@blinkk/root-cms 3.1.6 → 3.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/app.js +1 -1
  2. package/dist/{chunk-U4TMO2LI.js → chunk-NIBAHWGP.js} +2 -2
  3. package/dist/plugin.js +1 -1
  4. package/dist/ui/AIPage-XPE7F5AF.js +1 -0
  5. package/dist/ui/AssetsPage-C3ZEENBO.js +1 -0
  6. package/dist/ui/CollectionPage-VQ4WJHJB.js +1 -0
  7. package/dist/ui/ComparePage-VKOXKID4.js +1 -0
  8. package/dist/ui/{DataPage-YEIS7HBN.js → DataPage-JXZ2Z3DG.js} +1 -1
  9. package/dist/ui/{DataSourcePage-VD6YBDRW.js → DataSourcePage-X3NSUOTP.js} +1 -1
  10. package/dist/ui/{DocTranslationsPage-6XLREBPQ.js → DocTranslationsPage-AJGT52XQ.js} +1 -1
  11. package/dist/ui/DocumentPage-ZFD2KE3A.js +1 -0
  12. package/dist/ui/{EditDataSourcePage-E4PSKSG3.js → EditDataSourcePage-EMK3F6HD.js} +1 -1
  13. package/dist/ui/EditReleasePage-3IAERDSH.js +1 -0
  14. package/dist/ui/EmbeddedAIPage-2W5F7QFL.js +1 -0
  15. package/dist/ui/EmbeddedDocumentPage-BESFW2YZ.js +1 -0
  16. package/dist/ui/{ImageEditorDialog-YDKOGVJV.js → ImageEditorDialog-JDXMU2FC.js} +1 -1
  17. package/dist/ui/LogsPage-KCD4XZ2N.js +1 -0
  18. package/dist/ui/{NewDataSourcePage-NJJDHGPX.js → NewDataSourcePage-EZDU7HGA.js} +1 -1
  19. package/dist/ui/NewReleasePage-FFTRUIP4.js +1 -0
  20. package/dist/ui/{NotFoundPage-CA7XVXUO.js → NotFoundPage-JGG2NTUE.js} +1 -1
  21. package/dist/ui/{ProjectPage-XUBJSCWB.js → ProjectPage-HT5JKR33.js} +1 -1
  22. package/dist/ui/ReleasePage-OYWLGV4D.js +1 -0
  23. package/dist/ui/{ReleasesPage-OY7OKC3C.js → ReleasesPage-XEII7FBC.js} +1 -1
  24. package/dist/ui/{SettingsPage-5EQUY52A.js → SettingsPage-7GIBTPB5.js} +1 -1
  25. package/dist/ui/SidebarToolsPage-GQYTZDAC.js +1 -0
  26. package/dist/ui/TaskPage-SNDDYDZY.js +1 -0
  27. package/dist/ui/TasksPage-CEVWOY67.js +1 -0
  28. package/dist/ui/{TranslationsArbPage-PG5USRYB.js → TranslationsArbPage-ADRLLAIW.js} +1 -1
  29. package/dist/ui/{TranslationsEditPage-GV3ZJXTY.js → TranslationsEditPage-PSKA7K44.js} +1 -1
  30. package/dist/ui/{TranslationsPage-3AKSMCNF.js → TranslationsPage-NGCLDSK7.js} +2 -2
  31. package/dist/ui/{chunk-75NMQ3LW.js → chunk-3YBRRPAN.js} +1 -1
  32. package/dist/ui/{chunk-QLIIVG5Q.js → chunk-5F5XJPKD.js} +1 -1
  33. package/dist/ui/{chunk-ST6QNIWT.js → chunk-6ZVMJXLE.js} +7 -7
  34. package/dist/ui/chunk-7OU4ERTS.js +87 -0
  35. package/dist/ui/chunk-A2JZYRE3.js +1 -0
  36. package/dist/ui/chunk-B74M7NEV.js +1 -0
  37. package/dist/ui/{chunk-UOKVF54Y.js → chunk-BLHXP3SR.js} +1 -1
  38. package/dist/ui/{chunk-UJX25CXD.js → chunk-BOIY4J2R.js} +1 -1
  39. package/dist/ui/chunk-CEWU5VSJ.js +1 -0
  40. package/dist/ui/{chunk-34W6H4YG.js → chunk-CXMVFNX3.js} +1 -1
  41. package/dist/ui/{chunk-F7RQT4XN.js → chunk-EET5AS64.js} +1 -1
  42. package/dist/ui/{chunk-WASID5UU.js → chunk-GJ7ES2LA.js} +1 -1
  43. package/dist/ui/{chunk-2RRM4HEQ.js → chunk-H5JL376P.js} +1 -1
  44. package/dist/ui/{chunk-H37RXS4R.js → chunk-HKCOKHA2.js} +1 -1
  45. package/dist/ui/{chunk-QGAPMQEJ.js → chunk-HUYP5U4K.js} +1 -1
  46. package/dist/ui/{chunk-NCZD5IWS.js → chunk-HWON6MV4.js} +1 -1
  47. package/dist/ui/{chunk-HXSB6YB2.js → chunk-I3H465Z6.js} +1 -1
  48. package/dist/ui/{chunk-535JU7FU.js → chunk-ILFWJKSS.js} +1 -1
  49. package/dist/ui/chunk-K7IG7PO2.js +1 -0
  50. package/dist/ui/{chunk-LAXQZPE3.js → chunk-LKTN7YVM.js} +1 -1
  51. package/dist/ui/{chunk-PLYSJ7W5.js → chunk-LS2JH5QF.js} +1 -1
  52. package/dist/ui/{chunk-QFDU6FXP.js → chunk-MALK5YEV.js} +1 -1
  53. package/dist/ui/{chunk-YP6ZH3MT.js → chunk-MFRPYPCF.js} +1 -1
  54. package/dist/ui/{chunk-RB23LLKL.js → chunk-OKNBFTYR.js} +1 -1
  55. package/dist/ui/{chunk-A7IZAHBZ.js → chunk-P2RVKNG4.js} +1 -1
  56. package/dist/ui/{chunk-JBLSUM6W.js → chunk-P57AFOMR.js} +1 -1
  57. package/dist/ui/{chunk-HV3JJ5UT.js → chunk-PLTI4NG7.js} +1 -1
  58. package/dist/ui/chunk-PY4JH5SN.js +1 -0
  59. package/dist/ui/{chunk-44ZU5WMI.js → chunk-SBAY52SC.js} +1 -1
  60. package/dist/ui/{chunk-Y5EOMMNI.js → chunk-TCKR2BL4.js} +1 -1
  61. package/dist/ui/{chunk-C5FRMXDS.js → chunk-TCRDGNM4.js} +1 -1
  62. package/dist/ui/chunk-TCWN5YRW.js +1 -0
  63. package/dist/ui/{chunk-U7LSFUHT.js → chunk-TZWCCNSA.js} +1 -1
  64. package/dist/ui/{chunk-2PTLQRTU.js → chunk-U5OXKKBN.js} +1 -1
  65. package/dist/ui/{chunk-O7ESOZQO.js → chunk-VZGDXWRK.js} +1 -1
  66. package/dist/ui/{chunk-3LEYSXZP.js → chunk-X3VDQDHP.js} +1 -1
  67. package/dist/ui/chunk-XBYMUPZF.js +19 -0
  68. package/dist/ui/{chunk-QRAFYIAW.js → chunk-XYXL5HSZ.js} +1 -1
  69. package/dist/ui/chunk-Y7RYSRP7.js +7 -0
  70. package/dist/ui/{chunk-WRA24P66.js.LEGAL.txt → chunk-Y7RYSRP7.js.LEGAL.txt} +1 -0
  71. package/dist/ui/chunk-YIKHJONY.js +1 -0
  72. package/dist/ui/{chunk-UCYWQEAS.js → chunk-ZD3ORGA6.js} +1 -1
  73. package/dist/ui/{chunk-YBHFGQ3Z.js → chunk-ZQDUWURP.js} +1 -1
  74. package/dist/ui/{chunk-PIJ3E47R.js → chunk-ZYSR5UIW.js} +1 -1
  75. package/dist/ui/ui.css +1 -1
  76. package/dist/ui/ui.js +1 -1
  77. package/package.json +3 -3
  78. package/dist/ui/AIPage-EO5WH25R.js +0 -1
  79. package/dist/ui/AssetsPage-ESLB4R3I.js +0 -1
  80. package/dist/ui/CollectionPage-MXN7XKUX.js +0 -1
  81. package/dist/ui/ComparePage-TY7VJVE3.js +0 -1
  82. package/dist/ui/DocumentPage-2HNNEGRI.js +0 -1
  83. package/dist/ui/EditReleasePage-DOMXJXCU.js +0 -1
  84. package/dist/ui/EmbeddedAIPage-U5LONYH2.js +0 -1
  85. package/dist/ui/EmbeddedDocumentPage-HYV5GPK6.js +0 -1
  86. package/dist/ui/LogsPage-6KV3CQLH.js +0 -1
  87. package/dist/ui/NewReleasePage-FXHPFUVG.js +0 -1
  88. package/dist/ui/ReleasePage-NLGRYJX7.js +0 -1
  89. package/dist/ui/SidebarToolsPage-FWG6TIDI.js +0 -1
  90. package/dist/ui/TaskPage-APNRUOYG.js +0 -1
  91. package/dist/ui/TasksPage-FTEELXVZ.js +0 -1
  92. package/dist/ui/chunk-235TRWJF.js +0 -81
  93. package/dist/ui/chunk-56NMZYX6.js +0 -19
  94. package/dist/ui/chunk-6WJQBFN5.js +0 -1
  95. package/dist/ui/chunk-EYJ6GKZR.js +0 -1
  96. package/dist/ui/chunk-G5647K25.js +0 -1
  97. package/dist/ui/chunk-OWYV43BT.js +0 -1
  98. package/dist/ui/chunk-QWB6MAPJ.js +0 -7
  99. package/dist/ui/chunk-VJRMR2JM.js +0 -1
  100. package/dist/ui/chunk-WRA24P66.js +0 -7
  101. package/dist/ui/chunk-Z3ZJJWFT.js +0 -1
  102. package/dist/ui/chunk-ZAJPNVYS.js +0 -1
  103. /package/dist/ui/{ImageEditorDialog-YDKOGVJV.js.LEGAL.txt → ImageEditorDialog-JDXMU2FC.js.LEGAL.txt} +0 -0
  104. /package/dist/ui/{chunk-ST6QNIWT.js.LEGAL.txt → chunk-6ZVMJXLE.js.LEGAL.txt} +0 -0
  105. /package/dist/ui/{chunk-235TRWJF.js.LEGAL.txt → chunk-7OU4ERTS.js.LEGAL.txt} +0 -0
