@object-ui/components 7.2.0 → 7.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/index.js +1624 -1568
- package/dist/index.umd.cjs +2 -2
- package/package.json +5 -5
package/dist/index.umd.cjs
CHANGED
|
@@ -15,5 +15,5 @@ ${n.map(([e,n])=>{let r=n.theme?.[t]||n.color;return r?` --color-${e}: ${r};`:n
|
|
|
15
15
|
0% { transform: translateX(-100%); }
|
|
16
16
|
100% { transform: translateX(400%); }
|
|
17
17
|
}
|
|
18
|
-
`,document.head.appendChild(t),Ks=!0}var Js=({active:e,ariaLabel:t=`Refreshing`,className:n,...r})=>(a.useEffect(()=>{e&&qs()},[e]),e?(0,o.jsx)(`div`,{className:R(`pointer-events-none absolute inset-x-0 top-0 z-20 h-0.5 overflow-hidden`,n),role:`progressbar`,"aria-busy":`true`,"aria-label":t,"data-testid":`refresh-indicator`,...r,children:(0,o.jsx)(`div`,{className:`h-full w-1/4 rounded-full bg-primary/70`,style:{animation:`objui-refresh-bar 1.1s ease-in-out infinite`}})}):null);Js.displayName=`RefreshIndicator`;function Ys({className:e,message:t=`Loading…`,...n}){return(0,o.jsxs)(`div`,{role:`status`,"aria-label":t,"data-slot":`data-loading-state`,className:R(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...n,children:[(0,o.jsx)(c.Loader2,{className:`size-6 animate-spin text-muted-foreground`}),t&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}function Xs({className:e,icon:t,illustration:n,showIcon:r=!0,iconWrapperClassName:i,title:a=`No data`,description:s,action:l,children:u,...d}){let f=r&&(t!=null||!n);return(0,o.jsxs)(`div`,{"data-slot":`data-empty-state`,className:R(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...d,children:[n&&(0,o.jsx)(`div`,{"data-slot":`data-empty-state-illustration`,className:`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:zoom-in-95 motion-safe:duration-300 [&_svg]:max-h-40 [&_svg]:w-auto`,"aria-hidden":!0,children:n}),f&&(0,o.jsx)(`div`,{"data-slot":`data-empty-state-icon`,className:R(i??`flex size-10 items-center justify-center rounded-lg bg-muted`),children:t??(0,o.jsx)(c.InboxIcon,{className:`size-5 text-muted-foreground`})}),a&&(0,o.jsx)(`h3`,{className:`text-sm font-medium`,children:a}),s&&(0,o.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:s}),l,u]})}function Zs({className:e,title:t=`Something went wrong`,message:n,onRetry:r,retryLabel:i=`Retry`,children:a,...s}){return(0,o.jsxs)(`div`,{role:`alert`,"data-slot":`data-error-state`,className:R(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...s,children:[(0,o.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-lg bg-destructive/10`,children:(0,o.jsx)(c.AlertCircle,{className:`size-5 text-destructive`})}),t&&(0,o.jsx)(`h3`,{className:`text-sm font-medium`,children:t}),n&&(0,o.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:n}),r&&(0,o.jsx)(B,{variant:`outline`,size:`sm`,onClick:r,children:i}),a]})}var Qs=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(kt,{children:[(0,o.jsx)(jt,{}),(0,o.jsxs)(b.Content,{ref:r,className:R(`fixed inset-0 z-50 w-full bg-background p-4 shadow-lg duration-200`,`h-[100dvh]`,`sm:inset-auto sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%]`,`sm:max-w-lg sm:h-auto sm:max-h-[90vh] sm:rounded-lg sm:border sm:p-6`,`data-[state=open]:animate-in data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,`data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,`data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]`,`data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`,e),...n,children:[t,(0,o.jsxs)(b.Close,{className:R(`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity`,`hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,`disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,`min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 flex items-center justify-center`),children:[(0,o.jsx)(c.X,{className:`h-5 w-5 sm:h-4 sm:w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Qs.displayName=`MobileDialogContent`;function $s(e){return!e&&e!==0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function ec({open:e,onOpenChange:t,job:n,title:r,description:i,filename:s,allowCloseWhileRunning:l=!0,className:u,onAfterDownload:d,closeAfterDownloadMs:f}){let{progress:p,error:m,isRunning:h,cancel:g,download:_,reset:v}=n,y=p?.status,b=typeof p?.percentComplete==`number`?Math.max(0,Math.min(100,p.percentComplete)):void 0,x=y===`completed`,S=y===`failed`||y===`expired`,C=y===`cancelled`,w=a.useCallback(async()=>{await _(s)&&(d?.(),f&&f>0&&setTimeout(()=>t(!1),f))},[_,s,d,f,t]),T=a.useCallback(e=>{!e&&h&&!l||(t(e),!e&&!h&&setTimeout(v,0))},[h,l,t,v]),E=r??(x?`Export ready`:S?`Export failed`:C?`Export cancelled`:`Exporting…`),D=i??(x?`Your export is ready to download.`:S?`The export job did not complete.`:C?`The export was cancelled.`:`Your export is being prepared on the server. You can close this window — the job will continue in the background.`);return(0,o.jsx)(Dt,{open:e,onOpenChange:T,children:(0,o.jsxs)(Mt,{"data-testid":`export-progress-dialog`,className:R(`sm:max-w-md`,u),children:[(0,o.jsxs)(Nt,{children:[(0,o.jsxs)(Ft,{className:`flex items-center gap-2`,children:[x?(0,o.jsx)(c.CheckCircle2,{className:`h-5 w-5 text-green-600`,"aria-hidden":`true`}):S?(0,o.jsx)(c.AlertCircle,{className:`h-5 w-5 text-destructive`,"aria-hidden":`true`}):(0,o.jsx)(c.Loader2,{className:R(`h-5 w-5 text-muted-foreground`,h&&`animate-spin`),"aria-hidden":`true`}),E]}),(0,o.jsx)(It,{children:D})]}),(0,o.jsxs)(`div`,{className:`py-2 space-y-3`,children:[(h||x)&&(0,o.jsx)(`div`,{"data-testid":`export-progress-bar`,children:b===void 0?(0,o.jsx)(Mr,{value:void 0,"aria-label":`Export progress (indeterminate)`}):(0,o.jsx)(Mr,{value:b,"aria-label":`Export progress`})}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,o.jsx)(`span`,{"data-testid":`export-progress-counts`,children:p?.processedRecords==null?h?`Starting…`:``:`${p.processedRecords.toLocaleString()}${p.totalRecords==null?``:` / ${p.totalRecords.toLocaleString()}`} records`}),(0,o.jsx)(`span`,{"data-testid":`export-progress-percent`,children:b===void 0?``:`${b.toFixed(0)}%`})]}),p?.fileSize?(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:$s(p.fileSize)}):null,(m||p?.error)&&(0,o.jsx)(`div`,{"data-testid":`export-progress-error`,className:`text-xs text-destructive bg-destructive/10 border border-destructive/30 rounded-md px-2 py-1`,children:m?.message||p?.error?.message})]}),(0,o.jsxs)(Pt,{className:`gap-2 sm:gap-2`,children:[h&&(0,o.jsxs)(B,{type:`button`,variant:`ghost`,onClick:()=>g(),"data-testid":`export-progress-cancel`,children:[(0,o.jsx)(c.X,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`ml-1`,children:`Cancel`})]}),x&&(0,o.jsxs)(B,{type:`button`,variant:`default`,onClick:w,"data-testid":`export-progress-download`,children:[(0,o.jsx)(c.Download,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`ml-1`,children:`Download`})]}),!h&&(0,o.jsx)(B,{type:`button`,variant:`outline`,onClick:()=>T(!1),"data-testid":`export-progress-close`,children:`Close`})]})]})})}t.ComponentRegistry.register(`combobox`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(Do,{options:e.options||[],placeholder:e.placeholder,value:e.value,disabled:e.disabled,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i})},{namespace:`ui`,label:`Combobox`,inputs:[{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`value`,type:`string`,label:`Value`},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{placeholder:`Select option...`,options:[]}}),t.ComponentRegistry.register(`command`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsxs)(Lt,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:[(0,o.jsx)(zt,{placeholder:e.placeholder||`Type a command or search...`}),(0,o.jsxs)(Bt,{children:[(0,o.jsx)(Vt,{children:e.emptyText||`No results found.`}),e.groups?.map((e,t)=>(0,o.jsx)(Ht,{heading:e.heading,children:e.items?.map((e,t)=>(0,o.jsx)(Wt,{value:e.value,children:e.label},t))},t))]})]})},{namespace:`ui`,label:`Command`,inputs:[{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`emptyText`,type:`string`,label:`Empty Text`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{placeholder:`Type a command or search...`,emptyText:`No results found.`,groups:[]}});var tc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n,l=e.clickable||!!n.onClick;return(0,o.jsxs)(et,{ref:r,className:R(t,(e.hoverable||l)&&`transition-colors hover:bg-muted/50`,l&&`cursor-pointer active:bg-muted`),...c,"data-obj-id":i,"data-obj-type":a,style:s,children:[(e.title||e.description||e.header)&&(0,o.jsxs)(tt,{children:[e.title&&(0,o.jsx)(nt,{children:e.title}),e.description&&(0,o.jsx)(rt,{children:e.description}),e.header&&z(e.header)]}),(e.children||e.body)&&(0,o.jsx)(it,{children:z(e.children||e.body)}),e.footer&&(0,o.jsx)(at,{className:`flex justify-between`,children:z(e.footer)})]})});t.ComponentRegistry.register(`card`,tc,{namespace:`ui`,label:`Card`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Card Title`,description:`Card description goes here`,className:`w-full`},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}}),t.ComponentRegistry.register(`tabs`,({schema:e,className:t,onChange:n,value:r,...i})=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=i,u=e=>{n&&n(e)},d=e.orientation===`vertical`;return(0,o.jsxs)(Qi,{defaultValue:r===void 0?e.defaultValue:void 0,value:r??e.value,onValueChange:u,orientation:e.orientation||`horizontal`,className:R(t,d&&`flex gap-2`),...l,"data-obj-id":a,"data-obj-type":s,style:c,children:[(0,o.jsx)($i,{className:R(d&&`flex-col h-auto items-stretch bg-muted/50 p-1`),children:e.items?.map(e=>(0,o.jsx)(ea,{value:e.value,disabled:e.disabled,className:R(d&&`justify-start`),children:e.label},e.value))}),e.items?.map(e=>(0,o.jsx)(ta,{value:e.value,className:R(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,d&&`mt-0 flex-1`),children:z(e.content||e.body)},e.value))]})},{namespace:`ui`,label:`Tabs`,inputs:[{name:`defaultValue`,type:`string`,label:`Default Value`,required:!0},{name:`className`,type:`string`,label:`CSS Class`},{name:`items`,type:`array`,label:`Items`}],defaultProps:{defaultValue:`tab1`,items:[{label:`Tab 1`,value:`tab1`,body:[{type:`text`,content:`Content for Tab 1`}]},{label:`Tab 2`,value:`tab2`,body:[{type:`text`,content:`Content for Tab 2`}]},{label:`Tab 3`,value:`tab3`,body:[{type:`text`,content:`Content for Tab 3`}]}],className:`w-full`}});var nc={1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,5:`grid-cols-5`,6:`grid-cols-6`,7:`grid-cols-7`,8:`grid-cols-8`,9:`grid-cols-9`,10:`grid-cols-10`,11:`grid-cols-11`,12:`grid-cols-12`},rc={1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,5:`sm:grid-cols-5`,6:`sm:grid-cols-6`,7:`sm:grid-cols-7`,8:`sm:grid-cols-8`,9:`sm:grid-cols-9`,10:`sm:grid-cols-10`,11:`sm:grid-cols-11`,12:`sm:grid-cols-12`},ic={1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,5:`md:grid-cols-5`,6:`md:grid-cols-6`,7:`md:grid-cols-7`,8:`md:grid-cols-8`,9:`md:grid-cols-9`,10:`md:grid-cols-10`,11:`md:grid-cols-11`,12:`md:grid-cols-12`},ac={1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,5:`lg:grid-cols-5`,6:`lg:grid-cols-6`,7:`lg:grid-cols-7`,8:`lg:grid-cols-8`,9:`lg:grid-cols-9`,10:`lg:grid-cols-10`,11:`lg:grid-cols-11`,12:`lg:grid-cols-12`},oc={1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,5:`xl:grid-cols-5`,6:`xl:grid-cols-6`,7:`xl:grid-cols-7`,8:`xl:grid-cols-8`,9:`xl:grid-cols-9`,10:`xl:grid-cols-10`,11:`xl:grid-cols-11`,12:`xl:grid-cols-12`},sc={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`,10:`gap-10`,12:`gap-12`};t.ComponentRegistry.register(`grid`,({schema:e,className:t,...n})=>{let r=2,i,a,s,c;typeof e.columns==`number`?r=e.columns:typeof e.columns==`object`&&e.columns!==null&&(r=e.columns.xs??1,i=e.columns.sm,a=e.columns.md,s=e.columns.lg,c=e.columns.xl),e.smColumns&&(i=e.smColumns),e.mdColumns&&(a=e.mdColumns),e.lgColumns&&(s=e.lgColumns),e.xlColumns&&(c=e.xlColumns),typeof e.columns==`number`&&r>1&&i===void 0&&a===void 0&&s===void 0&&c===void 0&&(a=r,i=Math.min(2,r),r=1);let l=e.gap??4,u=R(`grid`,nc[r]||`grid-cols-2`,i&&rc[i],a&&ic[a],s&&ac[s],c&&oc[c],sc[l]||`gap-[${l*.25}rem]`,t),{"data-obj-id":d,"data-obj-type":f,style:p,...m}=n;return(0,o.jsx)(`div`,{className:u,...m,"data-obj-id":d,"data-obj-type":f,style:p,children:e.children&&z(e.children)})},{namespace:`ui`,label:`Grid Layout`,inputs:[{name:`columns`,type:`number`,label:`Base Columns (Mobile)`,defaultValue:2,description:`Number of columns on mobile devices`},{name:`smColumns`,type:`number`,label:`SM Columns (Tablet)`,description:`Columns at sm breakpoint (>640px)`},{name:`mdColumns`,type:`number`,label:`MD Columns (Laptop)`,description:`Columns at md breakpoint (>768px)`},{name:`lgColumns`,type:`number`,label:`LG Columns (Desktop)`,description:`Columns at lg breakpoint (>1024px)`},{name:`xlColumns`,type:`number`,label:`XL Columns (Wide)`,description:`Columns at xl breakpoint (>1280px)`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:4,description:`Gap between items (0-12)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{columns:1,mdColumns:2,lgColumns:4,gap:4,children:[{type:`card`,title:`Card 1`,description:`First card`},{type:`card`,title:`Card 2`,description:`Second card`},{type:`card`,title:`Card 3`,description:`Third card`},{type:`card`,title:`Card 4`,description:`Fourth card`}]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}}),t.ComponentRegistry.register(`flex`,({schema:e,className:t,...n})=>{let r=e.direction||`row`,i=e.justify||`start`,a=e.align||`start`,s=e.gap||2,c=e.wrap||!1,l=R(`flex`,r===`row`&&`flex-row`,r===`col`&&`flex-col`,r===`row-reverse`&&`flex-row-reverse`,r===`col-reverse`&&`flex-col-reverse`,i===`start`&&`justify-start`,i===`end`&&`justify-end`,i===`center`&&`justify-center`,i===`between`&&`justify-between`,i===`around`&&`justify-around`,i===`evenly`&&`justify-evenly`,a===`start`&&`items-start`,a===`end`&&`items-end`,a===`center`&&`items-center`,a===`baseline`&&`items-baseline`,a===`stretch`&&`items-stretch`,s===0&&`gap-0`,s===1&&`gap-1`,s===2&&`gap-1.5 sm:gap-2`,s===3&&`gap-2 sm:gap-3`,s===4&&`gap-2 sm:gap-3 md:gap-4`,s===5&&`gap-3 sm:gap-4 md:gap-5`,s===6&&`gap-3 sm:gap-4 md:gap-6`,s===7&&`gap-4 sm:gap-5 md:gap-7`,s===8&&`gap-4 sm:gap-6 md:gap-8`,c&&`flex-wrap`,t),{"data-obj-id":u,"data-obj-type":d,style:f,...p}=n;return(0,o.jsx)(`div`,{className:l,...p,"data-obj-id":u,"data-obj-type":d,style:f,children:e.children&&z(e.children)})},{namespace:`ui`,label:`Flex Layout`,inputs:[{name:`direction`,type:`enum`,enum:[`row`,`col`,`row-reverse`,`col-reverse`],label:`Direction`,defaultValue:`row`},{name:`justify`,type:`enum`,enum:[`start`,`end`,`center`,`between`,`around`,`evenly`],label:`Justify Content`,defaultValue:`start`},{name:`align`,type:`enum`,enum:[`start`,`end`,`center`,`baseline`,`stretch`],label:`Align Items`,defaultValue:`start`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:2,description:`Gap between items (0-8)`},{name:`wrap`,type:`boolean`,label:`Wrap`,defaultValue:!1,description:`Allow flex items to wrap`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`row`,justify:`start`,align:`center`,gap:2,wrap:!1,children:[{type:`button`,label:`Button 1`},{type:`button`,label:`Button 2`},{type:`button`,label:`Button 3`}]}});var cc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let i=e.direction||`col`,a=e.justify||`start`,s=e.align||`stretch`,c=e.gap??e.spacing??2,l=e.wrap||!1,u=R(`flex`,i===`row`&&`flex-row`,i===`col`&&`flex-col`,i===`row-reverse`&&`flex-row-reverse`,i===`col-reverse`&&`flex-col-reverse`,a===`start`&&`justify-start`,a===`end`&&`justify-end`,a===`center`&&`justify-center`,a===`between`&&`justify-between`,a===`around`&&`justify-around`,a===`evenly`&&`justify-evenly`,s===`start`&&`items-start`,s===`end`&&`items-end`,s===`center`&&`items-center`,s===`baseline`&&`items-baseline`,s===`stretch`&&`items-stretch`,c===0&&`gap-0`,c===1&&`gap-1`,c===2&&`gap-1.5 sm:gap-2`,c===3&&`gap-2 sm:gap-3`,c===4&&`gap-2 sm:gap-3 md:gap-4`,c===5&&`gap-3 sm:gap-4 md:gap-5`,c===6&&`gap-3 sm:gap-4 md:gap-6`,c===8&&`gap-4 sm:gap-6 md:gap-8`,c===10&&`gap-5 sm:gap-7 md:gap-10`,l&&`flex-wrap`,t),{"data-obj-id":d,"data-obj-type":f,style:p,...m}=n;return(0,o.jsx)(`div`,{ref:r,className:u,...m,"data-obj-id":d,"data-obj-type":f,style:p,children:e.children&&z(e.children)})});t.ComponentRegistry.register(`stack`,cc,{namespace:`ui`,label:`Stack`,inputs:[{name:`direction`,type:`enum`,label:`Direction`,enum:[`col`,`row`,`col-reverse`,`row-reverse`],defaultValue:`col`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:2},{name:`align`,type:`enum`,label:`Align Items`,enum:[`start`,`end`,`center`,`stretch`,`baseline`],defaultValue:`stretch`},{name:`justify`,type:`enum`,label:`Justify Content`,enum:[`start`,`end`,`center`,`between`,`around`,`evenly`],defaultValue:`start`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`col`,gap:2,align:`stretch`,children:[]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:100,minHeight:50}});var lc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let i=e.maxWidth||`xl`,a=e.padding||4,s=e.centered!==!1,c=R(`w-full`,i===`sm`&&`max-w-sm`,i===`md`&&`max-w-md`,i===`lg`&&`max-w-lg`,i===`xl`&&`max-w-xl`,i===`2xl`&&`max-w-2xl`,i===`3xl`&&`max-w-3xl`,i===`4xl`&&`max-w-4xl`,i===`5xl`&&`max-w-5xl`,i===`6xl`&&`max-w-6xl`,i===`7xl`&&`max-w-7xl`,i===`full`&&`max-w-full`,i===`screen`&&`max-w-screen-2xl`,s&&`mx-auto`,a===0&&`p-0`,a===1&&`p-0.5 sm:p-1`,a===2&&`p-1 sm:p-2`,a===3&&`p-2 sm:p-3`,a===4&&`p-2 sm:p-3 md:p-4`,a===5&&`p-3 sm:p-4 md:p-5`,a===6&&`p-3 sm:p-4 md:p-6`,a===7&&`p-4 sm:p-5 md:p-7`,a===8&&`p-4 sm:p-6 md:p-8`,a===10&&`p-5 sm:p-7 md:p-10`,a===12&&`p-6 sm:p-8 md:p-12`,a===16&&`p-8 sm:p-10 md:p-16`,t),{"data-obj-id":l,"data-obj-type":u,style:d,...f}=n;return(0,o.jsx)(`div`,{ref:r,className:c,...f,"data-obj-id":l,"data-obj-type":u,style:d,children:e.children&&z(e.children)})});t.ComponentRegistry.register(`container`,lc,{namespace:`ui`,label:`Container`,inputs:[{name:`maxWidth`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`full`,`screen`],label:`Max Width`,defaultValue:`xl`},{name:`padding`,type:`number`,label:`Padding`,defaultValue:4,description:`Padding value (0, 1-8, 10, 12, 16)`},{name:`centered`,type:`boolean`,label:`Center Horizontally`,defaultValue:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{maxWidth:`xl`,padding:4,centered:!0,children:[{type:`text`,content:`Container content goes here`}]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}});function uc(e){switch(e){case`small`:return`w-64`;case`medium`:return`w-80`;case`large`:return`w-96`;case`full`:return`w-full`;default:return e||`w-full`}}function dc(e){switch(e){case`small`:return`w-full md:w-64`;case`medium`:return`w-full md:w-80`;case`large`:return`w-full md:w-96`;default:return`w-full`}}function fc(e){switch(e){case`utility`:return`max-w-4xl`;case`home`:return`max-w-screen-2xl`;case`app`:return`max-w-screen-xl`;default:return`max-w-7xl`}}function Q(e,t){return e?.find(e=>e.name?.toLowerCase()===t.toLowerCase())}function pc(e,t){if(!e)return[];let n=new Set(t.map(e=>e.toLowerCase()));return e.filter(e=>!n.has(e.name?.toLowerCase()??``))}var $=({region:e,className:t})=>{let n=e.components||[];return n.length===0?null:(0,o.jsx)(`div`,{className:R(`space-y-4`,e.className,t),"data-region":e.name,children:n.map((t,n)=>(0,o.jsx)(i.SchemaRenderer,{schema:t},t?.id||`${e.name}-${n}`))})},mc=({regions:e,pageType:t,className:n})=>{let r=Q(e,`header`),i=Q(e,`sidebar`),a=Q(e,`main`),s=Q(e,`aside`),c=Q(e,`footer`),l=pc(e,[`header`,`sidebar`,`main`,`aside`,`footer`]);return r||i||a||s||c?(0,o.jsxs)(`div`,{className:R(`flex flex-col gap-6`,n),"data-page-layout":t,children:[r&&(0,o.jsx)($,{region:r,className:R(uc(r.width))}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[i&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(i.width||`small`)),children:(0,o.jsx)($,{region:i})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[a&&(0,o.jsx)($,{region:a}),l.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]}),s&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(s.width||`small`),s.className),children:(0,o.jsx)($,{region:s})})]}),c&&(0,o.jsx)($,{region:c,className:R(uc(c.width))})]}):(0,o.jsx)(`div`,{className:R(`space-y-6`,n),"data-page-layout":t,children:e.map((e,t)=>(0,o.jsx)($,{region:e},e.name||t))})},hc=({schema:e})=>{let t=e.body||e.children,n=Array.isArray(t)?t:t?[t]:[];return n.length===0?null:(0,o.jsx)(`div`,{className:`space-y-6`,children:n.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},e?.id||t))})},gc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:e.pageType}):(0,o.jsx)(hc,{schema:e}),_c={default:gc,"full-width":gc,"header-sidebar-main":({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(hc,{schema:e});let n=Q(t,`header`),r=Q(t,`sidebar`),i=Q(t,`main`),a=pc(t,[`header`,`sidebar`,`main`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`header-sidebar-main`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[r&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(r.width||`medium`)),children:(0,o.jsx)($,{region:r})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[i&&(0,o.jsx)($,{region:i}),a.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]})]})]})},"three-column":({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(hc,{schema:e});let n=Q(t,`header`),r=Q(t,`sidebar`),i=Q(t,`main`),a=Q(t,`aside`),s=Q(t,`footer`),c=pc(t,[`header`,`sidebar`,`main`,`aside`,`footer`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`three-column`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[r&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(r.width||`small`)),children:(0,o.jsx)($,{region:r})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[i&&(0,o.jsx)($,{region:i}),c.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]}),a&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(a.width||`small`),a.className),children:(0,o.jsx)($,{region:a})})]}),s&&(0,o.jsx)($,{region:s})]})},dashboard:({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(hc,{schema:e});let n=Q(t,`header`),r=Q(t,`footer`),i=pc(t,[`header`,`footer`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`dashboard`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:i.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`region-${t}`))}),r&&(0,o.jsx)($,{region:r})]})}};function vc(e){return e.template&&_c[e.template]||null}var yc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:`record`}):(0,o.jsx)(hc,{schema:e}),bc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:`home`}):(0,o.jsx)(hc,{schema:e}),xc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:`app`}):(0,o.jsx)(hc,{schema:e}),Sc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:`utility`}):(0,o.jsx)(hc,{schema:e}),Cc=({schema:e,className:t,...n})=>{let r=e.pageType||`record`,{"data-obj-id":s,"data-obj-type":c,style:l,pageType:u,schema:d,regions:f,template:p,title:m,icon:h,description:g,object:_,variables:v,body:y,isDefault:b,assignedProfiles:x,aria:S,recordOverride:C,permissions:w,requiredPermissions:T,enforceFieldSecurity:E,redactFields:D,children:O,...k}=n,A=Object.fromEntries(Object.entries(k).filter(([e])=>!e.startsWith(`_`))),j=(0,a.useMemo)(()=>{let t=vc(e);if(t)return(0,o.jsx)(t,{schema:e});switch(r){case`home`:return(0,o.jsx)(bc,{schema:e});case`app`:return(0,o.jsx)(xc,{schema:e});case`utility`:return(0,o.jsx)(Sc,{schema:e});default:return(0,o.jsx)(yc,{schema:e})}},[e,r]),ee=(e.regions??[]).some(e=>e.name?.toLowerCase()===`main`&&e.width===`full`),te=ee?`max-w-none`:fc(r),M=(0,o.jsx)(`div`,{className:R(`min-h-full w-full bg-background p-3 md:p-4 lg:p-6`,t),"data-page-type":r,"data-obj-id":s,"data-obj-type":c,style:l,...A,children:(0,o.jsxs)(`div`,{className:R(ee?`space-y-6`:`mx-auto space-y-6`,te),children:[r!==`record`&&(e.title||e.description)&&(0,o.jsxs)(`div`,{className:`space-y-2`,children:[e.title&&(0,o.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-foreground`,children:e.title}),e.description&&(0,o.jsx)(`p`,{className:`text-muted-foreground`,children:e.description})]}),j]})});return e.variables&&e.variables.length>0?(0,o.jsxs)(i.PageVariablesProvider,{definitions:e.variables,children:[(0,o.jsx)(i.PageVariableActionBridge,{}),M]}):M},wc={namespace:`ui`,label:`Page`,icon:`Layout`,category:`layout`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`pageType`,type:`string`,label:`Page Type`},{name:`object`,type:`string`,label:`Object Name`},{name:`template`,type:`string`,label:`Template`},{name:`regions`,type:`array`,label:`Regions`,itemType:`object`},{name:`variables`,type:`array`,label:`Variables`,itemType:`object`},{name:`body`,type:`array`,label:`Content (Legacy)`,itemType:`component`}]};t.ComponentRegistry.register(`page`,Cc,wc),t.ComponentRegistry.register(`app`,Cc,{...wc,label:`App Page`}),t.ComponentRegistry.register(`utility`,Cc,{...wc,label:`Utility Page`}),t.ComponentRegistry.register(`home`,Cc,{...wc,label:`Home Page`}),t.ComponentRegistry.register(`record`,Cc,{...wc,label:`Record Page`});var Tc=new Map,Ec=new Map,Dc=new Set;function Oc(e,t,n){return`${e}::${t??``}::${n??``}`}function kc(){for(let e of Dc)e()}function Ac(e,t,n){return Tc.get(Oc(e,t,n))}function jc(e,t,n,r){let i=Oc(e,t,n);Tc.get(i)!==r&&(Tc.set(i,r),kc())}async function Mc(e,t,n,r){let i=Oc(t,n,r),a=Tc.get(i);if(a!==void 0)return a;let o=Ec.get(i);if(o)return o;let s=(async()=>{let a={};if(n){if(!r)return 0;a[n]=r}try{let i=await e(t,{$filter:a,$top:1,$count:!0}),o=typeof i?.total==`number`?i.total:typeof i?.count==`number`?i.count:Array.isArray(i?.records)?i.records.length:Array.isArray(i?.data)?i.data.length:Array.isArray(i)?i.length:0,s=typeof o==`number`?o:0;return jc(t,n,r,s),s}catch{return 0}finally{Ec.delete(i)}})();return Ec.set(i,s),s}function Nc(e,t){let n=!1,r=`${e}::`;for(let e of Tc.keys())e.startsWith(r)&&(t!==void 0&&!e.endsWith(`::${t}`)||(Tc.delete(e),n=!0));n&&kc()}function Pc(){Tc.size!==0&&(Tc.clear(),kc())}function Fc(e){return Dc.add(e),()=>{Dc.delete(e)}}function Ic(){return Tc}function Lc(e,t,n){if((0,a.useSyncExternalStore)(Fc,Ic,Ic),e)return Ac(e,t,n)}var Rc={get:Ac,set:jc,fetch:Mc,invalidate:Nc,invalidateAll:Pc,_reset:()=>{Tc.clear(),Ec.clear(),kc()}},zc=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},Bc=e=>e==null?``:typeof e==`string`?e:typeof e==`object`?e.default||e.value||``:String(e),Vc={"zh-CN":{Details:`详情`,Related:`相关`,Activity:`活动`,History:`历史`,Notes:`备注`,Files:`文件`,Tasks:`任务`,"Open Tasks":`待办任务`,"Closed Tasks":`已完成任务`,Events:`日程`,Attachments:`附件`,Chatter:`讨论`,Discussion:`讨论`,Comments:`评论`,Overview:`概览`,Summary:`摘要`,Quotes:`报价单`,Products:`产品`,Contacts:`联系人`,Accounts:`客户`,Leads:`线索`,Opportunities:`商机`,Cases:`服务案例`,Campaigns:`营销活动`,Approvals:`审批`,Documents:`文档`,Emails:`邮件`,Calls:`通话`,Meetings:`会议`},"zh-TW":{Details:`詳情`,Related:`相關`,Activity:`活動`,History:`歷史`,Notes:`備註`,Files:`檔案`,Tasks:`任務`,"Open Tasks":`待辦任務`,"Closed Tasks":`已完成任務`,Events:`行程`,Attachments:`附件`,Chatter:`討論`,Discussion:`討論`,Comments:`評論`,Overview:`概覽`,Summary:`摘要`,Quotes:`報價單`,Products:`產品`,Contacts:`聯絡人`,Accounts:`客戶`,Leads:`線索`,Opportunities:`商機`,Cases:`服務案例`,Campaigns:`行銷活動`,Approvals:`審批`,Documents:`文件`,Emails:`郵件`,Calls:`通話`,Meetings:`會議`}},Hc=()=>{if(typeof document<`u`){let e=document.documentElement?.lang;if(e)return e}return typeof navigator<`u`&&navigator.language?navigator.language:`en`},Uc=e=>{if(!e)return e;let t=Hc(),n=Vc[t],r=t.split(`-`)[0]===`zh`?Vc[`zh-CN`]:void 0,i=n||r;if(!i)return e;if(i[e]!==void 0)return i[e];let a=/\s*(?:&|and|和)\s*/i;if(a.test(e)){let n=e.split(a);if(n.every(e=>i[e.trim()]!==void 0)){let e=t.startsWith(`zh`)?`与`:` & `;return n.map(e=>i[e.trim()]).join(e)}}return e},Wc=(e,t,n,r,i)=>!e||typeof e!=`string`?e||``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,a)=>{let o=a.split(`.`).reduce((e,t)=>e==null?e:e[t],t);if(o==null||typeof o==`object`)return``;let s=String(o);if(n?.fields&&r&&i&&!a.includes(`.`)){let e=(Array.isArray(n.fields)?n.fields.find(e=>e?.name===a):n.fields[a])?.options;if(Array.isArray(e)){let t=e.find(e=>String(e?.value??e)===s);return r(i,a,s,t?.label?String(t.label):s)}}return s}).replace(/\s+/g,` `).trim():e,Gc=e=>{let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,``)}k`:String(t):String(e)},Kc=(e,t=[])=>{if(!e)return t;let n=Array.isArray(e)?e:[e];for(let e of n){if(!e||typeof e!=`object`)continue;if(e.type===`record:related_list`||e.type===`record_related_list`){t.push(e);continue}let n=[e.children,e.properties?.children,e.properties?.items,e.body,e.items];for(let e of n)e&&Kc(e,t)}return t};t.ComponentRegistry.register(`page:tabs`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n),{language:s}=(0,F.useObjectTranslation)(),c=e?.items||[],l=e?.properties?.type||e?.tabStyle||`line`,u=(e?.position||`top`)===`left`,d=(0,i.useRecordContext)(),f=d?.data?.id,p=d?.dataSource;Lc(void 0,void 0,f);let m=a.default.useMemo(()=>{let e=new Map;return c.forEach((t,n)=>{if(t.count!==void 0&&t.count!==null&&t.count!==``)return;let r=Kc(t.children),i=[];for(let e of r){let t=e?.properties?.objectName||e?.objectName;if(!t)continue;let n=e?.properties?.relationshipField||e?.relationshipField;i.push({objectName:t,relationshipField:n})}i.length>0&&e.set(n,i)}),e},[c]);a.default.useEffect(()=>{if(!p||typeof p.find!=`function`||m.size===0)return;let e=!1;for(let t of m.values())for(let n of t)if(Rc.fetch((e,t)=>p.find(e,t),n.objectName,n.relationshipField,f).catch(()=>0),e)return;return()=>{e=!0}},[p,m,f]);let h=e=>{let t=m.get(e);if(!t||t.length===0)return;let n=0,r=!1;for(let e of t){let t=Rc.get(e.objectName,e.relationshipField,f);t!==void 0&&(n+=t,r=!0)}return r?n:void 0},g=c.map((e,t)=>({...e,value:`tab-${t}`,labelStr:Uc((0,F.pickLocalized)(e.label,s)),count:e.count!==void 0&&e.count!==null&&e.count!==``?e.count:h(t)})),_=g[0]?.value,v=R(u&&`flex-col h-auto items-stretch p-1`,l===`card`&&`bg-transparent gap-1`,l===`pill`&&`bg-muted rounded-full p-1 gap-1`,l===`line`&&!u&&`h-auto rounded-none bg-transparent p-0 gap-4 border-b border-border w-full justify-start`,!u&&`sticky top-0 z-20 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`),y=()=>R(u&&`justify-start`,l===`card`&&`data-[state=active]:bg-background data-[state=active]:border data-[state=active]:shadow-sm rounded-md`,l===`pill`&&`rounded-full data-[state=active]:bg-background`,l===`line`&&!u&&`rounded-none border-b-2 border-transparent bg-transparent px-1 pb-2.5 -mb-px shadow-none data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none data-[state=active]:text-foreground`);return(0,o.jsxs)(Qi,{defaultValue:_,orientation:u?`vertical`:`horizontal`,className:R(t,u&&`flex gap-4 w-full`),...r,children:[(g.length>1||e?.properties?.alwaysShowStrip===!0)&&(0,o.jsx)($i,{className:v,children:g.map(e=>(0,o.jsxs)(ea,{value:e.value,className:y(),children:[e.icon&&(0,o.jsx)(ka,{name:e.icon,className:`mr-1.5 h-3.5 w-3.5 shrink-0 opacity-70`,"aria-hidden":!0}),(0,o.jsx)(`span`,{children:e.labelStr}),e.count!==void 0&&e.count!==null&&e.count!==``&&Number(e.count)>0&&(0,o.jsx)(`span`,{className:`ml-1.5 inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-muted px-1 text-[10px] font-medium leading-none text-muted-foreground`,"aria-label":`${Gc(e.count)} items`,children:Gc(e.count)})]},e.value))}),g.map(e=>(0,o.jsx)(ta,{value:e.value,className:R(g.length>1?`mt-3`:`mt-0`,u&&`mt-0 flex-1`),children:z(e.children)},e.value))]})},{namespace:`page`,label:`Page Tabs`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`page:card`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n),{language:i}=(0,F.useObjectTranslation)(),a=(0,F.pickLocalized)(e?.title,i),s=e?.bordered!==!1,c=e?.body??e?.children,l=e?.footer;return(0,o.jsxs)(et,{className:R(t,!s&&`border-0 shadow-none bg-transparent`),...r,children:[a&&(0,o.jsx)(tt,{children:(0,o.jsx)(nt,{children:a})}),c&&(0,o.jsx)(it,{children:z(c)}),l&&(0,o.jsx)(at,{className:`flex justify-between`,children:z(l)})]})},{namespace:`page`,label:`Page Card`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`page:accordion`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n),{language:i}=(0,F.useObjectTranslation)(),a=e?.items||[],s=!!e?.allowMultiple,c=(e?.variant??e?.properties?.variant??`flush`)===`flush`?`border-b last:border-b-0`:void 0,l=a.map((e,t)=>({...e,value:`panel-${t}`,labelStr:Uc((0,F.pickLocalized)(e.label,i))})),u=l.filter(e=>e.collapsed===!1).map(e=>e.value),d=l.map(e=>(0,o.jsxs)(Se,{value:e.value,className:c,children:[(0,o.jsx)(Ce,{className:`text-sm font-semibold tracking-tight hover:no-underline`,children:e.labelStr}),(0,o.jsx)(we,{children:z(e.children)})]},e.value));return s?(0,o.jsx)(xe,{type:`multiple`,defaultValue:u,className:t,...r,children:d}):(0,o.jsx)(xe,{type:`single`,collapsible:!0,defaultValue:u[0],className:t,...r,children:d})},{namespace:`page`,label:`Page Accordion`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`page:section`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n);return(0,o.jsx)(`section`,{className:R(`space-y-4`,t),...r,children:z(e?.children||e?.body)})},{namespace:`page`,label:`Page Section`,category:`layout`,isContainer:!0});function qc(e){if(!e)return e;let t=e;for(let e=0;e<4;e+=1){let e=t.replace(/[\s\u00A0]*[-·:|/–—][\s\u00A0]*$/u,``).trimEnd();if(e===t)break;t=e}for(let e=0;e<4;e+=1){let e=t.replace(/^[\s\u00A0]*[-·:|/–—][\s\u00A0]*/u,``).trimStart();if(e===t)break;t=e}return t=t.replace(/([-·:|/–—])[\s\u00A0]*\1/gu,`$1`),t=t.replace(/[\s\u00A0]+/g,` `).trim(),t}t.ComponentRegistry.register(`page:header`,({schema:e,className:n,...r})=>{let{designer:s}=zc(r),l=(0,i.useRecordContext)(),u=(0,i.usePredicateScope)(),{execute:d}=(0,i.useAction)(),{objectLabel:f,actionLabel:p}=(0,F.useObjectLabel)(),{fieldOptionLabel:m}=(0,F.useSafeFieldLabel)(),{language:h}=(0,F.useObjectTranslation)(),g=e?.title??e?.properties?.title,_=e?.subtitle??e?.properties?.subtitle,v=l?.objectSchema,y=l?.objectName||v?.name,b=Wc((0,F.pickLocalized)(g,h),l?.data,v,m,y),x=Wc((0,F.pickLocalized)(_,h),l?.data,v,m,y),S=(e?.breadcrumb??e?.properties?.breadcrumb)!==!1,C=e?.recordChrome===!1||e?.properties?.recordChrome===!1,w=e?.showStar!==!1&&e?.properties?.showStar!==!1,T=e?.showCopyId!==!1&&e?.properties?.showCopyId!==!1,E=e?.actions??e?.properties?.actions,D=l?.headerSystemActions,O=a.default.useMemo(()=>{let e=l?.data,n=u?.user,r=new t.ExpressionEvaluator({...e&&typeof e==`object`?e:{},record:e,data:e,user:n,ctx:{user:n,record:e,data:e,app:u?.app,features:u?.features}}),i=e=>{try{return r.evaluateExpression(e)}catch{return}},a=e=>{if(Array.isArray(e?.locations)&&e.locations.length>0&&!e.locations.includes(`record_header`))return!1;let t=e?.visible;if(t!=null)if(typeof t==`boolean`){if(!t)return!1}else{let e=typeof t==`string`?t:t&&typeof t==`object`&&typeof t.source==`string`?t.source:null;if(e&&!i(e))return!1}let n=e?.hidden;if(n!=null)if(typeof n==`boolean`){if(n)return!1}else{let e=typeof n==`string`?n:n&&typeof n==`object`&&typeof n.source==`string`?n.source:null;if(e&&i(e))return!1}return!0},o=Array.isArray(E)?E.filter(a):[],s=Array.isArray(D)?D.filter(a):[],c=new Set,d=[];for(let e of[...o,...s]){let t=e?.name||e?.id||``;t&&c.has(t)||(t&&c.add(t),d.push(e))}return d},[E,D,l?.data,u]),k=()=>{if(O.length===0)return null;let e=(e,t)=>{let n=e?.name||e?.id,r=e?.label||n||`Action ${t+1}`;return n?p(l?.objectName,n,r):r},n=O.length>2,r=n?O.slice(0,1):O,i=n?O.slice(1):[],a=l?.data,s=new t.ExpressionEvaluator({...a&&typeof a==`object`?a:{},record:a,data:a}),u=e=>{if(e==null)return!1;if(typeof e==`boolean`)return e;let t=typeof e==`string`?e:e&&typeof e==`object`&&typeof e.source==`string`?e.source:void 0;if(!t)return!1;try{return!!s.evaluateExpression(t)}catch{return!1}};return(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 shrink-0`,role:`toolbar`,"aria-label":`Page header actions`,children:[r.map((t,n)=>{let r=e(t,n),i=t.variant||`default`,a=t.size||`sm`,s=u(t.disabled),c=typeof t.icon==`string`?t.icon:null;return(0,o.jsxs)(B,{variant:i,size:a,disabled:s,className:`gap-2`,onClick:()=>{if(typeof t.onClick==`function`){t.onClick();return}d(t)},children:[c&&(0,o.jsx)(ka,{name:c,className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:r})]},t.name||t.id||`header-action-${n}`)}),n&&(0,o.jsxs)(vn,{children:[(0,o.jsx)(yn,{asChild:!0,children:(0,o.jsx)(B,{variant:`outline`,size:`sm`,className:`gap-1 px-2`,"aria-label":`More actions`,children:(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`})})}),(0,o.jsx)(En,{align:`end`,className:`w-44`,children:i.map((t,n)=>{let r=e(t,n+1),i=u(t.disabled),a=typeof t.icon==`string`?t.icon:null;return(0,o.jsxs)(Dn,{disabled:i,onSelect:e=>{if(e.preventDefault(),typeof t.onClick==`function`){t.onClick();return}d(t)},className:R(`gap-2`,(t.variant===`destructive`||t.name===`sys_delete`)&&`text-destructive focus:text-destructive focus:bg-destructive/10`),children:[a&&(0,o.jsx)(ka,{name:a,className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:r})]},t.name||t.id||`overflow-action-${n}`)})})]})]})};if(l?.data&&l?.objectSchema&&!C){let e=l.data,t=l.objectSchema,r=l.objectName||t?.name,i=Bc(t?.label)||t?.name||l.objectName||``,a=r?f({name:r,label:i}):i||void 0,c=t?.primaryField,u=t?.titleFormat,d=typeof u==`string`?u:u&&typeof u==`object`&&typeof u.source==`string`?u.source:void 0,p=d?qc(Wc(d,e,t,m,r).trim()):``,h=b||c&&e?.[c]||(p&&!p.includes(`{`)?p:``)||e?.name||e?.full_name||e?.title||e?.subject||e?.display_name||e?.label||(a&&e?.id?`${a} ${String(e.id).slice(0,8)}`:``)||a||``;return(0,o.jsxs)(`header`,{className:R(`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-4 pb-4 border-b`,n),...s,children:[(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[S&&(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,"data-page-breadcrumb-slot":!0}),(0,o.jsx)(Gs,{title:h,objectLabel:a,resourceId:e?.id?String(e.id):void 0,showStar:w,showCopyId:T,isFavorite:l?.isFavorite,onToggleFavorite:l?.onToggleFavorite?()=>l.onToggleFavorite():void 0}),x&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:x})]}),k()??(0,o.jsx)(`div`,{"data-page-actions-slot":!0,className:`shrink-0`})]})}return(0,o.jsxs)(`header`,{className:R(`flex flex-col gap-2 pb-4 border-b`,n),...s,children:[S&&(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,"data-page-breadcrumb-slot":!0}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[b&&(0,o.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:b}),x&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:x})]}),k()??(0,o.jsx)(`div`,{"data-page-actions-slot":!0})]})]})},{namespace:`page`,label:`Page Header`,category:`layout`}),t.ComponentRegistry.register(`page:footer`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Gr,{className:`my-4`}),(0,o.jsx)(`footer`,{className:R(`flex items-center justify-between text-sm text-muted-foreground`,t),...r,children:z(e?.children||e?.body)})]})},{namespace:`page`,label:`Page Footer`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`page:sidebar`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n);return(0,o.jsx)(`aside`,{className:R(`flex flex-col gap-4 w-full md:w-80 shrink-0`,t),...r,children:z(e?.children||e?.body)})},{namespace:`page`,label:`Page Sidebar`,category:`layout`,isContainer:!0}),[`aside`,`main`,`header`,`nav`,`footer`,`section`,`article`].forEach(e=>{let n=(0,a.forwardRef)(({schema:t,className:n,...r},i)=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=r;return(0,o.jsx)(e,{ref:i,className:n,...l,"data-obj-id":a,"data-obj-type":s,style:c,children:z(t.children||t.body)})});n.displayName=`Semantic${e.charAt(0).toUpperCase()+e.slice(1)}`,t.ComponentRegistry.register(e,n,{namespace:`ui`,label:e.charAt(0).toUpperCase()+e.slice(1),category:`layout`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}]})}),t.ComponentRegistry.register(`aspect-ratio`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(ze,{ratio:e.ratio||16/9,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.image?(0,o.jsx)(`img`,{src:e.image,alt:e.alt||``,loading:`lazy`,className:`rounded-md object-cover w-full h-full`}):z(e.children||e.body)})},{namespace:`ui`,label:`Aspect Ratio`,inputs:[{name:`ratio`,type:`number`,label:`Ratio`,defaultValue:16/9},{name:`image`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{ratio:16/9}}),t.ComponentRegistry.register(`sidebar-provider`,({schema:e,...t})=>(0,o.jsx)(_i,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Provider`,inputs:[{name:`defaultOpen`,type:`boolean`,label:`Default Open`,defaultValue:!0}],defaultProps:{defaultOpen:!0},defaultChildren:[{type:`sidebar`},{type:`sidebar-inset`}]}),t.ComponentRegistry.register(`sidebar`,({schema:e,...t})=>(0,o.jsx)(vi,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar`,inputs:[{name:`collapsible`,type:`enum`,enum:[`offcanvas`,`icon`,`none`],defaultValue:`icon`,label:`Collapsible`},{name:`side`,type:`enum`,enum:[`left`,`right`],defaultValue:`left`,label:`Side`},{name:`variant`,type:`enum`,enum:[`sidebar`,`floating`,`inset`],defaultValue:`sidebar`,label:`Variant`}],defaultProps:{collapsible:`icon`,side:`left`,variant:`sidebar`},defaultChildren:[{type:`sidebar-header`},{type:`sidebar-content`},{type:`sidebar-footer`}]}),t.ComponentRegistry.register(`sidebar-header`,({schema:e,...t})=>(0,o.jsx)(Ci,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Header`,defaultChildren:[{type:`text`,content:`Sidebar Header`}]}),t.ComponentRegistry.register(`sidebar-content`,({schema:e,...t})=>(0,o.jsx)(Ei,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Content`,defaultChildren:[{type:`sidebar-group`}]}),t.ComponentRegistry.register(`sidebar-group`,({schema:e,...t})=>(0,o.jsxs)(Di,{...t,children:[e.label&&(0,o.jsx)(Oi,{children:e.label}),(0,o.jsx)(Ai,{children:z(e.body)})]}),{namespace:`ui`,label:`Sidebar Group`,inputs:[{name:`label`,type:`string`,label:`Label`}],defaultProps:{label:`Menu`},defaultChildren:[{type:`sidebar-menu`}]}),t.ComponentRegistry.register(`sidebar-menu`,({schema:e,...t})=>(0,o.jsx)(ji,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Menu`,defaultChildren:[{type:`sidebar-menu-item`},{type:`sidebar-menu-item`}]}),t.ComponentRegistry.register(`sidebar-menu-item`,({schema:e,...t})=>(0,o.jsx)(Mi,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Menu Item`,defaultChildren:[{type:`sidebar-menu-button`}]}),t.ComponentRegistry.register(`sidebar-menu-button`,({schema:e,...t})=>(0,o.jsx)(Pi,{isActive:e.active,...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Menu Button`,inputs:[{name:`active`,type:`boolean`,label:`Active`,defaultValue:!1},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`tooltip`,type:`string`,label:`Tooltip`}],defaultProps:{size:`default`},defaultChildren:[{type:`text`,content:`Menu Item`}]}),t.ComponentRegistry.register(`sidebar-footer`,({schema:e,...t})=>(0,o.jsx)(wi,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Footer`,defaultChildren:[{type:`text`,content:`Footer`}]}),t.ComponentRegistry.register(`sidebar-inset`,({schema:e,...t})=>(0,o.jsx)(xi,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Inset`,defaultChildren:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Main content area`}]}]}),t.ComponentRegistry.register(`sidebar-trigger`,({className:e,...t})=>(0,o.jsx)(yi,{className:e,...t}),{namespace:`ui`,label:`Sidebar Trigger`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}]});function Jc({crumb:e,isLast:t}){let n=(0,i.resolveI18nLabel)(e.label)??``;return e.siblings&&e.siblings.length>0?(0,o.jsxs)(vn,{children:[(0,o.jsxs)(yn,{className:`flex items-center gap-1`,children:[t?(0,o.jsx)(`span`,{className:`font-semibold`,children:n}):(0,o.jsx)(`span`,{children:n}),(0,o.jsx)(c.ChevronDown,{className:`h-3 w-3`})]}),(0,o.jsx)(En,{align:`start`,children:e.siblings.map((e,t)=>(0,o.jsx)(Dn,{asChild:!0,children:(0,o.jsx)(`a`,{href:e.href,children:e.label})},t))})]}):t?(0,o.jsx)(Ye,{children:n}):(0,o.jsx)(Je,{href:e.href||`#`,children:n})}t.ComponentRegistry.register(`header-bar`,({schema:e})=>(0,o.jsxs)(`header`,{className:`flex h-14 sm:h-16 shrink-0 items-center gap-2 border-b px-3 sm:px-4`,children:[(0,o.jsx)(yi,{}),(0,o.jsx)(Gr,{orientation:`vertical`,className:`mr-2 h-4`}),(0,o.jsx)(Ge,{children:(0,o.jsx)(Ke,{children:e.crumbs?.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[(0,o.jsx)(qe,{children:(0,o.jsx)(Jc,{crumb:t,isLast:n===e.crumbs.length-1})}),n<e.crumbs.length-1&&(0,o.jsx)(Xe,{})]},n))})}),(0,o.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[e.search?.enabled&&(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(c.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(W,{type:`search`,placeholder:e.search.placeholder,className:`pl-8 w-[200px] lg:w-[300px]`}),e.search.shortcut&&(0,o.jsx)(`kbd`,{className:`pointer-events-none absolute right-2 top-2 hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex`,children:e.search.shortcut})]}),e.actions?.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},t)),e.rightContent&&(0,o.jsx)(i.SchemaRenderer,{schema:e.rightContent})]})]}),{namespace:`ui`,label:`Header Bar`,inputs:[{name:`crumbs`,type:`array`,label:`Breadcrumbs`},{name:`search`,type:`object`,label:`Search Configuration`},{name:`actions`,type:`array`,label:`Action Slots`},{name:`rightContent`,type:`object`,label:`Right Content`}],defaultProps:{crumbs:[{label:`Home`,href:`#`},{label:`Current Page`}]}}),t.ComponentRegistry.register(`badge`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(We,{variant:e.variant,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.label||z(e.body)})},{namespace:`ui`,label:`Badge`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`variant`,type:`enum`,enum:[`default`,`secondary`,`destructive`,`outline`],defaultValue:`default`,label:`Variant`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{label:`Badge`,variant:`default`}}),t.ComponentRegistry.register(`avatar`,({schema:e,className:t,...n})=>(0,o.jsxs)(Be,{className:t,...n,children:[(0,o.jsx)(Ve,{src:e.src,alt:e.alt}),(0,o.jsx)(He,{children:e.fallback})]}),{namespace:`ui`,label:`Avatar`,inputs:[{name:`src`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`fallback`,type:`string`,label:`Fallback Initials`,defaultValue:`CN`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{fallback:`CN`,alt:`Avatar`}}),t.ComponentRegistry.register(`alert`,({schema:e,className:t,...n})=>(0,o.jsxs)(V,{variant:e.variant,className:t,...n,children:[(0,o.jsx)(H,{children:e.title}),(0,o.jsx)(Re,{children:e.description||z(e.body)})]}),{namespace:`ui`,label:`Alert`,inputs:[{name:`title`,type:`string`,label:`Title`,required:!0},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`destructive`],defaultValue:`default`,label:`Variant`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Alert Title`,description:`This is an alert message.`,variant:`default`}}),t.ComponentRegistry.register(`list`,({schema:e,className:t,...n})=>{let r=(0,i.useDataScope)(e.bind),a=Array.isArray(r)?r:Array.isArray(e.items)?e.items:[],s=e.ordered?`ol`:`ul`,c=e.ordered?`list-decimal`:`list-disc`;return(0,o.jsxs)(`div`,{className:R(`space-y-2`,e.wrapperClass),children:[e.title&&(0,o.jsx)(`h3`,{className:`text-lg font-semibold tracking-tight`,children:e.title}),(0,o.jsx)(s,{className:R(`ml-6 [&>li]:mt-2`,c,t),...n,children:a.map((e,t)=>(0,o.jsx)(`li`,{className:R(typeof e==`object`&&e.className),children:typeof e==`string`?e:e.content||z(e.body)},t))})]})},{namespace:`ui`,label:`List`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`ordered`,type:`boolean`,label:`Ordered List (numbered)`,defaultValue:!1},{name:`items`,type:`array`,label:`List Items`,description:`Array of strings or objects with content/body`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{ordered:!1,items:[`First item`,`Second item`,`Third item`],className:`text-sm`}});var Yc=({node:e,onNodeClick:t})=>{let[n,r]=(0,a.useState)(!1),i=e.children&&e.children.length>0;return(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsxs)(`div`,{className:R(`group flex items-center py-1.5 px-2 rounded-sm cursor-pointer transition-colors`,`hover:bg-accent hover:text-accent-foreground`,n&&i&&`bg-accent/50`),onClick:()=>{t&&t(e)},children:[i?(0,o.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(!n)},className:`mr-2 p-0.5 h-5 w-5 flex items-center justify-center rounded-sm hover:bg-muted text-muted-foreground transition-colors`,children:n?(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4`}):(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})}):(0,o.jsx)(`span`,{className:`mr-2 w-5 flex justify-center`,children:(0,o.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-muted-foreground/50`})}),e.icon===`folder`||i?n?(0,o.jsx)(c.FolderOpen,{className:`h-4 w-4 mr-2 text-primary`}):(0,o.jsx)(c.Folder,{className:`h-4 w-4 mr-2 text-muted-foreground group-hover:text-primary transition-colors`}):(0,o.jsx)(c.File,{className:`h-4 w-4 mr-2 text-muted-foreground group-hover:text-primary transition-colors`}),(0,o.jsx)(`span`,{className:R(`text-sm transition-colors`,n?`font-medium text-foreground`:`text-muted-foreground group-hover:text-foreground`),children:e.label})]}),i&&n&&(0,o.jsx)(`div`,{className:`relative ml-[11px] pl-3 border-l border-border animate-in slide-in-from-left-2 fade-in duration-200`,children:e.children.map(e=>(0,o.jsx)(Yc,{node:e,onNodeClick:t},e.id))})]})};t.ComponentRegistry.register(`tree-view`,({schema:e,className:t,...n})=>{let r=t=>{e.onNodeClick&&e.onNodeClick(t)},a=(0,i.useDataScope)(e.bind)||e.nodes||e.data||[],s=Array.isArray(a)?a:[];return(0,o.jsxs)(`div`,{className:R(`relative border rounded-lg p-3 bg-card text-card-foreground`,t),...n,children:[e.title&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 mb-3 pb-2 border-b`,children:(0,o.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.title})}),(0,o.jsx)(`div`,{className:`space-y-1`,children:s.map(e=>(0,o.jsx)(Yc,{node:e,onNodeClick:r},e.id))})]})},{namespace:`ui`,label:`Tree View`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`nodes`,type:`array`,label:`Tree Nodes`,description:`Array of { id, label, icon, children, data }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`File Explorer`,nodes:[{id:`1`,label:`Documents`,icon:`folder`,children:[{id:`1-1`,label:`Resume.pdf`,icon:`file`},{id:`1-2`,label:`Cover Letter.docx`,icon:`file`}]},{id:`2`,label:`Photos`,icon:`folder`,children:[{id:`2-1`,label:`Vacation`,icon:`folder`,children:[{id:`2-1-1`,label:`Beach.jpg`,icon:`file`}]},{id:`2-2`,label:`Family.jpg`,icon:`file`}]},{id:`3`,label:`README.md`,icon:`file`}]}});var Xc=e=>e?Oa(e):null;t.ComponentRegistry.register(`statistic`,({schema:e})=>{let t=e.icon?Xc(e.icon):null;return(0,o.jsxs)(`div`,{className:R(`group relative flex flex-col p-4 sm:p-5 md:p-6 rounded-xl border bg-card text-card-foreground shadow-sm`,e.className),children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[e.label&&(0,o.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:e.label}),t&&(0,o.jsx)(t,{className:`h-4 w-4 text-muted-foreground`})]}),(0,o.jsx)(`div`,{className:`flex items-baseline gap-2`,children:(0,o.jsx)(`h3`,{className:`text-2xl font-bold tracking-tight`,children:e.value})}),(e.trend||e.description)&&(0,o.jsxs)(`div`,{className:`mt-1 flex items-center text-xs text-muted-foreground`,children:[e.trend===`up`&&(0,o.jsx)(c.TrendingUp,{className:`mr-1 h-3 w-3 text-emerald-500`}),e.trend===`down`&&(0,o.jsx)(c.TrendingDown,{className:`mr-1 h-3 w-3 text-rose-500`}),e.trend===`neutral`&&(0,o.jsx)(c.Minus,{className:`mr-1 h-3 w-3`}),(0,o.jsx)(`span`,{className:R(e.trend===`up`&&`text-emerald-500 font-medium`,e.trend===`down`&&`text-rose-500 font-medium`),children:e.description})]})]})},{namespace:`ui`,label:`Statistic`,category:`data-display`,icon:`Activity`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`},{name:`description`,type:`string`,label:`Description`},{name:`trend`,type:`enum`,enum:[{label:`Up`,value:`up`},{label:`Down`,value:`down`},{label:`Neutral`,value:`neutral`}],label:`Trend`}],defaultProps:{label:`Total Revenue`,value:`$45,231.89`,trend:`up`,description:`+20.1% from last month`}}),t.ComponentRegistry.register(`breadcrumb`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:a,...s}=t;return(0,o.jsx)(Ge,{className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:a,children:(0,o.jsx)(Ke,{children:e.items?.map((t,n)=>(0,o.jsxs)(`div`,{className:`flex items-center`,children:[(0,o.jsx)(qe,{children:n===(e.items?.length||0)-1?(0,o.jsx)(Ye,{children:(0,i.resolveI18nLabel)(t.label)??``}):(0,o.jsx)(Je,{href:t.href,children:(0,i.resolveI18nLabel)(t.label)??``})}),n<(e.items?.length||0)-1&&(0,o.jsx)(Xe,{})]},n))})})},{namespace:`ui`,label:`Breadcrumb`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{items:[{label:`Home`,href:`/`},{label:`Products`,href:`/products`},{label:`Product`}]}}),t.ComponentRegistry.register(`kbd`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t,s=Array.isArray(e.keys)?e.keys:[e.keys||e.label||`K`];return(0,o.jsx)(`div`,{className:R(`inline-flex flex-wrap gap-1`,e.className),children:s.map((e,t)=>(0,o.jsx)(`kbd`,{className:`pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100`,...a,...t===0?{"data-obj-id":n,"data-obj-type":r,style:i}:{},children:e},t))})},{namespace:`ui`,label:`Keyboard Key`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{label:`K`}}),t.ComponentRegistry.register(`table`,({schema:e,className:t})=>{let n=(0,i.useDataScope)(e.bind)||e.data||e.props?.data||[],r=Array.isArray(e.columns)?e.columns:Array.isArray(e.props?.columns)?e.props.columns:[];if(n&&!Array.isArray(n))return(0,o.jsx)(`div`,{className:`text-red-500 p-2 border border-red-200 bg-red-50 rounded text-sm`,children:`Table data must be an array`});let a=Array.isArray(n)?n:[];return(0,o.jsx)(`div`,{className:R(`rounded-md border`,t),children:(0,o.jsxs)(Wi,{children:[(0,o.jsx)(Gi,{children:(0,o.jsx)(Ji,{children:r.map((e,t)=>(0,o.jsx)(Yi,{children:e.label||e.header},e.key||e.accessorKey||t))})}),(0,o.jsx)(Ki,{children:a.length===0?(0,o.jsx)(Ji,{children:(0,o.jsx)(Xi,{colSpan:r.length,className:`h-24 text-center`,children:`No results.`})}):a.map((e,t)=>(0,o.jsx)(Ji,{children:r.map((t,n)=>{let r=t.key||t.accessorKey||``,i=r?e[r]:``;return(0,o.jsx)(Xi,{children:typeof i==`object`&&i?String(i):i},t.key||t.accessorKey||n)})},e.id||t))})]})})},{namespace:`ui`}),t.ComponentRegistry.register(`progress`,({schema:e,className:t,...n})=>(0,o.jsx)(Mr,{value:e.value,className:t,...n}),{namespace:`ui`,label:`Progress`,inputs:[{name:`value`,type:`number`,label:`Value`,defaultValue:0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{value:50,className:`w-full`}}),t.ComponentRegistry.register(`skeleton`,({schema:e,className:t,...n})=>(0,o.jsx)(X,{className:t,...n,style:{width:e.width,height:e.height}}),{namespace:`ui`,label:`Skeleton`,inputs:[{name:`width`,type:`string`,label:`Width`},{name:`height`,type:`string`,label:`Height`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{width:`100%`,height:`20px`,className:`rounded-md`}}),t.ComponentRegistry.register(`toaster`,()=>(0,o.jsx)(Hi,{}),{namespace:`ui`,label:`Toaster`,inputs:[],defaultProps:{}}),t.ComponentRegistry.register(`loading`,({schema:e,className:t,...n})=>{let r=e.size||`md`,i=e.fullscreen||!1,a=(0,o.jsxs)(`div`,{className:R(`flex flex-col items-center justify-center gap-2`,t),children:[(0,o.jsx)(js,{className:R(r===`sm`&&`h-4 w-4`,r===`md`&&`h-8 w-8`,r===`lg`&&`h-12 w-12`,r===`xl`&&`h-16 w-16`)}),e.text&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.text})]});return i?(0,o.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,...n,children:a}):(0,o.jsx)(`div`,{className:`flex items-center justify-center p-8`,...n,children:a})},{namespace:`ui`,label:`Loading`,inputs:[{name:`text`,type:`string`,label:`Loading Text`},{name:`size`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`],label:`Size`,defaultValue:`md`},{name:`fullscreen`,type:`boolean`,label:`Fullscreen Overlay`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{text:`Loading...`,size:`md`,fullscreen:!1}}),t.ComponentRegistry.register(`toast`,({schema:e})=>(0,o.jsx)(B,{onClick:()=>{(e.variant===`success`?P.toast.success:e.variant===`error`?P.toast.error:e.variant===`warning`?P.toast.warning:e.variant===`info`?P.toast.info:P.toast)(e.title||`Notification`,{description:e.description,duration:e.duration})},variant:e.buttonVariant,className:e.className,children:e.buttonLabel||`Show Toast`}),{namespace:`ui`,label:`Toast`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`success`,`warning`,`error`,`info`],defaultValue:`default`,label:`Variant`},{name:`duration`,type:`number`,label:`Duration (ms)`},{name:`buttonLabel`,type:`string`,label:`Button Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Notification`,buttonLabel:`Show Toast`,variant:`default`,duration:5e3}}),t.ComponentRegistry.register(`spinner`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(c.Loader2,{className:R(`animate-spin`,{sm:`h-4 w-4`,md:`h-6 w-6`,lg:`h-8 w-8`,xl:`h-12 w-12`}[e.size||`md`],e.className),...a,"data-obj-id":n,"data-obj-type":r,style:i})},{namespace:`ui`,label:`Spinner`,inputs:[{name:`size`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`],defaultValue:`md`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{size:`md`}}),t.ComponentRegistry.register(`empty`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:a,action:s,icon:c,...l}=t,u=e.action,d=u&&typeof u==`object`?(0,o.jsx)(i.SchemaRenderer,{schema:u}):void 0;return(0,o.jsx)(Xs,{title:e.title||`No data`,description:e.description,className:e.className,action:d,...l,"data-obj-id":n,"data-obj-type":r,style:a})},{namespace:`ui`,label:`Empty`,inputs:[{name:`title`,type:`string`,label:`Title`,defaultValue:`No data`},{name:`description`,type:`string`,label:`Description`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`No data`}}),t.ComponentRegistry.register(`sonner`,({schema:e,...t})=>(0,o.jsx)(B,{onClick:()=>{(e.variant===`success`?P.toast.success:e.variant===`error`?P.toast.error:e.variant===`warning`?P.toast.warning:e.variant===`info`?P.toast.info:P.toast)(e.message||e.title||`Notification`,{description:e.description})},variant:e.buttonVariant,className:e.className,...t,children:e.buttonLabel||`Show Toast`}),{namespace:`ui`,label:`Sonner Toast`,inputs:[{name:`message`,type:`string`,label:`Message`},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`success`,`error`,`warning`,`info`],defaultValue:`default`,label:`Variant`},{name:`buttonLabel`,type:`string`,label:`Button Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{message:`Notification`,buttonLabel:`Show Toast`,variant:`default`}}),t.ComponentRegistry.register(`dialog`,({schema:e,className:t,...n})=>(0,o.jsxs)(Dt,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(Ot,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(Mt,{className:t,children:[(0,o.jsxs)(Nt,{children:[e.title&&(0,o.jsx)(Ft,{children:e.title}),e.description&&(0,o.jsx)(It,{children:e.description})]}),z(e.content),e.footer&&(0,o.jsx)(Pt,{children:z(e.footer)})]})]}),{namespace:`ui`,label:`Dialog`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`modal`,type:`boolean`,label:`Modal`,defaultValue:!0},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`,description:`Element that opens the dialog`},{name:`content`,type:`slot`,label:`Content`,description:`Main content of the dialog`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Dialog Title`,description:`Dialog description goes here`,modal:!0,trigger:[{type:`button`,label:`Open Dialog`}],content:[{type:`text`,content:`Dialog content goes here`}]}}),t.ComponentRegistry.register(`sheet`,({schema:e,className:t,...n})=>(0,o.jsxs)(Kr,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(qr,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(Qr,{side:e.side||`right`,className:t,children:[(0,o.jsxs)($r,{children:[e.title&&(0,o.jsx)(ti,{children:e.title}),e.description&&(0,o.jsx)(ni,{children:e.description})]}),z(e.content),e.footer&&(0,o.jsx)(ei,{children:z(e.footer)})]})]}),{namespace:`ui`,label:`Sheet`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],defaultValue:`right`,label:`Side`},{name:`modal`,type:`boolean`,label:`Modal`,defaultValue:!0},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Sheet Title`,description:`Sheet description`,side:`right`,modal:!0,trigger:[{type:`button`,label:`Open Sheet`}],content:[{type:`text`,content:`Sheet content goes here`}]}}),t.ComponentRegistry.register(`popover`,({schema:e,className:t,...n})=>(0,o.jsxs)(kr,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(Ar,{asChild:!0,children:z(e.trigger)}),(0,o.jsx)(jr,{align:e.align,side:e.side,className:t,children:z(e.content)})]}),{namespace:`ui`,label:`Popover`,inputs:[{name:`modal`,type:`boolean`,label:`Modal`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Open Popover`,variant:`outline`}],content:[{type:`text`,content:`Popover content goes here`}],align:`center`,side:`bottom`}}),t.ComponentRegistry.register(`tooltip`,({schema:e,className:t,...n})=>(0,o.jsx)(ai,{delayDuration:e.delayDuration,children:(0,o.jsxs)(oi,{...n,children:[(0,o.jsx)(si,{asChild:!0,children:z(e.trigger)}),(0,o.jsx)(ci,{side:e.side,align:e.align,className:t,children:e.content||z(e.body)})]})}),{namespace:`ui`,label:`Tooltip`,inputs:[{name:`delayDuration`,type:`number`,label:`Delay Duration`,defaultValue:700},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`string`,label:`Content Text`},{name:`body`,type:`slot`,label:`Rich Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Hover me`,variant:`outline`}],content:`Tooltip content`,delayDuration:700,side:`top`}}),t.ComponentRegistry.register(`alert-dialog`,({schema:e,className:t,...n})=>(0,o.jsxs)(Ee,{defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(De,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(Ae,{className:t,children:[(0,o.jsxs)(je,{children:[e.title&&(0,o.jsx)(Ne,{children:e.title}),e.description&&(0,o.jsx)(Pe,{children:e.description})]}),z(e.content),(0,o.jsxs)(Me,{children:[e.cancelText&&(0,o.jsx)(Ie,{children:e.cancelText}),e.actionText&&(0,o.jsx)(Fe,{onClick:e.onAction,children:e.actionText})]})]})]}),{namespace:`ui`,label:`Alert Dialog`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`cancelText`,type:`string`,label:`Cancel Text`,defaultValue:`Cancel`},{name:`actionText`,type:`string`,label:`Action Text`,defaultValue:`Continue`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content/Body`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Are you sure?`,description:`This action cannot be undone.`,cancelText:`Cancel`,actionText:`Continue`,trigger:[{type:`button`,label:`Open Alert`,variant:`destructive`}]}}),t.ComponentRegistry.register(`drawer`,({schema:e,className:t,...n})=>(0,o.jsxs)(cn,{shouldScaleBackground:e.shouldScaleBackground,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(ln,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(pn,{className:t,children:[(0,o.jsxs)(mn,{children:[e.title&&(0,o.jsx)(gn,{children:e.title}),e.description&&(0,o.jsx)(_n,{children:e.description})]}),z(e.content),e.footer&&(0,o.jsxs)(hn,{children:[z(e.footer),e.showClose&&(0,o.jsx)(dn,{asChild:!0,children:(0,o.jsx)(`button`,{children:`Close`})})]})]})]}),{namespace:`ui`,label:`Drawer`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`shouldScaleBackground`,type:`boolean`,label:`Scale Background`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`showClose`,type:`boolean`,label:`Show Close Button in Footer`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Drawer Title`,description:`Drawer description`,trigger:[{type:`button`,label:`Open Drawer`}],content:[{type:`text`,content:`Drawer content goes here`}]}}),t.ComponentRegistry.register(`hover-card`,({schema:e,className:t,...n})=>(0,o.jsxs)(Wn,{openDelay:e.openDelay,closeDelay:e.closeDelay,...n,children:[(0,o.jsx)(Gn,{asChild:!0,children:z(e.trigger)}),(0,o.jsx)(Kn,{align:e.align,side:e.side,className:t,children:z(e.content)})]}),{namespace:`ui`,label:`Hover Card`,inputs:[{name:`openDelay`,type:`number`,label:`Open Delay`},{name:`closeDelay`,type:`number`,label:`Close Delay`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Hover me`,variant:`link`}],content:[{type:`text`,content:`Hover card content appears on hover`}],side:`top`}});var Zc=e=>e?e.map((e,t)=>e.type===`separator`?(0,o.jsx)(jn,{},t):e.type===`label`?(0,o.jsx)(An,{children:e.label},t):e.children?(0,o.jsxs)(Sn,{children:[(0,o.jsxs)(wn,{inset:e.inset,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}),(0,o.jsx)(Tn,{children:Zc(e.children)})]},t):(0,o.jsxs)(Dn,{disabled:e.disabled,inset:e.inset,onSelect:e.onSelect,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label,e.shortcut&&(0,o.jsx)(`span`,{className:`ml-auto text-xs tracking-widest opacity-60`,children:e.shortcut})]},t)):null;t.ComponentRegistry.register(`dropdown-menu`,({schema:e,className:t,...n})=>(0,o.jsxs)(vn,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(yn,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(En,{align:e.align,side:e.side,className:t,children:[e.label&&(0,o.jsx)(An,{children:e.label}),e.label&&(0,o.jsx)(jn,{}),Zc(e.items)]})]}),{namespace:`ui`,label:`Dropdown Menu`,inputs:[{name:`label`,type:`string`,label:`Menu Label`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`items`,type:`array`,label:`Items`,description:`Recursive structure: { type?: "separator"|"label", label, icon, shortcut, disabled, children: [] }`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Menu`,variant:`outline`}],items:[{label:`Item 1`},{label:`Item 2`},{type:`separator`},{label:`Item 3`}],align:`start`,side:`bottom`}});var Qc=e=>e?e.map((e,t)=>e.type===`separator`?(0,o.jsx)(on,{},t):e.type===`label`?(0,o.jsx)(an,{children:e.label},t):e.children?(0,o.jsxs)(Xt,{children:[(0,o.jsx)(Qt,{inset:e.inset,children:e.label}),(0,o.jsx)($t,{children:Qc(e.children)})]},t):(0,o.jsxs)(tn,{disabled:e.disabled,inset:e.inset,onSelect:e.onSelect,children:[e.label,e.shortcut&&(0,o.jsx)(sn,{children:e.shortcut})]},t)):null;t.ComponentRegistry.register(`context-menu`,({schema:e,className:t,...n})=>{let r=e.triggerClassName||t||e.className||`h-[120px] w-full sm:h-[150px] sm:w-[300px] border border-dashed text-sm flex items-center justify-center`,i=e.contentClassName;return(0,o.jsxs)(Kt,{modal:e.modal,...n,children:[(0,o.jsx)(qt,{asChild:!0,children:(0,o.jsx)(`div`,{className:r,children:z(e.trigger||{type:`text`,value:`Right click here`})})}),(0,o.jsx)(en,{className:i,children:Qc(e.items)})]})},{namespace:`ui`,label:`Context Menu`,inputs:[{name:`trigger`,type:`slot`,label:`Trigger Area`},{name:`triggerClassName`,type:`string`,label:`Trigger Area Class`},{name:`items`,type:`array`,label:`Items`,description:`Recursive structure: { type?: "separator"|"label", label, shortcut, children }`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{items:[{label:`Action 1`},{label:`Action 2`},{type:`separator`},{label:`Action 3`}],trigger:[{type:`text`,content:`Right click here`}]}}),t.ComponentRegistry.register(`menubar`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(nr,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.menus?.map((e,t)=>(0,o.jsxs)(Zn,{children:[(0,o.jsx)(rr,{children:e.label}),(0,o.jsx)(or,{children:e.items?.map((e,t)=>e.separator?(0,o.jsx)(dr,{},t):e.children?(0,o.jsxs)(tr,{children:[(0,o.jsx)(ir,{children:e.label}),(0,o.jsx)(ar,{children:e.children.map((e,t)=>(0,o.jsx)(sr,{children:e.label},t))})]},t):(0,o.jsx)(sr,{disabled:e.disabled,children:e.label},t))})]},t))})},{namespace:`ui`,label:`Menubar`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{menus:[{label:`File`,items:[{label:`New`},{label:`Open`},{separator:!0},{label:`Exit`}]}]}}),t.ComponentRegistry.register(`accordion`,({schema:e,className:t,...n})=>(0,o.jsx)(xe,{type:e.accordionType||`single`,collapsible:e.collapsible,className:t,...n,children:e.items?.map((e,t)=>(0,o.jsxs)(Se,{value:e.value||`item-${t}`,children:[(0,o.jsx)(Ce,{children:e.title}),(0,o.jsx)(we,{children:z(e.content)})]},e.value||t))}),{namespace:`ui`,label:`Accordion`,inputs:[{name:`accordionType`,type:`enum`,enum:[`single`,`multiple`],defaultValue:`single`,label:`Type`},{name:`collapsible`,type:`boolean`,label:`Collapsible (for single type)`},{name:`items`,type:`array`,label:`Items`,description:`Array of { trigger, content, value }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{accordionType:`single`,collapsible:!0,items:[{label:`Item 1`,value:`item-1`,content:[{type:`text`,content:`Content for item 1`}]},{label:`Item 2`,value:`item-2`,content:[{type:`text`,content:`Content for item 2`}]},{label:`Item 3`,value:`item-3`,content:[{type:`text`,content:`Content for item 3`}]}],className:`w-full`}}),t.ComponentRegistry.register(`collapsible`,({schema:e,className:t,...n})=>(0,o.jsxs)(wt,{defaultOpen:e.defaultOpen,disabled:e.disabled,className:t,...n,children:[(0,o.jsx)(Tt,{asChild:!0,children:z(e.trigger)}),(0,o.jsx)(Et,{children:z(e.content)})]}),{namespace:`ui`,label:`Collapsible`,inputs:[{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Toggle`,variant:`outline`}],content:[{type:`text`,content:`Collapsible content goes here`}],className:`w-full`}}),t.ComponentRegistry.register(`toggle-group`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,type:a,...s}=t;return(0,o.jsx)(oa,{type:e.selectionType||`single`,variant:e.variant,size:e.size,value:e.value,className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:i,children:e.items?.map((e,t)=>(0,o.jsx)(sa,{value:e.value,"aria-label":e.label,children:e.label},t))})},{namespace:`ui`,label:`Toggle Group`,inputs:[{name:`selectionType`,type:`enum`,enum:[`single`,`multiple`],defaultValue:`single`,label:`Selection Type`},{name:`variant`,type:`enum`,enum:[`default`,`outline`],defaultValue:`default`,label:`Variant`},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{selectionType:`single`,variant:`default`,size:`default`,items:[{value:`bold`,label:`Bold`},{value:`italic`,label:`Italic`},{value:`underline`,label:`Underline`}]}}),t.ComponentRegistry.register(`carousel`,({schema:e,className:t,...n})=>(0,o.jsxs)(ct,{opts:e.opts,orientation:e.orientation||`horizontal`,className:t,...n,children:[(0,o.jsx)(lt,{children:e.items?.map((t,n)=>(0,o.jsx)(ut,{className:e.itemClassName,children:z(t)},n))}),e.showArrows&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(dt,{}),(0,o.jsx)(ft,{})]})]}),{namespace:`ui`,label:`Carousel`,inputs:[{name:`orientation`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Orientation`},{name:`showArrows`,type:`boolean`,label:`Show Arrows`,defaultValue:!0},{name:`items`,type:`array`,label:`Items`,description:`Array of content schemas`},{name:`itemClassName`,type:`string`,label:`Item CSS Class`},{name:`className`,type:`string`,label:`Container CSS Class`}],defaultProps:{orientation:`horizontal`,showArrows:!0,items:[[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 1`}]}],[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 2`}]}],[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 3`}]}]],className:`w-full max-w-xs`}}),t.ComponentRegistry.register(`filter-builder`,({schema:e,className:t,onChange:n,...r})=>(0,o.jsxs)(`div`,{className:e.wrapperClass||``,children:[e.label&&(0,o.jsx)(`label`,{className:`text-sm font-medium mb-2 block`,children:e.label}),(0,o.jsx)(Wo,{fields:e.fields||[],value:e.value||r.value,onChange:t=>{n&&n({target:{name:e.name,value:t}})},className:t,...r})]}),{namespace:`ui`,label:`Filter Builder`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Name`,required:!0},{name:`fields`,type:`array`,label:`Fields`,description:`Array of { value: string, label: string, type?: string } objects`,required:!0},{name:`value`,type:`object`,label:`Initial Value`,description:`FilterGroup object with conditions`}],defaultProps:{label:`Filters`,name:`filters`,fields:[{value:`name`,label:`Name`,type:`text`},{value:`email`,label:`Email`,type:`text`},{value:`age`,label:`Age`,type:`number`},{value:`status`,label:`Status`,type:`text`}],value:{id:`root`,logic:`and`,conditions:[]}}}),t.ComponentRegistry.register(`scroll-area`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n,c=e.orientation||`vertical`;return(0,o.jsxs)(Rr,{className:t,style:{height:e.height,width:e.width,...a},...s,"data-obj-id":r,"data-obj-type":i,children:[z(e.children),(c===`horizontal`||c===`both`)&&(0,o.jsx)(zr,{orientation:`horizontal`}),(c===`vertical`||c===`both`)&&(0,o.jsx)(zr,{orientation:`vertical`})]})},{namespace:`ui`,label:`Scroll Area`,inputs:[{name:`height`,type:`string`,label:`Height (e.g. 200px)`},{name:`width`,type:`string`,label:`Width`},{name:`orientation`,type:`enum`,enum:[`vertical`,`horizontal`,`both`],defaultValue:`vertical`,label:`Orientation`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{height:`200px`,width:`100%`,orientation:`vertical`,children:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Scrollable content goes here. Add more content to see scrolling behavior.`}]}],className:`rounded-md border`}}),t.ComponentRegistry.register(`resizable`,({schema:e,className:t,...n})=>{let r=Array.isArray(e.panels)?e.panels:[];return(0,o.jsx)(Fr,{orientation:e.direction||`horizontal`,className:t,...n,style:{minHeight:e.minHeight||`200px`},children:r.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[(0,o.jsx)(Ir,{defaultSize:t.defaultSize,minSize:t.minSize,maxSize:t.maxSize,children:z(t.content)}),n<r.length-1&&(0,o.jsx)(Lr,{withHandle:e.withHandle})]},n))})},{namespace:`ui`,label:`Resizable Panel Group`,inputs:[{name:`direction`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Direction`},{name:`minHeight`,type:`string`,label:`Min Height`},{name:`withHandle`,type:`boolean`,label:`Show Handle Icon`,defaultValue:!0},{name:`panels`,type:`array`,label:`Panels`,description:`Array of { defaultSize, minSize, maxSize, content }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`horizontal`,minHeight:`200px`,withHandle:!0,panels:[{defaultSize:50,content:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Panel 1`}]}]},{defaultSize:50,content:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Panel 2`}]}]}],className:`rounded-lg border`}}),t.ComponentRegistry.register(`table`,({schema:e,className:t,...n})=>(0,o.jsxs)(Wi,{className:t,...n,children:[e.caption&&(0,o.jsx)(Zi,{children:e.caption}),(0,o.jsx)(Gi,{children:(0,o.jsx)(Ji,{children:e.columns?.map((e,t)=>(0,o.jsx)(Yi,{className:e.className,style:{width:e.width},children:e.header||e.label},t))})}),(0,o.jsx)(Ki,{children:e.data?.map((t,n)=>(0,o.jsx)(Ji,{children:e.columns?.map((e,n)=>(0,o.jsx)(Xi,{className:e.cellClassName,children:t[e.accessorKey||e.name]},n))},n))}),e.footer&&(0,o.jsx)(qi,{children:(0,o.jsx)(Ji,{children:(0,o.jsx)(Xi,{colSpan:e.columns?.length,children:typeof e.footer==`string`?e.footer:z(e.footer)})})})]}),{namespace:`ui`,label:`Table`,inputs:[{name:`caption`,type:`string`,label:`Caption`},{name:`footer`,type:`string`,label:`Footer Content`},{name:`columns`,type:`array`,label:`Columns`,description:`Array of { header, accessorKey, className, width }`},{name:`data`,type:`array`,label:`Data`,description:`Array of objects`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{caption:`Table Caption`,columns:[{header:`Column 1`,accessorKey:`col1`},{header:`Column 2`,accessorKey:`col2`},{header:`Column 3`,accessorKey:`col3`}],data:[{col1:`Row 1, Col 1`,col2:`Row 1, Col 2`,col3:`Row 1, Col 3`},{col1:`Row 2, Col 1`,col2:`Row 2, Col 2`,col3:`Row 2, Col 3`},{col1:`Row 3, Col 1`,col2:`Row 3, Col 2`,col3:`Row 3, Col 3`}]}});var $c={"table.rowsPerPage":`Rows per page`,"table.pageInfo":`Page {{current}} of {{total}}`,"table.totalRecords":`{{count}} total`,"table.noResults":`No results found`,"table.noResultsHint":`Try adjusting your filters or search query.`,"table.sortAsc":`Sort ascending`,"table.sortDesc":`Sort descending`,"table.hideColumn":`Hide column`,"table.cancelAll":`Cancel All`,"table.saveAll":`Save All ({{count}})`,"table.exportCSV":`Export CSV`,"table.addRecord":`Add record`,"table.open":`Open`,"table.search":`Search...`,"table.modified":`{{count}} row modified`,"table.selected":`{{count}} selected`,"table.edit":`Edit`,"table.delete":`Delete`,"common.actions":`Actions`};function el(){try{let e=(0,i.useObjectTranslation)();return e.t(`table.rowsPerPage`)===`table.rowsPerPage`?{t:(e,t)=>{let n=$c[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:e.language||`en`}:{t:e.t,language:e.language||`en`}}catch{return{t:(e,t)=>{let n=$c[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:`en`}}}t.ComponentRegistry.register(`data-table`,({schema:e})=>{let{caption:n,columns:r=[],data:i=[],pagination:s=!0,pageSize:l=10,pageSizeOptions:u,manualPagination:d=!1,rowCount:f,page:p,onPageChange:m,onPageSizeChange:h,searchable:g=!0,selectable:_=!1,sortable:v=!0,exportable:y=!1,rowActions:b=!1,resizableColumns:x=!0,reorderableColumns:S=!0,editable:C=!1,singleClickEdit:w=!1,selectionStyle:T=`always`,rowClassName:E,rowStyle:D,className:O,cellClassName:k,frozenColumns:A=0,showRowNumbers:j=!1,showAddRow:ee=!1,borderless:te=!1,disableInnerScroll:M=!1}=e,{t:N,language:ne}=el(),re=/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,ie=a.default.useCallback(e=>{if(typeof e!=`string`||e.length<8||!re.test(e))return e;let t=Date.parse(e);if(Number.isNaN(t))return e;let n=e.includes(`T`);try{return new Intl.DateTimeFormat(ne,n?{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}:{year:`numeric`,month:`short`,day:`numeric`}).format(new Date(t))}catch{return e}},[ne]),ae=Array.isArray(i)?i:[],P=(0,a.useMemo)(()=>r.map(e=>({...e,header:e.header||e.label,accessorKey:e.accessorKey||e.name})),[r]),oe=(0,a.useMemo)(()=>{let e={},t=r.map(e=>({header:e.header||e.label,accessorKey:e.accessorKey||e.name,width:e.width}));for(let n of t){if(n.width)continue;let t=(n.header||``).length,r=ae.slice(0,50);for(let e of r){let r=e[n.accessorKey],i=r==null?0:String(r).length;i>t&&(t=i)}e[n.accessorKey]=Math.min(400,Math.max(80,t*8+48))}return e},[r,ae]),[se,ce]=(0,a.useState)(``),[le,F]=(0,a.useState)(null),[ue,de]=(0,a.useState)(null),[fe,pe]=(0,a.useState)(new Set),[me,he]=(0,a.useState)(1),[I,ge]=(0,a.useState)(l),[_e,ve]=(0,a.useState)(P),[L,z]=(0,a.useState)({}),[ye,be]=(0,a.useState)(null),[xe,Se]=(0,a.useState)(null),[Ce,we]=(0,a.useState)(null),[Te,Ee]=(0,a.useState)(``),[De,Oe]=(0,a.useState)(new Map),[ke,Ae]=(0,a.useState)(!1),[je,Me]=(0,a.useState)(null),Ne=(0,a.useRef)(null),Pe=(0,a.useRef)(0),Fe=(0,a.useRef)(0),Ie=(0,a.useRef)(null);(0,a.useEffect)(()=>{ve(P)},[P]);let Le=(0,a.useMemo)(()=>se?ae.filter(e=>_e.some(t=>e[t.accessorKey]?.toString().toLowerCase().includes(se.toLowerCase()))):ae,[ae,se,_e]),V=(0,a.useMemo)(()=>!le||!ue?Le:[...Le].sort((e,t)=>{let n=e[le],r=t[le];if(n===r)return 0;let i=n<r?-1:1;return ue===`asc`?i:-i}),[Le,le,ue]),H=d?Math.max(1,p??1):me,Re=d?Math.max(1,Math.ceil((f??V.length)/I)):Math.ceil(V.length/I),ze=s&&!d?V.slice((me-1)*I,me*I):V,Be=e=>{let t=Math.min(Re,Math.max(1,e));d?m?.(t):he(t)},Ve=e=>{ge(e),d?(h?.(e),m?.(1)):he(1)},He=a.default.useMemo(()=>{let e=u&&u.length>0?u:[5,10,20,50,100];return Array.from(new Set([...e,I])).filter(e=>Number.isFinite(e)&&e>0).sort((e,t)=>e-t)},[u,I]),Ue=(e,t)=>e.id===void 0?`row-${t}`:e.id,We=e=>{v&&(le===e?ue===`asc`?de(`desc`):ue===`desc`&&(de(null),F(null)):(F(e),de(`asc`)))},Ge=(e,t)=>{e.preventDefault(),Me({x:e.clientX,y:e.clientY,columnKey:t})},Ke=e=>{ve(t=>t.filter(t=>t.accessorKey!==e)),Me(null)};(0,a.useEffect)(()=>{if(!je)return;let e=()=>Me(null);return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[je]);let qe=t=>{let n=new Set;if(t&&ze.forEach((e,t)=>{let r=Ue(e,(H-1)*I+t);n.add(r)}),pe(n),e.onSelectionChange){let t=V.filter((e,t)=>{let r=Ue(e,t);return n.has(r)});e.onSelectionChange(t)}},Je=(t,n)=>{let r=new Set(fe);if(n?r.add(t):r.delete(t),pe(r),e.onSelectionChange){let t=V.filter((e,t)=>{let n=Ue(e,t);return r.has(n)});e.onSelectionChange(t)}},Ye=()=>{let e=[_e.map(e=>e.header).join(`,`),...V.map(e=>_e.map(t=>JSON.stringify(e[t.accessorKey]||``)).join(`,`))].join(`
|
|
19
|
-
`),t=new Blob([e],{type:`text/csv`}),n=window.URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`table-export.csv`,r.click(),window.URL.revokeObjectURL(n)},Xe=e=>le===e?ue===`asc`?(0,o.jsx)(c.ChevronUp,{className:`h-3 w-3 ml-0.5 text-primary`}):(0,o.jsx)(c.ChevronDown,{className:`h-3 w-3 ml-0.5 text-primary`}):(0,o.jsx)(c.ChevronsUpDown,{className:`h-3 w-3 ml-0.5 opacity-0 group-hover:opacity-50 transition-opacity`}),Ze=(e,t)=>{if(!x)return;e.preventDefault(),e.stopPropagation(),Ne.current=t,Pe.current=e.clientX;let n=e.target.closest(`th`);n&&(Fe.current=n.offsetWidth),document.addEventListener(`mousemove`,Qe),document.addEventListener(`mouseup`,$e)},Qe=e=>{if(!Ne.current)return;let t=e.clientX-Pe.current,n=Math.max(50,Fe.current+t);z(e=>({...e,[Ne.current]:n}))},$e=()=>{Ne.current=null,document.removeEventListener(`mousemove`,Qe),document.removeEventListener(`mouseup`,$e)},et=(e,t)=>{S&&(be(t),e.dataTransfer.effectAllowed=`move`)},tt=(e,t)=>{S&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,Se(t))},nt=(t,n)=>{if(!S||ye===null)return;if(t.preventDefault(),ye===n){be(null),Se(null);return}let r=[..._e],[i]=r.splice(ye,1);r.splice(n,0,i),ve(r),be(null),Se(null),e.onColumnsReorder&&e.onColumnsReorder(r)},rt=()=>{be(null),Se(null)},it=(e,t)=>{if(!C||_e.find(e=>e.accessorKey===t)?.editable===!1)return;we({rowIndex:e,columnKey:t});let n=De.get(e),r=ze[e][t];Ee(n?.[t]??r??``)},at=(t=!1)=>{if(!Ce||!t&&Ce===null)return;let{rowIndex:n,columnKey:r}=Ce,i=(H-1)*I+n,a=V[d?n:i],o=new Map(De),s=o.get(n)||{};s[r]=Te,o.set(n,s),Oe(o),e.onCellChange&&e.onCellChange(i,r,Te,a),we(null),Ee(``)},ot=()=>{we(null),Ee(``)},st=async t=>{let n=(H-1)*I+t,r=V[d?t:n],i=De.get(t);if(!(!i||Object.keys(i).length===0)){Ae(!0);try{e.onRowSave&&await e.onRowSave(n,i,r);let a=new Map(De);a.delete(t),Oe(a)}catch(e){console.error(`Failed to save row:`,e)}finally{Ae(!1)}}},ct=e=>{let t=new Map(De);t.delete(e),Oe(t)},lt=async()=>{if(De.size!==0){Ae(!0);try{let t=Array.from(De.entries()).map(([e,t])=>{let n=(H-1)*I+e;return{rowIndex:n,changes:t,row:V[d?e:n]}});e.onBatchSave&&await e.onBatchSave(t),Oe(new Map)}catch(e){console.error(`Failed to save batch:`,e)}finally{Ae(!1)}}},ut=()=>{Oe(new Map)},dt=(e,t,n)=>{if((e.ctrlKey||e.metaKey)&&e.key===`c`&&!Ce){e.preventDefault();let r=(H-1)*I+t,i=V[d?t:r];if(i){let e=i[n],t=e==null?``:String(e);navigator.clipboard.writeText(t).catch(()=>{})}return}C&&_e.find(e=>e.accessorKey===n)?.editable!==!1&&e.key===`Enter`&&!Ce&&(e.preventDefault(),it(t,n))},ft=e=>{e.key===`Enter`?(e.preventDefault(),at(!0)):e.key===`Escape`&&(e.preventDefault(),ot())};(0,a.useEffect)(()=>{Ce&&Ie.current&&(Ie.current.focus(),Ie.current.select())},[Ce]),(0,a.useEffect)(()=>()=>{document.removeEventListener(`mousemove`,Qe),document.removeEventListener(`mouseup`,$e)},[]);let pt=ze.length>0&&ze.every((e,t)=>{let n=Ue(e,(H-1)*I+t);return fe.has(n)}),mt=ze.some((e,t)=>{let n=Ue(e,(H-1)*I+t);return fe.has(n)})&&!pt,ht=De.size>0,gt=g||y||_&&fe.size>0||ht;return(0,o.jsxs)(`div`,{className:`flex flex-col h-full gap-2 sm:gap-4 ${O||``}`,children:[gt&&(0,o.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2 sm:gap-4 flex-none`,children:[(0,o.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:g&&(0,o.jsxs)(`div`,{className:`relative w-full sm:max-w-sm flex-1`,children:[(0,o.jsx)(c.Search,{className:`absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(W,{placeholder:N(`table.search`),value:se,onChange:e=>{ce(e.target.value),he(1)},className:`pl-8`})]})}),(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[ht&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:N(`table.modified`,{count:De.size})}),(0,o.jsxs)(B,{variant:`outline`,size:`sm`,onClick:ut,disabled:ke,children:[(0,o.jsx)(c.X,{className:`h-4 w-4 mr-2`}),N(`table.cancelAll`)]}),(0,o.jsxs)(B,{variant:`default`,size:`sm`,onClick:lt,disabled:ke,children:[(0,o.jsx)(c.Save,{className:`h-4 w-4 mr-2`}),N(`table.saveAll`,{count:De.size})]})]}),y&&(0,o.jsxs)(B,{variant:`outline`,size:`sm`,onClick:Ye,disabled:V.length===0,children:[(0,o.jsx)(c.Download,{className:`h-4 w-4 mr-2`}),N(`table.exportCSV`)]}),_&&fe.size>0&&(0,o.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:N(`table.selected`,{count:fe.size})})]})]}),(0,o.jsx)(`div`,{className:R(`relative bg-background`,M?`overflow-visible`:`flex-1 min-h-0 overflow-auto [-webkit-overflow-scrolling:touch]`,!te&&`rounded-md border shadow-[inset_-8px_0_8px_-8px_rgba(0,0,0,0.08)]`),children:(0,o.jsxs)(Wi,{children:[n&&(0,o.jsx)(Zi,{children:n}),(0,o.jsx)(Gi,{className:`sticky top-0 bg-background z-10`,children:(0,o.jsxs)(Ji,{children:[_&&(0,o.jsx)(Yi,{className:R(`w-10 bg-background px-3`,A>0&&`sticky left-0 z-20`),children:(0,o.jsx)(Ct,{checked:pt?!0:mt?`indeterminate`:!1,onCheckedChange:qe})}),j&&(0,o.jsx)(Yi,{className:R(`w-10 bg-background text-center px-3`,A>0&&`sticky z-20`),style:A>0?{left:_?40:0}:void 0,children:(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`#`})}),_e.map((e,t)=>{let n=L[e.accessorKey]||e.width||oe[e.accessorKey],r=ye===t,i=xe===t,a=A>0&&t<A,s=a?_e.slice(0,t).reduce((e,t,n)=>{if(n<A){let n=L[t.accessorKey]||t.width||oe[t.accessorKey];return e+(typeof n==`number`?n:n&&parseInt(String(n),10)||150)}return e},(_?40:0)+(j?40:0)):void 0;return(0,o.jsx)(Yi,{className:R(e.className,v&&e.sortable!==!1&&`cursor-pointer select-none`,r&&`opacity-50`,i&&`border-l-2 border-primary`,e.align===`right`&&`text-right`,e.align===`center`&&`text-center`,`relative group bg-background`,a&&`sticky z-20`,a&&t===A-1&&`border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]`),style:{width:n,minWidth:n,...a&&{left:s}},draggable:S,onDragStart:e=>et(e,t),onDragOver:e=>tt(e,t),onDrop:e=>nt(e,t),onDragEnd:rt,onClick:()=>v&&e.sortable!==!1&&We(e.accessorKey),onContextMenu:t=>Ge(t,e.accessorKey),children:(0,o.jsxs)(`div`,{className:R(`flex items-center`,e.align===`right`?`justify-end`:`justify-between`),children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[S&&(0,o.jsx)(c.GripVertical,{className:`h-4 w-4 opacity-0 group-hover:opacity-50 cursor-grab active:cursor-grabbing shrink-0`}),e.headerIcon&&(0,o.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e.headerIcon}),(0,o.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground whitespace-nowrap truncate`,children:e.header}),v&&e.sortable!==!1&&Xe(e.accessorKey)]}),x&&e.resizable!==!1&&(0,o.jsx)(`div`,{className:`absolute right-0 top-0 h-full w-1 cursor-col-resize hover:bg-primary opacity-0 hover:opacity-100 transition-opacity`,onMouseDown:t=>Ze(t,e.accessorKey),onClick:e=>e.stopPropagation()})]})},e.accessorKey)}),b&&(0,o.jsx)(Yi,{className:`w-24 text-right bg-background`,children:N(`common.actions`)})]})}),(0,o.jsx)(Ki,{children:ze.length===0?(0,o.jsx)(Ji,{className:`hover:bg-transparent`,children:(0,o.jsx)(Xi,{colSpan:_e.length+ +!!_+ +!!j+ +!!b,className:`h-48 text-center text-muted-foreground border-0`,children:(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3`,children:[(0,o.jsx)(c.Search,{className:`h-8 w-8 text-muted-foreground/50`}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`p`,{children:N(`table.noResults`)}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground/50`,children:N(`table.noResultsHint`)})]}),e.emptyAction&&(()=>{let n=e.emptyAction,r=n?.type?t.ComponentRegistry.get(n.type):null;return r?(0,o.jsx)(r,{schema:n}):null})()]})})}):(0,o.jsxs)(o.Fragment,{children:[ze.map((t,n)=>{let r=(H-1)*I+n,i=Ue(t,r),a=fe.has(i),s=De.has(n),l=De.get(n)||{};return(0,o.jsxs)(Ji,{"data-state":a?`selected`:void 0,className:R(`bg-background border-b border-border/60 group/row transition-colors`,`hover:bg-muted/40`,`data-[state=selected]:bg-primary/5 data-[state=selected]:hover:bg-primary/10`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset`,e.onRowClick&&`cursor-pointer`,s&&`bg-amber-50 dark:bg-amber-950/20`,E&&E(t,n)),style:D?D(t,n):void 0,onClick:n=>{if(e.onRowClick&&!n.defaultPrevented){let r=n.target;if(r.closest(`button`)||r.closest(`a`)||r.closest(`input, select, textarea, label`)||r.closest(`[role="checkbox"]`)||r.closest(`[role="menu"]`)||r.closest(`[role="menuitem"]`)||r.closest(`[role="menuitemcheckbox"]`)||r.closest(`[role="menuitemradio"]`)||r.closest(`[role="dialog"]`)||r.closest(`[role="alertdialog"]`)||r.closest(`[role="listbox"]`)||r.closest(`[role="option"]`)||r.closest(`[role="tab"]`)||r.closest(`[data-radix-popper-content-wrapper]`))return;e.onRowClick(t)}},children:[_&&(0,o.jsx)(Xi,{className:R(k,`px-3`,A>0&&`sticky left-0 z-10 bg-background`,T===`hover`&&`relative`),children:T===`hover`?(0,o.jsx)(`div`,{className:R(`transition-opacity`,a?`opacity-100`:`opacity-0 group-hover/row:opacity-100`),children:(0,o.jsx)(Ct,{checked:a,onCheckedChange:e=>Je(i,e)})}):(0,o.jsx)(Ct,{checked:a,onCheckedChange:e=>Je(i,e)})}),j&&(0,o.jsxs)(Xi,{className:R(`text-center w-10 relative`,k,A>0&&`sticky z-10 bg-background`),style:A>0?{left:_?40:0}:void 0,children:[(0,o.jsx)(`span`,{className:R(`text-xs text-muted-foreground tabular-nums select-none`,!_&&e.onRowClick&&`group-hover/row:invisible`),children:r+1}),!_&&e.onRowClick&&(0,o.jsxs)(`button`,{type:`button`,className:`absolute inset-0 hidden group-hover/row:flex items-center justify-center gap-0.5 text-xs font-medium text-primary hover:text-primary/80`,"data-testid":`row-expand-button`,onClick:n=>{n.stopPropagation(),e.onRowClick?.(t)},title:`Open record`,children:[(0,o.jsx)(`span`,{children:N(`table.open`)}),(0,o.jsx)(c.ChevronRight,{className:`h-3 w-3`})]})]}),_e.map((e,r)=>{let i=L[e.accessorKey]||e.width||oe[e.accessorKey],a=t[e.accessorKey],s=l[e.accessorKey]!==void 0,c=s?l[e.accessorKey]:a,u=Ce?.rowIndex===n&&Ce?.columnKey===e.accessorKey,d=C&&e.editable!==!1,f=A>0&&r<A,p=f?_e.slice(0,r).reduce((e,t,n)=>{if(n<A){let n=L[t.accessorKey]||t.width||oe[t.accessorKey];return e+(typeof n==`number`?n:n&&parseInt(String(n),10)||150)}return e},(_?40:0)+(j?40:0)):void 0;return(0,o.jsx)(Xi,{className:R(e.cellClassName,e.align===`right`&&`text-right`,e.align===`center`&&`text-center`,`overflow-hidden`,d&&!u&&`cursor-text hover:bg-muted/50`,s&&`font-semibold text-amber-700 dark:text-amber-400`,f&&`sticky z-10 bg-background`,f&&r===A-1&&`border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]`),style:{width:i,minWidth:i,maxWidth:i,...f&&{left:p}},onDoubleClick:()=>d&&!w&&it(n,e.accessorKey),onClick:()=>d&&w&&it(n,e.accessorKey),onKeyDown:t=>dt(t,n,e.accessorKey),tabIndex:0,children:u?(0,o.jsx)(W,{ref:Ie,value:Te,onChange:e=>Ee(e.target.value),onKeyDown:ft,className:`h-8 px-2 py-1`}):(0,o.jsx)(`div`,{className:`truncate w-full`,title:c!=null&&typeof c!=`object`?String(c):void 0,children:typeof e.cell==`function`?e.cell(c,t):typeof c==`object`&&c?String(c):ie(c)})},r)}),b&&(0,o.jsx)(Xi,{className:R(`text-right`,k),children:(0,o.jsx)(`div`,{className:`flex items-center justify-end gap-1`,children:s&&(e.onRowSave||e.onBatchSave)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(B,{variant:`ghost`,size:`icon`,onClick:()=>ct(n),disabled:ke,title:`Cancel changes`,children:(0,o.jsx)(c.X,{className:`h-4 w-4`})}),(0,o.jsx)(B,{variant:`ghost`,size:`icon`,onClick:()=>st(n),disabled:ke,title:`Save row`,children:(0,o.jsx)(c.Save,{className:`h-4 w-4 text-green-600`})})]}):(e.onRowEdit||e.onRowDelete)&&(0,o.jsxs)(vn,{children:[(0,o.jsx)(yn,{asChild:!0,children:(0,o.jsx)(B,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:e=>e.stopPropagation(),"aria-label":`Row actions`,children:(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`})})}),(0,o.jsxs)(En,{align:`end`,onClick:e=>e.stopPropagation(),children:[e.onRowEdit&&(0,o.jsxs)(Dn,{onClick:()=>e.onRowEdit?.(t),children:[(0,o.jsx)(c.Edit,{className:`mr-2 h-4 w-4`}),N(`table.edit`)]}),e.onRowEdit&&e.onRowDelete&&(0,o.jsx)(jn,{}),e.onRowDelete&&(0,o.jsxs)(Dn,{onClick:()=>e.onRowDelete?.(t),className:`text-destructive focus:text-destructive`,children:[(0,o.jsx)(c.Trash2,{className:`mr-2 h-4 w-4`}),N(`table.delete`)]})]})]})})})]},i)}),ee&&(0,o.jsx)(Ji,{className:`hover:bg-muted/30 cursor-pointer border-b border-border`,"data-testid":`add-record-row`,onClick:()=>e.onAddRecord?.(),children:(0,o.jsx)(Xi,{colSpan:_e.length+ +!!_+ +!!j+ +!!b,className:`h-9 px-3 py-1.5`,children:(0,o.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground text-sm hover:text-foreground transition-colors`,children:[(0,o.jsx)(c.Plus,{className:`h-3.5 w-3.5`}),N(`table.addRecord`)]})})})]})})]})}),s&&V.length>0&&Re>1&&(0,o.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-center justify-between gap-2 px-3 sm:px-4 py-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(`span`,{className:`text-xs sm:text-sm text-muted-foreground`,children:[N(`table.rowsPerPage`),`:`]}),(0,o.jsxs)(G,{value:I.toString(),onValueChange:e=>Ve(Number(e)),children:[(0,o.jsx)(q,{className:`w-20`,children:(0,o.jsx)(K,{})}),(0,o.jsx)(J,{children:He.map(e=>(0,o.jsx)(Y,{value:e.toString(),children:e},e))})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`text-xs sm:text-sm text-muted-foreground`,children:N(`table.pageInfo`,{current:H,total:Re})}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,o.jsx)(B,{variant:`outline`,size:`icon`,onClick:()=>Be(1),disabled:H===1,children:(0,o.jsx)(c.ChevronsLeft,{className:`h-4 w-4`})}),(0,o.jsx)(B,{variant:`outline`,size:`icon`,onClick:()=>Be(H-1),disabled:H===1,children:(0,o.jsx)(c.ChevronLeft,{className:`h-4 w-4`})}),(0,o.jsx)(B,{variant:`outline`,size:`icon`,onClick:()=>Be(H+1),disabled:H===Re,children:(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})}),(0,o.jsx)(B,{variant:`outline`,size:`icon`,onClick:()=>Be(Re),disabled:H===Re,children:(0,o.jsx)(c.ChevronsRight,{className:`h-4 w-4`})})]})]})]}),je&&(0,o.jsxs)(`div`,{className:`fixed z-50 min-w-[160px] rounded-md border bg-popover p-1 shadow-md`,style:{left:je.x,top:je.y},"data-testid":`column-context-menu`,onClick:e=>e.stopPropagation(),children:[v&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>{F(je.columnKey),de(`asc`),Me(null)},children:[(0,o.jsx)(c.ChevronUp,{className:`h-3.5 w-3.5`}),N(`table.sortAsc`)]}),(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>{F(je.columnKey),de(`desc`),Me(null)},children:[(0,o.jsx)(c.ChevronDown,{className:`h-3.5 w-3.5`}),N(`table.sortDesc`)]}),(0,o.jsx)(`div`,{className:`my-1 h-px bg-border`})]}),(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>Ke(je.columnKey),children:[(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`}),N(`table.hideColumn`)]})]})]})},{namespace:`ui`,label:`Data Table`,icon:`table`,inputs:[{name:`caption`,type:`string`,label:`Caption`},{name:`columns`,type:`array`,label:`Columns`,description:`Array of { header, accessorKey, className, width, sortable, filterable, resizable }`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Array of data objects`,required:!0},{name:`pagination`,type:`boolean`,label:`Enable Pagination`,defaultValue:!0},{name:`pageSize`,type:`number`,label:`Page Size`,defaultValue:10},{name:`searchable`,type:`boolean`,label:`Enable Search`,defaultValue:!0},{name:`selectable`,type:`boolean`,label:`Enable Row Selection`,defaultValue:!1},{name:`sortable`,type:`boolean`,label:`Enable Sorting`,defaultValue:!0},{name:`exportable`,type:`boolean`,label:`Enable Export`,defaultValue:!1},{name:`rowActions`,type:`boolean`,label:`Show Row Actions`,defaultValue:!1},{name:`resizableColumns`,type:`boolean`,label:`Enable Column Resizing`,defaultValue:!0},{name:`reorderableColumns`,type:`boolean`,label:`Enable Column Reordering`,defaultValue:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{caption:`Enterprise Data Table`,pagination:!0,pageSize:10,searchable:!0,selectable:!0,sortable:!0,exportable:!0,rowActions:!0,resizableColumns:!0,reorderableColumns:!0,columns:[{header:`ID`,accessorKey:`id`,width:`80px`},{header:`Name`,accessorKey:`name`},{header:`Email`,accessorKey:`email`},{header:`Status`,accessorKey:`status`},{header:`Role`,accessorKey:`role`}],data:[{id:1,name:`John Doe`,email:`john@example.com`,status:`Active`,role:`Admin`},{id:2,name:`Jane Smith`,email:`jane@example.com`,status:`Active`,role:`User`},{id:3,name:`Bob Johnson`,email:`bob@example.com`,status:`Inactive`,role:`User`},{id:4,name:`Alice Williams`,email:`alice@example.com`,status:`Active`,role:`Manager`},{id:5,name:`Charlie Brown`,email:`charlie@example.com`,status:`Active`,role:`User`},{id:6,name:`Diana Prince`,email:`diana@example.com`,status:`Active`,role:`Admin`},{id:7,name:`Ethan Hunt`,email:`ethan@example.com`,status:`Inactive`,role:`User`},{id:8,name:`Fiona Gallagher`,email:`fiona@example.com`,status:`Active`,role:`User`},{id:9,name:`George Wilson`,email:`george@example.com`,status:`Active`,role:`Manager`},{id:10,name:`Hannah Montana`,email:`hannah@example.com`,status:`Active`,role:`User`},{id:11,name:`Ivan Drago`,email:`ivan@example.com`,status:`Inactive`,role:`User`},{id:12,name:`Julia Roberts`,email:`julia@example.com`,status:`Active`,role:`Admin`}]}});function tl(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var nl={Home:`House`};function rl(e){if(!e)return null;let t=tl(e);return c.icons[nl[t]||t]??null}var il=(0,a.forwardRef)(({schema:e,className:t,context:n,...r},s)=>{let{"data-obj-id":l,"data-obj-type":u,style:d,data:f,...p}=r,{execute:m}=(0,i.useAction)(),[h,g]=(0,a.useState)(!1),_=typeof f==`object`&&f?f:{},v=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),_),y=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled),_),b=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled),_),x=rl(e.icon),S=e.variant===`primary`?`default`:e.variant||`default`,C=e.size===`md`?`default`:e.size||`default`,w=(0,a.useCallback)(async()=>{if(!h){g(!0);try{let t=Array.isArray(e.params)?{actionParams:e.params}:{params:e.params};await m({type:e.actionType||e.type,name:e.name,label:e.label,description:e.description,target:e.target,execute:e.execute,endpoint:e.endpoint,method:e.method,...t,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,undoable:e.undoable,recordIdField:e.recordIdField,toast:e.toast,resultDialog:e.resultDialog,...n})}finally{g(!1)}}},[e,m,h,n]);return e.visible&&!v?null:(0,o.jsxs)(B,{ref:s,type:`button`,variant:S,size:C,className:R(e.className,t),disabled:(e.disabled==null?e.enabled==null?!1:!b:y)||h,onClick:w,...p,"data-obj-id":l,"data-obj-type":u,style:d,children:[h&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!h&&x&&(0,o.jsx)(x,{className:R(`h-4 w-4`,e.label&&`mr-2`)}),e.label]})});il.displayName=`ActionButtonRenderer`,t.ComponentRegistry.register(`action:button`,il,{namespace:`action`,label:`Action Button`,inputs:[{name:`name`,type:`string`,label:`Action Name`},{name:`label`,type:`string`,label:`Label`,defaultValue:`Action`},{name:`icon`,type:`string`,label:`Icon`},{name:`type`,type:`enum`,label:`Action Type`,enum:[`script`,`url`,`modal`,`flow`,`api`],defaultValue:`script`},{name:`target`,type:`string`,label:`Target`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`primary`,`secondary`,`destructive`,`outline`,`ghost`],defaultValue:`default`},{name:`size`,type:`enum`,label:`Size`,enum:[`sm`,`md`,`lg`],defaultValue:`md`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{label:`Action`,type:`script`,variant:`default`,size:`md`}});var al=(0,a.forwardRef)(({schema:e,className:t,context:n,...r},s)=>{let{"data-obj-id":l,"data-obj-type":u,style:d,...f}=r,{execute:p}=(0,i.useAction)(),[m,h]=(0,a.useState)(!1),g=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),_=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),v=rl(e.icon),y=e.variant===`primary`?`default`:e.variant||`ghost`,b=(0,a.useCallback)(async()=>{if(!m){h(!0);try{await p({type:e.type,name:e.name,target:e.target,execute:e.execute,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,toast:e.toast,...n})}finally{h(!1)}}},[e,p,m,n]);if(e.visible&&!g)return null;let x=(0,o.jsx)(B,{ref:s,type:`button`,variant:y,size:`icon`,className:R(`h-8 w-8`,e.className,t),disabled:(e.enabled?!_:!1)||m,onClick:b,"aria-label":e.label||e.name,...f,"data-obj-id":l,"data-obj-type":u,style:d,children:m?(0,o.jsx)(c.Loader2,{className:`h-4 w-4 animate-spin`}):v?(0,o.jsx)(v,{className:`h-4 w-4`}):(0,o.jsx)(`span`,{className:`text-xs`,children:e.label?.charAt(0)||`?`})});return e.label||e.description?(0,o.jsx)(ai,{delayDuration:300,children:(0,o.jsxs)(oi,{children:[(0,o.jsx)(si,{asChild:!0,children:x}),(0,o.jsx)(ci,{children:(0,o.jsx)(`p`,{children:e.label||e.description})})]})}):x});al.displayName=`ActionIconRenderer`,t.ComponentRegistry.register(`action:icon`,al,{namespace:`action`,label:`Action Icon`,inputs:[{name:`name`,type:`string`,label:`Action Name`},{name:`label`,type:`string`,label:`Tooltip Label`},{name:`icon`,type:`string`,label:`Icon`},{name:`type`,type:`enum`,label:`Action Type`,enum:[`script`,`url`,`modal`,`flow`,`api`],defaultValue:`script`},{name:`target`,type:`string`,label:`Target`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`destructive`,`outline`,`ghost`],defaultValue:`ghost`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{icon:`play`,type:`script`,variant:`ghost`}});function ol(){try{let{t:e}=(0,F.useObjectTranslation)(),t=e(`detail.moreActions`);return!t||t===`detail.moreActions`?`More actions`:t}catch{return`More actions`}}var sl=({action:e,onExecute:t})=>{let n=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),r=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),s=(0,a.useMemo)(()=>{let t=rl(e.icon);return t?(0,o.jsx)(t,{className:`mr-2 h-4 w-4`}):null},[e.icon]);return e.visible&&!n?null:(0,o.jsxs)(Dn,{disabled:e.enabled?!r:!1,onSelect:n=>{n.preventDefault(),t(e)},className:R(e.variant===`destructive`&&`text-destructive focus:text-destructive`,e.className),children:[s,(0,o.jsx)(`span`,{children:e.label||e.name})]})};sl.displayName=`ActionMenuItem`;var cl=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":s,"data-obj-type":l,style:u,...d}=n,{execute:f}=(0,i.useAction)(),[p,m]=(0,a.useState)(!1),h=ol(),g=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),_=rl(e.icon)||c.MoreHorizontal,v=e.variant||`ghost`,y=e.size||`icon`,b=(0,a.useCallback)(async e=>{m(!0);try{if(typeof e.onClick==`function`){await e.onClick();return}await f({type:e.type,name:e.name,target:e.target,execute:e.execute,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,toast:e.toast,resultDialog:e.resultDialog})}finally{m(!1)}},[f]);if(e.visible&&!g)return null;let x=e.actions||[];return x.length===0?null:(0,o.jsxs)(vn,{children:[(0,o.jsx)(yn,{asChild:!0,children:(0,o.jsx)(B,{ref:r,type:`button`,variant:v,size:y,className:R(y===`icon`&&`h-8 w-8`,e.className,t),disabled:p,"aria-label":e.label||h,...d,"data-obj-id":s,"data-obj-type":l,style:u,children:p?(0,o.jsx)(c.Loader2,{className:`h-4 w-4 animate-spin`}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(_,{className:R(`h-4 w-4`,e.label&&`mr-2`)}),e.label&&(0,o.jsx)(`span`,{children:e.label})]})})}),(0,o.jsx)(En,{align:`end`,children:x.map((e,t)=>{let n=e.tags?.includes(`separator-before`)&&t>0;return(0,o.jsxs)(a.default.Fragment,{children:[n&&(0,o.jsx)(jn,{}),(0,o.jsx)(sl,{action:e,onExecute:b})]},e.name||t)})})]})});cl.displayName=`ActionMenuRenderer`,t.ComponentRegistry.register(`action:menu`,cl,{namespace:`action`,label:`Action Menu`,inputs:[{name:`label`,type:`string`,label:`Trigger Label`},{name:`icon`,type:`string`,label:`Trigger Icon`},{name:`actions`,type:`object`,label:`Actions`},{name:`variant`,type:`enum`,label:`Trigger Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`ghost`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{variant:`ghost`,actions:[]}});var ll=({action:e,variant:t,size:n,onExecute:r})=>{let[s,l]=(0,a.useState)(!1),u=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),d=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),f=rl(e.icon),p=e.variant===`primary`?`default`:e.variant||t||`outline`,m=e.size===`md`?`default`:e.size||n||`sm`,h=(0,a.useCallback)(async()=>{if(!s){l(!0);try{await r(e)}finally{l(!1)}}},[e,r,s]);return e.visible&&!u?null:(0,o.jsxs)(B,{type:`button`,variant:p,size:m,className:e.className,disabled:(e.enabled?!d:!1)||s,onClick:h,children:[s&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!s&&f&&(0,o.jsx)(f,{className:R(`h-4 w-4`,e.label&&`mr-2`)}),e.label]})};ll.displayName=`InlineActionButton`;var ul=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":s,"data-obj-type":l,style:u,...d}=n,{execute:f}=(0,i.useAction)(),[p,m]=(0,a.useState)(!1),h=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),g=e.actions||[];e.location&&(g=g.filter(t=>!t.locations||t.locations.includes(e.location)));let _=(0,a.useCallback)(async e=>{await f({type:e.type,name:e.name,target:e.target,execute:e.execute,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,toast:e.toast})},[f]);if(e.visible&&!h||g.length===0)return null;if((e.display||`inline`)===`dropdown`){let n=rl(e.icon);return(0,o.jsxs)(vn,{children:[(0,o.jsx)(yn,{asChild:!0,children:(0,o.jsxs)(B,{type:`button`,variant:e.variant||`outline`,size:e.size===`md`?`default`:e.size||`default`,className:R(e.className,t),disabled:p,"data-obj-id":s,"data-obj-type":l,style:u,children:[p&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!p&&n&&(0,o.jsx)(n,{className:`mr-2 h-4 w-4`}),e.label||`Actions`,(0,o.jsx)(c.ChevronDown,{className:`ml-2 h-3 w-3 opacity-50`})]})}),(0,o.jsx)(En,{align:`end`,children:g.map((e,t)=>{let n=rl(e.icon),r=e.tags?.includes(`separator-before`)&&t>0;return(0,o.jsxs)(a.default.Fragment,{children:[r&&(0,o.jsx)(jn,{}),(0,o.jsxs)(Dn,{onSelect:async t=>{t.preventDefault(),m(!0);try{await _(e)}finally{m(!1)}},className:R(e.variant===`destructive`&&`text-destructive focus:text-destructive`,e.className),children:[n&&(0,o.jsx)(n,{className:`mr-2 h-4 w-4`}),(0,o.jsx)(`span`,{children:e.label||e.name})]})]},e.name||t)})})]})}return(0,o.jsx)(`div`,{ref:r,className:R(`flex items-center gap-2`,e.className,t),...d,"data-obj-id":s,"data-obj-type":l,style:u,children:g.map(t=>(0,o.jsx)(ll,{action:t,variant:e.variant,size:e.size,onExecute:_},t.name))})});ul.displayName=`ActionGroupRenderer`,t.ComponentRegistry.register(`action:group`,ul,{namespace:`action`,label:`Action Group`,inputs:[{name:`name`,type:`string`,label:`Group Name`},{name:`label`,type:`string`,label:`Label`},{name:`icon`,type:`string`,label:`Icon`},{name:`actions`,type:`object`,label:`Actions`},{name:`display`,type:`enum`,label:`Display Mode`,enum:[`inline`,`dropdown`],defaultValue:`inline`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`outline`},{name:`size`,type:`enum`,label:`Size`,enum:[`sm`,`md`,`lg`],defaultValue:`sm`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{display:`inline`,variant:`outline`,size:`sm`,actions:[]}});function dl(){try{let{t:e}=(0,F.useObjectTranslation)(),t=e(`common.actions`);return!t||t===`common.actions`?`Actions`:t}catch{return`Actions`}}var fl=(0,a.forwardRef)(({schema:e,className:n,...r},s)=>{let c=dl(),{"data-obj-id":l,"data-obj-type":u,style:d,data:f,actions:p,systemActions:m,location:h,maxVisible:g,mobileMaxVisible:_,direction:v,gap:y,variant:b,size:x,visible:S,...C}=r,w=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),T=ii(),E=(0,a.useMemo)(()=>{let t=e.actions||[],n=e.location?t.filter(t=>!t.locations||t.locations.length===0||t.locations.includes(e.location)):t,r=new Set;return n.filter(e=>e.name?r.has(e.name)?!1:(r.add(e.name),!0):!0)},[e.actions,e.location]),D=(0,a.useMemo)(()=>{let t=e.systemActions||[],n=new Set;return t.filter(e=>e.name?n.has(e.name)?!1:(n.add(e.name),!0):!0)},[e.systemActions]),O=T?e.mobileMaxVisible??1:e.maxVisible??3,{inlineActions:k,overflowActions:A}=(0,a.useMemo)(()=>E.length<=O?{inlineActions:E,overflowActions:[]}:{inlineActions:E.slice(0,O),overflowActions:E.slice(O)},[E,O]),j=(0,a.useMemo)(()=>{if(D.length===0)return A;if(A.length===0)return D;let[e,...t]=D,n={...e,tags:[...e.tags||[],`separator-before`]};return[...A,n,...t]},[A,D]);if(e.visible&&!w||E.length===0&&D.length===0)return null;let ee=e.direction||`horizontal`,te=e.gap||`gap-2`,M=j.length>0?t.ComponentRegistry.get(`action:menu`):null,N=M?(0,o.jsx)(M,{schema:{type:`action:menu`,actions:j,variant:e.variant||`ghost`,size:e.size||`sm`}}):null;return(0,o.jsxs)(`div`,{ref:s,className:R(`flex items-center`,ee===`vertical`?`flex-col items-stretch`:`flex-row flex-wrap`,te,e.className,n),role:`toolbar`,"aria-label":c,...C,"data-obj-id":l,"data-obj-type":u,style:d,children:[k.map(n=>{let r=n.component||`action:button`,i=t.ComponentRegistry.get(r);return i?(0,o.jsx)(i,{schema:{...n,type:r,actionType:n.type,variant:n.variant||e.variant,size:n.size||e.size},data:f},n.name):null}),j.length>0&&N]})});fl.displayName=`ActionBarRenderer`,t.ComponentRegistry.register(`action:bar`,fl,{namespace:`action`,label:`Action Bar`,inputs:[{name:`actions`,type:`object`,label:`Actions`},{name:`systemActions`,type:`object`,label:`System Actions (always in overflow)`},{name:`location`,type:`enum`,label:`Location`,enum:[...fe.ACTION_LOCATIONS]},{name:`maxVisible`,type:`number`,label:`Max Visible Actions`,defaultValue:3},{name:`direction`,type:`enum`,label:`Direction`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`},{name:`variant`,type:`enum`,label:`Default Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`outline`},{name:`size`,type:`enum`,label:`Default Size`,enum:[`sm`,`md`,`lg`],defaultValue:`sm`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{maxVisible:3,direction:`horizontal`,variant:`outline`,size:`sm`,actions:[]}});var pl=({schema:e,className:t})=>{let n=e.type,r=n.startsWith(`view:`),i=n.startsWith(`widget:`),a=n.startsWith(`field:`);return(0,o.jsxs)(`div`,{className:R(`flex flex-col items-center justify-center p-6 border-2 border-dashed rounded-lg bg-muted/30 transition-colors hover:bg-muted/50`,r&&`border-blue-300 bg-blue-50/50 min-h-[200px]`,i&&`border-purple-300 bg-purple-50/50 min-h-[150px]`,a&&`border-yellow-300 bg-yellow-50/50 p-2 min-h-[40px] flex-row gap-2 justify-start`,t),children:[(0,o.jsxs)(`div`,{className:R(`flex items-center gap-2 text-muted-foreground`,a&&`text-sm`),children:[a?(0,o.jsx)(c.Box,{className:`h-4 w-4`}):(0,o.jsx)(c.FileQuestion,{className:`h-8 w-8 mb-2 opacity-50`}),(0,o.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,o.jsx)(`span`,{className:`font-mono font-medium text-foreground`,children:n}),!a&&(0,o.jsx)(`span`,{className:`text-xs`,children:`Component Placeholder`})]})]}),e.props&&!a&&(0,o.jsxs)(`div`,{className:`mt-4 w-full text-xs text-muted-foreground bg-background/50 p-2 rounded overflow-hidden`,children:[(0,o.jsx)(`div`,{className:`opacity-70`,children:`Properties:`}),(0,o.jsx)(`pre`,{className:`mt-1 truncate`,children:JSON.stringify(e.props,null,0)})]})]})},ml=`view:grid.view:kanban.view:map.view:calendar.view:gantt.view:timeline.view:gallery.view:simple.view:wizard.view:tabbed.view:drawer.view:modal.view:split.field:text.field:textarea.field:password.field:email.field:url.field:phone.field:markdown.field:html.field:code.field:number.field:currency.field:percent.field:slider.field:boolean.field:checkboxes.field:select.field:multiselect.field:radio.field:date.field:datetime.field:time.field:duration.field:lookup.field:master_detail.field:tree.field:image.field:file.field:video.field:audio.field:avatar.field:color.field:rating.field:signature.field:qrcode.field:progress.field:json.field:address.field:location.page:header.page-header.page:footer.page:tabs.page:accordion.page:card.page:sidebar.record:details.record:highlights.record:related_list.record:activity.record:chatter.record:path.app:launcher.nav:menu.nav:breadcrumb.global:search.global:notifications.user:profile.widget:metric.widget:bar.widget:line.widget:pie.widget:funnel.widget:radar.widget:scatter.widget:heatmap.widget:pivot.widget:table.widget:text.widget:image.ai:input.ai:suggestion.ai:feedback`.split(`.`);function hl(){ml.forEach(e=>{t.ComponentRegistry.get(e)||t.ComponentRegistry.register(e,pl,{namespace:`protocol-placeholder`})})}function gl(e,t){let n=t?.maxHistory??50,[r,i]=(0,a.useState)({...e}),[o,s]=(0,a.useState)(t?.mode===`create`),c=(0,a.useRef)([]),l=(0,a.useRef)([]),[,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i({...e}),s(t?.mode===`create`),c.current=[],l.current=[]},[e]);let d=(0,a.useCallback)((e,r)=>{i(t=>(c.current=[...c.current.slice(-(n-1)),t],l.current=[],{...t,[e]:r})),s(!0),u(e=>e+1),t?.onUpdate?.(e,r)},[t?.onUpdate,n]),f=(0,a.useCallback)(()=>{c.current.length!==0&&(i(e=>{let t=[...c.current],n=t.pop();return c.current=t,l.current=[e,...l.current],n}),u(e=>e+1))},[]),p=(0,a.useCallback)(()=>{l.current.length!==0&&(i(e=>{let t=[...l.current],n=t.shift();return l.current=t,c.current=[...c.current,e],n}),u(e=>e+1))},[]);return{draft:r,isDirty:o,updateField:d,discard:(0,a.useCallback)(()=>{i({...e}),s(!1),c.current=[],l.current=[],u(e=>e+1)},[e]),setDraft:i,undo:f,redo:p,canUndo:c.current.length>0,canRedo:l.current.length>0}}function _l(e){let[t,n]=a.useState({width:0,height:0});return a.useEffect(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=t.getBoundingClientRect();n(e=>e.width===r.width&&e.height===r.height?e:{width:r.width,height:r.height});let i=new ResizeObserver(e=>{let t=e[0];if(!t)return;let r,i=t.borderBoxSize?.[0];r=i?{width:i.inlineSize,height:i.blockSize}:{width:t.contentRect.width,height:t.contentRect.height},n(e=>e.width===r.width&&e.height===r.height?e:r)});return i.observe(t),()=>i.disconnect()},[e]),t}var vl=[`completed`,`failed`,`cancelled`,`expired`];function yl(e){return!!e&&vl.includes(e)}function bl(e={}){let{dataSource:t,pollIntervalMs:n=1500,maxAttempts:r=600,onComplete:i,onError:o}=e,[s,c]=(0,a.useState)(null),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(!1),p=(0,a.useRef)(null),m=(0,a.useRef)(null),h=(0,a.useRef)(0),g=(0,a.useRef)(!1),_=(0,a.useRef)({onComplete:i,onError:o});_.current={onComplete:i,onError:o};let v=!!t?.createExportJob&&!!t?.getExportJobProgress,y=(0,a.useCallback)(()=>{m.current&&=(clearTimeout(m.current),null)},[]),b=(0,a.useCallback)(()=>{y(),p.current=null,g.current=!1,h.current=0,c(null),u(null),f(!1)},[y]);(0,a.useEffect)(()=>()=>y(),[y]);let x=(0,a.useCallback)(async()=>{if(t?.getExportJobProgress&&!(!p.current||g.current)){if(h.current+=1,h.current>r){let e=Error(`Export job timed out (max attempts exceeded)`);u(e),f(!1),_.current.onError?.(e,s??void 0);return}try{let e=await t.getExportJobProgress(p.current);if(g.current)return;if(c(e),yl(e.status)){if(f(!1),e.status===`completed`)_.current.onComplete?.(e);else{let t=e.error?.message??`Export ${e.status}`,n=Error(t);u(n),_.current.onError?.(n,e)}return}m.current=setTimeout(x,n)}catch(e){if(g.current)return;let t=e instanceof Error?e:Error(String(e));u(t),f(!1),_.current.onError?.(t,s??void 0)}}},[t,r,n,s]),S=(0,a.useCallback)(async(e,r)=>{if(!t?.createExportJob){let e=Error(`DataSource does not implement createExportJob — cannot start async export.`);return u(e),_.current.onError?.(e),null}y(),g.current=!1,h.current=0,u(null),c(null),f(!0);try{let i=await t.createExportJob(e,r);if(p.current=i.jobId,c({jobId:i.jobId,status:i.status,processedRecords:0,totalRecords:i.estimatedRecords,percentComplete:0}),yl(i.status)){if(f(!1),i.status===`completed`&&t.getExportJobProgress)try{let e=await t.getExportJobProgress(i.jobId);c(e),_.current.onComplete?.(e)}catch{}return i.jobId}return m.current=setTimeout(x,n),i.jobId}catch(e){let t=e instanceof Error?e:Error(String(e));return u(t),f(!1),_.current.onError?.(t),null}},[t,y,x,n]),C=(0,a.useCallback)(async()=>{if(p.current){if(g.current=!0,y(),f(!1),t?.cancelExportJob)try{await t.cancelExportJob(p.current)}catch{}c(e=>e&&{...e,status:`cancelled`})}},[t,y]),w=(0,a.useCallback)(async()=>{if(!p.current)return null;if(t?.getExportJobDownloadUrl)try{return await t.getExportJobDownloadUrl(p.current)}catch{}return s?.downloadUrl??null},[t,s]);return{isRunning:d,progress:s,error:l,isSupported:v,start:S,cancel:C,getDownloadUrl:w,download:(0,a.useCallback)(async e=>{let t=await w();if(!t)return!1;let n=document.createElement(`a`);return n.href=t,e&&(n.download=e),n.rel=`noopener`,document.body.appendChild(n),n.click(),n.remove(),!0},[w]),reset:b}}function xl({schema:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No schema available`})}function Sl({dataContext:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No data context available`})}function Cl(){let e=(0,a.useMemo)(()=>{try{return t.ComponentRegistry.getAllTypes()}catch{return[]}},[]);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No registered components`}):(0,o.jsxs)(`div`,{className:`space-y-1 max-h-[60vh] overflow-auto`,children:[e.map(e=>(0,o.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 rounded text-xs font-mono bg-muted/30`,children:[(0,o.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full bg-green-500 shrink-0`}),e]},e)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` component`,e.length===1?``:`s`,` registered`]})]})}function wl({flags:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No debug flags`})}function Tl(e){let n=t.DebugCollector.getInstance(),[r,i]=(0,a.useState)(()=>n.getEntries(e));return a.default.useEffect(()=>(i(n.getEntries(e)),n.subscribe(()=>{i(n.getEntries(e))})),[n,e]),r}function El(){let e=Tl(`perf`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No performance data collected yet`}):(0,o.jsxs)(`div`,{className:`space-y-1 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:R(`flex items-center justify-between px-2 py-1 rounded text-xs font-mono`,e.durationMs>16?`bg-red-50 text-red-700`:`bg-muted/30`),children:[(0,o.jsxs)(`span`,{className:`truncate mr-2`,children:[e.type,e.id?`:${e.id}`:``]}),(0,o.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[e.durationMs.toFixed(2),`ms`]})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` render`,e.length===1?``:`s`,` tracked`]})]})}function Dl(){let e=Tl(`expr`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No expression evaluations tracked yet`}):(0,o.jsxs)(`div`,{className:`space-y-1.5 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:`px-2 py-1.5 rounded bg-muted/30 text-xs font-mono`,children:[(0,o.jsx)(`div`,{className:`text-muted-foreground truncate`,children:e.expression}),(0,o.jsxs)(`div`,{className:`mt-0.5`,children:[`→ `,JSON.stringify(e.result)]})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` evaluation`,e.length===1?``:`s`,` tracked`]})]})}function Ol(){let e=Tl(`event`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No events captured yet`}):(0,o.jsxs)(`div`,{className:`space-y-1.5 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:`px-2 py-1.5 rounded bg-muted/30 text-xs font-mono`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsx)(`span`,{className:`font-semibold`,children:e.action}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString()})]}),e.payload!==void 0&&(0,o.jsx)(`pre`,{className:`mt-0.5 text-[10px] text-muted-foreground truncate`,children:JSON.stringify(e.payload)})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` event`,e.length===1?``:`s`,` captured`]})]})}function kl({open:e,onClose:t,flags:n,schema:r,dataContext:i,extraTabs:s=[],className:c}){let l=(0,a.useMemo)(()=>[{id:`schema`,label:`Schema`,render:()=>(0,o.jsx)(xl,{schema:r})},{id:`data`,label:`Data`,render:()=>(0,o.jsx)(Sl,{dataContext:i})},{id:`perf`,label:`Perf`,render:()=>(0,o.jsx)(El,{})},{id:`expr`,label:`Expr`,render:()=>(0,o.jsx)(Dl,{})},{id:`events`,label:`Events`,render:()=>(0,o.jsx)(Ol,{})},{id:`registry`,label:`Registry`,render:()=>(0,o.jsx)(Cl,{})},{id:`flags`,label:`Flags`,render:()=>(0,o.jsx)(wl,{flags:n})}],[r,i,n]),u=(0,a.useMemo)(()=>[...l,...s],[l,s]),[d,f]=(0,a.useState)(u[0]?.id??`schema`),p=u.find(e=>e.id===d)??u[0],m=(0,a.useCallback)(e=>{f(e)},[]);return e?(0,o.jsxs)(`div`,{className:R(`fixed bottom-4 right-4 z-[9999] w-[420px] max-w-[95vw] rounded-lg border bg-background shadow-2xl`,`flex flex-col overflow-hidden`,c),"data-testid":`debug-panel`,role:`dialog`,"aria-label":`Developer Debug Panel`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b bg-muted/30`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`🛠 Debug Panel`}),(0,o.jsx)(`button`,{onClick:t,className:`text-muted-foreground hover:text-foreground text-sm leading-none px-1`,"aria-label":`Close debug panel`,"data-testid":`debug-panel-close`,children:`✕`})]}),(0,o.jsx)(`div`,{className:`flex border-b overflow-x-auto`,role:`tablist`,children:u.map(e=>(0,o.jsxs)(`button`,{role:`tab`,"aria-selected":e.id===p?.id,onClick:()=>m(e.id),className:R(`px-3 py-1.5 text-xs font-medium whitespace-nowrap transition-colors`,e.id===p?.id?`border-b-2 border-primary text-foreground`:`text-muted-foreground hover:text-foreground`),"data-testid":`debug-tab-${e.id}`,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-1`,children:e.icon}),e.label]},e.id))}),(0,o.jsx)(`div`,{className:`p-3 overflow-auto max-h-[50vh]`,"data-testid":`debug-panel-content`,children:p?.render()})]}):null}var Al={permission:`view`,audience:`link_only`,expiresInDays:7,password:``,label:``},jl=[{label:`1 day`,value:1},{label:`7 days`,value:7},{label:`30 days`,value:30},{label:`90 days`,value:90},{label:`Never`,value:null}],Ml=[{value:`link_only`,label:`Anyone with the link`,help:`No sign-in required`},{value:`signed_in`,label:`Signed-in users`,help:`Must be logged in to view`}];function Nl(e,t){return`${(e??(typeof window<`u`?`${window.location.origin}/s`:`/s`)).replace(/\/+$/,``)}/${t}`}async function Pl(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document<`u`){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`absolute`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();try{return document.execCommand(`copy`),document.body.removeChild(t),!0}catch{document.body.removeChild(t)}}return!1}function Fl({open:e,onOpenChange:t,objectName:n,recordId:r,recordLabel:i,apiBase:s,publicBaseUrl:l,fetchHeaders:u}){let[d,f]=(0,a.useState)([]),[p,m]=(0,a.useState)(!1),[h,g]=(0,a.useState)(!1),[_,v]=(0,a.useState)(null),[y,b]=(0,a.useState)(Al),[x,S]=(0,a.useState)(null),C=(0,a.useCallback)(async()=>{let e={"Content-Type":`application/json`};if(!u)return e;let t=await u();return{...e,...t}},[u]),w=(0,a.useMemo)(()=>`${s.replace(/\/+$/,``)}/v1/share-links?object=${encodeURIComponent(n)}&recordId=${encodeURIComponent(r)}`,[s,n,r]),T=(0,a.useCallback)(async()=>{m(!0),v(null);try{let e=await C(),t=await fetch(w,{headers:e,credentials:`include`});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();f(n.links??n.data??[])}catch(e){v(e?.message??`Failed to load share links`)}finally{m(!1)}},[w,C]);(0,a.useEffect)(()=>{e&&(T(),b(Al))},[e,T]);let E=(0,a.useCallback)(async()=>{g(!0),v(null);try{let e=y.expiresInDays==null?void 0:new Date(Date.now()+y.expiresInDays*24*60*60*1e3).toISOString(),t=await C(),i=await fetch(`${s.replace(/\/+$/,``)}/v1/share-links`,{method:`POST`,headers:t,credentials:`include`,body:JSON.stringify({object:n,recordId:r,permission:y.permission,audience:y.audience,expiresAt:e,password:y.password.trim()||void 0,label:y.label.trim()||void 0})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.error?.message||`HTTP ${i.status}`)}let a=await i.json(),o=a.link??a.data;if(!o)throw Error(`Share link create response missing link payload`);f(e=>[o,...e]),await Pl(Nl(l,o.token))&&(S(o.id),setTimeout(()=>S(null),1500)),b(Al)}catch(e){v(e?.message??`Failed to create share link`)}finally{g(!1)}},[s,C,n,r,y,l]),D=(0,a.useCallback)(async e=>{try{let t=await C(),n=await fetch(`${s.replace(/\/+$/,``)}/v1/share-links/${encodeURIComponent(e.id)}`,{method:`DELETE`,headers:t,credentials:`include`});if(!n.ok&&n.status!==204)throw Error(`HTTP ${n.status}`);f(t=>t.map(t=>t.id===e.id?{...t,revoked_at:new Date().toISOString()}:t))}catch(e){v(e?.message??`Failed to revoke link`)}},[s,C]),O=(0,a.useCallback)(async e=>{await Pl(Nl(l,e.token))&&(S(e.id),setTimeout(()=>S(null),1500))},[l]),k=d.filter(e=>!e.revoked_at),A=d.filter(e=>e.revoked_at);return(0,o.jsx)(Dt,{open:e,onOpenChange:t,children:(0,o.jsxs)(Mt,{className:`max-w-xl`,"data-testid":`share-dialog`,children:[(0,o.jsxs)(Nt,{children:[(0,o.jsxs)(Ft,{className:`flex items-center gap-2`,children:[(0,o.jsx)(c.Link2,{className:`h-4 w-4`}),`Share `,i??`this record`]}),(0,o.jsx)(It,{children:`Generate a link anyone (or selected people) can use to open this record. Links can be revoked at any time.`})]}),_&&(0,o.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,"data-testid":`share-dialog-error`,children:_}),(0,o.jsxs)(`section`,{className:`space-y-3 rounded-lg border bg-muted/30 p-3`,children:[(0,o.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(U,{className:`text-xs`,children:`Who can access`}),(0,o.jsxs)(G,{value:y.audience,onValueChange:e=>b(t=>({...t,audience:e})),children:[(0,o.jsx)(q,{className:`h-8 text-xs`,"data-testid":`share-audience`,children:(0,o.jsx)(K,{})}),(0,o.jsx)(J,{children:Ml.map(e=>(0,o.jsx)(Y,{value:e.value,className:`text-xs`,children:(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(`span`,{children:e.label}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.help})]})},e.value))})]})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(U,{className:`text-xs`,children:`Expires in`}),(0,o.jsxs)(G,{value:y.expiresInDays==null?`never`:String(y.expiresInDays),onValueChange:e=>b(t=>({...t,expiresInDays:e===`never`?null:Number(e)})),children:[(0,o.jsx)(q,{className:`h-8 text-xs`,"data-testid":`share-expiry`,children:(0,o.jsx)(K,{})}),(0,o.jsx)(J,{children:jl.map(e=>(0,o.jsx)(Y,{value:e.value==null?`never`:String(e.value),className:`text-xs`,children:e.label},String(e.value)))})]})]}),(0,o.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,o.jsx)(U,{className:`text-xs`,children:`Password (optional)`}),(0,o.jsx)(W,{type:`password`,value:y.password,onChange:e=>b(t=>({...t,password:e.target.value})),placeholder:`Require a password to open`,className:`h-8 text-xs`,"data-testid":`share-password`})]}),(0,o.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,o.jsx)(U,{className:`text-xs`,children:`Label (only you see this)`}),(0,o.jsx)(W,{value:y.label,onChange:e=>b(t=>({...t,label:e.target.value})),placeholder:`e.g. Sent to design review`,className:`h-8 text-xs`,"data-testid":`share-label`})]})]}),(0,o.jsx)(`div`,{className:`flex justify-end`,children:(0,o.jsxs)(B,{size:`sm`,onClick:E,disabled:h,"data-testid":`share-create`,children:[h?(0,o.jsx)(c.Loader2,{className:`mr-1 h-3 w-3 animate-spin`}):(0,o.jsx)(c.Link2,{className:`mr-1 h-3 w-3`}),`Create link`]})})]}),(0,o.jsxs)(`section`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground`,children:[`Existing links`,k.length?` (${k.length})`:``]}),p&&(0,o.jsx)(c.Loader2,{className:`h-3 w-3 animate-spin text-muted-foreground`})]}),!p&&k.length===0&&A.length===0&&(0,o.jsx)(`p`,{className:`rounded-md border border-dashed px-3 py-4 text-center text-xs text-muted-foreground`,children:`No share links yet. Create one above.`}),(0,o.jsxs)(`ul`,{className:`space-y-2`,children:[k.map(e=>(0,o.jsx)(Il,{link:e,copied:x===e.id,onCopy:()=>O(e),onRevoke:()=>D(e),publicBaseUrl:l},e.id)),A.length>0&&(0,o.jsx)(`li`,{className:`pt-2 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`Revoked`}),A.map(e=>(0,o.jsx)(Il,{link:e,copied:!1,onCopy:()=>O(e),onRevoke:()=>D(e),publicBaseUrl:l,disabled:!0},e.id))]})]}),(0,o.jsx)(Pt,{children:(0,o.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),children:`Done`})})]})})}function Il({link:e,copied:t,onCopy:n,onRevoke:r,publicBaseUrl:i,disabled:a}){let s=Nl(i,e.token);return(0,o.jsxs)(`li`,{className:R(`flex items-center gap-2 rounded-md border bg-card px-2 py-2 text-xs`,a&&`opacity-60`),"data-testid":`share-link-row`,children:[(0,o.jsx)(We,{variant:`secondary`,className:`text-[10px] capitalize`,children:e.audience.replace(`_`,` `)}),(0,o.jsx)(We,{variant:`outline`,className:`text-[10px] capitalize`,children:e.permission}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`truncate font-mono text-[11px]`,title:s,children:s}),e.label&&(0,o.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.label})]}),!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(B,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:n,"data-testid":`share-link-copy`,children:[(0,o.jsx)(c.Copy,{className:`mr-1 h-3 w-3`}),t?`Copied!`:`Copy`]}),(0,o.jsx)(B,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs text-destructive hover:text-destructive`,onClick:r,"data-testid":`share-link-revoke`,title:`Revoke`,children:(0,o.jsx)(c.Trash2,{className:`h-3 w-3`})})]}),a&&(0,o.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,o.jsx)(c.ShieldOff,{className:`h-3 w-3`}),`revoked`]})]})}function Ll(){return!0}e.Accordion=xe,e.AccordionContent=we,e.AccordionItem=Se,e.AccordionTrigger=Ce,e.ActionParamDialog=Ps,e.Alert=V,e.AlertDescription=Re,e.AlertDialog=Ee,e.AlertDialogAction=Fe,e.AlertDialogCancel=Ie,e.AlertDialogContent=Ae,e.AlertDialogDescription=Pe,e.AlertDialogFooter=Me,e.AlertDialogHeader=je,e.AlertDialogOverlay=ke,e.AlertDialogPortal=Oe,e.AlertDialogTitle=Ne,e.AlertDialogTrigger=De,e.AlertTitle=H,e.AspectRatio=ze,e.Avatar=Be,e.AvatarFallback=He,e.AvatarImage=Ve,e.Badge=We,e.Breadcrumb=Ge,e.BreadcrumbEllipsis=Ze,e.BreadcrumbItem=qe,e.BreadcrumbLink=Je,e.BreadcrumbList=Ke,e.BreadcrumbPage=Ye,e.BreadcrumbSeparator=Xe,e.Button=B,e.ButtonGroup=wo,e.ButtonGroupSeparator=Eo,e.ButtonGroupText=To,e.Calendar=Qe,e.CalendarDayButton=$e,e.Card=et,e.CardContent=it,e.CardDescription=rt,e.CardFooter=at,e.CardHeader=tt,e.CardTitle=nt,e.Carousel=ct,e.CarouselContent=lt,e.CarouselItem=ut,e.CarouselNext=ft,e.CarouselPrevious=dt,e.ChartContainer=gt,e.ChartLegend=bt,e.ChartLegendContent=xt,e.ChartSkeleton=zs,e.ChartStyle=_t,e.ChartTooltip=vt,e.ChartTooltipContent=yt,e.Checkbox=Ct,e.Collapsible=wt,e.CollapsibleContent=Et,e.CollapsibleTrigger=Tt,e.Combobox=Do,e.Command=Lt,e.CommandDialog=Rt,e.CommandEmpty=Vt,e.CommandGroup=Ht,e.CommandInput=zt,e.CommandItem=Wt,e.CommandList=Bt,e.CommandSeparator=Ut,e.CommandShortcut=Gt,e.ConfigFieldRenderer=Jo,e.ConfigPanelRenderer=Xo,e.ConfigRow=Oo,e.ContextMenu=Kt,e.ContextMenuCheckboxItem=nn,e.ContextMenuContent=en,e.ContextMenuGroup=Jt,e.ContextMenuItem=tn,e.ContextMenuLabel=an,e.ContextMenuPortal=Yt,e.ContextMenuRadioGroup=Zt,e.ContextMenuRadioItem=rn,e.ContextMenuSeparator=on,e.ContextMenuShortcut=sn,e.ContextMenuSub=Xt,e.ContextMenuSubContent=$t,e.ContextMenuSubTrigger=Qt,e.ContextMenuTrigger=qt,e.DataEmptyState=Xs,e.EmptyState=Xs,e.DataErrorState=Zs,e.DataLoadingState=Ys,e.DatePicker=Zo,e.DebugPanel=kl,e.Dialog=Dt,e.DialogClose=At,e.DialogContent=Mt,e.DialogDescription=It,e.DialogFooter=Pt,e.DialogHeader=Nt,e.DialogOverlay=jt,e.DialogPortal=kt,e.DialogTitle=Ft,e.DialogTrigger=Ot,e.Drawer=cn,e.DrawerClose=dn,e.DrawerContent=pn,e.DrawerDescription=_n,e.DrawerFooter=hn,e.DrawerHeader=mn,e.DrawerOverlay=fn,e.DrawerPortal=un,e.DrawerTitle=gn,e.DrawerTrigger=ln,e.DropdownMenu=vn,e.DropdownMenuCheckboxItem=On,e.DropdownMenuContent=En,e.DropdownMenuGroup=bn,e.DropdownMenuItem=Dn,e.DropdownMenuLabel=An,e.DropdownMenuPortal=xn,e.DropdownMenuRadioGroup=Cn,e.DropdownMenuRadioItem=kn,e.DropdownMenuSeparator=jn,e.DropdownMenuShortcut=Mn,e.DropdownMenuSub=Sn,e.DropdownMenuSubContent=Tn,e.DropdownMenuSubTrigger=wn,e.DropdownMenuTrigger=yn,e.Empty=$o,e.EmptyContent=as,e.EmptyDescription=is,e.EmptyHeader=es,e.EmptyMedia=ns,e.EmptyTitle=rs,e.EmptyValue=os,e.ExportProgressDialog=ec,e.Field=cs,e.FilterBuilder=Wo,e.Form=Pn,e.FormControl=Vn,e.FormDescription=Hn,e.FormField=In,e.FormItem=zn,e.FormLabel=Bn,e.FormMessage=Un,e.FormSkeleton=Ls,e.GridSkeleton=Fs,e.GroupingEditor=Ns,e.HoverCard=Wn,e.HoverCardContent=Kn,e.HoverCardTrigger=Gn,e.Input=W,e.InputGroup=ls,e.InputOTP=qn,e.InputOTPGroup=Jn,e.InputOTPSeparator=Xn,e.InputOTPSlot=Yn,e.Item=ps,e.ItemActions=ys,e.ItemContent=gs,e.ItemDescription=vs,e.ItemFooter=xs,e.ItemGroup=us,e.ItemHeader=bs,e.ItemMedia=hs,e.ItemSeparator=ds,e.ItemTitle=_s,e.KanbanSkeleton=Is,e.Kbd=Ss,e.KbdGroup=Cs,e.Label=U,e.LazyIcon=ka,e.ListSkeleton=Rs,e.LookupValuePicker=Go,e.Menubar=nr,e.MenubarCheckboxItem=cr,e.MenubarContent=or,e.MenubarGroup=Qn,e.MenubarItem=sr,e.MenubarLabel=ur,e.MenubarMenu=Zn,e.MenubarPortal=$n,e.MenubarRadioGroup=er,e.MenubarRadioItem=lr,e.MenubarSeparator=dr,e.MenubarShortcut=fr,e.MenubarSub=tr,e.MenubarSubContent=ar,e.MenubarSubTrigger=ir,e.MenubarTrigger=rr,e.MobileDialogContent=Qs,e.NativeSelect=ws,e.NavigationMenu=pr,e.NavigationMenuContent=vr,e.NavigationMenuIndicator=xr,e.NavigationMenuItem=hr,e.NavigationMenuLink=yr,e.NavigationMenuList=mr,e.NavigationMenuTrigger=_r,e.NavigationMenuViewport=br,e.NavigationOverlay=As,e.Pagination=Sr,e.PaginationContent=Cr,e.PaginationEllipsis=Or,e.PaginationItem=wr,e.PaginationLink=Tr,e.PaginationNext=Dr,e.PaginationPrevious=Er,e.Popover=kr,e.PopoverContent=jr,e.PopoverTrigger=Ar,e.Progress=Mr,e.RadioGroup=Nr,e.RadioGroupItem=Pr,e.RecordTitleChip=Gs,e.RefreshIndicator=Js,e.RelatedCountStore=Rc,e.ResizableHandle=Lr,e.ResizablePanel=Ir,e.ResizablePanelGroup=Fr,e.ScrollArea=Rr,e.ScrollBar=zr,e.SectionHeader=Yo,e.Select=G,e.SelectContent=J,e.SelectGroup=Br,e.SelectItem=Y,e.SelectLabel=Ur,e.SelectScrollDownButton=Hr,e.SelectScrollUpButton=Vr,e.SelectSeparator=Wr,e.SelectTrigger=q,e.SelectValue=K,e.Separator=Gr,e.ShareDialog=Fl,e.Sheet=Kr,e.SheetClose=Jr,e.SheetContent=Qr,e.SheetDescription=ni,e.SheetFooter=ei,e.SheetHeader=$r,e.SheetOverlay=Xr,e.SheetPortal=Yr,e.SheetTitle=ti,e.SheetTrigger=qr,e.ShimmerSkeleton=Vs,e.Sidebar=vi,e.SidebarContent=Ei,e.SidebarFooter=wi,e.SidebarGroup=Di,e.SidebarGroupAction=ki,e.SidebarGroupContent=Ai,e.SidebarGroupLabel=Oi,e.SidebarHeader=Ci,e.SidebarInput=Si,e.SidebarInset=xi,e.SidebarMenu=ji,e.SidebarMenuAction=Fi,e.SidebarMenuBadge=Ii,e.SidebarMenuButton=Pi,e.SidebarMenuItem=Mi,e.SidebarMenuSkeleton=Li,e.SidebarMenuSub=Ri,e.SidebarMenuSubButton=Bi,e.SidebarMenuSubItem=zi,e.SidebarProvider=_i,e.SidebarRail=bi,e.SidebarSeparator=Ti,e.SidebarTrigger=yi,e.Skeleton=X,e.Slider=Vi,e.SortBuilder=qo,e.Spinner=js,e.Switch=Ui,e.Table=Wi,e.TableBody=Ki,e.TableCaption=Zi,e.TableCell=Xi,e.TableFooter=qi,e.TableHead=Yi,e.TableHeader=Gi,e.TableRow=Ji,e.Tabs=Qi,e.TabsContent=ta,e.TabsList=$i,e.TabsTrigger=ea,e.Textarea=na,e.Toaster=Hi,e.Toggle=ia,e.ToggleGroup=oa,e.ToggleGroupItem=sa,e.Tooltip=oi,e.TooltipContent=ci,e.TooltipProvider=ai,e.TooltipTrigger=si,e.TypographyBlockquote=pa,e.TypographyH1=ca,e.TypographyH2=la,e.TypographyH3=ua,e.TypographyH4=da,e.TypographyInlineCode=ha,e.TypographyLarge=_a,e.TypographyLead=ga,e.TypographyList=ma,e.TypographyMuted=ya,e.TypographyP=fa,e.TypographySmall=va,e.ViewSkeleton=Bs,e.badgeVariants=Ue,e.buttonGroupVariants=Co,e.buttonVariants=Te,e.cn=R,Object.defineProperty(e,"cva",{enumerable:!0,get:function(){return d.cva}}),e.getLazyIcon=Oa,e.initializeComponents=Ll,e.navigationMenuTriggerStyle=gr,e.registerPlaceholders=hl,e.renderChildren=z,e.toKebabIconName=wa,e.toast=P.toast,e.toggleVariants=ra,e.useConfigDraft=gl,e.useExportJob=bl,e.useFormField=Ln,e.useIsMobile=ii,e.useRelatedCount=Lc,e.useResizeObserver=_l,e.useSidebar=gi});
|
|
18
|
+
`,document.head.appendChild(t),Ks=!0}var Js=({active:e,ariaLabel:t=`Refreshing`,className:n,...r})=>(a.useEffect(()=>{e&&qs()},[e]),e?(0,o.jsx)(`div`,{className:R(`pointer-events-none absolute inset-x-0 top-0 z-20 h-0.5 overflow-hidden`,n),role:`progressbar`,"aria-busy":`true`,"aria-label":t,"data-testid":`refresh-indicator`,...r,children:(0,o.jsx)(`div`,{className:`h-full w-1/4 rounded-full bg-primary/70`,style:{animation:`objui-refresh-bar 1.1s ease-in-out infinite`}})}):null);Js.displayName=`RefreshIndicator`;function Ys({className:e,message:t=`Loading…`,...n}){return(0,o.jsxs)(`div`,{role:`status`,"aria-label":t,"data-slot":`data-loading-state`,className:R(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...n,children:[(0,o.jsx)(c.Loader2,{className:`size-6 animate-spin text-muted-foreground`}),t&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t})]})}function Xs({className:e,icon:t,illustration:n,showIcon:r=!0,iconWrapperClassName:i,title:a=`No data`,description:s,action:l,children:u,...d}){let f=r&&(t!=null||!n);return(0,o.jsxs)(`div`,{"data-slot":`data-empty-state`,className:R(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...d,children:[n&&(0,o.jsx)(`div`,{"data-slot":`data-empty-state-illustration`,className:`motion-safe:animate-in motion-safe:fade-in-0 motion-safe:zoom-in-95 motion-safe:duration-300 [&_svg]:max-h-40 [&_svg]:w-auto`,"aria-hidden":!0,children:n}),f&&(0,o.jsx)(`div`,{"data-slot":`data-empty-state-icon`,className:R(i??`flex size-10 items-center justify-center rounded-lg bg-muted`),children:t??(0,o.jsx)(c.InboxIcon,{className:`size-5 text-muted-foreground`})}),a&&(0,o.jsx)(`h3`,{className:`text-sm font-medium`,children:a}),s&&(0,o.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:s}),l,u]})}function Zs({className:e,title:t=`Something went wrong`,message:n,onRetry:r,retryLabel:i=`Retry`,children:a,...s}){return(0,o.jsxs)(`div`,{role:`alert`,"data-slot":`data-error-state`,className:R(`flex flex-col items-center justify-center gap-3 p-6 text-center`,e),...s,children:[(0,o.jsx)(`div`,{className:`flex size-10 items-center justify-center rounded-lg bg-destructive/10`,children:(0,o.jsx)(c.AlertCircle,{className:`size-5 text-destructive`})}),t&&(0,o.jsx)(`h3`,{className:`text-sm font-medium`,children:t}),n&&(0,o.jsx)(`p`,{className:`max-w-sm text-sm text-muted-foreground`,children:n}),r&&(0,o.jsx)(B,{variant:`outline`,size:`sm`,onClick:r,children:i}),a]})}var Qs=a.forwardRef(({className:e,children:t,...n},r)=>(0,o.jsxs)(kt,{children:[(0,o.jsx)(jt,{}),(0,o.jsxs)(b.Content,{ref:r,className:R(`fixed inset-0 z-50 w-full bg-background p-4 shadow-lg duration-200`,`h-[100dvh]`,`sm:inset-auto sm:left-[50%] sm:top-[50%] sm:translate-x-[-50%] sm:translate-y-[-50%]`,`sm:max-w-lg sm:h-auto sm:max-h-[90vh] sm:rounded-lg sm:border sm:p-6`,`data-[state=open]:animate-in data-[state=closed]:animate-out`,`data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,`data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95`,`data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]`,`data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]`,e),...n,children:[t,(0,o.jsxs)(b.Close,{className:R(`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity`,`hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,`disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,`min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 flex items-center justify-center`),children:[(0,o.jsx)(c.X,{className:`h-5 w-5 sm:h-4 sm:w-4`}),(0,o.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));Qs.displayName=`MobileDialogContent`;function $s(e){return!e&&e!==0?``:e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:e<1024*1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:`${(e/(1024*1024*1024)).toFixed(2)} GB`}function ec({open:e,onOpenChange:t,job:n,title:r,description:i,filename:s,allowCloseWhileRunning:l=!0,className:u,onAfterDownload:d,closeAfterDownloadMs:f}){let{progress:p,error:m,isRunning:h,cancel:g,download:_,reset:v}=n,y=p?.status,b=typeof p?.percentComplete==`number`?Math.max(0,Math.min(100,p.percentComplete)):void 0,x=y===`completed`,S=y===`failed`||y===`expired`,C=y===`cancelled`,w=a.useCallback(async()=>{await _(s)&&(d?.(),f&&f>0&&setTimeout(()=>t(!1),f))},[_,s,d,f,t]),T=a.useCallback(e=>{!e&&h&&!l||(t(e),!e&&!h&&setTimeout(v,0))},[h,l,t,v]),E=r??(x?`Export ready`:S?`Export failed`:C?`Export cancelled`:`Exporting…`),D=i??(x?`Your export is ready to download.`:S?`The export job did not complete.`:C?`The export was cancelled.`:`Your export is being prepared on the server. You can close this window — the job will continue in the background.`);return(0,o.jsx)(Dt,{open:e,onOpenChange:T,children:(0,o.jsxs)(Mt,{"data-testid":`export-progress-dialog`,className:R(`sm:max-w-md`,u),children:[(0,o.jsxs)(Nt,{children:[(0,o.jsxs)(Ft,{className:`flex items-center gap-2`,children:[x?(0,o.jsx)(c.CheckCircle2,{className:`h-5 w-5 text-green-600`,"aria-hidden":`true`}):S?(0,o.jsx)(c.AlertCircle,{className:`h-5 w-5 text-destructive`,"aria-hidden":`true`}):(0,o.jsx)(c.Loader2,{className:R(`h-5 w-5 text-muted-foreground`,h&&`animate-spin`),"aria-hidden":`true`}),E]}),(0,o.jsx)(It,{children:D})]}),(0,o.jsxs)(`div`,{className:`py-2 space-y-3`,children:[(h||x)&&(0,o.jsx)(`div`,{"data-testid":`export-progress-bar`,children:b===void 0?(0,o.jsx)(Mr,{value:void 0,"aria-label":`Export progress (indeterminate)`}):(0,o.jsx)(Mr,{value:b,"aria-label":`Export progress`})}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,o.jsx)(`span`,{"data-testid":`export-progress-counts`,children:p?.processedRecords==null?h?`Starting…`:``:`${p.processedRecords.toLocaleString()}${p.totalRecords==null?``:` / ${p.totalRecords.toLocaleString()}`} records`}),(0,o.jsx)(`span`,{"data-testid":`export-progress-percent`,children:b===void 0?``:`${b.toFixed(0)}%`})]}),p?.fileSize?(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,children:$s(p.fileSize)}):null,(m||p?.error)&&(0,o.jsx)(`div`,{"data-testid":`export-progress-error`,className:`text-xs text-destructive bg-destructive/10 border border-destructive/30 rounded-md px-2 py-1`,children:m?.message||p?.error?.message})]}),(0,o.jsxs)(Pt,{className:`gap-2 sm:gap-2`,children:[h&&(0,o.jsxs)(B,{type:`button`,variant:`ghost`,onClick:()=>g(),"data-testid":`export-progress-cancel`,children:[(0,o.jsx)(c.X,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`ml-1`,children:`Cancel`})]}),x&&(0,o.jsxs)(B,{type:`button`,variant:`default`,onClick:w,"data-testid":`export-progress-download`,children:[(0,o.jsx)(c.Download,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,o.jsx)(`span`,{className:`ml-1`,children:`Download`})]}),!h&&(0,o.jsx)(B,{type:`button`,variant:`outline`,onClick:()=>T(!1),"data-testid":`export-progress-close`,children:`Close`})]})]})})}t.ComponentRegistry.register(`combobox`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(Do,{options:e.options||[],placeholder:e.placeholder,value:e.value,disabled:e.disabled,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i})},{namespace:`ui`,label:`Combobox`,inputs:[{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`value`,type:`string`,label:`Value`},{name:`disabled`,type:`boolean`,label:`Disabled`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{placeholder:`Select option...`,options:[]}}),t.ComponentRegistry.register(`command`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsxs)(Lt,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:[(0,o.jsx)(zt,{placeholder:e.placeholder||`Type a command or search...`}),(0,o.jsxs)(Bt,{children:[(0,o.jsx)(Vt,{children:e.emptyText||`No results found.`}),e.groups?.map((e,t)=>(0,o.jsx)(Ht,{heading:e.heading,children:e.items?.map((e,t)=>(0,o.jsx)(Wt,{value:e.value,children:e.label},t))},t))]})]})},{namespace:`ui`,label:`Command`,inputs:[{name:`placeholder`,type:`string`,label:`Placeholder`},{name:`emptyText`,type:`string`,label:`Empty Text`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{placeholder:`Type a command or search...`,emptyText:`No results found.`,groups:[]}});var tc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":i,"data-obj-type":a,style:s,...c}=n,l=e.clickable||!!n.onClick;return(0,o.jsxs)(et,{ref:r,className:R(t,(e.hoverable||l)&&`transition-colors hover:bg-muted/50`,l&&`cursor-pointer active:bg-muted`),...c,"data-obj-id":i,"data-obj-type":a,style:s,children:[(e.title||e.description||e.header)&&(0,o.jsxs)(tt,{children:[e.title&&(0,o.jsx)(nt,{children:e.title}),e.description&&(0,o.jsx)(rt,{children:e.description}),e.header&&z(e.header)]}),(e.children||e.body)&&(0,o.jsx)(it,{children:z(e.children||e.body)}),e.footer&&(0,o.jsx)(at,{className:`flex justify-between`,children:z(e.footer)})]})});t.ComponentRegistry.register(`card`,tc,{namespace:`ui`,label:`Card`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Card Title`,description:`Card description goes here`,className:`w-full`},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}}),t.ComponentRegistry.register(`tabs`,({schema:e,className:t,onChange:n,value:r,...i})=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=i,u=e=>{n&&n(e)},d=e.orientation===`vertical`;return(0,o.jsxs)(Qi,{defaultValue:r===void 0?e.defaultValue:void 0,value:r??e.value,onValueChange:u,orientation:e.orientation||`horizontal`,className:R(t,d&&`flex gap-2`),...l,"data-obj-id":a,"data-obj-type":s,style:c,children:[(0,o.jsx)($i,{className:R(d&&`flex-col h-auto items-stretch bg-muted/50 p-1`),children:e.items?.map(e=>(0,o.jsx)(ea,{value:e.value,disabled:e.disabled,className:R(d&&`justify-start`),children:e.label},e.value))}),e.items?.map(e=>(0,o.jsx)(ta,{value:e.value,className:R(`mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2`,d&&`mt-0 flex-1`),children:z(e.content||e.body)},e.value))]})},{namespace:`ui`,label:`Tabs`,inputs:[{name:`defaultValue`,type:`string`,label:`Default Value`,required:!0},{name:`className`,type:`string`,label:`CSS Class`},{name:`items`,type:`array`,label:`Items`}],defaultProps:{defaultValue:`tab1`,items:[{label:`Tab 1`,value:`tab1`,body:[{type:`text`,content:`Content for Tab 1`}]},{label:`Tab 2`,value:`tab2`,body:[{type:`text`,content:`Content for Tab 2`}]},{label:`Tab 3`,value:`tab3`,body:[{type:`text`,content:`Content for Tab 3`}]}],className:`w-full`}});var nc={1:`grid-cols-1`,2:`grid-cols-2`,3:`grid-cols-3`,4:`grid-cols-4`,5:`grid-cols-5`,6:`grid-cols-6`,7:`grid-cols-7`,8:`grid-cols-8`,9:`grid-cols-9`,10:`grid-cols-10`,11:`grid-cols-11`,12:`grid-cols-12`},rc={1:`sm:grid-cols-1`,2:`sm:grid-cols-2`,3:`sm:grid-cols-3`,4:`sm:grid-cols-4`,5:`sm:grid-cols-5`,6:`sm:grid-cols-6`,7:`sm:grid-cols-7`,8:`sm:grid-cols-8`,9:`sm:grid-cols-9`,10:`sm:grid-cols-10`,11:`sm:grid-cols-11`,12:`sm:grid-cols-12`},ic={1:`md:grid-cols-1`,2:`md:grid-cols-2`,3:`md:grid-cols-3`,4:`md:grid-cols-4`,5:`md:grid-cols-5`,6:`md:grid-cols-6`,7:`md:grid-cols-7`,8:`md:grid-cols-8`,9:`md:grid-cols-9`,10:`md:grid-cols-10`,11:`md:grid-cols-11`,12:`md:grid-cols-12`},ac={1:`lg:grid-cols-1`,2:`lg:grid-cols-2`,3:`lg:grid-cols-3`,4:`lg:grid-cols-4`,5:`lg:grid-cols-5`,6:`lg:grid-cols-6`,7:`lg:grid-cols-7`,8:`lg:grid-cols-8`,9:`lg:grid-cols-9`,10:`lg:grid-cols-10`,11:`lg:grid-cols-11`,12:`lg:grid-cols-12`},oc={1:`xl:grid-cols-1`,2:`xl:grid-cols-2`,3:`xl:grid-cols-3`,4:`xl:grid-cols-4`,5:`xl:grid-cols-5`,6:`xl:grid-cols-6`,7:`xl:grid-cols-7`,8:`xl:grid-cols-8`,9:`xl:grid-cols-9`,10:`xl:grid-cols-10`,11:`xl:grid-cols-11`,12:`xl:grid-cols-12`},sc={0:`gap-0`,1:`gap-1`,2:`gap-2`,3:`gap-3`,4:`gap-4`,5:`gap-5`,6:`gap-6`,8:`gap-8`,10:`gap-10`,12:`gap-12`};t.ComponentRegistry.register(`grid`,({schema:e,className:t,...n})=>{let r=2,i,a,s,c;typeof e.columns==`number`?r=e.columns:typeof e.columns==`object`&&e.columns!==null&&(r=e.columns.xs??1,i=e.columns.sm,a=e.columns.md,s=e.columns.lg,c=e.columns.xl),e.smColumns&&(i=e.smColumns),e.mdColumns&&(a=e.mdColumns),e.lgColumns&&(s=e.lgColumns),e.xlColumns&&(c=e.xlColumns),typeof e.columns==`number`&&r>1&&i===void 0&&a===void 0&&s===void 0&&c===void 0&&(a=r,i=Math.min(2,r),r=1);let l=e.gap??4,u=R(`grid`,nc[r]||`grid-cols-2`,i&&rc[i],a&&ic[a],s&&ac[s],c&&oc[c],sc[l]||`gap-[${l*.25}rem]`,t),{"data-obj-id":d,"data-obj-type":f,style:p,...m}=n;return(0,o.jsx)(`div`,{className:u,...m,"data-obj-id":d,"data-obj-type":f,style:p,children:e.children&&z(e.children)})},{namespace:`ui`,label:`Grid Layout`,inputs:[{name:`columns`,type:`number`,label:`Base Columns (Mobile)`,defaultValue:2,description:`Number of columns on mobile devices`},{name:`smColumns`,type:`number`,label:`SM Columns (Tablet)`,description:`Columns at sm breakpoint (>640px)`},{name:`mdColumns`,type:`number`,label:`MD Columns (Laptop)`,description:`Columns at md breakpoint (>768px)`},{name:`lgColumns`,type:`number`,label:`LG Columns (Desktop)`,description:`Columns at lg breakpoint (>1024px)`},{name:`xlColumns`,type:`number`,label:`XL Columns (Wide)`,description:`Columns at xl breakpoint (>1280px)`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:4,description:`Gap between items (0-12)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{columns:1,mdColumns:2,lgColumns:4,gap:4,children:[{type:`card`,title:`Card 1`,description:`First card`},{type:`card`,title:`Card 2`,description:`Second card`},{type:`card`,title:`Card 3`,description:`Third card`},{type:`card`,title:`Card 4`,description:`Fourth card`}]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}}),t.ComponentRegistry.register(`flex`,({schema:e,className:t,...n})=>{let r=e.direction||`row`,i=e.justify||`start`,a=e.align||`start`,s=e.gap||2,c=e.wrap||!1,l=R(`flex`,r===`row`&&`flex-row`,r===`col`&&`flex-col`,r===`row-reverse`&&`flex-row-reverse`,r===`col-reverse`&&`flex-col-reverse`,i===`start`&&`justify-start`,i===`end`&&`justify-end`,i===`center`&&`justify-center`,i===`between`&&`justify-between`,i===`around`&&`justify-around`,i===`evenly`&&`justify-evenly`,a===`start`&&`items-start`,a===`end`&&`items-end`,a===`center`&&`items-center`,a===`baseline`&&`items-baseline`,a===`stretch`&&`items-stretch`,s===0&&`gap-0`,s===1&&`gap-1`,s===2&&`gap-1.5 sm:gap-2`,s===3&&`gap-2 sm:gap-3`,s===4&&`gap-2 sm:gap-3 md:gap-4`,s===5&&`gap-3 sm:gap-4 md:gap-5`,s===6&&`gap-3 sm:gap-4 md:gap-6`,s===7&&`gap-4 sm:gap-5 md:gap-7`,s===8&&`gap-4 sm:gap-6 md:gap-8`,c&&`flex-wrap`,t),{"data-obj-id":u,"data-obj-type":d,style:f,...p}=n;return(0,o.jsx)(`div`,{className:l,...p,"data-obj-id":u,"data-obj-type":d,style:f,children:e.children&&z(e.children)})},{namespace:`ui`,label:`Flex Layout`,inputs:[{name:`direction`,type:`enum`,enum:[`row`,`col`,`row-reverse`,`col-reverse`],label:`Direction`,defaultValue:`row`},{name:`justify`,type:`enum`,enum:[`start`,`end`,`center`,`between`,`around`,`evenly`],label:`Justify Content`,defaultValue:`start`},{name:`align`,type:`enum`,enum:[`start`,`end`,`center`,`baseline`,`stretch`],label:`Align Items`,defaultValue:`start`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:2,description:`Gap between items (0-8)`},{name:`wrap`,type:`boolean`,label:`Wrap`,defaultValue:!1,description:`Allow flex items to wrap`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`row`,justify:`start`,align:`center`,gap:2,wrap:!1,children:[{type:`button`,label:`Button 1`},{type:`button`,label:`Button 2`},{type:`button`,label:`Button 3`}]}});var cc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let i=e.direction||`col`,a=e.justify||`start`,s=e.align||`stretch`,c=e.gap??e.spacing??2,l=e.wrap||!1,u=R(`flex`,i===`row`&&`flex-row`,i===`col`&&`flex-col`,i===`row-reverse`&&`flex-row-reverse`,i===`col-reverse`&&`flex-col-reverse`,a===`start`&&`justify-start`,a===`end`&&`justify-end`,a===`center`&&`justify-center`,a===`between`&&`justify-between`,a===`around`&&`justify-around`,a===`evenly`&&`justify-evenly`,s===`start`&&`items-start`,s===`end`&&`items-end`,s===`center`&&`items-center`,s===`baseline`&&`items-baseline`,s===`stretch`&&`items-stretch`,c===0&&`gap-0`,c===1&&`gap-1`,c===2&&`gap-1.5 sm:gap-2`,c===3&&`gap-2 sm:gap-3`,c===4&&`gap-2 sm:gap-3 md:gap-4`,c===5&&`gap-3 sm:gap-4 md:gap-5`,c===6&&`gap-3 sm:gap-4 md:gap-6`,c===8&&`gap-4 sm:gap-6 md:gap-8`,c===10&&`gap-5 sm:gap-7 md:gap-10`,l&&`flex-wrap`,t),{"data-obj-id":d,"data-obj-type":f,style:p,...m}=n;return(0,o.jsx)(`div`,{ref:r,className:u,...m,"data-obj-id":d,"data-obj-type":f,style:p,children:e.children&&z(e.children)})});t.ComponentRegistry.register(`stack`,cc,{namespace:`ui`,label:`Stack`,inputs:[{name:`direction`,type:`enum`,label:`Direction`,enum:[`col`,`row`,`col-reverse`,`row-reverse`],defaultValue:`col`},{name:`gap`,type:`number`,label:`Gap`,defaultValue:2},{name:`align`,type:`enum`,label:`Align Items`,enum:[`start`,`end`,`center`,`stretch`,`baseline`],defaultValue:`stretch`},{name:`justify`,type:`enum`,label:`Justify Content`,enum:[`start`,`end`,`center`,`between`,`around`,`evenly`],defaultValue:`start`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`col`,gap:2,align:`stretch`,children:[]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:100,minHeight:50}});var lc=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let i=e.maxWidth||`xl`,a=e.padding||4,s=e.centered!==!1,c=R(`w-full`,i===`sm`&&`max-w-sm`,i===`md`&&`max-w-md`,i===`lg`&&`max-w-lg`,i===`xl`&&`max-w-xl`,i===`2xl`&&`max-w-2xl`,i===`3xl`&&`max-w-3xl`,i===`4xl`&&`max-w-4xl`,i===`5xl`&&`max-w-5xl`,i===`6xl`&&`max-w-6xl`,i===`7xl`&&`max-w-7xl`,i===`full`&&`max-w-full`,i===`screen`&&`max-w-screen-2xl`,s&&`mx-auto`,a===0&&`p-0`,a===1&&`p-0.5 sm:p-1`,a===2&&`p-1 sm:p-2`,a===3&&`p-2 sm:p-3`,a===4&&`p-2 sm:p-3 md:p-4`,a===5&&`p-3 sm:p-4 md:p-5`,a===6&&`p-3 sm:p-4 md:p-6`,a===7&&`p-4 sm:p-5 md:p-7`,a===8&&`p-4 sm:p-6 md:p-8`,a===10&&`p-5 sm:p-7 md:p-10`,a===12&&`p-6 sm:p-8 md:p-12`,a===16&&`p-8 sm:p-10 md:p-16`,t),{"data-obj-id":l,"data-obj-type":u,style:d,...f}=n;return(0,o.jsx)(`div`,{ref:r,className:c,...f,"data-obj-id":l,"data-obj-type":u,style:d,children:e.children&&z(e.children)})});t.ComponentRegistry.register(`container`,lc,{namespace:`ui`,label:`Container`,inputs:[{name:`maxWidth`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`,`2xl`,`3xl`,`4xl`,`5xl`,`6xl`,`7xl`,`full`,`screen`],label:`Max Width`,defaultValue:`xl`},{name:`padding`,type:`number`,label:`Padding`,defaultValue:4,description:`Padding value (0, 1-8, 10, 12, 16)`},{name:`centered`,type:`boolean`,label:`Center Horizontally`,defaultValue:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{maxWidth:`xl`,padding:4,centered:!0,children:[{type:`text`,content:`Container content goes here`}]},isContainer:!0,resizable:!0,resizeConstraints:{width:!0,height:!0,minWidth:200,minHeight:100}});function uc(e){switch(e){case`small`:return`w-64`;case`medium`:return`w-80`;case`large`:return`w-96`;case`full`:return`w-full`;default:return e||`w-full`}}function dc(e){switch(e){case`small`:return`w-full md:w-64`;case`medium`:return`w-full md:w-80`;case`large`:return`w-full md:w-96`;default:return`w-full`}}function fc(e){switch(e){case`utility`:return`max-w-4xl`;case`home`:return`max-w-screen-2xl`;case`app`:return`max-w-screen-xl`;default:return`max-w-7xl`}}function Q(e,t){return e?.find(e=>e.name?.toLowerCase()===t.toLowerCase())}function pc(e,t){if(!e)return[];let n=new Set(t.map(e=>e.toLowerCase()));return e.filter(e=>!n.has(e.name?.toLowerCase()??``))}var $=({region:e,className:t})=>{let n=e.components||[];return n.length===0?null:(0,o.jsx)(`div`,{className:R(`space-y-4`,e.className,t),"data-region":e.name,children:n.map((t,n)=>(0,o.jsx)(i.SchemaRenderer,{schema:t},t?.id||`${e.name}-${n}`))})},mc=({regions:e,pageType:t,className:n})=>{let r=Q(e,`header`),i=Q(e,`sidebar`),a=Q(e,`main`),s=Q(e,`aside`),c=Q(e,`footer`),l=pc(e,[`header`,`sidebar`,`main`,`aside`,`footer`]);return r||i||a||s||c?(0,o.jsxs)(`div`,{className:R(`flex flex-col gap-6`,n),"data-page-layout":t,children:[r&&(0,o.jsx)($,{region:r,className:R(uc(r.width))}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[i&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(i.width||`small`)),children:(0,o.jsx)($,{region:i})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[a&&(0,o.jsx)($,{region:a}),l.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]}),s&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(s.width||`small`),s.className),children:(0,o.jsx)($,{region:s})})]}),c&&(0,o.jsx)($,{region:c,className:R(uc(c.width))})]}):(0,o.jsx)(`div`,{className:R(`space-y-6`,n),"data-page-layout":t,children:e.map((e,t)=>(0,o.jsx)($,{region:e},e.name||t))})},hc=({schema:e})=>{let t=e.body||e.children,n=Array.isArray(t)?t:t?[t]:[];return n.length===0?null:(0,o.jsx)(`div`,{className:`space-y-6`,children:n.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},e?.id||t))})},gc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:e.pageType}):(0,o.jsx)(hc,{schema:e}),_c={default:gc,"full-width":gc,"header-sidebar-main":({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(hc,{schema:e});let n=Q(t,`header`),r=Q(t,`sidebar`),i=Q(t,`main`),a=pc(t,[`header`,`sidebar`,`main`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`header-sidebar-main`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[r&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(r.width||`medium`)),children:(0,o.jsx)($,{region:r})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[i&&(0,o.jsx)($,{region:i}),a.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]})]})]})},"three-column":({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(hc,{schema:e});let n=Q(t,`header`),r=Q(t,`sidebar`),i=Q(t,`main`),a=Q(t,`aside`),s=Q(t,`footer`),c=pc(t,[`header`,`sidebar`,`main`,`aside`,`footer`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`three-column`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsxs)(`div`,{className:`flex flex-col md:flex-row flex-1 gap-6`,children:[r&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(r.width||`small`)),children:(0,o.jsx)($,{region:r})}),(0,o.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-6`,children:[i&&(0,o.jsx)($,{region:i}),c.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`extra-${t}`))]}),a&&(0,o.jsx)(`aside`,{className:R(`md:shrink-0`,dc(a.width||`small`),a.className),children:(0,o.jsx)($,{region:a})})]}),s&&(0,o.jsx)($,{region:s})]})},dashboard:({schema:e})=>{let t=e.regions||[];if(t.length===0)return(0,o.jsx)(hc,{schema:e});let n=Q(t,`header`),r=Q(t,`footer`),i=pc(t,[`header`,`footer`]);return(0,o.jsxs)(`div`,{className:`flex flex-col gap-6`,"data-template":`dashboard`,children:[n&&(0,o.jsx)($,{region:n}),(0,o.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:i.map((e,t)=>(0,o.jsx)($,{region:e},e.name||`region-${t}`))}),r&&(0,o.jsx)($,{region:r})]})}};function vc(e){return e.template&&_c[e.template]||null}var yc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:`record`}):(0,o.jsx)(hc,{schema:e}),bc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:`home`}):(0,o.jsx)(hc,{schema:e}),xc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:`app`}):(0,o.jsx)(hc,{schema:e}),Sc=({schema:e})=>e.regions&&e.regions.length>0?(0,o.jsx)(mc,{regions:e.regions,pageType:`utility`}):(0,o.jsx)(hc,{schema:e}),Cc=({schema:e,className:t,...n})=>{let r=e.pageType||`record`,{"data-obj-id":s,"data-obj-type":c,style:l,pageType:u,schema:d,regions:f,template:p,title:m,icon:h,description:g,object:_,variables:v,body:y,isDefault:b,assignedProfiles:x,aria:S,recordOverride:C,permissions:w,requiredPermissions:T,enforceFieldSecurity:E,redactFields:D,children:O,...k}=n,A=Object.fromEntries(Object.entries(k).filter(([e])=>!e.startsWith(`_`))),j=(0,a.useMemo)(()=>{let t=vc(e);if(t)return(0,o.jsx)(t,{schema:e});switch(r){case`home`:return(0,o.jsx)(bc,{schema:e});case`app`:return(0,o.jsx)(xc,{schema:e});case`utility`:return(0,o.jsx)(Sc,{schema:e});default:return(0,o.jsx)(yc,{schema:e})}},[e,r]),ee=(e.regions??[]).some(e=>e.name?.toLowerCase()===`main`&&e.width===`full`),te=ee?`max-w-none`:fc(r),M=(0,o.jsx)(`div`,{className:R(`min-h-full w-full bg-background p-3 md:p-4 lg:p-6`,t),"data-page-type":r,"data-obj-id":s,"data-obj-type":c,style:l,...A,children:(0,o.jsxs)(`div`,{className:R(ee?`space-y-6`:`mx-auto space-y-6`,te),children:[r!==`record`&&(e.title||e.description)&&(0,o.jsxs)(`div`,{className:`space-y-2`,children:[e.title&&(0,o.jsx)(`h1`,{className:`text-3xl font-bold tracking-tight text-foreground`,children:e.title}),e.description&&(0,o.jsx)(`p`,{className:`text-muted-foreground`,children:e.description})]}),j]})});return e.variables&&e.variables.length>0?(0,o.jsxs)(i.PageVariablesProvider,{definitions:e.variables,children:[(0,o.jsx)(i.PageVariableActionBridge,{}),M]}):M},wc={namespace:`ui`,label:`Page`,icon:`Layout`,category:`layout`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`pageType`,type:`string`,label:`Page Type`},{name:`object`,type:`string`,label:`Object Name`},{name:`template`,type:`string`,label:`Template`},{name:`regions`,type:`array`,label:`Regions`,itemType:`object`},{name:`variables`,type:`array`,label:`Variables`,itemType:`object`},{name:`body`,type:`array`,label:`Content (Legacy)`,itemType:`component`}]};t.ComponentRegistry.register(`page`,Cc,wc),t.ComponentRegistry.register(`app`,Cc,{...wc,label:`App Page`}),t.ComponentRegistry.register(`utility`,Cc,{...wc,label:`Utility Page`}),t.ComponentRegistry.register(`home`,Cc,{...wc,label:`Home Page`}),t.ComponentRegistry.register(`record`,Cc,{...wc,label:`Record Page`});var Tc=new Map,Ec=new Map,Dc=new Set;function Oc(e,t,n){return`${e}::${t??``}::${n??``}`}function kc(){for(let e of Dc)e()}function Ac(e,t,n){return Tc.get(Oc(e,t,n))}function jc(e,t,n,r){let i=Oc(e,t,n);Tc.get(i)!==r&&(Tc.set(i,r),kc())}async function Mc(e,t,n,r){let i=Oc(t,n,r),a=Tc.get(i);if(a!==void 0)return a;let o=Ec.get(i);if(o)return o;let s=(async()=>{let a={};if(n){if(!r)return 0;a[n]=r}try{let i=await e(t,{$filter:a,$top:1,$count:!0}),o=typeof i?.total==`number`?i.total:typeof i?.count==`number`?i.count:Array.isArray(i?.records)?i.records.length:Array.isArray(i?.data)?i.data.length:Array.isArray(i)?i.length:0,s=typeof o==`number`?o:0;return jc(t,n,r,s),s}catch{return 0}finally{Ec.delete(i)}})();return Ec.set(i,s),s}function Nc(e,t){let n=!1,r=`${e}::`;for(let e of Tc.keys())e.startsWith(r)&&(t!==void 0&&!e.endsWith(`::${t}`)||(Tc.delete(e),n=!0));n&&kc()}function Pc(){Tc.size!==0&&(Tc.clear(),kc())}function Fc(e){return Dc.add(e),()=>{Dc.delete(e)}}function Ic(){return Tc}function Lc(e,t,n){if((0,a.useSyncExternalStore)(Fc,Ic,Ic),e)return Ac(e,t,n)}var Rc={get:Ac,set:jc,fetch:Mc,invalidate:Nc,invalidateAll:Pc,_reset:()=>{Tc.clear(),Ec.clear(),kc()}},zc=e=>{let{"data-obj-id":t,"data-obj-type":n,style:r,...i}=e||{};return{designer:{"data-obj-id":t,"data-obj-type":n,style:r},rest:i}},Bc=e=>e==null?``:typeof e==`string`?e:typeof e==`object`?e.default||e.value||``:String(e),Vc={"zh-CN":{Details:`详情`,Related:`相关`,Activity:`活动`,History:`历史`,Notes:`备注`,Files:`文件`,Tasks:`任务`,"Open Tasks":`待办任务`,"Closed Tasks":`已完成任务`,Events:`日程`,Attachments:`附件`,Chatter:`讨论`,Discussion:`讨论`,Comments:`评论`,Overview:`概览`,Summary:`摘要`,Quotes:`报价单`,Products:`产品`,Contacts:`联系人`,Accounts:`客户`,Leads:`线索`,Opportunities:`商机`,Cases:`服务案例`,Campaigns:`营销活动`,Approvals:`审批`,Documents:`文档`,Emails:`邮件`,Calls:`通话`,Meetings:`会议`},"zh-TW":{Details:`詳情`,Related:`相關`,Activity:`活動`,History:`歷史`,Notes:`備註`,Files:`檔案`,Tasks:`任務`,"Open Tasks":`待辦任務`,"Closed Tasks":`已完成任務`,Events:`行程`,Attachments:`附件`,Chatter:`討論`,Discussion:`討論`,Comments:`評論`,Overview:`概覽`,Summary:`摘要`,Quotes:`報價單`,Products:`產品`,Contacts:`聯絡人`,Accounts:`客戶`,Leads:`線索`,Opportunities:`商機`,Cases:`服務案例`,Campaigns:`行銷活動`,Approvals:`審批`,Documents:`文件`,Emails:`郵件`,Calls:`通話`,Meetings:`會議`}},Hc=()=>{if(typeof document<`u`){let e=document.documentElement?.lang;if(e)return e}return typeof navigator<`u`&&navigator.language?navigator.language:`en`},Uc=e=>{if(!e)return e;let t=Hc(),n=Vc[t],r=t.split(`-`)[0]===`zh`?Vc[`zh-CN`]:void 0,i=n||r;if(!i)return e;if(i[e]!==void 0)return i[e];let a=/\s*(?:&|and|和)\s*/i;if(a.test(e)){let n=e.split(a);if(n.every(e=>i[e.trim()]!==void 0)){let e=t.startsWith(`zh`)?`与`:` & `;return n.map(e=>i[e.trim()]).join(e)}}return e},Wc=(e,t,n,r,i)=>!e||typeof e!=`string`?e||``:e.includes(`{`)?e.replace(/\{([a-zA-Z0-9_.]+)\}/g,(e,a)=>{let o=a.split(`.`).reduce((e,t)=>e==null?e:e[t],t);if(o==null||typeof o==`object`)return``;let s=String(o);if(n?.fields&&r&&i&&!a.includes(`.`)){let e=(Array.isArray(n.fields)?n.fields.find(e=>e?.name===a):n.fields[a])?.options;if(Array.isArray(e)){let t=e.find(e=>String(e?.value??e)===s);return r(i,a,s,t?.label?String(t.label):s)}}return s}).replace(/\s+/g,` `).trim():e,Gc=e=>{let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?t>=1e4?`${Math.round(t/1e3)}k`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,``)}k`:String(t):String(e)},Kc=(e,t=[])=>{if(!e)return t;let n=Array.isArray(e)?e:[e];for(let e of n){if(!e||typeof e!=`object`)continue;if(e.type===`record:related_list`||e.type===`record_related_list`){t.push(e);continue}let n=[e.children,e.properties?.children,e.properties?.items,e.body,e.items];for(let e of n)e&&Kc(e,t)}return t};t.ComponentRegistry.register(`page:tabs`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n),{language:s}=(0,F.useObjectTranslation)(),c=e?.items||[],l=e?.properties?.type||e?.tabStyle||`line`,u=(e?.position||`top`)===`left`,d=(0,i.useRecordContext)(),f=d?.data?.id,p=d?.dataSource;Lc(void 0,void 0,f);let m=a.default.useMemo(()=>{let e=new Map;return c.forEach((t,n)=>{if(t.count!==void 0&&t.count!==null&&t.count!==``)return;let r=Kc(t.children),i=[];for(let e of r){let t=e?.properties?.objectName||e?.objectName;if(!t)continue;let n=e?.properties?.relationshipField||e?.relationshipField;i.push({objectName:t,relationshipField:n})}i.length>0&&e.set(n,i)}),e},[c]);a.default.useEffect(()=>{if(!p||typeof p.find!=`function`||m.size===0)return;let e=!1;for(let t of m.values())for(let n of t)if(Rc.fetch((e,t)=>p.find(e,t),n.objectName,n.relationshipField,f).catch(()=>0),e)return;return()=>{e=!0}},[p,m,f]);let h=e=>{let t=m.get(e);if(!t||t.length===0)return;let n=0,r=!1;for(let e of t){let t=Rc.get(e.objectName,e.relationshipField,f);t!==void 0&&(n+=t,r=!0)}return r?n:void 0},g=c.map((e,t)=>({...e,value:`tab-${t}`,labelStr:Uc((0,F.pickLocalized)(e.label,s)),count:e.count!==void 0&&e.count!==null&&e.count!==``?e.count:h(t)})),_=g[0]?.value,v=R(u&&`flex-col h-auto items-stretch p-1`,l===`card`&&`bg-transparent gap-1`,l===`pill`&&`bg-muted rounded-full p-1 gap-1`,l===`line`&&!u&&`h-auto rounded-none bg-transparent p-0 gap-4 border-b border-border w-full justify-start`,!u&&`sticky top-0 z-20 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60`),y=()=>R(u&&`justify-start`,l===`card`&&`data-[state=active]:bg-background data-[state=active]:border data-[state=active]:shadow-sm rounded-md`,l===`pill`&&`rounded-full data-[state=active]:bg-background`,l===`line`&&!u&&`rounded-none border-b-2 border-transparent bg-transparent px-1 pb-2.5 -mb-px shadow-none data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none data-[state=active]:text-foreground`);return(0,o.jsxs)(Qi,{defaultValue:_,orientation:u?`vertical`:`horizontal`,className:R(t,u&&`flex gap-4 w-full`),...r,children:[(g.length>1||e?.properties?.alwaysShowStrip===!0)&&(0,o.jsx)($i,{className:v,children:g.map(e=>(0,o.jsxs)(ea,{value:e.value,className:y(),children:[e.icon&&(0,o.jsx)(ka,{name:e.icon,className:`mr-1.5 h-3.5 w-3.5 shrink-0 opacity-70`,"aria-hidden":!0}),(0,o.jsx)(`span`,{children:e.labelStr}),e.count!==void 0&&e.count!==null&&e.count!==``&&Number(e.count)>0&&(0,o.jsx)(`span`,{className:`ml-1.5 inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-muted px-1 text-[10px] font-medium leading-none text-muted-foreground`,"aria-label":`${Gc(e.count)} items`,children:Gc(e.count)})]},e.value))}),g.map(e=>(0,o.jsx)(ta,{value:e.value,className:R(g.length>1?`mt-3`:`mt-0`,u&&`mt-0 flex-1`),children:z(e.children)},e.value))]})},{namespace:`page`,label:`Page Tabs`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`page:card`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n),{language:i}=(0,F.useObjectTranslation)(),a=(0,F.pickLocalized)(e?.title,i),s=e?.bordered!==!1,c=e?.body??e?.children,l=e?.footer;return(0,o.jsxs)(et,{className:R(t,!s&&`border-0 shadow-none bg-transparent`),...r,children:[a&&(0,o.jsx)(tt,{children:(0,o.jsx)(nt,{children:a})}),c&&(0,o.jsx)(it,{children:z(c)}),l&&(0,o.jsx)(at,{className:`flex justify-between`,children:z(l)})]})},{namespace:`page`,label:`Page Card`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`page:accordion`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n),{language:i}=(0,F.useObjectTranslation)(),a=e?.items||[],s=!!e?.allowMultiple,c=(e?.variant??e?.properties?.variant??`flush`)===`flush`?`border-b last:border-b-0`:void 0,l=a.map((e,t)=>({...e,value:`panel-${t}`,labelStr:Uc((0,F.pickLocalized)(e.label,i))})),u=l.filter(e=>e.collapsed===!1).map(e=>e.value),d=l.map(e=>(0,o.jsxs)(Se,{value:e.value,className:c,children:[(0,o.jsx)(Ce,{className:`text-sm font-semibold tracking-tight hover:no-underline`,children:e.labelStr}),(0,o.jsx)(we,{children:z(e.children)})]},e.value));return s?(0,o.jsx)(xe,{type:`multiple`,defaultValue:u,className:t,...r,children:d}):(0,o.jsx)(xe,{type:`single`,collapsible:!0,defaultValue:u[0],className:t,...r,children:d})},{namespace:`page`,label:`Page Accordion`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`page:section`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n);return(0,o.jsx)(`section`,{className:R(`space-y-4`,t),...r,children:z(e?.children||e?.body)})},{namespace:`page`,label:`Page Section`,category:`layout`,isContainer:!0});function qc(e){if(!e)return e;let t=e;for(let e=0;e<4;e+=1){let e=t.replace(/[\s\u00A0]*[-·:|/–—][\s\u00A0]*$/u,``).trimEnd();if(e===t)break;t=e}for(let e=0;e<4;e+=1){let e=t.replace(/^[\s\u00A0]*[-·:|/–—][\s\u00A0]*/u,``).trimStart();if(e===t)break;t=e}return t=t.replace(/([-·:|/–—])[\s\u00A0]*\1/gu,`$1`),t=t.replace(/[\s\u00A0]+/g,` `).trim(),t}t.ComponentRegistry.register(`page:header`,({schema:e,className:n,...r})=>{let{designer:s}=zc(r),l=(0,i.useRecordContext)(),u=(0,i.usePredicateScope)(),{execute:d}=(0,i.useAction)(),{objectLabel:f,actionLabel:p}=(0,F.useObjectLabel)(),{fieldOptionLabel:m}=(0,F.useSafeFieldLabel)(),{language:h}=(0,F.useObjectTranslation)(),g=e?.title??e?.properties?.title,_=e?.subtitle??e?.properties?.subtitle,v=l?.objectSchema,y=l?.objectName||v?.name,b=Wc((0,F.pickLocalized)(g,h),l?.data,v,m,y),x=Wc((0,F.pickLocalized)(_,h),l?.data,v,m,y),S=(e?.breadcrumb??e?.properties?.breadcrumb)!==!1,C=e?.recordChrome===!1||e?.properties?.recordChrome===!1,w=e?.showStar!==!1&&e?.properties?.showStar!==!1,T=e?.showCopyId!==!1&&e?.properties?.showCopyId!==!1,E=e?.actions??e?.properties?.actions,D=l?.headerSystemActions,O=a.default.useMemo(()=>{let e=l?.data,n=u?.user,r=new t.ExpressionEvaluator({...e&&typeof e==`object`?e:{},record:e,data:e,user:n,ctx:{user:n,record:e,data:e,app:u?.app,features:u?.features}}),i=e=>{try{return r.evaluateExpression(e)}catch{return}},a=e=>{if(Array.isArray(e?.locations)&&e.locations.length>0&&!e.locations.includes(`record_header`))return!1;let t=e?.visible;if(t!=null)if(typeof t==`boolean`){if(!t)return!1}else{let e=typeof t==`string`?t:t&&typeof t==`object`&&typeof t.source==`string`?t.source:null;if(e&&!i(e))return!1}let n=e?.hidden;if(n!=null)if(typeof n==`boolean`){if(n)return!1}else{let e=typeof n==`string`?n:n&&typeof n==`object`&&typeof n.source==`string`?n.source:null;if(e&&i(e))return!1}return!0},o=Array.isArray(E)?E.filter(a):[],s=Array.isArray(D)?D.filter(a):[],c=new Set,d=[];for(let e of[...o,...s]){let t=e?.name||e?.id||``;t&&c.has(t)||(t&&c.add(t),d.push(e))}return d},[E,D,l?.data,u]),k=()=>{if(O.length===0)return null;let e=(e,t)=>{let n=e?.name||e?.id,r=e?.label||n||`Action ${t+1}`;return n?p(l?.objectName,n,r):r},n=O.length>2,r=n?O.slice(0,1):O,i=n?O.slice(1):[],a=l?.data,s=new t.ExpressionEvaluator({...a&&typeof a==`object`?a:{},record:a,data:a}),u=e=>{if(e==null)return!1;if(typeof e==`boolean`)return e;let t=typeof e==`string`?e:e&&typeof e==`object`&&typeof e.source==`string`?e.source:void 0;if(!t)return!1;try{return!!s.evaluateExpression(t)}catch{return!1}};return(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 shrink-0`,role:`toolbar`,"aria-label":`Page header actions`,children:[r.map((t,n)=>{let r=e(t,n),i=t.variant||`default`,a=t.size||`sm`,s=u(t.disabled),c=typeof t.icon==`string`?t.icon:null;return(0,o.jsxs)(B,{variant:i,size:a,disabled:s,className:`gap-2`,onClick:()=>{if(typeof t.onClick==`function`){t.onClick();return}d(t)},children:[c&&(0,o.jsx)(ka,{name:c,className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:r})]},t.name||t.id||`header-action-${n}`)}),n&&(0,o.jsxs)(vn,{children:[(0,o.jsx)(yn,{asChild:!0,children:(0,o.jsx)(B,{variant:`outline`,size:`sm`,className:`gap-1 px-2`,"aria-label":`More actions`,children:(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`})})}),(0,o.jsx)(En,{align:`end`,className:`w-44`,children:i.map((t,n)=>{let r=e(t,n+1),i=u(t.disabled),a=typeof t.icon==`string`?t.icon:null;return(0,o.jsxs)(Dn,{disabled:i,onSelect:e=>{if(e.preventDefault(),typeof t.onClick==`function`){t.onClick();return}d(t)},className:R(`gap-2`,(t.variant===`destructive`||t.name===`sys_delete`)&&`text-destructive focus:text-destructive focus:bg-destructive/10`),children:[a&&(0,o.jsx)(ka,{name:a,className:`h-4 w-4`}),(0,o.jsx)(`span`,{children:r})]},t.name||t.id||`overflow-action-${n}`)})})]})]})};if(l?.data&&l?.objectSchema&&!C){let e=l.data,t=l.objectSchema,r=l.objectName||t?.name,i=Bc(t?.label)||t?.name||l.objectName||``,a=r?f({name:r,label:i}):i||void 0,c=t?.primaryField,u=t?.titleFormat,d=typeof u==`string`?u:u&&typeof u==`object`&&typeof u.source==`string`?u.source:void 0,p=d?qc(Wc(d,e,t,m,r).trim()):``,h=b||c&&e?.[c]||(p&&!p.includes(`{`)?p:``)||e?.name||e?.full_name||e?.title||e?.subject||e?.display_name||e?.label||(a&&e?.id?`${a} ${String(e.id).slice(0,8)}`:``)||a||``;return(0,o.jsxs)(`header`,{className:R(`flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3 sm:gap-4 pb-4 border-b`,n),...s,children:[(0,o.jsxs)(`div`,{className:`flex flex-col min-w-0 flex-1`,children:[S&&(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground mb-1`,"data-page-breadcrumb-slot":!0}),(0,o.jsx)(Gs,{title:h,objectLabel:a,resourceId:e?.id?String(e.id):void 0,showStar:w,showCopyId:T,isFavorite:l?.isFavorite,onToggleFavorite:l?.onToggleFavorite?()=>l.onToggleFavorite():void 0}),x&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground mt-1`,children:x})]}),k()??(0,o.jsx)(`div`,{"data-page-actions-slot":!0,className:`shrink-0`})]})}return(0,o.jsxs)(`header`,{className:R(`flex flex-col gap-2 pb-4 border-b`,n),...s,children:[S&&(0,o.jsx)(`div`,{className:`text-xs text-muted-foreground`,"data-page-breadcrumb-slot":!0}),(0,o.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[b&&(0,o.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight`,children:b}),x&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:x})]}),k()??(0,o.jsx)(`div`,{"data-page-actions-slot":!0})]})]})},{namespace:`page`,label:`Page Header`,category:`layout`}),t.ComponentRegistry.register(`page:footer`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n);return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(Gr,{className:`my-4`}),(0,o.jsx)(`footer`,{className:R(`flex items-center justify-between text-sm text-muted-foreground`,t),...r,children:z(e?.children||e?.body)})]})},{namespace:`page`,label:`Page Footer`,category:`layout`,isContainer:!0}),t.ComponentRegistry.register(`page:sidebar`,({schema:e,className:t,...n})=>{let{designer:r}=zc(n);return(0,o.jsx)(`aside`,{className:R(`flex flex-col gap-4 w-full md:w-80 shrink-0`,t),...r,children:z(e?.children||e?.body)})},{namespace:`page`,label:`Page Sidebar`,category:`layout`,isContainer:!0}),[`aside`,`main`,`header`,`nav`,`footer`,`section`,`article`].forEach(e=>{let n=(0,a.forwardRef)(({schema:t,className:n,...r},i)=>{let{"data-obj-id":a,"data-obj-type":s,style:c,...l}=r;return(0,o.jsx)(e,{ref:i,className:n,...l,"data-obj-id":a,"data-obj-type":s,style:c,children:z(t.children||t.body)})});n.displayName=`Semantic${e.charAt(0).toUpperCase()+e.slice(1)}`,t.ComponentRegistry.register(e,n,{namespace:`ui`,label:e.charAt(0).toUpperCase()+e.slice(1),category:`layout`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}]})}),t.ComponentRegistry.register(`aspect-ratio`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(ze,{ratio:e.ratio||16/9,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.image?(0,o.jsx)(`img`,{src:e.image,alt:e.alt||``,loading:`lazy`,className:`rounded-md object-cover w-full h-full`}):z(e.children||e.body)})},{namespace:`ui`,label:`Aspect Ratio`,inputs:[{name:`ratio`,type:`number`,label:`Ratio`,defaultValue:16/9},{name:`image`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{ratio:16/9}}),t.ComponentRegistry.register(`sidebar-provider`,({schema:e,...t})=>(0,o.jsx)(_i,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Provider`,inputs:[{name:`defaultOpen`,type:`boolean`,label:`Default Open`,defaultValue:!0}],defaultProps:{defaultOpen:!0},defaultChildren:[{type:`sidebar`},{type:`sidebar-inset`}]}),t.ComponentRegistry.register(`sidebar`,({schema:e,...t})=>(0,o.jsx)(vi,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar`,inputs:[{name:`collapsible`,type:`enum`,enum:[`offcanvas`,`icon`,`none`],defaultValue:`icon`,label:`Collapsible`},{name:`side`,type:`enum`,enum:[`left`,`right`],defaultValue:`left`,label:`Side`},{name:`variant`,type:`enum`,enum:[`sidebar`,`floating`,`inset`],defaultValue:`sidebar`,label:`Variant`}],defaultProps:{collapsible:`icon`,side:`left`,variant:`sidebar`},defaultChildren:[{type:`sidebar-header`},{type:`sidebar-content`},{type:`sidebar-footer`}]}),t.ComponentRegistry.register(`sidebar-header`,({schema:e,...t})=>(0,o.jsx)(Ci,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Header`,defaultChildren:[{type:`text`,content:`Sidebar Header`}]}),t.ComponentRegistry.register(`sidebar-content`,({schema:e,...t})=>(0,o.jsx)(Ei,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Content`,defaultChildren:[{type:`sidebar-group`}]}),t.ComponentRegistry.register(`sidebar-group`,({schema:e,...t})=>(0,o.jsxs)(Di,{...t,children:[e.label&&(0,o.jsx)(Oi,{children:e.label}),(0,o.jsx)(Ai,{children:z(e.body)})]}),{namespace:`ui`,label:`Sidebar Group`,inputs:[{name:`label`,type:`string`,label:`Label`}],defaultProps:{label:`Menu`},defaultChildren:[{type:`sidebar-menu`}]}),t.ComponentRegistry.register(`sidebar-menu`,({schema:e,...t})=>(0,o.jsx)(ji,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Menu`,defaultChildren:[{type:`sidebar-menu-item`},{type:`sidebar-menu-item`}]}),t.ComponentRegistry.register(`sidebar-menu-item`,({schema:e,...t})=>(0,o.jsx)(Mi,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Menu Item`,defaultChildren:[{type:`sidebar-menu-button`}]}),t.ComponentRegistry.register(`sidebar-menu-button`,({schema:e,...t})=>(0,o.jsx)(Pi,{isActive:e.active,...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Menu Button`,inputs:[{name:`active`,type:`boolean`,label:`Active`,defaultValue:!1},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`tooltip`,type:`string`,label:`Tooltip`}],defaultProps:{size:`default`},defaultChildren:[{type:`text`,content:`Menu Item`}]}),t.ComponentRegistry.register(`sidebar-footer`,({schema:e,...t})=>(0,o.jsx)(wi,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Footer`,defaultChildren:[{type:`text`,content:`Footer`}]}),t.ComponentRegistry.register(`sidebar-inset`,({schema:e,...t})=>(0,o.jsx)(xi,{...t,children:z(e.body)}),{namespace:`ui`,label:`Sidebar Inset`,defaultChildren:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Main content area`}]}]}),t.ComponentRegistry.register(`sidebar-trigger`,({className:e,...t})=>(0,o.jsx)(yi,{className:e,...t}),{namespace:`ui`,label:`Sidebar Trigger`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}]});function Jc({crumb:e,isLast:t}){let n=(0,i.resolveI18nLabel)(e.label)??``;return e.siblings&&e.siblings.length>0?(0,o.jsxs)(vn,{children:[(0,o.jsxs)(yn,{className:`flex items-center gap-1`,children:[t?(0,o.jsx)(`span`,{className:`font-semibold`,children:n}):(0,o.jsx)(`span`,{children:n}),(0,o.jsx)(c.ChevronDown,{className:`h-3 w-3`})]}),(0,o.jsx)(En,{align:`start`,children:e.siblings.map((e,t)=>(0,o.jsx)(Dn,{asChild:!0,children:(0,o.jsx)(`a`,{href:e.href,children:e.label})},t))})]}):t?(0,o.jsx)(Ye,{children:n}):(0,o.jsx)(Je,{href:e.href||`#`,children:n})}t.ComponentRegistry.register(`header-bar`,({schema:e})=>(0,o.jsxs)(`header`,{className:`flex h-14 sm:h-16 shrink-0 items-center gap-2 border-b px-3 sm:px-4`,children:[(0,o.jsx)(yi,{}),(0,o.jsx)(Gr,{orientation:`vertical`,className:`mr-2 h-4`}),(0,o.jsx)(Ge,{children:(0,o.jsx)(Ke,{children:e.crumbs?.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[(0,o.jsx)(qe,{children:(0,o.jsx)(Jc,{crumb:t,isLast:n===e.crumbs.length-1})}),n<e.crumbs.length-1&&(0,o.jsx)(Xe,{})]},n))})}),(0,o.jsxs)(`div`,{className:`ml-auto flex items-center gap-2`,children:[e.search?.enabled&&(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsx)(c.Search,{className:`absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(W,{type:`search`,placeholder:e.search.placeholder,className:`pl-8 w-[200px] lg:w-[300px]`}),e.search.shortcut&&(0,o.jsx)(`kbd`,{className:`pointer-events-none absolute right-2 top-2 hidden h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 sm:flex`,children:e.search.shortcut})]}),e.actions?.map((e,t)=>(0,o.jsx)(i.SchemaRenderer,{schema:e},t)),e.rightContent&&(0,o.jsx)(i.SchemaRenderer,{schema:e.rightContent})]})]}),{namespace:`ui`,label:`Header Bar`,inputs:[{name:`crumbs`,type:`array`,label:`Breadcrumbs`},{name:`search`,type:`object`,label:`Search Configuration`},{name:`actions`,type:`array`,label:`Action Slots`},{name:`rightContent`,type:`object`,label:`Right Content`}],defaultProps:{crumbs:[{label:`Home`,href:`#`},{label:`Current Page`}]}}),t.ComponentRegistry.register(`badge`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(We,{variant:e.variant,className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.label||z(e.body)})},{namespace:`ui`,label:`Badge`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`variant`,type:`enum`,enum:[`default`,`secondary`,`destructive`,`outline`],defaultValue:`default`,label:`Variant`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{label:`Badge`,variant:`default`}}),t.ComponentRegistry.register(`avatar`,({schema:e,className:t,...n})=>(0,o.jsxs)(Be,{className:t,...n,children:[(0,o.jsx)(Ve,{src:e.src,alt:e.alt}),(0,o.jsx)(He,{children:e.fallback})]}),{namespace:`ui`,label:`Avatar`,inputs:[{name:`src`,type:`string`,label:`Image URL`},{name:`alt`,type:`string`,label:`Alt Text`},{name:`fallback`,type:`string`,label:`Fallback Initials`,defaultValue:`CN`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{fallback:`CN`,alt:`Avatar`}}),t.ComponentRegistry.register(`alert`,({schema:e,className:t,...n})=>(0,o.jsxs)(V,{variant:e.variant,className:t,...n,children:[(0,o.jsx)(H,{children:e.title}),(0,o.jsx)(Re,{children:e.description||z(e.body)})]}),{namespace:`ui`,label:`Alert`,inputs:[{name:`title`,type:`string`,label:`Title`,required:!0},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`destructive`],defaultValue:`default`,label:`Variant`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Alert Title`,description:`This is an alert message.`,variant:`default`}}),t.ComponentRegistry.register(`list`,({schema:e,className:t,...n})=>{let r=(0,i.useDataScope)(e.bind),a=Array.isArray(r)?r:Array.isArray(e.items)?e.items:[],s=e.ordered?`ol`:`ul`,c=e.ordered?`list-decimal`:`list-disc`;return(0,o.jsxs)(`div`,{className:R(`space-y-2`,e.wrapperClass),children:[e.title&&(0,o.jsx)(`h3`,{className:`text-lg font-semibold tracking-tight`,children:e.title}),(0,o.jsx)(s,{className:R(`ml-6 [&>li]:mt-2`,c,t),...n,children:a.map((e,t)=>(0,o.jsx)(`li`,{className:R(typeof e==`object`&&e.className),children:typeof e==`string`?e:e.content||z(e.body)},t))})]})},{namespace:`ui`,label:`List`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`ordered`,type:`boolean`,label:`Ordered List (numbered)`,defaultValue:!1},{name:`items`,type:`array`,label:`List Items`,description:`Array of strings or objects with content/body`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{ordered:!1,items:[`First item`,`Second item`,`Third item`],className:`text-sm`}});var Yc=({node:e,onNodeClick:t})=>{let[n,r]=(0,a.useState)(!1),i=e.children&&e.children.length>0;return(0,o.jsxs)(`div`,{className:`relative`,children:[(0,o.jsxs)(`div`,{className:R(`group flex items-center py-1.5 px-2 rounded-sm cursor-pointer transition-colors`,`hover:bg-accent hover:text-accent-foreground`,n&&i&&`bg-accent/50`),onClick:()=>{t&&t(e)},children:[i?(0,o.jsx)(`button`,{onClick:e=>{e.stopPropagation(),r(!n)},className:`mr-2 p-0.5 h-5 w-5 flex items-center justify-center rounded-sm hover:bg-muted text-muted-foreground transition-colors`,children:n?(0,o.jsx)(c.ChevronDown,{className:`h-4 w-4`}):(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})}):(0,o.jsx)(`span`,{className:`mr-2 w-5 flex justify-center`,children:(0,o.jsx)(`div`,{className:`w-1 h-1 rounded-full bg-muted-foreground/50`})}),e.icon===`folder`||i?n?(0,o.jsx)(c.FolderOpen,{className:`h-4 w-4 mr-2 text-primary`}):(0,o.jsx)(c.Folder,{className:`h-4 w-4 mr-2 text-muted-foreground group-hover:text-primary transition-colors`}):(0,o.jsx)(c.File,{className:`h-4 w-4 mr-2 text-muted-foreground group-hover:text-primary transition-colors`}),(0,o.jsx)(`span`,{className:R(`text-sm transition-colors`,n?`font-medium text-foreground`:`text-muted-foreground group-hover:text-foreground`),children:e.label})]}),i&&n&&(0,o.jsx)(`div`,{className:`relative ml-[11px] pl-3 border-l border-border animate-in slide-in-from-left-2 fade-in duration-200`,children:e.children.map(e=>(0,o.jsx)(Yc,{node:e,onNodeClick:t},e.id))})]})};t.ComponentRegistry.register(`tree-view`,({schema:e,className:t,...n})=>{let r=t=>{e.onNodeClick&&e.onNodeClick(t)},a=(0,i.useDataScope)(e.bind)||e.nodes||e.data||[],s=Array.isArray(a)?a:[];return(0,o.jsxs)(`div`,{className:R(`relative border rounded-lg p-3 bg-card text-card-foreground`,t),...n,children:[e.title&&(0,o.jsx)(`div`,{className:`flex items-center gap-2 mb-3 pb-2 border-b`,children:(0,o.jsx)(`h3`,{className:`text-sm font-semibold`,children:e.title})}),(0,o.jsx)(`div`,{className:`space-y-1`,children:s.map(e=>(0,o.jsx)(Yc,{node:e,onNodeClick:r},e.id))})]})},{namespace:`ui`,label:`Tree View`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`nodes`,type:`array`,label:`Tree Nodes`,description:`Array of { id, label, icon, children, data }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`File Explorer`,nodes:[{id:`1`,label:`Documents`,icon:`folder`,children:[{id:`1-1`,label:`Resume.pdf`,icon:`file`},{id:`1-2`,label:`Cover Letter.docx`,icon:`file`}]},{id:`2`,label:`Photos`,icon:`folder`,children:[{id:`2-1`,label:`Vacation`,icon:`folder`,children:[{id:`2-1-1`,label:`Beach.jpg`,icon:`file`}]},{id:`2-2`,label:`Family.jpg`,icon:`file`}]},{id:`3`,label:`README.md`,icon:`file`}]}});var Xc=e=>e?Oa(e):null;t.ComponentRegistry.register(`statistic`,({schema:e})=>{let t=e.icon?Xc(e.icon):null;return(0,o.jsxs)(`div`,{className:R(`group relative flex flex-col p-4 sm:p-5 md:p-6 rounded-xl border bg-card text-card-foreground shadow-sm`,e.className),children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between mb-2`,children:[e.label&&(0,o.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:e.label}),t&&(0,o.jsx)(t,{className:`h-4 w-4 text-muted-foreground`})]}),(0,o.jsx)(`div`,{className:`flex items-baseline gap-2`,children:(0,o.jsx)(`h3`,{className:`text-2xl font-bold tracking-tight`,children:e.value})}),(e.trend||e.description)&&(0,o.jsxs)(`div`,{className:`mt-1 flex items-center text-xs text-muted-foreground`,children:[e.trend===`up`&&(0,o.jsx)(c.TrendingUp,{className:`mr-1 h-3 w-3 text-emerald-500`}),e.trend===`down`&&(0,o.jsx)(c.TrendingDown,{className:`mr-1 h-3 w-3 text-rose-500`}),e.trend===`neutral`&&(0,o.jsx)(c.Minus,{className:`mr-1 h-3 w-3`}),(0,o.jsx)(`span`,{className:R(e.trend===`up`&&`text-emerald-500 font-medium`,e.trend===`down`&&`text-rose-500 font-medium`),children:e.description})]})]})},{namespace:`ui`,label:`Statistic`,category:`data-display`,icon:`Activity`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`value`,type:`string`,label:`Value`},{name:`description`,type:`string`,label:`Description`},{name:`trend`,type:`enum`,enum:[{label:`Up`,value:`up`},{label:`Down`,value:`down`},{label:`Neutral`,value:`neutral`}],label:`Trend`}],defaultProps:{label:`Total Revenue`,value:`$45,231.89`,trend:`up`,description:`+20.1% from last month`}}),t.ComponentRegistry.register(`breadcrumb`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:a,...s}=t;return(0,o.jsx)(Ge,{className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:a,children:(0,o.jsx)(Ke,{children:e.items?.map((t,n)=>(0,o.jsxs)(`div`,{className:`flex items-center`,children:[(0,o.jsx)(qe,{children:n===(e.items?.length||0)-1?(0,o.jsx)(Ye,{children:(0,i.resolveI18nLabel)(t.label)??``}):(0,o.jsx)(Je,{href:t.href,children:(0,i.resolveI18nLabel)(t.label)??``})}),n<(e.items?.length||0)-1&&(0,o.jsx)(Xe,{})]},n))})})},{namespace:`ui`,label:`Breadcrumb`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{items:[{label:`Home`,href:`/`},{label:`Products`,href:`/products`},{label:`Product`}]}}),t.ComponentRegistry.register(`kbd`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t,s=Array.isArray(e.keys)?e.keys:[e.keys||e.label||`K`];return(0,o.jsx)(`div`,{className:R(`inline-flex flex-wrap gap-1`,e.className),children:s.map((e,t)=>(0,o.jsx)(`kbd`,{className:`pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium text-muted-foreground opacity-100`,...a,...t===0?{"data-obj-id":n,"data-obj-type":r,style:i}:{},children:e},t))})},{namespace:`ui`,label:`Keyboard Key`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{label:`K`}}),t.ComponentRegistry.register(`table`,({schema:e,className:t})=>{let n=(0,i.useDataScope)(e.bind)||e.data||e.props?.data||[],r=Array.isArray(e.columns)?e.columns:Array.isArray(e.props?.columns)?e.props.columns:[];if(n&&!Array.isArray(n))return(0,o.jsx)(`div`,{className:`text-red-500 p-2 border border-red-200 bg-red-50 rounded text-sm`,children:`Table data must be an array`});let a=Array.isArray(n)?n:[];return(0,o.jsx)(`div`,{className:R(`rounded-md border`,t),children:(0,o.jsxs)(Wi,{children:[(0,o.jsx)(Gi,{children:(0,o.jsx)(Ji,{children:r.map((e,t)=>(0,o.jsx)(Yi,{children:e.label||e.header},e.key||e.accessorKey||t))})}),(0,o.jsx)(Ki,{children:a.length===0?(0,o.jsx)(Ji,{children:(0,o.jsx)(Xi,{colSpan:r.length,className:`h-24 text-center`,children:`No results.`})}):a.map((e,t)=>(0,o.jsx)(Ji,{children:r.map((t,n)=>{let r=t.key||t.accessorKey||``,i=r?e[r]:``;return(0,o.jsx)(Xi,{children:typeof i==`object`&&i?String(i):i},t.key||t.accessorKey||n)})},e.id||t))})]})})},{namespace:`ui`}),t.ComponentRegistry.register(`progress`,({schema:e,className:t,...n})=>(0,o.jsx)(Mr,{value:e.value,className:t,...n}),{namespace:`ui`,label:`Progress`,inputs:[{name:`value`,type:`number`,label:`Value`,defaultValue:0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{value:50,className:`w-full`}}),t.ComponentRegistry.register(`skeleton`,({schema:e,className:t,...n})=>(0,o.jsx)(X,{className:t,...n,style:{width:e.width,height:e.height}}),{namespace:`ui`,label:`Skeleton`,inputs:[{name:`width`,type:`string`,label:`Width`},{name:`height`,type:`string`,label:`Height`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{width:`100%`,height:`20px`,className:`rounded-md`}}),t.ComponentRegistry.register(`toaster`,()=>(0,o.jsx)(Hi,{}),{namespace:`ui`,label:`Toaster`,inputs:[],defaultProps:{}}),t.ComponentRegistry.register(`loading`,({schema:e,className:t,...n})=>{let r=e.size||`md`,i=e.fullscreen||!1,a=(0,o.jsxs)(`div`,{className:R(`flex flex-col items-center justify-center gap-2`,t),children:[(0,o.jsx)(js,{className:R(r===`sm`&&`h-4 w-4`,r===`md`&&`h-8 w-8`,r===`lg`&&`h-12 w-12`,r===`xl`&&`h-16 w-16`)}),e.text&&(0,o.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:e.text})]});return i?(0,o.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-center justify-center bg-background/80 backdrop-blur-sm`,...n,children:a}):(0,o.jsx)(`div`,{className:`flex items-center justify-center p-8`,...n,children:a})},{namespace:`ui`,label:`Loading`,inputs:[{name:`text`,type:`string`,label:`Loading Text`},{name:`size`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`],label:`Size`,defaultValue:`md`},{name:`fullscreen`,type:`boolean`,label:`Fullscreen Overlay`,defaultValue:!1},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{text:`Loading...`,size:`md`,fullscreen:!1}}),t.ComponentRegistry.register(`toast`,({schema:e})=>(0,o.jsx)(B,{onClick:()=>{(e.variant===`success`?P.toast.success:e.variant===`error`?P.toast.error:e.variant===`warning`?P.toast.warning:e.variant===`info`?P.toast.info:P.toast)(e.title||`Notification`,{description:e.description,duration:e.duration})},variant:e.buttonVariant,className:e.className,children:e.buttonLabel||`Show Toast`}),{namespace:`ui`,label:`Toast`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`success`,`warning`,`error`,`info`],defaultValue:`default`,label:`Variant`},{name:`duration`,type:`number`,label:`Duration (ms)`},{name:`buttonLabel`,type:`string`,label:`Button Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`Notification`,buttonLabel:`Show Toast`,variant:`default`,duration:5e3}}),t.ComponentRegistry.register(`spinner`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(c.Loader2,{className:R(`animate-spin`,{sm:`h-4 w-4`,md:`h-6 w-6`,lg:`h-8 w-8`,xl:`h-12 w-12`}[e.size||`md`],e.className),...a,"data-obj-id":n,"data-obj-type":r,style:i})},{namespace:`ui`,label:`Spinner`,inputs:[{name:`size`,type:`enum`,enum:[`sm`,`md`,`lg`,`xl`],defaultValue:`md`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{size:`md`}}),t.ComponentRegistry.register(`empty`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:a,action:s,icon:c,...l}=t,u=e.action,d=u&&typeof u==`object`?(0,o.jsx)(i.SchemaRenderer,{schema:u}):void 0;return(0,o.jsx)(Xs,{title:e.title||`No data`,description:e.description,className:e.className,action:d,...l,"data-obj-id":n,"data-obj-type":r,style:a})},{namespace:`ui`,label:`Empty`,inputs:[{name:`title`,type:`string`,label:`Title`,defaultValue:`No data`},{name:`description`,type:`string`,label:`Description`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{title:`No data`}}),t.ComponentRegistry.register(`sonner`,({schema:e,...t})=>(0,o.jsx)(B,{onClick:()=>{(e.variant===`success`?P.toast.success:e.variant===`error`?P.toast.error:e.variant===`warning`?P.toast.warning:e.variant===`info`?P.toast.info:P.toast)(e.message||e.title||`Notification`,{description:e.description})},variant:e.buttonVariant,className:e.className,...t,children:e.buttonLabel||`Show Toast`}),{namespace:`ui`,label:`Sonner Toast`,inputs:[{name:`message`,type:`string`,label:`Message`},{name:`description`,type:`string`,label:`Description`},{name:`variant`,type:`enum`,enum:[`default`,`success`,`error`,`warning`,`info`],defaultValue:`default`,label:`Variant`},{name:`buttonLabel`,type:`string`,label:`Button Label`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{message:`Notification`,buttonLabel:`Show Toast`,variant:`default`}}),t.ComponentRegistry.register(`dialog`,({schema:e,className:t,...n})=>(0,o.jsxs)(Dt,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(Ot,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(Mt,{className:t,children:[(0,o.jsxs)(Nt,{children:[e.title&&(0,o.jsx)(Ft,{children:e.title}),e.description&&(0,o.jsx)(It,{children:e.description})]}),z(e.content),e.footer&&(0,o.jsx)(Pt,{children:z(e.footer)})]})]}),{namespace:`ui`,label:`Dialog`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`modal`,type:`boolean`,label:`Modal`,defaultValue:!0},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`,description:`Element that opens the dialog`},{name:`content`,type:`slot`,label:`Content`,description:`Main content of the dialog`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Dialog Title`,description:`Dialog description goes here`,modal:!0,trigger:[{type:`button`,label:`Open Dialog`}],content:[{type:`text`,content:`Dialog content goes here`}]}}),t.ComponentRegistry.register(`sheet`,({schema:e,className:t,...n})=>(0,o.jsxs)(Kr,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(qr,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(Qr,{side:e.side||`right`,className:t,children:[(0,o.jsxs)($r,{children:[e.title&&(0,o.jsx)(ti,{children:e.title}),e.description&&(0,o.jsx)(ni,{children:e.description})]}),z(e.content),e.footer&&(0,o.jsx)(ei,{children:z(e.footer)})]})]}),{namespace:`ui`,label:`Sheet`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],defaultValue:`right`,label:`Side`},{name:`modal`,type:`boolean`,label:`Modal`,defaultValue:!0},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Sheet Title`,description:`Sheet description`,side:`right`,modal:!0,trigger:[{type:`button`,label:`Open Sheet`}],content:[{type:`text`,content:`Sheet content goes here`}]}}),t.ComponentRegistry.register(`popover`,({schema:e,className:t,...n})=>(0,o.jsxs)(kr,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(Ar,{asChild:!0,children:z(e.trigger)}),(0,o.jsx)(jr,{align:e.align,side:e.side,className:t,children:z(e.content)})]}),{namespace:`ui`,label:`Popover`,inputs:[{name:`modal`,type:`boolean`,label:`Modal`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Open Popover`,variant:`outline`}],content:[{type:`text`,content:`Popover content goes here`}],align:`center`,side:`bottom`}}),t.ComponentRegistry.register(`tooltip`,({schema:e,className:t,...n})=>(0,o.jsx)(ai,{delayDuration:e.delayDuration,children:(0,o.jsxs)(oi,{...n,children:[(0,o.jsx)(si,{asChild:!0,children:z(e.trigger)}),(0,o.jsx)(ci,{side:e.side,align:e.align,className:t,children:e.content||z(e.body)})]})}),{namespace:`ui`,label:`Tooltip`,inputs:[{name:`delayDuration`,type:`number`,label:`Delay Duration`,defaultValue:700},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`string`,label:`Content Text`},{name:`body`,type:`slot`,label:`Rich Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Hover me`,variant:`outline`}],content:`Tooltip content`,delayDuration:700,side:`top`}}),t.ComponentRegistry.register(`alert-dialog`,({schema:e,className:t,...n})=>(0,o.jsxs)(Ee,{defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(De,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(Ae,{className:t,children:[(0,o.jsxs)(je,{children:[e.title&&(0,o.jsx)(Ne,{children:e.title}),e.description&&(0,o.jsx)(Pe,{children:e.description})]}),z(e.content),(0,o.jsxs)(Me,{children:[e.cancelText&&(0,o.jsx)(Ie,{children:e.cancelText}),e.actionText&&(0,o.jsx)(Fe,{onClick:e.onAction,children:e.actionText})]})]})]}),{namespace:`ui`,label:`Alert Dialog`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`cancelText`,type:`string`,label:`Cancel Text`,defaultValue:`Cancel`},{name:`actionText`,type:`string`,label:`Action Text`,defaultValue:`Continue`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content/Body`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Are you sure?`,description:`This action cannot be undone.`,cancelText:`Cancel`,actionText:`Continue`,trigger:[{type:`button`,label:`Open Alert`,variant:`destructive`}]}}),t.ComponentRegistry.register(`drawer`,({schema:e,className:t,...n})=>(0,o.jsxs)(cn,{shouldScaleBackground:e.shouldScaleBackground,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(ln,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(pn,{className:t,children:[(0,o.jsxs)(mn,{children:[e.title&&(0,o.jsx)(gn,{children:e.title}),e.description&&(0,o.jsx)(_n,{children:e.description})]}),z(e.content),e.footer&&(0,o.jsxs)(hn,{children:[z(e.footer),e.showClose&&(0,o.jsx)(dn,{asChild:!0,children:(0,o.jsx)(`button`,{children:`Close`})})]})]})]}),{namespace:`ui`,label:`Drawer`,inputs:[{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`shouldScaleBackground`,type:`boolean`,label:`Scale Background`},{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`showClose`,type:`boolean`,label:`Show Close Button in Footer`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`footer`,type:`slot`,label:`Footer`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{title:`Drawer Title`,description:`Drawer description`,trigger:[{type:`button`,label:`Open Drawer`}],content:[{type:`text`,content:`Drawer content goes here`}]}}),t.ComponentRegistry.register(`hover-card`,({schema:e,className:t,...n})=>(0,o.jsxs)(Wn,{openDelay:e.openDelay,closeDelay:e.closeDelay,...n,children:[(0,o.jsx)(Gn,{asChild:!0,children:z(e.trigger)}),(0,o.jsx)(Kn,{align:e.align,side:e.side,className:t,children:z(e.content)})]}),{namespace:`ui`,label:`Hover Card`,inputs:[{name:`openDelay`,type:`number`,label:`Open Delay`},{name:`closeDelay`,type:`number`,label:`Close Delay`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Hover me`,variant:`link`}],content:[{type:`text`,content:`Hover card content appears on hover`}],side:`top`}});var Zc=e=>e?e.map((e,t)=>e.type===`separator`?(0,o.jsx)(jn,{},t):e.type===`label`?(0,o.jsx)(An,{children:e.label},t):e.children?(0,o.jsxs)(Sn,{children:[(0,o.jsxs)(wn,{inset:e.inset,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label]}),(0,o.jsx)(Tn,{children:Zc(e.children)})]},t):(0,o.jsxs)(Dn,{disabled:e.disabled,inset:e.inset,onSelect:e.onSelect,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-2`,children:e.icon}),e.label,e.shortcut&&(0,o.jsx)(`span`,{className:`ml-auto text-xs tracking-widest opacity-60`,children:e.shortcut})]},t)):null;t.ComponentRegistry.register(`dropdown-menu`,({schema:e,className:t,...n})=>(0,o.jsxs)(vn,{modal:e.modal,defaultOpen:e.defaultOpen,...n,children:[(0,o.jsx)(yn,{asChild:!0,children:z(e.trigger)}),(0,o.jsxs)(En,{align:e.align,side:e.side,className:t,children:[e.label&&(0,o.jsx)(An,{children:e.label}),e.label&&(0,o.jsx)(jn,{}),Zc(e.items)]})]}),{namespace:`ui`,label:`Dropdown Menu`,inputs:[{name:`label`,type:`string`,label:`Menu Label`},{name:`side`,type:`enum`,enum:[`top`,`right`,`bottom`,`left`],label:`Side`},{name:`align`,type:`enum`,enum:[`start`,`center`,`end`],label:`Align`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`items`,type:`array`,label:`Items`,description:`Recursive structure: { type?: "separator"|"label", label, icon, shortcut, disabled, children: [] }`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Menu`,variant:`outline`}],items:[{label:`Item 1`},{label:`Item 2`},{type:`separator`},{label:`Item 3`}],align:`start`,side:`bottom`}});var Qc=e=>e?e.map((e,t)=>e.type===`separator`?(0,o.jsx)(on,{},t):e.type===`label`?(0,o.jsx)(an,{children:e.label},t):e.children?(0,o.jsxs)(Xt,{children:[(0,o.jsx)(Qt,{inset:e.inset,children:e.label}),(0,o.jsx)($t,{children:Qc(e.children)})]},t):(0,o.jsxs)(tn,{disabled:e.disabled,inset:e.inset,onSelect:e.onSelect,children:[e.label,e.shortcut&&(0,o.jsx)(sn,{children:e.shortcut})]},t)):null;t.ComponentRegistry.register(`context-menu`,({schema:e,className:t,...n})=>{let r=e.triggerClassName||t||e.className||`h-[120px] w-full sm:h-[150px] sm:w-[300px] border border-dashed text-sm flex items-center justify-center`,i=e.contentClassName;return(0,o.jsxs)(Kt,{modal:e.modal,...n,children:[(0,o.jsx)(qt,{asChild:!0,children:(0,o.jsx)(`div`,{className:r,children:z(e.trigger||{type:`text`,value:`Right click here`})})}),(0,o.jsx)(en,{className:i,children:Qc(e.items)})]})},{namespace:`ui`,label:`Context Menu`,inputs:[{name:`trigger`,type:`slot`,label:`Trigger Area`},{name:`triggerClassName`,type:`string`,label:`Trigger Area Class`},{name:`items`,type:`array`,label:`Items`,description:`Recursive structure: { type?: "separator"|"label", label, shortcut, children }`},{name:`className`,type:`string`,label:`Content CSS Class`}],defaultProps:{items:[{label:`Action 1`},{label:`Action 2`},{type:`separator`},{label:`Action 3`}],trigger:[{type:`text`,content:`Right click here`}]}}),t.ComponentRegistry.register(`menubar`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,...a}=t;return(0,o.jsx)(nr,{className:e.className,...a,"data-obj-id":n,"data-obj-type":r,style:i,children:e.menus?.map((e,t)=>(0,o.jsxs)(Zn,{children:[(0,o.jsx)(rr,{children:e.label}),(0,o.jsx)(or,{children:e.items?.map((e,t)=>e.separator?(0,o.jsx)(dr,{},t):e.children?(0,o.jsxs)(tr,{children:[(0,o.jsx)(ir,{children:e.label}),(0,o.jsx)(ar,{children:e.children.map((e,t)=>(0,o.jsx)(sr,{children:e.label},t))})]},t):(0,o.jsx)(sr,{disabled:e.disabled,children:e.label},t))})]},t))})},{namespace:`ui`,label:`Menubar`,inputs:[{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{menus:[{label:`File`,items:[{label:`New`},{label:`Open`},{separator:!0},{label:`Exit`}]}]}}),t.ComponentRegistry.register(`accordion`,({schema:e,className:t,...n})=>(0,o.jsx)(xe,{type:e.accordionType||`single`,collapsible:e.collapsible,className:t,...n,children:e.items?.map((e,t)=>(0,o.jsxs)(Se,{value:e.value||`item-${t}`,children:[(0,o.jsx)(Ce,{children:e.title}),(0,o.jsx)(we,{children:z(e.content)})]},e.value||t))}),{namespace:`ui`,label:`Accordion`,inputs:[{name:`accordionType`,type:`enum`,enum:[`single`,`multiple`],defaultValue:`single`,label:`Type`},{name:`collapsible`,type:`boolean`,label:`Collapsible (for single type)`},{name:`items`,type:`array`,label:`Items`,description:`Array of { trigger, content, value }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{accordionType:`single`,collapsible:!0,items:[{label:`Item 1`,value:`item-1`,content:[{type:`text`,content:`Content for item 1`}]},{label:`Item 2`,value:`item-2`,content:[{type:`text`,content:`Content for item 2`}]},{label:`Item 3`,value:`item-3`,content:[{type:`text`,content:`Content for item 3`}]}],className:`w-full`}}),t.ComponentRegistry.register(`collapsible`,({schema:e,className:t,...n})=>(0,o.jsxs)(wt,{defaultOpen:e.defaultOpen,disabled:e.disabled,className:t,...n,children:[(0,o.jsx)(Tt,{asChild:!0,children:z(e.trigger)}),(0,o.jsx)(Et,{children:z(e.content)})]}),{namespace:`ui`,label:`Collapsible`,inputs:[{name:`defaultOpen`,type:`boolean`,label:`Default Open`},{name:`disabled`,type:`boolean`,label:`Disabled`},{name:`trigger`,type:`slot`,label:`Trigger`},{name:`content`,type:`slot`,label:`Content`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{trigger:[{type:`button`,label:`Toggle`,variant:`outline`}],content:[{type:`text`,content:`Collapsible content goes here`}],className:`w-full`}}),t.ComponentRegistry.register(`toggle-group`,({schema:e,...t})=>{let{"data-obj-id":n,"data-obj-type":r,style:i,type:a,...s}=t;return(0,o.jsx)(oa,{type:e.selectionType||`single`,variant:e.variant,size:e.size,value:e.value,className:e.className,...s,"data-obj-id":n,"data-obj-type":r,style:i,children:e.items?.map((e,t)=>(0,o.jsx)(sa,{value:e.value,"aria-label":e.label,children:e.label},t))})},{namespace:`ui`,label:`Toggle Group`,inputs:[{name:`selectionType`,type:`enum`,enum:[`single`,`multiple`],defaultValue:`single`,label:`Selection Type`},{name:`variant`,type:`enum`,enum:[`default`,`outline`],defaultValue:`default`,label:`Variant`},{name:`size`,type:`enum`,enum:[`default`,`sm`,`lg`],defaultValue:`default`,label:`Size`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{selectionType:`single`,variant:`default`,size:`default`,items:[{value:`bold`,label:`Bold`},{value:`italic`,label:`Italic`},{value:`underline`,label:`Underline`}]}}),t.ComponentRegistry.register(`carousel`,({schema:e,className:t,...n})=>(0,o.jsxs)(ct,{opts:e.opts,orientation:e.orientation||`horizontal`,className:t,...n,children:[(0,o.jsx)(lt,{children:e.items?.map((t,n)=>(0,o.jsx)(ut,{className:e.itemClassName,children:z(t)},n))}),e.showArrows&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(dt,{}),(0,o.jsx)(ft,{})]})]}),{namespace:`ui`,label:`Carousel`,inputs:[{name:`orientation`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Orientation`},{name:`showArrows`,type:`boolean`,label:`Show Arrows`,defaultValue:!0},{name:`items`,type:`array`,label:`Items`,description:`Array of content schemas`},{name:`itemClassName`,type:`string`,label:`Item CSS Class`},{name:`className`,type:`string`,label:`Container CSS Class`}],defaultProps:{orientation:`horizontal`,showArrows:!0,items:[[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 1`}]}],[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 2`}]}],[{type:`div`,className:`p-4 sm:p-6 md:p-8 border rounded bg-slate-50`,body:[{type:`text`,content:`Slide 3`}]}]],className:`w-full max-w-xs`}}),t.ComponentRegistry.register(`filter-builder`,({schema:e,className:t,onChange:n,...r})=>(0,o.jsxs)(`div`,{className:e.wrapperClass||``,children:[e.label&&(0,o.jsx)(`label`,{className:`text-sm font-medium mb-2 block`,children:e.label}),(0,o.jsx)(Wo,{fields:e.fields||[],value:e.value||r.value,onChange:t=>{n&&n({target:{name:e.name,value:t}})},className:t,...r})]}),{namespace:`ui`,label:`Filter Builder`,inputs:[{name:`label`,type:`string`,label:`Label`},{name:`name`,type:`string`,label:`Name`,required:!0},{name:`fields`,type:`array`,label:`Fields`,description:`Array of { value: string, label: string, type?: string } objects`,required:!0},{name:`value`,type:`object`,label:`Initial Value`,description:`FilterGroup object with conditions`}],defaultProps:{label:`Filters`,name:`filters`,fields:[{value:`name`,label:`Name`,type:`text`},{value:`email`,label:`Email`,type:`text`},{value:`age`,label:`Age`,type:`number`},{value:`status`,label:`Status`,type:`text`}],value:{id:`root`,logic:`and`,conditions:[]}}}),t.ComponentRegistry.register(`scroll-area`,({schema:e,className:t,...n})=>{let{"data-obj-id":r,"data-obj-type":i,style:a,...s}=n,c=e.orientation||`vertical`;return(0,o.jsxs)(Rr,{className:t,style:{height:e.height,width:e.width,...a},...s,"data-obj-id":r,"data-obj-type":i,children:[z(e.children),(c===`horizontal`||c===`both`)&&(0,o.jsx)(zr,{orientation:`horizontal`}),(c===`vertical`||c===`both`)&&(0,o.jsx)(zr,{orientation:`vertical`})]})},{namespace:`ui`,label:`Scroll Area`,inputs:[{name:`height`,type:`string`,label:`Height (e.g. 200px)`},{name:`width`,type:`string`,label:`Width`},{name:`orientation`,type:`enum`,enum:[`vertical`,`horizontal`,`both`],defaultValue:`vertical`,label:`Orientation`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{height:`200px`,width:`100%`,orientation:`vertical`,children:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Scrollable content goes here. Add more content to see scrolling behavior.`}]}],className:`rounded-md border`}}),t.ComponentRegistry.register(`resizable`,({schema:e,className:t,...n})=>{let r=Array.isArray(e.panels)?e.panels:[];return(0,o.jsx)(Fr,{orientation:e.direction||`horizontal`,className:t,...n,style:{minHeight:e.minHeight||`200px`},children:r.map((t,n)=>(0,o.jsxs)(a.default.Fragment,{children:[(0,o.jsx)(Ir,{defaultSize:t.defaultSize,minSize:t.minSize,maxSize:t.maxSize,children:z(t.content)}),n<r.length-1&&(0,o.jsx)(Lr,{withHandle:e.withHandle})]},n))})},{namespace:`ui`,label:`Resizable Panel Group`,inputs:[{name:`direction`,type:`enum`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`,label:`Direction`},{name:`minHeight`,type:`string`,label:`Min Height`},{name:`withHandle`,type:`boolean`,label:`Show Handle Icon`,defaultValue:!0},{name:`panels`,type:`array`,label:`Panels`,description:`Array of { defaultSize, minSize, maxSize, content }`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{direction:`horizontal`,minHeight:`200px`,withHandle:!0,panels:[{defaultSize:50,content:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Panel 1`}]}]},{defaultSize:50,content:[{type:`div`,className:`p-4`,body:[{type:`text`,content:`Panel 2`}]}]}],className:`rounded-lg border`}}),t.ComponentRegistry.register(`table`,({schema:e,className:t,...n})=>(0,o.jsxs)(Wi,{className:t,...n,children:[e.caption&&(0,o.jsx)(Zi,{children:e.caption}),(0,o.jsx)(Gi,{children:(0,o.jsx)(Ji,{children:e.columns?.map((e,t)=>(0,o.jsx)(Yi,{className:e.className,style:{width:e.width},children:e.header||e.label},t))})}),(0,o.jsx)(Ki,{children:e.data?.map((t,n)=>(0,o.jsx)(Ji,{children:e.columns?.map((e,n)=>(0,o.jsx)(Xi,{className:e.cellClassName,children:t[e.accessorKey||e.name]},n))},n))}),e.footer&&(0,o.jsx)(qi,{children:(0,o.jsx)(Ji,{children:(0,o.jsx)(Xi,{colSpan:e.columns?.length,children:typeof e.footer==`string`?e.footer:z(e.footer)})})})]}),{namespace:`ui`,label:`Table`,inputs:[{name:`caption`,type:`string`,label:`Caption`},{name:`footer`,type:`string`,label:`Footer Content`},{name:`columns`,type:`array`,label:`Columns`,description:`Array of { header, accessorKey, className, width }`},{name:`data`,type:`array`,label:`Data`,description:`Array of objects`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{caption:`Table Caption`,columns:[{header:`Column 1`,accessorKey:`col1`},{header:`Column 2`,accessorKey:`col2`},{header:`Column 3`,accessorKey:`col3`}],data:[{col1:`Row 1, Col 1`,col2:`Row 1, Col 2`,col3:`Row 1, Col 3`},{col1:`Row 2, Col 1`,col2:`Row 2, Col 2`,col3:`Row 2, Col 3`},{col1:`Row 3, Col 1`,col2:`Row 3, Col 2`,col3:`Row 3, Col 3`}]}});function $c(e){return String(e).padStart(2,`0`)}function el(e){if(e==null||e===``)return``;if(typeof e==`string`){let t=e.match(/^(\d{4}-\d{2}-\d{2})/);if(t)return t[1]}let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?``:`${t.getFullYear()}-${$c(t.getMonth()+1)}-${$c(t.getDate())}`}function tl(e){if(e==null||e===``)return``;let t=e instanceof Date?e:new Date(String(e));return Number.isNaN(t.getTime())?``:`${t.getFullYear()}-${$c(t.getMonth()+1)}-${$c(t.getDate())}T${$c(t.getHours())}:${$c(t.getMinutes())}`}var nl=new Set([`number`,`currency`,`percent`,`int`,`integer`,`float`,`double`]),rl={"table.rowsPerPage":`Rows per page`,"table.pageInfo":`Page {{current}} of {{total}}`,"table.totalRecords":`{{count}} total`,"table.noResults":`No results found`,"table.noResultsHint":`Try adjusting your filters or search query.`,"table.sortAsc":`Sort ascending`,"table.sortDesc":`Sort descending`,"table.hideColumn":`Hide column`,"table.cancelAll":`Cancel All`,"table.saveAll":`Save All ({{count}})`,"table.exportCSV":`Export CSV`,"table.addRecord":`Add record`,"table.open":`Open`,"table.search":`Search...`,"table.modified":`{{count}} row modified`,"table.selected":`{{count}} selected`,"table.edit":`Edit`,"table.delete":`Delete`,"common.actions":`Actions`};function il(){try{let e=(0,i.useObjectTranslation)();return e.t(`table.rowsPerPage`)===`table.rowsPerPage`?{t:(e,t)=>{let n=rl[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:e.language||`en`}:{t:e.t,language:e.language||`en`}}catch{return{t:(e,t)=>{let n=rl[e]||e;if(t)for(let[e,r]of Object.entries(t))n=n.replace(`{{${e}}}`,String(r));return n},language:`en`}}}t.ComponentRegistry.register(`data-table`,({schema:e})=>{let{caption:n,columns:r=[],data:i=[],pagination:s=!0,pageSize:l=10,pageSizeOptions:u,manualPagination:d=!1,rowCount:f,page:p,onPageChange:m,onPageSizeChange:h,searchable:g=!0,selectable:_=!1,sortable:v=!0,exportable:y=!1,rowActions:b=!1,resizableColumns:x=!0,reorderableColumns:S=!0,editable:C=!1,singleClickEdit:w=!1,selectionStyle:T=`always`,rowClassName:E,rowStyle:D,className:O,cellClassName:k,frozenColumns:A=0,showRowNumbers:j=!1,showAddRow:ee=!1,borderless:te=!1,disableInnerScroll:M=!1}=e,{t:N,language:ne}=il(),re=/^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?)?$/,ie=a.default.useCallback(e=>{if(typeof e!=`string`||e.length<8||!re.test(e))return e;let t=Date.parse(e);if(Number.isNaN(t))return e;let n=e.includes(`T`);try{return new Intl.DateTimeFormat(ne,n?{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`}:{year:`numeric`,month:`short`,day:`numeric`}).format(new Date(t))}catch{return e}},[ne]),ae=Array.isArray(i)?i:[],P=(0,a.useMemo)(()=>r.map(e=>({...e,header:e.header||e.label,accessorKey:e.accessorKey||e.name})),[r]),oe=(0,a.useMemo)(()=>{let e={},t=r.map(e=>({header:e.header||e.label,accessorKey:e.accessorKey||e.name,width:e.width}));for(let n of t){if(n.width)continue;let t=(n.header||``).length,r=ae.slice(0,50);for(let e of r){let r=e[n.accessorKey],i=r==null?0:String(r).length;i>t&&(t=i)}e[n.accessorKey]=Math.min(400,Math.max(80,t*8+48))}return e},[r,ae]),[se,ce]=(0,a.useState)(``),[le,F]=(0,a.useState)(null),[ue,de]=(0,a.useState)(null),[fe,pe]=(0,a.useState)(new Set),[me,he]=(0,a.useState)(1),[I,ge]=(0,a.useState)(l),[_e,ve]=(0,a.useState)(P),[L,z]=(0,a.useState)({}),[ye,be]=(0,a.useState)(null),[xe,Se]=(0,a.useState)(null),[Ce,we]=(0,a.useState)(null),[Te,Ee]=(0,a.useState)(``),[De,Oe]=(0,a.useState)(new Map),[ke,Ae]=(0,a.useState)(!1),[je,Me]=(0,a.useState)(null),Ne=(0,a.useRef)(null),Pe=(0,a.useRef)(0),Fe=(0,a.useRef)(0),Ie=(0,a.useRef)(null);(0,a.useEffect)(()=>{ve(P)},[P]);let Le=(0,a.useMemo)(()=>se?ae.filter(e=>_e.some(t=>e[t.accessorKey]?.toString().toLowerCase().includes(se.toLowerCase()))):ae,[ae,se,_e]),V=(0,a.useMemo)(()=>!le||!ue?Le:[...Le].sort((e,t)=>{let n=e[le],r=t[le];if(n===r)return 0;let i=n<r?-1:1;return ue===`asc`?i:-i}),[Le,le,ue]),H=d?Math.max(1,p??1):me,Re=d?Math.max(1,Math.ceil((f??V.length)/I)):Math.ceil(V.length/I),ze=s&&!d?V.slice((me-1)*I,me*I):V,Be=e=>{let t=Math.min(Re,Math.max(1,e));d?m?.(t):he(t)},Ve=e=>{ge(e),d?(h?.(e),m?.(1)):he(1)},He=a.default.useMemo(()=>{let e=u&&u.length>0?u:[5,10,20,50,100];return Array.from(new Set([...e,I])).filter(e=>Number.isFinite(e)&&e>0).sort((e,t)=>e-t)},[u,I]),Ue=(e,t)=>e.id===void 0?`row-${t}`:e.id,We=e=>{v&&(le===e?ue===`asc`?de(`desc`):ue===`desc`&&(de(null),F(null)):(F(e),de(`asc`)))},Ge=(e,t)=>{e.preventDefault(),Me({x:e.clientX,y:e.clientY,columnKey:t})},Ke=e=>{ve(t=>t.filter(t=>t.accessorKey!==e)),Me(null)};(0,a.useEffect)(()=>{if(!je)return;let e=()=>Me(null);return document.addEventListener(`click`,e),()=>document.removeEventListener(`click`,e)},[je]);let qe=t=>{let n=new Set;if(t&&ze.forEach((e,t)=>{let r=Ue(e,(H-1)*I+t);n.add(r)}),pe(n),e.onSelectionChange){let t=V.filter((e,t)=>{let r=Ue(e,t);return n.has(r)});e.onSelectionChange(t)}},Je=(t,n)=>{let r=new Set(fe);if(n?r.add(t):r.delete(t),pe(r),e.onSelectionChange){let t=V.filter((e,t)=>{let n=Ue(e,t);return r.has(n)});e.onSelectionChange(t)}},Ye=()=>{let e=[_e.map(e=>e.header).join(`,`),...V.map(e=>_e.map(t=>JSON.stringify(e[t.accessorKey]||``)).join(`,`))].join(`
|
|
19
|
+
`),t=new Blob([e],{type:`text/csv`}),n=window.URL.createObjectURL(t),r=document.createElement(`a`);r.href=n,r.download=`table-export.csv`,r.click(),window.URL.revokeObjectURL(n)},Xe=e=>le===e?ue===`asc`?(0,o.jsx)(c.ChevronUp,{className:`h-3 w-3 ml-0.5 text-primary`}):(0,o.jsx)(c.ChevronDown,{className:`h-3 w-3 ml-0.5 text-primary`}):(0,o.jsx)(c.ChevronsUpDown,{className:`h-3 w-3 ml-0.5 opacity-0 group-hover:opacity-50 transition-opacity`}),Ze=(e,t)=>{if(!x)return;e.preventDefault(),e.stopPropagation(),Ne.current=t,Pe.current=e.clientX;let n=e.target.closest(`th`);n&&(Fe.current=n.offsetWidth),document.addEventListener(`mousemove`,Qe),document.addEventListener(`mouseup`,$e)},Qe=e=>{if(!Ne.current)return;let t=e.clientX-Pe.current,n=Math.max(50,Fe.current+t);z(e=>({...e,[Ne.current]:n}))},$e=()=>{Ne.current=null,document.removeEventListener(`mousemove`,Qe),document.removeEventListener(`mouseup`,$e)},et=(e,t)=>{S&&(be(t),e.dataTransfer.effectAllowed=`move`)},tt=(e,t)=>{S&&(e.preventDefault(),e.dataTransfer.dropEffect=`move`,Se(t))},nt=(t,n)=>{if(!S||ye===null)return;if(t.preventDefault(),ye===n){be(null),Se(null);return}let r=[..._e],[i]=r.splice(ye,1);r.splice(n,0,i),ve(r),be(null),Se(null),e.onColumnsReorder&&e.onColumnsReorder(r)},rt=()=>{be(null),Se(null)},it=(e,t)=>{if(!C||_e.find(e=>e.accessorKey===t)?.editable===!1)return;we({rowIndex:e,columnKey:t});let n=De.get(e),r=ze[e][t];Ee(n?.[t]??r??``)},at=(t=!1)=>{if(!Ce||!t&&Ce===null)return;let{rowIndex:n,columnKey:r}=Ce,i=(H-1)*I+n,a=V[d?n:i],o=new Map(De),s=o.get(n)||{};s[r]=Te,o.set(n,s),Oe(o),e.onCellChange&&e.onCellChange(i,r,Te,a),we(null),Ee(``)},ot=()=>{we(null),Ee(``)},st=async t=>{let n=(H-1)*I+t,r=V[d?t:n],i=De.get(t);if(!(!i||Object.keys(i).length===0)){Ae(!0);try{e.onRowSave&&await e.onRowSave(n,i,r);let a=new Map(De);a.delete(t),Oe(a)}catch(e){console.error(`Failed to save row:`,e)}finally{Ae(!1)}}},ct=e=>{let t=new Map(De);t.delete(e),Oe(t)},lt=async()=>{if(De.size!==0){Ae(!0);try{let t=Array.from(De.entries()).map(([e,t])=>{let n=(H-1)*I+e;return{rowIndex:n,changes:t,row:V[d?e:n]}});e.onBatchSave&&await e.onBatchSave(t),Oe(new Map)}catch(e){console.error(`Failed to save batch:`,e)}finally{Ae(!1)}}},ut=()=>{Oe(new Map)},dt=(e,t,n)=>{if((e.ctrlKey||e.metaKey)&&e.key===`c`&&!Ce){e.preventDefault();let r=(H-1)*I+t,i=V[d?t:r];if(i){let e=i[n],t=e==null?``:String(e);navigator.clipboard.writeText(t).catch(()=>{})}return}C&&_e.find(e=>e.accessorKey===n)?.editable!==!1&&e.key===`Enter`&&!Ce&&(e.preventDefault(),it(t,n))},ft=e=>{e.key===`Enter`?(e.preventDefault(),at(!0)):e.key===`Escape`&&(e.preventDefault(),ot())};(0,a.useEffect)(()=>{Ce&&Ie.current&&(Ie.current.focus(),Ie.current.select())},[Ce]),(0,a.useEffect)(()=>()=>{document.removeEventListener(`mousemove`,Qe),document.removeEventListener(`mouseup`,$e)},[]);let pt=ze.length>0&&ze.every((e,t)=>{let n=Ue(e,(H-1)*I+t);return fe.has(n)}),mt=ze.some((e,t)=>{let n=Ue(e,(H-1)*I+t);return fe.has(n)})&&!pt,ht=De.size>0,gt=g||y||_&&fe.size>0||ht;return(0,o.jsxs)(`div`,{className:`flex flex-col h-full gap-2 sm:gap-4 ${O||``}`,children:[gt&&(0,o.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-stretch sm:items-center justify-between gap-2 sm:gap-4 flex-none`,children:[(0,o.jsx)(`div`,{className:`flex items-center gap-2 flex-1`,children:g&&(0,o.jsxs)(`div`,{className:`relative w-full sm:max-w-sm flex-1`,children:[(0,o.jsx)(c.Search,{className:`absolute left-2 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,o.jsx)(W,{placeholder:N(`table.search`),value:se,onChange:e=>{ce(e.target.value),he(1)},className:`pl-8`})]})}),(0,o.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[ht&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:N(`table.modified`,{count:De.size})}),(0,o.jsxs)(B,{variant:`outline`,size:`sm`,onClick:ut,disabled:ke,children:[(0,o.jsx)(c.X,{className:`h-4 w-4 mr-2`}),N(`table.cancelAll`)]}),(0,o.jsxs)(B,{variant:`default`,size:`sm`,onClick:lt,disabled:ke,children:[(0,o.jsx)(c.Save,{className:`h-4 w-4 mr-2`}),N(`table.saveAll`,{count:De.size})]})]}),y&&(0,o.jsxs)(B,{variant:`outline`,size:`sm`,onClick:Ye,disabled:V.length===0,children:[(0,o.jsx)(c.Download,{className:`h-4 w-4 mr-2`}),N(`table.exportCSV`)]}),_&&fe.size>0&&(0,o.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:N(`table.selected`,{count:fe.size})})]})]}),(0,o.jsx)(`div`,{className:R(`relative bg-background`,M?`overflow-visible`:`flex-1 min-h-0 overflow-auto [-webkit-overflow-scrolling:touch]`,!te&&`rounded-md border shadow-[inset_-8px_0_8px_-8px_rgba(0,0,0,0.08)]`),children:(0,o.jsxs)(Wi,{children:[n&&(0,o.jsx)(Zi,{children:n}),(0,o.jsx)(Gi,{className:`sticky top-0 bg-background z-10`,children:(0,o.jsxs)(Ji,{children:[_&&(0,o.jsx)(Yi,{className:R(`w-10 bg-background px-3`,A>0&&`sticky left-0 z-20`),children:(0,o.jsx)(Ct,{checked:pt?!0:mt?`indeterminate`:!1,onCheckedChange:qe})}),j&&(0,o.jsx)(Yi,{className:R(`w-10 bg-background text-center px-3`,A>0&&`sticky z-20`),style:A>0?{left:_?40:0}:void 0,children:(0,o.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`#`})}),_e.map((e,t)=>{let n=L[e.accessorKey]||e.width||oe[e.accessorKey],r=ye===t,i=xe===t,a=A>0&&t<A,s=a?_e.slice(0,t).reduce((e,t,n)=>{if(n<A){let n=L[t.accessorKey]||t.width||oe[t.accessorKey];return e+(typeof n==`number`?n:n&&parseInt(String(n),10)||150)}return e},(_?40:0)+(j?40:0)):void 0;return(0,o.jsx)(Yi,{className:R(e.className,v&&e.sortable!==!1&&`cursor-pointer select-none`,r&&`opacity-50`,i&&`border-l-2 border-primary`,e.align===`right`&&`text-right`,e.align===`center`&&`text-center`,`relative group bg-background`,a&&`sticky z-20`,a&&t===A-1&&`border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]`),style:{width:n,minWidth:n,...a&&{left:s}},draggable:S,onDragStart:e=>et(e,t),onDragOver:e=>tt(e,t),onDrop:e=>nt(e,t),onDragEnd:rt,onClick:()=>v&&e.sortable!==!1&&We(e.accessorKey),onContextMenu:t=>Ge(t,e.accessorKey),children:(0,o.jsxs)(`div`,{className:R(`flex items-center`,e.align===`right`?`justify-end`:`justify-between`),children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[S&&(0,o.jsx)(c.GripVertical,{className:`h-4 w-4 opacity-0 group-hover:opacity-50 cursor-grab active:cursor-grabbing shrink-0`}),e.headerIcon&&(0,o.jsx)(`span`,{className:`text-muted-foreground shrink-0`,children:e.headerIcon}),(0,o.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground whitespace-nowrap truncate`,children:e.header}),v&&e.sortable!==!1&&Xe(e.accessorKey)]}),x&&e.resizable!==!1&&(0,o.jsx)(`div`,{className:`absolute right-0 top-0 h-full w-1 cursor-col-resize hover:bg-primary opacity-0 hover:opacity-100 transition-opacity`,onMouseDown:t=>Ze(t,e.accessorKey),onClick:e=>e.stopPropagation()})]})},e.accessorKey)}),b&&(0,o.jsx)(Yi,{className:`w-24 text-right bg-background`,children:N(`common.actions`)})]})}),(0,o.jsx)(Ki,{children:ze.length===0?(0,o.jsx)(Ji,{className:`hover:bg-transparent`,children:(0,o.jsx)(Xi,{colSpan:_e.length+ +!!_+ +!!j+ +!!b,className:`h-48 text-center text-muted-foreground border-0`,children:(0,o.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-3`,children:[(0,o.jsx)(c.Search,{className:`h-8 w-8 text-muted-foreground/50`}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(`p`,{children:N(`table.noResults`)}),(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground/50`,children:N(`table.noResultsHint`)})]}),e.emptyAction&&(()=>{let n=e.emptyAction,r=n?.type?t.ComponentRegistry.get(n.type):null;return r?(0,o.jsx)(r,{schema:n}):null})()]})})}):(0,o.jsxs)(o.Fragment,{children:[ze.map((t,n)=>{let r=(H-1)*I+n,i=Ue(t,r),a=fe.has(i),s=De.has(n),l=De.get(n)||{};return(0,o.jsxs)(Ji,{"data-state":a?`selected`:void 0,className:R(`bg-background border-b border-border/60 group/row transition-colors`,`hover:bg-muted/40`,`data-[state=selected]:bg-primary/5 data-[state=selected]:hover:bg-primary/10`,`focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring focus-visible:ring-inset`,e.onRowClick&&`cursor-pointer`,s&&`bg-amber-50 dark:bg-amber-950/20`,E&&E(t,n)),style:D?D(t,n):void 0,onClick:n=>{if(e.onRowClick&&!n.defaultPrevented){let r=n.target;if(r.closest(`button`)||r.closest(`a`)||r.closest(`input, select, textarea, label`)||r.closest(`[role="checkbox"]`)||r.closest(`[role="menu"]`)||r.closest(`[role="menuitem"]`)||r.closest(`[role="menuitemcheckbox"]`)||r.closest(`[role="menuitemradio"]`)||r.closest(`[role="dialog"]`)||r.closest(`[role="alertdialog"]`)||r.closest(`[role="listbox"]`)||r.closest(`[role="option"]`)||r.closest(`[role="tab"]`)||r.closest(`[data-radix-popper-content-wrapper]`))return;e.onRowClick(t)}},children:[_&&(0,o.jsx)(Xi,{className:R(k,`px-3`,A>0&&`sticky left-0 z-10 bg-background`,T===`hover`&&`relative`),children:T===`hover`?(0,o.jsx)(`div`,{className:R(`transition-opacity`,a?`opacity-100`:`opacity-0 group-hover/row:opacity-100`),children:(0,o.jsx)(Ct,{checked:a,onCheckedChange:e=>Je(i,e)})}):(0,o.jsx)(Ct,{checked:a,onCheckedChange:e=>Je(i,e)})}),j&&(0,o.jsxs)(Xi,{className:R(`text-center w-10 relative`,k,A>0&&`sticky z-10 bg-background`),style:A>0?{left:_?40:0}:void 0,children:[(0,o.jsx)(`span`,{className:R(`text-xs text-muted-foreground tabular-nums select-none`,!_&&e.onRowClick&&`group-hover/row:invisible`),children:r+1}),!_&&e.onRowClick&&(0,o.jsxs)(`button`,{type:`button`,className:`absolute inset-0 hidden group-hover/row:flex items-center justify-center gap-0.5 text-xs font-medium text-primary hover:text-primary/80`,"data-testid":`row-expand-button`,onClick:n=>{n.stopPropagation(),e.onRowClick?.(t)},title:`Open record`,children:[(0,o.jsx)(`span`,{children:N(`table.open`)}),(0,o.jsx)(c.ChevronRight,{className:`h-3 w-3`})]})]}),_e.map((e,r)=>{let i=L[e.accessorKey]||e.width||oe[e.accessorKey],a=t[e.accessorKey],s=l[e.accessorKey]!==void 0,c=s?l[e.accessorKey]:a,u=Ce?.rowIndex===n&&Ce?.columnKey===e.accessorKey,d=C&&e.editable!==!1,f=A>0&&r<A,p=f?_e.slice(0,r).reduce((e,t,n)=>{if(n<A){let n=L[t.accessorKey]||t.width||oe[t.accessorKey];return e+(typeof n==`number`?n:n&&parseInt(String(n),10)||150)}return e},(_?40:0)+(j?40:0)):void 0;return(0,o.jsx)(Xi,{className:R(e.cellClassName,e.align===`right`&&`text-right`,e.align===`center`&&`text-center`,`overflow-hidden`,d&&!u&&`cursor-text hover:bg-muted/50`,s&&`font-semibold text-amber-700 dark:text-amber-400`,f&&`sticky z-10 bg-background`,f&&r===A-1&&`border-r-2 border-border shadow-[2px_0_4px_-2px_rgba(0,0,0,0.1)]`),style:{width:i,minWidth:i,maxWidth:i,...f&&{left:p}},onDoubleClick:t=>{d&&!w&&(t.stopPropagation(),it(n,e.accessorKey))},onClick:t=>{d&&w&&(t.stopPropagation(),it(n,e.accessorKey))},onKeyDown:t=>dt(t,n,e.accessorKey),tabIndex:0,children:u?(()=>{let t=e.type;return t===`date`?(0,o.jsx)(W,{ref:Ie,type:`date`,value:el(Te),onChange:e=>Ee(e.target.value),onKeyDown:ft,className:`h-8 px-2 py-1`}):t===`datetime`||t===`datetime-local`?(0,o.jsx)(W,{ref:Ie,type:`datetime-local`,value:tl(Te),onChange:e=>{let t=e.target.value,n=t?new Date(t):null;Ee(n&&!Number.isNaN(n.getTime())?n.toISOString():t)},onKeyDown:ft,className:`h-8 px-2 py-1`}):t&&nl.has(t)?(0,o.jsx)(W,{ref:Ie,type:`number`,value:Te??``,onChange:e=>Ee(e.target.value),onKeyDown:ft,className:`h-8 px-2 py-1`}):(0,o.jsx)(W,{ref:Ie,value:Te,onChange:e=>Ee(e.target.value),onKeyDown:ft,className:`h-8 px-2 py-1`})})():(0,o.jsx)(`div`,{className:`truncate w-full`,title:c!=null&&typeof c!=`object`?String(c):void 0,children:typeof e.cell==`function`?e.cell(c,t):typeof c==`object`&&c?String(c):ie(c)})},r)}),b&&(0,o.jsx)(Xi,{className:R(`text-right`,k),children:(0,o.jsx)(`div`,{className:`flex items-center justify-end gap-1`,children:s&&(e.onRowSave||e.onBatchSave)?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(B,{variant:`ghost`,size:`icon`,onClick:()=>ct(n),disabled:ke,title:`Cancel changes`,children:(0,o.jsx)(c.X,{className:`h-4 w-4`})}),(0,o.jsx)(B,{variant:`ghost`,size:`icon`,onClick:()=>st(n),disabled:ke,title:`Save row`,children:(0,o.jsx)(c.Save,{className:`h-4 w-4 text-green-600`})})]}):(e.onRowEdit||e.onRowDelete)&&(0,o.jsxs)(vn,{children:[(0,o.jsx)(yn,{asChild:!0,children:(0,o.jsx)(B,{variant:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:e=>e.stopPropagation(),"aria-label":`Row actions`,children:(0,o.jsx)(c.MoreHorizontal,{className:`h-4 w-4`})})}),(0,o.jsxs)(En,{align:`end`,onClick:e=>e.stopPropagation(),children:[e.onRowEdit&&(0,o.jsxs)(Dn,{onClick:()=>e.onRowEdit?.(t),children:[(0,o.jsx)(c.Edit,{className:`mr-2 h-4 w-4`}),N(`table.edit`)]}),e.onRowEdit&&e.onRowDelete&&(0,o.jsx)(jn,{}),e.onRowDelete&&(0,o.jsxs)(Dn,{onClick:()=>e.onRowDelete?.(t),className:`text-destructive focus:text-destructive`,children:[(0,o.jsx)(c.Trash2,{className:`mr-2 h-4 w-4`}),N(`table.delete`)]})]})]})})})]},i)}),ee&&(0,o.jsx)(Ji,{className:`hover:bg-muted/30 cursor-pointer border-b border-border`,"data-testid":`add-record-row`,onClick:()=>e.onAddRecord?.(),children:(0,o.jsx)(Xi,{colSpan:_e.length+ +!!_+ +!!j+ +!!b,className:`h-9 px-3 py-1.5`,children:(0,o.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted-foreground text-sm hover:text-foreground transition-colors`,children:[(0,o.jsx)(c.Plus,{className:`h-3.5 w-3.5`}),N(`table.addRecord`)]})})})]})})]})}),s&&V.length>0&&Re>1&&(0,o.jsxs)(`div`,{className:`flex flex-col sm:flex-row items-center justify-between gap-2 px-3 sm:px-4 py-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsxs)(`span`,{className:`text-xs sm:text-sm text-muted-foreground`,children:[N(`table.rowsPerPage`),`:`]}),(0,o.jsxs)(G,{value:I.toString(),onValueChange:e=>Ve(Number(e)),children:[(0,o.jsx)(q,{className:`w-20`,children:(0,o.jsx)(K,{})}),(0,o.jsx)(J,{children:He.map(e=>(0,o.jsx)(Y,{value:e.toString(),children:e},e))})]})]}),(0,o.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,o.jsx)(`span`,{className:`text-xs sm:text-sm text-muted-foreground`,children:N(`table.pageInfo`,{current:H,total:Re})}),(0,o.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,o.jsx)(B,{variant:`outline`,size:`icon`,onClick:()=>Be(1),disabled:H===1,children:(0,o.jsx)(c.ChevronsLeft,{className:`h-4 w-4`})}),(0,o.jsx)(B,{variant:`outline`,size:`icon`,onClick:()=>Be(H-1),disabled:H===1,children:(0,o.jsx)(c.ChevronLeft,{className:`h-4 w-4`})}),(0,o.jsx)(B,{variant:`outline`,size:`icon`,onClick:()=>Be(H+1),disabled:H===Re,children:(0,o.jsx)(c.ChevronRight,{className:`h-4 w-4`})}),(0,o.jsx)(B,{variant:`outline`,size:`icon`,onClick:()=>Be(Re),disabled:H===Re,children:(0,o.jsx)(c.ChevronsRight,{className:`h-4 w-4`})})]})]})]}),je&&(0,o.jsxs)(`div`,{className:`fixed z-50 min-w-[160px] rounded-md border bg-popover p-1 shadow-md`,style:{left:je.x,top:je.y},"data-testid":`column-context-menu`,onClick:e=>e.stopPropagation(),children:[v&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>{F(je.columnKey),de(`asc`),Me(null)},children:[(0,o.jsx)(c.ChevronUp,{className:`h-3.5 w-3.5`}),N(`table.sortAsc`)]}),(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>{F(je.columnKey),de(`desc`),Me(null)},children:[(0,o.jsx)(c.ChevronDown,{className:`h-3.5 w-3.5`}),N(`table.sortDesc`)]}),(0,o.jsx)(`div`,{className:`my-1 h-px bg-border`})]}),(0,o.jsxs)(`button`,{type:`button`,className:`flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-sm hover:bg-accent hover:text-accent-foreground cursor-pointer`,onClick:()=>Ke(je.columnKey),children:[(0,o.jsx)(c.X,{className:`h-3.5 w-3.5`}),N(`table.hideColumn`)]})]})]})},{namespace:`ui`,label:`Data Table`,icon:`table`,inputs:[{name:`caption`,type:`string`,label:`Caption`},{name:`columns`,type:`array`,label:`Columns`,description:`Array of { header, accessorKey, className, width, sortable, filterable, resizable }`,required:!0},{name:`data`,type:`array`,label:`Data`,description:`Array of data objects`,required:!0},{name:`pagination`,type:`boolean`,label:`Enable Pagination`,defaultValue:!0},{name:`pageSize`,type:`number`,label:`Page Size`,defaultValue:10},{name:`searchable`,type:`boolean`,label:`Enable Search`,defaultValue:!0},{name:`selectable`,type:`boolean`,label:`Enable Row Selection`,defaultValue:!1},{name:`sortable`,type:`boolean`,label:`Enable Sorting`,defaultValue:!0},{name:`exportable`,type:`boolean`,label:`Enable Export`,defaultValue:!1},{name:`rowActions`,type:`boolean`,label:`Show Row Actions`,defaultValue:!1},{name:`resizableColumns`,type:`boolean`,label:`Enable Column Resizing`,defaultValue:!0},{name:`reorderableColumns`,type:`boolean`,label:`Enable Column Reordering`,defaultValue:!0},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{caption:`Enterprise Data Table`,pagination:!0,pageSize:10,searchable:!0,selectable:!0,sortable:!0,exportable:!0,rowActions:!0,resizableColumns:!0,reorderableColumns:!0,columns:[{header:`ID`,accessorKey:`id`,width:`80px`},{header:`Name`,accessorKey:`name`},{header:`Email`,accessorKey:`email`},{header:`Status`,accessorKey:`status`},{header:`Role`,accessorKey:`role`}],data:[{id:1,name:`John Doe`,email:`john@example.com`,status:`Active`,role:`Admin`},{id:2,name:`Jane Smith`,email:`jane@example.com`,status:`Active`,role:`User`},{id:3,name:`Bob Johnson`,email:`bob@example.com`,status:`Inactive`,role:`User`},{id:4,name:`Alice Williams`,email:`alice@example.com`,status:`Active`,role:`Manager`},{id:5,name:`Charlie Brown`,email:`charlie@example.com`,status:`Active`,role:`User`},{id:6,name:`Diana Prince`,email:`diana@example.com`,status:`Active`,role:`Admin`},{id:7,name:`Ethan Hunt`,email:`ethan@example.com`,status:`Inactive`,role:`User`},{id:8,name:`Fiona Gallagher`,email:`fiona@example.com`,status:`Active`,role:`User`},{id:9,name:`George Wilson`,email:`george@example.com`,status:`Active`,role:`Manager`},{id:10,name:`Hannah Montana`,email:`hannah@example.com`,status:`Active`,role:`User`},{id:11,name:`Ivan Drago`,email:`ivan@example.com`,status:`Inactive`,role:`User`},{id:12,name:`Julia Roberts`,email:`julia@example.com`,status:`Active`,role:`Admin`}]}});function al(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var ol={Home:`House`};function sl(e){if(!e)return null;let t=al(e);return c.icons[ol[t]||t]??null}var cl=(0,a.forwardRef)(({schema:e,className:t,context:n,...r},s)=>{let{"data-obj-id":l,"data-obj-type":u,style:d,data:f,...p}=r,{execute:m}=(0,i.useAction)(),[h,g]=(0,a.useState)(!1),_=typeof f==`object`&&f?f:{},v=(0,i.useCondition)((0,i.toPredicateInput)(e.visible),_),y=(0,i.useCondition)((0,i.toPredicateInput)(e.disabled),_),b=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled),_),x=sl(e.icon),S=e.variant===`primary`?`default`:e.variant||`default`,C=e.size===`md`?`default`:e.size||`default`,w=(0,a.useCallback)(async()=>{if(!h){g(!0);try{let t=Array.isArray(e.params)?{actionParams:e.params}:{params:e.params};await m({type:e.actionType||e.type,name:e.name,label:e.label,description:e.description,target:e.target,execute:e.execute,endpoint:e.endpoint,method:e.method,...t,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,undoable:e.undoable,recordIdField:e.recordIdField,toast:e.toast,resultDialog:e.resultDialog,...n})}finally{g(!1)}}},[e,m,h,n]);return e.visible&&!v?null:(0,o.jsxs)(B,{ref:s,type:`button`,variant:S,size:C,className:R(e.className,t),disabled:(e.disabled==null?e.enabled==null?!1:!b:y)||h,onClick:w,...p,"data-obj-id":l,"data-obj-type":u,style:d,children:[h&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!h&&x&&(0,o.jsx)(x,{className:R(`h-4 w-4`,e.label&&`mr-2`)}),e.label]})});cl.displayName=`ActionButtonRenderer`,t.ComponentRegistry.register(`action:button`,cl,{namespace:`action`,label:`Action Button`,inputs:[{name:`name`,type:`string`,label:`Action Name`},{name:`label`,type:`string`,label:`Label`,defaultValue:`Action`},{name:`icon`,type:`string`,label:`Icon`},{name:`type`,type:`enum`,label:`Action Type`,enum:[`script`,`url`,`modal`,`flow`,`api`],defaultValue:`script`},{name:`target`,type:`string`,label:`Target`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`primary`,`secondary`,`destructive`,`outline`,`ghost`],defaultValue:`default`},{name:`size`,type:`enum`,label:`Size`,enum:[`sm`,`md`,`lg`],defaultValue:`md`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{label:`Action`,type:`script`,variant:`default`,size:`md`}});var ll=(0,a.forwardRef)(({schema:e,className:t,context:n,...r},s)=>{let{"data-obj-id":l,"data-obj-type":u,style:d,...f}=r,{execute:p}=(0,i.useAction)(),[m,h]=(0,a.useState)(!1),g=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),_=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),v=sl(e.icon),y=e.variant===`primary`?`default`:e.variant||`ghost`,b=(0,a.useCallback)(async()=>{if(!m){h(!0);try{await p({type:e.type,name:e.name,target:e.target,execute:e.execute,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,toast:e.toast,...n})}finally{h(!1)}}},[e,p,m,n]);if(e.visible&&!g)return null;let x=(0,o.jsx)(B,{ref:s,type:`button`,variant:y,size:`icon`,className:R(`h-8 w-8`,e.className,t),disabled:(e.enabled?!_:!1)||m,onClick:b,"aria-label":e.label||e.name,...f,"data-obj-id":l,"data-obj-type":u,style:d,children:m?(0,o.jsx)(c.Loader2,{className:`h-4 w-4 animate-spin`}):v?(0,o.jsx)(v,{className:`h-4 w-4`}):(0,o.jsx)(`span`,{className:`text-xs`,children:e.label?.charAt(0)||`?`})});return e.label||e.description?(0,o.jsx)(ai,{delayDuration:300,children:(0,o.jsxs)(oi,{children:[(0,o.jsx)(si,{asChild:!0,children:x}),(0,o.jsx)(ci,{children:(0,o.jsx)(`p`,{children:e.label||e.description})})]})}):x});ll.displayName=`ActionIconRenderer`,t.ComponentRegistry.register(`action:icon`,ll,{namespace:`action`,label:`Action Icon`,inputs:[{name:`name`,type:`string`,label:`Action Name`},{name:`label`,type:`string`,label:`Tooltip Label`},{name:`icon`,type:`string`,label:`Icon`},{name:`type`,type:`enum`,label:`Action Type`,enum:[`script`,`url`,`modal`,`flow`,`api`],defaultValue:`script`},{name:`target`,type:`string`,label:`Target`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`destructive`,`outline`,`ghost`],defaultValue:`ghost`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{icon:`play`,type:`script`,variant:`ghost`}});function ul(){try{let{t:e}=(0,F.useObjectTranslation)(),t=e(`detail.moreActions`);return!t||t===`detail.moreActions`?`More actions`:t}catch{return`More actions`}}var dl=({action:e,onExecute:t})=>{let n=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),r=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),s=(0,a.useMemo)(()=>{let t=sl(e.icon);return t?(0,o.jsx)(t,{className:`mr-2 h-4 w-4`}):null},[e.icon]);return e.visible&&!n?null:(0,o.jsxs)(Dn,{disabled:e.enabled?!r:!1,onSelect:n=>{n.preventDefault(),t(e)},className:R(e.variant===`destructive`&&`text-destructive focus:text-destructive`,e.className),children:[s,(0,o.jsx)(`span`,{children:e.label||e.name})]})};dl.displayName=`ActionMenuItem`;var fl=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":s,"data-obj-type":l,style:u,...d}=n,{execute:f}=(0,i.useAction)(),[p,m]=(0,a.useState)(!1),h=ul(),g=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),_=sl(e.icon)||c.MoreHorizontal,v=e.variant||`ghost`,y=e.size||`icon`,b=(0,a.useCallback)(async e=>{m(!0);try{if(typeof e.onClick==`function`){await e.onClick();return}await f({type:e.type,name:e.name,target:e.target,execute:e.execute,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,toast:e.toast,resultDialog:e.resultDialog})}finally{m(!1)}},[f]);if(e.visible&&!g)return null;let x=e.actions||[];return x.length===0?null:(0,o.jsxs)(vn,{children:[(0,o.jsx)(yn,{asChild:!0,children:(0,o.jsx)(B,{ref:r,type:`button`,variant:v,size:y,className:R(y===`icon`&&`h-8 w-8`,e.className,t),disabled:p,"aria-label":e.label||h,...d,"data-obj-id":s,"data-obj-type":l,style:u,children:p?(0,o.jsx)(c.Loader2,{className:`h-4 w-4 animate-spin`}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(_,{className:R(`h-4 w-4`,e.label&&`mr-2`)}),e.label&&(0,o.jsx)(`span`,{children:e.label})]})})}),(0,o.jsx)(En,{align:`end`,children:x.map((e,t)=>{let n=e.tags?.includes(`separator-before`)&&t>0;return(0,o.jsxs)(a.default.Fragment,{children:[n&&(0,o.jsx)(jn,{}),(0,o.jsx)(dl,{action:e,onExecute:b})]},e.name||t)})})]})});fl.displayName=`ActionMenuRenderer`,t.ComponentRegistry.register(`action:menu`,fl,{namespace:`action`,label:`Action Menu`,inputs:[{name:`label`,type:`string`,label:`Trigger Label`},{name:`icon`,type:`string`,label:`Trigger Icon`},{name:`actions`,type:`object`,label:`Actions`},{name:`variant`,type:`enum`,label:`Trigger Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`ghost`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{variant:`ghost`,actions:[]}});var pl=({action:e,variant:t,size:n,onExecute:r})=>{let[s,l]=(0,a.useState)(!1),u=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),d=(0,i.useCondition)((0,i.toPredicateInput)(e.enabled)),f=sl(e.icon),p=e.variant===`primary`?`default`:e.variant||t||`outline`,m=e.size===`md`?`default`:e.size||n||`sm`,h=(0,a.useCallback)(async()=>{if(!s){l(!0);try{await r(e)}finally{l(!1)}}},[e,r,s]);return e.visible&&!u?null:(0,o.jsxs)(B,{type:`button`,variant:p,size:m,className:e.className,disabled:(e.enabled?!d:!1)||s,onClick:h,children:[s&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!s&&f&&(0,o.jsx)(f,{className:R(`h-4 w-4`,e.label&&`mr-2`)}),e.label]})};pl.displayName=`InlineActionButton`;var ml=(0,a.forwardRef)(({schema:e,className:t,...n},r)=>{let{"data-obj-id":s,"data-obj-type":l,style:u,...d}=n,{execute:f}=(0,i.useAction)(),[p,m]=(0,a.useState)(!1),h=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),g=e.actions||[];e.location&&(g=g.filter(t=>!t.locations||t.locations.includes(e.location)));let _=(0,a.useCallback)(async e=>{await f({type:e.type,name:e.name,target:e.target,execute:e.execute,endpoint:e.endpoint,method:e.method,params:e.params,confirmText:e.confirmText,successMessage:e.successMessage,errorMessage:e.errorMessage,refreshAfter:e.refreshAfter,toast:e.toast})},[f]);if(e.visible&&!h||g.length===0)return null;if((e.display||`inline`)===`dropdown`){let n=sl(e.icon);return(0,o.jsxs)(vn,{children:[(0,o.jsx)(yn,{asChild:!0,children:(0,o.jsxs)(B,{type:`button`,variant:e.variant||`outline`,size:e.size===`md`?`default`:e.size||`default`,className:R(e.className,t),disabled:p,"data-obj-id":s,"data-obj-type":l,style:u,children:[p&&(0,o.jsx)(c.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),!p&&n&&(0,o.jsx)(n,{className:`mr-2 h-4 w-4`}),e.label||`Actions`,(0,o.jsx)(c.ChevronDown,{className:`ml-2 h-3 w-3 opacity-50`})]})}),(0,o.jsx)(En,{align:`end`,children:g.map((e,t)=>{let n=sl(e.icon),r=e.tags?.includes(`separator-before`)&&t>0;return(0,o.jsxs)(a.default.Fragment,{children:[r&&(0,o.jsx)(jn,{}),(0,o.jsxs)(Dn,{onSelect:async t=>{t.preventDefault(),m(!0);try{await _(e)}finally{m(!1)}},className:R(e.variant===`destructive`&&`text-destructive focus:text-destructive`,e.className),children:[n&&(0,o.jsx)(n,{className:`mr-2 h-4 w-4`}),(0,o.jsx)(`span`,{children:e.label||e.name})]})]},e.name||t)})})]})}return(0,o.jsx)(`div`,{ref:r,className:R(`flex items-center gap-2`,e.className,t),...d,"data-obj-id":s,"data-obj-type":l,style:u,children:g.map(t=>(0,o.jsx)(pl,{action:t,variant:e.variant,size:e.size,onExecute:_},t.name))})});ml.displayName=`ActionGroupRenderer`,t.ComponentRegistry.register(`action:group`,ml,{namespace:`action`,label:`Action Group`,inputs:[{name:`name`,type:`string`,label:`Group Name`},{name:`label`,type:`string`,label:`Label`},{name:`icon`,type:`string`,label:`Icon`},{name:`actions`,type:`object`,label:`Actions`},{name:`display`,type:`enum`,label:`Display Mode`,enum:[`inline`,`dropdown`],defaultValue:`inline`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`outline`},{name:`size`,type:`enum`,label:`Size`,enum:[`sm`,`md`,`lg`],defaultValue:`sm`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{display:`inline`,variant:`outline`,size:`sm`,actions:[]}});function hl(){try{let{t:e}=(0,F.useObjectTranslation)(),t=e(`common.actions`);return!t||t===`common.actions`?`Actions`:t}catch{return`Actions`}}var gl=(0,a.forwardRef)(({schema:e,className:n,...r},s)=>{let c=hl(),{"data-obj-id":l,"data-obj-type":u,style:d,data:f,actions:p,systemActions:m,location:h,maxVisible:g,mobileMaxVisible:_,direction:v,gap:y,variant:b,size:x,visible:S,...C}=r,w=(0,i.useCondition)((0,i.toPredicateInput)(e.visible)),T=ii(),E=(0,a.useMemo)(()=>{let t=e.actions||[],n=e.location?t.filter(t=>!t.locations||t.locations.length===0||t.locations.includes(e.location)):t,r=new Set;return n.filter(e=>e.name?r.has(e.name)?!1:(r.add(e.name),!0):!0)},[e.actions,e.location]),D=(0,a.useMemo)(()=>{let t=e.systemActions||[],n=new Set;return t.filter(e=>e.name?n.has(e.name)?!1:(n.add(e.name),!0):!0)},[e.systemActions]),O=T?e.mobileMaxVisible??1:e.maxVisible??3,{inlineActions:k,overflowActions:A}=(0,a.useMemo)(()=>E.length<=O?{inlineActions:E,overflowActions:[]}:{inlineActions:E.slice(0,O),overflowActions:E.slice(O)},[E,O]),j=(0,a.useMemo)(()=>{if(D.length===0)return A;if(A.length===0)return D;let[e,...t]=D,n={...e,tags:[...e.tags||[],`separator-before`]};return[...A,n,...t]},[A,D]);if(e.visible&&!w||E.length===0&&D.length===0)return null;let ee=e.direction||`horizontal`,te=e.gap||`gap-2`,M=j.length>0?t.ComponentRegistry.get(`action:menu`):null,N=M?(0,o.jsx)(M,{schema:{type:`action:menu`,actions:j,variant:e.variant||`ghost`,size:e.size||`sm`}}):null;return(0,o.jsxs)(`div`,{ref:s,className:R(`flex items-center`,ee===`vertical`?`flex-col items-stretch`:`flex-row flex-wrap`,te,e.className,n),role:`toolbar`,"aria-label":c,...C,"data-obj-id":l,"data-obj-type":u,style:d,children:[k.map(n=>{let r=n.component||`action:button`,i=t.ComponentRegistry.get(r);return i?(0,o.jsx)(i,{schema:{...n,type:r,actionType:n.type,variant:n.variant||e.variant,size:n.size||e.size},data:f},n.name):null}),j.length>0&&N]})});gl.displayName=`ActionBarRenderer`,t.ComponentRegistry.register(`action:bar`,gl,{namespace:`action`,label:`Action Bar`,inputs:[{name:`actions`,type:`object`,label:`Actions`},{name:`systemActions`,type:`object`,label:`System Actions (always in overflow)`},{name:`location`,type:`enum`,label:`Location`,enum:[...fe.ACTION_LOCATIONS]},{name:`maxVisible`,type:`number`,label:`Max Visible Actions`,defaultValue:3},{name:`direction`,type:`enum`,label:`Direction`,enum:[`horizontal`,`vertical`],defaultValue:`horizontal`},{name:`variant`,type:`enum`,label:`Default Variant`,enum:[`default`,`secondary`,`outline`,`ghost`],defaultValue:`outline`},{name:`size`,type:`enum`,label:`Default Size`,enum:[`sm`,`md`,`lg`],defaultValue:`sm`},{name:`className`,type:`string`,label:`CSS Class`,advanced:!0}],defaultProps:{maxVisible:3,direction:`horizontal`,variant:`outline`,size:`sm`,actions:[]}});var _l=({schema:e,className:t})=>{let n=e.type,r=n.startsWith(`view:`),i=n.startsWith(`widget:`),a=n.startsWith(`field:`);return(0,o.jsxs)(`div`,{className:R(`flex flex-col items-center justify-center p-6 border-2 border-dashed rounded-lg bg-muted/30 transition-colors hover:bg-muted/50`,r&&`border-blue-300 bg-blue-50/50 min-h-[200px]`,i&&`border-purple-300 bg-purple-50/50 min-h-[150px]`,a&&`border-yellow-300 bg-yellow-50/50 p-2 min-h-[40px] flex-row gap-2 justify-start`,t),children:[(0,o.jsxs)(`div`,{className:R(`flex items-center gap-2 text-muted-foreground`,a&&`text-sm`),children:[a?(0,o.jsx)(c.Box,{className:`h-4 w-4`}):(0,o.jsx)(c.FileQuestion,{className:`h-8 w-8 mb-2 opacity-50`}),(0,o.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,o.jsx)(`span`,{className:`font-mono font-medium text-foreground`,children:n}),!a&&(0,o.jsx)(`span`,{className:`text-xs`,children:`Component Placeholder`})]})]}),e.props&&!a&&(0,o.jsxs)(`div`,{className:`mt-4 w-full text-xs text-muted-foreground bg-background/50 p-2 rounded overflow-hidden`,children:[(0,o.jsx)(`div`,{className:`opacity-70`,children:`Properties:`}),(0,o.jsx)(`pre`,{className:`mt-1 truncate`,children:JSON.stringify(e.props,null,0)})]})]})},vl=`view:grid.view:kanban.view:map.view:calendar.view:gantt.view:timeline.view:gallery.view:simple.view:wizard.view:tabbed.view:drawer.view:modal.view:split.field:text.field:textarea.field:password.field:email.field:url.field:phone.field:markdown.field:html.field:code.field:number.field:currency.field:percent.field:slider.field:boolean.field:checkboxes.field:select.field:multiselect.field:radio.field:date.field:datetime.field:time.field:duration.field:lookup.field:master_detail.field:tree.field:image.field:file.field:video.field:audio.field:avatar.field:color.field:rating.field:signature.field:qrcode.field:progress.field:json.field:address.field:location.page:header.page-header.page:footer.page:tabs.page:accordion.page:card.page:sidebar.record:details.record:highlights.record:related_list.record:activity.record:chatter.record:path.app:launcher.nav:menu.nav:breadcrumb.global:search.global:notifications.user:profile.widget:metric.widget:bar.widget:line.widget:pie.widget:funnel.widget:radar.widget:scatter.widget:heatmap.widget:pivot.widget:table.widget:text.widget:image.ai:input.ai:suggestion.ai:feedback`.split(`.`);function yl(){vl.forEach(e=>{t.ComponentRegistry.get(e)||t.ComponentRegistry.register(e,_l,{namespace:`protocol-placeholder`})})}function bl(e,t){let n=t?.maxHistory??50,[r,i]=(0,a.useState)({...e}),[o,s]=(0,a.useState)(t?.mode===`create`),c=(0,a.useRef)([]),l=(0,a.useRef)([]),[,u]=(0,a.useState)(0);(0,a.useEffect)(()=>{i({...e}),s(t?.mode===`create`),c.current=[],l.current=[]},[e]);let d=(0,a.useCallback)((e,r)=>{i(t=>(c.current=[...c.current.slice(-(n-1)),t],l.current=[],{...t,[e]:r})),s(!0),u(e=>e+1),t?.onUpdate?.(e,r)},[t?.onUpdate,n]),f=(0,a.useCallback)(()=>{c.current.length!==0&&(i(e=>{let t=[...c.current],n=t.pop();return c.current=t,l.current=[e,...l.current],n}),u(e=>e+1))},[]),p=(0,a.useCallback)(()=>{l.current.length!==0&&(i(e=>{let t=[...l.current],n=t.shift();return l.current=t,c.current=[...c.current,e],n}),u(e=>e+1))},[]);return{draft:r,isDirty:o,updateField:d,discard:(0,a.useCallback)(()=>{i({...e}),s(!1),c.current=[],l.current=[],u(e=>e+1)},[e]),setDraft:i,undo:f,redo:p,canUndo:c.current.length>0,canRedo:l.current.length>0}}function xl(e){let[t,n]=a.useState({width:0,height:0});return a.useEffect(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let r=t.getBoundingClientRect();n(e=>e.width===r.width&&e.height===r.height?e:{width:r.width,height:r.height});let i=new ResizeObserver(e=>{let t=e[0];if(!t)return;let r,i=t.borderBoxSize?.[0];r=i?{width:i.inlineSize,height:i.blockSize}:{width:t.contentRect.width,height:t.contentRect.height},n(e=>e.width===r.width&&e.height===r.height?e:r)});return i.observe(t),()=>i.disconnect()},[e]),t}var Sl=[`completed`,`failed`,`cancelled`,`expired`];function Cl(e){return!!e&&Sl.includes(e)}function wl(e={}){let{dataSource:t,pollIntervalMs:n=1500,maxAttempts:r=600,onComplete:i,onError:o}=e,[s,c]=(0,a.useState)(null),[l,u]=(0,a.useState)(null),[d,f]=(0,a.useState)(!1),p=(0,a.useRef)(null),m=(0,a.useRef)(null),h=(0,a.useRef)(0),g=(0,a.useRef)(!1),_=(0,a.useRef)({onComplete:i,onError:o});_.current={onComplete:i,onError:o};let v=!!t?.createExportJob&&!!t?.getExportJobProgress,y=(0,a.useCallback)(()=>{m.current&&=(clearTimeout(m.current),null)},[]),b=(0,a.useCallback)(()=>{y(),p.current=null,g.current=!1,h.current=0,c(null),u(null),f(!1)},[y]);(0,a.useEffect)(()=>()=>y(),[y]);let x=(0,a.useCallback)(async()=>{if(t?.getExportJobProgress&&!(!p.current||g.current)){if(h.current+=1,h.current>r){let e=Error(`Export job timed out (max attempts exceeded)`);u(e),f(!1),_.current.onError?.(e,s??void 0);return}try{let e=await t.getExportJobProgress(p.current);if(g.current)return;if(c(e),Cl(e.status)){if(f(!1),e.status===`completed`)_.current.onComplete?.(e);else{let t=e.error?.message??`Export ${e.status}`,n=Error(t);u(n),_.current.onError?.(n,e)}return}m.current=setTimeout(x,n)}catch(e){if(g.current)return;let t=e instanceof Error?e:Error(String(e));u(t),f(!1),_.current.onError?.(t,s??void 0)}}},[t,r,n,s]),S=(0,a.useCallback)(async(e,r)=>{if(!t?.createExportJob){let e=Error(`DataSource does not implement createExportJob — cannot start async export.`);return u(e),_.current.onError?.(e),null}y(),g.current=!1,h.current=0,u(null),c(null),f(!0);try{let i=await t.createExportJob(e,r);if(p.current=i.jobId,c({jobId:i.jobId,status:i.status,processedRecords:0,totalRecords:i.estimatedRecords,percentComplete:0}),Cl(i.status)){if(f(!1),i.status===`completed`&&t.getExportJobProgress)try{let e=await t.getExportJobProgress(i.jobId);c(e),_.current.onComplete?.(e)}catch{}return i.jobId}return m.current=setTimeout(x,n),i.jobId}catch(e){let t=e instanceof Error?e:Error(String(e));return u(t),f(!1),_.current.onError?.(t),null}},[t,y,x,n]),C=(0,a.useCallback)(async()=>{if(p.current){if(g.current=!0,y(),f(!1),t?.cancelExportJob)try{await t.cancelExportJob(p.current)}catch{}c(e=>e&&{...e,status:`cancelled`})}},[t,y]),w=(0,a.useCallback)(async()=>{if(!p.current)return null;if(t?.getExportJobDownloadUrl)try{return await t.getExportJobDownloadUrl(p.current)}catch{}return s?.downloadUrl??null},[t,s]);return{isRunning:d,progress:s,error:l,isSupported:v,start:S,cancel:C,getDownloadUrl:w,download:(0,a.useCallback)(async e=>{let t=await w();if(!t)return!1;let n=document.createElement(`a`);return n.href=t,e&&(n.download=e),n.rel=`noopener`,document.body.appendChild(n),n.click(),n.remove(),!0},[w]),reset:b}}function Tl({schema:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No schema available`})}function El({dataContext:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No data context available`})}function Dl(){let e=(0,a.useMemo)(()=>{try{return t.ComponentRegistry.getAllTypes()}catch{return[]}},[]);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No registered components`}):(0,o.jsxs)(`div`,{className:`space-y-1 max-h-[60vh] overflow-auto`,children:[e.map(e=>(0,o.jsxs)(`div`,{className:`flex items-center gap-2 px-2 py-1 rounded text-xs font-mono bg-muted/30`,children:[(0,o.jsx)(`span`,{className:`inline-block w-2 h-2 rounded-full bg-green-500 shrink-0`}),e]},e)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` component`,e.length===1?``:`s`,` registered`]})]})}function Ol({flags:e}){return e?(0,o.jsx)(`pre`,{className:`text-[11px] leading-relaxed font-mono overflow-auto max-h-[60vh] whitespace-pre-wrap break-all`,children:JSON.stringify(e,null,2)}):(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No debug flags`})}function kl(e){let n=t.DebugCollector.getInstance(),[r,i]=(0,a.useState)(()=>n.getEntries(e));return a.default.useEffect(()=>(i(n.getEntries(e)),n.subscribe(()=>{i(n.getEntries(e))})),[n,e]),r}function Al(){let e=kl(`perf`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No performance data collected yet`}):(0,o.jsxs)(`div`,{className:`space-y-1 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:R(`flex items-center justify-between px-2 py-1 rounded text-xs font-mono`,e.durationMs>16?`bg-red-50 text-red-700`:`bg-muted/30`),children:[(0,o.jsxs)(`span`,{className:`truncate mr-2`,children:[e.type,e.id?`:${e.id}`:``]}),(0,o.jsxs)(`span`,{className:`shrink-0 tabular-nums`,children:[e.durationMs.toFixed(2),`ms`]})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` render`,e.length===1?``:`s`,` tracked`]})]})}function jl(){let e=kl(`expr`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No expression evaluations tracked yet`}):(0,o.jsxs)(`div`,{className:`space-y-1.5 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:`px-2 py-1.5 rounded bg-muted/30 text-xs font-mono`,children:[(0,o.jsx)(`div`,{className:`text-muted-foreground truncate`,children:e.expression}),(0,o.jsxs)(`div`,{className:`mt-0.5`,children:[`→ `,JSON.stringify(e.result)]})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` evaluation`,e.length===1?``:`s`,` tracked`]})]})}function Ml(){let e=kl(`event`).map(e=>e.data);return e.length===0?(0,o.jsx)(`p`,{className:`text-xs text-muted-foreground italic`,children:`No events captured yet`}):(0,o.jsxs)(`div`,{className:`space-y-1.5 max-h-[60vh] overflow-auto`,children:[e.map((e,t)=>(0,o.jsxs)(`div`,{className:`px-2 py-1.5 rounded bg-muted/30 text-xs font-mono`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsx)(`span`,{className:`font-semibold`,children:e.action}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground tabular-nums`,children:new Date(e.timestamp).toLocaleTimeString()})]}),e.payload!==void 0&&(0,o.jsx)(`pre`,{className:`mt-0.5 text-[10px] text-muted-foreground truncate`,children:JSON.stringify(e.payload)})]},t)),(0,o.jsxs)(`p`,{className:`text-[10px] text-muted-foreground mt-2`,children:[e.length,` event`,e.length===1?``:`s`,` captured`]})]})}function Nl({open:e,onClose:t,flags:n,schema:r,dataContext:i,extraTabs:s=[],className:c}){let l=(0,a.useMemo)(()=>[{id:`schema`,label:`Schema`,render:()=>(0,o.jsx)(Tl,{schema:r})},{id:`data`,label:`Data`,render:()=>(0,o.jsx)(El,{dataContext:i})},{id:`perf`,label:`Perf`,render:()=>(0,o.jsx)(Al,{})},{id:`expr`,label:`Expr`,render:()=>(0,o.jsx)(jl,{})},{id:`events`,label:`Events`,render:()=>(0,o.jsx)(Ml,{})},{id:`registry`,label:`Registry`,render:()=>(0,o.jsx)(Dl,{})},{id:`flags`,label:`Flags`,render:()=>(0,o.jsx)(Ol,{flags:n})}],[r,i,n]),u=(0,a.useMemo)(()=>[...l,...s],[l,s]),[d,f]=(0,a.useState)(u[0]?.id??`schema`),p=u.find(e=>e.id===d)??u[0],m=(0,a.useCallback)(e=>{f(e)},[]);return e?(0,o.jsxs)(`div`,{className:R(`fixed bottom-4 right-4 z-[9999] w-[420px] max-w-[95vw] rounded-lg border bg-background shadow-2xl`,`flex flex-col overflow-hidden`,c),"data-testid":`debug-panel`,role:`dialog`,"aria-label":`Developer Debug Panel`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between px-3 py-2 border-b bg-muted/30`,children:[(0,o.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`🛠 Debug Panel`}),(0,o.jsx)(`button`,{onClick:t,className:`text-muted-foreground hover:text-foreground text-sm leading-none px-1`,"aria-label":`Close debug panel`,"data-testid":`debug-panel-close`,children:`✕`})]}),(0,o.jsx)(`div`,{className:`flex border-b overflow-x-auto`,role:`tablist`,children:u.map(e=>(0,o.jsxs)(`button`,{role:`tab`,"aria-selected":e.id===p?.id,onClick:()=>m(e.id),className:R(`px-3 py-1.5 text-xs font-medium whitespace-nowrap transition-colors`,e.id===p?.id?`border-b-2 border-primary text-foreground`:`text-muted-foreground hover:text-foreground`),"data-testid":`debug-tab-${e.id}`,children:[e.icon&&(0,o.jsx)(`span`,{className:`mr-1`,children:e.icon}),e.label]},e.id))}),(0,o.jsx)(`div`,{className:`p-3 overflow-auto max-h-[50vh]`,"data-testid":`debug-panel-content`,children:p?.render()})]}):null}var Pl={permission:`view`,audience:`link_only`,expiresInDays:7,password:``,label:``},Fl=[{label:`1 day`,value:1},{label:`7 days`,value:7},{label:`30 days`,value:30},{label:`90 days`,value:90},{label:`Never`,value:null}],Il=[{value:`link_only`,label:`Anyone with the link`,help:`No sign-in required`},{value:`signed_in`,label:`Signed-in users`,help:`Must be logged in to view`}];function Ll(e,t){return`${(e??(typeof window<`u`?`${window.location.origin}/s`:`/s`)).replace(/\/+$/,``)}/${t}`}async function Rl(e){try{if(typeof navigator<`u`&&navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}if(typeof document<`u`){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`absolute`,t.style.left=`-9999px`,document.body.appendChild(t),t.select();try{return document.execCommand(`copy`),document.body.removeChild(t),!0}catch{document.body.removeChild(t)}}return!1}function zl({open:e,onOpenChange:t,objectName:n,recordId:r,recordLabel:i,apiBase:s,publicBaseUrl:l,fetchHeaders:u}){let[d,f]=(0,a.useState)([]),[p,m]=(0,a.useState)(!1),[h,g]=(0,a.useState)(!1),[_,v]=(0,a.useState)(null),[y,b]=(0,a.useState)(Pl),[x,S]=(0,a.useState)(null),C=(0,a.useCallback)(async()=>{let e={"Content-Type":`application/json`};if(!u)return e;let t=await u();return{...e,...t}},[u]),w=(0,a.useMemo)(()=>`${s.replace(/\/+$/,``)}/v1/share-links?object=${encodeURIComponent(n)}&recordId=${encodeURIComponent(r)}`,[s,n,r]),T=(0,a.useCallback)(async()=>{m(!0),v(null);try{let e=await C(),t=await fetch(w,{headers:e,credentials:`include`});if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();f(n.links??n.data??[])}catch(e){v(e?.message??`Failed to load share links`)}finally{m(!1)}},[w,C]);(0,a.useEffect)(()=>{e&&(T(),b(Pl))},[e,T]);let E=(0,a.useCallback)(async()=>{g(!0),v(null);try{let e=y.expiresInDays==null?void 0:new Date(Date.now()+y.expiresInDays*24*60*60*1e3).toISOString(),t=await C(),i=await fetch(`${s.replace(/\/+$/,``)}/v1/share-links`,{method:`POST`,headers:t,credentials:`include`,body:JSON.stringify({object:n,recordId:r,permission:y.permission,audience:y.audience,expiresAt:e,password:y.password.trim()||void 0,label:y.label.trim()||void 0})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e?.error?.message||`HTTP ${i.status}`)}let a=await i.json(),o=a.link??a.data;if(!o)throw Error(`Share link create response missing link payload`);f(e=>[o,...e]),await Rl(Ll(l,o.token))&&(S(o.id),setTimeout(()=>S(null),1500)),b(Pl)}catch(e){v(e?.message??`Failed to create share link`)}finally{g(!1)}},[s,C,n,r,y,l]),D=(0,a.useCallback)(async e=>{try{let t=await C(),n=await fetch(`${s.replace(/\/+$/,``)}/v1/share-links/${encodeURIComponent(e.id)}`,{method:`DELETE`,headers:t,credentials:`include`});if(!n.ok&&n.status!==204)throw Error(`HTTP ${n.status}`);f(t=>t.map(t=>t.id===e.id?{...t,revoked_at:new Date().toISOString()}:t))}catch(e){v(e?.message??`Failed to revoke link`)}},[s,C]),O=(0,a.useCallback)(async e=>{await Rl(Ll(l,e.token))&&(S(e.id),setTimeout(()=>S(null),1500))},[l]),k=d.filter(e=>!e.revoked_at),A=d.filter(e=>e.revoked_at);return(0,o.jsx)(Dt,{open:e,onOpenChange:t,children:(0,o.jsxs)(Mt,{className:`max-w-xl`,"data-testid":`share-dialog`,children:[(0,o.jsxs)(Nt,{children:[(0,o.jsxs)(Ft,{className:`flex items-center gap-2`,children:[(0,o.jsx)(c.Link2,{className:`h-4 w-4`}),`Share `,i??`this record`]}),(0,o.jsx)(It,{children:`Generate a link anyone (or selected people) can use to open this record. Links can be revoked at any time.`})]}),_&&(0,o.jsx)(`div`,{className:`rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2 text-xs text-destructive`,"data-testid":`share-dialog-error`,children:_}),(0,o.jsxs)(`section`,{className:`space-y-3 rounded-lg border bg-muted/30 p-3`,children:[(0,o.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(U,{className:`text-xs`,children:`Who can access`}),(0,o.jsxs)(G,{value:y.audience,onValueChange:e=>b(t=>({...t,audience:e})),children:[(0,o.jsx)(q,{className:`h-8 text-xs`,"data-testid":`share-audience`,children:(0,o.jsx)(K,{})}),(0,o.jsx)(J,{children:Il.map(e=>(0,o.jsx)(Y,{value:e.value,className:`text-xs`,children:(0,o.jsxs)(`div`,{className:`flex flex-col`,children:[(0,o.jsx)(`span`,{children:e.label}),(0,o.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:e.help})]})},e.value))})]})]}),(0,o.jsxs)(`div`,{className:`space-y-1`,children:[(0,o.jsx)(U,{className:`text-xs`,children:`Expires in`}),(0,o.jsxs)(G,{value:y.expiresInDays==null?`never`:String(y.expiresInDays),onValueChange:e=>b(t=>({...t,expiresInDays:e===`never`?null:Number(e)})),children:[(0,o.jsx)(q,{className:`h-8 text-xs`,"data-testid":`share-expiry`,children:(0,o.jsx)(K,{})}),(0,o.jsx)(J,{children:Fl.map(e=>(0,o.jsx)(Y,{value:e.value==null?`never`:String(e.value),className:`text-xs`,children:e.label},String(e.value)))})]})]}),(0,o.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,o.jsx)(U,{className:`text-xs`,children:`Password (optional)`}),(0,o.jsx)(W,{type:`password`,value:y.password,onChange:e=>b(t=>({...t,password:e.target.value})),placeholder:`Require a password to open`,className:`h-8 text-xs`,"data-testid":`share-password`})]}),(0,o.jsxs)(`div`,{className:`space-y-1 sm:col-span-2`,children:[(0,o.jsx)(U,{className:`text-xs`,children:`Label (only you see this)`}),(0,o.jsx)(W,{value:y.label,onChange:e=>b(t=>({...t,label:e.target.value})),placeholder:`e.g. Sent to design review`,className:`h-8 text-xs`,"data-testid":`share-label`})]})]}),(0,o.jsx)(`div`,{className:`flex justify-end`,children:(0,o.jsxs)(B,{size:`sm`,onClick:E,disabled:h,"data-testid":`share-create`,children:[h?(0,o.jsx)(c.Loader2,{className:`mr-1 h-3 w-3 animate-spin`}):(0,o.jsx)(c.Link2,{className:`mr-1 h-3 w-3`}),`Create link`]})})]}),(0,o.jsxs)(`section`,{className:`space-y-2`,children:[(0,o.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,o.jsxs)(`h4`,{className:`text-xs font-medium text-muted-foreground`,children:[`Existing links`,k.length?` (${k.length})`:``]}),p&&(0,o.jsx)(c.Loader2,{className:`h-3 w-3 animate-spin text-muted-foreground`})]}),!p&&k.length===0&&A.length===0&&(0,o.jsx)(`p`,{className:`rounded-md border border-dashed px-3 py-4 text-center text-xs text-muted-foreground`,children:`No share links yet. Create one above.`}),(0,o.jsxs)(`ul`,{className:`space-y-2`,children:[k.map(e=>(0,o.jsx)(Bl,{link:e,copied:x===e.id,onCopy:()=>O(e),onRevoke:()=>D(e),publicBaseUrl:l},e.id)),A.length>0&&(0,o.jsx)(`li`,{className:`pt-2 text-[10px] uppercase tracking-wide text-muted-foreground`,children:`Revoked`}),A.map(e=>(0,o.jsx)(Bl,{link:e,copied:!1,onCopy:()=>O(e),onRevoke:()=>D(e),publicBaseUrl:l,disabled:!0},e.id))]})]}),(0,o.jsx)(Pt,{children:(0,o.jsx)(B,{variant:`ghost`,size:`sm`,onClick:()=>t(!1),children:`Done`})})]})})}function Bl({link:e,copied:t,onCopy:n,onRevoke:r,publicBaseUrl:i,disabled:a}){let s=Ll(i,e.token);return(0,o.jsxs)(`li`,{className:R(`flex items-center gap-2 rounded-md border bg-card px-2 py-2 text-xs`,a&&`opacity-60`),"data-testid":`share-link-row`,children:[(0,o.jsx)(We,{variant:`secondary`,className:`text-[10px] capitalize`,children:e.audience.replace(`_`,` `)}),(0,o.jsx)(We,{variant:`outline`,className:`text-[10px] capitalize`,children:e.permission}),(0,o.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,o.jsx)(`div`,{className:`truncate font-mono text-[11px]`,title:s,children:s}),e.label&&(0,o.jsx)(`div`,{className:`truncate text-[10px] text-muted-foreground`,children:e.label})]}),!a&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)(B,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs`,onClick:n,"data-testid":`share-link-copy`,children:[(0,o.jsx)(c.Copy,{className:`mr-1 h-3 w-3`}),t?`Copied!`:`Copy`]}),(0,o.jsx)(B,{size:`sm`,variant:`ghost`,className:`h-7 px-2 text-xs text-destructive hover:text-destructive`,onClick:r,"data-testid":`share-link-revoke`,title:`Revoke`,children:(0,o.jsx)(c.Trash2,{className:`h-3 w-3`})})]}),a&&(0,o.jsxs)(`span`,{className:`flex items-center gap-1 text-[10px] text-muted-foreground`,children:[(0,o.jsx)(c.ShieldOff,{className:`h-3 w-3`}),`revoked`]})]})}function Vl(){return!0}e.Accordion=xe,e.AccordionContent=we,e.AccordionItem=Se,e.AccordionTrigger=Ce,e.ActionParamDialog=Ps,e.Alert=V,e.AlertDescription=Re,e.AlertDialog=Ee,e.AlertDialogAction=Fe,e.AlertDialogCancel=Ie,e.AlertDialogContent=Ae,e.AlertDialogDescription=Pe,e.AlertDialogFooter=Me,e.AlertDialogHeader=je,e.AlertDialogOverlay=ke,e.AlertDialogPortal=Oe,e.AlertDialogTitle=Ne,e.AlertDialogTrigger=De,e.AlertTitle=H,e.AspectRatio=ze,e.Avatar=Be,e.AvatarFallback=He,e.AvatarImage=Ve,e.Badge=We,e.Breadcrumb=Ge,e.BreadcrumbEllipsis=Ze,e.BreadcrumbItem=qe,e.BreadcrumbLink=Je,e.BreadcrumbList=Ke,e.BreadcrumbPage=Ye,e.BreadcrumbSeparator=Xe,e.Button=B,e.ButtonGroup=wo,e.ButtonGroupSeparator=Eo,e.ButtonGroupText=To,e.Calendar=Qe,e.CalendarDayButton=$e,e.Card=et,e.CardContent=it,e.CardDescription=rt,e.CardFooter=at,e.CardHeader=tt,e.CardTitle=nt,e.Carousel=ct,e.CarouselContent=lt,e.CarouselItem=ut,e.CarouselNext=ft,e.CarouselPrevious=dt,e.ChartContainer=gt,e.ChartLegend=bt,e.ChartLegendContent=xt,e.ChartSkeleton=zs,e.ChartStyle=_t,e.ChartTooltip=vt,e.ChartTooltipContent=yt,e.Checkbox=Ct,e.Collapsible=wt,e.CollapsibleContent=Et,e.CollapsibleTrigger=Tt,e.Combobox=Do,e.Command=Lt,e.CommandDialog=Rt,e.CommandEmpty=Vt,e.CommandGroup=Ht,e.CommandInput=zt,e.CommandItem=Wt,e.CommandList=Bt,e.CommandSeparator=Ut,e.CommandShortcut=Gt,e.ConfigFieldRenderer=Jo,e.ConfigPanelRenderer=Xo,e.ConfigRow=Oo,e.ContextMenu=Kt,e.ContextMenuCheckboxItem=nn,e.ContextMenuContent=en,e.ContextMenuGroup=Jt,e.ContextMenuItem=tn,e.ContextMenuLabel=an,e.ContextMenuPortal=Yt,e.ContextMenuRadioGroup=Zt,e.ContextMenuRadioItem=rn,e.ContextMenuSeparator=on,e.ContextMenuShortcut=sn,e.ContextMenuSub=Xt,e.ContextMenuSubContent=$t,e.ContextMenuSubTrigger=Qt,e.ContextMenuTrigger=qt,e.DataEmptyState=Xs,e.EmptyState=Xs,e.DataErrorState=Zs,e.DataLoadingState=Ys,e.DatePicker=Zo,e.DebugPanel=Nl,e.Dialog=Dt,e.DialogClose=At,e.DialogContent=Mt,e.DialogDescription=It,e.DialogFooter=Pt,e.DialogHeader=Nt,e.DialogOverlay=jt,e.DialogPortal=kt,e.DialogTitle=Ft,e.DialogTrigger=Ot,e.Drawer=cn,e.DrawerClose=dn,e.DrawerContent=pn,e.DrawerDescription=_n,e.DrawerFooter=hn,e.DrawerHeader=mn,e.DrawerOverlay=fn,e.DrawerPortal=un,e.DrawerTitle=gn,e.DrawerTrigger=ln,e.DropdownMenu=vn,e.DropdownMenuCheckboxItem=On,e.DropdownMenuContent=En,e.DropdownMenuGroup=bn,e.DropdownMenuItem=Dn,e.DropdownMenuLabel=An,e.DropdownMenuPortal=xn,e.DropdownMenuRadioGroup=Cn,e.DropdownMenuRadioItem=kn,e.DropdownMenuSeparator=jn,e.DropdownMenuShortcut=Mn,e.DropdownMenuSub=Sn,e.DropdownMenuSubContent=Tn,e.DropdownMenuSubTrigger=wn,e.DropdownMenuTrigger=yn,e.Empty=$o,e.EmptyContent=as,e.EmptyDescription=is,e.EmptyHeader=es,e.EmptyMedia=ns,e.EmptyTitle=rs,e.EmptyValue=os,e.ExportProgressDialog=ec,e.Field=cs,e.FilterBuilder=Wo,e.Form=Pn,e.FormControl=Vn,e.FormDescription=Hn,e.FormField=In,e.FormItem=zn,e.FormLabel=Bn,e.FormMessage=Un,e.FormSkeleton=Ls,e.GridSkeleton=Fs,e.GroupingEditor=Ns,e.HoverCard=Wn,e.HoverCardContent=Kn,e.HoverCardTrigger=Gn,e.Input=W,e.InputGroup=ls,e.InputOTP=qn,e.InputOTPGroup=Jn,e.InputOTPSeparator=Xn,e.InputOTPSlot=Yn,e.Item=ps,e.ItemActions=ys,e.ItemContent=gs,e.ItemDescription=vs,e.ItemFooter=xs,e.ItemGroup=us,e.ItemHeader=bs,e.ItemMedia=hs,e.ItemSeparator=ds,e.ItemTitle=_s,e.KanbanSkeleton=Is,e.Kbd=Ss,e.KbdGroup=Cs,e.Label=U,e.LazyIcon=ka,e.ListSkeleton=Rs,e.LookupValuePicker=Go,e.Menubar=nr,e.MenubarCheckboxItem=cr,e.MenubarContent=or,e.MenubarGroup=Qn,e.MenubarItem=sr,e.MenubarLabel=ur,e.MenubarMenu=Zn,e.MenubarPortal=$n,e.MenubarRadioGroup=er,e.MenubarRadioItem=lr,e.MenubarSeparator=dr,e.MenubarShortcut=fr,e.MenubarSub=tr,e.MenubarSubContent=ar,e.MenubarSubTrigger=ir,e.MenubarTrigger=rr,e.MobileDialogContent=Qs,e.NativeSelect=ws,e.NavigationMenu=pr,e.NavigationMenuContent=vr,e.NavigationMenuIndicator=xr,e.NavigationMenuItem=hr,e.NavigationMenuLink=yr,e.NavigationMenuList=mr,e.NavigationMenuTrigger=_r,e.NavigationMenuViewport=br,e.NavigationOverlay=As,e.Pagination=Sr,e.PaginationContent=Cr,e.PaginationEllipsis=Or,e.PaginationItem=wr,e.PaginationLink=Tr,e.PaginationNext=Dr,e.PaginationPrevious=Er,e.Popover=kr,e.PopoverContent=jr,e.PopoverTrigger=Ar,e.Progress=Mr,e.RadioGroup=Nr,e.RadioGroupItem=Pr,e.RecordTitleChip=Gs,e.RefreshIndicator=Js,e.RelatedCountStore=Rc,e.ResizableHandle=Lr,e.ResizablePanel=Ir,e.ResizablePanelGroup=Fr,e.ScrollArea=Rr,e.ScrollBar=zr,e.SectionHeader=Yo,e.Select=G,e.SelectContent=J,e.SelectGroup=Br,e.SelectItem=Y,e.SelectLabel=Ur,e.SelectScrollDownButton=Hr,e.SelectScrollUpButton=Vr,e.SelectSeparator=Wr,e.SelectTrigger=q,e.SelectValue=K,e.Separator=Gr,e.ShareDialog=zl,e.Sheet=Kr,e.SheetClose=Jr,e.SheetContent=Qr,e.SheetDescription=ni,e.SheetFooter=ei,e.SheetHeader=$r,e.SheetOverlay=Xr,e.SheetPortal=Yr,e.SheetTitle=ti,e.SheetTrigger=qr,e.ShimmerSkeleton=Vs,e.Sidebar=vi,e.SidebarContent=Ei,e.SidebarFooter=wi,e.SidebarGroup=Di,e.SidebarGroupAction=ki,e.SidebarGroupContent=Ai,e.SidebarGroupLabel=Oi,e.SidebarHeader=Ci,e.SidebarInput=Si,e.SidebarInset=xi,e.SidebarMenu=ji,e.SidebarMenuAction=Fi,e.SidebarMenuBadge=Ii,e.SidebarMenuButton=Pi,e.SidebarMenuItem=Mi,e.SidebarMenuSkeleton=Li,e.SidebarMenuSub=Ri,e.SidebarMenuSubButton=Bi,e.SidebarMenuSubItem=zi,e.SidebarProvider=_i,e.SidebarRail=bi,e.SidebarSeparator=Ti,e.SidebarTrigger=yi,e.Skeleton=X,e.Slider=Vi,e.SortBuilder=qo,e.Spinner=js,e.Switch=Ui,e.Table=Wi,e.TableBody=Ki,e.TableCaption=Zi,e.TableCell=Xi,e.TableFooter=qi,e.TableHead=Yi,e.TableHeader=Gi,e.TableRow=Ji,e.Tabs=Qi,e.TabsContent=ta,e.TabsList=$i,e.TabsTrigger=ea,e.Textarea=na,e.Toaster=Hi,e.Toggle=ia,e.ToggleGroup=oa,e.ToggleGroupItem=sa,e.Tooltip=oi,e.TooltipContent=ci,e.TooltipProvider=ai,e.TooltipTrigger=si,e.TypographyBlockquote=pa,e.TypographyH1=ca,e.TypographyH2=la,e.TypographyH3=ua,e.TypographyH4=da,e.TypographyInlineCode=ha,e.TypographyLarge=_a,e.TypographyLead=ga,e.TypographyList=ma,e.TypographyMuted=ya,e.TypographyP=fa,e.TypographySmall=va,e.ViewSkeleton=Bs,e.badgeVariants=Ue,e.buttonGroupVariants=Co,e.buttonVariants=Te,e.cn=R,Object.defineProperty(e,"cva",{enumerable:!0,get:function(){return d.cva}}),e.getLazyIcon=Oa,e.initializeComponents=Vl,e.navigationMenuTriggerStyle=gr,e.registerPlaceholders=yl,e.renderChildren=z,e.toKebabIconName=wa,e.toast=P.toast,e.toggleVariants=ra,e.useConfigDraft=bl,e.useExportJob=wl,e.useFormField=Ln,e.useIsMobile=ii,e.useRelatedCount=Lc,e.useResizeObserver=xl,e.useSidebar=gi});
|