convex-cms 0.0.7-alpha.0 → 0.0.8

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 (134) hide show
  1. package/README.md +22 -17
  2. package/admin/src/components/BreakingChangesWarningDialog.tsx +5 -5
  3. package/admin/src/components/BulkOperationModal.tsx +14 -14
  4. package/admin/src/components/ContentEntryEditor.tsx +6 -6
  5. package/admin/src/components/ContentTypeFormModal.tsx +1 -1
  6. package/admin/src/components/Header.tsx +5 -2
  7. package/admin/src/components/SchemaDriftWarning.tsx +126 -0
  8. package/admin/src/components/TaxonomyEditor.tsx +2 -2
  9. package/admin/src/components/TermTree.tsx +3 -3
  10. package/admin/src/components/UploadDropzone.tsx +7 -7
  11. package/admin/src/components/VersionCompare.tsx +13 -13
  12. package/admin/src/components/VersionHistory.tsx +2 -2
  13. package/admin/src/components/VersionRollbackModal.tsx +5 -5
  14. package/admin/src/components/cmsds/CmsButton.tsx +2 -2
  15. package/admin/src/components/cmsds/CmsDialog.tsx +4 -1
  16. package/admin/src/components/cmsds/CmsStatusBadge.tsx +5 -5
  17. package/admin/src/components/fields/JsonField.tsx +1 -1
  18. package/admin/src/components/fields/TagField.tsx +1 -1
  19. package/admin/src/contexts/SettingsConfigContext.tsx +10 -3
  20. package/admin/src/embed/index.tsx +29 -9
  21. package/admin/src/embed/pages/ContentTypeEntries.tsx +25 -0
  22. package/admin/src/embed/pages/Entry.tsx +114 -0
  23. package/admin/src/embed/pages/Media.tsx +3 -1
  24. package/admin/src/embed/pages/NewEntry.tsx +83 -0
  25. package/admin/src/embed/pages/index.ts +3 -0
  26. package/admin/src/pages/ContentPage.tsx +16 -1
  27. package/admin/src/pages/ContentTypeEntriesPage.tsx +466 -0
  28. package/admin/src/pages/ContentTypesPage.tsx +3 -3
  29. package/admin/src/pages/DashboardPage.tsx +3 -0
  30. package/admin/src/pages/SettingsPage.tsx +4 -4
  31. package/admin/src/pages/index.ts +1 -0
  32. package/admin/src/routes/__root.tsx +10 -10
  33. package/admin/src/styles/globals.css +31 -5
  34. package/admin/src/styles/tailwind-config.css +25 -0
  35. package/admin/src/styles/theme.css +50 -0
  36. package/admin-dist/nitro.json +1 -1
  37. package/admin-dist/public/assets/{CmsEmptyState-CXVkI3FZ.js → CmsEmptyState-6-PLaXtD.js} +1 -1
  38. package/admin-dist/public/assets/{CmsPageHeader-DU9fD34s.js → CmsPageHeader-SoF4Epu9.js} +1 -1
  39. package/admin-dist/public/assets/CmsStatusBadge-D7kYaohx.js +1 -0
  40. package/admin-dist/public/assets/{CmsSurface-DF7OcKg_.js → CmsSurface-BvksBm6W.js} +1 -1
  41. package/admin-dist/public/assets/{CmsToolbar-5S8FQrSx.js → CmsToolbar-DlZPMe2B.js} +1 -1
  42. package/admin-dist/public/assets/ContentEntryEditor-C6n9xLS9.js +4 -0
  43. package/admin-dist/public/assets/{TaxonomyFilter-DEN2Q9Lo.js → TaxonomyFilter-CFX1_g8s.js} +1 -1
  44. package/admin-dist/public/assets/{_contentTypeId-Ba5iowxH.js → _contentTypeId-DTv8UoTp.js} +1 -1
  45. package/admin-dist/public/assets/_entryId-D3lr5Dvy.js +1 -0
  46. package/admin-dist/public/assets/alert-BAHTL6ao.js +1 -0
  47. package/admin-dist/public/assets/badge-oJv4Eai8.js +1 -0
  48. package/admin-dist/public/assets/{circle-check-big-B7eCOM8r.js → circle-check-big-3OHxNDhO.js} +1 -1
  49. package/admin-dist/public/assets/{command-BIjzeKOv.js → command-DwgQs69u.js} +1 -1
  50. package/admin-dist/public/assets/content-CKQ4QwW2.js +1 -0
  51. package/admin-dist/public/assets/content-types-BrttaLpc.js +1 -0
  52. package/admin-dist/public/assets/globals-CoCRjt0K.css +1 -0
  53. package/admin-dist/public/assets/index-DOkgTSx0.js +1 -0
  54. package/admin-dist/public/assets/{main-BZB1uYTH.js → main-DV6oxWnU.js} +5 -5
  55. package/admin-dist/public/assets/media-B2i-mCbx.js +1 -0
  56. package/admin-dist/public/assets/new._contentTypeId-VF63rpic.js +1 -0
  57. package/admin-dist/public/assets/{pencil-BDQ1ZWRw.js → pencil-CX1CiTDD.js} +1 -1
  58. package/admin-dist/public/assets/refresh-cw-Cm-YOeFI.js +1 -0
  59. package/admin-dist/public/assets/{rotate-ccw-BWblSIsl.js → rotate-ccw-B45JsL5f.js} +1 -1
  60. package/admin-dist/public/assets/{scroll-area-BoaB6x8v.js → scroll-area-b3A1HHR7.js} +1 -1
  61. package/admin-dist/public/assets/{search-CYMIpd39.js → search-DKKh_DdH.js} +1 -1
  62. package/admin-dist/public/assets/settings-CGVDEV1r.js +1 -0
  63. package/admin-dist/public/assets/{switch-DN7TOCa5.js → switch-BTMY8Qnk.js} +1 -1
  64. package/admin-dist/public/assets/tabs-DUQwUoIb.js +1 -0
  65. package/admin-dist/public/assets/{tanstack-adapter-DQcKErwf.js → tanstack-adapter-f7AHmQ5L.js} +1 -1
  66. package/admin-dist/public/assets/taxonomies-DvMppdiD.js +1 -0
  67. package/admin-dist/public/assets/{trash-Dp_a2mpb.js → trash-D7e0uKd9.js} +1 -1
  68. package/admin-dist/public/assets/{useBreadcrumbLabel-BQ9dJI6T.js → useBreadcrumbLabel-CF2KYwsw.js} +1 -1
  69. package/admin-dist/public/assets/{usePermissions-WUBNg_Id.js → usePermissions-DWBImEOW.js} +1 -1
  70. package/admin-dist/server/_libs/lucide-react.mjs +50 -43
  71. package/admin-dist/server/_ssr/{CmsEmptyState-DYh_PPQE.mjs → CmsEmptyState-BM8DghTl.mjs} +1 -1
  72. package/admin-dist/server/_ssr/{CmsPageHeader-BcniLh49.mjs → CmsPageHeader-BHUmrIWD.mjs} +1 -1
  73. package/admin-dist/server/_ssr/{CmsStatusBadge-BShWDxwE.mjs → CmsStatusBadge-D0Zb0oRl.mjs} +7 -7
  74. package/admin-dist/server/_ssr/{CmsSurface-CHEv-Kba.mjs → CmsSurface-B2eBr-47.mjs} +1 -1
  75. package/admin-dist/server/_ssr/{CmsToolbar-Dqqb216_.mjs → CmsToolbar-BCrwg7OL.mjs} +1 -1
  76. package/admin-dist/server/_ssr/{ContentEntryEditor-DOIAyWME.mjs → ContentEntryEditor-Cjfm0uhr.mjs} +37 -37
  77. package/admin-dist/server/_ssr/{TaxonomyFilter-BfsPAZ-Y.mjs → TaxonomyFilter-C4pD0kfM.mjs} +3 -3
  78. package/admin-dist/server/_ssr/{_contentTypeId-CPjmri90.mjs → _contentTypeId-CiDiX-p7.mjs} +11 -11
  79. package/admin-dist/server/_ssr/{_entryId-D0yu8HuP.mjs → _entryId-9GxatOkL.mjs} +11 -11
  80. package/admin-dist/server/_ssr/_tanstack-start-manifest_v-CC7UrHKE.mjs +4 -0
  81. package/admin-dist/server/_ssr/{badge-Cp61aQNc.mjs → badge-EI998zba.mjs} +1 -1
  82. package/admin-dist/server/_ssr/{command-BfjE1WJf.mjs → command-BLAWQhUw.mjs} +1 -1
  83. package/admin-dist/server/_ssr/{content-DrODe6sA.mjs → content-BHX39L4D.mjs} +31 -22
  84. package/admin-dist/server/_ssr/{content-types-BPgMwxiT.mjs → content-types-DCzrBhTH.mjs} +9 -9
  85. package/admin-dist/server/_ssr/{index-BTHmIC9W.mjs → index-DwM_5VNP.mjs} +92 -6
  86. package/admin-dist/server/_ssr/index.mjs +2 -2
  87. package/admin-dist/server/_ssr/{media-DkvBfmD9.mjs → media-CbzgTRRQ.mjs} +9 -9
  88. package/admin-dist/server/_ssr/{new._contentTypeId-Co_73sDJ.mjs → new._contentTypeId-6Ph-Gtlw.mjs} +10 -10
  89. package/admin-dist/server/_ssr/{router-CaDgRHfQ.mjs → router-vd1nySeP.mjs} +45 -35
  90. package/admin-dist/server/_ssr/{scroll-area-D3v-O_jk.mjs → scroll-area--B9snFTJ.mjs} +1 -1
  91. package/admin-dist/server/_ssr/{settings-MaEXh2Hz.mjs → settings-DlTO2JSj.mjs} +11 -11
  92. package/admin-dist/server/_ssr/{switch-DmbR03dm.mjs → switch-C05NgNW0.mjs} +1 -1
  93. package/admin-dist/server/_ssr/{tabs-5oFlAGLz.mjs → tabs-DAk2J5xy.mjs} +8 -8
  94. package/admin-dist/server/_ssr/{tanstack-adapter-DNaUioIZ.mjs → tanstack-adapter-DWbaPByn.mjs} +15 -1
  95. package/admin-dist/server/_ssr/{taxonomies-D3xMK23a.mjs → taxonomies-B8nqce6u.mjs} +12 -12
  96. package/admin-dist/server/_ssr/{trash-CNw1mtF1.mjs → trash-zdlZgpTo.mjs} +7 -7
  97. package/admin-dist/server/_ssr/{useBreadcrumbLabel-BQGjOTcy.mjs → useBreadcrumbLabel-DpEKyG1h.mjs} +1 -1
  98. package/admin-dist/server/_ssr/{usePermissions-D0qtvmNi.mjs → usePermissions-olYRd9S9.mjs} +1 -1
  99. package/admin-dist/server/index.mjs +164 -157
  100. package/dist/client/admin/contentTypes.d.ts +25 -0
  101. package/dist/client/admin/contentTypes.d.ts.map +1 -1
  102. package/dist/client/admin/contentTypes.js +212 -6
  103. package/dist/client/admin/contentTypes.js.map +1 -1
  104. package/dist/client/admin/entries.d.ts.map +1 -1
  105. package/dist/client/admin/entries.js +27 -0
  106. package/dist/client/admin/entries.js.map +1 -1
  107. package/dist/client/admin/index.d.ts +4 -0
  108. package/dist/client/admin/index.d.ts.map +1 -1
  109. package/dist/client/admin/index.js +16 -0
  110. package/dist/client/admin/index.js.map +1 -1
  111. package/dist/client/admin/types.d.ts +4 -0
  112. package/dist/client/admin/types.d.ts.map +1 -1
  113. package/dist/client/schema/defineContentType.d.ts.map +1 -1
  114. package/dist/client/schema/defineContentType.js +99 -80
  115. package/dist/client/schema/defineContentType.js.map +1 -1
  116. package/dist/component/contentTypeMutations.d.ts.map +1 -1
  117. package/dist/component/contentTypeMutations.js +5 -4
  118. package/dist/component/contentTypeMutations.js.map +1 -1
  119. package/package.json +2 -2
  120. package/admin-dist/public/assets/CmsStatusBadge-nZ9TeLBL.js +0 -1
  121. package/admin-dist/public/assets/ContentEntryEditor-BDb44eTo.js +0 -4
  122. package/admin-dist/public/assets/_entryId-OY3sLz6O.js +0 -1
  123. package/admin-dist/public/assets/alert-BbW1Q9CR.js +0 -1
  124. package/admin-dist/public/assets/badge-DdM8Eua8.js +0 -1
  125. package/admin-dist/public/assets/content-BV3YeSSW.js +0 -1
  126. package/admin-dist/public/assets/content-types-Bm4b2tf8.js +0 -1
  127. package/admin-dist/public/assets/globals-D41WzvyZ.css +0 -1
  128. package/admin-dist/public/assets/index-DnJ5Twlv.js +0 -1
  129. package/admin-dist/public/assets/media-BIMN5jXt.js +0 -1
  130. package/admin-dist/public/assets/new._contentTypeId-DTWb8ZDl.js +0 -1
  131. package/admin-dist/public/assets/settings-DaNDUtr5.js +0 -1
  132. package/admin-dist/public/assets/tabs-RN__emeJ.js +0 -1
  133. package/admin-dist/public/assets/taxonomies-DylY9HE1.js +0 -1
  134. package/admin-dist/server/_ssr/_tanstack-start-manifest_v-DgCpSt_y.mjs +0 -4
