@blinkk/root-cms 3.1.3 → 3.1.5

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 (147) hide show
  1. package/dist/app.js +3 -5
  2. package/dist/{chunk-4VZTYUQ7.js → chunk-6CTCV2PN.js} +192 -14
  3. package/dist/{chunk-AFBSITEO.js → chunk-ETHWZSNM.js} +4 -0
  4. package/dist/chunk-MUXSUGFF.js +764 -0
  5. package/dist/cli.js +1 -1
  6. package/dist/client.js +1 -1
  7. package/dist/core/ai-tools.d.ts +82 -42
  8. package/dist/core/ai.d.ts +54 -218
  9. package/dist/core/plugin.d.ts +10 -4
  10. package/dist/core/schema.d.ts +88 -3
  11. package/dist/core.js +1 -1
  12. package/dist/functions.js +2 -3
  13. package/dist/plugin.js +43 -209
  14. package/dist/shared/ai/models.d.ts +110 -0
  15. package/dist/shared/ai/prompt-utils.d.ts +59 -0
  16. package/dist/ui/AIPage-25WICIOT.js +1 -0
  17. package/dist/ui/AssetsPage-WKTM2J2G.js +1 -0
  18. package/dist/ui/CollectionPage-5ZOVG7IG.js +1 -0
  19. package/dist/ui/ComparePage-DDIFYYTK.js +1 -0
  20. package/dist/ui/DataPage-RFNGSDDN.js +1 -0
  21. package/dist/ui/DataSourcePage-U46CDIH2.js +1 -0
  22. package/dist/ui/DocTranslationsPage-BFCM2PE3.js +1 -0
  23. package/dist/ui/DocumentPage-OTBXM55S.js +1 -0
  24. package/dist/ui/EditDataSourcePage-NKKIF6AD.js +1 -0
  25. package/dist/ui/EditReleasePage-TKNOUT7A.js +1 -0
  26. package/dist/ui/EmbeddedAIPage-4AX7VO3T.js +1 -0
  27. package/dist/ui/EmbeddedDocumentPage-2CNQJTW5.js +1 -0
  28. package/dist/ui/{ImageEditorDialog-GGS4VFEA.js → ImageEditorDialog-YDKOGVJV.js} +1 -1
  29. package/dist/ui/LogsPage-SCECIAZH.js +1 -0
  30. package/dist/ui/NewDataSourcePage-FAOPK2RZ.js +1 -0
  31. package/dist/ui/NewReleasePage-HD6T6UV2.js +1 -0
  32. package/dist/ui/{NotFoundPage-WXEZQZK6.js → NotFoundPage-JRYFUENW.js} +1 -1
  33. package/dist/ui/ProjectPage-2WIMWCSX.js +1 -0
  34. package/dist/ui/ReleasePage-GUMEMLF6.js +1 -0
  35. package/dist/ui/ReleasesPage-AW6PICTQ.js +1 -0
  36. package/dist/ui/SettingsPage-KFLNZ356.js +1 -0
  37. package/dist/ui/{SidebarToolsPage-API53RRR.js → SidebarToolsPage-3R7BQ2F7.js} +1 -1
  38. package/dist/ui/TaskPage-GZGPKIL5.js +1 -0
  39. package/dist/ui/TasksPage-G3GBTV3L.js +1 -0
  40. package/dist/ui/TranslationsArbPage-K272JEAA.js +2 -0
  41. package/dist/ui/TranslationsEditPage-XWXPNKRQ.js +1 -0
  42. package/dist/ui/{TranslationsPage-NGGZB4L6.js → TranslationsPage-7KUHVTLK.js} +1 -1
  43. package/dist/ui/ai-tools-7S4URTMT.js +1 -0
  44. package/dist/ui/{chunk-TVYAZN2Q.js → chunk-2FQMT5AB.js} +1 -1
  45. package/dist/ui/{chunk-J5E457OI.js → chunk-2PTLQRTU.js} +1 -1
  46. package/dist/ui/{chunk-UPDL6UXI.js → chunk-2RRM4HEQ.js} +1 -1
  47. package/dist/ui/{chunk-WYJJZTCI.js → chunk-34W6H4YG.js} +1 -1
  48. package/dist/ui/{chunk-4FGASIIX.js → chunk-44ZU5WMI.js} +1 -1
  49. package/dist/ui/{chunk-3E6CASIN.js → chunk-535JU7FU.js} +1 -1
  50. package/dist/ui/chunk-5KSGCGYY.js +1 -0
  51. package/dist/ui/{chunk-ZMS6NIGG.js → chunk-75NMQ3LW.js} +1 -1
  52. package/dist/ui/{chunk-Y3MCFLQU.js → chunk-7UHZS56B.js} +57 -57
  53. package/dist/ui/chunk-AAR7DBEN.js +110 -0
  54. package/dist/ui/{chunk-JS6TK4OP.js → chunk-ATTW36EM.js} +1 -1
  55. package/dist/ui/{chunk-DIFPCF7I.js → chunk-DWV5J2W7.js} +1 -1
  56. package/dist/ui/chunk-DZYYWCHX.js +3 -0
  57. package/dist/ui/chunk-F7RQT4XN.js +1 -0
  58. package/dist/ui/chunk-FVWSVOOY.js +1 -0
  59. package/dist/ui/chunk-GCSN3YEC.js +31 -0
  60. package/dist/ui/{chunk-CAY5NM4Z.js → chunk-H37RXS4R.js} +1 -1
  61. package/dist/ui/{chunk-JTIQBW33.js → chunk-HV3JJ5UT.js} +1 -1
  62. package/dist/ui/{chunk-MSYTAJBV.js → chunk-HXSB6YB2.js} +1 -1
  63. package/dist/ui/chunk-IGZDFHVM.js +1 -0
  64. package/dist/ui/chunk-ISUGBMXC.js +1 -0
  65. package/dist/ui/{chunk-G5ZZDHWA.js → chunk-JBLSUM6W.js} +1 -1
  66. package/dist/ui/{chunk-T77VOWHP.js → chunk-N5RJIILP.js} +1 -1
  67. package/dist/ui/{chunk-BW2MKGNP.js → chunk-NCZD5IWS.js} +1 -1
  68. package/dist/ui/chunk-NXWYS4HG.js +19 -0
  69. package/dist/ui/{chunk-FXIR2RBE.js → chunk-OWBT6YUM.js} +1 -1
  70. package/dist/ui/chunk-OWYV43BT.js +1 -0
  71. package/dist/ui/{chunk-QHJOTXYB.js → chunk-PIJ3E47R.js} +1 -1
  72. package/dist/ui/{chunk-ENQKSLGJ.js → chunk-PLYSJ7W5.js} +1 -1
  73. package/dist/ui/{chunk-FJLNXXE3.js → chunk-QFDU6FXP.js} +1 -1
  74. package/dist/ui/{chunk-P2Z66DHV.js → chunk-QLIIVG5Q.js} +1 -1
  75. package/dist/ui/{chunk-HARRKJFZ.js → chunk-QRAFYIAW.js} +1 -1
  76. package/dist/ui/{chunk-2EPQJUGM.js → chunk-QWB6MAPJ.js} +1 -1
  77. package/dist/ui/{chunk-W6LP22IK.js → chunk-RB23LLKL.js} +1 -1
  78. package/dist/ui/chunk-RN4XVVWD.js +1 -0
  79. package/dist/ui/{chunk-BOER3EAW.js → chunk-SYDHFYRC.js} +1 -1
  80. package/dist/ui/{chunk-NSI5JSVV.js → chunk-T5BJNOWE.js} +1 -1
  81. package/dist/ui/chunk-TNW2GNUR.js +1 -0
  82. package/dist/ui/{chunk-WFQU7V3W.js → chunk-UCYWQEAS.js} +1 -1
  83. package/dist/ui/{chunk-GT5EQSEX.js → chunk-UJX25CXD.js} +1 -1
  84. package/dist/ui/chunk-UPN3EMUS.js +1 -0
  85. package/dist/ui/{chunk-NJMNOITA.js → chunk-VPZHG7JL.js} +1 -1
  86. package/dist/ui/{chunk-BUNR5EU3.js → chunk-WASID5UU.js} +1 -1
  87. package/dist/ui/chunk-WC7KMPEQ.js +1 -0
  88. package/dist/ui/chunk-WRA24P66.js +7 -0
  89. package/dist/ui/{chunk-LROR6N3B.js.LEGAL.txt → chunk-WRA24P66.js.LEGAL.txt} +5 -1
  90. package/dist/ui/chunk-XACLTYBB.js +5 -0
  91. package/dist/ui/{chunk-VD6G5NV4.js → chunk-XOWWPE7X.js} +12 -12
  92. package/dist/ui/chunk-XUBZH4ON.js +1 -0
  93. package/dist/ui/{chunk-QF3GPZTI.js → chunk-Y5EOMMNI.js} +1 -1
  94. package/dist/ui/{chunk-NSOTG64N.js → chunk-YBHFGQ3Z.js} +1 -1
  95. package/dist/ui/chunk-YP6ZH3MT.js +1 -0
  96. package/dist/ui/{chunk-UUVAD4U4.js → chunk-Z3ZJJWFT.js} +1 -1
  97. package/dist/ui/ui.css +1 -1
  98. package/dist/ui/ui.js +1 -1
  99. package/package.json +3 -3
  100. package/dist/chunk-4G7S2LJH.js +0 -1411
  101. package/dist/chunk-AJDMNTZQ.js +0 -187
  102. package/dist/ui/AIPage-VOTAEVJE.js +0 -1
  103. package/dist/ui/AssetsPage-EWGRMRPJ.js +0 -1
  104. package/dist/ui/CollectionPage-N5JIAUDS.js +0 -1
  105. package/dist/ui/ComparePage-JDPVU2VA.js +0 -1
  106. package/dist/ui/DataPage-37D4CMLZ.js +0 -1
  107. package/dist/ui/DataSourcePage-LX5ASYQN.js +0 -1
  108. package/dist/ui/DocTranslationsPage-V5M4KB7X.js +0 -1
  109. package/dist/ui/DocumentPage-SURTQJPG.js +0 -1
  110. package/dist/ui/EditDataSourcePage-O7DOV5LX.js +0 -1
  111. package/dist/ui/EditReleasePage-NDYTKGXY.js +0 -1
  112. package/dist/ui/EmbeddedAIPage-RJOUIPF2.js +0 -1
  113. package/dist/ui/EmbeddedDocumentPage-SLEULNNI.js +0 -1
  114. package/dist/ui/LogsPage-ZGBP3I35.js +0 -1
  115. package/dist/ui/NewDataSourcePage-GQONTMP4.js +0 -1
  116. package/dist/ui/NewReleasePage-7ZKXHDTD.js +0 -1
  117. package/dist/ui/ProjectPage-F7W7X6YO.js +0 -1
  118. package/dist/ui/ReleasePage-ZKMNYPML.js +0 -1
  119. package/dist/ui/ReleasesPage-JHCE6AEJ.js +0 -1
  120. package/dist/ui/SettingsPage-MWCPZPGE.js +0 -1
  121. package/dist/ui/TaskPage-73NLAR4J.js +0 -1
  122. package/dist/ui/TasksPage-IKPW2OQO.js +0 -1
  123. package/dist/ui/TranslationsArbPage-QVN66DIW.js +0 -2
  124. package/dist/ui/TranslationsEditPage-ZOELF5PK.js +0 -1
  125. package/dist/ui/ai-tools-4DWMFQS6.js +0 -1
  126. package/dist/ui/chunk-2RAVKX2Z.js +0 -19
  127. package/dist/ui/chunk-344GZOGG.js +0 -84
  128. package/dist/ui/chunk-4ISFTE2G.js +0 -5
  129. package/dist/ui/chunk-BT2NTAW2.js +0 -1
  130. package/dist/ui/chunk-C2BLMTPR.js +0 -3
  131. package/dist/ui/chunk-D3UIZHRK.js +0 -1
  132. package/dist/ui/chunk-DS27MO63.js +0 -1
  133. package/dist/ui/chunk-HO3W4RVG.js +0 -1
  134. package/dist/ui/chunk-IOR72US3.js +0 -1
  135. package/dist/ui/chunk-KRNQ6L35.js +0 -1
  136. package/dist/ui/chunk-LROR6N3B.js +0 -7
  137. package/dist/ui/chunk-N3JSLTMV.js +0 -1
  138. package/dist/ui/chunk-PPYM4O5N.js +0 -1
  139. package/dist/ui/chunk-TOGLZDK3.js +0 -1
  140. package/dist/ui/chunk-TPJCPCRR.js +0 -1
  141. package/dist/ui/chunk-VPHBKJ3I.js +0 -1
  142. package/dist/ui/chunk-YUU6LWQK.js +0 -1
  143. package/dist/ui/chunk-Z6DBYLIM.js +0 -1
  144. /package/dist/ui/{ImageEditorDialog-GGS4VFEA.js.LEGAL.txt → ImageEditorDialog-YDKOGVJV.js.LEGAL.txt} +0 -0
  145. /package/dist/ui/{chunk-Y3MCFLQU.js.LEGAL.txt → chunk-7UHZS56B.js.LEGAL.txt} +0 -0
  146. /package/dist/ui/{chunk-NJMNOITA.js.LEGAL.txt → chunk-VPZHG7JL.js.LEGAL.txt} +0 -0
  147. /package/dist/ui/{chunk-VD6G5NV4.js.LEGAL.txt → chunk-XOWWPE7X.js.LEGAL.txt} +0 -0
