@blinkk/root-cms 3.1.1 → 3.1.3

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 (95) hide show
  1. package/dist/app.js +1 -1
  2. package/dist/{chunk-GXV4UQ6Z.js → chunk-4G7S2LJH.js} +2 -2
  3. package/dist/core/plugin.d.ts +1 -1
  4. package/dist/core/translations.d.ts +19 -4
  5. package/dist/plugin.js +34 -4
  6. package/dist/shared/translation-languages.d.ts +67 -0
  7. package/dist/ui/AIPage-VOTAEVJE.js +1 -0
  8. package/dist/ui/AssetsPage-EWGRMRPJ.js +1 -0
  9. package/dist/ui/{CollectionPage-CU3VDEXA.js → CollectionPage-N5JIAUDS.js} +1 -1
  10. package/dist/ui/ComparePage-JDPVU2VA.js +1 -0
  11. package/dist/ui/{DataPage-XIXFKXDN.js → DataPage-37D4CMLZ.js} +1 -1
  12. package/dist/ui/{DataSourcePage-ORIEQH3Y.js → DataSourcePage-LX5ASYQN.js} +1 -1
  13. package/dist/ui/DocTranslationsPage-V5M4KB7X.js +1 -0
  14. package/dist/ui/DocumentPage-SURTQJPG.js +1 -0
  15. package/dist/ui/{EditDataSourcePage-HIGZZQJC.js → EditDataSourcePage-O7DOV5LX.js} +1 -1
  16. package/dist/ui/{EditReleasePage-KUHBU2HQ.js → EditReleasePage-NDYTKGXY.js} +1 -1
  17. package/dist/ui/{EmbeddedAIPage-CJWZE5FC.js → EmbeddedAIPage-RJOUIPF2.js} +1 -1
  18. package/dist/ui/EmbeddedDocumentPage-SLEULNNI.js +1 -0
  19. package/dist/ui/LogsPage-ZGBP3I35.js +1 -0
  20. package/dist/ui/{NewDataSourcePage-7TUUE6ZL.js → NewDataSourcePage-GQONTMP4.js} +1 -1
  21. package/dist/ui/NewReleasePage-7ZKXHDTD.js +1 -0
  22. package/dist/ui/{NotFoundPage-AW6UC6II.js → NotFoundPage-WXEZQZK6.js} +1 -1
  23. package/dist/ui/ProjectPage-F7W7X6YO.js +1 -0
  24. package/dist/ui/{ReleasePage-W2R3DIFX.js → ReleasePage-ZKMNYPML.js} +1 -1
  25. package/dist/ui/{ReleasesPage-HBBUGE7D.js → ReleasesPage-JHCE6AEJ.js} +1 -1
  26. package/dist/ui/SettingsPage-MWCPZPGE.js +1 -0
  27. package/dist/ui/SidebarToolsPage-API53RRR.js +1 -0
  28. package/dist/ui/TaskPage-73NLAR4J.js +1 -0
  29. package/dist/ui/TasksPage-IKPW2OQO.js +1 -0
  30. package/dist/ui/{TranslationsArbPage-AJLM5VSD.js → TranslationsArbPage-QVN66DIW.js} +1 -1
  31. package/dist/ui/TranslationsEditPage-ZOELF5PK.js +1 -0
  32. package/dist/ui/{TranslationsPage-HPYAJQ4Q.js → TranslationsPage-NGGZB4L6.js} +32 -32
  33. package/dist/ui/{chunk-3T4ZWQR4.js → chunk-2EPQJUGM.js} +1 -1
  34. package/dist/ui/{chunk-2KSMCQ6H.js → chunk-2RAVKX2Z.js} +1 -1
  35. package/dist/ui/{chunk-B6M55OFE.js → chunk-4FGASIIX.js} +1 -1
  36. package/dist/ui/chunk-AAHM6RYJ.js +1 -0
  37. package/dist/ui/{chunk-OXVYTSIZ.js → chunk-BOER3EAW.js} +1 -1
  38. package/dist/ui/{chunk-GU24U5RM.js → chunk-BT2NTAW2.js} +1 -1
  39. package/dist/ui/chunk-BUNR5EU3.js +1 -0
  40. package/dist/ui/{chunk-O5P3CPJ4.js → chunk-BW2MKGNP.js} +1 -1
  41. package/dist/ui/chunk-C2BLMTPR.js +3 -0
  42. package/dist/ui/{chunk-RAXWL656.js → chunk-DIFPCF7I.js} +1 -1
  43. package/dist/ui/{chunk-R6B3W5AJ.js → chunk-DS27MO63.js} +1 -1
  44. package/dist/ui/{chunk-MZTOPPWQ.js → chunk-ENQKSLGJ.js} +1 -1
  45. package/dist/ui/chunk-FXIR2RBE.js +1 -0
  46. package/dist/ui/chunk-G5ZZDHWA.js +1 -0
  47. package/dist/ui/{chunk-76ZGLKLT.js → chunk-GT5EQSEX.js} +1 -1
  48. package/dist/ui/{chunk-AZCGXQTL.js → chunk-IOR72US3.js} +1 -1
  49. package/dist/ui/{chunk-XT5FNJCX.js → chunk-MSYTAJBV.js} +1 -1
  50. package/dist/ui/{chunk-E76ECIOX.js → chunk-NJMNOITA.js} +1 -1
  51. package/dist/ui/chunk-NSI5JSVV.js +1 -0
  52. package/dist/ui/{chunk-OWQL5DVE.js → chunk-PPYM4O5N.js} +1 -1
  53. package/dist/ui/{chunk-WKF7CSWS.js → chunk-QF3GPZTI.js} +1 -1
  54. package/dist/ui/{chunk-TDUBSLEC.js → chunk-T77VOWHP.js} +1 -1
  55. package/dist/ui/chunk-TOGLZDK3.js +1 -0
  56. package/dist/ui/{chunk-V4CTOC6E.js → chunk-TPJCPCRR.js} +1 -1
  57. package/dist/ui/{chunk-GQ5IRK43.js → chunk-TVYAZN2Q.js} +1 -1
  58. package/dist/ui/chunk-UPDL6UXI.js +1 -0
  59. package/dist/ui/{chunk-764W6634.js → chunk-VPHBKJ3I.js} +1 -1
  60. package/dist/ui/{chunk-U7PWJV6F.js → chunk-W6LP22IK.js} +1 -1
  61. package/dist/ui/{chunk-WXT7LTQM.js → chunk-WYJJZTCI.js} +1 -1
  62. package/dist/ui/chunk-Y3MCFLQU.js +141 -0
  63. package/dist/ui/chunk-YUU6LWQK.js +1 -0
  64. package/dist/ui/chunk-Z6DBYLIM.js +1 -0
  65. package/dist/ui/chunk-ZMS6NIGG.js +1 -0
  66. package/dist/ui/ui.css +1 -1
  67. package/dist/ui/ui.js +1 -1
  68. package/package.json +3 -3
  69. package/dist/ui/AIPage-EL6DQYII.js +0 -1
  70. package/dist/ui/AssetsPage-5S6PNMF6.js +0 -1
  71. package/dist/ui/ComparePage-FTZLYO2O.js +0 -1
  72. package/dist/ui/DocTranslationsPage-4OVBIPSG.js +0 -1
  73. package/dist/ui/DocumentPage-3JPFJF3E.js +0 -1
  74. package/dist/ui/EmbeddedDocumentPage-6XQHYIAO.js +0 -1
  75. package/dist/ui/LogsPage-4DVGYXZY.js +0 -1
  76. package/dist/ui/NewReleasePage-6UT36HDW.js +0 -1
  77. package/dist/ui/ProjectPage-US5FJGFK.js +0 -1
  78. package/dist/ui/SettingsPage-7JQQILUV.js +0 -1
  79. package/dist/ui/SidebarToolsPage-MIYXKHF2.js +0 -1
  80. package/dist/ui/TaskPage-JYUQEGRB.js +0 -1
  81. package/dist/ui/TasksPage-4VFQF243.js +0 -1
  82. package/dist/ui/TranslationsEditPage-RTTGTIGI.js +0 -1
  83. package/dist/ui/chunk-5AVRMJVW.js +0 -1
  84. package/dist/ui/chunk-FFHV5S6A.js +0 -1
  85. package/dist/ui/chunk-FSVNOZ6F.js +0 -1
  86. package/dist/ui/chunk-GDXNSFLE.js +0 -1
  87. package/dist/ui/chunk-M3T56ZRP.js +0 -1
  88. package/dist/ui/chunk-MXGHX55S.js +0 -141
  89. package/dist/ui/chunk-QEE7XS6O.js +0 -1
  90. package/dist/ui/chunk-SRX7EWL4.js +0 -1
  91. package/dist/ui/chunk-TFB3VGWP.js +0 -1
  92. package/dist/ui/chunk-YLSRRNSE.js +0 -1
  93. package/dist/ui/chunk-ZN2Y5OUF.js +0 -3
  94. /package/dist/ui/{chunk-E76ECIOX.js.LEGAL.txt → chunk-NJMNOITA.js.LEGAL.txt} +0 -0
  95. /package/dist/ui/{chunk-MXGHX55S.js.LEGAL.txt → chunk-Y3MCFLQU.js.LEGAL.txt} +0 -0