@@ -0,0 +1 @@
1
+ import{l as ee,j as e,L as es,h as I,r as a,y as Is,D as ve,z as be,A as ye,C as x,T as K,X as le,q as ss,F as ts,B as de,u as A,k as B,a as E,s as Ps,E as Rs,I as O,G as Qe,P as Bs,m as ze,n as as,H as ls,J as is,K as rs,M as V,N as Ls,O as Ne,Q as Us,U as ns,V as Ce,S as $s,b as Vs,c as Hs,d as qs,e as X,g as Ye,W as Ge,Y as Ze,i as ge,Z as Ws}from"./main-DV6oxWnU.js";import{C as os,F as cs,M as ds,V as ms,T as Os,a as Ks,b as Je,U as Qs,c as Ys}from"./tabs-DUQwUoIb.js";import{C as Gs}from"./CmsPageHeader-SoF4Epu9.js";import{C as Zs}from"./CmsToolbar-DlZPMe2B.js";import{C as je}from"./CmsEmptyState-6-PLaXtD.js";import{T as Js}from"./TaxonomyFilter-CFX1_g8s.js";import{P as Se}from"./pencil-CX1CiTDD.js";import{B as us}from"./badge-oJv4Eai8.js";import{R as ke}from"./rotate-ccw-B45JsL5f.js";import{S as Xe}from"./search-DKKh_DdH.js";import{u as Xs}from"./tanstack-adapter-f7AHmQ5L.js";import"./refresh-cw-Cm-YOeFI.js";import"./command-DwgQs69u.js";const et=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],st=ee("copy",et);const tt=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],we=ee("download",tt);const at=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]],lt=ee("ellipsis-vertical",at);const it=[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]],rt=ee("ellipsis",it);const nt=[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]],Fe=ee("folder-input",nt);const ot=[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],ct=ee("folder-plus",ot);function G({label:s,description:i,error:l,required:r,htmlFor:o,className:m,children:d}){return e.jsxs("div",{className:I("space-y-2",m),children:[s&&e.jsxs(es,{htmlFor:o,className:I("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",l&&"text-destructive"),children:[s,r&&e.jsx("span",{className:"ml-1 text-destructive",children:"*"})]}),d,i&&!l&&e.jsx("p",{className:"text-[13px] text-muted-foreground",children:i}),l&&e.jsx("p",{className:"text-[13px] font-medium text-destructive",children:l})]})}var dt=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),mt="VisuallyHidden",xs=a.forwardRef((s,i)=>e.jsx(Is.span,{...s,ref:i,style:{...dt,...s.style}}));xs.displayName=mt;function ut(s){return s?s.startsWith("image/")?"image":s.startsWith("video/")?"video":s.startsWith("audio/")?"audio":s==="application/pdf"||s.includes("document")||s.includes("sheet")||s.includes("presentation")||s.startsWith("text/")?"document":"other":"other"}function xt(s){if(!s||s===0)return"0 B";const i=1024,l=["B","KB","MB","GB"],r=Math.floor(Math.log(s)/Math.log(i));return`${parseFloat((s/Math.pow(i,r)).toFixed(1))} ${l[r]}`}function ht(s){return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric",hour:"numeric",minute:"2-digit"})}function ft(s,i="size-16"){const l={className:i};switch(s){case"image":return e.jsx(de,{...l});case"video":return e.jsx(ms,{...l});case"audio":return e.jsx(ds,{...l});case"document":return e.jsx(ts,{...l});default:return e.jsx(cs,{...l})}}function pt({asset:s,assets:i,currentIndex:l,open:r,onOpenChange:o,onNavigate:m,onEdit:d,onDelete:f}){const k=l>0,h=l<i.length-1,y=a.useCallback(()=>{k&&m(l-1)},[k,l,m]),c=a.useCallback(()=>{h&&m(l+1)},[h,l,m]),v=a.useCallback(u=>{if(r)switch(u.key){case"ArrowLeft":u.preventDefault(),y();break;case"ArrowRight":u.preventDefault(),c();break;case"Escape":u.preventDefault(),o(!1);break}},[r,y,c,o]);a.useEffect(()=>(window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)),[v]);const N=a.useCallback(()=>{if(!s?.url)return;const u=document.createElement("a");u.href=s.url,u.download=s.name,u.target="_blank",document.body.appendChild(u),u.click(),document.body.removeChild(u)},[s]),b=a.useCallback(async()=>{s?.url&&await navigator.clipboard.writeText(s.url)},[s]);if(!s)return null;const F=ut(s.mimeType),M=F==="image",g=!!s.url;return e.jsx(ve,{open:r,onOpenChange:o,children:e.jsxs(be,{className:"flex h-[90vh] w-[95vw] max-w-[1400px] flex-col gap-0 overflow-hidden p-0 sm:max-w-[1400px]",showCloseButton:!1,children:[e.jsx(xs,{children:e.jsxs(ye,{children:["Preview: ",s.name]})}),e.jsxs("div",{className:"flex items-center justify-between border-b px-4 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("h2",{className:"truncate text-lg font-semibold",title:s.name,children:s.name}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:[l+1," of ",i.length]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(x,{variant:"ghost",size:"icon",onClick:b,disabled:!s.url,title:"Copy URL",children:e.jsx(st,{className:"size-4"})}),e.jsx(x,{variant:"ghost",size:"icon",onClick:N,disabled:!s.url,title:"Download",children:e.jsx(we,{className:"size-4"})}),d&&e.jsx(x,{variant:"ghost",size:"icon",onClick:()=>d(s),title:"Edit",children:e.jsx(Se,{className:"size-4"})}),f&&e.jsx(x,{variant:"ghost",size:"icon",onClick:()=>f(s),title:"Delete",className:"text-destructive hover:text-destructive",children:e.jsx(K,{className:"size-4"})}),e.jsx(x,{variant:"ghost",size:"icon",onClick:()=>o(!1),title:"Close (Esc)",children:e.jsx(le,{className:"size-4"})})]})]}),e.jsxs("div",{className:"flex min-h-0 flex-1",children:[e.jsxs("div",{className:"relative flex flex-1 items-center justify-center bg-zinc-950",children:[k&&e.jsx("button",{onClick:y,className:"absolute left-4 z-10 flex size-10 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",title:"Previous (←)",children:e.jsx(os,{className:"size-6"})}),h&&e.jsx("button",{onClick:c,className:"absolute right-4 z-10 flex size-10 items-center justify-center rounded-full bg-black/50 text-white transition-colors hover:bg-black/70",title:"Next (→)",children:e.jsx(ss,{className:"size-6"})}),M&&g?e.jsx("img",{src:s.url,alt:s.altText||s.title||s.name,className:"max-h-full max-w-full object-contain"}):e.jsxs("div",{className:"flex flex-col items-center gap-4 text-zinc-400",children:[ft(F),e.jsx("p",{className:"text-sm",children:M&&!g?"Image URL not available":"Preview not available for this file type"}),g&&e.jsxs(x,{variant:"secondary",onClick:N,children:[e.jsx(we,{className:"mr-2 size-4"}),"Download to view"]})]})]}),e.jsx("div",{className:"w-72 shrink-0 overflow-y-auto border-l bg-background",children:e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx("h3",{className:"font-semibold",children:"File Information"}),e.jsx($,{label:"Filename",value:s.name}),s.title&&e.jsx($,{label:"Title",value:s.title}),s.description&&e.jsx($,{label:"Description",value:s.description}),s.altText&&e.jsx($,{label:"Alt Text",value:s.altText}),e.jsxs("div",{className:"border-t pt-4",children:[e.jsx($,{label:"Type",value:F,capitalize:!0}),s.mimeType&&e.jsx($,{label:"MIME Type",value:s.mimeType}),e.jsx($,{label:"Size",value:xt(s.size)}),s.width&&s.height&&e.jsx($,{label:"Dimensions",value:`${s.width} × ${s.height} px`})]}),e.jsx("div",{className:"border-t pt-4",children:e.jsx($,{label:"Uploaded",value:ht(s._creationTime)})}),s.tags&&s.tags.length>0&&e.jsxs("div",{className:"border-t pt-4",children:[e.jsx("p",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"Tags"}),e.jsx("div",{className:"flex flex-wrap gap-1",children:s.tags.map(u=>e.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-xs",children:u},u))})]})]})})]})]})})}function $({label:s,value:i,capitalize:l}){return e.jsxs("div",{className:"space-y-0.5",children:[e.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:s}),e.jsx("p",{className:I("break-words text-sm",l&&"capitalize"),children:i})]})}function gt({mediaId:s,taxonomyId:i,taxonomyName:l="Tags",allowCreate:r=!0,disabled:o=!1,className:m=""}){const[d,f]=a.useState(""),[k,h]=a.useState(!1),[y,c]=a.useState(0),[v,N]=a.useState(!1),[b,F]=a.useState(!1),M=a.useRef(null),g=a.useRef(null),u=a.useRef(null),D=A(B.admin.getTermsByMedia,{mediaId:s,taxonomyId:i}),S=D?.map(n=>n._id)??[],p=A(B.admin.suggestTerms,{taxonomyId:i,query:d,limit:10,excludeIds:S})??[],L=E(B.admin.setMediaTerms),Q=E(B.admin.createTermAndAddToMedia);a.useEffect(()=>{function n(C){u.current&&!u.current.contains(C.target)&&h(!1)}return document.addEventListener("mousedown",n),()=>document.removeEventListener("mousedown",n)},[]);const H=a.useCallback(async n=>{if(!S.includes(n)){F(!0);try{await L({mediaId:s,taxonomyId:i,termIds:[...S,n]})}catch(C){console.error("Failed to add tag:",C)}finally{F(!1),f(""),h(!1),c(0),M.current?.focus()}}},[s,i,S,L]),Y=a.useCallback(async n=>{F(!0);try{await L({mediaId:s,taxonomyId:i,termIds:S.filter(C=>C!==n)})}catch(C){console.error("Failed to remove tag:",C)}finally{F(!1)}},[s,i,S,L]),se=a.useCallback(async()=>{if(!(!d.trim()||!r)){N(!0);try{await Q({taxonomyId:i,name:d.trim(),mediaId:s}),f(""),h(!1),c(0)}catch(n){console.error("Failed to create tag:",n)}finally{N(!1)}}},[d,r,i,s,Q]),te=n=>{if(!o)switch(n.key){case"ArrowDown":n.preventDefault(),c(C=>C<p.length-1?C+1:C);break;case"ArrowUp":n.preventDefault(),c(C=>C>0?C-1:0);break;case"Enter":n.preventDefault(),p.length>0&&y<p.length?H(p[y]._id):d.trim()&&r&&se();break;case"Escape":h(!1);break;case"Backspace":d===""&&S.length>0&&Y(S[S.length-1]);break}};a.useEffect(()=>{if(g.current&&k){const n=g.current.querySelector(`[data-index="${y}"]`);n&&n.scrollIntoView({block:"nearest"})}},[y,k]);const U=p.filter(n=>!S.includes(n._id)),ae=r&&d.trim()&&!U.some(n=>n.name.toLowerCase()===d.trim().toLowerCase());return e.jsxs("div",{className:I("space-y-2",m),children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[e.jsx(Ps,{className:"size-4"}),l]}),e.jsxs("div",{ref:u,className:I("relative rounded-md border border-input bg-background",o&&"opacity-50"),children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 p-2",children:[(D??[]).map(n=>e.jsxs(us,{variant:"secondary",className:"gap-1 pr-1",style:n.color?{backgroundColor:n.color,color:"#fff"}:void 0,children:[n.name,!o&&e.jsx(Rs,{type:"button",variant:"ghost",size:"icon",className:"size-4 hover:bg-transparent",onClick:()=>Y(n._id),disabled:b,"aria-label":`Remove ${n.name}`,children:e.jsx(le,{className:"size-3"})})]},n._id)),!o&&e.jsx(O,{ref:M,type:"text",className:"h-7 min-w-[120px] flex-1 border-0 bg-transparent px-1 shadow-none focus-visible:ring-0",value:d,onChange:n=>{f(n.target.value),h(!0),c(0)},onFocus:()=>h(!0),onKeyDown:te,placeholder:S.length===0?"Add tags...":"",disabled:o||v||b})]}),k&&(U.length>0||ae)&&e.jsxs("div",{ref:g,className:"absolute left-0 right-0 top-full z-50 mt-1 max-h-48 overflow-auto rounded-md border bg-popover shadow-lg",role:"listbox",children:[U.map((n,C)=>e.jsxs("div",{"data-index":C,className:I("flex cursor-pointer items-center gap-2 px-3 py-2 text-sm",C===y&&"bg-accent"),onClick:()=>H(n._id),role:"option","aria-selected":C===y,children:[n.color&&e.jsx("span",{className:"size-2.5 rounded-full",style:{backgroundColor:n.color}}),e.jsx("span",{className:"flex-1",children:n.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[n.usageCount," uses"]})]},n._id)),ae&&e.jsxs("div",{"data-index":U.length,className:I("flex cursor-pointer items-center gap-2 px-3 py-2 text-sm",U.length===y&&"bg-accent"),onClick:se,role:"option","aria-selected":U.length===y,children:[v?e.jsx(Qe,{className:"size-4 animate-spin"}):e.jsx(Bs,{className:"size-4"}),e.jsxs("span",{children:['Create "',d.trim(),'"']})]})]}),(b||v)&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/50",children:e.jsx(Qe,{className:"size-4 animate-spin"})})]})]})}function jt({asset:s,open:i,onOpenChange:l,onSaved:r}){const[o,m]=a.useState(""),[d,f]=a.useState(""),[k,h]=a.useState(""),[y,c]=a.useState(""),[v,N]=a.useState(""),[b,F]=a.useState(!1),[M,g]=a.useState(""),u=E(B.admin.updateMediaAsset),S=A(B.admin.listTaxonomies,{isActive:!0,paginationOpts:{numItems:50,cursor:null}})?.page??[];a.useEffect(()=>{s&&(m(s.name),f(s.title||""),h(s.description||""),c(s.altText||""),N(s.tags?.join(", ")||""),g(""))},[s]);const T=a.useCallback(async()=>{if(s){if(!o.trim()){g("Filename is required");return}F(!0),g("");try{const p=v.split(",").map(L=>L.trim()).filter(Boolean);await u({id:s._id,name:o.trim(),title:d.trim()||void 0,description:k.trim()||void 0,altText:y.trim()||void 0,tags:p.length>0?p:void 0}),r?.(),l(!1)}catch(p){g(p instanceof Error?p.message:"Failed to update asset")}finally{F(!1)}}},[s,o,d,k,y,v,u,r,l]);return s?e.jsx(ze,{open:i,onOpenChange:l,title:"Edit File",size:"md",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"outline",onClick:()=>l(!1),disabled:b,children:"Cancel"}),e.jsx(x,{onClick:T,loading:b,children:"Save Changes"})]}),children:e.jsxs("div",{className:"space-y-4",children:[M&&e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:M}),e.jsx(G,{label:"Filename",required:!0,htmlFor:"asset-name",children:e.jsx(O,{id:"asset-name",value:o,onChange:p=>m(p.target.value),placeholder:"Enter filename"})}),e.jsx(G,{label:"Title",description:"A human-readable title for the file",htmlFor:"asset-title",children:e.jsx(O,{id:"asset-title",value:d,onChange:p=>f(p.target.value),placeholder:"Enter title (optional)"})}),e.jsx(G,{label:"Description",description:"A brief description of the file",htmlFor:"asset-description",children:e.jsx(as,{id:"asset-description",value:k,onChange:p=>h(p.target.value),placeholder:"Enter description (optional)",rows:3})}),e.jsx(G,{label:"Alt Text",description:"Alternative text for accessibility (important for images)",htmlFor:"asset-alt",children:e.jsx(O,{id:"asset-alt",value:y,onChange:p=>c(p.target.value),placeholder:"Describe the image content"})}),e.jsx(G,{label:"Quick Tags",description:"Comma-separated tags for simple organization",htmlFor:"asset-tags",children:e.jsx(O,{id:"asset-tags",value:v,onChange:p=>N(p.target.value),placeholder:"e.g., hero, blog, product"})}),S.length>0&&s&&e.jsxs("div",{className:"space-y-4 pt-2 border-t",children:[e.jsx("p",{className:"text-sm text-muted-foreground",children:"Organize with taxonomy terms"}),S.map(p=>e.jsx(gt,{mediaId:s._id,taxonomyId:p._id,taxonomyName:p.displayName,allowCreate:p.allowInlineCreation,disabled:b},p._id))]})]})}):null}function vt({folder:s,open:i,onOpenChange:l,onSaved:r}){const[o,m]=a.useState(""),[d,f]=a.useState(""),[k,h]=a.useState(!1),[y,c]=a.useState(""),v=E(B.admin.updateMediaFolder);a.useEffect(()=>{s&&(m(s.name),f(s.description||""),c(""))},[s]);const N=a.useCallback(async()=>{if(s){if(!o.trim()){c("Folder name is required");return}h(!0),c("");try{await v({id:s._id,name:o.trim(),description:d.trim()||void 0}),r?.(),l(!1)}catch(b){c(b instanceof Error?b.message:"Failed to update folder")}finally{h(!1)}}},[s,o,d,v,r,l]);return s?e.jsx(ze,{open:i,onOpenChange:l,title:"Edit Folder",size:"sm",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"outline",onClick:()=>l(!1),disabled:k,children:"Cancel"}),e.jsx(x,{onClick:N,loading:k,children:"Save Changes"})]}),children:e.jsxs("div",{className:"space-y-4",children:[y&&e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:y}),e.jsx(G,{label:"Folder Name",required:!0,htmlFor:"folder-name",children:e.jsx(O,{id:"folder-name",value:o,onChange:b=>m(b.target.value),placeholder:"Enter folder name"})}),e.jsx(G,{label:"Description",description:"A brief description of the folder contents",htmlFor:"folder-description",children:e.jsx(as,{id:"folder-description",value:d,onChange:b=>f(b.target.value),placeholder:"Enter description (optional)",rows:3})})]})}):null}function bt({asset:s,onView:i,onEdit:l,onMove:r,onDelete:o}){const m=()=>{if(!s.url)return;const f=document.createElement("a");f.href=s.url,f.download=s.name,f.target="_blank",document.body.appendChild(f),f.click(),document.body.removeChild(f)},d=async()=>{s.url&&await navigator.clipboard.writeText(s.url)};return e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsx(x,{variant:"ghost",size:"icon-sm",className:"opacity-0 group-hover:opacity-100",onClick:f=>f.stopPropagation(),children:e.jsx(lt,{className:"size-4"})})}),e.jsxs(rs,{side:"bottom",onClick:f=>f.stopPropagation(),children:[i&&e.jsxs(V,{onClick:i,children:[e.jsx(Ls,{className:"mr-2 size-4"}),"View Details"]}),l&&e.jsxs(V,{onClick:l,children:[e.jsx(Se,{className:"mr-2 size-4"}),"Edit"]}),r&&e.jsxs(V,{onClick:r,children:[e.jsx(Fe,{className:"mr-2 size-4"}),"Move to..."]}),e.jsx(Ne,{}),e.jsxs(V,{onClick:m,disabled:!s.url,children:[e.jsx(we,{className:"mr-2 size-4"}),"Download"]}),e.jsxs(V,{onClick:d,disabled:!s.url,children:[e.jsx(Us,{className:"mr-2 size-4"}),"Copy URL"]}),o&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{}),e.jsxs(V,{onClick:o,className:"text-destructive focus:text-destructive",children:[e.jsx(K,{className:"mr-2 size-4"}),"Delete"]})]})]})]})}function yt({folder:s,onEdit:i,onMove:l,onDelete:r}){return e.jsxs(ls,{children:[e.jsx(is,{asChild:!0,children:e.jsx(x,{variant:"ghost",size:"icon-sm",className:"opacity-0 group-hover:opacity-100",onClick:o=>o.stopPropagation(),children:e.jsx(rt,{className:"size-4"})})}),e.jsxs(rs,{align:"end",onClick:o=>o.stopPropagation(),children:[i&&e.jsxs(V,{onClick:i,children:[e.jsx(Se,{className:"mr-2 size-4"}),"Rename"]}),l&&e.jsxs(V,{onClick:l,children:[e.jsx(Fe,{className:"mr-2 size-4"}),"Move to..."]}),r&&e.jsxs(e.Fragment,{children:[e.jsx(Ne,{}),e.jsxs(V,{onClick:r,className:"text-destructive focus:text-destructive",children:[e.jsx(K,{className:"mr-2 size-4"}),"Delete"]})]})]})]})}function Nt({selectedCount:s,onClear:i,onMove:l,onDelete:r,isDeleting:o}){return s===0?null:e.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s," ",s===1?"file":"files"," selected"]}),e.jsxs(x,{variant:"ghost",size:"sm",onClick:i,children:[e.jsx(le,{className:"mr-1 size-4"}),"Clear"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(x,{variant:"secondary",onClick:l,disabled:o,children:[e.jsx(Fe,{className:"mr-2 size-4"}),"Move to..."]}),e.jsxs(x,{variant:"danger",onClick:r,loading:o,children:[e.jsx(K,{className:"mr-2 size-4"}),"Delete"]})]})]})})}function Ct({selectedCount:s,onClear:i,onRestore:l,onPermanentDelete:r,isRestoring:o,isDeleting:m}){return s===0?null:e.jsx("div",{className:"fixed inset-x-0 bottom-0 z-50 border-t bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80",children:e.jsxs("div",{className:"mx-auto flex max-w-7xl items-center justify-between px-6 py-3",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[s," ",s===1?"file":"files"," selected"]}),e.jsxs(x,{variant:"ghost",size:"sm",onClick:i,children:[e.jsx(le,{className:"mr-1 size-4"}),"Clear"]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(x,{variant:"secondary",onClick:l,loading:o,disabled:m,children:[e.jsx(ke,{className:"mr-2 size-4"}),"Restore"]}),e.jsxs(x,{variant:"danger",onClick:r,loading:m,disabled:o,children:[e.jsx(K,{className:"mr-2 size-4"}),"Delete Forever"]})]})]})})}function kt({open:s,onOpenChange:i,assetIds:l,currentFolderId:r,onMoved:o}){const[m,d]=a.useState(void 0),[f,k]=a.useState(!1),[h,y]=a.useState(""),c=A(B.admin.getMediaFolderTree,{}),v=E(B.admin.moveMediaAssets),N=a.useMemo(()=>{if(!c)return[];const g=(u,D)=>c.filter(T=>T.parentId===u).flatMap(T=>[{...T,depth:D},...g(T._id,D+1)]);return g(void 0,0)},[c]),b=async()=>{if(l.length!==0){k(!0),y("");try{await v({assetIds:l,targetFolderId:m}),o?.(),i(!1)}catch(g){y(g instanceof Error?g.message:"Failed to move files")}finally{k(!1)}}},F=m===r,M=m===void 0;return e.jsx(ze,{open:s,onOpenChange:i,title:"Move Files",description:`Select a destination folder for ${l.length} ${l.length===1?"file":"files"}`,size:"sm",footer:e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"outline",onClick:()=>i(!1),disabled:f,children:"Cancel"}),e.jsx(x,{onClick:b,loading:f,disabled:F,children:"Move Here"})]}),children:e.jsxs("div",{className:"space-y-2",children:[h&&e.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:h}),e.jsxs("div",{className:"max-h-[300px] overflow-y-auto rounded-md border",children:[e.jsxs("button",{type:"button",className:I("flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",M&&"bg-primary/10 text-primary",r===void 0&&"opacity-50"),onClick:()=>d(void 0),children:[e.jsx(ns,{className:"size-4"}),e.jsx("span",{className:"font-medium",children:"Root (All Files)"}),r===void 0&&e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Current"})]}),N.map(g=>{const u=g._id===r,D=g._id===m;return e.jsxs("button",{type:"button",className:I("flex w-full items-center gap-2 px-3 py-2 text-left text-sm transition-colors hover:bg-muted",D&&"bg-primary/10 text-primary",u&&"opacity-50"),style:{paddingLeft:`${12+g.depth*20}px`},onClick:()=>d(g._id),children:[g.depth>0&&e.jsx(ss,{className:"size-3 text-muted-foreground"}),e.jsx(Ce,{className:"size-4 text-amber-500"}),e.jsx("span",{className:"truncate",children:g.name}),u&&e.jsx("span",{className:"ml-auto text-xs text-muted-foreground",children:"Current"})]},g._id)}),N.length===0&&e.jsx("div",{className:"px-3 py-6 text-center text-sm text-muted-foreground",children:"No folders yet. Create folders to organize your files."})]}),F&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Files are already in this folder"})]})})}function wt(s){if(s===0)return"0 B";const i=1024,l=["B","KB","MB","GB"],r=Math.floor(Math.log(s)/Math.log(i));return`${parseFloat((s/Math.pow(i,r)).toFixed(1))} ${l[r]}`}function zt(s){return new Date(s).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function St(s,i="size-6"){const l={className:i};switch(s){case"image":return e.jsx(de,{...l});case"video":return e.jsx(ms,{...l});case"audio":return e.jsx(ds,{...l});case"document":return e.jsx(ts,{...l});default:return e.jsx(cs,{...l})}}function Ft(s){return s?s.startsWith("image/")?"image":s.startsWith("video/")?"video":s.startsWith("audio/")?"audio":s==="application/pdf"||s.includes("document")||s.includes("sheet")||s.includes("presentation")||s.startsWith("text/")?"document":"other":"other"}function Mt({api:s,navigation:i,settings:l}){a.useEffect(()=>{l&&!l.features.mediaManagement&&i.navigate("/")},[l,i]);const[r,o]=a.useState(void 0),[m,d]=a.useState(""),[f,k]=a.useState(""),[h,y]=a.useState([]),[c,v]=a.useState(new Set),[N,b]=a.useState(!1),[F,M]=a.useState(!1),[g,u]=a.useState(!1),[D,S]=a.useState(""),[T,p]=a.useState(!1),[L,Q]=a.useState(""),[H,Y]=a.useState(null),[se,te]=a.useState(null),[U,ae]=a.useState(null),[n,C]=a.useState(null),[hs,Me]=a.useState(!1),[fs,De]=a.useState(!1),[ps,me]=a.useState(!1),[Te,_e]=a.useState(!1),[Ae,gs]=a.useState("library"),[Ee,Z]=a.useState(!1),[Ie,Pe]=a.useState(!1),[js,ie]=a.useState(!1),[J,re]=a.useState(null),w=Ae==="trash",_=A(s.listMediaAssets,{folderId:w?void 0:r,type:f||void 0,search:m||void 0,deletedOnly:w?!0:void 0,paginationOpts:{numItems:100,cursor:null}}),ue=A(s.getMediaTrashCount,{}),Re=A(s.getMediaByTerm,h[0]?{termId:h[0]}:"skip"),Be=A(s.getMediaByTerm,h[1]?{termId:h[1]}:"skip"),Le=A(s.getMediaByTerm,h[2]?{termId:h[2]}:"skip"),xe=a.useMemo(()=>{if(h.length===0)return null;const t=new Set,j=[Re,Be,Le];for(let z=0;z<h.length&&z<3;z++){const W=j[z];if(W?.page)for(const R of W.page)t.add(R)}return t},[h,Re,Be,Le]),P=A(s.listMediaFolders,{parentId:w?void 0:r,deletedOnly:w||void 0}),he=A(s.getMediaFolder,r?{id:r}:"skip"),ne=A(s.getMediaFolderTree,{}),Ue=E(s.createMediaFolder),oe=E(s.deleteMediaAsset),$e=E(s.deleteMediaFolder),ce=E(s.restoreMediaAsset),Ve=E(s.restoreMediaFolder),He=E(s.permanentDeleteMediaAsset),qe=E(s.bulkPermanentDeleteMediaAssets),We=a.useMemo(()=>{if(!r||!ne)return[];const t=[];let j=ne.find(z=>z._id===r);for(;j;){t.unshift(j);const z=j.parentId;j=z?ne.find(W=>W._id===z):void 0}return t},[r,ne]),Oe=a.useCallback(t=>{o(t),d("")},[]),vs=a.useCallback(()=>{he?.parentId?o(he.parentId):o(void 0)},[he]),bs=a.useCallback(()=>{o(void 0),d("")},[]),fe=a.useCallback(t=>{v(j=>{const z=new Set(j);return z.has(t)?z.delete(t):z.add(t),z})},[]),ys=a.useCallback(()=>{_?.page&&v(new Set(_.page.map(t=>t._id)))},[_?.page]),pe=a.useCallback(()=>{v(new Set)},[]),Ns=a.useCallback(t=>{gs(t),v(new Set),b(!1)},[]),Cs=a.useCallback(t=>{if(N)fe(t);else{const j=_?.page?.findIndex(z=>z._id===t)??-1;j!==-1&&Y(j)}},[N,fe,_?.page]),ks=a.useCallback(t=>{Y(t)},[]),ws=a.useCallback(async()=>{if(n){Me(!0);try{n.type==="asset"?await oe({id:n.id}):await $e({id:n.id}),C(null)}catch(t){console.error("Delete failed:",t)}finally{Me(!1)}}},[n,oe,$e]),zs=a.useCallback(async()=>{if(c.size!==0){_e(!0);try{const t=Array.from(c).map(j=>oe({id:j}));await Promise.all(t),v(new Set),b(!1),me(!1)}catch(t){console.error("Bulk delete failed:",t)}finally{_e(!1)}}},[c,oe]),Ss=a.useCallback(()=>{v(new Set),b(!1)},[]),Fs=a.useCallback(async t=>{Z(!0);try{await ce({id:t})}catch(j){console.error("Restore failed:",j)}finally{Z(!1)}},[ce]),Ms=a.useCallback(async()=>{if(c.size!==0){Z(!0);try{const t=Array.from(c).map(j=>ce({id:j}));await Promise.all(t),v(new Set),b(!1)}catch(t){console.error("Bulk restore failed:",t)}finally{Z(!1)}}},[c,ce]),Ds=a.useCallback(async t=>{Z(!0);try{await Ve({id:t})}catch(j){console.error("Restore folder failed:",j)}finally{Z(!1)}},[Ve]),Ts=a.useCallback(async()=>{if(J){Pe(!0);try{J==="bulk"?(await qe({ids:Array.from(c)}),v(new Set),b(!1)):await He({id:J}),ie(!1),re(null)}catch(t){console.error("Permanent delete failed:",t)}finally{Pe(!1)}}},[J,He,qe,c]),Ke=a.useCallback(async()=>{if(!D.trim()){Q("Folder name is required");return}p(!0),Q("");try{await Ue({name:D.trim(),parentId:r}),M(!1),S("")}catch(t){Q(t instanceof Error?t.message:"Failed to create folder")}finally{p(!1)}},[D,r,Ue]),_s=a.useCallback(t=>{u(!1)},[]),As=_===void 0||P===void 0,q=a.useMemo(()=>{const t=_?.page??[];return xe===null?t:t.filter(j=>xe.has(j._id))},[_?.page,xe]);return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx(Gs,{title:"Media Library",description:"Upload, organize, and manage media assets for your content."}),e.jsx(Os,{value:Ae,onValueChange:t=>Ns(t),children:e.jsxs(Ks,{children:[e.jsxs(Je,{value:"library",children:[e.jsx(de,{className:"mr-1.5 size-4"}),"Library"]}),e.jsxs(Je,{value:"trash",children:[e.jsx(K,{className:"mr-1.5 size-4"}),"Trash",ue&&ue.total>0&&e.jsx(us,{variant:"secondary",className:"ml-1.5",children:ue.total})]})]})}),!w&&e.jsxs("nav",{className:"flex items-center gap-1","aria-label":"Folder navigation",children:[e.jsxs("button",{className:I("flex items-center gap-1.5 rounded-md px-2 py-1 text-sm transition-colors",r?"text-muted-foreground hover:bg-muted hover:text-foreground":"bg-primary/10 font-medium text-primary"),onClick:bs,children:[e.jsx(ns,{className:"size-4"}),e.jsx("span",{children:"All Files"})]}),We.map((t,j)=>e.jsxs("span",{className:"flex items-center",children:[e.jsx("span",{className:"mx-1 text-muted-foreground",children:"/"}),e.jsx("button",{className:I("rounded-md px-2 py-1 text-sm transition-colors",j===We.length-1?"bg-primary/10 font-medium text-primary":"text-muted-foreground hover:bg-muted hover:text-foreground"),onClick:()=>Oe(t._id),children:t.name})]},t._id))]}),e.jsx(Zs,{left:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(Xe,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(O,{type:"search",placeholder:"Search files...",value:m,onChange:t=>d(t.target.value),className:"w-64 pl-9"}),m&&e.jsx("button",{className:"absolute right-2 top-1/2 -translate-y-1/2 rounded p-0.5 hover:bg-muted",onClick:()=>d(""),"aria-label":"Clear search",children:e.jsx(le,{className:"size-4 text-muted-foreground"})})]}),e.jsxs($s,{value:f||"all",onValueChange:t=>k(t==="all"?"":t),children:[e.jsx(Vs,{className:"w-36",children:e.jsx(Hs,{placeholder:"All Types"})}),e.jsxs(qs,{children:[e.jsx(X,{value:"all",children:"All Types"}),e.jsx(X,{value:"image",children:"Images"}),e.jsx(X,{value:"video",children:"Videos"}),e.jsx(X,{value:"audio",children:"Audio"}),e.jsx(X,{value:"document",children:"Documents"}),e.jsx(X,{value:"other",children:"Other"})]})]}),e.jsx(Js,{selectedTermIds:h,onChange:y,placeholder:"Tags"}),_?.page&&_.page.length>0&&e.jsxs("label",{className:"flex cursor-pointer items-center gap-2 text-sm",children:[e.jsx(Ye,{checked:N,onCheckedChange:t=>{b(t),t||v(new Set)}}),"Selection Mode"]})]}),right:e.jsxs("div",{className:"flex items-center gap-2",children:[N&&c.size>0&&e.jsxs("span",{className:"text-sm text-muted-foreground",children:[c.size," selected"]}),N&&e.jsxs(e.Fragment,{children:[e.jsx(x,{variant:"secondary",size:"sm",onClick:ys,children:"Select All"}),e.jsx(x,{variant:"secondary",size:"sm",onClick:pe,children:"Clear"})]}),r&&!w&&e.jsxs(x,{variant:"secondary",onClick:vs,children:[e.jsx(os,{className:"size-4"}),"Up"]}),!w&&e.jsxs(e.Fragment,{children:[e.jsxs(x,{variant:"secondary",onClick:()=>M(!0),children:[e.jsx(ct,{className:"size-4"}),"New Folder"]}),e.jsxs(x,{onClick:()=>u(!0),children:[e.jsx(Qs,{className:"size-4"}),"Upload Files"]})]})]})}),As?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading media library..."})]}):e.jsxs(e.Fragment,{children:[!w&&P&&P.length>0&&!m&&e.jsxs("section",{children:[e.jsx("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:"Folders"}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 md:grid-cols-6",children:P.map(t=>e.jsxs("div",{className:"group relative flex cursor-pointer flex-col items-center gap-2 rounded-lg border bg-card p-4 text-center transition-colors hover:border-primary/50 hover:bg-muted/50",onClick:()=>Oe(t._id),children:[e.jsx("div",{className:"absolute right-2 top-2",children:e.jsx(yt,{folder:{_id:t._id,name:t.name},onEdit:()=>ae({_id:t._id,name:t.name,description:t.description}),onDelete:()=>C({type:"folder",id:t._id,name:t.name})})}),e.jsx(Ce,{className:"size-10 text-amber-500"}),e.jsx("span",{className:"truncate text-sm font-medium",children:t.name})]},t._id))})]}),w&&P&&P.length>0&&e.jsxs("section",{children:[e.jsxs("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:["Deleted Folders (",P.length,")"]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 md:grid-cols-6",children:P.map(t=>e.jsxs("div",{className:"group relative flex flex-col items-center gap-2 rounded-lg border border-destructive/20 bg-card p-4 text-center opacity-60",children:[e.jsx(Ce,{className:"size-10 text-amber-500/50"}),e.jsx("span",{className:"truncate text-sm font-medium",children:t.name}),e.jsxs(x,{variant:"secondary",size:"sm",onClick:()=>Ds(t._id),disabled:Ee,children:[e.jsx(ke,{className:"mr-1 size-3"}),"Restore"]})]},t._id))})]}),q.length>0?e.jsxs("section",{children:[!w&&P&&P.length>0&&!m&&e.jsx("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:"Files"}),w&&e.jsxs("h3",{className:"mb-3 text-sm font-medium text-muted-foreground",children:["Deleted Files (",q.length,")"]}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 md:grid-cols-6",children:q.map(t=>{const j=t._id,z=c.has(j),W=Ft(t.mimeType);return e.jsxs("div",{className:I("group relative flex cursor-pointer flex-col overflow-hidden rounded-lg border bg-card transition-all hover:border-primary/50",z&&"border-primary ring-2 ring-primary/20"),onClick:()=>Cs(j),children:[N&&e.jsx("div",{className:"absolute left-2 top-2 z-10",children:e.jsx(Ye,{checked:z,onCheckedChange:()=>fe(j),onClick:R=>R.stopPropagation(),className:"bg-white/80"})}),!N&&!w&&e.jsx("div",{className:"absolute right-2 top-2 z-10",children:e.jsx(bt,{asset:{_id:t._id,name:t.name,url:t.url},onView:()=>{const R=q.findIndex(Es=>Es._id===t._id);R!==-1&&Y(R)},onEdit:()=>te({_id:t._id,name:t.name,title:t.title,description:t.description,altText:t.altText,tags:t.tags}),onDelete:()=>C({type:"asset",id:t._id,name:t.name})})}),!N&&w&&e.jsxs("div",{className:"absolute right-2 top-2 z-10 flex gap-1 opacity-0 group-hover:opacity-100",children:[e.jsx(x,{variant:"secondary",size:"icon-sm",onClick:R=>{R.stopPropagation(),Fs(t._id)},title:"Restore",children:e.jsx(ke,{className:"size-4"})}),e.jsx(x,{variant:"danger",size:"icon-sm",onClick:R=>{R.stopPropagation(),re(t._id),ie(!0)},title:"Delete Forever",children:e.jsx(K,{className:"size-4"})})]}),e.jsx("div",{className:"aspect-square overflow-hidden bg-muted",children:W==="image"&&t.url?e.jsx("img",{src:t.url,alt:t.title||t.name,className:"h-full w-full object-cover"}):e.jsx("div",{className:"flex size-full items-center justify-center text-muted-foreground",children:St(W,"size-10")})}),e.jsxs("div",{className:"p-2",children:[e.jsx("p",{className:"truncate text-sm font-medium",title:t.name,children:t.name}),e.jsxs("div",{className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("span",{className:"capitalize",children:W}),e.jsx("span",{children:"•"}),e.jsx("span",{children:wt(t.size??0)})]}),e.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:zt(t._creationTime)})]})]},t._id)})}),!_.isDone&&e.jsxs("p",{className:"mt-4 text-center text-sm text-muted-foreground",children:["Showing ",_.page.length," files. More files available."]})]}):w?e.jsx(je,{icon:e.jsx(K,{className:"size-8"}),title:"Trash is empty",description:"Deleted files will appear here. You can restore them or permanently delete them."}):!P?.length&&e.jsx(je,{icon:e.jsx(de,{className:"size-8"}),title:"No media assets yet",description:"Upload images, videos, documents, and other files to use in your content.",action:{label:"Upload Files",onClick:()=>u(!0)}}),m&&q.length===0&&!w&&e.jsx(je,{icon:e.jsx(Xe,{className:"size-8"}),title:"No results found",description:`No files match "${m}". Try a different search term.`,action:{label:"Clear Search",onClick:()=>d(""),variant:"secondary"}})]}),e.jsx(ve,{open:F,onOpenChange:M,children:e.jsxs(be,{children:[e.jsx(Ge,{children:e.jsx(ye,{children:"Create New Folder"})}),e.jsx("div",{className:"space-y-4 py-4",children:e.jsxs("div",{className:"space-y-2",children:[e.jsx(es,{htmlFor:"folder-name",children:"Folder Name"}),e.jsx(O,{id:"folder-name",value:D,onChange:t=>{S(t.target.value),Q("")},placeholder:"Enter folder name",autoFocus:!0,onKeyDown:t=>{t.key==="Enter"&&!T&&Ke()}}),L&&e.jsx("p",{className:"text-sm text-destructive",children:L})]})}),e.jsxs(Ze,{children:[e.jsx(x,{variant:"secondary",onClick:()=>M(!1),disabled:T,children:"Cancel"}),e.jsx(x,{onClick:Ke,disabled:T||!D.trim(),loading:T,children:"Create Folder"})]})]})}),e.jsx(ve,{open:g,onOpenChange:u,children:e.jsxs(be,{className:"max-w-lg",children:[e.jsx(Ge,{children:e.jsx(ye,{children:"Upload Files"})}),e.jsx("div",{className:"py-4",children:e.jsx(Ys,{currentFolderId:r,generateUploadUrl:s.generateUploadUrl,createAsset:s.createMediaAsset,onUploadComplete:_s,maxFileSize:50*1024*1024,maxConcurrentUploads:3})}),e.jsx(Ze,{children:e.jsx(x,{variant:"secondary",onClick:()=>u(!1),children:"Close"})})]})}),e.jsx(pt,{asset:H!==null&&q[H]?q[H]:null,assets:q,currentIndex:H??0,open:H!==null,onOpenChange:t=>{t||Y(null)},onNavigate:ks,onEdit:w?void 0:t=>te({_id:t._id,name:t.name,title:t.title,description:t.description,altText:t.altText,tags:t.tags}),onDelete:w?void 0:t=>C({type:"asset",id:t._id,name:t.name})}),e.jsx(jt,{asset:se,open:se!==null,onOpenChange:t=>{t||te(null)}}),e.jsx(vt,{folder:U,open:U!==null,onOpenChange:t=>{t||ae(null)}}),e.jsx(ge,{open:n!==null,onOpenChange:t=>{t||C(null)},title:`Delete ${n?.type==="folder"?"Folder":"File"}?`,description:`Are you sure you want to delete "${n?.name}"? ${n?.type==="folder"?"This will also delete all files inside the folder.":"This action can be undone from the trash."}`,confirmLabel:"Delete",onConfirm:ws,variant:"danger",loading:hs}),e.jsx(ge,{open:ps,onOpenChange:me,title:"Delete Selected Files?",description:`Are you sure you want to delete ${c.size} ${c.size===1?"file":"files"}? This action can be undone from the trash.`,confirmLabel:"Delete All",onConfirm:zs,variant:"danger",loading:Te}),e.jsx(ge,{open:js,onOpenChange:t=>{ie(t),t||re(null)},title:J==="bulk"?`Delete ${c.size} ${c.size===1?"File":"Files"} Forever?`:"Delete Forever?",description:J==="bulk"?`This will permanently delete ${c.size} ${c.size===1?"file":"files"}. This action cannot be undone.`:"This will permanently delete this file. This action cannot be undone.",confirmLabel:"Delete Forever",onConfirm:Ts,variant:"danger",loading:Ie}),e.jsx(kt,{open:fs,onOpenChange:De,assetIds:Array.from(c),currentFolderId:r,onMoved:Ss}),N&&!w&&e.jsx(Nt,{selectedCount:c.size,onClear:pe,onMove:()=>De(!0),onDelete:()=>me(!0),isDeleting:Te}),N&&w&&e.jsx(Ct,{selectedCount:c.size,onClear:pe,onRestore:Ms,onPermanentDelete:()=>{re("bulk"),ie(!0)},isRestoring:Ee,isDeleting:Ie})]})}function Ht(){const s=Xs(),{settings:i}=Ws();return e.jsx(Mt,{api:B.admin,navigation:s,settings:i})}export{Ht as component};
@@ -0,0 +1 @@
1
+ import{aq as i,ad as p,u as m,k as c,j as e,F as d}from"./main-DV6oxWnU.js";import{C as l}from"./ContentEntryEditor-C6n9xLS9.js";import{u as y}from"./useBreadcrumbLabel-CF2KYwsw.js";import{C as u}from"./CmsEmptyState-6-PLaXtD.js";import"./switch-BTMY8Qnk.js";import"./tabs-DUQwUoIb.js";import"./refresh-cw-Cm-YOeFI.js";import"./pencil-CX1CiTDD.js";import"./search-DKKh_DdH.js";import"./command-DwgQs69u.js";import"./badge-oJv4Eai8.js";import"./CmsStatusBadge-D7kYaohx.js";import"./scroll-area-b3A1HHR7.js";import"./circle-check-big-3OHxNDhO.js";function w(){const{contentTypeId:n}=i.useParams(),o=p(),t=m(c.admin.getContentType,{id:n});if(y(`/entries/new/${n}`,t?`New ${t.displayName}`:void 0),t===void 0)return e.jsx("div",{className:"space-y-6 p-6",children:e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading content type..."})]})});if(t===null)return e.jsx("div",{className:"space-y-6 p-6",children:e.jsx(u,{icon:e.jsx(d,{className:"size-6"}),title:"Content Type Not Found",description:"The content type you're looking for doesn't exist or has been deleted.",action:{label:"Back to Content Types",onClick:()=>o({to:"/content-types"})}})});const s=a=>{o({to:"/entries/$entryId",params:{entryId:a._id}})},r=()=>{o({to:"/entries/type/$contentTypeId",params:{contentTypeId:n}})};return e.jsx("div",{className:"space-y-6 p-6",children:e.jsx(l,{contentType:t,onSave:s,onCancel:r})})}export{w as component};
@@ -1 +1 @@
1
- import{l as a}from"./main-BZB1uYTH.js";const e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],c=a("pencil",e);export{c as P};
1
+ import{l as a}from"./main-DV6oxWnU.js";const e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],c=a("pencil",e);export{c as P};
@@ -0,0 +1 @@
1
+ import{l as e}from"./main-DV6oxWnU.js";const t=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],c=e("refresh-cw",t);export{c as R};
@@ -1 +1 @@
1
- import{l as t}from"./main-BZB1uYTH.js";const e=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],a=t("rotate-ccw",e);export{a as R};
1
+ import{l as t}from"./main-DV6oxWnU.js";const e=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],a=t("rotate-ccw",e);export{a as R};
@@ -1 +1 @@
1
- import{r as s,aw as A,ax as se,j as f,ay as L,az as O,aA as ce,aB as C,aC as P,aD as ae,aE as ie,h as F}from"./main-BZB1uYTH.js";function de(e,o){return s.useReducer((r,l)=>o[r][l]??r,e)}var U="ScrollArea",[$]=ce(U),[ue,p]=$(U),q=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,type:l="hover",dir:t,scrollHideDelay:n=600,...c}=e,[a,i]=s.useState(null),[h,d]=s.useState(null),[b,u]=s.useState(null),[S,w]=s.useState(null),[T,Y]=s.useState(null),[x,_]=s.useState(0),[M,D]=s.useState(0),[j,y]=s.useState(!1),[N,W]=s.useState(!1),v=A(o,E=>i(E)),m=se(t);return f.jsx(ue,{scope:r,type:l,dir:m,scrollHideDelay:n,scrollArea:a,viewport:h,onViewportChange:d,content:b,onContentChange:u,scrollbarX:S,onScrollbarXChange:w,scrollbarXEnabled:j,onScrollbarXEnabledChange:y,scrollbarY:T,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:_,onCornerHeightChange:D,children:f.jsx(L.div,{dir:m,...c,ref:v,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...e.style}})})});q.displayName=U;var G="ScrollAreaViewport",J=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,children:l,nonce:t,...n}=e,c=p(G,r),a=s.useRef(null),i=A(o,a,c.onViewportChange);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),f.jsx(L.div,{"data-radix-scroll-area-viewport":"",...n,ref:i,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style},children:f.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});J.displayName=G;var g="ScrollAreaScrollbar",K=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=p(g,e.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:c}=t,a=e.orientation==="horizontal";return s.useEffect(()=>(a?n(!0):c(!0),()=>{a?n(!1):c(!1)}),[a,n,c]),t.type==="hover"?f.jsx(he,{...l,ref:o,forceMount:r}):t.type==="scroll"?f.jsx(fe,{...l,ref:o,forceMount:r}):t.type==="auto"?f.jsx(Q,{...l,ref:o,forceMount:r}):t.type==="always"?f.jsx(B,{...l,ref:o}):null});K.displayName=g;var he=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=p(g,e.__scopeScrollArea),[n,c]=s.useState(!1);return s.useEffect(()=>{const a=t.scrollArea;let i=0;if(a){const h=()=>{window.clearTimeout(i),c(!0)},d=()=>{i=window.setTimeout(()=>c(!1),t.scrollHideDelay)};return a.addEventListener("pointerenter",h),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(i),a.removeEventListener("pointerenter",h),a.removeEventListener("pointerleave",d)}}},[t.scrollArea,t.scrollHideDelay]),f.jsx(O,{present:r||n,children:f.jsx(Q,{"data-state":n?"visible":"hidden",...l,ref:o})})}),fe=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=p(g,e.__scopeScrollArea),n=e.orientation==="horizontal",c=X(()=>i("SCROLL_END"),100),[a,i]=de("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(a==="idle"){const h=window.setTimeout(()=>i("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(h)}},[a,t.scrollHideDelay,i]),s.useEffect(()=>{const h=t.viewport,d=n?"scrollLeft":"scrollTop";if(h){let b=h[d];const u=()=>{const S=h[d];b!==S&&(i("SCROLL"),c()),b=S};return h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[t.viewport,n,i,c]),f.jsx(O,{present:r||a!=="hidden",children:f.jsx(B,{"data-state":a==="hidden"?"hidden":"visible",...l,ref:o,onPointerEnter:C(e.onPointerEnter,()=>i("POINTER_ENTER")),onPointerLeave:C(e.onPointerLeave,()=>i("POINTER_LEAVE"))})})}),Q=s.forwardRef((e,o)=>{const r=p(g,e.__scopeScrollArea),{forceMount:l,...t}=e,[n,c]=s.useState(!1),a=e.orientation==="horizontal",i=X(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;c(a?h:d)}},10);return R(r.viewport,i),R(r.content,i),f.jsx(O,{present:l||n,children:f.jsx(B,{"data-state":n?"visible":"hidden",...t,ref:o})})}),B=s.forwardRef((e,o)=>{const{orientation:r="vertical",...l}=e,t=p(g,e.__scopeScrollArea),n=s.useRef(null),c=s.useRef(0),[a,i]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=te(a.viewport,a.content),d={...l,sizes:a,onSizesChange:i,hasThumb:h>0&&h<1,onThumbChange:u=>n.current=u,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:u=>c.current=u};function b(u,S){return we(u,c.current,a,S)}return r==="horizontal"?f.jsx(be,{...d,ref:o,onThumbPositionChange:()=>{if(t.viewport&&n.current){const u=t.viewport.scrollLeft,S=k(u,a,t.dir);n.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:u=>{t.viewport&&(t.viewport.scrollLeft=u)},onDragScroll:u=>{t.viewport&&(t.viewport.scrollLeft=b(u,t.dir))}}):r==="vertical"?f.jsx(Se,{...d,ref:o,onThumbPositionChange:()=>{if(t.viewport&&n.current){const u=t.viewport.scrollTop,S=k(u,a);n.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:u=>{t.viewport&&(t.viewport.scrollTop=u)},onDragScroll:u=>{t.viewport&&(t.viewport.scrollTop=b(u))}}):null}),be=s.forwardRef((e,o)=>{const{sizes:r,onSizesChange:l,...t}=e,n=p(g,e.__scopeScrollArea),[c,a]=s.useState(),i=s.useRef(null),h=A(o,i,n.onScrollbarXChange);return s.useEffect(()=>{i.current&&a(getComputedStyle(i.current))},[i]),f.jsx(ee,{"data-orientation":"horizontal",...t,ref:h,sizes:r,style:{bottom:0,left:n.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:n.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,b)=>{if(n.viewport){const u=n.viewport.scrollLeft+d.deltaX;e.onWheelScroll(u),le(u,b)&&d.preventDefault()}},onResize:()=>{i.current&&n.viewport&&c&&l({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:H(c.paddingLeft),paddingEnd:H(c.paddingRight)}})}})}),Se=s.forwardRef((e,o)=>{const{sizes:r,onSizesChange:l,...t}=e,n=p(g,e.__scopeScrollArea),[c,a]=s.useState(),i=s.useRef(null),h=A(o,i,n.onScrollbarYChange);return s.useEffect(()=>{i.current&&a(getComputedStyle(i.current))},[i]),f.jsx(ee,{"data-orientation":"vertical",...t,ref:h,sizes:r,style:{top:0,right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,b)=>{if(n.viewport){const u=n.viewport.scrollTop+d.deltaY;e.onWheelScroll(u),le(u,b)&&d.preventDefault()}},onResize:()=>{i.current&&n.viewport&&c&&l({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:H(c.paddingTop),paddingEnd:H(c.paddingBottom)}})}})}),[ve,Z]=$(g),ee=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,sizes:l,hasThumb:t,onThumbChange:n,onThumbPointerUp:c,onThumbPointerDown:a,onThumbPositionChange:i,onDragScroll:h,onWheelScroll:d,onResize:b,...u}=e,S=p(g,r),[w,T]=s.useState(null),Y=A(o,v=>T(v)),x=s.useRef(null),_=s.useRef(""),M=S.viewport,D=l.content-l.viewport,j=P(d),y=P(i),N=X(b,10);function W(v){if(x.current){const m=v.clientX-x.current.left,E=v.clientY-x.current.top;h({x:m,y:E})}}return s.useEffect(()=>{const v=m=>{const E=m.target;w?.contains(E)&&j(m,D)};return document.addEventListener("wheel",v,{passive:!1}),()=>document.removeEventListener("wheel",v,{passive:!1})},[M,w,D,j]),s.useEffect(y,[l,y]),R(w,N),R(S.content,N),f.jsx(ve,{scope:r,scrollbar:w,hasThumb:t,onThumbChange:P(n),onThumbPointerUp:P(c),onThumbPositionChange:y,onThumbPointerDown:P(a),children:f.jsx(L.div,{...u,ref:Y,style:{position:"absolute",...u.style},onPointerDown:C(e.onPointerDown,v=>{v.button===0&&(v.target.setPointerCapture(v.pointerId),x.current=w.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(v))}),onPointerMove:C(e.onPointerMove,W),onPointerUp:C(e.onPointerUp,v=>{const m=v.target;m.hasPointerCapture(v.pointerId)&&m.releasePointerCapture(v.pointerId),document.body.style.webkitUserSelect=_.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),z="ScrollAreaThumb",re=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=Z(z,e.__scopeScrollArea);return f.jsx(O,{present:r||t.hasThumb,children:f.jsx(pe,{ref:o,...l})})}),pe=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,style:l,...t}=e,n=p(z,r),c=Z(z,r),{onThumbPositionChange:a}=c,i=A(o,b=>c.onThumbChange(b)),h=s.useRef(void 0),d=X(()=>{h.current&&(h.current(),h.current=void 0)},100);return s.useEffect(()=>{const b=n.viewport;if(b){const u=()=>{if(d(),!h.current){const S=ge(b,a);h.current=S,a()}};return a(),b.addEventListener("scroll",u),()=>b.removeEventListener("scroll",u)}},[n.viewport,d,a]),f.jsx(L.div,{"data-state":c.hasThumb?"visible":"hidden",...t,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:C(e.onPointerDownCapture,b=>{const S=b.target.getBoundingClientRect(),w=b.clientX-S.left,T=b.clientY-S.top;c.onThumbPointerDown({x:w,y:T})}),onPointerUp:C(e.onPointerUp,c.onThumbPointerUp)})});re.displayName=z;var V="ScrollAreaCorner",oe=s.forwardRef((e,o)=>{const r=p(V,e.__scopeScrollArea),l=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&l?f.jsx(me,{...e,ref:o}):null});oe.displayName=V;var me=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,...l}=e,t=p(V,r),[n,c]=s.useState(0),[a,i]=s.useState(0),h=!!(n&&a);return R(t.scrollbarX,()=>{const d=t.scrollbarX?.offsetHeight||0;t.onCornerHeightChange(d),i(d)}),R(t.scrollbarY,()=>{const d=t.scrollbarY?.offsetWidth||0;t.onCornerWidthChange(d),c(d)}),h?f.jsx(L.div,{...l,ref:o,style:{width:n,height:a,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function H(e){return e?parseInt(e,10):0}function te(e,o){const r=e/o;return isNaN(r)?0:r}function I(e){const o=te(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,l=(e.scrollbar.size-r)*o;return Math.max(l,18)}function we(e,o,r,l="ltr"){const t=I(r),n=t/2,c=o||n,a=t-c,i=r.scrollbar.paddingStart+c,h=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,b=l==="ltr"?[0,d]:[d*-1,0];return ne([i,h],b)(e)}function k(e,o,r="ltr"){const l=I(o),t=o.scrollbar.paddingStart+o.scrollbar.paddingEnd,n=o.scrollbar.size-t,c=o.content-o.viewport,a=n-l,i=r==="ltr"?[0,c]:[c*-1,0],h=ie(e,i);return ne([0,c],[0,a])(h)}function ne(e,o){return r=>{if(e[0]===e[1]||o[0]===o[1])return o[0];const l=(o[1]-o[0])/(e[1]-e[0]);return o[0]+l*(r-e[0])}}function le(e,o){return e>0&&e<o}var ge=(e,o=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},l=0;return(function t(){const n={left:e.scrollLeft,top:e.scrollTop},c=r.left!==n.left,a=r.top!==n.top;(c||a)&&o(),r=n,l=window.requestAnimationFrame(t)})(),()=>window.cancelAnimationFrame(l)};function X(e,o){const r=P(e),l=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(l.current),[]),s.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(r,o)},[r,o])}function R(e,o){const r=P(o);ae(()=>{let l=0;if(e){const t=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(r)});return t.observe(e),()=>{window.cancelAnimationFrame(l),t.unobserve(e)}}},[e,r])}var xe=q,Pe=J,Ce=oe;function Te({className:e,children:o,...r}){return f.jsxs(xe,{"data-slot":"scroll-area",className:F("relative",e),...r,children:[f.jsx(Pe,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:o}),f.jsx(Ee,{}),f.jsx(Ce,{})]})}function Ee({className:e,orientation:o="vertical",...r}){return f.jsx(K,{"data-slot":"scroll-area-scrollbar",orientation:o,className:F("flex touch-none p-px transition-colors select-none",o==="vertical"&&"h-full w-2.5 border-l border-l-transparent",o==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:f.jsx(re,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}export{Te as S};
1
+ import{r as s,aw as A,ax as se,j as f,ay as L,az as O,aA as ce,aB as C,aC as P,aD as ae,aE as ie,h as F}from"./main-DV6oxWnU.js";function de(e,o){return s.useReducer((r,l)=>o[r][l]??r,e)}var U="ScrollArea",[$]=ce(U),[ue,p]=$(U),q=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,type:l="hover",dir:t,scrollHideDelay:n=600,...c}=e,[a,i]=s.useState(null),[h,d]=s.useState(null),[b,u]=s.useState(null),[S,w]=s.useState(null),[T,Y]=s.useState(null),[x,_]=s.useState(0),[M,D]=s.useState(0),[j,y]=s.useState(!1),[N,W]=s.useState(!1),v=A(o,E=>i(E)),m=se(t);return f.jsx(ue,{scope:r,type:l,dir:m,scrollHideDelay:n,scrollArea:a,viewport:h,onViewportChange:d,content:b,onContentChange:u,scrollbarX:S,onScrollbarXChange:w,scrollbarXEnabled:j,onScrollbarXEnabledChange:y,scrollbarY:T,onScrollbarYChange:Y,scrollbarYEnabled:N,onScrollbarYEnabledChange:W,onCornerWidthChange:_,onCornerHeightChange:D,children:f.jsx(L.div,{dir:m,...c,ref:v,style:{position:"relative","--radix-scroll-area-corner-width":x+"px","--radix-scroll-area-corner-height":M+"px",...e.style}})})});q.displayName=U;var G="ScrollAreaViewport",J=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,children:l,nonce:t,...n}=e,c=p(G,r),a=s.useRef(null),i=A(o,a,c.onViewportChange);return f.jsxs(f.Fragment,{children:[f.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:t}),f.jsx(L.div,{"data-radix-scroll-area-viewport":"",...n,ref:i,style:{overflowX:c.scrollbarXEnabled?"scroll":"hidden",overflowY:c.scrollbarYEnabled?"scroll":"hidden",...e.style},children:f.jsx("div",{ref:c.onContentChange,style:{minWidth:"100%",display:"table"},children:l})})]})});J.displayName=G;var g="ScrollAreaScrollbar",K=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=p(g,e.__scopeScrollArea),{onScrollbarXEnabledChange:n,onScrollbarYEnabledChange:c}=t,a=e.orientation==="horizontal";return s.useEffect(()=>(a?n(!0):c(!0),()=>{a?n(!1):c(!1)}),[a,n,c]),t.type==="hover"?f.jsx(he,{...l,ref:o,forceMount:r}):t.type==="scroll"?f.jsx(fe,{...l,ref:o,forceMount:r}):t.type==="auto"?f.jsx(Q,{...l,ref:o,forceMount:r}):t.type==="always"?f.jsx(B,{...l,ref:o}):null});K.displayName=g;var he=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=p(g,e.__scopeScrollArea),[n,c]=s.useState(!1);return s.useEffect(()=>{const a=t.scrollArea;let i=0;if(a){const h=()=>{window.clearTimeout(i),c(!0)},d=()=>{i=window.setTimeout(()=>c(!1),t.scrollHideDelay)};return a.addEventListener("pointerenter",h),a.addEventListener("pointerleave",d),()=>{window.clearTimeout(i),a.removeEventListener("pointerenter",h),a.removeEventListener("pointerleave",d)}}},[t.scrollArea,t.scrollHideDelay]),f.jsx(O,{present:r||n,children:f.jsx(Q,{"data-state":n?"visible":"hidden",...l,ref:o})})}),fe=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=p(g,e.__scopeScrollArea),n=e.orientation==="horizontal",c=X(()=>i("SCROLL_END"),100),[a,i]=de("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return s.useEffect(()=>{if(a==="idle"){const h=window.setTimeout(()=>i("HIDE"),t.scrollHideDelay);return()=>window.clearTimeout(h)}},[a,t.scrollHideDelay,i]),s.useEffect(()=>{const h=t.viewport,d=n?"scrollLeft":"scrollTop";if(h){let b=h[d];const u=()=>{const S=h[d];b!==S&&(i("SCROLL"),c()),b=S};return h.addEventListener("scroll",u),()=>h.removeEventListener("scroll",u)}},[t.viewport,n,i,c]),f.jsx(O,{present:r||a!=="hidden",children:f.jsx(B,{"data-state":a==="hidden"?"hidden":"visible",...l,ref:o,onPointerEnter:C(e.onPointerEnter,()=>i("POINTER_ENTER")),onPointerLeave:C(e.onPointerLeave,()=>i("POINTER_LEAVE"))})})}),Q=s.forwardRef((e,o)=>{const r=p(g,e.__scopeScrollArea),{forceMount:l,...t}=e,[n,c]=s.useState(!1),a=e.orientation==="horizontal",i=X(()=>{if(r.viewport){const h=r.viewport.offsetWidth<r.viewport.scrollWidth,d=r.viewport.offsetHeight<r.viewport.scrollHeight;c(a?h:d)}},10);return R(r.viewport,i),R(r.content,i),f.jsx(O,{present:l||n,children:f.jsx(B,{"data-state":n?"visible":"hidden",...t,ref:o})})}),B=s.forwardRef((e,o)=>{const{orientation:r="vertical",...l}=e,t=p(g,e.__scopeScrollArea),n=s.useRef(null),c=s.useRef(0),[a,i]=s.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),h=te(a.viewport,a.content),d={...l,sizes:a,onSizesChange:i,hasThumb:h>0&&h<1,onThumbChange:u=>n.current=u,onThumbPointerUp:()=>c.current=0,onThumbPointerDown:u=>c.current=u};function b(u,S){return we(u,c.current,a,S)}return r==="horizontal"?f.jsx(be,{...d,ref:o,onThumbPositionChange:()=>{if(t.viewport&&n.current){const u=t.viewport.scrollLeft,S=k(u,a,t.dir);n.current.style.transform=`translate3d(${S}px, 0, 0)`}},onWheelScroll:u=>{t.viewport&&(t.viewport.scrollLeft=u)},onDragScroll:u=>{t.viewport&&(t.viewport.scrollLeft=b(u,t.dir))}}):r==="vertical"?f.jsx(Se,{...d,ref:o,onThumbPositionChange:()=>{if(t.viewport&&n.current){const u=t.viewport.scrollTop,S=k(u,a);n.current.style.transform=`translate3d(0, ${S}px, 0)`}},onWheelScroll:u=>{t.viewport&&(t.viewport.scrollTop=u)},onDragScroll:u=>{t.viewport&&(t.viewport.scrollTop=b(u))}}):null}),be=s.forwardRef((e,o)=>{const{sizes:r,onSizesChange:l,...t}=e,n=p(g,e.__scopeScrollArea),[c,a]=s.useState(),i=s.useRef(null),h=A(o,i,n.onScrollbarXChange);return s.useEffect(()=>{i.current&&a(getComputedStyle(i.current))},[i]),f.jsx(ee,{"data-orientation":"horizontal",...t,ref:h,sizes:r,style:{bottom:0,left:n.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:n.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":I(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.x),onDragScroll:d=>e.onDragScroll(d.x),onWheelScroll:(d,b)=>{if(n.viewport){const u=n.viewport.scrollLeft+d.deltaX;e.onWheelScroll(u),le(u,b)&&d.preventDefault()}},onResize:()=>{i.current&&n.viewport&&c&&l({content:n.viewport.scrollWidth,viewport:n.viewport.offsetWidth,scrollbar:{size:i.current.clientWidth,paddingStart:H(c.paddingLeft),paddingEnd:H(c.paddingRight)}})}})}),Se=s.forwardRef((e,o)=>{const{sizes:r,onSizesChange:l,...t}=e,n=p(g,e.__scopeScrollArea),[c,a]=s.useState(),i=s.useRef(null),h=A(o,i,n.onScrollbarYChange);return s.useEffect(()=>{i.current&&a(getComputedStyle(i.current))},[i]),f.jsx(ee,{"data-orientation":"vertical",...t,ref:h,sizes:r,style:{top:0,right:n.dir==="ltr"?0:void 0,left:n.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":I(r)+"px",...e.style},onThumbPointerDown:d=>e.onThumbPointerDown(d.y),onDragScroll:d=>e.onDragScroll(d.y),onWheelScroll:(d,b)=>{if(n.viewport){const u=n.viewport.scrollTop+d.deltaY;e.onWheelScroll(u),le(u,b)&&d.preventDefault()}},onResize:()=>{i.current&&n.viewport&&c&&l({content:n.viewport.scrollHeight,viewport:n.viewport.offsetHeight,scrollbar:{size:i.current.clientHeight,paddingStart:H(c.paddingTop),paddingEnd:H(c.paddingBottom)}})}})}),[ve,Z]=$(g),ee=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,sizes:l,hasThumb:t,onThumbChange:n,onThumbPointerUp:c,onThumbPointerDown:a,onThumbPositionChange:i,onDragScroll:h,onWheelScroll:d,onResize:b,...u}=e,S=p(g,r),[w,T]=s.useState(null),Y=A(o,v=>T(v)),x=s.useRef(null),_=s.useRef(""),M=S.viewport,D=l.content-l.viewport,j=P(d),y=P(i),N=X(b,10);function W(v){if(x.current){const m=v.clientX-x.current.left,E=v.clientY-x.current.top;h({x:m,y:E})}}return s.useEffect(()=>{const v=m=>{const E=m.target;w?.contains(E)&&j(m,D)};return document.addEventListener("wheel",v,{passive:!1}),()=>document.removeEventListener("wheel",v,{passive:!1})},[M,w,D,j]),s.useEffect(y,[l,y]),R(w,N),R(S.content,N),f.jsx(ve,{scope:r,scrollbar:w,hasThumb:t,onThumbChange:P(n),onThumbPointerUp:P(c),onThumbPositionChange:y,onThumbPointerDown:P(a),children:f.jsx(L.div,{...u,ref:Y,style:{position:"absolute",...u.style},onPointerDown:C(e.onPointerDown,v=>{v.button===0&&(v.target.setPointerCapture(v.pointerId),x.current=w.getBoundingClientRect(),_.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",S.viewport&&(S.viewport.style.scrollBehavior="auto"),W(v))}),onPointerMove:C(e.onPointerMove,W),onPointerUp:C(e.onPointerUp,v=>{const m=v.target;m.hasPointerCapture(v.pointerId)&&m.releasePointerCapture(v.pointerId),document.body.style.webkitUserSelect=_.current,S.viewport&&(S.viewport.style.scrollBehavior=""),x.current=null})})})}),z="ScrollAreaThumb",re=s.forwardRef((e,o)=>{const{forceMount:r,...l}=e,t=Z(z,e.__scopeScrollArea);return f.jsx(O,{present:r||t.hasThumb,children:f.jsx(pe,{ref:o,...l})})}),pe=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,style:l,...t}=e,n=p(z,r),c=Z(z,r),{onThumbPositionChange:a}=c,i=A(o,b=>c.onThumbChange(b)),h=s.useRef(void 0),d=X(()=>{h.current&&(h.current(),h.current=void 0)},100);return s.useEffect(()=>{const b=n.viewport;if(b){const u=()=>{if(d(),!h.current){const S=ge(b,a);h.current=S,a()}};return a(),b.addEventListener("scroll",u),()=>b.removeEventListener("scroll",u)}},[n.viewport,d,a]),f.jsx(L.div,{"data-state":c.hasThumb?"visible":"hidden",...t,ref:i,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...l},onPointerDownCapture:C(e.onPointerDownCapture,b=>{const S=b.target.getBoundingClientRect(),w=b.clientX-S.left,T=b.clientY-S.top;c.onThumbPointerDown({x:w,y:T})}),onPointerUp:C(e.onPointerUp,c.onThumbPointerUp)})});re.displayName=z;var V="ScrollAreaCorner",oe=s.forwardRef((e,o)=>{const r=p(V,e.__scopeScrollArea),l=!!(r.scrollbarX&&r.scrollbarY);return r.type!=="scroll"&&l?f.jsx(me,{...e,ref:o}):null});oe.displayName=V;var me=s.forwardRef((e,o)=>{const{__scopeScrollArea:r,...l}=e,t=p(V,r),[n,c]=s.useState(0),[a,i]=s.useState(0),h=!!(n&&a);return R(t.scrollbarX,()=>{const d=t.scrollbarX?.offsetHeight||0;t.onCornerHeightChange(d),i(d)}),R(t.scrollbarY,()=>{const d=t.scrollbarY?.offsetWidth||0;t.onCornerWidthChange(d),c(d)}),h?f.jsx(L.div,{...l,ref:o,style:{width:n,height:a,position:"absolute",right:t.dir==="ltr"?0:void 0,left:t.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function H(e){return e?parseInt(e,10):0}function te(e,o){const r=e/o;return isNaN(r)?0:r}function I(e){const o=te(e.viewport,e.content),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,l=(e.scrollbar.size-r)*o;return Math.max(l,18)}function we(e,o,r,l="ltr"){const t=I(r),n=t/2,c=o||n,a=t-c,i=r.scrollbar.paddingStart+c,h=r.scrollbar.size-r.scrollbar.paddingEnd-a,d=r.content-r.viewport,b=l==="ltr"?[0,d]:[d*-1,0];return ne([i,h],b)(e)}function k(e,o,r="ltr"){const l=I(o),t=o.scrollbar.paddingStart+o.scrollbar.paddingEnd,n=o.scrollbar.size-t,c=o.content-o.viewport,a=n-l,i=r==="ltr"?[0,c]:[c*-1,0],h=ie(e,i);return ne([0,c],[0,a])(h)}function ne(e,o){return r=>{if(e[0]===e[1]||o[0]===o[1])return o[0];const l=(o[1]-o[0])/(e[1]-e[0]);return o[0]+l*(r-e[0])}}function le(e,o){return e>0&&e<o}var ge=(e,o=()=>{})=>{let r={left:e.scrollLeft,top:e.scrollTop},l=0;return(function t(){const n={left:e.scrollLeft,top:e.scrollTop},c=r.left!==n.left,a=r.top!==n.top;(c||a)&&o(),r=n,l=window.requestAnimationFrame(t)})(),()=>window.cancelAnimationFrame(l)};function X(e,o){const r=P(e),l=s.useRef(0);return s.useEffect(()=>()=>window.clearTimeout(l.current),[]),s.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(r,o)},[r,o])}function R(e,o){const r=P(o);ae(()=>{let l=0;if(e){const t=new ResizeObserver(()=>{cancelAnimationFrame(l),l=window.requestAnimationFrame(r)});return t.observe(e),()=>{window.cancelAnimationFrame(l),t.unobserve(e)}}},[e,r])}var xe=q,Pe=J,Ce=oe;function Te({className:e,children:o,...r}){return f.jsxs(xe,{"data-slot":"scroll-area",className:F("relative",e),...r,children:[f.jsx(Pe,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:o}),f.jsx(Ee,{}),f.jsx(Ce,{})]})}function Ee({className:e,orientation:o="vertical",...r}){return f.jsx(K,{"data-slot":"scroll-area-scrollbar",orientation:o,className:F("flex touch-none p-px transition-colors select-none",o==="vertical"&&"h-full w-2.5 border-l border-l-transparent",o==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",e),...r,children:f.jsx(re,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}export{Te as S};
@@ -1 +1 @@
1
- import{l as c}from"./main-BZB1uYTH.js";const e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o=c("search",e);export{o as S};
1
+ import{l as c}from"./main-DV6oxWnU.js";const e=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],o=c("search",e);export{o as S};
@@ -0,0 +1 @@
1
+ import{l as S,t as B,r as a,u as O,a as D,j as e,R as C,v as E,L as l,w as G,X as V,C as L,S as $,b as H,c as J,d as Q,e as X,x as Z,h as K,k as W}from"./main-DV6oxWnU.js";import{u as Y}from"./usePermissions-DWBImEOW.js";import{C as M}from"./CmsPageHeader-SoF4Epu9.js";import{C as u}from"./CmsSurface-BvksBm6W.js";import{S as v}from"./switch-BTMY8Qnk.js";import{B as N}from"./badge-oJv4Eai8.js";import{A as ee,a as se}from"./alert-BAHTL6ao.js";import{u as te}from"./tanstack-adapter-f7AHmQ5L.js";const ae=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],ne=S("info",ae);const ie=[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]],le=S("monitor",ie);const ce=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],re=S("moon",ce);const de=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],oe=S("sun",de),b={versioning:!0,scheduling:!0,localization:!1,mediaManagement:!0},f={_id:null,defaultLocale:"en",availableLocales:["en","es","fr","de"],features:b},me=[{value:"en",label:"English (en)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"},{value:"it",label:"Italian (it)"},{value:"pt",label:"Portuguese (pt)"},{value:"zh",label:"Chinese (zh)"},{value:"ja",label:"Japanese (ja)"}],ue=[{value:"light",label:"Light",icon:e.jsx(oe,{className:"size-4"})},{value:"dark",label:"Dark",icon:e.jsx(re,{className:"size-4"})},{value:"system",label:"System",icon:e.jsx(le,{className:"size-4"})}];function A(){const{theme:s,setTheme:w}=Z();return e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"Appearance"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Theme"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose your preferred color theme for the admin interface."})]}),e.jsx("div",{className:"flex gap-1 rounded-lg border bg-muted/50 p-1",children:ue.map(d=>e.jsxs("button",{type:"button",onClick:()=>w(d.value),className:K("flex items-center gap-2 rounded-md px-3 py-1.5 text-sm font-medium transition-colors",s===d.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[d.icon,d.label]},d.value))})]})})]})}function xe({api:s,navigation:w}){const{canManageSettings:d}=Y(),k=d(),I=B(),o=a.useMemo(()=>s.getSettings!=null,[s]),c=O(o?s.getSettings:"skip",o?{}:"skip"),T=D(s.updateSettings??(()=>{})),z=D(s.resetSettings??(()=>{})),[r,g]=a.useState(null),[x,y]=a.useState(!1),[h,n]=a.useState("idle"),[P,j]=a.useState(null),i=a.useMemo(()=>c?{_id:c._id??null,defaultLocale:c.defaultLocale??f.defaultLocale,availableLocales:c.availableLocales??f.availableLocales,features:{...b,...c.features??{}},updatedBy:c.updatedBy,_creationTime:c._creationTime}:null,[c]);a.useEffect(()=>{i&&!r&&g(i)},[i,r]),a.useEffect(()=>{i&&!x&&g(i)},[i,x]);const F=a.useCallback(t=>{r&&(g({...r,defaultLocale:t}),y(!0),n("idle"))},[r]),R=a.useCallback(async()=>{if(!(!r||!x||!o||!s.updateSettings)){n("saving"),j(null);try{await T({defaultLocale:r.defaultLocale}),n("saved"),y(!1),setTimeout(()=>{n("idle")},3e3)}catch(t){n("error"),j(t instanceof Error?t.message:"Failed to save settings")}}},[r,x,o,s.updateSettings,T]),U=a.useCallback(async()=>{if(!(!o||!s.resetSettings||!window.confirm("Are you sure you want to reset all settings to their defaults? This action cannot be undone."))){n("saving"),j(null);try{const m=await z({});g({...f,_id:m?._id??null,defaultLocale:m?.defaultLocale??f.defaultLocale,availableLocales:m?.availableLocales??f.availableLocales,features:{...b,...m?.features??{}}}),n("saved"),y(!1),setTimeout(()=>{n("idle")},3e3)}catch(m){n("error"),j(m instanceof Error?m.message:"Failed to reset settings")}}},[o,s.resetSettings,z]),q=a.useCallback(()=>{i&&(g(i),y(!1),n("idle"),j(null))},[i]);if(!o)return e.jsx(C,{requiredPermission:{resource:"settings",action:"manage"},children:e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx(M,{title:"Settings",description:"Configure your CMS settings and preferences."}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(A,{}),e.jsxs(ee,{children:[e.jsx(ne,{className:"size-4"}),e.jsxs(se,{children:[e.jsx("strong",{children:"Settings not configured."})," To enable CMS settings, export"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"getSettings"}),","," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"updateSettings"}),", and"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"resetSettings"})," from your"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 text-xs",children:"convex/admin.ts"})," file."]})]}),e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Features"}),e.jsxs(N,{variant:"secondary",className:"gap-1",children:[e.jsx(E,{className:"size-3"}),"Default values"]})]}),e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Showing default feature flags. Configure settings in your admin API to customize."}),e.jsx("div",{className:"space-y-4",children:["versioning","scheduling","localization","mediaManagement"].map(t=>e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsx("div",{children:e.jsx(l,{className:"text-sm font-medium capitalize",children:t})}),e.jsx(v,{checked:b[t],disabled:!0})]},t))})]}),e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"API"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Convex Deployment URL"}),e.jsx("code",{className:"mt-1 block rounded-md bg-muted px-3 py-2 text-sm",children:"https://majestic-beagle-49.convex.cloud"})]})})]})]})]})});if(c===void 0)return e.jsx(C,{requiredPermission:{resource:"settings",action:"manage"},children:e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsx(M,{title:"Settings",description:"Configure your CMS settings and preferences."}),e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading settings..."})]})]})});const _=r??i??f,p=_.features??b;return e.jsx(C,{requiredPermission:{resource:"settings",action:"manage"},children:e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(M,{title:"Settings",description:"Configure your CMS settings and preferences."}),k&&s.updateSettings&&e.jsxs("div",{className:"flex items-center gap-3",children:[h==="saved"&&e.jsxs(N,{variant:"secondary",className:"gap-1 bg-diff-added-bg text-diff-added-foreground",children:[e.jsx(G,{className:"size-3"}),"Settings saved successfully"]}),h==="error"&&e.jsxs(N,{variant:"destructive",className:"gap-1",children:[e.jsx(V,{className:"size-3"}),P||"An error occurred"]}),x&&e.jsx(L,{variant:"secondary",onClick:q,disabled:h==="saving",children:"Discard Changes"}),e.jsx(L,{onClick:R,disabled:!x,loading:h==="saving",children:"Save Changes"})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsx(A,{}),p.localization&&e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"General"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Default Locale"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"The default language for new content entries."})]}),e.jsxs($,{value:_.defaultLocale,onValueChange:F,disabled:!k||h==="saving"||!s.updateSettings,children:[e.jsx(H,{className:"w-48",children:e.jsx(J,{})}),e.jsx(Q,{children:me.map(t=>e.jsx(X,{value:t.value,children:t.label},t.value))})]})]})})]}),e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Features"}),e.jsxs(N,{variant:"secondary",className:"gap-1",children:[e.jsx(E,{className:"size-3"}),"Configured in code"]})]}),e.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Feature flags are defined in your Convex configuration and cannot be changed from the UI."}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Versioning"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Track content history and enable rollback to previous versions"})]}),e.jsx(v,{checked:p.versioning,disabled:!0})]}),e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Scheduling"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Schedule content to publish at a future date and time"})]}),e.jsx(v,{checked:p.scheduling,disabled:!0})]}),e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Localization"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Support multiple languages for content entries"})]}),e.jsx(v,{checked:p.localization,disabled:!0})]}),I.navigation.showMedia&&e.jsxs("div",{className:"flex items-center justify-between opacity-75",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Media Management"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Use the built-in media library for image and file uploads"})]}),e.jsx(v,{checked:p.mediaManagement,disabled:!0})]})]})]}),e.jsxs(u,{elevation:"base",className:"p-6",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-foreground",children:"API"}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Convex Deployment URL"}),e.jsx("code",{className:"mt-1 block rounded-md bg-muted px-3 py-2 text-sm",children:"https://majestic-beagle-49.convex.cloud"})]})})]}),k&&s.resetSettings&&e.jsxs(u,{elevation:"base",className:"border-destructive/50 p-6",children:[e.jsx("h2",{className:"mb-4 text-lg font-semibold text-destructive",children:"Danger Zone"}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(l,{className:"text-sm font-medium",children:"Reset to Defaults"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Reset all settings to their default values. This cannot be undone."})]}),e.jsx(L,{variant:"danger",onClick:U,disabled:h==="saving",children:"Reset Settings"})]})]})]})]})})}function Ne(){const s=te();return e.jsx(xe,{api:W.admin,navigation:s})}export{Ne as component};
@@ -1 +1 @@
1
- import{r as s,aw as C,aF as T,j as o,ay as y,aB as I,aG as H,aH as M,aA as A,h as g}from"./main-BZB1uYTH.js";var b="Switch",[z]=A(b),[U,q]=z(b),P=s.forwardRef((e,a)=>{const{__scopeSwitch:t,name:n,checked:r,defaultChecked:m,required:d,disabled:c,value:u="on",onCheckedChange:w,form:i,...k}=e,[l,p]=s.useState(null),v=C(a,f=>p(f)),x=s.useRef(!1),S=l?i||!!l.closest("form"):!0,[h,N]=T({prop:r,defaultProp:m??!1,onChange:w,caller:b});return o.jsxs(U,{scope:t,checked:h,disabled:c,children:[o.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":_(h),"data-disabled":c?"":void 0,disabled:c,value:u,...k,ref:v,onClick:I(e.onClick,f=>{N(B=>!B),S&&(x.current=f.isPropagationStopped(),x.current||f.stopPropagation())})}),S&&o.jsx(j,{control:l,bubbles:!x.current,name:n,value:u,checked:h,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=b;var E="SwitchThumb",R=s.forwardRef((e,a)=>{const{__scopeSwitch:t,...n}=e,r=q(E,t);return o.jsx(y.span,{"data-state":_(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:a})});R.displayName=E;var F="SwitchBubbleInput",j=s.forwardRef(({__scopeSwitch:e,control:a,checked:t,bubbles:n=!0,...r},m)=>{const d=s.useRef(null),c=C(d,m),u=H(t),w=M(a);return s.useEffect(()=>{const i=d.current;if(!i)return;const k=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&p){const v=new Event("click",{bubbles:n});p.call(i,t),i.dispatchEvent(v)}},[u,t,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:c,style:{...r.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j.displayName=F;function _(e){return e?"checked":"unchecked"}var L=P,O=R;function G({className:e,...a}){return o.jsx(L,{"data-slot":"switch",className:g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...a,children:o.jsx(O,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{G as S};
1
+ import{r as s,aw as C,aF as T,j as o,ay as y,aB as I,aG as H,aH as M,aA as A,h as g}from"./main-DV6oxWnU.js";var b="Switch",[z]=A(b),[U,q]=z(b),P=s.forwardRef((e,a)=>{const{__scopeSwitch:t,name:n,checked:r,defaultChecked:m,required:d,disabled:c,value:u="on",onCheckedChange:w,form:i,...k}=e,[l,p]=s.useState(null),v=C(a,f=>p(f)),x=s.useRef(!1),S=l?i||!!l.closest("form"):!0,[h,N]=T({prop:r,defaultProp:m??!1,onChange:w,caller:b});return o.jsxs(U,{scope:t,checked:h,disabled:c,children:[o.jsx(y.button,{type:"button",role:"switch","aria-checked":h,"aria-required":d,"data-state":_(h),"data-disabled":c?"":void 0,disabled:c,value:u,...k,ref:v,onClick:I(e.onClick,f=>{N(B=>!B),S&&(x.current=f.isPropagationStopped(),x.current||f.stopPropagation())})}),S&&o.jsx(j,{control:l,bubbles:!x.current,name:n,value:u,checked:h,required:d,disabled:c,form:i,style:{transform:"translateX(-100%)"}})]})});P.displayName=b;var E="SwitchThumb",R=s.forwardRef((e,a)=>{const{__scopeSwitch:t,...n}=e,r=q(E,t);return o.jsx(y.span,{"data-state":_(r.checked),"data-disabled":r.disabled?"":void 0,...n,ref:a})});R.displayName=E;var F="SwitchBubbleInput",j=s.forwardRef(({__scopeSwitch:e,control:a,checked:t,bubbles:n=!0,...r},m)=>{const d=s.useRef(null),c=C(d,m),u=H(t),w=M(a);return s.useEffect(()=>{const i=d.current;if(!i)return;const k=window.HTMLInputElement.prototype,p=Object.getOwnPropertyDescriptor(k,"checked").set;if(u!==t&&p){const v=new Event("click",{bubbles:n});p.call(i,t),i.dispatchEvent(v)}},[u,t,n]),o.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:t,...r,tabIndex:-1,ref:c,style:{...r.style,...w,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});j.displayName=F;function _(e){return e?"checked":"unchecked"}var L=P,O=R;function G({className:e,...a}){return o.jsx(L,{"data-slot":"switch",className:g("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e),...a,children:o.jsx(O,{"data-slot":"switch-thumb",className:g("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")})})}export{G as S};
@@ -0,0 +1 @@
1
+ import{l as k,r as u,a as B,j as t,a8 as ee,C as y,h as N,X as z,w as te,ax as se,aF as re,ay as T,aI as ae,aJ as ne,aK as oe,aB as $,aL as F,aA as ie,az as ce}from"./main-DV6oxWnU.js";import{R as le}from"./refresh-cw-Cm-YOeFI.js";const de=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],_e=k("chevron-left",de);const ue=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}]],Re=k("file",ue);const pe=[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]],Ue=k("music",pe);const me=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],ge=k("upload",me);const fe=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],Ie=k("video",fe);function he(){return`${Date.now()}-${Math.random().toString(36).substring(2,9)}`}function xe(r,a=5e3){return r.type.startsWith("image/")?new Promise(s=>{const c=new Image;let l=null;const i=setTimeout(()=>{l&&URL.revokeObjectURL(l),s(void 0)},a);c.onload=()=>{clearTimeout(i),l&&URL.revokeObjectURL(l),s({width:c.naturalWidth,height:c.naturalHeight})},c.onerror=()=>{clearTimeout(i),l&&URL.revokeObjectURL(l),s(void 0)},l=URL.createObjectURL(r),c.src=l}):Promise.resolve(void 0)}function ve(r,a,s,c){return new Promise((l,i)=>{const n=new XMLHttpRequest,g=()=>{n.abort(),i(new DOMException("Upload aborted","AbortError"))};s.addEventListener("abort",g),n.upload.onprogress=h=>{if(h.lengthComputable){const x=Math.round(h.loaded/h.total*80);c(10+x)}},n.onload=()=>{if(s.removeEventListener("abort",g),n.status>=200&&n.status<300)try{const h=JSON.parse(n.responseText);l(h.storageId)}catch{i(new Error("Invalid response from upload server"))}else i(new Error(`Upload failed: ${n.statusText||`HTTP ${n.status}`}`))},n.onerror=()=>{s.removeEventListener("abort",g),i(new Error("Network error during upload"))},n.ontimeout=()=>{s.removeEventListener("abort",g),i(new Error("Upload timed out"))},n.open("POST",r),n.setRequestHeader("Content-Type",a.type),n.send(a)})}function be(r,a){switch(a.type){case"ADD_FILES":{const s=a.files.map(c=>({id:he(),file:c,status:"pending",progress:0}));return[...r,...s]}case"UPDATE_FILE":return r.map(s=>s.id===a.id?{...s,...a.updates}:s);case"RETRY_FILE":return r.map(s=>s.id===a.id?{...s,status:"pending",progress:0,error:void 0}:s);case"REMOVE_FILE":return r.filter(s=>s.id!==a.id);case"CLEAR_COMPLETED":return r.filter(s=>s.status==="pending"||s.status==="uploading");case"CLEAR_ALL":return[];case"CANCEL_FILE":return r.map(s=>s.id===a.id&&(s.status==="pending"||s.status==="uploading")?{...s,status:"cancelled",error:"Upload cancelled"}:s);case"CANCEL_ALL":return r.map(s=>s.status==="pending"||s.status==="uploading"?{...s,status:"cancelled",error:"Upload cancelled"}:s);default:return r}}function Ce(r){const{maxConcurrent:a=3,metadata:s,onComplete:c,onError:l}=r,[i,n]=u.useReducer(be,[]),g=B(r.getUploadUrl),h=B(r.createAsset),x=u.useRef(0),p=u.useRef(new Map),m=u.useRef(!1),v=u.useCallback(async o=>{const f=new AbortController;p.current.set(o.id,f),n({type:"UPDATE_FILE",id:o.id,updates:{status:"uploading",progress:0}});try{const j=await g({});n({type:"UPDATE_FILE",id:o.id,updates:{progress:5}});const e=await ve(j,o.file,f.signal,L=>{n({type:"UPDATE_FILE",id:o.id,updates:{progress:L}})});n({type:"UPDATE_FILE",id:o.id,updates:{progress:90}});const C=await xe(o.file),b=await h({storageId:e,name:o.file.name,mimeType:o.file.type,size:o.file.size,...C,...s});n({type:"UPDATE_FILE",id:o.id,updates:{status:"complete",progress:100,result:b}})}catch(j){const e=j instanceof Error?j:new Error(String(j));if(e.name==="AbortError")n({type:"UPDATE_FILE",id:o.id,updates:{status:"cancelled",error:"Upload cancelled"}});else{const C={...o,status:"error",error:e.message};n({type:"UPDATE_FILE",id:o.id,updates:{status:"error",error:e.message}}),l?.(C)}}finally{p.current.delete(o.id),x.current--}},[g,h,s,l]),d=u.useCallback(()=>{if(m.current)return;m.current=!0;const o=i.filter(f=>f.status==="pending");for(;x.current<a&&o.length>0;){const f=o.shift();x.current++,v(f)}m.current=!1,x.current===0&&i.length>0&&i.every(f=>f.status!=="pending"&&f.status!=="uploading")&&c?.(i)},[i,a,v,c]);u.useEffect(()=>{i.some(o=>o.status==="pending")&&x.current<a&&d()},[i,a,d]);const A=u.useCallback(o=>{n({type:"ADD_FILES",files:o})},[]),E=u.useCallback(o=>{const f=p.current.get(o);f&&f.abort(),n({type:"CANCEL_FILE",id:o})},[]),_=u.useCallback(()=>{p.current.forEach(o=>o.abort()),n({type:"CANCEL_ALL"})},[]),R=u.useCallback(o=>{n({type:"RETRY_FILE",id:o})},[]),U=u.useCallback(()=>{n({type:"CLEAR_COMPLETED"})},[]),I=u.useCallback(()=>{p.current.forEach(o=>o.abort()),n({type:"CLEAR_ALL"})},[]),D=i.some(o=>o.status==="uploading"),M=i.length>0?Math.round(i.reduce((o,f)=>o+f.progress,0)/i.length):0;return{files:i,addFiles:A,cancelFile:E,cancelAll:_,retryFile:R,clearCompleted:U,clearAll:I,isUploading:D,overallProgress:M}}function S(r){if(r===0)return"0 B";const a=1024,s=["B","KB","MB","GB"],c=Math.floor(Math.log(r)/Math.log(a));return`${parseFloat((r/Math.pow(a,c)).toFixed(1))} ${s[c]}`}function je(r,a){return a.length===0?!0:a.some(s=>{if(s.endsWith("/*")){const c=s.slice(0,-2);return r.startsWith(c+"/")}return r===s})}function De({onUploadComplete:r,currentFolderId:a,generateUploadUrl:s,createAsset:c,maxFileSize:l,allowedMimeTypes:i=[],maxConcurrentUploads:n=3,onError:g}){const[h,x]=u.useState(!1),[p,m]=u.useState(new Map),v=u.useRef(null),d=Ce({getUploadUrl:s,createAsset:c,maxConcurrent:n,metadata:a?{parentId:a}:void 0,onComplete:e=>{const C=e.map(b=>({filename:b.file.name,storageId:b.result?String(b.result._id||""):"",success:b.status==="complete",error:b.error}));r(C)},onError:e=>{g?.(e.error||"Upload failed",e.file.name)}}),A=u.useCallback(e=>l&&e.size>l?`File exceeds maximum size of ${S(l)}`:i.length>0&&!je(e.type,i)?`File type ${e.type||"unknown"} is not allowed`:null,[l,i]),E=u.useCallback(e=>{const C=Array.from(e),b=new Map,L=[];for(const P of C){const V=A(P);V?b.set(P.name,V):L.push(P)}m(b),L.length>0&&d.addFiles(L)},[A,d]),_=u.useCallback(e=>{e.preventDefault(),e.stopPropagation(),x(!0)},[]),R=u.useCallback(e=>{e.preventDefault(),e.stopPropagation(),x(!1)},[]),U=u.useCallback(e=>{e.preventDefault(),e.stopPropagation()},[]),I=u.useCallback(e=>{e.preventDefault(),e.stopPropagation(),x(!1),e.dataTransfer.files?.length&&E(e.dataTransfer.files)},[E]),D=u.useCallback(e=>{e.target.files?.length&&(E(e.target.files),e.target.value="")},[E]),M=e=>{switch(e){case"complete":return t.jsx(te,{className:"size-4 text-success"});case"error":case"cancelled":return t.jsx(z,{className:"size-4 text-destructive"});case"uploading":return t.jsx("div",{className:"size-4 animate-spin rounded-full border-2 border-muted border-t-primary"});default:return t.jsx("div",{className:"size-4 rounded-full border-2 border-muted"})}},o=d.files.filter(e=>e.status==="complete").length,f=d.files.filter(e=>e.status==="error"||e.status==="cancelled").length,j=o>0||f>0;return t.jsxs("div",{className:"space-y-4",children:[p.size>0&&t.jsxs("div",{className:"rounded-md border border-destructive/50 bg-destructive/10 p-3",children:[t.jsxs("div",{className:"flex items-start gap-2",children:[t.jsx(ee,{className:"mt-0.5 size-4 shrink-0 text-destructive"}),t.jsx("div",{className:"flex-1 space-y-1",children:Array.from(p.entries()).map(([e,C])=>t.jsxs("p",{className:"text-sm text-destructive",children:[t.jsxs("span",{className:"font-medium",children:[e,":"]})," ",C]},e))})]}),t.jsx(y,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>m(new Map),children:"Dismiss"})]}),!d.isUploading&&d.files.length===0&&t.jsxs("div",{className:N("flex cursor-pointer flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed p-8 text-center transition-colors",h?"border-primary bg-primary/5":"border-muted-foreground/25 hover:border-primary/50 hover:bg-muted/50"),onClick:()=>v.current?.click(),onDragEnter:_,onDragLeave:R,onDragOver:U,onDrop:I,children:[t.jsx("div",{className:"flex size-12 items-center justify-center rounded-full bg-muted",children:t.jsx(ge,{className:"size-6 text-muted-foreground"})}),t.jsxs("div",{children:[t.jsx("p",{className:"text-sm font-medium text-foreground",children:h?"Drop files here":"Drag and drop files here"}),t.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"or click to browse"})]}),t.jsxs("p",{className:"text-xs text-muted-foreground",children:["Supports images, videos, documents, and more",l&&` (max ${S(l)} per file)`]})]}),d.files.length>0&&t.jsxs("div",{className:"space-y-3",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[t.jsxs("span",{className:"font-medium",children:[d.files.length," file",d.files.length!==1?"s":""]}),d.isUploading&&t.jsxs("span",{className:"text-muted-foreground",children:[d.overallProgress,"% complete"]}),!d.isUploading&&j&&t.jsxs("div",{className:"flex items-center gap-2",children:[o>0&&t.jsxs("span",{className:"text-success",children:[o," completed"]}),f>0&&t.jsxs("span",{className:"text-destructive",children:[f," failed"]})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[!d.isUploading&&t.jsx(y,{variant:"outline",size:"sm",onClick:()=>v.current?.click(),children:"Add More"}),d.isUploading&&t.jsx(y,{variant:"outline",size:"sm",onClick:d.cancelAll,children:"Cancel All"}),j&&!d.isUploading&&t.jsx(y,{variant:"ghost",size:"sm",onClick:d.clearCompleted,children:"Clear Done"})]})]}),d.isUploading&&t.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:t.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${d.overallProgress}%`}})}),t.jsx("div",{className:"space-y-2",children:d.files.map(e=>t.jsxs("div",{className:N("flex items-center gap-3 rounded-lg border bg-card p-3",e.status==="error"&&"border-diff-removed-border bg-diff-removed-bg",e.status==="complete"&&"border-diff-added-border bg-diff-added-bg"),children:[t.jsx("div",{className:"shrink-0",children:M(e.status)}),t.jsxs("div",{className:"min-w-0 flex-1",children:[t.jsx("p",{className:"truncate text-sm font-medium",title:e.file.name,children:e.file.name}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("span",{className:"text-xs text-muted-foreground",children:S(e.file.size)}),e.error&&t.jsx("span",{className:"text-xs text-destructive",children:e.error})]})]}),e.status==="uploading"&&t.jsxs("div",{className:"flex w-20 items-center gap-2",children:[t.jsx("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-muted",children:t.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${e.progress}%`}})}),t.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.progress,"%"]})]}),t.jsxs("div",{className:"shrink-0",children:[e.status==="pending"&&!d.isUploading&&t.jsx(y,{variant:"ghost",size:"icon-sm",onClick:()=>d.cancelFile(e.id),title:"Remove",children:t.jsx(z,{className:"size-4"})}),(e.status==="uploading"||e.status==="pending")&&d.isUploading&&t.jsx(y,{variant:"ghost",size:"icon-sm",onClick:()=>d.cancelFile(e.id),title:"Cancel",children:t.jsx(z,{className:"size-4"})}),(e.status==="error"||e.status==="cancelled")&&!d.isUploading&&t.jsx(y,{variant:"ghost",size:"icon-sm",onClick:()=>d.retryFile(e.id),title:"Retry",children:t.jsx(le,{className:"size-4"})})]})]},e.id))})]}),t.jsx("input",{ref:v,type:"file",multiple:!0,onChange:D,className:"hidden",accept:i.length>0?i.join(","):void 0})]})}var w="Tabs",[ye]=ie(w,[F]),H=F(),[Ee,O]=ye(w),G=u.forwardRef((r,a)=>{const{__scopeTabs:s,value:c,onValueChange:l,defaultValue:i,orientation:n="horizontal",dir:g,activationMode:h="automatic",...x}=r,p=se(g),[m,v]=re({prop:c,onChange:l,defaultProp:i??"",caller:w});return t.jsx(Ee,{scope:s,baseId:ae(),value:m,onValueChange:v,orientation:n,dir:p,activationMode:h,children:t.jsx(T.div,{dir:p,"data-orientation":n,...x,ref:a})})});G.displayName=w;var K="TabsList",W=u.forwardRef((r,a)=>{const{__scopeTabs:s,loop:c=!0,...l}=r,i=O(K,s),n=H(s);return t.jsx(ne,{asChild:!0,...n,orientation:i.orientation,dir:i.dir,loop:c,children:t.jsx(T.div,{role:"tablist","aria-orientation":i.orientation,...l,ref:a})})});W.displayName=K;var X="TabsTrigger",J=u.forwardRef((r,a)=>{const{__scopeTabs:s,value:c,disabled:l=!1,...i}=r,n=O(X,s),g=H(s),h=Z(n.baseId,c),x=q(n.baseId,c),p=c===n.value;return t.jsx(oe,{asChild:!0,...g,focusable:!l,active:p,children:t.jsx(T.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":x,"data-state":p?"active":"inactive","data-disabled":l?"":void 0,disabled:l,id:h,...i,ref:a,onMouseDown:$(r.onMouseDown,m=>{!l&&m.button===0&&m.ctrlKey===!1?n.onValueChange(c):m.preventDefault()}),onKeyDown:$(r.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&n.onValueChange(c)}),onFocus:$(r.onFocus,()=>{const m=n.activationMode!=="manual";!p&&!l&&m&&n.onValueChange(c)})})})});J.displayName=X;var Q="TabsContent",Y=u.forwardRef((r,a)=>{const{__scopeTabs:s,value:c,forceMount:l,children:i,...n}=r,g=O(Q,s),h=Z(g.baseId,c),x=q(g.baseId,c),p=c===g.value,m=u.useRef(p);return u.useEffect(()=>{const v=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(v)},[]),t.jsx(ce,{present:l||p,children:({present:v})=>t.jsx(T.div,{"data-state":p?"active":"inactive","data-orientation":g.orientation,role:"tabpanel","aria-labelledby":h,hidden:!v,id:x,tabIndex:0,...n,ref:a,style:{...r.style,animationDuration:m.current?"0s":void 0},children:v&&i})})});Y.displayName=Q;function Z(r,a){return`${r}-trigger-${a}`}function q(r,a){return`${r}-content-${a}`}var Ne=G,Le=W,ke=J,Ae=Y;function Me({className:r,...a}){return t.jsx(Ne,{"data-slot":"tabs",className:N("flex flex-col gap-2",r),...a})}function Pe({className:r,...a}){return t.jsx(Le,{"data-slot":"tabs-list",className:N("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",r),...a})}function ze({className:r,...a}){return t.jsx(ke,{"data-slot":"tabs-trigger",className:N("data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-md border border-transparent px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",r),...a})}function $e({className:r,...a}){return t.jsx(Ae,{"data-slot":"tabs-content",className:N("flex-1 outline-none",r),...a})}export{_e as C,Re as F,Ue as M,Me as T,ge as U,Ie as V,Pe as a,ze as b,De as c,$e as d};
@@ -1 +1 @@
1
- import{ab as m,ac as y,ad as v,r as e}from"./main-BZB1uYTH.js";function b(a){return m({select:n=>n.location})}function f(){const a=y(),n=b(),s=v({strict:!1}),c=e.useCallback((t,p)=>{let o=t;if(p)for(const[g,k]of Object.entries(p))o=o.replace(`:${g}`,k).replace(`$${g}`,k);a({to:o})},[a]),r=e.useCallback(t=>{a({to:"/entries/$entryId",params:{entryId:t}})},[a]),i=e.useCallback(t=>{a({to:"/entries/type/$contentTypeId",params:{contentTypeId:t}})},[a]),l=e.useCallback(t=>{a({to:"/entries/new/$contentTypeId",params:{contentTypeId:t}})},[a]),u=e.useCallback(()=>{window.history.back()},[]);return e.useMemo(()=>({navigate:c,currentRoute:n.pathname,params:s??{},canGoBack:window.history.length>1,goBack:u,navigateToEntry:r,navigateToContentType:i,navigateToNewEntry:l}),[c,n.pathname,s,u,r,i,l])}export{f as u};
1
+ import{ac as m,ad as y,ae as v,r as e}from"./main-DV6oxWnU.js";function b(a){return m({select:n=>n.location})}function f(){const a=y(),n=b(),s=v({strict:!1}),c=e.useCallback((t,p)=>{let o=t;if(p)for(const[g,k]of Object.entries(p))o=o.replace(`:${g}`,k).replace(`$${g}`,k);a({to:o})},[a]),r=e.useCallback(t=>{a({to:"/entries/$entryId",params:{entryId:t}})},[a]),i=e.useCallback(t=>{a({to:"/entries/type/$contentTypeId",params:{contentTypeId:t}})},[a]),l=e.useCallback(t=>{a({to:"/entries/new/$contentTypeId",params:{contentTypeId:t}})},[a]),u=e.useCallback(()=>{window.history.back()},[]);return e.useMemo(()=>({navigate:c,currentRoute:n.pathname,params:s??{},canGoBack:window.history.length>1,goBack:u,navigateToEntry:r,navigateToContentType:i,navigateToNewEntry:l}),[c,n.pathname,s,u,r,i,l])}export{f as u};
@@ -0,0 +1 @@
1
+ import{l as K,r as t,a as I,k as F,j as e,m as Q,L as f,I as D,n as R,g as _,C as y,u as M,P as L,o as W,i as Z,p as X,q as Y,h as P,T as U,s as H}from"./main-DV6oxWnU.js";import{C as V}from"./CmsEmptyState-6-PLaXtD.js";import{P as G}from"./pencil-CX1CiTDD.js";import{C as ee}from"./CmsPageHeader-SoF4Epu9.js";import{C as $}from"./CmsSurface-BvksBm6W.js";import{B}from"./badge-oJv4Eai8.js";import{S as se}from"./scroll-area-b3A1HHR7.js";import{u as ae}from"./tanstack-adapter-f7AHmQ5L.js";const te=[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]],re=K("folder-tree",te);function ie({taxonomy:r,onSave:o,onCancel:c}){const x=!!r,[n,b]=t.useState({name:r?.name??"",displayName:r?.displayName??"",description:r?.description??"",isHierarchical:r?.isHierarchical??!1,allowInlineCreation:r?.allowInlineCreation??!0,isActive:r?.isActive??!0,icon:r?.icon??"",sortOrder:r?.sortOrder??0}),[m,l]=t.useState({}),[d,v]=t.useState(!1),[T,u]=t.useState(null),[S,E]=t.useState(!1),w=I(F.admin.createTaxonomy),z=I(F.admin.updateTaxonomy);t.useEffect(()=>{r&&b({name:r.name,displayName:r.displayName,description:r.description??"",isHierarchical:r.isHierarchical,allowInlineCreation:r.allowInlineCreation,isActive:r.isActive,icon:r.icon??"",sortOrder:r.sortOrder??0})},[r]);const h=t.useCallback((s,p)=>{b(C=>({...C,[s]:p})),l(C=>{const{[s]:i,...a}=C;return a})},[]),N=t.useCallback(s=>s.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),[]),A=t.useCallback(s=>{h("displayName",s),!x&&!S&&h("name",N(s))},[h,x,S,N]),j=t.useCallback(()=>{const s={};return n.name.trim()?/^[a-z][a-z0-9-]*$/.test(n.name)||(s.name="Slug must start with a letter and contain only lowercase letters, numbers, and hyphens"):s.name="Slug is required",n.displayName.trim()||(s.displayName="Display name is required"),l(s),Object.keys(s).length===0},[n]),k=t.useCallback(async s=>{if(s.preventDefault(),!!j()){v(!0),u(null);try{x&&r?await z({id:r._id,displayName:n.displayName,description:n.description||void 0,allowInlineCreation:n.allowInlineCreation,icon:n.icon||void 0,sortOrder:n.sortOrder,isActive:n.isActive}):await w({name:n.name,displayName:n.displayName,description:n.description||void 0,isHierarchical:n.isHierarchical,allowInlineCreation:n.allowInlineCreation,icon:n.icon||void 0,sortOrder:n.sortOrder}),o()}catch(p){const C=p instanceof Error?p.message:"Failed to save taxonomy";u(C)}finally{v(!1)}}},[j,x,r,n,w,z,o]);return e.jsx(Q,{open:!0,onOpenChange:s=>!s&&!d&&c(),title:x?"Edit Taxonomy":"Create Taxonomy",size:"lg",footer:e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"outline",onClick:c,disabled:d,children:"Cancel"}),e.jsx(y,{variant:"primary",onClick:k,loading:d,children:x?"Save Changes":"Create Taxonomy"})]}),children:e.jsxs("form",{onSubmit:k,className:"space-y-4",children:[T&&e.jsx("div",{className:"diff-removed rounded-lg border px-3 py-2 text-sm",children:T}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{htmlFor:"displayName",children:["Display Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(D,{id:"displayName",value:n.displayName,onChange:s=>A(s.target.value),placeholder:"e.g., Categories, Tags",disabled:d,className:m.displayName?"border-destructive":""}),m.displayName&&e.jsx("p",{className:"text-xs text-destructive",children:m.displayName})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{htmlFor:"name",children:["Slug ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(D,{id:"name",value:n.name,onChange:s=>{h("name",s.target.value.toLowerCase()),E(!0)},placeholder:"e.g., categories, tags",disabled:d||x,className:m.name?"border-destructive":""}),m.name&&e.jsx("p",{className:"text-xs text-destructive",children:m.name}),x&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Slug cannot be changed after creation"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"description",children:"Description"}),e.jsx(R,{id:"description",value:n.description,onChange:s=>h("description",s.target.value),placeholder:"Optional description",rows:2,disabled:d})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"icon",children:"Icon"}),e.jsx(D,{id:"icon",value:n.icon,onChange:s=>h("icon",s.target.value),placeholder:"e.g., 🏷️ or folder",disabled:d}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Emoji or icon name"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"sortOrder",children:"Sort Order"}),e.jsx(D,{id:"sortOrder",type:"number",value:n.sortOrder,onChange:s=>h("sortOrder",parseInt(s.target.value)||0),disabled:d})]})]}),e.jsxs("div",{className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{id:"isHierarchical",checked:n.isHierarchical,onCheckedChange:s=>h("isHierarchical",s),disabled:d||x}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"isHierarchical",className:"cursor-pointer font-medium",children:"Hierarchical"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Terms can have parent-child relationships (like categories)"}),x&&e.jsx("p",{className:"text-xs text-warning",children:"Hierarchy type cannot be changed after creation"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{id:"allowInlineCreation",checked:n.allowInlineCreation,onCheckedChange:s=>h("allowInlineCreation",s),disabled:d}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"allowInlineCreation",className:"cursor-pointer font-medium",children:"Allow inline creation"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Users can create new terms while editing content"})]})]}),e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx(_,{id:"isActive",checked:n.isActive,onCheckedChange:s=>h("isActive",s),disabled:d}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(f,{htmlFor:"isActive",className:"cursor-pointer font-medium",children:"Active"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Inactive taxonomies are hidden from content editors"})]})]})]})]})})}function ne({taxonomyId:r,isHierarchical:o,allowInlineCreation:c}){const[x,n]=t.useState(new Set),[b,m]=t.useState(null),[l,d]=t.useState(!1),[v,T]=t.useState(),[u,S]=t.useState(null),[E,w]=t.useState(null),z=o?M(F.admin.getTermsHierarchy,{taxonomyId:r}):M(F.admin.listTerms,{taxonomyId:r}),h=I(F.admin.deleteTerm),N=o?z:z?.page,A=N===void 0,j=t.useCallback(i=>{n(a=>{const g=new Set(a);return g.has(i)?g.delete(i):g.add(i),g})},[]),k=t.useCallback(i=>{T(i),m(null),d(!0)},[]),s=t.useCallback(i=>{m(i),d(!0)},[]),p=t.useCallback(async i=>{w(null);try{await h({id:i,cascade:!0}),S(null)}catch(a){const g=a instanceof Error?a.message:"Failed to delete term";w(g)}},[h]),C=(i,a=0)=>{const g=i.children&&i.children.length>0,O=x.has(i._id);return e.jsxs("div",{className:"border-b border-border/50 last:border-0",children:[e.jsxs("div",{className:P("group flex items-center gap-2 py-2 pr-2 transition-colors hover:bg-muted/50",a>0&&"border-l-2 border-muted"),style:{paddingLeft:`${a*24+8}px`},children:[o&&e.jsx("button",{type:"button",onClick:()=>j(i._id),disabled:!g,className:P("flex size-5 items-center justify-center rounded transition-colors",g?"text-muted-foreground hover:bg-muted hover:text-foreground":"invisible"),"aria-expanded":O,children:g&&(O?e.jsx(X,{className:"size-4"}):e.jsx(Y,{className:"size-4"}))}),e.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[i.color&&e.jsx("span",{className:"size-3 shrink-0 rounded-full",style:{backgroundColor:i.color}}),i.icon&&e.jsx("span",{className:"shrink-0 text-sm",children:i.icon}),e.jsx("span",{className:"truncate font-medium text-foreground",children:i.name}),e.jsxs("span",{className:"shrink-0 text-xs text-muted-foreground",children:["(",i.slug,")"]}),e.jsxs("span",{className:"ml-auto shrink-0 rounded bg-muted px-1.5 py-0.5 text-xs text-muted-foreground",children:[i.usageCount," ",i.usageCount===1?"use":"uses"]})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[o&&c&&e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>k(i._id),title:"Add child term",className:"size-7 p-0",children:e.jsx(L,{className:"size-3.5"})}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>s(i),title:"Edit term",className:"size-7 p-0",children:e.jsx(G,{className:"size-3.5"})}),e.jsx(y,{variant:"ghost",size:"sm",onClick:()=>S(i._id),title:"Delete term",className:"size-7 p-0 text-destructive hover:text-destructive",children:e.jsx(U,{className:"size-3.5"})})]})]}),o&&g&&O&&e.jsx("div",{children:i.children.map(q=>C(q,a+1))})]},i._id)};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Terms"}),e.jsxs(y,{variant:"secondary",size:"sm",onClick:()=>k(),children:[e.jsx(L,{className:"size-3.5"}),"Add Term"]})]}),E&&e.jsxs("div",{className:"diff-removed flex items-center justify-between rounded-lg border px-3 py-2 text-sm",children:[E,e.jsx("button",{type:"button",onClick:()=>w(null),className:"text-diff-removed hover:text-diff-removed-foreground",children:"×"})]}),e.jsx("div",{className:"rounded-lg border bg-card",children:A?e.jsx("div",{className:"flex items-center justify-center py-8",children:e.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-muted border-t-primary"})}):!N||N.length===0?e.jsx(V,{icon:e.jsx(W,{className:"size-8"}),title:"No terms yet",description:"Add your first term to start organizing content.",action:c?{label:"Add your first term",onClick:()=>k(),variant:"secondary"}:void 0}):e.jsx("div",{className:"divide-y divide-border/50",children:N.map(i=>C(i))})}),l&&e.jsx(le,{taxonomyId:r,term:b,parentId:v,isHierarchical:o,onSave:()=>{d(!1),m(null),T(void 0)},onCancel:()=>{d(!1),m(null),T(void 0)}}),e.jsx(Z,{open:!!u,onOpenChange:i=>!i&&S(null),title:"Delete Term",description:o?"Are you sure you want to delete this term? All child terms will also be deleted.":"Are you sure you want to delete this term?",confirmLabel:"Delete",variant:"danger",onConfirm:()=>u&&p(u)})]})}function le({taxonomyId:r,term:o,parentId:c,isHierarchical:x,onSave:n,onCancel:b}){const m=!!o,[l,d]=t.useState({name:o?.name??"",slug:o?.slug??"",description:o?.description??"",color:o?.color??"",icon:o?.icon??"",sortOrder:o?.sortOrder??0}),[v,T]=t.useState({}),[u,S]=t.useState(!1),[E,w]=t.useState(null),[z,h]=t.useState(!1),N=I(F.admin.createTerm),A=I(F.admin.updateTerm),j=t.useCallback((a,g)=>{d(O=>({...O,[a]:g})),T(O=>{const{[a]:q,...J}=O;return J})},[]),k=t.useCallback(a=>a.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),[]),s=t.useCallback(a=>{j("name",a),!m&&!z&&j("slug",k(a))},[j,m,z,k]),p=t.useCallback(()=>{const a={};return l.name.trim()||(a.name="Name is required"),l.slug.trim()?/^[a-z0-9-]+$/.test(l.slug)||(a.slug="Slug must contain only lowercase letters, numbers, and hyphens"):a.slug="Slug is required",T(a),Object.keys(a).length===0},[l]),C=t.useCallback(async a=>{if(a.preventDefault(),!!p()){S(!0),w(null);try{m&&o?await A({id:o._id,name:l.name,slug:l.slug,description:l.description||void 0,color:l.color||void 0,icon:l.icon||void 0,sortOrder:l.sortOrder}):await N({taxonomyId:r,name:l.name,slug:l.slug,description:l.description||void 0,parentId:c,color:l.color||void 0,icon:l.icon||void 0,sortOrder:l.sortOrder}),n()}catch(g){const O=g instanceof Error?g.message:"Failed to save term";w(O)}finally{S(!1)}}},[p,m,o,l,r,c,N,A,n]),i=m?"Edit Term":c?"Create Child Term":"Create Term";return e.jsx(Q,{open:!0,onOpenChange:a=>!a&&!u&&b(),title:i,size:"md",footer:e.jsxs(e.Fragment,{children:[e.jsx(y,{variant:"outline",onClick:b,disabled:u,children:"Cancel"}),e.jsx(y,{variant:"primary",onClick:C,loading:u,children:m?"Save Changes":"Create Term"})]}),children:e.jsxs("form",{onSubmit:C,className:"space-y-4",children:[E&&e.jsx("div",{className:"diff-removed rounded-lg border px-3 py-2 text-sm",children:E}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{htmlFor:"termName",children:["Name ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(D,{id:"termName",value:l.name,onChange:a=>s(a.target.value),placeholder:"e.g., Technology",disabled:u,className:v.name?"border-destructive":""}),v.name&&e.jsx("p",{className:"text-xs text-destructive",children:v.name})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs(f,{htmlFor:"termSlug",children:["Slug ",e.jsx("span",{className:"text-destructive",children:"*"})]}),e.jsx(D,{id:"termSlug",value:l.slug,onChange:a=>{j("slug",a.target.value.toLowerCase()),h(!0)},placeholder:"e.g., technology",disabled:u,className:v.slug?"border-destructive":""}),v.slug&&e.jsx("p",{className:"text-xs text-destructive",children:v.slug})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"termDescription",children:"Description"}),e.jsx(R,{id:"termDescription",value:l.description,onChange:a=>j("description",a.target.value),placeholder:"Optional description",rows:2,disabled:u})]}),e.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"termColor",children:"Color"}),e.jsx(D,{id:"termColor",type:"color",value:l.color||"#6b7280",onChange:a=>j("color",a.target.value),disabled:u,className:"h-9 p-1"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"termIcon",children:"Icon"}),e.jsx(D,{id:"termIcon",value:l.icon,onChange:a=>j("icon",a.target.value),placeholder:"e.g., 💻",disabled:u})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(f,{htmlFor:"termSortOrder",children:"Sort Order"}),e.jsx(D,{id:"termSortOrder",type:"number",value:l.sortOrder,onChange:a=>j("sortOrder",parseInt(a.target.value)||0),disabled:u})]})]})]})})}function oe({api:r,navigation:o}){const[c,x]=t.useState(null),[n,b]=t.useState(!1),[m,l]=t.useState(null),[d,v]=t.useState(null),[T,u]=t.useState(null),S=M(r.listTaxonomies,{isActive:void 0,includeDeleted:!1}),E=I(r.deleteTaxonomy),w=S?.page??[],z=S===void 0,h=t.useCallback(()=>{l(null),b(!0)},[]),N=t.useCallback(s=>{l(s),b(!0)},[]),A=t.useCallback(async s=>{u(null);try{await E({id:s}),v(null),c?._id===s&&x(null)}catch(p){const C=p instanceof Error?p.message:"Failed to delete taxonomy";u(C)}},[E,c]),j=t.useCallback(()=>{b(!1),l(null)},[]),k=s=>s.isHierarchical?e.jsx(re,{className:"size-5"}):e.jsx(H,{className:"size-5"});return e.jsxs("div",{className:"flex h-[calc(100vh-4rem)] flex-col p-6",children:[e.jsxs("div",{className:"mb-6 flex items-start justify-between",children:[e.jsx(ee,{title:"Taxonomies",description:"Manage tags, categories, and other classification systems"}),e.jsxs(y,{onClick:h,children:[e.jsx(L,{className:"size-4"}),"Create Taxonomy"]})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 gap-6",children:[e.jsx($,{elevation:"base",className:"w-80 shrink-0 overflow-hidden",children:z?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-6 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"Loading taxonomies..."})]}):w.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center p-6 text-center",children:[e.jsx(H,{className:"mb-3 size-8 text-muted-foreground"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"No taxonomies created yet."}),e.jsx(y,{variant:"secondary",className:"mt-4",onClick:h,children:"Create your first taxonomy"})]}):e.jsx(se,{className:"h-full",children:e.jsx("div",{className:"divide-y",children:w.map(s=>e.jsxs("div",{className:P("group flex cursor-pointer items-center gap-3 p-3 transition-colors hover:bg-muted/50",c?._id===s._id&&"bg-primary/5",!s.isActive&&"opacity-60"),onClick:()=>x(s),children:[e.jsx("div",{className:"flex size-9 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:k(s)}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:s.displayName}),e.jsx("p",{className:"truncate text-xs text-muted-foreground",children:s.name})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(B,{variant:"secondary",className:"text-xs font-normal",children:s.isHierarchical?"Hierarchical":"Flat"}),!s.isActive&&e.jsx(B,{variant:"outline",className:"text-xs font-normal",children:"Inactive"})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[e.jsx(y,{variant:"ghost",size:"icon-sm",onClick:p=>{p.stopPropagation(),N(s)},title:"Edit taxonomy",children:e.jsx(G,{className:"size-4"})}),e.jsx(y,{variant:"ghost",size:"icon-sm",onClick:p=>{p.stopPropagation(),v(s._id)},title:"Delete taxonomy",className:"text-destructive hover:bg-destructive/10 hover:text-destructive",children:e.jsx(U,{className:"size-4"})})]})]},s._id))})})}),e.jsx($,{elevation:"base",className:"min-w-0 flex-1 overflow-hidden",children:c?e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"flex items-start justify-between border-b p-4",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"flex size-10 items-center justify-center rounded-md bg-muted text-muted-foreground",children:k(c)}),e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-semibold text-foreground",children:c.displayName}),c.description&&e.jsx("p",{className:"text-sm text-muted-foreground",children:c.description})]})]}),e.jsx(y,{variant:"secondary",onClick:()=>N(c),children:"Edit Taxonomy"})]}),e.jsx("div",{className:"flex-1 overflow-auto p-4",children:e.jsx(ne,{taxonomyId:c._id,isHierarchical:c.isHierarchical,allowInlineCreation:c.allowInlineCreation})})]}):e.jsx(V,{icon:e.jsx(H,{className:"size-6"}),title:"Select a taxonomy",description:"Select a taxonomy to view and manage its terms",className:"h-full"})})]}),n&&e.jsx(ie,{taxonomy:m,onSave:j,onCancel:()=>{b(!1),l(null)}}),e.jsx(Z,{open:d!==null,onOpenChange:s=>{s||(v(null),u(null))},title:"Delete Taxonomy",description:"Are you sure you want to delete this taxonomy? All associated terms will also be deleted.",confirmLabel:"Delete",onConfirm:()=>d&&A(d),variant:"danger",error:T})]})}function ve(){const r=ae();return e.jsx(oe,{api:F.admin,navigation:r})}export{ve as component};
@@ -1 +1 @@
1
- import{r as a,u as m,a as E,j as e,C as c,T as D,I as Y,S as Z,b as ee,c as se,d as te,e as I,f as A,X as R,g as _,h as ae,i as ne,k as re}from"./main-BZB1uYTH.js";import{C as le}from"./CmsPageHeader-DU9fD34s.js";import{C as oe}from"./CmsToolbar-5S8FQrSx.js";import{C as ie}from"./CmsEmptyState-CXVkI3FZ.js";import{C as Q}from"./CmsSurface-DF7OcKg_.js";import{B as ce}from"./badge-DdM8Eua8.js";import{A as L,a as B}from"./alert-BbW1Q9CR.js";import{S as de}from"./search-CYMIpd39.js";import{R as M}from"./rotate-ccw-BWblSIsl.js";import{u as me}from"./tanstack-adapter-DQcKErwf.js";function xe({api:l,navigation:ue}){const[g,F]=a.useState(""),[j,O]=a.useState(""),[r,i]=a.useState(new Set),[y,x]=a.useState(null),[N,C]=a.useState(!1),[P,u]=a.useState(!1),[b,v]=a.useState(!1),[S,h]=a.useState(null),T=m(l.listTrash,{contentTypeId:g||void 0,search:j||void 0,paginationOpts:{numItems:50,cursor:null}}),U=m(l.getTrashConfig,{}),V=m(l.getTrashStats,{}),H=m(l.listContentTypes,{})?.page??[],w=E(l.bulkRestore),k=E(l.emptyTrash),o=T?.page??[],X=T===void 0,p=U,f=V,$=a.useCallback((s,t)=>{i(n=>{const d=new Set(n);return t?d.add(s):d.delete(s),d})},[]),q=a.useCallback(()=>{r.size===o.length?i(new Set):i(new Set(o.map(s=>s._id)))},[r.size,o]),z=a.useCallback(async s=>{C(!0),x(null);try{await w({ids:s}),i(t=>{const n=new Set(t);return s.forEach(d=>n.delete(d)),n})}catch(t){const n=t instanceof Error?t.message:"Failed to restore";x(n)}finally{C(!1)}},[w]),G=a.useCallback(async()=>{v(!0),h(null);try{await k({}),u(!1),i(new Set)}catch(s){const t=s instanceof Error?s.message:"Failed to empty trash";h(t)}finally{v(!1)}},[k]),J=s=>new Date(s).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),K=s=>{if(!p?.retentionDays)return null;const t=s+p.retentionDays*24*60*60*1e3,n=Math.ceil((t-Date.now())/(1440*60*1e3));return Math.max(0,n)},W=s=>{if(s.title)return s.title;if(s.name)return s.name;if(s.data){const t=s.data.title||s.data.name;if(t&&typeof t=="string")return t}return s.slug||s._id};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(le,{title:"Trash",description:`Deleted items are kept for ${p?.retentionDays??30} days before permanent deletion`}),o.length>0&&e.jsxs(c,{variant:"danger",onClick:()=>u(!0),children:[e.jsx(D,{className:"size-4"}),"Empty Trash"]})]}),f&&e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs(Q,{elevation:"base",className:"p-4",children:[e.jsx("p",{className:"text-2xl font-semibold text-foreground",children:f.totalCount??0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Items in Trash"})]}),e.jsxs(Q,{elevation:"base",className:"p-4",children:[e.jsx("p",{className:"text-2xl font-semibold text-foreground",children:f.expiredCount??0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Expired"})]})]}),e.jsx(oe,{left:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(de,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Y,{type:"text",placeholder:"Search deleted items...",value:j,onChange:s=>O(s.target.value),className:"w-64 pl-9"})]}),e.jsxs(Z,{value:g||"all",onValueChange:s=>F(s==="all"?"":s),children:[e.jsx(ee,{className:"w-48",children:e.jsx(se,{placeholder:"All Content Types"})}),e.jsxs(te,{children:[e.jsx(I,{value:"all",children:"All Content Types"}),H.map(s=>e.jsx(I,{value:s._id,children:s.displayName},s._id))]})]})]})}),y&&e.jsxs(L,{variant:"destructive",children:[e.jsx(A,{className:"size-4"}),e.jsxs(B,{className:"flex items-center justify-between",children:[y,e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>x(null),children:e.jsx(R,{className:"size-4"})})]})]}),S&&e.jsxs(L,{variant:"destructive",children:[e.jsx(A,{className:"size-4"}),e.jsxs(B,{className:"flex items-center justify-between",children:[S,e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>h(null),children:e.jsx(R,{className:"size-4"})})]})]}),r.size>0&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-primary/20 bg-primary/5 p-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[r.size," ",r.size===1?"item":"items"," ","selected"]}),e.jsxs(c,{variant:"primary",size:"sm",onClick:()=>z(Array.from(r)),loading:N,children:[e.jsx(M,{className:"size-4"}),"Restore Selected"]}),e.jsx(c,{variant:"secondary",size:"sm",onClick:()=>i(new Set),children:"Clear Selection"})]}),X?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading trash..."})]}):o.length===0?e.jsx(ie,{icon:e.jsx(D,{className:"size-6"}),title:"Trash is empty",description:"Deleted items will appear here"}):e.jsx("div",{className:"rounded-lg border bg-card",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"w-10 p-3 text-left",children:e.jsx(_,{checked:r.size===o.length&&o.length>0,onCheckedChange:q})}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Name"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Type"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Deleted"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Expires In"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:o.map(s=>{const t=K(s.deletedAt);return e.jsxs("tr",{className:ae("border-b last:border-0 transition-colors hover:bg-muted/50",r.has(s._id)&&"bg-primary/5"),children:[e.jsx("td",{className:"p-3",children:e.jsx(_,{checked:r.has(s._id),onCheckedChange:n=>$(s._id,n)})}),e.jsxs("td",{className:"p-3",children:[e.jsx("span",{className:"font-medium text-foreground",children:W(s)}),s.slug&&e.jsx("span",{className:"block text-xs text-muted-foreground",children:s.slug})]}),e.jsx("td",{className:"p-3 text-sm text-muted-foreground",children:s.contentTypeName||"Unknown"}),e.jsxs("td",{className:"p-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:J(s.deletedAt)}),s.deletedBy&&e.jsxs("span",{className:"block text-xs text-muted-foreground",children:["by ",s.deletedBy]})]}),e.jsx("td",{className:"p-3",children:t!==null&&e.jsxs(ce,{variant:t<=3?"destructive":"secondary",className:"font-normal",children:[t," ",t===1?"day":"days"]})}),e.jsx("td",{className:"p-3",children:e.jsxs(c,{variant:"outline",size:"sm",onClick:()=>z([s._id]),loading:N,children:[e.jsx(M,{className:"size-4"}),"Restore"]})})]},s._id)})})]})}),e.jsx(ne,{open:P,onOpenChange:u,title:"Empty Trash",description:"This will permanently delete all items in the trash. This action cannot be undone.",confirmLabel:b?"Deleting...":"Empty Trash",onConfirm:G,variant:"danger",loading:b})]})}function Te(){const l=me();return e.jsx(xe,{api:re.admin,navigation:l})}export{Te as component};
1
+ import{r as a,u as m,a as E,j as e,C as c,T as D,I as Y,S as Z,b as ee,c as se,d as te,e as I,f as A,X as R,g as _,h as ae,i as ne,k as re}from"./main-DV6oxWnU.js";import{C as le}from"./CmsPageHeader-SoF4Epu9.js";import{C as oe}from"./CmsToolbar-DlZPMe2B.js";import{C as ie}from"./CmsEmptyState-6-PLaXtD.js";import{C as Q}from"./CmsSurface-BvksBm6W.js";import{B as ce}from"./badge-oJv4Eai8.js";import{A as L,a as B}from"./alert-BAHTL6ao.js";import{S as de}from"./search-DKKh_DdH.js";import{R as M}from"./rotate-ccw-B45JsL5f.js";import{u as me}from"./tanstack-adapter-f7AHmQ5L.js";function xe({api:l,navigation:ue}){const[g,F]=a.useState(""),[j,O]=a.useState(""),[r,i]=a.useState(new Set),[y,x]=a.useState(null),[N,C]=a.useState(!1),[P,u]=a.useState(!1),[b,v]=a.useState(!1),[S,h]=a.useState(null),T=m(l.listTrash,{contentTypeId:g||void 0,search:j||void 0,paginationOpts:{numItems:50,cursor:null}}),U=m(l.getTrashConfig,{}),V=m(l.getTrashStats,{}),H=m(l.listContentTypes,{})?.page??[],w=E(l.bulkRestore),k=E(l.emptyTrash),o=T?.page??[],X=T===void 0,p=U,f=V,$=a.useCallback((s,t)=>{i(n=>{const d=new Set(n);return t?d.add(s):d.delete(s),d})},[]),q=a.useCallback(()=>{r.size===o.length?i(new Set):i(new Set(o.map(s=>s._id)))},[r.size,o]),z=a.useCallback(async s=>{C(!0),x(null);try{await w({ids:s}),i(t=>{const n=new Set(t);return s.forEach(d=>n.delete(d)),n})}catch(t){const n=t instanceof Error?t.message:"Failed to restore";x(n)}finally{C(!1)}},[w]),G=a.useCallback(async()=>{v(!0),h(null);try{await k({}),u(!1),i(new Set)}catch(s){const t=s instanceof Error?s.message:"Failed to empty trash";h(t)}finally{v(!1)}},[k]),J=s=>new Date(s).toLocaleString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}),K=s=>{if(!p?.retentionDays)return null;const t=s+p.retentionDays*24*60*60*1e3,n=Math.ceil((t-Date.now())/(1440*60*1e3));return Math.max(0,n)},W=s=>{if(s.title)return s.title;if(s.name)return s.name;if(s.data){const t=s.data.title||s.data.name;if(t&&typeof t=="string")return t}return s.slug||s._id};return e.jsxs("div",{className:"space-y-6 p-6",children:[e.jsxs("div",{className:"flex items-start justify-between",children:[e.jsx(le,{title:"Trash",description:`Deleted items are kept for ${p?.retentionDays??30} days before permanent deletion`}),o.length>0&&e.jsxs(c,{variant:"danger",onClick:()=>u(!0),children:[e.jsx(D,{className:"size-4"}),"Empty Trash"]})]}),f&&e.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[e.jsxs(Q,{elevation:"base",className:"p-4",children:[e.jsx("p",{className:"text-2xl font-semibold text-foreground",children:f.totalCount??0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Items in Trash"})]}),e.jsxs(Q,{elevation:"base",className:"p-4",children:[e.jsx("p",{className:"text-2xl font-semibold text-foreground",children:f.expiredCount??0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Expired"})]})]}),e.jsx(oe,{left:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs("div",{className:"relative",children:[e.jsx(de,{className:"absolute left-3 top-1/2 size-4 -translate-y-1/2 text-muted-foreground"}),e.jsx(Y,{type:"text",placeholder:"Search deleted items...",value:j,onChange:s=>O(s.target.value),className:"w-64 pl-9"})]}),e.jsxs(Z,{value:g||"all",onValueChange:s=>F(s==="all"?"":s),children:[e.jsx(ee,{className:"w-48",children:e.jsx(se,{placeholder:"All Content Types"})}),e.jsxs(te,{children:[e.jsx(I,{value:"all",children:"All Content Types"}),H.map(s=>e.jsx(I,{value:s._id,children:s.displayName},s._id))]})]})]})}),y&&e.jsxs(L,{variant:"destructive",children:[e.jsx(A,{className:"size-4"}),e.jsxs(B,{className:"flex items-center justify-between",children:[y,e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>x(null),children:e.jsx(R,{className:"size-4"})})]})]}),S&&e.jsxs(L,{variant:"destructive",children:[e.jsx(A,{className:"size-4"}),e.jsxs(B,{className:"flex items-center justify-between",children:[S,e.jsx(c,{variant:"ghost",size:"icon-sm",onClick:()=>h(null),children:e.jsx(R,{className:"size-4"})})]})]}),r.size>0&&e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-primary/20 bg-primary/5 p-3",children:[e.jsxs("span",{className:"text-sm font-medium",children:[r.size," ",r.size===1?"item":"items"," ","selected"]}),e.jsxs(c,{variant:"primary",size:"sm",onClick:()=>z(Array.from(r)),loading:N,children:[e.jsx(M,{className:"size-4"}),"Restore Selected"]}),e.jsx(c,{variant:"secondary",size:"sm",onClick:()=>i(new Set),children:"Clear Selection"})]}),X?e.jsxs("div",{className:"flex flex-col items-center justify-center py-12",children:[e.jsx("div",{className:"size-8 animate-spin rounded-full border-2 border-muted border-t-primary"}),e.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"Loading trash..."})]}):o.length===0?e.jsx(ie,{icon:e.jsx(D,{className:"size-6"}),title:"Trash is empty",description:"Deleted items will appear here"}):e.jsx("div",{className:"rounded-lg border bg-card",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b",children:[e.jsx("th",{className:"w-10 p-3 text-left",children:e.jsx(_,{checked:r.size===o.length&&o.length>0,onCheckedChange:q})}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Name"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Type"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Deleted"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Expires In"}),e.jsx("th",{className:"p-3 text-left text-sm font-medium text-muted-foreground",children:"Actions"})]})}),e.jsx("tbody",{children:o.map(s=>{const t=K(s.deletedAt);return e.jsxs("tr",{className:ae("border-b last:border-0 transition-colors hover:bg-muted/50",r.has(s._id)&&"bg-primary/5"),children:[e.jsx("td",{className:"p-3",children:e.jsx(_,{checked:r.has(s._id),onCheckedChange:n=>$(s._id,n)})}),e.jsxs("td",{className:"p-3",children:[e.jsx("span",{className:"font-medium text-foreground",children:W(s)}),s.slug&&e.jsx("span",{className:"block text-xs text-muted-foreground",children:s.slug})]}),e.jsx("td",{className:"p-3 text-sm text-muted-foreground",children:s.contentTypeName||"Unknown"}),e.jsxs("td",{className:"p-3",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:J(s.deletedAt)}),s.deletedBy&&e.jsxs("span",{className:"block text-xs text-muted-foreground",children:["by ",s.deletedBy]})]}),e.jsx("td",{className:"p-3",children:t!==null&&e.jsxs(ce,{variant:t<=3?"destructive":"secondary",className:"font-normal",children:[t," ",t===1?"day":"days"]})}),e.jsx("td",{className:"p-3",children:e.jsxs(c,{variant:"outline",size:"sm",onClick:()=>z([s._id]),loading:N,children:[e.jsx(M,{className:"size-4"}),"Restore"]})})]},s._id)})})]})}),e.jsx(ne,{open:P,onOpenChange:u,title:"Empty Trash",description:"This will permanently delete all items in the trash. This action cannot be undone.",confirmLabel:b?"Deleting...":"Empty Trash",onConfirm:G,variant:"danger",loading:b})]})}function Te(){const l=me();return e.jsx(xe,{api:re.admin,navigation:l})}export{Te as component};
@@ -1 +1 @@
1
- import{aM as u,r as c}from"./main-BZB1uYTH.js";function a(r,e){const{setOverride:s,clearOverride:t}=u();c.useEffect(()=>(e&&s(r,e),()=>{t(r)}),[r,e,s,t])}export{a as u};
1
+ import{aM as u,r as c}from"./main-DV6oxWnU.js";function a(r,e){const{setOverride:s,clearOverride:t}=u();c.useEffect(()=>(e&&s(r,e),()=>{t(r)}),[r,e,s,t])}export{a as u};
@@ -1 +1 @@
1
- import{al as c,r as o,am as i,an as u,ao as d}from"./main-BZB1uYTH.js";function C(){const{role:n}=c();return o.useMemo(()=>{const r=!!n,t=(e,s,a)=>n?d(n,{resource:e,action:s,scope:a}):!1;return{role:n,hasRole:r,check:t,canAccess:e=>n?u(n,e):!1,canCreate:e=>t(e,"create"),canRead:(e,s)=>t(e,"read",s),canUpdate:(e,s)=>t(e,"update",s),canDelete:(e,s)=>t(e,"delete",s),canPublish:e=>t("contentEntries","publish",e),canUnpublish:e=>t("contentEntries","unpublish",e),canManageSettings:()=>t("settings","manage"),canManageContentTypes:()=>t("contentTypes","create")||t("contentTypes","update")||t("contentTypes","delete"),getPermissions:e=>n?i(n,e):[],isAdmin:n==="admin",isEditor:n==="admin"||n==="editor",isAuthor:n==="admin"||n==="editor"||n==="author"}},[n])}export{C as u};
1
+ import{am as c,r as o,an as i,ao as u,ap as d}from"./main-DV6oxWnU.js";function C(){const{role:n}=c();return o.useMemo(()=>{const r=!!n,t=(e,s,a)=>n?d(n,{resource:e,action:s,scope:a}):!1;return{role:n,hasRole:r,check:t,canAccess:e=>n?u(n,e):!1,canCreate:e=>t(e,"create"),canRead:(e,s)=>t(e,"read",s),canUpdate:(e,s)=>t(e,"update",s),canDelete:(e,s)=>t(e,"delete",s),canPublish:e=>t("contentEntries","publish",e),canUnpublish:e=>t("contentEntries","unpublish",e),canManageSettings:()=>t("settings","manage"),canManageContentTypes:()=>t("contentTypes","create")||t("contentTypes","update")||t("contentTypes","delete"),getPermissions:e=>n?i(n,e):[],isAdmin:n==="admin",isEditor:n==="admin"||n==="editor",isAuthor:n==="admin"||n==="editor"||n==="author"}},[n])}export{C as u};
@@ -75,25 +75,25 @@ const createLucideIcon = (iconName, iconNode) => {
75
75
  Component.displayName = toPascalCase(iconName);
76
76
  return Component;
77
77
  };
