@viglet/viglet-design-system 2026.3.16 → 2026.3.18

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 (114) hide show
  1. package/README.md +55 -19
  2. package/dist/{badge-locale-Bx7m7tg2.js → badge-locale-BwsfyQJT.js} +7 -7
  3. package/dist/{badge-locale-1_BmNTro.cjs → badge-locale-D4J5OlvK.cjs} +1 -1
  4. package/dist/bento/bento-actions-menu.d.ts +1 -1
  5. package/dist/bento/bento-back-to-top.d.ts +1 -1
  6. package/dist/bento/bento-calendar.d.ts +1 -1
  7. package/dist/bento/bento-calendar.d.ts.map +1 -1
  8. package/dist/bento/bento-change-cell.d.ts +22 -0
  9. package/dist/bento/bento-change-cell.d.ts.map +1 -0
  10. package/dist/bento/bento-change-mark.d.ts +1 -1
  11. package/dist/bento/bento-command-palette.d.ts +1 -1
  12. package/dist/bento/bento-command-palette.d.ts.map +1 -1
  13. package/dist/bento/bento-count-tile.d.ts +1 -1
  14. package/dist/bento/bento-data-table.d.ts +12 -2
  15. package/dist/bento/bento-data-table.d.ts.map +1 -1
  16. package/dist/bento/bento-diff.d.ts +1 -1
  17. package/dist/bento/bento-diff.d.ts.map +1 -1
  18. package/dist/bento/bento-empty-state.d.ts +4 -4
  19. package/dist/bento/bento-empty-state.d.ts.map +1 -1
  20. package/dist/bento/bento-entity-shell.d.ts +1 -1
  21. package/dist/bento/bento-entity-tile.d.ts +7 -3
  22. package/dist/bento/bento-entity-tile.d.ts.map +1 -1
  23. package/dist/bento/bento-filter-bar.d.ts +1 -1
  24. package/dist/bento/bento-filter-bar.d.ts.map +1 -1
  25. package/dist/bento/bento-form-hero.d.ts +1 -1
  26. package/dist/bento/bento-form-section.d.ts +8 -7
  27. package/dist/bento/bento-form-section.d.ts.map +1 -1
  28. package/dist/bento/bento-hero-icon-picker.d.ts +1 -1
  29. package/dist/bento/bento-hero.d.ts +3 -3
  30. package/dist/bento/bento-identity-cell.d.ts +22 -0
  31. package/dist/bento/bento-identity-cell.d.ts.map +1 -0
  32. package/dist/bento/bento-inline-edit.d.ts +1 -1
  33. package/dist/bento/bento-inline-edit.d.ts.map +1 -1
  34. package/dist/bento/bento-layout.d.ts +4 -2
  35. package/dist/bento/bento-layout.d.ts.map +1 -1
  36. package/dist/bento/bento-list-page.d.ts +32 -10
  37. package/dist/bento/bento-list-page.d.ts.map +1 -1
  38. package/dist/bento/bento-nav-rail.d.ts +1 -1
  39. package/dist/bento/bento-palette-trigger.d.ts +1 -1
  40. package/dist/bento/bento-panel.d.ts +8 -7
  41. package/dist/bento/bento-panel.d.ts.map +1 -1
  42. package/dist/bento/bento-save-bar.d.ts +2 -2
  43. package/dist/bento/bento-scroll-save-bar.d.ts +1 -1
  44. package/dist/bento/bento-section-chrome.d.ts +3 -3
  45. package/dist/bento/bento-section.d.ts +1 -1
  46. package/dist/bento/bento-shell.d.ts +1 -1
  47. package/dist/bento/bento-shell.d.ts.map +1 -1
  48. package/dist/bento/bento-shortcuts-dialog.d.ts +1 -1
  49. package/dist/bento/bento-split-page.d.ts +1 -1
  50. package/dist/bento/bento-status-marker.d.ts +20 -4
  51. package/dist/bento/bento-status-marker.d.ts.map +1 -1
  52. package/dist/bento/bento-tile.d.ts +1 -1
  53. package/dist/bento/bento-tones.d.ts +1 -1
  54. package/dist/bento/bento-trail.d.ts +1 -1
  55. package/dist/bento/bento-user-menu.d.ts +1 -1
  56. package/dist/bento/bento-version-rail.d.ts +1 -1
  57. package/dist/bento/index.d.ts +4 -2
  58. package/dist/bento/index.d.ts.map +1 -1
  59. package/dist/bento.cjs +3 -3
  60. package/dist/bento.css +39 -5
  61. package/dist/bento.es.js +1301 -1136
  62. package/dist/catalogue.json +155 -32
  63. package/dist/components/app-switcher.d.ts +1 -1
  64. package/dist/components/backend-status.d.ts +2 -2
  65. package/dist/components/language-select.d.ts +1 -1
  66. package/dist/components/language-switcher.d.ts +1 -1
  67. package/dist/components/login/login.d.ts +11 -11
  68. package/dist/components/mode-toggle.d.ts +2 -2
  69. package/dist/components/router/loading-provider.d.ts +1 -1
  70. package/dist/components/startup-first/startup-first.d.ts +11 -11
  71. package/dist/components/theme-provider.d.ts +1 -1
  72. package/dist/components/ui/button.d.ts.map +1 -1
  73. package/dist/components/ui/floating-formulas-bg.d.ts +1 -1
  74. package/dist/components/ui/form-actions.d.ts +1 -1
  75. package/dist/components/ui/glass-card.d.ts +2 -2
  76. package/dist/components/ui/gradient-button.d.ts.map +1 -1
  77. package/dist/components/ui/icon-picker-dialog.d.ts +1 -1
  78. package/dist/components/ui/pulse-ring.d.ts +1 -1
  79. package/dist/components/ui/resizable.d.ts +3 -3
  80. package/dist/components/ui/section-card.d.ts +1 -1
  81. package/dist/components/ui/sidebar.d.ts.map +1 -1
  82. package/dist/components/ui/skeleton.d.ts +1 -1
  83. package/dist/components/ui/sonner.d.ts +1 -1
  84. package/dist/components/ui/stepper.d.ts +1 -1
  85. package/dist/components/ui/sticky-save-bar.d.ts +2 -2
  86. package/dist/components/ui/toggle.d.ts.map +1 -1
  87. package/dist/components/ui/viglet-assistant.d.ts +1 -1
  88. package/dist/components/ui/viglet-avatar.d.ts +1 -1
  89. package/dist/components/viglet-app-switcher.d.ts +1 -1
  90. package/dist/contexts/breadcrumb.context.d.ts +1 -1
  91. package/dist/exports.json +11 -1
  92. package/dist/floating-formulas-bg.css +3 -1
  93. package/dist/i18n/index.d.ts +20 -0
  94. package/dist/i18n/index.d.ts.map +1 -1
  95. package/dist/i18n/locales/en/bento.json.d.ts +10 -0
  96. package/dist/i18n/locales/pt/bento.json.d.ts +10 -0
  97. package/dist/i18n.cjs +1 -1
  98. package/dist/i18n.es.js +20 -0
  99. package/dist/index.cjs +1 -1
  100. package/dist/index.es.js +972 -1045
  101. package/dist/lib/busy.d.ts +1 -1
  102. package/dist/{loading-provider-D-_5G-08.js → loading-provider-Dh7jdSol.js} +2 -2
  103. package/dist/loading-provider-bLW_X3A1.cjs +1 -0
  104. package/dist/preset.css +66 -7
  105. package/dist/router.cjs +1 -1
  106. package/dist/router.es.js +1 -1
  107. package/dist/user.context-BqsOcMaZ.cjs +1 -0
  108. package/dist/{user.context-DUs2lT6D.js → user.context-vCmnGlIb.js} +335 -262
  109. package/dist/viglet-design-system.css +1 -1
  110. package/docs/BENTO-AUTHORING.md +19 -3
  111. package/docs/reference/README.md +5 -7
  112. package/package.json +1 -1
  113. package/dist/loading-provider-E4tIG9BM.cjs +0 -1
  114. package/dist/user.context-uYif5Mp2.cjs +0 -1