@@ -1 +0,0 @@
1
- import{a as oa}from"./chunk-WXT7LTQM.js";import{a as ea}from"./chunk-OXVYTSIZ.js";import{c as ta}from"./chunk-U7PWJV6F.js";import{a as aa}from"./chunk-XT5FNJCX.js";import"./chunk-HARRKJFZ.js";import{b as G}from"./chunk-JS6TK4OP.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{Q as V,X}from"./chunk-TFB3VGWP.js";import{b as U,h as y}from"./chunk-ZN2Y5OUF.js";import{b as j}from"./chunk-J5E457OI.js";import{a as B,b as O}from"./chunk-QHJOTXYB.js";import"./chunk-O5P3CPJ4.js";import"./chunk-KRNQ6L35.js";import{a as M}from"./chunk-FFHV5S6A.js";import{a as na}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import"./chunk-VD6G5NV4.js";import{f as S}from"./chunk-YLSRRNSE.js";import{Bc as Q,Fa as p,Ga as a,Mc as Y,Qc as Z,V as R,W as w,a as r,c as k,ca as W,da as f,e as A,g as E,j as Ta,jc as K,qa as C,yb as q,zb as J}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Ta();function u(e){na(`Translations: ${e.collection}/${e.slug}`);let[_,l]=r(!0),[h,g]=r(!1),[o,t]=r([]),[s,c]=r({}),[N,sa]=r(null),[ra,I]=r(!1),[L,F]=r({}),[ia,z]=r(!1),m=e.collection,b=e.slug,i=`${m}/${b}`,la=oa(),x=((window.__ROOT_CTX.rootConfig.i18n||{}).locales||[]).filter(n=>!y(n)),[H,$]=ta("locale",x);async function ca(){try{let[n,d,T]=await Promise.all([ea(i),U(),X(i)]);t(n),c(d),sa(T),l(!1)}catch(n){console.error(n),l(!1),g(!0)}}if(k(()=>{ca()},[]),h)return a(u.NotFound,{docId:i});function da(n,d,T){I(!0),F(P=>{let D={...P},v=D[n]??{};return v.source=n,v[d]=T,D[n]=v,D})}async function ga(){z(!0),await j(async()=>{console.log("EditTranslationsModal.onSave()");let n=`edit-translations-${i}`;B({id:n,loading:!0,title:"Saving translations",message:`Updating for ${i}...`,autoClose:!1,disallowClose:!0});let d=Object.values(L);console.log(d),await V(i,d),O({id:n,title:"Saved translations",message:`Updated translations for ${i}!`,autoClose:!0}),F({}),I(!1)}),z(!1)}function _a(n){H.length===x.length?$([n]):$(x)}return a(M,{children:a("div",{className:"DocTranslationsPage",children:[a("div",{className:"DocTranslationsPage__header",children:[a(W,{className:"DocTranslationsPage__header__breadcrumbs",children:[a("a",{href:`/cms/content/${m}`,children:m}),a("a",{href:`/cms/content/${m}/${b}`,children:b}),a("div",{children:"translations"})]}),a("div",{className:"DocTranslationsPage__header__titleWrap",children:a(aa,{size:"h1",children:["Translations: ",i]})}),a("div",{className:"DocTranslationsPage__header__controls",children:[N&&a("div",{className:"DocTranslationsPage__header__linkedSheet",children:a("div",{className:"DocTranslationsPage__header__linkedSheet__controls",children:[a(p,{label:"Open Google Sheet",children:a(w,{component:"a",href:G(N),target:"_blank",variant:"filled",color:"green",size:"sm",children:a(Y,{size:16,strokeWidth:2.25})})}),a(f,{variant:"default",size:"xs",leftIcon:a(J,{size:16,strokeWidth:1.75}),children:"Import from Sheet"}),a(f,{variant:"default",size:"xs",leftIcon:a(q,{size:16,strokeWidth:1.75}),children:"Export to Sheet"})]})}),a(C,{className:"DocTranslationsPage__toolsMenu",control:a(p,{label:"Tools",children:a(w,{variant:"default",children:a(Z,{size:16})})}),size:220,children:a(C.Item,{className:"DocTranslationsPage__toolsMenu__item",icon:a(Q,{size:16}),onClick:()=>la.open({docId:i,sourceStrings:o,onPruned:n=>{c(d=>{let T={...d};return n.forEach(P=>delete T[P]),T})}}),children:"Prune unused strings"})})]})]}),a("div",{className:S("DocTranslationsPage__content",_&&"DocTranslationsPage__content--loading"),children:_?a(R,{color:"gray",size:"xl"}):a(u.Table,{locales:H,sourceStrings:o,translationsMap:s,onChange:da,changesMap:L,onSelectLocale:n=>_a(n)})}),a("div",{className:"DocTranslationsPage__footer",children:a("div",{className:"DocTranslationsPage__footer__buttons",children:a(f,{variant:"filled",color:"dark",disabled:!ra,loading:ia,onClick:()=>ga(),children:"Save"})})})]})})}u.NotFound=e=>a(M,{children:a("div",{className:"DocTranslationsPage DocTranslationsPage--error",children:a("div",{className:"DocTranslationsPage__error",children:[a("div",{className:"DocTranslationsPage__error__icon",children:a(K,{size:60})}),a("div",{className:"DocTranslationsPage__error__title",children:["Not found: ",e.docId]})]})})});u.Table=e=>{let l=((window.__ROOT_CTX.rootConfig.i18n||{}).locales||[]).filter(o=>!y(o)),h=E(()=>{let o={};return Object.values(e.translationsMap).forEach(t=>{o[t.source]=t}),o},[e.translationsMap]);function g(o,t){return{translation:(h[o]||{})[t]||"",hasChanges:!1}}return a("div",{className:"DocTranslationsPage__TableWrap",children:a("table",{className:"DocTranslationsPage__Table",children:[a("thead",{children:a("tr",{children:[a("th",{className:"DocTranslationsPage__Table__sourceCellHeader",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:"source"})}),e.locales.map(o=>a("th",{onClick:()=>e.onSelectLocale(o),className:"DocTranslationsPage__Table__localeHeader",children:a(p,{className:"DocTranslationsPage__Table__headerTooltip",placement:"start",withArrow:!0,label:e.locales.length===l.length?`Show only ${o}`:"Show all locales",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:o})})},o))]})}),a("tbody",{children:e.sourceStrings.map(o=>a("tr",{children:[a("td",{className:"DocTranslationsPage__Table__sourceCellWrap",children:a("div",{className:"DocTranslationsPage__Table__sourceCell",children:o})}),e.locales.map(t=>{let s=g(o,t);return a("td",{children:a(u.Textarea,{source:o,locale:t,value:s.translation,onChange:e.onChange,changesMap:e.changesMap})},t)})]},o))})]})})};u.Textarea=e=>{let _=A(null),[l,h]=r(e.value),g=null;e.locale in(e.changesMap[e.source]||{})&&(g=e.changesMap[e.source][e.locale]);let o=g!==null&&g!==e.value;function t(){window.requestAnimationFrame(()=>{let s=_.current;s.style.minHeight="auto";let c=s.scrollHeight;s.style.minHeight=`${c}px`})}return k(()=>{t()},[l]),a("textarea",{ref:_,className:S("DocTranslationsPage__Textarea",o&&"DocTranslationsPage__Textarea--hasChanges",!l&&"DocTranslationsPage__Textarea--empty"),onFocus:()=>t(),rows:1,onChange:s=>{let c=s.target.value;h(c),e.onChange(e.source,e.locale,c)},value:l})};export{u as DocTranslationsPage};
@@ -1 +0,0 @@
1
- import{d as Be,j as Me,k as Ae,l as q,n as Oe,o as Ve,p as Ue,q as We,s as $e}from"./chunk-MXGHX55S.js";import"./chunk-WFQU7V3W.js";import"./chunk-RAXWL656.js";import"./chunk-QEE7XS6O.js";import"./chunk-WXT7LTQM.js";import"./chunk-OXVYTSIZ.js";import"./chunk-3E6CASIN.js";import"./chunk-FBSBL476.js";import{a as Fe}from"./chunk-2KSMCQ6H.js";import"./chunk-HO3W4RVG.js";import"./chunk-3T4ZWQR4.js";import{c as Ne}from"./chunk-E76ECIOX.js";import"./chunk-344GZOGG.js";import{b as je}from"./chunk-U7PWJV6F.js";import"./chunk-5AVRMJVW.js";import"./chunk-MZTOPPWQ.js";import"./chunk-CAY5NM4Z.js";import"./chunk-XT5FNJCX.js";import"./chunk-TDUBSLEC.js";import{b as Le,c as ae,g as ze}from"./chunk-OWQL5DVE.js";import"./chunk-JTIQBW33.js";import"./chunk-R6B3W5AJ.js";import"./chunk-AZCGXQTL.js";import{a as R}from"./chunk-FJLNXXE3.js";import{a as se}from"./chunk-76ZGLKLT.js";import"./chunk-D3UIZHRK.js";import"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-TFB3VGWP.js";import"./chunk-ZN2Y5OUF.js";import{b as Te}from"./chunk-W5DOO6ID.js";import{a as Re}from"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-O5P3CPJ4.js";import"./chunk-KRNQ6L35.js";import{a as Xe}from"./chunk-FFHV5S6A.js";import{a as He}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import"./chunk-VD6G5NV4.js";import{f as I}from"./chunk-YLSRRNSE.js";import{Cc as Ie,Fa as T,Ga as e,Ia as pe,Oa as ge,P as me,Qa as oe,Sa as fe,Ua as ve,W as N,Wb as De,Xb as Ce,Xc as Ee,Yc as ne,Za as Pe,a as y,ba as he,c as b,da as j,e as P,g as B,h as C,j as te,pb as we,qb as xe,rb as be,rc as Se,sb as ke,vc as ye,za as _e}from"./chunk-LROR6N3B.js";import{d as O,j as ue,k as tt}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";te();te();async function qe(t,n){let a=await(await fetch("/cms/api/check.test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({check:t,docId:n})})).json();if(!a.success)throw new Error(a.error||"Check failed.");return a.data}function Ke(t){let n=window.__ROOT_CTX.checks||[],o=t.docId.split("/")[0],a=n.filter(s=>!s.collections||s.collections.includes(o)),[i,r]=y({}),c=C(async s=>{r(m=>({...m,[s]:{loading:!0}}));try{let m=await qe(s,t.docId);r(h=>({...h,[s]:{loading:!1,result:m}}))}catch(m){r(h=>({...h,[s]:{loading:!1,error:m.message||"Unknown error."}}))}},[t.docId]),l=C(async()=>{let s={};for(let m of a)s[m.id]={loading:!0};r(s);for(let m of a)try{let h=await qe(m.id,t.docId);r(_=>({..._,[m.id]:{loading:!1,result:h}}))}catch(h){r(_=>({..._,[m.id]:{loading:!1,error:h.message||"Unknown error."}}))}},[t.docId,a]);return e("div",{className:"ChecksPanel",children:[e("div",{className:"ChecksPanel__header",children:[e("div",{className:"ChecksPanel__header__title",children:"Checks"}),e(j,{variant:"default",size:"xs",compact:!0,leftIcon:e(Se,{size:12}),onClick:l,children:"Run All"})]}),e("div",{className:"ChecksPanel__body",children:e("div",{className:"ChecksPanel__checks",children:a.map(s=>{let m=i[s.id];return e(ot,{check:s,state:m,onRun:()=>c(s.id)},s.id)})})})]})}function ot(t){let{check:n,state:o,onRun:a}=t;return e("div",{className:"ChecksPanel__check",children:[e("div",{className:"ChecksPanel__check__header",children:[e("div",{className:"ChecksPanel__check__label",children:[n.label,o?.result&&e(it,{status:o.result.status})]}),e(j,{className:"ChecksPanel__check__runButton",variant:"default",size:"xs",compact:!0,loading:o?.loading,onClick:a,children:"Run"})]}),n.description&&e("div",{className:"ChecksPanel__check__description",children:n.description}),o?.result&&e("div",{className:I("ChecksPanel__check__result",`ChecksPanel__check__result--${o.result.status}`),children:e(Ne,{code:o.result.message})}),o?.error&&e("div",{className:"ChecksPanel__check__error",children:o.error})]})}var nt={success:"green",warning:"yellow",error:"red"},at={success:Pe,warning:pe,error:ne};function it(t){let n=nt[t.status],o=at[t.status],a=t.status.charAt(0).toUpperCase()+t.status.slice(1);return e(he,{className:"ChecksPanel__statusBadge",color:n,size:"sm",variant:"filled",leftSection:e(o,{size:10}),children:a})}function Je(t){let{device:n,expandVertically:o,iframeUrl:a,localeOptions:i,selectedLocale:r,onToggleDevice:c,onToggleExpandVertically:l,onReloadClick:s,onOpenNewTab:m,onLocaleChange:h}=t;return e("div",{className:"DocumentPagePreviewBar",children:[e("div",{className:"DocumentPagePreviewBar__devices",children:[e(T,{label:"Mobile",children:e(N,{className:I("DocumentPagePreviewBar__device",n==="mobile"&&"active"),onClick:()=>c("mobile"),children:e(ke,{size:16})})}),e(T,{label:"Tablet",children:e(N,{className:I("DocumentPagePreviewBar__device",n==="tablet"&&"active"),onClick:()=>c("tablet"),children:e(be,{size:16})})}),e(T,{label:"Desktop",children:e(N,{className:I("DocumentPagePreviewBar__device",n==="desktop"&&"active"),onClick:()=>c("desktop"),children:e(we,{size:16})})}),e(T,{label:"Expand",children:e(N,{className:I("DocumentPagePreviewBar__device",o&&"active"),"aria-pressed":o,disabled:n==="",onClick:l,children:e(fe,{size:16})})})]}),e("div",{className:"DocumentPagePreviewBar__navbar",children:e("div",{className:"DocumentPagePreviewBar__navbar__url",children:a})}),e("div",{className:"DocumentPagePreviewBar__locales",children:e(_e,{data:i,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:e(Ee,{size:16,strokeWidth:1.5}),value:r,onChange:_=>{h(_)}})}),e("div",{className:"DocumentPagePreviewBar__buttons",children:[e(T,{label:"Reload",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--reload",onClick:s,children:e(ye,{size:16})})}),e(T,{label:"Open new tab",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--openNewTab",onClick:m,children:e(oe,{size:16})})})]})]})}te();function Ye(t){let n=t.docId.split("/")[0],o=ze(n),a=q(),i=P(null),[r,c]=y(""),[l,s]=y([]),[m,h]=y(!1),_=P("");_.current=r;let v=P(o.schema?.fields||[]);v.current=o.schema?.fields||[];let D=P(o.schema?.types||{});D.current=o.schema?.types||{};let x=B(()=>Me(u=>{let k=u.trim();if(!k){s([]),h(!1);return}let S=a.controller?.getData()?.fields||{},L=We(k,S,v.current,D.current);s(L),h(!0)},150),[a.controller]);b(()=>{x(r)},[r,x]),Oe(()=>{_.current.trim()&&x(_.current)}),b(()=>{t.autoFocus&&requestAnimationFrame(()=>{i.current?.focus(),i.current?.select()})},[t.autoFocus]),b(()=>{let u=()=>{i.current?.focus(),i.current?.select()};return window.addEventListener("root:focus-search",u),()=>window.removeEventListener("root:focus-search",u)},[]);let g=u=>{st(u)};return e("div",{className:"SearchPanel",children:[e("div",{className:"SearchPanel__header",children:[e("div",{className:"SearchPanel__header__title",children:"Search"}),t.onClose&&e(N,{size:"xs",onClick:t.onClose,title:"Close search",children:e(ne,{size:14})})]}),e("div",{className:"SearchPanel__searchInput",children:[e("span",{className:"SearchPanel__searchInput__icon",children:e(Ie,{size:14})}),e("input",{ref:i,type:"text",className:"SearchPanel__searchInput__input",value:r,onInput:u=>c(u.currentTarget.value),onKeyDown:u=>{u.key==="Escape"&&t.onClose&&(u.preventDefault(),t.onClose())},placeholder:"Search field values\u2026",autoComplete:"off",spellcheck:!1})]}),e("div",{className:"SearchPanel__body",children:[!m&&!r.trim()&&e("div",{className:"SearchPanel__empty",children:"Type a query above to search field values in this document."}),m&&l.length===0&&e("div",{className:"SearchPanel__empty",children:["No matches for ",e("strong",{children:r}),"."]}),l.length>0&&e(O,{children:[e("div",{className:"SearchPanel__resultsCount",children:[l.length," ",l.length===1?"match":"matches"]}),e("ul",{className:"SearchPanel__results",children:l.map((u,k)=>e(rt,{result:u,onClick:()=>g(u)},`${u.deepKey}:${k}`))})]})]})]})}function rt(t){let{result:n}=t;return e("li",{className:"SearchPanel__result",children:e("button",{type:"button",className:"SearchPanel__result__button",onClick:t.onClick,children:[e("div",{className:"SearchPanel__result__label",children:n.label}),e("div",{className:"SearchPanel__result__snippet",children:ct(n.snippet,n.matches)}),e("div",{className:"SearchPanel__result__meta",children:[e("span",{className:"SearchPanel__result__type",children:n.fieldType}),n.richTextBlock&&e("span",{className:"SearchPanel__result__badge",children:"in block"}),n.richTextInline&&e("span",{className:"SearchPanel__result__badge",children:"inline"})]})]})})}function ct(t,n){if(!n||n.length===0)return t;let o=[],a=0;for(let i of n)i.start>a&&o.push({text:t.slice(a,i.start),match:!1}),o.push({text:t.slice(i.start,i.end),match:!0}),a=i.end;return a<t.length&&o.push({text:t.slice(a),match:!1}),o.map((i,r)=>i.match?e("mark",{children:i.text},r):e("span",{children:i.text},r))}function st(t){if(window.postMessage({scrollToDeeplink:{deepKey:t.deepKey}},"*"),t.richTextBlock){let n=t.richTextBlock;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Ve,{detail:n}))},350)}else if(t.richTextInline){let n=t.richTextInline;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Ue,{detail:n}))},350)}}tt();te();var lt=ue(null);function K(t){let{className:n,localStorageId:o,children:a}=t,[i,r]=R(`root::SplitPanel:${o}`,350),[c,l]=y(!1),[s,m]=y(0),h=B(()=>new Set,[]),_=P(null),v=P(null),D={onResize:g=>(h.add(g),()=>{h.delete(g)})};if(b(()=>{let g=()=>l(!1);window.addEventListener("mouseup",g);let u=_.current;return u&&m(u.getBoundingClientRect().left),()=>window.removeEventListener("mouseup",g)},[]),b(()=>{let g=u=>{let k=u.clientX-s;r(k),h.forEach(S=>S())};return c&&window.addEventListener("mousemove",g),()=>window.removeEventListener("mousemove",g)},[c]),a?.length!==2)throw new Error("SplitPanel should have two <SplitPanel.Item> children.");let x={"--panel-size":`${i}px`};return e(lt.Provider,{value:D,children:e("div",{className:I(n,"SplitPanel",c&&"dragging"),ref:_,style:x,children:[a[0],e("div",{className:"SplitPanel__divider",ref:v,onMouseDown:()=>l(!0)}),a[1]]})})}K.Item=t=>e("div",{className:I("SplitPanel__item",t.className,t.fluid?"fluid":"static"),children:t.children});function le(t,n,o=""){let a=ae({collectionId:t,slug:n}),i=new URLSearchParams(window.location.search);i.set("preview","true"),i.delete("locale"),i.delete("modal");let r=`${i.toString()}${window.location.hash}`;return o?`${ae({collectionId:t,slug:n,locale:o})}?${r}`:`${a}?${r}`}function dt(t,n){let o=new URL(n,window.location.origin);try{let a=t.contentWindow?.location.href;if(a&&!a.startsWith("about:blank")){let i=new URL(a);i.origin===o.origin&&i.pathname===o.pathname&&(i.searchParams.forEach((r,c)=>{o.searchParams.set(c,r)}),o.hash=i.hash)}}catch{}return o.searchParams.set("preview","true"),o.toString()}function Ge(t){let n=t.collection,o=t.slug,a=`${n}/${o}`,{roles:i}=Re(),r=window.firebase.user.email||"",c=Te(i,r);return e(Ae,{docId:a,readOnly:!c,children:e(ut,{...t,canEdit:c})})}function ut(t){let n=t.canEdit,o=t.collection,a=t.slug,i=`${o}/${a}`;He(i);let r=window.__ROOT_CTX.collections[o],c=q(),l=!!r?.url,[s,m]=R(`root::DocumentPage::previewVisible::${o}`,l),h=B(()=>(window.__ROOT_CTX.checks||[]).some(f=>!f.collections||f.collections.includes(o)),[o]),[_,v]=R("root::DocumentPage::checksVisible",!1),D=P(_);D.current=_;let[x,g]=R("root::DocumentPage::searchVisible",!1),u=P(x);u.current=x;let k=!!(window.__ROOT_CTX.ai||window.__ROOT_CTX.experiments?.ai),[S,L]=R("root::DocumentPage::aiVisible",!1),M=P(S);M.current=S,b(()=>{window.dispatchEvent(new CustomEvent("root:checks-visible",{detail:_}))},[_]),b(()=>{window.dispatchEvent(new CustomEvent("root:search-visible",{detail:x}))},[x]),b(()=>{window.dispatchEvent(new CustomEvent("root:ai-visible",{detail:S}))},[S]);let[U,J]=R("root::DocumentPage::searchPanelWidth",360),[W,$]=y(U),[F,H]=y(!1),Y=P(null);if(b(()=>{let p=()=>{let f=!D.current;v(()=>f),f&&(g(()=>!1),L(()=>!1))};return window.addEventListener("root:toggle-checks",p),()=>window.removeEventListener("root:toggle-checks",p)},[]),b(()=>{let p=()=>{let f=!u.current;g(()=>f),f&&(v(()=>!1),L(()=>!1),requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("root:focus-search"))}))};return window.addEventListener("root:toggle-search",p),()=>window.removeEventListener("root:toggle-search",p)},[]),b(()=>{let p=()=>{let f=!M.current;L(()=>f),f&&(v(()=>!1),g(()=>!1))};return window.addEventListener("root:toggle-ai",p),()=>window.removeEventListener("root:toggle-ai",p)},[]),b(()=>{if(!F)return;let p=A=>{let V=Y.current;if(!V)return;let re=V.getBoundingClientRect(),ce=Math.max(240,Math.min(re.right-A.clientX,800));$(ce)},f=()=>{H(!1),$(A=>(J(()=>A),A))};return window.addEventListener("mousemove",p),window.addEventListener("mouseup",f),()=>{window.removeEventListener("mousemove",p),window.removeEventListener("mouseup",f)}},[F]),!r)return e("div",{children:"Could not find collection."});let ie=C(()=>{if(!l)return;let p=le(o,a),f=window.open(p,"_blank","noopener,noreferrer");f&&f.focus()},[l,o,a]),Q=C(()=>{n&&c.controller&&c.controller.flush()},[n,c.controller]),G=Be(),X=C(()=>{let p=c.controller?.getData()?.fields||{};G.open({data:p,onSave:f=>{c.controller&&f&&typeof f=="object"&&(c.controller.updateKey("fields",f),c.controller.flush()),G.close()}})},[c.controller]),d=C(()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},[]),w=C(()=>{k&&window.dispatchEvent(new CustomEvent("root:toggle-ai"))},[k]),E=C(()=>{L(()=>!1)},[L]);return me([["mod+S",Q],["mod+shift+F",d],["mod+I",w]]),e(Xe,{children:e("div",{className:I("DocumentPage__layout",F&&"DocumentPage__layout--dragging"),ref:Y,children:[e(K,{className:"DocumentPage",localStorageId:"DocumentPage",children:[e(K.Item,{className:I("DocumentPage__side",(!l||!s)&&"DocumentPage__side--expanded"),children:[e("div",{className:"DocumentPage__side__header",children:[e("div",{className:"DocumentPage__side__header__nav",children:[e("a",{href:`/cms/content/${o}`,children:e(N,{className:"DocumentPage__side__header__back",children:e(ge,{size:16})})}),e("div",{className:"DocumentPage__side__header__docId",children:i})]}),e("div",{className:"DocumentPage__side__header__buttons",children:[e(se,{label:"You don't have access to edit this document",condition:!n,children:e(j,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:e(xe,{size:16}),onClick:()=>Q(),disabled:!n,children:"Save"})}),e(se,{label:"You don't have access to edit this document",condition:!n,children:e(T,{label:"Edit JSON",disabled:!n,children:e(N,{className:"DocumentPage__side__header__editJson",onClick:()=>X(),disabled:!n,children:e(ve,{size:14})})})}),l&&e(O,{children:[e(T,{label:s?"Hide preview":"Show preview",children:e(N,{className:"DocumentPage__side__header__previewToggle",onClick:()=>m(!s),children:s?e(De,{size:16}):e(Ce,{size:16})})}),!s&&e(T,{label:"Open preview in new tab",children:e(N,{className:"DocumentPage__side__header__openNewTab",onClick:ie,children:e(oe,{size:16})})})]})]})]}),e("div",{className:I("DocumentPage__side__editor",(!l||!s)&&!_&&!x&&!S&&"DocumentPage__side__editor--centered"),children:e($e,{docId:i})})]}),e(K.Item,{className:I("DocumentPage__main",(!l||!s)&&"DocumentPage__main--hidden"),fluid:!0,children:l&&s&&e(Ge.Preview,{docId:i},i)})]}),h&&_&&e(ht,{docId:i}),x&&e(O,{children:[e("div",{className:"DocumentPage__searchDivider",onMouseDown:()=>H(!0)}),e("div",{className:"DocumentPage__search",style:{flexBasis:`${W}px`},children:e(Ye,{docId:i,autoFocus:!0,onClose:()=>g(()=>!1)})})]}),k&&S&&e(mt,{docId:i,onClose:E})]})})}function mt(t){let[n,o]=R("root::DocumentPage::aiPanelWidth",420),[a,i]=y(n),r=P(null),c=P(a),l=P(),s=B(()=>e(Fe,{variant:"panel",docContext:{docId:t.docId},onClose:t.onClose}),[t.docId,t.onClose]),m=C(()=>{let h=r.current?.parentElement;if(!h)return;c.current=a,h.classList.add("DocumentPage__layout--dragging");let _=x=>{let g=r.current?.parentElement;if(!g)return;let u=g.getBoundingClientRect(),k=Math.max(280,Math.min(u.right-x.clientX,800));c.current=k,i(k)},v=()=>{h.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",D),l.current=void 0},D=()=>{v(),o(()=>c.current)};l.current=v,window.addEventListener("mousemove",_),window.addEventListener("mouseup",D)},[a,o]);return b(()=>()=>l.current?.(),[]),e(O,{children:[e("div",{className:"DocumentPage__aiDivider",ref:r,onMouseDown:m}),e("div",{className:"DocumentPage__ai",style:{flexBasis:`${a}px`},children:s})]})}function ht(t){let[n,o]=R("root::DocumentPage::checksPanelWidth",360),[a,i]=y(n),r=P(null),c=P(a),l=P(),s=B(()=>e(Ke,{docId:t.docId}),[t.docId]),m=C(()=>{let h=r.current?.parentElement;if(!h)return;c.current=a,h.classList.add("DocumentPage__layout--dragging");let _=x=>{let g=r.current?.parentElement;if(!g)return;let u=g.getBoundingClientRect(),k=Math.max(200,Math.min(u.right-x.clientX,800));c.current=k,i(k)},v=()=>{h.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",_),window.removeEventListener("mouseup",D),l.current=void 0},D=()=>{v(),o(()=>c.current)};l.current=v,window.addEventListener("mousemove",_),window.addEventListener("mouseup",D)},[a,o]);return b(()=>()=>l.current?.(),[]),e(O,{children:[e("div",{className:"DocumentPage__checksDivider",ref:r,onMouseDown:m}),e("div",{className:"DocumentPage__checks",style:{flexBasis:`${a}px`},children:s})]})}var Qe={mobile:[430,932],tablet:[768,1024],desktop:[1440,800]};function _t(t){let n=new Intl.DisplayNames(["en"],{type:"language"}),a=t.split("_")[0];return`${n.of(a)||t} (${t})`}Ge.Preview=t=>{let n=q();if(n.loading)return null;let[o,a]=t.docId.split("/"),r=window.__ROOT_CTX.collections[o];if(!r)throw new Error(`collection not found: ${o}`);if(!r.url)return null;let c=r.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",l=Le({collectionId:o,slug:a}),s=ae({collectionId:o,slug:a}),m=`${c}${l}`,[h,_]=y(m),[v,D]=R("root::DocumentPage::preview::device",""),[x,g]=R("root::DocumentPage::preview::expandVertically",!1),[u,k]=y({"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"}),[S,L]=je("locale",""),M=P(null),U=P(null),J=n.controller.getLocales()||[],W=le(o,a,S),$=P(W);$.current=W;let F=B(()=>[{value:"",label:"Select locale"},...J.map(d=>({value:d,label:_t(d)}))],[J]);function H(){if(document.hidden)return;let d=M.current,w=dt(d,$.current);d.src="about:blank",window.requestAnimationFrame(()=>{d.src!==w?d.src=w:d.contentWindow.location.reload()})}b(()=>{let d=M.current;function w(){let p=d.contentWindow;if(p&&s===l&&!p.location.href.startsWith("about:blank")){let f=p.location;_(`${c}${f.pathname}`)}}d.addEventListener("load",w);let E=n.controller?.onFlush(()=>{H()});return()=>{E(),d.removeEventListener("load",w)}},[]),b(()=>{let d=M.current;d.src=W},[S]);let Y=C(d=>{D(w=>{let E=w===d?"":d;return E===""&&g(!1),E})},[D,g]),ie=C(()=>{D(d=>(d&&g(w=>!w),d))},[D,g]),Q=C(()=>{n.controller&&n.controller.flush().then(()=>H())},[n.controller]),G=C(()=>{let d=le(o,a,S),w=window.open(d,"_blank","noopener,noreferrer");w&&w.focus()},[o,a,S]),X=C(()=>{if(v===""){let z={"--iframe-width":"100%","--iframe-height":"100%","--iframe-scale":"1"};k(ee=>ee["--iframe-width"]===z["--iframe-width"]&&ee["--iframe-height"]===z["--iframe-height"]&&ee["--iframe-scale"]===z["--iframe-scale"]?ee:z);return}let d=U.current;if(!d)return;let w=d.getBoundingClientRect(),[E,p]=Qe[v],f=20,A=Math.max(w.width-2*f,0),V=Math.max(w.height-2*f,0),re=A>0&&E>0?A/E:1,ce=V>0&&p>0?V/p:1,Ze=Math.min(re,ce,1),de=Number(Ze.toFixed(4))||1,et=x?`${Math.max(V-28,0)/de}px`:`${p}px`,Z={"--iframe-width":`${E}px`,"--iframe-height":et,"--iframe-scale":String(de)};k(z=>z["--iframe-width"]===Z["--iframe-width"]&&z["--iframe-height"]===Z["--iframe-height"]&&z["--iframe-scale"]===Z["--iframe-scale"]?z:Z)},[v,x]);return b(()=>{X();let d=U.current;if(!d)return;let w=0,E=()=>{window.cancelAnimationFrame(w),w=window.requestAnimationFrame(X)},p=new window.ResizeObserver(E);return p.observe(d),window.addEventListener("resize",E),()=>{window.cancelAnimationFrame(w),p.disconnect(),window.removeEventListener("resize",E)}},[X]),e("div",{className:"DocumentPage__main__preview",children:[e(Je,{device:v,expandVertically:x,iframeUrl:h,localeOptions:F,selectedLocale:S,onToggleDevice:Y,onToggleExpandVertically:ie,onReloadClick:Q,onOpenNewTab:G,onLocaleChange:L}),e("div",{className:"DocumentPage__main__previewFrame","data-device":v||"full",ref:U,style:u,children:[e("div",{className:"DocumentPage__main__previewFrame__deviceLabel",style:{display:v?void 0:"none"},children:v?`${v}: ${Qe[v].join("x")}`:""}),e("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:e("iframe",{ref:M,title:"iframe preview"})})]})]})};export{Ge as DocumentPage};
@@ -1 +0,0 @@
1
- import{k as E,l as P,m as h,s as S}from"./chunk-MXGHX55S.js";import"./chunk-WFQU7V3W.js";import"./chunk-RAXWL656.js";import"./chunk-QEE7XS6O.js";import"./chunk-WXT7LTQM.js";import"./chunk-OXVYTSIZ.js";import"./chunk-3E6CASIN.js";import{b as s}from"./chunk-FBSBL476.js";import"./chunk-HO3W4RVG.js";import"./chunk-3T4ZWQR4.js";import"./chunk-E76ECIOX.js";import"./chunk-344GZOGG.js";import"./chunk-5AVRMJVW.js";import"./chunk-MZTOPPWQ.js";import"./chunk-CAY5NM4Z.js";import"./chunk-XT5FNJCX.js";import"./chunk-TDUBSLEC.js";import"./chunk-OWQL5DVE.js";import"./chunk-JTIQBW33.js";import"./chunk-R6B3W5AJ.js";import"./chunk-AZCGXQTL.js";import"./chunk-FJLNXXE3.js";import"./chunk-76ZGLKLT.js";import"./chunk-D3UIZHRK.js";import"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-TFB3VGWP.js";import"./chunk-ZN2Y5OUF.js";import{b as p}from"./chunk-W5DOO6ID.js";import{a as D}from"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-O5P3CPJ4.js";import"./chunk-KRNQ6L35.js";import{a as x}from"./chunk-P2Z66DHV.js";import"./chunk-VD6G5NV4.js";import{f as _}from"./chunk-YLSRRNSE.js";import{Ga as t,a as v,c as m,da as f,e as u,j as B,qb as b}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function H(e){let o=`${e.collection}/${e.slug}`,{roles:d}=D(),a=window.firebase.user.email||"",n=p(d,a);return t(E,{docId:o,readOnly:!n,autoSave:!1,flushOnStop:!1,children:t(w,{...e,canEdit:n})})}function I(e){return e&&typeof e.toMillis=="function"?e.toMillis():0}function w(e){let o=`${e.collection}/${e.slug}`;x(o);let d=P(),a=d.controller,n=d.loading,[r,y]=v("NO_CHANGES");h(y);let g=u(!1);m(()=>{n||g.current||(g.current=!0,s({type:"ready",docId:o}))},[n,o]);let c=u(0);return m(()=>{let N=[a.onFlush(()=>{s({type:"saved",docId:o,saveState:"SAVED"})}),a.onChange(l=>{let i=I(l?.sys?.publishedAt);if(c.current===0){c.current=i;return}i>c.current&&(c.current=i,s({type:"published",docId:o,publishedAt:i}))})];return()=>N.forEach(l=>l())},[a,o]),t("div",{className:"EmbeddedDocumentPage",children:[e.canEdit&&!n&&t("div",{className:"EmbeddedDocumentPage__saveBar",children:[t(f,{component:"a",className:"EmbeddedDocumentPage__saveBar__docId",href:`/cms/content/${e.collection}/${e.slug}`,target:"_blank",rel:"noreferrer noopener",title:"Open in new tab",compact:!0,size:"xs",variant:"default",children:o}),t("div",{className:"EmbeddedDocumentPage__saveBar__controls",children:[t("div",{className:"EmbeddedDocumentPage__saveBar__saveState",children:[r==="UPDATE_PENDING"&&"unsaved changes",r==="SAVED"&&"saved!",r==="ERROR"&&"error saving"]}),t(f,{color:"dark",compact:!0,size:"xs",leftIcon:t(b,{size:16}),loading:r==="SAVING",disabled:r!=="UPDATE_PENDING"&&r!=="ERROR",onClick:()=>a.flush(),children:"Save"})]})]}),t("div",{className:_("EmbeddedDocumentPage__editor","DocumentPage__side"),children:t(S,{docId:o,hideStatusBar:!0})})]})}export{H as EmbeddedDocumentPage};
@@ -1 +0,0 @@
1
- import{a as e}from"./chunk-M3T56ZRP.js";import"./chunk-MZTOPPWQ.js";import"./chunk-CAY5NM4Z.js";import{a}from"./chunk-XT5FNJCX.js";import"./chunk-SRX7EWL4.js";import"./chunk-JS6TK4OP.js";import"./chunk-KRNQ6L35.js";import{a as i}from"./chunk-FFHV5S6A.js";import{a as g}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import"./chunk-VD6G5NV4.js";import"./chunk-YLSRRNSE.js";import{Ga as o}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function L(){return g("Action Logs"),o(i,{children:o("div",{className:"LogsPage",children:[o("div",{className:"LogsPage__header",children:o(a,{size:"h1",children:"Action Logs"})}),o(e,{})]})})}export{L as LogsPage};
@@ -1 +0,0 @@
1
- import{a as m}from"./chunk-764W6634.js";import"./chunk-N3JSLTMV.js";import"./chunk-RAXWL656.js";import{a as r}from"./chunk-XT5FNJCX.js";import"./chunk-OWQL5DVE.js";import"./chunk-JTIQBW33.js";import"./chunk-R6B3W5AJ.js";import"./chunk-AZCGXQTL.js";import"./chunk-FJLNXXE3.js";import"./chunk-76ZGLKLT.js";import"./chunk-D3UIZHRK.js";import"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-TFB3VGWP.js";import"./chunk-ZN2Y5OUF.js";import"./chunk-W5DOO6ID.js";import"./chunk-NSOTG64N.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-O5P3CPJ4.js";import"./chunk-KRNQ6L35.js";import{a as d}from"./chunk-FFHV5S6A.js";import{a as s}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import"./chunk-VD6G5NV4.js";import"./chunk-YLSRRNSE.js";import{Ga as e,ca as a}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function w(){return s("New Release"),e(d,{children:e("div",{className:"NewReleasePage",children:[e("div",{className:"NewReleasePage__header",children:[e(a,{className:"NewReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:"New"})]}),e(r,{size:"h1",children:"Add Release"})]}),e(m,{buttonLabel:"Create release"})]})})}export{w as NewReleasePage};
@@ -1 +0,0 @@
1
- import{a as l}from"./chunk-WKF7CSWS.js";import"./chunk-4ISFTE2G.js";import{a as s}from"./chunk-M3T56ZRP.js";import"./chunk-MZTOPPWQ.js";import"./chunk-CAY5NM4Z.js";import{a as n}from"./chunk-B6M55OFE.js";import{a as r}from"./chunk-SRX7EWL4.js";import"./chunk-FJLNXXE3.js";import"./chunk-JS6TK4OP.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-KRNQ6L35.js";import{a as c}from"./chunk-FFHV5S6A.js";import{a}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import"./chunk-VD6G5NV4.js";import"./chunk-YLSRRNSE.js";import{Ga as e,da as i}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function o(){a("Home");let t=!!window.__ROOT_CTX.experiments?.taskManager;return e(c,{children:e("div",{className:"ProjectPage",children:e("div",{className:"ProjectPage__main",children:[t&&e(l,{}),e("div",{className:"ProjectPage__section",children:[e(o.Collections,{}),e(o.ActionLogs,{})]})]})})})}o.SectionTitle=t=>e("div",{className:"ProjectPage__sectionTitle",children:t.children});o.Collections=()=>{let t=window.__ROOT_CTX.collections,m=window.__ROOT_CTX.rootConfig.projectId;return e("div",{className:"ProjectPage__collections",children:e(n,{collections:t,projectId:m})})};o.ActionLogs=()=>e("div",{className:"ProjectPage__actionLogs",children:[e("div",{className:"ProjectPage__actionLogs__header",children:[e(o.SectionTitle,{children:"Recent actions"}),e(i,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/logs",children:"Show all"})]}),e(r,{children:e(s,{limit:10,compact:!0})})]});export{o as ProjectPage};
@@ -1 +0,0 @@
1
- import{b as de}from"./chunk-GDXNSFLE.js";import{a as le,c as ce,e as me}from"./chunk-WFQU7V3W.js";import{b as ne,c as O,d as ae,f as z}from"./chunk-CAY5NM4Z.js";import{a as w}from"./chunk-XT5FNJCX.js";import{a as I}from"./chunk-SRX7EWL4.js";import"./chunk-JTIQBW33.js";import"./chunk-JS6TK4OP.js";import{c as se}from"./chunk-5MV6XVGA.js";import{a as te}from"./chunk-NSOTG64N.js";import{b as ee}from"./chunk-J5E457OI.js";import{a as U}from"./chunk-QHJOTXYB.js";import{a as g}from"./chunk-O5P3CPJ4.js";import{f as oe}from"./chunk-KRNQ6L35.js";import{a as ue}from"./chunk-FFHV5S6A.js";import{a as ge}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import{c as V,n as Y,p as Q,q as Z}from"./chunk-VD6G5NV4.js";import{f as N}from"./chunk-YLSRRNSE.js";import{Ca as q,Ga as e,Rc as ie,U as L,W as $,Yc as re,a as _,ba as J,c as B,da as v,e as W,g as C,j as T,na as F,pa as K,sa as X,ua as G,za as A}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";T();T();var Re={ADMIN:4,EDITOR:3,CONTRIBUTOR:2,VIEWER:1};function _e(o){return Re[o]??0}function ye(o,s){return _e(o)>=_e(s)?o:s}function H(o,s,a){let r=o[s];o[s]=r?ye(r,a):a}function pe(o,s={}){let a={...s},r={};for(let t of o){let m=(t.users||[]).filter(Boolean);if(m.length===0)continue;let u=(t.collections||[]).filter(Boolean);if(u.length===0)for(let d of m)H(a,d,t.role);else{for(let d of m)H(a,d,"VIEWER");for(let d of u){r[d]||(r[d]={});for(let p of m)H(r[d],p,t.role)}}}return{projectRoles:a,collectionRoles:r}}function fe(o={}){return{id:o.id||`g_${Date.now().toString(36)}_${Math.random().toString(36).slice(2,8)}`,name:o.name||"",role:o.role||"VIEWER",collections:o.collections?[...o.collections]:[],users:o.users?[...o.users]:[]}}T();function k(o){let s=o.size||28,[a,r]=_(!1),t=o.profile?.photoURL||"",m=o.profile?.displayName||o.email,u=N("EmailAvatar",o.className),d={width:s,height:s};return t&&!a?e("img",{className:u,style:d,src:t,alt:m,onError:()=>r(!0)}):e("svg",{className:u,style:d,viewBox:"0 0 28 28",role:"img","aria-label":m,children:[e("circle",{cx:"14",cy:"14",r:"14",fill:ae(o.email)}),e("text",{x:"14",y:"14",textAnchor:"middle",dominantBaseline:"central",fill:"#fff",fontSize:"13",fontWeight:"600",children:ne(o.email)})]})}var we=[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"CONTRIBUTOR",label:"CONTRIBUTOR"},{value:"VIEWER",label:"VIEWER"}];function xe(o){let{groups:s,onChange:a,collections:r,disabled:t}=o,m=C(()=>r.map(l=>({value:l,label:l})),[r]),[u,d]=_({});function p(l,n){a(s.map(c=>c.id===l?n(c):c))}function b(l){a(s.filter(n=>n.id!==l))}function P(){let l=s.length;a([...s,fe({name:"New group"})]),d(n=>({...n,[l]:!0}))}return e("div",{className:N(o.className,"PermissionGroupsBox"),children:[s.length===0?e("div",{className:"PermissionGroupsBox__empty",children:e(g,{size:"body-sm",weight:"semi-bold",color:"gray",children:"No permission groups yet. Create one to organize users by role and optionally scope access to specific collections."})}):e(L,{className:"PermissionGroupsBox__accordion",offsetIcon:!1,multiple:!0,state:u,onChange:d,children:s.map(l=>e(L.Item,{label:e("div",{className:"PermissionGroupsBox__trigger",children:[e("span",{className:"PermissionGroupsBox__trigger__name",children:l.name||"Untitled group"}),e(J,{color:"gray",radius:"sm",size:"xs",variant:"light",className:"PermissionGroupsBox__trigger__badge",children:[l.users.length," ",l.users.length===1?"user":"users"]})]}),children:e(Ne,{group:l,collectionOptions:m,disabled:t,onChange:n=>p(l.id,()=>n),onDelete:()=>b(l.id)})},l.id))}),e("div",{className:"PermissionGroupsBox__addGroup",children:e(v,{variant:"default",size:"xs",radius:0,disabled:t,onClick:P,children:"+ Add group"})})]})}function Ne(o){let{group:s,collectionOptions:a,disabled:r}=o,[t,m]=_(""),u=s.users.filter(i=>!O(i)),{profiles:d}=z(u);function p(i){o.onChange({...s,name:i})}function b(i){o.onChange({...s,role:i})}function P(i){o.onChange({...s,collections:i})}function l(i){let f=i.trim();if(!f||s.users.includes(f)){m("");return}o.onChange({...s,users:[...s.users,f]}),m("")}function n(i){o.onChange({...s,users:s.users.filter(f=>f!==i)})}function c(){window.confirm(`Delete the "${s.name||"Untitled group"}" group? This will remove its role assignments on next save.`)&&o.onDelete()}return e("div",{className:"PermissionGroupsBox__editor",children:[e("div",{className:"PermissionGroupsBox__editor__row",children:[e(G,{className:"PermissionGroupsBox__editor__name",label:"Group name",placeholder:"e.g. Blog Post Editors",value:s.name,radius:0,size:"xs",disabled:r,onChange:i=>p(i.target.value)}),e(A,{className:"PermissionGroupsBox__editor__role",label:"Role",data:we,value:s.role,radius:0,size:"xs",disabled:r,onChange:i=>b(i)})]}),e(X,{className:"PermissionGroupsBox__editor__collections",label:"Collections",description:"Leave empty to apply project-wide. Otherwise restrict the group's role to the selected collections.",data:a,value:s.collections,radius:0,size:"xs",searchable:!0,clearable:!0,placeholder:"All collections (project-wide)",disabled:r,onChange:i=>P(i),dropdownComponent:"div"}),e("div",{className:"PermissionGroupsBox__editor__users",children:[e(g,{size:"body-sm",weight:"semi-bold",children:"Users"}),e("form",{className:"PermissionGroupsBox__editor__addUser",onSubmit:i=>{i.preventDefault(),l(t)},children:[e(G,{className:"PermissionGroupsBox__editor__addUser__email",placeholder:"grogu@example.com",type:"email",value:t,onChange:i=>m(i.target.value),radius:0,size:"xs",disabled:r}),e(v,{size:"xs",radius:0,color:"dark",type:"submit",disabled:r||!t.trim(),children:"Add user"})]}),s.users.length>0&&e("ul",{className:"PermissionGroupsBox__editor__userList",children:s.users.map(i=>{let f=d.get(i.toLowerCase())||null;return e("li",{className:"PermissionGroupsBox__editor__userItem",children:[e(k,{className:"PermissionGroupsBox__editor__userItem__avatar",email:i,profile:f,size:24}),e("span",{className:"PermissionGroupsBox__editor__userItem__email",children:i}),e($,{size:"sm",variant:"transparent",disabled:r,onClick:()=>n(i),title:`Remove ${i}`,children:e(re,{size:14})})]},i)})})]}),e("div",{className:"PermissionGroupsBox__editor__footer",children:e(v,{variant:"subtle",size:"xs",color:"red",compact:!0,disabled:r,leftIcon:e(ie,{size:14}),onClick:c,children:"Delete group"})})]})}T();function D(o){let{roles:s,onChange:a,currentUserIsAdmin:r}=o,[t,m]=_(""),u=Object.keys(s).filter(n=>!O(n)),{profiles:d}=z(u);function p(n,c){a({...s,[n]:c})}function b(n){let c={...s};delete c[n],a(c)}function P(n){let c=n.trim();m(""),!(!c||c in s)&&a({...s,[c]:"EDITOR"})}let l=se(Object.keys(s).map(n=>({email:n,role:s[n],profile:d.get(n.toLowerCase())||null})),"email");return e("div",{className:N(o.className,"ShareBox"),children:[e("form",{className:"ShareBox__addUser",onSubmit:n=>{n.preventDefault(),P(t)},children:[e(G,{className:"ShareBox__addUser__email",placeholder:"grogu@example.com",type:"email",value:t,onChange:n=>m(n.target.value),radius:0,size:"xs",disabled:!r}),e(v,{className:"ShareBox__addUser__button",size:"xs",radius:0,color:"dark",type:"submit",disabled:!r,children:"Add user"})]}),e("div",{className:"ShareBox__users",children:l.map(n=>e(D.User,{...n,currentUserIsAdmin:r,onRoleChange:p,onRemove:b},n.email))})]})}D.User=o=>{let s=o.email===window.firebase.user.email;return e("div",{className:"ShareBox__user",children:[e(k,{className:"ShareBox__user__avatar",email:o.email,profile:o.profile,size:24}),e(g,{className:"ShareBox__user__email",size:"body-sm",weight:"semi-bold",color:"gray",children:[o.email,s&&" (you)"]}),e("div",{className:"ShareBox__user__roleSelect",children:e(A,{data:[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"CONTRIBUTOR",label:"CONTRIBUTOR"},{value:"VIEWER",label:"VIEWER"},{value:"REMOVE",label:"REMOVE"}],value:o.role,radius:0,size:"xs",disabled:s||!o.currentUserIsAdmin,onChange:a=>{a==="REMOVE"?o.onRemove(o.email):o.onRoleChange(o.email,a)}})})]})};function Be(o){if(!o)return"never";let s=Date.now()-o;return s<6e4?"just now":s<60*6e4?`${Math.floor(s/6e4)} min ago`:s<1440*6e4?`${Math.floor(s/(60*6e4))} hr ago`:new Date(o).toLocaleString()}function he(o){let s=window.firebase?.user?.email;if(!s)return!1;if(o[s]==="ADMIN")return!0;let a=s.split("@").at(-1);return!!(a&&o[`*@${a}`]==="ADMIN")}function Ge(){let o=de(),[s,a]=_(!1),[r,t]=_(!1),[m,u]=_(!1),d=W(null);function p(){d.current!==null&&(window.clearInterval(d.current),d.current=null),t(!1),u(!1)}B(()=>p,[]),B(()=>{r&&o.running&&u(!0)},[r,o.running]);async function b(f){if(!(s||r)){a(!0);try{let x=await fetch("/cms/api/search.rebuild",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({force:f})});if(!x.ok){let j=await x.text().catch(()=>"");throw new Error(`HTTP ${x.status}: ${j||"rebuild failed"}`)}U({title:"Search index",message:f?"Full rebuild started.":"Incremental rebuild started.",color:"blue",autoClose:4e3}),t(!0),d.current=window.setInterval(()=>{o.refresh()},2e3),window.setTimeout(p,10*6e4)}catch(x){U({title:"Error",message:x?.message||String(x),color:"red",autoClose:!1})}finally{a(!1)}}}B(()=>{r&&m&&!o.running&&(p(),U({title:"Search index",message:"Rebuild complete.",color:"green",autoClose:3e3}))},[r,m,o.running]);let P=o.status.lastRun,l=o.status.docCount,n=o.status.fieldCount,c=o.status.shardCount,i=o.running||s;return e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(w,{className:"SettingsPage__section__left__title",children:"Site Admin"}),e(g,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"Project-wide administrative actions. Only admins see this section."})})]}),e(I,{className:"SettingsPage__section__right",children:e("div",{className:"SettingsPage__section__setting",children:[e(g,{size:"body",weight:"semi-bold",children:"Search index"}),e(g,{size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"Powers the Cmd+K global search. Rebuilds run automatically on a schedule; trigger a manual rebuild here if you want immediate results (e.g. after a schema change)."})}),e("div",{className:"SettingsPage__siteAdmin__searchStats",children:[e("div",{children:[e("strong",{children:"Last indexed:"})," ",Be(P)]}),e("div",{children:[e("strong",{children:"Indexed docs:"})," ",l.toLocaleString()]}),e("div",{children:[e("strong",{children:"Indexed fields:"})," ",n.toLocaleString()]}),e("div",{children:[e("strong",{children:"Shards:"})," ",c]})]}),e("div",{className:"SettingsPage__siteAdmin__searchButtons",children:[e(v,{variant:"default",size:"xs",compact:!0,loading:i,onClick:()=>b(!1),children:"Rebuild incremental"}),e(v,{variant:"default",size:"xs",compact:!0,loading:i,onClick:()=>{window.confirm("Force a full rebuild? This wipes the existing index and reindexes every doc from scratch.")&&b(!0)},children:"Force full rebuild"})]})]})})]})}function Ue(o,s){return JSON.stringify(o)===JSON.stringify(s)}function Ie(){let o=window.__ROOT_CTX.rootConfig.projectId||"default",s=window.__ROOT_CTX.collections||{},a=C(()=>Object.keys(s).sort(),[s]),r=window.firebase.db,t=V(r,"Projects",o),[m,u]=_(!0),[d,p]=_(!1),[b,P]=_({}),[l,n]=_({globalRoles:{},permissionGroups:[]}),[c,i]=_({globalRoles:{},permissionGroups:[]});B(()=>{Y(t).then(h=>{let S=h.data()||{},E=S.roles||{},y={globalRoles:S.globalRoles||E,permissionGroups:S.permissionGroups||[]};P(E),n(y),i({globalRoles:{...y.globalRoles},permissionGroups:y.permissionGroups.map(R=>({...R}))}),u(!1)})},[]);let f=he(b),x=!Ue(l,c);function j(h){i(S=>({...S,globalRoles:h}))}function ve(h){i(S=>({...S,permissionGroups:h}))}function be(){i({globalRoles:{...l.globalRoles},permissionGroups:l.permissionGroups.map(h=>({...h}))})}async function Pe(){d||!x||(p(!0),await ee(async()=>{let{projectRoles:h,collectionRoles:S}=pe(c.permissionGroups,c.globalRoles);await Z(t,{globalRoles:c.globalRoles,roles:h,permissionGroups:c.permissionGroups});let E=l.permissionGroups.flatMap(R=>R.collections||[]),M=new Set([...Object.keys(S),...E]);for(let R of M){let Se=V(r,"Projects",o,"Collections",R);await Q(Se,{roles:S[R]||{}},{merge:!0})}let y={globalRoles:c.globalRoles,permissionGroups:c.permissionGroups};P(h),n(y),i({globalRoles:{...y.globalRoles},permissionGroups:y.permissionGroups.map(R=>({...R}))}),oe("acls.save_groups",{metadata:{groupCount:c.permissionGroups.length,userCount:Object.keys(h).length,collections:Array.from(M)}}),U({title:"Saved",message:"Sharing settings updated.",color:"green",autoClose:3e3})}),p(!1))}return e("div",{className:"SettingsPage__section SettingsPage__section__users",children:[e("div",{className:"SettingsPage__section__left",children:[e(w,{className:"SettingsPage__section__left__title",children:"Share"}),e(g,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:[e("p",{children:"Share access to the CMS. To share with everyone in a domain, use *@example.com."}),e("ul",{children:[e("li",{children:"VIEWER: view docs but not edit"}),e("li",{children:"CONTRIBUTOR: view and edit docs, but not publish"}),e("li",{children:"EDITOR: view, edit, and publish docs"}),e("li",{children:"ADMIN: all of the above and change sharing settings"})]}),e("p",{children:["Use ",e("strong",{children:"groups"})," to manage many users at once and optionally scope a role to specific collections."]})]})]}),e(I,{className:"SettingsPage__section__right",children:e("div",{className:"SettingsPage__share",children:[e(K,{visible:m,loaderProps:{color:"gray",size:"xl"}}),e("div",{className:"SettingsPage__share__subsection",children:[e(w,{className:"SettingsPage__section__right__title",size:"h3",children:"Users"}),e(D,{className:"SettingsPage__section__users__sharebox",roles:c.globalRoles,onChange:j,currentUserIsAdmin:f})]}),e("div",{className:"SettingsPage__share__subsection",children:[e(w,{className:"SettingsPage__section__right__title",size:"h3",children:"Groups"}),e(xe,{groups:c.permissionGroups,onChange:ve,collections:a,disabled:!f})]}),e("div",{className:"SettingsPage__share__saveBar",children:[e(g,{size:"body-sm",weight:"semi-bold",color:"gray",children:x?"You have unsaved changes.":"All changes saved."}),e("div",{className:"SettingsPage__share__saveBar__actions",children:[e(v,{variant:"default",size:"xs",radius:0,disabled:!x||d,onClick:be,children:"Discard"}),e(v,{size:"xs",radius:0,color:"dark",loading:d,disabled:!x||!f,onClick:Pe,children:"Save changes"})]})]})]})})]})}function Mo(){ge("Settings");let o=me(),s=ce(),a=te(),r=!a.loading&&he(a.roles);return e(ue,{children:e("div",{className:"SettingsPage",children:[e(Ie,{}),e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(w,{className:"SettingsPage__section__left__title",children:"Site Settings"}),e(g,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"These settings apply to the project. Only admins can change them."})})]}),e(I,{className:"SettingsPage__section__right",children:le.map(t=>e("div",{className:"SettingsPage__section__setting",children:[e(g,{size:"body",weight:"semi-bold",children:t.name}),e(g,{size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:t.description})}),e(F,{autosize:!0,minRows:2,maxRows:4,value:s.settings[t.key]||"",placeholder:t.placeholder,onChange:m=>s.setSettings(t.key,m.currentTarget.value)}),t.ui&&e("div",{children:t.ui(s.settings[t.key])})]},t.key))})]}),r&&e(Ge,{}),e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(w,{className:"SettingsPage__section__left__title",children:"User Preferences"}),e(g,{className:"SettingsPage__section__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:"These settings are for you only."})})]}),e(I,{className:"SettingsPage__section__right",children:e("div",{className:"SettingsPage__section__userPref",children:[e("div",{className:"SettingsPage__section__userPref__description",children:[e(g,{className:"SettingsPage__section__userPref__description__title",size:"body",weight:"semi-bold",children:"Enable EditorJS Editor (legacy)"}),e(g,{className:"SettingsPage__section__userPref__description__body",size:"body-sm",weight:"semi-bold",color:"gray",children:e("p",{children:["Replaces the"," ",e("a",{href:"https://lexical.dev/",target:"_blank",rel:"noopener noreferrer nofollow",children:"Lexical"})," ","(default) rich text editor with the"," ",e("a",{href:"https://editorjs.io/",target:"_blank",rel:"noopener noreferrer nofollow",children:"EditorJS"})," ","(legacy) version."]})})]}),e("div",{className:"SettingsPage__section__userPref__input",children:e(q,{color:"dark",checked:o.preferences.EnableEditorJSEditor,onChange:t=>{let m=t.currentTarget.checked;o.setPreference("EnableEditorJSEditor",m)}})})]})})]})]})})}export{Mo as SettingsPage};
@@ -1 +0,0 @@
1
- import{a}from"./chunk-FFHV5S6A.js";import{a as t}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import"./chunk-YLSRRNSE.js";import{Ga as e,c as d,j as l}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";l();function u(o){let r=(window.__ROOT_CTX.sidebar?.tools||{})[o.id];t(r?.label||o.id);let i=r?.cmsUrl,s=r?.externalUrl;return d(()=>{i?.startsWith("/cms/")&&window.location.replace(i)},[i]),d(()=>{s&&window.open(s,"_blank","noopener,noreferrer")?.focus()},[s]),r?s?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--message",children:e("a",{href:s,target:"_blank",rel:"noreferrer noopener",children:["Open ",r.label||o.id," in a new tab"]})})}):i?.startsWith("/cms/")?e(a,{children:e("div",{className:"SidebarToolsPage",children:"redirecting..."})}):i?e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["invalid cmsUrl (must start with /cms/): ",o.id]})}):r.iframeUrl?e(a,{children:e("div",{className:"SidebarToolsPage",children:e("iframe",{src:r.iframeUrl})})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",o.id]})}):e(a,{children:e("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",o.id]})})}export{u as SidebarToolsPage};
@@ -1 +0,0 @@
1
- import{c as C,f as oe,g as re,h as le,i as ce,j as me,k as de,l as _e,m as ge,n as pe,o as ue,p as ke,q as fe,r as Te,s as he}from"./chunk-4ISFTE2G.js";import{r as ie}from"./chunk-MXGHX55S.js";import"./chunk-WFQU7V3W.js";import"./chunk-RAXWL656.js";import"./chunk-QEE7XS6O.js";import"./chunk-WXT7LTQM.js";import"./chunk-OXVYTSIZ.js";import"./chunk-3E6CASIN.js";import"./chunk-FBSBL476.js";import"./chunk-HO3W4RVG.js";import"./chunk-3T4ZWQR4.js";import{b as R,c as ae}from"./chunk-E76ECIOX.js";import"./chunk-344GZOGG.js";import"./chunk-5AVRMJVW.js";import"./chunk-MZTOPPWQ.js";import"./chunk-CAY5NM4Z.js";import{a as W}from"./chunk-XT5FNJCX.js";import{a as I}from"./chunk-SRX7EWL4.js";import"./chunk-TDUBSLEC.js";import"./chunk-OWQL5DVE.js";import"./chunk-JTIQBW33.js";import"./chunk-R6B3W5AJ.js";import"./chunk-AZCGXQTL.js";import"./chunk-FJLNXXE3.js";import"./chunk-76ZGLKLT.js";import"./chunk-D3UIZHRK.js";import"./chunk-HARRKJFZ.js";import"./chunk-JS6TK4OP.js";import"./chunk-JDW4UORS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-TFB3VGWP.js";import"./chunk-ZN2Y5OUF.js";import"./chunk-W5DOO6ID.js";import"./chunk-NSOTG64N.js";import{a as k}from"./chunk-J5E457OI.js";import{a as f}from"./chunk-QHJOTXYB.js";import"./chunk-O5P3CPJ4.js";import"./chunk-KRNQ6L35.js";import{a as se}from"./chunk-FFHV5S6A.js";import{a as ne}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import{a as Y}from"./chunk-VD6G5NV4.js";import{f as x}from"./chunk-YLSRRNSE.js";import{Cb as Q,Fa as P,Ga as e,Rc as M,V,W as h,Wa as Z,Wc as te,Yc as A,Za as b,a as d,c as y,ca as U,da as T,e as O,g as D,hc as ee,j as Ie,lc as F,mb as B,mc as w,na as G,ua as S,wb as J,za as L}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import{h as X}from"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Ie();function H(a){return e(ie,{className:x("TaskCommentEditor",a.className),placeholder:a.placeholder,value:a.value,onChange:a.onChange,autoFocus:a.autoFocus,autosize:!0,variant:"comment"})}var we=[{value:"new",label:"New"},{value:"in-progress",label:"In progress"},{value:"in-review",label:"In review"},{value:"closed",label:"Closed"}],Ce=[{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"normal",label:"Normal"}];function yt(a){let t=a.id,[i,o]=d(null),[_,g]=d([]),[r,l]=d([]),[n,m]=d(!0),[c,s]=d("");return ne(i?`Task: ${i.title}`:`Task: ${t}`),y(()=>{m(!0),s("");let u=[oe(t,p=>{o(p),m(!1)},p=>{s(k(p)),m(!1)}),re(t,p=>g(p),p=>s(k(p))),le(t,p=>l(p),p=>s(k(p)))];return()=>u.forEach(p=>p())},[t]),e(se,{children:e("div",{className:"TaskPage",children:[e("div",{className:"TaskPage__header",children:[e(U,{className:"TaskPage__header__breadcrumbs",children:[e("a",{href:"/cms/tasks",children:"Tasks"}),e("div",{children:t})]}),e("div",{className:"TaskPage__header__titleWrap",children:[e(Ne,{task:i,taskId:t}),i&&e("span",{className:x("TaskPage__statusBadge",`TaskPage__statusBadge--${je(i.status)}`),children:$e(i.status)})]})]}),n&&e("div",{className:"TaskPage__loading",children:e(V,{color:"gray",size:"xl"})}),!n&&c&&e("div",{className:"TaskPage__error",children:c}),!n&&!c&&!i&&e(I,{className:"TaskPage__notFound",children:"Task not found."}),!n&&!c&&i&&e("div",{className:"TaskPage__body",children:[e("main",{className:"TaskPage__main",children:[e(ze,{task:i}),e(Ae,{task:i}),e(De,{task:i,comments:_,events:r}),e(ye,{taskId:i.id})]}),e("aside",{className:"TaskPage__side",children:e(Ee,{task:i})})]})]})})}function Ne(a){let{task:t}=a,[i,o]=d(!1),[_,g]=d(t?.title||""),[r,l]=d(!1);y(()=>{i||g(t?.title||"")},[t?.title,i]);async function n(){if(!t)return;let m=_.trim();if(!m){f({title:"Could not update title",message:"Task title is required.",color:"red"});return}if(m===t.title){g(t.title),o(!1);return}l(!0);try{await me(t.id,m),o(!1)}catch(c){f({title:"Could not update title",message:k(c),color:"red",autoClose:!1})}finally{l(!1)}}return t?i?e("form",{className:"TaskPage__header__titleForm",onSubmit:m=>{m.preventDefault(),n()},children:[e(S,{autoFocus:!0,className:"TaskPage__header__titleInput",disabled:r,value:_,onChange:m=>g(m.currentTarget.value),onKeyDown:m=>{m.key==="Escape"&&(g(t.title),o(!1))}}),e(T,{compact:!0,size:"xs",color:"dark",type:"submit",loading:r,leftIcon:e(b,{size:14,strokeWidth:"1.8"}),children:"Save"}),e(T,{compact:!0,size:"xs",variant:"default",type:"button",leftIcon:e(A,{size:14,strokeWidth:"1.8"}),onClick:()=>{g(t.title),o(!1)},children:"Cancel"})]}):e("div",{className:"TaskPage__header__titleContent",children:[e(W,{size:"h1",children:t.title}),e(P,{label:"Edit title",children:e(h,{size:"sm",onClick:()=>o(!0),children:e(w,{size:16,strokeWidth:"1.8"})})})]}):e(W,{size:"h1",children:`Task #${a.taskId}`})}function ze(a){let{task:t}=a,[i,o]=d(!1),[_,g]=d(t.description||""),[r,l]=d(!1);y(()=>{i||g(t.description||"")},[t.description,i]);async function n(){l(!0);try{await pe(t.id,_.trim()),o(!1)}catch(m){f({title:"Could not update description",message:k(m),color:"red",autoClose:!1})}finally{l(!1)}}return e(I,{className:"TaskPage__description",children:[e("div",{className:"TaskPage__description__top",children:[e("div",{className:"TaskPage__description__label",children:"Description"}),!i&&e(h,{size:"sm",onClick:()=>o(!0),children:e(w,{size:16,strokeWidth:"1.8"})})]}),i?e("div",{className:"TaskPage__description__edit",children:[e(G,{autosize:!0,autoFocus:!0,minRows:4,value:_,placeholder:"Add task details, scope, and acceptance criteria.",onChange:m=>g(m.currentTarget.value)}),e("div",{className:"TaskPage__description__editActions",children:[e(T,{compact:!0,size:"xs",variant:"default",leftIcon:e(A,{size:14,strokeWidth:"1.8"}),onClick:()=>{o(!1),g(t.description||"")},children:"Cancel"}),e(T,{compact:!0,size:"xs",color:"dark",loading:r,leftIcon:e(b,{size:14,strokeWidth:"1.8"}),onClick:n,children:"Save"})]})]}):e("div",{className:x("TaskPage__description__content",!t.description&&"TaskPage__description__content--empty"),children:t.description||"No description provided."})]})}function Ae(a){let{task:t}=a,i=O(null),[o,_]=d(!1),[g,r]=d(""),l=t.attachments||[];async function n(c){let s=Array.from(c);if(s.length!==0){_(!0);try{for(let u of s){let p=await X(u);await ue(t.id,{...p,filename:p.filename||u.name,contentType:u.type||void 0,size:u.size})}f({message:s.length===1?"File attached.":`${s.length} files attached.`,color:"green"})}catch(u){f({title:"Could not attach file",message:k(u),color:"red",autoClose:!1})}finally{_(!1),i.current&&(i.current.value="")}}}async function m(c){let s=xe(c);if(window.confirm(`Remove ${s} from this task?`)){r(c.id);try{await ke(t.id,c.id)}catch(u){f({title:"Could not remove attachment",message:k(u),color:"red",autoClose:!1})}finally{r("")}}}return e("section",{className:"TaskPage__attachments",children:[e("div",{className:"TaskPage__attachments__top",children:[e("div",{className:"TaskPage__attachments__label",children:"Attachments"}),e(T,{compact:!0,size:"xs",variant:"subtle",type:"button",loading:o,leftIcon:e(F,{size:14,strokeWidth:"1.8"}),onClick:()=>i.current?.click(),children:"Attach files"}),e("input",{ref:i,className:"TaskPage__attachments__input",type:"file",multiple:!0,onChange:c=>{n(c.currentTarget.files||[])}})]}),l.length>0?e("div",{className:"TaskPage__attachments__list",children:l.map(c=>e("div",{className:"TaskPage__attachments__item",children:[e("div",{className:"TaskPage__attachments__itemIcon",children:e(F,{size:16,strokeWidth:"1.8"})}),e("div",{className:"TaskPage__attachments__itemContent",children:[e("a",{href:c.src,target:"_blank",rel:"noreferrer",className:"TaskPage__attachments__itemTitle",children:xe(c)}),e("div",{className:"TaskPage__attachments__itemMeta",children:Re(c)})]}),e("div",{className:"TaskPage__attachments__itemActions",children:[e(P,{label:"Open file",children:e(h,{component:"a",href:c.src,target:"_blank",rel:"noreferrer",size:"sm",children:e(J,{size:16,strokeWidth:"1.8"})})}),e(P,{label:"Remove attachment",children:e(h,{size:"sm",disabled:g===c.id,onClick:()=>m(c),children:e(M,{size:16,strokeWidth:"1.8"})})})]})]},c.id))}):e("div",{className:"TaskPage__attachments__empty",children:"No files attached."})]})}function Ee(a){let{task:t}=a,[i,o]=d(t.assignee||""),[_,g]=d(j(t.targetLaunchDate)),[r,l]=d("");y(()=>{o(t.assignee||""),g(j(t.targetLaunchDate))},[t.assignee,t.targetLaunchDate]);async function n(s,u){l(s);try{await u()}catch(p){f({title:"Could not update task",message:k(p),color:"red",autoClose:!1})}finally{l("")}}function m(){let s=i.trim();(t.assignee||"")!==s&&n("assignee",()=>ce(t.id,s||null))}function c(s){g(s),j(t.targetLaunchDate)!==s&&n("targetLaunchDate",()=>ge(t.id,Ke(s)))}return e(I,{className:"TaskPage__metadata",children:[e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Status"}),e(L,{size:"xs",data:we,value:C(t.status),onChange:s=>{s&&s!==C(t.status)&&n("status",()=>de(t.id,s))}})]}),e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Assignee"}),e("div",{className:"TaskPage__metadata__assignee",children:e(S,{size:"xs",type:"email",placeholder:"teammate@example.com",value:i,disabled:r==="assignee",onChange:s=>o(s.currentTarget.value),onBlur:()=>m(),onKeyDown:s=>{s.key==="Enter"&&s.currentTarget.blur()}})})]}),e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Priority"}),e(L,{size:"xs",data:Ce,value:t.priority||"normal",onChange:s=>{s&&s!==(t.priority||"normal")&&n("priority",()=>_e(t.id,s))}})]}),e("div",{className:"TaskPage__metadata__field",children:[e("label",{children:"Target launch date"}),e("div",{className:"TaskPage__metadata__date",children:e("input",{type:"date",value:_,disabled:r==="targetLaunchDate",onInput:s=>c(s.currentTarget.value)})})]})]})}function De(a){let{task:t,comments:i,events:o}=a,_=D(()=>{let r=new Map;return i.filter(l=>l.parentId).forEach(l=>{let n=l.parentId||"";r.set(n,[...r.get(n)||[],l])}),r.forEach(l=>l.sort((n,m)=>E(n.createdAt)-E(m.createdAt))),r},[i]),g=D(()=>{let r=i.filter(n=>!n.parentId);return[{id:"opened",kind:"opened",createdAt:t.createdAt},...o.map(n=>({id:n.id,kind:"event",event:n,createdAt:n.createdAt})),...r.map(n=>({id:n.id,kind:"comment",comment:n,createdAt:n.createdAt}))].sort((n,m)=>E(n.createdAt)-E(m.createdAt))},[t,i,o]);return e("div",{className:"TaskPage__timeline",children:g.map(r=>r.kind==="opened"?e(Se,{task:t},r.id):r.kind==="event"?e(Le,{event:r.event},r.id):e(ve,{comment:r.comment,replies:_.get(r.comment.id)||[],threadParentId:r.comment.id},r.id))})}function Se(a){let{task:t}=a;return e("div",{className:"TaskPage__timelineItem TaskPage__timelineItem--event",children:[e("div",{className:"TaskPage__timelineItem__marker",children:e(b,{size:15,strokeWidth:"2"})}),e("div",{className:"TaskPage__timelineItem__content",children:[e("b",{children:z(t.createdBy||"unknown")})," opened this task"," ",N(t.createdAt),"."]})]})}function Le(a){let{event:t}=a;return e("div",{className:"TaskPage__timelineItem TaskPage__timelineItem--event",children:[e("div",{className:"TaskPage__timelineItem__marker",children:t.field==="title"?e(w,{size:15,strokeWidth:"2"}):t.field==="assignee"?e(te,{size:15,strokeWidth:"2"}):t.field==="priority"?e(Q,{size:15,strokeWidth:"2"}):t.field==="targetLaunchDate"?e(Z,{size:15,strokeWidth:"2"}):e(b,{size:15,strokeWidth:"2"})}),e("div",{className:"TaskPage__timelineItem__content",children:[e("b",{children:z(t.createdBy||"unknown")})," changed"," ",qe(t.field)," from"," ",e("span",{className:"TaskPage__timelineValue",children:Pe(t.field,t.oldValue)})," ","to"," ",e("span",{className:"TaskPage__timelineValue",children:Pe(t.field,t.newValue)})," ",N(t.createdAt),"."]})]})}function ve(a){let{comment:t}=a,i=window.firebase.user.email||"",[o,_]=d(!1),[g,r]=d(!1),[l,n]=d(t.body||q(t.content)),[m,c]=d(!1),s=t.createdBy===i&&!t.isDeleted,u=a.threadParentId||t.parentId||t.id;y(()=>{n(t.body||q(t.content))},[t.body,t.content]);async function p(){if(l){c(!0);try{await Te(t.taskId,t.id,l),r(!1)}catch(v){f({title:"Could not edit comment",message:k(v),color:"red",autoClose:!1})}finally{c(!1)}}}async function be(){if(window.confirm("Delete this comment?"))try{await he(t.taskId,t.id)}catch(v){f({title:"Could not delete comment",message:k(v),color:"red",autoClose:!1})}}return e("div",{className:x("TaskPage__timelineItem","TaskPage__timelineItem--comment",a.isReply&&"TaskPage__timelineItem--reply"),children:[e("div",{className:"TaskPage__timelineItem__marker",children:a.isReply?e(B,{size:15,strokeWidth:"2"}):e(ee,{size:15,strokeWidth:"2"})}),e("div",{className:"TaskPage__timelineItem__content",children:[e(I,{className:"TaskPage__comment",children:[e("div",{className:"TaskPage__comment__header",children:[e("div",{children:[e("b",{children:z(t.createdBy||"unknown")})," ",e("span",{children:N(t.createdAt)}),t.updatedAt&&!t.isDeleted&&e("span",{children:[" edited ",N(t.updatedAt)]})]}),e("div",{className:"TaskPage__comment__actions",children:[!t.isDeleted&&e(P,{label:"Reply",children:e(h,{size:"sm",onClick:()=>_(!o),children:e(B,{size:16,strokeWidth:"1.8"})})}),s&&e(P,{label:"Edit",children:e(h,{size:"sm",onClick:()=>r(!0),children:e(w,{size:16,strokeWidth:"1.8"})})}),s&&e(P,{label:"Delete",children:e(h,{size:"sm",onClick:be,children:e(M,{size:16,strokeWidth:"1.8"})})})]})]}),g?e("div",{className:"TaskPage__comment__edit",children:[e(H,{value:l,placeholder:"Edit this comment...",onChange:n}),e("div",{className:"TaskPage__comment__editActions",children:[e(T,{compact:!0,size:"xs",variant:"default",leftIcon:e(A,{size:14,strokeWidth:"1.8"}),onClick:()=>{r(!1),n(t.body||q(t.content))},children:"Cancel"}),e(T,{compact:!0,size:"xs",color:"dark",loading:m,disabled:!l,leftIcon:e(b,{size:14,strokeWidth:"1.8"}),onClick:p,children:"Save"})]})]}):e("div",{className:x("TaskPage__comment__body",t.isDeleted&&"TaskPage__comment__body--deleted"),children:t.isDeleted?"Comment deleted.":t.body?e(Be,{className:"TaskPage__comment__richText",data:t.body}):e(ae,{className:"TaskPage__comment__markdown",code:t.content})})]}),o&&e(ye,{taskId:t.taskId,parentId:u,autoFocus:!0,onSubmitted:()=>_(!1),onCancel:()=>_(!1)}),a.replies&&a.replies.length>0&&e("div",{className:"TaskPage__replies",children:a.replies.map(v=>e(ve,{comment:v,isReply:!0,threadParentId:t.id},v.id))})]})]})}function ye(a){let[t,i]=d(null),[o,_]=d(0),[g,r]=d(!1),l=!!a.parentId;async function n(m){if(m.preventDefault(),!!t){r(!0);try{await fe(a.taskId,t,a.parentId),i(null),_(c=>c+1),a.onSubmitted?.()}catch(c){f({title:l?"Could not add reply":"Could not add comment",message:k(c),color:"red",autoClose:!1})}finally{r(!1)}}}return e(I,{className:x("TaskPage__composer",l&&"TaskPage__composer--reply"),children:e("form",{onSubmit:n,children:[e(H,{autoFocus:a.autoFocus,placeholder:l?"Write a reply...":"Leave a comment...",value:t,onChange:i},o),e("div",{className:"TaskPage__composer__actions",children:[a.onCancel&&e(T,{compact:!0,size:"xs",variant:"default",type:"button",onClick:a.onCancel,children:"Cancel"}),e(T,{compact:!0,size:"xs",color:"dark",type:"submit",loading:g,disabled:!t,children:l?"Reply":"Comment"})]})]})})}function Be(a){return e("div",{className:a.className,children:(a.data.blocks||[]).map((t,i)=>e(Fe,{block:t},i))})}function Fe(a){let{block:t}=a;switch(t.type){case"paragraph":return e($,{tag:"p",html:t.data?.text});case"heading":return e($,{tag:"h4",html:t.data?.text});case"quote":return e($,{tag:"blockquote",html:t.data?.text});case"orderedList":return e("ol",{children:(t.data?.items||[]).map((i,o)=>e(K,{item:i},o))});case"unorderedList":return e("ul",{children:(t.data?.items||[]).map((i,o)=>e(K,{item:i},o))});case"image":{let i=t.data?.file;return i?.url?e("img",{src:i.url,width:Number(i.width)||void 0,height:Number(i.height)||void 0,alt:i.alt||""}):null}default:return null}}function $(a){if(!a.html)return null;let t=a.tag;return e(t,{dangerouslySetInnerHTML:{__html:R(a.html)}})}function K(a){return e("li",{children:[a.item.content&&e("span",{dangerouslySetInnerHTML:{__html:R(a.item.content)}}),a.item.items&&a.item.items.length>0&&e("ul",{children:a.item.items.map((t,i)=>e(K,{item:t},i))})]})}function q(a){return a.trim()?{blocks:a.split(/\n{2,}/).map(t=>({type:"paragraph",data:{text:Me(t).replace(/\n/g,"<br>")}})),time:Date.now(),version:"plain-text"}:null}function Me(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function E(a){return a?.toMillis?.()||0}function xe(a){let t=a.src.split("?")[0].split("/").filter(Boolean).at(-1)||"",i=a.filename||t||"Attachment";try{return decodeURIComponent(i)}catch{return i}}function Re(a){let t=[We(a.size),a.contentType||"",a.attachedBy?`attached by ${z(a.attachedBy)}`:"",a.attachedAt?N(a.attachedAt):""].filter(Boolean);return t.length>0?t.join(" - "):"Attached file"}function We(a){if(typeof a!="number")return"";if(a<1024)return`${a} B`;let t=["KB","MB","GB"],i=a/1024,o=0;for(;i>=1024&&o<t.length-1;)i=i/1024,o+=1;return`${i.toFixed(i>=10?0:1)} ${t[o]}`}function z(a){return a.split("@")[0]||a}function He(a){return a?.toMillis?new Date(a.toMillis()).toLocaleDateString("en",{month:"short",day:"numeric",year:"numeric"}):"No date"}function N(a){return a?.toMillis?new Date(a.toMillis()).toLocaleString("en",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):"just now"}function $e(a){return C(a).replace(/[-_]/g," ")}function qe(a){return a.replace(/([A-Z])/g," $1").toLowerCase()}function Pe(a,t){return t?t instanceof Y?He(t):a==="assignee"?z(t):a==="title"?t:t.replace(/[-_]/g," "):"none"}function je(a){return C(a).replace(/[^a-z0-9]+/gi,"-").toLowerCase()}function j(a){if(!a?.toMillis)return"";let t=new Date(a.toMillis()),i=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),_=String(t.getDate()).padStart(2,"0");return`${i}-${o}-${_}`}function Ke(a){if(!a)return null;let[t,i,o]=a.split("-").map(Number);return!t||!i||!o?null:new Date(t,i-1,o)}export{yt as TaskPage};
@@ -1 +0,0 @@
1
- import{a as g}from"./chunk-WKF7CSWS.js";import"./chunk-4ISFTE2G.js";import"./chunk-MZTOPPWQ.js";import"./chunk-CAY5NM4Z.js";import{a as e}from"./chunk-XT5FNJCX.js";import"./chunk-SRX7EWL4.js";import"./chunk-FJLNXXE3.js";import"./chunk-J5E457OI.js";import"./chunk-QHJOTXYB.js";import"./chunk-KRNQ6L35.js";import{a as i}from"./chunk-FFHV5S6A.js";import{a as s}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import"./chunk-VD6G5NV4.js";import"./chunk-YLSRRNSE.js";import{Ga as a}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function k(){return s("Tasks"),a(i,{children:a("div",{className:"TasksPage",children:[a("div",{className:"TasksPage__header",children:a(e,{size:"h1",children:"Tasks"})}),a(g,{variant:"page"})]})})}export{k as TasksPage};
@@ -1 +0,0 @@
1
- import{a as h}from"./chunk-XT5FNJCX.js";import{c as F,d as y,g as N}from"./chunk-ZN2Y5OUF.js";import{a as x}from"./chunk-QHJOTXYB.js";import"./chunk-KRNQ6L35.js";import{a as C}from"./chunk-FFHV5S6A.js";import{a as z}from"./chunk-P2Z66DHV.js";import"./chunk-FSVNOZ6F.js";import"./chunk-VD6G5NV4.js";import"./chunk-YLSRRNSE.js";import{Ga as a,V as P,a as r,c,ca as f,da as T,j as B,na as _,sa as b,ua as v}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function w(i){z("Edit Translation");let t=i.hash,[p,l]=r(!1),[d,g]=r(!1),[n,o]=r({source:""});async function s(){l(!0);let e=await F(t);if(l(!1),!e?.source){g(!0);return}o(e)}async function u(e){console.log(e),await y(t,e),o(m=>({...m,...e})),x({title:"Saved translations",message:`Updated translations for ${t}.`,autoClose:5e3})}return c(()=>{s()},[i.hash]),a(C,{children:a("div",{className:"TranslationsEditPage",children:[a("div",{className:"TranslationsEditPage__header",children:[a(f,{className:"TranslationsEditPage__header__breadcrumbs",children:[a("a",{href:"/cms/translations",children:"Translations"}),a("div",{children:i.hash})]}),a(h,{size:"h1",children:"Edit Translations"})]}),p?a(P,{color:"gray",size:"xl"}):d?a("div",{className:"TranslationsEditPage__notFound",children:"Not Found"}):a(w.Form,{hash:i.hash,translations:n,onChange:u})]})})}w.Form=i=>{let t=i.translations,l=(window.__ROOT_CTX.rootConfig.i18n.locales||[]).filter(s=>s!=="en"),[d,g]=r(t.tags||[]),[n,o]=r(null);return c(()=>{g(t.tags||[])},[t.tags]),a("div",{className:"TranslationsEditPage__FormContainer",children:[a("form",{className:"TranslationsEditPage__Form",onSubmit:async s=>{s.preventDefault();let u=s.currentTarget,e=["en",...l],m={};e.forEach(E=>{let S=u.elements[E].value;m[E]=N(S)}),o("translations");try{await i.onChange(m)}finally{o(null)}},children:[a(v,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"hash",label:"hash",value:i.hash,disabled:!0}),a(_,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"source",label:"source",value:t.source,autosize:!0,disabled:!0}),a(_,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:"en",label:"en",value:t.en,autosize:!0,disabled:!!n}),l.map(s=>a(_,{className:"TranslationsEditPage__Form__input",size:"xs",radius:0,name:s,label:s,value:t[s]||"",autosize:!0,disabled:!!n},s)),a(T,{className:"TranslationsEditPage__Form__input__submit",color:"blue",size:"xs",type:"submit",disabled:!!n,loading:n==="translations",children:n==="translations"?"Saving...":"Save"})]}),a("div",{className:"TranslationsEditPage__TagsForm",children:[a(h,{size:"h3",className:"TranslationsEditPage__TagsForm__heading",children:"Tags"}),a(b,{data:d,value:d,onChange:g,placeholder:"Add tags",searchable:!0,creatable:!0,disabled:!!n,getCreateLabel:s=>`+ Add tag ${s}`}),a(T,{className:"TranslationsEditPage__TagsForm__submit",color:"blue",size:"xs",disabled:!!n,loading:n==="tags",onClick:async()=>{o("tags");try{await i.onChange({...t,tags:d})}finally{o(null)}},children:n==="tags"?"Saving...":"Save tags"})]})]})};export{w as TranslationsEditPage};
@@ -1 +0,0 @@
1
- import{a as _t}from"./chunk-MZTOPPWQ.js";import{g as oe,h as Xe,i as ke,j as qe,k as Ke,l as Je,m as Qe,n as Ye,o as Ze,p as et,q as de,r as tt,s as Me,t as st,u as ce,y as _e,z as me}from"./chunk-TFB3VGWP.js";import{a as ct}from"./chunk-W5DOO6ID.js";import{a as dt}from"./chunk-NSOTG64N.js";import{b as M}from"./chunk-J5E457OI.js";import{a as b,b as je,c as Ge}from"./chunk-QHJOTXYB.js";import{b as He,d as ye}from"./chunk-KRNQ6L35.js";import{f as fe}from"./chunk-YLSRRNSE.js";import{$a as Fe,Ab as pe,Cc as it,Da as ie,Db as lt,Eb as he,Fa as Le,Fb as De,Ga as e,Pb as nt,Rc as O,Uc as rt,V as te,W as se,a as i,c as T,da as g,ea as L,g as Se,j as Ee,lb as ue,mc as ze,na as Pe,qa as k,ra as U,tb as Ne,ua as j,vb as ge,wb as ot,zb as at}from"./chunk-LROR6N3B.js";import{d as C}from"./chunk-KUCVLANF.js";import{g as Oe,h as re,k as D,l as G,m as Ce,n as H,o as Ve,p as We}from"./chunk-7SK47HHZ.js";Ee();Ee();function mt(t){let o=t.file||{},a=o.src||"",l=o.filename||a,r={"--asset-thumb-size":`${t.size}px`};if(a&&G(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("img",{src:Ie(o,t.size*2),alt:o.alt||"",loading:"lazy"})});if(a&&H(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("video",{src:a,muted:!0,playsInline:!0,preload:"metadata"})});let _=D(l);return e("div",{className:"AssetBrowser__thumb",style:r,children:_&&_.length<=4?e("div",{className:"AssetBrowser__thumb__ext",children:_}):e(pe,{size:20,stroke:"1.5"})})}function Ie(t,o){let a=t?.src||"";return a.startsWith(Oe)&&o?`${a}=s${o}`:a}function ve(t){let o=t?.src||"";Ce(o)&&(o=o.split("=")[0]+"=s0"),navigator.clipboard.writeText(o).then(()=>{b({message:"Copied URL to clipboard.",autoClose:2e3})})}function we(t){let o=t?.src||"";if(o)if(Ce(o)){let a=document.createElement("a");a.href=We(o),t.filename&&(a.download=t.filename),document.body.appendChild(a),a.click(),document.body.removeChild(a)}else window.open(o,"_blank")}function ft(t){let[o,a]=i(t.asset),[l,r]=i(t.asset.file?.alt||""),[_,d]=i(!1),[x,v]=i(!1),[m,B]=i(null),[h,F]=i(null),n=o.file||{},f=n.filename||o.name,N=G(f),S=H(f),V=l!==(n.alt||""),W=n.altDisabled===!0;T(()=>{_e(o.id).then(c=>F(c)).catch(c=>{console.error("failed to fetch asset usage:",c),F([])})},[o.id]);async function z(c,w){let p=await me(c,{previousFile:w});p.failedDocIds.length>0?b({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&&b({message:`Updated ${p.updatedDocIds.length} doc(s) that use this asset.`,color:"green"})}async function X(){d(!0),await M(async()=>{let c={...n},w=await st(o,l);a(w),t.onChanged(w),await z(w,c)}),d(!1)}function R(){let c=document.createElement("input");c.type="file",c.onchange=()=>{let w=c.files?.[0];if(!w)return;let p=D(f),y=D(w.name);if(p&&y&&p!==y){B(w);return}E(w)},c.click(),c.remove()}async function E(c){B(null),d(!0),await M(async()=>{let w={...n},p=await re(c),y=await tt(o,p);a(y),r(y.file?.alt||""),t.onChanged(y),await z(y,w)}),d(!1)}async function $(c){d(!0),await M(async()=>{let w={...n},p=await ce(o,c);a(p),r(p.file?.alt||""),t.onChanged(p),await z(p,w)}),d(!1)}async function q(){d(!0),await M(async()=>{await de(o),b({message:`Deleted "${o.name}".`,color:"green"}),t.onDeleted()}),d(!1)}return e(U,{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:Ie(n,800),alt:n.alt||"",style:n.canvasBgColor==="dark"?{background:"#000"}:{}}):S?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:f})]})}),e(ie,{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:f})]}),!!(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:[ye(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:[ye(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(j,{readOnly:!0,value:n.src||"",size:"xs",radius:"xs",onClick:c=>c.target.select(),styles:{root:{flex:1,minWidth:0}}}),e(Le,{label:"Copy URL",transition:"pop",children:e(se,{size:"sm",onClick:()=>ve(n),children:e(ue,{size:16})})})]})})]})]})}),(N||S)&&e("div",{className:"AssetBrowser__details__alt",children:[W?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(Pe,{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||_,onChange:c=>r(c.currentTarget.value)}),t.canManage&&V&&e(g,{size:"xs",color:"dark",mt:8,loading:_,onClick:()=>X(),children:"Save alt text"})]}),t.canManage&&e(L,{className:"AssetBrowser__details__alt__disableCheckbox",label:"Disable alt text (e.g. decorative images)",size:"xs",mt:8,checked:W,disabled:_,onChange:c=>$(c.currentTarget.checked)})]}),e("div",{className:"AssetBrowser__details__usage",children:[e("div",{className:"AssetBrowser__details__usage__title",children:"Used in"}),h===null?e(te,{color:"gray",size:"sm"}):h.length===0?e("div",{className:"AssetBrowser__details__usage__empty",children:"No docs use this asset."}):e("div",{className:"AssetBrowser__details__usage__list",children:h.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(ot,{size:14})]},c.id))})]}),e("div",{className:"AssetBrowser__details__buttons",children:[e(g,{variant:"default",size:"xs",leftIcon:e(ge,{size:14}),onClick:()=>we(n),children:"Download"}),t.canManage&&e(C,{children:[e(g,{variant:"default",size:"xs",leftIcon:e(at,{size:14}),loading:_,onClick:()=>R(),children:"Replace file"}),e(g,{className:"AssetBrowser__details__buttons__delete",color:"red",variant:"filled",size:"xs",leftIcon:e(O,{size:14}),disabled:_,onClick:()=>v(!0),children:"Delete"})]})]}),m&&e("div",{className:"AssetBrowser__details__confirmReplace",children:[e("div",{children:["The new file has a different type (",e("b",{children:[".",D(f)]})," ","\u2192 ",e("b",{children:[".",D(m.name)]}),"). Replacing will change the asset's file extension and serving URL",Me(o.name,D(m.name))!==o.name&&e(C,{children:[", and the asset will be renamed to"," ",e("b",{children:Me(o.name,D(m.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:_,children:"Cancel"}),e(g,{color:"dark",size:"xs",loading:_,onClick:()=>E(m),children:"Replace"})]})]}),x&&e("div",{className:"AssetBrowser__details__confirmDelete",children:[e("div",{children:["Delete ",e("b",{children:o.name})," from the asset library?",h&&h.length>0&&e(C,{children:[" ","This asset is used in ",h.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:_,children:"Cancel"}),e(g,{color:"red",size:"xs",loading:_,onClick:()=>q(),children:"Delete"})]})]})]})})}function Te(t){let[o,a]=i(t.folder??t.initialFolder??""),l=t.folder??o,[r,_]=i([]),[d,x]=i(!0),[v,m]=i(""),[B,h]=i(!1),[F,n]=i(!1),[f,N]=i(null),[S,V]=i(!1),[W,z]=i(null),[X,R]=i(null),[E,$]=i(null),[q,c]=i(null),[w,p]=i(null),[y,K]=i(new Map),{roles:pt}=dt(),ht=window.firebase.user.email||"",J=ct(pt,ht),Q=v.trim().length>0;function P(s){a(s),m(""),t.onFolderChange&&t.onFolderChange(s)}async function I(s){x(!0),N(null),K(new Map),await M(async()=>{let u=await ke(s);_(u)}),x(!1)}T(()=>{I(l)},[l]),T(()=>{if(!Q||f!==null)return;let s=!1;return(async()=>{let u=[];await M(async()=>{u=await qe(l)}),s||N(u)})(),()=>{s=!0}},[Q,f,l]);let be=t.mode==="manage"?t.initialAssetId:"";T(()=>{be&&M(async()=>{let s=await Je(be);s&&s.type==="file"&&(P(s.parent),p(s))})},[be]);let Y=Se(()=>{let s=v.trim().toLowerCase(),u=s?f||[]:r;return t.mode==="pick"&&(u=u.filter(A=>A.type==="folder"||Ve(A.file?.filename||A.name,t.accept))),s&&(u=u.filter(A=>A.name.toLowerCase().includes(s))),u},[r,f,v,t.mode,t.accept]);async function Ue(s){if(s.length===0||F)return;let u="asset-browser-upload";n(!0),b({id:u,message:`Uploading ${s.length} file(s)...`,loading:!0,autoClose:!1,disallowClose:!0});let A=[],xe=[];for(let le=0;le<s.length;le++){let ne=s[le];je({id:u,message:`Uploading ${ne.name} (${le+1} of ${s.length})...`,loading:!0,autoClose:!1,disallowClose:!0});try{let Be=await re(ne),At=await Ye({parent:l,file:Be});A.push(At)}catch(Be){console.error(`failed to upload ${ne.name}:`,Be),xe.push(ne.name)}}Ge(u),n(!1),xe.length>0?b({title:"Upload failed",message:`Failed to upload: ${xe.join(", ")}`,color:"red",autoClose:!1}):b({message:`Uploaded ${A.length} file(s).`,color:"green"}),await I(l),t.mode==="pick"&&A.length===1&&s.length===1&&t.onPickFile&&t.onPickFile(A[0])}function vt(){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=()=>{Ue(Array.from(s.files||[]))},s.click(),s.remove()}function wt(s){t.onPickFile&&t.onPickFile(s)}let Z=J,ae=t.mode==="manage"&&J,ee=Array.from(y.values()),Re=ee.filter(s=>s.type==="file"&&!s.file?.altDisabled&&(G(s.file?.filename||s.name)||H(s.file?.filename||s.name))),Ae=Y.length>0&&Y.every(s=>y.has(s.id));function $e(s){K(u=>{let A=new Map(u);return A.has(s.id)?A.delete(s.id):A.set(s.id,s),A})}function bt(){K(Ae?new Map:new Map(Y.map(s=>[s.id,s])))}return e("div",{className:fe("AssetBrowser",t.className,`AssetBrowser--${t.mode}`),children:[e("div",{className:"AssetBrowser__toolbar",children:[e(Te.Breadcrumbs,{folder:l,onNavigate:P}),e("div",{className:"AssetBrowser__toolbar__actions",children:[e(j,{className:"AssetBrowser__toolbar__filter",placeholder:"Search by name",size:"xs",icon:e(it,{size:14}),value:v,onChange:s=>m(s.currentTarget.value)}),Z&&t.mode==="manage"&&e(g,{variant:"default",size:"xs",leftIcon:e(lt,{size:16}),onClick:()=>V(!0),children:"New folder"}),Z&&e(g,{color:"dark",size:"xs",leftIcon:e(rt,{size:16}),loading:F,onClick:()=>vt(),children:"Upload"})]})]}),ae&&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:()=>R(ee),children:"Move"}),Re.length>0&&e(g,{variant:"default",size:"xs",onClick:()=>c(Re),children:"Disable alt text"}),e(g,{color:"red",size:"xs",leftIcon:e(O,{size:14}),onClick:()=>$(ee),children:"Delete"}),e(g,{variant:"subtle",color:"gray",size:"xs",onClick:()=>K(new Map),children:"Clear"})]})]}),e("div",{className:fe("AssetBrowser__listing",B&&"dragging"),onDragOver:s=>{Z&&(s.preventDefault(),h(!0))},onDragLeave:s=>{s.preventDefault(),h(!1)},onDrop:s=>{s.preventDefault(),h(!1),Z&&Ue(Array.from(s.dataTransfer?.files||[]))},children:d||Q&&f===null?e("div",{className:"AssetBrowser__loading",children:e(te,{color:"gray",size:"lg"})}):Y.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."}),Z&&e("div",{className:"AssetBrowser__empty__hint",children:'Drop files here or click "Upload" to add assets.'})]})}):e(ie,{className:"AssetBrowser__table",verticalSpacing:"xs",fontSize:"xs",highlightOnHover:!0,children:[e("thead",{children:e("tr",{children:[ae&&e("th",{className:"AssetBrowser__table__checkboxCol",children:e(L,{size:"xs","aria-label":"Select all",checked:Ae,indeterminate:!Ae&&y.size>0,onChange:()=>bt()})}),e("th",{children:"name"}),e("th",{className:"AssetBrowser__table__modifiedCol",children:"modified"}),e("th",{className:"AssetBrowser__table__actionsCol"})]})}),e("tbody",{children:Y.map(s=>s.type==="folder"?e("tr",{className:"AssetBrowser__row AssetBrowser__row--folder",onClick:()=>P(oe(s.parent,s.name)),children:[ae&&e("td",{className:"AssetBrowser__checkboxCell",onClick:u=>u.stopPropagation(),children:e(L,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>$e(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e("div",{className:"AssetBrowser__thumb",children:e(De,{size:24,stroke:"1.5"})}),e("div",{className:"AssetBrowser__nameCell__text",children:[e("div",{className:"AssetBrowser__nameCell__name",children:s.name}),e(ut,{asset:s,folder:l,searching:Q,onNavigate:P})]})]})}),e("td",{children:e(gt,{asset:s})}),e("td",{onClick:u=>u.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(Ne,{size:16})}),children:[e(k.Item,{icon:e(ze,{size:14}),onClick:()=>z(s),children:"Rename"}),e(k.Item,{icon:e(he,{size:14}),onClick:()=>R([s]),children:"Move"}),e(k.Item,{color:"red",icon:e(O,{size:14}),onClick:()=>$([s]),children:"Delete"})]})})})]},s.id):e("tr",{className:"AssetBrowser__row AssetBrowser__row--file",onClick:()=>{t.mode==="pick"?wt(s):p(s)},children:[ae&&e("td",{className:"AssetBrowser__checkboxCell",onClick:u=>u.stopPropagation(),children:e(L,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>$e(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e(mt,{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(ut,{asset:s,folder:l,searching:Q,onNavigate:P})]})]})}),e("td",{children:e(gt,{asset:s})}),e("td",{onClick:u=>u.stopPropagation(),children:e("div",{className:"AssetBrowser__actionsCell",children:t.mode!=="pick"&&e(xt,{asset:s,canManage:J,onDetails:()=>p(s),onRename:()=>z(s),onMove:()=>R([s]),onDelete:()=>$([s])})})})]},s.id))})]})}),e(Bt,{opened:S,parent:l,onClose:()=>V(!1),onCreated:s=>{V(!1),P(oe(l,s))}}),W&&e(yt,{asset:W,onClose:()=>z(null),onRenamed:()=>{z(null),I(l)}}),X&&X.length>0&&e(Ct,{assets:X,onClose:()=>R(null),onMoved:()=>{R(null),I(l)}}),E&&E.length>0&&e(Mt,{assets:E,onClose:()=>$(null),onDeleted:()=>{$(null),I(l)}}),q&&q.length>0&&e(Ft,{assets:q,onClose:()=>c(null),onDone:()=>{c(null),I(l)}}),w&&e(ft,{asset:w,canManage:J,onClose:()=>p(null),onChanged:()=>I(l),onDeleted:()=>{p(null),I(l)}})]})}Te.Breadcrumbs=t=>{let o=Xe(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(Fe,{className:"AssetBrowser__breadcrumbs__divider",size:14}),e("button",{className:fe("AssetBrowser__breadcrumbs__link",r===a.length-1&&"active"),disabled:r===a.length-1,onClick:()=>t.onNavigate(l.path),children:l.label})]},l.path))})};function xt(t){let o=t.asset;return e(k,{shadow:"sm",position:"bottom",placement:"end",control:e(se,{size:"sm",children:e(Ne,{size:16})}),children:[e(k.Item,{icon:e(nt,{size:14}),onClick:t.onDetails,children:"Details"}),e(k.Item,{icon:e(ue,{size:14}),onClick:()=>ve(o.file),children:"Copy URL"}),e(k.Item,{icon:e(ge,{size:14}),onClick:()=>we(o.file),children:"Download"}),t.canManage&&e(C,{children:[e(k.Item,{icon:e(ze,{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(O,{size:14}),onClick:t.onDelete,children:"Delete"})]})]})}function ut(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 ",Ke(o.parent,t.folder)]})}function gt(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(_t,{email:a,size:20}),e("span",{children:l?He(l):"\u2014"})]})}function Bt(t){let[o,a]=i(""),[l,r]=i(!1);async function _(){r(!0),await M(async()=>{let d=await Qe(t.parent,o);a(""),t.onCreated(d.name)}),r(!1)}return e(U,{opened:t.opened,onClose:t.onClose,title:"New folder",size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),_()},children:[e(j,{"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 yt(t){let[o,a]=i(t.asset.name),[l,r]=i(!1);async function _(){r(!0),await M(async()=>{await Ze(t.asset,o),t.onRenamed()}),r(!1)}return e(U,{opened:!0,onClose:t.onClose,title:`Rename ${t.asset.type}`,size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),_()},children:[e(j,{"data-autofocus":!0,value:o,onChange:d=>a(d.currentTarget.value)}),e(g,{type:"submit",color:"dark",loading:l,disabled:!o,children:"Rename"})]})})}function Ct(t){let o=t.assets,[a,l]=i(o[0]?.parent||""),[r,_]=i([]),[d,x]=i(!0),[v,m]=i(!1);T(()=>{x(!0),M(async()=>{let n=await ke(a);_(n.filter(f=>f.type==="folder"))}).then(()=>x(!1))},[a]);let B=o.filter(n=>n.type==="folder").map(n=>oe(n.parent,n.name));function h(n){return B.some(f=>n===f||n.startsWith(`${f}/`))}async function F(){m(!0);let n=[],f=0;for(let N of o)try{await et(N,a),f+=1}catch(S){console.error(`failed to move ${N.name}:`,S),n.push(N.name)}m(!1),n.length>0&&b({title:"Move failed",message:`Failed to move: ${n.join(", ")}`,color:"red",autoClose:!1}),f>0&&b({message:o.length===1?`Moved "${o[0].name}" to ${a||"Assets"}.`:`Moved ${f} item(s) to ${a||"Assets"}.`,color:"green"}),t.onMoved()}return e(U,{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(Te.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 f=oe(n.parent,n.name);return e("button",{className:"AssetBrowser__moveModal__folder",disabled:h(f),onClick:()=>l(f),children:[e(De,{size:16,stroke:"1.5"}),e("span",{children:n.name}),e(Fe,{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 kt=20;function Mt(t){let o=t.assets,[a,l]=i(!1),[r,_]=i(null),d=o.filter(m=>m.type==="file"),x=o.some(m=>m.type==="folder");T(()=>{d.length===0||d.length>kt||Promise.all(d.map(m=>_e(m.id))).then(m=>{let B=new Set(m.flat().map(h=>h.id));_(B.size)}).catch(()=>_(null))},[o.map(m=>m.id).join(",")]);async function v(){l(!0);let m=[],B=0;for(let h of o)try{await de(h),B+=1}catch(F){console.error(`failed to delete ${h.name}:`,F),m.push(h.name)}l(!1),m.length>0&&b({title:"Delete failed",message:`Failed to delete: ${m.join(", ")}. Note that folders must be empty before they can be deleted.`,color:"red",autoClose:!1}),B>0&&b({message:o.length===1?`Deleted "${o[0].name}".`:`Deleted ${B} item(s).`,color:"green"}),t.onDeleted()}return e(U,{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 Ft(t){let o=t.assets,[a,l]=i(!1);async function r(){l(!0);let _=[],d=0;for(let x of o)try{let v=x.file,m=await ce(x,!0);await me(m,{previousFile:v}),d+=1}catch(v){console.error(`failed to disable alt text for ${x.name}:`,v),_.push(x.name)}l(!1),_.length>0&&b({title:"Failed to disable alt text",message:`Failed to update: ${_.join(", ")}`,color:"red",autoClose:!1}),d>0&&b({message:`Disabled alt text for ${d} file(s).`,color:"green"}),t.onDone()}return e(U,{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{Te as a};
@@ -1 +0,0 @@
1
- import{a as U}from"./chunk-FSVNOZ6F.js";import{d as _,f as d}from"./chunk-YLSRRNSE.js";import{Cc as Z,Fa as S,Fb as M,Fc as P,Ga as t,Ob as T,S as x,Tb as I,Y as k,Ya as B,_ as L,a as v,aa as w,c as C,ec as H,fb as j,j as X,ob as N,pc as O,qa as g,xc as z,yc as R}from"./chunk-LROR6N3B.js";import{d as m}from"./chunk-KUCVLANF.js";var h={name:"@blinkk/root-cms",version:"3.1.1",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.1","firebase-admin":">=11","firebase-functions":">=4"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function W(){return t("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("g",{"clip-path":"url(#clip0_1_318)",children:[t("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"}),t("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"}),t("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"}),t("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"}),t("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"}),t("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"}),t("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"}),t("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"}),t("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"})]}),t("defs",{children:t("clipPath",{id:"clip0_1_318",children:t("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}X();function V(e){let[i,a]=v(!1);C(()=>{let c=navigator.userAgentData?.platform??navigator.platform;a(/mac/i.test(c||""))},[]);let l=()=>{U()};return t("button",{type:"button",className:d("SearchBar",e.className),onClick:l,"aria-label":"Open search",children:[t(Z,{className:"SearchBar__icon",size:16,stroke:1.5}),t("span",{className:"SearchBar__placeholder",children:"Search"}),t("span",{className:"SearchBar__shortcut","aria-hidden":"true",children:i?"\u2318 + K":"Ctrl + K"})]})}var r="1.5";function o(e){return t("div",{className:"Layout",children:[t(o.Top,{}),t(o.Side,{}),t(o.Main,{...e,children:e.children}),t(o.Bottom,{})]})}function G(e){let a=e.split("?")[0].replace(/\/+$/g,"").split("/").filter(Boolean);return a.length===4&&a[0]==="cms"&&a[1]==="content"}o.Top=()=>{let e=window.__ROOT_CTX.rootConfig,i=e.projectName||e.projectId,a=e.minimalBranding,{url:l}=_(),c=!G(l);return t("div",{className:"Layout__top",children:[a?t(m,{children:[t("a",{className:"Layout__top__logo",href:"/cms",children:i}),t("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",h.version]})]}):t(m,{children:[t("a",{className:"Layout__top__logo",href:"/cms",children:t(W,{})}),t("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",h.version]}),t("div",{className:"Layout__top__project",children:i})]}),c&&t("div",{className:"Layout__top__search",children:t(V,{})})]})};o.Side=()=>{let{url:e}=_(),i=e.replace(/\/*$/g,""),a=window.firebase.user,l=window.__ROOT_CTX.sidebar?.tools,c=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),s=u=>c.has(u),f=window.__ROOT_CTX.experiments||{},D=async()=>{await window.firebase.auth.signOut(),window.location.href="/cms/login"};return t("div",{className:"Layout__side",children:[t("div",{className:"Layout__side__buttons",children:[!s("home")&&t(o.SideButton,{label:"Home",url:"/cms",active:i==="/cms",children:t(T,{stroke:r})}),!s("content")&&t(o.SideButton,{label:"Content",url:"/cms/content",active:i.startsWith("/cms/content"),children:t(M,{stroke:r})}),f.taskManager&&t(o.SideButton,{label:"Tasks",url:"/cms/tasks",active:i.startsWith("/cms/tasks"),children:t(j,{stroke:r})}),!s("releases")&&t(o.SideButton,{label:"Releases",url:"/cms/releases",active:i.startsWith("/cms/releases"),children:t(R,{stroke:r})}),!s("data")&&t(o.SideButton,{label:"Data",url:"/cms/data",active:i.startsWith("/cms/data"),children:t(N,{stroke:r})}),!s("assets")&&t(o.SideButton,{label:"Asset Library",url:"/cms/assets",active:i.startsWith("/cms/assets"),children:t(O,{stroke:r})}),!s("translations")&&t(o.SideButton,{label:"Translations",url:"/cms/translations",active:i.startsWith("/cms/translations"),children:t(I,{stroke:r})}),(f.ai||window.__ROOT_CTX.ai)&&!s("ai")&&t(o.SideButton,{label:"Root AI",url:"/cms/ai",active:i.startsWith("/cms/ai"),children:t(z,{stroke:r})}),l&&t(m,{children:[t("div",{className:"Layout__side__divider"}),Object.entries(l).map(([u,n])=>{let A=n.cmsUrl?.startsWith("/cms/")?n.cmsUrl:void 0,p=n.externalUrl,y=p??A??`/cms/tools/${u}`,b=p?void 0:y.replace(/\/*$/g,""),E=!p&&!!b&&(i===b||i.startsWith(`${b}/`));return t(o.SideButton,{className:"Layout__side__tool",label:n.label||"",url:y,active:E,external:!!p,children:n.icon?t("img",{className:"Layout__side__tool__icon",src:n.icon,alt:n.label||""}):t(B,{stroke:r})},u)}),t("div",{className:"Layout__side__divider"})]}),!s("settings")&&t(o.SideButton,{label:"Settings",url:"/cms/settings",active:i.startsWith("/cms/settings"),children:t(P,{stroke:r})})]}),t("div",{className:"Layout__side__user",children:t(g,{shadow:"md",position:"right",control:t(x,{children:t(w,{src:a.photoURL,alt:a.email,size:30,radius:"xl"})}),children:[t(g.Label,{children:t(k,{size:"xs",color:"dimmed",truncate:!0,children:["Signed in as ",a.email]})}),t(L,{}),t(g.Item,{color:"red",icon:t(H,{style:{width:14,height:14}}),onClick:D,children:"Sign out"})]})})]})};o.SideButton=e=>t(S,{className:d("Layout__side__button",e.className),label:e.label,position:"right",withArrow:!0,children:t("a",{className:d(e.active&&"active"),href:e.url,target:e.external?"_blank":void 0,rel:e.external?"noreferrer noopener":void 0,children:e.children})});o.Main=e=>t("div",{className:"Layout__main",children:e.children});o.Bottom=()=>t("div",{className:"Layout__bottom"});export{o as a};
@@ -1 +0,0 @@
1
- import{C as te,D as E,E as oe,G as H,H as re,I as ne,K as ie,O as ae,P as se,Q as le,S as ce,T as pe,Y as C,Z as ue,a as _,c as Q,e as ee,fa as de,ha as ge,ia as fe,ja as me,ka as he,ua as ve,v as n,y as w}from"./chunk-LROR6N3B.js";import{j as Y}from"./chunk-KUCVLANF.js";w();w();var tt=Object.defineProperty,ot=Object.defineProperties,rt=Object.getOwnPropertyDescriptors,ye=Object.getOwnPropertySymbols,nt=Object.prototype.hasOwnProperty,it=Object.prototype.propertyIsEnumerable,_e=(e,t,o)=>t in e?tt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,at=(e,t)=>{for(var o in t||(t={}))nt.call(t,o)&&_e(e,o,t[o]);if(ye)for(var o of ye(t))it.call(t,o)&&_e(e,o,t[o]);return e},st=(e,t)=>ot(e,rt(t));function lt(e){return st(at({},e),{id:e.id||ie()})}function ct(e){let t=[];return e.reduceRight((o,r)=>(t.includes(r.id)||(t.push(r.id),o.push(r)),o),[]).reverse()}function M(e){return ct(e.map(t=>lt(t)))}function we(e,t){let[o,r]=_(M(typeof e=="function"?e(t):e));return Q(()=>{typeof e=="function"&&r(M(e(t)))},[t]),[o,{registerActions:i=>r(s=>M([...s,...i])),updateActions:i=>r(M(typeof i=="function"?i(t):i)),removeActions:i=>r(s=>s.filter(l=>!i.includes(l.id))),triggerAction:i=>{var s;let l=o.find(m=>m.id===i);(s=l?.onTrigger)==null||s.call(l,l)}}]}function pt(e,t){return e===null?[]:Array.isArray(e)?e.map(o=>[o,t]):[[e,t]]}function Se(e,t){se(pt(e,t))}w();w();var ut=E((e,{radius:t})=>({action:{position:"relative",display:"block",width:"100%",padding:"10px 12px",borderRadius:e.fn.radius(t)},actionHovered:{backgroundColor:e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[1]},actionIcon:{color:e.colorScheme==="dark"?e.colors.dark[2]:e.colors.gray[6]},actionBody:{flex:1}})),Oe=ut;var dt=Object.defineProperty,z=Object.getOwnPropertySymbols,Pe=Object.prototype.hasOwnProperty,Ae=Object.prototype.propertyIsEnumerable,Ee=(e,t,o)=>t in e?dt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,gt=(e,t)=>{for(var o in t||(t={}))Pe.call(t,o)&&Ee(e,o,t[o]);if(z)for(var o of z(t))Ae.call(t,o)&&Ee(e,o,t[o]);return e},ft=(e,t)=>{var o={};for(var r in e)Pe.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&z)for(var r of z(e))t.indexOf(r)<0&&Ae.call(e,r)&&(o[r]=e[r]);return o};function K(e){var t=e,{action:o,styles:r,classNames:a,hovered:d,onTrigger:p,highlightQuery:h,highlightColor:i,query:s,radius:l}=t,m=ft(t,["action","styles","classNames","hovered","onTrigger","highlightQuery","highlightColor","query","radius"]);let{classes:u,cx:v}=Oe({radius:l},{styles:r,classNames:a,name:"Spotlight"});return n.createElement(ce,gt({className:v(u.action,{[u.actionHovered]:d}),tabIndex:-1,onMouseDown:y=>y.preventDefault(),onClick:p},m),n.createElement(de,{noWrap:!0},o.icon&&n.createElement(pe,{className:u.actionIcon},o.icon),n.createElement("div",{className:u.actionBody},n.createElement(he,{highlightColor:i,highlight:h?s:null},o.title),o.description&&n.createElement(C,{color:"dimmed",size:"xs"},o.description))))}K.displayName="@mantine/spotlight/DefaultAction";w();var mt=E(e=>({nothingFound:{},actions:{padding:e.spacing.xs/2,borderTop:`1px solid ${e.colorScheme==="dark"?e.colors.dark[4]:e.colors.gray[2]}`},actionsGroup:{textTransform:"uppercase",fontSize:e.spacing.xs,fontWeight:700,padding:"10px 12px",paddingBottom:0,paddingTop:15}})),xe=mt;function U({actions:e,styles:t,classNames:o,actionComponent:r,hovered:a,onActionHover:d,onActionTrigger:p,query:h,nothingFoundMessage:i,highlightQuery:s,highlightColor:l,radius:m}){let{classes:u}=xe(null,{classNames:o,styles:t,name:"Spotlight"}),v=e.map(g=>g.type==="item"?n.createElement(r,{query:h,key:g.item.id,action:g.item,hovered:g.index===a,onMouseEnter:()=>d(g.index),classNames:o,styles:t,radius:m,onTrigger:()=>p(g.item),highlightQuery:s,highlightColor:l}):n.createElement(C,{className:u.actionsGroup,color:"dimmed",key:g.label},g.label)),y=v.length>0||!!i&&h.trim().length>0;return n.createElement(n.Fragment,null,y&&n.createElement("div",{className:u.actions},v.length>0?v:n.createElement(C,{color:"dimmed",className:u.nothingFound,align:"center",size:"lg",py:"md"},i)))}U.displayName="@mantine/spotlight/ActionsList";function ht(e){return Array.isArray(e)?e.map(t=>t.trim()).join(",").toLowerCase().trim():typeof e=="string"?e.toLowerCase().trim():""}function Ce(e,t){let o=e.trim().toLowerCase(),r=[[],[]];return t.forEach(a=>{var d,p;(d=a.title)!=null&&d.toLowerCase().includes(o)?r[0].push(a):((p=a.description)!=null&&p.toLowerCase().includes(o)||ht(a.keywords).includes(o))&&r[1].push(a)}),r.flat()}var vt=Object.defineProperty,yt=Object.defineProperties,_t=Object.getOwnPropertyDescriptors,be=Object.getOwnPropertySymbols,wt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable,Ie=(e,t,o)=>t in e?vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,De=(e,t)=>{for(var o in t||(t={}))wt.call(t,o)&&Ie(e,o,t[o]);if(be)for(var o of be(t))St.call(t,o)&&Ie(e,o,t[o]);return e},Ne=(e,t)=>yt(e,_t(t)),Ot=E((e,{centered:t,maxWidth:o,topOffset:r,radius:a})=>({root:Ne(De({},e.fn.cover()),{position:"fixed"}),spotlight:{position:"relative",zIndex:2,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white,borderRadius:e.fn.radius(a),width:"100%",maxWidth:o,overflow:"hidden",marginLeft:"calc(var(--removed-scroll-width, 0px) * -1)"},overlay:Ne(De({},e.fn.cover()),{position:"fixed"}),inner:{height:"100vh",display:"flex",flexDirection:"column",paddingTop:t?e.spacing.md:r,justifyContent:t?"center":"flex-start",alignItems:"center"},searchInput:{border:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,backgroundColor:e.colorScheme==="dark"?e.colors.dark[6]:e.white}})),Te=Ot;var Et=Object.defineProperty,B=Object.getOwnPropertySymbols,Re=Object.prototype.hasOwnProperty,Le=Object.prototype.propertyIsEnumerable,je=(e,t,o)=>t in e?Et(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,Pt=(e,t)=>{for(var o in t||(t={}))Re.call(t,o)&&je(e,o,t[o]);if(B)for(var o of B(t))Le.call(t,o)&&je(e,o,t[o]);return e},At=(e,t)=>{var o={};for(var r in e)Re.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&B)for(var r of B(e))t.indexOf(r)<0&&Le.call(e,r)&&(o[r]=e[r]);return o};function q(e){var t=e,{query:o,onQueryChange:r,actions:a,onClose:d,opened:p,withinPortal:h,transition:i="pop",transitionDuration:s,classNames:l,styles:m,overlayColor:u="#000",overlayOpacity:v=.25,overlayBlur:y=3,shadow:g="md",radius:P="sm",centered:W=!1,closeOnActionTrigger:b=!0,highlightQuery:I=!1,highlightColor:D,maxWidth:N=600,topOffset:T=120,className:G,searchPlaceholder:j,searchIcon:R,filter:Fe=Ce,nothingFoundMessage:We,limit:Ge=10,actionComponent:Ve=K,actionsWrapperComponent:Ke="div",zIndex:Ue=te("modal")}=t,qe=At(t,["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[L,S]=_(-1),[Ze,$]=_(!1),{classes:A,cx:$e}=Te({centered:W,maxWidth:N,topOffset:T,radius:P},{classNames:l,styles:m,name:"Spotlight"}),[,J]=ae(),Je=ne(p),V=()=>S(-1),k=()=>{V(),d()};re({transitionDuration:0,opened:p});let Xe=Fe(o,a).slice(0,Ge),X=oe(Xe).items,O=X.map(c=>c.type==="item"?c.item:void 0).filter(c=>c);H(()=>{O.length-1<L&&S(O.length-1)},[O.length]);let Ye=c=>{var x;if(!Ze)switch(c.code){case"ArrowDown":{c.preventDefault(),S(f=>f<O.length-1?f+1:0);break}case"ArrowUp":{c.preventDefault(),S(f=>f>0?f-1:O.length-1);break}case"Enter":{c.preventDefault();let f=O[L];(x=f?.onTrigger)==null||x.call(f,f),b&&f?.onTrigger&&k();break}case"Escape":c.preventDefault(),k()}},et=c=>{r(c.currentTarget.value),L===-1&&S(0)};return n.createElement(ge,{withinPortal:h,zIndex:Ue},n.createElement(fe,{onExited:()=>J(!1),onEntered:()=>J(!0),mounted:p,transitions:{spotlight:{duration:s,transition:i,timingFunction:"ease"},overlay:{duration:s/2,transition:"fade",timingFunction:"ease"}}},c=>n.createElement("div",Pt({className:$e(A.root,G)},qe),n.createElement("div",{className:A.inner,ref:Je},n.createElement(ue,{style:c.spotlight,className:A.spotlight,shadow:g,radius:P,onMouseLeave:V},n.createElement(ve,{value:o,onChange:et,onKeyDown:Ye,onCompositionStart:()=>$(!0),onCompositionEnd:()=>$(!1),classNames:{input:A.searchInput},size:"lg",placeholder:j,icon:R,onMouseEnter:V,autoComplete:"chrome-please-just-do-not-show-it-thanks"}),n.createElement(Ke,null,n.createElement(U,{highlightQuery:I,highlightColor:D,actions:X,actionComponent:Ve,hovered:L,query:o,nothingFoundMessage:We,onActionHover:S,onActionTrigger:x=>{x.onTrigger(x),b&&k()},styles:m,classNames:l,radius:P}))),n.createElement("div",{style:c.overlay},n.createElement(me,{className:A.overlay,zIndex:1,onMouseDown:k,color:u,opacity:v,blur:y}))))))}q.displayName="@mantine/spotlight/Spotlight";w();var Z={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 xt(e,t){return new CustomEvent(e,{detail:t})}function Ct(){window.dispatchEvent(xt(Z.open))}function ke(e){let t={registerActions:o=>e.registerActions(o.detail),removeActions:o=>e.removeActions(o.detail),triggerAction:o=>e.triggerAction(o.detail),open:e.openSpotlight,close:e.closeSpotlight,toggle:e.toggleSpotlight};Q(()=>(Object.keys(t).forEach(o=>{window.addEventListener(Z[o],t[o])}),()=>{Object.keys(t).forEach(o=>{window.removeEventListener(Z[o],t[o])})}),[])}w();var Qe=Y(null);var bt=Object.defineProperty,F=Object.getOwnPropertySymbols,Me=Object.prototype.hasOwnProperty,ze=Object.prototype.propertyIsEnumerable,He=(e,t,o)=>t in e?bt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:o}):e[t]=o,It=(e,t)=>{for(var o in t||(t={}))Me.call(t,o)&&He(e,o,t[o]);if(F)for(var o of F(t))ze.call(t,o)&&He(e,o,t[o]);return e},Dt=(e,t)=>{var o={};for(var r in e)Me.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(e!=null&&F)for(var r of F(e))t.indexOf(r)<0&&ze.call(e,r)&&(o[r]=e[r]);return o};function Be(e){var t=e,{actions:o,children:r,shortcut:a="mod + K",onSpotlightClose:d,onSpotlightOpen:p,onQueryChange:h,cleanQueryOnClose:i=!0,transitionDuration:s=150}=t,l=Dt(t,["actions","children","shortcut","onSpotlightClose","onSpotlightOpen","onQueryChange","cleanQueryOnClose","transitionDuration"]);let m=ee(-1),[u,v]=_(""),[y,{registerActions:g,updateActions:P,removeActions:W,triggerAction:b}]=we(o,u);H(()=>{P(o)},[o]);let I=R=>{v(R),h?.(R)},[D,{open:N,close:T,toggle:G}]=le(!1,{onClose:()=>{d?.(),i&&(m.current=window.setTimeout(()=>{I("")},s))},onOpen:()=>{p?.(),window.clearTimeout(m.current)}}),j={openSpotlight:N,closeSpotlight:T,toggleSpotlight:G,registerActions:g,removeActions:W,triggerAction:b,opened:D,actions:y,query:u};return Se(a,N),ke(j),n.createElement(Qe.Provider,{value:j},n.createElement(q,It({actions:y,onClose:T,opened:D,query:u,onQueryChange:I,transitionDuration:s},l)),r)}Be.displayName="@mantine/spotlight/SpotlightProvider";export{Ct as a,Be as b};
@@ -1 +0,0 @@
1
- import{b as R,f as O,g as U,i as A,j as H,k as j,m as N,o as M}from"./chunk-VD6G5NV4.js";import{a,c as E,e as x,h as D,j as B}from"./chunk-LROR6N3B.js";B();var F=200,X=25,Y=2;function W(u,d={}){let[b,r]=a([]),[f,t]=a(!1),[e,g]=a(null),[y,n]=a(null),o=x(null),T=d.limit??X,L=d.minQueryLength??Y;return E(()=>{let h=u.trim();if(h.length<L){o.current?.abort(),o.current=null,r([]),t(!1),g(null);return}t(!0),g(null);let S=window.setTimeout(async()=>{o.current?.abort();let s=new AbortController;o.current=s;try{let l=await fetch("/cms/api/search.query",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({q:h,limit:T}),signal:s.signal});if(!l.ok)throw new Error(`search.query returned ${l.status}`);let c=await l.json();if(!c?.success)throw new Error(c?.error||"search failed");if(s.signal.aborted)return;r(Array.isArray(c.hits)?c.hits:[]),n(c.meta||null),t(!1)}catch(l){if(s.signal.aborted)return;console.error("global search failed:",l),g(String(l?.message||l)),r([]),t(!1)}},F);return()=>{window.clearTimeout(S)}},[u,T,L]),{hits:b,loading:f,error:e,status:y}}function Z(){let[u,d]=a({status:{lastRun:null,docCount:0,fieldCount:0,shardCount:0},running:!1}),[b,r]=a(!0),f=D(async()=>{try{let t=await fetch("/cms/api/search.status",{method:"GET",headers:{"Content-Type":"application/json"}});if(!t.ok)return;let e=await t.json();if(!e?.success)return;d({status:e.status,running:!!e.running})}catch(t){console.error("search.status failed:",t)}finally{r(!1)}},[]);return E(()=>{f()},[f]),{...u,loading:b,refresh:f}}var v=200,J=5,K=2;function tt(u,d={}){let[b,r]=a([]),[f,t]=a(!1),e=x(null),g=d.limit??10,y=d.minQueryLength??K;return E(()=>{let n=u.trim(),o=n.indexOf("/");if((o>=0?n.slice(o+1):n).length<y){e.current&&(e.current.aborted=!0),e.current=null,r([]),t(!1);return}t(!0);let L=window.setTimeout(async()=>{e.current&&(e.current.aborted=!0);let h={aborted:!1};e.current=h;let S=null,s=n;o>=0&&(S=n.slice(0,o),s=n.slice(o+1));let l=window.__ROOT_CTX?.rootConfig?.projectId,c=window.firebase?.db;if(!l||!c){r([]),t(!1);return}let I=Object.keys(window.__ROOT_CTX.collections||{}),q=S?I.filter(p=>p.toLowerCase()===S.toLowerCase()):I,P=s,Q=`${s}\uF8FF`;try{let p=q.map(async i=>{let w=R(c,"Projects",l,"Collections",i,"Drafts"),C=U(w,A(O()),j(P),N(Q),H(J));try{let m=await M(C),_=[];return m.forEach(G=>{_.push({collection:i,slug:G.id,docId:`${i}/${G.id}`})}),_}catch(m){return console.error(`docSlugSearch failed for ${i}:`,m),[]}}),$=(await Promise.all(p)).flat();if(h.aborted)return;let k=$.sort((i,w)=>{let C=i.slug===s||i.docId===n?0:1,m=w.slug===s||w.docId===n?0:1;return C!==m?C-m:i.docId.localeCompare(w.docId)});r(k.slice(0,g)),t(!1)}catch(p){if(h.aborted)return;console.error("docSlugSearch failed:",p),r([]),t(!1)}},v);return()=>{window.clearTimeout(L)}},[u,g,y]),{hits:b,loading:f}}export{W as a,Z as b,tt as c};
@@ -1 +0,0 @@
1
- import{a as k}from"./chunk-MZTOPPWQ.js";import{a as H}from"./chunk-SRX7EWL4.js";import{b as B}from"./chunk-JS6TK4OP.js";import{g as D}from"./chunk-KRNQ6L35.js";import{a as b}from"./chunk-VD6G5NV4.js";import{f as C}from"./chunk-YLSRRNSE.js";import{Cc as U,Da as F,F as M,Fa as L,Ga as t,U as w,V as N,a as d,c as v,da as p,g as A,j as Y,sa as I,ua as j,wa as O,za as E}from"./chunk-LROR6N3B.js";import{d as z}from"./chunk-KUCVLANF.js";Y();var S=50,tt=[{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 Q(e){let[a,o]=d(!0),[n,i]=d([]);return v(()=>{D(e?{limit:e}:void 0).then(r=>{i(r),o(!1)})},[e]),{loading:a,actions:n}}function xt(e){if(e.compact)return t(ot,{...e});let[a,o]=d(""),[n]=M(a,300),[i,r]=d([]),[m,q]=d([]),[g,G]=d("all"),[h,T]=d(1),{actions:l,loading:R}=Q(),X=A(()=>{let s=new Set;return l.forEach(c=>s.add(c.action)),Array.from(s).sort()},[l]),Z=A(()=>{let s=new Set;return l.forEach(c=>{c.by&&s.add(c.by)}),Array.from(s).sort()},[l]),u=A(()=>{let s=Date.now();return l.filter(c=>{if(n){let f=n.toLowerCase(),x=c.action.toLowerCase().includes(f),_=c.by?.toLowerCase().includes(f),K=ct(c.metadata).toLowerCase().includes(f);if(!x&&!_&&!K)return!1}if(i.length>0&&!i.includes(c.action)||m.length>0&&(!c.by||!m.includes(c.by)))return!1;if(g&&g!=="all"){let f=J(c.timestamp);if(!f)return!1;let x=f.toMillis(),_=0;switch(g){case"1h":_=s-3600*1e3;break;case"24h":_=s-1440*60*1e3;break;case"7d":_=s-10080*60*1e3;break;case"30d":_=s-720*60*60*1e3;break}if(x<_)return!1}return!0})},[l,n,i,m,g]),$=e.compact?1:Math.ceil(u.length/S),y=A(()=>{if(e.compact)return u;let s=(h-1)*S;return u.slice(s,s+S)},[u,h,e.compact]);return v(()=>{T(1)},[n,i,m,g]),R?t("div",{className:`ActionsLog ActionsLog--loading ${e.className||""}`,children:t(N,{color:"gray",size:"xl"})}):t("div",{className:`ActionsLog ${e.className||""}`,children:[!e.compact&&t("div",{className:"ActionsLog__tableHeader",children:[t("div",{className:"ActionsLog__filters",children:[t(j,{className:"ActionsLog__filters__search",placeholder:"Search actions...",icon:t(U,{size:16}),value:a,onChange:s=>o(s.target.value)}),t(I,{className:"ActionsLog__filters__select",placeholder:"Filter by action",clearable:!0,searchable:!0,data:X,value:i,onChange:r}),t(I,{className:"ActionsLog__filters__select",placeholder:"Filter by user",clearable:!0,searchable:!0,data:Z,value:m,onChange:q}),t(E,{className:"ActionsLog__filters__select",placeholder:"Filter by time",data:tt,value:g,onChange:G})]}),t("div",{className:"ActionsLog__summary",children:["Showing ",y.length," of ",u.length," ","actions",u.length!==l.length&&` (filtered from ${l.length} total)`]})]}),t(H,{className:"ActionsLog__tableSurface",children:t(F,{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:[y.map((s,c)=>t("tr",{className:"ActionsLogs__table__row",children:[t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:V(s.timestamp)}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--nowrap",children:t("span",{className:"ActionsLogs__user",children:s.by?t(z,{children:[t(k,{email:s.by,size:20}),t("span",{className:"ActionsLogs__user__email",children:s.by})]}):"\u2014"})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--action",children:t("span",{className:"ActionsLogs__action",children:s.action})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--metadata",children:t(W,{metadata:s.metadata})}),t("td",{className:"ActionsLogs__table__col ActionsLogs__table__col--links",children:t(P,{action:s})})]},c)),y.length===0&&t("tr",{children:t("td",{colSpan:5,className:"ActionsLogs__table__col ActionsLogs__table__col--empty",children:"No actions found matching your filters."})})]})]})}),!e.compact&&$>1&&t("div",{className:"ActionsLog__pagination",children:t(O,{total:$,value:h,onChange:T,size:"sm"})})]})}function W(e){let{metadata:a}=e;if(!a||Object.keys(a).length===0)return t("span",{className:"ActionsLogs__metadata--empty",children:"\u2014"});let o=Object.entries(a);return t("div",{className:"ActionsLogs__metadata",children:o.map(([n,i])=>t("div",{className:"ActionsLogs__metadata__item",children:[t("span",{className:"ActionsLogs__metadata__key",children:[n,":"]})," ",t("span",{className:"ActionsLogs__metadata__value",children:et(i)})]},n))})}function et(e){if(e==null)return"\u2014";if(Array.isArray(e))return e.length===0?"[]":e.length<=3?e.join(", "):`${e.slice(0,3).join(", ")} (+${e.length-3} more)`;if(typeof e=="object"){let a=at(e);try{return JSON.stringify(a)}catch(o){console.error(o),console.error("failed to stringify json:",a)}}return String(e)}function at(e){let a={};return Object.entries(e).forEach(([o,n])=>{o.startsWith("_")||(a[o]=n)}),a}function P(e){let{action:a}=e,o=[];function n(i){return e.label||i}return a.action!=="doc.delete"&&a.metadata?.docId&&o.push(t(L,{transition:"pop",label:a.metadata.docId,children:t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/content/${a.metadata.docId}`,children:n("Open doc")})},"doc")),a.action!=="datasource.delete"&&a.metadata?.datasourceId&&o.push(t(L,{transition:"pop",label:a.metadata.datasourceId,children:t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/data/${a.metadata.datasourceId}`,children:n("Open data source")})},"datasource")),a.action!=="release.delete"&&a.metadata?.releaseId&&o.push(t(L,{transition:"pop",label:a.metadata.releaseId,children:t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${a.metadata.releaseId}`,children:n("Open release")})},"release")),a.metadata?.sheetId&&o.push(t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:B(a.metadata.sheetId),target:"_blank",children:n("Open sheet")},"sheet")),a.action.startsWith("acls.")&&o.push(t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:"/cms/settings",children:n("Open settings")},"settings")),a.links&&a.links.forEach((i,r)=>{o.push(t(p,{component:"a",variant:"default",size:"xs",compact:!0,href:i.url,target:i.target,children:i.label},`link-${r}`))}),o.length===0?t("span",{className:"ActionsLogs__links--empty"}):(e.limit&&(o=o.slice(0,e.limit)),t("div",{className:"ActionsLogs__table__buttons",children:o}))}function ot(e){let{actions:a,loading:o}=Q(e.limit||10);return o?t("div",{className:C(e.className,"ActionLogsCompact","ActionLogsCompact--loading"),children:t(N,{color:"gray",size:"xl"})}):t("div",{className:C(e.className,"ActionLogsCompact"),children:t(w,{className:"ActionLogsCompact__table",multiple:!0,children:a.map((n,i)=>t(w.Item,{label:t(nt,{action:n}),children:t(st,{action:n})},i))})})}function nt(e){let a=e.action,o=it(a),n=e.action.by||"";return t("div",{className:"ActionLogsCompactItemPreview",children:[t("div",{className:"ActionLogsCompactItemPreview__user",children:t(k,{email:n,size:20})}),t("div",{className:"ActionLogsCompactItemPreview__timestamp",children:V(a.timestamp)}),t("div",{className:"ActionLogsCompactItemPreview__action",children:a.action}),t("div",{className:"ActionLogsCompactItemPreview__actionMetaId",children:o}),t("div",{className:"ActionLogsCompactItemPreview__buttons",children:t(P,{action:a,label:"Open",limit:1})})]})}function st(e){let a=e.action,o={user:a.by,...a.metadata};return t("div",{className:"ActionLogsCompactItemDetails",children:[t(W,{metadata:o}),t(P,{action:a})]})}function it(e){for(let a of Object.keys(e.metadata||{}))if(a.toLowerCase().endsWith("id"))return e.metadata[a];return""}function J(e){return e?e instanceof b?e:typeof e=="object"&&typeof e._seconds=="number"?new b(e._seconds,e._nanoseconds||0):typeof e=="object"&&typeof e.seconds=="number"?new b(e.seconds,e.nanoseconds||0):typeof e=="number"?b.fromMillis(e):null:null}function V(e){let a=J(e);if(!a)return"Invalid date";let o=a.toDate(),n=String(o.getMonth()+1).padStart(2,"0"),i=String(o.getDate()).padStart(2,"0"),r=String(o.getHours()).padStart(2,"0"),m=String(o.getMinutes()).padStart(2,"0");return`${n}/${i} ${r}:${m}`}function ct(e){function a(o){return o===null?"null":typeof o>"u"?"undefined":typeof o=="string"?`"${o.replaceAll('"','\\"')}"`:typeof o!="object"?String(o):Array.isArray(o)?`[${o.map(a).join(", ")}]`:`{${Object.entries(o).map(([i,r])=>`${i}: ${a(r)}`).join(", ")}}`}return a(e)}export{xt as a};