package/dist/app.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getServerVersion,
3
3
  serializeAiConfig
4
- } from "./chunk-U4TMO2LI.js";
4
+ } from "./chunk-NIBAHWGP.js";
5
5
  import {
6
6
  getCollectionSchema,
7
7
  getProjectSchemas
@@ -552,7 +552,7 @@ async function generateImage(rootConfig, options) {
552
552
  // package.json
553
553
  var package_default = {
554
554
  name: "@blinkk/root-cms",
555
- version: "3.1.6",
555
+ version: "3.1.7",
556
556
  author: "s@blinkk.com",
557
557
  license: "MIT",
558
558
  engines: {
@@ -727,7 +727,7 @@ var package_default = {
727
727
  yjs: "13.6.27"
728
728
  },
729
729
  peerDependencies: {
730
- "@blinkk/root": "3.1.6",
730
+ "@blinkk/root": "3.1.7",
731
731
  "firebase-admin": ">=11",
732
732
  "firebase-functions": ">=4"
733
733
  },
package/dist/plugin.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  serializeAiConfig,
13
13
  summarizeDiff,
14
14
  translateString
15
- } from "./chunk-U4TMO2LI.js";
15
+ } from "./chunk-NIBAHWGP.js";
16
16
  import {
17
17
  SearchIndexService,
18
18
  runCronJobs
@@ -0,0 +1 @@
1
+ import{a}from"./chunk-XBYMUPZF.js";import"./chunk-LKTN7YVM.js";import"./chunk-AAR7DBEN.js";import"./chunk-7OU4ERTS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{a as i}from"./chunk-5F5XJPKD.js";import{c as o}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{fd as t}from"./chunk-Y7RYSRP7.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";function n(r){return i("AI"),t(o,{children:t(a,{variant:"page",initialChatId:r.chatId})})}export{n as AIPage};
@@ -0,0 +1 @@
1
+ import{a as p}from"./chunk-OKNBFTYR.js";import{a as d}from"./chunk-P57AFOMR.js";import"./chunk-H5JL376P.js";import{a as n}from"./chunk-I3H465Z6.js";import"./chunk-LS2JH5QF.js";import"./chunk-HKCOKHA2.js";import"./chunk-W5DOO6ID.js";import"./chunk-ZQDUWURP.js";import"./chunk-U5OXKKBN.js";import"./chunk-ZYSR5UIW.js";import{a as i}from"./chunk-HWON6MV4.js";import{a as g}from"./chunk-5F5XJPKD.js";import{c as m}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{d as o}from"./chunk-GJ7ES2LA.js";import{a as t,c as r,fd as e,j as h}from"./chunk-Y7RYSRP7.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";h();function k(){g("Asset Library");let[l,u]=p("folder",""),{query:c,route:f}=o(),[a]=t(c.asset||"");return r(()=>{if(a){let s=new URL(window.location.href);s.searchParams.delete("asset"),f(s.pathname+s.search,!0)}},[]),e(m,{children:e("div",{className:"AssetsPage","data-testid":"assets-page",children:[e("div",{className:"AssetsPage__header",children:[e(n,{size:"h1",children:"Asset Library"}),e(i,{as:"p",children:"The asset library can be used to store and organize files used throughout the project. Replacing a file in the asset library automatically updates all draft docs that use it (requires re-publishing)."})]}),e(d,{className:"AssetsPage__browser",mode:"manage",folder:l,onFolderChange:u,initialAssetId:a})]})})}export{k as AssetsPage};
@@ -0,0 +1 @@
1
+ import{a as no}from"./chunk-SBAY52SC.js";import{a as ao}from"./chunk-TCWN5YRW.js";import{f as B}from"./chunk-A2JZYRE3.js";import{a as to,f as lo}from"./chunk-PY4JH5SN.js";import"./chunk-PLTI4NG7.js";import{b as G,d as J,e as Q,m as S,o as A}from"./chunk-CEWU5VSJ.js";import"./chunk-B74M7NEV.js";import"./chunk-YIKHJONY.js";import{a as y}from"./chunk-MALK5YEV.js";import"./chunk-JDW4UORS.js";import{a as z}from"./chunk-BOIY4J2R.js";import"./chunk-Z2CRNO3I.js";import"./chunk-XYXL5HSZ.js";import"./chunk-ATTW36EM.js";import"./chunk-7OU4ERTS.js";import"./chunk-YDO2EDVY.js";import{b as h}from"./chunk-5MV6XVGA.js";import"./chunk-LS2JH5QF.js";import"./chunk-HKCOKHA2.js";import{b as eo}from"./chunk-W5DOO6ID.js";import{a as oo}from"./chunk-ZQDUWURP.js";import"./chunk-U5OXKKBN.js";import"./chunk-ZYSR5UIW.js";import"./chunk-HWON6MV4.js";import{a as co}from"./chunk-5F5XJPKD.js";import{c as io}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import{N as Y}from"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import{B as Z,z as V}from"./chunk-XOWWPE7X.js";import{d as X,e as w}from"./chunk-GJ7ES2LA.js";import{$a as W,Ca as $,Fa as j,Sa as F,Ta as H,V as k,W as E,_a as K,a as M,bb as q,c as U,da as D,eb as I,fd as o,j as fo,qa as P,za as R}from"./chunk-Y7RYSRP7.js";import{d as N}from"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";fo();var O=[{value:"comfortable",label:"Comfortable",Icon:F},{value:"compact",label:"Compact",Icon:H}];function L(e){let{route:c}=X(),l=window.__ROOT_CTX.rootConfig.projectId;co(e.collection?e.collection:"Content"),U(()=>{let n=window.__ROOT_CTX.collections,a=`root-cms::${l}::last_collection`;if(e.collection)window.localStorage.setItem(a,e.collection);else{let s=window.localStorage.getItem(a);if(s&&n[s]){c(`/cms/content/${s}`);return}if(window.__ROOT_CTX.collections.Pages){c("/cms/content/Pages");return}let d=Object.keys(window.__ROOT_CTX.collections)||[];if(d.length>0){let u=d[0];c(`/cms/content/${u}`);return}console.warn("no collections")}},[e.collection,l]);let i=window.__ROOT_CTX.collections;return o(io,{children:o("div",{className:"CollectionPage",children:o("div",{className:"CollectionPage__layout",children:[o("div",{className:"CollectionPage__side",children:o(no,{collections:i,activeCollectionId:e.collection,projectId:l})}),o("div",{className:"CollectionPage__main",children:e.collection&&o(L.Collection,{collection:e.collection},e.collection)})]})})})}L.Collection=e=>{let{roles:c}=oo(),l=window.firebase.user.email||"",i=eo(c,l),[n,a]=y(`root::CollectionPage:${e.collection}:orderBy`,"modifiedAt"),[s,d]=y(`root::CollectionPage:${e.collection}:showArchived`,!1),[u,v]=M(!1),r=window.__ROOT_CTX.collections[e.collection];if(!r)return route("/cms/content"),o(N,{});let t=!!r.viewOptions?.compact,[_,g]=y("root::CollectionPage:density","comfortable"),m=t?"compact":_,f=m==="compact",C=[{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"title",label:"Title (A-Z)"},{value:"titleDesc",label:"Title (Z-A)"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"},{value:"modifiedAt",label:"Last modified"},{value:"modifiedAtAsc",label:"Least recently modified"},...r.sortOptions?.map(p=>({value:p.id,label:p.label}))||[]],[b,ro,T]=to(e.collection,{orderBy:n,includeArchived:s}),go=b&&T.length===0,mo=!b&&T.length===0;return o(N,{children:[o(lo,{collection:e.collection,opened:u,onClose:()=>v(!1)}),o("div",{className:"CollectionPage__collection",children:o("div",{className:"CollectionPage__collection__docsTab",children:[o("div",{className:"CollectionPage__collection__docsTab__header",children:[o("div",{className:"CollectionPage__collection__docsTab__header__title",children:r.name||e.collection}),o("div",{className:"CollectionPage__collection__docsTab__controls",children:[o("div",{className:"CollectionPage__collection__docsTab__controls__showArchived",children:o($,{size:"sm",color:"dark",label:"Show archived:",checked:s,onChange:p=>d(!!p.currentTarget.checked)})}),o("div",{className:"CollectionPage__collection__docsTab__controls__sort",children:[o("div",{className:"CollectionPage__collection__docsTab__controls__sort__label",children:"Sort:"}),o(R,{size:"xs",value:n,onChange:p=>a(p||"modifiedAt"),data:C})]}),o(po,{density:m,locked:t,onChange:g}),o("div",{className:"CollectionPage__collection__docsTab__controls__newDoc",children:o(z,{label:"You don't have access to create new documents",condition:!i,children:o(D,{color:"dark",size:"xs",leftIcon:o(I,{size:16}),onClick:()=>v(!0),disabled:!i,children:"New"})})})]})]}),o(ao,{className:"CollectionPage__collection__docsTab__content",children:go?o("div",{className:"CollectionPage__collection__docsTab__content__loading",children:o(k,{color:"gray",size:"xl"})}):mo?o("div",{class:"CollectionPage__collection__docsEmpty",children:[o("div",{class:"CollectionPage__collection__docsEmpty__title",children:"Collection is empty."}),o("div",{class:"CollectionPage__collection__docsEmpty__button",children:o(z,{label:"You don't have access to create new documents",condition:!i,children:o(D,{color:"dark",size:"xs",leftIcon:o(I,{size:16}),onClick:()=>v(!0),disabled:!i,children:"New"})})})]}):o("div",{className:"CollectionPage__collection__docsTab__content__list",children:[b&&o("div",{className:"CollectionPage__collection__docsTab__content__reloading",children:o(k,{color:"gray",size:"md"})}),o("div",{className:w("CollectionPage__collection__docsTab__content__items",b&&"CollectionPage__collection__docsTab__content__items--loading"),children:o(L.DocsList,{collection:e.collection,docs:T,compact:f,orderBy:n,onSort:a,reloadDocs:()=>ro()})})]})})]})})]})};function po(e){let l=(O.find(n=>n.value===e.density)||O[0]).Icon,i=o(E,{variant:"default",color:"gray",size:30,disabled:e.locked,"aria-label":"Change view density",children:o(l,{size:16})});return o("div",{className:"CollectionPage__collection__docsTab__controls__density",children:[o("div",{className:"CollectionPage__collection__docsTab__controls__density__label",children:"View:"}),e.locked?o(j,{label:"This collection is locked to the compact view",transition:"pop",withArrow:!0,children:i}):o(P,{position:"bottom",placement:"end",control:i,children:[o(P.Label,{children:"View density"}),O.map(n=>{let a=n.Icon,s=n.value===e.density;return o(P.Item,{icon:o(a,{size:18}),rightSection:s?o(K,{size:14,stroke:2.5}):void 0,onClick:()=>e.onChange(n.value),children:n.label},n.value)})]})]})}var so={slug:{asc:"slug",desc:"slugDesc",defaultDir:"asc"},title:{asc:"title",desc:"titleDesc",defaultDir:"asc"},created:{asc:"oldest",desc:"newest",defaultDir:"desc"},modified:{asc:"modifiedAtAsc",desc:"modifiedAt",defaultDir:"desc"}};function uo(e,c){let l=so[e];return!l||!c?null:c===l.asc?"asc":c===l.desc?"desc":null}function x(e){let c=so[e.column],l=uo(e.column,e.orderBy),i=l!==null;function n(){if(!e.onSort)return;let a;l==="asc"?a="desc":l==="desc"?a="asc":a=c.defaultDir,e.onSort(c[a])}return o("button",{type:"button",className:w("CollectionPage__collection__docsList__header__cell","CollectionPage__collection__docsList__header__cell--sortable",i&&"CollectionPage__collection__docsList__header__cell--active"),onClick:n,"aria-label":`Sort by ${e.label}`,children:[o("span",{children:e.label}),i&&(l==="asc"?o(q,{size:12,stroke:2.5}):o(W,{size:12,stroke:2.5}))]})}function vo(e,c){let l=e?.sys||{},i=0;return(!l.publishedAt||!l.modifiedAt||l.modifiedAt>l.publishedAt)&&i++,l.publishedAt&&i++,l.scheduledAt&&i++,Y(e)&&i++,l.archivedAt&&i++,c>0&&i++,i}L.DocsList=e=>{let c=e.collection,l=window.__ROOT_CTX.collections[e.collection];if(!l)throw new Error(`could not find collection: ${c}`);let i=!!l.url,n=!!e.compact,a=e.docs||[],{getReleasesForDoc:s}=G(),d=n?a.reduce((t,_)=>Math.max(t,vo(_,s(_.id).length)),1):1,u=d<=1?80:d===2?150:215;function v(t){return i?Q({collectionId:c,slug:t}):""}function r(t){(t.action==="archive"||t.action==="copy"||t.action==="unarchive"||t.action==="delete"||t.action==="unpublish"||t.action==="locked"||t.action==="unlocked")&&e.reloadDocs()}return n?o("div",{className:w("CollectionPage__collection__docsList","CollectionPage__collection__docsList--compact"),style:{"--docs-status-width":`${u}px`},children:[o("div",{className:"CollectionPage__collection__docsList__header",children:[o("div",{className:"CollectionPage__collection__docsList__header__image"}),o(x,{column:"slug",label:"Slug",orderBy:e.orderBy,onSort:e.onSort}),o(x,{column:"title",label:"Title",orderBy:e.orderBy,onSort:e.onSort}),o("div",{className:"CollectionPage__collection__docsList__header__cell",children:"Status"}),o(x,{column:"created",label:"Created",orderBy:e.orderBy,onSort:e.onSort}),o(x,{column:"modified",label:"Modified",orderBy:e.orderBy,onSort:e.onSort}),o("div",{className:"CollectionPage__collection__docsList__header__controls"})]}),a.map(t=>{let _=`/cms/content/${c}/${t.slug}`,g=t.fields||{},m=h(g,l.preview?.title||"meta.title"),f=h(g,l.preview?.image||"meta.image")||l.preview?.defaultImage;return o("div",{className:"CollectionPage__collection__docsList__doc",children:[o("a",{className:"CollectionPage__collection__docsList__doc__image",href:_,children:o(A,{file:f,width:40,height:30,withPlaceholder:!f?.src})}),o("a",{className:"CollectionPage__collection__docsList__doc__docId",href:_,children:t.slug}),o("a",{className:"CollectionPage__collection__docsList__doc__title",href:_,children:m||"[UNTITLED]"}),o("div",{className:"CollectionPage__collection__docsList__doc__badges",children:o(S,{doc:t})}),o("div",{className:"CollectionPage__collection__docsList__doc__timestamp",children:_o(t?.sys?.createdAt,t?.sys?.createdBy)}),o("div",{className:"CollectionPage__collection__docsList__doc__timestamp",children:_o(t?.sys?.modifiedAt,t?.sys?.modifiedBy)}),o("div",{className:"CollectionPage__collection__docsList__doc__controls",children:o(B,{docId:t.id,data:t,onAction:r})})]},t.id)})]}):o("div",{className:"CollectionPage__collection__docsList",children:a.map(t=>{let _=`/cms/content/${c}/${t.slug}`,g=v(t.slug),m=t.fields||{},f=h(m,l.preview?.title||"meta.title"),C=h(m,l.preview?.image||"meta.image")||l.preview?.defaultImage;return o("div",{className:"CollectionPage__collection__docsList__doc",children:[o("div",{className:"CollectionPage__collection__docsList__doc__image",children:o("a",{href:_,children:o(A,{file:C,width:120,height:90,withPlaceholder:!C?.src})})}),o("a",{className:"CollectionPage__collection__docsList__doc__content",href:_,children:[o("div",{className:"CollectionPage__collection__docsList__doc__content__header",children:[o("div",{className:"CollectionPage__collection__docsList__doc__content__header__docId",children:t.id}),o(S,{doc:t})]}),o("div",{className:"CollectionPage__collection__docsList__doc__content__title",children:f||"[UNTITLED]"}),i&&g&&o("div",{className:"CollectionPage__collection__docsList__doc__content__url",children:g})]}),o("div",{className:"CollectionPage__collection__docsList__doc__controls",children:o(B,{docId:t.id,data:t,onAction:r})})]},t.id)})})};function _o(e,c){return!e||typeof e.toMillis!="function"?o("span",{className:"CollectionPage__collection__docsList__doc__timestamp__value",children:"\u2014"}):o(J,{message:Z(e),user:c,children:o("span",{className:"CollectionPage__collection__docsList__doc__timestamp__value",children:V(e.toMillis())})})}export{L as CollectionPage};
@@ -0,0 +1 @@
1
+ import{b as s}from"./chunk-YIKHJONY.js";import"./chunk-7OU4ERTS.js";import"./chunk-5MV6XVGA.js";import"./chunk-HWON6MV4.js";import{a as m}from"./chunk-5F5XJPKD.js";import{c as d}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{d as t}from"./chunk-GJ7ES2LA.js";import{fd as a,g as i,j as p}from"./chunk-Y7RYSRP7.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";p();function h(){let{query:r}=t();m("Compare");let o=i(()=>n(r.left||""),[r.left]),e=i(()=>n(r.right||""),[r.right]);return a(d,{children:a("div",{className:"ComparePage",children:o&&e?a(s,{className:"ComparePage__diff",left:o,right:e}):a("div",{className:"ComparePage__error",children:"Invalid params, double check query params."})})})}function n(r){let[o,e]=String(r).split("@");return o&&e?{docId:o,versionId:e}:null}export{h as ComparePage};
@@ -1 +1 @@
1
- import{a as m}from"./chunk-QGAPMQEJ.js";import"./chunk-535JU7FU.js";import{a as y}from"./chunk-HXSB6YB2.js";import{a as k}from"./chunk-OWYV43BT.js";import{a as x}from"./chunk-QFDU6FXP.js";import{a as w}from"./chunk-UJX25CXD.js";import{b as v}from"./chunk-Z2CRNO3I.js";import"./chunk-ATTW36EM.js";import{b as P}from"./chunk-W5DOO6ID.js";import{a as T}from"./chunk-YBHFGQ3Z.js";import"./chunk-PIJ3E47R.js";import{a as p}from"./chunk-NCZD5IWS.js";import{a as B}from"./chunk-QLIIVG5Q.js";import{c as A}from"./chunk-A7IZAHBZ.js";import"./chunk-AAHM6RYJ.js";import{z as u}from"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Ca as b,Da as D,Fa as i,Ga as e,Qc as S,V as g,W as f,a as d,ba as s,c as h,da as _,g as c,j as G}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";G();var z={transition:"pop"};function O(a){let o=a.dataSource;return N(o.archivedAt)?e(i,{...z,label:`Archived ${L(o.archivedAt)} by ${o.archivedBy}`,children:e(s,{size:"xs",color:"gray",variant:"filled",children:"Archived"})}):N(o.publishedAt)?e(i,{...z,label:`Published ${L(o.publishedAt)} by ${o.publishedBy}`,children:e(s,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}):e(s,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Unpublished"})}function N(a){return!!(a&&a.toMillis)}function L(a){return a?.toMillis?u(a.toMillis()):u(new Date().getTime())}function E(){B("Data Sources");let{roles:a}=T(),o=window.firebase.user.email||"",r=P(a,o);return e(A,{children:e("div",{className:"DataPage",children:[e("div",{className:"DataPage__header",children:[e(y,{size:"h1",children:"Data Sources"}),e(p,{as:"p",children:"Add data sources to sync data from external services, like Google Sheets."}),e("div",{className:"DataPage__header__buttons",children:e(w,{label:"You don't have access to create new data sources",condition:!r,children:e(_,{component:"a",color:"blue",size:"xs",href:"/cms/data/new",disabled:!r,style:r?void 0:{pointerEvents:"none"},children:"New data source"})})})]}),e(E.DataSourcesTable,{})]})})}E.DataSourcesTable=()=>{let[a,o]=d(!0),[r,I]=d([]),[l,$]=x("root::DataPage:showArchived",!1),C=t=>!!t&&t.startsWith("https://docs.google.com/spreadsheets/");async function M(){let t=await v();I(t),o(!1)}let H=c(()=>r.some(t=>!!t.archivedAt),[r]),n=c(()=>r.filter(t=>{let U=!!t.archivedAt;return l?!0:!U}),[r,l]);return h(()=>{M()},[]),e("div",{className:"DataPage__DataSourcesTable",children:[!a&&H&&e("div",{className:"DataPage__DataSourcesTable__filters",children:e(b,{size:"sm",color:"dark",label:"Show archived",checked:l,onChange:t=>$(!!t.currentTarget.checked)})}),e(k,{children:[a&&e(g,{color:"gray",size:"xl"}),!a&&n.length>0&&e(D,{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:"type"}),e("th",{children:"url"}),e("th",{children:"status"}),e("th",{children:"last synced"}),e("th",{children:"last published"})]})}),e("tbody",{children:n.map(t=>e("tr",{children:[e("td",{children:e("a",{href:`/cms/data/${t.id}`,children:t.id})}),e("td",{children:t.description||""}),e("td",{children:t.type}),e("td",{children:C(t.url)?e("div",{className:"DataPage__DataSourcesTable__url",children:[e(i,{label:"Open spreadsheet",children:e(f,{component:"a",href:t.url,target:"_blank",rel:"noreferrer",variant:"filled",color:"green",size:"sm","aria-label":"Open spreadsheet",children:e(S,{size:16,stroke:"2.25"})})}),e("a",{className:"DataPage__DataSourcesTable__url__text",href:t.url,target:"_blank",rel:"noreferrer",children:t.url})]}):t.url||""}),e("td",{children:e(O,{dataSource:t})}),e("td",{children:e(m,{dataSource:t,action:"sync"})}),e("td",{children:e(m,{dataSource:t,action:"publish"})})]},t.id))})]}),!a&&n.length===0&&e(p,{as:"p",children:"No data sources found for this filter."})]})]})};export{E as DataPage};
1
+ import{a as m}from"./chunk-HUYP5U4K.js";import"./chunk-ILFWJKSS.js";import{a as y}from"./chunk-I3H465Z6.js";import{a as k}from"./chunk-TCWN5YRW.js";import{a as x}from"./chunk-MALK5YEV.js";import{a as w}from"./chunk-BOIY4J2R.js";import{b as v}from"./chunk-Z2CRNO3I.js";import"./chunk-ATTW36EM.js";import{b as P}from"./chunk-W5DOO6ID.js";import{a as T}from"./chunk-ZQDUWURP.js";import"./chunk-ZYSR5UIW.js";import{a as p}from"./chunk-HWON6MV4.js";import{a as B}from"./chunk-5F5XJPKD.js";import{c as A}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import{z as u}from"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{Ca as b,Da as D,Fa as i,Qc as S,V as g,W as f,a as d,ba as s,c as h,da as _,fd as e,g as c,j as G}from"./chunk-Y7RYSRP7.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";G();var z={transition:"pop"};function O(a){let o=a.dataSource;return N(o.archivedAt)?e(i,{...z,label:`Archived ${L(o.archivedAt)} by ${o.archivedBy}`,children:e(s,{size:"xs",color:"gray",variant:"filled",children:"Archived"})}):N(o.publishedAt)?e(i,{...z,label:`Published ${L(o.publishedAt)} by ${o.publishedBy}`,children:e(s,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}):e(s,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Unpublished"})}function N(a){return!!(a&&a.toMillis)}function L(a){return a?.toMillis?u(a.toMillis()):u(new Date().getTime())}function E(){B("Data Sources");let{roles:a}=T(),o=window.firebase.user.email||"",r=P(a,o);return e(A,{children:e("div",{className:"DataPage",children:[e("div",{className:"DataPage__header",children:[e(y,{size:"h1",children:"Data Sources"}),e(p,{as:"p",children:"Add data sources to sync data from external services, like Google Sheets."}),e("div",{className:"DataPage__header__buttons",children:e(w,{label:"You don't have access to create new data sources",condition:!r,children:e(_,{component:"a",color:"blue",size:"xs",href:"/cms/data/new",disabled:!r,style:r?void 0:{pointerEvents:"none"},children:"New data source"})})})]}),e(E.DataSourcesTable,{})]})})}E.DataSourcesTable=()=>{let[a,o]=d(!0),[r,I]=d([]),[l,$]=x("root::DataPage:showArchived",!1),C=t=>!!t&&t.startsWith("https://docs.google.com/spreadsheets/");async function M(){let t=await v();I(t),o(!1)}let H=c(()=>r.some(t=>!!t.archivedAt),[r]),n=c(()=>r.filter(t=>{let U=!!t.archivedAt;return l?!0:!U}),[r,l]);return h(()=>{M()},[]),e("div",{className:"DataPage__DataSourcesTable",children:[!a&&H&&e("div",{className:"DataPage__DataSourcesTable__filters",children:e(b,{size:"sm",color:"dark",label:"Show archived",checked:l,onChange:t=>$(!!t.currentTarget.checked)})}),e(k,{children:[a&&e(g,{color:"gray",size:"xl"}),!a&&n.length>0&&e(D,{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:"type"}),e("th",{children:"url"}),e("th",{children:"status"}),e("th",{children:"last synced"}),e("th",{children:"last published"})]})}),e("tbody",{children:n.map(t=>e("tr",{children:[e("td",{children:e("a",{href:`/cms/data/${t.id}`,children:t.id})}),e("td",{children:t.description||""}),e("td",{children:t.type}),e("td",{children:C(t.url)?e("div",{className:"DataPage__DataSourcesTable__url",children:[e(i,{label:"Open spreadsheet",children:e(f,{component:"a",href:t.url,target:"_blank",rel:"noreferrer",variant:"filled",color:"green",size:"sm","aria-label":"Open spreadsheet",children:e(S,{size:16,stroke:"2.25"})})}),e("a",{className:"DataPage__DataSourcesTable__url__text",href:t.url,target:"_blank",rel:"noreferrer",children:t.url})]}):t.url||""}),e("td",{children:e(O,{dataSource:t})}),e("td",{children:e(m,{dataSource:t,action:"sync"})}),e("td",{children:e(m,{dataSource:t,action:"publish"})})]},t.id))})]}),!a&&n.length===0&&e(p,{as:"p",children:"No data sources found for this filter."})]})]})};export{E as DataPage};
@@ -1 +1 @@
1
- import{a as f}from"./chunk-QGAPMQEJ.js";import"./chunk-535JU7FU.js";import{a as g}from"./chunk-HXSB6YB2.js";import{a as h}from"./chunk-OWYV43BT.js";import"./chunk-UJX25CXD.js";import{c as T,d as N}from"./chunk-Z2CRNO3I.js";import"./chunk-ATTW36EM.js";import"./chunk-W5DOO6ID.js";import"./chunk-YBHFGQ3Z.js";import"./chunk-PIJ3E47R.js";import{a as A}from"./chunk-NCZD5IWS.js";import{a as H}from"./chunk-QLIIVG5Q.js";import{c as W}from"./chunk-A7IZAHBZ.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-WASID5UU.js";import{Da as D,Fa as p,Ga as a,Jc as k,Qc as z,V as y,W as m,a as _,c as b,ca as v,da as P,j as B,na as x,oa as w}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function r(t){H(`Data Source: ${t.id}`);let[o,l]=_(!0),[e,u]=_(null),[n,c]=_(null),i=t.id;async function d(){let s=await T(i);if(u(s),s){let I=await N(i,{mode:"draft"});c(I)}l(!1)}b(()=>{d()},[]);function S(s){s==="sync"&&d()}return a(W,{children:a("div",{className:"DataSourcePage",children:[a("div",{className:"DataSourcePage__header",children:[a(v,{className:"DataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data"}),a("div",{children:i})]}),a("div",{className:"DataSourcePage__header__titleWrap",children:[a(g,{size:"h1",children:["Data Source: ",i]}),a("div",{className:"DataSourcePage__header__controls",children:a(p,{label:"Configure",children:a(m,{component:"a",href:`/cms/data/${t.id}/edit`,children:a(k,{size:24,stroke:"1.5"})})})})]}),e?.description&&a(A,{as:"p",children:e.description})]}),e&&a(r.SyncStatus,{dataSource:e,onAction:S}),o?a(y,{color:"gray",size:"xl"}):e?a(r.DataSection,{dataSource:e,data:n}):a("div",{className:"DataSourcePage__notFound",children:"Not Found"})]})})}r.SyncStatus=t=>{let o=t.dataSource;return a("div",{className:"DataSourcePage__SyncStatus",children:[a(g,{size:"h2",children:"Status"}),a(h,{className:"DataSourcePage__SyncStatus__content",children:a(D,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[a("thead",{children:a("tr",{children:[a("th",{children:"last synced"}),a("th",{children:"last published"})]})}),a("tbody",{children:a("tr",{children:[a("td",{children:a(f,{dataSource:o,action:"sync",onAction:()=>{t.onAction&&t.onAction("sync")}})}),a("td",{children:a(f,{dataSource:o,action:"publish"})})]})})]})})]})};r.DataSection=t=>{let{data:o,headers:l}=t.data||{},e=t.dataSource;if(!o)return null;let u=e.dataFormat||"map";if(e.type==="gsheet"){let n=l,c=[];if(u==="array")c=o;else if(u==="map"){let i=o;if(!n){let d=new Set;i.forEach(S=>{for(let s in S)s&&d.add(s)}),n=Array.from(d)}i.forEach(d=>{c.push(n.map(S=>d[S]||""))})}return a(r.DataSectionWrap,{dataSource:e,children:a(r.DataTable,{headers:n,rows:c})})}return e.type==="http"?a(r.DataSectionWrap,{dataSource:e,children:a(r.DefaultDataDisplay,{data:o})}):(console.log(`unsupported data type: ${e.type}`),null)};r.DataSectionWrap=t=>a("div",{className:"DataSourcePage__DataSection",children:[a("div",{className:"DataSourcePage__DataSection__header",children:[a(g,{size:"h2",children:"Data"}),a("div",{className:"DataSourcePage__DataSection__header__actions",children:[t.dataSource.url?.startsWith("https://docs.google.com/spreadsheets/")&&a(p,{label:"Open spreadsheet",children:a(m,{component:"a",href:t.dataSource.url,target:"_blank",variant:"filled",color:"green",children:a(z,{size:16,stroke:"2.25"})})}),t.dataSource.previewUrl&&a(P,{component:"a",variant:"default",size:"xs",href:t.dataSource.previewUrl,target:"_blank",children:"Preview"})]})]}),a(h,{className:"DataSourcePage__DataSection__content",children:t.children})]});r.DataTable=t=>{let o=t.headers||[],l=t.rows||[];return a("div",{className:"DataSourcePage__DataTable",children:a(D,{className:"DataSourcePage__DataTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[o.length>0&&a("thead",{children:a("tr",{children:o.map(e=>a("th",{children:e},e))})}),a("tbody",{children:l.map((e,u)=>a("tr",{children:e.map((n,c)=>a("td",{children:n},c))},u))})]})})};r.DefaultDataDisplay=t=>{let o=t.data;return typeof o=="object"?a(w,{value:JSON.stringify(o,null,2),minRows:20,maxRows:100}):a(x,{value:String(o),minRows:12,maxRows:100})};export{r as DataSourcePage};
1
+ import{a as f}from"./chunk-HUYP5U4K.js";import"./chunk-ILFWJKSS.js";import{a as g}from"./chunk-I3H465Z6.js";import{a as h}from"./chunk-TCWN5YRW.js";import"./chunk-BOIY4J2R.js";import{c as T,d as N}from"./chunk-Z2CRNO3I.js";import"./chunk-ATTW36EM.js";import"./chunk-W5DOO6ID.js";import"./chunk-ZQDUWURP.js";import"./chunk-ZYSR5UIW.js";import{a as A}from"./chunk-HWON6MV4.js";import{a as H}from"./chunk-5F5XJPKD.js";import{c as W}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{Da as D,Fa as p,Jc as k,Qc as z,V as y,W as m,a as _,c as b,ca as v,da as P,fd as a,j as B,na as x,oa as w}from"./chunk-Y7RYSRP7.js";import"./chunk-KUCVLANF.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";B();function r(t){H(`Data Source: ${t.id}`);let[o,l]=_(!0),[e,u]=_(null),[n,c]=_(null),i=t.id;async function d(){let s=await T(i);if(u(s),s){let I=await N(i,{mode:"draft"});c(I)}l(!1)}b(()=>{d()},[]);function S(s){s==="sync"&&d()}return a(W,{children:a("div",{className:"DataSourcePage",children:[a("div",{className:"DataSourcePage__header",children:[a(v,{className:"DataSourcePage__header__breadcrumbs",children:[a("a",{href:"/cms/data",children:"Data"}),a("div",{children:i})]}),a("div",{className:"DataSourcePage__header__titleWrap",children:[a(g,{size:"h1",children:["Data Source: ",i]}),a("div",{className:"DataSourcePage__header__controls",children:a(p,{label:"Configure",children:a(m,{component:"a",href:`/cms/data/${t.id}/edit`,children:a(k,{size:24,stroke:"1.5"})})})})]}),e?.description&&a(A,{as:"p",children:e.description})]}),e&&a(r.SyncStatus,{dataSource:e,onAction:S}),o?a(y,{color:"gray",size:"xl"}):e?a(r.DataSection,{dataSource:e,data:n}):a("div",{className:"DataSourcePage__notFound",children:"Not Found"})]})})}r.SyncStatus=t=>{let o=t.dataSource;return a("div",{className:"DataSourcePage__SyncStatus",children:[a(g,{size:"h2",children:"Status"}),a(h,{className:"DataSourcePage__SyncStatus__content",children:a(D,{verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[a("thead",{children:a("tr",{children:[a("th",{children:"last synced"}),a("th",{children:"last published"})]})}),a("tbody",{children:a("tr",{children:[a("td",{children:a(f,{dataSource:o,action:"sync",onAction:()=>{t.onAction&&t.onAction("sync")}})}),a("td",{children:a(f,{dataSource:o,action:"publish"})})]})})]})})]})};r.DataSection=t=>{let{data:o,headers:l}=t.data||{},e=t.dataSource;if(!o)return null;let u=e.dataFormat||"map";if(e.type==="gsheet"){let n=l,c=[];if(u==="array")c=o;else if(u==="map"){let i=o;if(!n){let d=new Set;i.forEach(S=>{for(let s in S)s&&d.add(s)}),n=Array.from(d)}i.forEach(d=>{c.push(n.map(S=>d[S]||""))})}return a(r.DataSectionWrap,{dataSource:e,children:a(r.DataTable,{headers:n,rows:c})})}return e.type==="http"?a(r.DataSectionWrap,{dataSource:e,children:a(r.DefaultDataDisplay,{data:o})}):(console.log(`unsupported data type: ${e.type}`),null)};r.DataSectionWrap=t=>a("div",{className:"DataSourcePage__DataSection",children:[a("div",{className:"DataSourcePage__DataSection__header",children:[a(g,{size:"h2",children:"Data"}),a("div",{className:"DataSourcePage__DataSection__header__actions",children:[t.dataSource.url?.startsWith("https://docs.google.com/spreadsheets/")&&a(p,{label:"Open spreadsheet",children:a(m,{component:"a",href:t.dataSource.url,target:"_blank",variant:"filled",color:"green",children:a(z,{size:16,stroke:"2.25"})})}),t.dataSource.previewUrl&&a(P,{component:"a",variant:"default",size:"xs",href:t.dataSource.previewUrl,target:"_blank",children:"Preview"})]})]}),a(h,{className:"DataSourcePage__DataSection__content",children:t.children})]});r.DataTable=t=>{let o=t.headers||[],l=t.rows||[];return a("div",{className:"DataSourcePage__DataTable",children:a(D,{className:"DataSourcePage__DataTable__table",verticalSpacing:"xs",striped:!0,highlightOnHover:!0,fontSize:"xs",children:[o.length>0&&a("thead",{children:a("tr",{children:o.map(e=>a("th",{children:e},e))})}),a("tbody",{children:l.map((e,u)=>a("tr",{children:e.map((n,c)=>a("td",{children:n},c))},u))})]})})};r.DefaultDataDisplay=t=>{let o=t.data;return typeof o=="object"?a(w,{value:JSON.stringify(o,null,2),minRows:20,maxRows:100}):a(x,{value:String(o),minRows:12,maxRows:100})};export{r as DataSourcePage};
@@ -1 +1 @@
1
- import{a as sa}from"./chunk-34W6H4YG.js";import{a as ta}from"./chunk-SYDHFYRC.js";import{c as ia}from"./chunk-RB23LLKL.js";import{a as na}from"./chunk-HXSB6YB2.js";import"./chunk-QRAFYIAW.js";import{b as U}from"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{b as G}from"./chunk-2PTLQRTU.js";import{a as O,b as j}from"./chunk-PIJ3E47R.js";import"./chunk-NCZD5IWS.js";import{a as ra}from"./chunk-QLIIVG5Q.js";import{c as N}from"./chunk-A7IZAHBZ.js";import"./chunk-AAHM6RYJ.js";import{Q as J,X as K}from"./chunk-ISUGBMXC.js";import{c as V,g as X,i as C,l as S,n as q}from"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{e as M}from"./chunk-WASID5UU.js";import{Cb as Q,Db as Y,Fa as P,Fc as aa,Ga as a,Qc as ea,Uc as oa,V as B,W as k,a as r,c as w,ca as W,da as b,e as E,g as R,j as fa,nc as Z,qa as y}from"./chunk-WRA24P66.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";fa();function u(e){ra(`Translations: ${e.collection}/${e.slug}`);let[g,l]=r(!0),[h,_]=r(!1),[o,t]=r([]),[s,c]=r({}),[L,la]=r(null),[ca,F]=r(!1),[I,z]=r({}),[da,H]=r(!1),p=e.collection,x=e.slug,i=`${p}/${x}`,ga=sa(),_a=window.__ROOT_CTX.rootConfig.i18n||{},D=S((_a.locales||[]).filter(n=>!C(n))),[$,A]=ia("locale",D);async function Ta(){try{let[n,d]=await Promise.all([ta(i),K(i)]),T=await Promise.all(n.map(f=>X(f))),m=await V(T);t(n),c(m),la(d),l(!1)}catch(n){console.error(n),l(!1),_(!0)}}if(w(()=>{Ta()},[]),h)return a(u.NotFound,{docId:i});function ua(n,d,T){F(!0),z(m=>{let f={...m},v=f[n]??{};return v.source=n,v[d]=T,f[n]=v,f})}async function ha(){H(!0),await G(async()=>{console.log("EditTranslationsModal.onSave()");let n=`edit-translations-${i}`;O({id:n,loading:!0,title:"Saving translations",message:`Updating for ${i}...`,autoClose:!1,disallowClose:!0});let d=Object.values(I);console.log(d),await J(i,d),j({id:n,title:"Saved translations",message:`Updated translations for ${i}!`,autoClose:!0}),z({}),F(!1)}),H(!1)}function ma(n){$.length===D.length?A([n]):A(D)}return a(N,{children:a("div",{className:"DocTranslationsPage",children:[a("div",{className:"DocTranslationsPage__header",children:[a(W,{className:"DocTranslationsPage__header__breadcrumbs",children:[a("a",{href:`/cms/content/${p}`,children:p}),a("a",{href:`/cms/content/${p}/${x}`,children:x}),a("div",{children:"translations"})]}),a("div",{className:"DocTranslationsPage__header__titleWrap",children:a(na,{size:"h1",children:["Translations: ",i]})}),a("div",{className:"DocTranslationsPage__header__controls",children:[L&&a("div",{className:"DocTranslationsPage__header__linkedSheet",children:a("div",{className:"DocTranslationsPage__header__linkedSheet__controls",children:[a(P,{label:"Open Google Sheet",children:a(k,{component:"a",href:U(L),target:"_blank",variant:"filled",color:"green",size:"sm",children:a(ea,{size:16,strokeWidth:2.25})})}),a(b,{variant:"default",size:"xs",leftIcon:a(Y,{size:16,strokeWidth:1.75}),children:"Import from Sheet"}),a(b,{variant:"default",size:"xs",leftIcon:a(Q,{size:16,strokeWidth:1.75}),children:"Export to Sheet"})]})}),a(y,{className:"DocTranslationsPage__toolsMenu",control:a(P,{label:"Tools",children:a(k,{variant:"default",children:a(oa,{size:16})})}),size:220,children:a(y.Item,{className:"DocTranslationsPage__toolsMenu__item",icon:a(aa,{size:16}),onClick:()=>ga.open({docId:i,sourceStrings:o,onPruned:n=>{c(d=>{let T={...d};return n.forEach(m=>delete T[m]),T})}}),children:"Prune unused strings"})})]})]}),a("div",{className:M("DocTranslationsPage__content",g&&"DocTranslationsPage__content--loading"),children:g?a(B,{color:"gray",size:"xl"}):a(u.Table,{locales:$,sourceStrings:o,translationsMap:s,onChange:ua,changesMap:I,onSelectLocale:n=>ma(n)})}),a("div",{className:"DocTranslationsPage__footer",children:a("div",{className:"DocTranslationsPage__footer__buttons",children:a(b,{variant:"filled",color:"dark",disabled:!ca,loading:da,onClick:()=>ha(),children:"Save"})})})]})})}u.NotFound=e=>a(N,{children:a("div",{className:"DocTranslationsPage DocTranslationsPage--error",children:a("div",{className:"DocTranslationsPage__error",children:[a("div",{className:"DocTranslationsPage__error__icon",children:a(Z,{size:60})}),a("div",{className:"DocTranslationsPage__error__title",children:["Not found: ",e.docId]})]})})});u.Table=e=>{let g=window.__ROOT_CTX.rootConfig.i18n||{},l=S((g.locales||[]).filter(o=>!C(o))),h=R(()=>{let o={};return Object.values(e.translationsMap).forEach(t=>{o[t.source]=t}),o},[e.translationsMap]);function _(o,t){let s=h[o]||{};return{translation:q(s,t),hasChanges:!1}}return a("div",{className:"DocTranslationsPage__TableWrap",children:a("table",{className:"DocTranslationsPage__Table",children:[a("thead",{children:a("tr",{children:[a("th",{className:"DocTranslationsPage__Table__sourceCellHeader",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:"source"})}),e.locales.map(o=>a("th",{onClick:()=>e.onSelectLocale(o),className:"DocTranslationsPage__Table__localeHeader",children:a(P,{className:"DocTranslationsPage__Table__headerTooltip",placement:"start",withArrow:!0,label:e.locales.length===l.length?`Show only ${o}`:"Show all locales",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:o})})},o))]})}),a("tbody",{children:e.sourceStrings.map(o=>a("tr",{children:[a("td",{className:"DocTranslationsPage__Table__sourceCellWrap",children:a("div",{className:"DocTranslationsPage__Table__sourceCell",children:o})}),e.locales.map(t=>{let s=_(o,t);return a("td",{children:a(u.Textarea,{source:o,locale:t,value:s.translation,onChange:e.onChange,changesMap:e.changesMap})},t)})]},o))})]})})};u.Textarea=e=>{let g=E(null),[l,h]=r(e.value),_=null;e.locale in(e.changesMap[e.source]||{})&&(_=e.changesMap[e.source][e.locale]);let o=_!==null&&_!==e.value;function t(){window.requestAnimationFrame(()=>{let s=g.current;s.style.minHeight="auto";let c=s.scrollHeight;s.style.minHeight=`${c}px`})}return w(()=>{t()},[l]),a("textarea",{ref:g,className:M("DocTranslationsPage__Textarea",o&&"DocTranslationsPage__Textarea--hasChanges",!l&&"DocTranslationsPage__Textarea--empty"),onFocus:()=>t(),rows:1,onChange:s=>{let c=s.target.value;h(c),e.onChange(e.source,e.locale,c)},value:l})};export{u as DocTranslationsPage};
1
+ import{a as sa}from"./chunk-CXMVFNX3.js";import{a as ta}from"./chunk-SYDHFYRC.js";import{c as ia}from"./chunk-OKNBFTYR.js";import{a as na}from"./chunk-I3H465Z6.js";import"./chunk-XYXL5HSZ.js";import{b as U}from"./chunk-ATTW36EM.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{b as G}from"./chunk-U5OXKKBN.js";import{a as O,b as j}from"./chunk-ZYSR5UIW.js";import"./chunk-HWON6MV4.js";import{a as ra}from"./chunk-5F5XJPKD.js";import{c as N}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import{Q as J,X as K}from"./chunk-ISUGBMXC.js";import{c as V,g as X,i as C,l as S,n as q}from"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{e as M}from"./chunk-GJ7ES2LA.js";import{Bb as Q,Db as Y,Fa as P,Fc as aa,Qc as ea,Uc as oa,V as B,W as k,a as r,c as w,ca as W,da as b,e as E,fd as a,g as R,j as fa,nc as Z,qa as y}from"./chunk-Y7RYSRP7.js";import"./chunk-KUCVLANF.js";import"./chunk-7SK47HHZ.js";import"./chunk-DTMZLUNY.js";import"./chunk-PVAE643M.js";fa();function u(e){ra(`Translations: ${e.collection}/${e.slug}`);let[g,l]=r(!0),[h,_]=r(!1),[o,t]=r([]),[s,c]=r({}),[L,la]=r(null),[ca,F]=r(!1),[I,z]=r({}),[da,H]=r(!1),p=e.collection,x=e.slug,i=`${p}/${x}`,ga=sa(),_a=window.__ROOT_CTX.rootConfig.i18n||{},D=S((_a.locales||[]).filter(n=>!C(n))),[$,A]=ia("locale",D);async function Ta(){try{let[n,d]=await Promise.all([ta(i),K(i)]),T=await Promise.all(n.map(f=>X(f))),m=await V(T);t(n),c(m),la(d),l(!1)}catch(n){console.error(n),l(!1),_(!0)}}if(w(()=>{Ta()},[]),h)return a(u.NotFound,{docId:i});function ua(n,d,T){F(!0),z(m=>{let f={...m},v=f[n]??{};return v.source=n,v[d]=T,f[n]=v,f})}async function ha(){H(!0),await G(async()=>{console.log("EditTranslationsModal.onSave()");let n=`edit-translations-${i}`;O({id:n,loading:!0,title:"Saving translations",message:`Updating for ${i}...`,autoClose:!1,disallowClose:!0});let d=Object.values(I);console.log(d),await J(i,d),j({id:n,title:"Saved translations",message:`Updated translations for ${i}!`,autoClose:!0}),z({}),F(!1)}),H(!1)}function ma(n){$.length===D.length?A([n]):A(D)}return a(N,{children:a("div",{className:"DocTranslationsPage",children:[a("div",{className:"DocTranslationsPage__header",children:[a(W,{className:"DocTranslationsPage__header__breadcrumbs",children:[a("a",{href:`/cms/content/${p}`,children:p}),a("a",{href:`/cms/content/${p}/${x}`,children:x}),a("div",{children:"translations"})]}),a("div",{className:"DocTranslationsPage__header__titleWrap",children:a(na,{size:"h1",children:["Translations: ",i]})}),a("div",{className:"DocTranslationsPage__header__controls",children:[L&&a("div",{className:"DocTranslationsPage__header__linkedSheet",children:a("div",{className:"DocTranslationsPage__header__linkedSheet__controls",children:[a(P,{label:"Open Google Sheet",children:a(k,{component:"a",href:U(L),target:"_blank",variant:"filled",color:"green",size:"sm",children:a(ea,{size:16,strokeWidth:2.25})})}),a(b,{variant:"default",size:"xs",leftIcon:a(Y,{size:16,strokeWidth:1.75}),children:"Import from Sheet"}),a(b,{variant:"default",size:"xs",leftIcon:a(Q,{size:16,strokeWidth:1.75}),children:"Export to Sheet"})]})}),a(y,{className:"DocTranslationsPage__toolsMenu",control:a(P,{label:"Tools",children:a(k,{variant:"default",children:a(oa,{size:16})})}),size:220,children:a(y.Item,{className:"DocTranslationsPage__toolsMenu__item",icon:a(aa,{size:16}),onClick:()=>ga.open({docId:i,sourceStrings:o,onPruned:n=>{c(d=>{let T={...d};return n.forEach(m=>delete T[m]),T})}}),children:"Prune unused strings"})})]})]}),a("div",{className:M("DocTranslationsPage__content",g&&"DocTranslationsPage__content--loading"),children:g?a(B,{color:"gray",size:"xl"}):a(u.Table,{locales:$,sourceStrings:o,translationsMap:s,onChange:ua,changesMap:I,onSelectLocale:n=>ma(n)})}),a("div",{className:"DocTranslationsPage__footer",children:a("div",{className:"DocTranslationsPage__footer__buttons",children:a(b,{variant:"filled",color:"dark",disabled:!ca,loading:da,onClick:()=>ha(),children:"Save"})})})]})})}u.NotFound=e=>a(N,{children:a("div",{className:"DocTranslationsPage DocTranslationsPage--error",children:a("div",{className:"DocTranslationsPage__error",children:[a("div",{className:"DocTranslationsPage__error__icon",children:a(Z,{size:60})}),a("div",{className:"DocTranslationsPage__error__title",children:["Not found: ",e.docId]})]})})});u.Table=e=>{let g=window.__ROOT_CTX.rootConfig.i18n||{},l=S((g.locales||[]).filter(o=>!C(o))),h=R(()=>{let o={};return Object.values(e.translationsMap).forEach(t=>{o[t.source]=t}),o},[e.translationsMap]);function _(o,t){let s=h[o]||{};return{translation:q(s,t),hasChanges:!1}}return a("div",{className:"DocTranslationsPage__TableWrap",children:a("table",{className:"DocTranslationsPage__Table",children:[a("thead",{children:a("tr",{children:[a("th",{className:"DocTranslationsPage__Table__sourceCellHeader",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:"source"})}),e.locales.map(o=>a("th",{onClick:()=>e.onSelectLocale(o),className:"DocTranslationsPage__Table__localeHeader",children:a(P,{className:"DocTranslationsPage__Table__headerTooltip",placement:"start",withArrow:!0,label:e.locales.length===l.length?`Show only ${o}`:"Show all locales",children:a("div",{className:"DocTranslationsPage__Table__headerLabel",children:o})})},o))]})}),a("tbody",{children:e.sourceStrings.map(o=>a("tr",{children:[a("td",{className:"DocTranslationsPage__Table__sourceCellWrap",children:a("div",{className:"DocTranslationsPage__Table__sourceCell",children:o})}),e.locales.map(t=>{let s=_(o,t);return a("td",{children:a(u.Textarea,{source:o,locale:t,value:s.translation,onChange:e.onChange,changesMap:e.changesMap})},t)})]},o))})]})})};u.Textarea=e=>{let g=E(null),[l,h]=r(e.value),_=null;e.locale in(e.changesMap[e.source]||{})&&(_=e.changesMap[e.source][e.locale]);let o=_!==null&&_!==e.value;function t(){window.requestAnimationFrame(()=>{let s=g.current;s.style.minHeight="auto";let c=s.scrollHeight;s.style.minHeight=`${c}px`})}return w(()=>{t()},[l]),a("textarea",{ref:g,className:M("DocTranslationsPage__Textarea",o&&"DocTranslationsPage__Textarea--hasChanges",!l&&"DocTranslationsPage__Textarea--empty"),onFocus:()=>t(),rows:1,onChange:s=>{let c=s.target.value;h(c),e.onChange(e.source,e.locale,c)},value:l})};export{u as DocTranslationsPage};
@@ -0,0 +1 @@
1
+ import{d as Ke,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-6ZVMJXLE.js";import"./chunk-ZD3ORGA6.js";import"./chunk-MYPLMHFW.js";import"./chunk-TZWCCNSA.js";import"./chunk-CXMVFNX3.js";import"./chunk-SYDHFYRC.js";import"./chunk-ILFWJKSS.js";import"./chunk-FBSBL476.js";import{a as nt}from"./chunk-XBYMUPZF.js";import"./chunk-LKTN7YVM.js";import"./chunk-AAR7DBEN.js";import{b as it}from"./chunk-OKNBFTYR.js";import"./chunk-P57AFOMR.js";import"./chunk-H5JL376P.js";import"./chunk-I3H465Z6.js";import"./chunk-A2JZYRE3.js";import{c as qe}from"./chunk-PY4JH5SN.js";import"./chunk-PLTI4NG7.js";import{f as He,g as ce}from"./chunk-CEWU5VSJ.js";import"./chunk-B74M7NEV.js";import"./chunk-YIKHJONY.js";import{a as T}from"./chunk-MALK5YEV.js";import"./chunk-JDW4UORS.js";import{a as fe}from"./chunk-BOIY4J2R.js";import"./chunk-Z2CRNO3I.js";import"./chunk-XYXL5HSZ.js";import"./chunk-ATTW36EM.js";import{c as $e}from"./chunk-7OU4ERTS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-LS2JH5QF.js";import"./chunk-HKCOKHA2.js";import{b as Xe}from"./chunk-W5DOO6ID.js";import{a as je}from"./chunk-ZQDUWURP.js";import"./chunk-U5OXKKBN.js";import"./chunk-ZYSR5UIW.js";import"./chunk-HWON6MV4.js";import{a as at}from"./chunk-5F5XJPKD.js";import{c as ot}from"./chunk-P2RVKNG4.js";import{a as Ue}from"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{e as E}from"./chunk-GJ7ES2LA.js";import{$b as Ae,$c as We,Fa as R,Gc as Ve,Ha as Se,Na as ye,P as ke,Pa as ie,Ra as Ie,Va as Ee,W as N,_a as Ne,_b as Be,a as I,ad as re,ba as De,c as b,da as Y,e as w,fd as e,g as z,h as D,j as ae,mb as Te,sb as Re,tb as Le,ub as Me,vb as ze,vc as Oe,za as Ce,zc as Fe}from"./chunk-Y7RYSRP7.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($e,{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=qe(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}=je(),c=window.firebase.user.email||"",d=Xe(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=Ue(),[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]),$=Ke(),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=He({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};
@@ -1 +1 @@
1
- import{a as H}from"./chunk-UOKVF54Y.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-Z2CRNO3I.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-A7IZAHBZ.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};
1
+ import{a as H}from"./chunk-BLHXP3SR.js";import"./chunk-ILFWJKSS.js";import{a as B}from"./chunk-I3H465Z6.js";import{a as F}from"./chunk-TCWN5YRW.js";import"./chunk-JDW4UORS.js";import{a as _}from"./chunk-BOIY4J2R.js";import{c as u,f as A,g as E,j as T,l as z}from"./chunk-Z2CRNO3I.js";import{a as w,c as p}from"./chunk-XYXL5HSZ.js";import"./chunk-ATTW36EM.js";import{a as N}from"./chunk-W5DOO6ID.js";import{a as M}from"./chunk-ZQDUWURP.js";import"./chunk-U5OXKKBN.js";import{a as s,b as r}from"./chunk-ZYSR5UIW.js";import{a as m}from"./chunk-HWON6MV4.js";import{a as L}from"./chunk-5F5XJPKD.js";import{c as O}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import{d as y}from"./chunk-GJ7ES2LA.js";import{Ac as U,Fa as n,Ka as I,W as l,a as D,c as x,ca as P,dd as $,fd as e,j as K,kb as k}from"./chunk-Y7RYSRP7.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-X3VDQDHP.js";import"./chunk-TCRDGNM4.js";import"./chunk-EET5AS64.js";import"./chunk-TZWCCNSA.js";import{a as z}from"./chunk-I3H465Z6.js";import{a as N}from"./chunk-TCWN5YRW.js";import"./chunk-PY4JH5SN.js";import"./chunk-PLTI4NG7.js";import"./chunk-CEWU5VSJ.js";import{d as s,f as E,g as w}from"./chunk-B74M7NEV.js";import"./chunk-YIKHJONY.js";import"./chunk-MALK5YEV.js";import"./chunk-JDW4UORS.js";import{a as I}from"./chunk-BOIY4J2R.js";import"./chunk-Z2CRNO3I.js";import{a as x,c as C}from"./chunk-XYXL5HSZ.js";import"./chunk-ATTW36EM.js";import"./chunk-7OU4ERTS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-LS2JH5QF.js";import"./chunk-HKCOKHA2.js";import{a as T}from"./chunk-W5DOO6ID.js";import{a as A}from"./chunk-ZQDUWURP.js";import"./chunk-U5OXKKBN.js";import{a as h,b as f}from"./chunk-ZYSR5UIW.js";import{a as g}from"./chunk-HWON6MV4.js";import{a as $}from"./chunk-5F5XJPKD.js";import{c as k}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{d as P}from"./chunk-GJ7ES2LA.js";import{Ac as y,Fa as m,Ka as p,W as c,a as v,c as R,ca as b,fd as e,j as H}from"./chunk-Y7RYSRP7.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-XBYMUPZF.js";import"./chunk-LKTN7YVM.js";import"./chunk-AAR7DBEN.js";import{b as i}from"./chunk-OKNBFTYR.js";import"./chunk-7OU4ERTS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import{a as f}from"./chunk-5F5XJPKD.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{c as r,e as t,fd as o,j as m}from"./chunk-Y7RYSRP7.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-6ZVMJXLE.js";import"./chunk-ZD3ORGA6.js";import"./chunk-MYPLMHFW.js";import"./chunk-TZWCCNSA.js";import"./chunk-CXMVFNX3.js";import"./chunk-SYDHFYRC.js";import"./chunk-ILFWJKSS.js";import{b as s}from"./chunk-FBSBL476.js";import"./chunk-LKTN7YVM.js";import"./chunk-AAR7DBEN.js";import"./chunk-P57AFOMR.js";import"./chunk-H5JL376P.js";import"./chunk-I3H465Z6.js";import"./chunk-A2JZYRE3.js";import"./chunk-PY4JH5SN.js";import"./chunk-PLTI4NG7.js";import"./chunk-CEWU5VSJ.js";import"./chunk-B74M7NEV.js";import"./chunk-YIKHJONY.js";import"./chunk-MALK5YEV.js";import"./chunk-JDW4UORS.js";import"./chunk-BOIY4J2R.js";import"./chunk-Z2CRNO3I.js";import"./chunk-XYXL5HSZ.js";import"./chunk-ATTW36EM.js";import"./chunk-7OU4ERTS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-LS2JH5QF.js";import"./chunk-HKCOKHA2.js";import{b as p}from"./chunk-W5DOO6ID.js";import{a as D}from"./chunk-ZQDUWURP.js";import"./chunk-U5OXKKBN.js";import"./chunk-ZYSR5UIW.js";import"./chunk-HWON6MV4.js";import{a as x}from"./chunk-5F5XJPKD.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import{e as b}from"./chunk-GJ7ES2LA.js";import{a as v,c as m,da as f,e as u,fd as t,j as B,tb as _}from"./chunk-Y7RYSRP7.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(_,{size:16}),loading:r==="SAVING",disabled:r!=="UPDATE_PENDING"&&r!=="ERROR",onClick:()=>a.flush(),children:"Save"})]})]}),t("div",{className:b("EmbeddedDocumentPage__editor","DocumentPage__side"),children:t(S,{docId:o,hideStatusBar:!0})})]})}export{H as EmbeddedDocumentPage};
@@ -1,4 +1,4 @@
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 {
1
+ import{A as le,Aa as de,Ba as me,Fa as $,Qa as ve,Ra as we,W as K,Y as pe,_a as ye,a as C,c as Y,da as N,fa as P,fd as h,g as ue,ga as he,h as q,j as qe,ra as fe,va as J,y as Ke}from"./chunk-Y7RYSRP7.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-MFRPYPCF.js";import"./chunk-H5JL376P.js";import{a}from"./chunk-I3H465Z6.js";import"./chunk-TCWN5YRW.js";import"./chunk-ATTW36EM.js";import"./chunk-LS2JH5QF.js";import"./chunk-HKCOKHA2.js";import{a as i}from"./chunk-5F5XJPKD.js";import{c as g}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{fd as o}from"./chunk-Y7RYSRP7.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};
@@ -1 +1 @@
1
- import{a as d}from"./chunk-UOKVF54Y.js";import"./chunk-535JU7FU.js";import{a as r}from"./chunk-HXSB6YB2.js";import"./chunk-JDW4UORS.js";import"./chunk-Z2CRNO3I.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-A7IZAHBZ.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};
1
+ import{a as d}from"./chunk-BLHXP3SR.js";import"./chunk-ILFWJKSS.js";import{a as r}from"./chunk-I3H465Z6.js";import"./chunk-JDW4UORS.js";import"./chunk-Z2CRNO3I.js";import"./chunk-ATTW36EM.js";import"./chunk-U5OXKKBN.js";import"./chunk-ZYSR5UIW.js";import{a as o}from"./chunk-5F5XJPKD.js";import{c as t}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{ca as e,fd as a}from"./chunk-Y7RYSRP7.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-X3VDQDHP.js";import"./chunk-TCRDGNM4.js";import"./chunk-EET5AS64.js";import"./chunk-TZWCCNSA.js";import{a as r}from"./chunk-I3H465Z6.js";import"./chunk-PY4JH5SN.js";import"./chunk-PLTI4NG7.js";import"./chunk-CEWU5VSJ.js";import"./chunk-B74M7NEV.js";import"./chunk-YIKHJONY.js";import"./chunk-MALK5YEV.js";import"./chunk-JDW4UORS.js";import"./chunk-BOIY4J2R.js";import"./chunk-Z2CRNO3I.js";import"./chunk-XYXL5HSZ.js";import"./chunk-ATTW36EM.js";import"./chunk-7OU4ERTS.js";import"./chunk-YDO2EDVY.js";import"./chunk-5MV6XVGA.js";import"./chunk-LS2JH5QF.js";import"./chunk-HKCOKHA2.js";import"./chunk-W5DOO6ID.js";import"./chunk-ZQDUWURP.js";import"./chunk-U5OXKKBN.js";import"./chunk-ZYSR5UIW.js";import"./chunk-HWON6MV4.js";import{a as d}from"./chunk-5F5XJPKD.js";import{c as s}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{ca as a,fd as e}from"./chunk-Y7RYSRP7.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-QLIIVG5Q.js";import{c as e}from"./chunk-A7IZAHBZ.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};
1
+ import{a as n}from"./chunk-5F5XJPKD.js";import{c as e}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-GJ7ES2LA.js";import{fd as o,nc as t}from"./chunk-Y7RYSRP7.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 +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-A7IZAHBZ.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};
1
+ import{a as s}from"./chunk-TCKR2BL4.js";import"./chunk-XACLTYBB.js";import{a as l}from"./chunk-MFRPYPCF.js";import"./chunk-H5JL376P.js";import{a as n}from"./chunk-SBAY52SC.js";import{a as r}from"./chunk-TCWN5YRW.js";import"./chunk-MALK5YEV.js";import"./chunk-ATTW36EM.js";import"./chunk-LS2JH5QF.js";import"./chunk-HKCOKHA2.js";import"./chunk-U5OXKKBN.js";import"./chunk-ZYSR5UIW.js";import{a as c}from"./chunk-5F5XJPKD.js";import{c as a}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{da as i,fd as e}from"./chunk-Y7RYSRP7.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-K7IG7PO2.js";import{a as F}from"./chunk-VZGDXWRK.js";import{a as q}from"./chunk-EET5AS64.js";import{a as h}from"./chunk-I3H465Z6.js";import{a as R}from"./chunk-TCWN5YRW.js";import{p as W}from"./chunk-CEWU5VSJ.js";import{d as B,h as E,k as M}from"./chunk-B74M7NEV.js";import"./chunk-YIKHJONY.js";import"./chunk-JDW4UORS.js";import{a as P}from"./chunk-BOIY4J2R.js";import{c as $}from"./chunk-Z2CRNO3I.js";import{a as k,c as I}from"./chunk-XYXL5HSZ.js";import"./chunk-ATTW36EM.js";import{c as Y}from"./chunk-7OU4ERTS.js";import"./chunk-5MV6XVGA.js";import"./chunk-LS2JH5QF.js";import"./chunk-HKCOKHA2.js";import{a as O}from"./chunk-W5DOO6ID.js";import{a as j}from"./chunk-ZQDUWURP.js";import{b as D}from"./chunk-U5OXKKBN.js";import{a as v,b as z}from"./chunk-ZYSR5UIW.js";import{a as U}from"./chunk-HWON6MV4.js";import{a as J}from"./chunk-5F5XJPKD.js";import{c as G}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import{A as T}from"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{Da as A,Fa as g,Jc as H,V as w,W as C,a as u,c as x,ca as N,da as m,fd as e,j as Z}from"./chunk-Y7RYSRP7.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(H,{size:24,stroke:"1.5"})})})})]}),a?.description&&e(Y,{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}=j(),i=window.firebase.user.email||"",a=O(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(U,{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(W,{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};
@@ -1 +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-VJRMR2JM.js";import"./chunk-JDW4UORS.js";import{a as T}from"./chunk-UJX25CXD.js";import"./chunk-Z2CRNO3I.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-A7IZAHBZ.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};
1
+ import{a as w}from"./chunk-K7IG7PO2.js";import{a as P}from"./chunk-I3H465Z6.js";import{a as S}from"./chunk-TCWN5YRW.js";import{c as f}from"./chunk-B74M7NEV.js";import"./chunk-JDW4UORS.js";import{a as T}from"./chunk-BOIY4J2R.js";import"./chunk-Z2CRNO3I.js";import"./chunk-ATTW36EM.js";import{a as v}from"./chunk-W5DOO6ID.js";import{a as R}from"./chunk-ZQDUWURP.js";import{a as d}from"./chunk-HWON6MV4.js";import{a as y}from"./chunk-5F5XJPKD.js";import{c as x}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-ISUGBMXC.js";import"./chunk-DZYYWCHX.js";import"./chunk-XOWWPE7X.js";import"./chunk-GJ7ES2LA.js";import{Da as _,V as h,a as o,c as m,da as b,fd as e,g as p,j as A,ya as g}from"./chunk-Y7RYSRP7.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};
@@ -1 +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-A7IZAHBZ.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
+ import{b as me,e as _e}from"./chunk-3YBRRPAN.js";import{a as ce,c as de,e as ge}from"./chunk-ZD3ORGA6.js";import{a as N}from"./chunk-I3H465Z6.js";import{a as E}from"./chunk-TCWN5YRW.js";import"./chunk-PLTI4NG7.js";import"./chunk-ATTW36EM.js";import{c as te}from"./chunk-5MV6XVGA.js";import{b as ne,c as O,d as ae,f as z}from"./chunk-HKCOKHA2.js";import{a as le}from"./chunk-ZQDUWURP.js";import{b as ee}from"./chunk-U5OXKKBN.js";import{a as I}from"./chunk-ZYSR5UIW.js";import{a as g}from"./chunk-HWON6MV4.js";import{a as pe}from"./chunk-5F5XJPKD.js";import{c as ue}from"./chunk-P2RVKNG4.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-GJ7ES2LA.js";import{Ca as Y,U as L,Vc as ie,W as $,_a as se,a as _,ad as re,ba as F,c as w,da as v,e as H,fd as e,g as T,j as G,na as J,pa as K,sa as X,ua as U,za as A}from"./chunk-Y7RYSRP7.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:ae(o.email)}),e("text",{x:"14",y:"14",textAnchor:"middle",dominantBaseline:"central",fill:"#fff",fontSize:"13",fontWeight:"600",children:ne(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(re,{size:14})})]},i)})})]}),e("div",{className:"PermissionGroupsBox__editor__footer",children:e(v,{variant:"subtle",size:"xs",color:"red",compact:!0,disabled:r,leftIcon:e(ie,{size:14}),onClick:c,children:"Delete group"})})]})}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=te(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(se,{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};
@@ -0,0 +1 @@
1
+ import{a as S}from"./chunk-MYPLMHFW.js";import{a as U}from"./chunk-5F5XJPKD.js";import{c as d}from"./chunk-P2RVKNG4.js";import"./chunk-AAHM6RYJ.js";import"./chunk-GJ7ES2LA.js";import{a as u,c as h,e as P,fd as i,j as x}from"./chunk-Y7RYSRP7.js";import"./chunk-KUCVLANF.js";import"./chunk-PVAE643M.js";x();function L(r){return`/cms/tools/${r}`}function v(r){return r.replace(/\/+$/,"")||"/"}function $(r,n){let e=v(r);return e==="/"?n==="/"?"":n:n===e?"":n.startsWith(`${e}/`)?n.slice(e.length):null}function y(r,n,e){let o;try{o=new URL(r,window.location.href)}catch{return null}let t=$(o.pathname,e.pathname);return t===null?null:`${L(n)}${t}${e.search}${e.hash}`}function p(r,n,e){let o=L(n),t="";if(e.pathname.startsWith(`${o}/`)&&(t=e.pathname.slice(o.length)),!t&&!e.search&&!e.hash)return r;try{let s=new URL(r,window.location.href),f=v(s.pathname),l=new URL(s.toString());return l.pathname=f==="/"?t||"/":`${f}${t}`,l.search=e.search||s.search,l.hash=e.hash||s.hash,l.toString()}catch{return r}}var R=400;function F(r){let e=(window.__ROOT_CTX.sidebar?.tools||{})[r.id];U(e?.label||r.id);let o=e?.cmsUrl,t=e?.externalUrl;return h(()=>{o?.startsWith("/cms/")&&window.location.replace(o)},[o]),h(()=>{t&&window.open(t,"_blank","noopener,noreferrer")?.focus()},[t]),e?t?i(d,{children:i("div",{className:"SidebarToolsPage SidebarToolsPage--message",children:i("a",{href:t,target:"_blank",rel:"noreferrer noopener",children:["Open ",e.label||r.id," in a new tab"]})})}):o?.startsWith("/cms/")?i(d,{children:i("div",{className:"SidebarToolsPage",children:"redirecting..."})}):o?i(d,{children:i("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["invalid cmsUrl (must start with /cms/): ",r.id]})}):e.iframeUrl?i(d,{children:i("div",{className:"SidebarToolsPage",children:i(E,{id:r.id,iframeUrl:e.iframeUrl},r.id)})}):i(d,{children:i("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["missing iframeUrl: ",r.id]})}):i(d,{children:i("div",{className:"SidebarToolsPage SidebarToolsPage--error",children:["not found: ",r.id]})})}function E(r){let n=P(null),[e]=u(()=>new URL(r.iframeUrl,window.location.href)),[o]=u(()=>p(r.iframeUrl,r.id,window.location));return h(()=>{let t=n.current;if(!t)return;let s=null,f=!1,l=a=>{let c=y(r.iframeUrl,r.id,a);c===null||c===s||(s=c,window.history.replaceState(window.history.state,"",c))},g=()=>{try{let a=t.contentWindow?.location;return!a||a.href==="about:blank"?null:{pathname:a.pathname,search:a.search,hash:a.hash}}catch{return f=!0,null}},T=()=>{let a=g();a&&l(a)};t.addEventListener("load",T);let m=0,b=()=>{if(!f){let a=g();a&&l(a)}f||(m=window.setTimeout(b,R))};m=window.setTimeout(b,R);let w=a=>{if(a.source===t.contentWindow&&a.origin===e.origin&&S(a.data))try{let c=new URL(a.data.rootTool.url,e.origin);l({pathname:c.pathname,search:c.search,hash:c.hash})}catch{}};return window.addEventListener("message",w),()=>{t.removeEventListener("load",T),window.clearTimeout(m),window.removeEventListener("message",w)}},[e,r.id,r.iframeUrl]),i("iframe",{ref:n,src:o})}export{F as SidebarToolsPage};