@@ -0,0 +1 @@
1
+ import{d as qe,j as Je,k as Ye,l as G,n as Ge,o as Qe,p as Ze,q as et,s as tt}from"./chunk-7UHZS56B.js";import"./chunk-UCYWQEAS.js";import"./chunk-DWV5J2W7.js";import"./chunk-T5BJNOWE.js";import"./chunk-34W6H4YG.js";import"./chunk-SYDHFYRC.js";import"./chunk-535JU7FU.js";import"./chunk-FBSBL476.js";import{a as nt}from"./chunk-NXWYS4HG.js";import"./chunk-GCSN3YEC.js";import"./chunk-QWB6MAPJ.js";import{c as Ue}from"./chunk-VPZHG7JL.js";import"./chunk-AAR7DBEN.js";import{b as it}from"./chunk-RB23LLKL.js";import"./chunk-JBLSUM6W.js";import"./chunk-2RRM4HEQ.js";import"./chunk-HXSB6YB2.js";import"./chunk-N5RJIILP.js";import{b as je,c as ce,g as Xe}from"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import{a as T}from"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import{a as fe}from"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{b as He}from"./chunk-W5DOO6ID.js";import{a as $e}from"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as at}from"./chunk-QLIIVG5Q.js";import{c as ot}from"./chunk-OWBT6YUM.js";import{a as Ke}from"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{e as E}from"./chunk-WASID5UU.js";import{$a as Ne,$b as Ae,$c as We,Fa as R,Ga as e,Gc as Ve,Ia as Se,Oa as ye,P as ke,Qa as ie,Sa as Ie,W as N,Wa as Ee,_b as Be,a as I,ad as re,ba as De,c as b,da as Y,e as w,g as z,h as D,j as ae,nb as Te,tb as Re,ub as Le,vb as Me,vc as Oe,wb as ze,za as Ce,zc as Fe}from"./chunk-WRA24P66.js";import{d as W,j as be,k as ft}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";ae();ae();async function rt(t,o){let a=await(await fetch("/cms/api/check.test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({check:t,docId:o})})).json();if(!a.success)throw new Error(a.error||"Check failed.");return a.data}function ct(t){let o=window.__ROOT_CTX.checks||[],n=t.docId.split("/")[0],a=o.filter(l=>!l.collections||l.collections.includes(n)),[i,c]=I({}),d=D(async l=>{c(h=>({...h,[l]:{loading:!0}}));try{let h=await rt(l,t.docId);c(_=>({..._,[l]:{loading:!1,result:h}}))}catch(h){c(_=>({..._,[l]:{loading:!1,error:h.message||"Unknown error."}}))}},[t.docId]),u=D(async()=>{let l={};for(let h of a)l[h.id]={loading:!0};c(l);for(let h of a)try{let _=await rt(h.id,t.docId);c(f=>({...f,[h.id]:{loading:!1,result:_}}))}catch(_){c(f=>({...f,[h.id]:{loading:!1,error:_.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(Y,{variant:"default",size:"xs",compact:!0,leftIcon:e(Oe,{size:12}),onClick:u,children:"Run All"})]}),e("div",{className:"ChecksPanel__body",children:e("div",{className:"ChecksPanel__checks",children:a.map(l=>{let h=i[l.id];return e(vt,{check:l,state:h,onRun:()=>d(l.id)},l.id)})})})]})}function vt(t){let{check:o,state:n,onRun:a}=t;return e("div",{className:"ChecksPanel__check",children:[e("div",{className:"ChecksPanel__check__header",children:[e("div",{className:"ChecksPanel__check__label",children:[o.label,n?.result&&e(xt,{status:n.result.status})]}),e(Y,{className:"ChecksPanel__check__runButton",variant:"default",size:"xs",compact:!0,loading:n?.loading,onClick:a,children:"Run"})]}),o.description&&e("div",{className:"ChecksPanel__check__description",children:o.description}),n?.result&&e("div",{className:E("ChecksPanel__check__result",`ChecksPanel__check__result--${n.result.status}`),children:e(Ue,{code:n.result.message})}),n?.error&&e("div",{className:"ChecksPanel__check__error",children:n.error})]})}var Pt={success:"green",warning:"yellow",error:"red"},wt={success:Ne,warning:Se,error:re};function xt(t){let o=Pt[t.status],n=wt[t.status],a=t.status.charAt(0).toUpperCase()+t.status.slice(1);return e(De,{className:"ChecksPanel__statusBadge",color:o,size:"sm",variant:"filled",leftSection:e(n,{size:10}),children:a})}function st(t){let{devices:o,multiSelect:n,expandVertically:a,iframeUrl:i,localeOptions:c,selectedLocale:d,onToggleDevice:u,onToggleMultiSelect:l,onToggleExpandVertically:h,onReloadClick:_,onOpenNewTab:f,onLocaleChange:C}=t,g=o.length>0;return e("div",{className:"DocumentPagePreviewBar",children:[e("div",{className:"DocumentPagePreviewBar__devices",children:[e(R,{label:"Mobile",children:e(N,{className:E("DocumentPagePreviewBar__device",o.includes("mobile")&&"active"),"aria-pressed":o.includes("mobile"),onClick:()=>u("mobile"),children:e(ze,{size:16})})}),e(R,{label:"Tablet",children:e(N,{className:E("DocumentPagePreviewBar__device",o.includes("tablet")&&"active"),"aria-pressed":o.includes("tablet"),onClick:()=>u("tablet"),children:e(Me,{size:16})})}),e(R,{label:"Desktop",children:e(N,{className:E("DocumentPagePreviewBar__device",o.includes("desktop")&&"active"),"aria-pressed":o.includes("desktop"),onClick:()=>u("desktop"),children:e(Re,{size:16})})}),e("div",{className:"DocumentPagePreviewBar__divider"}),e(R,{label:"Compare viewports",children:e(N,{className:E("DocumentPagePreviewBar__device",n&&"active"),role:"checkbox","aria-checked":n,onClick:l,children:e(Te,{size:16})})}),e(R,{label:"Expand",children:e(N,{className:E("DocumentPagePreviewBar__device",a&&"active"),"aria-pressed":a,disabled:!g,onClick:h,children:e(Ie,{size:16})})})]}),e("div",{className:"DocumentPagePreviewBar__navbar",children:e("div",{className:"DocumentPagePreviewBar__navbar__url",children:i})}),e("div",{className:"DocumentPagePreviewBar__locales",children:e(Ce,{data:c,placeholder:"Locale",radius:"xl",size:"xs",required:!0,icon:e(We,{size:16,strokeWidth:1.5}),value:d,onChange:v=>{C(v)}})}),e("div",{className:"DocumentPagePreviewBar__buttons",children:[e(R,{label:"Reload",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--reload",onClick:_,children:e(Fe,{size:16})})}),e(R,{label:"Open new tab",children:e(N,{className:"DocumentPagePreviewBar__button DocumentPagePreviewBar__button--openNewTab",onClick:f,children:e(ie,{size:16})})})]})]})}ae();function lt(t){let o=t.docId.split("/")[0],n=Xe(o),a=G(),i=w(null),[c,d]=I(""),[u,l]=I([]),[h,_]=I(!1),f=w("");f.current=c;let C=w(n.schema?.fields||[]);C.current=n.schema?.fields||[];let g=w(n.schema?.types||{});g.current=n.schema?.types||{};let v=z(()=>Je(p=>{let k=p.trim();if(!k){l([]),_(!1);return}let y=a.controller?.getData()?.fields||{},L=et(k,y,C.current,g.current);l(L),_(!0)},150),[a.controller]);b(()=>{v(c)},[c,v]),Ge(()=>{f.current.trim()&&v(f.current)}),b(()=>{t.autoFocus&&requestAnimationFrame(()=>{i.current?.focus(),i.current?.select()})},[t.autoFocus]),b(()=>{let p=()=>{i.current?.focus(),i.current?.select()};return window.addEventListener("root:focus-search",p),()=>window.removeEventListener("root:focus-search",p)},[]);let P=p=>{Dt(p)};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(re,{size:14})})]}),e("div",{className:"SearchPanel__searchInput",children:[e("span",{className:"SearchPanel__searchInput__icon",children:e(Ve,{size:14})}),e("input",{ref:i,type:"text",className:"SearchPanel__searchInput__input",value:c,onInput:p=>d(p.currentTarget.value),onKeyDown:p=>{p.key==="Escape"&&t.onClose&&(p.preventDefault(),t.onClose())},placeholder:"Search field values\u2026",autoComplete:"off",spellcheck:!1})]}),e("div",{className:"SearchPanel__body",children:[!h&&!c.trim()&&e("div",{className:"SearchPanel__empty",children:"Type a query above to search field values in this document."}),h&&u.length===0&&e("div",{className:"SearchPanel__empty",children:["No matches for ",e("strong",{children:c}),"."]}),u.length>0&&e(W,{children:[e("div",{className:"SearchPanel__resultsCount",children:[u.length," ",u.length===1?"match":"matches"]}),e("ul",{className:"SearchPanel__results",children:u.map((p,k)=>e(bt,{result:p,onClick:()=>P(p)},`${p.deepKey}:${k}`))})]})]})]})}function bt(t){let{result:o}=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:o.label}),e("div",{className:"SearchPanel__result__snippet",children:kt(o.snippet,o.matches)}),e("div",{className:"SearchPanel__result__meta",children:[e("span",{className:"SearchPanel__result__type",children:o.fieldType}),o.richTextBlock&&e("span",{className:"SearchPanel__result__badge",children:"in block"}),o.richTextInline&&e("span",{className:"SearchPanel__result__badge",children:"inline"})]})]})})}function kt(t,o){if(!o||o.length===0)return t;let n=[],a=0;for(let i of o)i.start>a&&n.push({text:t.slice(a,i.start),match:!1}),n.push({text:t.slice(i.start,i.end),match:!0}),a=i.end;return a<t.length&&n.push({text:t.slice(a),match:!1}),n.map((i,c)=>i.match?e("mark",{children:i.text},c):e("span",{children:i.text},c))}function Dt(t){if(window.postMessage({scrollToDeeplink:{deepKey:t.deepKey}},"*"),t.richTextBlock){let o=t.richTextBlock;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Qe,{detail:o}))},350)}else if(t.richTextInline){let o=t.richTextInline;setTimeout(()=>{window.dispatchEvent(new CustomEvent(Ze,{detail:o}))},350)}}ft();ae();var Ct=be(null);function Q(t){let{className:o,localStorageId:n,children:a}=t,[i,c]=T(`root::SplitPanel:${n}`,350),[d,u]=I(!1),[l,h]=I(0),_=z(()=>new Set,[]),f=w(null),C=w(null),g={onResize:P=>(_.add(P),()=>{_.delete(P)})};if(b(()=>{let P=()=>u(!1);window.addEventListener("mouseup",P);let p=f.current;return p&&h(p.getBoundingClientRect().left),()=>window.removeEventListener("mouseup",P)},[]),b(()=>{let P=p=>{let k=p.clientX-l;c(k),_.forEach(y=>y())};return d&&window.addEventListener("mousemove",P),()=>window.removeEventListener("mousemove",P)},[d]),a?.length!==2)throw new Error("SplitPanel should have two <SplitPanel.Item> children.");let v={"--panel-size":`${i}px`};return e(Ct.Provider,{value:g,children:e("div",{className:E(o,"SplitPanel",d&&"dragging"),ref:f,style:v,children:[a[0],e("div",{className:"SplitPanel__divider",ref:C,onMouseDown:()=>u(!0)}),a[1]]})})}Q.Item=t=>e("div",{className:E("SplitPanel__item",t.className,t.fluid?"fluid":"static"),children:t.children});function ve(t,o,n=""){let a=ce({collectionId:t,slug:o}),i=new URLSearchParams(window.location.search);i.set("preview","true"),i.delete("locale"),i.delete("modal");let c=`${i.toString()}${window.location.hash}`;return n?`${ce({collectionId:t,slug:o,locale:n})}?${c}`:`${a}?${c}`}function St(t,o){let n=new URL(o,window.location.origin);try{let a=t.contentWindow?.location.href;if(a&&!a.startsWith("about:blank")){let i=new URL(a);i.origin===n.origin&&i.pathname===n.pathname&&(i.searchParams.forEach((c,d)=>{n.searchParams.set(d,c)}),n.hash=i.hash)}}catch{}return n.searchParams.set("preview","true"),n.toString()}function dt(t){let o=t.collection,n=t.slug,a=`${o}/${n}`,{roles:i}=$e(),c=window.firebase.user.email||"",d=He(i,c);return e(Ye,{docId:a,readOnly:!d,children:e(yt,{...t,canEdit:d})})}function yt(t){let o=t.canEdit,n=t.collection,a=t.slug,i=`${n}/${a}`;at(i);let c=window.__ROOT_CTX.collections[n],d=G(),u=!!c?.url,[l,h]=T(`root::DocumentPage::previewVisible::${n}`,u),_=z(()=>(window.__ROOT_CTX.checks||[]).some(x=>!x.collections||x.collections.includes(n)),[n]),[f,C]=T("root::DocumentPage::checksVisible",!1),g=w(f);g.current=f;let[v,P]=T("root::DocumentPage::searchVisible",!1),p=w(v);p.current=v;let k=Ke(),[y,L]=T("root::DocumentPage::aiVisible",!1),X=w(y);X.current=y,b(()=>{window.dispatchEvent(new CustomEvent("root:checks-visible",{detail:f}))},[f]),b(()=>{window.dispatchEvent(new CustomEvent("root:search-visible",{detail:v}))},[v]),b(()=>{window.dispatchEvent(new CustomEvent("root:ai-visible",{detail:y}))},[y]);let[A,le]=T("root::DocumentPage::searchPanelWidth",360),[O,q]=I(A),[F,K]=I(!1),Z=w(null);if(b(()=>{let S=()=>{let x=!g.current;C(()=>x),x&&(P(()=>!1),L(()=>!1))};return window.addEventListener("root:toggle-checks",S),()=>window.removeEventListener("root:toggle-checks",S)},[]),b(()=>{let S=()=>{let x=!p.current;P(()=>x),x&&(C(()=>!1),L(()=>!1),requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("root:focus-search"))}))};return window.addEventListener("root:toggle-search",S),()=>window.removeEventListener("root:toggle-search",S)},[]),b(()=>{let S=()=>{let x=!X.current;L(()=>x),x&&(C(()=>!1),P(()=>!1))};return window.addEventListener("root:toggle-ai",S),()=>window.removeEventListener("root:toggle-ai",S)},[]),b(()=>{if(!F)return;let S=H=>{let oe=Z.current;if(!oe)return;let pe=oe.getBoundingClientRect(),J=Math.max(240,Math.min(pe.right-H.clientX,800));q(J)},x=()=>{K(!1),q(H=>(le(()=>H),H))};return window.addEventListener("mousemove",S),window.addEventListener("mouseup",x),()=>{window.removeEventListener("mousemove",S),window.removeEventListener("mouseup",x)}},[F]),!c)return e("div",{children:"Could not find collection."});let ee=D(()=>{if(!u)return;let S=ve(n,a),x=window.open(S,"_blank","noopener,noreferrer");x&&x.focus()},[u,n,a]),U=D(()=>{o&&d.controller&&d.controller.flush()},[o,d.controller]),$=qe(),de=D(()=>{let S=d.controller?.getData()?.fields||{};$.open({data:S,onSave:x=>{d.controller&&x&&typeof x=="object"&&(d.controller.updateKey("fields",x),d.controller.flush()),$.close()}})},[d.controller]),ue=D(()=>{window.dispatchEvent(new CustomEvent("root:toggle-search"))},[]),te=D(()=>{k&&window.dispatchEvent(new CustomEvent("root:toggle-ai"))},[k]),me=D(()=>{L(()=>!1)},[L]);return ke([["mod+S",U],["mod+shift+F",ue],["mod+I",te]]),e(ot,{children:e("div",{className:E("DocumentPage__layout",F&&"DocumentPage__layout--dragging"),ref:Z,children:[e(Q,{className:"DocumentPage",localStorageId:"DocumentPage",children:[e(Q.Item,{className:E("DocumentPage__side",(!u||!l)&&"DocumentPage__side--expanded"),children:[e("div",{className:"DocumentPage__side__header",children:[e("div",{className:"DocumentPage__side__header__nav",children:[e("a",{href:`/cms/content/${n}`,children:e(N,{className:"DocumentPage__side__header__back",children:e(ye,{size:16})})}),e("div",{className:"DocumentPage__side__header__docId",children:i})]}),e("div",{className:"DocumentPage__side__header__buttons",children:[e(fe,{label:"You don't have access to edit this document",condition:!o,children:e(Y,{className:"DocumentPage__side__header__saveButton",variant:"filled",color:"dark",size:"xs",compact:!0,leftIcon:e(Le,{size:16}),onClick:()=>U(),disabled:!o,children:"Save"})}),e(fe,{label:"You don't have access to edit this document",condition:!o,children:e(R,{label:"Edit JSON",disabled:!o,children:e(N,{className:"DocumentPage__side__header__editJson",onClick:()=>de(),disabled:!o,children:e(Ee,{size:14})})})}),u&&e(W,{children:[e(R,{label:l?"Hide preview":"Show preview",children:e(N,{className:"DocumentPage__side__header__previewToggle",onClick:()=>h(!l),children:l?e(Be,{size:16}):e(Ae,{size:16})})}),!l&&e(R,{label:"Open preview in new tab",children:e(N,{className:"DocumentPage__side__header__openNewTab",onClick:ee,children:e(ie,{size:16})})})]})]})]}),e("div",{className:E("DocumentPage__side__editor",(!u||!l)&&!f&&!v&&!y&&"DocumentPage__side__editor--centered"),children:e(tt,{docId:i})})]}),e(Q.Item,{className:E("DocumentPage__main",(!u||!l)&&"DocumentPage__main--hidden"),fluid:!0,children:u&&l&&e(dt.Preview,{docId:i},i)})]}),_&&f&&e(Et,{docId:i}),v&&e(W,{children:[e("div",{className:"DocumentPage__searchDivider",onMouseDown:()=>K(!0)}),e("div",{className:"DocumentPage__search",style:{flexBasis:`${O}px`},children:e(lt,{docId:i,autoFocus:!0,onClose:()=>P(()=>!1)})})]}),k&&y&&e(It,{docId:i,onClose:me})]})})}function It(t){let[o,n]=T("root::DocumentPage::aiPanelWidth",420),[a,i]=I(o),c=w(null),d=w(a),u=w(),l=z(()=>e(nt,{variant:"panel",docContext:{docId:t.docId},onClose:t.onClose}),[t.docId,t.onClose]),h=D(()=>{let _=c.current?.parentElement;if(!_)return;d.current=a,_.classList.add("DocumentPage__layout--dragging");let f=v=>{let P=c.current?.parentElement;if(!P)return;let p=P.getBoundingClientRect(),k=Math.max(280,Math.min(p.right-v.clientX,800));d.current=k,i(k)},C=()=>{_.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",g),u.current=void 0},g=()=>{C(),n(()=>d.current)};u.current=C,window.addEventListener("mousemove",f),window.addEventListener("mouseup",g)},[a,n]);return b(()=>()=>u.current?.(),[]),e(W,{children:[e("div",{className:"DocumentPage__aiDivider",ref:c,onMouseDown:h}),e("div",{className:"DocumentPage__ai",style:{flexBasis:`${a}px`},children:l})]})}function Et(t){let[o,n]=T("root::DocumentPage::checksPanelWidth",360),[a,i]=I(o),c=w(null),d=w(a),u=w(),l=z(()=>e(ct,{docId:t.docId}),[t.docId]),h=D(()=>{let _=c.current?.parentElement;if(!_)return;d.current=a,_.classList.add("DocumentPage__layout--dragging");let f=v=>{let P=c.current?.parentElement;if(!P)return;let p=P.getBoundingClientRect(),k=Math.max(200,Math.min(p.right-v.clientX,800));d.current=k,i(k)},C=()=>{_.classList.remove("DocumentPage__layout--dragging"),window.removeEventListener("mousemove",f),window.removeEventListener("mouseup",g),u.current=void 0},g=()=>{C(),n(()=>d.current)};u.current=C,window.addEventListener("mousemove",f),window.addEventListener("mouseup",g)},[a,n]);return b(()=>()=>u.current?.(),[]),e(W,{children:[e("div",{className:"DocumentPage__checksDivider",ref:c,onMouseDown:h}),e("div",{className:"DocumentPage__checks",style:{flexBasis:`${a}px`},children:l})]})}var se={mobile:[430,932],tablet:[768,1024],desktop:[1440,800]},Pe=["mobile","tablet","desktop"],Nt="root::DocumentPage::preview::devices",Tt="root::DocumentPage::preview::device";function Rt(){try{let t=window.localStorage.getItem(Tt);if(t){let o=JSON.parse(t);if(Pe.includes(o))return[o]}}catch(t){console.error(t)}return[]}function Lt(t){let o=new Intl.DisplayNames(["en"],{type:"language"}),a=t.split("_")[0];return`${o.of(a)||t} (${t})`}dt.Preview=t=>{let o=G();if(o.loading)return null;let[n,a]=t.docId.split("/"),c=window.__ROOT_CTX.collections[n];if(!c)throw new Error(`collection not found: ${n}`);if(!c.url)return null;let d=c.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",u=je({collectionId:n,slug:a}),l=ce({collectionId:n,slug:a}),h=`${d}${u}`,[_,f]=I(h),C=z(Rt,[]),[g,v]=T(Nt,C),[P,p]=T("root::DocumentPage::preview::multiSelect",!1),[k,y]=T("root::DocumentPage::preview::expandVertically",!1),[L,X]=I({scale:1,frameHeight:0}),[A,le]=it("locale",""),O=w(new Map),q=w(new Map),F=w(null),K=w([]),Z=D(r=>{let s=q.current.get(r);return s||(s=m=>{m?O.current.set(r,m):O.current.delete(r)},q.current.set(r,s)),s},[]),ee=o.controller.getLocales()||[],U=ve(n,a,A),$=w(U);$.current=U;let de=z(()=>[{value:"",label:"Select locale"},...ee.map(r=>({value:r,label:Lt(r)}))],[ee]);function ue(r){if(document.hidden)return;let s=St(r,$.current);r.src="about:blank",window.requestAnimationFrame(()=>{r.src!==s?r.src=s:r.contentWindow.location.reload()})}function te(){O.current.forEach(r=>ue(r))}b(()=>{let r=o.controller?.onFlush(()=>{te()});return()=>{r?.()}},[]),b(()=>{O.current.forEach(r=>{r.src=U})},[A]);let me=g.length>0?g.length:1;b(()=>{let r=Array.from(O.current.values());function s(m){let V=m.currentTarget.contentWindow;if(V&&l===u&&!V.location.href.startsWith("about:blank")){let j=V.location;f(`${d}${j.pathname}`)}}return r.forEach(m=>{m.getAttribute("src")||(m.src=$.current),m.addEventListener("load",s)}),()=>{r.forEach(m=>m.removeEventListener("load",s))}},[me]);let S=D(r=>{if(P){v(s=>{if(s.includes(r)){let m=s.filter(M=>M!==r);return m.length===0&&y(!1),m}return Pe.filter(m=>m===r||s.includes(m))});return}v(s=>s.length===1&&s[0]===r?(y(!1),[]):[r])},[P,v,y]),x=D(()=>{p(r=>{let s=!r;return v(s?m=>{if(K.current=m,m.length>=2)return m;let M=m[0]||"desktop",V=M==="desktop"?"mobile":"desktop";return Pe.filter(j=>j===M||j===V)}:()=>K.current),s})},[p,v]),H=D(()=>{g.length!==0&&y(r=>!r)},[g,y]),oe=D(()=>{o.controller&&o.controller.flush().then(()=>te())},[o.controller]),pe=D(()=>{let r=ve(n,a,A),s=window.open(r,"_blank","noopener,noreferrer");s&&s.focus()},[n,a,A]),J=D(()=>{if(g.length===0){X(B=>B.scale===1&&B.frameHeight===0?B:{scale:1,frameHeight:0});return}let r=F.current;if(!r)return;let s=r.getBoundingClientRect(),m=20,M=16,V=28,j=g.length,we=Math.max(s.width-2*m-M*(j-1),0),he=Math.max(s.height-2*m-V,0),_e=0,ne=0;for(let B of g){let[_t,gt]=se[B];_e+=_t,ne=Math.max(ne,gt)}let mt=we>0&&_e>0?we/_e:1,pt=he>0&&ne>0?he/ne:1,ht=Math.min(mt,pt,1),ge=Number(ht.toFixed(4))||1,xe=Math.max(he/ge,0);X(B=>B.scale===ge&&B.frameHeight===xe?B:{scale:ge,frameHeight:xe})},[g]);b(()=>{J();let r=F.current;if(!r)return;let s=0,m=()=>{window.cancelAnimationFrame(s),s=window.requestAnimationFrame(J)},M=new window.ResizeObserver(m);return M.observe(r),window.addEventListener("resize",m),()=>{window.cancelAnimationFrame(s),M.disconnect(),window.removeEventListener("resize",m)}},[J]);let ut=g.length>0?g.map((r,s)=>({slot:s,device:r})):[{slot:0,device:null}];return e("div",{className:"DocumentPage__main__preview",children:[e(st,{devices:g,multiSelect:P,expandVertically:k,iframeUrl:_,localeOptions:de,selectedLocale:A,onToggleDevice:S,onToggleMultiSelect:x,onToggleExpandVertically:H,onReloadClick:oe,onOpenNewTab:pe,onLocaleChange:le}),e("div",{className:"DocumentPage__main__previewFrame","data-device":g.length>0?"device":"full",ref:F,children:e("div",{className:"DocumentPage__main__previewFrame__group",children:ut.map(r=>{let s=r.device,m=s?{"--iframe-width":`${se[s][0]}px`,"--iframe-height":`${k?L.frameHeight:se[s][1]}px`,"--iframe-scale":String(L.scale)}:void 0;return e("div",{className:"DocumentPage__main__previewFrame__item",style:m,children:[e("div",{className:"DocumentPage__main__previewFrame__iframeWrap",children:e("iframe",{ref:Z(r.slot),title:"iframe preview"})}),s&&e("div",{className:"DocumentPage__main__previewFrame__deviceLabel",children:`${s}: ${se[s].join("x")}`})]},r.slot)})})})]})};export{dt as DocumentPage};
@@ -0,0 +1 @@
1
+ import{a as H}from"./chunk-2FQMT5AB.js";import"./chunk-535JU7FU.js";import{a as B}from"./chunk-HXSB6YB2.js";import{a as F}from"./chunk-OWYV43BT.js";import"./chunk-JDW4UORS.js";import{a as _}from"./chunk-UJX25CXD.js";import{c as u,f as A,g as E,j as T,l as z}from"./chunk-RN4XVVWD.js";import{a as w,c as p}from"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import{a as N}from"./chunk-W5DOO6ID.js";import{a as M}from"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import{a as s,b as r}from"./chunk-PIJ3E47R.js";import{a as m}from"./chunk-NCZD5IWS.js";import{a as L}from"./chunk-QLIIVG5Q.js";import{c as O}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import{d as y}from"./chunk-WASID5UU.js";import{Ac as U,Fa as n,Ga as e,La as I,W as l,a as D,c as x,ca as P,dd as $,j as K,lb as k}from"./chunk-WRA24P66.js";import{d as S}from"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";K();function ve(a){L(`Edit Data Source: ${a.id}`);let{route:b}=y(),[v,h]=D(null),i=w(),f=p(),{roles:g}=M(),R=window.firebase.user.email||"",t=N(g,R);x(()=>{u(a.id).then(o=>{h(o)})},[a.id]);function W(){let o=`delete-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Delete data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to delete data source ",e("code",{children:a.id}),"? All previously synced data will be deleted. There is no undo."]}),labels:{confirm:"Delete",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Deleting data source",message:`Deleting ${a.id} and synced data...`,loading:!0,autoClose:!1}),await z(a.id),r({id:o,title:"Deleted data source",message:`Successfully deleted ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b("/cms/data")}})}function Y(){let o=`archive-data-source-${a.id}`,d=!!v?.publishedAt,c=i.openConfirmModal({...f,title:"Archive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive data source ",e("code",{children:a.id}),"? Archived data sources cannot be synced or published.",d&&e(S,{children:[" ","Note: previously published data will remain available until the data source is unpublished."]})]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Archiving data source",message:`Archiving ${a.id}...`,loading:!0,autoClose:!1}),await A(a.id);let J=await u(a.id);h(J),r({id:o,title:"Archived data source",message:`Successfully archived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(c),b("/cms/data")}})}function j(){let o=`unarchive-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unarchive data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive data source ",e("code",{children:a.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unarchiving data source",message:`Unarchiving ${a.id}...`,loading:!0,autoClose:!1}),await E(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unarchived data source",message:`Successfully unarchived ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d),b(`/cms/data/${a.id}`)}})}function q(){let o=`unpublish-data-source-${a.id}`,d=i.openConfirmModal({...f,title:"Unpublish data source",children:e(m,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unpublish data source ",e("code",{children:a.id}),"? The published data will be removed and will no longer be available to production. There is no undo."]}),labels:{confirm:"Unpublish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{s({id:o,title:"Unpublishing data source",message:`Unpublishing ${a.id}...`,loading:!0,autoClose:!1}),await T(a.id);let c=await u(a.id);h(c),r({id:o,title:"Unpublished data source",message:`Successfully unpublished ${a.id}`,loading:!1,autoClose:5e3}),i.closeModal(d)}})}let G=!!v?.publishedAt,C=!!v?.archivedAt;return e(O,{children:e("div",{className:"EditDataSourcePage",children:[e("div",{className:"EditDataSourcePage__header",children:[e(P,{className:"EditDataSourcePage__header__breadcrumbs",children:[e("a",{href:"/cms/data",children:"Data Sources"}),e("a",{href:`/cms/data/${a.id}`,children:a.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditDataSourcePage__header__titleWrap",children:[e(B,{size:"h1",children:["Edit Data Source: ",a.id]}),e("div",{className:"EditDataSourcePage__header__controls",children:[G&&!C&&e(_,{label:"You don't have access to unpublish data sources",condition:!t,children:e(n,{label:"Unpublish",disabled:!t,children:e(l,{onClick:q,loading:!g,disabled:!t,children:e(k,{size:20,stroke:"1.5"})})})}),e(_,{label:"You don't have access to archive data sources",condition:!t,children:C?e(n,{label:"Unarchive",disabled:!t,children:e(l,{onClick:j,loading:!g,disabled:!t,children:e(U,{size:20,stroke:"1.5"})})}):e(n,{label:"Archive",disabled:!t,children:e(l,{onClick:Y,loading:!g,disabled:!t,children:e(I,{size:20,stroke:"1.5"})})})}),e(n,{label:"Delete",children:e(l,{onClick:W,children:e($,{size:20,stroke:"1.5"})})})]})]})]}),e(F,{className:"EditDataSourcePage__form",children:e(H,{dataSourceId:a.id})})]})})}export{ve as EditDataSourcePage};
@@ -0,0 +1 @@
1
+ import{a as U}from"./chunk-IGZDFHVM.js";import"./chunk-WC7KMPEQ.js";import"./chunk-F7RQT4XN.js";import"./chunk-DWV5J2W7.js";import{a as z}from"./chunk-HXSB6YB2.js";import{a as N}from"./chunk-OWYV43BT.js";import"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import{d as s,f as E,g as w}from"./chunk-FVWSVOOY.js";import"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import{a as I}from"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import{a as x,c as C}from"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{a as T}from"./chunk-W5DOO6ID.js";import{a as A}from"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import{a as h,b as f}from"./chunk-PIJ3E47R.js";import{a as g}from"./chunk-NCZD5IWS.js";import{a as $}from"./chunk-QLIIVG5Q.js";import{c as k}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{d as P}from"./chunk-WASID5UU.js";import{Ac as y,Fa as m,Ga as e,La as p,W as c,a as v,c as R,ca as b,j as H}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";H();function de(a){$(`Edit Release: ${a.id}`);let{route:u}=P(),[M,t]=v(null),l=x(),_=C(),{roles:d}=A(),S=window.firebase.user.email||"",o=T(d,S);R(()=>{s(a.id).then(i=>{t(i)})},[a.id]);function L(){let i=`archive-release-${a.id}`,r=l.openConfirmModal({..._,title:"Archive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to archive release ",e("code",{children:a.id}),"?"]}),labels:{confirm:"Archive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"red",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:i,title:"Archiving release",message:`Archiving ${a.id}...`,loading:!0,autoClose:!1}),await E(a.id);let n=await s(a.id);t(n),f({id:i,title:"Archived release",message:`Successfully archived ${a.id}`,loading:!1,autoClose:5e3}),l.closeModal(r),u("/cms/releases")}})}function B(){let i=`unarchive-release-${a.id}`,r=l.openConfirmModal({..._,title:"Unarchive release",children:e(g,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to unarchive release ",e("code",{children:a.id}),"?"]}),labels:{confirm:"Unarchive",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!1,onConfirm:async()=>{h({id:i,title:"Unarchiving release",message:`Unarchiving ${a.id}...`,loading:!0,autoClose:!1}),await w(a.id);let n=await s(a.id);t(n),f({id:i,title:"Unarchived release",message:`Successfully unarchived ${a.id}`,loading:!1,autoClose:5e3}),l.closeModal(r),u(`/cms/releases/${a.id}`)}})}return e(k,{children:e("div",{className:"EditReleasePage",children:[e("div",{className:"EditReleasePage__header",children:[e(b,{className:"EditReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("a",{href:`/cms/releases/${a.id}`,children:a.id}),e("div",{children:"Edit"})]}),e("div",{className:"EditReleasePage__header__titleWrap",children:[e(z,{size:"h1",children:["Edit Release: ",a.id]}),e("div",{className:"EditReleasePage__header__controls",children:e(I,{label:"You don't have access to archive releases",condition:!o,children:M?.archivedAt?e(m,{label:"Unarchive",disabled:!o,children:e(c,{onClick:B,loading:!d,disabled:!o,children:e(y,{size:20,stroke:"1.5"})})}):e(m,{label:"Archive",disabled:!o,children:e(c,{onClick:L,loading:!d,disabled:!o,children:e(p,{size:20,stroke:"1.5"})})})})})]})]}),e(N,{className:"EditReleasePage__form",children:e(U,{releaseId:a.id})})]})})}export{de as EditReleasePage};
@@ -0,0 +1 @@
1
+ import{b as n}from"./chunk-FBSBL476.js";import{a}from"./chunk-NXWYS4HG.js";import"./chunk-GCSN3YEC.js";import"./chunk-QWB6MAPJ.js";import"./chunk-VPZHG7JL.js";import"./chunk-AAR7DBEN.js";import{b as i}from"./chunk-RB23LLKL.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{a as f}from"./chunk-QLIIVG5Q.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as o,c as r,e as t,j as m}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";m();function v(){f("Root AI");let[e]=i("docId"),d=t(!1);return r(()=>{d.current||(d.current=!0,n({type:"ready",docId:e||void 0}))},[e]),o("div",{className:"EmbeddedAIPage",children:o(a,{variant:"panel",docContext:e?{docId:e}:void 0})})}export{v as EmbeddedAIPage};
@@ -0,0 +1 @@
1
+ import{k as E,l as P,m as h,s as S}from"./chunk-7UHZS56B.js";import"./chunk-UCYWQEAS.js";import"./chunk-DWV5J2W7.js";import"./chunk-T5BJNOWE.js";import"./chunk-34W6H4YG.js";import"./chunk-SYDHFYRC.js";import"./chunk-535JU7FU.js";import{b as s}from"./chunk-FBSBL476.js";import"./chunk-GCSN3YEC.js";import"./chunk-QWB6MAPJ.js";import"./chunk-VPZHG7JL.js";import"./chunk-AAR7DBEN.js";import"./chunk-JBLSUM6W.js";import"./chunk-2RRM4HEQ.js";import"./chunk-HXSB6YB2.js";import"./chunk-N5RJIILP.js";import"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{b as p}from"./chunk-W5DOO6ID.js";import{a as D}from"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as x}from"./chunk-QLIIVG5Q.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{e as _}from"./chunk-WASID5UU.js";import{Ga as t,a as v,c as m,da as f,e as u,j as B,ub as b}from"./chunk-WRA24P66.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,4 +1,4 @@
1
- import{A as le,Aa as de,Ba as me,Fa as $,Ga as h,Ra as ve,Sa as we,W as K,Y as pe,Za as ye,a as C,c as Y,da as N,fa as P,g as ue,ga as he,h as q,j as qe,ra as fe,va as J,y as Ke}from"./chunk-LROR6N3B.js";import{b as E,c as L,e as ce}from"./chunk-KUCVLANF.js";import{g as ge}from"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import{b as O,d as Ye}from"./chunk-PVAE643M.js";var Pe=O((yt,Ee)=>{"use strict";var Ce=!1,S,ee,te,Z,H,_e,G,re,oe,ne,xe,ie,ae,Se,Re;function y(){if(!Ce){Ce=!0;var r=navigator.userAgent,n=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(r),e=/(Mac OS X)|(Windows)|(Linux)/.exec(r);if(ie=/\b(iPhone|iP[ao]d)/.exec(r),ae=/\b(iP[ao]d)/.exec(r),ne=/Android/i.exec(r),Se=/FBAN\/\w+;/i.exec(r),Re=/Mobile/i.exec(r),xe=!!/Win64/.exec(r),n){S=n[1]?parseFloat(n[1]):n[5]?parseFloat(n[5]):NaN,S&&document&&document.documentMode&&(S=document.documentMode);var t=/(?:Trident\/(\d+.\d+))/.exec(r);_e=t?parseFloat(t[1])+4:S,ee=n[2]?parseFloat(n[2]):NaN,te=n[3]?parseFloat(n[3]):NaN,Z=n[4]?parseFloat(n[4]):NaN,Z?(n=/(?:Chrome\/(\d+\.\d+))/.exec(r),H=n&&n[1]?parseFloat(n[1]):NaN):H=NaN}else S=ee=te=H=Z=NaN;if(e){if(e[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(r);G=o?parseFloat(o[1].replace("_",".")):!0}else G=!1;re=!!e[2],oe=!!e[3]}else G=re=oe=!1}}var se={ie:function(){return y()||S},ieCompatibilityMode:function(){return y()||_e>S},ie64:function(){return se.ie()&&xe},firefox:function(){return y()||ee},opera:function(){return y()||te},webkit:function(){return y()||Z},safari:function(){return se.webkit()},chrome:function(){return y()||H},windows:function(){return y()||re},osx:function(){return y()||G},linux:function(){return y()||oe},iphone:function(){return y()||ie},mobile:function(){return y()||ie||ae||ne||Re},nativeApp:function(){return y()||Se},android:function(){return y()||ne},ipad:function(){return y()||ae}};Ee.exports=se});var ze=O((bt,De)=>{"use strict";var k=!!(typeof window<"u"&&window.document&&window.document.createElement),Je={canUseDOM:k,canUseWorkers:typeof Worker<"u",canUseEventListeners:k&&!!(window.addEventListener||window.attachEvent),canUseViewport:k&&!!window.screen,isInWorker:!k};De.exports=Je});var Te=O((Ct,Oe)=>{"use strict";var Me=ze(),Ae;Me.canUseDOM&&(Ae=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function $e(r,n){if(!Me.canUseDOM||n&&!("addEventListener"in document))return!1;var e="on"+r,t=e in document;if(!t){var o=document.createElement("div");o.setAttribute(e,"return;"),t=typeof o[e]=="function"}return!t&&Ae&&r==="wheel"&&(t=document.implementation.hasFeature("Events.wheel","3.0")),t}Oe.exports=$e});var Ne=O((_t,Le)=>{"use strict";var Qe=Pe(),et=Te(),je=10,Ie=40,We=800;function Fe(r){var n=0,e=0,t=0,o=0;return"detail"in r&&(e=r.detail),"wheelDelta"in r&&(e=-r.wheelDelta/120),"wheelDeltaY"in r&&(e=-r.wheelDeltaY/120),"wheelDeltaX"in r&&(n=-r.wheelDeltaX/120),"axis"in r&&r.axis===r.HORIZONTAL_AXIS&&(n=e,e=0),t=n*je,o=e*je,"deltaY"in r&&(o=r.deltaY),"deltaX"in r&&(t=r.deltaX),(t||o)&&r.deltaMode&&(r.deltaMode==1?(t*=Ie,o*=Ie):(t*=We,o*=We)),t&&!n&&(n=t<1?-1:1),o&&!e&&(e=o<1?-1:1),{spinX:n,spinY:e,pixelX:t,pixelY:o}}Fe.getEventType=function(){return Qe.firefox()?"DOMMouseScroll":et("wheel")?"wheel":"mousewheel"};Le.exports=Fe});var He=O((xt,Ze)=>{"use strict";Ze.exports=Ne()});qe();var Q=function(r,n){return Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},Q(r,n)};function be(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");Q(r,n);function e(){this.constructor=r}r.prototype=n===null?Object.create(n):(e.prototype=n.prototype,new e)}var g=function(){return g=Object.assign||function(n){for(var e,t=1,o=arguments.length;t<o;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},g.apply(this,arguments)};Ke();var Xe=Ye(He(),1);function tt(r,n,e,t,o,i){i===void 0&&(i=0);var s=D(r,n,i),a=s.width,c=s.height,u=Math.min(a,e),l=Math.min(c,t);return u>l*o?{width:l*o,height:l}:{width:u,height:u/o}}function rt(r){return r.width>r.height?r.width/r.naturalWidth:r.height/r.naturalHeight}function T(r,n,e,t,o){o===void 0&&(o=0);var i=D(n.width,n.height,o),s=i.width,a=i.height;return{x:Ge(r.x,s,e.width,t),y:Ge(r.y,a,e.height,t)}}function Ge(r,n,e,t){var o=n*t/2-e/2;return U(r,-o,o)}function ke(r,n){return Math.sqrt(Math.pow(r.y-n.y,2)+Math.pow(r.x-n.x,2))}function Be(r,n){return Math.atan2(n.y-r.y,n.x-r.x)*180/Math.PI}function ot(r,n,e,t,o,i,s){i===void 0&&(i=0),s===void 0&&(s=!0);var a=s?nt:it,c=D(n.width,n.height,i),u=D(n.naturalWidth,n.naturalHeight,i),l={x:a(100,((c.width-e.width/o)/2-r.x/o)/c.width*100),y:a(100,((c.height-e.height/o)/2-r.y/o)/c.height*100),width:a(100,e.width/c.width*100/o),height:a(100,e.height/c.height*100/o)},d=Math.round(a(u.width,l.width*u.width/100)),p=Math.round(a(u.height,l.height*u.height/100)),m=u.width>=u.height*t,v=m?{width:Math.round(p*t),height:p}:{width:d,height:Math.round(d/t)},w=g(g({},v),{x:Math.round(a(u.width-v.width,l.x*u.width/100)),y:Math.round(a(u.height-v.height,l.y*u.height/100))});return{croppedAreaPercentages:l,croppedAreaPixels:w}}function nt(r,n){return Math.min(r,Math.max(0,n))}function it(r,n){return n}function at(r,n,e,t,o,i){var s=D(n.width,n.height,e),a=U(t.width/s.width*(100/r.width),o,i),c={x:a*s.width/2-t.width/2-s.width*a*(r.x/100),y:a*s.height/2-t.height/2-s.height*a*(r.y/100)};return{crop:c,zoom:a}}function st(r,n,e){var t=rt(n);return e.height>e.width?e.height/(r.height*t):e.width/(r.width*t)}function ct(r,n,e,t,o,i){e===void 0&&(e=0);var s=D(n.naturalWidth,n.naturalHeight,e),a=U(st(r,n,t),o,i),c=t.height>t.width?t.height/r.height:t.width/r.width,u={x:((s.width-r.width)/2-r.x)*c,y:((s.height-r.height)/2-r.y)*c};return{crop:u,zoom:a}}function Ue(r,n){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}function ut(r){return r*Math.PI/180}function D(r,n,e){var t=ut(e);return{width:Math.abs(Math.cos(t)*r)+Math.abs(Math.sin(t)*n),height:Math.abs(Math.sin(t)*r)+Math.abs(Math.cos(t)*n)}}function U(r,n,e){return Math.min(Math.max(r,n),e)}function B(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var lt=`.reactEasyCrop_Container {
1
+ import{$a as ye,A as le,Aa as de,Ba as me,Fa as $,Ga as h,Ra as ve,Sa as we,W as K,Y as pe,a as C,c as Y,da as N,fa as P,g as ue,ga as he,h as q,j as qe,ra as fe,va as J,y as Ke}from"./chunk-WRA24P66.js";import{b as E,c as L,e as ce}from"./chunk-KUCVLANF.js";import{g as ge}from"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import{b as O,d as Ye}from"./chunk-PVAE643M.js";var Pe=O((yt,Ee)=>{"use strict";var Ce=!1,S,ee,te,Z,H,_e,G,re,oe,ne,xe,ie,ae,Se,Re;function y(){if(!Ce){Ce=!0;var r=navigator.userAgent,n=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(r),e=/(Mac OS X)|(Windows)|(Linux)/.exec(r);if(ie=/\b(iPhone|iP[ao]d)/.exec(r),ae=/\b(iP[ao]d)/.exec(r),ne=/Android/i.exec(r),Se=/FBAN\/\w+;/i.exec(r),Re=/Mobile/i.exec(r),xe=!!/Win64/.exec(r),n){S=n[1]?parseFloat(n[1]):n[5]?parseFloat(n[5]):NaN,S&&document&&document.documentMode&&(S=document.documentMode);var t=/(?:Trident\/(\d+.\d+))/.exec(r);_e=t?parseFloat(t[1])+4:S,ee=n[2]?parseFloat(n[2]):NaN,te=n[3]?parseFloat(n[3]):NaN,Z=n[4]?parseFloat(n[4]):NaN,Z?(n=/(?:Chrome\/(\d+\.\d+))/.exec(r),H=n&&n[1]?parseFloat(n[1]):NaN):H=NaN}else S=ee=te=H=Z=NaN;if(e){if(e[1]){var o=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(r);G=o?parseFloat(o[1].replace("_",".")):!0}else G=!1;re=!!e[2],oe=!!e[3]}else G=re=oe=!1}}var se={ie:function(){return y()||S},ieCompatibilityMode:function(){return y()||_e>S},ie64:function(){return se.ie()&&xe},firefox:function(){return y()||ee},opera:function(){return y()||te},webkit:function(){return y()||Z},safari:function(){return se.webkit()},chrome:function(){return y()||H},windows:function(){return y()||re},osx:function(){return y()||G},linux:function(){return y()||oe},iphone:function(){return y()||ie},mobile:function(){return y()||ie||ae||ne||Re},nativeApp:function(){return y()||Se},android:function(){return y()||ne},ipad:function(){return y()||ae}};Ee.exports=se});var ze=O((bt,De)=>{"use strict";var k=!!(typeof window<"u"&&window.document&&window.document.createElement),Je={canUseDOM:k,canUseWorkers:typeof Worker<"u",canUseEventListeners:k&&!!(window.addEventListener||window.attachEvent),canUseViewport:k&&!!window.screen,isInWorker:!k};De.exports=Je});var Te=O((Ct,Oe)=>{"use strict";var Me=ze(),Ae;Me.canUseDOM&&(Ae=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);function $e(r,n){if(!Me.canUseDOM||n&&!("addEventListener"in document))return!1;var e="on"+r,t=e in document;if(!t){var o=document.createElement("div");o.setAttribute(e,"return;"),t=typeof o[e]=="function"}return!t&&Ae&&r==="wheel"&&(t=document.implementation.hasFeature("Events.wheel","3.0")),t}Oe.exports=$e});var Ne=O((_t,Le)=>{"use strict";var Qe=Pe(),et=Te(),je=10,Ie=40,We=800;function Fe(r){var n=0,e=0,t=0,o=0;return"detail"in r&&(e=r.detail),"wheelDelta"in r&&(e=-r.wheelDelta/120),"wheelDeltaY"in r&&(e=-r.wheelDeltaY/120),"wheelDeltaX"in r&&(n=-r.wheelDeltaX/120),"axis"in r&&r.axis===r.HORIZONTAL_AXIS&&(n=e,e=0),t=n*je,o=e*je,"deltaY"in r&&(o=r.deltaY),"deltaX"in r&&(t=r.deltaX),(t||o)&&r.deltaMode&&(r.deltaMode==1?(t*=Ie,o*=Ie):(t*=We,o*=We)),t&&!n&&(n=t<1?-1:1),o&&!e&&(e=o<1?-1:1),{spinX:n,spinY:e,pixelX:t,pixelY:o}}Fe.getEventType=function(){return Qe.firefox()?"DOMMouseScroll":et("wheel")?"wheel":"mousewheel"};Le.exports=Fe});var He=O((xt,Ze)=>{"use strict";Ze.exports=Ne()});qe();var Q=function(r,n){return Q=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])},Q(r,n)};function be(r,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");Q(r,n);function e(){this.constructor=r}r.prototype=n===null?Object.create(n):(e.prototype=n.prototype,new e)}var g=function(){return g=Object.assign||function(n){for(var e,t=1,o=arguments.length;t<o;t++){e=arguments[t];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=e[i])}return n},g.apply(this,arguments)};Ke();var Xe=Ye(He(),1);function tt(r,n,e,t,o,i){i===void 0&&(i=0);var s=D(r,n,i),a=s.width,c=s.height,u=Math.min(a,e),l=Math.min(c,t);return u>l*o?{width:l*o,height:l}:{width:u,height:u/o}}function rt(r){return r.width>r.height?r.width/r.naturalWidth:r.height/r.naturalHeight}function T(r,n,e,t,o){o===void 0&&(o=0);var i=D(n.width,n.height,o),s=i.width,a=i.height;return{x:Ge(r.x,s,e.width,t),y:Ge(r.y,a,e.height,t)}}function Ge(r,n,e,t){var o=n*t/2-e/2;return U(r,-o,o)}function ke(r,n){return Math.sqrt(Math.pow(r.y-n.y,2)+Math.pow(r.x-n.x,2))}function Be(r,n){return Math.atan2(n.y-r.y,n.x-r.x)*180/Math.PI}function ot(r,n,e,t,o,i,s){i===void 0&&(i=0),s===void 0&&(s=!0);var a=s?nt:it,c=D(n.width,n.height,i),u=D(n.naturalWidth,n.naturalHeight,i),l={x:a(100,((c.width-e.width/o)/2-r.x/o)/c.width*100),y:a(100,((c.height-e.height/o)/2-r.y/o)/c.height*100),width:a(100,e.width/c.width*100/o),height:a(100,e.height/c.height*100/o)},d=Math.round(a(u.width,l.width*u.width/100)),p=Math.round(a(u.height,l.height*u.height/100)),m=u.width>=u.height*t,v=m?{width:Math.round(p*t),height:p}:{width:d,height:Math.round(d/t)},w=g(g({},v),{x:Math.round(a(u.width-v.width,l.x*u.width/100)),y:Math.round(a(u.height-v.height,l.y*u.height/100))});return{croppedAreaPercentages:l,croppedAreaPixels:w}}function nt(r,n){return Math.min(r,Math.max(0,n))}function it(r,n){return n}function at(r,n,e,t,o,i){var s=D(n.width,n.height,e),a=U(t.width/s.width*(100/r.width),o,i),c={x:a*s.width/2-t.width/2-s.width*a*(r.x/100),y:a*s.height/2-t.height/2-s.height*a*(r.y/100)};return{crop:c,zoom:a}}function st(r,n,e){var t=rt(n);return e.height>e.width?e.height/(r.height*t):e.width/(r.width*t)}function ct(r,n,e,t,o,i){e===void 0&&(e=0);var s=D(n.naturalWidth,n.naturalHeight,e),a=U(st(r,n,t),o,i),c=t.height>t.width?t.height/r.height:t.width/r.width,u={x:((s.width-r.width)/2-r.x)*c,y:((s.height-r.height)/2-r.y)*c};return{crop:u,zoom:a}}function Ue(r,n){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}function ut(r){return r*Math.PI/180}function D(r,n,e){var t=ut(e);return{width:Math.abs(Math.cos(t)*r)+Math.abs(Math.sin(t)*n),height:Math.abs(Math.sin(t)*r)+Math.abs(Math.cos(t)*n)}}function U(r,n,e){return Math.min(Math.max(r,n),e)}function B(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];return r.filter(function(e){return typeof e=="string"&&e.length>0}).join(" ").trim()}var lt=`.reactEasyCrop_Container {
2
2
  position: absolute;
3
3
  top: 0;
4
4
  left: 0;
@@ -0,0 +1 @@
1
+ import{a as e}from"./chunk-YP6ZH3MT.js";import"./chunk-2RRM4HEQ.js";import{a}from"./chunk-HXSB6YB2.js";import"./chunk-OWYV43BT.js";import"./chunk-ATTW36EM.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{a as i}from"./chunk-QLIIVG5Q.js";import{c as g}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as o}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function L(){return i("Action Logs"),o(g,{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};
@@ -0,0 +1 @@
1
+ import{a as d}from"./chunk-2FQMT5AB.js";import"./chunk-535JU7FU.js";import{a as r}from"./chunk-HXSB6YB2.js";import"./chunk-JDW4UORS.js";import"./chunk-RN4XVVWD.js";import"./chunk-ATTW36EM.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import{a as o}from"./chunk-QLIIVG5Q.js";import{c as t}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as a,ca as e}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(){return o("New Data Source"),a(t,{children:a("div",{className:"NewDataSourcePage",children:[a("div",{className:"NewDataSourcePage__header",children:[a(e,{className:"NewDataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data Sources"}),a("div",{children:"New"})]}),a(r,{size:"h1",children:"Add Data Source"})]}),a(d,{buttonLabel:"Create data source"})]})})}export{n as NewDataSourcePage};
@@ -0,0 +1 @@
1
+ import{a as m}from"./chunk-IGZDFHVM.js";import"./chunk-WC7KMPEQ.js";import"./chunk-F7RQT4XN.js";import"./chunk-DWV5J2W7.js";import{a as r}from"./chunk-HXSB6YB2.js";import"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import"./chunk-W5DOO6ID.js";import"./chunk-YBHFGQ3Z.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as d}from"./chunk-QLIIVG5Q.js";import{c as s}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as e,ca as a}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function w(){return d("New Release"),e(s,{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 +1 @@
1
- import{a as n}from"./chunk-P2Z66DHV.js";import{b as e}from"./chunk-FXIR2RBE.js";import"./chunk-AAHM6RYJ.js";import"./chunk-BUNR5EU3.js";import{Ga as o,jc as t}from"./chunk-LROR6N3B.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";function l(){return n("Not Found"),o(e,{children:o("div",{className:"NotFoundPage",children:[o("div",{className:"NotFoundPage__icon",children:o(t,{size:60})}),o("h2",{className:"NotFoundPage__title",children:"Not Found"}),o("p",{className:"NotFoundPage__body",children:["Double-check the URL and try again or ",o("a",{href:"/cms",children:"go home"}),"."]})]})})}export{l as NotFoundPage};
1
+ import{a as n}from"./chunk-QLIIVG5Q.js";import{c as e}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-WASID5UU.js";import{Ga as o,nc as t}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";function l(){return n("Not Found"),o(e,{children:o("div",{className:"NotFoundPage",children:[o("div",{className:"NotFoundPage__icon",children:o(t,{size:60})}),o("h2",{className:"NotFoundPage__title",children:"Not Found"}),o("p",{className:"NotFoundPage__body",children:["Double-check the URL and try again or ",o("a",{href:"/cms",children:"go home"}),"."]})]})})}export{l as NotFoundPage};
@@ -0,0 +1 @@
1
+ import{a as s}from"./chunk-Y5EOMMNI.js";import"./chunk-XACLTYBB.js";import{a as l}from"./chunk-YP6ZH3MT.js";import"./chunk-2RRM4HEQ.js";import{a as n}from"./chunk-44ZU5WMI.js";import{a as r}from"./chunk-OWYV43BT.js";import"./chunk-QFDU6FXP.js";import"./chunk-ATTW36EM.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import{a as c}from"./chunk-QLIIVG5Q.js";import{c as a}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as e,da as i}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function o(){c("Home");let t=!!window.__ROOT_CTX.experiments?.taskManager;return e(a,{children:e("div",{className:"ProjectPage",children:e("div",{className:"ProjectPage__main",children:[t&&e(s,{}),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,d=window.__ROOT_CTX.rootConfig.projectId;return e("div",{className:"ProjectPage__collections",children:e(n,{collections:t,projectId:d})})};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(l,{limit:10,compact:!0})})]});export{o as ProjectPage};
@@ -0,0 +1 @@
1
+ import{a as K}from"./chunk-Z3ZJJWFT.js";import{a as F}from"./chunk-XUBZH4ON.js";import{a as q}from"./chunk-F7RQT4XN.js";import{c as U}from"./chunk-VPZHG7JL.js";import{a as h}from"./chunk-HXSB6YB2.js";import{a as R}from"./chunk-OWYV43BT.js";import{g as H}from"./chunk-TNW2GNUR.js";import{d as B,h as E,k as M}from"./chunk-FVWSVOOY.js";import"./chunk-JDW4UORS.js";import{a as P}from"./chunk-UJX25CXD.js";import{c as $}from"./chunk-RN4XVVWD.js";import{a as k,c as I}from"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import{a as j}from"./chunk-W5DOO6ID.js";import{a as W}from"./chunk-YBHFGQ3Z.js";import{b as D}from"./chunk-2PTLQRTU.js";import{a as v,b as z}from"./chunk-PIJ3E47R.js";import{a as O}from"./chunk-NCZD5IWS.js";import{a as J}from"./chunk-QLIIVG5Q.js";import{c as G}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import{A as T}from"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Da as A,Fa as g,Ga as e,Jc as Y,V as w,W as C,a as u,c as x,ca as N,da as m,j as Z}from"./chunk-WRA24P66.js";import{d as y}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";Z();function p(t){let[c,i]=u(!0),[a,s]=u(null),[o,l]=u(0),n=t.id;J(`Release: ${n}`);async function _(){i(!0),await D(async()=>{let r=await B(n);s(r),l(T())}),i(!1)}x(()=>{_()},[]);function d(r){console.log("onAction()",r),_()}return e(G,{children:e("div",{className:"ReleasePage",children:[e("div",{className:"ReleasePage__header",children:[e(N,{className:"ReleasePage__header__breadcrumbs",children:[e("a",{href:"/cms/releases",children:"Releases"}),e("div",{children:n})]}),e("div",{className:"ReleasePage__header__titleWrap",children:[e(h,{size:"h1",children:["Release: ",n]}),e("div",{className:"ReleasePage__header__controls",children:e(g,{label:"Configure",children:e(C,{component:"a",href:`/cms/releases/${t.id}/edit`,children:e(Y,{size:24,stroke:"1.5"})})})})]}),a?.description&&e(U,{className:"ReleasePage__header__description",code:a.description})]}),c?e(w,{color:"gray",size:"xl"}):e(y,{children:[a&&e(p.PublishStatus,{release:a,onAction:d}),a&&a.docIds&&a.docIds.length>0&&e(p.DocsList,{release:a},`docs-list-${o}`),a&&a.dataSourceIds&&a.dataSourceIds.length>0&&e(p.DataSourcesList,{release:a},`data-sources-${o}`)]})]})})}p.PublishStatus=t=>{let{roles:c}=W(),i=window.firebase.user.email||"",a=j(c,i),s=t.release,[o,l]=u(!1),n=k(),_=I(),d=F({releaseId:s.id,onScheduled:()=>{t.onAction("scheduled")}});function r(){let f=s.docIds||[],S=s.dataSourceIds||[],b=f.length+S.length;if(b===0){v({title:"Cannot publish release",message:"Error: nothing in the release to publish.",color:"red",autoClose:!1});return}n.openConfirmModal({..._,title:`Publish release: ${s.id}`,children:e(O,{size:"body-sm",weight:"semi-bold",children:["Are you sure you want to publish this release? The ",b," items in the release will go live immediately."]}),labels:{confirm:"Publish",cancel:"Cancel"},cancelProps:{size:"xs"},confirmProps:{color:"dark",size:"xs"},onCancel:()=>console.log("Cancel"),closeOnConfirm:!0,onConfirm:()=>{Q()}})}async function Q(){l(!0),await D(async()=>{let f=`publish-release-${s.id}`,S=s.docIds?.length||0,b=s.dataSourceIds?.length||0,L=S+b;v({id:f,title:"Publishing release",message:`Publishing ${L} items...`,loading:!0,autoClose:!1}),await E(s.id),z({id:f,title:"Published release!",message:`Successfully published ${L} items!`,loading:!1,autoClose:5e3}),t.onAction&&t.onAction("publish")}),l(!1)}function V(){d.open()}async function X(){await M(s.id),t.onAction("cancel-schedule")}return e("div",{className:"ReleasePage__PublishStatus",children:[e(h,{size:"h2",children:"Status"}),e(R,{children:e(A,{className:"ReleasePage__PublishStatus__table",verticalSpacing:"xs",striped:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"status"}),e("th",{children:"actions"})]})}),e("tbody",{children:e("tr",{children:[e("td",{children:e(K,{release:s})}),e("td",{children:e("div",{className:"ReleasePage__PublishStatus__actions",children:[!s.archivedAt&&!s.scheduledAt&&e(P,{label:"You don't have access to publish this release",condition:!a,children:e(g,{label:"Publish the release immediately",position:"bottom",withArrow:!0,disabled:!a,children:e(m,{variant:"default",size:"xs",compact:!0,onClick:()=>r(),loading:o,disabled:!a,children:s.publishedAt?"Re-publish":"Publish"})})}),!s.archivedAt&&(s.scheduledAt?e(P,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(g,{label:"Cancel the scheduled release",position:"bottom",withArrow:!0,disabled:!a,children:e(m,{variant:"default",size:"xs",compact:!0,onClick:()=>X(),disabled:!a,children:"Cancel Schedule"})})}):e(P,{label:"You don't have access to manage scheduled releases",condition:!a,children:e(g,{label:"Schedule the release to be published at a future date",position:"bottom",withArrow:!0,wrapLines:!0,width:180,disabled:!a,children:e(m,{variant:"default",size:"xs",compact:!0,onClick:()=>V(),disabled:!a,children:"Schedule"})})}))]})})]})})]})})]})};p.DocsList=t=>{let c=t.release,i=c.docIds||[];return e("div",{className:"ReleasePage__DocsList",children:[e("div",{className:"ReleasePage__DocsList__header",children:[e(h,{size:"h2",children:"Docs"}),e(m,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${c.id}/edit`,children:"Edit"})]}),e(R,{className:"ReleasePage__DocsList__cards",children:i.map(a=>e("div",{className:"ReleasePage__DocsList__card",children:e("a",{href:`/cms/content/${a}`,children:e(H,{docId:a,statusBadges:!0,hideReleases:!0})})},a))})]})};p.DataSourcesList=t=>{let c=t.release,i=c.dataSourceIds||[],[a,s]=u({});return x(()=>{let o=!1;async function l(){let n=await Promise.all(i.map(async d=>{let r=await $(d);return[d,r]}));if(o)return;let _={};for(let[d,r]of n)r&&(_[d]=r);s(_)}return l(),()=>{o=!0}},[i.join(",")]),e("div",{className:"ReleasePage__DataSourcesList",children:[e("div",{className:"ReleasePage__DataSourcesList__header",children:[e(h,{size:"h2",children:"Data Sources"}),e(m,{component:"a",variant:"default",size:"xs",compact:!0,href:`/cms/releases/${c.id}/edit`,children:"Edit"})]}),e(R,{className:"ReleasePage__DataSourcesList__items",children:i.map(o=>{let l=a[o];return e("a",{className:"ReleasePage__DataSourcesList__item",href:`/cms/data/${o}`,children:[e(q,{className:"ReleasePage__DataSourcesList__item__icon",type:l?.type}),e("div",{className:"ReleasePage__DataSourcesList__item__info",children:[e("div",{className:"ReleasePage__DataSourcesList__item__id",children:o}),l?.description&&e("div",{className:"ReleasePage__DataSourcesList__item__description",children:l.description})]})]},o)})})]})};export{p as ReleasePage};
@@ -0,0 +1 @@
1
+ import{a as w}from"./chunk-Z3ZJJWFT.js";import{a as P}from"./chunk-HXSB6YB2.js";import{a as S}from"./chunk-OWYV43BT.js";import{c as f}from"./chunk-FVWSVOOY.js";import"./chunk-JDW4UORS.js";import{a as T}from"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-ATTW36EM.js";import{a as v}from"./chunk-W5DOO6ID.js";import{a as R}from"./chunk-YBHFGQ3Z.js";import{a as d}from"./chunk-NCZD5IWS.js";import{a as y}from"./chunk-QLIIVG5Q.js";import{c as x}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Da as _,Ga as e,V as h,a as o,c as m,da as b,g as p,j as A,ya as g}from"./chunk-WRA24P66.js";import{d as c}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";A();function N(){y("Releases");let{roles:i}=R(),r=window.firebase.user.email||"",t=v(i,r);return e(x,{children:e("div",{className:"ReleasesPage",children:[e("div",{className:"ReleasesPage__header",children:[e(P,{size:"h1",children:"Releases"}),e(d,{as:"p",children:"Bundle one or more documents and publish them together. Schedule a release to go live at a specific time, or publish manually when you're ready."}),e("div",{className:"ReleasesPage__header__buttons",children:e(T,{label:"You don't have access to create new releases",condition:!t,children:e(b,{component:"a",color:"blue",size:"xs",href:"/cms/releases/new",disabled:!t,style:t?void 0:{pointerEvents:"none"},children:"New release"})})})]}),e(N.ReleasesTable,{})]})})}N.ReleasesTable=()=>{let[i,r]=o(!0),[t,L]=o([]),[l,B]=o("active");async function z(){let a=await f();L(a),r(!1)}let n=p(()=>t.filter(a=>{let s=!!a.archivedAt,u=!!a.publishedAt;return l==="active"?!s:l==="unpublished"?!s&&!u:l==="published"?!s&&u:s}),[t,l]);return m(()=>{z()},[]),e("div",{className:"ReleasesPage__ReleasesTable",children:[i&&e(h,{color:"gray",size:"xl"}),!i&&e(c,{children:[e("div",{className:"ReleasesPage__ReleasesTable__filters",children:e(g,{size:"sm",value:l,onChange:a=>B(a),data:[{label:"Active",value:"active"},{label:"Unpublished",value:"unpublished"},{label:"Published",value:"published"},{label:"Archived",value:"archived"}]})}),n.length>0&&e(S,{children:e(_,{className:"ReleasesPage__ReleasesTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[e("thead",{children:e("tr",{children:[e("th",{children:"id"}),e("th",{children:"description"}),e("th",{children:"content"}),e("th",{children:"status"})]})}),e("tbody",{children:n.map(a=>e("tr",{children:[e("td",{children:e("a",{href:`/cms/releases/${a.id}`,children:a.id})}),e("td",{children:a.description||""}),e("td",{children:(a.docIds||[]).map(s=>e("div",{children:e("a",{href:`/cms/content/${s}`,children:s})},s))}),e("td",{children:e("div",{className:"ReleasesPage__ReleasesTable__publishStatus",children:e(w,{release:a})})})]},a.id))})]})}),n.length===0&&e(d,{as:"p",children:"No releases found for this filter."})]})]})};export{N as ReleasesPage};
@@ -0,0 +1 @@
1
+ import{b as me,e as _e}from"./chunk-75NMQ3LW.js";import{a as ce,c as de,e as ge}from"./chunk-UCYWQEAS.js";import{a as N}from"./chunk-HXSB6YB2.js";import{a as E}from"./chunk-OWYV43BT.js";import"./chunk-HV3JJ5UT.js";import"./chunk-ATTW36EM.js";import{c as se}from"./chunk-5MV6XVGA.js";import{b as ie,c as O,d as re,f as z}from"./chunk-H37RXS4R.js";import{a as le}from"./chunk-YBHFGQ3Z.js";import{b as ee}from"./chunk-2PTLQRTU.js";import{a as I}from"./chunk-PIJ3E47R.js";import{a as g}from"./chunk-NCZD5IWS.js";import{a as pe}from"./chunk-QLIIVG5Q.js";import{c as ue}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import{D as oe,c as V,n as q,p as Q,q as Z}from"./chunk-XOWWPE7X.js";import{e as B}from"./chunk-WASID5UU.js";import{$a as te,Ca as Y,Ga as e,U as L,Vc as ne,W as $,a as _,ad as ae,ba as F,c as w,da as v,e as H,g as T,j as G,na as J,pa as K,sa as X,ua as U,za as A}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";G();G();var Ne={ADMIN:4,EDITOR:3,CONTRIBUTOR:2,VIEWER:1};function fe(o){return Ne[o]??0}function Be(o,s){return fe(o)>=fe(s)?o:s}function W(o,s,a){let r=o[s];o[s]=r?Be(r,a):a}function xe(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)W(a,d,t.role);else{for(let d of m)W(a,d,"VIEWER");for(let d of u){r[d]||(r[d]={});for(let p of m)W(r[d],p,t.role)}}}return{projectRoles:a,collectionRoles:r}}function he(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]:[]}}G();function k(o){let s=o.size||28,[a,r]=_(!1),t=o.profile?.photoURL||"",m=o.profile?.displayName||o.email,u=B("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:re(o.email)}),e("text",{x:"14",y:"14",textAnchor:"middle",dominantBaseline:"central",fill:"#fff",fontSize:"13",fontWeight:"600",children:ie(o.email)})]})}var Ge=[{value:"ADMIN",label:"ADMIN"},{value:"EDITOR",label:"EDITOR"},{value:"CONTRIBUTOR",label:"CONTRIBUTOR"},{value:"VIEWER",label:"VIEWER"}];function ve(o){let{groups:s,onChange:a,collections:r,disabled:t}=o,m=T(()=>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,he({name:"New group"})]),d(n=>({...n,[l]:!0}))}return e("div",{className:B(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(F,{color:"gray",radius:"sm",size:"xs",variant:"light",className:"PermissionGroupsBox__trigger__badge",children:[l.users.length," ",l.users.length===1?"user":"users"]})]}),children:e(Ue,{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 Ue(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(U,{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:Ge,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(U,{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(ae,{size:14})})]},i)})})]}),e("div",{className:"PermissionGroupsBox__editor__footer",children:e(v,{variant:"subtle",size:"xs",color:"red",compact:!0,disabled:r,leftIcon:e(ne,{size:14}),onClick:c,children:"Delete group"})})]})}G();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:B(o.className,"ShareBox"),children:[e("form",{className:"ShareBox__addUser",onSubmit:n=>{n.preventDefault(),P(t)},children:[e(U,{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)}})})]})};G();var Ie="You have unsaved changes. Are you sure you want to leave this page?";function be(o){w(()=>{if(o)return _e({message:Ie,url:window.location.href})},[o])}function Ee(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 Pe(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 Ce(){let o=me(),[s,a]=_(!1),[r,t]=_(!1),[m,u]=_(!1),d=H(null);function p(){d.current!==null&&(window.clearInterval(d.current),d.current=null),t(!1),u(!1)}w(()=>p,[]),w(()=>{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"}`)}I({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){I({title:"Error",message:x?.message||String(x),color:"red",autoClose:!1})}finally{a(!1)}}}w(()=>{r&&m&&!o.running&&(p(),I({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(N,{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(E,{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:"})," ",Ee(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 Te(o,s){return JSON.stringify(o)===JSON.stringify(s)}function Ae(){let o=window.__ROOT_CTX.rootConfig.projectId||"default",s=window.__ROOT_CTX.collections||{},a=T(()=>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:[]});w(()=>{q(t).then(h=>{let S=h.data()||{},C=S.roles||{},y={globalRoles:S.globalRoles||C,permissionGroups:S.permissionGroups||[]};P(C),n(y),i({globalRoles:{...y.globalRoles},permissionGroups:y.permissionGroups.map(R=>({...R}))}),u(!1)})},[]);let f=Pe(b),x=!Te(l,c);be(x);function j(h){i(S=>({...S,globalRoles:h}))}function Se(h){i(S=>({...S,permissionGroups:h}))}function Re(){i({globalRoles:{...l.globalRoles},permissionGroups:l.permissionGroups.map(h=>({...h}))})}async function ye(){d||!x||(p(!0),await ee(async()=>{let{projectRoles:h,collectionRoles:S}=xe(c.permissionGroups,c.globalRoles);await Z(t,{globalRoles:c.globalRoles,roles:h,permissionGroups:c.permissionGroups});let C=l.permissionGroups.flatMap(R=>R.collections||[]),M=new Set([...Object.keys(S),...C]);for(let R of M){let we=V(r,"Projects",o,"Collections",R);await Q(we,{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)}}),I({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(N,{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(E,{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(N,{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(N,{className:"SettingsPage__section__right__title",size:"h3",children:"Groups"}),e(ve,{groups:c.permissionGroups,onChange:Se,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:Re,children:"Discard"}),e(v,{size:"xs",radius:0,color:x?"green":"dark",leftIcon:e(te,{size:14}),loading:d,disabled:!x||!f,onClick:ye,children:"Save changes"})]})]})]})})]})}function Xo(){pe("Settings");let o=ge(),s=de(),a=le(),r=!a.loading&&Pe(a.roles);return e(ue,{children:e("div",{className:"SettingsPage",children:[e(Ae,{}),e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(N,{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(E,{className:"SettingsPage__section__right",children:ce.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(J,{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(Ce,{}),e("div",{className:"SettingsPage__section",children:[e("div",{className:"SettingsPage__section__left",children:[e(N,{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(E,{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(Y,{color:"dark",checked:o.preferences.EnableEditorJSEditor,onChange:t=>{let m=t.currentTarget.checked;o.setPreference("EnableEditorJSEditor",m)}})})]})})]})]})})}export{Xo as SettingsPage};
@@ -1 +1 @@
1
- import{a as t}from"./chunk-P2Z66DHV.js";import{b as a}from"./chunk-FXIR2RBE.js";import"./chunk-AAHM6RYJ.js";import"./chunk-BUNR5EU3.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
+ import{a as t}from"./chunk-QLIIVG5Q.js";import{c as a}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-WASID5UU.js";import{Ga as e,c as d,j as l}from"./chunk-WRA24P66.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};
@@ -0,0 +1 @@
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-XACLTYBB.js";import{r as ie}from"./chunk-7UHZS56B.js";import"./chunk-UCYWQEAS.js";import"./chunk-DWV5J2W7.js";import"./chunk-T5BJNOWE.js";import"./chunk-34W6H4YG.js";import"./chunk-SYDHFYRC.js";import"./chunk-535JU7FU.js";import"./chunk-FBSBL476.js";import"./chunk-GCSN3YEC.js";import"./chunk-QWB6MAPJ.js";import{b as R,c as ae}from"./chunk-VPZHG7JL.js";import"./chunk-AAR7DBEN.js";import"./chunk-JBLSUM6W.js";import"./chunk-2RRM4HEQ.js";import{a as W}from"./chunk-HXSB6YB2.js";import{a as I}from"./chunk-OWYV43BT.js";import"./chunk-N5RJIILP.js";import"./chunk-UPN3EMUS.js";import"./chunk-HV3JJ5UT.js";import"./chunk-TNW2GNUR.js";import"./chunk-FVWSVOOY.js";import"./chunk-QFDU6FXP.js";import"./chunk-JDW4UORS.js";import"./chunk-UJX25CXD.js";import"./chunk-RN4XVVWD.js";import"./chunk-QRAFYIAW.js";import"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import"./chunk-W5DOO6ID.js";import"./chunk-YBHFGQ3Z.js";import{a as k}from"./chunk-2PTLQRTU.js";import{a as f}from"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as se}from"./chunk-QLIIVG5Q.js";import{c as ne}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import{a as Y}from"./chunk-XOWWPE7X.js";import{e as x}from"./chunk-WASID5UU.js";import{$a as b,Ab as J,Fa as P,Ga as e,Gb as Q,V,Vc as M,W as h,Ya as Z,_c as te,a as d,ad as A,c as y,ca as U,da as T,e as O,g as D,j as Ie,lc as ee,na as G,pc as F,qb as B,qc as w,ua as S,za as L}from"./chunk-WRA24P66.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 se(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(ne,{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};
@@ -0,0 +1 @@
1
+ import{a as g}from"./chunk-Y5EOMMNI.js";import"./chunk-XACLTYBB.js";import{a as e}from"./chunk-HXSB6YB2.js";import"./chunk-OWYV43BT.js";import"./chunk-QFDU6FXP.js";import"./chunk-PLYSJ7W5.js";import"./chunk-H37RXS4R.js";import"./chunk-2PTLQRTU.js";import"./chunk-PIJ3E47R.js";import{a as i}from"./chunk-QLIIVG5Q.js";import{c as s}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as a}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function k(){return i("Tasks"),a(s,{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};
@@ -0,0 +1,2 @@
1
+ import{b as q}from"./chunk-SYDHFYRC.js";import{a as M}from"./chunk-HXSB6YB2.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{a as A}from"./chunk-NCZD5IWS.js";import{a as N}from"./chunk-QLIIVG5Q.js";import{c as B}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import{R as O}from"./chunk-ISUGBMXC.js";import{g as D}from"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Cb as $,Da as F,Ga as t,a as p,ca as y,da as T,na as C,w as H}from"./chunk-WRA24P66.js";import{d as S}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";H();var f=class{constructor(){this.data={}}setMeta(r){Object.entries(r).forEach(([e,s])=>{e.startsWith("@@")||(e=`@@${e}`),this.data[e]=s})}add(r,e,s){this.data[r]=e,s&&(this.data[`@${r}`]=s)}get(r){let e=this.data[r];return e?{source:e,meta:this.data[`@${r}`]}:null}list(){let r=[];return Object.entries(this.data).forEach(([e])=>{if(e.startsWith("@"))return;let s=this.data[e],c=this.data[`@${e}`];r.push({key:e,source:s,meta:c})}),r}toJson(){return{...this.data}}toString(){return JSON.stringify(this.toJson(),null,2)}};function h(){return N("ARB Translations"),t(B,{children:t("div",{className:"TranslationsArbPage",children:[t("div",{className:"TranslationsArbPage__header",children:[t(y,{className:"TranslationsArbPage__header__breadcrumbs",children:[t("a",{href:"/cms/translations",children:"Translations"}),t("div",{children:"ARB"})]}),t(M,{size:"h1",children:"ARB Translations"}),t(A,{as:"p",children:"Enter doc ids below (separated by newlines) to include in an ARB file."})]}),t(h.RequestForm,{})]})})}h.RequestForm=()=>{let[o,r]=p(""),[e,s]=p(!1),[c,l]=p(""),[m,I]=p(null);async function v(a){let u=await O(a),d=new f,g=window.__ROOT_CTX.rootConfig,b=[g.domain];g.base&&g.base!=="/"&&b.push(g.base);let n=b.join("");d.setMeta({locale:"en",context:n,last_modified:new Date().toISOString()}),console.log(u);for(let w in u){let W=await q(w);for(let[P,_]of W.entries()){let R=await D(P),i=d.get(R)?.meta;if(i){let x=i.context.split(", ");x.push(w),x.sort(),i.context=x.join(", "),!i.description&&_.description&&(i.description=_.description)}else i={context:w},_.notes&&(i.description=_.notes);d.add(R,P,i)}}return d}async function L(){try{let a=j(o),u=await v(a);I(u)}catch(a){console.error(a),l(`failed to preview arb: ${a}`)}}async function E(){try{s(!0),console.log("download arb");let a=j(o),d=(await v(a)).toString(),b=await new Response(d).blob(),n=document.createElement("a");n.href=window.URL.createObjectURL(b),n.download=k(a),document.body.appendChild(n),n.click(),document.body.removeChild(n),window.URL.revokeObjectURL(n.href),s(!1)}catch(a){console.error(a),l(`failed to download arb: ${a}`)}}return t("form",{className:"TranslationsArbPage__RequestForm",onSubmit:a=>{a.preventDefault(),E()},children:[t("div",{className:"TranslationsArbPage__RequestForm__textareaWrapper",children:t(C,{required:!0,size:"xs",radius:0,autosize:!0,minRows:8,maxRows:20,value:o,placeholder:"Pages/index",onChange:a=>{r(a.currentTarget.value||"")}})}),t("div",{className:"TranslationsArbPage__RequestForm__submit",children:[t(T,{variant:"default",color:"dark",size:"xs",onClick:L,children:"Preview"}),t(T,{color:"blue",size:"xs",loading:e,type:"submit",leftIcon:t($,{size:16,strokeWidth:1.75}),children:"Download ARB"})]}),c&&t(A,{as:"p",className:"TranslationsArbPage__RequestForm__error",children:c}),m&&t(h.Preview,{arb:m})]})};h.Preview=o=>{let r=o.arb.list().filter(e=>!!e.meta);return console.log(r),t(F,{verticalSpacing:"xs",highlightOnHover:!0,fontSize:"xs",children:[t("thead",{children:t("tr",{children:[t("th",{children:"source"}),t("th",{children:"context"})]})}),t("tbody",{children:r.map(e=>t("tr",{class:"TranslationsArbPage__Preview__Table__row",children:[t("td",{children:e.source}),t("td",{children:[e.meta?.context,e.meta?.description&&t(S,{children:["/ ",e.meta.description]})]})]},e.source))})]})};function j(o){return o.split(`
2
+ `).map(r=>r.trim()).filter(r=>U(r))}function U(o){return!!o&&o.includes("/")&&o.split("/").length===2}function k(o){let r=new Date,e=m=>m.toString().padStart(2,"0"),s=`${r.getFullYear()}${e(r.getMonth()+1)}${e(r.getDate())}t${e(r.getHours())}${e(r.getMinutes())}`,c=window.__ROOT_CTX.rootConfig.projectName||window.__ROOT_CTX.rootConfig.projectId,l=[z(c)];return o.length===1&&l.push(z(o[0])),l.push(s),`${l.join("_")}.arb`}function z(o){return o.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}export{h as TranslationsArbPage};
@@ -0,0 +1 @@
1
+ import{a as p}from"./chunk-HXSB6YB2.js";import{a as x}from"./chunk-PIJ3E47R.js";import{a as S}from"./chunk-QLIIVG5Q.js";import{c as w}from"./chunk-OWBT6YUM.js";import"./chunk-AAHM6RYJ.js";import{d as F,e as y,h as N,l as z,n as C}from"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ga as a,V as P,a as r,c as T,ca as f,da as h,j as H,na as _,sa as b,ua as v}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";H();function L(i){S("Edit Translation");let t=i.hash,[u,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 c(e){console.log(e),await y(t,e),o(m=>({...m,...e})),x({title:"Saved translations",message:`Updated translations for ${t}.`,autoClose:5e3})}return T(()=>{s()},[i.hash]),a(w,{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(p,{size:"h1",children:"Edit Translations"})]}),u?a(P,{color:"gray",size:"xl"}):d?a("div",{className:"TranslationsEditPage__notFound",children:"Not Found"}):a(L.Form,{hash:i.hash,translations:n,onChange:c})]})})}L.Form=i=>{let t=i.translations,u=window.__ROOT_CTX.rootConfig.i18n.locales||[],l=z(u).filter(s=>s!=="en"),[d,g]=r(t.tags||[]),[n,o]=r(null);return T(()=>{g(t.tags||[])},[t.tags]),a("div",{className:"TranslationsEditPage__FormContainer",children:[a("form",{className:"TranslationsEditPage__Form",onSubmit:async s=>{s.preventDefault();let c=s.currentTarget,e=["en",...l],m={};e.forEach(E=>{let B=c.elements[E].value;m[E]=N(B)}),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:C(t,s),autosize:!0,disabled:!!n},s)),a(h,{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(p,{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(h,{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{L as TranslationsEditPage};