@object-ui/console 3.4.0 → 4.0.1

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.
Files changed (46) hide show
  1. package/dist/assets/{AppManagementPage-CLr3paaF.js → AppManagementPage-Da4DphqI.js} +1 -1
  2. package/dist/assets/{ConsoleFloatingChatbot-C_ClJ2NU.js → ConsoleFloatingChatbot-BWbRwcSc.js} +1 -1
  3. package/dist/assets/DashboardView-l8ACItY-.js +1 -0
  4. package/dist/assets/{MetadataDetailPage-C1sWJhl2.js → MetadataDetailPage-D7yDeoSe.js} +1 -1
  5. package/dist/assets/{MetadataFormDialog-Cje6P_Wf.js → MetadataFormDialog-CSuCo9Qt.js} +1 -1
  6. package/dist/assets/MetadataManagerPage-DJ2ZjoVP.js +1 -0
  7. package/dist/assets/{PageView-DZHuurne.js → PageView-CJFNRux1.js} +1 -1
  8. package/dist/assets/ProfilePage-CK0mmAvw.js +1 -0
  9. package/dist/assets/RecordDetailView-BfzfI4-e.js +1 -0
  10. package/dist/assets/{ReportView-oYVEbfYq.js → ReportView-B6tHCvDV.js} +1 -1
  11. package/dist/assets/{SearchResultsPage-BjAVc5rm.js → SearchResultsPage-CDUPn8G4.js} +1 -1
  12. package/dist/assets/{SystemHubPage-D08IDX3M.js → SystemHubPage-CVOYNpyU.js} +1 -1
  13. package/dist/assets/{data-adapter-CleWpyQH.js → data-adapter-DBWF2sV-.js} +1 -1
  14. package/dist/assets/{getIcon-vBP44wSb.js → getIcon-CWhoWdFA.js} +1 -1
  15. package/dist/assets/index-BimUnPgZ.js +2 -0
  16. package/dist/assets/index-DoG5QbE6.css +2 -0
  17. package/dist/assets/{plugin-calendar-DX_UWouT.js → plugin-calendar-DBrkXKZq.js} +1 -1
  18. package/dist/assets/{plugin-charts-BvZ1cSiZ.js → plugin-charts-BHH2XtQC.js} +1 -1
  19. package/dist/assets/{plugin-chatbot-DeSEtutf.js → plugin-chatbot-Cdf-WJAv.js} +15 -15
  20. package/dist/assets/plugin-form-CKcMp4d_.js +1 -0
  21. package/dist/assets/plugin-gantt-DwFZiNye.js +1 -0
  22. package/dist/assets/plugin-grid-CQS8zk9l.js +8 -0
  23. package/dist/assets/plugin-kanban-CaM_pxR_.js +1 -0
  24. package/dist/assets/{plugin-map-B7EfyDsf.js → plugin-map-BFlwDcr7.js} +1 -1
  25. package/dist/assets/{plugin-markdown-CiHluuxA.js → plugin-markdown-PR8tBwTD.js} +1 -1
  26. package/dist/assets/{plugin-timeline-D8_YFDQQ.js → plugin-timeline-B-vzj0Pe.js} +1 -1
  27. package/dist/assets/plugin-view-djqft75T.js +1 -0
  28. package/dist/assets/plugins-views-BDVYhbx4.js +63 -0
  29. package/dist/assets/src-D1MGEpQM.js +1 -0
  30. package/dist/assets/{ui-components-BCmPcwhR.js → ui-components-3HVEceOY.js} +4 -4
  31. package/dist/assets/{ui-layout-BLl7ARoe.js → ui-layout-_xO4eFwD.js} +1 -1
  32. package/dist/index.html +3 -3
  33. package/package.json +30 -30
  34. package/dist/assets/DashboardView-CODdYLuL.js +0 -1
  35. package/dist/assets/MetadataManagerPage-DobP393N.js +0 -1
  36. package/dist/assets/ProfilePage-6u6k00rh.js +0 -1
  37. package/dist/assets/RecordDetailView-cFSCvmx3.js +0 -1
  38. package/dist/assets/index-98Lfd5ty.js +0 -2
  39. package/dist/assets/index-C162ArSl.css +0 -2
  40. package/dist/assets/plugin-form-BhbVu8jO.js +0 -1
  41. package/dist/assets/plugin-gantt-BG1WaV_b.js +0 -1
  42. package/dist/assets/plugin-grid-DwpWK0E8.js +0 -8
  43. package/dist/assets/plugin-kanban-Dzjqra5U.js +0 -1
  44. package/dist/assets/plugin-view-CXAFUa14.js +0 -1
  45. package/dist/assets/plugins-views-C5gstDGy.js +0 -63
  46. package/dist/assets/src-iMF4J4F7.js +0 -1