package/dist/bento.cjs CHANGED
@@ -1,5 +1,5 @@
1
- "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-Oagwe_oa.cjs"),t=require("./badge-locale-1_BmNTro.cjs"),n=require("./user.context-uYif5Mp2.cjs"),r=require("./loading-provider-E4tIG9BM.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("react-i18next"),s=require("@tabler/icons-react"),c=require("@iconify/react"),l=require("react-resizable-panels"),u=require("react-router-dom"),d=require("@tanstack/react-table"),f=require("@dnd-kit/core"),p=require("@dnd-kit/sortable"),m=require("@dnd-kit/utilities"),h=require("sonner");var g={default:``,destructive:`bento-item-danger`},_=new Set;function v(e){process.env.NODE_ENV===`production`||_.has(e)||(_.add(e),console.warn(`BentoActionsMenu: the action "${e}" has no id. Give it a stable name, such as "post.delete": it is rendered as data-action-id so a console verb can be matched to an agent verb, and it becomes required in the next release.`))}function y({actions:e,triggerLabel:t}){let{t:r}=(0,o.useTranslation)();if(e.length===0)return null;for(let t of e)t.id||v(t.label);return(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,"aria-label":t??r(`forms.formActions.moreActions`,{defaultValue:`More actions`}),className:`bento-tile-clickable inline-flex h-9 w-9 items-center justify-center rounded-full border border-border/60 bg-card/60 text-muted-foreground backdrop-blur transition-colors duration-200 hover:text-foreground`,children:(0,a.jsx)(s.IconDotsVertical,{size:18})})}),(0,a.jsx)(n.P,{align:`end`,sideOffset:8,className:`bento-dropdown min-w-44 p-1.5`,children:e.map(e=>{let t=e.icon,r=g[e.tone??`default`];return(0,a.jsxs)(n.I,{"data-action-id":e.id,onSelect:e.onSelect,disabled:e.disabled,className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 ${r}`,children:[(0,a.jsx)(t,{size:16}),e.label]},e.id??e.label)})})]})}var b={blue:`bento-tone-blue`,indigo:`bento-tone-indigo`,violet:`bento-tone-violet`,emerald:`bento-tone-emerald`,amber:`bento-tone-amber`,rose:`bento-tone-rose`,slate:`bento-tone-slate`},x=Object.keys(b);function S(e){return`bento-chip ${b[e]??b.slate}`}function C({to:e,icon:t,tone:n,label:r,count:i,span:o}){let s=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`grid h-9 w-9 place-items-center rounded-2xl text-white shadow-md ${S(n)}`,children:(0,a.jsx)(t,{size:18})}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-3xl font-semibold tabular-nums tracking-tight`,children:i}),(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:r})]})]}),c=`bento-tile bento-glass group relative flex flex-col justify-between overflow-hidden p-4 ${o}${e?` bento-tile-clickable`:``}`;return e?(0,a.jsx)(u.Link,{to:e,className:c,children:s}):(0,a.jsx)(`div`,{className:c,children:s})}var w=6,T={rowSortingFeature:d.rowSortingFeature,coreRowModel:(0,d.createCoreRowModel)(),sortedRowModel:(0,d.createSortedRowModel)()};function E({rows:t,getRowId:r,columns:c,label:l,getRowLabel:u,rowActions:f,selectionActions:p,selectedIds:m,onSelectionChange:h,selectionScope:g,layout:_,onLayoutChange:v,onRowOpen:b,rowHeight:x=44,height:S=480,empty:C}){let{t:E}=(0,o.useTranslation)(),[D,O]=(0,i.useState)([]),[k,A]=(0,i.useState)({hidden:[]}),[j,M]=(0,i.useState)(new Set),[N,P]=(0,i.useState)(null),[F,I]=(0,i.useState)(g),[L,ee]=(0,i.useState)(void 0);F!==g&&(I(g),M(new Set),ee(m),P(null));let te=(0,i.useMemo)(()=>new Set(m??[]),[m]),R=j;m!==void 0&&(R=m===L?new Set:te);let z=(0,i.useRef)(g);(0,i.useEffect)(()=>{z.current!==g&&(z.current=g,h?.([]))},[g,h]);let[B,V]=(0,i.useState)(0),[H,U]=(0,i.useState)(0),W=(0,i.useRef)(null),ne=(0,i.useRef)(new Map),re=(0,i.useRef)(!1),G=(p?.length??0)>0,ie=e=>u?.(e)??r(e),K=(0,i.useMemo)(()=>c.map(e=>({id:e.id,accessorFn:t=>e.sortValue?.(t)??null,enableSorting:e.sortValue!==void 0})),[c]),q=(0,d.useTable)({features:T,data:t,columns:K,state:{sorting:D},onSortingChange:O}).getRowModel().rows.map(e=>e.original),ae=_??k,J=c.filter(e=>e.hideable===!1||!ae.hidden.includes(e.id)),oe=[G?`2.75rem`:null,...J.map(e=>e.width??`minmax(8rem, 1fr)`),f?.length?`3.25rem`:null].filter(Boolean).join(` `),Y=q.length,se=Math.min(S,Y*x),ce=Math.max(1,Math.floor(se/x)),le=Math.max(0,Math.floor(H/x)-w),ue=Math.min(Y,Math.ceil((H+se)/x)+w),de=Math.min(B,Math.max(0,Y-1));(0,i.useEffect)(()=>{re.current&&(re.current=!1,ne.current.get(de)?.focus())},[de,le]);function fe(e){m===void 0&&M(e),h?.([...e])}function pe(e,t){let[n,i]=e<=t?[e,t]:[t,e];fe(new Set(q.slice(n,i+1).map(r)))}function me(e){let t=r(q[e]),n=new Set(R);n.has(t)?n.delete(t):n.add(t),fe(n),P(e)}function X(e,t){let n=Math.max(0,Math.min(Y-1,e));if(t&&G){let e=N??de;P(e),pe(e,n)}let r=W.current,i=n*x;if(r){let e=r.scrollTop;i<e?e=i:i+x>e+se&&(e=i+x-se),e!==r.scrollTop&&(r.scrollTop=e,U(e))}re.current=!0,V(n)}function he(e,t){if(e.target!==e.currentTarget)return;let n=e.shiftKey;switch(e.key){case`ArrowDown`:X(t+1,n);break;case`ArrowUp`:X(t-1,n);break;case`PageDown`:X(t+ce,n);break;case`PageUp`:X(t-ce,n);break;case`Home`:X(0,n);break;case`End`:X(Y-1,n);break;case` `:if(!G)return;me(t);break;case`Enter`:if(!b)return;b(q[t]);break;case`Escape`:if(!G||R.size===0)return;fe(new Set),P(null);break;case`a`:case`A`:if(!G||!(e.ctrlKey||e.metaKey))return;fe(new Set(q.map(r)));break;default:return}e.preventDefault()}function ge(e,t){if(!e.target.closest(`button, a, input, [role='checkbox']`)&&(V(t),G)){if(e.shiftKey){let e=N??de;P(e),pe(e,t)}else e.metaKey||e.ctrlKey?me(t):(fe(new Set([r(q[t])])),P(t))}}function _e(e){let t=D.find(t=>t.id===e);t?t.desc?O([]):O([{id:e,desc:!0}]):O([{id:e,desc:!1}])}function ve(e,t){let n={hidden:t?[...ae.hidden,e]:ae.hidden.filter(t=>t!==e)};_===void 0&&A(n),v?.(n)}let Z=q.filter(e=>R.has(r(e))),Q=Y>0&&Z.length===Y,ye=c.filter(e=>e.hideable!==!1);return(0,a.jsxs)(`div`,{"data-slot":`bento-data-table`,className:`bento-glass overflow-hidden rounded-2xl`,children:[(0,a.jsxs)(`div`,{className:`flex min-h-12 flex-wrap items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,a.jsx)(`span`,{"aria-live":`polite`,className:`text-sm font-medium`,children:Z.length>0?E(`bento.table.selected`,{defaultValue:`{{count}} selected`,count:Z.length}):``}),Z.length>0&&(0,a.jsxs)(`div`,{role:`toolbar`,"aria-label":E(`bento.table.selectionActions`,{defaultValue:`Actions on the selection`}),className:`flex flex-wrap items-center gap-2`,children:[p?.map(t=>{let r=t.icon;return(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,className:e.t(`gap-1.5`,t.tone===`destructive`&&`bento-item-danger`),onClick:()=>t.onSelect(Z),children:[(0,a.jsx)(r,{size:16}),t.label]},t.id)}),(0,a.jsx)(n.J,{variant:`ghost`,size:`sm`,onClick:()=>fe(new Set),children:E(`bento.table.clearSelection`,{defaultValue:`Clear selection`})})]}),ye.length>0&&(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsxs)(n.J,{variant:`ghost`,size:`sm`,className:`ml-auto gap-1.5`,children:[(0,a.jsx)(s.IconColumns3,{size:16,"aria-hidden":`true`}),E(`bento.table.columns`,{defaultValue:`Columns`})]})}),(0,a.jsx)(n.P,{align:`end`,className:`bento-dropdown min-w-44 p-1.5`,children:ye.map(e=>(0,a.jsx)(n.N,{checked:!ae.hidden.includes(e.id),onCheckedChange:t=>ve(e.id,t!==!0),onSelect:e=>e.preventDefault(),children:e.header},e.id))})]})]}),(0,a.jsxs)(`div`,{role:`grid`,"aria-label":l,"aria-rowcount":Y+1,"aria-colcount":J.length+ +!!G+ +!!f?.length,"aria-multiselectable":G?`true`:void 0,children:[(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsxs)(`div`,{role:`row`,"aria-rowindex":1,className:`grid items-center border-b border-border/50 px-1 text-xs font-medium text-muted-foreground`,style:{gridTemplateColumns:oe,minHeight:x},children:[G&&(0,a.jsx)(`div`,{role:`columnheader`,className:`grid place-items-center`,children:(0,a.jsx)(n.q,{"aria-label":E(`bento.table.selectAll`,{defaultValue:`Select all rows`}),checked:Q?!0:Z.length>0&&`indeterminate`,onCheckedChange:()=>fe(Q?new Set:new Set(q.map(r)))})}),J.map(e=>{let t=D.find(t=>t.id===e.id),n=t?t.desc?`descending`:`ascending`:`none`;return(0,a.jsx)(`div`,{role:`columnheader`,"aria-sort":e.sortValue?n:void 0,className:`min-w-0 px-2`,children:e.sortValue?(0,a.jsxs)(`button`,{type:`button`,onClick:()=>_e(e.id),className:`inline-flex max-w-full items-center gap-1 rounded-md py-1 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(`span`,{className:`truncate`,children:e.header}),n===`ascending`&&(0,a.jsx)(s.IconArrowUp,{size:14,"aria-hidden":`true`}),n===`descending`&&(0,a.jsx)(s.IconArrowDown,{size:14,"aria-hidden":`true`}),n===`none`&&(0,a.jsx)(s.IconArrowsSort,{size:14,"aria-hidden":`true`,className:`opacity-40`})]}):(0,a.jsx)(`span`,{className:`block truncate py-1`,children:e.header})},e.id)}),f?.length?(0,a.jsx)(`div`,{role:`columnheader`,className:`px-2`,children:(0,a.jsx)(`span`,{className:`sr-only`,children:E(`bento.table.actions`,{defaultValue:`Actions`})})}):null]})}),Y===0?(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsx)(`div`,{role:`row`,"aria-rowindex":2,children:(0,a.jsx)(`div`,{role:`gridcell`,className:`px-4 py-10 text-center text-sm text-muted-foreground`,children:C??E(`bento.table.empty`,{defaultValue:`Nothing to show`})})})}):(0,a.jsx)(`div`,{role:`rowgroup`,ref:W,onScroll:e=>U(e.currentTarget.scrollTop),className:`relative overflow-y-auto`,style:{height:se},children:(0,a.jsx)(`div`,{style:{height:Y*x},className:`relative`,children:q.slice(le,ue).map((t,i)=>{let o=le+i,s=r(t),c=R.has(s),l=ie(t);return(0,a.jsxs)(`div`,{ref:e=>{e?ne.current.set(o,e):ne.current.delete(o)},role:`row`,"aria-rowindex":o+2,"aria-selected":G?c?`true`:`false`:void 0,tabIndex:o===de?0:-1,onKeyDown:e=>he(e,o),onClick:e=>ge(e,o),onDoubleClick:()=>b?.(t),onFocus:e=>{e.target===e.currentTarget&&V(o)},className:e.t(`absolute inset-x-0 grid items-center border-b border-border/30 px-1 text-sm outline-none transition-colors`,`hover:bg-muted/40 focus-visible:bg-muted/60 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,c&&`bg-primary/10 hover:bg-primary/15`),style:{top:o*x,height:x,gridTemplateColumns:oe},children:[G&&(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(n.q,{tabIndex:-1,"aria-label":E(`bento.table.selectRow`,{defaultValue:`Select {{row}}`,row:l}),checked:c,onCheckedChange:()=>me(o)})}),J.map(e=>(0,a.jsx)(`div`,{role:`gridcell`,className:`min-w-0 truncate px-2`,children:e.cell(t)},e.id)),f?.length?(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(y,{triggerLabel:E(`bento.table.rowActions`,{defaultValue:`Actions for {{row}}`,row:l}),actions:f.map(e=>({id:e.id,label:e.label,icon:e.icon,tone:e.tone,onSelect:()=>e.onSelect([t])}))})}):null]},s)})})})]})]})}function D({icon:t=s.IconSparkles,tone:n=`indigo`,title:r,description:i,action:o,align:c=`center`,titleLevel:l=2,className:u}){let d=S(n),f=c===`center`,p=`h${l}`;return(0,a.jsxs)(`div`,{className:e.t(`bento-tile bento-glass flex flex-col gap-3 rounded-3xl p-8`,f?`items-center text-center`:`items-start text-left`,u),children:[(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${d} text-white shadow-md`,children:(0,a.jsx)(t,{size:24})}),(0,a.jsx)(p,{className:`m-0 text-lg font-semibold tracking-tight`,children:r}),i&&(0,a.jsx)(`p`,{className:e.t(`max-w-md text-sm text-muted-foreground`,f&&`mx-auto`),children:i}),o&&(0,a.jsx)(`div`,{className:e.t(`mt-1`,f&&`mx-auto`),children:o})]})}var O=4;function k({steps:e}){let{t}=(0,o.useTranslation)(),n=e.length>O,r=t=>n&&t>0&&t<e.length-2;return(0,a.jsx)(`nav`,{"aria-label":t(`bento.trail.label`,{defaultValue:`Location`}),"data-slot":`bento-trail`,children:(0,a.jsx)(`ol`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:e.map((e,t)=>(0,a.jsxs)(`li`,{className:r(t)?`sr-only`:`inline-flex min-w-0 items-center gap-1`,children:[t>0&&!r(t)&&(0,a.jsx)(s.IconChevronRight,{size:12,"aria-hidden":!0,className:`shrink-0 opacity-60`}),(0,a.jsx)(u.Link,{to:e.to,className:`max-w-[16ch] truncate hover:text-foreground`,children:e.label}),n&&t===0&&(0,a.jsxs)(`span`,{"aria-hidden":!0,className:`inline-flex items-center gap-1`,children:[(0,a.jsx)(s.IconChevronRight,{size:12,className:`shrink-0 opacity-60`}),`…`]})]},`${e.to}-${t}`))})})}function A({to:e,children:t}){return(0,a.jsxs)(u.Link,{to:e,className:`inline-flex items-center gap-1 hover:text-foreground`,children:[(0,a.jsx)(s.IconArrowLeft,{size:14,"aria-hidden":!0}),t]})}function j(e,t,n){return e&&e.length>1?(0,a.jsx)(k,{steps:e}):e&&e.length===1?(0,a.jsx)(A,{to:e[0].to,children:e[0].label}):t==null?null:(0,a.jsx)(A,{to:t,children:n})}function M({eyebrow:e,backTo:t,backLabel:n,trail:r,title:i,subtitle:o,leading:s,trailing:c}){let l=e??j(r,t,n);return(0,a.jsx)(`header`,{className:`bento-shell-header mb-6 flex flex-col items-start gap-3 md:mb-10`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-start gap-4`,children:[s&&(0,a.jsx)(`div`,{className:`shrink-0`,children:s}),(0,a.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[l&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:l}),(0,a.jsx)(`h1`,{className:`text-3xl font-semibold tracking-tight md:text-4xl`,children:i}),o&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:o})]}),c&&(0,a.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:c})]})})}function N({value:e,onChange:t,onClear:r,defaultIcon:l,tone:u,title:d,description:f,readOnly:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(!1);return p?(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${S(u)} text-white shadow-md`,children:e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24})}):(0,a.jsxs)(`div`,{className:`group relative`,children:[(0,a.jsxs)(`button`,{type:`button`,onClick:()=>g(!0),"aria-label":m(`forms.iconPicker.chooseAnIcon`),className:`group/icon relative grid h-12 w-12 cursor-pointer place-items-center overflow-hidden rounded-2xl ${S(u)} text-white shadow-md outline-none transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:scale-105 focus-visible:ring-2 focus-visible:ring-ring active:scale-95`,children:[e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24}),(0,a.jsx)(`span`,{className:`pointer-events-none absolute inset-0 grid place-items-center bg-black/40 opacity-0 transition-opacity duration-200 group-hover/icon:opacity-100`,children:(0,a.jsx)(s.IconPalette,{className:`size-5 text-white`})})]}),e&&r&&(0,a.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r()},"aria-label":m(`forms.common.remove`),title:m(`forms.common.remove`),className:`absolute -right-1.5 -top-1.5 grid h-5 w-5 cursor-pointer place-items-center rounded-full border border-border/60 bg-card/90 text-foreground opacity-0 shadow-md backdrop-blur transition-opacity duration-200 bento-clear focus-visible:opacity-100 group-hover:opacity-100`,children:(0,a.jsx)(s.IconX,{size:12})}),(0,a.jsx)(n.j,{open:h,onOpenChange:g,value:e,onSelect:t,onClear:r,title:d,description:f})]})}function P({value:n,onSave:r,multiline:s=!1,placeholder:c,className:l,ariaLabel:u,autoFocus:d=!1,readOnly:f=!1,commitOnChange:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(d),[_,v]=(0,i.useState)(n),[y,b]=(0,i.useState)(!1),x=(0,i.useRef)(null),S=(0,i.useRef)(null),C=(0,i.useRef)(!1),w=(0,i.useRef)(!1),[T,E]=(0,i.useState)(n);!h&&n!==T&&(E(n),v(n)),(0,i.useEffect)(()=>{h&&x.current?(x.current.focus(),x.current.select()):!h&&w.current&&(w.current=!1,S.current?.focus())},[h]);function D(){w.current=x.current!==null&&document.activeElement===x.current,g(!1)}async function O(){if(C.current)return;let e=_.trim();if(e===n){D();return}if(!e&&!c){v(n),D();return}C.current=!0,b(!0);try{await r(e)}catch{v(n)}finally{C.current=!1,b(!1),D()}}function k(){v(n),D()}function A(e){v(e),p&&r(e)}let j=!n;if(f)return(0,a.jsx)(`span`,{className:e.t(`block w-full`,l),"aria-label":u,children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:c??`—`})});let M=`w-full bg-transparent outline-none border-b transition-colors duration-200`,N=e.t(M,`cursor-text rounded-sm`,j?`border-dashed border-border/70 hover:border-foreground/40`:`border-transparent hover:border-border/60 focus-visible:border-border/80`),P=e.t(M,`bento-editing`);if(!h)return(0,a.jsx)(`button`,{ref:S,type:`button`,onClick:()=>g(!0),className:e.t(N,`text-left`,l),"aria-label":u??m(`forms.formActions.edit`),children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:c??`—`})});function F(e){if(e.key===`Escape`){e.preventDefault(),k();return}e.key===`Enter`&&(!s||e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())}return s?(0,a.jsx)(`textarea`,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,rows:3,className:e.t(P,`resize-none py-0.5 leading-snug`,l)}):(0,a.jsx)(t.a,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:F,placeholder:c,"aria-label":u,"aria-busy":y||void 0,className:e.t(P,`h-auto px-0 py-0 shadow-none focus-visible:ring-0`,l)})}function F({titleMissing:t,dirty:n,className:r}){let{t:i}=(0,o.useTranslation)();if(!t&&!n)return null;let c=`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium normal-case leading-none tracking-normal`;return t?(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-error`,r),children:[(0,a.jsx)(s.IconAlertTriangle,{className:`size-3`}),i(`bento.saveBar.titleRequired`,{defaultValue:`Title required`})]}):(0,a.jsxs)(`span`,{className:e.t(c,`bento-status bento-status-warn`,r),children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bento-status-dot bento-pulse`}),i(`bento.saveBar.unsaved`,{defaultValue:`Unsaved changes`})]})}function I(e){(0,i.useEffect)(()=>{let t=e.current;if(!t)return;let n=document.documentElement,r=0,i=()=>{r=0;let e=t.getBoundingClientRect().top,i=Math.max(0,Math.min(1,(160-e)/80));n.style.setProperty(`--bento-fade`,String(i)),n.classList.toggle(`bento-fade-half`,i>.5)},a=()=>{r||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a),()=>{r&&cancelAnimationFrame(r),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a),n.style.removeProperty(`--bento-fade`),n.classList.remove(`bento-fade-half`)}},[e])}function L(e,t){let n={};for(let r of Object.keys(e))Object.assign(n,{[r]:t[r]});return n}function ee({entity:e,isNew:n,headlineFallback:c,eyebrow:l,listRoute:d,trail:f,icon:p,tone:m,formId:g,feature:_,hasStatus:v=!1,hideIcon:b=!1,readOnly:x=!1,autosaveOnly:S=!1,badge:C,notice:w,onUpdate:T,onDelete:E,extraActions:D,children:O}){let{t:j}=(0,o.useTranslation)(),ee=(0,u.useNavigate)(),[te,R]=(0,i.useState)(!1),[z,B]=(0,i.useState)({isDirty:!1,isSubmitting:!1}),V=(0,i.useRef)(null);I(V);let H={title:e.title??``,description:e.description??``,icon:e.icon??null,enabled:e.enabled??1},[U,W]=(0,i.useState)(H),[ne,re]=(0,i.useState)(H);(H.title!==ne.title||H.description!==ne.description||H.icon!==ne.icon||H.enabled!==ne.enabled)&&(re(H),W(H));async function G(t){if(W(e=>({...e,...t})),n||!T)return;let r=t.title??U.title;try{await T({...e,...t}),h.toast.success(j(`forms.common.updated`,{name:r,feature:_}))}catch(e){console.error(`Failed to update entity field`,e),W(e=>({...e,...L(t,H)})),h.toast.error(j(`forms.common.notUpdated`,{name:H.title||r,feature:_}))}}async function ie(){if(E){try{await E()?(h.toast.success(j(`forms.common.deleted`,{name:U.title,feature:_})),ee(d)):h.toast.error(j(`forms.common.notDeleted`,{name:U.title,feature:_}))}catch(e){console.error(`Failed to delete entity`,e),h.toast.error(j(`forms.common.notDeleted`,{name:U.title,feature:_}))}R(!1)}}let K=U.enabled===1,q=!x,ae=!(S&&!n),J=!U.title.trim(),oe=!n&&!z.isDirty,Y=J||oe,se=[...D??[],...E&&!x?[{id:`entity.delete`,label:j(`forms.formActions.delete`),icon:s.IconTrash,tone:`destructive`,onSelect:()=>R(!0)}]:[]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M,{eyebrow:(0,a.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[f&&f.length>1?(0,a.jsx)(k,{steps:f}):(0,a.jsx)(A,{to:d,children:l}),!x&&(0,a.jsx)(F,{titleMissing:J,dirty:n||z.isDirty})]}),leading:(0,a.jsx)(N,{value:U.icon,onChange:e=>G({icon:e}),onClear:()=>G({icon:null}),defaultIcon:p,tone:m,title:U.title,description:U.description,readOnly:x||b}),title:(0,a.jsx)(P,{value:U.title,onSave:e=>G({title:e}),placeholder:c,className:`text-3xl font-semibold tracking-tight md:text-4xl`,ariaLabel:j(`forms.common.title`),autoFocus:n,commitOnChange:n,readOnly:x}),subtitle:(0,a.jsx)(P,{value:U.description,onSave:e=>G({description:e}),multiline:!0,placeholder:j(`forms.common.description`),className:`max-w-2xl text-sm text-muted-foreground`,ariaLabel:j(`forms.common.description`),commitOnChange:n,readOnly:x}),trailing:(0,a.jsxs)(a.Fragment,{children:[q&&(0,a.jsxs)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:[ae&&(0,a.jsxs)(t.o,{type:`submit`,form:g,size:`sm`,loading:z.isSubmitting,"aria-disabled":Y?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),j(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>ee(d),children:[(0,a.jsx)(s.IconX,{className:`size-4`}),j(`forms.formActions.cancel`)]})]}),C,v&&(x?(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?j(`common.active`,{defaultValue:`Active`}):j(`common.idle`,{defaultValue:`Idle`})]}):(0,a.jsxs)(`button`,{type:`button`,onClick:()=>G({enabled:+!K}),"aria-label":j(`forms.common.enabled`),title:j(K?`common.activeToggleHint`:`common.idleToggleHint`),className:`bento-tile-clickable flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[10px] uppercase tracking-wider transition-colors duration-200 ${K?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground hover:bg-muted/80`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${K?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),K?j(`common.active`,{defaultValue:`Active`}):j(`common.idle`,{defaultValue:`Idle`})]})),!n&&se.length>0&&(0,a.jsx)(y,{actions:se})]})}),(0,a.jsx)(`div`,{ref:V,"aria-hidden":!0,className:`h-px`}),w,!n&&E&&(0,a.jsx)(r.r,{feature:_,name:U.title,onDelete:ie,open:te,setOpen:R,trigger:(0,a.jsx)(`span`,{className:`hidden`,"aria-hidden":!0})}),O({staged:U,onStateChange:B})]})}var te={added:`bento-status bento-status-on`,removed:`bento-status bento-status-error`,changed:`bento-status bento-status-warn`,unchanged:!1};function R({state:t,compact:n=!1,className:r}){let{t:i}=(0,o.useTranslation)(),s={added:i(`bento.diff.added`,{defaultValue:`Added`}),removed:i(`bento.diff.removed`,{defaultValue:`Removed`}),changed:i(`bento.diff.changed`,{defaultValue:`Changed`}),unchanged:i(`bento.diff.unchanged`,{defaultValue:`Unchanged`})}[t],c=e.t(`rounded-full border px-1.5 leading-4`,n&&`font-mono`,te[t],r);if(!n)return(0,a.jsx)(`span`,{"data-slot":`bento-change-mark`,"data-state":t,className:c,children:s});let l={added:i(`bento.diff.addedLetter`,{defaultValue:`A`}),removed:i(`bento.diff.removedLetter`,{defaultValue:`D`}),changed:i(`bento.diff.changedLetter`,{defaultValue:`M`}),unchanged:i(`bento.diff.unchangedLetter`,{defaultValue:`·`})}[t];return(0,a.jsxs)(`span`,{"data-slot":`bento-change-mark`,"data-state":t,title:s,className:c,children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,children:l}),(0,a.jsx)(`span`,{className:`sr-only`,children:s})]})}function z(e,t,n=!0){let r=e.length,i=t.length;if(r*i>4e5)return null;let a=Array.from({length:r+1},()=>new Uint32Array(i+1));for(let n=r-1;n>=0;n--)for(let r=i-1;r>=0;r--)a[n][r]=e[n]===t[r]?a[n+1][r+1]+1:Math.max(a[n+1][r],a[n][r+1]);let o=[],s=(e,t)=>{let r=o[o.length-1];n&&r?.op===e?r.text+=t:o.push({op:e,text:t})},c=0,l=0;for(;c<r&&l<i;)e[c]===t[l]?(s(`same`,e[c]),c++,l++):a[c+1][l]>=a[c][l+1]?s(`remove`,e[c++]):s(`add`,t[l++]);for(;c<r;)s(`remove`,e[c++]);for(;l<i;)s(`add`,t[l++]);return o}var B=e=>e.split(/(\s+)/).filter(e=>e!==``);function V(e){if(typeof DOMParser>`u`)return e.split(/<\/(?:p|h[1-6]|li|blockquote|pre|div)>/i).map(e=>e.replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim()).filter(Boolean);let t=new DOMParser().parseFromString(e,`text/html`),n=[...t.body.querySelectorAll(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)].filter(e=>!e.parentElement?.closest(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)).map(e=>(e.textContent??``).replace(/\s+/g,` `).trim()).filter(Boolean),r=(t.body.textContent??``).replace(/\s+/g,` `).trim();return n.length>0?n:r?[r]:[]}var H=e=>e==null?``:String(e);function U({before:t,after:n,fields:r,showUnchanged:c=!1,layout:l=`inline`}){let{t:u}=(0,o.useTranslation)(),[d,f]=(0,i.useState)(c),p=r.map(e=>{let r=t?.[e.id],i=n?.[e.id],a=e.kind??`text`,o=a===`rich`?V(H(r)).join(`
1
+ "use client";Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./utils-Oagwe_oa.cjs"),t=require("./badge-locale-D4J5OlvK.cjs"),n=require("./user.context-BqsOcMaZ.cjs"),r=require("./loading-provider-bLW_X3A1.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("react-i18next"),s=require("@tabler/icons-react"),c=require("@iconify/react"),l=require("react-resizable-panels"),u=require("react-router-dom"),d=require("@tanstack/react-table"),f=require("@dnd-kit/core"),p=require("@dnd-kit/sortable"),m=require("@dnd-kit/utilities"),h=require("sonner");var g={default:``,destructive:`bento-item-danger`},_=new Set;function v(e){process.env.NODE_ENV===`production`||_.has(e)||(_.add(e),console.warn(`BentoActionsMenu: the action "${e}" has no id. Give it a stable name, such as "post.delete": it is rendered as data-action-id so a console verb can be matched to an agent verb, and it becomes required in the next release.`))}function y({actions:e,triggerLabel:t}){let{t:r}=(0,o.useTranslation)();if(e.length===0)return null;for(let t of e)t.id||v(t.label);return(0,a.jsxs)(n.I,{children:[(0,a.jsx)(n.X,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,"aria-label":t??r(`forms.formActions.moreActions`,{defaultValue:`More actions`}),className:`bento-tile-clickable inline-flex size-(--vg-control-form) items-center justify-center rounded-full border border-border/60 bg-card/60 text-muted-foreground backdrop-blur transition-colors duration-200 hover:text-foreground`,children:(0,a.jsx)(s.IconDotsVertical,{size:18})})}),(0,a.jsx)(n.R,{align:`end`,sideOffset:8,className:`bento-dropdown min-w-44 p-1.5`,children:e.map(e=>{let t=e.icon,r=g[e.tone??`default`];return(0,a.jsxs)(n.B,{"data-action-id":e.id,onSelect:e.onSelect,disabled:e.disabled,className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 ${r}`,children:[(0,a.jsx)(t,{size:16}),e.label]},e.id??e.label)})})]})}var b={blue:`bento-tone-blue`,indigo:`bento-tone-indigo`,violet:`bento-tone-violet`,emerald:`bento-tone-emerald`,amber:`bento-tone-amber`,rose:`bento-tone-rose`,slate:`bento-tone-slate`},x=Object.keys(b);function S(e){return`bento-chip ${b[e]??b.slate}`}function C({to:e,icon:t,tone:n,label:r,count:i,span:o}){let s=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`span`,{className:`grid h-9 w-9 place-items-center rounded-2xl text-white shadow-md ${S(n)}`,children:(0,a.jsx)(t,{size:18})}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-3xl font-semibold tabular-nums tracking-tight`,children:i}),(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:r})]})]}),c=`bento-tile bento-glass group relative flex flex-col justify-between overflow-hidden p-4 ${o}${e?` bento-tile-clickable`:``}`;return e?(0,a.jsx)(u.Link,{to:e,className:c,children:s}):(0,a.jsx)(`div`,{className:c,children:s})}var w=6;function T(e){for(let t=e.parentElement;t&&t!==document.body;t=t.parentElement){let{overflowY:e}=getComputedStyle(t);if(e===`auto`||e===`scroll`)return t}return null}function E(e){if(e){let{top:t,bottom:n}=e.getBoundingClientRect();return{top:t,bottom:n}}return{top:0,bottom:window.innerHeight}}var D={rowSortingFeature:d.rowSortingFeature,coreRowModel:(0,d.createCoreRowModel)(),sortedRowModel:(0,d.createSortedRowModel)()};function O({rows:t,getRowId:r,columns:c,label:l,getRowLabel:u,rowActions:f,selectionActions:p,selectedIds:m,onSelectionChange:h,selectionScope:g,layout:_,onLayoutChange:v,onRowOpen:b,rowHeight:x=44,height:S,empty:C,toolbar:O}){let{t:k}=(0,o.useTranslation)(),[A,j]=(0,i.useState)([]),[M,N]=(0,i.useState)({hidden:[]}),[ee,P]=(0,i.useState)(new Set),[te,F]=(0,i.useState)(null),[ne,re]=(0,i.useState)(g),[I,L]=(0,i.useState)(void 0);ne!==g&&(re(g),P(new Set),L(m),F(null));let ie=(0,i.useMemo)(()=>new Set(m??[]),[m]),R=ee;m!==void 0&&(R=m===I?new Set:ie);let z=(0,i.useRef)(g);(0,i.useEffect)(()=>{z.current!==g&&(z.current=g,h?.([]))},[g,h]);let[B,V]=(0,i.useState)(0),[H,ae]=(0,i.useState)(0),U=S===void 0,[W,G]=(0,i.useState)(()=>({size:typeof window>`u`?0:window.innerHeight,port:typeof window>`u`?0:window.innerHeight})),K=(0,i.useRef)(null),oe=(0,i.useRef)(null),se=(0,i.useRef)(new Map),ce=(0,i.useRef)(!1),q=(p?.length??0)>0,le=e=>u?.(e)??r(e),ue=(0,i.useMemo)(()=>c.map(e=>({id:e.id,accessorFn:t=>e.sortValue?.(t)??null,enableSorting:e.sortValue!==void 0})),[c]),J=(0,d.useTable)({features:D,data:t,columns:ue,state:{sorting:A},onSortingChange:j}).getRowModel().rows.map(e=>e.original),de=_??M,fe=c.filter(e=>e.hideable===!1||!de.hidden.includes(e.id)),pe=[q?`2.75rem`:null,...fe.map(e=>e.width??`minmax(8rem, 1fr)`),f?.length?`3.25rem`:null].filter(Boolean).join(` `),Y=J.length,me=Math.min(U?W.size:S,Y*x),he=Math.max(1,Math.floor((U?W.port:me)/x)),ge=(0,i.useCallback)(()=>{let e=K.current;if(!e)return;let t=e.getBoundingClientRect(),n=E(T(e)),r=Math.max(0,n.top-t.top);ae(r),G({size:Math.max(0,n.bottom-Math.max(t.top,n.top)),port:n.bottom-n.top})},[]);(0,i.useLayoutEffect)(()=>{if(!U||!K.current)return;ge();let e=T(K.current)??window;return e.addEventListener(`scroll`,ge,{passive:!0}),window.addEventListener(`resize`,ge),()=>{e.removeEventListener(`scroll`,ge),window.removeEventListener(`resize`,ge)}},[U,ge,Y]);let _e=Math.max(0,Math.floor(H/x)-w),ve=Math.min(Y,Math.ceil((H+me)/x)+w),ye=Math.min(B,Math.max(0,Y-1));(0,i.useEffect)(()=>{ce.current&&(ce.current=!1,se.current.get(ye)?.focus())},[ye,_e]);function X(e){m===void 0&&P(e),h?.([...e])}function be(e,t){let[n,i]=e<=t?[e,t]:[t,e];X(new Set(J.slice(n,i+1).map(r)))}function xe(e){let t=r(J[e]),n=new Set(R);n.has(t)?n.delete(t):n.add(t),X(n),F(e)}function Se(e,t){let n=Math.max(0,Math.min(Y-1,e));if(t&&q){let e=te??ye;F(e),be(e,n)}let r=K.current,i=n*x;if(r&&U){let e=T(r),t=E(e),n=Math.max(t.top,oe.current?.getBoundingClientRect().bottom??t.top),a=r.getBoundingClientRect().top+i,o=0;a<n?o=a-n:a+x>t.bottom&&(o=a+x-t.bottom),o!==0&&((e??window).scrollBy({top:o,behavior:`instant`}),ge())}else if(r){let e=r.scrollTop;i<e?e=i:i+x>e+me&&(e=i+x-me),e!==r.scrollTop&&(r.scrollTop=e,ae(e))}ce.current=!0,V(n)}function Ce(e,t){if(e.target!==e.currentTarget)return;let n=e.shiftKey;switch(e.key){case`ArrowDown`:Se(t+1,n);break;case`ArrowUp`:Se(t-1,n);break;case`PageDown`:Se(t+he,n);break;case`PageUp`:Se(t-he,n);break;case`Home`:Se(0,n);break;case`End`:Se(Y-1,n);break;case` `:if(!q)return;xe(t);break;case`Enter`:if(!b)return;b(J[t]);break;case`Escape`:if(!q||R.size===0)return;X(new Set),F(null);break;case`a`:case`A`:if(!q||!(e.ctrlKey||e.metaKey))return;X(new Set(J.map(r)));break;default:return}e.preventDefault()}function we(e,t){if(!e.target.closest(`button, a, input, [role='checkbox']`)&&(V(t),q)){if(e.shiftKey){let e=te??ye;F(e),be(e,t)}else e.metaKey||e.ctrlKey?xe(t):(X(new Set([r(J[t])])),F(t))}}function Te(e){let t=A.find(t=>t.id===e);t?t.desc?j([]):j([{id:e,desc:!0}]):j([{id:e,desc:!1}])}function Ee(e,t){let n={hidden:t?[...de.hidden,e]:de.hidden.filter(t=>t!==e)};_===void 0&&N(n),v?.(n)}let De=c.filter(e=>e.hideable!==!1),Z=J.filter(e=>R.has(r(e))),Oe=Y>0&&Z.length===Y;return(0,a.jsxs)(`div`,{"data-slot":`bento-data-table`,className:`bento-glass overflow-clip rounded-2xl`,children:[(0,a.jsxs)(`div`,{className:e.t(`flex min-h-12 flex-wrap items-center gap-2 border-b border-border/50 px-3 py-2`,O==null&&De.length===0&&Z.length===0&&`sr-only`),children:[(0,a.jsx)(`span`,{"aria-live":`polite`,className:e.t(`text-sm font-medium`,Z.length===0&&`sr-only`),children:Z.length>0?k(`bento.table.selected`,{defaultValue:`{{count}} selected`,count:Z.length}):``}),Z.length===0&&O!=null&&(0,a.jsx)(`div`,{className:`flex min-w-0 flex-1 flex-wrap items-center gap-2`,children:O}),Z.length>0&&(0,a.jsxs)(`div`,{role:`toolbar`,"aria-label":k(`bento.table.selectionActions`,{defaultValue:`Actions on the selection`}),className:`flex flex-wrap items-center gap-2`,children:[p?.map(t=>{let r=t.icon;return(0,a.jsxs)(n.Q,{variant:`outline`,size:`sm`,className:e.t(`gap-1.5`,t.tone===`destructive`&&`bento-item-danger`),onClick:()=>t.onSelect(Z),children:[(0,a.jsx)(r,{size:16}),t.label]},t.id)}),(0,a.jsx)(n.Q,{variant:`ghost`,size:`sm`,onClick:()=>X(new Set),children:k(`bento.table.clearSelection`,{defaultValue:`Clear selection`})})]}),De.length>0&&(0,a.jsxs)(n.I,{children:[(0,a.jsx)(n.X,{asChild:!0,children:(0,a.jsxs)(n.Q,{variant:`ghost`,size:`sm`,className:`ml-auto gap-1.5`,children:[(0,a.jsx)(s.IconColumns3,{size:16,"aria-hidden":`true`}),k(`bento.table.columns`,{defaultValue:`Columns`})]})}),(0,a.jsx)(n.R,{align:`end`,className:`bento-dropdown min-w-44 p-1.5`,children:De.map(e=>(0,a.jsx)(n.L,{checked:!de.hidden.includes(e.id),onCheckedChange:t=>Ee(e.id,t!==!0),onSelect:e=>e.preventDefault(),children:e.header},e.id))})]})]}),(0,a.jsxs)(`div`,{role:`grid`,"aria-label":l,"aria-rowcount":Y+1,"aria-colcount":fe.length+ +!!q+ +!!f?.length,"aria-multiselectable":q?`true`:void 0,children:[(0,a.jsx)(`div`,{role:`rowgroup`,ref:oe,className:e.t(U&&`sticky top-(--bento-shell-header,0px) z-10 bg-card/95 backdrop-blur`),children:(0,a.jsxs)(`div`,{role:`row`,"aria-rowindex":1,className:`grid items-center border-b border-border/50 px-1 text-xs font-medium text-muted-foreground`,style:{gridTemplateColumns:pe,minHeight:x},children:[q&&(0,a.jsx)(`div`,{role:`columnheader`,className:`grid place-items-center`,children:(0,a.jsx)(n.Z,{"aria-label":k(`bento.table.selectAll`,{defaultValue:`Select all rows`}),checked:Oe?!0:Z.length>0&&`indeterminate`,onCheckedChange:()=>X(Oe?new Set:new Set(J.map(r)))})}),fe.map(e=>{let t=A.find(t=>t.id===e.id),n=t?t.desc?`descending`:`ascending`:`none`;return(0,a.jsx)(`div`,{role:`columnheader`,"aria-sort":e.sortValue?n:void 0,className:`min-w-0 px-2`,children:e.sortValue?(0,a.jsxs)(`button`,{type:`button`,"data-look":`text`,onClick:()=>Te(e.id),className:`inline-flex max-w-full items-center gap-1 rounded-md py-1 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(`span`,{className:`truncate`,children:e.header}),n===`ascending`&&(0,a.jsx)(s.IconArrowUp,{size:14,"aria-hidden":`true`}),n===`descending`&&(0,a.jsx)(s.IconArrowDown,{size:14,"aria-hidden":`true`}),n===`none`&&(0,a.jsx)(s.IconArrowsSort,{size:14,"aria-hidden":`true`,className:`opacity-40`})]}):(0,a.jsx)(`span`,{className:`block truncate py-1`,children:e.header})},e.id)}),f?.length?(0,a.jsx)(`div`,{role:`columnheader`,className:`px-2`,children:(0,a.jsx)(`span`,{className:`sr-only`,children:k(`bento.table.actions`,{defaultValue:`Actions`})})}):null]})}),Y===0?(0,a.jsx)(`div`,{role:`rowgroup`,children:(0,a.jsx)(`div`,{role:`row`,"aria-rowindex":2,children:(0,a.jsx)(`div`,{role:`gridcell`,className:`px-4 py-10 text-center text-sm text-muted-foreground`,children:C??k(`bento.table.empty`,{defaultValue:`Nothing to show`})})})}):(0,a.jsx)(`div`,{role:`rowgroup`,ref:K,onScroll:U?void 0:e=>ae(e.currentTarget.scrollTop),className:e.t(`relative`,!U&&`overflow-y-auto`),style:U?void 0:{height:me},children:(0,a.jsx)(`div`,{style:{height:Y*x},className:`relative`,children:J.slice(_e,ve).map((t,i)=>{let o=_e+i,s=r(t),c=R.has(s),l=le(t);return(0,a.jsxs)(`div`,{ref:e=>{e?se.current.set(o,e):se.current.delete(o)},role:`row`,"aria-rowindex":o+2,"aria-selected":q?c?`true`:`false`:void 0,tabIndex:o===ye?0:-1,onKeyDown:e=>Ce(e,o),onClick:e=>we(e,o),onDoubleClick:()=>b?.(t),onFocus:e=>{e.target===e.currentTarget&&V(o)},className:e.t(`absolute inset-x-0 grid items-center border-b border-border/30 px-1 text-sm outline-none transition-colors`,`hover:bg-muted/40 focus-visible:bg-muted/60 focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,c&&`bg-primary/10 hover:bg-primary/15`),style:{top:o*x,height:x,gridTemplateColumns:pe},children:[q&&(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(n.Z,{tabIndex:-1,"aria-label":k(`bento.table.selectRow`,{defaultValue:`Select {{row}}`,row:l}),checked:c,onCheckedChange:()=>xe(o)})}),fe.map(e=>(0,a.jsx)(`div`,{role:`gridcell`,className:`min-w-0 truncate px-2`,children:e.cell(t)},e.id)),f?.length?(0,a.jsx)(`div`,{role:`gridcell`,className:`grid place-items-center`,children:(0,a.jsx)(y,{triggerLabel:k(`bento.table.rowActions`,{defaultValue:`Actions for {{row}}`,row:l}),actions:f.map(e=>({id:e.id,label:e.label,icon:e.icon,tone:e.tone,onSelect:()=>e.onSelect([t])}))})}):null]},s)})})})]})]})}function k({icon:t=s.IconSparkles,title:n,description:r,action:i,align:o=`center`,titleLevel:c=2,className:l}){let u=o===`center`,d=`h${c}`;return(0,a.jsxs)(`div`,{className:e.t(`bento-tile bento-glass flex flex-col gap-3 rounded-3xl p-8`,u?`items-center text-center`:`items-start text-left`,l),children:[(0,a.jsx)(`span`,{className:`bento-well grid h-12 w-12 place-items-center rounded-2xl`,children:(0,a.jsx)(t,{size:24})}),(0,a.jsx)(d,{className:`m-0 text-lg font-semibold tracking-tight`,children:n}),r&&(0,a.jsx)(`p`,{className:e.t(`max-w-md text-sm text-muted-foreground`,u&&`mx-auto`),children:r}),i&&(0,a.jsx)(`div`,{className:e.t(`mt-1`,u&&`mx-auto`),children:i})]})}var A=4;function j({steps:e}){let{t}=(0,o.useTranslation)(),n=e.length>A,r=t=>n&&t>0&&t<e.length-2;return(0,a.jsx)(`nav`,{"aria-label":t(`bento.trail.label`,{defaultValue:`Location`}),"data-slot":`bento-trail`,children:(0,a.jsx)(`ol`,{className:`flex min-w-0 flex-wrap items-center gap-1`,children:e.map((e,t)=>(0,a.jsxs)(`li`,{className:r(t)?`sr-only`:`inline-flex min-w-0 items-center gap-1`,children:[t>0&&!r(t)&&(0,a.jsx)(s.IconChevronRight,{size:12,"aria-hidden":!0,className:`shrink-0 opacity-60`}),(0,a.jsx)(u.Link,{to:e.to,className:`max-w-[16ch] truncate hover:text-foreground`,children:e.label}),n&&t===0&&(0,a.jsxs)(`span`,{"aria-hidden":!0,className:`inline-flex items-center gap-1`,children:[(0,a.jsx)(s.IconChevronRight,{size:12,className:`shrink-0 opacity-60`}),`…`]})]},`${e.to}-${t}`))})})}function M({to:e,children:t}){return(0,a.jsxs)(u.Link,{to:e,className:`inline-flex items-center gap-1 hover:text-foreground`,children:[(0,a.jsx)(s.IconArrowLeft,{size:14,"aria-hidden":!0}),t]})}function N(e,t,n){return e&&e.length>1?(0,a.jsx)(j,{steps:e}):e&&e.length===1?(0,a.jsx)(M,{to:e[0].to,children:e[0].label}):t==null?null:(0,a.jsx)(M,{to:t,children:n})}function ee({eyebrow:e,backTo:t,backLabel:n,trail:r,title:i,subtitle:o,leading:s,trailing:c}){let l=e??N(r,t,n);return(0,a.jsx)(`header`,{className:`bento-shell-header mb-6 flex flex-col items-start gap-3 md:mb-10`,children:(0,a.jsxs)(`div`,{className:`flex w-full items-start gap-4`,children:[s&&(0,a.jsx)(`div`,{className:`shrink-0`,children:s}),(0,a.jsxs)(`div`,{className:`flex flex-1 flex-col gap-1`,children:[l&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:l}),(0,a.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-3xl`,children:i}),o&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:o})]}),c&&(0,a.jsx)(`div`,{className:`ml-auto flex shrink-0 items-center gap-2`,children:c})]})})}function P({value:e,onChange:t,onClear:r,defaultIcon:l,tone:u,title:d,description:f,readOnly:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(!1);return p?(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${S(u)} text-white shadow-md`,children:e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24})}):(0,a.jsxs)(`div`,{className:`group relative`,children:[(0,a.jsxs)(`button`,{type:`button`,onClick:()=>g(!0),"aria-label":m(`forms.iconPicker.chooseAnIcon`),className:`group/icon relative grid h-12 w-12 cursor-pointer place-items-center overflow-hidden rounded-2xl ${S(u)} text-white shadow-md outline-none transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:scale-105 focus-visible:ring-2 focus-visible:ring-ring active:scale-95`,children:[e?(0,a.jsx)(c.Icon,{icon:e,className:`size-6 text-white`}):(0,a.jsx)(l,{size:24}),(0,a.jsx)(`span`,{className:`pointer-events-none absolute inset-0 grid place-items-center bg-black/40 opacity-0 transition-opacity duration-200 group-hover/icon:opacity-100`,children:(0,a.jsx)(s.IconPalette,{className:`size-5 text-white`})})]}),e&&r&&(0,a.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),r()},"aria-label":m(`forms.common.remove`),title:m(`forms.common.remove`),className:`absolute -right-1.5 -top-1.5 grid h-5 w-5 cursor-pointer place-items-center rounded-full border border-border/60 bg-card/90 text-foreground opacity-0 shadow-md backdrop-blur transition-opacity duration-200 bento-clear focus-visible:opacity-100 group-hover:opacity-100`,children:(0,a.jsx)(s.IconX,{size:12})}),(0,a.jsx)(n.F,{open:h,onOpenChange:g,value:e,onSelect:t,onClear:r,title:d,description:f})]})}function te({value:n,onSave:r,multiline:s=!1,placeholder:c,className:l,ariaLabel:u,autoFocus:d=!1,readOnly:f=!1,commitOnChange:p=!1}){let{t:m}=(0,o.useTranslation)(),[h,g]=(0,i.useState)(d),[_,v]=(0,i.useState)(n),[y,b]=(0,i.useState)(!1),x=(0,i.useRef)(null),S=(0,i.useRef)(null),C=(0,i.useRef)(!1),w=(0,i.useRef)(!1),[T,E]=(0,i.useState)(n);!h&&n!==T&&(E(n),v(n)),(0,i.useEffect)(()=>{h&&x.current?(x.current.focus(),x.current.select()):!h&&w.current&&(w.current=!1,S.current?.focus())},[h]);function D(){w.current=x.current!==null&&document.activeElement===x.current,g(!1)}async function O(){if(C.current)return;let e=_.trim();if(e===n){D();return}if(!e&&!c){v(n),D();return}C.current=!0,b(!0);try{await r(e)}catch{v(n)}finally{C.current=!1,b(!1),D()}}function k(){v(n),D()}function A(e){v(e),p&&r(e)}let j=!n;if(f)return(0,a.jsx)(`span`,{className:e.t(`block w-full`,l),"aria-label":u,children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:c??`—`})});let M=`w-full bg-transparent outline-none border-b transition-colors duration-200`,N=e.t(M,`cursor-text rounded-sm`,j?`border-dashed border-border/70 hover:border-foreground/40`:`border-transparent hover:border-border/60 focus-visible:border-border/80`),ee=e.t(M,`bento-editing`);if(!h)return(0,a.jsx)(`button`,{ref:S,type:`button`,"data-look":`text`,onClick:()=>g(!0),className:e.t(N,`text-left`,l),"aria-label":u??m(`forms.formActions.edit`),children:n||(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:c??`—`})});function P(e){if(e.key===`Escape`){e.preventDefault(),k();return}e.key===`Enter`&&(!s||e.metaKey||e.ctrlKey)&&(e.preventDefault(),O())}return s?(0,a.jsx)(`textarea`,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:P,placeholder:c,"aria-label":u,"aria-busy":y||void 0,rows:3,className:e.t(ee,`resize-none py-0.5 leading-snug`,l)}):(0,a.jsx)(t.a,{ref:x,value:_,onChange:e=>A(e.target.value),onBlur:O,onKeyDown:P,placeholder:c,"aria-label":u,"aria-busy":y||void 0,className:e.t(ee,`h-auto px-0 py-0 shadow-none focus-visible:ring-0`,l)})}var F=[`published`,`draft`,`scheduled`,`changed`,`archived`];function ne({titleMissing:t,dirty:n,state:r,className:i}){let{t:c}=(0,o.useTranslation)();if(!t&&!n&&!r)return null;let l=`inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-medium normal-case leading-none tracking-normal`;return t?(0,a.jsxs)(`span`,{className:e.t(l,`bento-status bento-status-error`,i),children:[(0,a.jsx)(s.IconAlertTriangle,{className:`size-3`}),c(`bento.saveBar.titleRequired`,{defaultValue:`Title required`})]}):n?(0,a.jsxs)(`span`,{className:e.t(l,`bento-status bento-status-warn`,i),children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full bento-status-dot bento-pulse`}),c(`bento.saveBar.unsaved`,{defaultValue:`Unsaved changes`})]}):(0,a.jsxs)(`span`,{"data-state":r,className:e.t(`inline-flex items-center gap-1.5 text-xs font-normal normal-case leading-none tracking-normal`,r===`archived`?`text-muted-foreground`:`text-foreground/80`,`bento-state-${r}`,i),children:[(0,a.jsx)(`span`,{"aria-hidden":!0,className:`h-1.5 w-1.5 shrink-0 rounded-full bento-state-dot`}),c(`bento.state.${r}`)]})}function re(e){(0,i.useEffect)(()=>{let t=e.current;if(!t)return;let n=document.documentElement,r=0,i=()=>{r=0;let e=t.getBoundingClientRect().top,i=Math.max(0,Math.min(1,(160-e)/80));n.style.setProperty(`--bento-fade`,String(i)),n.classList.toggle(`bento-fade-half`,i>.5)},a=()=>{r||=requestAnimationFrame(i)};return i(),window.addEventListener(`scroll`,a,{passive:!0}),window.addEventListener(`resize`,a),()=>{r&&cancelAnimationFrame(r),window.removeEventListener(`scroll`,a),window.removeEventListener(`resize`,a),n.style.removeProperty(`--bento-fade`),n.classList.remove(`bento-fade-half`)}},[e])}function I(e,t){let n={};for(let r of Object.keys(e))Object.assign(n,{[r]:t[r]});return n}function L({entity:e,isNew:n,headlineFallback:c,eyebrow:l,listRoute:d,trail:f,icon:p,tone:m,formId:g,feature:_,hasStatus:v=!1,hideIcon:b=!1,readOnly:x=!1,autosaveOnly:S=!1,badge:C,notice:w,onUpdate:T,onDelete:E,extraActions:D,children:O}){let{t:k}=(0,o.useTranslation)(),A=(0,u.useNavigate)(),[N,F]=(0,i.useState)(!1),[L,ie]=(0,i.useState)({isDirty:!1,isSubmitting:!1}),R=(0,i.useRef)(null);re(R);let z={title:e.title??``,description:e.description??``,icon:e.icon??null,enabled:e.enabled??1},[B,V]=(0,i.useState)(z),[H,ae]=(0,i.useState)(z);(z.title!==H.title||z.description!==H.description||z.icon!==H.icon||z.enabled!==H.enabled)&&(ae(z),V(z));async function U(t){if(V(e=>({...e,...t})),n||!T)return;let r=t.title??B.title;try{await T({...e,...t}),h.toast.success(k(`forms.common.updated`,{name:r,feature:_}))}catch(e){console.error(`Failed to update entity field`,e),V(e=>({...e,...I(t,z)})),h.toast.error(k(`forms.common.notUpdated`,{name:z.title||r,feature:_}))}}async function W(){if(E){try{await E()?(h.toast.success(k(`forms.common.deleted`,{name:B.title,feature:_})),A(d)):h.toast.error(k(`forms.common.notDeleted`,{name:B.title,feature:_}))}catch(e){console.error(`Failed to delete entity`,e),h.toast.error(k(`forms.common.notDeleted`,{name:B.title,feature:_}))}F(!1)}}let G=B.enabled===1,K=!x,oe=!(S&&!n),se=!B.title.trim(),ce=!n&&!L.isDirty,q=se||ce,le=[...D??[],...E&&!x?[{id:`entity.delete`,label:k(`forms.formActions.delete`),icon:s.IconTrash,tone:`destructive`,onSelect:()=>F(!0)}]:[]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ee,{eyebrow:(0,a.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[f&&f.length>1?(0,a.jsx)(j,{steps:f}):(0,a.jsx)(M,{to:d,children:l}),!x&&(0,a.jsx)(ne,{titleMissing:se,dirty:n||L.isDirty})]}),leading:(0,a.jsx)(P,{value:B.icon,onChange:e=>U({icon:e}),onClear:()=>U({icon:null}),defaultIcon:p,tone:m,title:B.title,description:B.description,readOnly:x||b}),title:(0,a.jsx)(te,{value:B.title,onSave:e=>U({title:e}),placeholder:c,className:`text-2xl font-semibold tracking-tight md:text-3xl`,ariaLabel:k(`forms.common.title`),autoFocus:n,commitOnChange:n,readOnly:x}),subtitle:(0,a.jsx)(te,{value:B.description,onSave:e=>U({description:e}),multiline:!0,placeholder:k(`forms.common.description`),className:`max-w-2xl text-sm text-muted-foreground`,ariaLabel:k(`forms.common.description`),commitOnChange:n,readOnly:x}),trailing:(0,a.jsxs)(a.Fragment,{children:[K&&(0,a.jsxs)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:[oe&&(0,a.jsxs)(t.o,{type:`submit`,form:g,size:`sm`,loading:L.isSubmitting,"aria-disabled":q?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),k(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,size:`sm`,variant:`outline`,onClick:()=>A(d),children:[(0,a.jsx)(s.IconX,{className:`size-4`}),k(`forms.formActions.cancel`)]})]}),C,v&&(x?(0,a.jsxs)(`span`,{className:`flex h-(--vg-control-dense) items-center gap-1.5 rounded-full border px-2.5 text-[10px] uppercase tracking-wider ${G?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${G?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),G?k(`common.active`,{defaultValue:`Active`}):k(`common.idle`,{defaultValue:`Idle`})]}):(0,a.jsxs)(`button`,{type:`button`,onClick:()=>U({enabled:+!G}),"aria-label":k(`forms.common.enabled`),title:k(G?`common.activeToggleHint`:`common.idleToggleHint`),className:`bento-tile-clickable flex h-(--vg-control-dense) items-center gap-1.5 rounded-full border px-2.5 text-[10px] uppercase tracking-wider transition-colors duration-200 ${G?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground hover:bg-muted/80`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${G?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),G?k(`common.active`,{defaultValue:`Active`}):k(`common.idle`,{defaultValue:`Idle`})]})),!n&&le.length>0&&(0,a.jsx)(y,{actions:le})]})}),(0,a.jsx)(`div`,{ref:R,"aria-hidden":!0,className:`h-px`}),w,!n&&E&&(0,a.jsx)(r.r,{feature:_,name:B.title,onDelete:W,open:N,setOpen:F,trigger:(0,a.jsx)(`span`,{className:`hidden`,"aria-hidden":!0})}),O({staged:B,onStateChange:ie})]})}var ie={added:`bento-status bento-status-on`,removed:`bento-status bento-status-error`,changed:`bento-status bento-status-warn`,unchanged:!1};function R({state:t,compact:n=!1,className:r}){let{t:i}=(0,o.useTranslation)(),s={added:i(`bento.diff.added`,{defaultValue:`Added`}),removed:i(`bento.diff.removed`,{defaultValue:`Removed`}),changed:i(`bento.diff.changed`,{defaultValue:`Changed`}),unchanged:i(`bento.diff.unchanged`,{defaultValue:`Unchanged`})}[t],c=e.t(`rounded-full border px-1.5 leading-4`,n&&`font-mono`,ie[t],r);if(!n)return(0,a.jsx)(`span`,{"data-slot":`bento-change-mark`,"data-state":t,className:c,children:s});let l={added:i(`bento.diff.addedLetter`,{defaultValue:`A`}),removed:i(`bento.diff.removedLetter`,{defaultValue:`D`}),changed:i(`bento.diff.changedLetter`,{defaultValue:`M`}),unchanged:i(`bento.diff.unchangedLetter`,{defaultValue:`·`})}[t];return(0,a.jsxs)(`span`,{"data-slot":`bento-change-mark`,"data-state":t,title:s,className:c,children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,children:l}),(0,a.jsx)(`span`,{className:`sr-only`,children:s})]})}function z(e,t,n=!0){let r=e.length,i=t.length;if(r*i>4e5)return null;let a=Array.from({length:r+1},()=>new Uint32Array(i+1));for(let n=r-1;n>=0;n--)for(let r=i-1;r>=0;r--)a[n][r]=e[n]===t[r]?a[n+1][r+1]+1:Math.max(a[n+1][r],a[n][r+1]);let o=[],s=(e,t)=>{let r=o[o.length-1];n&&r?.op===e?r.text+=t:o.push({op:e,text:t})},c=0,l=0;for(;c<r&&l<i;)e[c]===t[l]?(s(`same`,e[c]),c++,l++):a[c+1][l]>=a[c][l+1]?s(`remove`,e[c++]):s(`add`,t[l++]);for(;c<r;)s(`remove`,e[c++]);for(;l<i;)s(`add`,t[l++]);return o}var B=e=>e.split(/(\s+)/).filter(e=>e!==``);function V(e){if(typeof DOMParser>`u`)return e.split(/<\/(?:p|h[1-6]|li|blockquote|pre|div)>/i).map(e=>e.replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim()).filter(Boolean);let t=new DOMParser().parseFromString(e,`text/html`),n=[...t.body.querySelectorAll(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)].filter(e=>!e.parentElement?.closest(`p, h1, h2, h3, h4, h5, h6, li, blockquote, pre`)).map(e=>(e.textContent??``).replace(/\s+/g,` `).trim()).filter(Boolean),r=(t.body.textContent??``).replace(/\s+/g,` `).trim();return n.length>0?n:r?[r]:[]}var H=e=>e==null?``:String(e);function ae({before:t,after:n,fields:r,showUnchanged:c=!1,layout:l=`inline`}){let{t:u}=(0,o.useTranslation)(),[d,f]=(0,i.useState)(c),p=r.map(e=>{let r=t?.[e.id],i=n?.[e.id],a=e.kind??`text`,o=a===`rich`?V(H(r)).join(`
2
2
  `)===V(H(i)).join(`
3
- `):a===`value`?JSON.stringify(r??null)===JSON.stringify(i??null):H(r)===H(i),s=`changed`;return t===null||(r==null||r===``)&&!o?s=`added`:n===null||(i==null||i===``)&&!o?s=`removed`:o&&(s=`unchanged`),{field:e,a:r,b:i,kind:a,state:s}}),m=p.filter(e=>e.state!==`unchanged`),h=p.filter(e=>e.state===`unchanged`);return(0,a.jsxs)(`div`,{"data-slot":`bento-diff`,className:`flex flex-col gap-3`,children:[(t===null||n===null)&&(0,a.jsx)(`p`,{className:`m-0 text-sm font-medium`,children:t===null?u(`bento.diff.created`,{defaultValue:`Created in this version`}):u(`bento.diff.deleted`,{defaultValue:`Deleted in this version`})}),m.length===0&&(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:u(`bento.diff.noChanges`,{defaultValue:`No field changed`})}),(0,a.jsx)(`dl`,{className:`m-0 flex flex-col gap-3`,children:m.map(e=>(0,a.jsx)(W,{label:e.field.label,state:e.state,children:(0,a.jsx)(ne,{row:e,layout:l})},e.field.id))}),h.length>0&&(0,a.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,a.jsxs)(`button`,{type:`button`,"aria-expanded":d?`true`:`false`,onClick:()=>f(!d),className:`inline-flex items-center gap-1 self-start rounded-md text-sm text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(s.IconChevronRight,{size:14,"aria-hidden":`true`,className:e.t(`transition-transform`,d&&`rotate-90`)}),u(`bento.diff.unchangedCount`,{defaultValue:`{{count}} unchanged`,count:h.length})]}),d&&(0,a.jsx)(`dl`,{className:`m-0 flex flex-col gap-3`,children:h.map(t=>(0,a.jsx)(W,{label:t.field.label,state:`unchanged`,children:(0,a.jsx)(`p`,{className:e.t(`m-0 whitespace-pre-wrap text-sm text-muted-foreground`,t.kind===`lines`&&`font-mono text-xs`),children:t.kind===`rich`?V(H(t.b)).join(`
3
+ `):a===`value`?JSON.stringify(r??null)===JSON.stringify(i??null):H(r)===H(i),s=`changed`;return t===null||(r==null||r===``)&&!o?s=`added`:n===null||(i==null||i===``)&&!o?s=`removed`:o&&(s=`unchanged`),{field:e,a:r,b:i,kind:a,state:s}}),m=p.filter(e=>e.state!==`unchanged`),h=p.filter(e=>e.state===`unchanged`);return(0,a.jsxs)(`div`,{"data-slot":`bento-diff`,className:`flex flex-col gap-3`,children:[(t===null||n===null)&&(0,a.jsx)(`p`,{className:`m-0 text-sm font-medium`,children:t===null?u(`bento.diff.created`,{defaultValue:`Created in this version`}):u(`bento.diff.deleted`,{defaultValue:`Deleted in this version`})}),m.length===0&&(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:u(`bento.diff.noChanges`,{defaultValue:`No field changed`})}),(0,a.jsx)(`dl`,{className:`m-0 flex flex-col gap-3`,children:m.map(e=>(0,a.jsx)(U,{label:e.field.label,state:e.state,children:(0,a.jsx)(W,{row:e,layout:l})},e.field.id))}),h.length>0&&(0,a.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,a.jsxs)(`button`,{type:`button`,"data-look":`text`,"aria-expanded":d?`true`:`false`,onClick:()=>f(!d),className:`inline-flex items-center gap-1 self-start rounded-md text-sm text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(s.IconChevronRight,{size:14,"aria-hidden":`true`,className:e.t(`transition-transform`,d&&`rotate-90`)}),u(`bento.diff.unchangedCount`,{defaultValue:`{{count}} unchanged`,count:h.length})]}),d&&(0,a.jsx)(`dl`,{className:`m-0 flex flex-col gap-3`,children:h.map(t=>(0,a.jsx)(U,{label:t.field.label,state:`unchanged`,children:(0,a.jsx)(`p`,{className:e.t(`m-0 whitespace-pre-wrap text-sm text-muted-foreground`,t.kind===`lines`&&`font-mono text-xs`),children:t.kind===`rich`?V(H(t.b)).join(`
4
4
 
5
- `):t.field.format?t.field.format(t.b):H(t.b)})},t.field.id))})]})]})}function W({label:e,state:t,children:n}){return(0,a.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card/40 p-3`,children:[(0,a.jsxs)(`dt`,{className:`mb-1.5 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,a.jsx)(`span`,{children:e}),(0,a.jsx)(R,{state:t})]}),(0,a.jsx)(`dd`,{className:`m-0`,children:n})]})}function ne({row:e,layout:t}){let{t:n}=(0,o.useTranslation)(),{field:r,a:i,b:s,kind:c,state:l}=e;if(c===`lines`)return(0,a.jsx)(ae,{label:r.label,before:H(i),after:H(s),layout:t});if(c===`value`){let e=e=>r.format?r.format(e):H(e);return(0,a.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[l!==`added`&&(0,a.jsx)(X,{children:e(i)}),l===`changed`&&(0,a.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),l!==`removed`&&(0,a.jsx)(me,{children:e(s)})]})}let u=c===`rich`?V(H(i)):[H(i)].filter(Boolean),d=c===`rich`?V(H(s)):[H(s)].filter(Boolean),f=z(u,d,!1)??[...u.map(e=>({op:`remove`,text:e})),...d.map(e=>({op:`add`,text:e}))],p=[];for(let e=0;e<f.length;e++){let t=f[e],n=f[e+1];if(t.op===`remove`&&n?.op===`add`){let r=z(B(t.text),B(n.text));p.push((0,a.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm leading-relaxed`,children:r?r.map((e,t)=>e.op===`same`?(0,a.jsx)(`span`,{children:e.text},t):e.op===`add`?(0,a.jsx)(me,{children:e.text},t):(0,a.jsx)(X,{children:e.text},t)):[(0,a.jsx)(X,{children:t.text},`r`),` `,(0,a.jsx)(me,{children:n.text},`a`)]},e)),e++}else p.push((0,a.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm leading-relaxed`,children:t.op===`same`?t.text:t.op===`add`?(0,a.jsx)(me,{children:t.text}):(0,a.jsx)(X,{children:t.text})},e))}return p.length===0?(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:n(`bento.diff.empty`,{defaultValue:`Empty`})}):(0,a.jsx)(`div`,{className:`flex flex-col gap-2`,children:p})}var re=3,G=e=>e===``?[]:e.replace(/\r?\n$/,``).split(/\r?\n/);function ie(e,t){let n=G(e),r=G(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=0;for(;a<n.length-i&&a<r.length-i&&n[n.length-1-a]===r[r.length-1-a];)a++;let o=z(n.slice(i,n.length-a),r.slice(i,r.length-a),!1);if(o===null)return null;let s=[],c=0,l=0,u=e=>s.push({op:`same`,text:e,old:++c,new:++l});n.slice(0,i).forEach(u);let d=[],f=[],p=()=>{for(let e=0;e<Math.min(d.length,f.length);e++){let t=z(B(d[e].text),B(f[e].text));t&&(d[e].parts=t.filter(e=>e.op!==`add`),f[e].parts=t.filter(e=>e.op!==`remove`))}s.push(...d,...f),d=[],f=[]};for(let e of o)e.op===`remove`?d.push({op:`remove`,text:e.text,old:++c}):e.op===`add`?f.push({op:`add`,text:e.text,new:++l}):(p(),u(e.text));return p(),n.slice(n.length-a).forEach(u),s}function K(e){let t=[],n=0;for(;n<e.length;){if(e[n].op===`same`){t.push({left:e[n],right:e[n]}),n++;continue}let r=[],i=[];for(;n<e.length&&e[n].op!==`same`;n++)(e[n].op===`remove`?r:i).push(e[n]);for(let e=0;e<Math.max(r.length,i.length);e++)t.push({left:r[e]??null,right:i[e]??null})}return t}function q(e,t,n){let r=Array(e.length).fill(!1);e.forEach((n,i)=>{if(t(n))for(let t=Math.max(0,i-re);t<=Math.min(e.length-1,i+re);t++)r[t]=!0});let i=[],a=0;for(;a<e.length;){let t=a,o=r[a];for(;a<e.length&&r[a]===o;)a++;let s=e.slice(t,a);o||s.length===1?i.push({fold:!1,items:s}):i.push({fold:!0,key:n(s[0]),items:s})}return i}function ae({label:t,before:n,after:r,layout:c}){let{t:l}=(0,o.useTranslation)(),[u,d]=(0,i.useState)(new Set),f=ie(n,r);if(f===null)return(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:l(`bento.diff.tooLarge`,{defaultValue:`Too many lines changed to compare them here`})});if(f.length===0)return(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:l(`bento.diff.empty`,{defaultValue:`Empty`})});let p=e=>{let t=new Set(u);t.delete(e)||t.add(e),d(t)};function m(t,n,r){let i=u.has(t.key);return[(0,a.jsx)(`tr`,{children:(0,a.jsx)(`td`,{colSpan:n,className:`bg-muted/40 px-2`,children:(0,a.jsxs)(`button`,{type:`button`,"aria-expanded":i?`true`:`false`,onClick:()=>p(t.key),className:`inline-flex items-center gap-1 rounded-md font-sans text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(s.IconChevronRight,{size:12,"aria-hidden":`true`,className:e.t(`transition-transform`,i&&`rotate-90`)}),l(`bento.diff.unchangedLines`,{defaultValue:`{{count}} unchanged lines`,count:t.items.length})]})})},`fold-${t.key}`),...i?t.items.map(r):[]]}let h=t=>(0,a.jsx)(`table`,{"data-layout":`inline`,className:e.t(`min-w-full border-collapse font-mono text-xs leading-5`,t),children:(0,a.jsx)(`tbody`,{children:q(f,e=>e.op!==`same`,J).map(e=>{let t=e=>(0,a.jsx)(ue,{row:e},J(e));return e.fold?m(e,4,t):e.items.map(t)})})});return(0,a.jsx)(`section`,{"aria-label":t,tabIndex:0,className:`@container/diff overflow-x-auto rounded-md border border-border/60 focus-visible:outline-2 focus-visible:outline-ring`,children:c===`split`?(0,a.jsxs)(a.Fragment,{children:[h(`@3xl/diff:hidden`),(t=>(0,a.jsxs)(`table`,{"data-layout":`split`,className:e.t(`w-full table-fixed border-collapse font-mono text-xs leading-5`,t),children:[(0,a.jsxs)(`colgroup`,{children:[(0,a.jsx)(`col`,{className:`w-14`}),(0,a.jsx)(`col`,{className:`w-5`}),(0,a.jsx)(`col`,{}),(0,a.jsx)(`col`,{className:`w-14`}),(0,a.jsx)(`col`,{className:`w-5`}),(0,a.jsx)(`col`,{})]}),(0,a.jsx)(`tbody`,{children:q(K(f),e=>e.left?.op!==`same`,oe).map(e=>{let t=e=>(0,a.jsx)(de,{pair:e},oe(e));return e.fold?m(e,6,t):e.items.map(t)})})]}))(`hidden @3xl/diff:table`)]}):h()})}var J=e=>`${e.old??``}:${e.new??``}`,oe=e=>`${e.left?.old??``}:${e.right?.new??``}`,Y=t=>e.t(t.op===`add`&&`bento-status bento-status-on`,t.op===`remove`&&`bento-status bento-status-error`);function se(e){return e.parts?e.parts.map((e,t)=>e.op===`add`?(0,a.jsx)(me,{children:e.text},t):e.op===`remove`?(0,a.jsx)(X,{children:e.text},t):(0,a.jsx)(`span`,{children:e.text},t)):e.op===`same`?e.text:(0,a.jsx)(pe,{op:e.op,children:e.text})}var ce={same:` `,add:`+`,remove:`−`},le=`select-none px-2 text-right align-top text-muted-foreground tabular-nums`;function ue({row:t}){let n=Y(t);return(0,a.jsxs)(`tr`,{"data-op":t.op,children:[(0,a.jsx)(`td`,{className:e.t(`w-px`,le,n),children:t.old}),(0,a.jsx)(`td`,{className:e.t(`w-px`,le,n),children:t.new}),(0,a.jsx)(`td`,{"aria-hidden":`true`,className:e.t(`w-px select-none pr-1`,n),children:ce[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre pr-3`,!t.parts&&n),children:se(t)})]})}function de({pair:e}){return(0,a.jsxs)(`tr`,{"data-op":e.left?.op===`same`?`same`:`change`,children:[(0,a.jsx)(fe,{row:e.left,number:e.left?.old}),(0,a.jsx)(fe,{row:e.right,number:e.right?.new,right:!0})]})}function fe({row:t,number:n,right:r=!1}){if(t===null)return(0,a.jsx)(`td`,{colSpan:3,"data-empty":``,className:e.t(`[background-image:repeating-linear-gradient(-45deg,var(--color-border)_0_1px,transparent_0_6px)]`,r&&`border-l border-border/60`)});let i=Y(t);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`td`,{className:e.t(le,i,r&&`border-l border-border/60`),children:n}),(0,a.jsx)(`td`,{"aria-hidden":`true`,className:e.t(`select-none align-top`,i),children:ce[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre-wrap pr-3 [overflow-wrap:anywhere]`,!t.parts&&i),children:se(t)})]})}function pe({op:e,children:t}){let{t:n}=(0,o.useTranslation)();return(0,a.jsxs)(e===`add`?`ins`:`del`,{className:`no-underline`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[e===`add`?n(`bento.diff.addedStart`,{defaultValue:`added:`}):n(`bento.diff.removedStart`,{defaultValue:`removed:`}),` `]}),t]})}function me({children:e}){let{t}=(0,o.useTranslation)();return(0,a.jsxs)(`ins`,{className:`bento-status bento-status-on rounded-sm px-0.5 underline decoration-2 underline-offset-2`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[t(`bento.diff.addedStart`,{defaultValue:`added:`}),` `]}),e]})}function X({children:e}){let{t}=(0,o.useTranslation)();return(0,a.jsxs)(`del`,{className:`bento-status bento-status-error rounded-sm px-0.5 line-through decoration-2`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[t(`bento.diff.removedStart`,{defaultValue:`removed:`}),` `]}),e]})}var he=[`primary`,`secondary`],ge={getItem:e=>{try{return window.localStorage.getItem(e)}catch{return null}},setItem:(e,t)=>{try{window.localStorage.setItem(e,t)}catch{}}},_e={getItem:()=>null,setItem:()=>{}};function ve({primary:t,secondary:r,primaryLabel:i,secondaryLabel:s,storageKey:c,defaultRatio:u=50,className:d}){let{t:f}=(0,o.useTranslation)(),p=n.m(),m=(0,l.useDefaultLayout)({id:c??`bento-split-page`,panelIds:he,storage:c?ge:_e});return p?(0,a.jsxs)(n.l,{"data-slot":`bento-split-page`,defaultValue:`primary`,className:e.t(`flex flex-col gap-3`,d),children:[(0,a.jsxs)(n.d,{"aria-label":f(`bento.split.switch`,{defaultValue:`Show`}),className:`self-start`,children:[(0,a.jsx)(n.f,{value:`primary`,children:i}),(0,a.jsx)(n.f,{value:`secondary`,children:s})]}),(0,a.jsx)(n.u,{value:`primary`,forceMount:!0,className:`data-[state=inactive]:hidden`,children:t}),(0,a.jsx)(n.u,{value:`secondary`,forceMount:!0,className:`data-[state=inactive]:hidden`,children:r})]}):(0,a.jsx)(`div`,{"data-slot":`bento-split-page`,className:e.t(`h-[var(--bento-split-height,calc(100dvh-12rem))] min-h-80`,d),children:(0,a.jsxs)(n.C,{orientation:`horizontal`,defaultLayout:m.defaultLayout,onLayoutChanged:m.onLayoutChanged,children:[(0,a.jsx)(n.S,{id:`primary`,defaultSize:`${u}`,minSize:`25`,children:(0,a.jsx)(`section`,{"aria-label":i,className:`h-full overflow-y-auto pr-3`,children:t})}),(0,a.jsx)(n.x,{withHandle:!0}),(0,a.jsx)(n.S,{id:`secondary`,defaultSize:`${100-u}`,minSize:`25`,children:(0,a.jsx)(`section`,{"aria-label":s,className:`h-full overflow-y-auto pl-3`,children:r})})]})})}var Z=({y:e,m:t,d:n})=>`${e}-${String(t).padStart(2,`0`)}-${String(n).padStart(2,`0`)}`,Q=({y:e,m:t,d:n})=>Date.UTC(e,t-1,n),ye=e=>{let t=new Date(e);return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}},$=(e,t)=>ye(Q(e)+t*864e5),be=(e,t)=>{let n=new Date(Date.UTC(e.y,e.m-1+t,1)),r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return{y:n.getUTCFullYear(),m:n.getUTCMonth()+1,d:Math.min(e.d,r)}},xe=e=>new Date(Q(e)).getUTCDay();function Se(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,hourCycle:`h23`}).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value);return{y:r(`year`),m:r(`month`),d:r(`day`),h:r(`hour`),mi:r(`minute`),s:r(`second`)}}function Ce(e,t,n,r,i,a){let o=Date.UTC(e.y,e.m-1,e.d,t,n,r),s=e=>{let t=Se(e,a);return Date.UTC(t.y,t.m-1,t.d,t.h,t.mi,t.s)-Math.floor(e/1e3)*1e3},c=o-s(o),l=s(c);return o-l!==c&&(c=o-l),new Date(c+i)}var we={on:`bento-status bento-status-on`,warn:`bento-status bento-status-warn`,error:`bento-status bento-status-error`};function Te({entries:t,view:n,defaultView:r=`month`,onViewChange:c,defaultDate:l,timeZone:u=Intl.DateTimeFormat().resolvedOptions().timeZone,weekStartsOn:d=0,onEntryMove:f,onEntrySelect:p,onRangeChange:m,label:h,className:g}){let{t:_,i18n:v}=(0,o.useTranslation)(),y=v?.resolvedLanguage??v?.language,b=e=>{let t=Se(new Date(e).getTime(),u);return{y:t.y,m:t.m,d:t.d}},[x,S]=(0,i.useState)(r),C=n??x,[w,T]=(0,i.useState)(()=>b(l??Date.now())),[E,D]=(0,i.useState)(null),[O,k]=(0,i.useState)(null),[A,j]=(0,i.useState)(``),M=(0,i.useRef)(new Map),N=(0,i.useRef)(!1),P=(0,i.useId)(),[F]=(0,i.useState)(()=>Z(b(Date.now()))),I=e=>$(e,-((xe(e)-d+7)%7)),L=I(C===`month`?{...w,d:1}:w),ee=C===`month`?Math.ceil((Q(be({...w,d:1},1))-Q(L))/6048e5):1,te=Array.from({length:ee},(e,t)=>Array.from({length:7},(e,n)=>$(L,t*7+n))),R=$(L,ee*7),z=`${Z(L)}/${Z(R)}`;(0,i.useEffect)(()=>{m?.({start:Ce(L,0,0,0,0,u),end:Ce(R,0,0,0,0,u)})},[z,u]),(0,i.useEffect)(()=>{N.current&&(N.current=!1,M.current.get(Z(w))?.focus())});let B=new Map;for(let e of t){let t=new Date(e.start).getTime();if(Number.isNaN(t))continue;let n=Z(b(t)),r=B.get(n)??[];r.push({entry:e,time:t}),B.set(n,r)}for(let e of B.values())e.sort((e,t)=>e.time-t.time);let V=e=>new Intl.DateTimeFormat(y,{...e,timeZone:`UTC`}),H=e=>V({dateStyle:`full`}).format(Q(e)),U=e=>new Intl.DateTimeFormat(y,{timeStyle:`short`,timeZone:u}).format(e),W=C===`month`?V({month:`long`,year:`numeric`}).format(Q({...w,d:1})):`${V({dateStyle:`medium`}).format(Q(L))} – ${V({dateStyle:`medium`}).format(Q($(R,-1)))}`;function ne(e){N.current=!0,T(e)}function re(e){n===void 0&&S(e),c?.(e)}let G=e=>C===`month`?be(w,e):$(w,7*e);function ie(e,n){let r=t.find(t=>t.id===e);if(!r||!f)return;let i=new Date(r.start).getTime(),a=Se(i,u);Z(a)!==Z(n)&&f(e,Ce(n,a.h,a.mi,a.s,i%1e3,u)),j(_(`bento.calendar.moved`,{defaultValue:`Moved {{label}} to {{day}}.`,label:r.label,day:H(n)}))}function K(e,n){let r={ArrowLeft:()=>$(n,-1),ArrowRight:()=>$(n,1),ArrowUp:()=>$(n,-7),ArrowDown:()=>$(n,7),Home:()=>I(n),End:()=>$(I(n),6),PageUp:()=>G(-1),PageDown:()=>G(1)}[e.key];if(r){e.preventDefault(),ne(r());return}if(E&&(e.key===`Enter`||e.key===` `))e.preventDefault(),ie(E,n),D(null);else if(E&&e.key===`Escape`){e.preventDefault();let n=t.find(e=>e.id===E);D(null),j(_(`bento.calendar.cancelled`,{defaultValue:`Put {{label}} back.`,label:n?.label??``}))}else e.key===`Enter`&&(e.preventDefault(),e.currentTarget.querySelector(`button`)?.focus())}function q(e,t){let n=e.currentTarget.closest(`td`),r=n?[...n.querySelectorAll(`button`)]:[],i=r.indexOf(e.currentTarget),a=f&&(e.key===` `||e.key===`Enter`&&!p);if(e.key===`ArrowDown`||e.key===`ArrowUp`)r[i+(e.key===`ArrowDown`?1:-1)]?.focus();else if(e.key===`Escape`)n?.focus();else if(a)D(t.id),j(_(`bento.calendar.picked`,{defaultValue:`Picked up {{label}}. Choose a day and press Enter.`,label:t.label})),n?.focus();else if(e.key===`Enter`&&p)p(t.id);else return;e.preventDefault(),e.stopPropagation()}function ae(e,t){let n=O??e.dataTransfer.getData(`text/plain`);k(null),n&&(e.preventDefault(),ie(n,t))}let J=f?P:void 0;return(0,a.jsxs)(`div`,{"data-slot":`bento-calendar`,className:e.t(`flex flex-col gap-3`,g),children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(Ee,{label:_(`bento.calendar.previous`,{defaultValue:`Previous`}),onClick:()=>T(G(-1)),children:(0,a.jsx)(s.IconChevronLeft,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(Ee,{label:_(`bento.calendar.next`,{defaultValue:`Next`}),onClick:()=>T(G(1)),children:(0,a.jsx)(s.IconChevronRight,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>T(b(Date.now())),className:`rounded-md border border-border px-2 py-1 text-sm hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring`,children:_(`bento.calendar.today`,{defaultValue:`Today`})}),(0,a.jsx)(`h2`,{className:`m-0 ml-2 text-base font-semibold`,"aria-live":`polite`,children:W})]}),(0,a.jsx)(`div`,{role:`group`,"aria-label":_(`bento.calendar.views`,{defaultValue:`View`}),className:`flex rounded-md border border-border p-0.5`,children:[`month`,`week`].map(t=>(0,a.jsx)(`button`,{type:`button`,"aria-pressed":C===t?`true`:`false`,onClick:()=>re(t),className:e.t(`rounded px-2 py-0.5 text-sm focus-visible:outline-2 focus-visible:outline-ring`,C===t?`bg-primary text-primary-foreground`:`hover:bg-muted/50`),children:t===`month`?_(`bento.calendar.month`,{defaultValue:`Month`}):_(`bento.calendar.week`,{defaultValue:`Week`})},t))})]}),(0,a.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:A}),J&&(0,a.jsx)(`span`,{id:J,className:`sr-only`,children:_(`bento.calendar.moveHint`,{defaultValue:`Space picks this up to move it: the arrow keys choose a day, Enter drops it and Escape cancels.`})}),(0,a.jsxs)(`table`,{role:`grid`,"aria-label":h??W,className:`w-full table-fixed border-collapse text-sm`,children:[(0,a.jsx)(`thead`,{children:(0,a.jsx)(`tr`,{children:te[0].map(e=>(0,a.jsx)(`th`,{scope:`col`,abbr:V({weekday:`long`}).format(Q(e)),className:`pb-1 text-xs font-medium text-muted-foreground`,children:V({weekday:`short`}).format(Q(e))},Z(e)))})}),(0,a.jsx)(`tbody`,{children:te.map(t=>(0,a.jsx)(`tr`,{children:t.map(t=>{let n=Z(t),r=B.get(n)??[],i=n===Z(w),o=C===`month`&&t.m!==w.m,s=r.length;return(0,a.jsxs)(`td`,{ref:e=>{e?M.current.set(n,e):M.current.delete(n)},role:`gridcell`,tabIndex:i?0:-1,"aria-label":s>0?`${H(t)}, ${_(`bento.calendar.entries`,{defaultValue:`{{count}} scheduled`,count:s})}`:H(t),"aria-current":n===F?`date`:void 0,"data-day":n,onKeyDown:e=>K(e,t),onFocus:()=>{i||T(t)},onDragOver:e=>{O&&e.preventDefault()},onDrop:e=>ae(e,t),className:e.t(`border border-border/60 p-1 align-top outline-none`,C===`month`?`h-24`:`h-48`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,E&&i&&`bg-primary/10`),children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,className:e.t(`mb-1 inline-grid size-6 place-items-center rounded-full text-xs`,n===F&&`bg-primary font-semibold text-primary-foreground`,n!==F&&o&&`text-muted-foreground`),children:t.d}),(0,a.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:r.map(({entry:t,time:n})=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,tabIndex:-1,draggable:f?!0:void 0,"aria-describedby":J,"aria-pressed":f?E===t.id?`true`:`false`:void 0,"data-entry":t.id,onKeyDown:e=>q(e,t),onClick:()=>p?.(t.id),onDragStart:e=>{e.dataTransfer.setData(`text/plain`,t.id),e.dataTransfer.effectAllowed=`move`,k(t.id)},onDragEnd:()=>k(null),className:e.t(`flex w-full min-w-0 items-baseline gap-1 rounded-md px-1 py-0.5 text-left text-xs focus-visible:outline-2 focus-visible:outline-ring`,t.tone?we[t.tone]:`bg-muted`,E===t.id&&`outline-2 outline-dashed outline-primary`),children:[(0,a.jsx)(`time`,{dateTime:new Date(n).toISOString(),className:`flex-none tabular-nums`,children:U(n)}),(0,a.jsx)(`span`,{className:`truncate`,children:t.label})]})},t.id))})]},n)})},Z(t[0])))})]})]})}function Ee({label:e,onClick:t,children:n}){return(0,a.jsx)(`button`,{type:`button`,"aria-label":e,onClick:t,className:`grid size-7 place-items-center rounded-md border border-border hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring`,children:n})}var De={LARGE:`col-span-2 row-span-2 md:col-span-2 md:row-span-2 lg:col-span-2 lg:row-span-2`,MEDIUM:`col-span-2 row-span-1 md:col-span-2 md:row-span-1 lg:col-span-2 lg:row-span-1`,SMALL:`col-span-1 row-span-1`},Oe={SMALL:`MEDIUM`,MEDIUM:`LARGE`,LARGE:`SMALL`};function ke(e,t,n){if(!n||n.length===0)return e.map((e,n)=>({item:e,key:t(e),emphasis:n===0?`LARGE`:`MEDIUM`}));let r=new Map,i=new Map;for(let e of n)r.set(e.itemId,e.displayOrder),i.set(e.itemId,e.emphasis);return e.map((e,n)=>({item:e,key:t(e),idx:n})).sort((e,t)=>{let n=r.has(e.key)?r.get(e.key):2**53-1,i=r.has(t.key)?r.get(t.key):2**53-1;return n===i?e.idx-t.idx:n-i}).map(({item:e,key:t})=>({item:e,key:t,emphasis:i.get(t)??`MEDIUM`}))}function Ae(e){return e.map((e,t)=>({itemId:e.key,emphasis:e.emphasis,displayOrder:t}))}function je({to:e,emphasis:t,featured:n,defaultIcon:r,icon:i,tone:s=`indigo`,title:l,description:d,meta:f,enabled:p,hasStatus:m=!1,viewTransitionName:h}){let{t:g}=(0,o.useTranslation)(),_=S(s),v=t??(n?`LARGE`:`MEDIUM`),y=v===`LARGE`,b=v===`SMALL`,x=De[v],C=p===1,w=y?`p-6 md:p-7`:b?`p-4`:`p-5`,T=y?`h-14 w-14`:b?`h-8 w-8`:`h-9 w-9`,E=y?28:b?16:18,D=y?`text-xl md:text-2xl`:b?`text-sm`:`text-base md:text-lg`;return(0,a.jsxs)(u.Link,{to:e,className:`bento-tile bento-tile-clickable bento-glass group relative flex flex-col ${y?`gap-5`:`gap-4`} overflow-hidden ${w} ${x}`,style:h?{viewTransitionName:h}:void 0,children:[y&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -bottom-10 -right-10 h-64 w-64 rounded-full ${_} opacity-40 blur-2xl dark:opacity-50`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-12 top-1/3 h-32 w-32 rounded-full ${_} bento-chip-tr opacity-20 blur-2xl dark:opacity-30`})]}),(0,a.jsxs)(`div`,{className:`relative z-1 flex items-center justify-between`,children:[(0,a.jsx)(`span`,{className:`grid place-items-center rounded-2xl ${_} text-white shadow-md ${T}`,children:i?(0,a.jsx)(c.Icon,{icon:i,className:y?`size-7 text-white`:`size-4.5 text-white`}):(0,a.jsx)(r,{size:E})}),m&&(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-wider ${C?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${C?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),C?g(`common.active`,{defaultValue:`Active`}):g(`common.idle`,{defaultValue:`Idle`})]})]}),(0,a.jsxs)(`div`,{className:`relative z-1`,children:[(0,a.jsx)(`div`,{className:`font-semibold tracking-tight ${D}`,children:l}),!b&&f&&(0,a.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:f}),!b&&d&&(0,a.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:d})]})]})}var Me={query:``,facets:{}},Ne=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Pe=e=>Array.isArray(e)?e:[];function Fe(e,t,n){let r={...e.facets};return n===void 0||Array.isArray(n)&&n.length===0||Ne(n)&&!n.from&&!n.to?delete r[t]:r[t]=n,{...e,facets:r}}function Ie({value:e,onChange:r,facets:c,queryLabel:l,queryDelay:u=300,views:d}){let{t:f}=(0,o.useTranslation)(),[p,m]=(0,i.useState)({source:e.query,text:e.query}),[h,g]=(0,i.useState)(null);p.source!==e.query&&m({source:e.query,text:e.query===h?p.text:e.query}),(0,i.useEffect)(()=>{if(p.text===e.query)return;let t=setTimeout(()=>{g(p.text),r({...e,query:p.text})},u);return()=>clearTimeout(t)},[p.text,e,r,u]);let _=[];for(let t of c){let n=e.facets[t.id];if(t.kind===`choice`)for(let r of Pe(n)){let i=t.options.find(e=>e.value===r);_.push({key:`${t.id}:${r}`,text:`${t.label}: ${i?.label??r}`,remove:()=>Fe(e,t.id,Pe(n).filter(e=>e!==r))})}else Ne(n)&&(n.from||n.to)&&_.push({key:t.id,text:`${t.label}: ${n.from??`…`} – ${n.to??`…`}`,remove:()=>Fe(e,t.id,void 0)})}let v=_.length>0||e.query!==``,y=l??f(`bento.filters.search`,{defaultValue:`Search`});return(0,a.jsxs)(`div`,{role:`search`,"aria-label":f(`bento.filters.label`,{defaultValue:`Filters`}),"data-slot":`bento-filter-bar`,className:`flex flex-col gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,a.jsxs)(`div`,{className:`relative min-w-48 flex-1`,children:[(0,a.jsx)(s.IconSearch,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,a.jsx)(t.a,{type:`search`,value:p.text,placeholder:y,"aria-label":y,onChange:e=>m({...p,text:e.target.value}),className:`pl-9`})]}),c.map(t=>t.kind===`choice`?(0,a.jsx)(Re,{facet:t,value:e,onChange:r},t.id):(0,a.jsx)(ze,{facet:t,value:e,onChange:r},t.id)),d]}),v&&(0,a.jsxs)(`ul`,{className:`m-0 flex list-none flex-wrap items-center gap-1.5 p-0`,"aria-label":f(`bento.filters.active`,{defaultValue:`Active filters`}),children:[_.map(e=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,"aria-label":f(`bento.filters.remove`,{defaultValue:`Remove filter {{filter}}`,filter:e.text}),onClick:()=>r(e.remove()),className:`bento-clear inline-flex items-center gap-1 rounded-full border border-border/60 bg-card/60 py-0.5 pl-2.5 pr-1.5 text-xs`,children:[e.text,(0,a.jsx)(s.IconX,{size:12,"aria-hidden":`true`})]})},e.key)),(0,a.jsx)(`li`,{children:(0,a.jsx)(n.J,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>{m({source:``,text:``}),r(Me)},children:f(`bento.filters.clearAll`,{defaultValue:`Clear all`})})})]})]})}function Le({label:e,count:t,...r}){return(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,className:`gap-1.5`,...r,children:[e,t>0&&(0,a.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-[0.6875rem] leading-4 text-primary-foreground`,children:t}),(0,a.jsx)(s.IconChevronDown,{size:14,"aria-hidden":`true`})]})}function Re({facet:e,value:t,onChange:r}){let i=Pe(t.facets[e.id]);return(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsx)(Le,{label:e.label,count:i.length})}),(0,a.jsx)(n.P,{align:`start`,className:`bento-dropdown min-w-44 p-1.5`,children:e.multiple?e.options.map(o=>(0,a.jsx)(n.N,{checked:i.includes(o.value),onCheckedChange:n=>r(Fe(t,e.id,n===!0?[...i,o.value]:i.filter(e=>e!==o.value))),onSelect:e=>e.preventDefault(),children:o.label},o.value)):(0,a.jsx)(n.z,{value:i[0]??``,onValueChange:n=>r(Fe(t,e.id,n===i[0]?[]:[n])),children:e.options.map(e=>(0,a.jsx)(n.B,{value:e.value,children:e.label},e.value))})})]})}function ze({facet:e,value:r,onChange:s}){let{t:c}=(0,o.useTranslation)(),l=r.facets[e.id],u=Ne(l)?l:{},[d,f]=(0,i.useState)(!1),[p,m]=(0,i.useState)(u.from??``),[h,g]=(0,i.useState)(u.to??``),_=(0,i.useId)(),v=(0,i.useId)();return(0,a.jsxs)(n.w,{open:d,onOpenChange:e=>{e&&(m(u.from??``),g(u.to??``)),f(e)},children:[(0,a.jsx)(n.A,{asChild:!0,children:(0,a.jsx)(Le,{label:e.label,count:u.from||u.to?1:0})}),(0,a.jsx)(n.E,{align:`start`,className:`bento-dropdown w-64 p-3`,children:(0,a.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:t=>{t.preventDefault(),s(Fe(r,e.id,{from:p||void 0,to:h||void 0})),f(!1)},children:[(0,a.jsx)(`label`,{htmlFor:_,className:`text-xs text-muted-foreground`,children:c(`bento.filters.from`,{defaultValue:`From`})}),(0,a.jsx)(t.a,{id:_,type:`date`,value:p,max:h||void 0,onChange:e=>m(e.target.value)}),(0,a.jsx)(`label`,{htmlFor:v,className:`text-xs text-muted-foreground`,children:c(`bento.filters.to`,{defaultValue:`To`})}),(0,a.jsx)(t.a,{id:v,type:`date`,value:h,min:p||void 0,onChange:e=>g(e.target.value)}),(0,a.jsx)(n.J,{type:`submit`,size:`sm`,className:`mt-1`,children:c(`bento.filters.apply`,{defaultValue:`Apply`})})]})})]})}var Be=E,Ve=`bento-grid grid auto-rows-[minmax(140px,auto)] grid-cols-2 gap-4 md:grid-cols-4 md:gap-5 lg:grid-cols-6`;function He({items:e,error:t,tryAgainUrl:c,listId:l,eyebrow:d,backTo:f,backLabel:p,trail:m,heroIcon:h,title:g,subtitle:_,tone:v=`indigo`,headerAction:y,newRoute:b,newLabel:x,newSubtitle:C,hideNew:w=!1,itemKey:T,columns:E,rowActions:O,onRowOpen:k,getRowLabel:A,columnLayout:j,onColumnLayoutChange:N,renderTile:P,emptyTitle:F,emptyDescription:I,layout:L}){let{t:ee}=(0,o.useTranslation)(),te=S(v),[R,z]=(0,i.useState)(!1),B=(0,i.useMemo)(()=>ke(e??[],T,L?.data?.entries),[e,T,L?.data?.entries]),V=h?(0,a.jsx)(`span`,{className:`grid h-12 w-12 place-items-center rounded-2xl ${te} text-white shadow-md`,children:(0,a.jsx)(h,{size:24})}):void 0;if(!P)return(0,a.jsxs)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:c,children:[(0,a.jsx)(M,{eyebrow:d,backTo:f,backLabel:p,trail:m,leading:V,title:g,subtitle:_,trailing:w?void 0:(0,a.jsx)(n.J,{asChild:!0,className:`gap-2`,children:(0,a.jsxs)(u.Link,{to:b,children:[(0,a.jsx)(s.IconPlus,{size:16}),x]})})}),y&&(0,a.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:y}),e?.length===0?(0,a.jsx)(D,{icon:s.IconSparkles,title:F,description:I}):(0,a.jsx)(Be,{rows:e??[],getRowId:T,columns:E??[],label:g,getRowLabel:A,rowActions:O,onRowOpen:k,layout:j,onLayoutChange:N})]});let H=!!l&&!!L&&(e?.length??0)>0;return(0,a.jsxs)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:c,children:[(0,a.jsx)(M,{eyebrow:d,backTo:f,backLabel:p,trail:m,leading:V,title:g,subtitle:_}),(y||H&&!R)&&(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[y,H&&!R&&(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,onClick:()=>z(!0),className:`ml-auto gap-2`,children:[(0,a.jsx)(s.IconAdjustmentsHorizontal,{size:16}),ee(`bento.layout.customize`,{defaultValue:`Customize layout`})]})]}),R&&l&&L?(0,a.jsx)(Ge,{layout:L,resolved:B,canEditGlobal:L?.data?.canEditGlobal??!1,isCustomized:L?.data?.source===`USER`,renderTile:P,chip:te,hideNew:w,newRoute:b,newLabel:x,newSubtitle:C,onClose:()=>z(!1)}):(0,a.jsx)(We,{resolved:B,renderTile:P,chip:te,hideNew:w,newRoute:b,newLabel:x,newSubtitle:C,isEmpty:e?.length===0,emptyTitle:F,emptyDescription:I})]})}function Ue({items:e,error:t,tryAgainUrl:n,tone:i=`indigo`,newRoute:o,newLabel:s,newSubtitle:c,hideNew:l=!1,itemKey:u,renderTile:d,emptyTitle:f,emptyDescription:p}){let m=S(i);return(0,a.jsx)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:n,children:(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:Ve,children:[!l&&o&&s?(0,a.jsx)(Ye,{route:o,label:s,subtitle:c,chip:m}):null,(e??[]).map(e=>(0,a.jsx)(`span`,{className:`contents`,children:d(e)},u(e))),e?.length===0&&(0,a.jsx)(Xe,{title:f,description:p})]})})}function We({resolved:t,renderTile:n,chip:r,hideNew:i,newRoute:o,newLabel:s,newSubtitle:c,isEmpty:l,emptyTitle:u,emptyDescription:d}){let f=t.some(e=>e.emphasis===`SMALL`);return(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:e.t(Ve,f&&`grid-flow-dense`),children:[!i&&(0,a.jsx)(Ye,{route:o,label:s,subtitle:c,chip:r}),t.map(({item:e,key:t,emphasis:r})=>(0,a.jsx)(`span`,{className:`contents`,children:n(e,r)},t)),l&&(0,a.jsx)(Xe,{title:u,description:d})]})}function Ge({layout:t,resolved:r,canEditGlobal:c,isCustomized:l,renderTile:u,chip:d,hideNew:m,newRoute:h,newLabel:g,newSubtitle:_,onClose:v}){let{t:y}=(0,o.useTranslation)(),[b,x]=(0,i.useState)(r),[S,C]=(0,i.useState)(null),w=(t.saving??!1)||S!==null,T=e=>w&&S===e?{loading:!0}:{"aria-disabled":w||void 0},[E,D]=(0,i.useState)(!1),O=(e,t)=>async()=>{if(t){C(e),D(!1);try{await t(),v()}catch(e){console.error(`Failed to save the bento layout`,e),D(!0)}finally{C(null)}}},k=(0,f.useSensors)((0,f.useSensor)(f.PointerSensor,{activationConstraint:{distance:8}}),(0,f.useSensor)(f.KeyboardSensor));function A(e){let{active:t,over:n}=e;!n||t.id===n.id||x(e=>{let r=e.findIndex(e=>e.key===t.id),i=e.findIndex(e=>e.key===n.id);return r<0||i<0?e:(0,p.arrayMove)(e,r,i)})}function j(e,t){x(n=>n.map(n=>n.key===e?{...n,emphasis:t}:n))}let M=(0,i.useMemo)(()=>Ae(b),[b]),N=b.some(e=>e.emphasis===`SMALL`);return(0,a.jsxs)(`div`,{children:[(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2 rounded-2xl border border-border/60 bg-card/40 p-3 backdrop-blur-md`,children:[(0,a.jsx)(`span`,{className:`mr-auto text-sm text-muted-foreground`,children:y(`bento.layout.editHint`,{defaultValue:`Drag tiles to reorder · tap the size button to resize`})}),l&&t.onReset&&(0,a.jsxs)(n.J,{variant:`ghost`,size:`sm`,className:`gap-2`,...T(`reset`),onClick:O(`reset`,t.onReset),children:[S!==`reset`&&(0,a.jsx)(s.IconArrowBackUp,{size:16}),y(`bento.layout.reset`,{defaultValue:`Reset to default`})]}),c&&t.onSaveGlobal&&(0,a.jsxs)(n.J,{variant:`outline`,size:`sm`,className:`gap-2`,...T(`global`),onClick:O(`global`,()=>t.onSaveGlobal?.(M)),children:[S!==`global`&&(0,a.jsx)(s.IconUsers,{size:16}),y(`bento.layout.saveGlobal`,{defaultValue:`Set as default for everyone`})]}),(0,a.jsxs)(n.J,{variant:`ghost`,size:`sm`,className:`gap-2`,...T(`cancel`),onClick:v,children:[(0,a.jsx)(s.IconX,{size:16}),y(`common.cancel`,{defaultValue:`Cancel`})]}),(0,a.jsxs)(n.J,{size:`sm`,className:`gap-2`,...T(`save`),onClick:O(`save`,()=>t.onSave(M)),children:[S!==`save`&&(0,a.jsx)(s.IconDeviceFloppy,{size:16}),y(`bento.layout.save`,{defaultValue:`Save layout`})]}),E&&(0,a.jsx)(`p`,{role:`alert`,className:`w-full text-sm text-destructive`,children:y(`bento.layout.saveFailed`,{defaultValue:`The layout could not be saved. Nothing has changed — try again.`})})]}),(0,a.jsx)(f.DndContext,{sensors:k,collisionDetection:f.closestCenter,onDragEnd:A,children:(0,a.jsx)(p.SortableContext,{items:b.map(e=>e.key),strategy:p.rectSortingStrategy,children:(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:e.t(Ve,N&&`grid-flow-dense`),children:[!m&&(0,a.jsx)(Ye,{route:h,label:g,subtitle:_,chip:d}),b.map(({item:e,key:t,emphasis:n})=>(0,a.jsx)(Je,{id:t,emphasis:n,onSetEmphasis:e=>j(t,e),children:u(e,n)},t))]})})})]})}var Ke=[`SMALL`,`MEDIUM`,`LARGE`],qe={SMALL:{key:`bento.layout.size.small`,def:`Small`},MEDIUM:{key:`bento.layout.size.medium`,def:`Medium`},LARGE:{key:`bento.layout.size.large`,def:`Large`}};function Je({id:t,emphasis:n,onSetEmphasis:r,children:i}){let{t:c}=(0,o.useTranslation)(),{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:h,isDragging:g}=(0,p.useSortable)({id:t}),_={transform:m.CSS.Translate.toString(f),transition:h,opacity:g?.6:1,zIndex:g?50:void 0};return(0,a.jsxs)(`div`,{ref:d,style:_,className:e.t(`relative h-full`,De[n]),children:[(0,a.jsx)(`div`,{className:`pointer-events-none h-full select-none [&>*]:h-full [&>*]:w-full`,children:i}),(0,a.jsxs)(`div`,{className:`absolute right-2 top-2 z-10 flex items-center gap-1`,children:[(0,a.jsx)(`div`,{role:`group`,"aria-label":c(`bento.layout.sizeGroup`,{defaultValue:`Tile size`}),className:`flex items-center gap-0.5 rounded-full border border-border/60 bg-background/80 p-0.5 shadow-sm backdrop-blur`,children:Ke.map(t=>{let i=t===n,o=c(qe[t].key,{defaultValue:qe[t].def});return(0,a.jsx)(`button`,{type:`button`,onClick:()=>r(t),"aria-pressed":i,"aria-label":o,title:o,className:e.t(`grid h-6 w-6 place-items-center rounded-full text-[11px] font-semibold uppercase transition-colors`,i?`bg-primary text-primary-foreground shadow`:`text-muted-foreground hover:bg-muted`),children:o.charAt(0)},t)})}),(0,a.jsx)(`button`,{type:`button`,...l,...u,"aria-label":c(`bento.layout.dragToReorder`,{defaultValue:`Drag to reorder`}),className:`grid h-7 w-7 cursor-grab place-items-center rounded-full border border-border/60 bg-background/80 shadow-sm backdrop-blur hover:bg-background active:cursor-grabbing`,children:(0,a.jsx)(s.IconGripVertical,{size:14,className:`text-muted-foreground`})})]})]})}function Ye({route:e,label:t,subtitle:n,chip:r}){let{t:i}=(0,o.useTranslation)();return(0,a.jsxs)(u.Link,{to:e,className:`bento-tile bento-tile-clickable col-span-2 row-span-1 flex flex-col gap-3 rounded-3xl border-2 border-dashed border-border/60 bg-card/30 p-5 backdrop-blur-md bento-new-tile hover:bg-card/50 md:col-span-2 md:row-span-1 lg:col-span-2 lg:row-span-1`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`bento-pulse grid h-10 w-10 place-items-center rounded-2xl ${r} text-white shadow-md`,children:(0,a.jsx)(s.IconPlus,{size:20})}),(0,a.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:i(`forms.formActions.new`,{defaultValue:`New`})})]}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-base font-semibold tracking-tight md:text-lg`,children:(0,a.jsx)(`span`,{className:`${r} bg-clip-text text-transparent`,children:t})}),n&&(0,a.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n})]})]})}function Xe({title:e,description:t}){return(0,a.jsx)(D,{icon:s.IconSparkles,title:e,description:t,align:`start`,className:`col-span-2 row-span-2 justify-end md:col-span-4`})}function Ze({title:e,badges:n,actions:r,onCancel:i,loading:c,disabled:l,dirty:u,titleMissing:d}){let{t:f}=(0,o.useTranslation)();return(0,a.jsxs)(`div`,{className:`bento-glass flex items-center justify-between gap-4 rounded-2xl px-4 py-3 shadow-md backdrop-blur-xl`,children:[(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[e&&(0,a.jsx)(`p`,{className:`truncate text-base font-semibold tracking-tight md:text-lg`,children:e}),(0,a.jsx)(F,{titleMissing:d,dirty:u}),n&&(0,a.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n})]}),(0,a.jsx)(`div`,{className:`flex shrink-0 gap-2`,children:r??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:c,"aria-disabled":l?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),f(`forms.formActions.saveChanges`)]}),i&&(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),f(`forms.formActions.cancel`)]})]})})]})}function Qe({children:e}){return(0,a.jsx)(`span`,{className:`rounded-full border border-border/60 bg-card/50 px-2 py-0.5 text-[10px] uppercase tracking-wider text-muted-foreground backdrop-blur`,children:e})}Ze.Badge=Qe;function $e(e){let t=(0,i.useRef)(null);return I(t),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{ref:t,"aria-hidden":!0,className:`h-px`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`bento-save-bar-spacer`}),(0,a.jsx)(`div`,{className:`bento-fade-in fixed inset-x-0 top-20 z-20 mx-auto w-full max-w-7xl px-4 md:px-8`,children:(0,a.jsx)(Ze,{...e})})]})}function et({eyebrow:e,backTo:n,backLabel:r,trail:i,leading:c,title:l,subtitle:u,trailing:d,onCancel:f,actions:p,loading:m,dirty:h,titleMissing:g,saveDisabled:_,stickyTitle:v,stickyBadges:y}){let{t:b}=(0,o.useTranslation)(),x=_??(!!g||!h),S=j(i,n,r)??e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(M,{eyebrow:S,leading:c,title:l,subtitle:u,trailing:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:p??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:m,"aria-disabled":x?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),b(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:f,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),b(`forms.formActions.cancel`)]})]})}),d]})}),(0,a.jsx)($e,{title:v,badges:y,actions:p,onCancel:f,loading:m,disabled:x,dirty:h,titleMissing:g})]})}var tt=`bento-tile bento-glass relative flex flex-col gap-5 overflow-hidden rounded-3xl p-5 md:p-6`;function nt({icon:t,tone:n,title:r,description:i,children:o,trailing:s,as:c=`h2`,className:l}){return(0,a.jsxs)(`section`,{className:e.t(tt,l),children:[(0,a.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`grid h-10 w-10 place-items-center rounded-2xl text-white shadow-md ${S(n)}`,children:(0,a.jsx)(t,{size:20})}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,a.jsx)(c,{className:`text-base font-semibold tracking-tight md:text-lg`,children:r}),i&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:i})]})]}),s&&(0,a.jsx)(`div`,{className:`shrink-0`,children:s})]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-5`,children:o})]})}function rt({children:t,className:n,contentClassName:r}){return(0,a.jsx)(`div`,{className:e.t(`bento-glass rounded-2xl shadow-md`,n),children:(0,a.jsx)(`div`,{className:r,children:t})})}var it=480;function at(e){return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)}function ot(){return window.scrollY>it}function st({inline:e=!1}={}){let{t}=(0,o.useTranslation)(),r=n.o(),c=e||r,l=(0,i.useSyncExternalStore)(at,ot,()=>!1);return(0,a.jsx)(`button`,{type:`button`,"aria-label":t(`bento.backToTop`,{defaultValue:`Back to top`}),tabIndex:l?0:-1,onClick:()=>window.scrollTo({top:0,behavior:`smooth`}),className:`${c?`relative`:`fixed bottom-6 right-6 z-40`} grid h-11 w-11 place-items-center rounded-full border border-border/60 bg-card/80 text-foreground shadow-lg backdrop-blur-xl transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:-translate-y-0.5 hover:shadow-xl active:scale-95 ${l?`pointer-events-auto translate-y-0 scale-100 opacity-100`:`pointer-events-none translate-y-4 scale-90 opacity-0`}`,children:(0,a.jsx)(s.IconArrowUp,{size:18})})}function ct(e){return e.bentoRoute??e.fallbackRoute}function lt({label:e,children:t}){return e?(0,a.jsxs)(`div`,{role:`group`,"aria-label":e,children:[(0,a.jsx)(`p`,{className:`px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground`,children:e}),t]}):(0,a.jsx)(a.Fragment,{children:t})}function ut({index:e,active:t,icon:n,label:r,description:i,trailing:o,onActivate:c,onChoose:l}){return(0,a.jsxs)(`button`,{type:`button`,id:`bento-palette-opt-${e}`,"data-index":e,role:`option`,"aria-selected":t?`true`:`false`,onMouseEnter:c,onClick:l,className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${t?`bg-accent text-accent-foreground`:`text-foreground`}`,children:[n&&(0,a.jsx)(n,{size:18,className:`shrink-0 text-muted-foreground`}),(0,a.jsxs)(`span`,{className:`flex-1 truncate`,children:[r,i&&(0,a.jsx)(`span`,{className:`ml-2 text-muted-foreground`,children:i})]}),o??(t&&(0,a.jsx)(s.IconArrowRight,{"aria-hidden":!0,size:15,className:`shrink-0 text-muted-foreground`}))]})}function dt({open:e,onOpenChange:n,items:r,group:c,onQueryChange:l}){let{t:d}=(0,o.useTranslation)(),f=(0,u.useNavigate)(),[p,m]=(0,i.useState)(``),[h,g]=(0,i.useState)(0),_=(0,i.useRef)(null),v=(0,i.useMemo)(()=>{let e=p.trim().toLowerCase(),t=r.map(e=>({item:e,label:d(e.titleKey),description:d(e.descriptionKey)}));if(!e)return t;let n=[],i=[];for(let r of t)r.label.toLowerCase().includes(e)?n.push(r):r.description.toLowerCase().includes(e)&&i.push(r);return[...n,...i]},[r,p,d]),y=(0,i.useMemo)(()=>[...v.map(e=>({kind:`nav`,entry:e})),...(c?.items??[]).map(e=>({kind:`supplied`,item:e}))],[v,c]),b=(0,i.useRef)(l);(0,i.useEffect)(()=>{b.current=l}),(0,i.useEffect)(()=>{b.current?.(p)},[p]);let[x,S]=(0,i.useState)(e);e!==x&&(S(e),e&&(m(``),g(0)));let C=y.length===0?0:y.length-1;h>C&&g(C),(0,i.useEffect)(()=>{(_.current?.querySelector(`[data-index="${h}"]`))?.scrollIntoView({block:`nearest`})},[h]);function w(e){n(!1),e.kind===`nav`?f(ct(e.entry.item)):c?.onSelect(e.item)}function T(e){if(e.key===`ArrowDown`)e.preventDefault(),g(e=>y.length===0?0:(e+1)%y.length);else if(e.key===`ArrowUp`)e.preventDefault(),g(e=>y.length===0?0:(e-1+y.length)%y.length);else if(e.key===`Enter`){e.preventDefault();let t=y[h];t&&w(t)}}return(0,a.jsx)(t.c,{open:e,onOpenChange:n,children:(0,a.jsxs)(t.u,{showCloseButton:!1,className:`top-[15%] max-w-xl translate-y-0 gap-0 overflow-hidden p-0`,onKeyDown:T,children:[(0,a.jsx)(t.g,{className:`sr-only`,children:d(`bento.palette.title`,{defaultValue:`Command palette`})}),(0,a.jsx)(t.d,{className:`sr-only`,children:d(`bento.palette.description`,{defaultValue:`Search and jump to any area`})}),(0,a.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/60 px-4`,children:[(0,a.jsx)(s.IconSearch,{size:18,className:`shrink-0 text-muted-foreground`}),(0,a.jsx)(`input`,{autoFocus:!0,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`bento-palette-list`,"aria-activedescendant":y[h]?`bento-palette-opt-${h}`:void 0,value:p,onChange:e=>m(e.target.value),placeholder:d(`bento.palette.placeholder`,{defaultValue:`Search areas…`}),className:`h-12 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground`})]}),(0,a.jsxs)(`div`,{ref:_,id:`bento-palette-list`,role:`listbox`,"aria-label":d(`bento.palette.title`,{defaultValue:`Command palette`}),className:`max-h-80 overflow-y-auto p-2`,children:[y.length===0&&!c?.pending&&(0,a.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:d(`bento.palette.noResults`,{defaultValue:`No matches`})}),(0,a.jsx)(lt,{label:c&&v.length>0?d(`bento.palette.areas`,{defaultValue:`Areas`}):void 0,children:v.map(({item:e,label:t},n)=>(0,a.jsx)(ut,{index:n,active:n===h,icon:e.icon,label:t,onActivate:()=>g(n),onChoose:()=>w(y[n]),trailing:e.bentoRoute?void 0:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.IconExternalLink,{"aria-hidden":!0,size:15,className:`shrink-0 text-muted-foreground/70`}),(0,a.jsx)(`span`,{className:`sr-only`,children:d(`bento.palette.opensConsole`,{defaultValue:`Opens in console`})})]})},e.id))}),c&&(0,a.jsxs)(lt,{label:c.label,children:[c.items.map((e,t)=>{let n=v.length+t;return(0,a.jsx)(ut,{index:n,active:n===h,icon:e.icon,label:e.label,description:e.description,onActivate:()=>g(n),onChoose:()=>w(y[n])},e.id)}),c.pending&&(0,a.jsx)(`p`,{className:`px-3 py-2.5 text-sm text-muted-foreground`,children:d(`bento.palette.searching`,{defaultValue:`Searching…`})})]})]})]})})}function ft({rail:t,headerStart:r,headerEnd:s,column:c=`default`,dock:l,backToTop:d=!0,children:f}){let{t:p}=(0,o.useTranslation)(),m=(0,u.useInRouterContext)(),h=(0,i.useId)(),g=(0,i.useRef)(null),_=(0,i.useRef)(null),v=c===`full`,y=r!=null||s!=null,b=n.m(),x=null;l!=null&&(x=b?y?`header`:`corner`:t==null?`corner`:`rail`);let S=d||x===`corner`,C=e=>(0,a.jsx)(n.r.Provider,{value:!0,children:(0,a.jsx)(n.i.Provider,{value:e,children:l})});return(0,a.jsxs)(`div`,{"data-slot":`bento-shell`,className:e.t(`relative w-full bg-background text-foreground`,t!=null&&`bento-rail-gutter`,v?`flex h-svh flex-col overflow-hidden`:`min-h-svh`),style:x===`rail`?{"--bento-rail-foot":`4.5rem`}:void 0,children:[(0,a.jsx)(`a`,{href:`#${h}`,onClick:e=>{e.preventDefault(),g.current?.focus()},className:`sr-only rounded-full border border-border/60 bg-card px-4 py-2 text-sm shadow-lg focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[60]`,children:p(`bento.shell.skip`,{defaultValue:`Skip to content`})}),(0,a.jsx)(`span`,{ref:_,role:`status`,"aria-live":`polite`,className:`sr-only`}),m&&(0,a.jsx)(pt,{main:g,announcer:_}),t,x===`rail`&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-dock`,className:`pointer-events-none fixed bottom-4 left-[18px] z-50 flex flex-col items-start`,children:C(`rail`)}),y&&(0,a.jsxs)(`header`,{className:`bento-shell-header bento-shell-bar sticky top-0 z-30 flex shrink-0 items-center justify-between gap-3 border-b border-border/40 bg-background/55 py-3 backdrop-blur-xl backdrop-saturate-150`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center gap-3`,children:r}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,x===`header`&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-dock`,className:`relative flex`,children:C(`header`)})]})]}),(0,a.jsx)(`main`,{ref:g,id:h,tabIndex:-1,"aria-label":p(`bento.shell.main`,{defaultValue:`Main content`}),"data-column":c,className:`bento-shell-main`,children:f}),S&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-corner`,className:`pointer-events-none fixed bottom-5 right-5 z-50 flex flex-col items-end gap-3`,children:(0,a.jsxs)(n.r.Provider,{value:!0,children:[d&&(0,a.jsx)(st,{}),x===`corner`&&C(`corner`)]})})]})}function pt({main:e,announcer:t}){let{pathname:n}=(0,u.useLocation)(),r=(0,i.useRef)(n);return(0,i.useEffect)(()=>{if(r.current===n)return;r.current=n;let i=0,a,o=()=>{let n=e.current?.querySelector(`h1`)??null;if(!n&&i++<20){a=setTimeout(o,50);return}n&&!n.hasAttribute(`tabindex`)&&n.setAttribute(`tabindex`,`-1`),(n??e.current)?.focus(),t.current&&(t.current.textContent=n?.textContent?.trim()||document.title)};return o(),()=>clearTimeout(a)},[n,e,t]),null}var mt=Object.freeze([{action:`palette`,key:`k`,mod:!0},{action:`palette`,key:`/`},{action:`shortcuts`,key:`?`}]);function ht(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent||``)}function gt(e,t){let n=e.key.length===1?e.key.toUpperCase():e.key;return e.mod?[t?`⌘`:`Ctrl`,n]:[n]}function _t(e){if(!(e instanceof HTMLElement))return!1;if([`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)||e.isContentEditable)return!0;let t=e.closest(`[contenteditable]`);return t!==null&&t.getAttribute(`contenteditable`)!==`false`}function vt(e,t){if(e.defaultPrevented||e.isComposing||e.repeat)return;let n=e.key.toLowerCase();return mt.find(r=>n===r.key?r.mod?(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey:e.metaKey||_t(e.target)?!1:e.ctrlKey===e.altKey:!1)}function yt({onPalette:e,onShortcuts:t,isMac:n=ht()}){let r=(0,i.useRef)({onPalette:e,onShortcuts:t});(0,i.useEffect)(()=>{r.current={onPalette:e,onShortcuts:t}}),(0,i.useEffect)(()=>{function e(e){let t=vt(e,n),i=t?.action===`palette`?r.current.onPalette:t&&r.current.onShortcuts;i&&(e.preventDefault(),i())}return globalThis.addEventListener(`keydown`,e),()=>globalThis.removeEventListener(`keydown`,e)},[n])}function bt({onClick:t,isMac:n=ht(),className:r}){let{t:i}=(0,o.useTranslation)(),c=mt.filter(e=>e.action===`palette`),l=c.find(e=>e.mod);return(0,a.jsxs)(`button`,{type:`button`,onClick:t,"aria-keyshortcuts":c.map(e=>e.mod?`${n?`Meta`:`Control`}+${e.key.toUpperCase()}`:e.key).join(` `),className:e.t(`bento-tile bento-tile-clickable inline-flex items-center gap-2 rounded-full border border-border/60 bg-card/60 py-1.5 pl-3 pr-2 text-sm text-muted-foreground backdrop-blur hover:text-foreground`,r),children:[(0,a.jsx)(s.IconSearch,{"aria-hidden":!0,size:16}),(0,a.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:i(`bento.palette.search`,{defaultValue:`Search`})}),l&&(0,a.jsx)(`kbd`,{"aria-hidden":!0,className:`hidden rounded border border-border/60 bg-muted px-1.5 py-0.5 text-[10px] font-medium tracking-wide sm:inline`,children:gt(l,n).join(n?``:` `)})]})}function xt({open:e,onOpenChange:n,isMac:r=ht()}){let{t:c}=(0,o.useTranslation)(),l={palette:c(`bento.palette.open`,{defaultValue:`Open command palette`}),shortcuts:c(`bento.shortcuts.openGuide`,{defaultValue:`Show keyboard shortcuts`})},u=[...new Set(mt.map(e=>e.action))],d=[{heading:c(`bento.shortcuts.global`,{defaultValue:`Global`}),rows:u.map(e=>({id:e,label:l[e],combos:mt.filter(t=>t.action===e).map(e=>gt(e,r))}))},{heading:c(`bento.shortcuts.palette`,{defaultValue:`Command palette`}),rows:[{id:`navigate`,combos:[[`↑`,`↓`]],label:c(`bento.shortcuts.navigate`,{defaultValue:`Move between results`})},{id:`open`,combos:[[`↵`]],label:c(`bento.shortcuts.openSelected`,{defaultValue:`Open the selected area`})},{id:`dismiss`,combos:[[`Esc`]],label:c(`bento.shortcuts.dismiss`,{defaultValue:`Close the palette or a dialog`})}]}];return(0,a.jsx)(t.c,{open:e,onOpenChange:n,children:(0,a.jsxs)(t.u,{className:`max-w-md`,children:[(0,a.jsxs)(t.p,{children:[(0,a.jsxs)(t.g,{className:`flex items-center gap-2`,children:[(0,a.jsx)(s.IconKeyboard,{size:20,className:`bento-accent-icon`}),c(`bento.shortcuts.title`,{defaultValue:`Keyboard shortcuts`})]}),(0,a.jsx)(t.d,{children:c(`bento.shortcuts.description`,{defaultValue:`Move around without leaving the keyboard.`})})]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-5`,children:d.map(e=>(0,a.jsxs)(`section`,{children:[(0,a.jsx)(`h3`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.heading}),(0,a.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.rows.map(e=>(0,a.jsxs)(`li`,{"data-shortcut":e.id,className:`flex items-center justify-between gap-4`,children:[(0,a.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,a.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:e.combos.map((e,t)=>(0,a.jsxs)(i.Fragment,{children:[t>0&&(0,a.jsx)(`span`,{className:`px-0.5 text-[11px] text-muted-foreground`,children:c(`bento.shortcuts.or`,{defaultValue:`or`})}),e.map(e=>(0,a.jsx)(`kbd`,{className:`inline-flex min-w-6 items-center justify-center rounded-md border border-border/60 bg-muted px-1.5 py-0.5 text-[11px] font-medium tracking-wide`,children:e},e))]},e.join(`+`)))})]},e.id))})]},e.heading))})]})})}var St=s.IconLayoutGrid;function Ct(e,t){return e===t||e.startsWith(`${t}/`)}function wt(e,t){return t.section.areaRoute&&Ct(e,t.section.areaRoute)?!0:t.items.some(t=>t.bentoRoute&&Ct(e,t.bentoRoute))}function Tt(e){return e.items.reduce((e,t)=>e+(t.count&&t.count>0?t.count:0),0)}function Et({groups:e,homeRoute:t,homeAliases:r,homeLabel:c}){let{t:l}=(0,o.useTranslation)(),{pathname:d}=(0,u.useLocation)(),f=(0,i.useMemo)(()=>e.filter(e=>!!e.section.areaRoute),[e]),p=d===t||(r?.includes(d)??!1);return(0,a.jsx)(n._,{delayDuration:200,children:(0,a.jsxs)(`nav`,{"aria-label":l(`bento.nav.label`,{defaultValue:`Primary`}),className:`fixed inset-y-0 left-0 z-40 hidden w-20 flex-col items-center gap-1 overflow-y-auto overflow-x-hidden border-r border-border/40 bg-background/55 pt-20 pb-[calc(1rem+var(--bento-rail-foot,0px))] backdrop-blur-xl backdrop-saturate-150 md:flex`,children:[(0,a.jsx)(Dt,{to:t,icon:s.IconHome,label:c??l(`home.title`,{defaultValue:`Home`}),shown:!0,active:p}),f.length>0&&(0,a.jsx)(`span`,{"aria-hidden":!0,className:`my-1 h-px w-6 bg-border/60`}),f.map(e=>(0,a.jsx)(Dt,{to:e.section.areaRoute,icon:e.section.icon??St,label:e.section.labelKey?l(e.section.labelKey):e.section.id,shown:!!e.section.labelKey,count:Tt(e),active:wt(d,e)},e.section.id))]})})}function Dt({to:e,icon:t,label:r,shown:i,count:s=0,active:c}){let{t:l}=(0,o.useTranslation)(),d=s>0?l(`bento.nav.count`,{count:s,defaultValue:`{{count}} waiting`}):null,f=(0,a.jsxs)(u.Link,{to:e,"aria-label":d?`${r}, ${d}`:r,"aria-current":c?`page`:void 0,className:`group flex w-full shrink-0 flex-col items-center gap-1 px-1 py-0.5 ${c?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,a.jsxs)(`span`,{className:`bento-tile-clickable relative grid h-11 w-11 place-items-center rounded-2xl border transition-colors duration-200 ${c?`bento-rail-active`:`border-transparent group-hover:border-border/60 group-hover:bg-card/60`}`,children:[(0,a.jsx)(t,{size:20}),s>0&&(0,a.jsx)(`span`,{"aria-hidden":!0,"data-slot":`bento-rail-count`,className:`absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-center text-[0.6875rem] leading-4 text-primary-foreground`,children:s>99?`99+`:s})]}),i&&(0,a.jsx)(`span`,{"aria-hidden":!0,title:r,className:`w-full truncate text-center text-[0.6875rem] leading-4`,children:r})]});return i?f:(0,a.jsxs)(n.h,{children:[(0,a.jsx)(n.v,{asChild:!0,children:f}),(0,a.jsx)(n.g,{side:`right`,children:r})]})}function Ot({accountRoute:e,logoutUrl:t,organizationsRoute:r,tenantAdminRoute:i,onOpenShortcuts:c,onReplayTour:l}){let{user:d,status:f}=n.n(),{t:p}=(0,o.useTranslation)(),m=(0,u.useNavigate)(),h=`${d.firstName??``} ${d.lastName??``}`.trim()||d.username||``;return f===`loading`?(0,a.jsx)(`div`,{className:`h-9 w-9 rounded-full bg-muted/40`,"aria-hidden":!0}):(0,a.jsxs)(n.M,{children:[(0,a.jsx)(n.K,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,title:h||d.username,className:`bento-tile-clickable cursor-pointer rounded-full p-0.5 ring-1 ring-border/60 outline-none transition-shadow duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] bento-ring hover:ring-2 focus-visible:ring-2 focus-visible:ring-ring`,children:(0,a.jsx)(n.s,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})})}),(0,a.jsxs)(n.P,{align:`end`,sideOffset:10,className:`bento-dropdown min-w-64 p-2`,children:[(0,a.jsx)(n.L,{className:`p-0 font-normal`,children:(0,a.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl px-2 py-2 text-left text-sm`,children:[(0,a.jsx)(`span`,{className:`rounded-full p-0.5 ring-1 ring-border/60`,children:(0,a.jsx)(n.s,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})}),(0,a.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[h&&(0,a.jsx)(`span`,{className:`truncate font-medium`,children:h}),d.email&&(0,a.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:d.email})]})]})}),(0,a.jsx)(n.V,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.F,{children:[(0,a.jsxs)(n.I,{onSelect:()=>m(e),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconUserCircle,{size:18}),p(`nav.account`)]}),r&&(0,a.jsxs)(n.I,{onSelect:()=>m(r),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconBuildingCommunity,{size:18}),p(`nav.organizations`,{defaultValue:`Organizations`})]}),i&&(0,a.jsxs)(n.I,{onSelect:()=>m(i),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconBuildingSkyscraper,{size:18}),p(`nav.tenantAdmin`,{defaultValue:`Tenant administration`})]})]}),(c||l)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.V,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.F,{children:[l&&(0,a.jsxs)(n.I,{onSelect:()=>l(),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconSparkles,{size:18}),p(`bento.tour.replay`,{defaultValue:`Take the tour`})]}),c&&(0,a.jsxs)(n.I,{onSelect:()=>c(),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconKeyboard,{size:18}),p(`bento.shortcuts.title`,{defaultValue:`Keyboard shortcuts`})]})]})]}),(0,a.jsx)(n.V,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.I,{onSelect:()=>{globalThis.location.href=t},className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 bento-item-danger`,children:[(0,a.jsx)(s.IconLogout,{size:18}),p(`nav.logOut`)]})]})]})}var kt={blue:`blue`,violet:`violet`,emerald:`emerald`,amber:`amber`,rose:`rose`,slate:`slate`,cyan:`blue`,orange:`amber`};function At({variant:t=`blue`,className:r,children:o}){let s;i.Children.forEach(o,e=>{if(!(0,i.isValidElement)(e))return;let{type:t}=e;(t===n.y.Header||t===n.y.StaticHeader)&&(s??=e.props)});let c=i.Children.map(o,e=>{if(!(0,i.isValidElement)(e))return e;let{type:t}=e;return t===n.y.Header||t===n.y.StaticHeader?null:t===n.y.Content?e.props.children:e});return s?(0,a.jsx)(nt,{icon:s.icon,tone:kt[t]??`blue`,title:s.title,description:s.description,className:r,children:c}):(0,a.jsx)(`section`,{className:e.t(tt,r),children:c})}At.Header=n.y.Header,At.StaticHeader=n.y.StaticHeader,At.Content=n.y.Content;var jt=`bento-grid grid auto-rows-[minmax(140px,auto)] grid-cols-2 gap-4 md:grid-cols-4 md:gap-5 lg:grid-cols-6`;function Mt({eyebrow:e,title:t,description:n,titleHref:r,children:i,gridClassName:o=jt}){let c=(0,a.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight md:text-2xl`,children:t});return(0,a.jsxs)(`section`,{className:`mb-8 md:mb-10`,children:[(0,a.jsxs)(`header`,{className:`bento-shell-header mb-4 flex flex-col gap-0.5`,children:[e&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:e}),r?(0,a.jsxs)(u.Link,{to:r,className:`group inline-flex w-fit items-center gap-1 text-foreground transition-colors hover:text-primary`,children:[c,(0,a.jsx)(s.IconChevronRight,{size:20,className:`text-muted-foreground transition-transform duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] group-hover:translate-x-1`})]}):c,n&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:n})]}),(0,a.jsx)(`div`,{className:o,children:i})]})}function Nt({to:t,onClick:n,disabled:r=!1,disabledHint:i,icon:o,tone:c,eyebrow:l,title:d,span:f,featured:p=!1,children:m}){let h=!r&&!!(t||n),g=p?`h-14 w-14 rounded-2xl`:`h-9 w-9 rounded-2xl`,_=p?28:18,v=p?`text-xl font-semibold tracking-tight md:text-2xl`:`text-base font-semibold tracking-tight md:text-lg`,y=(0,a.jsxs)(a.Fragment,{children:[p&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -bottom-10 -right-10 h-64 w-64 rounded-full ${S(c)} opacity-40 blur-2xl dark:opacity-50`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-12 top-1/3 h-32 w-32 rounded-full ${S(c)} bento-chip-tr opacity-20 blur-2xl dark:opacity-30`})]}),(0,a.jsxs)(`div`,{className:`relative z-1 flex items-center justify-between`,children:[(0,a.jsx)(`span`,{className:`grid place-items-center ${S(c)} text-white shadow-md ${g}`,children:(0,a.jsx)(o,{size:_})}),h&&(0,a.jsx)(s.IconChevronRight,{size:p?18:16,className:`text-muted-foreground transition-transform duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] group-hover:translate-x-1`})]}),(0,a.jsxs)(`div`,{className:`relative z-1`,children:[(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:l}),(0,a.jsx)(`div`,{className:`mt-0.5 ${v}`,children:d}),m&&(0,a.jsx)(`div`,{className:`mt-2`,children:m})]})]}),b=`bento-tile bento-glass group relative flex flex-col ${p?`gap-5`:`gap-4`} overflow-hidden text-left ${p?`p-6 md:p-7`:`p-5`} ${f}${h?` bento-tile-clickable`:``}${r?` cursor-not-allowed opacity-60`:``}`;return r?(0,a.jsx)(`div`,{className:b,"aria-disabled":`true`,title:i,children:y}):t?(0,a.jsx)(u.Link,{to:t,className:b,children:y}):n?(0,a.jsx)(`button`,{type:`button`,onClick:n,className:e.t(`w-full`,b),children:y}):(0,a.jsx)(`div`,{className:b,children:y})}function Pt({versions:t,selected:n,onSelect:r,label:c}){let{t:l,i18n:u}=(0,o.useTranslation)(),[d,f]=(0,i.useState)(0),[p,m]=(0,i.useState)([]),h=(0,i.useRef)(new Map),g=e=>[...e].sort((e,n)=>t.findIndex(e=>e.id===n)-t.findIndex(t=>t.id===e));function _(e){if(n.includes(e)){m(p.filter(t=>t!==e)),r(n.filter(t=>t!==e));return}let t=[...n.filter(e=>!p.includes(e)),...p.filter(e=>n.includes(e))],i=t.length>=2?t.slice(t.length-1):t;m([...i,e]),r(g([...i,e]))}function v(e){let n=Math.max(0,Math.min(t.length-1,e));f(n),h.current.get(n)?.focus()}function y(e,n){switch(e.key){case`ArrowDown`:v(n+1);break;case`ArrowUp`:v(n-1);break;case`Home`:v(0);break;case`End`:v(t.length-1);break;case` `:case`Enter`:_(t[n].id);break;default:return}e.preventDefault()}let b=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?{iso:void 0,text:String(e)}:{iso:t.toISOString(),text:new Intl.DateTimeFormat(u?.resolvedLanguage,{dateStyle:`medium`,timeStyle:`short`}).format(t)}};return(0,a.jsx)(`ul`,{role:`listbox`,"aria-label":c??l(`bento.versions.label`,{defaultValue:`Versions`}),"aria-multiselectable":`true`,"data-slot":`bento-version-rail`,className:`m-0 flex list-none flex-col gap-1 p-0`,children:t.map((r,i)=>{let o=n.includes(r.id),c=b(r.at),u=r.actor===`agent`?s.IconRobot:s.IconUser,p=o?`text-foreground/80`:`text-muted-foreground`;return(0,a.jsxs)(`li`,{ref:e=>{e?h.current.set(i,e):h.current.delete(i)},role:`option`,"aria-selected":o?`true`:`false`,tabIndex:i===Math.min(d,t.length-1)?0:-1,onKeyDown:e=>y(e,i),onClick:()=>{f(i),_(r.id)},className:e.t(`flex cursor-pointer flex-col gap-0.5 rounded-xl border px-3 py-2 text-sm outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring`,o?`border-primary/50 bg-primary/10`:`border-transparent hover:bg-muted/50`),children:[(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,a.jsx)(u,{size:14,"aria-hidden":`true`}),r.author,(0,a.jsx)(`span`,{className:e.t(`text-xs font-normal`,p),children:r.actor===`agent`?l(`bento.versions.agent`,{defaultValue:`Agent`}):l(`bento.versions.human`,{defaultValue:`Person`})})]}),(0,a.jsx)(`time`,{dateTime:c.iso,className:e.t(`text-xs`,p),children:c.text}),r.summary&&(0,a.jsx)(`span`,{className:`text-xs`,children:r.summary})]},r.id)})})}exports.AdaptiveSectionCard=At,exports.BENTO_EMPHASIS_NEXT=Oe,exports.BENTO_EMPHASIS_SPAN=De,exports.BENTO_SHELL_SHORTCUTS=mt,exports.BENTO_TONES=x,exports.BENTO_TONE_CLASS=b,exports.BentoActionsMenu=y,exports.BentoBackLink=A,exports.BentoBackToTop=st,exports.BentoCalendar=Te,exports.BentoChangeMark=R,exports.BentoCommandPalette=dt,exports.BentoCountTile=C,exports.BentoDataTable=E,exports.BentoDiff=U,exports.BentoEmptyState=D,exports.BentoEntityShell=ee,exports.BentoEntityTile=je,exports.BentoFilterBar=Ie,exports.BentoFormHero=et,exports.BentoFormSection=nt,exports.BentoHero=M,exports.BentoHeroIconPicker=N,exports.BentoInlineEdit=P,exports.BentoListPage=He,exports.BentoNavRail=Et,exports.BentoPaletteTrigger=bt,exports.BentoPanel=rt,exports.BentoSaveBar=Ze,exports.BentoScrollSaveBar=$e,exports.BentoSection=Mt,exports.BentoShell=ft,exports.BentoShortcutsDialog=xt,exports.BentoSplitPage=ve,exports.BentoStatusMarker=F,exports.BentoTile=Nt,exports.BentoTileGrid=Ue,exports.BentoTrail=k,exports.BentoUserMenu=Ot,exports.BentoVersionRail=Pt,exports.EMPTY_FILTERS=Me,exports.bentoChipClass=S,exports.bentoNavTarget=ct,exports.resolveBentoLayout=ke,exports.toBentoLayoutEntries=Ae,exports.useBentoScrollFade=I,exports.useBentoShellShortcuts=yt;
5
+ `):t.field.format?t.field.format(t.b):H(t.b)})},t.field.id))})]})]})}function U({label:e,state:t,children:n}){return(0,a.jsxs)(`div`,{className:`rounded-xl border border-border/60 bg-card/40 p-3`,children:[(0,a.jsxs)(`dt`,{className:`mb-1.5 flex items-center gap-2 text-xs font-medium text-muted-foreground`,children:[(0,a.jsx)(`span`,{children:e}),(0,a.jsx)(R,{state:t})]}),(0,a.jsx)(`dd`,{className:`m-0`,children:n})]})}function W({row:e,layout:t}){let{t:n}=(0,o.useTranslation)(),{field:r,a:i,b:s,kind:c,state:l}=e;if(c===`lines`)return(0,a.jsx)(q,{label:r.label,before:H(i),after:H(s),layout:t});if(c===`value`){let e=e=>r.format?r.format(e):H(e);return(0,a.jsxs)(`p`,{className:`m-0 flex flex-wrap items-center gap-2 text-sm`,children:[l!==`added`&&(0,a.jsx)(ve,{children:e(i)}),l===`changed`&&(0,a.jsx)(`span`,{"aria-hidden":`true`,children:`→`}),l!==`removed`&&(0,a.jsx)(_e,{children:e(s)})]})}let u=c===`rich`?V(H(i)):[H(i)].filter(Boolean),d=c===`rich`?V(H(s)):[H(s)].filter(Boolean),f=z(u,d,!1)??[...u.map(e=>({op:`remove`,text:e})),...d.map(e=>({op:`add`,text:e}))],p=[];for(let e=0;e<f.length;e++){let t=f[e],n=f[e+1];if(t.op===`remove`&&n?.op===`add`){let r=z(B(t.text),B(n.text));p.push((0,a.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm leading-relaxed`,children:r?r.map((e,t)=>e.op===`same`?(0,a.jsx)(`span`,{children:e.text},t):e.op===`add`?(0,a.jsx)(_e,{children:e.text},t):(0,a.jsx)(ve,{children:e.text},t)):[(0,a.jsx)(ve,{children:t.text},`r`),` `,(0,a.jsx)(_e,{children:n.text},`a`)]},e)),e++}else p.push((0,a.jsx)(`p`,{className:`m-0 whitespace-pre-wrap text-sm leading-relaxed`,children:t.op===`same`?t.text:t.op===`add`?(0,a.jsx)(_e,{children:t.text}):(0,a.jsx)(ve,{children:t.text})},e))}return p.length===0?(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:n(`bento.diff.empty`,{defaultValue:`Empty`})}):(0,a.jsx)(`div`,{className:`flex flex-col gap-2`,children:p})}var G=3,K=e=>e===``?[]:e.replace(/\r?\n$/,``).split(/\r?\n/);function oe(e,t){let n=K(e),r=K(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;let a=0;for(;a<n.length-i&&a<r.length-i&&n[n.length-1-a]===r[r.length-1-a];)a++;let o=z(n.slice(i,n.length-a),r.slice(i,r.length-a),!1);if(o===null)return null;let s=[],c=0,l=0,u=e=>s.push({op:`same`,text:e,old:++c,new:++l});n.slice(0,i).forEach(u);let d=[],f=[],p=()=>{for(let e=0;e<Math.min(d.length,f.length);e++){let t=z(B(d[e].text),B(f[e].text));t&&(d[e].parts=t.filter(e=>e.op!==`add`),f[e].parts=t.filter(e=>e.op!==`remove`))}s.push(...d,...f),d=[],f=[]};for(let e of o)e.op===`remove`?d.push({op:`remove`,text:e.text,old:++c}):e.op===`add`?f.push({op:`add`,text:e.text,new:++l}):(p(),u(e.text));return p(),n.slice(n.length-a).forEach(u),s}function se(e){let t=[],n=0;for(;n<e.length;){if(e[n].op===`same`){t.push({left:e[n],right:e[n]}),n++;continue}let r=[],i=[];for(;n<e.length&&e[n].op!==`same`;n++)(e[n].op===`remove`?r:i).push(e[n]);for(let e=0;e<Math.max(r.length,i.length);e++)t.push({left:r[e]??null,right:i[e]??null})}return t}function ce(e,t,n){let r=Array(e.length).fill(!1);e.forEach((n,i)=>{if(t(n))for(let t=Math.max(0,i-G);t<=Math.min(e.length-1,i+G);t++)r[t]=!0});let i=[],a=0;for(;a<e.length;){let t=a,o=r[a];for(;a<e.length&&r[a]===o;)a++;let s=e.slice(t,a);o||s.length===1?i.push({fold:!1,items:s}):i.push({fold:!0,key:n(s[0]),items:s})}return i}function q({label:t,before:n,after:r,layout:c}){let{t:l}=(0,o.useTranslation)(),[u,d]=(0,i.useState)(new Set),f=oe(n,r);if(f===null)return(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:l(`bento.diff.tooLarge`,{defaultValue:`Too many lines changed to compare them here`})});if(f.length===0)return(0,a.jsx)(`p`,{className:`m-0 text-sm text-muted-foreground`,children:l(`bento.diff.empty`,{defaultValue:`Empty`})});let p=e=>{let t=new Set(u);t.delete(e)||t.add(e),d(t)};function m(t,n,r){let i=u.has(t.key);return[(0,a.jsx)(`tr`,{children:(0,a.jsx)(`td`,{colSpan:n,className:`bg-muted/40 px-2`,children:(0,a.jsxs)(`button`,{type:`button`,"data-look":`text`,"aria-expanded":i?`true`:`false`,onClick:()=>p(t.key),className:`inline-flex items-center gap-1 rounded-md font-sans text-muted-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,a.jsx)(s.IconChevronRight,{size:12,"aria-hidden":`true`,className:e.t(`transition-transform`,i&&`rotate-90`)}),l(`bento.diff.unchangedLines`,{defaultValue:`{{count}} unchanged lines`,count:t.items.length})]})})},`fold-${t.key}`),...i?t.items.map(r):[]]}let h=t=>(0,a.jsx)(`table`,{"data-layout":`inline`,className:e.t(`min-w-full border-collapse font-mono text-mono leading-5`,t),children:(0,a.jsx)(`tbody`,{children:ce(f,e=>e.op!==`same`,le).map(e=>{let t=e=>(0,a.jsx)(Y,{row:e},le(e));return e.fold?m(e,4,t):e.items.map(t)})})});return(0,a.jsx)(`section`,{"aria-label":t,tabIndex:0,className:`@container/diff overflow-x-auto rounded-md border border-border/60 focus-visible:outline-2 focus-visible:outline-ring`,children:c===`split`?(0,a.jsxs)(a.Fragment,{children:[h(`@3xl/diff:hidden`),(t=>(0,a.jsxs)(`table`,{"data-layout":`split`,className:e.t(`w-full table-fixed border-collapse font-mono text-mono leading-5`,t),children:[(0,a.jsxs)(`colgroup`,{children:[(0,a.jsx)(`col`,{className:`w-14`}),(0,a.jsx)(`col`,{className:`w-5`}),(0,a.jsx)(`col`,{}),(0,a.jsx)(`col`,{className:`w-14`}),(0,a.jsx)(`col`,{className:`w-5`}),(0,a.jsx)(`col`,{})]}),(0,a.jsx)(`tbody`,{children:ce(se(f),e=>e.left?.op!==`same`,ue).map(e=>{let t=e=>(0,a.jsx)(me,{pair:e},ue(e));return e.fold?m(e,6,t):e.items.map(t)})})]}))(`hidden @3xl/diff:table`)]}):h()})}var le=e=>`${e.old??``}:${e.new??``}`,ue=e=>`${e.left?.old??``}:${e.right?.new??``}`,J=t=>e.t(t.op===`add`&&`bento-status bento-status-on`,t.op===`remove`&&`bento-status bento-status-error`);function de(e){return e.parts?e.parts.map((e,t)=>e.op===`add`?(0,a.jsx)(_e,{children:e.text},t):e.op===`remove`?(0,a.jsx)(ve,{children:e.text},t):(0,a.jsx)(`span`,{children:e.text},t)):e.op===`same`?e.text:(0,a.jsx)(ge,{op:e.op,children:e.text})}var fe={same:` `,add:`+`,remove:`−`},pe=`select-none px-2 text-right align-top text-muted-foreground tabular-nums`;function Y({row:t}){let n=J(t);return(0,a.jsxs)(`tr`,{"data-op":t.op,children:[(0,a.jsx)(`td`,{className:e.t(`w-px`,pe,n),children:t.old}),(0,a.jsx)(`td`,{className:e.t(`w-px`,pe,n),children:t.new}),(0,a.jsx)(`td`,{"aria-hidden":`true`,className:e.t(`w-px select-none pr-1`,n),children:fe[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre pr-3`,!t.parts&&n),children:de(t)})]})}function me({pair:e}){return(0,a.jsxs)(`tr`,{"data-op":e.left?.op===`same`?`same`:`change`,children:[(0,a.jsx)(he,{row:e.left,number:e.left?.old}),(0,a.jsx)(he,{row:e.right,number:e.right?.new,right:!0})]})}function he({row:t,number:n,right:r=!1}){if(t===null)return(0,a.jsx)(`td`,{colSpan:3,"data-empty":``,className:e.t(`[background-image:repeating-linear-gradient(-45deg,var(--color-border)_0_1px,transparent_0_6px)]`,r&&`border-l border-border/60`)});let i=J(t);return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`td`,{className:e.t(pe,i,r&&`border-l border-border/60`),children:n}),(0,a.jsx)(`td`,{"aria-hidden":`true`,className:e.t(`select-none align-top`,i),children:fe[t.op]}),(0,a.jsx)(`td`,{className:e.t(`whitespace-pre-wrap pr-3 [overflow-wrap:anywhere]`,!t.parts&&i),children:de(t)})]})}function ge({op:e,children:t}){let{t:n}=(0,o.useTranslation)();return(0,a.jsxs)(e===`add`?`ins`:`del`,{className:`no-underline`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[e===`add`?n(`bento.diff.addedStart`,{defaultValue:`added:`}):n(`bento.diff.removedStart`,{defaultValue:`removed:`}),` `]}),t]})}function _e({children:e}){let{t}=(0,o.useTranslation)();return(0,a.jsxs)(`ins`,{className:`bento-status bento-status-on rounded-sm px-0.5 underline decoration-2 underline-offset-2`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[t(`bento.diff.addedStart`,{defaultValue:`added:`}),` `]}),e]})}function ve({children:e}){let{t}=(0,o.useTranslation)();return(0,a.jsxs)(`del`,{className:`bento-status bento-status-error rounded-sm px-0.5 line-through decoration-2`,children:[(0,a.jsxs)(`span`,{className:`sr-only`,children:[t(`bento.diff.removedStart`,{defaultValue:`removed:`}),` `]}),e]})}var ye=6e4,X=60*ye,be=24*X,xe=30*be;function Se(e,t,n){let r=e.getTime()-t,i=Math.abs(r);return i<ye?n.format(0,`second`):i<X?n.format(Math.round(r/ye),`minute`):i<be?n.format(Math.round(r/X),`hour`):n.format(Math.round(r/be),`day`)}function Ce({at:t,actor:n,agent:r=!1,now:c,className:l}){let{t:u,i18n:d}=(0,o.useTranslation)(),f=new Date(t),p=!Number.isNaN(f.getTime()),[m]=(0,i.useState)(()=>Date.now()),h=c===void 0?m:new Date(c).getTime(),g=d?.resolvedLanguage??d?.language,_=String(t),v=String(t);return p&&(v=new Intl.DateTimeFormat(g,{dateStyle:`long`,timeStyle:`short`}).format(f),_=Math.abs(f.getTime()-h)<xe?Se(f,h,new Intl.RelativeTimeFormat(g,{numeric:`auto`})):new Intl.DateTimeFormat(g,{dateStyle:`medium`}).format(f)),(0,a.jsxs)(`span`,{"data-slot":`bento-change-cell`,className:e.t(`flex min-w-0 flex-col`,l),children:[(0,a.jsxs)(`time`,{dateTime:p?f.toISOString():void 0,title:v,className:`truncate text-foreground`,children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,children:_}),(0,a.jsx)(`span`,{className:`sr-only`,children:v})]}),n!=null&&(0,a.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1 text-xs text-muted-foreground`,children:[r&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.IconRobot,{size:12,"aria-hidden":`true`,className:`shrink-0`}),(0,a.jsx)(`span`,{className:`sr-only`,children:u(`bento.versions.agent`,{defaultValue:`Agent`})})]}),(0,a.jsx)(`span`,{className:`truncate`,children:n})]})]})}function we(e){let t=0;for(let n of e)t=t*31+(n.codePointAt(0)??0)>>>0;return x[t%x.length]}function Te({name:t,detail:r,tone:i,className:o}){return(0,a.jsxs)(`span`,{"data-slot":`bento-identity-cell`,className:e.t(`flex min-w-0 items-center gap-2.5`,o),children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,className:e.t(S(i??we(t)),`grid size-8 shrink-0 place-items-center rounded-lg text-xs font-semibold text-white`),children:n.c({name:t})}),(0,a.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,a.jsx)(`span`,{className:`truncate font-medium text-foreground`,children:t}),r!=null&&(0,a.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:r})]})]})}var Ee=[`primary`,`secondary`],De={getItem:e=>{try{return window.localStorage.getItem(e)}catch{return null}},setItem:(e,t)=>{try{window.localStorage.setItem(e,t)}catch{}}},Z={getItem:()=>null,setItem:()=>{}};function Oe({primary:t,secondary:r,primaryLabel:i,secondaryLabel:s,storageKey:c,defaultRatio:u=50,className:d}){let{t:f}=(0,o.useTranslation)(),p=n.v(),m=(0,l.useDefaultLayout)({id:c??`bento-split-page`,panelIds:Ee,storage:c?De:Z});return p?(0,a.jsxs)(n.p,{"data-slot":`bento-split-page`,defaultValue:`primary`,className:e.t(`flex flex-col gap-3`,d),children:[(0,a.jsxs)(n.h,{"aria-label":f(`bento.split.switch`,{defaultValue:`Show`}),className:`self-start`,children:[(0,a.jsx)(n.g,{value:`primary`,children:i}),(0,a.jsx)(n.g,{value:`secondary`,children:s})]}),(0,a.jsx)(n.m,{value:`primary`,forceMount:!0,className:`data-[state=inactive]:hidden`,children:t}),(0,a.jsx)(n.m,{value:`secondary`,forceMount:!0,className:`data-[state=inactive]:hidden`,children:r})]}):(0,a.jsx)(`div`,{"data-slot":`bento-split-page`,className:e.t(`h-[var(--bento-split-height,calc(100dvh-12rem))] min-h-80`,d),children:(0,a.jsxs)(n.D,{orientation:`horizontal`,defaultLayout:m.defaultLayout,onLayoutChanged:m.onLayoutChanged,children:[(0,a.jsx)(n.E,{id:`primary`,defaultSize:`${u}`,minSize:`25`,children:(0,a.jsx)(`section`,{"aria-label":i,className:`h-full overflow-y-auto pr-3`,children:t})}),(0,a.jsx)(n.T,{withHandle:!0}),(0,a.jsx)(n.E,{id:`secondary`,defaultSize:`${100-u}`,minSize:`25`,children:(0,a.jsx)(`section`,{"aria-label":s,className:`h-full overflow-y-auto pl-3`,children:r})})]})})}var Q=({y:e,m:t,d:n})=>`${e}-${String(t).padStart(2,`0`)}-${String(n).padStart(2,`0`)}`,$=({y:e,m:t,d:n})=>Date.UTC(e,t-1,n),ke=e=>{let t=new Date(e);return{y:t.getUTCFullYear(),m:t.getUTCMonth()+1,d:t.getUTCDate()}},Ae=(e,t)=>ke($(e)+t*864e5),je=(e,t)=>{let n=new Date(Date.UTC(e.y,e.m-1+t,1)),r=new Date(Date.UTC(n.getUTCFullYear(),n.getUTCMonth()+1,0)).getUTCDate();return{y:n.getUTCFullYear(),m:n.getUTCMonth()+1,d:Math.min(e.d,r)}},Me=e=>new Date($(e)).getUTCDay();function Ne(e,t){let n=new Intl.DateTimeFormat(`en-US`,{timeZone:t,year:`numeric`,month:`numeric`,day:`numeric`,hour:`numeric`,minute:`numeric`,second:`numeric`,hourCycle:`h23`}).formatToParts(new Date(e)),r=e=>Number(n.find(t=>t.type===e)?.value);return{y:r(`year`),m:r(`month`),d:r(`day`),h:r(`hour`),mi:r(`minute`),s:r(`second`)}}function Pe(e,t,n,r,i,a){let o=Date.UTC(e.y,e.m-1,e.d,t,n,r),s=e=>{let t=Ne(e,a);return Date.UTC(t.y,t.m-1,t.d,t.h,t.mi,t.s)-Math.floor(e/1e3)*1e3},c=o-s(o),l=s(c);return o-l!==c&&(c=o-l),new Date(c+i)}var Fe={on:`bento-status bento-status-on`,warn:`bento-status bento-status-warn`,error:`bento-status bento-status-error`};function Ie({entries:t,view:n,defaultView:r=`month`,onViewChange:c,defaultDate:l,timeZone:u=Intl.DateTimeFormat().resolvedOptions().timeZone,weekStartsOn:d=0,onEntryMove:f,onEntrySelect:p,onRangeChange:m,label:h,className:g}){let{t:_,i18n:v}=(0,o.useTranslation)(),y=v?.resolvedLanguage??v?.language,b=e=>{let t=Ne(new Date(e).getTime(),u);return{y:t.y,m:t.m,d:t.d}},[x,S]=(0,i.useState)(r),C=n??x,[w,T]=(0,i.useState)(()=>b(l??Date.now())),[E,D]=(0,i.useState)(null),[O,k]=(0,i.useState)(null),[A,j]=(0,i.useState)(``),M=(0,i.useRef)(new Map),N=(0,i.useRef)(!1),ee=(0,i.useId)(),[P]=(0,i.useState)(()=>Q(b(Date.now()))),te=e=>Ae(e,-((Me(e)-d+7)%7)),F=te(C===`month`?{...w,d:1}:w),ne=C===`month`?Math.ceil(($(je({...w,d:1},1))-$(F))/6048e5):1,re=Array.from({length:ne},(e,t)=>Array.from({length:7},(e,n)=>Ae(F,t*7+n))),I=Ae(F,ne*7),L=`${Q(F)}/${Q(I)}`;(0,i.useEffect)(()=>{m?.({start:Pe(F,0,0,0,0,u),end:Pe(I,0,0,0,0,u)})},[L,u]),(0,i.useEffect)(()=>{N.current&&(N.current=!1,M.current.get(Q(w))?.focus())});let ie=new Map;for(let e of t){let t=new Date(e.start).getTime();if(Number.isNaN(t))continue;let n=Q(b(t)),r=ie.get(n)??[];r.push({entry:e,time:t}),ie.set(n,r)}for(let e of ie.values())e.sort((e,t)=>e.time-t.time);let R=e=>new Intl.DateTimeFormat(y,{...e,timeZone:`UTC`}),z=e=>R({dateStyle:`full`}).format($(e)),B=e=>new Intl.DateTimeFormat(y,{timeStyle:`short`,timeZone:u}).format(e),V=C===`month`?R({month:`long`,year:`numeric`}).format($({...w,d:1})):`${R({dateStyle:`medium`}).format($(F))} – ${R({dateStyle:`medium`}).format($(Ae(I,-1)))}`;function H(e){N.current=!0,T(e)}function ae(e){n===void 0&&S(e),c?.(e)}let U=e=>C===`month`?je(w,e):Ae(w,7*e);function W(e,n){let r=t.find(t=>t.id===e);if(!r||!f)return;let i=new Date(r.start).getTime(),a=Ne(i,u);Q(a)!==Q(n)&&f(e,Pe(n,a.h,a.mi,a.s,i%1e3,u)),j(_(`bento.calendar.moved`,{defaultValue:`Moved {{label}} to {{day}}.`,label:r.label,day:z(n)}))}function G(e,n){let r={ArrowLeft:()=>Ae(n,-1),ArrowRight:()=>Ae(n,1),ArrowUp:()=>Ae(n,-7),ArrowDown:()=>Ae(n,7),Home:()=>te(n),End:()=>Ae(te(n),6),PageUp:()=>U(-1),PageDown:()=>U(1)}[e.key];if(r){e.preventDefault(),H(r());return}if(E&&(e.key===`Enter`||e.key===` `))e.preventDefault(),W(E,n),D(null);else if(E&&e.key===`Escape`){e.preventDefault();let n=t.find(e=>e.id===E);D(null),j(_(`bento.calendar.cancelled`,{defaultValue:`Put {{label}} back.`,label:n?.label??``}))}else e.key===`Enter`&&(e.preventDefault(),e.currentTarget.querySelector(`button`)?.focus())}function K(e,t){let n=e.currentTarget.closest(`td`),r=n?[...n.querySelectorAll(`button`)]:[],i=r.indexOf(e.currentTarget),a=f&&(e.key===` `||e.key===`Enter`&&!p);if(e.key===`ArrowDown`||e.key===`ArrowUp`)r[i+(e.key===`ArrowDown`?1:-1)]?.focus();else if(e.key===`Escape`)n?.focus();else if(a)D(t.id),j(_(`bento.calendar.picked`,{defaultValue:`Picked up {{label}}. Choose a day and press Enter.`,label:t.label})),n?.focus();else if(e.key===`Enter`&&p)p(t.id);else return;e.preventDefault(),e.stopPropagation()}function oe(e,t){let n=O??e.dataTransfer.getData(`text/plain`);k(null),n&&(e.preventDefault(),W(n,t))}let se=f?ee:void 0;return(0,a.jsxs)(`div`,{"data-slot":`bento-calendar`,className:e.t(`flex flex-col gap-3`,g),children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,a.jsx)(Le,{label:_(`bento.calendar.previous`,{defaultValue:`Previous`}),onClick:()=>T(U(-1)),children:(0,a.jsx)(s.IconChevronLeft,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(Le,{label:_(`bento.calendar.next`,{defaultValue:`Next`}),onClick:()=>T(U(1)),children:(0,a.jsx)(s.IconChevronRight,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(`button`,{type:`button`,onClick:()=>T(b(Date.now())),className:`inline-flex h-(--vg-control-dense) items-center rounded-md border border-border px-3 text-sm hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring`,children:_(`bento.calendar.today`,{defaultValue:`Today`})}),(0,a.jsx)(`h2`,{className:`m-0 ml-2 text-base font-semibold`,"aria-live":`polite`,children:V})]}),(0,a.jsx)(`div`,{role:`group`,"aria-label":_(`bento.calendar.views`,{defaultValue:`View`}),className:`flex gap-1`,children:[`month`,`week`].map(t=>(0,a.jsx)(`button`,{type:`button`,"aria-pressed":C===t?`true`:`false`,onClick:()=>ae(t),className:e.t(`inline-flex h-(--vg-control-dense) items-center rounded-md border border-border px-3 text-sm focus-visible:outline-2 focus-visible:outline-ring`,C===t?`bg-primary text-primary-foreground`:`hover:bg-muted/50`),children:t===`month`?_(`bento.calendar.month`,{defaultValue:`Month`}):_(`bento.calendar.week`,{defaultValue:`Week`})},t))})]}),(0,a.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:A}),se&&(0,a.jsx)(`span`,{id:se,className:`sr-only`,children:_(`bento.calendar.moveHint`,{defaultValue:`Space picks this up to move it: the arrow keys choose a day, Enter drops it and Escape cancels.`})}),(0,a.jsxs)(`table`,{role:`grid`,"aria-label":h??V,className:`w-full table-fixed border-collapse text-sm`,children:[(0,a.jsx)(`thead`,{children:(0,a.jsx)(`tr`,{children:re[0].map(e=>(0,a.jsx)(`th`,{scope:`col`,abbr:R({weekday:`long`}).format($(e)),className:`pb-1 text-xs font-medium text-muted-foreground`,children:R({weekday:`short`}).format($(e))},Q(e)))})}),(0,a.jsx)(`tbody`,{children:re.map(t=>(0,a.jsx)(`tr`,{children:t.map(t=>{let n=Q(t),r=ie.get(n)??[],i=n===Q(w),o=C===`month`&&t.m!==w.m,s=r.length;return(0,a.jsxs)(`td`,{ref:e=>{e?M.current.set(n,e):M.current.delete(n)},role:`gridcell`,tabIndex:i?0:-1,"aria-label":s>0?`${z(t)}, ${_(`bento.calendar.entries`,{defaultValue:`{{count}} scheduled`,count:s})}`:z(t),"aria-current":n===P?`date`:void 0,"data-day":n,onKeyDown:e=>G(e,t),onFocus:()=>{i||T(t)},onDragOver:e=>{O&&e.preventDefault()},onDrop:e=>oe(e,t),className:e.t(`border border-border/60 p-1 align-top outline-none`,C===`month`?`h-24`:`h-48`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring`,E&&i&&`bg-primary/10`),children:[(0,a.jsx)(`span`,{"aria-hidden":`true`,className:e.t(`mb-1 inline-grid size-6 place-items-center rounded-full text-xs`,n===P&&`bg-primary font-semibold text-primary-foreground`,n!==P&&o&&`text-muted-foreground`),children:t.d}),(0,a.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-0.5 p-0`,children:r.map(({entry:t,time:n})=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,"data-look":`text`,tabIndex:-1,draggable:f?!0:void 0,"aria-describedby":se,"aria-pressed":f?E===t.id?`true`:`false`:void 0,"data-entry":t.id,onKeyDown:e=>K(e,t),onClick:()=>p?.(t.id),onDragStart:e=>{e.dataTransfer.setData(`text/plain`,t.id),e.dataTransfer.effectAllowed=`move`,k(t.id)},onDragEnd:()=>k(null),className:e.t(`flex w-full min-w-0 items-baseline gap-1 rounded-md px-1 py-0.5 text-left text-xs focus-visible:outline-2 focus-visible:outline-ring`,t.tone?Fe[t.tone]:`bg-muted`,E===t.id&&`outline-2 outline-dashed outline-primary`),children:[(0,a.jsx)(`time`,{dateTime:new Date(n).toISOString(),className:`flex-none tabular-nums`,children:B(n)}),(0,a.jsx)(`span`,{className:`truncate`,children:t.label})]})},t.id))})]},n)})},Q(t[0])))})]})]})}function Le({label:e,onClick:t,children:n}){return(0,a.jsx)(`button`,{type:`button`,"aria-label":e,onClick:t,className:`grid size-(--vg-control-dense) place-items-center rounded-md border border-border hover:bg-muted/50 focus-visible:outline-2 focus-visible:outline-ring`,children:n})}var Re={LARGE:`col-span-2 row-span-2 md:col-span-2 md:row-span-2 lg:col-span-2 lg:row-span-2`,MEDIUM:`col-span-2 row-span-1 md:col-span-2 md:row-span-1 lg:col-span-2 lg:row-span-1`,SMALL:`col-span-1 row-span-1`},ze={SMALL:`MEDIUM`,MEDIUM:`LARGE`,LARGE:`SMALL`};function Be(e,t,n){if(!n||n.length===0)return e.map(e=>({item:e,key:t(e),emphasis:`MEDIUM`}));let r=new Map,i=new Map;for(let e of n)r.set(e.itemId,e.displayOrder),i.set(e.itemId,e.emphasis);return e.map((e,n)=>({item:e,key:t(e),idx:n})).sort((e,t)=>{let n=r.has(e.key)?r.get(e.key):2**53-1,i=r.has(t.key)?r.get(t.key):2**53-1;return n===i?e.idx-t.idx:n-i}).map(({item:e,key:t})=>({item:e,key:t,emphasis:i.get(t)??`MEDIUM`}))}function Ve(e){return e.map((e,t)=>({itemId:e.key,emphasis:e.emphasis,displayOrder:t}))}function He({to:e,emphasis:t,featured:n,defaultIcon:r,icon:i,title:s,description:l,meta:d,state:f,enabled:p,hasStatus:m=!1,viewTransitionName:h}){let{t:g}=(0,o.useTranslation)(),_=t??(n?`LARGE`:`MEDIUM`),v=_===`LARGE`,y=_===`SMALL`,b=Re[_],x=p===1,S=v?`p-6 md:p-7`:y?`p-4`:`p-5`,C=v?`h-14 w-14`:y?`h-8 w-8`:`h-9 w-9`,w=v?28:y?16:18,T=v?`text-xl md:text-2xl`:y?`text-sm`:`text-base md:text-lg`;return(0,a.jsxs)(u.Link,{to:e,className:`bento-tile bento-tile-clickable bento-glass group relative flex flex-col ${v?`gap-5`:`gap-4`} overflow-hidden ${S} ${b}`,style:h?{viewTransitionName:h}:void 0,children:[(0,a.jsxs)(`div`,{className:`relative z-1 flex items-center justify-between`,children:[(0,a.jsx)(`span`,{className:`bento-well grid place-items-center rounded-2xl ${C}`,children:i?(0,a.jsx)(c.Icon,{icon:i,className:v?`size-7`:`size-4.5`}):(0,a.jsx)(r,{size:w})}),m&&(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[10px] uppercase tracking-wider ${x?`bento-status bento-status-on`:`border-border bg-muted text-muted-foreground`}`,children:[(0,a.jsx)(`span`,{className:`h-1.5 w-1.5 rounded-full ${x?`bento-status-dot bento-pulse`:`bg-muted-foreground/60`}`}),x?g(`common.active`,{defaultValue:`Active`}):g(`common.idle`,{defaultValue:`Idle`})]})]}),(0,a.jsxs)(`div`,{className:`relative z-1`,children:[(0,a.jsx)(`div`,{className:`font-semibold tracking-tight ${T}`,children:s}),!y&&d&&(0,a.jsx)(`div`,{className:`mt-1 flex flex-wrap items-center gap-1.5 text-xs text-muted-foreground`,children:d}),!y&&l&&(0,a.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:l}),f&&(0,a.jsx)(ne,{state:f,className:`mt-3`})]})]})}var Ue={query:``,facets:{}},We=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Ge=e=>Array.isArray(e)?e:[];function Ke(e,t,n){let r={...e.facets};return n===void 0||Array.isArray(n)&&n.length===0||We(n)&&!n.from&&!n.to?delete r[t]:r[t]=n,{...e,facets:r}}function qe({value:e,onChange:r,facets:c,queryLabel:l,queryDelay:u=300,views:d}){let{t:f}=(0,o.useTranslation)(),[p,m]=(0,i.useState)({source:e.query,text:e.query}),[h,g]=(0,i.useState)(null);p.source!==e.query&&m({source:e.query,text:e.query===h?p.text:e.query}),(0,i.useEffect)(()=>{if(p.text===e.query)return;let t=setTimeout(()=>{g(p.text),r({...e,query:p.text})},u);return()=>clearTimeout(t)},[p.text,e,r,u]);let _=[];for(let t of c){let n=e.facets[t.id];if(t.kind===`choice`)for(let r of Ge(n)){let i=t.options.find(e=>e.value===r);_.push({key:`${t.id}:${r}`,text:`${t.label}: ${i?.label??r}`,remove:()=>Ke(e,t.id,Ge(n).filter(e=>e!==r))})}else We(n)&&(n.from||n.to)&&_.push({key:t.id,text:`${t.label}: ${n.from??`…`} – ${n.to??`…`}`,remove:()=>Ke(e,t.id,void 0)})}let v=_.length>0||e.query!==``,y=l??f(`bento.filters.search`,{defaultValue:`Search`});return(0,a.jsxs)(`div`,{role:`search`,"aria-label":f(`bento.filters.label`,{defaultValue:`Filters`}),"data-slot":`bento-filter-bar`,className:`flex min-w-0 flex-1 flex-col gap-2`,children:[(0,a.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,a.jsxs)(`div`,{className:`relative min-w-48 flex-1`,children:[(0,a.jsx)(s.IconSearch,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground`}),(0,a.jsx)(t.a,{type:`search`,value:p.text,placeholder:y,"aria-label":y,onChange:e=>m({...p,text:e.target.value}),className:`pl-9`})]}),c.map(t=>t.kind===`choice`?(0,a.jsx)(Ye,{facet:t,value:e,onChange:r},t.id):(0,a.jsx)(Xe,{facet:t,value:e,onChange:r},t.id)),d]}),v&&(0,a.jsxs)(`ul`,{className:`m-0 flex list-none flex-wrap items-center gap-1.5 p-0`,"aria-label":f(`bento.filters.active`,{defaultValue:`Active filters`}),children:[_.map(e=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,"aria-label":f(`bento.filters.remove`,{defaultValue:`Remove filter {{filter}}`,filter:e.text}),onClick:()=>r(e.remove()),className:`bento-clear inline-flex items-center gap-1 rounded-full border border-border/60 bg-card/60 py-0.5 pl-2.5 pr-1.5 text-xs`,children:[e.text,(0,a.jsx)(s.IconX,{size:12,"aria-hidden":`true`})]})},e.key)),(0,a.jsx)(`li`,{children:(0,a.jsx)(n.Q,{variant:`ghost`,size:`sm`,className:`h-6 px-2 text-xs`,onClick:()=>{m({source:``,text:``}),r(Ue)},children:f(`bento.filters.clearAll`,{defaultValue:`Clear all`})})})]})]})}function Je({label:e,count:t,...r}){return(0,a.jsxs)(n.Q,{variant:`outline`,size:`sm`,className:`gap-1.5`,...r,children:[e,t>0&&(0,a.jsx)(`span`,{className:`rounded-full bg-primary px-1.5 text-[0.6875rem] leading-4 text-primary-foreground`,children:t}),(0,a.jsx)(s.IconChevronDown,{size:14,"aria-hidden":`true`})]})}function Ye({facet:e,value:t,onChange:r}){let i=Ge(t.facets[e.id]);return(0,a.jsxs)(n.I,{children:[(0,a.jsx)(n.X,{asChild:!0,children:(0,a.jsx)(Je,{label:e.label,count:i.length})}),(0,a.jsx)(n.R,{align:`start`,className:`bento-dropdown min-w-44 p-1.5`,children:e.multiple?e.options.map(o=>(0,a.jsx)(n.L,{checked:i.includes(o.value),onCheckedChange:n=>r(Ke(t,e.id,n===!0?[...i,o.value]:i.filter(e=>e!==o.value))),onSelect:e=>e.preventDefault(),children:o.label},o.value)):(0,a.jsx)(n.U,{value:i[0]??``,onValueChange:n=>r(Ke(t,e.id,n===i[0]?[]:[n])),children:e.options.map(e=>(0,a.jsx)(n.W,{value:e.value,children:e.label},e.value))})})]})}function Xe({facet:e,value:r,onChange:s}){let{t:c}=(0,o.useTranslation)(),l=r.facets[e.id],u=We(l)?l:{},[d,f]=(0,i.useState)(!1),[p,m]=(0,i.useState)(u.from??``),[h,g]=(0,i.useState)(u.to??``),_=(0,i.useId)(),v=(0,i.useId)();return(0,a.jsxs)(n.O,{open:d,onOpenChange:e=>{e&&(m(u.from??``),g(u.to??``)),f(e)},children:[(0,a.jsx)(n.P,{asChild:!0,children:(0,a.jsx)(Je,{label:e.label,count:u.from||u.to?1:0})}),(0,a.jsx)(n.A,{align:`start`,className:`bento-dropdown w-64 p-3`,children:(0,a.jsxs)(`form`,{className:`flex flex-col gap-2`,onSubmit:t=>{t.preventDefault(),s(Ke(r,e.id,{from:p||void 0,to:h||void 0})),f(!1)},children:[(0,a.jsx)(`label`,{htmlFor:_,className:`text-xs text-muted-foreground`,children:c(`bento.filters.from`,{defaultValue:`From`})}),(0,a.jsx)(t.a,{id:_,type:`date`,value:p,max:h||void 0,onChange:e=>m(e.target.value)}),(0,a.jsx)(`label`,{htmlFor:v,className:`text-xs text-muted-foreground`,children:c(`bento.filters.to`,{defaultValue:`To`})}),(0,a.jsx)(t.a,{id:v,type:`date`,value:h,min:p||void 0,onChange:e=>g(e.target.value)}),(0,a.jsx)(n.Q,{type:`submit`,size:`sm`,className:`mt-1`,children:c(`bento.filters.apply`,{defaultValue:`Apply`})})]})})]})}var Ze=O,Qe=`bento-grid grid auto-rows-[minmax(140px,auto)] grid-cols-2 gap-4 md:grid-cols-4 md:gap-5 lg:grid-cols-6`;function $e({items:t,error:c,tryAgainUrl:l,listId:d,eyebrow:f,backTo:p,backLabel:m,trail:h,heroIcon:g,title:_,subtitle:v,toolbar:y,headerAction:b,newRoute:x,newLabel:S,newSubtitle:C,hideNew:w=!1,itemKey:T,columns:E,rowActions:D,onRowOpen:O,getRowLabel:A,columnLayout:j,onColumnLayoutChange:M,renderTile:N,defaultView:P=`list`,view:te,onViewChange:F,emptyTitle:ne,emptyDescription:re,layout:I}){let{t:L}=(0,o.useTranslation)(),[ie,R]=(0,i.useState)(!1),[z,B]=(0,i.useState)(P),V=y??b,H=N!==void 0&&E!==void 0,ae=N?`grid`:`list`;H&&(ae=te??z);let U=H?(0,a.jsxs)(n.l,{type:`single`,size:`sm`,variant:`outline`,value:ae,onValueChange:e=>{(e===`grid`||e===`list`)&&(te===void 0&&B(e),F?.(e))},"aria-label":L(`bento.layout.view`,{defaultValue:`View`}),className:`ml-auto`,children:[(0,a.jsx)(n.u,{value:`grid`,"aria-label":L(`bento.layout.grid`,{defaultValue:`Grid`}),children:(0,a.jsx)(s.IconLayoutGrid,{size:16,"aria-hidden":`true`})}),(0,a.jsx)(n.u,{value:`list`,"aria-label":L(`bento.layout.list`,{defaultValue:`List`}),children:(0,a.jsx)(s.IconList,{size:16,"aria-hidden":`true`})})]}):null,W=V!=null||U!=null?(0,a.jsxs)(a.Fragment,{children:[V,U]}):void 0,G=(0,i.useMemo)(()=>Be(t??[],T,I?.data?.entries),[t,T,I?.data?.entries]),K=g?(0,a.jsx)(`span`,{className:`bento-well grid h-12 w-12 place-items-center rounded-2xl`,children:(0,a.jsx)(g,{size:24})}):void 0;if(ae===`list`||!N)return(0,a.jsxs)(r.t,{checkIsNotUndefined:t,error:c??null,tryAgainUrl:l,children:[(0,a.jsx)(ee,{eyebrow:f,backTo:p,backLabel:m,trail:h,leading:K,title:_,subtitle:v,trailing:w?void 0:(0,a.jsx)(n.Q,{asChild:!0,className:`gap-2`,children:(0,a.jsxs)(u.Link,{to:x,children:[(0,a.jsx)(s.IconPlus,{size:16}),S]})})}),t?.length===0?(0,a.jsxs)(a.Fragment,{children:[W!=null&&(0,a.jsx)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:W}),(0,a.jsx)(k,{icon:s.IconSparkles,title:ne,description:re})]}):(0,a.jsx)(Ze,{rows:t??[],getRowId:T,columns:E??[],label:_,getRowLabel:A,rowActions:D,onRowOpen:O,layout:j,onLayoutChange:M,toolbar:W})]});let oe=!!d&&!!I&&(t?.length??0)>0;return(0,a.jsxs)(r.t,{checkIsNotUndefined:t,error:c??null,tryAgainUrl:l,children:[(0,a.jsx)(ee,{eyebrow:f,backTo:p,backLabel:m,trail:h,leading:K,title:_,subtitle:v}),(W!=null||oe&&!ie)&&(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,children:[W,oe&&!ie&&(0,a.jsxs)(n.Q,{variant:`outline`,size:`sm`,onClick:()=>R(!0),className:e.t(`gap-2`,U==null&&`ml-auto`),children:[(0,a.jsx)(s.IconAdjustmentsHorizontal,{size:16}),L(`bento.layout.customize`,{defaultValue:`Customize layout`})]})]}),ie&&d&&I?(0,a.jsx)(nt,{layout:I,resolved:G,canEditGlobal:I?.data?.canEditGlobal??!1,isCustomized:I?.data?.source===`USER`,renderTile:N,hideNew:w,newRoute:x,newLabel:S,newSubtitle:C,onClose:()=>R(!1)}):(0,a.jsx)(tt,{resolved:G,renderTile:N,hideNew:w,newRoute:x,newLabel:S,newSubtitle:C,isEmpty:t?.length===0,emptyTitle:ne,emptyDescription:re})]})}function et({items:e,error:t,tryAgainUrl:n,newRoute:i,newLabel:o,newSubtitle:s,hideNew:c=!1,itemKey:l,renderTile:u,emptyTitle:d,emptyDescription:f}){return(0,a.jsx)(r.t,{checkIsNotUndefined:e,error:t??null,tryAgainUrl:n,children:(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:Qe,children:[!c&&i&&o?(0,a.jsx)(ot,{route:i,label:o,subtitle:s}):null,(e??[]).map(e=>(0,a.jsx)(`span`,{className:`contents`,children:u(e)},l(e))),e?.length===0&&(0,a.jsx)(st,{title:d,description:f})]})})}function tt({resolved:t,renderTile:n,hideNew:r,newRoute:i,newLabel:o,newSubtitle:s,isEmpty:c,emptyTitle:l,emptyDescription:u}){let d=t.some(e=>e.emphasis===`SMALL`);return(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:e.t(Qe,d&&`grid-flow-dense`),children:[!r&&(0,a.jsx)(ot,{route:i,label:o,subtitle:s}),t.map(({item:e,key:t,emphasis:r})=>(0,a.jsx)(`span`,{className:`contents`,children:n(e,r)},t)),c&&(0,a.jsx)(st,{title:l,description:u})]})}function nt({layout:t,resolved:r,canEditGlobal:c,isCustomized:l,renderTile:u,hideNew:d,newRoute:m,newLabel:h,newSubtitle:g,onClose:_}){let{t:v}=(0,o.useTranslation)(),[y,b]=(0,i.useState)(r),[x,S]=(0,i.useState)(null),C=(t.saving??!1)||x!==null,w=e=>C&&x===e?{loading:!0}:{"aria-disabled":C||void 0},[T,E]=(0,i.useState)(!1),D=(e,t)=>async()=>{if(t){S(e),E(!1);try{await t(),_()}catch(e){console.error(`Failed to save the bento layout`,e),E(!0)}finally{S(null)}}},O=(0,f.useSensors)((0,f.useSensor)(f.PointerSensor,{activationConstraint:{distance:8}}),(0,f.useSensor)(f.KeyboardSensor));function k(e){let{active:t,over:n}=e;n&&t.id!==n.id&&b(e=>{let r=e.findIndex(e=>e.key===t.id),i=e.findIndex(e=>e.key===n.id);return r<0||i<0?e:(0,p.arrayMove)(e,r,i)})}function A(e,t){b(n=>n.map(n=>n.key===e?{...n,emphasis:t}:n))}let j=(0,i.useMemo)(()=>Ve(y),[y]),M=y.some(e=>e.emphasis===`SMALL`);return(0,a.jsxs)(`div`,{children:[(0,a.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2 rounded-2xl border border-border/60 bg-card/40 p-3 backdrop-blur-md`,children:[(0,a.jsx)(`span`,{className:`mr-auto text-sm text-muted-foreground`,children:v(`bento.layout.editHint`,{defaultValue:`Drag tiles to reorder · tap the size button to resize`})}),l&&t.onReset&&(0,a.jsxs)(n.Q,{variant:`ghost`,size:`sm`,className:`gap-2`,...w(`reset`),onClick:D(`reset`,t.onReset),children:[x!==`reset`&&(0,a.jsx)(s.IconArrowBackUp,{size:16}),v(`bento.layout.reset`,{defaultValue:`Reset to default`})]}),c&&t.onSaveGlobal&&(0,a.jsxs)(n.Q,{variant:`outline`,size:`sm`,className:`gap-2`,...w(`global`),onClick:D(`global`,()=>t.onSaveGlobal?.(j)),children:[x!==`global`&&(0,a.jsx)(s.IconUsers,{size:16}),v(`bento.layout.saveGlobal`,{defaultValue:`Set as default for everyone`})]}),(0,a.jsxs)(n.Q,{variant:`ghost`,size:`sm`,className:`gap-2`,...w(`cancel`),onClick:_,children:[(0,a.jsx)(s.IconX,{size:16}),v(`common.cancel`,{defaultValue:`Cancel`})]}),(0,a.jsxs)(n.Q,{size:`sm`,className:`gap-2`,...w(`save`),onClick:D(`save`,()=>t.onSave(j)),children:[x!==`save`&&(0,a.jsx)(s.IconDeviceFloppy,{size:16}),v(`bento.layout.save`,{defaultValue:`Save layout`})]}),T&&(0,a.jsx)(`p`,{role:`alert`,className:`w-full text-sm text-destructive`,children:v(`bento.layout.saveFailed`,{defaultValue:`The layout could not be saved. Nothing has changed — try again.`})})]}),(0,a.jsx)(f.DndContext,{sensors:O,collisionDetection:f.closestCenter,onDragEnd:k,children:(0,a.jsx)(p.SortableContext,{items:y.map(e=>e.key),strategy:p.rectSortingStrategy,children:(0,a.jsxs)(`div`,{"data-slot":`bento-list-tiles`,className:e.t(Qe,M&&`grid-flow-dense`),children:[!d&&(0,a.jsx)(ot,{route:m,label:h,subtitle:g}),y.map(({item:e,key:t,emphasis:n})=>(0,a.jsx)(at,{id:t,emphasis:n,onSetEmphasis:e=>A(t,e),children:u(e,n)},t))]})})})]})}var rt=[`SMALL`,`MEDIUM`,`LARGE`],it={SMALL:{key:`bento.layout.size.small`,def:`Small`},MEDIUM:{key:`bento.layout.size.medium`,def:`Medium`},LARGE:{key:`bento.layout.size.large`,def:`Large`}};function at({id:t,emphasis:n,onSetEmphasis:r,children:i}){let{t:c}=(0,o.useTranslation)(),{attributes:l,listeners:u,setNodeRef:d,transform:f,transition:h,isDragging:g}=(0,p.useSortable)({id:t}),_={transform:m.CSS.Translate.toString(f),transition:h,opacity:g?.6:1,zIndex:g?50:void 0};return(0,a.jsxs)(`div`,{ref:d,style:_,className:e.t(`relative h-full`,Re[n]),children:[(0,a.jsx)(`div`,{className:`pointer-events-none h-full select-none [&>*]:h-full [&>*]:w-full`,children:i}),(0,a.jsxs)(`div`,{className:`absolute right-2 top-2 z-10 flex items-center gap-1`,children:[(0,a.jsx)(`div`,{role:`group`,"aria-label":c(`bento.layout.sizeGroup`,{defaultValue:`Tile size`}),className:`flex items-center gap-0.5 rounded-full border border-border/60 bg-background/80 p-0.5 shadow-sm backdrop-blur`,children:rt.map(t=>{let i=t===n,o=c(it[t].key,{defaultValue:it[t].def});return(0,a.jsx)(`button`,{type:`button`,onClick:()=>r(t),"aria-pressed":i,"aria-label":o,title:o,className:e.t(`grid h-6 w-6 place-items-center rounded-full text-[11px] font-semibold uppercase transition-colors`,i?`bg-primary text-primary-foreground shadow`:`text-muted-foreground hover:bg-muted`),children:o.charAt(0)},t)})}),(0,a.jsx)(`button`,{type:`button`,...l,...u,"aria-label":c(`bento.layout.dragToReorder`,{defaultValue:`Drag to reorder`}),className:`grid size-(--vg-control-dense) cursor-grab place-items-center rounded-full border border-border/60 bg-background/80 shadow-sm backdrop-blur hover:bg-background active:cursor-grabbing`,children:(0,a.jsx)(s.IconGripVertical,{size:14,className:`text-muted-foreground`})})]})]})}function ot({route:e,label:t,subtitle:n}){let{t:r}=(0,o.useTranslation)();return(0,a.jsxs)(u.Link,{to:e,className:`bento-tile bento-tile-clickable col-span-2 row-span-1 flex flex-col gap-3 rounded-3xl border-2 border-dashed border-border/60 bg-card/30 p-5 backdrop-blur-md bento-new-tile hover:bg-card/50 md:col-span-2 md:row-span-1 lg:col-span-2 lg:row-span-1`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`bento-well grid h-10 w-10 place-items-center rounded-2xl`,children:(0,a.jsx)(s.IconPlus,{size:20})}),(0,a.jsx)(`span`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:r(`forms.formActions.new`,{defaultValue:`New`})})]}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`div`,{className:`text-base font-semibold tracking-tight md:text-lg`,children:t}),n&&(0,a.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:n})]})]})}function st({title:e,description:t}){return(0,a.jsx)(k,{icon:s.IconSparkles,title:e,description:t,align:`start`,className:`col-span-2 row-span-2 justify-end md:col-span-4`})}function ct({title:e,badges:n,actions:r,onCancel:i,loading:c,disabled:l,dirty:u,titleMissing:d}){let{t:f}=(0,o.useTranslation)();return(0,a.jsxs)(`div`,{className:`bento-frost flex items-center justify-between gap-4 rounded-2xl px-4 py-3 shadow-md backdrop-blur-xl`,children:[(0,a.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[e&&(0,a.jsx)(`p`,{className:`truncate text-base font-semibold tracking-tight md:text-lg`,children:e}),(0,a.jsx)(ne,{titleMissing:d,dirty:u}),n&&(0,a.jsx)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:n})]}),(0,a.jsx)(`div`,{className:`flex shrink-0 gap-2`,children:r??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:c,"aria-disabled":l?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),f(`forms.formActions.saveChanges`)]}),i&&(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:i,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),f(`forms.formActions.cancel`)]})]})})]})}function lt({children:e}){return(0,a.jsx)(`span`,{className:`rounded-full border border-border/60 bg-card/50 px-2 py-0.5 text-[10px] uppercase tracking-wider text-muted-foreground backdrop-blur`,children:e})}ct.Badge=lt;function ut(e){let t=(0,i.useRef)(null);return re(t),(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{ref:t,"aria-hidden":!0,className:`h-px`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`bento-save-bar-spacer`}),(0,a.jsx)(`div`,{className:`bento-fade-in fixed inset-x-0 top-20 z-20 mx-auto w-full max-w-7xl px-4 md:px-8`,children:(0,a.jsx)(ct,{...e})})]})}function dt({eyebrow:e,backTo:n,backLabel:r,trail:i,leading:c,title:l,subtitle:u,trailing:d,onCancel:f,actions:p,loading:m,dirty:h,titleMissing:g,saveDisabled:_,stickyTitle:v,stickyBadges:y}){let{t:b}=(0,o.useTranslation)(),x=_??(!!g||!h),S=N(i,n,r)??e;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ee,{eyebrow:S,leading:c,title:l,subtitle:u,trailing:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{className:`bento-fade-out flex shrink-0 items-center gap-2`,children:p??(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)(t.o,{type:`submit`,size:`sm`,loading:m,"aria-disabled":x?`true`:void 0,children:[(0,a.jsx)(s.IconDeviceFloppy,{className:`size-4`}),b(`forms.formActions.saveChanges`)]}),(0,a.jsxs)(t.o,{type:`button`,variant:`outline`,size:`sm`,onClick:f,children:[(0,a.jsx)(s.IconX,{className:`size-4`}),b(`forms.formActions.cancel`)]})]})}),d]})}),(0,a.jsx)(ut,{title:v,badges:y,actions:p,onCancel:f,loading:m,disabled:x,dirty:h,titleMissing:g})]})}var ft=`bento-tile bento-glass relative flex flex-col gap-5 overflow-hidden rounded-3xl p-5 md:p-6`;function pt({icon:t,title:n,description:r,children:i,trailing:o,as:s=`h2`,className:c}){return(0,a.jsxs)(`section`,{className:e.t(ft,c),children:[(0,a.jsxs)(`header`,{className:`flex items-start justify-between gap-3`,children:[(0,a.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,a.jsx)(`span`,{className:`bento-well grid h-10 w-10 place-items-center rounded-2xl`,children:(0,a.jsx)(t,{size:20})}),(0,a.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,a.jsx)(s,{className:`text-base font-semibold tracking-tight md:text-lg`,children:n}),r&&(0,a.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:r})]})]}),o&&(0,a.jsx)(`div`,{className:`shrink-0`,children:o})]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-5`,children:i})]})}function mt({children:t,className:n,contentClassName:r}){return(0,a.jsx)(`div`,{className:e.t(`bento-glass rounded-2xl shadow-md`,n),children:(0,a.jsx)(`div`,{className:r,children:t})})}var ht=480;function gt(e){return window.addEventListener(`scroll`,e,{passive:!0}),()=>window.removeEventListener(`scroll`,e)}function _t(){return window.scrollY>ht}function vt({inline:e=!1}={}){let{t}=(0,o.useTranslation)(),r=n.o(),c=e||r,l=(0,i.useSyncExternalStore)(gt,_t,()=>!1);return(0,a.jsx)(`button`,{type:`button`,"aria-label":t(`bento.backToTop`,{defaultValue:`Back to top`}),tabIndex:l?0:-1,onClick:()=>window.scrollTo({top:0,behavior:`smooth`}),className:`${c?`relative`:`fixed bottom-6 right-6 z-40`} grid h-11 w-11 place-items-center rounded-full border border-border/60 bg-card/80 text-foreground shadow-lg backdrop-blur-xl transition-all duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] hover:-translate-y-0.5 hover:shadow-xl active:scale-95 ${l?`pointer-events-auto translate-y-0 scale-100 opacity-100`:`pointer-events-none translate-y-4 scale-90 opacity-0`}`,children:(0,a.jsx)(s.IconArrowUp,{size:18})})}function yt(e){return e.bentoRoute??e.fallbackRoute}function bt({label:e,children:t}){return e?(0,a.jsxs)(`div`,{role:`group`,"aria-label":e,children:[(0,a.jsx)(`p`,{className:`px-3 pt-2 pb-1 text-xs font-medium text-muted-foreground`,children:e}),t]}):(0,a.jsx)(a.Fragment,{children:t})}function xt({index:e,active:t,icon:n,label:r,description:i,trailing:o,onActivate:c,onChoose:l}){return(0,a.jsxs)(`button`,{type:`button`,id:`bento-palette-opt-${e}`,"data-index":e,role:`option`,"aria-selected":t?`true`:`false`,onMouseEnter:c,onClick:l,className:`flex w-full items-center gap-3 rounded-xl px-3 py-2.5 text-left text-sm transition-colors ${t?`bg-accent text-accent-foreground`:`text-foreground`}`,children:[n&&(0,a.jsx)(n,{size:18,className:`shrink-0 text-muted-foreground`}),(0,a.jsxs)(`span`,{className:`flex-1 truncate`,children:[r,i&&(0,a.jsx)(`span`,{className:`ml-2 text-muted-foreground`,children:i})]}),o??(t&&(0,a.jsx)(s.IconArrowRight,{"aria-hidden":!0,size:15,className:`shrink-0 text-muted-foreground`}))]})}function St({open:e,onOpenChange:n,items:r,group:c,onQueryChange:l}){let{t:d}=(0,o.useTranslation)(),f=(0,u.useNavigate)(),[p,m]=(0,i.useState)(``),[h,g]=(0,i.useState)(0),_=(0,i.useRef)(null),v=(0,i.useMemo)(()=>{let e=p.trim().toLowerCase(),t=r.map(e=>({item:e,label:d(e.titleKey),description:d(e.descriptionKey)}));if(!e)return t;let n=[],i=[];for(let r of t)r.label.toLowerCase().includes(e)?n.push(r):r.description.toLowerCase().includes(e)&&i.push(r);return[...n,...i]},[r,p,d]),y=(0,i.useMemo)(()=>[...v.map(e=>({kind:`nav`,entry:e})),...(c?.items??[]).map(e=>({kind:`supplied`,item:e}))],[v,c]),b=(0,i.useRef)(l);(0,i.useEffect)(()=>{b.current=l}),(0,i.useEffect)(()=>{b.current?.(p)},[p]);let[x,S]=(0,i.useState)(e);e!==x&&(S(e),e&&(m(``),g(0)));let C=y.length===0?0:y.length-1;h>C&&g(C),(0,i.useEffect)(()=>{(_.current?.querySelector(`[data-index="${h}"]`))?.scrollIntoView({block:`nearest`})},[h]);function w(e){n(!1),e.kind===`nav`?f(yt(e.entry.item)):c?.onSelect(e.item)}function T(e){if(e.key===`ArrowDown`)e.preventDefault(),g(e=>y.length===0?0:(e+1)%y.length);else if(e.key===`ArrowUp`)e.preventDefault(),g(e=>y.length===0?0:(e-1+y.length)%y.length);else if(e.key===`Enter`){e.preventDefault();let t=y[h];t&&w(t)}}return(0,a.jsx)(t.c,{open:e,onOpenChange:n,children:(0,a.jsxs)(t.u,{showCloseButton:!1,className:`top-[15%] max-w-xl translate-y-0 gap-0 overflow-hidden p-0`,onKeyDown:T,children:[(0,a.jsx)(t.g,{className:`sr-only`,children:d(`bento.palette.title`,{defaultValue:`Command palette`})}),(0,a.jsx)(t.d,{className:`sr-only`,children:d(`bento.palette.description`,{defaultValue:`Search and jump to any area`})}),(0,a.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-border/60 px-4`,children:[(0,a.jsx)(s.IconSearch,{size:18,className:`shrink-0 text-muted-foreground`}),(0,a.jsx)(`input`,{autoFocus:!0,type:`text`,role:`combobox`,"aria-expanded":`true`,"aria-controls":`bento-palette-list`,"aria-activedescendant":y[h]?`bento-palette-opt-${h}`:void 0,value:p,onChange:e=>m(e.target.value),placeholder:d(`bento.palette.placeholder`,{defaultValue:`Search areas…`}),className:`h-12 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground`})]}),(0,a.jsxs)(`div`,{ref:_,id:`bento-palette-list`,role:`listbox`,"aria-label":d(`bento.palette.title`,{defaultValue:`Command palette`}),className:`max-h-80 overflow-y-auto p-2`,children:[y.length===0&&!c?.pending&&(0,a.jsx)(`p`,{className:`px-3 py-6 text-center text-sm text-muted-foreground`,children:d(`bento.palette.noResults`,{defaultValue:`No matches`})}),(0,a.jsx)(bt,{label:c&&v.length>0?d(`bento.palette.areas`,{defaultValue:`Areas`}):void 0,children:v.map(({item:e,label:t},n)=>(0,a.jsx)(xt,{index:n,active:n===h,icon:e.icon,label:t,onActivate:()=>g(n),onChoose:()=>w(y[n]),trailing:e.bentoRoute?void 0:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.IconExternalLink,{"aria-hidden":!0,size:15,className:`shrink-0 text-muted-foreground/70`}),(0,a.jsx)(`span`,{className:`sr-only`,children:d(`bento.palette.opensConsole`,{defaultValue:`Opens in console`})})]})},e.id))}),c&&(0,a.jsxs)(bt,{label:c.label,children:[c.items.map((e,t)=>{let n=v.length+t;return(0,a.jsx)(xt,{index:n,active:n===h,icon:e.icon,label:e.label,description:e.description,onActivate:()=>g(n),onChoose:()=>w(y[n])},e.id)}),c.pending&&(0,a.jsx)(`p`,{className:`px-3 py-2.5 text-sm text-muted-foreground`,children:d(`bento.palette.searching`,{defaultValue:`Searching…`})})]})]})]})})}function Ct({rail:t,headerStart:r,headerEnd:s,column:c=`default`,dock:l,backToTop:d=!0,children:f}){let{t:p}=(0,o.useTranslation)(),m=(0,u.useInRouterContext)(),h=(0,i.useId)(),g=(0,i.useRef)(null),_=(0,i.useRef)(null),v=c===`full`,y=r!=null||s!=null,b=n.v(),x=null;l!=null&&(x=b?y?`header`:`corner`:t==null?`corner`:`rail`);let S=d||x===`corner`,C=(0,i.useRef)(null),w=(0,i.useRef)(null);(0,i.useEffect)(()=>{let e=C.current,t=w.current;if(!e||!t||v||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(()=>e.style.setProperty(`--bento-shell-header`,`${t.offsetHeight}px`));return n.observe(t),()=>{n.disconnect(),e.style.removeProperty(`--bento-shell-header`)}},[v,y]);let T=e=>(0,a.jsx)(n.r.Provider,{value:!0,children:(0,a.jsx)(n.i.Provider,{value:e,children:l})});return(0,a.jsxs)(`div`,{ref:C,"data-slot":`bento-shell`,className:e.t(`relative w-full bg-background text-foreground`,t!=null&&`bento-rail-gutter`,v?`flex h-svh flex-col overflow-hidden`:`min-h-svh`),style:x===`rail`?{"--bento-rail-foot":`4.5rem`}:void 0,children:[(0,a.jsx)(`a`,{href:`#${h}`,onClick:e=>{e.preventDefault(),g.current?.focus()},className:`sr-only rounded-full border border-border/60 bg-card px-4 py-2 text-sm shadow-lg focus:not-sr-only focus:fixed focus:left-4 focus:top-4 focus:z-[60]`,children:p(`bento.shell.skip`,{defaultValue:`Skip to content`})}),(0,a.jsx)(`span`,{ref:_,role:`status`,"aria-live":`polite`,className:`sr-only`}),m&&(0,a.jsx)(wt,{main:g,announcer:_}),t,x===`rail`&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-dock`,className:`pointer-events-none fixed bottom-4 left-[18px] z-50 flex flex-col items-start`,children:T(`rail`)}),y&&(0,a.jsxs)(`header`,{ref:w,className:`bento-shell-header bento-shell-bar sticky top-0 z-30 flex shrink-0 items-center justify-between gap-3 border-b border-border/40 bg-background/55 py-3 backdrop-blur-xl backdrop-saturate-150`,children:[(0,a.jsx)(`div`,{className:`flex min-w-0 items-center gap-3`,children:r}),(0,a.jsxs)(`div`,{className:`flex items-center gap-2`,children:[s,x===`header`&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-dock`,className:`relative flex`,children:T(`header`)})]})]}),(0,a.jsx)(`main`,{ref:g,id:h,tabIndex:-1,"aria-label":p(`bento.shell.main`,{defaultValue:`Main content`}),"data-column":c,className:`bento-shell-main`,children:f}),S&&(0,a.jsx)(`div`,{"data-slot":`bento-shell-corner`,className:`pointer-events-none fixed bottom-5 right-5 z-50 flex flex-col items-end gap-3`,children:(0,a.jsxs)(n.r.Provider,{value:!0,children:[d&&(0,a.jsx)(vt,{}),x===`corner`&&T(`corner`)]})})]})}function wt({main:e,announcer:t}){let{pathname:n}=(0,u.useLocation)(),r=(0,i.useRef)(n);return(0,i.useEffect)(()=>{if(r.current===n)return;r.current=n;let i=0,a,o=()=>{let n=e.current?.querySelector(`h1`)??null;if(!n&&i++<20){a=setTimeout(o,50);return}n&&!n.hasAttribute(`tabindex`)&&n.setAttribute(`tabindex`,`-1`),(n??e.current)?.focus(),t.current&&(t.current.textContent=n?.textContent?.trim()||document.title)};return o(),()=>clearTimeout(a)},[n,e,t]),null}var Tt=Object.freeze([{action:`palette`,key:`k`,mod:!0},{action:`palette`,key:`/`},{action:`shortcuts`,key:`?`}]);function Et(){return typeof navigator>`u`?!1:/Mac|iPhone|iPad|iPod/.test(navigator.platform||navigator.userAgent||``)}function Dt(e,t){let n=e.key.length===1?e.key.toUpperCase():e.key;return e.mod?[t?`⌘`:`Ctrl`,n]:[n]}function Ot(e){if(!(e instanceof HTMLElement))return!1;if([`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName)||e.isContentEditable)return!0;let t=e.closest(`[contenteditable]`);return t!==null&&t.getAttribute(`contenteditable`)!==`false`}function kt(e,t){if(e.defaultPrevented||e.isComposing||e.repeat)return;let n=e.key.toLowerCase();return Tt.find(r=>n===r.key?r.mod?(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.altKey&&!e.shiftKey:e.metaKey||Ot(e.target)?!1:e.ctrlKey===e.altKey:!1)}function At({onPalette:e,onShortcuts:t,isMac:n=Et()}){let r=(0,i.useRef)({onPalette:e,onShortcuts:t});(0,i.useEffect)(()=>{r.current={onPalette:e,onShortcuts:t}}),(0,i.useEffect)(()=>{function e(e){let t=kt(e,n),i=t?.action===`palette`?r.current.onPalette:t&&r.current.onShortcuts;i&&(e.preventDefault(),i())}return globalThis.addEventListener(`keydown`,e),()=>globalThis.removeEventListener(`keydown`,e)},[n])}function jt({onClick:t,isMac:n=Et(),className:r}){let{t:i}=(0,o.useTranslation)(),c=Tt.filter(e=>e.action===`palette`),l=c.find(e=>e.mod);return(0,a.jsxs)(`button`,{type:`button`,onClick:t,"aria-keyshortcuts":c.map(e=>e.mod?`${n?`Meta`:`Control`}+${e.key.toUpperCase()}`:e.key).join(` `),className:e.t(`bento-tile bento-tile-clickable inline-flex items-center gap-2 rounded-full border border-border/60 bg-card/60 py-1.5 pl-3 pr-2 text-sm text-muted-foreground backdrop-blur hover:text-foreground`,r),children:[(0,a.jsx)(s.IconSearch,{"aria-hidden":!0,size:16}),(0,a.jsx)(`span`,{className:`sr-only sm:not-sr-only`,children:i(`bento.palette.search`,{defaultValue:`Search`})}),l&&(0,a.jsx)(`kbd`,{"aria-hidden":!0,className:`hidden rounded-sm border border-border/60 bg-muted px-1.5 py-0.5 text-[10px] font-medium tracking-wide sm:inline`,children:Dt(l,n).join(n?``:` `)})]})}function Mt({open:e,onOpenChange:n,isMac:r=Et()}){let{t:c}=(0,o.useTranslation)(),l={palette:c(`bento.palette.open`,{defaultValue:`Open command palette`}),shortcuts:c(`bento.shortcuts.openGuide`,{defaultValue:`Show keyboard shortcuts`})},u=[...new Set(Tt.map(e=>e.action))],d=[{heading:c(`bento.shortcuts.global`,{defaultValue:`Global`}),rows:u.map(e=>({id:e,label:l[e],combos:Tt.filter(t=>t.action===e).map(e=>Dt(e,r))}))},{heading:c(`bento.shortcuts.palette`,{defaultValue:`Command palette`}),rows:[{id:`navigate`,combos:[[`↑`,`↓`]],label:c(`bento.shortcuts.navigate`,{defaultValue:`Move between results`})},{id:`open`,combos:[[`↵`]],label:c(`bento.shortcuts.openSelected`,{defaultValue:`Open the selected area`})},{id:`dismiss`,combos:[[`Esc`]],label:c(`bento.shortcuts.dismiss`,{defaultValue:`Close the palette or a dialog`})}]}];return(0,a.jsx)(t.c,{open:e,onOpenChange:n,children:(0,a.jsxs)(t.u,{className:`max-w-md`,children:[(0,a.jsxs)(t.p,{children:[(0,a.jsxs)(t.g,{className:`flex items-center gap-2`,children:[(0,a.jsx)(s.IconKeyboard,{size:20,className:`bento-accent-icon`}),c(`bento.shortcuts.title`,{defaultValue:`Keyboard shortcuts`})]}),(0,a.jsx)(t.d,{children:c(`bento.shortcuts.description`,{defaultValue:`Move around without leaving the keyboard.`})})]}),(0,a.jsx)(`div`,{className:`flex flex-col gap-5`,children:d.map(e=>(0,a.jsxs)(`section`,{children:[(0,a.jsx)(`h3`,{className:`mb-2 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground`,children:e.heading}),(0,a.jsx)(`ul`,{className:`flex flex-col gap-1.5`,children:e.rows.map(e=>(0,a.jsxs)(`li`,{"data-shortcut":e.id,className:`flex items-center justify-between gap-4`,children:[(0,a.jsx)(`span`,{className:`text-sm text-foreground`,children:e.label}),(0,a.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:e.combos.map((e,t)=>(0,a.jsxs)(i.Fragment,{children:[t>0&&(0,a.jsx)(`span`,{className:`px-0.5 text-[11px] text-muted-foreground`,children:c(`bento.shortcuts.or`,{defaultValue:`or`})}),e.map(e=>(0,a.jsx)(`kbd`,{className:`inline-flex min-w-6 items-center justify-center rounded-md border border-border/60 bg-muted px-1.5 py-0.5 text-[11px] font-medium tracking-wide`,children:e},e))]},e.join(`+`)))})]},e.id))})]},e.heading))})]})})}var Nt=s.IconLayoutGrid;function Pt(e,t){return e===t||e.startsWith(`${t}/`)}function Ft(e,t){return t.section.areaRoute&&Pt(e,t.section.areaRoute)?!0:t.items.some(t=>t.bentoRoute&&Pt(e,t.bentoRoute))}function It(e){return e.items.reduce((e,t)=>e+(t.count&&t.count>0?t.count:0),0)}function Lt({groups:e,homeRoute:t,homeAliases:r,homeLabel:c}){let{t:l}=(0,o.useTranslation)(),{pathname:d}=(0,u.useLocation)(),f=(0,i.useMemo)(()=>e.filter(e=>!!e.section.areaRoute),[e]),p=d===t||(r?.includes(d)??!1);return(0,a.jsx)(n.x,{delayDuration:200,children:(0,a.jsxs)(`nav`,{"aria-label":l(`bento.nav.label`,{defaultValue:`Primary`}),className:`fixed inset-y-0 left-0 z-40 hidden w-20 flex-col items-center gap-1 overflow-y-auto overflow-x-hidden border-r border-border/40 bg-background/55 pt-20 pb-[calc(1rem+var(--bento-rail-foot,0px))] backdrop-blur-xl backdrop-saturate-150 md:flex`,children:[(0,a.jsx)(Rt,{to:t,icon:s.IconHome,label:c??l(`home.title`,{defaultValue:`Home`}),shown:!0,active:p}),f.length>0&&(0,a.jsx)(`span`,{"aria-hidden":!0,className:`my-1 h-px w-6 bg-border/60`}),f.map(e=>(0,a.jsx)(Rt,{to:e.section.areaRoute,icon:e.section.icon??Nt,label:e.section.labelKey?l(e.section.labelKey):e.section.id,shown:!!e.section.labelKey,count:It(e),active:Ft(d,e)},e.section.id))]})})}function Rt({to:e,icon:t,label:r,shown:i,count:s=0,active:c}){let{t:l}=(0,o.useTranslation)(),d=s>0?l(`bento.nav.count`,{count:s,defaultValue:`{{count}} waiting`}):null,f=(0,a.jsxs)(u.Link,{to:e,"aria-label":d?`${r}, ${d}`:r,"aria-current":c?`page`:void 0,className:`group flex w-full shrink-0 flex-col items-center gap-1 px-1 py-0.5 ${c?`text-primary`:`text-muted-foreground hover:text-foreground`}`,children:[(0,a.jsxs)(`span`,{className:`bento-tile-clickable relative grid h-11 w-11 place-items-center rounded-2xl border transition-colors duration-200 ${c?`bento-rail-active`:`border-transparent group-hover:border-border/60 group-hover:bg-card/60`}`,children:[(0,a.jsx)(t,{size:20}),s>0&&(0,a.jsx)(`span`,{"aria-hidden":!0,"data-slot":`bento-rail-count`,className:`absolute -right-1 -top-1 min-w-4 rounded-full bg-primary px-1 text-center text-[0.6875rem] leading-4 text-primary-foreground`,children:s>99?`99+`:s})]}),i&&(0,a.jsx)(`span`,{"aria-hidden":!0,title:r,className:`w-full truncate text-center text-[0.6875rem] leading-4`,children:r})]});return i?f:(0,a.jsxs)(n.y,{children:[(0,a.jsx)(n.S,{asChild:!0,children:f}),(0,a.jsx)(n.b,{side:`right`,children:r})]})}function zt({accountRoute:e,logoutUrl:t,organizationsRoute:r,tenantAdminRoute:i,onOpenShortcuts:c,onReplayTour:l}){let{user:d,status:f}=n.n(),{t:p}=(0,o.useTranslation)(),m=(0,u.useNavigate)(),h=`${d.firstName??``} ${d.lastName??``}`.trim()||d.username||``;return f===`loading`?(0,a.jsx)(`div`,{className:`h-9 w-9 rounded-full bg-muted/40`,"aria-hidden":!0}):(0,a.jsxs)(n.I,{children:[(0,a.jsx)(n.X,{asChild:!0,children:(0,a.jsx)(`button`,{type:`button`,title:h||d.username,className:`bento-tile-clickable cursor-pointer rounded-full p-0.5 ring-1 ring-border/60 outline-none transition-shadow duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] bento-ring hover:ring-2 focus-visible:ring-2 focus-visible:ring-ring`,children:(0,a.jsx)(n.s,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})})}),(0,a.jsxs)(n.R,{align:`end`,sideOffset:10,className:`bento-dropdown min-w-64 p-2`,children:[(0,a.jsx)(n.V,{className:`p-0 font-normal`,children:(0,a.jsxs)(`div`,{className:`flex items-center gap-3 rounded-xl px-2 py-2 text-left text-sm`,children:[(0,a.jsx)(`span`,{className:`rounded-full p-0.5 ring-1 ring-border/60`,children:(0,a.jsx)(n.s,{givenName:d.firstName,familyName:d.lastName,name:h||d.username,src:d.avatarUrl||void 0,alt:d.username})}),(0,a.jsxs)(`div`,{className:`grid flex-1 text-left text-sm leading-tight`,children:[h&&(0,a.jsx)(`span`,{className:`truncate font-medium`,children:h}),d.email&&(0,a.jsx)(`span`,{className:`truncate text-xs text-muted-foreground`,children:d.email})]})]})}),(0,a.jsx)(n.G,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.z,{children:[(0,a.jsxs)(n.B,{onSelect:()=>m(e),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconUserCircle,{size:18}),p(`nav.account`)]}),r&&(0,a.jsxs)(n.B,{onSelect:()=>m(r),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconBuildingCommunity,{size:18}),p(`nav.organizations`,{defaultValue:`Organizations`})]}),i&&(0,a.jsxs)(n.B,{onSelect:()=>m(i),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconBuildingSkyscraper,{size:18}),p(`nav.tenantAdmin`,{defaultValue:`Tenant administration`})]})]}),(c||l)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.G,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.z,{children:[l&&(0,a.jsxs)(n.B,{onSelect:()=>l(),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconSparkles,{size:18}),p(`bento.tour.replay`,{defaultValue:`Take the tour`})]}),c&&(0,a.jsxs)(n.B,{onSelect:()=>c(),className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2`,children:[(0,a.jsx)(s.IconKeyboard,{size:18}),p(`bento.shortcuts.title`,{defaultValue:`Keyboard shortcuts`})]})]})]}),(0,a.jsx)(n.G,{className:`my-1.5 bg-border/50`}),(0,a.jsxs)(n.B,{onSelect:()=>{globalThis.location.href=t},className:`bento-dropdown-item cursor-pointer gap-2 px-3 py-2 bento-item-danger`,children:[(0,a.jsx)(s.IconLogout,{size:18}),p(`nav.logOut`)]})]})]})}var Bt={blue:`blue`,violet:`violet`,emerald:`emerald`,amber:`amber`,rose:`rose`,slate:`slate`,cyan:`blue`,orange:`amber`};function Vt({variant:t=`blue`,className:r,children:o}){let s;i.Children.forEach(o,e=>{if(!(0,i.isValidElement)(e))return;let{type:t}=e;(t===n.C.Header||t===n.C.StaticHeader)&&(s??=e.props)});let c=i.Children.map(o,e=>{if(!(0,i.isValidElement)(e))return e;let{type:t}=e;return t===n.C.Header||t===n.C.StaticHeader?null:t===n.C.Content?e.props.children:e});return s?(0,a.jsx)(pt,{icon:s.icon,tone:Bt[t]??`blue`,title:s.title,description:s.description,className:r,children:c}):(0,a.jsx)(`section`,{className:e.t(ft,r),children:c})}Vt.Header=n.C.Header,Vt.StaticHeader=n.C.StaticHeader,Vt.Content=n.C.Content;var Ht=`bento-grid grid auto-rows-[minmax(140px,auto)] grid-cols-2 gap-4 md:grid-cols-4 md:gap-5 lg:grid-cols-6`;function Ut({eyebrow:e,title:t,description:n,titleHref:r,children:i,gridClassName:o=Ht}){let c=(0,a.jsx)(`h2`,{className:`text-xl font-semibold tracking-tight md:text-2xl`,children:t});return(0,a.jsxs)(`section`,{className:`mb-8 md:mb-10`,children:[(0,a.jsxs)(`header`,{className:`bento-shell-header mb-4 flex flex-col gap-0.5`,children:[e&&(0,a.jsx)(`span`,{className:`text-xs uppercase tracking-[0.18em] text-muted-foreground`,children:e}),r?(0,a.jsxs)(u.Link,{to:r,className:`group inline-flex w-fit items-center gap-1 text-foreground transition-colors hover:text-primary`,children:[c,(0,a.jsx)(s.IconChevronRight,{size:20,className:`text-muted-foreground transition-transform duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] group-hover:translate-x-1`})]}):c,n&&(0,a.jsx)(`p`,{className:`max-w-2xl text-sm text-muted-foreground`,children:n})]}),(0,a.jsx)(`div`,{className:o,children:i})]})}function Wt({to:t,onClick:n,disabled:r=!1,disabledHint:i,icon:o,tone:c,eyebrow:l,title:d,span:f,featured:p=!1,children:m}){let h=!r&&!!(t||n),g=p?`h-14 w-14 rounded-2xl`:`h-9 w-9 rounded-2xl`,_=p?28:18,v=p?`text-xl font-semibold tracking-tight md:text-2xl`:`text-base font-semibold tracking-tight md:text-lg`,y=(0,a.jsxs)(a.Fragment,{children:[p&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -bottom-10 -right-10 h-64 w-64 rounded-full ${S(c)} opacity-40 blur-2xl dark:opacity-50`}),(0,a.jsx)(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute right-12 top-1/3 h-32 w-32 rounded-full ${S(c)} bento-chip-tr opacity-20 blur-2xl dark:opacity-30`})]}),(0,a.jsxs)(`div`,{className:`relative z-1 flex items-center justify-between`,children:[(0,a.jsx)(`span`,{className:`grid place-items-center ${S(c)} text-white shadow-md ${g}`,children:(0,a.jsx)(o,{size:_})}),h&&(0,a.jsx)(s.IconChevronRight,{size:p?18:16,className:`text-muted-foreground transition-transform duration-300 ease-[cubic-bezier(0.32,0.72,0,1)] group-hover:translate-x-1`})]}),(0,a.jsxs)(`div`,{className:`relative z-1`,children:[(0,a.jsx)(`div`,{className:`text-[11px] uppercase tracking-wider text-muted-foreground`,children:l}),(0,a.jsx)(`div`,{className:`mt-0.5 ${v}`,children:d}),m&&(0,a.jsx)(`div`,{className:`mt-2`,children:m})]})]}),b=`bento-tile bento-glass group relative flex flex-col ${p?`gap-5`:`gap-4`} overflow-hidden text-left ${p?`p-6 md:p-7`:`p-5`} ${f}${h?` bento-tile-clickable`:``}${r?` cursor-not-allowed opacity-60`:``}`;return r?(0,a.jsx)(`div`,{className:b,"aria-disabled":`true`,title:i,children:y}):t?(0,a.jsx)(u.Link,{to:t,className:b,children:y}):n?(0,a.jsx)(`button`,{type:`button`,onClick:n,className:e.t(`w-full`,b),children:y}):(0,a.jsx)(`div`,{className:b,children:y})}function Gt({versions:t,selected:n,onSelect:r,label:c}){let{t:l,i18n:u}=(0,o.useTranslation)(),[d,f]=(0,i.useState)(0),[p,m]=(0,i.useState)([]),h=(0,i.useRef)(new Map),g=e=>[...e].sort((e,n)=>t.findIndex(e=>e.id===n)-t.findIndex(t=>t.id===e));function _(e){if(n.includes(e)){m(p.filter(t=>t!==e)),r(n.filter(t=>t!==e));return}let t=[...n.filter(e=>!p.includes(e)),...p.filter(e=>n.includes(e))],i=t.length>=2?t.slice(t.length-1):t;m([...i,e]),r(g([...i,e]))}function v(e){let n=Math.max(0,Math.min(t.length-1,e));f(n),h.current.get(n)?.focus()}function y(e,n){switch(e.key){case`ArrowDown`:v(n+1);break;case`ArrowUp`:v(n-1);break;case`Home`:v(0);break;case`End`:v(t.length-1);break;case` `:case`Enter`:_(t[n].id);break;default:return}e.preventDefault()}let b=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?{iso:void 0,text:String(e)}:{iso:t.toISOString(),text:new Intl.DateTimeFormat(u?.resolvedLanguage,{dateStyle:`medium`,timeStyle:`short`}).format(t)}};return(0,a.jsx)(`ul`,{role:`listbox`,"aria-label":c??l(`bento.versions.label`,{defaultValue:`Versions`}),"aria-multiselectable":`true`,"data-slot":`bento-version-rail`,className:`m-0 flex list-none flex-col gap-1 p-0`,children:t.map((r,i)=>{let o=n.includes(r.id),c=b(r.at),u=r.actor===`agent`?s.IconRobot:s.IconUser,p=o?`text-foreground/80`:`text-muted-foreground`;return(0,a.jsxs)(`li`,{ref:e=>{e?h.current.set(i,e):h.current.delete(i)},role:`option`,"aria-selected":o?`true`:`false`,tabIndex:i===Math.min(d,t.length-1)?0:-1,onKeyDown:e=>y(e,i),onClick:()=>{f(i),_(r.id)},className:e.t(`flex cursor-pointer flex-col gap-0.5 rounded-xl border px-3 py-2 text-sm outline-none transition-colors`,`focus-visible:ring-2 focus-visible:ring-ring`,o?`border-primary/50 bg-primary/10`:`border-transparent hover:bg-muted/50`),children:[(0,a.jsxs)(`span`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,a.jsx)(u,{size:14,"aria-hidden":`true`}),r.author,(0,a.jsx)(`span`,{className:e.t(`text-xs font-normal`,p),children:r.actor===`agent`?l(`bento.versions.agent`,{defaultValue:`Agent`}):l(`bento.versions.human`,{defaultValue:`Person`})})]}),(0,a.jsx)(`time`,{dateTime:c.iso,className:e.t(`text-xs`,p),children:c.text}),r.summary&&(0,a.jsx)(`span`,{className:`text-xs`,children:r.summary})]},r.id)})})}exports.AdaptiveSectionCard=Vt,exports.BENTO_EMPHASIS_NEXT=ze,exports.BENTO_EMPHASIS_SPAN=Re,exports.BENTO_RECORD_STATES=F,exports.BENTO_SHELL_SHORTCUTS=Tt,exports.BENTO_TONES=x,exports.BENTO_TONE_CLASS=b,exports.BentoActionsMenu=y,exports.BentoBackLink=M,exports.BentoBackToTop=vt,exports.BentoCalendar=Ie,exports.BentoChangeCell=Ce,exports.BentoChangeMark=R,exports.BentoCommandPalette=St,exports.BentoCountTile=C,exports.BentoDataTable=O,exports.BentoDiff=ae,exports.BentoEmptyState=k,exports.BentoEntityShell=L,exports.BentoEntityTile=He,exports.BentoFilterBar=qe,exports.BentoFormHero=dt,exports.BentoFormSection=pt,exports.BentoHero=ee,exports.BentoHeroIconPicker=P,exports.BentoIdentityCell=Te,exports.BentoInlineEdit=te,exports.BentoListPage=$e,exports.BentoNavRail=Lt,exports.BentoPaletteTrigger=jt,exports.BentoPanel=mt,exports.BentoSaveBar=ct,exports.BentoScrollSaveBar=ut,exports.BentoSection=Ut,exports.BentoShell=Ct,exports.BentoShortcutsDialog=Mt,exports.BentoSplitPage=Oe,exports.BentoStatusMarker=ne,exports.BentoTile=Wt,exports.BentoTileGrid=et,exports.BentoTrail=j,exports.BentoUserMenu=zt,exports.BentoVersionRail=Gt,exports.EMPTY_FILTERS=Ue,exports.bentoChipClass=S,exports.bentoNavTarget=yt,exports.resolveBentoLayout=Be,exports.toBentoLayoutEntries=Ve,exports.useBentoScrollFade=re,exports.useBentoShellShortcuts=At;
package/dist/bento.css CHANGED
@@ -11,7 +11,7 @@
11
11
  * JavaScript beside it.
