"use strict";var e=require("react/jsx-runtime"),t=require("react"),n=require("@mantine/core"),r=require("@tabler/icons-react"),o=require("@mantine/form"),i=require("@mantine/notifications"),a=require("@mantine/modals"),s=require("axios"),c=require("@mantine/hooks"),l=function(){return l=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==s[0]&&2!==s[0])){i=0;continue}if(3===s[0]&&(!o||s[1]>o[0]&&s[1]0&&e.jsx(n.Stack,{align:"center",gap:"sm",w:"100%",children:I.map(function(t,r){return e.jsx(n.Button,{onClick:t.onClick,variant:t.variant||"filled",color:t.color,leftSection:t.leftSection,size:"sm",children:t.label},r)})})]})})},y=function(t){var o,i=t.opened,a=t.onClose,s=t.title,c=t.width,u=void 0===c?450:c,d=t.position,f=void 0===d?"right":d,p=t.headerActions,h=t.footer,m=t.children,x=t.zIndex,g=void 0===x?1e3:x,v=t.offsetTop,b=void 0===v?60:v,y=t.backgroundColor,j=void 0===y?"var(--mantine-color-body)":y,k=t.borderColor,w=void 0===k?"var(--mantine-color-gray-3)":k,C=t.animationDuration,S=void 0===C?"0.3s":C,I=t["aria-label"];return e.jsxs(n.Paper,{style:(o={position:"fixed",top:b,bottom:0,width:"".concat(u,"px"),zIndex:g,borderRadius:0,display:"flex",flexDirection:"column",backgroundColor:j,transition:"".concat(f," ").concat(S," ease")},l(l({},o),"right"===f?{right:i?0:"-".concat(u,"px"),borderLeft:"1px solid ".concat(w)}:{left:i?0:"-".concat(u,"px"),borderRight:"1px solid ".concat(w)})),role:"dialog","aria-modal":"true","aria-label":I||s,"aria-hidden":!i,children:[e.jsxs(n.Group,{justify:"space-between",p:"md",style:{borderBottom:"1px solid ".concat(w)},children:[e.jsx(n.Title,{order:4,style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:s}),p&&e.jsx(n.Group,{gap:"xs",children:p}),e.jsx(n.ActionIcon,{variant:"subtle",color:"gray",onClick:a,"aria-label":"Close sidebar",ml:"xs",children:e.jsx(r.IconX,{size:18})})]}),e.jsx(n.ScrollArea,{style:{flex:1},scrollbarSize:6,children:e.jsx(n.Box,{p:"md",children:m})}),h&&e.jsxs(e.Fragment,{children:[e.jsx(n.Divider,{}),e.jsx(n.Box,{p:"md",style:{borderTop:"1px solid ".concat(w)},children:h})]})]})},j=function(e){var t=[],n=[],r=[];e.forEach(function(e){"red"===e.color||e.key.includes("delete")||e.key.includes("remove")?r.push(e):e.key.includes("edit")||e.key.includes("view")||e.key.includes("copy")?t.push(e):n.push(e)});var o=[];return t.length>0&&o.push(t),n.length>0&&o.push(n),r.length>0&&o.push(r),o},k=function(e){return{key:"view",label:"View Details",icon:r.IconEye,onClick:e}},w=function(e){return{key:"edit",label:"Edit",icon:r.IconEdit,color:"blue",onClick:e}},C=function(e){return{key:"copy",label:"Duplicate",icon:r.IconCopy,onClick:e}},S=function(e,t){return void 0===t&&(t="item"),{key:"delete",label:"Delete",icon:r.IconTrash,color:"red",onClick:e,confirm:{title:"Confirm Delete",message:"Are you sure you want to delete this ".concat(t,"? This action cannot be undone."),confirmLabel:"Delete",cancelLabel:"Cancel"}}},I=function(t){var r=t.variant,o=void 0===r?"spinner":r,i=t.size,a=void 0===i?"md":i,s=t.height,c=void 0===s?200:s,l=t.message,u=t.submessage,d=t.progress,f=t.progressLabel,p=t.rows,h=void 0===p?5:p,m=t.columns,x=void 0===m?3:m,g=t.color,v=void 0===g?"blue":g,b=t.withContainer,y=void 0===b||b,j=t.animate,k=void 0===j||j,w=function(){return{xs:"xs",sm:"sm",md:"md",lg:"lg",xl:"xl"}[a]},C=function(){return e.jsxs(n.Stack,{align:"center",gap:"md",children:[e.jsx(n.Loader,{size:{xs:16,sm:24,md:32,lg:48,xl:64}[a],color:v}),l&&e.jsx(n.Text,{size:w(),c:"dimmed",ta:"center",children:l}),u&&e.jsx(n.Text,{size:"xs",c:"dimmed",ta:"center",children:u})]})},S=function(){switch(o){case"progress":return e.jsxs(n.Stack,{gap:"md",children:[(l||f)&&e.jsxs(n.Group,{justify:"space-between",children:[e.jsx(n.Text,{size:w(),children:l||"Loading..."}),f&&e.jsx(n.Text,{size:"sm",c:"dimmed",children:f})]}),e.jsx(n.Progress,{value:d||0,color:v,size:a,animated:k}),u&&e.jsx(n.Text,{size:"xs",c:"dimmed",ta:"center",children:u})]});case"skeleton-table":return e.jsxs(n.Stack,{gap:"xs",children:[e.jsx(n.Group,{gap:"md",children:Array.from({length:x}).map(function(t,r){return e.jsx(n.Skeleton,{height:20,width:"".concat(100/x,"%")},"header-".concat(r))})}),Array.from({length:h}).map(function(t,r){return e.jsx(n.Group,{gap:"md",children:Array.from({length:x}).map(function(t,o){return e.jsx(n.Skeleton,{height:16,width:"".concat(100/x,"%")},"cell-".concat(r,"-").concat(o))})},"row-".concat(r))})]});case"skeleton-cards":return e.jsx(n.SimpleGrid,{cols:{base:1,sm:2,lg:x},children:Array.from({length:h*x}).map(function(t,r){return e.jsx(n.Card,{padding:"md",withBorder:!0,children:e.jsxs(n.Stack,{gap:"xs",children:[e.jsx(n.Skeleton,{height:20,width:"70%"}),e.jsx(n.Skeleton,{height:14}),e.jsx(n.Skeleton,{height:14,width:"90%"}),e.jsxs(n.Group,{justify:"apart",mt:"md",children:[e.jsx(n.Skeleton,{height:12,width:"40%"}),e.jsx(n.Skeleton,{height:12,width:"30%"})]})]})},"card-".concat(r))})});case"skeleton-form":return e.jsxs(n.Stack,{gap:"md",children:[Array.from({length:h}).map(function(t,r){return e.jsxs(n.Box,{children:[e.jsx(n.Skeleton,{height:12,width:"30%",mb:"xs"}),e.jsx(n.Skeleton,{height:36})]},"form-field-".concat(r))}),e.jsxs(n.Group,{justify:"flex-end",mt:"xl",children:[e.jsx(n.Skeleton,{height:36,width:80}),e.jsx(n.Skeleton,{height:36,width:100})]})]});case"skeleton-text":return e.jsx(n.Stack,{gap:"xs",children:Array.from({length:h}).map(function(t,r){var o=["100%","95%","85%","90%","75%"];return e.jsx(n.Skeleton,{height:16,width:o[r%o.length]},"text-".concat(r))})});case"dots":return t=Array.from({length:3}).map(function(t,r){return e.jsx(n.Box,{w:8,h:8,bg:v,style:{borderRadius:"50%",animation:k?"loading-dots 1.4s infinite ease-in-out ".concat(.16*r,"s"):void 0}},r)}),e.jsxs(n.Stack,{align:"center",gap:"md",children:[e.jsx(n.Group,{gap:"xs",children:t}),l&&e.jsx(n.Text,{size:w(),c:"dimmed",ta:"center",children:l})]});case"overlay":return e.jsx(n.Box,{style:{position:"absolute",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(255, 255, 255, 0.8)",backdropFilter:"blur(2px)",zIndex:1e3},children:e.jsx(n.Center,{h:"100%",children:C()})});default:return C()}var t};if("overlay"===o)return e.jsxs(e.Fragment,{children:[S(),e.jsx("style",{children:A})]});var I=e.jsxs(e.Fragment,{children:[S(),k&&e.jsx("style",{children:A})]});return y?e.jsx(n.Center,{h:c,children:I}):I},A="\n @keyframes loading-dots {\n 0%, 80%, 100% {\n transform: scale(0);\n opacity: 0.5;\n }\n 40% {\n transform: scale(1);\n opacity: 1;\n }\n }\n",P=function(e,t){void 0===t&&(t="Success");var n={title:t,message:e,color:"green"};i.notifications.show(n)},T=function(e,t){void 0===t&&(t="Error");var n={title:t,message:e,color:"red"};i.notifications.show(n)},O={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"},z={success:function(e,t){var n=O["".concat(e,"Success")](t);P(n)},error:function(e,t,n){var r=n||O["".concat(e,"Error")](t);T(r)}},F={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},L={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)}};Object.defineProperty(exports,"ActionIcon",{enumerable:!0,get:function(){return n.ActionIcon}}),Object.defineProperty(exports,"Badge",{enumerable:!0,get:function(){return n.Badge}}),Object.defineProperty(exports,"Box",{enumerable:!0,get:function(){return n.Box}}),Object.defineProperty(exports,"Button",{enumerable:!0,get:function(){return n.Button}}),Object.defineProperty(exports,"Center",{enumerable:!0,get:function(){return n.Center}}),Object.defineProperty(exports,"Divider",{enumerable:!0,get:function(){return n.Divider}}),Object.defineProperty(exports,"Group",{enumerable:!0,get:function(){return n.Group}}),Object.defineProperty(exports,"JsonInput",{enumerable:!0,get:function(){return n.JsonInput}}),Object.defineProperty(exports,"LoadingOverlay",{enumerable:!0,get:function(){return n.LoadingOverlay}}),Object.defineProperty(exports,"Menu",{enumerable:!0,get:function(){return n.Menu}}),Object.defineProperty(exports,"MultiSelect",{enumerable:!0,get:function(){return n.MultiSelect}}),Object.defineProperty(exports,"NumberInput",{enumerable:!0,get:function(){return n.NumberInput}}),Object.defineProperty(exports,"Pagination",{enumerable:!0,get:function(){return n.Pagination}}),Object.defineProperty(exports,"Paper",{enumerable:!0,get:function(){return n.Paper}}),Object.defineProperty(exports,"ScrollArea",{enumerable:!0,get:function(){return n.ScrollArea}}),Object.defineProperty(exports,"Select",{enumerable:!0,get:function(){return n.Select}}),Object.defineProperty(exports,"Stack",{enumerable:!0,get:function(){return n.Stack}}),Object.defineProperty(exports,"Table",{enumerable:!0,get:function(){return n.Table}}),Object.defineProperty(exports,"Text",{enumerable:!0,get:function(){return n.Text}}),Object.defineProperty(exports,"TextInput",{enumerable:!0,get:function(){return n.TextInput}}),Object.defineProperty(exports,"Textarea",{enumerable:!0,get:function(){return n.Textarea}}),Object.defineProperty(exports,"Title",{enumerable:!0,get:function(){return n.Title}}),Object.defineProperty(exports,"IconAlertCircle",{enumerable:!0,get:function(){return r.IconAlertCircle}}),Object.defineProperty(exports,"IconCheck",{enumerable:!0,get:function(){return r.IconCheck}}),Object.defineProperty(exports,"IconChevronDown",{enumerable:!0,get:function(){return r.IconChevronDown}}),Object.defineProperty(exports,"IconChevronRight",{enumerable:!0,get:function(){return r.IconChevronRight}}),Object.defineProperty(exports,"IconCopy",{enumerable:!0,get:function(){return r.IconCopy}}),Object.defineProperty(exports,"IconDots",{enumerable:!0,get:function(){return r.IconDots}}),Object.defineProperty(exports,"IconEdit",{enumerable:!0,get:function(){return r.IconEdit}}),Object.defineProperty(exports,"IconEye",{enumerable:!0,get:function(){return r.IconEye}}),Object.defineProperty(exports,"IconEyeOff",{enumerable:!0,get:function(){return r.IconEyeOff}}),Object.defineProperty(exports,"IconFilter",{enumerable:!0,get:function(){return r.IconFilter}}),Object.defineProperty(exports,"IconInfoCircle",{enumerable:!0,get:function(){return r.IconInfoCircle}}),Object.defineProperty(exports,"IconKey",{enumerable:!0,get:function(){return r.IconKey}}),Object.defineProperty(exports,"IconPlus",{enumerable:!0,get:function(){return r.IconPlus}}),Object.defineProperty(exports,"IconRefresh",{enumerable:!0,get:function(){return r.IconRefresh}}),Object.defineProperty(exports,"IconSearch",{enumerable:!0,get:function(){return r.IconSearch}}),Object.defineProperty(exports,"IconSettings",{enumerable:!0,get:function(){return r.IconSettings}}),Object.defineProperty(exports,"IconTrash",{enumerable:!0,get:function(){return r.IconTrash}}),Object.defineProperty(exports,"IconUser",{enumerable:!0,get:function(){return r.IconUser}}),Object.defineProperty(exports,"IconUsers",{enumerable:!0,get:function(){return r.IconUsers}}),Object.defineProperty(exports,"IconX",{enumerable:!0,get:function(){return r.IconX}}),Object.defineProperty(exports,"useForm",{enumerable:!0,get:function(){return o.useForm}}),Object.defineProperty(exports,"notifications",{enumerable:!0,get:function(){return i.notifications}}),Object.defineProperty(exports,"modals",{enumerable:!0,get:function(){return a.modals}}),Object.defineProperty(exports,"useDisclosure",{enumerable:!0,get:function(){return c.useDisclosure}}),Object.defineProperty(exports,"useLocalStorage",{enumerable:!0,get:function(){return c.useLocalStorage}}),Object.defineProperty(exports,"useToggle",{enumerable:!0,get:function(){return c.useToggle}}),exports.ActionMenu=function(o){var s=o.item,c=o.actions,u=o.trigger,p=void 0===u?"dots":u,h=o.triggerLabel,m=void 0===h?"Actions":h,x=o.triggerIcon,g=void 0===x?r.IconDots:x,v=o.triggerProps,b=void 0===v?{}:v,y=o.customTrigger,k=o.position,w=void 0===k?"bottom-end":k,C=o.withArrow,S=void 0!==C&&C,I=o.withinPortal,A=void 0===I||I,P=o["aria-label"],T=c.filter(function(e){return!e.hidden&&!(e.show&&!e.show(s))}),O=j(T);if(0===T.length)return null;var z=function(t){var r=t.icon;return e.jsx(n.Menu.Item,{leftSection:r&&e.jsx(r,{size:14}),color:t.color,disabled:t.disabled,onClick:function(){return function(t){return d(void 0,void 0,void 0,function(){var r;return f(this,function(o){switch(o.label){case 0:return o.trys.push([0,4,,5]),t.confirm?[2,new Promise(function(r){a.modals.openConfirmModal({title:t.confirm.title,children:e.jsx(n.Text,{size:"sm",children:t.confirm.message}),labels:{confirm:t.confirm.confirmLabel||"Confirm",cancel:t.confirm.cancelLabel||"Cancel"},confirmProps:{color:t.color||"red"},onConfirm:function(){return d(void 0,void 0,void 0,function(){var e;return f(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,t.onClick(s)];case 1:return n.sent(),r(),[3,3];case 2:return e=n.sent(),console.error("Action ".concat(t.key," failed:"),e),i.notifications.show({title:"Action Failed",message:"Failed to ".concat(t.label.toLowerCase()),color:"red"}),[3,3];case 3:return[2]}})})},onCancel:function(){return r()}})})]:[3,1];case 1:return[4,t.onClick(s)];case 2:o.sent(),o.label=3;case 3:return[3,5];case 4:return r=o.sent(),console.error("Action ".concat(t.key," failed:"),r),i.notifications.show({title:"Action Failed",message:"Failed to ".concat(t.label.toLowerCase()),color:"red"}),[3,5];case 5:return[2]}})})}(t)},children:t.label},t.key)};return e.jsxs(n.Menu,{position:w,withArrow:S,withinPortal:A,children:[e.jsx(n.Menu.Target,{children:y||("button"===p?e.jsx(n.Button,l({variant:"light",size:"xs",leftSection:e.jsx(g,{size:16})},b,{children:m})):e.jsx(n.ActionIcon,l({variant:"subtle",color:"gray",size:"sm","aria-label":P||"".concat(m," menu")},b,{children:e.jsx(g,{size:16})})))}),e.jsx(n.Menu.Dropdown,{children:O.map(function(r,o){return e.jsxs(t.Fragment,{children:[r.map(z),o0)&&e.jsx(n.Table.Th,{style:{width:50},children:"Actions"})]})}),e.jsx(n.Table.Tbody,{children:s.map(function(t){return e.jsxs(n.Table.Tr,{children:[c.map(function(r){return e.jsx(n.Table.Td,{children:_(r,t)},"".concat(t.id,"-").concat(r.key))}),(S||I||T.length>0)&&e.jsx(n.Table.Td,{children:Z(t)})]},t.id)})})]})]}),Q>1&&e.jsx(n.Group,{justify:"center",children:e.jsx(n.Pagination,{total:Q,value:y,onChange:w,size:"sm"})})]})},exports.DetailsSidebar=function(t){var r=t.itemName,o=t.itemType,i=void 0===o?"Item":o,a=t.editButton,s=t.deleteButton,c=t.status,d=t.children,f=u(t,["itemName","itemType","editButton","deleteButton","status","children"]),p=e.jsxs(n.Group,{gap:"xs",children:[c,a,s]});return e.jsx(y,l({},f,{title:"".concat(i,": ").concat(r),headerActions:p,children:d}))},exports.EmptyState=b,exports.ErrorState=function(t){var n=t.onRetry,r=u(t,["onRetry"]);return e.jsx(b,l({},r,{variant:"error",onRefresh:n}))},exports.ExecutionStatusBadge=function(t){return e.jsx(x,l({},t,{variant:"execution"}))},exports.FormLoadingState=function(t){var n=t.fields,r=void 0===n?4:n;return e.jsx(I,{variant:"skeleton-form",rows:r,withContainer:!1})},exports.FormSidebar=function(a){var s=a.opened,c=a.onClose,u=a.onSuccess,p=a.title,h=a.editMode,m=void 0!==h&&h,x=a.editItem,g=a.fields,v=a.onSubmit,b=a.width,y=void 0===b?450:b,j=a.initialValues,k=void 0===j?{}:j;a.validateOnSubmit;var w,C=m&&!!x,S=function(){var e={};return g.forEach(function(t){var n;e[t.name]=null!==(n=t.defaultValue)&&void 0!==n?n:"multiselect"===t.type?[]:""}),l(l({},e),k)},I=o.useForm({initialValues:S(),validate:(w={},g.forEach(function(e){w[e.name]=function(t){var n,r,o,i,a,s;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.lengthe.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===(s=e.validation)||void 0===s?void 0:s.custom)?e.validation.custom(t):null}}),w)});t.useEffect(function(){if(C&&x){var e={};g.forEach(function(t){var n,r;e[t.name]=null!==(r=null!==(n=x[t.name])&&void 0!==n?n:t.defaultValue)&&void 0!==r?r:""}),I.setValues(e)}else C||I.setValues(S())},[x,s,C]);return e.jsxs(n.Paper,{style:{position:"fixed",top:60,right:s?0:"-".concat(y,"px"),bottom:0,width:"".concat(y,"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.jsxs(n.Group,{justify:"space-between",p:"md",style:{borderBottom:"1px solid var(--mantine-color-gray-3)"},children:[e.jsx(n.Title,{order:4,children:C?"Edit ".concat(p):"Create New ".concat(p)}),e.jsx(n.ActionIcon,{variant:"subtle",color:"gray",onClick:c,children:e.jsx(r.IconX,{size:18})})]}),e.jsx(n.ScrollArea,{style:{flex:1},children:e.jsx(n.Box,{p:"md",children:e.jsx("form",{onSubmit:I.onSubmit(function(e){return d(void 0,void 0,void 0,function(){var t,n,r;return f(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,v(e)];case 1:return o.sent(),t={title:"Success",message:"".concat(p," ").concat(C?"updated":"created"," successfully"),color:"green"},i.notifications.show(t),u(),c(),I.reset(),[3,3];case 2:return n=o.sent(),console.error("Error ".concat(C?"updating":"creating"," ").concat(p.toLowerCase(),":"),n),r={title:"Error",message:n.message||"Failed to ".concat(C?"update":"create"," ").concat(p.toLowerCase()),color:"red"},i.notifications.show(r),[3,3];case 3:return[2]}})})}),children:e.jsxs(n.Stack,{gap:"md",children:[g.map(function(t){var r=I.getInputProps(t.name),o=l({key:t.name,label:t.label,placeholder:t.placeholder,description:t.description,required:t.required,disabled:t.disabled||C&&"id"===t.name},r);switch(t.type){case"email":return e.jsx(n.TextInput,l({},o,{type:"email"}));case"number":return e.jsx(n.NumberInput,l({},o));case"textarea":return e.jsx(n.Textarea,l({},o,{autosize:!0,minRows:3,maxRows:6}));case"select":return e.jsx(n.Select,l({},o,{data:t.options||[]}));case"multiselect":return e.jsx(n.MultiSelect,l({},o,{data:t.options||[]}));case"json":return e.jsx(n.JsonInput,l({},o,{validationError:"Invalid JSON format",formatOnBlur:!0,autosize:!0,minRows:3}));default:return e.jsx(n.TextInput,l({},o))}}),e.jsxs(n.Group,{justify:"flex-end",mt:"md",children:[e.jsx(n.Button,{variant:"light",onClick:c,children:"Cancel"}),e.jsxs(n.Button,{type:"submit",children:[C?"Update":"Create"," ",p]})]})]})})})})]})},exports.FormSidebarWrapper=function(t){var r=t.children,o=t.cancelLabel,i=void 0===o?"Cancel":o,a=t.submitLabel,s=void 0===a?"Save":a,c=t.onCancel,d=t.onSubmit,f=t.submitDisabled,p=void 0!==f&&f,h=t.showFooterActions,m=void 0===h||h,x=t.onClose,g=u(t,["children","cancelLabel","submitLabel","onCancel","onSubmit","submitDisabled","showFooterActions","onClose"]),v=m?e.jsxs(n.Group,{justify:"flex-end",gap:"sm",children:[e.jsx(n.ActionIcon,{variant:"subtle",onClick:function(){null==c||c(),x()},size:"sm",children:i}),e.jsx(n.ActionIcon,{onClick:d,disabled:p,size:"sm",children:s})]}):void 0;return e.jsx(y,l({},g,{onClose:x,footer:v,children:r}))},exports.InlineLoadingState=function(t){var r=t.message,o=void 0===r?"Loading...":r,i=t.size,a=void 0===i?"sm":i;return e.jsxs(n.Group,{gap:"xs",children:[e.jsx(n.Loader,{size:"xs"===a?12:"sm"===a?16:20}),e.jsx(n.Text,{size:a,c:"dimmed",children:o})]})},exports.LoadingState=I,exports.NoApplicationsState=function(t){var n=t.onCreateApp,r=u(t,["onCreateApp"]);return e.jsx(b,l({},r,{variant:"no-data",context:"applications",onAdd:n}))},exports.NoFunctionsState=function(t){var n=t.onCreateFunction,r=u(t,["onCreateFunction"]);return e.jsx(b,l({},r,{variant:"no-data",context:"functions",onAdd:n}))},exports.NoSearchResults=function(t){var n=t.onClearFilters,r=t.onRefresh,o=u(t,["onClearFilters","onRefresh"]);return e.jsx(b,l({},o,{variant:"no-results",onClearFilters:n,onRefresh:r}))},exports.NoTokensState=function(t){var n=t.onGenerateToken,r=u(t,["onGenerateToken"]);return e.jsx(b,l({},r,{variant:"no-data",context:"tokens",onAdd:n}))},exports.NoUsersState=function(t){var n=t.onAddUser,r=u(t,["onAddUser"]);return e.jsx(b,l({},r,{variant:"no-data",context:"users",onAdd:n}))},exports.NotificationMessages=O,exports.PageLoadingState=function(t){var n=t.message,r=void 0===n?"Loading page...":n;return e.jsx(I,{variant:"spinner",message:r,height:"60vh",size:"lg"})},exports.QuickSidebar=function(t){var n=t.content,r=t.actions,o=u(t,["content","actions"]);return e.jsx(y,l({},o,{footer:r,children:n}))},exports.RuntimeBadge=function(t){return e.jsx(x,l({},t,{variant:"runtime"}))},exports.SeverityBadge=function(t){return e.jsx(x,l({},t,{variant:"severity"}))},exports.Sidebar=y,exports.StatusBadge=x,exports.TableLoadingState=function(t){var n=t.rows,r=void 0===n?5:n,o=t.columns,i=void 0===o?4:o;return e.jsx(I,{variant:"skeleton-table",rows:r,columns:i,withContainer:!1})},exports.UserRoleBadge=function(t){return e.jsx(x,l({},t,{variant:"role"}))},exports.ValidationMessages=L,exports.ValidationPatterns=F,exports.combineValidators=function(){for(var e=[],t=0;t0?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,f,c,o]);return{filteredData:v,filters:c,setFilter:m,clearFilters:x,resetFilters:g,searchTerm:f,setSearchTerm:h}},exports.useLoadingState=function(e){void 0===e&&(e=!1);var n=t.useState(e),r=n[0],o=n[1],i=t.useState(0),a=i[0],s=i[1];return{loading:r,progress:a,startLoading:t.useCallback(function(){return o(!0)},[]),stopLoading:t.useCallback(function(){o(!1),s(0)},[]),updateProgress:t.useCallback(function(e){s(Math.max(0,Math.min(100,e)))},[]),setLoading:o,setProgress:s}},exports.useSidebar=function(e){void 0===e&&(e=!1);var n=t.useState(e),r=n[0],o=n[1];return{opened:r,open:t.useCallback(function(){return o(!0)},[]),close:t.useCallback(function(){return o(!1)},[]),toggle:t.useCallback(function(){return o(function(e){return!e})},[]),setOpened:o}},exports.validateAppId=function(e){return e?F.appId.test(e)?null:L.appId:null},exports.validateDuration=function(e){return e?F.duration.test(e)?null:L.duration:null},exports.validateEmail=function(e){return e?F.email.test(e)?null:L.email:null},exports.validateJsonString=function(e){if(!e||""===e.trim())return null;try{return JSON.parse(e),null}catch(e){return"Invalid JSON format"}},exports.validateMaxLength=function(e,t,n){return void 0===n&&(n="Field"),e?e.length<=t?null:L.maxLength(n,t):null},exports.validateMinLength=function(e,t,n){return void 0===n&&(n="Field"),e?e.length>=t?null:L.minLength(n,t):null},exports.validatePattern=function(e,t,n){return void 0===n&&(n="Field"),e?t.test(e)?null:L.pattern(n):null},exports.validateRange=function(e,t,n,r){return void 0===r&&(r="Field"),null==e?null:en?L.range(r,t,n):null},exports.validateRequired=function(e){return null==e||""===e||Array.isArray(e)&&0===e.length?"This field is required":null},exports.validateToken=function(e){return e?F.token.test(e)?null:L.token:null},exports.validateUrl=function(e){return e?F.url.test(e)?null:L.url:null},exports.validateUuid=function(e){return e?F.uuid.test(e)?null:L.uuid:null}; //# sourceMappingURL=index.js.map