Files
skybridge/web-components/dist/index.esm.js
2025-08-31 23:27:52 -04:00

3 lines
21 KiB
JavaScript

import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useEffect as n,useState as r,useCallback as o,useMemo as i}from"react";import{Paper as a,Group as c,Title as l,ActionIcon as u,ScrollArea as s,Box as d,Stack as f,Button as h,TextInput as m,JsonInput as v,MultiSelect as p,Select as g,Textarea as y,NumberInput as b,Text as w,LoadingOverlay as x,Center as I,Table as C,Pagination as S,Badge as k,Menu as E}from"@mantine/core";export{ActionIcon,Badge,Box,Button,Center,Divider,Group,JsonInput,LoadingOverlay,Menu,MultiSelect,NumberInput,Pagination,Paper,ScrollArea,Select,Stack,Table,Text,TextInput,Textarea,Title}from"@mantine/core";import{IconX as F,IconRefresh as A,IconPlus as T,IconSearch as L,IconFilter as z,IconEdit as D,IconTrash as P,IconDots as U}from"@tabler/icons-react";export{IconAlertCircle,IconCheck,IconChevronDown,IconChevronRight,IconCopy,IconDots,IconEdit,IconEye,IconEyeOff,IconFilter,IconInfoCircle,IconKey,IconPlus,IconRefresh,IconSearch,IconSettings,IconTrash,IconUser,IconUsers,IconX}from"@tabler/icons-react";import{useForm as O}from"@mantine/form";export{useForm}from"@mantine/form";import{notifications as j}from"@mantine/notifications";export{notifications}from"@mantine/notifications";import{modals as R}from"@mantine/modals";export{modals}from"@mantine/modals";import q from"axios";export{useDisclosure,useLocalStorage,useToggle}from"@mantine/hooks";var M=function(){return M=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},M.apply(this,arguments)};function B(e,t,n,r){return new(n||(n=Promise))(function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function c(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n(function(e){e(t)})).then(a,c)}l((r=r.apply(e,t||[])).next())})}function N(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},a=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return a.next=c(0),a.throw=c(1),a.return=c(2),"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(c){return function(l){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;a&&(a=0,c[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&c[0]?r.return:c[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,c[1])).done)return o;switch(r=0,o&&(c=[2&c[0],o.value]),c[0]){case 0:case 1:o=c;break;case 4:return i.label++,{value:c[1],done:!1};case 5:i.label++,r=c[1],c=[0];continue;case 7:c=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==c[0]&&2!==c[0])){i=0;continue}if(3===c[0]&&(!o||c[1]>o[0]&&c[1]<o[3])){i.label=c[1];break}if(6===c[0]&&i.label<o[1]){i.label=o[1],o=c;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(c);break}o[2]&&i.ops.pop(),i.trys.pop();continue}c=t.call(e,i)}catch(e){c=[6,e],r=0}finally{n=o=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,l])}}}function $(e,t,n){if(n||2===arguments.length)for(var r,o=0,i=t.length;o<i;o++)!r&&o in t||(r||(r=Array.prototype.slice.call(t,0,o)),r[o]=t[o]);return e.concat(r||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var V=function(r){var o=r.opened,i=r.onClose,w=r.onSuccess,x=r.title,I=r.editMode,C=void 0!==I&&I,S=r.editItem,k=r.fields,E=r.onSubmit,A=r.width,T=void 0===A?450:A,L=r.initialValues,z=void 0===L?{}:L;r.validateOnSubmit;var D,P=C&&!!S,U=function(){var e={};return k.forEach(function(t){var n;e[t.name]=null!==(n=t.defaultValue)&&void 0!==n?n:"multiselect"===t.type?[]:""}),M(M({},e),z)},R=O({initialValues:U(),validate:(D={},k.forEach(function(e){D[e.name]=function(t){var n,r,o,i,a,c;return e.required&&(!t||"string"==typeof t&&""===t.trim())?"".concat(e.label," is required"):(null===(n=e.validation)||void 0===n?void 0:n.email)&&t&&!/^\S+@\S+$/.test(t)?"Invalid email format":(null===(r=e.validation)||void 0===r?void 0:r.url)&&t&&!/^https?:\/\/.+/.test(t)?"Invalid URL format":(null===(o=e.validation)||void 0===o?void 0:o.minLength)&&t&&t.length<e.validation.minLength?"".concat(e.label," must be at least ").concat(e.validation.minLength," characters"):(null===(i=e.validation)||void 0===i?void 0:i.maxLength)&&t&&t.length>e.validation.maxLength?"".concat(e.label," must be no more than ").concat(e.validation.maxLength," characters"):(null===(a=e.validation)||void 0===a?void 0:a.pattern)&&t&&!e.validation.pattern.test(t)?"".concat(e.label," format is invalid"):(null===(c=e.validation)||void 0===c?void 0:c.custom)?e.validation.custom(t):null}}),D)});n(function(){if(P&&S){var e={};k.forEach(function(t){var n,r;e[t.name]=null!==(r=null!==(n=S[t.name])&&void 0!==n?n:t.defaultValue)&&void 0!==r?r:""}),R.setValues(e)}else P||R.setValues(U())},[S,o,P]);return e(a,{style:{position:"fixed",top:60,right:o?0:"-".concat(T,"px"),bottom:0,width:"".concat(T,"px"),zIndex:1e3,borderRadius:0,display:"flex",flexDirection:"column",borderLeft:"1px solid var(--mantine-color-gray-3)",backgroundColor:"var(--mantine-color-body)",transition:"right 0.3s ease"},children:[e(c,{justify:"space-between",p:"md",style:{borderBottom:"1px solid var(--mantine-color-gray-3)"},children:[t(l,{order:4,children:P?"Edit ".concat(x):"Create New ".concat(x)}),t(u,{variant:"subtle",color:"gray",onClick:i,children:t(F,{size:18})})]}),t(s,{style:{flex:1},children:t(d,{p:"md",children:t("form",{onSubmit:R.onSubmit(function(e){return B(void 0,void 0,void 0,function(){var t,n,r;return N(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,E(e)];case 1:return o.sent(),t={title:"Success",message:"".concat(x," ").concat(P?"updated":"created"," successfully"),color:"green"},j.show(t),w(),i(),R.reset(),[3,3];case 2:return n=o.sent(),console.error("Error ".concat(P?"updating":"creating"," ").concat(x.toLowerCase(),":"),n),r={title:"Error",message:n.message||"Failed to ".concat(P?"update":"create"," ").concat(x.toLowerCase()),color:"red"},j.show(r),[3,3];case 3:return[2]}})})}),children:e(f,{gap:"md",children:[k.map(function(e){var n=R.getInputProps(e.name),r=M({key:e.name,label:e.label,placeholder:e.placeholder,description:e.description,required:e.required,disabled:e.disabled||P&&"id"===e.name},n);switch(e.type){case"email":return t(m,M({},r,{type:"email"}));case"number":return t(b,M({},r));case"textarea":return t(y,M({},r,{autosize:!0,minRows:3,maxRows:6}));case"select":return t(g,M({},r,{data:e.options||[]}));case"multiselect":return t(p,M({},r,{data:e.options||[]}));case"json":return t(v,M({},r,{validationError:"Invalid JSON format",formatOnBlur:!0,autosize:!0,minRows:3}));default:return t(m,M({},r))}}),e(c,{justify:"flex-end",mt:"md",children:[t(h,{variant:"light",onClick:i,children:"Cancel"}),e(h,{type:"submit",children:[P?"Update":"Create"," ",x]})]})]})})})})]})},J=function(o){var i=o.data,l=o.columns,s=o.loading,d=void 0!==s&&s,v=o.error,p=void 0===v?null:v,g=o.title,y=o.total,b=void 0===y?0:y,F=o.page,O=void 0===F?1:F,q=o.pageSize,$=void 0===q?10:q,V=o.onPageChange,J=o.onAdd,H=o.onEdit,_=o.onDelete,G=o.onRefresh,X=o.customActions,Z=void 0===X?[]:X,K=o.searchable,W=void 0===K||K,Y=o.filterable,Q=void 0!==Y&&Y,ee=o.filters,te=void 0===ee?{}:ee,ne=o.onFiltersChange,re=o.withBorder,oe=void 0===re||re,ie=o.withColumnBorders,ae=void 0!==ie&&ie,ce=o.striped,le=void 0===ce||ce,ue=o.highlightOnHover,se=void 0===ue||ue,de=o.emptyMessage,fe=void 0===de?"No data available":de,he=r(te),me=he[0],ve=he[1];n(function(){ve(te)},[te]);var pe=function(e){!function(e,t){var n,r=M(M({},me),((n={})[e]=t,n));ve(r),null==ne||ne(r)}("search",e)},ge=function(e,n){var r=n[e.key];if(e.render)return e.render(r,n);if(null==r)return t(w,{c:"dimmed",children:"-"});if("boolean"==typeof r)return t(k,{color:r?"green":"gray",size:"sm",children:r?"Yes":"No"});if("status"===e.key){return t(k,{color:{active:"green",inactive:"gray",pending:"yellow",suspended:"red",success:"green",error:"red",warning:"yellow"}[r]||"blue",size:"sm",children:r})}return t(w,{children:r.toString()})},ye=function(n){var r=[];H&&r.push({key:"edit",label:"Edit",icon:t(D,{size:14}),onClick:H}),_&&r.push({key:"delete",label:"Delete",icon:t(P,{size:14}),color:"red",onClick:function(){return function(e){R.openConfirmModal({title:"Confirm Delete",children:t(w,{size:"sm",children:"Are you sure you want to delete this item? This action cannot be undone."}),labels:{confirm:"Delete",cancel:"Cancel"},confirmProps:{color:"red"},onConfirm:function(){return B(void 0,void 0,void 0,function(){var t;return N(this,function(n){switch(n.label){case 0:return n.trys.push([0,3,,4]),_?[4,_(e)]:[3,2];case 1:n.sent(),j.show({title:"Success",message:"Item deleted successfully",color:"green"}),n.label=2;case 2:return[3,4];case 3:return t=n.sent(),j.show({title:"Error",message:t.message||"Failed to delete item",color:"red"}),[3,4];case 4:return[2]}})})}})}(n)}}),r.push.apply(r,Z);var o=r.filter(function(e){return!e.show||e.show(n)});return 0===o.length?null:e(E,{position:"bottom-end",children:[t(E.Target,{children:t(u,{variant:"subtle",color:"gray",children:t(U,{size:16})})}),t(E.Dropdown,{children:o.map(function(e){return t(E.Item,{leftSection:e.icon,color:e.color,onClick:function(){return e.onClick(n)},children:e.label},e.key)})})]})},be=Math.ceil(b/$);return e(f,{gap:"md",children:[e(c,{justify:"space-between",children:[t(c,{children:g&&t(w,{size:"xl",fw:600,children:g})}),e(c,{children:[G&&t(u,{variant:"light",onClick:G,children:t(A,{size:16})}),J&&t(h,{leftSection:t(T,{size:16}),onClick:J,children:"Add New"})]})]}),(W||Q)&&e(c,{children:[W&&t(m,{placeholder:"Search...",leftSection:t(L,{size:16}),value:me.search||"",onChange:function(e){return pe(e.currentTarget.value)},style:{flex:1}}),Q&&t(c,{children:t(u,{variant:"light",children:t(z,{size:16})})})]}),e(a,{withBorder:oe,pos:"relative",children:[t(x,{visible:d}),p?t(I,{p:"xl",children:e(f,{align:"center",gap:"xs",children:[t(w,{c:"red",fw:500,children:"Error loading data"}),t(w,{c:"dimmed",size:"sm",children:p}),G&&t(h,{variant:"light",size:"sm",onClick:G,children:"Try Again"})]})}):0===i.length?t(I,{p:"xl",children:e(f,{align:"center",gap:"xs",children:[t(w,{c:"dimmed",children:fe}),J&&t(h,{variant:"light",size:"sm",onClick:J,children:"Add First Item"})]})}):e(C,{striped:le,highlightOnHover:se,withColumnBorders:ae,children:[t(C.Thead,{children:e(C.Tr,{children:[l.map(function(e){return t(C.Th,{style:{width:e.width},children:e.label},e.key)}),(H||_||Z.length>0)&&t(C.Th,{style:{width:50},children:"Actions"})]})}),t(C.Tbody,{children:i.map(function(n){return e(C.Tr,{children:[l.map(function(e){return t(C.Td,{children:ge(e,n)},"".concat(n.id,"-").concat(e.key))}),(H||_||Z.length>0)&&t(C.Td,{children:ye(n)})]},n.id)})})]})]}),be>1&&t(c,{justify:"center",children:t(S,{total:be,value:O,onChange:V,size:"sm"})})]})},H=function(e,t){var n=r([]),i=n[0],a=n[1],c=r(!1),l=c[0],u=c[1],s=r(null),d=s[0],f=s[1],h=r(0),m=h[0],v=h[1],p=r(!1),g=p[0],y=p[1],b=q.create({baseURL:e.baseURL,timeout:e.timeout||1e4,headers:M({"Content-Type":"application/json"},e.defaultHeaders)});b.interceptors.request.use(function(e){return e.headers["X-User-Email"]="admin@example.com",e},function(e){return Promise.reject(e)}),b.interceptors.response.use(function(e){return e},function(e){var t,n,r=(null===(n=null===(t=e.response)||void 0===t?void 0:t.data)||void 0===n?void 0:n.message)||e.message||"An error occurred";return f(r),Promise.reject(e)});var w=o(function(){f(null)},[]),x=o(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return B(void 0,$([],e,!0),void 0,function(e){var n,r,o,i,c,l,s,d;return void 0===e&&(e={}),N(this,function(h){switch(h.label){case 0:u(!0),f(null),h.label=1;case 1:return h.trys.push([1,3,4,5]),n=new URLSearchParams,Object.entries(e).forEach(function(e){var t=e[0],r=e[1];null!=r&&""!==r&&n.append(t,r.toString())}),[4,b.get("".concat(t,"?").concat(n.toString()))];case 2:if("data"in(r=h.sent()).data&&Array.isArray(r.data.data))return o=r.data,a(o.data),v(o.total),y(o.has_more||!1),[2,o.data];if("data"in r.data&&Array.isArray(r.data.data))return i=r.data,a(i.data),v(i.data.length),y(!1),[2,i.data];if(Array.isArray(r.data))return a(r.data),v(r.data.length),y(!1),[2,r.data];throw new Error("Invalid response format");case 3:throw c=h.sent(),l=(null===(d=null===(s=c.response)||void 0===s?void 0:s.data)||void 0===d?void 0:d.message)||c.message||"Failed to fetch data",f(l),c;case 4:return u(!1),[7];case 5:return[2]}})})},[b,t]),I=o(function(e){return B(void 0,void 0,void 0,function(){var n,r,o,i,a;return N(this,function(c){switch(c.label){case 0:u(!0),f(null),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,b.get("".concat(t,"/").concat(e))];case 2:return n=c.sent(),[2,"data"in n.data?n.data.data:n.data];case 3:throw r=c.sent(),o=(null===(a=null===(i=r.response)||void 0===i?void 0:i.data)||void 0===a?void 0:a.message)||r.message||"Failed to fetch item",f(o),r;case 4:return u(!1),[7];case 5:return[2]}})})},[b,t]),C=o(function(e){return B(void 0,void 0,void 0,function(){var n,r,o,i,c,l;return N(this,function(s){switch(s.label){case 0:u(!0),f(null),s.label=1;case 1:return s.trys.push([1,3,4,5]),[4,b.post(t,e)];case 2:return n=s.sent(),r="data"in n.data?n.data.data:n.data,a(function(e){return $($([],e,!0),[r],!1)}),v(function(e){return e+1}),[2,r];case 3:throw o=s.sent(),i=(null===(l=null===(c=o.response)||void 0===c?void 0:c.data)||void 0===l?void 0:l.message)||o.message||"Failed to create item",f(i),o;case 4:return u(!1),[7];case 5:return[2]}})})},[b,t]),S=o(function(e,n){return B(void 0,void 0,void 0,function(){var r,o,i,c,l,s;return N(this,function(d){switch(d.label){case 0:u(!0),f(null),d.label=1;case 1:return d.trys.push([1,3,4,5]),[4,b.put("".concat(t,"/").concat(e),n)];case 2:return r=d.sent(),o="data"in r.data?r.data.data:r.data,a(function(t){return t.map(function(t){return t.id===e?o:t})}),[2,o];case 3:throw i=d.sent(),c=(null===(s=null===(l=i.response)||void 0===l?void 0:l.data)||void 0===s?void 0:s.message)||i.message||"Failed to update item",f(c),i;case 4:return u(!1),[7];case 5:return[2]}})})},[b,t]),k=o(function(e){return B(void 0,void 0,void 0,function(){var n,r,o,i;return N(this,function(c){switch(c.label){case 0:u(!0),f(null),c.label=1;case 1:return c.trys.push([1,3,4,5]),[4,b.delete("".concat(t,"/").concat(e))];case 2:return c.sent(),a(function(t){return t.filter(function(t){return t.id!==e})}),v(function(e){return e-1}),[3,5];case 3:throw n=c.sent(),r=(null===(i=null===(o=n.response)||void 0===o?void 0:o.data)||void 0===i?void 0:i.message)||n.message||"Failed to delete item",f(r),n;case 4:return u(!1),[7];case 5:return[2]}})})},[b,t]),E=o(function(){return B(void 0,void 0,void 0,function(){return N(this,function(e){switch(e.label){case 0:return[4,x()];case 1:return e.sent(),[2]}})})},[x]);return{data:i,loading:l,error:d,total:m,hasMore:g,client:b,getAll:x,getById:I,create:C,update:S,delete:k,clearError:w,refresh:E}},_=function(e,t){void 0===t&&(t={});var n=t.searchFields,a=void 0===n?["name","title","email","description"]:n,c=t.defaultFilters,l=void 0===c?{}:c,u=r(l),s=u[0],d=u[1],f=r(""),h=f[0],m=f[1],v=o(function(e,t){"search"===e?(m(t),d(function(e){return M(M({},e),{search:t})})):d(function(n){var r;return M(M({},n),((r={})[e]=t,r))})},[]),p=o(function(){d({}),m("")},[]),g=o(function(){d(l),m("")},[l]),y=i(function(){var t=$([],e,!0);if(h.trim()){var n=h.toLowerCase().trim();t=t.filter(function(e){return a.some(function(t){var r=e[t];return!!r&&r.toString().toLowerCase().includes(n)})})}return Object.entries(s).forEach(function(e){var n=e[0],r=e[1];"search"!==n&&null!=r&&""!==r&&(t=Array.isArray(r)&&r.length>0?t.filter(function(e){return r.includes(e[n])}):t.filter(function(e){var t=e[n];return null!=t&&(t.toString().toLowerCase()===r.toString().toLowerCase()||"string"==typeof t&&"string"==typeof r&&t.toLowerCase().includes(r.toLowerCase()))}))}),t},[e,h,s,a]);return{filteredData:y,filters:s,setFilter:v,clearFilters:p,resetFilters:g,searchTerm:h,setSearchTerm:m}},G=function(e,t){void 0===t&&(t="Success");var n={title:t,message:e,color:"green"};j.show(n)},X=function(e,t){void 0===t&&(t="Error");var n={title:t,message:e,color:"red"};j.show(n)},Z=function(e,t){void 0===t&&(t="Warning");var n={title:t,message:e,color:"yellow"};j.show(n)},K=function(e,t){void 0===t&&(t="Info");var n={title:t,message:e,color:"blue"};j.show(n)},W={createSuccess:function(e){return"".concat(e," created successfully")},updateSuccess:function(e){return"".concat(e," updated successfully")},deleteSuccess:function(e){return"".concat(e," deleted successfully")},createError:function(e){return"Failed to create ".concat(e)},updateError:function(e){return"Failed to update ".concat(e)},deleteError:function(e){return"Failed to delete ".concat(e)},loadError:function(e){return"Failed to load ".concat(e)},networkError:"Network error occurred. Please try again.",validationError:"Please check the form for errors",requiredFieldError:function(e){return"".concat(e," is required")},authRequired:"Authentication required",permissionDenied:"Permission denied",sessionExpired:"Session expired. Please log in again.",applicationCreated:"Application created successfully",applicationUpdated:"Application updated successfully",applicationDeleted:"Application deleted successfully",tokenCreated:"Token created successfully",tokenRevoked:"Token revoked successfully",userCreated:"User created successfully",userUpdated:"User updated successfully",userDeleted:"User deleted successfully",functionCreated:"Function created successfully",functionUpdated:"Function updated successfully",functionDeleted:"Function deleted successfully",executionStarted:"Function execution started",executionCompleted:"Function execution completed",executionFailed:"Function execution failed"},Y={success:function(e,t){var n=W["".concat(e,"Success")](t);G(n)},error:function(e,t,n){var r=n||W["".concat(e,"Error")](t);X(r)}},Q={email:/^\S+@\S+\.\S+$/,url:/^https?:\/\/.+/,duration:/^\d+[smhd]$/,token:/^[a-zA-Z0-9_-]+$/,appId:/^[a-zA-Z0-9-_]+$/,uuid:/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i},ee={required:function(e){return"".concat(e," is required")},email:"Please enter a valid email address",url:"Please enter a valid URL (http:// or https://)",duration:"Duration must be in format like 30s, 5m, 2h, 1d",minLength:function(e,t){return"".concat(e," must be at least ").concat(t," characters")},maxLength:function(e,t){return"".concat(e," must be no more than ").concat(t," characters")},pattern:function(e){return"".concat(e," format is invalid")},token:"Token can only contain letters, numbers, underscores and hyphens",appId:"App ID can only contain letters, numbers, hyphens and underscores",uuid:"Please enter a valid UUID",positiveNumber:"Must be a positive number",range:function(e,t,n){return"".concat(e," must be between ").concat(t," and ").concat(n)}},te=function(e){return null==e||""===e||Array.isArray(e)&&0===e.length?"This field is required":null},ne=function(e){return e?Q.email.test(e)?null:ee.email:null},re=function(e){return e?Q.url.test(e)?null:ee.url:null},oe=function(e){return e?Q.duration.test(e)?null:ee.duration:null},ie=function(e,t,n){return void 0===n&&(n="Field"),e?e.length>=t?null:ee.minLength(n,t):null},ae=function(e,t,n){return void 0===n&&(n="Field"),e?e.length<=t?null:ee.maxLength(n,t):null},ce=function(e,t,n){return void 0===n&&(n="Field"),e?t.test(e)?null:ee.pattern(n):null},le=function(e,t,n,r){return void 0===r&&(r="Field"),null==e?null:e<t||e>n?ee.range(r,t,n):null},ue=function(e){return e?Q.appId.test(e)?null:ee.appId:null},se=function(e){return e?Q.token.test(e)?null:ee.token:null},de=function(e){return e?Q.uuid.test(e)?null:ee.uuid:null},fe=function(e){if(!e||""===e.trim())return null;try{return JSON.parse(e),null}catch(e){return"Invalid JSON format"}},he=function(e){var t=e.match(/^(\d+)([smhd]?)$/);if(!t)return 86400;var n=parseInt(t[1]);switch(t[2]||"h"){case"s":return n;case"m":return 60*n;case"h":default:return 3600*n;case"d":return 86400*n}},me=function(e){return e<60?"".concat(e,"s"):e<3600?"".concat(Math.floor(e/60),"m"):e<86400?"".concat(Math.floor(e/3600),"h"):"".concat(Math.floor(e/86400),"d")},ve=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return function(t){for(var n=0,r=e;n<r.length;n++){var o=(0,r[n])(t);if(o)return o}return null}};export{J as DataTable,V as FormSidebar,W as NotificationMessages,ee as ValidationMessages,Q as ValidationPatterns,ve as combineValidators,me as formatDuration,he as parseDuration,Y as showCrudNotification,X as showErrorNotification,K as showInfoNotification,G as showSuccessNotification,Z as showWarningNotification,H as useApiService,_ as useDataFilter,ue as validateAppId,oe as validateDuration,ne as validateEmail,fe as validateJsonString,ae as validateMaxLength,ie as validateMinLength,ce as validatePattern,le as validateRange,te as validateRequired,se as validateToken,re as validateUrl,de as validateUuid};
//# sourceMappingURL=index.esm.js.map