78
- const __iconNode$1m = [
78
+ const __iconNode$1n = [
79
79
  ["rect", { width: "20", height: "5", x: "2", y: "3", rx: "1", key: "1wp1u1" }],
80
80
  ["path", { d: "M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8", key: "1s80jp" }],
81
81
  ["path", { d: "M10 12h4", key: "a56b0p" }]
82
82
  ];
83
- const Archive = createLucideIcon("archive", __iconNode$1m);
84
- const __iconNode$1l = [
83
+ const Archive = createLucideIcon("archive", __iconNode$1n);
84
+ const __iconNode$1m = [
85
85
  ["path", { d: "M5 12h14", key: "1ays0h" }],
86
86
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
87
87
  ];
88
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$1l);
89
- const __iconNode$1k = [
88
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$1m);
89
+ const __iconNode$1l = [
90
90
  ["path", { d: "m21 16-4 4-4-4", key: "f6ql7i" }],
91
91
  ["path", { d: "M17 20V4", key: "1ejh1v" }],
92
92
  ["path", { d: "m3 8 4-4 4 4", key: "11wl7u" }],
93
93
  ["path", { d: "M7 4v16", key: "1glfcx" }]
94
94
  ];
95
- const ArrowUpDown = createLucideIcon("arrow-up-down", __iconNode$1k);
96
- const __iconNode$1j = [
95
+ const ArrowUpDown = createLucideIcon("arrow-up-down", __iconNode$1l);
96
+ const __iconNode$1k = [
97
97
  ["path", { d: "M10.268 21a2 2 0 0 0 3.464 0", key: "vwvbt9" }],
98
98
  [
99
99
  "path",
@@ -103,15 +103,15 @@ const __iconNode$1j = [
103
103
  }
104
104
  ]
105
105
  ];
106
- const Bell = createLucideIcon("bell", __iconNode$1j);
107
- const __iconNode$1i = [
106
+ const Bell = createLucideIcon("bell", __iconNode$1k);
107
+ const __iconNode$1j = [
108
108
  [
109
109
  "path",
110
110
  { d: "M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8", key: "mg9rjx" }
111
111
  ]
112
112
  ];
113
- const Bold = createLucideIcon("bold", __iconNode$1i);
114
- const __iconNode$1h = [
113
+ const Bold = createLucideIcon("bold", __iconNode$1j);
114
+ const __iconNode$1i = [
115
115
  [
116
116
  "path",
117
117
  {
@@ -120,8 +120,8 @@ const __iconNode$1h = [
120
120
  }
121
121
  ]
122
122
  ];
123
- const Book = createLucideIcon("book", __iconNode$1h);
124
- const __iconNode$1g = [
123
+ const Book = createLucideIcon("book", __iconNode$1i);
124
+ const __iconNode$1h = [
125
125
  [
126
126
  "path",
127
127
  {
@@ -130,8 +130,8 @@ const __iconNode$1g = [
130
130
  }
131
131
  ]
132
132
  ];
133
- const Bookmark = createLucideIcon("bookmark", __iconNode$1g);
134
- const __iconNode$1f = [
133
+ const Bookmark = createLucideIcon("bookmark", __iconNode$1h);
134
+ const __iconNode$1g = [
135
135
  [
136
136
  "path",
137
137
  { d: "M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1", key: "ezmyqa" }
@@ -144,41 +144,47 @@ const __iconNode$1f = [
144
144
  }
145
145
  ]
146
146
  ];
147
- const Braces = createLucideIcon("braces", __iconNode$1f);
148
- const __iconNode$1e = [
147
+ const Braces = createLucideIcon("braces", __iconNode$1g);
148
+ const __iconNode$1f = [
149
149
  ["path", { d: "M8 2v4", key: "1cmpym" }],
150
150
  ["path", { d: "M16 2v4", key: "4m81vk" }],
151
151
  ["rect", { width: "18", height: "18", x: "3", y: "4", rx: "2", key: "1hopcy" }],
152
152
  ["path", { d: "M3 10h18", key: "8toen8" }]
153
153
  ];
154
- const Calendar = createLucideIcon("calendar", __iconNode$1e);
155
- const __iconNode$1d = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
156
- const Check = createLucideIcon("check", __iconNode$1d);
157
- const __iconNode$1c = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
158
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$1c);
159
- const __iconNode$1b = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
160
- const ChevronLeft = createLucideIcon("chevron-left", __iconNode$1b);
161
- const __iconNode$1a = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
162
- const ChevronRight = createLucideIcon("chevron-right", __iconNode$1a);
163
- const __iconNode$19 = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
164
- const ChevronUp = createLucideIcon("chevron-up", __iconNode$19);
165
- const __iconNode$18 = [
154
+ const Calendar = createLucideIcon("calendar", __iconNode$1f);
155
+ const __iconNode$1e = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
156
+ const Check = createLucideIcon("check", __iconNode$1e);
157
+ const __iconNode$1d = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
158
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$1d);
159
+ const __iconNode$1c = [["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]];
160
+ const ChevronLeft = createLucideIcon("chevron-left", __iconNode$1c);
161
+ const __iconNode$1b = [["path", { d: "m9 18 6-6-6-6", key: "mthhwq" }]];
162
+ const ChevronRight = createLucideIcon("chevron-right", __iconNode$1b);
163
+ const __iconNode$1a = [["path", { d: "m18 15-6-6-6 6", key: "153udz" }]];
164
+ const ChevronUp = createLucideIcon("chevron-up", __iconNode$1a);
165
+ const __iconNode$19 = [
166
166
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
167
167
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
168
168
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
169
169
  ];
170
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$18);
171
- const __iconNode$17 = [
170
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$19);
171
+ const __iconNode$18 = [
172
172
  ["path", { d: "M21.801 10A10 10 0 1 1 17 3.335", key: "yps3ct" }],
173
173
  ["path", { d: "m9 11 3 3L22 4", key: "1pflzl" }]
174
174
  ];
175
- const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$17);
176
- const __iconNode$16 = [
175
+ const CircleCheckBig = createLucideIcon("circle-check-big", __iconNode$18);
176
+ const __iconNode$17 = [
177
177
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
178
178
  ["path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3", key: "1u773s" }],
179
179
  ["path", { d: "M12 17h.01", key: "p32p05" }]
180
180
  ];
181
- const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$16);
181
+ const CircleQuestionMark = createLucideIcon("circle-question-mark", __iconNode$17);
182
+ const __iconNode$16 = [
183
+ ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
184
+ ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
185
+ ["path", { d: "m9 9 6 6", key: "z0biqf" }]
186
+ ];
187
+ const CircleX = createLucideIcon("circle-x", __iconNode$16);
182
188
  const __iconNode$15 = [
183
189
  ["path", { d: "M12 6v6l4 2", key: "mmk7yg" }],
184
190
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }]
@@ -826,16 +832,17 @@ export {
826
832
  Grid3x3 as ak,
827
833
  CircleCheckBig as al,
828
834
  TrendingUp as am,
829
- ArrowUpDown as an,
835
+ CircleX as an,
830
836
  RefreshCw as ao,
831
- History as ap,
832
- GitCompare as aq,
833
- ArrowRight as ar,
834
- Bold as as,
835
- Italic as at,
836
- Heading2 as au,
837
- Quote as av,
838
- Minus as aw,
837
+ ArrowUpDown as ap,
838
+ History as aq,
839
+ GitCompare as ar,
840
+ ArrowRight as as,
841
+ Bold as at,
842
+ Italic as au,
843
+ Heading2 as av,
844
+ Quote as aw,
845
+ Minus as ax,
839
846
  Book as b,
840
847
  Code as c,
841
848
  ChevronDown as d,