12
12
  *
13
13
  * It reads `--primary`, `--card`, `--popover` and `--border`, which the preset
14
- * aliases from its own `--vg-*` tokens. So the frosted surfaces take the
14
+ * aliases from its own `--vg-*` tokens. So the surfaces take the
15
15
  * product's palette rather than carrying one — but a consumer importing this
16
16
  * without `@viglet/viglet-design-system/preset` gets surfaces with no colour.
17
17
  */
@@ -20,7 +20,8 @@
20
20
  :root {
21
21
  --bento-spring: cubic-bezier(0.32, 0.72, 0, 1);
22
22
  --bento-soft: cubic-bezier(0.22, 1, 0.36, 1);
23
- --bento-radius: 1.5rem;
23
+ /* A tile is a panel on the closed radius scale (VDS198); it was 24 px. */
24
+ --bento-radius: var(--vg-radius-panel, 0.625rem);
24
25
  }
25
26
  }
26
27
 
@@ -220,7 +221,7 @@
220
221
  * Bento dropdown surface — the frosted-glass tile aesthetic, for a popover.
221
222
  * ------------------------------------------------------------------------- */
222
223
  .bento-dropdown {
223
- border-radius: calc(var(--bento-radius) - 0.25rem);
224
+ border-radius: var(--bento-radius);
224
225
  background: color-mix(in oklab, var(--popover) 78%, transparent);
225
226
  -webkit-backdrop-filter: blur(22px) saturate(180%);
226
227
  backdrop-filter: blur(22px) saturate(180%);
@@ -231,7 +232,7 @@
231
232
  }