@@ -1 +1 @@
1
- import{n as e,r as t}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as n,t as r}from"./vendor-react-B1k2FF9f.js";import{H as i,L as a,M as o,R as s,j as c,w as l}from"./framework-CoXA0nY6.js";import{g as u,n as d,p as f}from"./vendor-zod-Dfb8LXKF.js";import{n as p}from"./vendor-ui-utils-AywTz3cM.js";import{NL as m,PL as h,nt as g}from"./ui-components-BCmPcwhR.js";import{i as _}from"./plugin-grid-DwpWK0E8.js";var v=r(),y=10080*60*1e3;function b(e){let t=e.flatMap(e=>(e.items||[]).flatMap(e=>[e.startDate,e.endDate])),n=Math.min(...t.map(e=>new Date(e).getTime())),r=Math.max(...t.map(e=>new Date(e).getTime()));return{minDate:new Date(n).toISOString().split(`T`)[0],maxDate:new Date(r).toISOString().split(`T`)[0]}}function x(e,t,n,r){let i=new Date(e).getTime(),a=new Date(t).getTime(),o=new Date(n).getTime(),s=new Date(r).getTime()-o,c=i-o,l=a-i;return{start:c/s*100,width:l/s*100}}function S(e,t){let n=new Date(e);return t===`short`?n.toLocaleDateString():t===`long`?n.toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`}):n.toISOString().split(`T`)[0]}var C=({schema:e,className:t,...n})=>{let{variant:r=`vertical`,items:i=[],dateFormat:a=`short`,onItemClick:o}=e;if(r===`vertical`)return(0,v.jsx)(O,{className:t,...n,children:i.map((e,t)=>(0,v.jsxs)(A,{className:m(e.className,o&&`cursor-pointer`),onClick:()=>o?.(e),children:[(0,v.jsx)(M,{variant:e.variant||`default`,children:e.icon&&(0,v.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,v.jsxs)(N,{children:[e.time&&(0,v.jsx)(F,{dateTime:e.time,children:S(e.time,a)}),e.title&&(0,v.jsx)(P,{children:e.title}),e.description&&(0,v.jsx)(I,{className:`line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&h(e.content)]})]},t))});if(r===`horizontal`)return(0,v.jsx)(L,{className:m(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...n,children:i.map((e,t)=>(0,v.jsxs)(R,{className:m(e.className,o&&`cursor-pointer`),onClick:()=>o?.(e),children:[(0,v.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,v.jsx)(M,{variant:e.variant||`default`,children:e.icon&&(0,v.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,v.jsxs)(`div`,{className:`mt-4 text-center`,children:[e.time&&(0,v.jsx)(F,{dateTime:e.time,children:S(e.time,a)}),e.title&&(0,v.jsx)(P,{children:e.title}),e.description&&(0,v.jsx)(I,{className:`text-center line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&h(e.content)]})]}),t<i.length-1&&(0,v.jsx)(`div`,{className:`absolute left-full w-16 border-t-2 border-gray-200 top-3`})]},t))});if(r===`gantt`){let r=b(i),s=e.minDate||r.minDate,c=e.maxDate||r.maxDate,l=e.timeScale||`month`,u=(()=>{let e=[],t=new Date(s),n=new Date(c);if(l===`month`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`})),r.setMonth(r.getMonth()+1)}else if(l===`week`){let r=new Date(t);for(;r<=n;)e.push(`Week ${Math.ceil((r.getTime()-t.getTime())/y)+1}`),r.setDate(r.getDate()+7)}else if(l===`day`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})),r.setDate(r.getDate()+1)}return e})();return(0,v.jsxs)(z,{className:m(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...n,children:[(0,v.jsxs)(B,{children:[(0,v.jsx)(V,{className:`flex items-center px-2 sm:px-4 py-2 sm:py-3`,children:(0,v.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:e.rowLabel||`Items`})}),(0,v.jsx)(H,{children:(0,v.jsx)(`div`,{className:`flex h-full`,children:u.map((e,t)=>(0,v.jsx)(`div`,{className:`flex-1 px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center`,children:e},t))})})]}),(0,v.jsx)(`div`,{children:(0,v.jsxs)(`div`,{className:`flex`,children:[(0,v.jsx)(V,{children:i.map((e,t)=>(0,v.jsx)(U,{children:(0,v.jsx)(W,{title:e.label,className:`truncate`,children:e.label})},t))}),(0,v.jsx)(H,{className:`relative`,children:i.map((e,t)=>(0,v.jsx)(U,{className:`relative`,children:(e.items||[]).map((n,r)=>{let i=x(n.startDate,n.endDate,s,c);return(0,v.jsx)(G,{start:i.start,width:i.width,variant:n.variant||`default`,onClick:()=>o?.(n,e,t,r),title:`${n.title||``}\n${S(n.startDate,a)} - ${S(n.endDate,a)}`,children:(0,v.jsx)(K,{children:n.title})},r)})},t))})]})})]})}return null};i.register(`timeline`,C,{namespace:`plugin-timeline`,label:`Timeline`,category:`data-display`,inputs:[{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],label:`Timeline Variant`,defaultValue:`vertical`},{name:`items`,type:`array`,label:`Timeline Items`,description:`For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }`},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`],label:`Date Format`,defaultValue:`short`},{name:`timeScale`,type:`enum`,enum:[`day`,`week`,`month`],label:`Time Scale (Gantt only)`,defaultValue:`month`},{name:`rowLabel`,type:`string`,label:`Row Label (Gantt only)`,defaultValue:`Items`},{name:`minDate`,type:`string`,label:`Min Date (Gantt only)`,description:`Override auto-calculated min date (YYYY-MM-DD)`},{name:`maxDate`,type:`string`,label:`Max Date (Gantt only)`,description:`Override auto-calculated max date (YYYY-MM-DD)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{variant:`vertical`,dateFormat:`short`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`,icon:`🚀`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`,icon:`🎨`},{time:`2024-03-15`,title:`Beta Release`,description:`Released beta version to testers`,variant:`warning`,icon:`⚡`},{time:`2024-04-01`,title:`Launch`,description:`Official product launch`,variant:`success`,icon:`🎉`}]},examples:{vertical:{variant:`vertical`,dateFormat:`long`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`}]},horizontal:{variant:`horizontal`,dateFormat:`short`,items:[{time:`2024-01-01`,title:`Q1`,description:`First quarter`,variant:`default`},{time:`2024-04-01`,title:`Q2`,description:`Second quarter`,variant:`info`},{time:`2024-07-01`,title:`Q3`,description:`Third quarter`,variant:`warning`},{time:`2024-10-01`,title:`Q4`,description:`Fourth quarter`,variant:`success`}]},gantt:{variant:`gantt`,dateFormat:`short`,timeScale:`month`,rowLabel:`Projects`,items:[{label:`Backend Development`,items:[{title:`API Design`,startDate:`2024-01-01`,endDate:`2024-01-31`,variant:`success`},{title:`Implementation`,startDate:`2024-02-01`,endDate:`2024-03-31`,variant:`info`}]},{label:`Frontend Development`,items:[{title:`UI Design`,startDate:`2024-01-15`,endDate:`2024-02-15`,variant:`warning`},{title:`Component Dev`,startDate:`2024-02-15`,endDate:`2024-04-15`,variant:`default`}]},{label:`Testing`,items:[{title:`QA Phase`,startDate:`2024-03-01`,endDate:`2024-04-30`,variant:`danger`}]}]}}});var w=t(n(),1),T=f({mapping:f({title:u().optional(),date:u().optional(),description:u().optional(),variant:u().optional()}).optional(),objectName:u().optional(),titleField:u().optional(),dateField:u().optional(),startDateField:u().optional(),endDateField:u().optional(),descriptionField:u().optional(),groupByField:u().optional(),colorField:u().optional(),scale:d([`hour`,`day`,`week`,`month`,`quarter`,`year`]).optional()}),E=({schema:e,dataSource:t,className:n,onRowClick:r,onItemClick:i,...o})=>{let[u,d]=(0,w.useState)([]),[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(null),[y,b]=(0,w.useState)(0),[x,S]=(0,w.useState)(null),E=e.timeline;(0,w.useEffect)(()=>{let t=T.safeParse(e);t.success||console.warn(`[ObjectTimeline] Invalid timeline configuration:`,t.error.format())},[e]);let D=c(e.bind);(0,w.useEffect)(()=>{let n=!0;return(async()=>{if(!(!t||typeof t.getObjectSchema!=`function`||!e.objectName))try{let r=await t.getObjectSchema(e.objectName);n&&S(r)}catch(e){console.warn(`Failed to fetch object def for ObjectTimeline`,e)}})(),()=>{n=!1}},[e.objectName,t]),(0,w.useEffect)(()=>{e.objectName&&!D&&!e.items&&!o.data&&(async()=>{if(!(!t||typeof t.find!=`function`||!e.objectName)){p(!0);try{let n=a(x?.fields);d(s(await t.find(e.objectName,{options:{$top:100},...n.length>0?{$expand:n}:{}})))}catch(e){console.error(e),h(e)}finally{p(!1)}}})()},[e.objectName,t,D,e.items,o.data,y,x]);let O=o.data||D||u,k=e.items;if(!k&&O&&Array.isArray(O)){let t=E?.titleField??e.mapping?.title??e.titleField??`name`,n=E?.startDateField??e.mapping?.date??e.startDateField??e.dateField??`date`,r=E?.endDateField??e.endDateField??n,i=e.mapping?.description??e.descriptionField??`description`,a=e.mapping?.variant??`variant`,o=E?.groupByField??e.groupByField,s=E?.colorField??e.colorField;k=O.map(e=>({title:e[t],time:e[n],startDate:e[n],endDate:e[r],description:e[i],variant:e[a]||`default`,...o?{group:e[o]}:{},...s?{color:e[s]}:{},_data:e}))}let{ref:A,isRefreshing:j,pullDistance:M}=_({onRefresh:(0,w.useCallback)(async()=>{b(e=>e+1)},[]),enabled:!!e.objectName&&!!t}),N=l({navigation:e.navigation,objectName:e.objectName,onRowClick:r??i}),P=E?.scale??e.scale,F={...e,items:k||[],className:n||e.className,...P?{timeScale:P}:{},onItemClick:e=>{let t=e._data||e;N.handleClick(t),i?.(t)}};return m?(0,v.jsxs)(`div`,{className:`p-4 text-red-500`,children:[`Error loading timeline: `,m.message]}):(0,v.jsxs)(`div`,{ref:A,className:`relative overflow-auto h-full min-w-0`,children:[M>0&&(0,v.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:M},children:j?`Refreshing…`:`Pull to refresh`}),(0,v.jsx)(C,{schema:F}),N.isOverlay&&(0,v.jsx)(g,{...N,title:`Timeline Item`,children:e=>(0,v.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,v.jsxs)(`div`,{className:`flex flex-col`,children:[(0,v.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,v.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},D=e({ObjectTimeline:()=>E,ObjectTimelineRenderer:()=>q,Timeline:()=>O,TimelineContent:()=>N,TimelineDescription:()=>I,TimelineGantt:()=>z,TimelineGanttBar:()=>G,TimelineGanttBarContent:()=>K,TimelineGanttGrid:()=>H,TimelineGanttHeader:()=>B,TimelineGanttLabel:()=>W,TimelineGanttRow:()=>U,TimelineGanttRowLabels:()=>V,TimelineHorizontal:()=>L,TimelineHorizontalItem:()=>R,TimelineItem:()=>A,TimelineMarker:()=>M,TimelineRenderer:()=>C,TimelineTime:()=>F,TimelineTitle:()=>P,timelineItemVariants:()=>k,timelineMarkerVariants:()=>j}),O=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`ol`,{ref:n,className:m(`relative ml-3 border-l border-gray-200`,e),...t}));O.displayName=`Timeline`;var k=p(`ml-6`,{variants:{density:{default:`mb-10`,compact:`mb-3`,comfortable:`mb-6`}},defaultVariants:{density:`default`}}),A=w.forwardRef(({className:e,density:t,...n},r)=>(0,v.jsx)(`li`,{ref:r,className:m(k({density:t}),e),...n}));A.displayName=`TimelineItem`;var j=p(`absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center`,{variants:{variant:{default:`bg-blue-200 border-blue-400`,success:`bg-emerald-200 border-emerald-500`,warning:`bg-amber-200 border-amber-500`,danger:`bg-red-200 border-red-500`,info:`bg-purple-200 border-purple-500`,todo:`bg-slate-200 border-slate-400`,"in-progress":`bg-blue-200 border-blue-500`,done:`bg-emerald-200 border-emerald-500`}},defaultVariants:{variant:`default`}}),M=w.forwardRef(({className:e,variant:t=`default`,...n},r)=>(0,v.jsx)(`div`,{ref:r,className:m(j({variant:t}),e),...n}));M.displayName=`TimelineMarker`;var N=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:e,...t}));N.displayName=`TimelineContent`;var P=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`h3`,{ref:n,className:m(`font-semibold text-lg mb-1`,e),...t}));P.displayName=`TimelineTitle`;var F=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`time`,{ref:n,className:m(`text-sm font-normal text-gray-500 mb-2 block`,e),...t}));F.displayName=`TimelineTime`;var I=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`p`,{ref:n,className:m(`text-base text-gray-700`,e),...t}));I.displayName=`TimelineDescription`;var L=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`relative flex overflow-x-auto py-8`,e),...t}));L.displayName=`TimelineHorizontal`;var R=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`flex-shrink-0 w-64 relative`,e),...t}));R.displayName=`TimelineHorizontalItem`;var z=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`relative w-full border rounded-lg overflow-hidden`,e),...t}));z.displayName=`TimelineGantt`;var B=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`flex border-b bg-gray-50`,e),...t}));B.displayName=`TimelineGanttHeader`;var V=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`w-48 border-r bg-white`,e),...t}));V.displayName=`TimelineGanttRowLabels`;var H=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`flex-1 overflow-x-auto`,e),...t}));H.displayName=`TimelineGanttGrid`;var U=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`flex items-center border-b min-h-12`,e),...t}));U.displayName=`TimelineGanttRow`;var W=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`px-4 py-2 font-medium text-sm truncate`,e),...t}));W.displayName=`TimelineGanttLabel`;var G=w.forwardRef(({className:e,start:t=0,width:n=100,variant:r=`default`,...i},a)=>(0,v.jsx)(`div`,{ref:a,className:m(`absolute h-8 rounded-md transition-colors cursor-pointer`,{default:`bg-blue-500 hover:bg-blue-600`,success:`bg-green-500 hover:bg-green-600`,warning:`bg-yellow-500 hover:bg-yellow-600`,danger:`bg-red-500 hover:bg-red-600`,info:`bg-purple-500 hover:bg-purple-600`}[r],e),style:{left:`${t}%`,width:`${n}%`},...i}));G.displayName=`TimelineGanttBar`;var K=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:m(`px-2 py-1 text-white text-xs font-medium truncate`,e),...t}));K.displayName=`TimelineGanttBarContent`;var q=({schema:e,...t})=>{let{dataSource:n}=o()||{};return(0,v.jsx)(E,{schema:e,dataSource:n,...t})};i.register(`object-timeline`,q,{namespace:`plugin-timeline`,label:`Object Timeline`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]}),i.register(`timeline`,q,{namespace:`view`,label:`Timeline View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]});export{D as t};
1
+ import{n as e,r as t}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as n,t as r}from"./vendor-react-B1k2FF9f.js";import{H as i,L as a,M as o,R as s,j as c,w as l}from"./framework-CoXA0nY6.js";import{g as u,n as d,p as f}from"./vendor-zod-Dfb8LXKF.js";import{n as p}from"./vendor-ui-utils-AywTz3cM.js";import{FL as m,PL as h,rt as g}from"./ui-components-3HVEceOY.js";import{i as _}from"./plugin-grid-CQS8zk9l.js";var v=r(),y=10080*60*1e3;function b(e){let t=e.flatMap(e=>(e.items||[]).flatMap(e=>[e.startDate,e.endDate])),n=Math.min(...t.map(e=>new Date(e).getTime())),r=Math.max(...t.map(e=>new Date(e).getTime()));return{minDate:new Date(n).toISOString().split(`T`)[0],maxDate:new Date(r).toISOString().split(`T`)[0]}}function x(e,t,n,r){let i=new Date(e).getTime(),a=new Date(t).getTime(),o=new Date(n).getTime(),s=new Date(r).getTime()-o,c=i-o,l=a-i;return{start:c/s*100,width:l/s*100}}function S(e,t){let n=new Date(e);return t===`short`?n.toLocaleDateString():t===`long`?n.toLocaleDateString(`en-US`,{year:`numeric`,month:`long`,day:`numeric`}):n.toISOString().split(`T`)[0]}var C=({schema:e,className:t,...n})=>{let{variant:r=`vertical`,items:i=[],dateFormat:a=`short`,onItemClick:o}=e;if(r===`vertical`)return(0,v.jsx)(O,{className:t,...n,children:i.map((e,t)=>(0,v.jsxs)(A,{className:h(e.className,o&&`cursor-pointer`),onClick:()=>o?.(e),children:[(0,v.jsx)(M,{variant:e.variant||`default`,children:e.icon&&(0,v.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,v.jsxs)(N,{children:[e.time&&(0,v.jsx)(F,{dateTime:e.time,children:S(e.time,a)}),e.title&&(0,v.jsx)(P,{children:e.title}),e.description&&(0,v.jsx)(I,{className:`line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&m(e.content)]})]},t))});if(r===`horizontal`)return(0,v.jsx)(L,{className:h(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...n,children:i.map((e,t)=>(0,v.jsxs)(R,{className:h(e.className,o&&`cursor-pointer`),onClick:()=>o?.(e),children:[(0,v.jsxs)(`div`,{className:`flex flex-col items-center`,children:[(0,v.jsx)(M,{variant:e.variant||`default`,children:e.icon&&(0,v.jsx)(`span`,{className:`text-xs`,children:e.icon})}),(0,v.jsxs)(`div`,{className:`mt-4 text-center`,children:[e.time&&(0,v.jsx)(F,{dateTime:e.time,children:S(e.time,a)}),e.title&&(0,v.jsx)(P,{children:e.title}),e.description&&(0,v.jsx)(I,{className:`text-center line-clamp-2 sm:line-clamp-none`,children:e.description}),e.content&&m(e.content)]})]}),t<i.length-1&&(0,v.jsx)(`div`,{className:`absolute left-full w-16 border-t-2 border-gray-200 top-3`})]},t))});if(r===`gantt`){let r=b(i),s=e.minDate||r.minDate,c=e.maxDate||r.maxDate,l=e.timeScale||`month`,u=(()=>{let e=[],t=new Date(s),n=new Date(c);if(l===`month`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,year:`numeric`})),r.setMonth(r.getMonth()+1)}else if(l===`week`){let r=new Date(t);for(;r<=n;)e.push(`Week ${Math.ceil((r.getTime()-t.getTime())/y)+1}`),r.setDate(r.getDate()+7)}else if(l===`day`){let r=new Date(t);for(;r<=n;)e.push(r.toLocaleDateString(`en-US`,{month:`short`,day:`numeric`})),r.setDate(r.getDate()+1)}return e})();return(0,v.jsxs)(z,{className:h(`overflow-x-auto [-webkit-overflow-scrolling:touch]`,t),...n,children:[(0,v.jsxs)(B,{children:[(0,v.jsx)(V,{className:`flex items-center px-2 sm:px-4 py-2 sm:py-3`,children:(0,v.jsx)(`span`,{className:`font-semibold text-xs sm:text-sm`,children:e.rowLabel||`Items`})}),(0,v.jsx)(H,{children:(0,v.jsx)(`div`,{className:`flex h-full`,children:u.map((e,t)=>(0,v.jsx)(`div`,{className:`flex-1 px-1 sm:px-2 py-2 sm:py-3 border-r text-xs font-medium text-center`,children:e},t))})})]}),(0,v.jsx)(`div`,{children:(0,v.jsxs)(`div`,{className:`flex`,children:[(0,v.jsx)(V,{children:i.map((e,t)=>(0,v.jsx)(U,{children:(0,v.jsx)(W,{title:e.label,className:`truncate`,children:e.label})},t))}),(0,v.jsx)(H,{className:`relative`,children:i.map((e,t)=>(0,v.jsx)(U,{className:`relative`,children:(e.items||[]).map((n,r)=>{let i=x(n.startDate,n.endDate,s,c);return(0,v.jsx)(G,{start:i.start,width:i.width,variant:n.variant||`default`,onClick:()=>o?.(n,e,t,r),title:`${n.title||``}\n${S(n.startDate,a)} - ${S(n.endDate,a)}`,children:(0,v.jsx)(K,{children:n.title})},r)})},t))})]})})]})}return null};i.register(`timeline`,C,{namespace:`plugin-timeline`,label:`Timeline`,category:`data-display`,inputs:[{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],label:`Timeline Variant`,defaultValue:`vertical`},{name:`items`,type:`array`,label:`Timeline Items`,description:`For vertical/horizontal: Array of { time, title, description, variant, icon, content }. For gantt: Array of { label, items: [{ title, startDate, endDate, variant }] }`},{name:`dateFormat`,type:`enum`,enum:[`short`,`long`,`iso`],label:`Date Format`,defaultValue:`short`},{name:`timeScale`,type:`enum`,enum:[`day`,`week`,`month`],label:`Time Scale (Gantt only)`,defaultValue:`month`},{name:`rowLabel`,type:`string`,label:`Row Label (Gantt only)`,defaultValue:`Items`},{name:`minDate`,type:`string`,label:`Min Date (Gantt only)`,description:`Override auto-calculated min date (YYYY-MM-DD)`},{name:`maxDate`,type:`string`,label:`Max Date (Gantt only)`,description:`Override auto-calculated max date (YYYY-MM-DD)`},{name:`className`,type:`string`,label:`CSS Class`}],defaultProps:{variant:`vertical`,dateFormat:`short`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`,icon:`🚀`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`,icon:`🎨`},{time:`2024-03-15`,title:`Beta Release`,description:`Released beta version to testers`,variant:`warning`,icon:`⚡`},{time:`2024-04-01`,title:`Launch`,description:`Official product launch`,variant:`success`,icon:`🎉`}]},examples:{vertical:{variant:`vertical`,dateFormat:`long`,items:[{time:`2024-01-15`,title:`Project Started`,description:`Kickoff meeting and initial planning`,variant:`success`},{time:`2024-02-01`,title:`First Milestone`,description:`Completed initial design phase`,variant:`info`}]},horizontal:{variant:`horizontal`,dateFormat:`short`,items:[{time:`2024-01-01`,title:`Q1`,description:`First quarter`,variant:`default`},{time:`2024-04-01`,title:`Q2`,description:`Second quarter`,variant:`info`},{time:`2024-07-01`,title:`Q3`,description:`Third quarter`,variant:`warning`},{time:`2024-10-01`,title:`Q4`,description:`Fourth quarter`,variant:`success`}]},gantt:{variant:`gantt`,dateFormat:`short`,timeScale:`month`,rowLabel:`Projects`,items:[{label:`Backend Development`,items:[{title:`API Design`,startDate:`2024-01-01`,endDate:`2024-01-31`,variant:`success`},{title:`Implementation`,startDate:`2024-02-01`,endDate:`2024-03-31`,variant:`info`}]},{label:`Frontend Development`,items:[{title:`UI Design`,startDate:`2024-01-15`,endDate:`2024-02-15`,variant:`warning`},{title:`Component Dev`,startDate:`2024-02-15`,endDate:`2024-04-15`,variant:`default`}]},{label:`Testing`,items:[{title:`QA Phase`,startDate:`2024-03-01`,endDate:`2024-04-30`,variant:`danger`}]}]}}});var w=t(n(),1),T=f({mapping:f({title:u().optional(),date:u().optional(),description:u().optional(),variant:u().optional()}).optional(),objectName:u().optional(),titleField:u().optional(),dateField:u().optional(),startDateField:u().optional(),endDateField:u().optional(),descriptionField:u().optional(),groupByField:u().optional(),colorField:u().optional(),scale:d([`hour`,`day`,`week`,`month`,`quarter`,`year`]).optional()}),E=({schema:e,dataSource:t,className:n,onRowClick:r,onItemClick:i,...o})=>{let[u,d]=(0,w.useState)([]),[f,p]=(0,w.useState)(!1),[m,h]=(0,w.useState)(null),[y,b]=(0,w.useState)(0),[x,S]=(0,w.useState)(null),E=e.timeline;(0,w.useEffect)(()=>{let t=T.safeParse(e);t.success||console.warn(`[ObjectTimeline] Invalid timeline configuration:`,t.error.format())},[e]);let D=c(e.bind);(0,w.useEffect)(()=>{let n=!0;return(async()=>{if(!(!t||typeof t.getObjectSchema!=`function`||!e.objectName))try{let r=await t.getObjectSchema(e.objectName);n&&S(r)}catch(e){console.warn(`Failed to fetch object def for ObjectTimeline`,e)}})(),()=>{n=!1}},[e.objectName,t]),(0,w.useEffect)(()=>{e.objectName&&!D&&!e.items&&!o.data&&(async()=>{if(!(!t||typeof t.find!=`function`||!e.objectName)){p(!0);try{let n=a(x?.fields);d(s(await t.find(e.objectName,{options:{$top:100},...n.length>0?{$expand:n}:{}})))}catch(e){console.error(e),h(e)}finally{p(!1)}}})()},[e.objectName,t,D,e.items,o.data,y,x]);let O=o.data||D||u,k=e.items;if(!k&&O&&Array.isArray(O)){let t=E?.titleField??e.mapping?.title??e.titleField??`name`,n=E?.startDateField??e.mapping?.date??e.startDateField??e.dateField??`date`,r=E?.endDateField??e.endDateField??n,i=e.mapping?.description??e.descriptionField??`description`,a=e.mapping?.variant??`variant`,o=E?.groupByField??e.groupByField,s=E?.colorField??e.colorField;k=O.map(e=>({title:e[t],time:e[n],startDate:e[n],endDate:e[r],description:e[i],variant:e[a]||`default`,...o?{group:e[o]}:{},...s?{color:e[s]}:{},_data:e}))}let{ref:A,isRefreshing:j,pullDistance:M}=_({onRefresh:(0,w.useCallback)(async()=>{b(e=>e+1)},[]),enabled:!!e.objectName&&!!t}),N=l({navigation:e.navigation,objectName:e.objectName,onRowClick:r??i}),P=E?.scale??e.scale,F={...e,items:k||[],className:n||e.className,...P?{timeScale:P}:{},onItemClick:e=>{let t=e._data||e;N.handleClick(t),i?.(t)}};return m?(0,v.jsxs)(`div`,{className:`p-4 text-red-500`,children:[`Error loading timeline: `,m.message]}):(0,v.jsxs)(`div`,{ref:A,className:`relative overflow-auto h-full min-w-0`,children:[M>0&&(0,v.jsx)(`div`,{className:`flex items-center justify-center text-xs text-muted-foreground`,style:{height:M},children:j?`Refreshing…`:`Pull to refresh`}),(0,v.jsx)(C,{schema:F}),N.isOverlay&&(0,v.jsx)(g,{...N,title:`Timeline Item`,children:e=>(0,v.jsx)(`div`,{className:`space-y-3`,children:Object.entries(e).map(([e,t])=>(0,v.jsxs)(`div`,{className:`flex flex-col`,children:[(0,v.jsx)(`span`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wide`,children:e.replace(/_/g,` `)}),(0,v.jsx)(`span`,{className:`text-sm`,children:String(t??`—`)})]},e))})})]})},D=e({ObjectTimeline:()=>E,ObjectTimelineRenderer:()=>q,Timeline:()=>O,TimelineContent:()=>N,TimelineDescription:()=>I,TimelineGantt:()=>z,TimelineGanttBar:()=>G,TimelineGanttBarContent:()=>K,TimelineGanttGrid:()=>H,TimelineGanttHeader:()=>B,TimelineGanttLabel:()=>W,TimelineGanttRow:()=>U,TimelineGanttRowLabels:()=>V,TimelineHorizontal:()=>L,TimelineHorizontalItem:()=>R,TimelineItem:()=>A,TimelineMarker:()=>M,TimelineRenderer:()=>C,TimelineTime:()=>F,TimelineTitle:()=>P,timelineItemVariants:()=>k,timelineMarkerVariants:()=>j}),O=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`ol`,{ref:n,className:h(`relative ml-3 border-l border-gray-200`,e),...t}));O.displayName=`Timeline`;var k=p(`ml-6`,{variants:{density:{default:`mb-10`,compact:`mb-3`,comfortable:`mb-6`}},defaultVariants:{density:`default`}}),A=w.forwardRef(({className:e,density:t,...n},r)=>(0,v.jsx)(`li`,{ref:r,className:h(k({density:t}),e),...n}));A.displayName=`TimelineItem`;var j=p(`absolute -left-3 w-6 h-6 rounded-full border-2 flex items-center justify-center`,{variants:{variant:{default:`bg-blue-200 border-blue-400`,success:`bg-emerald-200 border-emerald-500`,warning:`bg-amber-200 border-amber-500`,danger:`bg-red-200 border-red-500`,info:`bg-purple-200 border-purple-500`,todo:`bg-slate-200 border-slate-400`,"in-progress":`bg-blue-200 border-blue-500`,done:`bg-emerald-200 border-emerald-500`}},defaultVariants:{variant:`default`}}),M=w.forwardRef(({className:e,variant:t=`default`,...n},r)=>(0,v.jsx)(`div`,{ref:r,className:h(j({variant:t}),e),...n}));M.displayName=`TimelineMarker`;var N=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:e,...t}));N.displayName=`TimelineContent`;var P=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`h3`,{ref:n,className:h(`font-semibold text-lg mb-1`,e),...t}));P.displayName=`TimelineTitle`;var F=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`time`,{ref:n,className:h(`text-sm font-normal text-gray-500 mb-2 block`,e),...t}));F.displayName=`TimelineTime`;var I=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`p`,{ref:n,className:h(`text-base text-gray-700`,e),...t}));I.displayName=`TimelineDescription`;var L=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`relative flex overflow-x-auto py-8`,e),...t}));L.displayName=`TimelineHorizontal`;var R=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`flex-shrink-0 w-64 relative`,e),...t}));R.displayName=`TimelineHorizontalItem`;var z=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`relative w-full border rounded-lg overflow-hidden`,e),...t}));z.displayName=`TimelineGantt`;var B=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`flex border-b bg-gray-50`,e),...t}));B.displayName=`TimelineGanttHeader`;var V=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`w-48 border-r bg-white`,e),...t}));V.displayName=`TimelineGanttRowLabels`;var H=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`flex-1 overflow-x-auto`,e),...t}));H.displayName=`TimelineGanttGrid`;var U=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`flex items-center border-b min-h-12`,e),...t}));U.displayName=`TimelineGanttRow`;var W=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`px-4 py-2 font-medium text-sm truncate`,e),...t}));W.displayName=`TimelineGanttLabel`;var G=w.forwardRef(({className:e,start:t=0,width:n=100,variant:r=`default`,...i},a)=>(0,v.jsx)(`div`,{ref:a,className:h(`absolute h-8 rounded-md transition-colors cursor-pointer`,{default:`bg-blue-500 hover:bg-blue-600`,success:`bg-green-500 hover:bg-green-600`,warning:`bg-yellow-500 hover:bg-yellow-600`,danger:`bg-red-500 hover:bg-red-600`,info:`bg-purple-500 hover:bg-purple-600`}[r],e),style:{left:`${t}%`,width:`${n}%`},...i}));G.displayName=`TimelineGanttBar`;var K=w.forwardRef(({className:e,...t},n)=>(0,v.jsx)(`div`,{ref:n,className:h(`px-2 py-1 text-white text-xs font-medium truncate`,e),...t}));K.displayName=`TimelineGanttBarContent`;var q=({schema:e,...t})=>{let{dataSource:n}=o()||{};return(0,v.jsx)(E,{schema:e,dataSource:n,...t})};i.register(`object-timeline`,q,{namespace:`plugin-timeline`,label:`Object Timeline`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]}),i.register(`timeline`,q,{namespace:`view`,label:`Timeline View`,category:`view`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`variant`,type:`enum`,enum:[`vertical`,`horizontal`,`gantt`],defaultValue:`vertical`}]});export{D as t};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{_ as t,t as n}from"./vendor-react-B1k2FF9f.js";import{D as r,H as i,L as a,k as o}from"./framework-CoXA0nY6.js";import{n as s}from"./vendor-ui-utils-AywTz3cM.js";import{$t as c,An as l,BF as u,Bt as d,CE as f,Cd as p,Cm as m,Cn as h,Dn as g,En as _,FS as v,Fn as y,Gn as b,Ht as x,Jm as S,Jn as ee,Kn as C,Mn as w,Ms as T,Nn as te,OL as E,Ol as D,On as ne,PL as O,Pn as re,Py as ie,Qn as k,Qt as ae,RS as A,Rd as oe,Sn as j,Td as se,Tn as ce,Tu as M,Ty as le,Un as ue,Vr as N,Vt as P,Wn as de,XS as fe,_t as pe,ar as F,bd as I,bn as L,br as R,cE as z,cT as B,cn as me,dn as V,dt as H,en as U,fI as he,ff as ge,fn as _e,gn as W,gt as G,hc as K,jn as ve,kn as ye,kv as q,ln as be,lt as xe,mM as Se,mn as Ce,mo as we,mt as Te,nO as Ee,nn as De,pj as Oe,pn as ke,px as Ae,py as je,qn as Me,rj as Ne,rt as Pe,tn as Fe,tt as Ie,uE as Le,um as Re,un as ze,ut as Be,vn as Ve,wn as He,wt as Ue,xm as We,xn as Ge,yb as Ke,yn as qe,yr as J,zt as Je}from"./ui-components-3HVEceOY.js";import{a as Ye,f as Xe,g as Ze,h as Qe,i as $e,l as et,m as tt,n as nt,o as rt,r as it,s as at,t as ot,u as st}from"./vendor-dndkit-BGB4qgc3.js";import{n as ct}from"./plugin-grid-CQS8zk9l.js";import{t as lt}from"./plugin-form-CKcMp4d_.js";var Y=e(t(),1),X=n(),ut={list:`List`,detail:`Detail`,grid:`Grid`,kanban:`Kanban`,calendar:`Calendar`,timeline:`Timeline`,map:`Map`,gallery:`Gallery`,gantt:`Gantt`},dt={list:le,detail:B,grid:A,kanban:Ke,calendar:Se,timeline:E,map:q,gallery:Ae,gantt:D},ft=s(`flex gap-4`,{variants:{position:{top:`flex-col`,bottom:`flex-col-reverse`,left:`flex-row`,right:`flex-row-reverse`}},defaultVariants:{position:`top`}}),pt=s(`w-full`,{variants:{orientation:{horizontal:`w-full`,vertical:`w-48`}},defaultVariants:{orientation:`horizontal`}}),mt=s(`flex gap-2`,{variants:{orientation:{horizontal:`flex-row flex-wrap`,vertical:`flex-col`}},defaultVariants:{orientation:`horizontal`}}),ht=s(``,{variants:{orientation:{horizontal:``,vertical:`flex h-auto flex-col items-stretch`}},defaultVariants:{orientation:`horizontal`}});function gt(e){return e.split(`-`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(``)}var _t={Home:`House`};function vt(e){if(!e)return null;let t=gt(e);return R[_t[t]||t]||null}function yt(e){return e.label?e.label:ut[e.type]||e.type}function bt(e){return e.icon?vt(e.icon):dt[e.type]||null}function xt(e){return e.activeView?e.activeView:e.defaultView?e.defaultView:e.views?.[0]?.type}var St={share:I,settings:p,duplicate:Ee,delete:we},Ct={share:`Share`,settings:`Settings`,duplicate:`Duplicate`,delete:`Delete`},wt=({schema:e,className:t,onViewChange:n,onCreateView:i,onViewAction:a,createViewLabel:o=`Create view`,...s})=>{let l=Y.useMemo(()=>e.storageKey?e.storageKey:`view-switcher${e.id?`-${e.id}`:``}`,[e.id,e.storageKey]),[u,d]=Y.useState(()=>xt(e));Y.useEffect(()=>{if(e.activeView){d(e.activeView);return}if(e.persistPreference)try{let t=localStorage.getItem(l);if(t){let n=e.views.find(e=>e.type===t)?.type;n&&d(n)}}catch{}},[e.activeView,e.persistPreference,e.views,l]),Y.useEffect(()=>{if(!(!e.persistPreference||!u||e.activeView))try{localStorage.setItem(l,u)}catch{}},[u,e.activeView,e.persistPreference,l]);let f=Y.useCallback(t=>{n?.(t),e.onViewChange&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(e.onViewChange,{detail:{view:t}}))},[n,e.onViewChange]),p=Y.useCallback(e=>{d(e),f(e)},[f]),m=u||e.views?.[0]?.type,h=m||``,g=e.views.find(e=>e.type===m)||e.views?.[0],_=e.variant||`tabs`,v=e.position||`top`,y=v===`left`||v===`right`,b=y?`vertical`:`horizontal`,x=e.viewActions&&e.viewActions.length>0?(0,X.jsx)(`div`,{className:`flex items-center gap-1`,children:e.viewActions.map((e,t)=>{let n=e.icon&&vt(e.icon)||St[e.type];return(0,X.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>a?.(e.type,m),title:Ct[e.type]||e.type,children:n?(0,X.jsx)(n,{className:`h-3.5 w-3.5`}):null},`action-${e.type}-${t}`)})}):null,S=e.allowCreateView?(0,X.jsx)(J,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>i?.(),title:o,children:(0,X.jsx)(Re,{className:`h-3.5 w-3.5`})}):null,ee=(0,X.jsxs)(`div`,{className:O(pt({orientation:b}),`flex items-center gap-1`),children:[_===`dropdown`&&(0,X.jsxs)(ae,{value:h,onValueChange:e=>p(e),children:[(0,X.jsx)(Fe,{className:O(`w-full`,y?`h-10`:`h-9`),children:(0,X.jsx)(De,{placeholder:`Select view`})}),(0,X.jsx)(c,{children:e.views.map((e,t)=>(0,X.jsx)(U,{value:e.type,children:yt(e)},`${e.type}-${t}`))})]}),_===`buttons`&&(0,X.jsx)(`div`,{className:O(mt({orientation:b})),children:e.views.map((e,t)=>{let n=e.type===m,r=bt(e);return(0,X.jsxs)(J,{type:`button`,size:`sm`,variant:n?`secondary`:`ghost`,className:O(`justify-start gap-2`,y?`w-full`:``),onClick:()=>p(e.type),children:[r?(0,X.jsx)(r,{className:`h-4 w-4`}):null,(0,X.jsx)(`span`,{children:yt(e)})]},`${e.type}-${t}`)})}),_===`tabs`&&(0,X.jsx)(Te,{value:h,onValueChange:e=>p(e),children:(0,X.jsx)(G,{className:O(ht({orientation:b})),children:e.views.map((e,t)=>{let n=bt(e);return(0,X.jsxs)(pe,{value:e.type,className:O(`gap-2`,y?`justify-start`:``),children:[n?(0,X.jsx)(n,{className:`h-4 w-4`}):null,(0,X.jsx)(`span`,{children:yt(e)})]},`${e.type}-${t}`)})})}),x,S]}),C=g?.schema?Array.isArray(g.schema)?(0,X.jsx)(`div`,{className:`space-y-4`,children:g.schema.map((e,t)=>(0,X.jsx)(r,{schema:e,...s},`${g.type}-${t}`))}):(0,X.jsx)(r,{schema:g.schema,...s}):null;return(0,X.jsxs)(`div`,{className:O(ft({position:v}),t),children:[(0,X.jsx)(`div`,{className:O(`shrink-0`,y?`flex flex-col`:`flex`),children:ee}),(0,X.jsx)(`div`,{className:`flex-1 min-w-0`,children:C})]})},Tt=r,Et=({schema:e,dataSource:t,className:n,views:r,activeViewId:i,onViewChange:o,onRowClick:s,onEdit:c,renderListView:l,toolbarAddon:u,onCreateView:d,onViewAction:f})=>{let[p,m]=(0,Y.useState)(null),v=(0,Y.useRef)(null);v.current=p;let[y,x]=(0,Y.useState)(!1),[S,C]=(0,Y.useState)(`create`),[w,T]=(0,Y.useState)(null),[te,E]=(0,Y.useState)(0);(0,Y.useEffect)(()=>{if(!(!t?.onMutation||!e.objectName)&&!l)return t.onMutation(t=>{t.resource===e.objectName&&E(e=>e+1)})},[t,e.objectName,l]);let[D,ne]=(0,Y.useState)([]),[re,ie]=(0,Y.useState)(!1),[k,ae]=(0,Y.useState)({}),[A,oe]=(0,Y.useState)([]),j=e.listViews,se=j!=null&&Object.keys(j).length>0,[M,le]=(0,Y.useState)(()=>e.defaultListView&&j?.[e.defaultListView]?e.defaultListView:j&&Object.keys(j)[0]||``),N=(0,Y.useMemo)(()=>!se||!M?null:j[M]||null,[se,M,j]),P=(0,Y.useMemo)(()=>r&&r.length>0?r:null,[r]),fe=P!=null&&P.length>0,F=i||P?.[0]?.id,I=P?.find(e=>e.id===F)||P?.[0],L=(0,Y.useMemo)(()=>N?.type?N.type:I?.type?I.type:e.defaultViewType||`grid`,[N,I,e.defaultViewType]),R=e.navigation;(0,Y.useEffect)(()=>{let n=!0;return e.objectName&&t&&(async()=>{try{let r=await t.getObjectSchema(e.objectName);n&&m(r)}catch(e){console.error(`Failed to fetch object schema:`,e)}})(),()=>{n=!1}},[e.objectName,t]),(0,Y.useEffect)(()=>{let n=!0;return(async()=>{if(!l&&L!==`grid`&&!(!t||!e.objectName)){ie(!0);try{let r=N?.filter||I?.filter||e.table?.defaultFilters||[],i=Object.entries(k).filter(([,e])=>e!==void 0&&e!==``&&e!==null).map(([e,t])=>[e,`=`,t]),o=[];o=r.length>0&&i.length>0?[`and`,...r,...i]:i.length===1?i[0]:i.length>1?[`and`,...i]:r;let s=A.length>0?A.map(e=>({field:e.field,order:e.direction})):N?.sort||I?.sort||e.table?.defaultSort||void 0,c=a(v.current?.fields),l=await t.find(e.objectName,{$filter:o.length>0?o:void 0,$orderby:s,$top:100,...c.length>0?{$expand:c}:{}}),u=[];Array.isArray(l)?u=l:l&&typeof l==`object`&&(Array.isArray(l.data)?u=l.data:Array.isArray(l.records)?u=l.records:Array.isArray(l.value)&&(u=l.value)),n&&ne(u)}catch(e){console.error(`ObjectView data fetch error:`,e)}finally{n&&ie(!1)}}})(),()=>{n=!1}},[e.objectName,t,L,k,A,te,N,I,l]);let z=e.layout||`drawer`,B=e.operations||e.table?.operations||{create:!0,read:!0,update:!0,delete:!0},me=(0,Y.useCallback)(()=>{z===`page`&&e.onNavigate?e.onNavigate(`new`,`edit`):(C(`create`),T(null),x(!0))},[z,e]),V=(0,Y.useCallback)(t=>{if(c){c(t);return}if(z===`page`&&e.onNavigate){let n=t.id||t._id;e.onNavigate(n,`edit`)}else C(`edit`),T(t),x(!0)},[z,e,c]),H=(0,Y.useCallback)(t=>{if(z===`page`&&e.onNavigate){let n=t.id||t._id;e.onNavigate(n,`view`)}else C(`view`),T(t),x(!0)},[z,e]),U=(0,Y.useCallback)(t=>{if(s){s(t);return}if(R){if(R.mode===`none`||R.preventNavigation)return;if(R.mode===`new_window`||R.openNewTab){let n=t.id||t._id,r=`/${e.objectName}/${encodeURIComponent(String(n))}`;window.open(r,`_blank`);return}if(R.mode===`drawer`){C(`view`),T(t),x(!0);return}if(R.mode===`modal`){C(`view`),T(t),x(!0);return}if(R.mode===`page`){let n=t.id||t._id;e.onNavigate&&e.onNavigate(n,`view`);return}if(R.mode===`split`||R.mode===`popover`){C(`view`),T(t),x(!0);return}}B.read!==!1&&H(t)},[s,R,B.read,H,e]),he=(0,Y.useCallback)(e=>{E(e=>e+1)},[]),ge=(0,Y.useCallback)(e=>{E(e=>e+1)},[]),_e=(0,Y.useCallback)(()=>{x(!1),T(null),E(e=>e+1)},[]),W=(0,Y.useCallback)(()=>{x(!1),T(null)},[]);(0,Y.useCallback)(()=>{E(e=>e+1)},[]);let K=(0,Y.useMemo)(()=>!fe||!P||P.length<=1?null:{type:`view-switcher`,variant:`tabs`,position:`top`,persistPreference:!0,storageKey:`view-pref-${e.objectName}`,defaultView:I?.type||`grid`,activeView:I?.type||`grid`,views:P.map(e=>({type:e.type,label:e.label,icon:{kanban:`kanban`,calendar:`calendar`,map:`map`,gallery:`layout-grid`,timeline:`activity`,gantt:`gantt-chart`,grid:`table`,list:`list`,detail:`file-text`}[e.type]||`table`})),allowCreateView:e.allowCreateView,viewActions:e.viewActions},[fe,P,I,e.objectName,e.allowCreateView,e.viewActions]),ve=(0,Y.useCallback)(e=>{if(!P)return;let t=P.find(t=>t.type===e);t&&o&&o(t.id)},[P,o]),ye=(0,Y.useCallback)(e=>{le(e)},[]);(0,Y.useMemo)(()=>{if(e.showFilters===!1)return null;let t=e.filterableFields,n=p?.fields||{},r=(t?t.map(e=>[e,n[e]||{label:e}]):Object.entries(n).filter(([,e])=>!e.hidden).slice(0,8)).map(([e,t])=>{let n=t.type||`text`,r=`text`,i;return n===`number`||n===`currency`||n===`percent`?r=`number`:n===`boolean`||n===`toggle`?r=`boolean`:n===`date`||n===`datetime`?r=`date`:n===`select`||n===`status`||t.options?(r=`select`,i=(t.options||[]).map(e=>typeof e==`string`?{label:e,value:e}:{label:e.label,value:e.value})):(n===`lookup`||n===`master_detail`||n===`user`||n===`owner`)&&t.options&&t.options.length>0&&(r=`multi-select`,i=(t.options||[]).map(e=>typeof e==`string`?{label:e,value:e}:{label:e.label,value:e.value})),{field:e,label:t.label||e,type:r,placeholder:`Filter ${t.label||e}...`,...i?{options:i}:{}}});return r.length===0?null:{type:`filter-ui`,layout:`popover`,showClear:!0,showApply:!0,filters:r,values:k}},[e.showFilters,e.filterableFields,p,k]);let q=e.showSort;(0,Y.useMemo)(()=>{if(q===!1)return null;let e=p?.fields||{},t=Object.entries(e).filter(([,e])=>!e.hidden).slice(0,10).map(([e,t])=>({field:e,label:t.label||e}));return t.length===0?null:{type:`sort-ui`,variant:`dropdown`,multiple:!1,fields:t,sort:A}},[p,A,q]);let be=(0,Y.useCallback)(t=>{let n={objectName:e.objectName,fields:N?.columns||I?.columns||e.table?.fields,className:`h-full w-full`,showSearch:I?.showSearch??e.showSearch??!1,showSort:I?.showSort??e.showSort??!1,showFilters:I?.showFilters??e.showFilters??!1,striped:I?.striped??!1,bordered:I?.bordered??!1,color:I?.color},r=N?.options||I||{};switch(t){case`kanban`:return{type:`object-kanban`,...n,groupBy:r.kanban?.groupField||`status`,groupField:r.kanban?.groupField||`status`,titleField:r.kanban?.titleField||`name`,cardFields:n.fields||[],...r.kanban||{}};case`calendar`:return{type:`object-calendar`,...n,startDateField:r.calendar?.startDateField||`start_date`,endDateField:r.calendar?.endDateField||`end_date`,titleField:r.calendar?.titleField||`name`,...r.calendar||{}};case`gallery`:return{type:`object-gallery`,...n,imageField:r.gallery?.imageField,titleField:r.gallery?.titleField||`name`,subtitleField:r.gallery?.subtitleField,...r.gallery||{}};case`timeline`:return{type:`object-timeline`,...n,dateField:r.timeline?.dateField||`created_at`,titleField:r.timeline?.titleField||`name`,...r.timeline||{}};case`gantt`:return{type:`object-gantt`,...n,startDateField:r.gantt?.startDateField||`start_date`,endDateField:r.gantt?.endDateField||`end_date`,progressField:r.gantt?.progressField||`progress`,dependenciesField:r.gantt?.dependenciesField||`dependencies`,...r.gantt||{}};case`map`:return{type:`object-map`,...n,locationField:r.map?.locationField||`location`,...r.map||{}};default:return null}},[e.objectName,e.table?.fields,N,I]),xe=(0,Y.useMemo)(()=>({type:`object-grid`,objectName:e.objectName,title:e.table?.title,description:e.table?.description,fields:N?.columns||I?.columns||e.table?.fields,columns:N?.columns||I?.columns||e.table?.columns,operations:{...B,create:!1},defaultFilters:N?.filter||I?.filter||e.table?.defaultFilters,defaultSort:N?.sort||I?.sort||e.table?.defaultSort,pageSize:e.table?.pageSize,selectable:e.table?.selectable,striped:I?.striped??e.table?.striped,bordered:I?.bordered??e.table?.bordered,className:e.table?.className}),[e,B,N,I]),Se=()=>{let t=w?w.id||w._id:void 0;return{type:`object-form`,objectName:e.objectName,mode:S,recordId:t,title:e.form?.title,description:e.form?.description,fields:e.form?.fields,customFields:e.form?.customFields,groups:e.form?.groups,layout:e.form?.layout,columns:e.form?.columns,showSubmit:e.form?.showSubmit,submitText:e.form?.submitText,showCancel:e.form?.showCancel,cancelText:e.form?.cancelText,showReset:e.form?.showReset,initialValues:e.form?.initialValues,readOnly:e.form?.readOnly||S===`view`,className:e.form?.className,onSuccess:_e,onCancel:W}},Ce=()=>{if(e.form?.title)return e.form.title;let t=p?.label||e.objectName;switch(S){case`create`:return`Create ${t}`;case`edit`:return`Edit ${t}`;case`view`:return`View ${t}`;default:return t}},we=(0,Y.useMemo)(()=>{let e=R?.width;return e?typeof e==`number`?`max-w-[${e}px]`:`max-w-[${e}]`:``},[R]),Ee=()=>(0,X.jsx)(h,{open:y,onOpenChange:x,direction:`right`,children:(0,X.jsxs)(He,{className:O(`w-full sm:max-w-2xl`,we),children:[(0,X.jsxs)(_,{children:[(0,X.jsx)(g,{children:Ce()}),e.form?.description&&(0,X.jsx)(ce,{children:e.form.description})]}),(0,X.jsx)(`div`,{className:`flex-1 overflow-y-auto px-4 pb-4`,children:(0,X.jsx)(lt,{schema:Se(),dataSource:t})})]})}),De=()=>(0,X.jsx)(ue,{open:y,onOpenChange:x,children:(0,X.jsxs)(de,{className:O(`max-w-2xl max-h-[90vh] overflow-y-auto`,we),children:[(0,X.jsxs)(Me,{children:[(0,X.jsx)(ee,{children:Ce()}),e.form?.description&&(0,X.jsx)(b,{children:e.form.description})]}),(0,X.jsx)(lt,{schema:Se(),dataSource:t})]})}),Oe=(0,Y.useMemo)(()=>Object.keys(k).some(e=>k[e]!==void 0&&k[e]!==``&&k[e]!==null)?Object.entries(k).filter(([,e])=>e!==void 0&&e!==``&&e!==null).map(([e,t])=>({field:e,operator:`equals`,value:t})):N?.filter||I?.filter||e.table?.defaultFilters,[k,N,I,e.table?.defaultFilters]),ke=(0,Y.useMemo)(()=>A.length>0?A:N?.sort||I?.sort||e.table?.defaultSort,[A,N,I,e.table?.defaultSort]),Ae=()=>{let n=`${e.objectName}-${M||I?.id||`default`}-${L}-${te}`;if(l)return l({schema:{type:`list-view`,objectName:e.objectName,viewType:L,fields:N?.columns||I?.columns||e.table?.fields,filters:Oe,sort:ke,rowHeight:I?.rowHeight,densityMode:I?.densityMode,groupBy:I?.groupBy,groupBy2:I?.groupBy2,grouping:I?.grouping,options:N?.options||I,showSearch:I?.showSearch??e.showSearch,showFilters:I?.showFilters??e.showFilters,showSort:I?.showSort??e.showSort,showHideFields:I?.showHideFields??e.showHideFields,showGroup:I?.showGroup??e.showGroup,showColor:I?.showColor??e.showColor,showDensity:I?.showDensity??e.showDensity,allowExport:I?.allowExport??e.allowExport,striped:I?.striped??e.striped,bordered:I?.bordered??e.bordered,color:I?.color??e.color,inlineEdit:I?.inlineEdit??e.inlineEdit,wrapHeaders:I?.wrapHeaders??e.wrapHeaders,clickIntoRecordDetails:I?.clickIntoRecordDetails??e.clickIntoRecordDetails,addRecordViaForm:I?.addRecordViaForm??e.addRecordViaForm,addDeleteRecordsInline:I?.addDeleteRecordsInline??e.addDeleteRecordsInline,collapseAllByDefault:I?.collapseAllByDefault??e.collapseAllByDefault,fieldTextColor:I?.fieldTextColor??e.fieldTextColor,prefixField:I?.prefixField??e.prefixField,showDescription:I?.showDescription??e.showDescription,navigation:I?.navigation??e.navigation,selection:I?.selection??e.selection,pagination:I?.pagination??e.pagination,searchableFields:I?.searchableFields??e.searchableFields,filterableFields:I?.filterableFields??e.filterableFields,resizable:I?.resizable??e.resizable,hiddenFields:I?.hiddenFields??e.hiddenFields,rowActions:I?.rowActions??e.rowActions,bulkActions:I?.bulkActions??e.bulkActions,sharing:I?.sharing??e.sharing,addRecord:I?.addRecord??e.addRecord,conditionalFormatting:I?.conditionalFormatting??e.conditionalFormatting,quickFilters:I?.quickFilters??e.quickFilters,userFilters:I?.userFilters??e.userFilters,showRecordCount:I?.showRecordCount??e.showRecordCount,allowPrinting:I?.allowPrinting??e.allowPrinting,virtualScroll:I?.virtualScroll??e.virtualScroll,emptyState:I?.emptyState??e.emptyState,aria:I?.aria??e.aria,tabs:e.tabs,refreshTrigger:te},dataSource:t,onEdit:V,onRowClick:U,className:`h-full`,refreshKey:te});if(L!==`grid`){let e=be(L);if(e&&Tt)return(0,X.jsx)(Tt,{schema:e,dataSource:t,data:D,loading:re},n);if(!Tt)return(0,X.jsx)(`div`,{className:`flex items-center justify-center h-40 text-muted-foreground`,children:(0,X.jsxs)(`p`,{children:[`SchemaRenderer not available. Install @object-ui/react to render `,L,` views.`]})})}return(0,X.jsx)(ct,{schema:xe,dataSource:t,onRowClick:U,onEdit:B.update===!1?void 0:V,onDelete:B.delete===!1?void 0:he,onBulkDelete:B.delete===!1?void 0:ge},n)},je=()=>{if(!se)return null;let e=Object.entries(j);return e.length<=1?null:(0,X.jsx)(Te,{value:M,onValueChange:ye,className:`w-full`,children:(0,X.jsx)(G,{className:`w-auto`,children:e.map(([e,t])=>(0,X.jsx)(pe,{value:e,className:`text-sm`,children:t.label||e},e))})})},Ne=()=>{let t=e.showCreate!==!1&&B.create!==!1,n=e.showViewSwitcher===!0,r=je();return!r&&!n&&!t&&!u?null:(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[r,(n||t||u)&&(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:n&&K&&(0,X.jsx)(wt,{schema:K,onViewChange:ve,onCreateView:d,onViewAction:f,className:`overflow-x-auto`})}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u,t&&(0,X.jsxs)(J,{size:`sm`,onClick:me,children:[(0,X.jsx)(Re,{className:`h-4 w-4`}),`Create`]})]})]})]})},Fe=R?.mode===`modal`?`modal`:R?.mode===`drawer`?`drawer`:R?.mode===`split`?`split`:R?.mode===`popover`?`popover`:z,Ie=e=>(0,X.jsx)(`div`,{className:`space-y-3`,children:(0,X.jsx)(lt,{schema:Se(),dataSource:t})}),Le=(0,Y.useCallback)(e=>{e||W()},[W]);if(Fe===`split`){let t=p?.label||e.objectName;return(0,X.jsxs)(`div`,{className:O(`flex flex-col h-full min-w-0 overflow-hidden`,n),children:[(e.title||e.description)&&(0,X.jsxs)(`div`,{className:`mb-4 shrink-0`,children:[e.title&&(0,X.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:e.title}),e.description&&(0,X.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.description})]}),(0,X.jsx)(`div`,{className:`mb-4 shrink-0`,children:Ne()}),(0,X.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:y&&w?(0,X.jsx)(Pe,{isOpen:y,selectedRecord:w,mode:`split`,close:W,setIsOpen:Le,width:R?.width,isOverlay:!0,title:`${t} Detail`,mainContent:(0,X.jsx)(`div`,{className:`h-full overflow-auto`,children:Ae()}),children:Ie}):Ae()})]})}return(0,X.jsxs)(`div`,{className:O(`flex flex-col h-full min-w-0 overflow-hidden`,n),children:[(e.title||e.description)&&(0,X.jsxs)(`div`,{className:`mb-4 shrink-0`,children:[e.title&&(0,X.jsx)(`h2`,{className:`text-2xl font-bold tracking-tight`,children:e.title}),e.description&&(0,X.jsx)(`p`,{className:`text-muted-foreground mt-1`,children:e.description})]}),(0,X.jsx)(`div`,{className:`mb-4 shrink-0`,children:Ne()}),(0,X.jsx)(`div`,{className:`flex-1 min-h-0 min-w-0 overflow-hidden`,children:Ae()}),Fe===`drawer`&&Ee(),Fe===`modal`&&De(),Fe===`popover`&&y&&w&&(0,X.jsx)(Pe,{isOpen:y,selectedRecord:w,mode:`popover`,close:W,setIsOpen:Le,width:R?.width,isOverlay:!0,title:Ce(),children:Ie})]})},Dt=s(`flex`,{variants:{layout:{inline:`flex-col space-y-4`,popover:`items-center`,drawer:`items-center`}},defaultVariants:{layout:`inline`}}),Ot=e=>e==null||e===``?!0:Array.isArray(e)?e.length===0:typeof e==`object`?Object.values(e).every(e=>e==null||e===``):!1,kt=e=>Array.isArray(e)?{start:e[0]||``,end:e[1]||``}:e&&typeof e==`object`?{start:e.start||``,end:e.end||``}:{start:``,end:``},At=({schema:e,className:t,onChange:n})=>{let[r,i]=Y.useState(e.values||{}),[a,o]=Y.useState(!1);Y.useEffect(()=>{e.values&&i(e.values)},[e.values]);let s=Y.useCallback(t=>{n?.(t),e.onChange&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(e.onChange,{detail:{values:t}}))},[n,e.onChange]),l=Y.useCallback((t,n)=>{let a={...r,[t]:n};i(a),e.showApply||s(a)},[s,e.showApply,r]),u=Y.useCallback(()=>{let t={};if(i(t),e.showApply){s(t);return}s(t)},[s,e.showApply]),d=Y.useCallback(()=>{s(r),o(!1)},[s,r]),f=Y.useMemo(()=>Object.values(r).filter(e=>!Ot(e)).length,[r]),p=e=>{let t=e.label||e.field,n=e.placeholder||`Filter by ${t}`;switch(e.type){case`number`:return(0,X.jsx)(V,{type:`number`,value:r[e.field]??``,placeholder:n,onChange:t=>{let n=t.target.value,r=n===``?``:Number(n);l(e.field,r)}});case`select`:return(0,X.jsxs)(ae,{value:r[e.field]===void 0?``:String(r[e.field]),onValueChange:t=>{let n=e.options?.find(e=>String(e.value)===t);l(e.field,n?n.value:t)},children:[(0,X.jsx)(Fe,{children:(0,X.jsx)(De,{placeholder:n})}),(0,X.jsx)(c,{children:e.options?.map(e=>(0,X.jsx)(U,{value:String(e.value),children:e.label},String(e.value)))})]});case`multi-select`:{let t=r[e.field],n=Array.isArray(t)?t:t?[t]:[];return(0,X.jsx)(`div`,{className:`max-h-40 overflow-y-auto space-y-0.5 border rounded-md p-2`,children:e.options?.map(t=>{let r=n.map(String).includes(String(t.value));return(0,X.jsxs)(`label`,{className:O(`flex items-center gap-2 text-sm py-1 px-1.5 rounded cursor-pointer`,r?`bg-primary/5 text-primary`:`hover:bg-muted`),children:[(0,X.jsx)(k,{checked:r,onCheckedChange:r=>{let i=r?[...n,t.value]:n.filter(e=>String(e)!==String(t.value));l(e.field,i)}}),(0,X.jsx)(`span`,{className:`truncate`,children:t.label})]},String(t.value))})})}case`date`:return(0,X.jsx)(V,{type:`date`,value:r[e.field]??``,onChange:t=>l(e.field,t.target.value)});case`date-range`:{let t=kt(r[e.field]);return(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{type:`date`,value:t.start??``,onChange:n=>{l(e.field,{...t,start:n.target.value})}}),(0,X.jsx)(V,{type:`date`,value:t.end??``,onChange:n=>{l(e.field,{...t,end:n.target.value})}})]})}case`boolean`:return(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(k,{checked:!!r[e.field],onCheckedChange:t=>l(e.field,!!t)}),(0,X.jsx)(`span`,{className:`text-sm text-muted-foreground`,children:`Enabled`})]});default:return(0,X.jsx)(V,{value:r[e.field]??``,placeholder:n,onChange:t=>l(e.field,t.target.value)})}},m=(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(`div`,{className:`grid gap-4 sm:grid-cols-2`,children:e.filters.map(e=>(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(_e,{className:`text-xs text-muted-foreground`,children:e.label||e.field}),p(e)]},e.field))}),(e.showApply||e.showClear)&&(0,X.jsxs)(`div`,{className:`flex items-center justify-end gap-2 border-t pt-3`,children:[e.showClear&&(0,X.jsx)(J,{type:`button`,variant:`ghost`,size:`sm`,onClick:u,children:`Clear`}),e.showApply&&(0,X.jsx)(J,{type:`button`,size:`sm`,onClick:d,children:`Apply`})]})]}),v=e.layout||`inline`;return v===`popover`?(0,X.jsx)(`div`,{className:O(Dt({layout:v}),t),children:(0,X.jsxs)(me,{open:a,onOpenChange:o,children:[(0,X.jsx)(ze,{asChild:!0,children:(0,X.jsxs)(J,{type:`button`,variant:f>0?`secondary`:`outline`,size:`sm`,className:`gap-2`,children:[(0,X.jsx)(M,{className:`h-4 w-4`}),`Filters`,f>0&&(0,X.jsx)(`span`,{className:`inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary`,children:f})]})}),(0,X.jsx)(be,{align:`start`,className:`w-[520px] p-4`,children:m})]})}):v===`drawer`?(0,X.jsxs)(`div`,{className:O(Dt({layout:v}),t),children:[(0,X.jsxs)(J,{type:`button`,variant:f>0?`secondary`:`outline`,size:`sm`,className:`gap-2`,onClick:()=>o(!0),children:[(0,X.jsx)(M,{className:`h-4 w-4`}),`Filters`,f>0&&(0,X.jsx)(`span`,{className:`inline-flex h-5 min-w-[20px] items-center justify-center rounded-full bg-primary/10 px-1 text-xs font-medium text-primary`,children:f})]}),(0,X.jsx)(h,{open:a,onOpenChange:o,children:(0,X.jsxs)(He,{children:[(0,X.jsxs)(_,{children:[(0,X.jsx)(g,{children:`Filters`}),(0,X.jsx)(ce,{children:`Refine the data with advanced filters.`})]}),(0,X.jsx)(`div`,{className:`px-4 pb-6`,children:m})]})})]}):(0,X.jsxs)(`div`,{className:O(Dt({layout:v}),t),children:[m,!e.showApply&&e.showClear&&(0,X.jsxs)(J,{type:`button`,variant:`ghost`,size:`sm`,className:`gap-2`,onClick:u,children:[(0,X.jsx)(N,{className:`h-3.5 w-3.5`}),`Clear filters`]})]})},jt=s(``,{variants:{variant:{buttons:`flex flex-wrap gap-2`,dropdown:`flex flex-wrap items-center gap-3`,builder:`space-y-3`}},defaultVariants:{variant:`dropdown`}}),Mt=e=>e?e.map(e=>({field:e.field,direction:e.direction})):[],Nt=e=>e.map(e=>({id:`${e.field}-${e.direction}`,field:e.field,order:e.direction})),Pt=e=>e.filter(e=>e.field).map(e=>({field:e.field,direction:e.order})),Ft=({schema:e,className:t,onChange:n})=>{let[r,i]=Y.useState(()=>Mt(e.sort)),[a,o]=Y.useState(()=>Nt(Mt(e.sort)));Y.useEffect(()=>{let t=Mt(e.sort);i(t),o(Nt(t))},[e.sort]);let s=Y.useCallback(t=>{i(t),n?.(t),e.onChange&&typeof window<`u`&&window.dispatchEvent(new CustomEvent(e.onChange,{detail:{sort:t}}))},[n,e.onChange]),l=Y.useCallback(t=>{let n=r.find(e=>e.field===t),i=!!e.multiple;if(!n){s(i?[...r,{field:t,direction:`asc`}]:[{field:t,direction:`asc`}]);return}if(n.direction===`asc`){s(r.map(e=>e.field===t?{...e,direction:`desc`}:e));return}s(r.filter(e=>e.field!==t))},[s,e.multiple,r]);if((e.variant||`dropdown`)===`buttons`)return(0,X.jsx)(`div`,{className:O(jt({variant:`buttons`}),t),children:e.fields.map(e=>{let t=r.find(t=>t.field===e.field),n=t?.direction===`asc`?u:he;return(0,X.jsxs)(J,{type:`button`,variant:t?`secondary`:`outline`,size:`sm`,onClick:()=>l(e.field),className:`gap-2`,children:[(0,X.jsx)(`span`,{children:e.label||e.field}),t&&(0,X.jsx)(n,{className:`h-3.5 w-3.5`})]},e.field)})});if(e.multiple)return(0,X.jsx)(`div`,{className:O(jt({variant:`builder`}),t),children:(0,X.jsx)(xe,{fields:e.fields.map(e=>({value:e.field,label:e.label||e.field})),value:a,onChange:e=>{o(e),s(Pt(e))}})});let d=r[0];return(0,X.jsxs)(`div`,{className:O(jt({variant:`dropdown`}),t),children:[(0,X.jsxs)(ae,{value:d?.field||``,onValueChange:e=>{if(!e){s([]);return}s([{field:e,direction:d?.direction||`asc`}])},children:[(0,X.jsx)(Fe,{className:`w-56`,children:(0,X.jsx)(De,{placeholder:`Select field`})}),(0,X.jsx)(c,{children:e.fields.map(e=>(0,X.jsx)(U,{value:e.field,children:e.label||e.field},e.field))})]}),(0,X.jsxs)(ae,{value:d?.direction||`asc`,onValueChange:e=>{d?.field&&s([{field:d.field,direction:e}])},children:[(0,X.jsx)(Fe,{className:`w-36`,children:(0,X.jsx)(De,{})}),(0,X.jsxs)(c,{children:[(0,X.jsx)(U,{value:`asc`,children:`Ascending`}),(0,X.jsx)(U,{value:`desc`,children:`Descending`})]})]})]})};function It(){if(typeof crypto<`u`&&typeof crypto.randomUUID==`function`)return crypto.randomUUID();if(typeof crypto<`u`&&typeof crypto.getRandomValues==`function`){let e=new Uint8Array(16);return crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)}return Math.random().toString(36).slice(2)+Math.random().toString(36).slice(2)}function Lt(e,t,n,r){return`${e}/share/${t}/${n}?mode=readonly&token=${r}`}var Rt=({objectName:e,viewId:t=`default`,baseUrl:n,onShare:r,className:i})=>{let[a,o]=Y.useState(null),[s,c]=Y.useState(!1),[l,u]=Y.useState(!1),[d,f]=Y.useState(``),[p,m]=Y.useState(``),h=n??(typeof window<`u`?window.location.origin:``),g=Y.useCallback(()=>{let n=Lt(h,e,t,It());o(n),c(!1);let i=p?new Date(Date.now()+parseInt(p,10)*864e5).toISOString():void 0;r?.(n,{password:d||void 0,expiresAt:i})},[h,e,t,r,d,p]),_=Y.useCallback(async()=>{if(a)try{await navigator.clipboard.writeText(a),c(!0),setTimeout(()=>c(!1),2e3)}catch{let e=document.createElement(`textarea`);e.value=a,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e),c(!0),setTimeout(()=>c(!1),2e3)}},[a]);return(0,X.jsxs)(me,{open:l,onOpenChange:u,children:[(0,X.jsx)(ze,{asChild:!0,children:(0,X.jsxs)(J,{variant:`outline`,size:`sm`,className:O(`gap-2`,i),children:[(0,X.jsx)(I,{className:`h-4 w-4`}),`Share`]})}),(0,X.jsxs)(be,{className:`w-96 space-y-4`,align:`end`,children:[(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,X.jsx)(`h4`,{className:`text-sm font-medium`,children:`Share View`}),(0,X.jsx)(F,{variant:`secondary`,className:`text-xs`,children:`Read-only`})]}),(0,X.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Generate a public link to share this view. Recipients can view data without logging in.`})]}),a?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(V,{value:a,readOnly:!0,className:`h-8 text-xs`,onClick:e=>e.target.select()}),(0,X.jsx)(J,{variant:`outline`,size:`sm`,onClick:_,className:`shrink-0 gap-1`,children:s?(0,X.jsx)(Oe,{className:`h-4 w-4 text-green-500`}):(0,X.jsx)(Ee,{className:`h-4 w-4`})})]}),(d||p)&&(0,X.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[d&&(0,X.jsxs)(F,{variant:`outline`,className:`text-xs gap-1`,children:[(0,X.jsx)(je,{className:`h-3 w-3`}),`Password protected`]}),p&&(0,X.jsxs)(F,{variant:`outline`,className:`text-xs gap-1`,children:[(0,X.jsx)(Se,{className:`h-3 w-3`}),`Expires in `,p,` day`,p===`1`?``:`s`]})]})]}):(0,X.jsxs)(`div`,{className:`space-y-3`,children:[(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,X.jsx)(je,{className:`h-3.5 w-3.5`}),`Password protection (optional)`]}),(0,X.jsx)(V,{type:`password`,value:d,onChange:e=>f(e.target.value),placeholder:`Enter password...`,className:`h-8 text-xs`})]}),(0,X.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,X.jsxs)(`label`,{className:`flex items-center gap-1.5 text-xs font-medium text-foreground`,children:[(0,X.jsx)(Se,{className:`h-3.5 w-3.5`}),`Expires after (optional)`]}),(0,X.jsxs)(`select`,{value:p,onChange:e=>m(e.target.value),className:`w-full h-8 text-xs rounded-md border border-input bg-background px-3`,children:[(0,X.jsx)(`option`,{value:``,children:`Never`}),(0,X.jsx)(`option`,{value:`1`,children:`1 day`}),(0,X.jsx)(`option`,{value:`7`,children:`7 days`}),(0,X.jsx)(`option`,{value:`30`,children:`30 days`}),(0,X.jsx)(`option`,{value:`90`,children:`90 days`})]})]}),(0,X.jsxs)(J,{onClick:g,className:`w-full gap-2`,size:`sm`,children:[(0,X.jsx)(I,{className:`h-4 w-4`}),`Generate Link`]})]})]})]})},zt={private:0,team:1,organization:2,public:3},Bt=8,Vt=({id:e,disabled:t,children:n})=>{let{attributes:r,listeners:i,setNodeRef:a,transform:o,transition:s,isDragging:c}=Ye({id:e,disabled:t,attributes:{role:`tab`,roleDescription:`view tab`,tabIndex:0}});return(0,X.jsx)(X.Fragment,{children:n({setNodeRef:a,style:{transform:Ze.Transform.toString(o),transition:s,zIndex:c?10:void 0,opacity:c?.5:void 0},listeners:i,attributes:r,isDragging:c})})},Ht=({views:e,activeViewId:t,onViewChange:n,viewTypeIcons:r={},config:i={},onAddView:a,onRenameView:o,onDuplicateView:s,onDeleteView:c,onSetDefaultView:u,onShareView:p,onSaveAsView:h,onPinView:g,onReorderViews:_,onChangeViewType:b,onConfigView:ee,onManageViews:C,availableViewTypes:E,hasUnsavedChanges:D=!1,onResetChanges:k,className:ae})=>{let{showAddButton:A=!0,inlineRename:oe=!0,contextMenu:ce=!0,reorderable:M=!1,maxVisibleTabs:le=6,showIndicators:ue=!0,showSaveAsView:N=!0,showPinnedSection:de=!0,showVisibilityGroups:pe=!1}=i,[F,R]=(0,Y.useState)(null),[z,B]=(0,Y.useState)(``),me=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{F&&me.current&&(me.current.focus(),me.current.select())},[F]);let H=(0,Y.useCallback)(t=>{if(!oe||!o)return;let n=e.find(e=>e.id===t);n&&(n.readonly||(R(t),B(n.label)))},[oe,o,e]),U=(0,Y.useCallback)(()=>{F&&z.trim()&&o&&o(F,z.trim()),R(null),B(``)},[F,z,o]),he=(0,Y.useCallback)(()=>{R(null),B(``)},[]),_e=(0,Y.useMemo)(()=>e.length>0&&e.every(e=>!!e.readonly),[e]),G=(0,Y.useMemo)(()=>{let t=[...e];return t.sort((e,t)=>{if(de){let n=+!!e.isPinned,r=+!!t.isPinned;if(n!==r)return r-n}if(pe){let n=zt[e.visibility||`public`]??zt.public,r=zt[t.visibility||`public`]??zt.public;if(n!==r)return n-r}return 0}),t},[e,de,pe]),{visibleViews:q,overflowViews:be}=(0,Y.useMemo)(()=>{let e=G.slice(0,le),n=G.slice(le),r=n.findIndex(e=>e.id===t);if(r===-1)return{visibleViews:e,overflowViews:n};let i=n[r],a=e.length>0?[...e.slice(0,-1),i]:[i],o=e.length>0?e[e.length-1]:null,s=n.filter((e,t)=>t!==r);return o&&s.unshift(o),{visibleViews:a,overflowViews:s}},[G,le,t]),xe=Qe(tt(st,{activationConstraint:{distance:Bt}}),tt(et)),Se=(0,Y.useCallback)(e=>{let{active:t,over:n}=e;if(!n||t.id===n.id||!_)return;let r=G.findIndex(e=>e.id===t.id),i=G.findIndex(e=>e.id===n.id);r===-1||i===-1||_(nt(G,r,i).map(e=>e.id))},[G,_]),Te=T,De=(0,Y.useCallback)(e=>{if(!pe||e===0)return!1;let t=q[e-1],n=q[e],r=e=>e.visibility===`private`;return r(t)&&!r(n)},[pe,q]),Oe=(e,i)=>{let a=e.id===t,f=r[e.type]||Te,h=F===e.id,T=ue&&(e.hasActiveFilters||e.hasActiveSort),D=De(i),k=!!e.readonly,ae=(e=>pe?e.visibility===`private`?(0,X.jsx)(je,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):e.visibility?(0,X.jsx)(fe,{"data-testid":`view-tab-visibility-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}):null:null)(e),A=t=>(0,X.jsxs)(`div`,{"data-testid":`view-tab-${e.id}`,role:`tab`,tabIndex:0,"aria-selected":a,onClick:()=>!h&&n(e.id),onDoubleClick:()=>H(e.id),onKeyDown:t=>{!h&&(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),n(e.id))},...t?.listeners??{},...t?.attributes??{},className:O(`group/tab inline-flex items-center gap-1.5 px-3 py-2 text-sm font-medium border-b-2 transition-colors whitespace-nowrap relative outline-none focus-visible:ring-2 focus-visible:ring-ring`,t?.isDragging?`cursor-grabbing`:`cursor-pointer`,a?`border-primary text-primary`:`border-transparent text-muted-foreground hover:text-foreground hover:border-border`),children:[M&&_&&(0,X.jsx)(`span`,{"data-testid":`view-tab-drag-handle-${e.id}`,"aria-hidden":`true`,className:O(`text-muted-foreground transition-opacity pointer-events-none`,`opacity-0 group-hover/tab:opacity-100`,t?.isDragging&&`opacity-100`),children:(0,X.jsx)(v,{className:`h-3 w-3`})}),de&&e.isPinned&&(0,X.jsx)(We,{"data-testid":`view-tab-pin-indicator-${e.id}`,className:`h-3 w-3 text-primary shrink-0`}),ae,(0,X.jsx)(f,{className:`h-3.5 w-3.5`}),h?(0,X.jsx)(V,{ref:me,"data-testid":`view-tab-rename-input-${e.id}`,value:z,onChange:e=>B(e.target.value),onBlur:U,onKeyDown:e=>{e.key===`Enter`&&U(),e.key===`Escape`&&he()},className:`h-5 w-24 px-1 py-0 text-sm border-none focus-visible:ring-1`,onClick:e=>e.stopPropagation()}):(0,X.jsx)(`span`,{children:e.label}),k&&!_e&&(0,X.jsxs)(Je,{children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(je,{"data-testid":`view-tab-readonly-${e.id}`,"aria-label":`Read-only view`,className:`h-3 w-3 text-muted-foreground shrink-0`})}),(0,X.jsx)(d,{side:`bottom`,className:`text-xs`,children:e.readonlyReason||`System view — duplicate to customize.`})]}),T&&(0,X.jsxs)(Je,{children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(`span`,{"data-testid":`view-tab-indicator-${e.id}`,className:`ml-1 inline-flex items-center justify-center h-4 min-w-[16px] rounded-full bg-primary/15 text-[10px] font-medium text-primary px-1 shrink-0`,children:[e.hasActiveFilters&&`F`,e.hasActiveSort&&`S`].filter(Boolean).join(``)})}),(0,X.jsx)(d,{side:`bottom`,className:`text-xs`,children:[e.hasActiveFilters&&`Active filters`,e.hasActiveSort&&`Active sort`].filter(Boolean).join(`, `)})]}),e.isDefault&&(0,X.jsx)(K,{className:`h-3 w-3 text-amber-500 fill-amber-500 shrink-0`}),a&&(ee||o||s||c)&&(0,X.jsxs)(ke,{children:[(0,X.jsx)(j,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"data-testid":`view-tab-actions-${e.id}`,className:`ml-0.5 h-4 w-4 flex items-center justify-center rounded hover:bg-accent shrink-0 opacity-70 hover:opacity-100 transition-opacity`,onClick:e=>e.stopPropagation(),onPointerDown:e=>e.stopPropagation(),onMouseDown:e=>e.stopPropagation(),"aria-label":`View actions for ${e.label}`,children:(0,X.jsx)(Ne,{className:`h-3 w-3`})})}),(0,X.jsxs)(Ce,{align:`start`,className:`min-w-[180px]`,onClick:e=>e.stopPropagation(),children:[ee&&!k&&(0,X.jsxs)(W,{"data-testid":`view-tab-menu-config-${e.id}`,onClick:()=>ee(e.id),children:[(0,X.jsx)(se,{className:`h-4 w-4 mr-2`}),` Edit view config`]}),o&&!k&&(0,X.jsxs)(W,{"data-testid":`view-tab-menu-rename-${e.id}`,onClick:()=>H(e.id),children:[(0,X.jsx)(S,{className:`h-4 w-4 mr-2`}),` Rename`]}),s&&(0,X.jsxs)(W,{"data-testid":`view-tab-menu-duplicate-${e.id}`,onClick:()=>s(e.id),children:[(0,X.jsx)(Ee,{className:`h-4 w-4 mr-2`}),` Duplicate view`]}),p&&(0,X.jsxs)(W,{"data-testid":`view-tab-menu-share-${e.id}`,onClick:()=>p(e.id),children:[(0,X.jsx)(I,{className:`h-4 w-4 mr-2`}),` Share view`]}),u&&!k&&(0,X.jsxs)(W,{"data-testid":`view-tab-menu-default-${e.id}`,onClick:()=>u(e.id),children:[(0,X.jsx)(K,{className:`h-4 w-4 mr-2`}),` Set as default`]}),g&&!k&&(0,X.jsx)(W,{"data-testid":`view-tab-menu-pin-${e.id}`,onClick:()=>g(e.id,!e.isPinned),children:e.isPinned?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(m,{className:`h-4 w-4 mr-2`}),` Unpin view`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(We,{className:`h-4 w-4 mr-2`}),` Pin view`]})}),b&&!k&&E&&E.length>0&&(0,X.jsxs)(qe,{children:[(0,X.jsxs)(Ge,{"data-testid":`view-tab-menu-change-type-${e.id}`,children:[(0,X.jsx)(Ke,{className:`h-4 w-4 mr-2`}),` Change view type`]}),(0,X.jsx)(L,{children:E.map(t=>{let n=r[t.type]||Te;return(0,X.jsxs)(W,{"data-testid":`view-tab-menu-type-${e.id}-${t.type}`,disabled:t.type===e.type,onClick:()=>b(e.id,t.type),children:[(0,X.jsx)(n,{className:`h-4 w-4 mr-2`}),(0,X.jsx)(`span`,{children:t.label})]},t.type)})})]}),c&&!k&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ve,{}),(0,X.jsxs)(W,{"data-testid":`view-tab-menu-delete-${e.id}`,onClick:()=>c(e.id),className:`text-destructive focus:text-destructive`,children:[(0,X.jsx)(we,{className:`h-4 w-4 mr-2`}),` Delete view`]})]}),C&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ve,{}),(0,X.jsxs)(W,{"data-testid":`view-tab-menu-manage-${e.id}`,onClick:C,children:[(0,X.jsx)(ie,{className:`h-4 w-4 mr-2`}),` Manage all views…`]})]})]})]})]}),oe=t=>!ce||h?t:(0,X.jsxs)(ne,{children:[(0,X.jsx)(y,{asChild:!0,children:t}),(0,X.jsxs)(ye,{children:[o&&!k&&(0,X.jsxs)(l,{"data-testid":`context-menu-rename-${e.id}`,onClick:()=>H(e.id),children:[(0,X.jsx)(S,{className:`h-4 w-4 mr-2`}),` Rename`]}),s&&(0,X.jsxs)(l,{"data-testid":`context-menu-duplicate-${e.id}`,onClick:()=>s(e.id),children:[(0,X.jsx)(Ee,{className:`h-4 w-4 mr-2`}),` Duplicate View`]}),p&&(0,X.jsxs)(l,{"data-testid":`context-menu-share-${e.id}`,onClick:()=>p(e.id),children:[(0,X.jsx)(I,{className:`h-4 w-4 mr-2`}),` Share View`]}),u&&!k&&(0,X.jsxs)(l,{"data-testid":`context-menu-default-${e.id}`,onClick:()=>u(e.id),children:[(0,X.jsx)(K,{className:`h-4 w-4 mr-2`}),` Set as Default`]}),g&&!k&&(0,X.jsx)(l,{"data-testid":`context-menu-pin-${e.id}`,onClick:()=>g(e.id,!e.isPinned),children:e.isPinned?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(m,{className:`h-4 w-4 mr-2`}),` Unpin View`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(We,{className:`h-4 w-4 mr-2`}),` Pin View`]})}),b&&!k&&E&&E.length>0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ve,{}),(0,X.jsxs)(w,{children:[(0,X.jsxs)(re,{"data-testid":`context-menu-change-type-${e.id}`,children:[(0,X.jsx)(Ke,{className:`h-4 w-4 mr-2`}),` Change View Type`]}),(0,X.jsx)(te,{"data-testid":`context-menu-type-submenu-${e.id}`,children:E.map(t=>{let n=r[t.type]||Te;return(0,X.jsxs)(l,{"data-testid":`context-menu-type-${e.id}-${t.type}`,disabled:t.type===e.type,onClick:()=>b(e.id,t.type),children:[(0,X.jsx)(n,{className:`h-4 w-4 mr-2`}),(0,X.jsxs)(`div`,{className:`flex flex-col`,children:[(0,X.jsx)(`span`,{children:t.label}),t.description&&(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:t.description})]})]},t.type)})})]})]}),c&&!k&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ve,{}),(0,X.jsxs)(l,{"data-testid":`context-menu-delete-${e.id}`,onClick:()=>c(e.id),className:`text-destructive focus:text-destructive`,children:[(0,X.jsx)(we,{className:`h-4 w-4 mr-2`}),` Delete View`]})]}),C&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ve,{}),(0,X.jsxs)(l,{"data-testid":`context-menu-manage-${e.id}`,onClick:C,children:[(0,X.jsx)(ie,{className:`h-4 w-4 mr-2`}),` Manage all views…`]})]})]})]});return M&&_?(0,X.jsxs)(Y.Fragment,{children:[D&&(0,X.jsx)(`div`,{"data-testid":`view-tab-visibility-separator`,className:`w-px h-5 bg-border mx-1 self-center shrink-0`}),(0,X.jsx)(Vt,{id:e.id,children:({setNodeRef:e,style:t,listeners:n,attributes:r,isDragging:i})=>(0,X.jsx)(`div`,{ref:e,style:t,className:O(`flex`,i&&`z-10`),children:oe(A({listeners:n,attributes:r,isDragging:i}))})})]},e.id):(0,X.jsxs)(Y.Fragment,{children:[D&&(0,X.jsx)(`div`,{"data-testid":`view-tab-visibility-separator`,className:`w-px h-5 bg-border mx-1 self-center shrink-0`}),oe(A())]},e.id)},Ae=(0,X.jsx)(X.Fragment,{children:q.map((e,t)=>Oe(e,t))});return(0,X.jsx)(P,{children:(0,X.jsxs)(`div`,{"data-testid":`view-tab-bar`,className:O(`flex items-center gap-0.5 -mb-px`,ae),children:[M&&_?(0,X.jsx)(at,{sensors:xe,collisionDetection:Xe,onDragEnd:Se,children:(0,X.jsx)(ot,{items:q.map(e=>e.id),strategy:it,children:(0,X.jsx)(`div`,{"data-testid":`view-tab-sortable-container`,className:`flex items-center gap-0.5`,children:Ae})})}):Ae,be.length>0&&(0,X.jsxs)(ke,{children:[(0,X.jsx)(j,{asChild:!0,children:(0,X.jsxs)(`button`,{"data-testid":`view-tab-overflow`,className:`inline-flex items-center gap-1 px-2 py-2 text-sm text-muted-foreground hover:text-foreground transition-colors`,children:[(0,X.jsx)(f,{className:`h-4 w-4`}),(0,X.jsxs)(`span`,{className:`text-xs`,children:[be.length,` more`]})]})}),(0,X.jsxs)(Ce,{align:`end`,children:[C&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(W,{"data-testid":`view-tab-overflow-manage`,onClick:C,className:`font-medium`,children:[(0,X.jsx)(ie,{className:`h-4 w-4 mr-2`}),` Manage all views…`]}),(0,X.jsx)(Ve,{})]}),be.map(e=>{let t=r[e.type]||Te;return(0,X.jsxs)(W,{"data-testid":`view-tab-overflow-${e.id}`,onClick:()=>n(e.id),children:[e.isPinned&&(0,X.jsx)(We,{className:`h-3 w-3 mr-1 text-primary shrink-0`}),(0,X.jsx)(t,{className:`h-4 w-4 mr-2`}),e.label,ue&&(e.hasActiveFilters||e.hasActiveSort)&&(0,X.jsx)(`span`,{className:`ml-auto inline-flex items-center justify-center h-4 min-w-[16px] rounded-full bg-primary/15 text-[10px] font-medium text-primary px-1`,children:[e.hasActiveFilters&&`F`,e.hasActiveSort&&`S`].filter(Boolean).join(``)})]},e.id)})]})]}),A&&a&&(0,X.jsxs)(Je,{children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(`button`,{"data-testid":`view-tab-add`,onClick:a,className:`inline-flex items-center px-2 py-2 text-muted-foreground hover:text-foreground transition-colors`,children:(0,X.jsx)(Re,{className:`h-4 w-4`})})}),(0,X.jsx)(d,{children:`Add View`})]}),N&&D&&(0,X.jsxs)(`div`,{"data-testid":`view-tab-save-as`,className:`flex items-center gap-1 ml-2 text-xs text-amber-600 dark:text-amber-400`,children:[(0,X.jsx)(ge,{className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`hidden sm:inline`,children:`Unsaved changes`}),h&&(0,X.jsx)(J,{variant:`ghost`,size:`sm`,"data-testid":`view-tab-save-as-btn`,className:`h-6 px-2 text-xs`,onClick:h,children:`Save as View`}),k&&(0,X.jsx)(J,{variant:`ghost`,size:`sm`,"data-testid":`view-tab-reset-btn`,className:`h-6 px-2 text-xs`,onClick:k,children:`Reset`})]})]})})},Ut=T,Wt=({view:e,isActive:t,Icon:n,isRenaming:r,onStartRename:i,onCommitRename:a,onCancelRename:o,onRowClick:s,onDelete:c,onDuplicate:l,onSetDefault:u,onSetPinned:p,onConfigView:h})=>{let{attributes:g,listeners:_,setNodeRef:y,transform:b,transition:ee,isDragging:C}=Ye({id:e.id}),w={transform:Ze.Transform.toString(b),transition:ee,opacity:C?.5:1},T=(0,Y.useRef)(null),[te,E]=(0,Y.useState)(e.label),D=!!e.readonly;(0,Y.useEffect)(()=>{r&&(E(e.label),requestAnimationFrame(()=>{T.current?.focus(),T.current?.select()}))},[r,e.label]);let ne=(0,Y.useCallback)(()=>{let t=te.trim();t&&t!==e.label?a(e.id,t):o()},[te,e.id,e.label,a,o]);return(0,X.jsxs)(`li`,{ref:y,style:w,"data-testid":`manage-views-row-${e.id}`,className:O(`group/row flex items-center gap-2 px-2 py-2 rounded-md border border-transparent`,`hover:bg-accent/50 transition-colors`,t&&`bg-accent/40 border-border`,C&&`shadow-md bg-background border-border z-10`),children:[(0,X.jsx)(`button`,{type:`button`,...g,..._,"aria-label":`Drag to reorder`,"data-testid":`manage-views-drag-${e.id}`,className:`shrink-0 h-6 w-5 flex items-center justify-center text-muted-foreground/40 hover:text-muted-foreground cursor-grab active:cursor-grabbing rounded hover:bg-accent`,onClick:e=>e.stopPropagation(),children:(0,X.jsx)(v,{className:`h-4 w-4`})}),(0,X.jsx)(n,{className:`shrink-0 h-4 w-4 text-muted-foreground`}),(0,X.jsx)(`div`,{className:`flex-1 min-w-0`,onClick:()=>{r||s?.(e.id)},children:r?(0,X.jsx)(V,{ref:T,value:te,onChange:e=>E(e.target.value),onBlur:ne,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),ne()):e.key===`Escape`&&(e.preventDefault(),o())},onClick:e=>e.stopPropagation(),className:`h-7 text-sm`,"data-testid":`manage-views-rename-input-${e.id}`}):(0,X.jsxs)(`button`,{type:`button`,className:`w-full text-left text-sm font-medium truncate cursor-pointer flex items-center gap-1.5`,onDoubleClick:t=>{t.stopPropagation(),D||i(e.id)},title:e.label,children:[(0,X.jsx)(`span`,{className:`truncate`,children:e.label}),D&&(0,X.jsx)(je,{"aria-label":`Read-only view`,"data-testid":`manage-views-readonly-${e.id}`,className:`h-3 w-3 text-muted-foreground shrink-0`}),e.isDefault&&(0,X.jsxs)(`span`,{className:`ml-1 inline-flex items-center text-[10px] uppercase tracking-wide text-muted-foreground`,title:`Default view`,children:[(0,X.jsx)(K,{className:`h-3 w-3 mr-0.5 fill-current`}),` default`]})]})}),p&&!r&&!D&&(0,X.jsx)(P,{delayDuration:300,children:(0,X.jsxs)(Je,{children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":e.isPinned?`Unpin view`:`Pin view`,"data-testid":`manage-views-pin-${e.id}`,onClick:t=>{t.stopPropagation(),p(e.id,!e.isPinned)},className:O(`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent transition-colors`,e.isPinned?`text-amber-500`:`text-muted-foreground/40 opacity-0 group-hover/row:opacity-100`),children:e.isPinned?(0,X.jsx)(We,{className:`h-4 w-4 fill-current`}):(0,X.jsx)(We,{className:`h-4 w-4`})})}),(0,X.jsx)(d,{side:`top`,children:e.isPinned?`Unpin view`:`Pin view`})]})}),u&&!r&&!e.isDefault&&!D&&(0,X.jsx)(P,{delayDuration:300,children:(0,X.jsxs)(Je,{children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Set as default`,"data-testid":`manage-views-default-${e.id}`,onClick:t=>{t.stopPropagation(),u(e.id)},className:`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground/40 hover:text-foreground opacity-0 group-hover/row:opacity-100 transition-colors`,children:(0,X.jsx)(K,{className:`h-4 w-4`})})}),(0,X.jsx)(d,{side:`top`,children:`Set as default`})]})}),!r&&(c||l||h||u)&&(0,X.jsxs)(ke,{children:[(0,X.jsx)(j,{asChild:!0,children:(0,X.jsx)(`button`,{type:`button`,"aria-label":`Actions for ${e.label}`,"data-testid":`manage-views-actions-${e.id}`,onClick:e=>e.stopPropagation(),className:`shrink-0 h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground opacity-60 group-hover/row:opacity-100 transition-opacity`,children:(0,X.jsx)(f,{className:`h-4 w-4`})})}),(0,X.jsxs)(Ce,{align:`end`,className:`min-w-[180px]`,children:[!D&&(0,X.jsxs)(W,{"data-testid":`manage-views-action-rename-${e.id}`,onClick:()=>i(e.id),children:[(0,X.jsx)(S,{className:`h-4 w-4 mr-2`}),` Rename`]}),l&&(0,X.jsxs)(W,{"data-testid":`manage-views-action-duplicate-${e.id}`,onClick:()=>l(e.id),children:[(0,X.jsx)(Ee,{className:`h-4 w-4 mr-2`}),` Duplicate`]}),h&&!D&&(0,X.jsxs)(W,{"data-testid":`manage-views-action-config-${e.id}`,onClick:()=>h(e.id),children:[(0,X.jsx)(S,{className:`h-4 w-4 mr-2`}),` Edit configuration…`]}),u&&!e.isDefault&&!D&&(0,X.jsxs)(W,{"data-testid":`manage-views-action-default-${e.id}`,onClick:()=>u(e.id),children:[(0,X.jsx)(K,{className:`h-4 w-4 mr-2`}),` Set as default`]}),p&&!D&&(0,X.jsx)(W,{"data-testid":`manage-views-action-pin-${e.id}`,onClick:()=>p(e.id,!e.isPinned),children:e.isPinned?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(m,{className:`h-4 w-4 mr-2`}),` Unpin`]}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(We,{className:`h-4 w-4 mr-2`}),` Pin`]})}),c&&!D&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ve,{}),(0,X.jsxs)(W,{"data-testid":`manage-views-action-delete-${e.id}`,onClick:()=>c(e.id),className:`text-destructive focus:text-destructive`,children:[(0,X.jsx)(we,{className:`h-4 w-4 mr-2`}),` Delete`]})]})]})]}),r&&(0,X.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":`Save name`,onMouseDown:e=>e.preventDefault(),onClick:ne,className:`h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-emerald-600`,children:(0,X.jsx)(Oe,{className:`h-4 w-4`})}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Cancel rename`,onMouseDown:e=>e.preventDefault(),onClick:o,className:`h-7 w-7 inline-flex items-center justify-center rounded hover:bg-accent text-muted-foreground`,children:(0,X.jsx)(N,{className:`h-4 w-4`})})]})]})},Gt=({open:e,onOpenChange:t,views:n,activeViewId:r,viewTypeIcons:i={},onRename:a,onDelete:o,onDuplicate:s,onSetDefault:c,onSetPinned:l,onReorder:u,onAddView:d,onConfigView:f})=>{let[p,m]=(0,Y.useState)(``),[h,g]=(0,Y.useState)(null),[_,v]=(0,Y.useState)(()=>n.map(e=>e.id));(0,Y.useEffect)(()=>{v(n.map(e=>e.id))},[n]),(0,Y.useEffect)(()=>{e||(g(null),m(``))},[e]);let y=(0,Y.useMemo)(()=>{let e=new Map(n.map(e=>[e.id,e]));return _.map(t=>e.get(t)).filter(Boolean)},[_,n]),x=(0,Y.useMemo)(()=>{if(!p.trim())return y;let e=p.toLowerCase();return y.filter(t=>t.label.toLowerCase().includes(e))},[y,p]),S=Qe(tt(st,{activationConstraint:{distance:5}}),tt(et,{coordinateGetter:$e})),w=e=>{let{active:t,over:n}=e;if(!n||t.id===n.id)return;let r=_.indexOf(String(t.id)),i=_.indexOf(String(n.id));if(r<0||i<0)return;let a=nt(_,r,i);v(a),u?.(a)},T=e=>{t(!1),requestAnimationFrame(()=>f?.(e))};return(0,X.jsx)(ue,{open:e,onOpenChange:t,children:(0,X.jsxs)(de,{className:`sm:max-w-[560px] p-0 gap-0 overflow-hidden`,"data-testid":`manage-views-dialog`,children:[(0,X.jsxs)(Me,{className:`px-5 pt-5 pb-3`,children:[(0,X.jsx)(ee,{className:`text-base`,children:`Manage views`}),(0,X.jsx)(b,{className:`text-xs`,children:`Reorder, rename, pin, or delete every view in this object.`})]}),(0,X.jsx)(`div`,{className:`px-5 pb-3`,children:(0,X.jsxs)(`div`,{className:`relative`,children:[(0,X.jsx)(oe,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,X.jsx)(V,{value:p,onChange:e=>m(e.target.value),placeholder:`Search views`,className:`pl-8 h-9`,"data-testid":`manage-views-search`})]})}),(0,X.jsx)(`div`,{className:`px-3 pb-3 max-h-[55vh] overflow-y-auto`,"data-testid":`manage-views-list`,children:x.length===0?(0,X.jsx)(`div`,{className:`text-center text-sm text-muted-foreground py-10`,children:`No views match your search.`}):(0,X.jsx)(at,{sensors:S,collisionDetection:Xe,onDragEnd:w,children:(0,X.jsx)(ot,{items:x.map(e=>e.id),strategy:rt,children:(0,X.jsx)(`ul`,{className:`space-y-0.5`,children:x.map(e=>(0,X.jsx)(Wt,{view:e,Icon:i[e.type]||Ut,isActive:e.id===r,isRenaming:h===e.id,onStartRename:e=>g(e),onCancelRename:()=>g(null),onCommitRename:(e,t)=>{g(null),a?.(e,t)},onDelete:o,onDuplicate:s,onSetDefault:c,onSetPinned:l,onConfigView:f?T:void 0},e.id))})})})}),(0,X.jsxs)(C,{className:`border-t bg-muted/30 px-5 py-3 flex sm:justify-between gap-2`,children:[d?(0,X.jsxs)(J,{variant:`ghost`,size:`sm`,onClick:()=>{t(!1),requestAnimationFrame(()=>d())},"data-testid":`manage-views-add`,className:`text-sm`,children:[(0,X.jsx)(Re,{className:`h-4 w-4 mr-1.5`}),` Add new view`]}):(0,X.jsx)(`span`,{}),(0,X.jsx)(J,{size:`sm`,onClick:()=>t(!1),"data-testid":`manage-views-done`,children:`Done`})]})]})})},Kt={"=":`equals`,"==":`equals`,"!=":`notEquals`,"<>":`notEquals`,">":`greaterThan`,"<":`lessThan`,">=":`greaterOrEqual`,"<=":`lessOrEqual`,contains:`contains`,not_contains:`notContains`,is_empty:`isEmpty`,is_not_empty:`isNotEmpty`,in:`in`,not_in:`notIn`,"not in":`notIn`,before:`before`,after:`after`,between:`between`,equals:`equals`,notEquals:`notEquals`,greaterThan:`greaterThan`,lessThan:`lessThan`,greaterOrEqual:`greaterOrEqual`,lessOrEqual:`lessOrEqual`,notContains:`notContains`,isEmpty:`isEmpty`,isNotEmpty:`isNotEmpty`,notIn:`notIn`},qt={equals:`=`,notEquals:`!=`,greaterThan:`>`,lessThan:`<`,greaterOrEqual:`>=`,lessOrEqual:`<=`,contains:`contains`,notContains:`not_contains`,isEmpty:`is_empty`,isNotEmpty:`is_not_empty`,in:`in`,notIn:`not in`,before:`before`,after:`after`,between:`between`};function Jt(e){let t=(e||``).toLowerCase();return[`integer`,`int`,`float`,`double`,`number`,`currency`,`money`,`percent`,`rating`].includes(t)?`number`:[`date`,`datetime`,`datetime_tz`,`timestamp`,`time`].includes(t)?`date`:[`boolean`,`bool`,`checkbox`,`switch`].includes(t)?`boolean`:[`select`,`picklist`,`single_select`,`multi_select`,`enum`,`status`,`lookup`,`master_detail`,`user`,`owner`].includes(t)?`select`:`text`}function Yt(e){if(!Array.isArray(e)||e.length<2)return null;let[t,n,r]=e;return typeof t!=`string`||typeof n!=`string`?null:{id:crypto.randomUUID(),field:t,operator:Kt[n]||n,value:r??``}}function Xt(e){if(Array.isArray(e)){let t=Yt(e);return t?[t]:[]}return typeof e==`object`&&e&&e.field?[{id:e.id||crypto.randomUUID(),field:e.field,operator:Kt[e.operator]||e.operator||`equals`,value:e.value??``}]:[]}function Zt(e){if(!Array.isArray(e)||e.length===0)return{logic:`and`,conditions:[]};if(typeof e[0]==`string`&&(e[0]===`and`||e[0]===`or`))return{logic:e[0],conditions:e.slice(1).flatMap(e=>Xt(e))};if(e.length>=2&&e.length<=3&&typeof e[0]==`string`&&typeof e[1]==`string`&&!Array.isArray(e[0])&&!Array.isArray(e[2])){let t=Yt(e);return{logic:`and`,conditions:t?[t]:[]}}if(Array.isArray(e[0])||typeof e[0]==`object`&&e[0]!==null&&!Array.isArray(e[0]))return{logic:`and`,conditions:e.flatMap(e=>Xt(e))};let t=Yt(e);return{logic:`and`,conditions:t?[t]:[]}}function Qt(e,t){let n=t.filter(e=>e.field).map(e=>[e.field,qt[e.operator]||e.operator,e.value]);return n.length===0?[]:n.length===1&&e===`and`?n[0]:e===`or`?[`or`,...n]:n}function $t(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}function en(e){return e.split(`,`).map(e=>Number(e.trim())).filter(e=>!isNaN(e)&&e>0)}var tn={grid:`Grid`,kanban:`Kanban`,calendar:`Calendar`,gallery:`Gallery`,timeline:`Timeline`,gantt:`Gantt`,map:`Map`,chart:`Chart`},nn=Object.keys(tn),rn=[{value:`compact`,gapClass:`gap-0`},{value:`short`,gapClass:`gap-px`},{value:`medium`,gapClass:`gap-0.5`},{value:`tall`,gapClass:`gap-1`},{value:`extra_tall`,gapClass:`gap-1.5`}];function an(e){return e.fields?Object.entries(e.fields).map(([e,t])=>({value:e,label:t.label||e,type:Jt(t.type),options:t.options})):[]}function on(e){let t=Zt(e);return{id:`root`,logic:t.logic,conditions:t.conditions}}function sn(e){return(Array.isArray(e)?e:[]).map(e=>({id:e.id||crypto.randomUUID(),field:e.field||``,order:e.order||e.direction||`asc`}))}function Z({renderSummary:e,children:t}){let[n,r]=Y.useState(!1);return(0,X.jsxs)(X.Fragment,{children:[e(()=>r(e=>!e)),n&&t]})}var cn=5;function ln({colName:e,label:t,idx:n,total:r,onToggle:i,onMove:a}){let{attributes:o,listeners:s,setNodeRef:c,transform:l,transition:u,isDragging:d}=Ye({id:e});return(0,X.jsxs)(`div`,{ref:c,style:{transform:Ze.Transform.toString(l),transition:u,zIndex:d?10:void 0,opacity:d?.5:void 0},"data-field-name":e,"data-field-label":t,className:`flex items-center gap-1 text-xs hover:bg-accent/50 rounded-sm py-0.5 px-1 -mx-1 group`,children:[(0,X.jsx)(`span`,{...o,...s,className:`shrink-0 cursor-grab touch-none`,"data-testid":`col-drag-handle-${e}`,children:(0,X.jsx)(v,{className:`h-3 w-3 text-muted-foreground/50`})}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`col-eye-${e}`,className:`h-5 w-5 flex items-center justify-center rounded hover:bg-accent shrink-0`,onClick:()=>i(e,!1),"aria-label":`Hide ${t}`,children:(0,X.jsx)(z,{className:`h-3.5 w-3.5 text-primary`})}),(0,X.jsx)(`span`,{className:`truncate flex-1`,children:t}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`col-move-up-${e}`,className:`h-5 w-5 flex items-center justify-center rounded hover:bg-accent disabled:opacity-30 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,disabled:n===0,onClick:()=>a(e,`up`),"aria-label":`Move ${t} up`,children:(0,X.jsx)(v,{className:`h-3 w-3 rotate-90`})}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`col-move-down-${e}`,className:`h-5 w-5 flex items-center justify-center rounded hover:bg-accent disabled:opacity-30 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity`,disabled:n===r-1,onClick:()=>a(e,`down`),"aria-label":`Move ${t} down`,children:(0,X.jsx)(v,{className:`h-3 w-3 -rotate-90`})})]})}function un({columns:e,fieldOptions:t,onToggle:n,onMove:r,onReorder:i}){return(0,X.jsx)(at,{sensors:Qe(tt(st,{activationConstraint:{distance:cn}}),tt(et)),collisionDetection:Xe,onDragEnd:Y.useCallback(t=>{let{active:n,over:r}=t;if(!r||n.id===r.id)return;let a=e.indexOf(String(n.id)),o=e.indexOf(String(r.id));a===-1||o===-1||i(nt(e,a,o))},[e,i]),children:(0,X.jsx)(ot,{items:e,strategy:rt,children:e.map((i,a)=>(0,X.jsx)(ln,{colName:i,label:t.find(e=>e.value===i)?.label||i,idx:a,total:e.length,onToggle:n,onMove:r},i))})})}var dn=[`general`,`data`,`appearance`,`toolbar`,`userActions`,`navigation`,`exportPrint`],fn=[`general`,`data`,`appearance`],Q=e=>e.type==null||e.type===`grid`,pn=e=>e.type==null||[`grid`,`kanban`,`gallery`].includes(e.type),mn=e=>e.type==null||[`grid`,`calendar`,`timeline`,`gantt`].includes(e.type),hn=e=>e.type==null||[`grid`,`kanban`].includes(e.type),gn=e=>e.type==null||[`grid`,`kanban`].includes(e.type),_n=e=>e.type==null||[`grid`,`gallery`].includes(e.type);function vn(e){let{t,fieldOptions:n,objectDef:r,updateField:i,filterGroupValue:a,sortItemsValue:o,essentialOnly:s=!1}=e,c=n.map(e=>({value:e.value,label:e.label})),l=[{value:``,label:t(`console.objectView.none`)},...c],u=[yn(t,r),bn(t),xn(t,i),Sn(t,i),Cn(t,i),wn(t,n,l,r,i,a,o),Tn(t,n,l,i),En(t,i),Dn(t,i),On(t,i)],d=s?u.filter(e=>dn.includes(e.key)).map(e=>fn.includes(e.key)?e:{...e,collapsible:!0,defaultCollapsed:!0}):u;return{breadcrumb:[t(`console.objectView.page`)],sections:d}}function yn(e,t){return{key:`general`,title:e(`console.objectView.general`),hint:e(`console.objectView.generalHint`),fields:[{key:`label`,label:e(`console.objectView.title`),type:`custom`,render:(t,n)=>(0,X.jsx)(H,{label:e(`console.objectView.title`),children:(0,X.jsx)(V,{"data-testid":`view-title-input`,className:`h-7 text-xs w-32 text-right`,value:t||``,onChange:e=>n(e.target.value)})})},{key:`description`,label:e(`console.objectView.description`),type:`custom`,render:(n,r)=>(0,X.jsx)(H,{label:e(`console.objectView.description`),children:(0,X.jsx)(V,{"data-testid":`view-description-input`,className:`h-7 text-xs w-32 text-right`,value:n??``,placeholder:t.description||e(`console.objectView.noDescription`),onChange:e=>r(e.target.value)})})},{key:`type`,label:e(`console.objectView.viewType`),type:`custom`,render:(t,n)=>(0,X.jsx)(H,{label:e(`console.objectView.viewType`),children:(0,X.jsx)(`select`,{"data-testid":`view-type-select`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground`,value:t||`grid`,onChange:e=>n(e.target.value),children:nn.map(e=>(0,X.jsx)(`option`,{value:e,children:tn[e]},e))})})}]}}function bn(e){let t=[`showSearch`,`showSort`,`showFilters`,`showHideFields`,`showGroup`,`showColor`,`showDensity`];return{key:`toolbar`,title:e(`console.objectView.toolbar`),hint:e(`console.objectView.toolbarHint`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_toolbarSummary`,label:e(`console.objectView.toolbar`),type:`custom`,render:(n,r,i)=>{let a=t.length,o=t.filter(e=>i[e]!==!1).length;return(0,X.jsx)(`div`,{className:`flex items-center gap-1.5 py-1`,"data-testid":`toolbar-summary-chip`,children:(0,X.jsx)(`span`,{className:`inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground`,children:e(`console.objectView.toolbarEnabledCount`,{count:o,total:a})})})}},$(`showSearch`,e(`console.objectView.enableSearch`),`toggle-showSearch`,!0),$(`showSort`,e(`console.objectView.enableSort`),`toggle-showSort`,!0),$(`showFilters`,e(`console.objectView.enableFilter`),`toggle-showFilters`,!0),$(`showHideFields`,e(`console.objectView.enableHideFields`),`toggle-showHideFields`,!0),$(`showGroup`,e(`console.objectView.enableGroup`),`toggle-showGroup`,!0,!1,void 0,pn),$(`showColor`,e(`console.objectView.enableColor`),`toggle-showColor`,!0,!1,void 0,mn),$(`showDensity`,e(`console.objectView.enableDensity`),`toggle-showDensity`,!0,!1,void 0,Q)]}}function xn(e,t){return{key:`navigation`,title:e(`console.objectView.navigationSection`),hint:e(`console.objectView.navigationHint`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_navigationMode`,label:e(`console.objectView.navigationMode`),type:`custom`,render:(n,r,i)=>{let a=i.navigation?.mode||`page`;return(0,X.jsx)(H,{label:e(`console.objectView.navigationMode`),children:(0,X.jsxs)(`select`,{"data-testid":`select-navigation-mode`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]`,value:a,onChange:e=>{let n=e.target.value;t(`navigation`,{...i.navigation||{},mode:n}),t(`clickIntoRecordDetails`,n!==`none`)},children:[(0,X.jsx)(`option`,{value:`page`,children:`Page`}),(0,X.jsx)(`option`,{value:`drawer`,children:`Drawer`}),(0,X.jsx)(`option`,{value:`modal`,children:`Modal`}),(0,X.jsx)(`option`,{value:`split`,children:`Split`}),(0,X.jsx)(`option`,{value:`popover`,children:`Popover`}),(0,X.jsx)(`option`,{value:`new_window`,children:`New Window`}),(0,X.jsx)(`option`,{value:`none`,children:`None`})]})})}},{key:`_navigationWidth`,label:e(`console.objectView.navigationWidth`),type:`custom`,helpText:e(`console.objectView.navigationWidthHint`),visibleWhen:e=>[`drawer`,`modal`,`split`].includes(e.navigation?.mode||`page`),render:(n,r,i)=>{let a=i.navigation?.mode||`page`;return(0,X.jsx)(H,{label:e(`console.objectView.navigationWidth`),children:(0,X.jsx)(V,{"data-testid":`input-navigation-width`,className:`h-7 text-xs w-24 text-right`,value:i.navigation?.width??``,placeholder:`600px`,onChange:e=>t(`navigation`,{...i.navigation||{},mode:a,width:e.target.value})})})}},{key:`_navigationOpenNewTab`,label:e(`console.objectView.openNewTab`),type:`custom`,helpText:e(`console.objectView.openNewTabHint`),visibleWhen:e=>[`page`,`new_window`].includes(e.navigation?.mode||`page`),render:(n,r,i)=>{let a=i.navigation?.mode||`page`;return(0,X.jsx)(H,{label:e(`console.objectView.openNewTab`),children:(0,X.jsx)(Ue,{"data-testid":`toggle-navigation-openNewTab`,checked:i.navigation?.openNewTab===!0,onCheckedChange:e=>t(`navigation`,{...i.navigation||{},mode:a,openNewTab:e}),className:`scale-75`})})}}]}}function Sn(e,t){return{key:`records`,title:e(`console.objectView.records`),hint:e(`console.objectView.recordsHint`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_selectionType`,label:e(`console.objectView.selectionMode`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(H,{label:e(`console.objectView.selectionMode`),children:(0,X.jsxs)(`select`,{"data-testid":`select-selection-type`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]`,value:i.selection?.type||`multiple`,onChange:e=>t(`selection`,{type:e.target.value}),children:[(0,X.jsx)(`option`,{value:`none`,children:e(`console.objectView.selectionNone`)}),(0,X.jsx)(`option`,{value:`single`,children:e(`console.objectView.selectionSingle`)}),(0,X.jsx)(`option`,{value:`multiple`,children:e(`console.objectView.selectionMultiple`)})]})})},{key:`_addRecord`,label:e(`console.objectView.addRecordEnabled`),type:`custom`,render:(n,r,i)=>{let a=i.addRecordViaForm===!0||i.addRecord?.enabled===!0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{label:e(`console.objectView.addRecordEnabled`),children:(0,X.jsx)(Ue,{"data-testid":`toggle-addRecord-enabled`,checked:a,onCheckedChange:e=>{t(`addRecordViaForm`,e),t(`addRecord`,{...i.addRecord||{},enabled:e})},className:`scale-75`})}),a&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{label:e(`console.objectView.addRecordPosition`),children:(0,X.jsxs)(`select`,{"data-testid":`select-addRecord-position`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[100px]`,value:i.addRecord?.position||`top`,onChange:e=>t(`addRecord`,{...i.addRecord||{},enabled:!0,position:e.target.value}),children:[(0,X.jsx)(`option`,{value:`top`,children:`Top`}),(0,X.jsx)(`option`,{value:`bottom`,children:`Bottom`})]})}),(0,X.jsx)(H,{label:e(`console.objectView.addRecordMode`),children:(0,X.jsxs)(`select`,{"data-testid":`select-addRecord-mode`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[100px]`,value:i.addRecord?.mode||`form`,onChange:e=>t(`addRecord`,{...i.addRecord||{},enabled:!0,mode:e.target.value}),children:[(0,X.jsx)(`option`,{value:`inline`,children:`Inline`}),(0,X.jsx)(`option`,{value:`form`,children:`Form`}),(0,X.jsx)(`option`,{value:`modal`,children:`Modal`})]})}),(0,X.jsx)(H,{label:e(`console.objectView.addRecordFormView`),children:(0,X.jsx)(V,{"data-testid":`input-addRecord-formView`,className:`h-7 text-xs w-24 text-right`,value:i.addRecord?.formView??``,onChange:e=>t(`addRecord`,{...i.addRecord||{},enabled:!0,formView:e.target.value})})})]})]})}}]}}function Cn(e,t){return{key:`exportPrint`,title:e(`console.objectView.exportPrint`),hint:e(`console.objectView.exportPrintHint`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_export`,label:e(`console.objectView.allowExport`),type:`custom`,render:(n,r,i)=>{let a=i.exportOptions!=null||i.allowExport===!0;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{label:e(`console.objectView.allowExport`),children:(0,X.jsx)(Ue,{"data-testid":`toggle-allowExport`,checked:a,onCheckedChange:e=>t(`allowExport`,e),className:`scale-75`})}),a&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{label:e(`console.objectView.exportFormats`),children:(0,X.jsx)(`div`,{"data-testid":`export-formats`,className:`flex flex-wrap gap-1`,children:[`csv`,`xlsx`,`json`,`pdf`].map(e=>(0,X.jsxs)(`label`,{className:`flex items-center gap-1 text-xs cursor-pointer`,children:[(0,X.jsx)(k,{"data-testid":`export-format-${e}`,checked:(i.exportOptions?.formats||[]).includes(e),onCheckedChange:n=>{let r=i.exportOptions?.formats||[],a=n?[...r,e]:r.filter(t=>t!==e);t(`exportOptions`,{...i.exportOptions||{},formats:a})},className:`h-3.5 w-3.5`}),e]},e))})}),(0,X.jsx)(H,{label:e(`console.objectView.exportMaxRecords`),children:(0,X.jsx)(V,{"data-testid":`input-export-maxRecords`,className:`h-7 text-xs w-20 text-right`,type:`number`,value:i.exportOptions?.maxRecords??``,placeholder:`0`,onChange:e=>t(`exportOptions`,{...i.exportOptions||{},maxRecords:Number(e.target.value)||void 0})})}),(0,X.jsx)(H,{label:e(`console.objectView.exportIncludeHeaders`),children:(0,X.jsx)(Ue,{"data-testid":`toggle-export-includeHeaders`,checked:i.exportOptions?.includeHeaders!==!1,onCheckedChange:e=>t(`exportOptions`,{...i.exportOptions||{},includeHeaders:e}),className:`scale-75`})}),(0,X.jsx)(H,{label:e(`console.objectView.exportFileNamePrefix`),children:(0,X.jsx)(V,{"data-testid":`input-export-fileNamePrefix`,className:`h-7 text-xs w-24 text-right`,value:i.exportOptions?.fileNamePrefix??``,placeholder:`export`,onChange:e=>t(`exportOptions`,{...i.exportOptions||{},fileNamePrefix:e.target.value})})})]})]})}},$(`showRecordCount`,e(`console.objectView.showRecordCount`),`toggle-showRecordCount`,!1,!0,void 0,Q),$(`allowPrinting`,e(`console.objectView.allowPrinting`),`toggle-allowPrinting`,!1,!0,void 0,Q)]}}function wn(e,t,n,r,i,a,o){return{key:`data`,title:e(`console.objectView.data`),hint:e(`console.objectView.listConfigHint`),collapsible:!0,fields:[{key:`_source`,label:e(`console.objectView.source`),type:`custom`,render:()=>(0,X.jsx)(H,{label:e(`console.objectView.source`),value:r.label||r.name})},{key:`_columns`,label:e(`console.objectView.fields`),type:`custom`,render:(n,r,a)=>{let o=Array.isArray(a.columns)?a.columns.length:0,s=o>0?e(`console.objectView.fieldsVisible`,{count:o}):e(`console.objectView.none`),c=(e,t)=>{let n=Array.isArray(a.columns)?[...a.columns]:[];if(t&&!n.includes(e))n.push(e);else if(!t){let t=n.indexOf(e);t>=0&&n.splice(t,1)}i(`columns`,n)};return(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(H,{label:e(`console.objectView.fields`),value:s,onClick:t}),children:(0,X.jsxs)(`div`,{"data-testid":`column-selector`,className:`pb-2 space-y-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-1 pb-1`,children:[(0,X.jsx)(V,{"data-testid":`column-search-input`,className:`h-6 text-xs flex-1`,placeholder:e(`console.objectView.searchFields`),onChange:e=>{let t=e.target,n=t.closest(`[data-testid="column-selector"]`);if(!n)return;let r=t.value.toLowerCase();n.querySelectorAll(`[data-field-name]`).forEach(e=>{let t=e.getAttribute(`data-field-name`)||``,n=e.getAttribute(`data-field-label`)||``;e.style.display=!r||t.toLowerCase().includes(r)||n.toLowerCase().includes(r)?``:`none`})}}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`column-show-all`,className:`text-xs text-primary hover:underline whitespace-nowrap`,onClick:()=>{i(`columns`,t.map(e=>e.value))},children:e(`console.objectView.showAllFields`)}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`column-hide-all`,className:`text-xs text-primary hover:underline whitespace-nowrap`,onClick:()=>{i(`columns`,[])},children:e(`console.objectView.hideAllFields`)})]}),(0,X.jsxs)(`div`,{className:`space-y-0.5 max-h-48 overflow-auto`,children:[Array.isArray(a.columns)&&a.columns.length>0&&(0,X.jsx)(`div`,{"data-testid":`selected-columns`,className:`space-y-0.5 pb-1 mb-1 border-b border-border/50`,children:(0,X.jsx)(un,{columns:a.columns,fieldOptions:t,onToggle:c,onMove:(e,t)=>{let n=Array.isArray(a.columns)?[...a.columns]:[],r=n.indexOf(e);if(r<0)return;let o=t===`up`?r-1:r+1;o<0||o>=n.length||([n[r],n[o]]=[n[o],n[r]],i(`columns`,n))},onReorder:e=>i(`columns`,e)})}),t.filter(e=>!Array.isArray(a.columns)||!a.columns.includes(e.value)).map(e=>(0,X.jsxs)(`div`,{"data-field-name":e.value,"data-field-label":e.label,className:`flex items-center gap-1 text-xs cursor-pointer hover:bg-accent/50 rounded-sm py-0.5 px-1 -mx-1`,children:[(0,X.jsx)(v,{className:`h-3 w-3 text-muted-foreground/20 shrink-0`}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`col-eye-${e.value}`,className:`h-5 w-5 flex items-center justify-center rounded hover:bg-accent shrink-0`,onClick:()=>c(e.value,!0),"aria-label":`Show ${e.label}`,children:(0,X.jsx)(Le,{className:`h-3.5 w-3.5 text-muted-foreground`})}),(0,X.jsx)(`span`,{className:`truncate text-muted-foreground`,children:e.label})]},e.value))]})]})})}},{key:`_filterBy`,label:e(`console.objectView.filterBy`),type:`custom`,render:(n,r,o)=>{let s=a.conditions.length,c=s>0?e(`console.objectView.filtersCount`,{count:s}):e(`console.objectView.none`);return(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(H,{label:e(`console.objectView.filterBy`),value:c,onClick:t}),children:(0,X.jsx)(`div`,{"data-testid":`inline-filter-builder`,className:`pb-2`,children:(0,X.jsx)(Be,{fields:t,value:a,onChange:e=>{i(`filter`,Qt(e.logic,e.conditions.map(e=>({field:e.field,operator:e.operator,value:e.value}))))},className:`[&_button]:h-7 [&_button]:text-xs [&_input]:h-7 [&_input]:text-xs`,showClearAll:!0})})})}},{key:`_sortBy`,label:e(`console.objectView.sortBy`),type:`custom`,render:(n,r,a)=>{let s=Array.isArray(a.sort)?a.sort.filter(e=>e.field).length:0,c=s>0?e(`console.objectView.sortsCount`,{count:s}):e(`console.objectView.none`);return(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(H,{label:e(`console.objectView.sortBy`),value:c,onClick:t}),children:(0,X.jsx)(`div`,{"data-testid":`inline-sort-builder`,className:`pb-2`,children:(0,X.jsx)(xe,{fields:t.map(e=>({value:e.value,label:e.label})),value:o,onChange:e=>{i(`sort`,e.map(e=>({id:e.id,field:e.field,order:e.order})))},className:`[&_button]:h-7 [&_button]:text-xs`})})})}},{key:`_grouping`,label:e(`console.objectView.groupBy`),type:`custom`,visibleWhen:_n,render:(n,r,a)=>{let o=Array.isArray(a.grouping?.fields)&&a.grouping.fields.length?{fields:a.grouping.fields.map(e=>({field:e.field,order:e.order===`desc`?`desc`:`asc`,collapsed:!!e.collapsed}))}:a.groupBy||a.groupBy2?{fields:[a.groupBy&&{field:a.groupBy,order:`asc`,collapsed:!1},a.groupBy2&&{field:a.groupBy2,order:`asc`,collapsed:!1}].filter(Boolean)}:void 0;return(0,X.jsx)(H,{label:e(`console.objectView.groupBy`),children:(0,X.jsx)(Ie,{value:o,fieldOptions:t,maxLevels:3,labels:{addGroup:e(`console.objectView.addGroup`,`Add group field`),collapseTitle:e(`console.objectView.collapsedByDefault`,`Collapsed by default`),removeTitle:e(`console.objectView.removeGroup`,`Remove`)},onChange:e=>{i(`grouping`,e),i(`groupBy`,e?.fields?.[0]?.field||void 0),i(`groupBy2`,e?.fields?.[1]?.field||void 0)}})})}},{key:`_pageSize`,label:e(`console.objectView.pageSize`),type:`custom`,render:(t,n,r)=>(0,X.jsx)(H,{label:e(`console.objectView.pageSize`),children:(0,X.jsx)(V,{"data-testid":`input-pagination-pageSize`,className:`h-7 text-xs w-20 text-right`,type:`number`,value:r.pagination?.pageSize??``,placeholder:`25`,onChange:e=>{let t=Number(e.target.value)||void 0;i(`pagination`,{...r.pagination||{},pageSize:t})}})})},{key:`_pageSizeOptions`,label:e(`console.objectView.pageSizeOptions`),type:`custom`,render:(t,n,r)=>(0,X.jsx)(H,{label:e(`console.objectView.pageSizeOptions`),children:(0,X.jsx)(V,{"data-testid":`input-pagination-pageSizeOptions`,className:`h-7 text-xs w-28 text-right`,value:(r.pagination?.pageSizeOptions||[]).join(`, `),placeholder:`10, 25, 50, 100`,onChange:e=>{let t=en(e.target.value);i(`pagination`,{...r.pagination||{},pageSizeOptions:t.length?t:void 0})}})})},kn(`searchableFields`,e(`console.objectView.searchableFields`),`searchable-fields-selector`,`searchable-field`,t,i,`selected`),kn(`filterableFields`,e(`console.objectView.filterableFields`),`filterable-fields-selector`,`filterable-field`,t,i,`selected`),kn(`hiddenFields`,e(`console.objectView.hiddenFields`),`hidden-fields-selector`,`hidden-field`,t,i,`hidden`),{key:`_quickFilters`,label:e(`console.objectView.quickFilters`),type:`custom`,render:(t,n,r)=>(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(H,{label:e(`console.objectView.quickFilters`),value:`${(r.quickFilters||[]).length} filters`,onClick:t}),children:(0,X.jsxs)(`div`,{"data-testid":`quick-filters-editor`,className:`pb-2 space-y-1`,children:[(r.quickFilters||[]).map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-1 text-xs`,children:[(0,X.jsx)(V,{"data-testid":`quick-filter-label-${t}`,className:`h-6 text-xs flex-1`,value:e.label||``,placeholder:`Label`,onChange:e=>{let n=[...r.quickFilters||[]];n[t]={...n[t],label:e.target.value},i(`quickFilters`,n)}}),(0,X.jsx)(k,{"data-testid":`quick-filter-default-${t}`,checked:e.defaultActive===!0,onCheckedChange:e=>{let n=[...r.quickFilters||[]];n[t]={...n[t],defaultActive:e},i(`quickFilters`,n)},className:`h-3.5 w-3.5`}),(0,X.jsx)(`button`,{type:`button`,className:`text-destructive hover:text-destructive/80 text-xs`,onClick:()=>{i(`quickFilters`,(r.quickFilters||[]).filter((e,n)=>n!==t))},children:`✕`})]},e.id||t)),(0,X.jsxs)(`button`,{type:`button`,"data-testid":`add-quick-filter`,className:`text-xs text-primary hover:underline`,onClick:()=>{let e={id:crypto.randomUUID(),label:``,filters:[],defaultActive:!1};i(`quickFilters`,[...r.quickFilters||[],e])},children:[`+ `,e(`console.objectView.addQuickFilter`)]})]})})},{key:`_userFilters`,label:e(`console.objectView.userFilters`),type:`custom`,render:(n,r,a)=>{let o=a.userFilters||{element:`dropdown`,fields:[]},s=o.element||`dropdown`,c=o.fields||[],l=o.tabs||[],u=t.filter(e=>{let t=Array.isArray(e.options)&&e.options.length>0,n=e.type===`select`||e.type===`boolean`;return t||n}).map(e=>e.value),d=[{value:`dropdown`,label:e(`console.objectView.ufDropdown`)},{value:`tabs`,label:e(`console.objectView.ufTabs`)},{value:`toggle`,label:e(`console.objectView.ufToggle`)}],f=s===`tabs`?l.length>0?l.map(e=>e.label||e.id).join(`, `):e(`console.objectView.none`):c.length>0?c.map(e=>t.find(t=>t.value===e.field)?.label||e.field).join(`, `):e(`console.objectView.none`);return(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(H,{label:e(`console.objectView.userFilters`),value:f,onClick:t}),children:(0,X.jsxs)(`div`,{"data-testid":`user-filters-editor`,className:`pb-2 space-y-2`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.ufElements`)}),(0,X.jsx)(`div`,{className:`flex gap-1`,children:d.map(e=>(0,X.jsx)(`button`,{type:`button`,"data-testid":`uf-element-${e.value}`,className:`text-xs px-2 py-0.5 rounded border ${s===e.value?`bg-primary text-primary-foreground border-primary`:`border-border hover:bg-accent`}`,onClick:()=>{i(`userFilters`,{...o,element:e.value})},children:e.label},e.value))})]}),(s===`dropdown`||s===`toggle`)&&(0,X.jsxs)(`div`,{"data-testid":`uf-fields-section`,className:`space-y-1`,children:[c.map((e,n)=>(0,X.jsxs)(`div`,{"data-testid":`uf-field-${n}`,className:`flex items-center gap-1 text-xs`,children:[(0,X.jsx)(`span`,{className:`flex-1 truncate`,children:t.find(t=>t.value===e.field)?.label||e.field}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`uf-remove-field-${n}`,className:`text-destructive hover:text-destructive/80 text-xs`,onClick:()=>{let e=c.filter((e,t)=>t!==n);i(`userFilters`,{...o,fields:e})},children:`✕`})]},e.field||n)),u.length>0?(0,X.jsxs)(`select`,{"data-testid":`uf-add-field`,className:`text-xs h-6 w-full border rounded px-1`,value:``,onChange:e=>{if(!e.target.value)return;let t={field:e.target.value};i(`userFilters`,{...o,fields:[...c,t]}),e.target.value=``},children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.ufAddField`)}),u.filter(e=>!c.some(t=>t.field===e)).map(e=>(0,X.jsx)(`option`,{value:e,children:t.find(t=>t.value===e)?.label||e},e))]}):(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.ufNoFields`)})]}),s===`tabs`&&(0,X.jsxs)(`div`,{"data-testid":`uf-tabs-section`,className:`space-y-1`,children:[l.map((t,n)=>(0,X.jsxs)(`div`,{"data-testid":`uf-tab-${n}`,className:`flex items-center gap-1 text-xs`,children:[(0,X.jsx)(V,{"data-testid":`uf-tab-label-${n}`,className:`h-6 text-xs flex-1`,value:t.label||``,placeholder:e(`console.objectView.ufTabLabel`),onChange:e=>{let t=[...l];t[n]={...t[n],label:e.target.value},i(`userFilters`,{...o,tabs:t})}}),(0,X.jsx)(k,{"data-testid":`uf-tab-default-${n}`,checked:t.default===!0,onCheckedChange:e=>{let t=l.map((t,r)=>({...t,default:r===n?e:!1}));i(`userFilters`,{...o,tabs:t})},className:`h-3.5 w-3.5`}),(0,X.jsx)(`button`,{type:`button`,"data-testid":`uf-remove-tab-${n}`,className:`text-destructive hover:text-destructive/80 text-xs`,onClick:()=>{let e=l.filter((e,t)=>t!==n);i(`userFilters`,{...o,tabs:e})},children:`✕`})]},t.id||n)),(0,X.jsx)(`button`,{type:`button`,"data-testid":`uf-add-tab`,className:`text-xs text-primary hover:underline`,onClick:()=>{let e={id:crypto.randomUUID(),label:``,filters:[],default:!1};i(`userFilters`,{...o,tabs:[...l,e]})},children:e(`console.objectView.ufAddTab`)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,X.jsx)(k,{"data-testid":`uf-show-all-records`,checked:o.showAllRecords!==!1,onCheckedChange:e=>{i(`userFilters`,{...o,showAllRecords:e?void 0:!1})},className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`text-xs`,children:e(`console.objectView.ufShowAllRecords`)})]}),(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(k,{"data-testid":`uf-allow-add-tab`,checked:o.allowAddTab===!0,onCheckedChange:e=>{i(`userFilters`,{...o,allowAddTab:e})},className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`text-xs`,children:e(`console.objectView.ufAllowAddTab`)})]})]})]})})}},$(`virtualScroll`,e(`console.objectView.virtualScroll`),`toggle-virtualScroll`,!1,!0,void 0,Q),{key:`_typeOptions`,label:`Type-specific options`,type:`custom`,render:(n,r,a)=>{let o=a.type||`grid`,s=(e,t,n)=>{i(e,{...a[e]||{},[t]:n})};return o===`grid`?(0,X.jsx)(`div`,{"data-testid":`type-options-section`,className:`hidden`}):(0,X.jsxs)(`div`,{"data-testid":`type-options-section`,className:`pt-1 space-y-2`,children:[o===`kanban`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.groupByField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-kanban-groupByField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.kanban?.groupByField||a.kanban?.groupField||``,onChange:e=>s(`kanban`,`groupByField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),o===`calendar`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.startDateField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-calendar-startDateField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.calendar?.startDateField||``,onChange:e=>s(`calendar`,`startDateField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.endDateField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-calendar-endDateField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.calendar?.endDateField||``,onChange:e=>s(`calendar`,`endDateField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.titleField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-calendar-titleField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.calendar?.titleField||``,onChange:e=>s(`calendar`,`titleField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})]}),o===`map`&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.latitudeField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-map-latitudeField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.map?.latitudeField||``,onChange:e=>s(`map`,`latitudeField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.longitudeField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-map-longitudeField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.map?.longitudeField||``,onChange:e=>s(`map`,`longitudeField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})]}),o===`gallery`&&(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.imageField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-gallery-imageField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a.gallery?.imageField||``,onChange:e=>s(`gallery`,`imageField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(o===`timeline`||o===`gantt`)&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.dateField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-${o}-dateField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a[o]?.dateField||a[o]?.startDateField||``,onChange:e=>s(o,`dateField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e(`console.objectView.titleField`)}),(0,X.jsxs)(`select`,{"data-testid":`type-opt-${o}-titleField`,className:`w-full text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground mt-1`,value:a[o]?.titleField||``,onChange:e=>s(o,`titleField`,e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.selectField`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})]})]})]})}}]}}function Tn(e,t,n,r){return{key:`appearance`,title:e(`console.objectView.appearance`),collapsible:!0,defaultCollapsed:!0,fields:[$(`striped`,e(`console.objectView.striped`),`toggle-striped`,!1,!0,void 0,Q),$(`bordered`,e(`console.objectView.bordered`),`toggle-bordered`,!1,!0,void 0,Q),{key:`color`,label:e(`console.objectView.color`),type:`custom`,visibleWhen:mn,render:(n,r)=>(0,X.jsx)(H,{label:e(`console.objectView.color`),children:(0,X.jsxs)(`select`,{"data-testid":`appearance-color`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]`,value:n||``,onChange:e=>r(e.target.value),children:[(0,X.jsx)(`option`,{value:``,children:e(`console.objectView.none`)}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]})})},$(`wrapHeaders`,e(`console.objectView.wrapHeaders`),`toggle-wrapHeaders`,!1,!0,void 0,Q),$(`showDescription`,e(`console.objectView.showFieldDescriptions`),`toggle-showDescription`,!0),$(`resizable`,e(`console.objectView.resizableColumns`),`toggle-resizable`,!1,!0,void 0,Q),{key:`rowHeight`,label:e(`console.objectView.rowHeight`),type:`custom`,visibleWhen:Q,render:(t,n)=>(0,X.jsx)(H,{label:e(`console.objectView.rowHeight`),children:(0,X.jsx)(`div`,{className:`flex gap-0.5`,"data-testid":`appearance-rowHeight`,role:`radiogroup`,"aria-label":e(`console.objectView.rowHeight`),children:rn.map(e=>(0,X.jsx)(`button`,{type:`button`,role:`radio`,"aria-checked":(t||`compact`)===e.value,"aria-label":e.value,"data-testid":`row-height-${e.value}`,className:`h-7 w-7 rounded border flex items-center justify-center ${(t||`compact`)===e.value?`border-primary bg-primary/10 text-primary`:`border-input text-muted-foreground hover:bg-accent/50`}`,onClick:()=>n(e.value),title:e.value,children:(0,X.jsxs)(`div`,{className:`flex flex-col items-center justify-center w-4 h-4 ${e.gapClass}`,children:[(0,X.jsx)(`div`,{className:`w-3.5 h-px bg-current rounded-full`}),(0,X.jsx)(`div`,{className:`w-3.5 h-px bg-current rounded-full`}),(0,X.jsx)(`div`,{className:`w-3.5 h-px bg-current rounded-full`})]})},e.value))})})},{key:`_conditionalFormatting`,label:e(`console.objectView.conditionalFormatting`),type:`custom`,visibleWhen:hn,render:(n,i,a)=>(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(H,{label:e(`console.objectView.conditionalFormatting`),value:`${(a.conditionalFormatting||[]).length} rules`,onClick:t}),children:(0,X.jsxs)(`div`,{"data-testid":`conditional-formatting-editor`,className:`pb-2 space-y-1`,children:[(a.conditionalFormatting||[]).map((e,n)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-1 text-xs border rounded p-1`,children:[(0,X.jsxs)(`select`,{"data-testid":`cf-field-${n}`,className:`text-xs h-6 rounded border border-input bg-background px-1 flex-1`,value:e.field||``,onChange:e=>{let t=[...a.conditionalFormatting||[]];t[n]={...t[n],field:e.target.value},r(`conditionalFormatting`,t)},children:[(0,X.jsx)(`option`,{value:``,children:`Field`}),t.map(e=>(0,X.jsx)(`option`,{value:e.value,children:e.label},e.value))]}),(0,X.jsxs)(`select`,{"data-testid":`cf-operator-${n}`,className:`text-xs h-6 rounded border border-input bg-background px-1`,value:e.operator||`equals`,onChange:e=>{let t=[...a.conditionalFormatting||[]];t[n]={...t[n],operator:e.target.value},r(`conditionalFormatting`,t)},children:[(0,X.jsx)(`option`,{value:`equals`,children:`=`}),(0,X.jsx)(`option`,{value:`not_equals`,children:`≠`}),(0,X.jsx)(`option`,{value:`contains`,children:`contains`}),(0,X.jsx)(`option`,{value:`greater_than`,children:`>`}),(0,X.jsx)(`option`,{value:`less_than`,children:`<`}),(0,X.jsx)(`option`,{value:`in`,children:`in`})]}),(0,X.jsx)(V,{"data-testid":`cf-value-${n}`,className:`h-6 text-xs w-16`,value:String(e.value??``),placeholder:`Value`,onChange:e=>{let t=[...a.conditionalFormatting||[]];t[n]={...t[n],value:e.target.value},r(`conditionalFormatting`,t)}}),(0,X.jsx)(`button`,{type:`button`,className:`text-destructive hover:text-destructive/80 text-xs`,onClick:()=>{r(`conditionalFormatting`,(a.conditionalFormatting||[]).filter((e,t)=>t!==n))},children:`✕`})]},n)),(0,X.jsxs)(`button`,{type:`button`,"data-testid":`add-conditional-rule`,className:`text-xs text-primary hover:underline`,onClick:()=>{let e={field:``,operator:`equals`,value:``};r(`conditionalFormatting`,[...a.conditionalFormatting||[],e])},children:[`+ `,e(`console.objectView.addRule`)]})]})})},{key:`_emptyState`,label:`Empty state`,type:`custom`,render:(t,n,i)=>(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(H,{label:e(`console.objectView.emptyStateTitle`),children:(0,X.jsx)(V,{"data-testid":`input-emptyState-title`,className:`h-7 text-xs w-28 text-right`,value:i.emptyState?.title??``,onChange:e=>r(`emptyState`,{...i.emptyState||{},title:e.target.value})})}),(0,X.jsx)(H,{label:e(`console.objectView.emptyStateMessage`),children:(0,X.jsx)(V,{"data-testid":`input-emptyState-message`,className:`h-7 text-xs w-28 text-right`,value:i.emptyState?.message??``,onChange:e=>r(`emptyState`,{...i.emptyState||{},message:e.target.value})})}),(0,X.jsx)(H,{label:e(`console.objectView.emptyStateIcon`),children:(0,X.jsx)(V,{"data-testid":`input-emptyState-icon`,className:`h-7 text-xs w-28 text-right`,value:i.emptyState?.icon??``,onChange:e=>r(`emptyState`,{...i.emptyState||{},icon:e.target.value})})})]})}]}}function En(e,t){return{key:`userActions`,title:e(`console.objectView.userActions`),collapsible:!0,defaultCollapsed:!0,fields:[$(`inlineEdit`,e(`console.objectView.inlineEdit`),`toggle-inlineEdit`,!0,!1,void 0,Q),$(`addDeleteRecordsInline`,e(`console.objectView.addDeleteRecordsInline`),`toggle-addDeleteRecordsInline`,!0,!1,void 0,Q),{key:`_rowActions`,label:e(`console.objectView.rowActions`),type:`custom`,visibleWhen:gn,render:(n,r,i)=>(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(H,{label:e(`console.objectView.rowActions`),value:`${(i.rowActions||[]).length} actions`,onClick:t}),children:(0,X.jsx)(`div`,{"data-testid":`row-actions-selector`,className:`pb-2 space-y-0.5 max-h-36 overflow-auto`,children:(0,X.jsx)(V,{"data-testid":`input-rowActions`,className:`h-7 text-xs w-full`,value:(i.rowActions||[]).join(`, `),placeholder:`edit, delete, duplicate`,onChange:e=>{t(`rowActions`,$t(e.target.value))}})})})},{key:`_bulkActions`,label:e(`console.objectView.bulkActions`),type:`custom`,visibleWhen:gn,render:(n,r,i)=>(0,X.jsx)(Z,{renderSummary:t=>(0,X.jsx)(H,{label:e(`console.objectView.bulkActions`),value:`${(i.bulkActions||[]).length} actions`,onClick:t}),children:(0,X.jsx)(`div`,{"data-testid":`bulk-actions-selector`,className:`pb-2 space-y-0.5 max-h-36 overflow-auto`,children:(0,X.jsx)(V,{"data-testid":`input-bulkActions`,className:`h-7 text-xs w-full`,value:(i.bulkActions||[]).join(`, `),placeholder:`delete, export, assign`,onChange:e=>{t(`bulkActions`,$t(e.target.value))}})})})}]}}function Dn(e,t){return{key:`sharing`,title:e(`console.objectView.sharing`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_sharingEnabled`,label:e(`console.objectView.sharingEnabled`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(H,{label:e(`console.objectView.sharingEnabled`),children:(0,X.jsx)(Ue,{"data-testid":`toggle-sharing-enabled`,checked:i.sharing?.enabled===!0,onCheckedChange:e=>t(`sharing`,{...i.sharing||{},enabled:e}),className:`scale-75`})})},{key:`_sharingVisibility`,label:e(`console.objectView.sharingVisibility`),type:`custom`,visibleWhen:e=>e.sharing?.enabled===!0,render:(n,r,i)=>(0,X.jsx)(H,{label:e(`console.objectView.sharingVisibility`),children:(0,X.jsxs)(`select`,{"data-testid":`select-sharing-visibility`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[120px]`,value:i.sharing?.visibility||`private`,onChange:e=>t(`sharing`,{...i.sharing||{},enabled:!0,visibility:e.target.value}),children:[(0,X.jsx)(`option`,{value:`private`,children:`Private`}),(0,X.jsx)(`option`,{value:`team`,children:`Team`}),(0,X.jsx)(`option`,{value:`organization`,children:`Organization`}),(0,X.jsx)(`option`,{value:`public`,children:`Public`})]})})}]}}function On(e,t){return{key:`accessibility`,title:e(`console.objectView.accessibility`),collapsible:!0,defaultCollapsed:!0,fields:[{key:`_ariaLabel`,label:e(`console.objectView.ariaLabel`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(H,{label:e(`console.objectView.ariaLabel`),children:(0,X.jsx)(V,{"data-testid":`input-aria-label`,className:`h-7 text-xs w-28 text-right`,value:i.aria?.label??``,onChange:e=>t(`aria`,{...i.aria||{},label:e.target.value})})})},{key:`_ariaDescribedBy`,label:e(`console.objectView.ariaDescribedBy`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(H,{label:e(`console.objectView.ariaDescribedBy`),children:(0,X.jsx)(V,{"data-testid":`input-aria-describedBy`,className:`h-7 text-xs w-28 text-right`,value:i.aria?.describedBy??``,onChange:e=>t(`aria`,{...i.aria||{},describedBy:e.target.value})})})},{key:`_ariaLive`,label:e(`console.objectView.ariaLive`),type:`custom`,render:(n,r,i)=>(0,X.jsx)(H,{label:e(`console.objectView.ariaLive`),children:(0,X.jsxs)(`select`,{"data-testid":`select-aria-live`,className:`text-xs h-7 rounded-md border border-input bg-background px-2 text-foreground max-w-[100px]`,value:i.aria?.live||`off`,onChange:e=>t(`aria`,{...i.aria||{},live:e.target.value}),children:[(0,X.jsx)(`option`,{value:`off`,children:`Off`}),(0,X.jsx)(`option`,{value:`polite`,children:`Polite`}),(0,X.jsx)(`option`,{value:`assertive`,children:`Assertive`})]})})}]}}function $(e,t,n,r=!1,i=!1,a,o){return{key:e,label:t,type:`custom`,disabledWhen:a,visibleWhen:o,render:(e,o,s)=>(0,X.jsx)(H,{label:t,children:(0,X.jsx)(Ue,{"data-testid":n,checked:i?e===!0:r?e!==!1:!!e,disabled:a?a(s):!1,onCheckedChange:e=>o(e),className:`scale-75`})})}}function kn(e,t,n,r,i,a,o,s){return{key:`_${e}`,label:t,type:`custom`,visibleWhen:s,render:(s,c,l)=>(0,X.jsx)(Z,{renderSummary:n=>(0,X.jsx)(H,{label:t,value:`${(l[e]||[]).length} ${o}`,onClick:n}),children:(0,X.jsx)(`div`,{"data-testid":n,className:`pb-2 space-y-0.5 max-h-36 overflow-auto`,children:i.map(t=>(0,X.jsxs)(`label`,{className:`flex items-center gap-2 text-xs cursor-pointer hover:bg-accent/50 rounded-sm py-0.5 px-1 -mx-1`,children:[(0,X.jsx)(k,{"data-testid":`${r}-${t.value}`,checked:(l[e]||[]).includes(t.value),onCheckedChange:n=>{let r=l[e]||[];a(e,n?[...r,t.value]:r.filter(e=>e!==t.value))},className:`h-3.5 w-3.5`}),(0,X.jsx)(`span`,{className:`truncate`,children:t.label})]},t.value))})})}}var An=o,jn=({schema:e})=>(0,X.jsx)(Et,{schema:e,dataSource:(0,Y.useContext)(An)?.dataSource??null});i.register(`object-view`,jn,{namespace:`plugin-view`,label:`Object View`,category:`view`,icon:`LayoutDashboard`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`title`,type:`string`,label:`Title`},{name:`description`,type:`string`,label:`Description`},{name:`layout`,type:`enum`,label:`Form Layout`,enum:[`drawer`,`modal`,`page`]},{name:`defaultViewType`,type:`enum`,label:`Default View Type`,enum:[`grid`,`kanban`,`gallery`,`calendar`,`timeline`,`gantt`,`map`]},{name:`defaultListView`,type:`string`,label:`Default Named View`},{name:`showSearch`,type:`boolean`,label:`Show Search`},{name:`showFilters`,type:`boolean`,label:`Show Filters`},{name:`showCreate`,type:`boolean`,label:`Show Create Button`},{name:`showRefresh`,type:`boolean`,label:`Show Refresh Button`},{name:`showViewSwitcher`,type:`boolean`,label:`Show View Switcher`},{name:`listViews`,type:`object`,label:`Named List Views`},{name:`navigation`,type:`object`,label:`Navigation Config`},{name:`searchableFields`,type:`array`,label:`Searchable Fields`},{name:`filterableFields`,type:`array`,label:`Filterable Fields`}],defaultProps:{layout:`drawer`,defaultViewType:`grid`,showSearch:!0,showFilters:!0,showCreate:!0,showRefresh:!0,showViewSwitcher:!0}}),i.register(`view`,jn,{namespace:`plugin-view`,label:`View`,category:`view`}),i.register(`view-switcher`,wt,{namespace:`view`,label:`View Switcher`,category:`view`,icon:`LayoutGrid`,inputs:[{name:`views`,type:`array`,label:`Views`,required:!0},{name:`defaultView`,type:`string`,label:`Default View`},{name:`activeView`,type:`string`,label:`Active View`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`tabs`,`buttons`,`dropdown`]},{name:`position`,type:`enum`,label:`Position`,enum:[`top`,`bottom`,`left`,`right`]},{name:`persistPreference`,type:`boolean`,label:`Persist Preference`},{name:`storageKey`,type:`string`,label:`Storage Key`},{name:`onViewChange`,type:`string`,label:`On View Change Event`}],defaultProps:{variant:`tabs`,position:`top`,defaultView:`grid`,views:[{type:`grid`,label:`Grid`,schema:{type:`text`,content:`Grid view`}},{type:`list`,label:`List`,schema:{type:`text`,content:`List view`}}]}}),i.register(`filter-ui`,At,{namespace:`view`,label:`Filter UI`,category:`view`,icon:`SlidersHorizontal`,inputs:[{name:`filters`,type:`array`,label:`Filters`,required:!0},{name:`values`,type:`object`,label:`Values`},{name:`onChange`,type:`string`,label:`On Change Event`},{name:`showClear`,type:`boolean`,label:`Show Clear Button`},{name:`showApply`,type:`boolean`,label:`Show Apply Button`},{name:`layout`,type:`enum`,label:`Layout`,enum:[`inline`,`popover`,`drawer`]}],defaultProps:{layout:`inline`,showApply:!1,showClear:!0,filters:[{field:`name`,label:`Name`,type:`text`,placeholder:`Search name`},{field:`status`,label:`Status`,type:`select`,options:[{label:`Open`,value:`open`},{label:`Closed`,value:`closed`}]},{field:`created_at`,label:`Created`,type:`date`}]}}),i.register(`sort-ui`,Ft,{namespace:`view`,label:`Sort UI`,category:`view`,icon:`ArrowUpDown`,inputs:[{name:`fields`,type:`array`,label:`Fields`,required:!0},{name:`sort`,type:`array`,label:`Sort`},{name:`onChange`,type:`string`,label:`On Change Event`},{name:`multiple`,type:`boolean`,label:`Allow Multiple`},{name:`variant`,type:`enum`,label:`Variant`,enum:[`dropdown`,`buttons`]}],defaultProps:{variant:`dropdown`,multiple:!0,fields:[{field:`name`,label:`Name`},{field:`created_at`,label:`Created At`}],sort:[{field:`name`,direction:`asc`}]}}),i.register(`shared-view-link`,Rt,{namespace:`view`,label:`Shared View Link`,category:`view`,icon:`Share2`,inputs:[{name:`objectName`,type:`string`,label:`Object Name`,required:!0},{name:`viewId`,type:`string`,label:`View ID`},{name:`baseUrl`,type:`string`,label:`Base URL`}],defaultProps:{objectName:`objects`,viewId:`default`}}),i.register(`view:simple`,({schema:e,className:t,children:n,dataSource:r,...i})=>(0,X.jsx)(`div`,{className:t,style:e.props?.columns?{display:`grid`,gridTemplateColumns:`repeat(${e.props.columns}, 1fr)`,gap:`1rem`}:void 0,...i,children:n}),{namespace:`plugin-view`,label:`Simple View`,category:`view`});export{sn as a,Et as c,on as i,tn as n,Gt as o,an as r,Ht as s,vn as t};