@blinkk/root-cms 3.1.5 → 3.1.7

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 (120) hide show
  1. package/dist/app.js +1 -1
  2. package/dist/{chunk-MUXSUGFF.js → chunk-NIBAHWGP.js} +2 -2
  3. package/dist/{chunk-ETHWZSNM.js → chunk-PLSNGCYU.js} +196 -22
  4. package/dist/{chunk-6CTCV2PN.js → chunk-Z2CTQVYR.js} +1 -1
  5. package/dist/cli.js +1 -1
  6. package/dist/client.js +1 -1
  7. package/dist/core/client.d.ts +30 -2
  8. package/dist/core/cron-schedule.d.ts +63 -0
  9. package/dist/core/plugin.d.ts +6 -1
  10. package/dist/core.js +1 -1
  11. package/dist/functions.js +2 -2
  12. package/dist/plugin.js +7 -5
  13. package/dist/richtext.js +1 -1
  14. package/dist/shared/embed-protocol.d.ts +19 -0
  15. package/dist/ui/AIPage-XPE7F5AF.js +1 -0
  16. package/dist/ui/AssetsPage-C3ZEENBO.js +1 -0
  17. package/dist/ui/CollectionPage-VQ4WJHJB.js +1 -0
  18. package/dist/ui/ComparePage-VKOXKID4.js +1 -0
  19. package/dist/ui/{DataPage-RFNGSDDN.js → DataPage-JXZ2Z3DG.js} +1 -1
  20. package/dist/ui/{DataSourcePage-U46CDIH2.js → DataSourcePage-X3NSUOTP.js} +1 -1
  21. package/dist/ui/{DocTranslationsPage-BFCM2PE3.js → DocTranslationsPage-AJGT52XQ.js} +1 -1
  22. package/dist/ui/DocumentPage-ZFD2KE3A.js +1 -0
  23. package/dist/ui/{EditDataSourcePage-NKKIF6AD.js → EditDataSourcePage-EMK3F6HD.js} +1 -1
  24. package/dist/ui/EditReleasePage-3IAERDSH.js +1 -0
  25. package/dist/ui/EmbeddedAIPage-2W5F7QFL.js +1 -0
  26. package/dist/ui/{EmbeddedDocumentPage-2CNQJTW5.js → EmbeddedDocumentPage-BESFW2YZ.js} +1 -1
  27. package/dist/ui/{ImageEditorDialog-YDKOGVJV.js → ImageEditorDialog-JDXMU2FC.js} +1 -1
  28. package/dist/ui/LogsPage-KCD4XZ2N.js +1 -0
  29. package/dist/ui/NewDataSourcePage-EZDU7HGA.js +1 -0
  30. package/dist/ui/NewReleasePage-FFTRUIP4.js +1 -0
  31. package/dist/ui/{NotFoundPage-JRYFUENW.js → NotFoundPage-JGG2NTUE.js} +1 -1
  32. package/dist/ui/{ProjectPage-2WIMWCSX.js → ProjectPage-HT5JKR33.js} +1 -1
  33. package/dist/ui/ReleasePage-OYWLGV4D.js +1 -0
  34. package/dist/ui/{ReleasesPage-AW6PICTQ.js → ReleasesPage-XEII7FBC.js} +1 -1
  35. package/dist/ui/{SettingsPage-KFLNZ356.js → SettingsPage-7GIBTPB5.js} +1 -1
  36. package/dist/ui/SidebarToolsPage-GQYTZDAC.js +1 -0
  37. package/dist/ui/{TaskPage-GZGPKIL5.js → TaskPage-SNDDYDZY.js} +1 -1
  38. package/dist/ui/TasksPage-CEVWOY67.js +1 -0
  39. package/dist/ui/{TranslationsArbPage-K272JEAA.js → TranslationsArbPage-ADRLLAIW.js} +1 -1
  40. package/dist/ui/{TranslationsEditPage-XWXPNKRQ.js → TranslationsEditPage-PSKA7K44.js} +1 -1
  41. package/dist/ui/{TranslationsPage-7KUHVTLK.js → TranslationsPage-NGCLDSK7.js} +2 -2
  42. package/dist/ui/{chunk-75NMQ3LW.js → chunk-3YBRRPAN.js} +1 -1
  43. package/dist/ui/{chunk-QLIIVG5Q.js → chunk-5F5XJPKD.js} +1 -1
  44. package/dist/ui/{chunk-7UHZS56B.js → chunk-6ZVMJXLE.js} +53 -53
  45. package/dist/ui/chunk-7OU4ERTS.js +87 -0
  46. package/dist/ui/chunk-A2JZYRE3.js +1 -0
  47. package/dist/ui/chunk-B74M7NEV.js +1 -0
  48. package/dist/ui/chunk-BLHXP3SR.js +3 -0
  49. package/dist/ui/{chunk-UJX25CXD.js → chunk-BOIY4J2R.js} +1 -1
  50. package/dist/ui/chunk-CEWU5VSJ.js +1 -0
  51. package/dist/ui/{chunk-34W6H4YG.js → chunk-CXMVFNX3.js} +1 -1
  52. package/dist/ui/{chunk-F7RQT4XN.js → chunk-EET5AS64.js} +1 -1
  53. package/dist/ui/{chunk-WASID5UU.js → chunk-GJ7ES2LA.js} +1 -1
  54. package/dist/ui/{chunk-2RRM4HEQ.js → chunk-H5JL376P.js} +1 -1
  55. package/dist/ui/{chunk-H37RXS4R.js → chunk-HKCOKHA2.js} +1 -1
  56. package/dist/ui/{chunk-5KSGCGYY.js → chunk-HUYP5U4K.js} +1 -1
  57. package/dist/ui/{chunk-NCZD5IWS.js → chunk-HWON6MV4.js} +1 -1
  58. package/dist/ui/{chunk-HXSB6YB2.js → chunk-I3H465Z6.js} +1 -1
  59. package/dist/ui/{chunk-535JU7FU.js → chunk-ILFWJKSS.js} +1 -1
  60. package/dist/ui/chunk-K7IG7PO2.js +1 -0
  61. package/dist/ui/chunk-LKTN7YVM.js +31 -0
  62. package/dist/ui/{chunk-PLYSJ7W5.js → chunk-LS2JH5QF.js} +1 -1
  63. package/dist/ui/{chunk-QFDU6FXP.js → chunk-MALK5YEV.js} +1 -1
  64. package/dist/ui/{chunk-YP6ZH3MT.js → chunk-MFRPYPCF.js} +1 -1
  65. package/dist/ui/chunk-MYPLMHFW.js +1 -0
  66. package/dist/ui/{chunk-RB23LLKL.js → chunk-OKNBFTYR.js} +1 -1
  67. package/dist/ui/{chunk-OWBT6YUM.js → chunk-P2RVKNG4.js} +1 -1
  68. package/dist/ui/{chunk-JBLSUM6W.js → chunk-P57AFOMR.js} +1 -1
  69. package/dist/ui/{chunk-HV3JJ5UT.js → chunk-PLTI4NG7.js} +1 -1
  70. package/dist/ui/chunk-PY4JH5SN.js +1 -0
  71. package/dist/ui/{chunk-44ZU5WMI.js → chunk-SBAY52SC.js} +1 -1
  72. package/dist/ui/{chunk-Y5EOMMNI.js → chunk-TCKR2BL4.js} +1 -1
  73. package/dist/ui/{chunk-WC7KMPEQ.js → chunk-TCRDGNM4.js} +1 -1
  74. package/dist/ui/chunk-TCWN5YRW.js +1 -0
  75. package/dist/ui/{chunk-DWV5J2W7.js → chunk-TZWCCNSA.js} +1 -1
  76. package/dist/ui/{chunk-2PTLQRTU.js → chunk-U5OXKKBN.js} +1 -1
  77. package/dist/ui/{chunk-XUBZH4ON.js → chunk-VZGDXWRK.js} +1 -1
  78. package/dist/ui/{chunk-IGZDFHVM.js → chunk-X3VDQDHP.js} +1 -1
  79. package/dist/ui/chunk-XBYMUPZF.js +19 -0
  80. package/dist/ui/{chunk-QRAFYIAW.js → chunk-XYXL5HSZ.js} +1 -1
  81. package/dist/ui/chunk-Y7RYSRP7.js +7 -0
  82. package/dist/ui/{chunk-WRA24P66.js.LEGAL.txt → chunk-Y7RYSRP7.js.LEGAL.txt} +1 -0
  83. package/dist/ui/chunk-YIKHJONY.js +1 -0
  84. package/dist/ui/chunk-Z2CRNO3I.js +1 -0
  85. package/dist/ui/{chunk-UCYWQEAS.js → chunk-ZD3ORGA6.js} +1 -1
  86. package/dist/ui/{chunk-YBHFGQ3Z.js → chunk-ZQDUWURP.js} +1 -1
  87. package/dist/ui/{chunk-PIJ3E47R.js → chunk-ZYSR5UIW.js} +1 -1
  88. package/dist/ui/ui.css +1 -1
  89. package/dist/ui/ui.js +1 -1
  90. package/package.json +3 -3
  91. package/dist/ui/AIPage-25WICIOT.js +0 -1
  92. package/dist/ui/AssetsPage-WKTM2J2G.js +0 -1
  93. package/dist/ui/CollectionPage-5ZOVG7IG.js +0 -1
  94. package/dist/ui/ComparePage-DDIFYYTK.js +0 -1
  95. package/dist/ui/DocumentPage-OTBXM55S.js +0 -1
  96. package/dist/ui/EditReleasePage-TKNOUT7A.js +0 -1
  97. package/dist/ui/EmbeddedAIPage-4AX7VO3T.js +0 -1
  98. package/dist/ui/LogsPage-SCECIAZH.js +0 -1
  99. package/dist/ui/NewDataSourcePage-FAOPK2RZ.js +0 -1
  100. package/dist/ui/NewReleasePage-HD6T6UV2.js +0 -1
  101. package/dist/ui/ReleasePage-GUMEMLF6.js +0 -1
  102. package/dist/ui/SidebarToolsPage-3R7BQ2F7.js +0 -1
  103. package/dist/ui/TasksPage-G3GBTV3L.js +0 -1
  104. package/dist/ui/chunk-2FQMT5AB.js +0 -3
  105. package/dist/ui/chunk-FVWSVOOY.js +0 -1
  106. package/dist/ui/chunk-GCSN3YEC.js +0 -31
  107. package/dist/ui/chunk-N5RJIILP.js +0 -1
  108. package/dist/ui/chunk-NXWYS4HG.js +0 -19
  109. package/dist/ui/chunk-OWYV43BT.js +0 -1
  110. package/dist/ui/chunk-QWB6MAPJ.js +0 -7
  111. package/dist/ui/chunk-RN4XVVWD.js +0 -1
  112. package/dist/ui/chunk-T5BJNOWE.js +0 -1
  113. package/dist/ui/chunk-TNW2GNUR.js +0 -1
  114. package/dist/ui/chunk-UPN3EMUS.js +0 -1
  115. package/dist/ui/chunk-VPZHG7JL.js +0 -81
  116. package/dist/ui/chunk-WRA24P66.js +0 -7
  117. package/dist/ui/chunk-Z3ZJJWFT.js +0 -1
  118. /package/dist/ui/{ImageEditorDialog-YDKOGVJV.js.LEGAL.txt → ImageEditorDialog-JDXMU2FC.js.LEGAL.txt} +0 -0
  119. /package/dist/ui/{chunk-7UHZS56B.js.LEGAL.txt → chunk-6ZVMJXLE.js.LEGAL.txt} +0 -0
  120. /package/dist/ui/{chunk-VPZHG7JL.js.LEGAL.txt → chunk-7OU4ERTS.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- import{a as p,d as U,e as g}from"./chunk-H37RXS4R.js";import{e as u}from"./chunk-WASID5UU.js";import{Fa as d,Ga as t,a as f,aa as v,j as x}from"./chunk-WRA24P66.js";import{d as c}from"./chunk-KUCVLANF.js";x();function A(e){let a=e.size||30,l=e.withTooltip!==!1,{profile:_}=g(e.profile===void 0?e.email:null),s=e.profile!==void 0?e.profile:_,r=s?.email||e.email||"",i=s?.displayName||"",o=s?.photoURL||"",[n,h]=f(!1),m=t(v,{className:u("UserAvatar",e.inactive&&"UserAvatar--inactive",e.className),src:!n&&o?o:void 0,alt:i||r,size:a,radius:"xl",style:!o||n?{backgroundColor:U(r||i||"?"),color:"#fff",fontWeight:600,fontSize:Math.max(10,Math.round(a*.4))}:void 0,imageProps:{onError:()=>h(!0)},children:!o||n?p(r,i):null});return l?t(A.Tooltip,{email:r,displayName:i,children:m}):m}A.Tooltip=function(a){if(!a.email&&!a.displayName)return t(c,{children:a.children});let l=t("div",{className:"UserAvatar__tooltip",children:[a.displayName&&t("div",{className:"UserAvatar__tooltip__name",children:a.displayName}),a.email&&t("div",{className:"UserAvatar__tooltip__email",children:a.email})]});return t(d,{label:l,position:"bottom",withArrow:!0,transition:"pop",children:a.children})};export{A as a};
1
+ import{a as p,d as U,e as g}from"./chunk-HKCOKHA2.js";import{e as u}from"./chunk-GJ7ES2LA.js";import{Fa as d,a as f,aa as v,fd as t,j as x}from"./chunk-Y7RYSRP7.js";import{d as c}from"./chunk-KUCVLANF.js";x();function A(e){let a=e.size||30,l=e.withTooltip!==!1,{profile:_}=g(e.profile===void 0?e.email:null),s=e.profile!==void 0?e.profile:_,r=s?.email||e.email||"",i=s?.displayName||"",o=s?.photoURL||"",[n,h]=f(!1),m=t(v,{className:u("UserAvatar",e.inactive&&"UserAvatar--inactive",e.className),src:!n&&o?o:void 0,alt:i||r,size:a,radius:"xl",style:!o||n?{backgroundColor:U(r||i||"?"),color:"#fff",fontWeight:600,fontSize:Math.max(10,Math.round(a*.4))}:void 0,imageProps:{onError:()=>h(!0)},children:!o||n?p(r,i):null});return l?t(A.Tooltip,{email:r,displayName:i,children:m}):m}A.Tooltip=function(a){if(!a.email&&!a.displayName)return t(c,{children:a.children});let l=t("div",{className:"UserAvatar__tooltip",children:[a.displayName&&t("div",{className:"UserAvatar__tooltip__name",children:a.displayName}),a.email&&t("div",{className:"UserAvatar__tooltip__email",children:a.email})]});return t(d,{label:l,position:"bottom",withArrow:!0,transition:"pop",children:a.children})};export{A as a};
@@ -1 +1 @@
1
- import{a,h as n,j as s}from"./chunk-WRA24P66.js";s();s();function T(e,r){let[c,i]=a(()=>{try{let t=window.localStorage.getItem(e);return t?JSON.parse(t):r}catch(t){return console.error(t),r}}),u=n(t=>{i(l=>{let o=typeof t=="function"?t(l):t;return window.localStorage.setItem(e,JSON.stringify(o)),o})},[e]);return[c,u]}export{T as a};
1
+ import{a,h as n,j as s}from"./chunk-Y7RYSRP7.js";s();s();function T(e,r){let[c,i]=a(()=>{try{let t=window.localStorage.getItem(e);return t?JSON.parse(t):r}catch(t){return console.error(t),r}}),u=n(t=>{i(l=>{let o=typeof t=="function"?t(l):t;return window.localStorage.setItem(e,JSON.stringify(o)),o})},[e]);return[c,u]}export{T as a};
@@ -1 +1 @@
1
- import{a as F,b as B,c as U}from"./chunk-2RRM4HEQ.js";import{a as H}from"./chunk-OWYV43BT.js";import{b as j}from"./chunk-ATTW36EM.js";import{a as N}from"./chunk-PLYSJ7W5.js";import{E as z,a as A}from"./chunk-XOWWPE7X.js";import{e as w}from"./chunk-WASID5UU.js";import{Da as O,F as P,Fa as f,Ga as t,Gc as E,U as y,V as x,a as _,c as T,da as l,g as b,j as tt,sa as v,ua as M,za as D}from"./chunk-WRA24P66.js";import{d as $}from"./chunk-KUCVLANF.js";tt();var et=50,at=["doc.save","doc.publish","doc.restore_version","doc.import_translations","doc.revert"],ot=[{value:"all",label:"All time"},{value:"1h",label:"Last hour"},{value:"24h",label:"Last 24 hours"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function W(a){let[e,o]=_(!0),[n,s]=_([]);return T(()=>{z(a?{limit:a}:void 0).then(m=>{s(m),o(!1)})},[a]),{loading:e,actions:n}}function Pt(a){if(a.compact)return t(ct,{...a});let[e,o]=_(""),[n]=P(e,300),[s,m]=_([]),[h,V]=_([]),[g,q]=_("all"),{actions:r,loading:X}=W(),Y=b(()=>{let i=new Set;return r.forEach(c=>i.add(c.action)),Array.from(i).sort()},[r]),Z=b(()=>{let i=new Set;return r.forEach(c=>{c.by&&i.add(c.by)}),Array.from(i).sort()},[r]),S=b(()=>{let i=Date.now();return r.filter(c=>{if(n){let u=n.toLowerCase(),L=c.action.toLowerCase().includes(u),p=c.by?.toLowerCase().includes(u),K=ut(c.metadata).toLowerCase().includes(u);if(!L&&!p&&!K)return!1}if(s.length>0&&!s.includes(c.action)||h.length>0&&(!c.by||!h.includes(c.by)))return!1;if(g&&g!=="all"){let u=C(c.timestamp);if(!u)return!1;let L=u.toMillis(),p=0;switch(g){case"1h":p=i-3600*1e3;break;case"24h":p=i-1440*60*1e3;break;case"7d":p=i-10080*60*1e3;break;case"30d":p=i-720*60*60*1e3;break}if(L<p)return!1}return!0})},[r,n,s,h,g]),d=F(S,{pageSize:et,resetDeps:[n,s,h,g]}),k=d.pageItems;return X?t("div",{className:`ActionsLog ActionsLog--loading ${a.className||""}`,children:t(x,{color:"gray",size:"xl"})}):t("div",{className:`ActionsLog ${a.className||""}`,children:[!a.compact&&t("div",{className:"ActionsLog__tableHeader",children:[t("div",{className:"ActionsLog__filters",children:[t(M,{className:"ActionsLog__filters__search",placeholder:"Search actions...",icon:t(E,{size:16}),value:e,onChange:i=>o(i.target.value)}),t(v,{className:"ActionsLog__filters__select",placeholder:"Filter by action",clearable:!0,searchable:!0,data:Y,value:s,onChange:m}),t(v,{className:"ActionsLog__filters__select",placeholder:"Filter by user",clearable:!0,searchable:!0,data:Z,value:h,onChange:V}),t(D,{className:"ActionsLog__filters__select",placeholder:"Filter by time",data:ot,value:g,onChange:q})]}),t(U,{start:d.start,end:d.end,total:d.totalItems,noun:"action",note:S.length!==r.length?`filtered from ${r.length} total`:void 0})]}),t(H,{className:"ActionsLog__tableSurface",children:t(O,{className:"ActionsLog__table",children:[t("thead",{children:t("tr",{className:"ActionsLogs__table__row ActionsLogs__table__row--header",children:[t("th",{className:"ActionsLogs__table__header",children:"Timestamp"}),t("th",{className:"ActionsLogs__table__header",children:"User"}),t("th",{className:"ActionsLogs__table__header",children:"Action"}),t("th",{className:"ActionsLogs__table__header",children:"Details"}),t("th",{className:"ActionsLogs__table__header",children:"Links"})]})}),t("tbody",{children:[k.map((i,c)=>t("tr",{className:"ActionsLogs__table__row",children:[t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:t(G,{timestamp:i.timestamp,format:"long"})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:t("span",{className:"ActionsLogs__user",children:i.by?t($,{children:[t(N,{email:i.by,size:20}),t("span",{className:"ActionsLogs__user__email",children:i.by})]}):"\u2014"})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--action",children:t("span",{className:"ActionsLogs__action",children:i.action})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--metadata",children:t(Q,{metadata:i.metadata})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--links",children:t(I,{action:i})})]},c)),k.length===0&&t("tr",{children:t("td",{colSpan:5,className:"ActionsLogs__table__col ActionsLogs__table__col--empty",children:"No actions found matching your filters."})})]})]})}),t(B,{total:d.totalPages,page:d.page,onChange:d.setPage})]})}function Q(a){let{metadata:e}=a;if(!e||Object.keys(e).length===0)return t("span",{className:"ActionsLogs__metadata--empty",children:"\u2014"});let o=Object.entries(e);return t("div",{className:"ActionsLogs__metadata",children:o.map(([n,s])=>t("div",{className:"ActionsLogs__metadata__item",children:[t("span",{className:"ActionsLogs__metadata__key",children:[n,":"]})," ",t("span",{className:"ActionsLogs__metadata__value",children:nt(s)})]},n))})}function nt(a){if(a==null)return"\u2014";if(Array.isArray(a))return a.length===0?"[]":a.length<=3?a.join(", "):`${a.slice(0,3).join(", ")} (+${a.length-3} more)`;if(typeof a=="object"){let e=st(a);try{return JSON.stringify(e)}catch(o){console.error(o),console.error("failed to stringify json:",e)}}return String(a)}function st(a){let e={};return Object.entries(a).forEach(([o,n])=>{o.startsWith("_")||(e[o]=n)}),e}function I(a){let{action:e}=a,o=[];function n(s){return a.label||s}if(e.action!=="doc.delete"&&e.metadata?.docId&&o.push(t(f,{transition:"pop",label:e.metadata.docId,children:t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/content/${e.metadata.docId}`,children:n("Open doc")})},"doc")),at.includes(e.action)&&e.metadata?.docId){let s=C(e.timestamp)?.toMillis();s&&o.push(t(f,{transition:"pop",label:`Show changes to ${e.metadata.docId}`,children:t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:it(e.metadata.docId,s),children:n("Show changes")})},"changes"))}return e.action!=="datasource.delete"&&e.metadata?.datasourceId&&o.push(t(f,{transition:"pop",label:e.metadata.datasourceId,children:t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/data/${e.metadata.datasourceId}`,children:n("Open data source")})},"datasource")),e.action!=="release.delete"&&e.metadata?.releaseId&&o.push(t(f,{transition:"pop",label:e.metadata.releaseId,children:t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${e.metadata.releaseId}`,children:n("Open release")})},"release")),e.metadata?.sheetId&&o.push(t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:j(e.metadata.sheetId),target:"_blank",children:n("Open sheet")},"sheet")),e.action.startsWith("acls.")&&o.push(t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/settings",children:n("Open settings")},"settings")),e.links&&e.links.forEach((s,m)=>{o.push(t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:s.url,target:s.target,children:s.label},`link-${m}`))}),o.length===0?t("span",{className:"ActionsLogs__links--empty"}):(a.limit&&(o=o.slice(0,a.limit)),t("div",{className:"ActionsLogs__table__buttons",children:o}))}function it(a,e){let o=J(a,`before:${e}`),n=J(a,`after:${e}`);return`/cms/compare?left=${o}&right=${n}`}function J(a,e){return encodeURIComponent(`${a}@${e}`).replaceAll("%2F","/").replaceAll("%40","@").replaceAll("%3A",":")}function ct(a){let{actions:e,loading:o}=W(a.limit||10);return o?t("div",{className:w(a.className,"ActionLogsCompact","ActionLogsCompact--loading"),children:t(x,{color:"gray",size:"xl"})}):t("div",{className:w(a.className,"ActionLogsCompact"),children:t(y,{className:"ActionLogsCompact__table",multiple:!0,children:e.map((n,s)=>t(y.Item,{label:t(rt,{action:n}),children:t(lt,{action:n})},s))})})}function rt(a){let e=a.action,o=mt(e),n=a.action.by||"";return t("div",{className:"ActionLogsCompactItemPreview",children:[t("div",{className:"ActionLogsCompactItemPreview__user",children:t(N,{email:n,size:20})}),t("div",{className:"ActionLogsCompactItemPreview__timestamp",children:t(G,{timestamp:e.timestamp})}),t("div",{className:"ActionLogsCompactItemPreview__action",children:e.action}),t("div",{className:"ActionLogsCompactItemPreview__actionMetaId",children:o}),t("div",{className:"ActionLogsCompactItemPreview__buttons",children:t(I,{action:e,label:"Open",limit:1})})]})}function lt(a){let e=a.action,o={user:e.by,...e.metadata};return t("div",{className:"ActionLogsCompactItemDetails",children:[t(Q,{metadata:o}),t(I,{action:e})]})}function mt(a){for(let e of Object.keys(a.metadata||{}))if(e.toLowerCase().endsWith("id"))return a.metadata[e];return""}function C(a){return a?a instanceof A?a:typeof a=="object"&&typeof a._seconds=="number"?new A(a._seconds,a._nanoseconds||0):typeof a=="object"&&typeof a.seconds=="number"?new A(a.seconds,a.nanoseconds||0):typeof a=="number"?A.fromMillis(a):null:null}function G(a){let e=C(a.timestamp)?.toMillis()||0;if(!e)return t("span",{children:"Invalid date"});let o=a.format==="long"?_t(e):pt(e);return t(f,{transition:"pop",label:gt(e),children:t("span",{className:"ActionsLogs__timestamp",children:o})})}var dt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(a){let e=a.getHours(),o=e<12?"AM":"PM",n=String(e%12||12).padStart(2,"0"),s=String(a.getMinutes()).padStart(2,"0");return`${n}:${s} ${o}`}function pt(a){let e=new Date(a),o=String(e.getDate()).padStart(2,"0");return`${dt[e.getMonth()]} ${o}, ${R(e)}`}function _t(a){let e=new Date(a),o=e.toLocaleDateString("en",{month:"long"}),n=String(e.getDate()).padStart(2,"0");return`${o} ${n}, ${e.getFullYear()} ${R(e)}`}function gt(a){return new Date(a).toLocaleString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function ut(a){function e(o){return o===null?"null":typeof o>"u"?"undefined":typeof o=="string"?`"${o.replaceAll('"','\\"')}"`:typeof o!="object"?String(o):Array.isArray(o)?`[${o.map(e).join(", ")}]`:`{${Object.entries(o).map(([s,m])=>`${s}: ${e(m)}`).join(", ")}}`}return e(a)}export{Pt as a};
1
+ import{a as F,b as B,c as U}from"./chunk-H5JL376P.js";import{a as H}from"./chunk-TCWN5YRW.js";import{b as j}from"./chunk-ATTW36EM.js";import{a as N}from"./chunk-LS2JH5QF.js";import{E as z,a as A}from"./chunk-XOWWPE7X.js";import{e as w}from"./chunk-GJ7ES2LA.js";import{Da as O,F as P,Fa as f,Gc as E,U as y,V as x,a as _,c as T,da as l,fd as t,g as b,j as tt,sa as v,ua as M,za as D}from"./chunk-Y7RYSRP7.js";import{d as $}from"./chunk-KUCVLANF.js";tt();var et=50,at=["doc.save","doc.publish","doc.restore_version","doc.import_translations","doc.revert"],ot=[{value:"all",label:"All time"},{value:"1h",label:"Last hour"},{value:"24h",label:"Last 24 hours"},{value:"7d",label:"Last 7 days"},{value:"30d",label:"Last 30 days"}];function W(a){let[e,o]=_(!0),[n,s]=_([]);return T(()=>{z(a?{limit:a}:void 0).then(m=>{s(m),o(!1)})},[a]),{loading:e,actions:n}}function Pt(a){if(a.compact)return t(ct,{...a});let[e,o]=_(""),[n]=P(e,300),[s,m]=_([]),[h,V]=_([]),[g,q]=_("all"),{actions:r,loading:X}=W(),Y=b(()=>{let i=new Set;return r.forEach(c=>i.add(c.action)),Array.from(i).sort()},[r]),Z=b(()=>{let i=new Set;return r.forEach(c=>{c.by&&i.add(c.by)}),Array.from(i).sort()},[r]),S=b(()=>{let i=Date.now();return r.filter(c=>{if(n){let u=n.toLowerCase(),L=c.action.toLowerCase().includes(u),p=c.by?.toLowerCase().includes(u),K=ut(c.metadata).toLowerCase().includes(u);if(!L&&!p&&!K)return!1}if(s.length>0&&!s.includes(c.action)||h.length>0&&(!c.by||!h.includes(c.by)))return!1;if(g&&g!=="all"){let u=C(c.timestamp);if(!u)return!1;let L=u.toMillis(),p=0;switch(g){case"1h":p=i-3600*1e3;break;case"24h":p=i-1440*60*1e3;break;case"7d":p=i-10080*60*1e3;break;case"30d":p=i-720*60*60*1e3;break}if(L<p)return!1}return!0})},[r,n,s,h,g]),d=F(S,{pageSize:et,resetDeps:[n,s,h,g]}),k=d.pageItems;return X?t("div",{className:`ActionsLog ActionsLog--loading ${a.className||""}`,children:t(x,{color:"gray",size:"xl"})}):t("div",{className:`ActionsLog ${a.className||""}`,children:[!a.compact&&t("div",{className:"ActionsLog__tableHeader",children:[t("div",{className:"ActionsLog__filters",children:[t(M,{className:"ActionsLog__filters__search",placeholder:"Search actions...",icon:t(E,{size:16}),value:e,onChange:i=>o(i.target.value)}),t(v,{className:"ActionsLog__filters__select",placeholder:"Filter by action",clearable:!0,searchable:!0,data:Y,value:s,onChange:m}),t(v,{className:"ActionsLog__filters__select",placeholder:"Filter by user",clearable:!0,searchable:!0,data:Z,value:h,onChange:V}),t(D,{className:"ActionsLog__filters__select",placeholder:"Filter by time",data:ot,value:g,onChange:q})]}),t(U,{start:d.start,end:d.end,total:d.totalItems,noun:"action",note:S.length!==r.length?`filtered from ${r.length} total`:void 0})]}),t(H,{className:"ActionsLog__tableSurface",children:t(O,{className:"ActionsLog__table",children:[t("thead",{children:t("tr",{className:"ActionsLogs__table__row ActionsLogs__table__row--header",children:[t("th",{className:"ActionsLogs__table__header",children:"Timestamp"}),t("th",{className:"ActionsLogs__table__header",children:"User"}),t("th",{className:"ActionsLogs__table__header",children:"Action"}),t("th",{className:"ActionsLogs__table__header",children:"Details"}),t("th",{className:"ActionsLogs__table__header",children:"Links"})]})}),t("tbody",{children:[k.map((i,c)=>t("tr",{className:"ActionsLogs__table__row",children:[t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:t(G,{timestamp:i.timestamp,format:"long"})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:t("span",{className:"ActionsLogs__user",children:i.by?t($,{children:[t(N,{email:i.by,size:20}),t("span",{className:"ActionsLogs__user__email",children:i.by})]}):"\u2014"})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--action",children:t("span",{className:"ActionsLogs__action",children:i.action})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--metadata",children:t(Q,{metadata:i.metadata})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--links",children:t(I,{action:i})})]},c)),k.length===0&&t("tr",{children:t("td",{colSpan:5,className:"ActionsLogs__table__col ActionsLogs__table__col--empty",children:"No actions found matching your filters."})})]})]})}),t(B,{total:d.totalPages,page:d.page,onChange:d.setPage})]})}function Q(a){let{metadata:e}=a;if(!e||Object.keys(e).length===0)return t("span",{className:"ActionsLogs__metadata--empty",children:"\u2014"});let o=Object.entries(e);return t("div",{className:"ActionsLogs__metadata",children:o.map(([n,s])=>t("div",{className:"ActionsLogs__metadata__item",children:[t("span",{className:"ActionsLogs__metadata__key",children:[n,":"]})," ",t("span",{className:"ActionsLogs__metadata__value",children:nt(s)})]},n))})}function nt(a){if(a==null)return"\u2014";if(Array.isArray(a))return a.length===0?"[]":a.length<=3?a.join(", "):`${a.slice(0,3).join(", ")} (+${a.length-3} more)`;if(typeof a=="object"){let e=st(a);try{return JSON.stringify(e)}catch(o){console.error(o),console.error("failed to stringify json:",e)}}return String(a)}function st(a){let e={};return Object.entries(a).forEach(([o,n])=>{o.startsWith("_")||(e[o]=n)}),e}function I(a){let{action:e}=a,o=[];function n(s){return a.label||s}if(e.action!=="doc.delete"&&e.metadata?.docId&&o.push(t(f,{transition:"pop",label:e.metadata.docId,children:t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/content/${e.metadata.docId}`,children:n("Open doc")})},"doc")),at.includes(e.action)&&e.metadata?.docId){let s=C(e.timestamp)?.toMillis();s&&o.push(t(f,{transition:"pop",label:`Show changes to ${e.metadata.docId}`,children:t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:it(e.metadata.docId,s),children:n("Show changes")})},"changes"))}return e.action!=="datasource.delete"&&e.metadata?.datasourceId&&o.push(t(f,{transition:"pop",label:e.metadata.datasourceId,children:t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/data/${e.metadata.datasourceId}`,children:n("Open data source")})},"datasource")),e.action!=="release.delete"&&e.metadata?.releaseId&&o.push(t(f,{transition:"pop",label:e.metadata.releaseId,children:t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${e.metadata.releaseId}`,children:n("Open release")})},"release")),e.metadata?.sheetId&&o.push(t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:j(e.metadata.sheetId),target:"_blank",children:n("Open sheet")},"sheet")),e.action.startsWith("acls.")&&o.push(t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/settings",children:n("Open settings")},"settings")),e.links&&e.links.forEach((s,m)=>{o.push(t(l,{component:"a",variant:"default",size:"xs",compact:!0,href:s.url,target:s.target,children:s.label},`link-${m}`))}),o.length===0?t("span",{className:"ActionsLogs__links--empty"}):(a.limit&&(o=o.slice(0,a.limit)),t("div",{className:"ActionsLogs__table__buttons",children:o}))}function it(a,e){let o=J(a,`before:${e}`),n=J(a,`after:${e}`);return`/cms/compare?left=${o}&right=${n}`}function J(a,e){return encodeURIComponent(`${a}@${e}`).replaceAll("%2F","/").replaceAll("%40","@").replaceAll("%3A",":")}function ct(a){let{actions:e,loading:o}=W(a.limit||10);return o?t("div",{className:w(a.className,"ActionLogsCompact","ActionLogsCompact--loading"),children:t(x,{color:"gray",size:"xl"})}):t("div",{className:w(a.className,"ActionLogsCompact"),children:t(y,{className:"ActionLogsCompact__table",multiple:!0,children:e.map((n,s)=>t(y.Item,{label:t(rt,{action:n}),children:t(lt,{action:n})},s))})})}function rt(a){let e=a.action,o=mt(e),n=a.action.by||"";return t("div",{className:"ActionLogsCompactItemPreview",children:[t("div",{className:"ActionLogsCompactItemPreview__user",children:t(N,{email:n,size:20})}),t("div",{className:"ActionLogsCompactItemPreview__timestamp",children:t(G,{timestamp:e.timestamp})}),t("div",{className:"ActionLogsCompactItemPreview__action",children:e.action}),t("div",{className:"ActionLogsCompactItemPreview__actionMetaId",children:o}),t("div",{className:"ActionLogsCompactItemPreview__buttons",children:t(I,{action:e,label:"Open",limit:1})})]})}function lt(a){let e=a.action,o={user:e.by,...e.metadata};return t("div",{className:"ActionLogsCompactItemDetails",children:[t(Q,{metadata:o}),t(I,{action:e})]})}function mt(a){for(let e of Object.keys(a.metadata||{}))if(e.toLowerCase().endsWith("id"))return a.metadata[e];return""}function C(a){return a?a instanceof A?a:typeof a=="object"&&typeof a._seconds=="number"?new A(a._seconds,a._nanoseconds||0):typeof a=="object"&&typeof a.seconds=="number"?new A(a.seconds,a.nanoseconds||0):typeof a=="number"?A.fromMillis(a):null:null}function G(a){let e=C(a.timestamp)?.toMillis()||0;if(!e)return t("span",{children:"Invalid date"});let o=a.format==="long"?_t(e):pt(e);return t(f,{transition:"pop",label:gt(e),children:t("span",{className:"ActionsLogs__timestamp",children:o})})}var dt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function R(a){let e=a.getHours(),o=e<12?"AM":"PM",n=String(e%12||12).padStart(2,"0"),s=String(a.getMinutes()).padStart(2,"0");return`${n}:${s} ${o}`}function pt(a){let e=new Date(a),o=String(e.getDate()).padStart(2,"0");return`${dt[e.getMonth()]} ${o}, ${R(e)}`}function _t(a){let e=new Date(a),o=e.toLocaleDateString("en",{month:"long"}),n=String(e.getDate()).padStart(2,"0");return`${o} ${n}, ${e.getFullYear()} ${R(e)}`}function gt(a){return new Date(a).toLocaleString("en",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit",second:"2-digit"})}function ut(a){function e(o){return o===null?"null":typeof o>"u"?"undefined":typeof o=="string"?`"${o.replaceAll('"','\\"')}"`:typeof o!="object"?String(o):Array.isArray(o)?`[${o.map(e).join(", ")}]`:`{${Object.entries(o).map(([s,m])=>`${s}: ${e(m)}`).join(", ")}}`}return e(a)}export{Pt as a};
@@ -0,0 +1 @@
1
+ function t(o){let e=o?.rootTool;return typeof e=="object"&&e!==null&&e.type==="locationchange"&&typeof e.url=="string"}function s(o){let e=o?.scrollToDeeplink;return typeof e=="object"&&e!==null&&typeof e.deepKey=="string"}export{t as a,s as b};
@@ -1 +1 @@
1
- import{d as Q}from"./chunk-WASID5UU.js";import{a as z,c as d,e as i,h as c,j as h}from"./chunk-WRA24P66.js";h();function R(r,t,n={}){let{query:l,route:g}=Q(),{replace:m=!1,serialize:y=e=>String(e),deserialize:f=e=>e}=n,a=i(t),T=i(y),P=i(f);a.current=t,T.current=y,P.current=f;let o=c(()=>{let e=l[r];return e!==void 0?P.current(e):a.current},[l,r]),[S,p]=z(o);d(()=>{p(o())},[o]);let b=c(e=>{p(e);let s=new URL(window.location.href),u=T.current(e);u===String(a.current)||u===""?s.searchParams.delete(r):s.searchParams.set(r,u);let k=s.pathname+s.search;g(k,m)},[r,m,g]);return[S,b]}function O(r,t=""){return R(r,t)}function w(r,t=[]){return R(r,t,{serialize:n=>Array.isArray(n)?n.join(","):"",deserialize:n=>n?n.split(",").filter(Boolean):t})}export{R as a,O as b,w as c};
1
+ import{d as Q}from"./chunk-GJ7ES2LA.js";import{a as z,c as d,e as i,h as c,j as h}from"./chunk-Y7RYSRP7.js";h();function R(r,t,n={}){let{query:l,route:g}=Q(),{replace:m=!1,serialize:y=e=>String(e),deserialize:f=e=>e}=n,a=i(t),T=i(y),P=i(f);a.current=t,T.current=y,P.current=f;let o=c(()=>{let e=l[r];return e!==void 0?P.current(e):a.current},[l,r]),[S,p]=z(o);d(()=>{p(o())},[o]);let b=c(e=>{p(e);let s=new URL(window.location.href),u=T.current(e);u===String(a.current)||u===""?s.searchParams.delete(r):s.searchParams.set(r,u);let k=s.pathname+s.search;g(k,m)},[r,m,g]);return[S,b]}function O(r,t=""){return R(r,t)}function w(r,t=[]){return R(r,t,{serialize:n=>Array.isArray(n)?n.join(","):"",deserialize:n=>n?n.split(",").filter(Boolean):t})}export{R as a,O as b,w as c};
@@ -1 +1 @@
1
- import{a as Vt}from"./chunk-AAHM6RYJ.js";import{d as Y,e as N}from"./chunk-WASID5UU.js";import{Bc as Ht,C as dt,Cc as Rt,D as j,E as ut,Fa as Et,G as U,Ga as r,Gc as zt,H as mt,I as gt,Jb as Bt,Jc as Wt,K as ft,O as ht,P as _t,Q as vt,S as Q,Sb as It,T as yt,Xb as Tt,Y as S,Z as bt,_ as Ct,_a as Pt,a as x,aa as xt,c as O,e as pt,fa as wt,ha as St,ia as kt,ib as At,ic as Mt,j as je,ja as Lt,ka as Ot,qa as Z,sb as Nt,tc as Dt,ua as jt,v as n,y as w}from"./chunk-WRA24P66.js";import{d as V,j as ct}from"./chunk-KUCVLANF.js";var tt={name:"@blinkk/root-cms",version:"3.1.5",author:"s@blinkk.com",license:"MIT",engines:{node:">=22.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/core.js",types:"./dist/core/core.d.ts",exports:{".":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./browser-client":{types:"./dist/browser-client/browser-client.d.ts",import:"./dist/browser-client.js"},"./client":{types:"./dist/core/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/core/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/core/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/core/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/core/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"node ../../scripts/build-esbuild.mjs ./esbuild.config.json","build:ui":"pnpm build:ui:bundle && pnpm build:ui:clean","build:ui:bundle":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external --splitting --format=esm","build:ui:clean":"rm -f dist/ui/*-*.css","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui:bundle --watch",test:"pnpm build && firebase emulators:exec 'vitest run --exclude=**/*.visual.test.tsx'","test:visual":"vitest run --config=vitest.config.visual.ts","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@ag-grid-community/client-side-row-model":"32.3.9","@ag-grid-community/core":"32.3.9","@ag-grid-community/react":"32.3.9","@ag-grid-community/styles":"32.3.9","@ai-sdk/anthropic":"3.0.74","@ai-sdk/google":"3.0.67","@ai-sdk/openai":"3.0.60","@ai-sdk/openai-compatible":"2.0.46","@ai-sdk/react":"3.0.177","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","@mantine/spotlight":"4.2.12","@types/cli-progress":"3.11.6",ai:"6.0.175","body-parser":"1.20.2","cli-progress":"3.12.0",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4","date-fns":"4.1.0","date-fns-tz":"3.2.0",diff:"8.0.2","dts-dom":"3.7.0","fnv-plus":"1.3.1",jsonwebtoken:"9.0.2",kleur:"4.1.5",minisearch:"7.2.0","sanitize-html":"2.13.1",sirv:"2.0.3","tiny-glob":"0.2.9",zod:"4.4.3"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/table":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"3.35.0","@testing-library/preact":"3.2.4","@testing-library/user-event":"14.6.1","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1","@types/sanitize-html":"2.13.0","@vitest/browser":"4.1.8","@vitest/browser-playwright":"4.1.8",concurrently:"7.6.0",esbuild:"0.28.0",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0",jsdom:"27.2.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",playwright:"1.60.0",preact:"10.27.1","preact-iso":"2.11.1","preact-render-to-string":"6.6.7",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-easy-crop":"5.5.6","react-json-view-compare":"2.0.2",typescript:"6.0.3",vite:"8.0.13",vitest:"4.1.6",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"3.1.5","firebase-admin":">=11","firebase-functions":">=4"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function Ut(){return r("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("g",{"clip-path":"url(#clip0_1_318)",children:[r("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),r("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),r("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),r("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),r("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),r("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),r("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),r("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),r("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),r("defs",{children:r("clipPath",{id:"clip0_1_318",children:r("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}w();var Qt=ct(null);w();w();var Pe=Object.defineProperty,Ae=Object.defineProperties,Ne=Object.getOwnPropertyDescriptors,Zt=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,Gt=(t,e,o)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Te=(t,e)=>{for(var o in e||(e={}))Be.call(e,o)&&Gt(t,o,e[o]);if(Zt)for(var o of Zt(e))Ie.call(e,o)&&Gt(t,o,e[o]);return t},Me=(t,e)=>Ae(t,Ne(e));function De(t){return Me(Te({},t),{id:t.id||ft()})}function He(t){let e=[];return t.reduceRight((o,i)=>(e.includes(i.id)||(e.push(i.id),o.push(i)),o),[]).reverse()}function G(t){return He(t.map(e=>De(e)))}function Ft(t,e){let[o,i]=x(G(typeof t=="function"?t(e):t));return O(()=>{typeof t=="function"&&i(G(t(e)))},[e]),[o,{registerActions:s=>i(a=>G([...a,...s])),updateActions:s=>i(G(typeof s=="function"?s(e):s)),removeActions:s=>i(a=>a.filter(d=>!s.includes(d.id))),triggerAction:s=>{var a;let d=o.find(g=>g.id===s);(a=d?.onTrigger)==null||a.call(d,d)}}]}function Re(t,e){return t===null?[]:Array.isArray(t)?t.map(o=>[o,e]):[[t,e]]}function Kt(t,e){_t(Re(t,e))}w();w();var ze=j((t,{radius:e})=>({action:{position:"relative",display:"block",width:"100%",padding:"10px 12px",borderRadius:t.fn.radius(e)},actionHovered:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[1]},actionIcon:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]},actionBody:{flex:1}})),$t=ze;var We=Object.defineProperty,F=Object.getOwnPropertySymbols,qt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,Xt=(t,e,o)=>e in t?We(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ve=(t,e)=>{for(var o in e||(e={}))qt.call(e,o)&&Xt(t,o,e[o]);if(F)for(var o of F(e))Jt.call(e,o)&&Xt(t,o,e[o]);return t},Ue=(t,e)=>{var o={};for(var i in t)qt.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&F)for(var i of F(t))e.indexOf(i)<0&&Jt.call(t,i)&&(o[i]=t[i]);return o};function et(t){var e=t,{action:o,styles:i,classNames:l,hovered:c,onTrigger:m,highlightQuery:_,highlightColor:s,query:a,radius:d}=e,g=Ue(e,["action","styles","classNames","hovered","onTrigger","highlightQuery","highlightColor","query","radius"]);let{classes:u,cx:h}=$t({radius:d},{styles:i,classNames:l,name:"Spotlight"});return n.createElement(Q,Ve({className:h(u.action,{[u.actionHovered]:c}),tabIndex:-1,onMouseDown:b=>b.preventDefault(),onClick:m},g),n.createElement(wt,{noWrap:!0},o.icon&&n.createElement(yt,{className:u.actionIcon},o.icon),n.createElement("div",{className:u.actionBody},n.createElement(Ot,{highlightColor:s,highlight:_?a:null},o.title),o.description&&n.createElement(S,{color:"dimmed",size:"xs"},o.description))))}et.displayName="@mantine/spotlight/DefaultAction";w();var Qe=j(t=>({nothingFound:{},actions:{padding:t.spacing.xs/2,borderTop:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2]}`},actionsGroup:{textTransform:"uppercase",fontSize:t.spacing.xs,fontWeight:700,padding:"10px 12px",paddingBottom:0,paddingTop:15}})),Yt=Qe;function ot({actions:t,styles:e,classNames:o,actionComponent:i,hovered:l,onActionHover:c,onActionTrigger:m,query:_,nothingFoundMessage:s,highlightQuery:a,highlightColor:d,radius:g}){let{classes:u}=Yt(null,{classNames:o,styles:e,name:"Spotlight"}),h=t.map(v=>v.type==="item"?n.createElement(i,{query:_,key:v.item.id,action:v.item,hovered:v.index===l,onMouseEnter:()=>c(v.index),classNames:o,styles:e,radius:g,onTrigger:()=>m(v.item),highlightQuery:a,highlightColor:d}):n.createElement(S,{className:u.actionsGroup,color:"dimmed",key:v.label},v.label)),b=h.length>0||!!s&&_.trim().length>0;return n.createElement(n.Fragment,null,b&&n.createElement("div",{className:u.actions},h.length>0?h:n.createElement(S,{color:"dimmed",className:u.nothingFound,align:"center",size:"lg",py:"md"},s)))}ot.displayName="@mantine/spotlight/ActionsList";function Ze(t){return Array.isArray(t)?t.map(e=>e.trim()).join(",").toLowerCase().trim():typeof t=="string"?t.toLowerCase().trim():""}function te(t,e){let o=t.trim().toLowerCase(),i=[[],[]];return e.forEach(l=>{var c,m;(c=l.title)!=null&&c.toLowerCase().includes(o)?i[0].push(l):((m=l.description)!=null&&m.toLowerCase().includes(o)||Ze(l.keywords).includes(o))&&i[1].push(l)}),i.flat()}var Ge=Object.defineProperty,Fe=Object.defineProperties,Ke=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,oe=(t,e,o)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,re=(t,e)=>{for(var o in e||(e={}))$e.call(e,o)&&oe(t,o,e[o]);if(ee)for(var o of ee(e))Xe.call(e,o)&&oe(t,o,e[o]);return t},ie=(t,e)=>Fe(t,Ke(e)),qe=j((t,{centered:e,maxWidth:o,topOffset:i,radius:l})=>({root:ie(re({},t.fn.cover()),{position:"fixed"}),spotlight:{position:"relative",zIndex:2,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,borderRadius:t.fn.radius(l),width:"100%",maxWidth:o,overflow:"hidden",marginLeft:"calc(var(--removed-scroll-width, 0px) * -1)"},overlay:ie(re({},t.fn.cover()),{position:"fixed"}),inner:{height:"100vh",display:"flex",flexDirection:"column",paddingTop:e?t.spacing.md:i,justifyContent:e?"center":"flex-start",alignItems:"center"},searchInput:{border:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white}})),ne=qe;var Je=Object.defineProperty,K=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable,ae=(t,e,o)=>e in t?Je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ye=(t,e)=>{for(var o in e||(e={}))se.call(e,o)&&ae(t,o,e[o]);if(K)for(var o of K(e))le.call(e,o)&&ae(t,o,e[o]);return t},to=(t,e)=>{var o={};for(var i in t)se.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&K)for(var i of K(t))e.indexOf(i)<0&&le.call(t,i)&&(o[i]=t[i]);return o};function rt(t){var e=t,{query:o,onQueryChange:i,actions:l,onClose:c,opened:m,withinPortal:_,transition:s="pop",transitionDuration:a,classNames:d,styles:g,overlayColor:u="#000",overlayOpacity:h=.25,overlayBlur:b=3,shadow:v="md",radius:E="sm",centered:X=!1,closeOnActionTrigger:B=!0,highlightQuery:I=!1,highlightColor:T,maxWidth:M=600,topOffset:D=120,className:q,searchPlaceholder:H,searchIcon:R,filter:fe=te,nothingFoundMessage:he,limit:_e=10,actionComponent:ve=et,actionsWrapperComponent:ye="div",zIndex:be=dt("modal")}=e,Ce=to(e,["query","onQueryChange","actions","onClose","opened","withinPortal","transition","transitionDuration","classNames","styles","overlayColor","overlayOpacity","overlayBlur","shadow","radius","centered","closeOnActionTrigger","highlightQuery","highlightColor","maxWidth","topOffset","className","searchPlaceholder","searchIcon","filter","nothingFoundMessage","limit","actionComponent","actionsWrapperComponent","zIndex"]);let[z,k]=x(-1),[xe,at]=x(!1),{classes:P,cx:we}=ne({centered:X,maxWidth:M,topOffset:D,radius:E},{classNames:d,styles:g,name:"Spotlight"}),[,st]=ht(),Se=gt(m),J=()=>k(-1),W=()=>{J(),c()};mt({transitionDuration:0,opened:m});let ke=fe(o,l).slice(0,_e),lt=ut(ke).items,L=lt.map(f=>f.type==="item"?f.item:void 0).filter(f=>f);U(()=>{L.length-1<z&&k(L.length-1)},[L.length]);let Le=f=>{var A;if(!xe)switch(f.code){case"ArrowDown":{f.preventDefault(),k(y=>y<L.length-1?y+1:0);break}case"ArrowUp":{f.preventDefault(),k(y=>y>0?y-1:L.length-1);break}case"Enter":{f.preventDefault();let y=L[z];(A=y?.onTrigger)==null||A.call(y,y),B&&y?.onTrigger&&W();break}case"Escape":f.preventDefault(),W()}},Oe=f=>{i(f.currentTarget.value),z===-1&&k(0)};return n.createElement(St,{withinPortal:_,zIndex:be},n.createElement(kt,{onExited:()=>st(!1),onEntered:()=>st(!0),mounted:m,transitions:{spotlight:{duration:a,transition:s,timingFunction:"ease"},overlay:{duration:a/2,transition:"fade",timingFunction:"ease"}}},f=>n.createElement("div",Ye({className:we(P.root,q)},Ce),n.createElement("div",{className:P.inner,ref:Se},n.createElement(bt,{style:f.spotlight,className:P.spotlight,shadow:v,radius:E,onMouseLeave:J},n.createElement(jt,{value:o,onChange:Oe,onKeyDown:Le,onCompositionStart:()=>at(!0),onCompositionEnd:()=>at(!1),classNames:{input:P.searchInput},size:"lg",placeholder:H,icon:R,onMouseEnter:J,autoComplete:"chrome-please-just-do-not-show-it-thanks"}),n.createElement(ye,null,n.createElement(ot,{highlightQuery:I,highlightColor:T,actions:lt,actionComponent:ve,hovered:z,query:o,nothingFoundMessage:he,onActionHover:k,onActionTrigger:A=>{A.onTrigger(A),B&&W()},styles:g,classNames:d,radius:E}))),n.createElement("div",{style:f.overlay},n.createElement(Lt,{className:P.overlay,zIndex:1,onMouseDown:W,color:u,opacity:h,blur:b}))))))}rt.displayName="@mantine/spotlight/Spotlight";w();var it={open:"mantine:open-spotlight",close:"mantine:close-spotlight",toggle:"mantine:toggle-spotlight",triggerAction:"mantine:trigger-spotlight-action",registerActions:"mantine:register-spotlight-actions",removeActions:"mantine:remove-spotlight-actions"};function eo(t,e){return new CustomEvent(t,{detail:e})}function nt(){window.dispatchEvent(eo(it.open))}function ce(t){let e={registerActions:o=>t.registerActions(o.detail),removeActions:o=>t.removeActions(o.detail),triggerAction:o=>t.triggerAction(o.detail),open:t.openSpotlight,close:t.closeSpotlight,toggle:t.toggleSpotlight};O(()=>(Object.keys(e).forEach(o=>{window.addEventListener(it[o],e[o])}),()=>{Object.keys(e).forEach(o=>{window.removeEventListener(it[o],e[o])})}),[])}var oo=Object.defineProperty,$=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,pe=(t,e,o)=>e in t?oo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ro=(t,e)=>{for(var o in e||(e={}))de.call(e,o)&&pe(t,o,e[o]);if($)for(var o of $(e))ue.call(e,o)&&pe(t,o,e[o]);return t},io=(t,e)=>{var o={};for(var i in t)de.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&$)for(var i of $(t))e.indexOf(i)<0&&ue.call(t,i)&&(o[i]=t[i]);return o};function me(t){var e=t,{actions:o,children:i,shortcut:l="mod + K",onSpotlightClose:c,onSpotlightOpen:m,onQueryChange:_,cleanQueryOnClose:s=!0,transitionDuration:a=150}=e,d=io(e,["actions","children","shortcut","onSpotlightClose","onSpotlightOpen","onQueryChange","cleanQueryOnClose","transitionDuration"]);let g=pt(-1),[u,h]=x(""),[b,{registerActions:v,updateActions:E,removeActions:X,triggerAction:B}]=Ft(o,u);U(()=>{E(o)},[o]);let I=R=>{h(R),_?.(R)},[T,{open:M,close:D,toggle:q}]=vt(!1,{onClose:()=>{c?.(),s&&(g.current=window.setTimeout(()=>{I("")},a))},onOpen:()=>{m?.(),window.clearTimeout(g.current)}}),H={openSpotlight:M,closeSpotlight:D,toggleSpotlight:q,registerActions:v,removeActions:X,triggerAction:B,opened:T,actions:b,query:u};return Kt(l,M),ce(H),n.createElement(Qt.Provider,{value:H},n.createElement(rt,ro({actions:b,onClose:D,opened:T,query:u,onQueryChange:I,transitionDuration:a},d)),i)}me.displayName="@mantine/spotlight/SpotlightProvider";je();function ge(t){let[e,o]=x(!1);O(()=>{let l=navigator.userAgentData?.platform??navigator.platform;o(/mac/i.test(l||""))},[]);let i=()=>{nt()};return r("button",{type:"button",className:N("SearchBar",t.className),onClick:i,"aria-label":"Open search",children:[r(zt,{className:"SearchBar__icon",size:16,stroke:1.5}),r("span",{className:"SearchBar__placeholder",children:"Search"}),r("span",{className:"SearchBar__shortcut","aria-hidden":"true",children:e?"\u2318 + K":"Ctrl + K"})]})}var C="1.5";function p(t){return r("div",{className:"Layout",children:[r(p.Top,{}),r(p.Side,{}),r(p.Main,{...t,children:t.children}),r(p.Bottom,{})]})}function no(t){let o=t.split("?")[0].replace(/\/+$/g,"").split("/").filter(Boolean);return o.length===4&&o[0]==="cms"&&o[1]==="content"}p.Top=()=>{let t=window.__ROOT_CTX.rootConfig,e=t.projectName||t.projectId,o=t.minimalBranding,{url:i}=Y(),l=!no(i);return r("div",{className:"Layout__top",children:[o?r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:e}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]})]}):r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:r(Ut,{})}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]}),r("div",{className:"Layout__top__project",children:e})]}),l&&r("div",{className:"Layout__top__search",children:r(ge,{})})]})};p.Side=()=>{let{url:t}=Y(),e=t.replace(/\/*$/g,""),o=window.firebase.user,i=window.__ROOT_CTX.sidebar?.tools,l=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),c=s=>l.has(s),m=window.__ROOT_CTX.experiments||{},_=async()=>{await window.firebase.auth.signOut(),window.location.href="/cms/login"};return r("div",{className:"Layout__side",children:[r("div",{className:"Layout__side__buttons",children:[!c("home")&&r(p.SideButton,{label:"Home",url:"/cms",active:e==="/cms",children:r(It,{stroke:C})}),!c("content")&&r(p.SideButton,{label:"Content",url:"/cms/content",active:e.startsWith("/cms/content"),children:r(Bt,{stroke:C})}),m.taskManager&&r(p.SideButton,{label:"Tasks",url:"/cms/tasks",active:e.startsWith("/cms/tasks"),children:r(At,{stroke:C})}),!c("releases")&&r(p.SideButton,{label:"Releases",url:"/cms/releases",active:e.startsWith("/cms/releases"),children:r(Rt,{stroke:C})}),!c("data")&&r(p.SideButton,{label:"Data",url:"/cms/data",active:e.startsWith("/cms/data"),children:r(Nt,{stroke:C})}),!c("assets")&&r(p.SideButton,{label:"Asset Library",url:"/cms/assets",active:e.startsWith("/cms/assets"),children:r(Dt,{stroke:C})}),!c("translations")&&r(p.SideButton,{label:"Translations",url:"/cms/translations",active:e.startsWith("/cms/translations"),children:r(Tt,{stroke:C})}),Vt()&&!c("ai")&&r(p.SideButton,{label:"Root AI",url:"/cms/ai",active:e.startsWith("/cms/ai"),children:r(Ht,{stroke:C})}),i&&r(V,{children:[r("div",{className:"Layout__side__divider"}),Object.entries(i).map(([s,a])=>{let d=a.cmsUrl?.startsWith("/cms/")?a.cmsUrl:void 0,g=a.externalUrl,u=g??d??`/cms/tools/${s}`,h=g?void 0:u.replace(/\/*$/g,""),b=!g&&!!h&&(e===h||e.startsWith(`${h}/`));return r(p.SideButton,{className:"Layout__side__tool",label:a.label||"",url:u,active:b,external:!!g,children:a.icon?r("img",{className:"Layout__side__tool__icon",src:a.icon,alt:a.label||""}):r(Pt,{stroke:C})},s)}),r("div",{className:"Layout__side__divider"})]}),!c("settings")&&r(p.SideButton,{label:"Settings",url:"/cms/settings",active:e.startsWith("/cms/settings"),children:r(Wt,{stroke:C})})]}),r("div",{className:"Layout__side__user",children:r(Z,{shadow:"md",position:"right",control:r(Q,{children:r(xt,{src:o.photoURL,alt:o.email,size:30,radius:"xl"})}),children:[r(Z.Label,{children:r(S,{size:"xs",color:"dimmed",truncate:!0,children:["Signed in as ",o.email]})}),r(Ct,{}),r(Z.Item,{color:"red",icon:r(Mt,{style:{width:14,height:14}}),onClick:_,children:"Sign out"})]})})]})};p.SideButton=t=>r(Et,{className:N("Layout__side__button",t.className),label:t.label,position:"right",withArrow:!0,children:r("a",{className:N(t.active&&"active"),href:t.url,target:t.external?"_blank":void 0,rel:t.external?"noreferrer noopener":void 0,children:t.children})});p.Main=t=>r("div",{className:"Layout__main",children:t.children});p.Bottom=()=>r("div",{className:"Layout__bottom"});export{nt as a,me as b,p as c};
1
+ import{a as Vt}from"./chunk-AAHM6RYJ.js";import{d as Y,e as N}from"./chunk-GJ7ES2LA.js";import{Bc as Ht,C as dt,Cc as Rt,D as j,E as ut,Fa as Et,G as U,Gc as zt,H as mt,I as gt,Jb as Bt,Jc as Wt,K as ft,O as ht,P as _t,Q as vt,S as Q,Sb as It,T as yt,Xb as Tt,Y as S,Z as bt,Za as Pt,_ as Ct,a as x,aa as xt,c as O,e as pt,fa as wt,fd as r,ha as St,hb as At,ia as kt,ic as Mt,j as je,ja as Lt,ka as Ot,qa as Z,rb as Nt,tc as Dt,ua as jt,v as n,y as w}from"./chunk-Y7RYSRP7.js";import{d as V,j as ct}from"./chunk-KUCVLANF.js";var tt={name:"@blinkk/root-cms",version:"3.1.7",author:"s@blinkk.com",license:"MIT",engines:{node:">=22.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/core.js",types:"./dist/core/core.d.ts",exports:{".":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./browser-client":{types:"./dist/browser-client/browser-client.d.ts",import:"./dist/browser-client.js"},"./client":{types:"./dist/core/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/core/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/core/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/core/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/core/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"node ../../scripts/build-esbuild.mjs ./esbuild.config.json","build:ui":"pnpm build:ui:bundle && pnpm build:ui:clean","build:ui:bundle":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external --splitting --format=esm","build:ui:clean":"rm -f dist/ui/*-*.css","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui:bundle --watch",test:"pnpm build && firebase emulators:exec 'vitest run --exclude=**/*.visual.test.tsx'","test:visual":"vitest run --config=vitest.config.visual.ts","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@ag-grid-community/client-side-row-model":"32.3.9","@ag-grid-community/core":"32.3.9","@ag-grid-community/react":"32.3.9","@ag-grid-community/styles":"32.3.9","@ai-sdk/anthropic":"3.0.74","@ai-sdk/google":"3.0.67","@ai-sdk/openai":"3.0.60","@ai-sdk/openai-compatible":"2.0.46","@ai-sdk/react":"3.0.177","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","@mantine/spotlight":"4.2.12","@types/cli-progress":"3.11.6",ai:"6.0.175","body-parser":"1.20.2","cli-progress":"3.12.0",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4","date-fns":"4.1.0","date-fns-tz":"3.2.0",diff:"8.0.2","dts-dom":"3.7.0","fnv-plus":"1.3.1",jsonwebtoken:"9.0.2",kleur:"4.1.5",minisearch:"7.2.0","sanitize-html":"2.13.1",sirv:"2.0.3","tiny-glob":"0.2.9",zod:"4.4.3"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/table":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"3.35.0","@testing-library/preact":"3.2.4","@testing-library/user-event":"14.6.1","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1","@types/sanitize-html":"2.13.0","@vitest/browser":"4.1.8","@vitest/browser-playwright":"4.1.8",concurrently:"7.6.0",esbuild:"0.28.0",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0",jsdom:"27.2.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",playwright:"1.60.0",preact:"10.27.1","preact-iso":"2.11.1","preact-render-to-string":"6.6.7",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-easy-crop":"5.5.6","react-json-view-compare":"2.0.2",typescript:"6.0.3",vite:"8.0.13",vitest:"4.1.6",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"3.1.7","firebase-admin":">=11","firebase-functions":">=4"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function Ut(){return r("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("g",{"clip-path":"url(#clip0_1_318)",children:[r("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),r("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),r("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),r("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),r("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),r("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),r("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),r("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),r("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),r("defs",{children:r("clipPath",{id:"clip0_1_318",children:r("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}w();var Qt=ct(null);w();w();var Pe=Object.defineProperty,Ae=Object.defineProperties,Ne=Object.getOwnPropertyDescriptors,Zt=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,Gt=(t,e,o)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Te=(t,e)=>{for(var o in e||(e={}))Be.call(e,o)&&Gt(t,o,e[o]);if(Zt)for(var o of Zt(e))Ie.call(e,o)&&Gt(t,o,e[o]);return t},Me=(t,e)=>Ae(t,Ne(e));function De(t){return Me(Te({},t),{id:t.id||ft()})}function He(t){let e=[];return t.reduceRight((o,i)=>(e.includes(i.id)||(e.push(i.id),o.push(i)),o),[]).reverse()}function G(t){return He(t.map(e=>De(e)))}function Ft(t,e){let[o,i]=x(G(typeof t=="function"?t(e):t));return O(()=>{typeof t=="function"&&i(G(t(e)))},[e]),[o,{registerActions:s=>i(a=>G([...a,...s])),updateActions:s=>i(G(typeof s=="function"?s(e):s)),removeActions:s=>i(a=>a.filter(d=>!s.includes(d.id))),triggerAction:s=>{var a;let d=o.find(g=>g.id===s);(a=d?.onTrigger)==null||a.call(d,d)}}]}function Re(t,e){return t===null?[]:Array.isArray(t)?t.map(o=>[o,e]):[[t,e]]}function Kt(t,e){_t(Re(t,e))}w();w();var ze=j((t,{radius:e})=>({action:{position:"relative",display:"block",width:"100%",padding:"10px 12px",borderRadius:t.fn.radius(e)},actionHovered:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[1]},actionIcon:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]},actionBody:{flex:1}})),$t=ze;var We=Object.defineProperty,F=Object.getOwnPropertySymbols,qt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,Xt=(t,e,o)=>e in t?We(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ve=(t,e)=>{for(var o in e||(e={}))qt.call(e,o)&&Xt(t,o,e[o]);if(F)for(var o of F(e))Jt.call(e,o)&&Xt(t,o,e[o]);return t},Ue=(t,e)=>{var o={};for(var i in t)qt.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&F)for(var i of F(t))e.indexOf(i)<0&&Jt.call(t,i)&&(o[i]=t[i]);return o};function et(t){var e=t,{action:o,styles:i,classNames:l,hovered:c,onTrigger:m,highlightQuery:_,highlightColor:s,query:a,radius:d}=e,g=Ue(e,["action","styles","classNames","hovered","onTrigger","highlightQuery","highlightColor","query","radius"]);let{classes:u,cx:h}=$t({radius:d},{styles:i,classNames:l,name:"Spotlight"});return n.createElement(Q,Ve({className:h(u.action,{[u.actionHovered]:c}),tabIndex:-1,onMouseDown:b=>b.preventDefault(),onClick:m},g),n.createElement(wt,{noWrap:!0},o.icon&&n.createElement(yt,{className:u.actionIcon},o.icon),n.createElement("div",{className:u.actionBody},n.createElement(Ot,{highlightColor:s,highlight:_?a:null},o.title),o.description&&n.createElement(S,{color:"dimmed",size:"xs"},o.description))))}et.displayName="@mantine/spotlight/DefaultAction";w();var Qe=j(t=>({nothingFound:{},actions:{padding:t.spacing.xs/2,borderTop:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2]}`},actionsGroup:{textTransform:"uppercase",fontSize:t.spacing.xs,fontWeight:700,padding:"10px 12px",paddingBottom:0,paddingTop:15}})),Yt=Qe;function ot({actions:t,styles:e,classNames:o,actionComponent:i,hovered:l,onActionHover:c,onActionTrigger:m,query:_,nothingFoundMessage:s,highlightQuery:a,highlightColor:d,radius:g}){let{classes:u}=Yt(null,{classNames:o,styles:e,name:"Spotlight"}),h=t.map(v=>v.type==="item"?n.createElement(i,{query:_,key:v.item.id,action:v.item,hovered:v.index===l,onMouseEnter:()=>c(v.index),classNames:o,styles:e,radius:g,onTrigger:()=>m(v.item),highlightQuery:a,highlightColor:d}):n.createElement(S,{className:u.actionsGroup,color:"dimmed",key:v.label},v.label)),b=h.length>0||!!s&&_.trim().length>0;return n.createElement(n.Fragment,null,b&&n.createElement("div",{className:u.actions},h.length>0?h:n.createElement(S,{color:"dimmed",className:u.nothingFound,align:"center",size:"lg",py:"md"},s)))}ot.displayName="@mantine/spotlight/ActionsList";function Ze(t){return Array.isArray(t)?t.map(e=>e.trim()).join(",").toLowerCase().trim():typeof t=="string"?t.toLowerCase().trim():""}function te(t,e){let o=t.trim().toLowerCase(),i=[[],[]];return e.forEach(l=>{var c,m;(c=l.title)!=null&&c.toLowerCase().includes(o)?i[0].push(l):((m=l.description)!=null&&m.toLowerCase().includes(o)||Ze(l.keywords).includes(o))&&i[1].push(l)}),i.flat()}var Ge=Object.defineProperty,Fe=Object.defineProperties,Ke=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,oe=(t,e,o)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,re=(t,e)=>{for(var o in e||(e={}))$e.call(e,o)&&oe(t,o,e[o]);if(ee)for(var o of ee(e))Xe.call(e,o)&&oe(t,o,e[o]);return t},ie=(t,e)=>Fe(t,Ke(e)),qe=j((t,{centered:e,maxWidth:o,topOffset:i,radius:l})=>({root:ie(re({},t.fn.cover()),{position:"fixed"}),spotlight:{position:"relative",zIndex:2,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,borderRadius:t.fn.radius(l),width:"100%",maxWidth:o,overflow:"hidden",marginLeft:"calc(var(--removed-scroll-width, 0px) * -1)"},overlay:ie(re({},t.fn.cover()),{position:"fixed"}),inner:{height:"100vh",display:"flex",flexDirection:"column",paddingTop:e?t.spacing.md:i,justifyContent:e?"center":"flex-start",alignItems:"center"},searchInput:{border:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white}})),ne=qe;var Je=Object.defineProperty,K=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable,ae=(t,e,o)=>e in t?Je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ye=(t,e)=>{for(var o in e||(e={}))se.call(e,o)&&ae(t,o,e[o]);if(K)for(var o of K(e))le.call(e,o)&&ae(t,o,e[o]);return t},to=(t,e)=>{var o={};for(var i in t)se.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&K)for(var i of K(t))e.indexOf(i)<0&&le.call(t,i)&&(o[i]=t[i]);return o};function rt(t){var e=t,{query:o,onQueryChange:i,actions:l,onClose:c,opened:m,withinPortal:_,transition:s="pop",transitionDuration:a,classNames:d,styles:g,overlayColor:u="#000",overlayOpacity:h=.25,overlayBlur:b=3,shadow:v="md",radius:E="sm",centered:X=!1,closeOnActionTrigger:B=!0,highlightQuery:I=!1,highlightColor:T,maxWidth:M=600,topOffset:D=120,className:q,searchPlaceholder:H,searchIcon:R,filter:fe=te,nothingFoundMessage:he,limit:_e=10,actionComponent:ve=et,actionsWrapperComponent:ye="div",zIndex:be=dt("modal")}=e,Ce=to(e,["query","onQueryChange","actions","onClose","opened","withinPortal","transition","transitionDuration","classNames","styles","overlayColor","overlayOpacity","overlayBlur","shadow","radius","centered","closeOnActionTrigger","highlightQuery","highlightColor","maxWidth","topOffset","className","searchPlaceholder","searchIcon","filter","nothingFoundMessage","limit","actionComponent","actionsWrapperComponent","zIndex"]);let[z,k]=x(-1),[xe,at]=x(!1),{classes:P,cx:we}=ne({centered:X,maxWidth:M,topOffset:D,radius:E},{classNames:d,styles:g,name:"Spotlight"}),[,st]=ht(),Se=gt(m),J=()=>k(-1),W=()=>{J(),c()};mt({transitionDuration:0,opened:m});let ke=fe(o,l).slice(0,_e),lt=ut(ke).items,L=lt.map(f=>f.type==="item"?f.item:void 0).filter(f=>f);U(()=>{L.length-1<z&&k(L.length-1)},[L.length]);let Le=f=>{var A;if(!xe)switch(f.code){case"ArrowDown":{f.preventDefault(),k(y=>y<L.length-1?y+1:0);break}case"ArrowUp":{f.preventDefault(),k(y=>y>0?y-1:L.length-1);break}case"Enter":{f.preventDefault();let y=L[z];(A=y?.onTrigger)==null||A.call(y,y),B&&y?.onTrigger&&W();break}case"Escape":f.preventDefault(),W()}},Oe=f=>{i(f.currentTarget.value),z===-1&&k(0)};return n.createElement(St,{withinPortal:_,zIndex:be},n.createElement(kt,{onExited:()=>st(!1),onEntered:()=>st(!0),mounted:m,transitions:{spotlight:{duration:a,transition:s,timingFunction:"ease"},overlay:{duration:a/2,transition:"fade",timingFunction:"ease"}}},f=>n.createElement("div",Ye({className:we(P.root,q)},Ce),n.createElement("div",{className:P.inner,ref:Se},n.createElement(bt,{style:f.spotlight,className:P.spotlight,shadow:v,radius:E,onMouseLeave:J},n.createElement(jt,{value:o,onChange:Oe,onKeyDown:Le,onCompositionStart:()=>at(!0),onCompositionEnd:()=>at(!1),classNames:{input:P.searchInput},size:"lg",placeholder:H,icon:R,onMouseEnter:J,autoComplete:"chrome-please-just-do-not-show-it-thanks"}),n.createElement(ye,null,n.createElement(ot,{highlightQuery:I,highlightColor:T,actions:lt,actionComponent:ve,hovered:z,query:o,nothingFoundMessage:he,onActionHover:k,onActionTrigger:A=>{A.onTrigger(A),B&&W()},styles:g,classNames:d,radius:E}))),n.createElement("div",{style:f.overlay},n.createElement(Lt,{className:P.overlay,zIndex:1,onMouseDown:W,color:u,opacity:h,blur:b}))))))}rt.displayName="@mantine/spotlight/Spotlight";w();var it={open:"mantine:open-spotlight",close:"mantine:close-spotlight",toggle:"mantine:toggle-spotlight",triggerAction:"mantine:trigger-spotlight-action",registerActions:"mantine:register-spotlight-actions",removeActions:"mantine:remove-spotlight-actions"};function eo(t,e){return new CustomEvent(t,{detail:e})}function nt(){window.dispatchEvent(eo(it.open))}function ce(t){let e={registerActions:o=>t.registerActions(o.detail),removeActions:o=>t.removeActions(o.detail),triggerAction:o=>t.triggerAction(o.detail),open:t.openSpotlight,close:t.closeSpotlight,toggle:t.toggleSpotlight};O(()=>(Object.keys(e).forEach(o=>{window.addEventListener(it[o],e[o])}),()=>{Object.keys(e).forEach(o=>{window.removeEventListener(it[o],e[o])})}),[])}var oo=Object.defineProperty,$=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,pe=(t,e,o)=>e in t?oo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ro=(t,e)=>{for(var o in e||(e={}))de.call(e,o)&&pe(t,o,e[o]);if($)for(var o of $(e))ue.call(e,o)&&pe(t,o,e[o]);return t},io=(t,e)=>{var o={};for(var i in t)de.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&$)for(var i of $(t))e.indexOf(i)<0&&ue.call(t,i)&&(o[i]=t[i]);return o};function me(t){var e=t,{actions:o,children:i,shortcut:l="mod + K",onSpotlightClose:c,onSpotlightOpen:m,onQueryChange:_,cleanQueryOnClose:s=!0,transitionDuration:a=150}=e,d=io(e,["actions","children","shortcut","onSpotlightClose","onSpotlightOpen","onQueryChange","cleanQueryOnClose","transitionDuration"]);let g=pt(-1),[u,h]=x(""),[b,{registerActions:v,updateActions:E,removeActions:X,triggerAction:B}]=Ft(o,u);U(()=>{E(o)},[o]);let I=R=>{h(R),_?.(R)},[T,{open:M,close:D,toggle:q}]=vt(!1,{onClose:()=>{c?.(),s&&(g.current=window.setTimeout(()=>{I("")},a))},onOpen:()=>{m?.(),window.clearTimeout(g.current)}}),H={openSpotlight:M,closeSpotlight:D,toggleSpotlight:q,registerActions:v,removeActions:X,triggerAction:B,opened:T,actions:b,query:u};return Kt(l,M),ce(H),n.createElement(Qt.Provider,{value:H},n.createElement(rt,ro({actions:b,onClose:D,opened:T,query:u,onQueryChange:I,transitionDuration:a},d)),i)}me.displayName="@mantine/spotlight/SpotlightProvider";je();function ge(t){let[e,o]=x(!1);O(()=>{let l=navigator.userAgentData?.platform??navigator.platform;o(/mac/i.test(l||""))},[]);let i=()=>{nt()};return r("button",{type:"button",className:N("SearchBar",t.className),onClick:i,"aria-label":"Open search",children:[r(zt,{className:"SearchBar__icon",size:16,stroke:1.5}),r("span",{className:"SearchBar__placeholder",children:"Search"}),r("span",{className:"SearchBar__shortcut","aria-hidden":"true",children:e?"\u2318 + K":"Ctrl + K"})]})}var C="1.5";function p(t){return r("div",{className:"Layout",children:[r(p.Top,{}),r(p.Side,{}),r(p.Main,{...t,children:t.children}),r(p.Bottom,{})]})}function no(t){let o=t.split("?")[0].replace(/\/+$/g,"").split("/").filter(Boolean);return o.length===4&&o[0]==="cms"&&o[1]==="content"}p.Top=()=>{let t=window.__ROOT_CTX.rootConfig,e=t.projectName||t.projectId,o=t.minimalBranding,{url:i}=Y(),l=!no(i);return r("div",{className:"Layout__top",children:[o?r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:e}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]})]}):r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:r(Ut,{})}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]}),r("div",{className:"Layout__top__project",children:e})]}),l&&r("div",{className:"Layout__top__search",children:r(ge,{})})]})};p.Side=()=>{let{url:t}=Y(),e=t.replace(/\/*$/g,""),o=window.firebase.user,i=window.__ROOT_CTX.sidebar?.tools,l=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),c=s=>l.has(s),m=window.__ROOT_CTX.experiments||{},_=async()=>{await window.firebase.auth.signOut(),window.location.href="/cms/login"};return r("div",{className:"Layout__side",children:[r("div",{className:"Layout__side__buttons",children:[!c("home")&&r(p.SideButton,{label:"Home",url:"/cms",active:e==="/cms",children:r(It,{stroke:C})}),!c("content")&&r(p.SideButton,{label:"Content",url:"/cms/content",active:e.startsWith("/cms/content"),children:r(Bt,{stroke:C})}),m.taskManager&&r(p.SideButton,{label:"Tasks",url:"/cms/tasks",active:e.startsWith("/cms/tasks"),children:r(At,{stroke:C})}),!c("releases")&&r(p.SideButton,{label:"Releases",url:"/cms/releases",active:e.startsWith("/cms/releases"),children:r(Rt,{stroke:C})}),!c("data")&&r(p.SideButton,{label:"Data",url:"/cms/data",active:e.startsWith("/cms/data"),children:r(Nt,{stroke:C})}),!c("assets")&&r(p.SideButton,{label:"Asset Library",url:"/cms/assets",active:e.startsWith("/cms/assets"),children:r(Dt,{stroke:C})}),!c("translations")&&r(p.SideButton,{label:"Translations",url:"/cms/translations",active:e.startsWith("/cms/translations"),children:r(Tt,{stroke:C})}),Vt()&&!c("ai")&&r(p.SideButton,{label:"Root AI",url:"/cms/ai",active:e.startsWith("/cms/ai"),children:r(Ht,{stroke:C})}),i&&r(V,{children:[r("div",{className:"Layout__side__divider"}),Object.entries(i).map(([s,a])=>{let d=a.cmsUrl?.startsWith("/cms/")?a.cmsUrl:void 0,g=a.externalUrl,u=g??d??`/cms/tools/${s}`,h=g?void 0:u.replace(/\/*$/g,""),b=!g&&!!h&&(e===h||e.startsWith(`${h}/`));return r(p.SideButton,{className:"Layout__side__tool",label:a.label||"",url:u,active:b,external:!!g,children:a.icon?r("img",{className:"Layout__side__tool__icon",src:a.icon,alt:a.label||""}):r(Pt,{stroke:C})},s)}),r("div",{className:"Layout__side__divider"})]}),!c("settings")&&r(p.SideButton,{label:"Settings",url:"/cms/settings",active:e.startsWith("/cms/settings"),children:r(Wt,{stroke:C})})]}),r("div",{className:"Layout__side__user",children:r(Z,{shadow:"md",position:"right",control:r(Q,{children:r(xt,{src:o.photoURL,alt:o.email,size:30,radius:"xl"})}),children:[r(Z.Label,{children:r(S,{size:"xs",color:"dimmed",truncate:!0,children:["Signed in as ",o.email]})}),r(Ct,{}),r(Z.Item,{color:"red",icon:r(Mt,{style:{width:14,height:14}}),onClick:_,children:"Sign out"})]})})]})};p.SideButton=t=>r(Et,{className:N("Layout__side__button",t.className),label:t.label,position:"right",withArrow:!0,children:r("a",{className:N(t.active&&"active"),href:t.url,target:t.external?"_blank":void 0,rel:t.external?"noreferrer noopener":void 0,children:t.children})});p.Main=t=>r("div",{className:"Layout__main",children:t.children});p.Bottom=()=>r("div",{className:"Layout__bottom"});export{nt as a,me as b,p as c};
@@ -1 +1 @@
1
- import{a as _t,b as gt,c as pt}from"./chunk-2RRM4HEQ.js";import{a as lt}from"./chunk-PLYSJ7W5.js";import{a as ut}from"./chunk-W5DOO6ID.js";import{a as ft}from"./chunk-YBHFGQ3Z.js";import{b as M}from"./chunk-2PTLQRTU.js";import{a as A,b as He,c as Oe}from"./chunk-PIJ3E47R.js";import{g as oe,h as Ke,i as Me,j as Ze,k as Je,l as Qe,m as Ye,n as et,o as tt,p as st,q as ce,r as ot,s as Fe,t as at,u as me,y as _e,z as fe}from"./chunk-ISUGBMXC.js";import{B as Ce,z as Ve}from"./chunk-XOWWPE7X.js";import{e as ue}from"./chunk-WASID5UU.js";import{Ab as nt,Da as re,Db as it,Eb as he,Fa as Ge,Ga as e,Gc as ct,Hb as rt,Ib as ve,Jb as ze,Tb as dt,V as te,Vc as W,W as se,Yc as mt,a as i,bb as Ne,c as U,da as g,ea as G,g as $e,j as Le,na as je,pb as ge,qa as k,qc as Ie,ra as S,ua as H,xb as De,zb as pe}from"./chunk-WRA24P66.js";import{d as C}from"./chunk-KUCVLANF.js";import{g as We,h as de,k as D,l as O,m as ke,n as V,o as Xe,p as qe}from"./chunk-7SK47HHZ.js";Le();Le();function ht(t){let o=t.file||{},a=o.src||"",l=o.filename||a,r={"--asset-thumb-size":`${t.size}px`};if(a&&O(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("img",{src:Te(o,t.size*2),alt:o.alt||"",loading:"lazy"})});if(a&&V(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("video",{src:a,muted:!0,playsInline:!0,preload:"metadata"})});let m=D(l);return e("div",{className:"AssetBrowser__thumb",style:r,children:m&&m.length<=4?e("div",{className:"AssetBrowser__thumb__ext",children:m}):e(he,{size:20,stroke:"1.5"})})}function Te(t,o){let a=t?.src||"";return a.startsWith(We)&&o?`${a}=s${o}`:a}function we(t){let o=t?.src||"";ke(o)&&(o=o.split("=")[0]+"=s0"),navigator.clipboard.writeText(o).then(()=>{A({message:"Copied URL to clipboard.",autoClose:2e3})})}function be(t){let o=t?.src||"";if(o)if(ke(o)){let a=document.createElement("a");a.href=qe(o),t.filename&&(a.download=t.filename),document.body.appendChild(a),a.click(),document.body.removeChild(a)}else window.open(o,"_blank")}function vt(t){let[o,a]=i(t.asset),[l,r]=i(t.asset.file?.alt||""),[m,d]=i(!1),[x,v]=i(!1),[f,B]=i(null),[w,F]=i(null),n=o.file||{},u=n.filename||o.name,N=O(u),R=V(u),X=l!==(n.alt||""),q=n.altDisabled===!0;U(()=>{_e(o.id).then(c=>F(c)).catch(c=>{console.error("failed to fetch asset usage:",c),F([])})},[o.id]);async function z(c,b){let p=await fe(c,{previousFile:b});p.failedDocIds.length>0?A({title:"Some docs failed to update",message:`Failed to update: ${p.failedDocIds.join(", ")}. Re-save the asset to retry.`,color:"red",autoClose:!1}):p.updatedDocIds.length>0&&A({message:`Updated ${p.updatedDocIds.length} doc(s) that use this asset.`,color:"green"})}async function K(){d(!0),await M(async()=>{let c={...n},b=await at(o,l);a(b),t.onChanged(b),await z(b,c)}),d(!1)}function E(){let c=document.createElement("input");c.type="file",c.onchange=()=>{let b=c.files?.[0];if(!b)return;let p=D(u),y=D(b.name);if(p&&y&&p!==y){B(b);return}$(b)},c.click(),c.remove()}async function $(c){B(null),d(!0),await M(async()=>{let b={...n},p=await de(c),y=await ot(o,p);a(y),r(y.file?.alt||""),t.onChanged(y),await z(y,b)}),d(!1)}async function P(c){d(!0),await M(async()=>{let b={...n},p=await me(o,c);a(p),r(p.file?.alt||""),t.onChanged(p),await z(p,b)}),d(!1)}async function Z(){d(!0),await M(async()=>{await ce(o),A({message:`Deleted "${o.name}".`,color:"green"}),t.onDeleted()}),d(!1)}return e(S,{className:"AssetBrowser__detailsModal",opened:!0,onClose:t.onClose,title:o.name,size:720,overflow:"outside",centered:!0,children:e("div",{className:"AssetBrowser__details",children:[e("div",{className:"AssetBrowser__details__preview",children:N?e("img",{src:Te(n,800),alt:n.alt||"",style:n.canvasBgColor==="dark"?{background:"#000"}:{}}):R?e("video",{src:n.src,controls:!0,muted:!0,preload:"metadata"}):e("div",{className:"AssetBrowser__details__preview__placeholder",children:[e(he,{size:48,stroke:"1"}),e("div",{children:u})]})}),e(re,{className:"AssetBrowser__details__table",verticalSpacing:"xs",fontSize:"xs",children:e("tbody",{children:[e("tr",{children:[e("td",{children:e("b",{children:"Filename"})}),e("td",{children:u})]}),!!(n.width&&n.height)&&e("tr",{children:[e("td",{children:e("b",{children:"Dimensions"})}),e("td",{children:[n.width,"x",n.height]})]}),o.createdAt&&e("tr",{children:[e("td",{children:e("b",{children:"Uploaded"})}),e("td",{children:[Ce(o.createdAt),o.createdBy&&e(C,{children:[" by ",o.createdBy]})]})]}),o.modifiedAt&&e("tr",{children:[e("td",{children:e("b",{children:"Modified"})}),e("td",{children:[Ce(o.modifiedAt),o.modifiedBy&&e(C,{children:[" by ",o.modifiedBy]})]})]}),e("tr",{children:[e("td",{children:e("b",{children:"URL"})}),e("td",{children:e("div",{className:"AssetBrowser__details__url",children:[e(H,{readOnly:!0,value:n.src||"",size:"xs",radius:"xs",onClick:c=>c.target.select(),styles:{root:{flex:1,minWidth:0}}}),e(Ge,{label:"Copy URL",transition:"pop",children:e(se,{size:"sm",onClick:()=>we(n),children:e(ge,{size:16})})})]})})]})]})}),(N||R)&&e("div",{className:"AssetBrowser__details__alt",children:[q?e("div",{className:"AssetBrowser__details__alt__disabledNote",children:"Alt text is disabled for this asset. Docs that use it hide the alt text input and render no alt text."}):e(C,{children:[e(je,{label:"Alt text",description:"Used as the default alt text when the asset is selected in a doc. Updating it syncs docs that use this asset.",autosize:!0,minRows:1,size:"xs",value:l,disabled:!t.canManage||m,onChange:c=>r(c.currentTarget.value)}),t.canManage&&X&&e(g,{size:"xs",color:"dark",mt:8,loading:m,onClick:()=>K(),children:"Save alt text"})]}),t.canManage&&e(G,{className:"AssetBrowser__details__alt__disableCheckbox",label:"Disable alt text (e.g. decorative images)",size:"xs",mt:8,checked:q,disabled:m,onChange:c=>P(c.currentTarget.checked)})]}),e("div",{className:"AssetBrowser__details__usage",children:[e("div",{className:"AssetBrowser__details__usage__title",children:"Used in"}),w===null?e(te,{color:"gray",size:"sm"}):w.length===0?e("div",{className:"AssetBrowser__details__usage__empty",children:"No docs use this asset."}):e("div",{className:"AssetBrowser__details__usage__list",children:w.map(c=>e("a",{className:"AssetBrowser__details__usage__doc",href:`/cms/content/${c.id}`,target:"_blank",rel:"noreferrer",children:[e("span",{children:c.id}),e(nt,{size:14})]},c.id))})]}),e("div",{className:"AssetBrowser__details__buttons",children:[e(g,{variant:"default",size:"xs",leftIcon:e(pe,{size:14}),onClick:()=>be(n),children:"Download"}),t.canManage&&e(C,{children:[e(g,{variant:"default",size:"xs",leftIcon:e(it,{size:14}),loading:m,onClick:()=>E(),children:"Replace file"}),e(g,{className:"AssetBrowser__details__buttons__delete",color:"red",variant:"filled",size:"xs",leftIcon:e(W,{size:14}),disabled:m,onClick:()=>v(!0),children:"Delete"})]})]}),f&&e("div",{className:"AssetBrowser__details__confirmReplace",children:[e("div",{children:["The new file has a different type (",e("b",{children:[".",D(u)]})," ","\u2192 ",e("b",{children:[".",D(f.name)]}),"). Replacing will change the asset's file extension and serving URL",Fe(o.name,D(f.name))!==o.name&&e(C,{children:[", and the asset will be renamed to"," ",e("b",{children:Fe(o.name,D(f.name))})]}),". Docs that use this asset will be updated."]}),e("div",{className:"AssetBrowser__details__confirmReplace__buttons",children:[e(g,{variant:"default",size:"xs",onClick:()=>B(null),disabled:m,children:"Cancel"}),e(g,{color:"dark",size:"xs",loading:m,onClick:()=>$(f),children:"Replace"})]})]}),x&&e("div",{className:"AssetBrowser__details__confirmDelete",children:[e("div",{children:["Delete ",e("b",{children:o.name})," from the asset library?",w&&w.length>0&&e(C,{children:[" ","This asset is used in ",w.length," doc(s); those docs keep their copy of the file but will no longer receive updates."]})]}),e("div",{className:"AssetBrowser__details__confirmDelete__buttons",children:[e(g,{variant:"default",size:"xs",onClick:()=>v(!1),disabled:m,children:"Cancel"}),e(g,{color:"red",size:"xs",loading:m,onClick:()=>Z(),children:"Delete"})]})]})]})})}var Mt=100;function Ue(t){let[o,a]=i(t.folder??t.initialFolder??""),l=t.folder??o,[r,m]=i([]),[d,x]=i(!0),[v,f]=i(""),[B,w]=i(!1),[F,n]=i(!1),[u,N]=i(null),[R,X]=i(!1),[q,z]=i(null),[K,E]=i(null),[$,P]=i(null),[Z,c]=i(null),[b,p]=i(null),[y,ae]=i(new Map),{roles:At}=ft(),xt=window.firebase.user.email||"",J=ut(At,xt),Q=v.trim().length>0;function L(s){a(s),f(""),t.onFolderChange&&t.onFolderChange(s)}async function I(s){x(!0),N(null),ae(new Map),await M(async()=>{let _=await Me(s);m(_)}),x(!1)}U(()=>{I(l)},[l]),U(()=>{if(!Q||u!==null)return;let s=!1;return(async()=>{let _=[];await M(async()=>{_=await Ze(l)}),s||N(_)})(),()=>{s=!0}},[Q,u,l]);let Ae=t.mode==="manage"?t.initialAssetId:"";U(()=>{Ae&&M(async()=>{let s=await Qe(Ae);s&&s.type==="file"&&(L(s.parent),p(s))})},[Ae]);let Se=$e(()=>{let s=v.trim().toLowerCase(),_=s?u||[]:r;return t.mode==="pick"&&(_=_.filter(h=>h.type==="folder"||Xe(h.file?.filename||h.name,t.accept))),s&&(_=_.filter(h=>h.name.toLowerCase().includes(s))),_},[r,u,v,t.mode,t.accept]),T=_t(Se,{pageSize:Mt,resetDeps:[l,v]}),j=T.pageItems;async function Ee(s){if(s.length===0||F)return;let _="asset-browser-upload";n(!0),A({id:_,message:`Uploading ${s.length} file(s)...`,loading:!0,autoClose:!1,disallowClose:!0});let h=[],Be=[];for(let ne=0;ne<s.length;ne++){let ie=s[ne];He({id:_,message:`Uploading ${ie.name} (${ne+1} of ${s.length})...`,loading:!0,autoClose:!1,disallowClose:!0});try{let ye=await de(ie),kt=await et({parent:l,file:ye});h.push(kt)}catch(ye){console.error(`failed to upload ${ie.name}:`,ye),Be.push(ie.name)}}Oe(_),n(!1),Be.length>0?A({title:"Upload failed",message:`Failed to upload: ${Be.join(", ")}`,color:"red",autoClose:!1}):A({message:`Uploaded ${h.length} file(s).`,color:"green"}),await I(l),t.mode==="pick"&&h.length===1&&s.length===1&&t.onPickFile&&t.onPickFile(h[0])}function Bt(){let s=document.createElement("input");s.type="file",s.multiple=!0,t.mode==="pick"&&t.accept&&t.accept.length>0&&(s.accept=t.accept.join(",")),s.onchange=()=>{Ee(Array.from(s.files||[]))},s.click(),s.remove()}function yt(s){t.onPickFile&&t.onPickFile(s)}let Y=J,le=t.mode==="manage"&&J,ee=Array.from(y.values()),Pe=ee.filter(s=>s.type==="file"&&!s.file?.altDisabled&&(O(s.file?.filename||s.name)||V(s.file?.filename||s.name))),xe=j.length>0&&j.every(s=>y.has(s.id));function Re(s){ae(_=>{let h=new Map(_);return h.has(s.id)?h.delete(s.id):h.set(s.id,s),h})}function Ct(){ae(s=>{let _=new Map(s);return xe?j.forEach(h=>_.delete(h.id)):j.forEach(h=>_.set(h.id,h)),_})}return e("div",{className:ue("AssetBrowser",t.className,`AssetBrowser--${t.mode}`),children:[e("div",{className:"AssetBrowser__toolbar",children:[e(Ue.Breadcrumbs,{folder:l,onNavigate:L}),e("div",{className:"AssetBrowser__toolbar__actions",children:[e(H,{className:"AssetBrowser__toolbar__filter",placeholder:"Search by name",size:"xs",icon:e(ct,{size:14}),value:v,onChange:s=>f(s.currentTarget.value)}),Y&&t.mode==="manage"&&e(g,{variant:"default",size:"xs",leftIcon:e(rt,{size:16}),onClick:()=>X(!0),children:"New folder"}),Y&&e(g,{color:"dark",size:"xs",leftIcon:e(mt,{size:16}),loading:F,onClick:()=>Bt(),children:"Upload"})]})]}),le&&ee.length>0&&e("div",{className:"AssetBrowser__selectionBar",children:[e("div",{className:"AssetBrowser__selectionBar__count",children:[ee.length," selected"]}),e("div",{className:"AssetBrowser__selectionBar__actions",children:[e(g,{variant:"default",size:"xs",leftIcon:e(ve,{size:14}),onClick:()=>E(ee),children:"Move"}),Pe.length>0&&e(g,{variant:"default",size:"xs",onClick:()=>c(Pe),children:"Disable alt text"}),e(g,{color:"red",size:"xs",leftIcon:e(W,{size:14}),onClick:()=>P(ee),children:"Delete"}),e(g,{variant:"subtle",color:"gray",size:"xs",onClick:()=>ae(new Map),children:"Clear"})]})]}),e("div",{className:ue("AssetBrowser__listing",B&&"dragging"),onDragOver:s=>{Y&&(s.preventDefault(),w(!0))},onDragLeave:s=>{s.preventDefault(),w(!1)},onDrop:s=>{s.preventDefault(),w(!1),Y&&Ee(Array.from(s.dataTransfer?.files||[]))},children:d||Q&&u===null?e("div",{className:"AssetBrowser__loading",children:e(te,{color:"gray",size:"lg"})}):Se.length===0?e("div",{className:"AssetBrowser__empty","data-testid":"asset-browser-empty",children:v?e("div",{children:['No assets match "',v,'" in this folder or its subfolders.']}):e(C,{children:[e("div",{children:"This folder is empty."}),Y&&e("div",{className:"AssetBrowser__empty__hint",children:'Drop files here or click "Upload" to add assets.'})]})}):e(re,{className:"AssetBrowser__table",verticalSpacing:"xs",fontSize:"xs",highlightOnHover:!0,children:[e("thead",{children:e("tr",{children:[le&&e("th",{className:"AssetBrowser__table__checkboxCol",children:e(G,{size:"xs","aria-label":"Select all",checked:xe,indeterminate:!xe&&j.some(s=>y.has(s.id)),onChange:()=>Ct()})}),e("th",{children:"name"}),e("th",{className:"AssetBrowser__table__modifiedCol",children:"modified"}),e("th",{className:"AssetBrowser__table__actionsCol"})]})}),e("tbody",{children:j.map(s=>s.type==="folder"?e("tr",{className:"AssetBrowser__row AssetBrowser__row--folder",onClick:()=>L(oe(s.parent,s.name)),children:[le&&e("td",{className:"AssetBrowser__checkboxCell",onClick:_=>_.stopPropagation(),children:e(G,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>Re(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e("div",{className:"AssetBrowser__thumb",children:e(ze,{size:24,stroke:"1.5"})}),e("div",{className:"AssetBrowser__nameCell__text",children:[e("div",{className:"AssetBrowser__nameCell__name",children:s.name}),e(wt,{asset:s,folder:l,searching:Q,onNavigate:L})]})]})}),e("td",{children:e(bt,{asset:s})}),e("td",{onClick:_=>_.stopPropagation(),children:e("div",{className:"AssetBrowser__actionsCell",children:t.mode==="manage"&&J&&e(k,{shadow:"sm",position:"bottom",placement:"end",control:e(se,{size:"sm",children:e(De,{size:16})}),children:[e(k.Item,{icon:e(Ie,{size:14}),onClick:()=>z(s),children:"Rename"}),e(k.Item,{icon:e(ve,{size:14}),onClick:()=>E([s]),children:"Move"}),e(k.Item,{color:"red",icon:e(W,{size:14}),onClick:()=>P([s]),children:"Delete"})]})})})]},s.id):e("tr",{className:"AssetBrowser__row AssetBrowser__row--file",onClick:()=>{t.mode==="pick"?yt(s):p(s)},children:[le&&e("td",{className:"AssetBrowser__checkboxCell",onClick:_=>_.stopPropagation(),children:e(G,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>Re(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e(ht,{file:s.file,size:36}),e("div",{className:"AssetBrowser__nameCell__text",children:[e("div",{className:"AssetBrowser__nameCell__name",children:[s.name,!!(s.file?.width&&s.file?.height)&&e("span",{className:"AssetBrowser__nameCell__dimens",children:[" ","(",s.file.width,"x",s.file.height,")"]})]}),e(wt,{asset:s,folder:l,searching:Q,onNavigate:L})]})]})}),e("td",{children:e(bt,{asset:s})}),e("td",{onClick:_=>_.stopPropagation(),children:e("div",{className:"AssetBrowser__actionsCell",children:t.mode!=="pick"&&e(Ft,{asset:s,canManage:J,onDetails:()=>p(s),onRename:()=>z(s),onMove:()=>E([s]),onDelete:()=>P([s])})})})]},s.id))})]})}),T.totalPages>1&&e("div",{className:"AssetBrowser__footer",children:[e(pt,{start:T.start,end:T.end,total:T.totalItems,noun:"asset"}),e(gt,{total:T.totalPages,page:T.page,onChange:T.setPage})]}),e(Nt,{opened:R,parent:l,onClose:()=>X(!1),onCreated:s=>{X(!1),L(oe(l,s))}}),q&&e(Dt,{asset:q,onClose:()=>z(null),onRenamed:()=>{z(null),I(l)}}),K&&K.length>0&&e(zt,{assets:K,onClose:()=>E(null),onMoved:()=>{E(null),I(l)}}),$&&$.length>0&&e(Tt,{assets:$,onClose:()=>P(null),onDeleted:()=>{P(null),I(l)}}),Z&&Z.length>0&&e(Ut,{assets:Z,onClose:()=>c(null),onDone:()=>{c(null),I(l)}}),b&&e(vt,{asset:b,canManage:J,onClose:()=>p(null),onChanged:()=>I(l),onDeleted:()=>{p(null),I(l)}})]})}Ue.Breadcrumbs=t=>{let o=Ke(t.folder),a=[{label:"Assets",path:""}];return o.forEach((l,r)=>{a.push({label:l,path:o.slice(0,r+1).join("/")})}),e("div",{className:"AssetBrowser__breadcrumbs",children:a.map((l,r)=>e("div",{className:"AssetBrowser__breadcrumbs__crumb",children:[r>0&&e(Ne,{className:"AssetBrowser__breadcrumbs__divider",size:14}),e("button",{className:ue("AssetBrowser__breadcrumbs__link",r===a.length-1&&"active"),disabled:r===a.length-1,onClick:()=>t.onNavigate(l.path),children:l.label})]},l.path))})};function Ft(t){let o=t.asset;return e(k,{shadow:"sm",position:"bottom",placement:"end",control:e(se,{size:"sm",children:e(De,{size:16})}),children:[e(k.Item,{icon:e(dt,{size:14}),onClick:t.onDetails,children:"Details"}),e(k.Item,{icon:e(ge,{size:14}),onClick:()=>we(o.file),children:"Copy URL"}),e(k.Item,{icon:e(pe,{size:14}),onClick:()=>be(o.file),children:"Download"}),t.canManage&&e(C,{children:[e(k.Item,{icon:e(Ie,{size:14}),onClick:t.onRename,children:"Rename"}),e(k.Item,{icon:e(ve,{size:14}),onClick:t.onMove,children:"Move"}),e(k.Item,{color:"red",icon:e(W,{size:14}),onClick:t.onDelete,children:"Delete"})]})]})}function wt(t){let o=t.asset;return!t.searching||o.parent===t.folder?null:e("button",{className:"AssetBrowser__nameCell__path",title:"Go to folder",onClick:a=>{a.stopPropagation(),t.onNavigate(o.parent)},children:["in ",Je(o.parent,t.folder)]})}function bt(t){let o=t.asset.modifiedAt||t.asset.createdAt,a=t.asset.modifiedBy||t.asset.createdBy||"",l=o&&typeof o.toMillis=="function"?o.toMillis():0;return e("div",{className:"AssetBrowser__modifiedCell",children:[a&&e(lt,{email:a,size:20}),e("span",{children:l?Ve(l):"\u2014"})]})}function Nt(t){let[o,a]=i(""),[l,r]=i(!1);async function m(){r(!0),await M(async()=>{let d=await Ye(t.parent,o);a(""),t.onCreated(d.name)}),r(!1)}return e(S,{opened:t.opened,onClose:t.onClose,title:"New folder",size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),m()},children:[e(H,{"data-autofocus":!0,placeholder:"Folder name",value:o,onChange:d=>a(d.currentTarget.value)}),e(g,{type:"submit",color:"dark",loading:l,disabled:!o,children:"Create"})]})})}function Dt(t){let[o,a]=i(t.asset.name),[l,r]=i(!1);async function m(){r(!0),await M(async()=>{await tt(t.asset,o),t.onRenamed()}),r(!1)}return e(S,{opened:!0,onClose:t.onClose,title:`Rename ${t.asset.type}`,size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),m()},children:[e(H,{"data-autofocus":!0,value:o,onChange:d=>a(d.currentTarget.value)}),e(g,{type:"submit",color:"dark",loading:l,disabled:!o,children:"Rename"})]})})}function zt(t){let o=t.assets,[a,l]=i(o[0]?.parent||""),[r,m]=i([]),[d,x]=i(!0),[v,f]=i(!1);U(()=>{x(!0),M(async()=>{let n=await Me(a);m(n.filter(u=>u.type==="folder"))}).then(()=>x(!1))},[a]);let B=o.filter(n=>n.type==="folder").map(n=>oe(n.parent,n.name));function w(n){return B.some(u=>n===u||n.startsWith(`${u}/`))}async function F(){f(!0);let n=[],u=0;for(let N of o)try{await st(N,a),u+=1}catch(R){console.error(`failed to move ${N.name}:`,R),n.push(N.name)}f(!1),n.length>0&&A({title:"Move failed",message:`Failed to move: ${n.join(", ")}`,color:"red",autoClose:!1}),u>0&&A({message:o.length===1?`Moved "${o[0].name}" to ${a||"Assets"}.`:`Moved ${u} item(s) to ${a||"Assets"}.`,color:"green"}),t.onMoved()}return e(S,{opened:!0,onClose:t.onClose,title:o.length===1?`Move "${o[0].name}"`:`Move ${o.length} items`,size:"md",centered:!0,children:e("div",{className:"AssetBrowser__moveModal",children:[e(Ue.Breadcrumbs,{folder:a,onNavigate:l}),e("div",{className:"AssetBrowser__moveModal__folders",children:d?e(te,{color:"gray",size:"sm"}):r.length===0?e("div",{className:"AssetBrowser__moveModal__empty",children:"No subfolders."}):r.map(n=>{let u=oe(n.parent,n.name);return e("button",{className:"AssetBrowser__moveModal__folder",disabled:w(u),onClick:()=>l(u),children:[e(ze,{size:16,stroke:"1.5"}),e("span",{children:n.name}),e(Ne,{size:14})]},n.id)})}),e(g,{color:"dark",fullWidth:!0,loading:v,disabled:o.every(n=>n.parent===a),onClick:()=>F(),children:"Move here"})]})})}var It=20;function Tt(t){let o=t.assets,[a,l]=i(!1),[r,m]=i(null),d=o.filter(f=>f.type==="file"),x=o.some(f=>f.type==="folder");U(()=>{d.length===0||d.length>It||Promise.all(d.map(f=>_e(f.id))).then(f=>{let B=new Set(f.flat().map(w=>w.id));m(B.size)}).catch(()=>m(null))},[o.map(f=>f.id).join(",")]);async function v(){l(!0);let f=[],B=0;for(let w of o)try{await ce(w),B+=1}catch(F){console.error(`failed to delete ${w.name}:`,F),f.push(w.name)}l(!1),f.length>0&&A({title:"Delete failed",message:`Failed to delete: ${f.join(", ")}. Note that folders must be empty before they can be deleted.`,color:"red",autoClose:!1}),B>0&&A({message:o.length===1?`Deleted "${o[0].name}".`:`Deleted ${B} item(s).`,color:"green"}),t.onDeleted()}return e(S,{opened:!0,onClose:t.onClose,title:o.length===1?`Delete ${o[0].type}?`:`Delete ${o.length} items?`,size:"sm",centered:!0,children:e("div",{className:"AssetBrowser__deleteModal",children:[e("div",{className:"AssetBrowser__deleteModal__text",children:["Are you sure you want to delete"," ",o.length===1?e("b",{children:o[0].name}):e("b",{children:[o.length," items"]})," ","from the asset manager?",d.length>0&&e(C,{children:[" ","The underlying files are not deleted from GCS, and docs that currently use the assets keep their copy of the files."]}),x&&e(C,{children:" Folders must be empty before they can be deleted."})]}),r!==null&&r>0&&e("div",{className:"AssetBrowser__deleteModal__warning",children:[o.length===1?"This asset is":"These assets are"," ","currently used in ",r," doc(s). Those docs will no longer receive updates when the asset changes."]}),e("div",{className:"AssetBrowser__deleteModal__buttons",children:[e(g,{variant:"default",onClick:t.onClose,disabled:a,children:"Cancel"}),e(g,{color:"red",loading:a,onClick:()=>v(),children:"Delete"})]})]})})}function Ut(t){let o=t.assets,[a,l]=i(!1);async function r(){l(!0);let m=[],d=0;for(let x of o)try{let v=x.file,f=await me(x,!0);await fe(f,{previousFile:v}),d+=1}catch(v){console.error(`failed to disable alt text for ${x.name}:`,v),m.push(x.name)}l(!1),m.length>0&&A({title:"Failed to disable alt text",message:`Failed to update: ${m.join(", ")}`,color:"red",autoClose:!1}),d>0&&A({message:`Disabled alt text for ${d} file(s).`,color:"green"}),t.onDone()}return e(S,{opened:!0,onClose:t.onClose,title:"Disable alt text?",size:"sm",centered:!0,children:e("div",{className:"AssetBrowser__deleteModal",children:[e("div",{className:"AssetBrowser__deleteModal__text",children:["Disable alt text for ",e("b",{children:[o.length," file(s)"]}),"? The alt text input is hidden in docs that use these assets and their embedded alt text is cleared. Alt text can be re-enabled per asset from its details."]}),e("div",{className:"AssetBrowser__deleteModal__buttons",children:[e(g,{variant:"default",onClick:t.onClose,disabled:a,children:"Cancel"}),e(g,{color:"dark",loading:a,onClick:()=>r(),children:"Disable alt text"})]})]})})}export{Ue as a};
1
+ import{a as _t,b as gt,c as pt}from"./chunk-H5JL376P.js";import{a as mt}from"./chunk-LS2JH5QF.js";import{a as ut}from"./chunk-W5DOO6ID.js";import{a as ft}from"./chunk-ZQDUWURP.js";import{b as M}from"./chunk-U5OXKKBN.js";import{a as A,b as He,c as Oe}from"./chunk-ZYSR5UIW.js";import{g as oe,h as Ke,i as Me,j as Ze,k as Je,l as Qe,m as Ye,n as et,o as tt,p as st,q as ce,r as ot,s as Fe,t as at,u as me,y as _e,z as fe}from"./chunk-ISUGBMXC.js";import{B as Ce,z as Ve}from"./chunk-XOWWPE7X.js";import{e as ve}from"./chunk-GJ7ES2LA.js";import{Da as re,Db as nt,Eb as pe,Fa as Ge,Gc as dt,Hb as it,Ib as he,Jb as ze,Tb as rt,V as te,Vc as W,W as se,Yc as ct,a as i,ab as Ne,c as U,da as g,ea as G,fd as e,g as $e,j as Le,na as je,ob as ue,qa as k,qc as Ie,ra as S,ua as H,wb as De,yb as ge,zb as lt}from"./chunk-Y7RYSRP7.js";import{d as C}from"./chunk-KUCVLANF.js";import{g as We,h as de,k as D,l as O,m as ke,n as V,o as Xe,p as qe}from"./chunk-7SK47HHZ.js";Le();Le();function ht(t){let o=t.file||{},a=o.src||"",l=o.filename||a,r={"--asset-thumb-size":`${t.size}px`};if(a&&O(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("img",{src:Te(o,t.size*2),alt:o.alt||"",loading:"lazy"})});if(a&&V(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("video",{src:a,muted:!0,playsInline:!0,preload:"metadata"})});let m=D(l);return e("div",{className:"AssetBrowser__thumb",style:r,children:m&&m.length<=4?e("div",{className:"AssetBrowser__thumb__ext",children:m}):e(pe,{size:20,stroke:"1.5"})})}function Te(t,o){let a=t?.src||"";return a.startsWith(We)&&o?`${a}=s${o}`:a}function we(t){let o=t?.src||"";ke(o)&&(o=o.split("=")[0]+"=s0"),navigator.clipboard.writeText(o).then(()=>{A({message:"Copied URL to clipboard.",autoClose:2e3})})}function be(t){let o=t?.src||"";if(o)if(ke(o)){let a=document.createElement("a");a.href=qe(o),t.filename&&(a.download=t.filename),document.body.appendChild(a),a.click(),document.body.removeChild(a)}else window.open(o,"_blank")}function vt(t){let[o,a]=i(t.asset),[l,r]=i(t.asset.file?.alt||""),[m,d]=i(!1),[x,v]=i(!1),[f,B]=i(null),[w,F]=i(null),n=o.file||{},u=n.filename||o.name,N=O(u),R=V(u),X=l!==(n.alt||""),q=n.altDisabled===!0;U(()=>{_e(o.id).then(c=>F(c)).catch(c=>{console.error("failed to fetch asset usage:",c),F([])})},[o.id]);async function z(c,b){let p=await fe(c,{previousFile:b});p.failedDocIds.length>0?A({title:"Some docs failed to update",message:`Failed to update: ${p.failedDocIds.join(", ")}. Re-save the asset to retry.`,color:"red",autoClose:!1}):p.updatedDocIds.length>0&&A({message:`Updated ${p.updatedDocIds.length} doc(s) that use this asset.`,color:"green"})}async function K(){d(!0),await M(async()=>{let c={...n},b=await at(o,l);a(b),t.onChanged(b),await z(b,c)}),d(!1)}function E(){let c=document.createElement("input");c.type="file",c.onchange=()=>{let b=c.files?.[0];if(!b)return;let p=D(u),y=D(b.name);if(p&&y&&p!==y){B(b);return}$(b)},c.click(),c.remove()}async function $(c){B(null),d(!0),await M(async()=>{let b={...n},p=await de(c),y=await ot(o,p);a(y),r(y.file?.alt||""),t.onChanged(y),await z(y,b)}),d(!1)}async function P(c){d(!0),await M(async()=>{let b={...n},p=await me(o,c);a(p),r(p.file?.alt||""),t.onChanged(p),await z(p,b)}),d(!1)}async function Z(){d(!0),await M(async()=>{await ce(o),A({message:`Deleted "${o.name}".`,color:"green"}),t.onDeleted()}),d(!1)}return e(S,{className:"AssetBrowser__detailsModal",opened:!0,onClose:t.onClose,title:o.name,size:720,overflow:"outside",centered:!0,children:e("div",{className:"AssetBrowser__details",children:[e("div",{className:"AssetBrowser__details__preview",children:N?e("img",{src:Te(n,800),alt:n.alt||"",style:n.canvasBgColor==="dark"?{background:"#000"}:{}}):R?e("video",{src:n.src,controls:!0,muted:!0,preload:"metadata"}):e("div",{className:"AssetBrowser__details__preview__placeholder",children:[e(pe,{size:48,stroke:"1"}),e("div",{children:u})]})}),e(re,{className:"AssetBrowser__details__table",verticalSpacing:"xs",fontSize:"xs",children:e("tbody",{children:[e("tr",{children:[e("td",{children:e("b",{children:"Filename"})}),e("td",{children:u})]}),!!(n.width&&n.height)&&e("tr",{children:[e("td",{children:e("b",{children:"Dimensions"})}),e("td",{children:[n.width,"x",n.height]})]}),o.createdAt&&e("tr",{children:[e("td",{children:e("b",{children:"Uploaded"})}),e("td",{children:[Ce(o.createdAt),o.createdBy&&e(C,{children:[" by ",o.createdBy]})]})]}),o.modifiedAt&&e("tr",{children:[e("td",{children:e("b",{children:"Modified"})}),e("td",{children:[Ce(o.modifiedAt),o.modifiedBy&&e(C,{children:[" by ",o.modifiedBy]})]})]}),e("tr",{children:[e("td",{children:e("b",{children:"URL"})}),e("td",{children:e("div",{className:"AssetBrowser__details__url",children:[e(H,{readOnly:!0,value:n.src||"",size:"xs",radius:"xs",onClick:c=>c.target.select(),styles:{root:{flex:1,minWidth:0}}}),e(Ge,{label:"Copy URL",transition:"pop",children:e(se,{size:"sm",onClick:()=>we(n),children:e(ue,{size:16})})})]})})]})]})}),(N||R)&&e("div",{className:"AssetBrowser__details__alt",children:[q?e("div",{className:"AssetBrowser__details__alt__disabledNote",children:"Alt text is disabled for this asset. Docs that use it hide the alt text input and render no alt text."}):e(C,{children:[e(je,{label:"Alt text",description:"Used as the default alt text when the asset is selected in a doc. Updating it syncs docs that use this asset.",autosize:!0,minRows:1,size:"xs",value:l,disabled:!t.canManage||m,onChange:c=>r(c.currentTarget.value)}),t.canManage&&X&&e(g,{size:"xs",color:"dark",mt:8,loading:m,onClick:()=>K(),children:"Save alt text"})]}),t.canManage&&e(G,{className:"AssetBrowser__details__alt__disableCheckbox",label:"Disable alt text (e.g. decorative images)",size:"xs",mt:8,checked:q,disabled:m,onChange:c=>P(c.currentTarget.checked)})]}),e("div",{className:"AssetBrowser__details__usage",children:[e("div",{className:"AssetBrowser__details__usage__title",children:"Used in"}),w===null?e(te,{color:"gray",size:"sm"}):w.length===0?e("div",{className:"AssetBrowser__details__usage__empty",children:"No docs use this asset."}):e("div",{className:"AssetBrowser__details__usage__list",children:w.map(c=>e("a",{className:"AssetBrowser__details__usage__doc",href:`/cms/content/${c.id}`,target:"_blank",rel:"noreferrer",children:[e("span",{children:c.id}),e(lt,{size:14})]},c.id))})]}),e("div",{className:"AssetBrowser__details__buttons",children:[e(g,{variant:"default",size:"xs",leftIcon:e(ge,{size:14}),onClick:()=>be(n),children:"Download"}),t.canManage&&e(C,{children:[e(g,{variant:"default",size:"xs",leftIcon:e(nt,{size:14}),loading:m,onClick:()=>E(),children:"Replace file"}),e(g,{className:"AssetBrowser__details__buttons__delete",color:"red",variant:"filled",size:"xs",leftIcon:e(W,{size:14}),disabled:m,onClick:()=>v(!0),children:"Delete"})]})]}),f&&e("div",{className:"AssetBrowser__details__confirmReplace",children:[e("div",{children:["The new file has a different type (",e("b",{children:[".",D(u)]})," ","\u2192 ",e("b",{children:[".",D(f.name)]}),"). Replacing will change the asset's file extension and serving URL",Fe(o.name,D(f.name))!==o.name&&e(C,{children:[", and the asset will be renamed to"," ",e("b",{children:Fe(o.name,D(f.name))})]}),". Docs that use this asset will be updated."]}),e("div",{className:"AssetBrowser__details__confirmReplace__buttons",children:[e(g,{variant:"default",size:"xs",onClick:()=>B(null),disabled:m,children:"Cancel"}),e(g,{color:"dark",size:"xs",loading:m,onClick:()=>$(f),children:"Replace"})]})]}),x&&e("div",{className:"AssetBrowser__details__confirmDelete",children:[e("div",{children:["Delete ",e("b",{children:o.name})," from the asset library?",w&&w.length>0&&e(C,{children:[" ","This asset is used in ",w.length," doc(s); those docs keep their copy of the file but will no longer receive updates."]})]}),e("div",{className:"AssetBrowser__details__confirmDelete__buttons",children:[e(g,{variant:"default",size:"xs",onClick:()=>v(!1),disabled:m,children:"Cancel"}),e(g,{color:"red",size:"xs",loading:m,onClick:()=>Z(),children:"Delete"})]})]})]})})}var Mt=100;function Ue(t){let[o,a]=i(t.folder??t.initialFolder??""),l=t.folder??o,[r,m]=i([]),[d,x]=i(!0),[v,f]=i(""),[B,w]=i(!1),[F,n]=i(!1),[u,N]=i(null),[R,X]=i(!1),[q,z]=i(null),[K,E]=i(null),[$,P]=i(null),[Z,c]=i(null),[b,p]=i(null),[y,ae]=i(new Map),{roles:At}=ft(),xt=window.firebase.user.email||"",J=ut(At,xt),Q=v.trim().length>0;function L(s){a(s),f(""),t.onFolderChange&&t.onFolderChange(s)}async function I(s){x(!0),N(null),ae(new Map),await M(async()=>{let _=await Me(s);m(_)}),x(!1)}U(()=>{I(l)},[l]),U(()=>{if(!Q||u!==null)return;let s=!1;return(async()=>{let _=[];await M(async()=>{_=await Ze(l)}),s||N(_)})(),()=>{s=!0}},[Q,u,l]);let Ae=t.mode==="manage"?t.initialAssetId:"";U(()=>{Ae&&M(async()=>{let s=await Qe(Ae);s&&s.type==="file"&&(L(s.parent),p(s))})},[Ae]);let Se=$e(()=>{let s=v.trim().toLowerCase(),_=s?u||[]:r;return t.mode==="pick"&&(_=_.filter(h=>h.type==="folder"||Xe(h.file?.filename||h.name,t.accept))),s&&(_=_.filter(h=>h.name.toLowerCase().includes(s))),_},[r,u,v,t.mode,t.accept]),T=_t(Se,{pageSize:Mt,resetDeps:[l,v]}),j=T.pageItems;async function Ee(s){if(s.length===0||F)return;let _="asset-browser-upload";n(!0),A({id:_,message:`Uploading ${s.length} file(s)...`,loading:!0,autoClose:!1,disallowClose:!0});let h=[],Be=[];for(let ne=0;ne<s.length;ne++){let ie=s[ne];He({id:_,message:`Uploading ${ie.name} (${ne+1} of ${s.length})...`,loading:!0,autoClose:!1,disallowClose:!0});try{let ye=await de(ie),kt=await et({parent:l,file:ye});h.push(kt)}catch(ye){console.error(`failed to upload ${ie.name}:`,ye),Be.push(ie.name)}}Oe(_),n(!1),Be.length>0?A({title:"Upload failed",message:`Failed to upload: ${Be.join(", ")}`,color:"red",autoClose:!1}):A({message:`Uploaded ${h.length} file(s).`,color:"green"}),await I(l),t.mode==="pick"&&h.length===1&&s.length===1&&t.onPickFile&&t.onPickFile(h[0])}function Bt(){let s=document.createElement("input");s.type="file",s.multiple=!0,t.mode==="pick"&&t.accept&&t.accept.length>0&&(s.accept=t.accept.join(",")),s.onchange=()=>{Ee(Array.from(s.files||[]))},s.click(),s.remove()}function yt(s){t.onPickFile&&t.onPickFile(s)}let Y=J,le=t.mode==="manage"&&J,ee=Array.from(y.values()),Pe=ee.filter(s=>s.type==="file"&&!s.file?.altDisabled&&(O(s.file?.filename||s.name)||V(s.file?.filename||s.name))),xe=j.length>0&&j.every(s=>y.has(s.id));function Re(s){ae(_=>{let h=new Map(_);return h.has(s.id)?h.delete(s.id):h.set(s.id,s),h})}function Ct(){ae(s=>{let _=new Map(s);return xe?j.forEach(h=>_.delete(h.id)):j.forEach(h=>_.set(h.id,h)),_})}return e("div",{className:ve("AssetBrowser",t.className,`AssetBrowser--${t.mode}`),children:[e("div",{className:"AssetBrowser__toolbar",children:[e(Ue.Breadcrumbs,{folder:l,onNavigate:L}),e("div",{className:"AssetBrowser__toolbar__actions",children:[e(H,{className:"AssetBrowser__toolbar__filter",placeholder:"Search by name",size:"xs",icon:e(dt,{size:14}),value:v,onChange:s=>f(s.currentTarget.value)}),Y&&t.mode==="manage"&&e(g,{variant:"default",size:"xs",leftIcon:e(it,{size:16}),onClick:()=>X(!0),children:"New folder"}),Y&&e(g,{color:"dark",size:"xs",leftIcon:e(ct,{size:16}),loading:F,onClick:()=>Bt(),children:"Upload"})]})]}),le&&ee.length>0&&e("div",{className:"AssetBrowser__selectionBar",children:[e("div",{className:"AssetBrowser__selectionBar__count",children:[ee.length," selected"]}),e("div",{className:"AssetBrowser__selectionBar__actions",children:[e(g,{variant:"default",size:"xs",leftIcon:e(he,{size:14}),onClick:()=>E(ee),children:"Move"}),Pe.length>0&&e(g,{variant:"default",size:"xs",onClick:()=>c(Pe),children:"Disable alt text"}),e(g,{color:"red",size:"xs",leftIcon:e(W,{size:14}),onClick:()=>P(ee),children:"Delete"}),e(g,{variant:"subtle",color:"gray",size:"xs",onClick:()=>ae(new Map),children:"Clear"})]})]}),e("div",{className:ve("AssetBrowser__listing",B&&"dragging"),onDragOver:s=>{Y&&(s.preventDefault(),w(!0))},onDragLeave:s=>{s.preventDefault(),w(!1)},onDrop:s=>{s.preventDefault(),w(!1),Y&&Ee(Array.from(s.dataTransfer?.files||[]))},children:d||Q&&u===null?e("div",{className:"AssetBrowser__loading",children:e(te,{color:"gray",size:"lg"})}):Se.length===0?e("div",{className:"AssetBrowser__empty","data-testid":"asset-browser-empty",children:v?e("div",{children:['No assets match "',v,'" in this folder or its subfolders.']}):e(C,{children:[e("div",{children:"This folder is empty."}),Y&&e("div",{className:"AssetBrowser__empty__hint",children:'Drop files here or click "Upload" to add assets.'})]})}):e(re,{className:"AssetBrowser__table",verticalSpacing:"xs",fontSize:"xs",highlightOnHover:!0,children:[e("thead",{children:e("tr",{children:[le&&e("th",{className:"AssetBrowser__table__checkboxCol",children:e(G,{size:"xs","aria-label":"Select all",checked:xe,indeterminate:!xe&&j.some(s=>y.has(s.id)),onChange:()=>Ct()})}),e("th",{children:"name"}),e("th",{className:"AssetBrowser__table__modifiedCol",children:"modified"}),e("th",{className:"AssetBrowser__table__actionsCol"})]})}),e("tbody",{children:j.map(s=>s.type==="folder"?e("tr",{className:"AssetBrowser__row AssetBrowser__row--folder",onClick:()=>L(oe(s.parent,s.name)),children:[le&&e("td",{className:"AssetBrowser__checkboxCell",onClick:_=>_.stopPropagation(),children:e(G,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>Re(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e("div",{className:"AssetBrowser__thumb",children:e(ze,{size:24,stroke:"1.5"})}),e("div",{className:"AssetBrowser__nameCell__text",children:[e("div",{className:"AssetBrowser__nameCell__name",children:s.name}),e(wt,{asset:s,folder:l,searching:Q,onNavigate:L})]})]})}),e("td",{children:e(bt,{asset:s})}),e("td",{onClick:_=>_.stopPropagation(),children:e("div",{className:"AssetBrowser__actionsCell",children:t.mode==="manage"&&J&&e(k,{shadow:"sm",position:"bottom",placement:"end",control:e(se,{size:"sm",children:e(De,{size:16})}),children:[e(k.Item,{icon:e(Ie,{size:14}),onClick:()=>z(s),children:"Rename"}),e(k.Item,{icon:e(he,{size:14}),onClick:()=>E([s]),children:"Move"}),e(k.Item,{color:"red",icon:e(W,{size:14}),onClick:()=>P([s]),children:"Delete"})]})})})]},s.id):e("tr",{className:"AssetBrowser__row AssetBrowser__row--file",onClick:()=>{t.mode==="pick"?yt(s):p(s)},children:[le&&e("td",{className:"AssetBrowser__checkboxCell",onClick:_=>_.stopPropagation(),children:e(G,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>Re(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e(ht,{file:s.file,size:36}),e("div",{className:"AssetBrowser__nameCell__text",children:[e("div",{className:"AssetBrowser__nameCell__name",children:[s.name,!!(s.file?.width&&s.file?.height)&&e("span",{className:"AssetBrowser__nameCell__dimens",children:[" ","(",s.file.width,"x",s.file.height,")"]})]}),e(wt,{asset:s,folder:l,searching:Q,onNavigate:L})]})]})}),e("td",{children:e(bt,{asset:s})}),e("td",{onClick:_=>_.stopPropagation(),children:e("div",{className:"AssetBrowser__actionsCell",children:t.mode!=="pick"&&e(Ft,{asset:s,canManage:J,onDetails:()=>p(s),onRename:()=>z(s),onMove:()=>E([s]),onDelete:()=>P([s])})})})]},s.id))})]})}),T.totalPages>1&&e("div",{className:"AssetBrowser__footer",children:[e(pt,{start:T.start,end:T.end,total:T.totalItems,noun:"asset"}),e(gt,{total:T.totalPages,page:T.page,onChange:T.setPage})]}),e(Nt,{opened:R,parent:l,onClose:()=>X(!1),onCreated:s=>{X(!1),L(oe(l,s))}}),q&&e(Dt,{asset:q,onClose:()=>z(null),onRenamed:()=>{z(null),I(l)}}),K&&K.length>0&&e(zt,{assets:K,onClose:()=>E(null),onMoved:()=>{E(null),I(l)}}),$&&$.length>0&&e(Tt,{assets:$,onClose:()=>P(null),onDeleted:()=>{P(null),I(l)}}),Z&&Z.length>0&&e(Ut,{assets:Z,onClose:()=>c(null),onDone:()=>{c(null),I(l)}}),b&&e(vt,{asset:b,canManage:J,onClose:()=>p(null),onChanged:()=>I(l),onDeleted:()=>{p(null),I(l)}})]})}Ue.Breadcrumbs=t=>{let o=Ke(t.folder),a=[{label:"Assets",path:""}];return o.forEach((l,r)=>{a.push({label:l,path:o.slice(0,r+1).join("/")})}),e("div",{className:"AssetBrowser__breadcrumbs",children:a.map((l,r)=>e("div",{className:"AssetBrowser__breadcrumbs__crumb",children:[r>0&&e(Ne,{className:"AssetBrowser__breadcrumbs__divider",size:14}),e("button",{className:ve("AssetBrowser__breadcrumbs__link",r===a.length-1&&"active"),disabled:r===a.length-1,onClick:()=>t.onNavigate(l.path),children:l.label})]},l.path))})};function Ft(t){let o=t.asset;return e(k,{shadow:"sm",position:"bottom",placement:"end",control:e(se,{size:"sm",children:e(De,{size:16})}),children:[e(k.Item,{icon:e(rt,{size:14}),onClick:t.onDetails,children:"Details"}),e(k.Item,{icon:e(ue,{size:14}),onClick:()=>we(o.file),children:"Copy URL"}),e(k.Item,{icon:e(ge,{size:14}),onClick:()=>be(o.file),children:"Download"}),t.canManage&&e(C,{children:[e(k.Item,{icon:e(Ie,{size:14}),onClick:t.onRename,children:"Rename"}),e(k.Item,{icon:e(he,{size:14}),onClick:t.onMove,children:"Move"}),e(k.Item,{color:"red",icon:e(W,{size:14}),onClick:t.onDelete,children:"Delete"})]})]})}function wt(t){let o=t.asset;return!t.searching||o.parent===t.folder?null:e("button",{className:"AssetBrowser__nameCell__path",title:"Go to folder",onClick:a=>{a.stopPropagation(),t.onNavigate(o.parent)},children:["in ",Je(o.parent,t.folder)]})}function bt(t){let o=t.asset.modifiedAt||t.asset.createdAt,a=t.asset.modifiedBy||t.asset.createdBy||"",l=o&&typeof o.toMillis=="function"?o.toMillis():0;return e("div",{className:"AssetBrowser__modifiedCell",children:[a&&e(mt,{email:a,size:20}),e("span",{children:l?Ve(l):"\u2014"})]})}function Nt(t){let[o,a]=i(""),[l,r]=i(!1);async function m(){r(!0),await M(async()=>{let d=await Ye(t.parent,o);a(""),t.onCreated(d.name)}),r(!1)}return e(S,{opened:t.opened,onClose:t.onClose,title:"New folder",size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),m()},children:[e(H,{"data-autofocus":!0,placeholder:"Folder name",value:o,onChange:d=>a(d.currentTarget.value)}),e(g,{type:"submit",color:"dark",loading:l,disabled:!o,children:"Create"})]})})}function Dt(t){let[o,a]=i(t.asset.name),[l,r]=i(!1);async function m(){r(!0),await M(async()=>{await tt(t.asset,o),t.onRenamed()}),r(!1)}return e(S,{opened:!0,onClose:t.onClose,title:`Rename ${t.asset.type}`,size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),m()},children:[e(H,{"data-autofocus":!0,value:o,onChange:d=>a(d.currentTarget.value)}),e(g,{type:"submit",color:"dark",loading:l,disabled:!o,children:"Rename"})]})})}function zt(t){let o=t.assets,[a,l]=i(o[0]?.parent||""),[r,m]=i([]),[d,x]=i(!0),[v,f]=i(!1);U(()=>{x(!0),M(async()=>{let n=await Me(a);m(n.filter(u=>u.type==="folder"))}).then(()=>x(!1))},[a]);let B=o.filter(n=>n.type==="folder").map(n=>oe(n.parent,n.name));function w(n){return B.some(u=>n===u||n.startsWith(`${u}/`))}async function F(){f(!0);let n=[],u=0;for(let N of o)try{await st(N,a),u+=1}catch(R){console.error(`failed to move ${N.name}:`,R),n.push(N.name)}f(!1),n.length>0&&A({title:"Move failed",message:`Failed to move: ${n.join(", ")}`,color:"red",autoClose:!1}),u>0&&A({message:o.length===1?`Moved "${o[0].name}" to ${a||"Assets"}.`:`Moved ${u} item(s) to ${a||"Assets"}.`,color:"green"}),t.onMoved()}return e(S,{opened:!0,onClose:t.onClose,title:o.length===1?`Move "${o[0].name}"`:`Move ${o.length} items`,size:"md",centered:!0,children:e("div",{className:"AssetBrowser__moveModal",children:[e(Ue.Breadcrumbs,{folder:a,onNavigate:l}),e("div",{className:"AssetBrowser__moveModal__folders",children:d?e(te,{color:"gray",size:"sm"}):r.length===0?e("div",{className:"AssetBrowser__moveModal__empty",children:"No subfolders."}):r.map(n=>{let u=oe(n.parent,n.name);return e("button",{className:"AssetBrowser__moveModal__folder",disabled:w(u),onClick:()=>l(u),children:[e(ze,{size:16,stroke:"1.5"}),e("span",{children:n.name}),e(Ne,{size:14})]},n.id)})}),e(g,{color:"dark",fullWidth:!0,loading:v,disabled:o.every(n=>n.parent===a),onClick:()=>F(),children:"Move here"})]})})}var It=20;function Tt(t){let o=t.assets,[a,l]=i(!1),[r,m]=i(null),d=o.filter(f=>f.type==="file"),x=o.some(f=>f.type==="folder");U(()=>{d.length===0||d.length>It||Promise.all(d.map(f=>_e(f.id))).then(f=>{let B=new Set(f.flat().map(w=>w.id));m(B.size)}).catch(()=>m(null))},[o.map(f=>f.id).join(",")]);async function v(){l(!0);let f=[],B=0;for(let w of o)try{await ce(w),B+=1}catch(F){console.error(`failed to delete ${w.name}:`,F),f.push(w.name)}l(!1),f.length>0&&A({title:"Delete failed",message:`Failed to delete: ${f.join(", ")}. Note that folders must be empty before they can be deleted.`,color:"red",autoClose:!1}),B>0&&A({message:o.length===1?`Deleted "${o[0].name}".`:`Deleted ${B} item(s).`,color:"green"}),t.onDeleted()}return e(S,{opened:!0,onClose:t.onClose,title:o.length===1?`Delete ${o[0].type}?`:`Delete ${o.length} items?`,size:"sm",centered:!0,children:e("div",{className:"AssetBrowser__deleteModal",children:[e("div",{className:"AssetBrowser__deleteModal__text",children:["Are you sure you want to delete"," ",o.length===1?e("b",{children:o[0].name}):e("b",{children:[o.length," items"]})," ","from the asset manager?",d.length>0&&e(C,{children:[" ","The underlying files are not deleted from GCS, and docs that currently use the assets keep their copy of the files."]}),x&&e(C,{children:" Folders must be empty before they can be deleted."})]}),r!==null&&r>0&&e("div",{className:"AssetBrowser__deleteModal__warning",children:[o.length===1?"This asset is":"These assets are"," ","currently used in ",r," doc(s). Those docs will no longer receive updates when the asset changes."]}),e("div",{className:"AssetBrowser__deleteModal__buttons",children:[e(g,{variant:"default",onClick:t.onClose,disabled:a,children:"Cancel"}),e(g,{color:"red",loading:a,onClick:()=>v(),children:"Delete"})]})]})})}function Ut(t){let o=t.assets,[a,l]=i(!1);async function r(){l(!0);let m=[],d=0;for(let x of o)try{let v=x.file,f=await me(x,!0);await fe(f,{previousFile:v}),d+=1}catch(v){console.error(`failed to disable alt text for ${x.name}:`,v),m.push(x.name)}l(!1),m.length>0&&A({title:"Failed to disable alt text",message:`Failed to update: ${m.join(", ")}`,color:"red",autoClose:!1}),d>0&&A({message:`Disabled alt text for ${d} file(s).`,color:"green"}),t.onDone()}return e(S,{opened:!0,onClose:t.onClose,title:"Disable alt text?",size:"sm",centered:!0,children:e("div",{className:"AssetBrowser__deleteModal",children:[e("div",{className:"AssetBrowser__deleteModal__text",children:["Disable alt text for ",e("b",{children:[o.length," file(s)"]}),"? The alt text input is hidden in docs that use these assets and their embedded alt text is cleared. Alt text can be re-enabled per asset from its details."]}),e("div",{className:"AssetBrowser__deleteModal__buttons",children:[e(g,{variant:"default",onClick:t.onClose,disabled:a,children:"Cancel"}),e(g,{color:"dark",loading:a,onClick:()=>r(),children:"Disable alt text"})]})]})})}export{Ue as a};
@@ -1 +1 @@
1
- import{i as t,j as i}from"./chunk-WRA24P66.js";import{j as r,k as o}from"./chunk-KUCVLANF.js";o();i();var s=r(null);function n(){let e=t(s);if(!e)throw new Error("useFirebase() should be called within a <FirebaseProvider>");return e}export{s as a,n as b};
1
+ import{i as t,j as i}from"./chunk-Y7RYSRP7.js";import{j as r,k as o}from"./chunk-KUCVLANF.js";o();i();var s=r(null);function n(){let e=t(s);if(!e)throw new Error("useFirebase() should be called within a <FirebaseProvider>");return e}export{s as a,n as b};
@@ -0,0 +1 @@
1
+ import{b as oe}from"./chunk-PLTI4NG7.js";import{h as ee}from"./chunk-CEWU5VSJ.js";import{a as W}from"./chunk-B74M7NEV.js";import{b as J,c as V}from"./chunk-JDW4UORS.js";import{a as te}from"./chunk-YDO2EDVY.js";import{a as O}from"./chunk-5MV6XVGA.js";import{b as K}from"./chunk-U5OXKKBN.js";import{a as j}from"./chunk-ZYSR5UIW.js";import{P as Z,c as Y}from"./chunk-ISUGBMXC.js";import{b as G,f as L,g as h,i as S,o as Q}from"./chunk-XOWWPE7X.js";import{d as q}from"./chunk-GJ7ES2LA.js";import{A as I,a as m,c as C,da as P,e as b,fd as g,g as U,h as A,i as H,j as N,ra as X}from"./chunk-Y7RYSRP7.js";import{j as z,k as ue}from"./chunk-KUCVLANF.js";N();function we(o,t){let[e,r]=m([]),[n,s]=m(!0),y=oe().db,w=window.__ROOT_CTX.rootConfig.projectId||"default",v=t.includeArchived??!1,f=async()=>{s(!0);let l=G(y,"Projects",w,"Collections",o,"Drafts"),i=l,c=t.orderBy;if(c==="modifiedAt")i=h(l,S("sys.modifiedAt","desc"));else if(c==="modifiedAtAsc")i=h(l,S("sys.modifiedAt"));else if(c==="newest")i=h(l,S("sys.createdAt","desc"));else if(c==="oldest")i=h(l,S("sys.createdAt"));else if(c==="slug")i=h(l,S(L()));else if(c==="slugDesc")i=h(l,S(L(),"desc"));else if(c==="title"||c==="titleDesc"){let u=c==="titleDesc"?"desc":"asc",d=de(o);i=d?h(l,S(d,u)):h(l,S(L(),u))}else{let d=window.__ROOT_CTX.collections[o]?.sortOptions?.find(E=>E.id===c);d&&(i=d.direction==="desc"?h(l,S(d.field,"desc")):h(l,S(d.field)))}await K(async()=>{let u=await Q(i),d=[];u.docs.forEach(E=>{let k=E.data(),p=E.id,x=`${o}/${p}`,_={...k,id:x,slug:p};Y(x,_),!(!v&&_?.sys?.archivedAt)&&d.push(_)}),r(d)}),s(!1)};return C(()=>{s(!0),f()},[o,t.orderBy,v]),[n,f,e]}function de(o){let e=window.__ROOT_CTX.collections[o]?.preview?.title??"meta.title";return Array.isArray(e)&&(e=e[0]),typeof e!="string"||!e||e.includes("{")?"":`fields.${e}`}ue();N();var D={CONNECTED:"connected",SCHEMA_CHANGED:"schemaChanged"};function re(o){let e=new URLSearchParams(window.location.search).get("e");return e?e.split(",").includes(o):!1}var fe="/cms/api/sse.connect",T=re("EnableVerboseLogging"),ne=window.location.hostname==="localhost",$=class{constructor(){this.map=new Map}on(t,e){return this.map.has(t)||this.map.set(t,new Set),this.map.get(t).add(e),()=>{this.map.get(t)?.delete(e)}}emit(t,e,r){this.map.get(t)?.forEach(n=>n(e,r)),this.map.get("*")?.forEach(n=>n({type:t,data:e},r))}},ie=z(null);function Oe(o){let e=b(new $).current,r=b(null),n=b(!1),s=b({attempt:0,timer:0}),a=b(""),y=()=>{r.current&&(r.current.close(),r.current=null)},w=A(()=>{T&&console.log("[sse] connecting..."),y();let f=new EventSource(fe);r.current=f,f.addEventListener(D.CONNECTED,i=>{if(T&&console.log("[sse] connected"),n.current=!1,s.current.attempt=0,ne){let u=se(i.data)?.serverVersion||"";a.current?a.current!==u&&(console.log(`server version changed: ${a.current} -> ${u}`),console.log("reloading..."),window.location.reload()):a.current=u}});let l=i=>{if(!i||!i.type)return;let c=se(i.data);T&&console.log("[sse] event:",i.type,c),e.emit(i.type,c,i)};Object.values(D).forEach(i=>{f.addEventListener(i,l)}),f.addEventListener("error",()=>{T&&console.log("[sse] disconnected"),f.readyState===EventSource.CLOSED&&!n.current&&(n.current=!0,(()=>{let c=++s.current.attempt,u=Math.min(3e4,Math.pow(2,c)*500),d=Math.random()*.3*u,E=u+d;window.clearTimeout(s.current.timer),s.current.timer=window.setTimeout(()=>{n.current=!1,w()},E)})())})},[e]);C(()=>{if(!ne)return;w();let f=()=>{document.visibilityState==="visible"&&r.current?.readyState!==EventSource.OPEN&&w()};return document.addEventListener("visibilitychange",f),()=>{document.removeEventListener("visibilitychange",f),window.clearTimeout(s.current.timer),y()}},[w]);let v=U(()=>({emitter:e}),[e]);return g(ie.Provider,{value:v,children:o.children})}function se(o){try{return JSON.parse(o)}catch{return o}}function ae(o,t){let e=H(ie);if(!e)throw new Error("useSSE() must be used within an <SSEProvider>");let r=b(t);C(()=>{r.current=t},[t]),C(()=>e.emitter.on(o,(n,s)=>r.current(n,s)),[e,o])}N();N();function ce(o){let[t,e]=m(!0),[r,n]=m(null),s=A(async()=>{try{let a=await te(o);n(a)}catch(a){console.error(a),j({title:`Failed to load collection: ${o}`,message:String(a),color:"red",autoClose:!1})}e(!1)},[o]);return C(()=>{s()},[o]),ae(D.SCHEMA_CHANGED,async a=>{await s();let y=a.file?`Applied updates from changes to ${a.file}.`:"Applied updates from changes to a .schema.ts file.";j({title:"Updated schema!",message:y})}),{loading:t,schema:r}}function B(o){let t={_array:[]};return o.forEach(e=>{let r=me();t._array.push(r),t[r]=e}),t}function me(){let o=[],t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=t.length;for(let r=0;r<6;r++)o.push(t.charAt(Math.floor(Math.random()*e)));return o.join("")}function F(o){let t={};return o.fields.forEach(e=>{e.id&&(e.type==="array"&&e.default&&Array.isArray(e.default)?t[e.id]=B(e.default):e.default?t[e.id]=e.default:e.type==="object"&&(t[e.id]=F(e)))}),t}function R(o,t,e){let r={...t};return o.fields.forEach(n=>{if(!n.id)return;let s=r[n.id];if(s!=null){if(n.type==="array"&&Array.isArray(s)){let a=s.map(y=>ge(n.of,y,e));r[n.id]=B(a)}else if(n.type==="object"&&O(s))r[n.id]=R(n,s,e);else if(n.type==="oneof"&&O(s)&&typeof s._type=="string"&&e){let a=e[s._type];a&&(r[n.id]=R(a,s,e))}}}),r}function ge(o,t,e){if(!O(t))return t;if(o.type==="object")return R(o,t,e);if(o.type==="oneof"&&typeof t._type=="string"&&e){let r=e[t._type];if(r)return R(r,t,e)}return t}function rt(o){let{route:t}=q(),e=I(),r=o.collection,n=window.__ROOT_CTX.collections[r];if(!n)throw new Error(`collection not found: ${r}`);let[s]=m(()=>n.autoSlug?W(n.autoSlug):""),[a,y]=m(s),[w,v]=m(!1),[f,l]=m(()=>d(s)),[i,c]=m(""),u=ce(r);function d(p){let x=V(p);return x?J(x,n.slugRegex):""}function E(){o.onClose&&o.onClose()}async function k(p){if(p.preventDefault(),v(!0),l(""),d(a)){v(!1);return}let _=V(a),le=`${r}/${_}`;try{let M={};!u.loading&&u.schema&&(M=await F(u.schema)),await Z(le,{fields:M})}catch(M){c(String(M)),v(!1);return}v(!1),o.skipNavigation?E():t(`/cms/content/${o.collection}/${_}`)}return g(X,{className:"NewDocModal",opened:o.opened||!1,onClose:()=>E(),title:"New",size:"500px",overlayColor:e.colorScheme==="dark"?e.colors.dark[9]:e.colors.gray[2],children:[g("div",{className:"NewDocModal__body",children:"Enter a slug for the new doc. The slug is the ID of the page and is what's used in the URL. Use only lowercase letters, numbers, and dashes."}),g("form",{onSubmit:p=>k(p),children:[g(ee,{className:"NewDocModal__slug",collectionId:r,initialSlug:s,onChange:p=>{y(p.slug),l(d(p.slug)),c("")}}),i&&g("div",{className:"NewDocModal__slugError",children:i}),g("div",{className:"NewDocModal__buttons",children:[g(P,{variant:"outline",onClick:()=>E(),type:"button",size:"xs",color:"dark",children:"Cancel"}),g(P,{variant:"filled",type:"submit",size:"xs",color:"dark",loading:u.loading||w,disabled:!!f||!!i,children:"Submit"})]})]})]})}export{we as a,Oe as b,ce as c,F as d,R as e,rt as f};
@@ -1 +1 @@
1
- import{a as C}from"./chunk-QFDU6FXP.js";import{e as p}from"./chunk-WASID5UU.js";import{Ga as o,Jb as u,U as _,g,j as b}from"./chunk-WRA24P66.js";b();function m(s){let e={},t=[],r={};if(Object.entries(s).forEach(([n,i])=>{e[n]={id:n,name:i.name||n,description:i.description,isGroup:!1,collection:i,children:[]}}),Object.entries(s).forEach(([n,i])=>{let c=e[n],d=i.group||"Content";d?(r[d]||(r[d]={id:`group:${d}`,name:d,isGroup:!0,children:[]}),r[d].children.push(c)):t.push(c)}),Object.keys(r).length>0&&t.length>0){let n={id:"group:Content",name:"Content",isGroup:!0,children:t},i=Object.values(r).sort((c,d)=>c.name.localeCompare(d.name));return[n,...i]}Object.values(r).forEach(n=>{t.push(n)});let l=n=>{n.sort((i,c)=>i.name.localeCompare(c.name)),n.forEach(i=>{i.children.length>0&&l(i.children)})};return l(t),t}function O(s){let{collections:e,activeCollectionId:t,projectId:r}=s,[a,l]=C(`root-cms::${r}::closed_groups`,[]),n=g(()=>m(e),[]),i=(c,d)=>{d?l(a.filter(v=>v!==c)):a.includes(c)||l([...a,c])};return o("div",{className:p(s.className,"CollectionTree"),children:[n.map(c=>o(h,{node:c,depth:0,activeCollectionId:t,closedGroups:a,onAccordionChange:i},c.id)),n.length===0&&o("div",{className:"CollectionTree__collections__empty",children:"No collections match your query."})]})}function h(s){let{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l}=s,n=e.children.length>0;return e.isGroup?n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__group__label",children:o("span",{children:e.name})})}):o("div",{className:"CollectionTree__group-empty",style:{paddingLeft:`${t*16}px`},children:[o(u,{size:20,strokeWidth:"1.75"}),o("span",{children:e.name})]}):n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__collection__label",children:o("a",{className:p("CollectionTree__collection-link",e.id===r&&"active"),href:`/cms/content/${e.id}`,onClick:i=>i.stopPropagation(),children:e.name})})}):o("a",{className:p("CollectionTree__collection",e.id===r&&"active"),href:`/cms/content/${e.id}`,children:[o("div",{className:"CollectionTree__collection__icon",children:o(u,{size:20,strokeWidth:"1.75"})}),o("div",{className:"CollectionTree__collection__content",children:[o("div",{className:"CollectionTree__collection__name",children:e.name}),e.description&&o("div",{className:"CollectionTree__collection__desc",children:e.description})]})]})}function f(s){let{node:e,depth:t,label:r,activeCollectionId:a,closedGroups:l,onAccordionChange:n}=s,i=!l.includes(e.id);return o("div",{className:"CollectionTree__accordion",children:o(_,{iconPosition:"left",initialItem:i?0:-1,offsetIcon:!1,onChange:()=>n(e.id,!i),children:o(_.Item,{label:r,children:o("div",{className:"CollectionTree__accordion__children",children:e.children.map(c=>o(h,{node:c,depth:t+1,activeCollectionId:a,closedGroups:l,onAccordionChange:n},c.id))})})})})}export{O as a};
1
+ import{a as C}from"./chunk-MALK5YEV.js";import{e as p}from"./chunk-GJ7ES2LA.js";import{Jb as u,U as _,fd as o,g,j as b}from"./chunk-Y7RYSRP7.js";b();function m(s){let e={},t=[],r={};if(Object.entries(s).forEach(([n,i])=>{e[n]={id:n,name:i.name||n,description:i.description,isGroup:!1,collection:i,children:[]}}),Object.entries(s).forEach(([n,i])=>{let c=e[n],d=i.group||"Content";d?(r[d]||(r[d]={id:`group:${d}`,name:d,isGroup:!0,children:[]}),r[d].children.push(c)):t.push(c)}),Object.keys(r).length>0&&t.length>0){let n={id:"group:Content",name:"Content",isGroup:!0,children:t},i=Object.values(r).sort((c,d)=>c.name.localeCompare(d.name));return[n,...i]}Object.values(r).forEach(n=>{t.push(n)});let l=n=>{n.sort((i,c)=>i.name.localeCompare(c.name)),n.forEach(i=>{i.children.length>0&&l(i.children)})};return l(t),t}function O(s){let{collections:e,activeCollectionId:t,projectId:r}=s,[a,l]=C(`root-cms::${r}::closed_groups`,[]),n=g(()=>m(e),[]),i=(c,d)=>{d?l(a.filter(v=>v!==c)):a.includes(c)||l([...a,c])};return o("div",{className:p(s.className,"CollectionTree"),children:[n.map(c=>o(h,{node:c,depth:0,activeCollectionId:t,closedGroups:a,onAccordionChange:i},c.id)),n.length===0&&o("div",{className:"CollectionTree__collections__empty",children:"No collections match your query."})]})}function h(s){let{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l}=s,n=e.children.length>0;return e.isGroup?n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__group__label",children:o("span",{children:e.name})})}):o("div",{className:"CollectionTree__group-empty",style:{paddingLeft:`${t*16}px`},children:[o(u,{size:20,strokeWidth:"1.75"}),o("span",{children:e.name})]}):n?o(f,{node:e,depth:t,activeCollectionId:r,closedGroups:a,onAccordionChange:l,label:o("div",{className:"CollectionTree__collection__label",children:o("a",{className:p("CollectionTree__collection-link",e.id===r&&"active"),href:`/cms/content/${e.id}`,onClick:i=>i.stopPropagation(),children:e.name})})}):o("a",{className:p("CollectionTree__collection",e.id===r&&"active"),href:`/cms/content/${e.id}`,children:[o("div",{className:"CollectionTree__collection__icon",children:o(u,{size:20,strokeWidth:"1.75"})}),o("div",{className:"CollectionTree__collection__content",children:[o("div",{className:"CollectionTree__collection__name",children:e.name}),e.description&&o("div",{className:"CollectionTree__collection__desc",children:e.description})]})]})}function f(s){let{node:e,depth:t,label:r,activeCollectionId:a,closedGroups:l,onAccordionChange:n}=s,i=!l.includes(e.id);return o("div",{className:"CollectionTree__accordion",children:o(_,{iconPosition:"left",initialItem:i?0:-1,offsetIcon:!1,onChange:()=>n(e.id,!i),children:o(_.Item,{label:r,children:o("div",{className:"CollectionTree__accordion__children",children:e.children.map(c=>o(h,{node:c,depth:t+1,activeCollectionId:a,closedGroups:l,onAccordionChange:n},c.id))})})})})}export{O as a};
@@ -1,3 +1,3 @@
1
- import{a as na,b as P,c as I,d as ia,e as la}from"./chunk-XACLTYBB.js";import{a as d}from"./chunk-OWYV43BT.js";import{a as oa}from"./chunk-QFDU6FXP.js";import{a as v}from"./chunk-PLYSJ7W5.js";import{a as D}from"./chunk-2PTLQRTU.js";import{a as A}from"./chunk-PIJ3E47R.js";import{e as Q}from"./chunk-WASID5UU.js";import{Da as J,Ga as a,Gb as ta,Pa as X,Qc as ra,V as G,Ya as Z,Zc as sa,a as l,ab as aa,c as W,da as _,g as V,j as fa,ob as ea,qa as z,ua as Y,xa as R,ya as q}from"./chunk-WRA24P66.js";fa();var O=[{value:"new",label:"New"},{value:"in-progress",label:"In progress"},{value:"in-review",label:"In review"},{value:"closed",label:"Closed"}],Ta=O.filter(t=>t.value!=="closed"),xa=O.filter(t=>t.value==="closed"),va=[{value:"table",label:a("span",{className:"TaskManager__layoutOption",children:[a(ra,{size:14,strokeWidth:"1.8"}),"Table"]})},{value:"board",label:a("span",{className:"TaskManager__layoutOption",children:[a(ea,{size:14,strokeWidth:"1.8"}),"Board"]})}],ba=[{value:"open",label:"Active"},{value:"assigned-to-me",label:"Assigned to me"}],ha=[{value:"open",label:"Active"},{value:"assigned-to-me",label:"Assigned to me"},{value:"created-by-me",label:"Created by me"},{value:"closed",label:"Closed"},{value:"all",label:"All"}];function qa(t){let e=window.firebase.user.email||"",r=(t.variant||"compact")==="page",{tasks:i,loading:n,error:c}=Sa(r?"all":"open"),[f,b]=l("open"),[p,da]=oa("root-cms-task-manager-layout-v2","table"),[h,j]=l(""),[g,y]=l(""),[M,T]=l(!1),[w,B]=l("normal"),[x,N]=l(""),[C,L]=l(!1),[H,F]=l(!1),pa=r?ha:ba,U=V(()=>za(i,f,e),[i,f,e]),K=U.length,ga=r?`${K} shown`:`${K} active`,ma=!!h.trim()&&!H;async function ka(o){o.preventDefault();let $=h.trim();if(!$)return;let S=Ca($);F(!0);try{await na({title:S.title,description:S.description,assignee:g.trim()||void 0,priority:w,targetLaunchDate:_a(x)}),j(""),y(""),B("normal"),N(""),A({title:"Task created",message:S.title,autoClose:4e3})}catch(ua){A({title:"Could not create task",message:D(ua),color:"red",autoClose:!1})}finally{F(!1)}}return a("div",{className:Q(t.className,"TaskManager",r&&"TaskManager--page"),children:[a(d,{className:"TaskManager__composer",children:a("form",{onSubmit:o=>ka(o),children:[a("div",{className:"TaskManager__composer__header",children:[a("div",{className:"TaskManager__composer__avatar",children:g&&a(v,{email:g,size:32})}),a("div",{children:[a("div",{className:"TaskManager__composer__title",children:"Create a task"}),a("div",{className:"TaskManager__composer__subtitle",children:"Assign it to an agent, a teammate, or yourself."})]})]}),a("textarea",{className:"TaskManager__composer__textarea",value:h,rows:3,placeholder:"Enter a task description. Specify scope, collection, and acceptance criteria.",onInput:o=>{j(o.currentTarget.value)}}),a("div",{className:"TaskManager__composer__footer",children:[a("div",{className:"TaskManager__composer__controls",children:[a(R,{opened:M,onClose:()=>T(!1),position:"bottom",shadow:"md",width:280,withArrow:!0,target:a("button",{className:"TaskManager__composer__control",type:"button","aria-expanded":M,onClick:()=>T(!M),children:[a(sa,{size:15,strokeWidth:"1.8"}),a("span",{children:"assign to..."}),g&&a("span",{className:"TaskManager__composer__control__value",children:m(g)})]}),children:a("div",{className:"TaskManager__composer__popover",children:[a(Y,{autoFocus:!0,label:"Email",placeholder:"teammate@example.com",size:"xs",type:"email",value:g,onChange:o=>y(o.currentTarget.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),T(!1))}}),a("div",{className:"TaskManager__composer__popover__actions",children:[a(_,{compact:!0,size:"xs",variant:"default",onClick:()=>y(""),children:"Clear"}),a(_,{compact:!0,size:"xs",color:"dark",onClick:()=>T(!1),children:"Done"})]})]})}),a(z,{position:"bottom",shadow:"md",control:a("button",{className:"TaskManager__composer__control",type:"button",children:[a(ta,{size:15,strokeWidth:"1.8"}),a("span",{children:w}),a(aa,{size:14,strokeWidth:"1.8"})]}),children:["high","medium","normal"].map(o=>a(z.Item,{className:w===o?"TaskManager__composer__menuItem--active":"",onClick:()=>B(o),children:o},o))}),a(R,{opened:C,onClose:()=>L(!1),position:"bottom",shadow:"md",width:260,withArrow:!0,target:a("button",{className:"TaskManager__composer__control",type:"button","aria-expanded":C,onClick:()=>L(!C),children:[a(Z,{size:15,strokeWidth:"1.8"}),a("span",{children:x?Da(x):"target launch date"})]}),children:a("div",{className:"TaskManager__composer__popover",children:[a("label",{className:"TaskManager__composer__dateLabel",children:["Target launch date",a("input",{type:"date",value:x,onInput:o=>{N(o.currentTarget.value)}})]}),a("div",{className:"TaskManager__composer__popover__actions",children:[a(_,{compact:!0,size:"xs",variant:"default",onClick:()=>N(""),children:"Clear"}),a(_,{compact:!0,size:"xs",color:"dark",onClick:()=>L(!1),children:"Done"})]})]})})]}),a(_,{type:"submit",size:"xs",color:"dark",loading:H,disabled:!ma,rightIcon:a(X,{size:15,strokeWidth:"1.8"}),children:"Create task"})]})]})}),a("div",{className:"TaskManager__listHeader",children:[a("div",{className:"TaskManager__listHeader__summary",children:[a("div",{className:"TaskManager__listHeader__titleLine",children:[a("div",{className:"TaskManager__sectionTitle",children:r?"Tasks":"Active tasks"}),a("span",{className:"TaskManager__listHeader__count",children:ga})]}),a("div",{className:"TaskManager__filters","aria-label":"Task filters",children:pa.map(o=>a("button",{className:f===o.value?"active":"",type:"button",onClick:()=>b(o.value),children:o.label},o.value))})]}),a("div",{className:"TaskManager__listHeader__actions",children:r?a(q,{className:"TaskManager__layoutToggle",size:"xs",value:p,onChange:o=>da(o),data:va}):a(_,{component:"a",href:"/cms/tasks",variant:"default",size:"xs",compact:!0,children:"Show all"})})]}),a(ya,{error:c,filter:f,layout:r?p:"compact",loading:n,tasks:U})]})}function ya(t){let{error:e,filter:s,layout:r,loading:i,tasks:n}=t;return i?a(d,{className:"TaskManager__list",children:a("div",{className:"TaskManager__list__state",children:a(G,{color:"gray",size:"sm"})})}):e?a(d,{className:"TaskManager__list",children:a("div",{className:"TaskManager__list__state error",children:e})}):n.length===0?a(d,{className:"TaskManager__list",children:a("div",{className:"TaskManager__list__state",children:Ra(s,r)})}):r==="board"?a(wa,{filter:s,tasks:n}):r==="table"?a(Ma,{tasks:n}):a(d,{className:"TaskManager__list",children:n.map(c=>a(La,{task:c},c.id))})}function Ma(t){return a(d,{className:"TaskManager__tableSurface",children:a(J,{className:"TaskManager__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[a("thead",{children:a("tr",{children:[a("th",{children:"task"}),a("th",{children:"status"}),a("th",{children:"priority"}),a("th",{children:"assignee"}),a("th",{children:"target"}),a("th",{children:"opened"})]})}),a("tbody",{children:t.tasks.map(e=>{let s=e.createdBy||"unknown";return a("tr",{children:[a("td",{children:a("a",{className:"TaskManager__tableTask",href:`/cms/tasks/${e.id}`,children:[a("div",{className:"TaskManager__taskRow__avatar",children:e.assignee&&a(v,{email:e.assignee,size:24})}),a("span",{className:"TaskManager__tableTask__content",children:[a("span",{className:"TaskManager__tableTask__title",children:e.title}),a("span",{className:"TaskManager__tableTask__meta",children:["#",e.id," by ",m(s)]})]})]})}),a("td",{children:a("span",{className:"TaskManager__taskRow__status",children:[a("span",{}),E(e.status)]})}),a("td",{children:a("span",{className:`TaskManager__taskRow__priority TaskManager__taskRow__priority--${u(e.priority)}`,children:u(e.priority)})}),a("td",{children:e.assignee?m(e.assignee):"Unassigned"}),a("td",{children:e.targetLaunchDate?k(e.targetLaunchDate):"None"}),a("td",{children:k(e.createdAt)})]},e.id)})})]})})}function wa(t){let e=Aa(t.tasks,t.filter);return a("div",{className:"TaskManager__board",children:e.map(s=>{let r=t.tasks.filter(i=>ca(i)===s.value);return a("section",{className:"TaskManager__boardColumn",children:[a("div",{className:"TaskManager__boardColumn__header",children:[a("span",{children:s.label}),a("span",{children:r.length})]}),a("div",{className:"TaskManager__boardColumn__tasks",children:[r.length===0&&a("div",{className:"TaskManager__boardColumn__empty",children:"No tasks"}),r.map(i=>a(Na,{task:i},i.id))]})]},s.value)})})}function Na(t){let{task:e}=t,s=e.createdBy||"unknown";return a("a",{className:"TaskManager__boardCard",href:`/cms/tasks/${e.id}`,children:[a("div",{className:"TaskManager__boardCard__title",children:e.title}),e.description&&a("div",{className:"TaskManager__boardCard__description",children:e.description}),a("div",{className:"TaskManager__boardCard__meta",children:["#",e.id," opened ",k(e.createdAt)," by"," ",m(s)]}),a("div",{className:"TaskManager__boardCard__badges",children:[a("span",{className:`TaskManager__taskRow__priority TaskManager__taskRow__priority--${u(e.priority)}`,children:u(e.priority)}),a("span",{className:"TaskManager__boardCard__badge",children:e.assignee?m(e.assignee):"Unassigned"}),e.targetLaunchDate&&a("span",{className:"TaskManager__boardCard__badge",children:["target ",k(e.targetLaunchDate)]})]})]})}function Ca(t){let[e,...s]=t.split(`
1
+ import{a as na,b as P,c as I,d as ia,e as la}from"./chunk-XACLTYBB.js";import{a as d}from"./chunk-TCWN5YRW.js";import{a as oa}from"./chunk-MALK5YEV.js";import{a as v}from"./chunk-LS2JH5QF.js";import{a as D}from"./chunk-U5OXKKBN.js";import{a as A}from"./chunk-ZYSR5UIW.js";import{e as sa}from"./chunk-GJ7ES2LA.js";import{$a as Z,Da as J,Gb as ea,Oa as Q,Qc as ta,V as G,Xa as X,Zc as ra,a as l,c as W,da as _,fd as a,g as V,j as fa,nb as aa,qa as z,ua as Y,xa as R,ya as q}from"./chunk-Y7RYSRP7.js";fa();var O=[{value:"new",label:"New"},{value:"in-progress",label:"In progress"},{value:"in-review",label:"In review"},{value:"closed",label:"Closed"}],Ta=O.filter(t=>t.value!=="closed"),xa=O.filter(t=>t.value==="closed"),va=[{value:"table",label:a("span",{className:"TaskManager__layoutOption",children:[a(ta,{size:14,strokeWidth:"1.8"}),"Table"]})},{value:"board",label:a("span",{className:"TaskManager__layoutOption",children:[a(aa,{size:14,strokeWidth:"1.8"}),"Board"]})}],ba=[{value:"open",label:"Active"},{value:"assigned-to-me",label:"Assigned to me"}],ha=[{value:"open",label:"Active"},{value:"assigned-to-me",label:"Assigned to me"},{value:"created-by-me",label:"Created by me"},{value:"closed",label:"Closed"},{value:"all",label:"All"}];function qa(t){let e=window.firebase.user.email||"",r=(t.variant||"compact")==="page",{tasks:i,loading:n,error:c}=Sa(r?"all":"open"),[f,b]=l("open"),[p,da]=oa("root-cms-task-manager-layout-v2","table"),[h,j]=l(""),[g,y]=l(""),[M,T]=l(!1),[w,B]=l("normal"),[x,N]=l(""),[C,L]=l(!1),[H,F]=l(!1),pa=r?ha:ba,U=V(()=>za(i,f,e),[i,f,e]),K=U.length,ga=r?`${K} shown`:`${K} active`,ma=!!h.trim()&&!H;async function ka(o){o.preventDefault();let $=h.trim();if(!$)return;let S=Ca($);F(!0);try{await na({title:S.title,description:S.description,assignee:g.trim()||void 0,priority:w,targetLaunchDate:_a(x)}),j(""),y(""),B("normal"),N(""),A({title:"Task created",message:S.title,autoClose:4e3})}catch(ua){A({title:"Could not create task",message:D(ua),color:"red",autoClose:!1})}finally{F(!1)}}return a("div",{className:sa(t.className,"TaskManager",r&&"TaskManager--page"),children:[a(d,{className:"TaskManager__composer",children:a("form",{onSubmit:o=>ka(o),children:[a("div",{className:"TaskManager__composer__header",children:[a("div",{className:"TaskManager__composer__avatar",children:g&&a(v,{email:g,size:32})}),a("div",{children:[a("div",{className:"TaskManager__composer__title",children:"Create a task"}),a("div",{className:"TaskManager__composer__subtitle",children:"Assign it to an agent, a teammate, or yourself."})]})]}),a("textarea",{className:"TaskManager__composer__textarea",value:h,rows:3,placeholder:"Enter a task description. Specify scope, collection, and acceptance criteria.",onInput:o=>{j(o.currentTarget.value)}}),a("div",{className:"TaskManager__composer__footer",children:[a("div",{className:"TaskManager__composer__controls",children:[a(R,{opened:M,onClose:()=>T(!1),position:"bottom",shadow:"md",width:280,withArrow:!0,target:a("button",{className:"TaskManager__composer__control",type:"button","aria-expanded":M,onClick:()=>T(!M),children:[a(ra,{size:15,strokeWidth:"1.8"}),a("span",{children:"assign to..."}),g&&a("span",{className:"TaskManager__composer__control__value",children:m(g)})]}),children:a("div",{className:"TaskManager__composer__popover",children:[a(Y,{autoFocus:!0,label:"Email",placeholder:"teammate@example.com",size:"xs",type:"email",value:g,onChange:o=>y(o.currentTarget.value),onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),T(!1))}}),a("div",{className:"TaskManager__composer__popover__actions",children:[a(_,{compact:!0,size:"xs",variant:"default",onClick:()=>y(""),children:"Clear"}),a(_,{compact:!0,size:"xs",color:"dark",onClick:()=>T(!1),children:"Done"})]})]})}),a(z,{position:"bottom",shadow:"md",control:a("button",{className:"TaskManager__composer__control",type:"button",children:[a(ea,{size:15,strokeWidth:"1.8"}),a("span",{children:w}),a(Z,{size:14,strokeWidth:"1.8"})]}),children:["high","medium","normal"].map(o=>a(z.Item,{className:w===o?"TaskManager__composer__menuItem--active":"",onClick:()=>B(o),children:o},o))}),a(R,{opened:C,onClose:()=>L(!1),position:"bottom",shadow:"md",width:260,withArrow:!0,target:a("button",{className:"TaskManager__composer__control",type:"button","aria-expanded":C,onClick:()=>L(!C),children:[a(X,{size:15,strokeWidth:"1.8"}),a("span",{children:x?Da(x):"target launch date"})]}),children:a("div",{className:"TaskManager__composer__popover",children:[a("label",{className:"TaskManager__composer__dateLabel",children:["Target launch date",a("input",{type:"date",value:x,onInput:o=>{N(o.currentTarget.value)}})]}),a("div",{className:"TaskManager__composer__popover__actions",children:[a(_,{compact:!0,size:"xs",variant:"default",onClick:()=>N(""),children:"Clear"}),a(_,{compact:!0,size:"xs",color:"dark",onClick:()=>L(!1),children:"Done"})]})]})})]}),a(_,{type:"submit",size:"xs",color:"dark",loading:H,disabled:!ma,rightIcon:a(Q,{size:15,strokeWidth:"1.8"}),children:"Create task"})]})]})}),a("div",{className:"TaskManager__listHeader",children:[a("div",{className:"TaskManager__listHeader__summary",children:[a("div",{className:"TaskManager__listHeader__titleLine",children:[a("div",{className:"TaskManager__sectionTitle",children:r?"Tasks":"Active tasks"}),a("span",{className:"TaskManager__listHeader__count",children:ga})]}),a("div",{className:"TaskManager__filters","aria-label":"Task filters",children:pa.map(o=>a("button",{className:f===o.value?"active":"",type:"button",onClick:()=>b(o.value),children:o.label},o.value))})]}),a("div",{className:"TaskManager__listHeader__actions",children:r?a(q,{className:"TaskManager__layoutToggle",size:"xs",value:p,onChange:o=>da(o),data:va}):a(_,{component:"a",href:"/cms/tasks",variant:"default",size:"xs",compact:!0,children:"Show all"})})]}),a(ya,{error:c,filter:f,layout:r?p:"compact",loading:n,tasks:U})]})}function ya(t){let{error:e,filter:s,layout:r,loading:i,tasks:n}=t;return i?a(d,{className:"TaskManager__list",children:a("div",{className:"TaskManager__list__state",children:a(G,{color:"gray",size:"sm"})})}):e?a(d,{className:"TaskManager__list",children:a("div",{className:"TaskManager__list__state error",children:e})}):n.length===0?a(d,{className:"TaskManager__list",children:a("div",{className:"TaskManager__list__state",children:Ra(s,r)})}):r==="board"?a(wa,{filter:s,tasks:n}):r==="table"?a(Ma,{tasks:n}):a(d,{className:"TaskManager__list",children:n.map(c=>a(La,{task:c},c.id))})}function Ma(t){return a(d,{className:"TaskManager__tableSurface",children:a(J,{className:"TaskManager__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[a("thead",{children:a("tr",{children:[a("th",{children:"task"}),a("th",{children:"status"}),a("th",{children:"priority"}),a("th",{children:"assignee"}),a("th",{children:"target"}),a("th",{children:"opened"})]})}),a("tbody",{children:t.tasks.map(e=>{let s=e.createdBy||"unknown";return a("tr",{children:[a("td",{children:a("a",{className:"TaskManager__tableTask",href:`/cms/tasks/${e.id}`,children:[a("div",{className:"TaskManager__taskRow__avatar",children:e.assignee&&a(v,{email:e.assignee,size:24})}),a("span",{className:"TaskManager__tableTask__content",children:[a("span",{className:"TaskManager__tableTask__title",children:e.title}),a("span",{className:"TaskManager__tableTask__meta",children:["#",e.id," by ",m(s)]})]})]})}),a("td",{children:a("span",{className:"TaskManager__taskRow__status",children:[a("span",{}),E(e.status)]})}),a("td",{children:a("span",{className:`TaskManager__taskRow__priority TaskManager__taskRow__priority--${u(e.priority)}`,children:u(e.priority)})}),a("td",{children:e.assignee?m(e.assignee):"Unassigned"}),a("td",{children:e.targetLaunchDate?k(e.targetLaunchDate):"None"}),a("td",{children:k(e.createdAt)})]},e.id)})})]})})}function wa(t){let e=Aa(t.tasks,t.filter);return a("div",{className:"TaskManager__board",children:e.map(s=>{let r=t.tasks.filter(i=>ca(i)===s.value);return a("section",{className:"TaskManager__boardColumn",children:[a("div",{className:"TaskManager__boardColumn__header",children:[a("span",{children:s.label}),a("span",{children:r.length})]}),a("div",{className:"TaskManager__boardColumn__tasks",children:[r.length===0&&a("div",{className:"TaskManager__boardColumn__empty",children:"No tasks"}),r.map(i=>a(Na,{task:i},i.id))]})]},s.value)})})}function Na(t){let{task:e}=t,s=e.createdBy||"unknown";return a("a",{className:"TaskManager__boardCard",href:`/cms/tasks/${e.id}`,children:[a("div",{className:"TaskManager__boardCard__title",children:e.title}),e.description&&a("div",{className:"TaskManager__boardCard__description",children:e.description}),a("div",{className:"TaskManager__boardCard__meta",children:["#",e.id," opened ",k(e.createdAt)," by"," ",m(s)]}),a("div",{className:"TaskManager__boardCard__badges",children:[a("span",{className:`TaskManager__taskRow__priority TaskManager__taskRow__priority--${u(e.priority)}`,children:u(e.priority)}),a("span",{className:"TaskManager__boardCard__badge",children:e.assignee?m(e.assignee):"Unassigned"}),e.targetLaunchDate&&a("span",{className:"TaskManager__boardCard__badge",children:["target ",k(e.targetLaunchDate)]})]})]})}function Ca(t){let[e,...s]=t.split(`
2
2
  `);for(;s.length>0&&s[0].trim().length===0;)s.shift();return{title:e.trim(),description:s.join(`
3
3
  `).trim()}}function La(t){let{task:e}=t,s=e.createdBy||"unknown";return a("a",{className:"TaskManager__taskRow",href:`/cms/tasks/${e.id}`,children:[a("div",{className:"TaskManager__taskRow__avatar",children:e.assignee&&a(v,{email:e.assignee,size:28})}),a("div",{className:"TaskManager__taskRow__content",children:[a("div",{className:"TaskManager__taskRow__title",children:e.title}),a("div",{className:"TaskManager__taskRow__meta",children:["opened ",k(e.createdAt)," by ",m(s)]})]}),a("div",{className:"TaskManager__taskRow__badges",children:[a("div",{className:"TaskManager__taskRow__status",children:[a("span",{}),E(e.status)]}),a("div",{className:`TaskManager__taskRow__priority TaskManager__taskRow__priority--${u(e.priority)}`,children:u(e.priority)}),e.targetLaunchDate&&a("div",{className:"TaskManager__taskRow__date",children:["target ",k(e.targetLaunchDate)]})]})]})}function Sa(t){let[e,s]=l([]),[r,i]=l(!0),[n,c]=l("");return W(()=>{i(!0);let b=(t==="all"?ia:la)(p=>{s(p),c(""),i(!1)},p=>{c(D(p)),i(!1)});return()=>b()},[t]),{tasks:e,loading:r,error:n}}function za(t,e,s){switch(e){case"all":return t;case"closed":return t.filter(r=>!P(r.status));case"assigned-to-me":return t.filter(r=>r.assignee===s);case"created-by-me":return t.filter(r=>r.createdBy===s);default:return t.filter(r=>P(r.status))}}function Ra(t,e){switch(t){case"assigned-to-me":return e==="compact"?"No active tasks are assigned to you.":"No tasks are assigned to you.";case"created-by-me":return"No tasks created by you.";case"closed":return"No closed tasks yet.";case"all":return"No tasks yet.";default:return"No active tasks yet."}}function m(t){return t.split("@")[0]||t}function k(t){return t?.toMillis?new Date(t.toMillis()).toLocaleDateString("en",{month:"short",day:"numeric"}):"just now"}function E(t){return I(t).replace(/[-_]/g," ")}function ca(t){return I(t.status)}function Aa(t,e){let s=e==="open"?Ta:e==="closed"?xa:O,r=new Set(s.map(n=>n.value)),i=t.map(n=>ca(n)).filter(n=>!r.has(n));return[...s,...Array.from(new Set(i)).map(n=>({value:n,label:E(n)}))]}function u(t){return t||"normal"}function _a(t){if(!t)return null;let[e,s,r]=t.split("-").map(Number);return!e||!s||!r?null:new Date(e,s-1,r)}function Da(t){let e=_a(t);return e?e.toLocaleDateString("en",{month:"short",day:"numeric"}):"target launch date"}export{qa as a};
@@ -1 +1 @@
1
- import{a as m}from"./chunk-F7RQT4XN.js";import{b as _}from"./chunk-RN4XVVWD.js";import{a as S,c as u}from"./chunk-QRAFYIAW.js";import{Ga as e,V as d,a as c,c as s,da as l,j as h}from"./chunk-WRA24P66.js";h();var r="DataSourceSelectModal";function T(){let a=S(),t=u();return{open:i=>{a.openContextModal(r,{...t,innerProps:i,size:"600px",overflow:"inside"})},close:()=>{a.closeModal(r)}}}function N(a){let{innerProps:t}=a,[i,p]=c(!0),[n,D]=c([]),f=t.selectedDataSourceIds||[];s(()=>{async function o(){let g=await _();D(g.filter(x=>!x.archivedAt)),p(!1)}o()},[]);function M(o){t.onChange&&t.onChange(o,!0)}function v(o){t.onChange&&t.onChange(o,!1)}return e("div",{className:"DataSourceSelectModal",children:i?e("div",{className:"DataSourceSelectModal__loading",children:e(d,{color:"gray",size:"xl"})}):n.length===0?e("div",{className:"DataSourceSelectModal__empty",children:"No data sources."}):e("div",{className:"DataSourceSelectModal__list",children:n.map(o=>e("div",{className:"DataSourceSelectModal__item",children:[e(m,{className:"DataSourceSelectModal__item__icon",type:o.type}),e("div",{className:"DataSourceSelectModal__item__info",children:[e("div",{className:"DataSourceSelectModal__item__id",children:o.id}),o.description&&e("div",{className:"DataSourceSelectModal__item__description",children:o.description})]}),e("div",{className:"DataSourceSelectModal__item__action",children:f.includes(o.id)?e(l,{variant:"light",color:"blue",size:"xs",onClick:()=>v(o.id),children:"Unselect"}):e(l,{variant:"filled",color:"blue",size:"xs",onClick:()=>M(o.id),children:"Select"})})]},o.id))})})}N.id=r;export{T as a,N as b};
1
+ import{a as m}from"./chunk-EET5AS64.js";import{b as _}from"./chunk-Z2CRNO3I.js";import{a as S,c as u}from"./chunk-XYXL5HSZ.js";import{V as d,a as c,c as s,da as l,fd as e,j as h}from"./chunk-Y7RYSRP7.js";h();var r="DataSourceSelectModal";function T(){let a=S(),t=u();return{open:i=>{a.openContextModal(r,{...t,innerProps:i,size:"600px",overflow:"inside"})},close:()=>{a.closeModal(r)}}}function N(a){let{innerProps:t}=a,[i,p]=c(!0),[n,D]=c([]),f=t.selectedDataSourceIds||[];s(()=>{async function o(){let g=await _();D(g.filter(x=>!x.archivedAt)),p(!1)}o()},[]);function M(o){t.onChange&&t.onChange(o,!0)}function v(o){t.onChange&&t.onChange(o,!1)}return e("div",{className:"DataSourceSelectModal",children:i?e("div",{className:"DataSourceSelectModal__loading",children:e(d,{color:"gray",size:"xl"})}):n.length===0?e("div",{className:"DataSourceSelectModal__empty",children:"No data sources."}):e("div",{className:"DataSourceSelectModal__list",children:n.map(o=>e("div",{className:"DataSourceSelectModal__item",children:[e(m,{className:"DataSourceSelectModal__item__icon",type:o.type}),e("div",{className:"DataSourceSelectModal__item__info",children:[e("div",{className:"DataSourceSelectModal__item__id",children:o.id}),o.description&&e("div",{className:"DataSourceSelectModal__item__description",children:o.description})]}),e("div",{className:"DataSourceSelectModal__item__action",children:f.includes(o.id)?e(l,{variant:"light",color:"blue",size:"xs",onClick:()=>v(o.id),children:"Unselect"}):e(l,{variant:"filled",color:"blue",size:"xs",onClick:()=>M(o.id),children:"Select"})})]},o.id))})})}N.id=r;export{T as a,N as b};
@@ -0,0 +1 @@
1
+ import{e}from"./chunk-GJ7ES2LA.js";import{fd as o}from"./chunk-Y7RYSRP7.js";function n(r){return o("div",{className:e(r.className,"Surface"),children:r.children})}export{n as a};
@@ -1 +1 @@
1
- import{e as z,j as I}from"./chunk-UPN3EMUS.js";import{d as N,f as L}from"./chunk-TNW2GNUR.js";import{a as C}from"./chunk-QFDU6FXP.js";import{a as w,c as y}from"./chunk-QRAFYIAW.js";import{b as v}from"./chunk-5MV6XVGA.js";import{Ga as e,Gc as B,V as P,a as g,da as p,g as M,j as x,ua as S,za as f}from"./chunk-WRA24P66.js";x();x();function O(o,t){return M(()=>{if(!t.trim())return o;let l=t.toLowerCase();return o.filter(c=>{let[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],s=v(r,n.preview?.title||"meta.title")||"";return c.id.toLowerCase().includes(l)||s.toLowerCase().includes(l)||u.toLowerCase().includes(l)})},[o,t])}var h="DocPickerModal";function ee(){let o=w(),t=y();return{open:l=>{o.openContextModal(h,{...t,innerProps:l,size:"700px",overflow:"inside"})},close:()=>{o.closeModal(h)}}}function k(o){let{innerProps:t}=o,l=Object.keys(window.__ROOT_CTX.collections);t.collections?.length&&(l=l.filter(i=>t.collections?.includes(i)));let c=[{value:"",label:"Select"}];l.forEach(i=>{c.push({value:i,label:i})});let[a,u]=C("DocPickerModal.lastSelectedCollection",""),r=()=>t.initialCollection?t.initialCollection:a&&l.includes(a)?a:l.length===1?l[0]:"",[n,D]=g(r()),s=i=>{D(i),u(i)};function m(i){t.multiSelect&&t.onChangeMulti?t.onChangeMulti(i.id,!0):t.onChange&&t.onChange(i.id)}function b(i){t.multiSelect&&t.onChangeMulti&&t.onChangeMulti(i.id,!1)}return e("div",{className:"DocPickerModal",children:[l.length===0&&e("div",{className:"DocPickerModal__noCollections",children:"No collections matching schema field definition."}),l.length>0&&e(k.DocsList,{collection:n,onDocSelected:m,onDocUnselected:b,onCollectionChange:s,multiSelect:t.multiSelect,selectedDocIds:t.selectedDocIds,options:{enableSearch:t.enableSearch??!0,enableSort:t.enableSort??!0,enableCreate:t.enableCreate??!0,enableStatusBadges:t.enableStatusBadges??!0,showCollectionSelect:l.length>1,collectionSelectValue:n,collectionSelectOptions:c}})]})}k.DocsList=o=>{let[t,l]=g(""),[c,a]=C(`root::DocPickerModal:${o.collection}:sortBy`,"modifiedAt"),[u,r]=g(!1),[n,D,s]=z(o.collection||"",{orderBy:c}),m=O(s,t),b=[{value:"modifiedAt",label:"Last Modified"},{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"}],i=o.selectedDocIds||[],d=o.options||{};return e("div",{className:"DocPickerModal__DocsList",children:[e("div",{className:"DocPickerModal__DocsList__stickyHeader",children:[d.showCollectionSelect&&e("div",{className:"DocPickerModal__collection__select",children:[e("div",{className:"DocPickerModal__collection__select__label",children:"Content Type:"}),e(f,{data:d.collectionSelectOptions||[],value:d.collectionSelectValue,placeholder:"Select",onChange:_=>{o.onCollectionChange?.(_||"")},size:"xs",radius:0,searchable:!0,autoFocus:!0,dropdownComponent:"div"}),d.collectionSelectValue&&e(p,{variant:"outline",color:"dark",size:"xs",onClick:()=>r(!0),children:"New"})]}),d.enableSearch&&d.collectionSelectValue&&e("div",{className:"DocPickerModal__DocsList__controls",children:[e(S,{placeholder:"Search documents...",value:t,onChange:_=>l(_.target.value),icon:e(B,{size:16}),size:"xs",className:"DocPickerModal__DocsList__controls__search"}),d.enableSort&&e(f,{data:b,value:c,onChange:_=>a(_||"modifiedAt"),size:"xs",className:"DocPickerModal__DocsList__controls__sort"})]}),!n&&s.length>0&&e("div",{className:"DocPickerModal__DocsList__count",children:["Showing ",m.length," of ",s.length," documents"]})]}),e("div",{className:"DocPickerModal__DocsList__docsContainer",children:o.collection?n?e("div",{className:"DocPickerModal__DocsList__loading",children:e(P,{color:"gray",size:"xl"})}):m.length===0?e("div",{className:"DocPickerModal__DocsList__empty",children:s.length===0?"Collection is empty.":"No documents match your search."}):e("div",{className:"DocPickerModal__DocsList__docs",children:m.map(_=>e(k.DocCard,{doc:_,onDocSelected:o.onDocSelected,onDocUnselected:o.onDocUnselected,multiSelect:o.multiSelect,selected:i.includes(_.id),enableStatusBadges:d.enableStatusBadges},_.id))}):e("div",{className:"DocPickerModal__DocsList__empty",children:"Select a content type to view documents"})}),d.collectionSelectValue&&e(I,{collection:d.collectionSelectValue,opened:u,skipNavigation:!0,onClose:()=>{r(!1),D()}})]})};k.DocCard=o=>{let[t,l]=g(!!o.selected),c=o.doc,[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],D=`/cms/content/${a}/${u}`,s=v(r,n.preview?.title||"meta.title"),m=v(r,n.preview?.image||"meta.image")||n.preview?.defaultImage;return e("div",{className:"DocPickerModal__DocCard",children:[e("div",{className:"DocPickerModal__DocCard__image",onClick:()=>window.open(D,"_blank"),children:e(L,{file:m,width:120,height:90,withPlaceholder:!m?.src})}),e("div",{className:"DocPickerModal__DocCard__content",children:[e("div",{className:"DocPickerModal__DocCard__content__header",children:e("div",{className:"DocPickerModal__DocCard__content__header__docId",onClick:()=>window.open(D,"_blank"),children:c.id})}),e("div",{className:"DocPickerModal__DocCard__content__title",children:e("div",{className:"DocPickerModal__DocCard__content__link",onClick:()=>window.open(D,"_blank"),children:s||"[UNTITLED]"})}),o.enableStatusBadges&&e("div",{className:"DocPickerModal__DocCard__content__badges",children:e(N,{doc:c})})]}),e("div",{className:"DocPickerModal__DocCard__controls",children:e("div",{className:"DocPickerModal__DocCard__controls__buttons",children:o.multiSelect?t?e(p,{variant:"light",color:"blue",size:"xs",onClick:()=>{l(!1),o.onDocUnselected(o.doc)},children:"Unselect"}):e(p,{variant:"filled",color:"blue",size:"xs",onClick:()=>{l(!0),o.onDocSelected(o.doc)},children:"Select"}):e(p,{color:"blue",size:"xs",onClick:()=>o.onDocSelected(o.doc),children:"Select"})})})]})};k.id=h;export{ee as a,k as b};
1
+ import{a as z,f as I}from"./chunk-PY4JH5SN.js";import{m as L,o as B}from"./chunk-CEWU5VSJ.js";import{a as C}from"./chunk-MALK5YEV.js";import{a as w,c as y}from"./chunk-XYXL5HSZ.js";import{b as v}from"./chunk-5MV6XVGA.js";import{Gc as N,V as P,a as g,da as p,fd as e,g as M,j as x,ua as S,za as f}from"./chunk-Y7RYSRP7.js";x();x();function O(o,t){return M(()=>{if(!t.trim())return o;let l=t.toLowerCase();return o.filter(c=>{let[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],s=v(r,n.preview?.title||"meta.title")||"";return c.id.toLowerCase().includes(l)||s.toLowerCase().includes(l)||u.toLowerCase().includes(l)})},[o,t])}var h="DocPickerModal";function ee(){let o=w(),t=y();return{open:l=>{o.openContextModal(h,{...t,innerProps:l,size:"700px",overflow:"inside"})},close:()=>{o.closeModal(h)}}}function k(o){let{innerProps:t}=o,l=Object.keys(window.__ROOT_CTX.collections);t.collections?.length&&(l=l.filter(i=>t.collections?.includes(i)));let c=[{value:"",label:"Select"}];l.forEach(i=>{c.push({value:i,label:i})});let[a,u]=C("DocPickerModal.lastSelectedCollection",""),r=()=>t.initialCollection?t.initialCollection:a&&l.includes(a)?a:l.length===1?l[0]:"",[n,D]=g(r()),s=i=>{D(i),u(i)};function m(i){t.multiSelect&&t.onChangeMulti?t.onChangeMulti(i.id,!0):t.onChange&&t.onChange(i.id)}function b(i){t.multiSelect&&t.onChangeMulti&&t.onChangeMulti(i.id,!1)}return e("div",{className:"DocPickerModal",children:[l.length===0&&e("div",{className:"DocPickerModal__noCollections",children:"No collections matching schema field definition."}),l.length>0&&e(k.DocsList,{collection:n,onDocSelected:m,onDocUnselected:b,onCollectionChange:s,multiSelect:t.multiSelect,selectedDocIds:t.selectedDocIds,options:{enableSearch:t.enableSearch??!0,enableSort:t.enableSort??!0,enableCreate:t.enableCreate??!0,enableStatusBadges:t.enableStatusBadges??!0,showCollectionSelect:l.length>1,collectionSelectValue:n,collectionSelectOptions:c}})]})}k.DocsList=o=>{let[t,l]=g(""),[c,a]=C(`root::DocPickerModal:${o.collection}:sortBy`,"modifiedAt"),[u,r]=g(!1),[n,D,s]=z(o.collection||"",{orderBy:c}),m=O(s,t),b=[{value:"modifiedAt",label:"Last Modified"},{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"}],i=o.selectedDocIds||[],d=o.options||{};return e("div",{className:"DocPickerModal__DocsList",children:[e("div",{className:"DocPickerModal__DocsList__stickyHeader",children:[d.showCollectionSelect&&e("div",{className:"DocPickerModal__collection__select",children:[e("div",{className:"DocPickerModal__collection__select__label",children:"Content Type:"}),e(f,{data:d.collectionSelectOptions||[],value:d.collectionSelectValue,placeholder:"Select",onChange:_=>{o.onCollectionChange?.(_||"")},size:"xs",radius:0,searchable:!0,autoFocus:!0,dropdownComponent:"div"}),d.collectionSelectValue&&e(p,{variant:"outline",color:"dark",size:"xs",onClick:()=>r(!0),children:"New"})]}),d.enableSearch&&d.collectionSelectValue&&e("div",{className:"DocPickerModal__DocsList__controls",children:[e(S,{placeholder:"Search documents...",value:t,onChange:_=>l(_.target.value),icon:e(N,{size:16}),size:"xs",className:"DocPickerModal__DocsList__controls__search"}),d.enableSort&&e(f,{data:b,value:c,onChange:_=>a(_||"modifiedAt"),size:"xs",className:"DocPickerModal__DocsList__controls__sort"})]}),!n&&s.length>0&&e("div",{className:"DocPickerModal__DocsList__count",children:["Showing ",m.length," of ",s.length," documents"]})]}),e("div",{className:"DocPickerModal__DocsList__docsContainer",children:o.collection?n?e("div",{className:"DocPickerModal__DocsList__loading",children:e(P,{color:"gray",size:"xl"})}):m.length===0?e("div",{className:"DocPickerModal__DocsList__empty",children:s.length===0?"Collection is empty.":"No documents match your search."}):e("div",{className:"DocPickerModal__DocsList__docs",children:m.map(_=>e(k.DocCard,{doc:_,onDocSelected:o.onDocSelected,onDocUnselected:o.onDocUnselected,multiSelect:o.multiSelect,selected:i.includes(_.id),enableStatusBadges:d.enableStatusBadges},_.id))}):e("div",{className:"DocPickerModal__DocsList__empty",children:"Select a content type to view documents"})}),d.collectionSelectValue&&e(I,{collection:d.collectionSelectValue,opened:u,skipNavigation:!0,onClose:()=>{r(!1),D()}})]})};k.DocCard=o=>{let[t,l]=g(!!o.selected),c=o.doc,[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],D=`/cms/content/${a}/${u}`,s=v(r,n.preview?.title||"meta.title"),m=v(r,n.preview?.image||"meta.image")||n.preview?.defaultImage;return e("div",{className:"DocPickerModal__DocCard",children:[e("div",{className:"DocPickerModal__DocCard__image",onClick:()=>window.open(D,"_blank"),children:e(B,{file:m,width:120,height:90,withPlaceholder:!m?.src})}),e("div",{className:"DocPickerModal__DocCard__content",children:[e("div",{className:"DocPickerModal__DocCard__content__header",children:e("div",{className:"DocPickerModal__DocCard__content__header__docId",onClick:()=>window.open(D,"_blank"),children:c.id})}),e("div",{className:"DocPickerModal__DocCard__content__title",children:e("div",{className:"DocPickerModal__DocCard__content__link",onClick:()=>window.open(D,"_blank"),children:s||"[UNTITLED]"})}),o.enableStatusBadges&&e("div",{className:"DocPickerModal__DocCard__content__badges",children:e(L,{doc:c})})]}),e("div",{className:"DocPickerModal__DocCard__controls",children:e("div",{className:"DocPickerModal__DocCard__controls__buttons",children:o.multiSelect?t?e(p,{variant:"light",color:"blue",size:"xs",onClick:()=>{l(!1),o.onDocUnselected(o.doc)},children:"Unselect"}):e(p,{variant:"filled",color:"blue",size:"xs",onClick:()=>{l(!0),o.onDocSelected(o.doc)},children:"Select"}):e(p,{color:"blue",size:"xs",onClick:()=>o.onDocSelected(o.doc),children:"Select"})})})]})};k.id=h;export{ee as a,k as b};
@@ -1 +1 @@
1
- import{a as t}from"./chunk-PIJ3E47R.js";function s(e){if(typeof e=="object"&&e!==null){let o=e;if(typeof o.code=="string"&&typeof o.message=="string")return`${o.code}: ${o.message}`;if(typeof o.body=="string")return o.body;if(typeof o.message=="string")return o.message}return String(e)}async function i(e){try{await e()}catch(o){console.error(o);let r=s(o);t({title:"Error",message:r,color:"red",autoClose:!1})}}export{s as a,i as b};
1
+ import{a as t}from"./chunk-ZYSR5UIW.js";function s(e){if(typeof e=="object"&&e!==null){let o=e;if(typeof o.code=="string"&&typeof o.message=="string")return`${o.code}: ${o.message}`;if(typeof o.body=="string")return o.body;if(typeof o.message=="string")return o.message}return String(e)}async function i(e){try{await e()}catch(o){console.error(o);let r=s(o);t({title:"Error",message:r,color:"red",autoClose:!1})}}export{s as a,i as b};
@@ -1 +1 @@
1
- import{i as M}from"./chunk-FVWSVOOY.js";import{a as n,c as _}from"./chunk-QRAFYIAW.js";import{b as h}from"./chunk-2PTLQRTU.js";import{a as u}from"./chunk-PIJ3E47R.js";import{C as f,a as m}from"./chunk-XOWWPE7X.js";import{Ga as e,a as i,da as d,e as c,j as I}from"./chunk-WRA24P66.js";I();var S="ScheduleReleaseModal";function F(l){let t=n(),a=_();return{open:()=>{t.openContextModal(S,{...a,title:`Schedule release: ${l.releaseId}`,innerProps:l})}}}function T(l){let{innerProps:t,context:a,id:g}=l,[s,x]=i(""),[R,r]=i(!1),v=c(null),b=n();async function w(){r(!0),await h(async()=>{let o=Math.floor(new Date(s).getTime());if(Math.floor(new Date().getTime())>=o)throw new Error("bad datetime, please choose a date in the future");let y=m.fromMillis(o);await M(t.releaseId,o),u({title:"Scheduled!",message:`Release ${t.releaseId} will go live ${s}.`,autoClose:1e4}),b.closeAll(),t.onScheduled&&t.onScheduled(y)}),r(!1)}return e("div",{className:"ScheduleReleaseModal",children:e("div",{className:"ScheduleReleaseModal__content",children:e("form",{className:"ScheduleReleaseModal__form",onSubmit:o=>{o.preventDefault(),w()},children:[e("div",{className:"ScheduleReleaseModal__form__description",children:"Content in the release will go live at the datetime specified below."}),e("div",{className:"ScheduleReleaseModal__form__dateInput",children:[e("input",{ref:v,type:"datetime-local",value:s,min:f(),onChange:o=>{let p=o.target;x(p.value)}}),e("div",{className:"ScheduleReleaseModal__form__dateInput__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]}),e("div",{className:"ScheduleReleaseModal__form__buttons",children:[e(d,{variant:"outline",onClick:()=>a.closeModal(g),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(d,{variant:"filled",size:"xs",color:"dark",loading:R,type:"submit",children:"Schedule"})]})]})})})}T.id=S;export{F as a,T as b};
1
+ import{i as M}from"./chunk-B74M7NEV.js";import{a as n,c as _}from"./chunk-XYXL5HSZ.js";import{b as h}from"./chunk-U5OXKKBN.js";import{a as u}from"./chunk-ZYSR5UIW.js";import{C as f,a as m}from"./chunk-XOWWPE7X.js";import{a as i,da as d,e as c,fd as e,j as I}from"./chunk-Y7RYSRP7.js";I();var S="ScheduleReleaseModal";function F(l){let t=n(),a=_();return{open:()=>{t.openContextModal(S,{...a,title:`Schedule release: ${l.releaseId}`,innerProps:l})}}}function T(l){let{innerProps:t,context:a,id:g}=l,[s,x]=i(""),[R,r]=i(!1),v=c(null),b=n();async function w(){r(!0),await h(async()=>{let o=Math.floor(new Date(s).getTime());if(Math.floor(new Date().getTime())>=o)throw new Error("bad datetime, please choose a date in the future");let y=m.fromMillis(o);await M(t.releaseId,o),u({title:"Scheduled!",message:`Release ${t.releaseId} will go live ${s}.`,autoClose:1e4}),b.closeAll(),t.onScheduled&&t.onScheduled(y)}),r(!1)}return e("div",{className:"ScheduleReleaseModal",children:e("div",{className:"ScheduleReleaseModal__content",children:e("form",{className:"ScheduleReleaseModal__form",onSubmit:o=>{o.preventDefault(),w()},children:[e("div",{className:"ScheduleReleaseModal__form__description",children:"Content in the release will go live at the datetime specified below."}),e("div",{className:"ScheduleReleaseModal__form__dateInput",children:[e("input",{ref:v,type:"datetime-local",value:s,min:f(),onChange:o=>{let p=o.target;x(p.value)}}),e("div",{className:"ScheduleReleaseModal__form__dateInput__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]}),e("div",{className:"ScheduleReleaseModal__form__buttons",children:[e(d,{variant:"outline",onClick:()=>a.closeModal(g),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(d,{variant:"filled",size:"xs",color:"dark",loading:R,type:"submit",children:"Schedule"})]})]})})})}T.id=S;export{F as a,T as b};