232
233
 
233
234
  .bento-dropdown-item {
234
- border-radius: 0.75rem;
235
+ border-radius: var(--vg-radius-control, 0.375rem);
235
236
  transition:
236
237
  background 200ms var(--bento-soft),
237
238
  transform 200ms var(--bento-spring);
@@ -239,8 +240,19 @@
239
240
 
240
241
  .bento-dropdown-item:active { transform: scale(0.98); }
241
242
 
242
- /* Frosted-glass surface — works in light and dark through the design tokens */
243
+ /* The panel surface — a solid card on a border (VDS182).
244
+
245
+ It was frosted glass, and every panel on a page frosting what sat behind it
246
+ was one of the reasons a working screen read as a collage. The class keeps its
247
+ name because products hand-roll it at call sites; what it draws is the card. */
243
248
  .bento-glass {
249
+ background: var(--card);
250
+ border: 1px solid var(--border);
251
+ }
252
+
253
+ /* Frost stays where content scrolls under a surface — the save bar that docks
254
+ over a form — because there the blur is what keeps the text beneath legible. */
255
+ .bento-frost {
244
256
  background: color-mix(in oklab, var(--card) 72%, transparent);
245
257
  -webkit-backdrop-filter: blur(18px) saturate(180%);
246
258
  backdrop-filter: blur(18px) saturate(180%);
@@ -350,6 +362,28 @@
350
362
  --bento-status-text: var(--vg-bento-error-text-dark);
351
363
  }
352
364
 
365
+ /* Record states (VDS182) — a dot and a word, the one place colour appears on a
366
+ row or a list tile. Five of them, and no tone per product area: colour that is
367
+ everywhere cannot say which record is live and which is waiting. */
368
+ .bento-state-dot {
369
+ background-color: var(--bento-state);
370
+ }
371
+
372
+ .bento-state-published { --bento-state: var(--vg-bento-state-published); }
373
+ .bento-state-draft { --bento-state: var(--vg-bento-state-draft); }
374
+ .bento-state-scheduled { --bento-state: var(--vg-bento-state-scheduled); }
375
+ .bento-state-changed { --bento-state: var(--vg-bento-state-changed); }
376
+ .bento-state-archived { --bento-state: var(--vg-bento-state-archived); }
377
+
378
+ /* Where no single thing is named — a list's hero, a form section, an empty
379
+ state — the icon sits in a neutral well. The gradient chip names a thing, so it
380
+ stays in an entity hero and on a hub's tiles (VDS182). */
381
+ .bento-well {
382
+ background: var(--muted);
383
+ border: 1px solid var(--border);
384
+ color: var(--muted-foreground);
385
+ }
386
+
353
387
  /* The destructive item in a menu: text only until focused, then a faint wash. */
354
388
  .bento-item-danger {
355
389
  color: var(--vg-bento-danger-text);