@blinkk/root-cms 3.1.2 → 3.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +1 -1
- package/dist/{chunk-X5CNR4CK.js → chunk-4G7S2LJH.js} +2 -2
- package/dist/plugin.js +1 -1
- package/dist/ui/{AIPage-2N5UYBRX.js → AIPage-VOTAEVJE.js} +1 -1
- package/dist/ui/AssetsPage-EWGRMRPJ.js +1 -0
- package/dist/ui/{CollectionPage-D7IG6526.js → CollectionPage-N5JIAUDS.js} +1 -1
- package/dist/ui/{ComparePage-726NIJW5.js → ComparePage-JDPVU2VA.js} +1 -1
- package/dist/ui/{DataPage-YMSQCIVK.js → DataPage-37D4CMLZ.js} +1 -1
- package/dist/ui/{DataSourcePage-7VPFUG3K.js → DataSourcePage-LX5ASYQN.js} +1 -1
- package/dist/ui/{DocTranslationsPage-FO7O76VK.js → DocTranslationsPage-V5M4KB7X.js} +1 -1
- package/dist/ui/DocumentPage-SURTQJPG.js +1 -0
- package/dist/ui/{EditDataSourcePage-Y7YK6IWT.js → EditDataSourcePage-O7DOV5LX.js} +1 -1
- package/dist/ui/{EditReleasePage-XZ4RHHRT.js → EditReleasePage-NDYTKGXY.js} +1 -1
- package/dist/ui/EmbeddedDocumentPage-SLEULNNI.js +1 -0
- package/dist/ui/LogsPage-ZGBP3I35.js +1 -0
- package/dist/ui/{NewDataSourcePage-YUPRHL7F.js → NewDataSourcePage-GQONTMP4.js} +1 -1
- package/dist/ui/{NewReleasePage-6HHLYOQP.js → NewReleasePage-7ZKXHDTD.js} +1 -1
- package/dist/ui/{NotFoundPage-A6OCYREA.js → NotFoundPage-WXEZQZK6.js} +1 -1
- package/dist/ui/ProjectPage-F7W7X6YO.js +1 -0
- package/dist/ui/{ReleasePage-V2JMPWX7.js → ReleasePage-ZKMNYPML.js} +1 -1
- package/dist/ui/{ReleasesPage-SCR4SVKN.js → ReleasesPage-JHCE6AEJ.js} +1 -1
- package/dist/ui/{SettingsPage-5XKHPG6K.js → SettingsPage-MWCPZPGE.js} +1 -1
- package/dist/ui/{SidebarToolsPage-VXVRZ2C3.js → SidebarToolsPage-API53RRR.js} +1 -1
- package/dist/ui/TaskPage-73NLAR4J.js +1 -0
- package/dist/ui/{TasksPage-DIXUWYXM.js → TasksPage-IKPW2OQO.js} +1 -1
- package/dist/ui/{TranslationsArbPage-QPD3ZBT4.js → TranslationsArbPage-QVN66DIW.js} +1 -1
- package/dist/ui/{TranslationsEditPage-475Z7UPC.js → TranslationsEditPage-ZOELF5PK.js} +1 -1
- package/dist/ui/{TranslationsPage-674JU6L4.js → TranslationsPage-NGGZB4L6.js} +1 -1
- package/dist/ui/{chunk-JBHRZ4EX.js → chunk-BOER3EAW.js} +1 -1
- package/dist/ui/{chunk-RHAJNURN.js → chunk-BT2NTAW2.js} +1 -1
- package/dist/ui/chunk-C2BLMTPR.js +3 -0
- package/dist/ui/{chunk-XWX2622O.js → chunk-DIFPCF7I.js} +1 -1
- package/dist/ui/{chunk-PTPYMVFW.js → chunk-DS27MO63.js} +1 -1
- package/dist/ui/{chunk-WMICEDOT.js → chunk-FXIR2RBE.js} +1 -1
- package/dist/ui/chunk-G5ZZDHWA.js +1 -0
- package/dist/ui/{chunk-2S5HMST6.js → chunk-IOR72US3.js} +1 -1
- package/dist/ui/{chunk-SKQECSUR.js → chunk-NSI5JSVV.js} +1 -1
- package/dist/ui/{chunk-YXSXWFLZ.js → chunk-PPYM4O5N.js} +1 -1
- package/dist/ui/{chunk-Q7IU4QCY.js → chunk-T77VOWHP.js} +1 -1
- package/dist/ui/chunk-UPDL6UXI.js +1 -0
- package/dist/ui/{chunk-SENZVSVZ.js → chunk-VPHBKJ3I.js} +1 -1
- package/dist/ui/{chunk-VJUMFJIX.js → chunk-WYJJZTCI.js} +1 -1
- package/dist/ui/{chunk-4ALFT4ES.js → chunk-Y3MCFLQU.js} +56 -56
- package/dist/ui/chunk-YUU6LWQK.js +1 -0
- package/dist/ui/{chunk-AGFPVTBA.js → chunk-Z6DBYLIM.js} +1 -1
- package/dist/ui/ui.css +1 -1
- package/dist/ui/ui.js +1 -1
- package/package.json +3 -3
- package/dist/ui/AssetsPage-KLGNE6D6.js +0 -1
- package/dist/ui/DocumentPage-M7SJ4ITQ.js +0 -1
- package/dist/ui/EmbeddedDocumentPage-4TLMCDSO.js +0 -1
- package/dist/ui/LogsPage-IGDDZGEI.js +0 -1
- package/dist/ui/ProjectPage-UHRXNN7O.js +0 -1
- package/dist/ui/TaskPage-LDPRN3G6.js +0 -1
- package/dist/ui/chunk-NWHGT476.js +0 -1
- package/dist/ui/chunk-XMESZUC5.js +0 -1
- package/dist/ui/chunk-YMBBWVBB.js +0 -3
- /package/dist/ui/{chunk-4ALFT4ES.js.LEGAL.txt → chunk-Y3MCFLQU.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk-YDO2EDVY.js";import{a as x}from"./chunk-5MV6XVGA.js";import{
|
|
1
|
+
import{a as h}from"./chunk-YDO2EDVY.js";import{a as x}from"./chunk-5MV6XVGA.js";import{h as y}from"./chunk-C2BLMTPR.js";import{c as f,n as g}from"./chunk-VD6G5NV4.js";async function b(e){let t=window.firebase.db,r=window.__ROOT_CTX.rootConfig.projectId,[o,a]=e.split("/",2),i=await h(o),n=f(t,"Projects",r,"Collections",o,"Drafts",a),c=(await g(n)).data()||{},p=new Set;return m(p,i.fields,c.fields||{},i.types||{}),Array.from(p)}async function C(e){let t=window.firebase.db,r=window.__ROOT_CTX.rootConfig.projectId,[o,a]=e.split("/",2),i=await h(o),n=f(t,"Projects",r,"Collections",o,"Drafts",a),c=(await g(n)).data()||{},p=new Map;return d(p,i.fields,c.fields||{},i.types||{}),p}function m(e,t,r,o={}){t.forEach(a=>{if(!a.id)return;let i=r[a.id],n=`@${a.id}`,s=r[n];s?.translate===!1||s?.disableTranslations||R(e,a,i,o,s)})}function d(e,t,r,o={}){t.forEach(a=>{if(!a.id)return;let i=r[a.id],n=`@${a.id}`,s=r[n];if(s?.translate===!1||s?.disableTranslations)return;let c=s?.description;S(e,a,i,o,c,s)})}function R(e,t,r,o={},a){if(!r)return;function i(n){let s=y(n);s&&e.add(s)}if(t.type==="object")m(e,t.fields||[],r,o);else if(t.type==="array"){let n=r._array||[];for(let s of n)R(e,t.of,r[s],o)}else if(t.type==="string"||t.type==="select")t.translate&&i(r);else if(t.type==="image")t.translate&&r&&r.alt&&t.alt!==!1&&a?.alt!==!1&&i(r.alt);else if(t.type==="multiselect"){if(t.translate&&Array.isArray(r))for(let n of r)i(n)}else if(t.type==="oneof"){let n=t.types||[],s;typeof n[0]=="string"?n.includes(r._type)&&(s=o[r._type]):s=n.find(c=>c.name===r._type),s&&m(e,s.fields||[],r,o)}else t.type==="richtext"?t.translate&&T(e,r):console.log(`extract: ignoring field, id=${t.id}, type=${t.type}`)}function S(e,t,r,o={},a,i){if(!r)return;function n(s){let c=y(s);if(c){let p=e.get(c);(!p||!p.description)&&e.set(c,{description:a})}}if(t.type==="object")d(e,t.fields||[],r,o);else if(t.type==="array"){let s=r._array||[];for(let c of s)S(e,t.of,r[c],o,a)}else if(t.type==="string"||t.type==="select")t.translate&&n(r);else if(t.type==="image")t.translate&&r&&r.alt&&t.alt!==!1&&i?.alt!==!1&&n(r.alt);else if(t.type==="multiselect"){if(t.translate&&Array.isArray(r))for(let s of r)n(s)}else if(t.type==="oneof"){let s=t.types||[],c;typeof s[0]=="string"?s.includes(r._type)&&(c=o[r._type]):c=s.find(p=>p.name===r._type),c&&d(e,c.fields||[],r,o)}else if(t.type==="richtext"&&t.translate){let s=new Set;T(s,r),s.forEach(c=>n(c))}}function T(e,t){(t?.blocks||[]).forEach(o=>{l(e,o)})}function l(e,t){if(!t?.type)return;function r(n){if(!n)return;let s=y(n);s&&e.add(s)}function o(n){n&&Object.values(n).forEach(s=>{a(s)})}function a(n){if(typeof n=="string"){r(n);return}if(Array.isArray(n)){n.forEach(s=>a(s));return}x(n)&&Object.values(n).forEach(s=>a(s))}function i(n){n&&n.forEach(s=>{r(s.content),o(s.components),i(s.items)})}t.type==="heading"||t.type==="paragraph"?(r(t.data?.text),o(t.data?.components)):t.type==="orderedList"||t.type==="unorderedList"?i(t.data?.items):t.type==="html"?r(t.data?.html):t.type==="table"&&(t.data?.rows||[]).forEach(s=>{(s.cells||[]).forEach(p=>{(p.blocks||[]).forEach(w=>{l(e,w)})})})}export{b as a,C as b,R as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as M}from"./chunk-
|
|
1
|
+
import{i as M}from"./chunk-IOR72US3.js";import{a as n,c as _}from"./chunk-HARRKJFZ.js";import{b as h}from"./chunk-J5E457OI.js";import{a as u}from"./chunk-QHJOTXYB.js";import{e as f}from"./chunk-KRNQ6L35.js";import{a as m}from"./chunk-VD6G5NV4.js";import{Ga as e,a as i,da as d,e as c,j as I}from"./chunk-LROR6N3B.js";I();var S="ScheduleReleaseModal";function F(l){let t=n(),a=_();return{open:()=>{t.openContextModal(S,{...a,title:`Schedule release: ${l.releaseId}`,innerProps:l})}}}function T(l){let{innerProps:t,context:a,id:g}=l,[s,x]=i(""),[R,r]=i(!1),v=c(null),b=n();async function w(){r(!0),await h(async()=>{let o=Math.floor(new Date(s).getTime());if(Math.floor(new Date().getTime())>=o)throw new Error("bad datetime, please choose a date in the future");let y=m.fromMillis(o);await M(t.releaseId,o),u({title:"Scheduled!",message:`Release ${t.releaseId} will go live ${s}.`,autoClose:1e4}),b.closeAll(),t.onScheduled&&t.onScheduled(y)}),r(!1)}return e("div",{className:"ScheduleReleaseModal",children:e("div",{className:"ScheduleReleaseModal__content",children:e("form",{className:"ScheduleReleaseModal__form",onSubmit:o=>{o.preventDefault(),w()},children:[e("div",{className:"ScheduleReleaseModal__form__description",children:"Content in the release will go live at the datetime specified below."}),e("div",{className:"ScheduleReleaseModal__form__dateInput",children:[e("input",{ref:v,type:"datetime-local",value:s,min:f(),onChange:o=>{let p=o.target;x(p.value)}}),e("div",{className:"ScheduleReleaseModal__form__dateInput__help",children:["timezone: ",Intl.DateTimeFormat().resolvedOptions().timeZone]})]}),e("div",{className:"ScheduleReleaseModal__form__buttons",children:[e(d,{variant:"outline",onClick:()=>a.closeModal(g),type:"button",size:"xs",color:"dark",children:"Cancel"}),e(d,{variant:"filled",size:"xs",color:"dark",loading:R,type:"submit",children:"Schedule"})]})]})})})}T.id=S;export{F as a,T as b};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{a as b,f as R}from"./chunk-KRNQ6L35.js";import{b as m,c as l,f as y,g as f,h as T,n as x,o as L,q as _,w,x as h}from"./chunk-VD6G5NV4.js";function d(n,o){let t=n.translationLanguages||{},a=String(o).toLowerCase();for(let[r,s]of Object.entries(t))if(r.toLowerCase()===a)return s;return o}function O(n,o){let t=[];for(let a of o){let r=d(n,a);t.includes(r)||t.push(r)}return t}function C(n,o){let t=n.locales||["en"],a=String(o).toLowerCase(),r=[];for(let s of t)(String(s).toLowerCase()===a||d(n,s).toLowerCase()===a)&&r.push(s);return r}function I(n,o,t){for(let a of C(n,t)){let r=o[a];if(typeof r=="string"&&r)return r}return""}function j(){let n=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db;return m(o,"Projects",n,"Translations")}async function D(n){let o=j(),t=n?.tags?f(o,T("tags","array-contains-any",n.tags)):f(o),a=await L(t),r={};return a.forEach(s=>{let e=s.id;r[e]=s.data()}),r}async function G(n){let o=Array.from(new Set(n)).filter(Boolean),t={};if(o.length===0)return t;let a=j(),r=30,s=[];for(let e=0;e<o.length;e+=r)s.push(o.slice(e,e+r));return await Promise.all(s.map(async e=>{let i=f(a,T(y(),"in",e));(await L(i)).forEach(c=>{t[c.id]=c.data()})})),t}async function N(n){let o=window.__ROOT_CTX.rootConfig.projectId,t=window.firebase.db,a=l(t,"Projects",o,"Translations",n);return(await x(a)).data()}async function K(n,o){let t=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,r=l(a,"Projects",t,"Translations",n),s={};for(let e in o){if(e==="tags"){s.tags=o.tags;continue}for(let i of X(e))s[i]=o[e]}console.log("updating translations: ",s),await _(r,s),R("translations.save",{metadata:{hash:n},throttle:5*b.minute,throttleId:n})}async function W(n,o){let t=o?.mode??"replace",a=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,s=500;for(let e=0;e<n.length;e+=s){let i=h(r);n.slice(e,e+s).forEach(({hash:c,tags:u})=>{let g=l(r,"Projects",a,"Translations",c);t==="union"?i.update(g,{tags:w(...u)}):i.update(g,{tags:u})}),await i.commit()}}async function M(n){return k(E(n))}async function k(n){let t=new TextEncoder().encode(n),a=await crypto.subtle.digest("SHA-1",t);return Array.from(new Uint8Array(a)).map(e=>e.toString(16).padStart(2,"0")).join("")}function E(n){return String(n).trim().split(`
|
|
2
|
+
`).map(t=>q(t)).join(`
|
|
3
|
+
`)}function q(n){return String(n).trimEnd().replace(/ $/,"")}var S=new Map;function H(n){let o=S.get(n);if(o)return o;let t=n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,"."),a=new RegExp(`^${t}$`,"i");return S.set(n,a),a}function Z(n){return(window.__ROOT_CTX.excludeLocalesFromTranslations||[]).some(t=>H(t).test(n))}function J(n){let t=(window.__ROOT_CTX.rootConfig.i18n||{}).locales||["en"];for(let a of t)if(String(a).toLowerCase()===n.toLowerCase())return a;return null}function Q(n){let o=window.__ROOT_CTX.rootConfig.i18n||{};return d(o,n)}function V(n){let o=window.__ROOT_CTX.rootConfig.i18n||{};return O(o,n)}function X(n){let o=window.__ROOT_CTX.rootConfig.i18n||{};return C(o,n)}function Y(n,o){let t=window.__ROOT_CTX.rootConfig.i18n||{};return I(t,n,o)}async function nn(n,o){let t=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,r=500,s=await Promise.all(n.map(async e=>({hash:await M(e.source),locales:e.locales,source:e.source})));for(let e=0;e<s.length;e+=r){let i=h(a),p=s.slice(e,e+r);for(let c of p){let u=l(a,"Projects",t,"Translations",c.hash),g={source:c.source};for(let[F,P]of Object.entries(c.locales))for(let A of X(F))g[A]=E(P);o?.tags?.length&&(g.tags=w(...o.tags)),i.set(u,g,{merge:!0})}await i.commit()}R("translations.batch_save",{metadata:{count:n.length}})}export{j as a,D as b,G as c,N as d,K as e,W as f,M as g,E as h,Z as i,J as j,Q as k,V as l,X as m,Y as n,nn as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as z,j as I}from"./chunk-
|
|
1
|
+
import{e as z,j as I}from"./chunk-PPYM4O5N.js";import{c as N,e as L}from"./chunk-DS27MO63.js";import{a as C}from"./chunk-FJLNXXE3.js";import{a as w,c as y}from"./chunk-HARRKJFZ.js";import{b as v}from"./chunk-5MV6XVGA.js";import{Cc as B,Ga as e,V as P,a as g,da as p,g as M,j as x,ua as S,za as f}from"./chunk-LROR6N3B.js";x();x();function O(o,t){return M(()=>{if(!t.trim())return o;let l=t.toLowerCase();return o.filter(c=>{let[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],s=v(r,n.preview?.title||"meta.title")||"";return c.id.toLowerCase().includes(l)||s.toLowerCase().includes(l)||u.toLowerCase().includes(l)})},[o,t])}var h="DocPickerModal";function ee(){let o=w(),t=y();return{open:l=>{o.openContextModal(h,{...t,innerProps:l,size:"700px",overflow:"inside"})},close:()=>{o.closeModal(h)}}}function k(o){let{innerProps:t}=o,l=Object.keys(window.__ROOT_CTX.collections);t.collections?.length&&(l=l.filter(i=>t.collections?.includes(i)));let c=[{value:"",label:"Select"}];l.forEach(i=>{c.push({value:i,label:i})});let[a,u]=C("DocPickerModal.lastSelectedCollection",""),r=()=>t.initialCollection?t.initialCollection:a&&l.includes(a)?a:l.length===1?l[0]:"",[n,D]=g(r()),s=i=>{D(i),u(i)};function m(i){t.multiSelect&&t.onChangeMulti?t.onChangeMulti(i.id,!0):t.onChange&&t.onChange(i.id)}function b(i){t.multiSelect&&t.onChangeMulti&&t.onChangeMulti(i.id,!1)}return e("div",{className:"DocPickerModal",children:[l.length===0&&e("div",{className:"DocPickerModal__noCollections",children:"No collections matching schema field definition."}),l.length>0&&e(k.DocsList,{collection:n,onDocSelected:m,onDocUnselected:b,onCollectionChange:s,multiSelect:t.multiSelect,selectedDocIds:t.selectedDocIds,options:{enableSearch:t.enableSearch??!0,enableSort:t.enableSort??!0,enableCreate:t.enableCreate??!0,enableStatusBadges:t.enableStatusBadges??!0,showCollectionSelect:l.length>1,collectionSelectValue:n,collectionSelectOptions:c}})]})}k.DocsList=o=>{let[t,l]=g(""),[c,a]=C(`root::DocPickerModal:${o.collection}:sortBy`,"modifiedAt"),[u,r]=g(!1),[n,D,s]=z(o.collection||"",{orderBy:c}),m=O(s,t),b=[{value:"modifiedAt",label:"Last Modified"},{value:"slug",label:"A-Z"},{value:"slugDesc",label:"Z-A"},{value:"newest",label:"Newest"},{value:"oldest",label:"Oldest"}],i=o.selectedDocIds||[],d=o.options||{};return e("div",{className:"DocPickerModal__DocsList",children:[e("div",{className:"DocPickerModal__DocsList__stickyHeader",children:[d.showCollectionSelect&&e("div",{className:"DocPickerModal__collection__select",children:[e("div",{className:"DocPickerModal__collection__select__label",children:"Content Type:"}),e(f,{data:d.collectionSelectOptions||[],value:d.collectionSelectValue,placeholder:"Select",onChange:_=>{o.onCollectionChange?.(_||"")},size:"xs",radius:0,searchable:!0,autoFocus:!0,dropdownComponent:"div"}),d.collectionSelectValue&&e(p,{variant:"outline",color:"dark",size:"xs",onClick:()=>r(!0),children:"New"})]}),d.enableSearch&&d.collectionSelectValue&&e("div",{className:"DocPickerModal__DocsList__controls",children:[e(S,{placeholder:"Search documents...",value:t,onChange:_=>l(_.target.value),icon:e(B,{size:16}),size:"xs",className:"DocPickerModal__DocsList__controls__search"}),d.enableSort&&e(f,{data:b,value:c,onChange:_=>a(_||"modifiedAt"),size:"xs",className:"DocPickerModal__DocsList__controls__sort"})]}),!n&&s.length>0&&e("div",{className:"DocPickerModal__DocsList__count",children:["Showing ",m.length," of ",s.length," documents"]})]}),e("div",{className:"DocPickerModal__DocsList__docsContainer",children:o.collection?n?e("div",{className:"DocPickerModal__DocsList__loading",children:e(P,{color:"gray",size:"xl"})}):m.length===0?e("div",{className:"DocPickerModal__DocsList__empty",children:s.length===0?"Collection is empty.":"No documents match your search."}):e("div",{className:"DocPickerModal__DocsList__docs",children:m.map(_=>e(k.DocCard,{doc:_,onDocSelected:o.onDocSelected,onDocUnselected:o.onDocUnselected,multiSelect:o.multiSelect,selected:i.includes(_.id),enableStatusBadges:d.enableStatusBadges},_.id))}):e("div",{className:"DocPickerModal__DocsList__empty",children:"Select a content type to view documents"})}),d.collectionSelectValue&&e(I,{collection:d.collectionSelectValue,opened:u,skipNavigation:!0,onClose:()=>{r(!1),D()}})]})};k.DocCard=o=>{let[t,l]=g(!!o.selected),c=o.doc,[a,u]=c.id.split("/"),r=c.fields||{},n=window.__ROOT_CTX.collections[a],D=`/cms/content/${a}/${u}`,s=v(r,n.preview?.title||"meta.title"),m=v(r,n.preview?.image||"meta.image")||n.preview?.defaultImage;return e("div",{className:"DocPickerModal__DocCard",children:[e("div",{className:"DocPickerModal__DocCard__image",onClick:()=>window.open(D,"_blank"),children:e(L,{file:m,width:120,height:90,withPlaceholder:!m?.src})}),e("div",{className:"DocPickerModal__DocCard__content",children:[e("div",{className:"DocPickerModal__DocCard__content__header",children:e("div",{className:"DocPickerModal__DocCard__content__header__docId",onClick:()=>window.open(D,"_blank"),children:c.id})}),e("div",{className:"DocPickerModal__DocCard__content__title",children:e("div",{className:"DocPickerModal__DocCard__content__link",onClick:()=>window.open(D,"_blank"),children:s||"[UNTITLED]"})}),o.enableStatusBadges&&e("div",{className:"DocPickerModal__DocCard__content__badges",children:e(N,{doc:c})})]}),e("div",{className:"DocPickerModal__DocCard__controls",children:e("div",{className:"DocPickerModal__DocCard__controls__buttons",children:o.multiSelect?t?e(p,{variant:"light",color:"blue",size:"xs",onClick:()=>{l(!1),o.onDocUnselected(o.doc)},children:"Unselect"}):e(p,{variant:"filled",color:"blue",size:"xs",onClick:()=>{l(!0),o.onDocSelected(o.doc)},children:"Select"}):e(p,{color:"blue",size:"xs",onClick:()=>o.onDocSelected(o.doc),children:"Select"})})})]})};k.id=h;export{ee as a,k as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as F}from"./chunk-
|
|
1
|
+
import{c as F}from"./chunk-IOR72US3.js";import{b as P}from"./chunk-5MV6XVGA.js";import{N as T,b as S}from"./chunk-Z6DBYLIM.js";import{b as $}from"./chunk-J5E457OI.js";import{b as p,d as b}from"./chunk-KRNQ6L35.js";import{e as w}from"./chunk-BUNR5EU3.js";import{Fa as g,Ga as t,V as N,a as f,ba as l,c as h,e as k,i as R,j as B,la as I}from"./chunk-LROR6N3B.js";import{d as y,j as x,k as M}from"./chunk-KUCVLANF.js";M();B();var L=x(null);function W(e){let[i,n]=f([]),[o,a]=f(!1),r=k("idle");function u(){r.current==="idle"&&(r.current="fetching",a(!0),F().then(s=>{let c=s.filter(m=>!m.publishedAt&&!m.archivedAt);n(c)}).catch(s=>{console.error("Failed to fetch pending releases:",s)}).finally(()=>{r.current="done",a(!1)}))}function d(s){return i.filter(c=>c.docIds?.includes(s))}return t(L.Provider,{value:{releases:i,getReleasesForDoc:d,loading:o,fetchReleases:u},children:e.children})}function A(){let e=R(L);if(!e)throw new Error("usePendingReleases must be used within a <PendingReleasesProvider>");let{fetchReleases:i,...n}=e;return h(()=>{i()},[]),n}function z(e){let i={transition:"pop"},n=e.doc,o=n.sys;return t("div",{className:"DocStatusBadges",children:[(!o.publishedAt||!o.modifiedAt||o.modifiedAt>o.publishedAt)&&t(g,{...i,label:`Modified ${_(o.modifiedAt)} by ${o.modifiedBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"indigo",to:"cyan"},children:"Draft"})}),!!o.publishedAt&&t(g,{...i,label:`Published ${_(o.publishedAt)} by ${o.publishedBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"teal",to:"lime",deg:105},children:"Published"})}),!!o.scheduledAt&&t(g,{...i,label:`Scheduled ${b(o.scheduledAt)} by ${o.scheduledBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"grape",to:"pink",deg:35},children:"Scheduled"})}),!e.hideReleases&&t(K,{docId:e.docId||n.id,tooltipProps:i}),T(n)&&t(g,{...i,label:O(n),children:t(l,{size:"xs",variant:"gradient",gradient:{from:"orange",to:"red"},className:e.onPublishingLockClick?"DocStatusBadges__badge--clickable":void 0,style:e.onPublishingLockClick?{cursor:"pointer"}:void 0,role:e.onPublishingLockClick?"button":void 0,tabIndex:e.onPublishingLockClick?0:void 0,onClick:e.onPublishingLockClick,onKeyDown:e.onPublishingLockClick?a=>{(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),e.onPublishingLockClick())}:void 0,children:"Locked"})}),!!o.archivedAt&&t(g,{...i,label:`Archived ${_(o.archivedAt)} by ${o.archivedBy}`,children:t(l,{size:"xs",variant:"gradient",gradient:{from:"gray",to:"dark"},children:"Archived"})})]})}function O(e){let i=e.sys?.publishingLocked;return i?i.until?`Locked until ${b(i.until)} by ${i.lockedBy}: "${i.reason}"`:`Locked by ${i.lockedBy}: "${i.reason}"`:""}function K(e){let{getReleasesForDoc:i}=A(),n=i(e.docId);return n.length===0?null:t(y,{children:n.map(o=>t(g,{...e.tooltipProps,label:`In release: ${o.id}`,children:t(l,{component:"a",href:`/cms/releases/${o.id}`,size:"xs",variant:"gradient",gradient:{from:"violet",to:"grape"},style:{cursor:"pointer"},children:o.id})},o.id))})}function _(e){return e?p(e.toMillis()):p(new Date().getTime())}function E(e){let{file:i,width:n,height:o,withPlaceholder:a,className:r,alt:u}=e,d=typeof i=="string"?i:i?.src;return U(i)?t(X,{className:r,src:d,width:n,height:o}):t(I,{className:r,src:d,width:n,height:o,withPlaceholder:a,alt:u})}function U(e){if(!e)return!1;if(typeof e=="string")return/\.mp4($|\?)/i.test(e);if(typeof e.mimeType=="string")return e.mimeType.toLowerCase()==="video/mp4";let i=e.src;return typeof i!="string"?!1:/\.mp4($|\?)/i.test(i)}function X(e){return t("video",{className:e.className,src:e.src,width:e.width,height:e.height,muted:!0,playsInline:!0,preload:"metadata",style:{width:`${e.width}px`,height:`${e.height}px`,backgroundColor:"#f1f3f5",objectFit:"cover",display:"block"}})}B();function De(e){let i=e.docId,[n,o]=f(e.doc),[a,r]=f(!e.doc);async function u(){r(!0),await $(async()=>{let V=await S(i);o(V)}),r(!1)}if(h(()=>{u()},[i]),a)return t("div",{className:w(e.className,"DocPreviewCard","DocPreviewCard--loading",e.variant&&`DocPreviewCard--${e.variant}`),children:t(N,{color:"gray",size:"sm"})});if(!n)return;let[d]=i.split("/"),s=n.fields||{},c=window.__ROOT_CTX.collections[d];if(!c)return console.error(`could not find collection: ${d}`),t("div",{className:"DocPreviewCard",children:["Collection ",t("b",{children:d})," not found."]});let m=P(s,c.preview?.title||"meta.title"),C=P(s,c.preview?.image||"meta.image")||c.preview?.defaultImage,D="div",v={};return e.clickable&&(D="a",v.href=`/cms/content/${e.docId}`,v.target="_blank"),t(D,{className:w(e.className,"DocPreviewCard",e.variant&&`DocPreviewCard--${e.variant}`),...v,children:[t("div",{className:"DocPreviewCard__image",children:t(E,{file:C,width:80,height:60,withPlaceholder:!C?.src})}),t("div",{className:"DocPreviewCard__content",children:[t("div",{className:"DocPreviewCard__content__header",children:t("div",{className:"DocPreviewCard__content__header__docId",children:n.id})}),t("div",{className:"DocPreviewCard__content__title",children:m||"[UNTITLED]"}),e.statusBadges&&n&&t("div",{className:"DocPreviewCard__content__badges",children:t(z,{doc:n,hideReleases:e.hideReleases})})]})]})}export{W as a,A as b,z as c,O as d,E as e,De as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as Vt}from"./chunk-AAHM6RYJ.js";import{d as Y,e as N}from"./chunk-BUNR5EU3.js";import{C as dt,Cc as zt,D as j,E as ut,Fa as Et,Fb as Bt,Fc as Wt,G as U,Ga as r,H as mt,I as gt,K as ft,O as ht,Ob as It,P as _t,Q as vt,S as Q,T as yt,Tb as Tt,Y as S,Ya as Pt,Z as bt,_ as Ct,a as x,aa as xt,c as O,e as pt,ec as Mt,fa as wt,fb as At,ha as St,ia as kt,j as je,ja as Lt,ka as Ot,ob as Nt,pc as Dt,qa as Z,ua as jt,v as n,xc as Ht,y as w,yc as Rt}from"./chunk-LROR6N3B.js";import{d as V,j as ct}from"./chunk-KUCVLANF.js";var tt={name:"@blinkk/root-cms",version:"3.1.2",author:"s@blinkk.com",license:"MIT",engines:{node:">=22.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/core.js",types:"./dist/core/core.d.ts",exports:{".":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./browser-client":{types:"./dist/browser-client/browser-client.d.ts",import:"./dist/browser-client.js"},"./client":{types:"./dist/core/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/core/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/core/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/core/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/core/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"node ../../scripts/build-esbuild.mjs ./esbuild.config.json","build:ui":"pnpm build:ui:bundle && pnpm build:ui:clean","build:ui:bundle":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external --splitting --format=esm","build:ui:clean":"rm -f dist/ui/*-*.css","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui:bundle --watch",test:"pnpm build && firebase emulators:exec 'vitest run --exclude=**/*.visual.test.tsx'","test:visual":"vitest run --config=vitest.config.visual.ts","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@ag-grid-community/client-side-row-model":"32.3.9","@ag-grid-community/core":"32.3.9","@ag-grid-community/react":"32.3.9","@ag-grid-community/styles":"32.3.9","@ai-sdk/anthropic":"3.0.74","@ai-sdk/google":"3.0.67","@ai-sdk/openai":"3.0.60","@ai-sdk/openai-compatible":"2.0.46","@ai-sdk/react":"3.0.177","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","@mantine/spotlight":"4.2.12","@types/cli-progress":"3.11.6",ai:"6.0.175","body-parser":"1.20.2","cli-progress":"3.12.0",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4","date-fns":"4.1.0","date-fns-tz":"3.2.0",diff:"8.0.2","dts-dom":"3.7.0","fnv-plus":"1.3.1",jsonwebtoken:"9.0.2",kleur:"4.1.5",minisearch:"7.2.0","sanitize-html":"2.13.1",sirv:"2.0.3","tiny-glob":"0.2.9",zod:"4.4.3"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/table":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"3.35.0","@testing-library/preact":"3.2.4","@testing-library/user-event":"14.6.1","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1","@types/sanitize-html":"2.13.0","@vitest/browser":"4.1.8","@vitest/browser-playwright":"4.1.8",concurrently:"7.6.0",esbuild:"0.28.0",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0",jsdom:"27.2.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",playwright:"1.60.0",preact:"10.27.1","preact-iso":"2.11.1","preact-render-to-string":"6.6.7",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-easy-crop":"5.5.6","react-json-view-compare":"2.0.2",typescript:"6.0.3",vite:"8.0.13",vitest:"4.1.6",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"3.1.2","firebase-admin":">=11","firebase-functions":">=4"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function Ut(){return r("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("g",{"clip-path":"url(#clip0_1_318)",children:[r("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),r("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),r("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),r("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),r("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),r("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),r("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),r("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),r("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),r("defs",{children:r("clipPath",{id:"clip0_1_318",children:r("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}w();var Qt=ct(null);w();w();var Pe=Object.defineProperty,Ae=Object.defineProperties,Ne=Object.getOwnPropertyDescriptors,Zt=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,Gt=(t,e,o)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Te=(t,e)=>{for(var o in e||(e={}))Be.call(e,o)&&Gt(t,o,e[o]);if(Zt)for(var o of Zt(e))Ie.call(e,o)&&Gt(t,o,e[o]);return t},Me=(t,e)=>Ae(t,Ne(e));function De(t){return Me(Te({},t),{id:t.id||ft()})}function He(t){let e=[];return t.reduceRight((o,i)=>(e.includes(i.id)||(e.push(i.id),o.push(i)),o),[]).reverse()}function G(t){return He(t.map(e=>De(e)))}function Ft(t,e){let[o,i]=x(G(typeof t=="function"?t(e):t));return O(()=>{typeof t=="function"&&i(G(t(e)))},[e]),[o,{registerActions:s=>i(a=>G([...a,...s])),updateActions:s=>i(G(typeof s=="function"?s(e):s)),removeActions:s=>i(a=>a.filter(d=>!s.includes(d.id))),triggerAction:s=>{var a;let d=o.find(g=>g.id===s);(a=d?.onTrigger)==null||a.call(d,d)}}]}function Re(t,e){return t===null?[]:Array.isArray(t)?t.map(o=>[o,e]):[[t,e]]}function Kt(t,e){_t(Re(t,e))}w();w();var ze=j((t,{radius:e})=>({action:{position:"relative",display:"block",width:"100%",padding:"10px 12px",borderRadius:t.fn.radius(e)},actionHovered:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[1]},actionIcon:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]},actionBody:{flex:1}})),$t=ze;var We=Object.defineProperty,F=Object.getOwnPropertySymbols,qt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,Xt=(t,e,o)=>e in t?We(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ve=(t,e)=>{for(var o in e||(e={}))qt.call(e,o)&&Xt(t,o,e[o]);if(F)for(var o of F(e))Jt.call(e,o)&&Xt(t,o,e[o]);return t},Ue=(t,e)=>{var o={};for(var i in t)qt.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&F)for(var i of F(t))e.indexOf(i)<0&&Jt.call(t,i)&&(o[i]=t[i]);return o};function et(t){var e=t,{action:o,styles:i,classNames:l,hovered:c,onTrigger:m,highlightQuery:_,highlightColor:s,query:a,radius:d}=e,g=Ue(e,["action","styles","classNames","hovered","onTrigger","highlightQuery","highlightColor","query","radius"]);let{classes:u,cx:h}=$t({radius:d},{styles:i,classNames:l,name:"Spotlight"});return n.createElement(Q,Ve({className:h(u.action,{[u.actionHovered]:c}),tabIndex:-1,onMouseDown:b=>b.preventDefault(),onClick:m},g),n.createElement(wt,{noWrap:!0},o.icon&&n.createElement(yt,{className:u.actionIcon},o.icon),n.createElement("div",{className:u.actionBody},n.createElement(Ot,{highlightColor:s,highlight:_?a:null},o.title),o.description&&n.createElement(S,{color:"dimmed",size:"xs"},o.description))))}et.displayName="@mantine/spotlight/DefaultAction";w();var Qe=j(t=>({nothingFound:{},actions:{padding:t.spacing.xs/2,borderTop:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2]}`},actionsGroup:{textTransform:"uppercase",fontSize:t.spacing.xs,fontWeight:700,padding:"10px 12px",paddingBottom:0,paddingTop:15}})),Yt=Qe;function ot({actions:t,styles:e,classNames:o,actionComponent:i,hovered:l,onActionHover:c,onActionTrigger:m,query:_,nothingFoundMessage:s,highlightQuery:a,highlightColor:d,radius:g}){let{classes:u}=Yt(null,{classNames:o,styles:e,name:"Spotlight"}),h=t.map(v=>v.type==="item"?n.createElement(i,{query:_,key:v.item.id,action:v.item,hovered:v.index===l,onMouseEnter:()=>c(v.index),classNames:o,styles:e,radius:g,onTrigger:()=>m(v.item),highlightQuery:a,highlightColor:d}):n.createElement(S,{className:u.actionsGroup,color:"dimmed",key:v.label},v.label)),b=h.length>0||!!s&&_.trim().length>0;return n.createElement(n.Fragment,null,b&&n.createElement("div",{className:u.actions},h.length>0?h:n.createElement(S,{color:"dimmed",className:u.nothingFound,align:"center",size:"lg",py:"md"},s)))}ot.displayName="@mantine/spotlight/ActionsList";function Ze(t){return Array.isArray(t)?t.map(e=>e.trim()).join(",").toLowerCase().trim():typeof t=="string"?t.toLowerCase().trim():""}function te(t,e){let o=t.trim().toLowerCase(),i=[[],[]];return e.forEach(l=>{var c,m;(c=l.title)!=null&&c.toLowerCase().includes(o)?i[0].push(l):((m=l.description)!=null&&m.toLowerCase().includes(o)||Ze(l.keywords).includes(o))&&i[1].push(l)}),i.flat()}var Ge=Object.defineProperty,Fe=Object.defineProperties,Ke=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,oe=(t,e,o)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,re=(t,e)=>{for(var o in e||(e={}))$e.call(e,o)&&oe(t,o,e[o]);if(ee)for(var o of ee(e))Xe.call(e,o)&&oe(t,o,e[o]);return t},ie=(t,e)=>Fe(t,Ke(e)),qe=j((t,{centered:e,maxWidth:o,topOffset:i,radius:l})=>({root:ie(re({},t.fn.cover()),{position:"fixed"}),spotlight:{position:"relative",zIndex:2,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,borderRadius:t.fn.radius(l),width:"100%",maxWidth:o,overflow:"hidden",marginLeft:"calc(var(--removed-scroll-width, 0px) * -1)"},overlay:ie(re({},t.fn.cover()),{position:"fixed"}),inner:{height:"100vh",display:"flex",flexDirection:"column",paddingTop:e?t.spacing.md:i,justifyContent:e?"center":"flex-start",alignItems:"center"},searchInput:{border:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white}})),ne=qe;var Je=Object.defineProperty,K=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable,ae=(t,e,o)=>e in t?Je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ye=(t,e)=>{for(var o in e||(e={}))se.call(e,o)&&ae(t,o,e[o]);if(K)for(var o of K(e))le.call(e,o)&&ae(t,o,e[o]);return t},to=(t,e)=>{var o={};for(var i in t)se.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&K)for(var i of K(t))e.indexOf(i)<0&&le.call(t,i)&&(o[i]=t[i]);return o};function rt(t){var e=t,{query:o,onQueryChange:i,actions:l,onClose:c,opened:m,withinPortal:_,transition:s="pop",transitionDuration:a,classNames:d,styles:g,overlayColor:u="#000",overlayOpacity:h=.25,overlayBlur:b=3,shadow:v="md",radius:E="sm",centered:X=!1,closeOnActionTrigger:B=!0,highlightQuery:I=!1,highlightColor:T,maxWidth:M=600,topOffset:D=120,className:q,searchPlaceholder:H,searchIcon:R,filter:fe=te,nothingFoundMessage:he,limit:_e=10,actionComponent:ve=et,actionsWrapperComponent:ye="div",zIndex:be=dt("modal")}=e,Ce=to(e,["query","onQueryChange","actions","onClose","opened","withinPortal","transition","transitionDuration","classNames","styles","overlayColor","overlayOpacity","overlayBlur","shadow","radius","centered","closeOnActionTrigger","highlightQuery","highlightColor","maxWidth","topOffset","className","searchPlaceholder","searchIcon","filter","nothingFoundMessage","limit","actionComponent","actionsWrapperComponent","zIndex"]);let[z,k]=x(-1),[xe,at]=x(!1),{classes:P,cx:we}=ne({centered:X,maxWidth:M,topOffset:D,radius:E},{classNames:d,styles:g,name:"Spotlight"}),[,st]=ht(),Se=gt(m),J=()=>k(-1),W=()=>{J(),c()};mt({transitionDuration:0,opened:m});let ke=fe(o,l).slice(0,_e),lt=ut(ke).items,L=lt.map(f=>f.type==="item"?f.item:void 0).filter(f=>f);U(()=>{L.length-1<z&&k(L.length-1)},[L.length]);let Le=f=>{var A;if(!xe)switch(f.code){case"ArrowDown":{f.preventDefault(),k(y=>y<L.length-1?y+1:0);break}case"ArrowUp":{f.preventDefault(),k(y=>y>0?y-1:L.length-1);break}case"Enter":{f.preventDefault();let y=L[z];(A=y?.onTrigger)==null||A.call(y,y),B&&y?.onTrigger&&W();break}case"Escape":f.preventDefault(),W()}},Oe=f=>{i(f.currentTarget.value),z===-1&&k(0)};return n.createElement(St,{withinPortal:_,zIndex:be},n.createElement(kt,{onExited:()=>st(!1),onEntered:()=>st(!0),mounted:m,transitions:{spotlight:{duration:a,transition:s,timingFunction:"ease"},overlay:{duration:a/2,transition:"fade",timingFunction:"ease"}}},f=>n.createElement("div",Ye({className:we(P.root,q)},Ce),n.createElement("div",{className:P.inner,ref:Se},n.createElement(bt,{style:f.spotlight,className:P.spotlight,shadow:v,radius:E,onMouseLeave:J},n.createElement(jt,{value:o,onChange:Oe,onKeyDown:Le,onCompositionStart:()=>at(!0),onCompositionEnd:()=>at(!1),classNames:{input:P.searchInput},size:"lg",placeholder:H,icon:R,onMouseEnter:J,autoComplete:"chrome-please-just-do-not-show-it-thanks"}),n.createElement(ye,null,n.createElement(ot,{highlightQuery:I,highlightColor:T,actions:lt,actionComponent:ve,hovered:z,query:o,nothingFoundMessage:he,onActionHover:k,onActionTrigger:A=>{A.onTrigger(A),B&&W()},styles:g,classNames:d,radius:E}))),n.createElement("div",{style:f.overlay},n.createElement(Lt,{className:P.overlay,zIndex:1,onMouseDown:W,color:u,opacity:h,blur:b}))))))}rt.displayName="@mantine/spotlight/Spotlight";w();var it={open:"mantine:open-spotlight",close:"mantine:close-spotlight",toggle:"mantine:toggle-spotlight",triggerAction:"mantine:trigger-spotlight-action",registerActions:"mantine:register-spotlight-actions",removeActions:"mantine:remove-spotlight-actions"};function eo(t,e){return new CustomEvent(t,{detail:e})}function nt(){window.dispatchEvent(eo(it.open))}function ce(t){let e={registerActions:o=>t.registerActions(o.detail),removeActions:o=>t.removeActions(o.detail),triggerAction:o=>t.triggerAction(o.detail),open:t.openSpotlight,close:t.closeSpotlight,toggle:t.toggleSpotlight};O(()=>(Object.keys(e).forEach(o=>{window.addEventListener(it[o],e[o])}),()=>{Object.keys(e).forEach(o=>{window.removeEventListener(it[o],e[o])})}),[])}var oo=Object.defineProperty,$=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,pe=(t,e,o)=>e in t?oo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ro=(t,e)=>{for(var o in e||(e={}))de.call(e,o)&&pe(t,o,e[o]);if($)for(var o of $(e))ue.call(e,o)&&pe(t,o,e[o]);return t},io=(t,e)=>{var o={};for(var i in t)de.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&$)for(var i of $(t))e.indexOf(i)<0&&ue.call(t,i)&&(o[i]=t[i]);return o};function me(t){var e=t,{actions:o,children:i,shortcut:l="mod + K",onSpotlightClose:c,onSpotlightOpen:m,onQueryChange:_,cleanQueryOnClose:s=!0,transitionDuration:a=150}=e,d=io(e,["actions","children","shortcut","onSpotlightClose","onSpotlightOpen","onQueryChange","cleanQueryOnClose","transitionDuration"]);let g=pt(-1),[u,h]=x(""),[b,{registerActions:v,updateActions:E,removeActions:X,triggerAction:B}]=Ft(o,u);U(()=>{E(o)},[o]);let I=R=>{h(R),_?.(R)},[T,{open:M,close:D,toggle:q}]=vt(!1,{onClose:()=>{c?.(),s&&(g.current=window.setTimeout(()=>{I("")},a))},onOpen:()=>{m?.(),window.clearTimeout(g.current)}}),H={openSpotlight:M,closeSpotlight:D,toggleSpotlight:q,registerActions:v,removeActions:X,triggerAction:B,opened:T,actions:b,query:u};return Kt(l,M),ce(H),n.createElement(Qt.Provider,{value:H},n.createElement(rt,ro({actions:b,onClose:D,opened:T,query:u,onQueryChange:I,transitionDuration:a},d)),i)}me.displayName="@mantine/spotlight/SpotlightProvider";je();function ge(t){let[e,o]=x(!1);O(()=>{let l=navigator.userAgentData?.platform??navigator.platform;o(/mac/i.test(l||""))},[]);let i=()=>{nt()};return r("button",{type:"button",className:N("SearchBar",t.className),onClick:i,"aria-label":"Open search",children:[r(zt,{className:"SearchBar__icon",size:16,stroke:1.5}),r("span",{className:"SearchBar__placeholder",children:"Search"}),r("span",{className:"SearchBar__shortcut","aria-hidden":"true",children:e?"\u2318 + K":"Ctrl + K"})]})}var C="1.5";function p(t){return r("div",{className:"Layout",children:[r(p.Top,{}),r(p.Side,{}),r(p.Main,{...t,children:t.children}),r(p.Bottom,{})]})}function no(t){let o=t.split("?")[0].replace(/\/+$/g,"").split("/").filter(Boolean);return o.length===4&&o[0]==="cms"&&o[1]==="content"}p.Top=()=>{let t=window.__ROOT_CTX.rootConfig,e=t.projectName||t.projectId,o=t.minimalBranding,{url:i}=Y(),l=!no(i);return r("div",{className:"Layout__top",children:[o?r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:e}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]})]}):r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:r(Ut,{})}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]}),r("div",{className:"Layout__top__project",children:e})]}),l&&r("div",{className:"Layout__top__search",children:r(ge,{})})]})};p.Side=()=>{let{url:t}=Y(),e=t.replace(/\/*$/g,""),o=window.firebase.user,i=window.__ROOT_CTX.sidebar?.tools,l=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),c=s=>l.has(s),m=window.__ROOT_CTX.experiments||{},_=async()=>{await window.firebase.auth.signOut(),window.location.href="/cms/login"};return r("div",{className:"Layout__side",children:[r("div",{className:"Layout__side__buttons",children:[!c("home")&&r(p.SideButton,{label:"Home",url:"/cms",active:e==="/cms",children:r(It,{stroke:C})}),!c("content")&&r(p.SideButton,{label:"Content",url:"/cms/content",active:e.startsWith("/cms/content"),children:r(Bt,{stroke:C})}),m.taskManager&&r(p.SideButton,{label:"Tasks",url:"/cms/tasks",active:e.startsWith("/cms/tasks"),children:r(At,{stroke:C})}),!c("releases")&&r(p.SideButton,{label:"Releases",url:"/cms/releases",active:e.startsWith("/cms/releases"),children:r(Rt,{stroke:C})}),!c("data")&&r(p.SideButton,{label:"Data",url:"/cms/data",active:e.startsWith("/cms/data"),children:r(Nt,{stroke:C})}),!c("assets")&&r(p.SideButton,{label:"Asset Library",url:"/cms/assets",active:e.startsWith("/cms/assets"),children:r(Dt,{stroke:C})}),!c("translations")&&r(p.SideButton,{label:"Translations",url:"/cms/translations",active:e.startsWith("/cms/translations"),children:r(Tt,{stroke:C})}),Vt()&&!c("ai")&&r(p.SideButton,{label:"Root AI",url:"/cms/ai",active:e.startsWith("/cms/ai"),children:r(Ht,{stroke:C})}),i&&r(V,{children:[r("div",{className:"Layout__side__divider"}),Object.entries(i).map(([s,a])=>{let d=a.cmsUrl?.startsWith("/cms/")?a.cmsUrl:void 0,g=a.externalUrl,u=g??d??`/cms/tools/${s}`,h=g?void 0:u.replace(/\/*$/g,""),b=!g&&!!h&&(e===h||e.startsWith(`${h}/`));return r(p.SideButton,{className:"Layout__side__tool",label:a.label||"",url:u,active:b,external:!!g,children:a.icon?r("img",{className:"Layout__side__tool__icon",src:a.icon,alt:a.label||""}):r(Pt,{stroke:C})},s)}),r("div",{className:"Layout__side__divider"})]}),!c("settings")&&r(p.SideButton,{label:"Settings",url:"/cms/settings",active:e.startsWith("/cms/settings"),children:r(Wt,{stroke:C})})]}),r("div",{className:"Layout__side__user",children:r(Z,{shadow:"md",position:"right",control:r(Q,{children:r(xt,{src:o.photoURL,alt:o.email,size:30,radius:"xl"})}),children:[r(Z.Label,{children:r(S,{size:"xs",color:"dimmed",truncate:!0,children:["Signed in as ",o.email]})}),r(Ct,{}),r(Z.Item,{color:"red",icon:r(Mt,{style:{width:14,height:14}}),onClick:_,children:"Sign out"})]})})]})};p.SideButton=t=>r(Et,{className:N("Layout__side__button",t.className),label:t.label,position:"right",withArrow:!0,children:r("a",{className:N(t.active&&"active"),href:t.url,target:t.external?"_blank":void 0,rel:t.external?"noreferrer noopener":void 0,children:t.children})});p.Main=t=>r("div",{className:"Layout__main",children:t.children});p.Bottom=()=>r("div",{className:"Layout__bottom"});export{me as a,p as b};
|
|
1
|
+
import{a as Vt}from"./chunk-AAHM6RYJ.js";import{d as Y,e as N}from"./chunk-BUNR5EU3.js";import{C as dt,Cc as zt,D as j,E as ut,Fa as Et,Fb as Bt,Fc as Wt,G as U,Ga as r,H as mt,I as gt,K as ft,O as ht,Ob as It,P as _t,Q as vt,S as Q,T as yt,Tb as Tt,Y as S,Ya as Pt,Z as bt,_ as Ct,a as x,aa as xt,c as O,e as pt,ec as Mt,fa as wt,fb as At,ha as St,ia as kt,j as je,ja as Lt,ka as Ot,ob as Nt,pc as Dt,qa as Z,ua as jt,v as n,xc as Ht,y as w,yc as Rt}from"./chunk-LROR6N3B.js";import{d as V,j as ct}from"./chunk-KUCVLANF.js";var tt={name:"@blinkk/root-cms",version:"3.1.3",author:"s@blinkk.com",license:"MIT",engines:{node:">=22.0.0"},repository:{type:"git",url:"git+https://github.com/blinkk/rootjs.git",directory:"packages/root-cms"},files:["dist/**/*"],bin:{"root-cms":"./bin/root-cms.js"},type:"module",module:"./dist/core.js",types:"./dist/core/core.d.ts",exports:{".":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./browser-client":{types:"./dist/browser-client/browser-client.d.ts",import:"./dist/browser-client.js"},"./client":{types:"./dist/core/client.d.ts",import:"./dist/client.js"},"./core":{types:"./dist/core/core.d.ts",import:"./dist/core.js"},"./functions":{types:"./dist/core/functions.d.ts",import:"./dist/functions.js"},"./plugin":{types:"./dist/core/plugin.d.ts",import:"./dist/plugin.js"},"./project":{types:"./dist/core/project.d.ts",import:"./dist/project.js"},"./richtext":{types:"./dist/core/richtext.d.ts",import:"./dist/richtext.js"}},scripts:{build:'rm -rf dist && concurrently -n "core,signin,ui" npm:build:core npm:build:signin npm:build:ui',"build:core":"node ../../scripts/build-esbuild.mjs ./esbuild.config.json","build:ui":"pnpm build:ui:bundle && pnpm build:ui:clean","build:ui:bundle":"esbuild ui/ui.tsx --bundle --minify --alias:react=@preact/compat --alias:react-dom=@preact/compat --tsconfig=ui/tsconfig.json --outdir=dist/ui --legal-comments=external --splitting --format=esm","build:ui:clean":"rm -f dist/ui/*-*.css","build:signin":"esbuild signin/signin.tsx --bundle --minify --tsconfig=signin/tsconfig.json --outdir=dist/ui --legal-comments=external",dev:'rm -rf dist && concurrently -k -n "core,ui" npm:dev:core npm:dev:signin npm:dev:ui',"dev:core":"pnpm build:core --watch","dev:signin":"pnpm build:signin --watch","dev:ui":"pnpm build:ui:bundle --watch",test:"pnpm build && firebase emulators:exec 'vitest run --exclude=**/*.visual.test.tsx'","test:visual":"vitest run --config=vitest.config.visual.ts","test:watch":"pnpm build && firebase emulators:exec 'vitest'"},dependencies:{"@ag-grid-community/client-side-row-model":"32.3.9","@ag-grid-community/core":"32.3.9","@ag-grid-community/react":"32.3.9","@ag-grid-community/styles":"32.3.9","@ai-sdk/anthropic":"3.0.74","@ai-sdk/google":"3.0.67","@ai-sdk/openai":"3.0.60","@ai-sdk/openai-compatible":"2.0.46","@ai-sdk/react":"3.0.177","@google-cloud/firestore":"7.11.3","@hello-pangea/dnd":"18.0.1","@mantine/spotlight":"4.2.12","@types/cli-progress":"3.11.6",ai:"6.0.175","body-parser":"1.20.2","cli-progress":"3.12.0",commander:"11.0.0","csv-parse":"5.5.2","csv-stringify":"6.4.4","date-fns":"4.1.0","date-fns-tz":"3.2.0",diff:"8.0.2","dts-dom":"3.7.0","fnv-plus":"1.3.1",jsonwebtoken:"9.0.2",kleur:"4.1.5",minisearch:"7.2.0","sanitize-html":"2.13.1",sirv:"2.0.3","tiny-glob":"0.2.9",zod:"4.4.3"},"//":"NOTE(stevenle): due to compat issues with mantine and preact, mantine is pinned to v4.2.12",devDependencies:{"@babel/core":"7.17.9","@blinkk/root":"workspace:*","@editorjs/editorjs":"2.30.8","@editorjs/header":"2.8.8","@editorjs/image":"2.10.2","@editorjs/list":"2.0.6","@editorjs/nested-list":"1.4.3","@editorjs/raw":"2.5.1","@editorjs/table":"2.4.4","@editorjs/underline":"1.2.1","@emotion/react":"11.10.5","@firebase/app-compat":"0.5.2","@firebase/app-types":"0.9.3","@firebase/rules-unit-testing":"5.0.0","@lexical/code":"0.33.1","@lexical/html":"0.33.1","@lexical/link":"0.33.1","@lexical/list":"0.33.1","@lexical/markdown":"0.33.1","@lexical/react":"0.33.1","@lexical/rich-text":"0.33.1","@lexical/selection":"0.33.1","@lexical/table":"0.33.1","@lexical/utils":"0.33.1","@mantine/core":"4.2.12","@mantine/hooks":"4.2.12","@mantine/modals":"4.2.12","@mantine/notifications":"4.2.12","@preact/compat":"18.3.1","@tabler/icons-preact":"3.35.0","@testing-library/preact":"3.2.4","@testing-library/user-event":"14.6.1","@types/body-parser":"1.19.3","@types/fnv-plus":"1.3.2","@types/gapi":"0.0.47","@types/gapi.client.drive-v3":"0.0.4","@types/gapi.client.sheets-v4":"0.0.4","@types/google.accounts":"0.0.14","@types/jsonwebtoken":"9.0.1","@types/node":"24.3.1","@types/sanitize-html":"2.13.0","@vitest/browser":"4.1.8","@vitest/browser-playwright":"4.1.8",concurrently:"7.6.0",esbuild:"0.28.0",firebase:"12.2.1","firebase-admin":"13.5.0","firebase-functions":"6.4.0","firebase-tools":"14.15.2","highlight.js":"11.6.0",jsdom:"27.2.0","json-diff-kit":"1.0.29",lexical:"0.33.1",marked:"9.1.1","mdast-util-from-markdown":"2.0.1","mdast-util-gfm":"3.0.0","micromark-extension-gfm":"3.0.0",playwright:"1.60.0",preact:"10.27.1","preact-iso":"2.11.1","preact-render-to-string":"6.6.7",react:"npm:@preact/compat@18.3.1","react-dom":"npm:@preact/compat@18.3.1","react-easy-crop":"5.5.6","react-json-view-compare":"2.0.2",typescript:"6.0.3",vite:"8.0.13",vitest:"4.1.6",yjs:"13.6.27"},peerDependencies:{"@blinkk/root":"3.1.3","firebase-admin":">=11","firebase-functions":">=4"},peerDependenciesMeta:{"firebase-functions":{optional:!0}}};function Ut(){return r("svg",{width:"100",height:"23",viewBox:"0 0 100 23",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r("g",{"clip-path":"url(#clip0_1_318)",children:[r("path",{d:"M7.82998 5.01802C3.12925 5.6479 0.833937 18.1194 2.62578 19.6731C5.64773 22.2934 16.6441 14.1722 15.6786 9.46913C15.3009 6.61371 11.2717 4.28377 7.82998 5.01802Z",fill:"black"}),r("path",{d:"M13.9782 0.720147C12.6553 0.896474 12.0093 4.38767 12.5136 4.8226C13.364 5.55611 16.4587 3.28271 16.187 1.96616C16.0807 1.16683 14.9468 0.514607 13.9782 0.720147Z",fill:"black"}),r("path",{d:"M92.7383 17.6275C90.9681 17.6275 89.3816 17.0263 88.3796 16.0744C87.9955 15.7237 87.8953 15.3396 88.246 14.9555L88.8305 14.2541C89.1645 13.87 89.5486 13.7865 89.9327 14.1205C90.6007 14.6883 91.7029 15.1726 92.5713 15.1726C93.5232 15.1726 94.1244 14.8219 94.1244 14.2875C94.1244 13.5193 93.2059 13.4358 91.9868 13.0684C90.417 12.6008 88.5132 11.7324 88.5132 9.64493C88.5132 7.70773 90.25 6.37173 92.7383 6.37173C94.2413 6.37173 95.5272 6.87273 96.4123 7.57413C96.8131 7.90813 96.9467 8.27553 96.596 8.67633L96.0282 9.37773C95.7109 9.76183 95.3435 9.82863 94.926 9.51133C94.3916 9.09383 93.6568 8.69303 92.7884 8.69303C92.0202 8.69303 91.5192 9.01033 91.5192 9.51133C91.5192 10.1292 92.3041 10.4131 93.1224 10.6636C94.9761 11.2314 97.1304 11.8326 97.1304 14.2708C97.1304 16.4585 95.1264 17.6275 92.7383 17.6275Z",fill:"black"}),r("path",{d:"M87.0008 16.6756C87.0843 17.1766 86.8171 17.4271 86.2994 17.4271H85.097C84.596 17.4271 84.3789 17.1766 84.3121 16.6756L83.7443 11.9161L81.757 16.7424C81.5399 17.2434 81.1892 17.5106 80.6882 17.5106H80.5212C80.0202 17.5106 79.6695 17.2434 79.4524 16.7424L77.4651 11.8994L76.8973 16.6756C76.8472 17.1766 76.6301 17.4271 76.1291 17.4271H74.7263C74.2086 17.4271 73.9414 17.1766 74.0082 16.6756L75.4945 7.24013C75.5613 6.75583 75.8786 6.48863 76.3796 6.48863H76.5466C77.0476 6.48863 77.3315 6.75583 77.5486 7.24013L80.6047 13.8032L83.4938 7.24013C83.7109 6.75583 84.0115 6.48863 84.4958 6.48863H84.6795C85.1638 6.48863 85.4811 6.75583 85.5646 7.24013L87.0008 16.6756Z",fill:"black"}),r("path",{d:"M68.6496 17.6275C65.3096 17.6275 62.7211 15.2227 62.7211 11.9996C62.7211 8.77653 65.3096 6.37173 68.683 6.37173C70.3029 6.37173 71.7558 6.97293 72.7745 7.99163C73.1419 8.34233 73.1419 8.77653 72.7745 9.09383L71.9228 9.81193C71.5554 10.1292 71.2047 10.1125 70.8206 9.79523C70.2361 9.31093 69.5013 9.01033 68.683 9.01033C67.013 9.01033 65.7104 10.2628 65.7104 11.9996C65.7104 13.7364 67.013 14.9889 68.683 14.9889C69.5013 14.9889 70.2528 14.6883 70.8206 14.204C71.2047 13.8867 71.5554 13.87 71.9228 14.1873L72.7745 14.9054C73.1419 15.2227 73.1419 15.6569 72.7745 16.0076C71.7558 17.0263 70.3029 17.6275 68.6496 17.6275Z",fill:"black"}),r("path",{d:"M58.575 16.2915C58.7587 16.6923 58.4581 16.8927 58.241 17.0597C57.7233 17.4271 56.9384 17.6442 56.1201 17.6442C54.4501 17.6442 52.8469 16.6923 52.8469 14.4044V11.0978H52.1121C51.6111 11.0978 51.3439 10.8139 51.3439 10.3296V9.76183C51.3439 9.26083 51.6111 8.99363 52.1121 8.99363H52.8469V7.05643C52.8469 6.57213 53.1308 6.38843 53.6151 6.28823L54.9511 6.05443C55.4521 5.95423 55.7193 6.30493 55.7193 6.80593V8.99363H57.3726C57.8569 8.99363 58.1408 9.26083 58.1408 9.76183V10.3296C58.1408 10.8139 57.8569 11.0978 57.3726 11.0978H55.7193V14.1038C55.7193 14.9221 56.1368 15.1893 56.6545 15.1893C56.905 15.1893 57.1555 15.0724 57.3392 14.9555C57.7567 14.6883 57.9571 14.8887 58.1074 15.206L58.575 16.2915Z",fill:"black"}),r("path",{d:"M46.2592 17.6442C43.5538 17.6442 41.5999 15.7738 41.5999 13.2521C41.5999 10.7304 43.5538 8.86003 46.2592 8.86003C48.9646 8.86003 50.9185 10.7304 50.9185 13.2521C50.9185 15.7738 48.9646 17.6442 46.2592 17.6442ZM46.2592 15.1726C47.3113 15.1726 48.0628 14.3543 48.0628 13.2521C48.0628 12.1499 47.3113 11.3316 46.2592 11.3316C45.2071 11.3316 44.4389 12.1499 44.4389 13.2521C44.4389 14.3543 45.2071 15.1726 46.2592 15.1726Z",fill:"black"}),r("path",{d:"M36.052 17.6442C33.3466 17.6442 31.3927 15.7738 31.3927 13.2521C31.3927 10.7304 33.3466 8.86003 36.052 8.86003C38.7574 8.86003 40.7113 10.7304 40.7113 13.2521C40.7113 15.7738 38.7574 17.6442 36.052 17.6442ZM36.052 15.1726C37.1041 15.1726 37.8556 14.3543 37.8556 13.2521C37.8556 12.1499 37.1041 11.3316 36.052 11.3316C34.9999 11.3316 34.2317 12.1499 34.2317 13.2521C34.2317 14.3543 34.9999 15.1726 36.052 15.1726Z",fill:"black"}),r("path",{d:"M28.7099 13.0851L30.6805 16.6422C30.9644 17.1599 30.6638 17.4271 30.1628 17.4271H28.4594C27.9417 17.4271 27.8081 17.1766 27.5242 16.6589L25.7707 13.4859H24.6351V16.6422C24.6351 17.1432 24.3512 17.4271 23.8502 17.4271H22.4808C21.9798 17.4271 21.6959 17.1432 21.6959 16.6422V7.35703C21.6959 6.85603 21.9798 6.57213 22.4808 6.57213H26.5222C29.3111 6.57213 30.8141 7.92483 30.8141 10.1125C30.8141 11.5654 29.9791 12.5841 28.7099 13.0851ZM24.6351 8.96023V11.5153H26.4721C27.2236 11.5153 27.8248 11.0644 27.8248 10.2628C27.8248 9.44453 27.2236 8.96023 26.4721 8.96023H24.6351Z",fill:"black"})]}),r("defs",{children:r("clipPath",{id:"clip0_1_318",children:r("rect",{width:"99",height:"22",fill:"white",transform:"translate(0.0175781 0.177246)"})})})]})}w();var Qt=ct(null);w();w();var Pe=Object.defineProperty,Ae=Object.defineProperties,Ne=Object.getOwnPropertyDescriptors,Zt=Object.getOwnPropertySymbols,Be=Object.prototype.hasOwnProperty,Ie=Object.prototype.propertyIsEnumerable,Gt=(t,e,o)=>e in t?Pe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Te=(t,e)=>{for(var o in e||(e={}))Be.call(e,o)&&Gt(t,o,e[o]);if(Zt)for(var o of Zt(e))Ie.call(e,o)&&Gt(t,o,e[o]);return t},Me=(t,e)=>Ae(t,Ne(e));function De(t){return Me(Te({},t),{id:t.id||ft()})}function He(t){let e=[];return t.reduceRight((o,i)=>(e.includes(i.id)||(e.push(i.id),o.push(i)),o),[]).reverse()}function G(t){return He(t.map(e=>De(e)))}function Ft(t,e){let[o,i]=x(G(typeof t=="function"?t(e):t));return O(()=>{typeof t=="function"&&i(G(t(e)))},[e]),[o,{registerActions:s=>i(a=>G([...a,...s])),updateActions:s=>i(G(typeof s=="function"?s(e):s)),removeActions:s=>i(a=>a.filter(d=>!s.includes(d.id))),triggerAction:s=>{var a;let d=o.find(g=>g.id===s);(a=d?.onTrigger)==null||a.call(d,d)}}]}function Re(t,e){return t===null?[]:Array.isArray(t)?t.map(o=>[o,e]):[[t,e]]}function Kt(t,e){_t(Re(t,e))}w();w();var ze=j((t,{radius:e})=>({action:{position:"relative",display:"block",width:"100%",padding:"10px 12px",borderRadius:t.fn.radius(e)},actionHovered:{backgroundColor:t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[1]},actionIcon:{color:t.colorScheme==="dark"?t.colors.dark[2]:t.colors.gray[6]},actionBody:{flex:1}})),$t=ze;var We=Object.defineProperty,F=Object.getOwnPropertySymbols,qt=Object.prototype.hasOwnProperty,Jt=Object.prototype.propertyIsEnumerable,Xt=(t,e,o)=>e in t?We(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ve=(t,e)=>{for(var o in e||(e={}))qt.call(e,o)&&Xt(t,o,e[o]);if(F)for(var o of F(e))Jt.call(e,o)&&Xt(t,o,e[o]);return t},Ue=(t,e)=>{var o={};for(var i in t)qt.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&F)for(var i of F(t))e.indexOf(i)<0&&Jt.call(t,i)&&(o[i]=t[i]);return o};function et(t){var e=t,{action:o,styles:i,classNames:l,hovered:c,onTrigger:m,highlightQuery:_,highlightColor:s,query:a,radius:d}=e,g=Ue(e,["action","styles","classNames","hovered","onTrigger","highlightQuery","highlightColor","query","radius"]);let{classes:u,cx:h}=$t({radius:d},{styles:i,classNames:l,name:"Spotlight"});return n.createElement(Q,Ve({className:h(u.action,{[u.actionHovered]:c}),tabIndex:-1,onMouseDown:b=>b.preventDefault(),onClick:m},g),n.createElement(wt,{noWrap:!0},o.icon&&n.createElement(yt,{className:u.actionIcon},o.icon),n.createElement("div",{className:u.actionBody},n.createElement(Ot,{highlightColor:s,highlight:_?a:null},o.title),o.description&&n.createElement(S,{color:"dimmed",size:"xs"},o.description))))}et.displayName="@mantine/spotlight/DefaultAction";w();var Qe=j(t=>({nothingFound:{},actions:{padding:t.spacing.xs/2,borderTop:`1px solid ${t.colorScheme==="dark"?t.colors.dark[4]:t.colors.gray[2]}`},actionsGroup:{textTransform:"uppercase",fontSize:t.spacing.xs,fontWeight:700,padding:"10px 12px",paddingBottom:0,paddingTop:15}})),Yt=Qe;function ot({actions:t,styles:e,classNames:o,actionComponent:i,hovered:l,onActionHover:c,onActionTrigger:m,query:_,nothingFoundMessage:s,highlightQuery:a,highlightColor:d,radius:g}){let{classes:u}=Yt(null,{classNames:o,styles:e,name:"Spotlight"}),h=t.map(v=>v.type==="item"?n.createElement(i,{query:_,key:v.item.id,action:v.item,hovered:v.index===l,onMouseEnter:()=>c(v.index),classNames:o,styles:e,radius:g,onTrigger:()=>m(v.item),highlightQuery:a,highlightColor:d}):n.createElement(S,{className:u.actionsGroup,color:"dimmed",key:v.label},v.label)),b=h.length>0||!!s&&_.trim().length>0;return n.createElement(n.Fragment,null,b&&n.createElement("div",{className:u.actions},h.length>0?h:n.createElement(S,{color:"dimmed",className:u.nothingFound,align:"center",size:"lg",py:"md"},s)))}ot.displayName="@mantine/spotlight/ActionsList";function Ze(t){return Array.isArray(t)?t.map(e=>e.trim()).join(",").toLowerCase().trim():typeof t=="string"?t.toLowerCase().trim():""}function te(t,e){let o=t.trim().toLowerCase(),i=[[],[]];return e.forEach(l=>{var c,m;(c=l.title)!=null&&c.toLowerCase().includes(o)?i[0].push(l):((m=l.description)!=null&&m.toLowerCase().includes(o)||Ze(l.keywords).includes(o))&&i[1].push(l)}),i.flat()}var Ge=Object.defineProperty,Fe=Object.defineProperties,Ke=Object.getOwnPropertyDescriptors,ee=Object.getOwnPropertySymbols,$e=Object.prototype.hasOwnProperty,Xe=Object.prototype.propertyIsEnumerable,oe=(t,e,o)=>e in t?Ge(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,re=(t,e)=>{for(var o in e||(e={}))$e.call(e,o)&&oe(t,o,e[o]);if(ee)for(var o of ee(e))Xe.call(e,o)&&oe(t,o,e[o]);return t},ie=(t,e)=>Fe(t,Ke(e)),qe=j((t,{centered:e,maxWidth:o,topOffset:i,radius:l})=>({root:ie(re({},t.fn.cover()),{position:"fixed"}),spotlight:{position:"relative",zIndex:2,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white,borderRadius:t.fn.radius(l),width:"100%",maxWidth:o,overflow:"hidden",marginLeft:"calc(var(--removed-scroll-width, 0px) * -1)"},overlay:ie(re({},t.fn.cover()),{position:"fixed"}),inner:{height:"100vh",display:"flex",flexDirection:"column",paddingTop:e?t.spacing.md:i,justifyContent:e?"center":"flex-start",alignItems:"center"},searchInput:{border:0,borderBottomRightRadius:0,borderBottomLeftRadius:0,backgroundColor:t.colorScheme==="dark"?t.colors.dark[6]:t.white}})),ne=qe;var Je=Object.defineProperty,K=Object.getOwnPropertySymbols,se=Object.prototype.hasOwnProperty,le=Object.prototype.propertyIsEnumerable,ae=(t,e,o)=>e in t?Je(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,Ye=(t,e)=>{for(var o in e||(e={}))se.call(e,o)&&ae(t,o,e[o]);if(K)for(var o of K(e))le.call(e,o)&&ae(t,o,e[o]);return t},to=(t,e)=>{var o={};for(var i in t)se.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&K)for(var i of K(t))e.indexOf(i)<0&&le.call(t,i)&&(o[i]=t[i]);return o};function rt(t){var e=t,{query:o,onQueryChange:i,actions:l,onClose:c,opened:m,withinPortal:_,transition:s="pop",transitionDuration:a,classNames:d,styles:g,overlayColor:u="#000",overlayOpacity:h=.25,overlayBlur:b=3,shadow:v="md",radius:E="sm",centered:X=!1,closeOnActionTrigger:B=!0,highlightQuery:I=!1,highlightColor:T,maxWidth:M=600,topOffset:D=120,className:q,searchPlaceholder:H,searchIcon:R,filter:fe=te,nothingFoundMessage:he,limit:_e=10,actionComponent:ve=et,actionsWrapperComponent:ye="div",zIndex:be=dt("modal")}=e,Ce=to(e,["query","onQueryChange","actions","onClose","opened","withinPortal","transition","transitionDuration","classNames","styles","overlayColor","overlayOpacity","overlayBlur","shadow","radius","centered","closeOnActionTrigger","highlightQuery","highlightColor","maxWidth","topOffset","className","searchPlaceholder","searchIcon","filter","nothingFoundMessage","limit","actionComponent","actionsWrapperComponent","zIndex"]);let[z,k]=x(-1),[xe,at]=x(!1),{classes:P,cx:we}=ne({centered:X,maxWidth:M,topOffset:D,radius:E},{classNames:d,styles:g,name:"Spotlight"}),[,st]=ht(),Se=gt(m),J=()=>k(-1),W=()=>{J(),c()};mt({transitionDuration:0,opened:m});let ke=fe(o,l).slice(0,_e),lt=ut(ke).items,L=lt.map(f=>f.type==="item"?f.item:void 0).filter(f=>f);U(()=>{L.length-1<z&&k(L.length-1)},[L.length]);let Le=f=>{var A;if(!xe)switch(f.code){case"ArrowDown":{f.preventDefault(),k(y=>y<L.length-1?y+1:0);break}case"ArrowUp":{f.preventDefault(),k(y=>y>0?y-1:L.length-1);break}case"Enter":{f.preventDefault();let y=L[z];(A=y?.onTrigger)==null||A.call(y,y),B&&y?.onTrigger&&W();break}case"Escape":f.preventDefault(),W()}},Oe=f=>{i(f.currentTarget.value),z===-1&&k(0)};return n.createElement(St,{withinPortal:_,zIndex:be},n.createElement(kt,{onExited:()=>st(!1),onEntered:()=>st(!0),mounted:m,transitions:{spotlight:{duration:a,transition:s,timingFunction:"ease"},overlay:{duration:a/2,transition:"fade",timingFunction:"ease"}}},f=>n.createElement("div",Ye({className:we(P.root,q)},Ce),n.createElement("div",{className:P.inner,ref:Se},n.createElement(bt,{style:f.spotlight,className:P.spotlight,shadow:v,radius:E,onMouseLeave:J},n.createElement(jt,{value:o,onChange:Oe,onKeyDown:Le,onCompositionStart:()=>at(!0),onCompositionEnd:()=>at(!1),classNames:{input:P.searchInput},size:"lg",placeholder:H,icon:R,onMouseEnter:J,autoComplete:"chrome-please-just-do-not-show-it-thanks"}),n.createElement(ye,null,n.createElement(ot,{highlightQuery:I,highlightColor:T,actions:lt,actionComponent:ve,hovered:z,query:o,nothingFoundMessage:he,onActionHover:k,onActionTrigger:A=>{A.onTrigger(A),B&&W()},styles:g,classNames:d,radius:E}))),n.createElement("div",{style:f.overlay},n.createElement(Lt,{className:P.overlay,zIndex:1,onMouseDown:W,color:u,opacity:h,blur:b}))))))}rt.displayName="@mantine/spotlight/Spotlight";w();var it={open:"mantine:open-spotlight",close:"mantine:close-spotlight",toggle:"mantine:toggle-spotlight",triggerAction:"mantine:trigger-spotlight-action",registerActions:"mantine:register-spotlight-actions",removeActions:"mantine:remove-spotlight-actions"};function eo(t,e){return new CustomEvent(t,{detail:e})}function nt(){window.dispatchEvent(eo(it.open))}function ce(t){let e={registerActions:o=>t.registerActions(o.detail),removeActions:o=>t.removeActions(o.detail),triggerAction:o=>t.triggerAction(o.detail),open:t.openSpotlight,close:t.closeSpotlight,toggle:t.toggleSpotlight};O(()=>(Object.keys(e).forEach(o=>{window.addEventListener(it[o],e[o])}),()=>{Object.keys(e).forEach(o=>{window.removeEventListener(it[o],e[o])})}),[])}var oo=Object.defineProperty,$=Object.getOwnPropertySymbols,de=Object.prototype.hasOwnProperty,ue=Object.prototype.propertyIsEnumerable,pe=(t,e,o)=>e in t?oo(t,e,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[e]=o,ro=(t,e)=>{for(var o in e||(e={}))de.call(e,o)&&pe(t,o,e[o]);if($)for(var o of $(e))ue.call(e,o)&&pe(t,o,e[o]);return t},io=(t,e)=>{var o={};for(var i in t)de.call(t,i)&&e.indexOf(i)<0&&(o[i]=t[i]);if(t!=null&&$)for(var i of $(t))e.indexOf(i)<0&&ue.call(t,i)&&(o[i]=t[i]);return o};function me(t){var e=t,{actions:o,children:i,shortcut:l="mod + K",onSpotlightClose:c,onSpotlightOpen:m,onQueryChange:_,cleanQueryOnClose:s=!0,transitionDuration:a=150}=e,d=io(e,["actions","children","shortcut","onSpotlightClose","onSpotlightOpen","onQueryChange","cleanQueryOnClose","transitionDuration"]);let g=pt(-1),[u,h]=x(""),[b,{registerActions:v,updateActions:E,removeActions:X,triggerAction:B}]=Ft(o,u);U(()=>{E(o)},[o]);let I=R=>{h(R),_?.(R)},[T,{open:M,close:D,toggle:q}]=vt(!1,{onClose:()=>{c?.(),s&&(g.current=window.setTimeout(()=>{I("")},a))},onOpen:()=>{m?.(),window.clearTimeout(g.current)}}),H={openSpotlight:M,closeSpotlight:D,toggleSpotlight:q,registerActions:v,removeActions:X,triggerAction:B,opened:T,actions:b,query:u};return Kt(l,M),ce(H),n.createElement(Qt.Provider,{value:H},n.createElement(rt,ro({actions:b,onClose:D,opened:T,query:u,onQueryChange:I,transitionDuration:a},d)),i)}me.displayName="@mantine/spotlight/SpotlightProvider";je();function ge(t){let[e,o]=x(!1);O(()=>{let l=navigator.userAgentData?.platform??navigator.platform;o(/mac/i.test(l||""))},[]);let i=()=>{nt()};return r("button",{type:"button",className:N("SearchBar",t.className),onClick:i,"aria-label":"Open search",children:[r(zt,{className:"SearchBar__icon",size:16,stroke:1.5}),r("span",{className:"SearchBar__placeholder",children:"Search"}),r("span",{className:"SearchBar__shortcut","aria-hidden":"true",children:e?"\u2318 + K":"Ctrl + K"})]})}var C="1.5";function p(t){return r("div",{className:"Layout",children:[r(p.Top,{}),r(p.Side,{}),r(p.Main,{...t,children:t.children}),r(p.Bottom,{})]})}function no(t){let o=t.split("?")[0].replace(/\/+$/g,"").split("/").filter(Boolean);return o.length===4&&o[0]==="cms"&&o[1]==="content"}p.Top=()=>{let t=window.__ROOT_CTX.rootConfig,e=t.projectName||t.projectId,o=t.minimalBranding,{url:i}=Y(),l=!no(i);return r("div",{className:"Layout__top",children:[o?r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:e}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]})]}):r(V,{children:[r("a",{className:"Layout__top__logo",href:"/cms",children:r(Ut,{})}),r("a",{className:"Layout__top__version",href:"https://github.com/blinkk/rootjs/blob/main/packages/root-cms/CHANGELOG.md",target:"_blank",rel:"noreferrer noopener",children:["v",tt.version]}),r("div",{className:"Layout__top__project",children:e})]}),l&&r("div",{className:"Layout__top__search",children:r(ge,{})})]})};p.Side=()=>{let{url:t}=Y(),e=t.replace(/\/*$/g,""),o=window.firebase.user,i=window.__ROOT_CTX.sidebar?.tools,l=new Set(window.__ROOT_CTX.sidebar?.hiddenBuiltInTools||[]),c=s=>l.has(s),m=window.__ROOT_CTX.experiments||{},_=async()=>{await window.firebase.auth.signOut(),window.location.href="/cms/login"};return r("div",{className:"Layout__side",children:[r("div",{className:"Layout__side__buttons",children:[!c("home")&&r(p.SideButton,{label:"Home",url:"/cms",active:e==="/cms",children:r(It,{stroke:C})}),!c("content")&&r(p.SideButton,{label:"Content",url:"/cms/content",active:e.startsWith("/cms/content"),children:r(Bt,{stroke:C})}),m.taskManager&&r(p.SideButton,{label:"Tasks",url:"/cms/tasks",active:e.startsWith("/cms/tasks"),children:r(At,{stroke:C})}),!c("releases")&&r(p.SideButton,{label:"Releases",url:"/cms/releases",active:e.startsWith("/cms/releases"),children:r(Rt,{stroke:C})}),!c("data")&&r(p.SideButton,{label:"Data",url:"/cms/data",active:e.startsWith("/cms/data"),children:r(Nt,{stroke:C})}),!c("assets")&&r(p.SideButton,{label:"Asset Library",url:"/cms/assets",active:e.startsWith("/cms/assets"),children:r(Dt,{stroke:C})}),!c("translations")&&r(p.SideButton,{label:"Translations",url:"/cms/translations",active:e.startsWith("/cms/translations"),children:r(Tt,{stroke:C})}),Vt()&&!c("ai")&&r(p.SideButton,{label:"Root AI",url:"/cms/ai",active:e.startsWith("/cms/ai"),children:r(Ht,{stroke:C})}),i&&r(V,{children:[r("div",{className:"Layout__side__divider"}),Object.entries(i).map(([s,a])=>{let d=a.cmsUrl?.startsWith("/cms/")?a.cmsUrl:void 0,g=a.externalUrl,u=g??d??`/cms/tools/${s}`,h=g?void 0:u.replace(/\/*$/g,""),b=!g&&!!h&&(e===h||e.startsWith(`${h}/`));return r(p.SideButton,{className:"Layout__side__tool",label:a.label||"",url:u,active:b,external:!!g,children:a.icon?r("img",{className:"Layout__side__tool__icon",src:a.icon,alt:a.label||""}):r(Pt,{stroke:C})},s)}),r("div",{className:"Layout__side__divider"})]}),!c("settings")&&r(p.SideButton,{label:"Settings",url:"/cms/settings",active:e.startsWith("/cms/settings"),children:r(Wt,{stroke:C})})]}),r("div",{className:"Layout__side__user",children:r(Z,{shadow:"md",position:"right",control:r(Q,{children:r(xt,{src:o.photoURL,alt:o.email,size:30,radius:"xl"})}),children:[r(Z.Label,{children:r(S,{size:"xs",color:"dimmed",truncate:!0,children:["Signed in as ",o.email]})}),r(Ct,{}),r(Z.Item,{color:"red",icon:r(Mt,{style:{width:14,height:14}}),onClick:_,children:"Sign out"})]})})]})};p.SideButton=t=>r(Et,{className:N("Layout__side__button",t.className),label:t.label,position:"right",withArrow:!0,children:r("a",{className:N(t.active&&"active"),href:t.url,target:t.external?"_blank":void 0,rel:t.external?"noreferrer noopener":void 0,children:t.children})});p.Main=t=>r("div",{className:"Layout__main",children:t.children});p.Bottom=()=>r("div",{className:"Layout__bottom"});export{me as a,p as b};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as mt,b as ut,c as gt}from"./chunk-UPDL6UXI.js";import{a as pt}from"./chunk-ENQKSLGJ.js";import{g as oe,h as Ke,i as Me,j as Ze,k as Je,l as Qe,m as Ye,n as et,o as tt,p as st,q as ce,r as ot,s as Fe,t as at,u as me,y as _e,z as fe}from"./chunk-Z6DBYLIM.js";import{a as ft}from"./chunk-W5DOO6ID.js";import{a as _t}from"./chunk-NSOTG64N.js";import{b as M}from"./chunk-J5E457OI.js";import{a as A,b as He,c as Oe}from"./chunk-QHJOTXYB.js";import{b as Ve,d as Ce}from"./chunk-KRNQ6L35.js";import{e as ue}from"./chunk-BUNR5EU3.js";import{$a as Ne,Ab as he,Cc as dt,Da as re,Db as it,Eb as ve,Fa as Ge,Fb as ze,Ga as e,Pb as rt,Rc as W,Uc as ct,V as te,W as se,a as i,c as U,da as g,ea as G,g as $e,j as Le,lb as ge,mc as Ie,na as je,qa as k,ra as S,tb as De,ua as H,vb as pe,wb as lt,zb as nt}from"./chunk-LROR6N3B.js";import{d as C}from"./chunk-KUCVLANF.js";import{g as We,h as de,k as D,l as O,m as ke,n as V,o as Xe,p as qe}from"./chunk-7SK47HHZ.js";Le();Le();function ht(t){let o=t.file||{},a=o.src||"",l=o.filename||a,r={"--asset-thumb-size":`${t.size}px`};if(a&&O(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("img",{src:Te(o,t.size*2),alt:o.alt||"",loading:"lazy"})});if(a&&V(l))return e("div",{className:"AssetBrowser__thumb",style:r,children:e("video",{src:a,muted:!0,playsInline:!0,preload:"metadata"})});let m=D(l);return e("div",{className:"AssetBrowser__thumb",style:r,children:m&&m.length<=4?e("div",{className:"AssetBrowser__thumb__ext",children:m}):e(he,{size:20,stroke:"1.5"})})}function Te(t,o){let a=t?.src||"";return a.startsWith(We)&&o?`${a}=s${o}`:a}function we(t){let o=t?.src||"";ke(o)&&(o=o.split("=")[0]+"=s0"),navigator.clipboard.writeText(o).then(()=>{A({message:"Copied URL to clipboard.",autoClose:2e3})})}function be(t){let o=t?.src||"";if(o)if(ke(o)){let a=document.createElement("a");a.href=qe(o),t.filename&&(a.download=t.filename),document.body.appendChild(a),a.click(),document.body.removeChild(a)}else window.open(o,"_blank")}function vt(t){let[o,a]=i(t.asset),[l,r]=i(t.asset.file?.alt||""),[m,d]=i(!1),[x,v]=i(!1),[f,B]=i(null),[w,F]=i(null),n=o.file||{},u=n.filename||o.name,N=O(u),R=V(u),X=l!==(n.alt||""),q=n.altDisabled===!0;U(()=>{_e(o.id).then(c=>F(c)).catch(c=>{console.error("failed to fetch asset usage:",c),F([])})},[o.id]);async function z(c,b){let p=await fe(c,{previousFile:b});p.failedDocIds.length>0?A({title:"Some docs failed to update",message:`Failed to update: ${p.failedDocIds.join(", ")}. Re-save the asset to retry.`,color:"red",autoClose:!1}):p.updatedDocIds.length>0&&A({message:`Updated ${p.updatedDocIds.length} doc(s) that use this asset.`,color:"green"})}async function K(){d(!0),await M(async()=>{let c={...n},b=await at(o,l);a(b),t.onChanged(b),await z(b,c)}),d(!1)}function E(){let c=document.createElement("input");c.type="file",c.onchange=()=>{let b=c.files?.[0];if(!b)return;let p=D(u),y=D(b.name);if(p&&y&&p!==y){B(b);return}$(b)},c.click(),c.remove()}async function $(c){B(null),d(!0),await M(async()=>{let b={...n},p=await de(c),y=await ot(o,p);a(y),r(y.file?.alt||""),t.onChanged(y),await z(y,b)}),d(!1)}async function P(c){d(!0),await M(async()=>{let b={...n},p=await me(o,c);a(p),r(p.file?.alt||""),t.onChanged(p),await z(p,b)}),d(!1)}async function Z(){d(!0),await M(async()=>{await ce(o),A({message:`Deleted "${o.name}".`,color:"green"}),t.onDeleted()}),d(!1)}return e(S,{className:"AssetBrowser__detailsModal",opened:!0,onClose:t.onClose,title:o.name,size:720,overflow:"outside",centered:!0,children:e("div",{className:"AssetBrowser__details",children:[e("div",{className:"AssetBrowser__details__preview",children:N?e("img",{src:Te(n,800),alt:n.alt||"",style:n.canvasBgColor==="dark"?{background:"#000"}:{}}):R?e("video",{src:n.src,controls:!0,muted:!0,preload:"metadata"}):e("div",{className:"AssetBrowser__details__preview__placeholder",children:[e(he,{size:48,stroke:"1"}),e("div",{children:u})]})}),e(re,{className:"AssetBrowser__details__table",verticalSpacing:"xs",fontSize:"xs",children:e("tbody",{children:[e("tr",{children:[e("td",{children:e("b",{children:"Filename"})}),e("td",{children:u})]}),!!(n.width&&n.height)&&e("tr",{children:[e("td",{children:e("b",{children:"Dimensions"})}),e("td",{children:[n.width,"x",n.height]})]}),o.createdAt&&e("tr",{children:[e("td",{children:e("b",{children:"Uploaded"})}),e("td",{children:[Ce(o.createdAt),o.createdBy&&e(C,{children:[" by ",o.createdBy]})]})]}),o.modifiedAt&&e("tr",{children:[e("td",{children:e("b",{children:"Modified"})}),e("td",{children:[Ce(o.modifiedAt),o.modifiedBy&&e(C,{children:[" by ",o.modifiedBy]})]})]}),e("tr",{children:[e("td",{children:e("b",{children:"URL"})}),e("td",{children:e("div",{className:"AssetBrowser__details__url",children:[e(H,{readOnly:!0,value:n.src||"",size:"xs",radius:"xs",onClick:c=>c.target.select(),styles:{root:{flex:1,minWidth:0}}}),e(Ge,{label:"Copy URL",transition:"pop",children:e(se,{size:"sm",onClick:()=>we(n),children:e(ge,{size:16})})})]})})]})]})}),(N||R)&&e("div",{className:"AssetBrowser__details__alt",children:[q?e("div",{className:"AssetBrowser__details__alt__disabledNote",children:"Alt text is disabled for this asset. Docs that use it hide the alt text input and render no alt text."}):e(C,{children:[e(je,{label:"Alt text",description:"Used as the default alt text when the asset is selected in a doc. Updating it syncs docs that use this asset.",autosize:!0,minRows:1,size:"xs",value:l,disabled:!t.canManage||m,onChange:c=>r(c.currentTarget.value)}),t.canManage&&X&&e(g,{size:"xs",color:"dark",mt:8,loading:m,onClick:()=>K(),children:"Save alt text"})]}),t.canManage&&e(G,{className:"AssetBrowser__details__alt__disableCheckbox",label:"Disable alt text (e.g. decorative images)",size:"xs",mt:8,checked:q,disabled:m,onChange:c=>P(c.currentTarget.checked)})]}),e("div",{className:"AssetBrowser__details__usage",children:[e("div",{className:"AssetBrowser__details__usage__title",children:"Used in"}),w===null?e(te,{color:"gray",size:"sm"}):w.length===0?e("div",{className:"AssetBrowser__details__usage__empty",children:"No docs use this asset."}):e("div",{className:"AssetBrowser__details__usage__list",children:w.map(c=>e("a",{className:"AssetBrowser__details__usage__doc",href:`/cms/content/${c.id}`,target:"_blank",rel:"noreferrer",children:[e("span",{children:c.id}),e(lt,{size:14})]},c.id))})]}),e("div",{className:"AssetBrowser__details__buttons",children:[e(g,{variant:"default",size:"xs",leftIcon:e(pe,{size:14}),onClick:()=>be(n),children:"Download"}),t.canManage&&e(C,{children:[e(g,{variant:"default",size:"xs",leftIcon:e(nt,{size:14}),loading:m,onClick:()=>E(),children:"Replace file"}),e(g,{className:"AssetBrowser__details__buttons__delete",color:"red",variant:"filled",size:"xs",leftIcon:e(W,{size:14}),disabled:m,onClick:()=>v(!0),children:"Delete"})]})]}),f&&e("div",{className:"AssetBrowser__details__confirmReplace",children:[e("div",{children:["The new file has a different type (",e("b",{children:[".",D(u)]})," ","\u2192 ",e("b",{children:[".",D(f.name)]}),"). Replacing will change the asset's file extension and serving URL",Fe(o.name,D(f.name))!==o.name&&e(C,{children:[", and the asset will be renamed to"," ",e("b",{children:Fe(o.name,D(f.name))})]}),". Docs that use this asset will be updated."]}),e("div",{className:"AssetBrowser__details__confirmReplace__buttons",children:[e(g,{variant:"default",size:"xs",onClick:()=>B(null),disabled:m,children:"Cancel"}),e(g,{color:"dark",size:"xs",loading:m,onClick:()=>$(f),children:"Replace"})]})]}),x&&e("div",{className:"AssetBrowser__details__confirmDelete",children:[e("div",{children:["Delete ",e("b",{children:o.name})," from the asset library?",w&&w.length>0&&e(C,{children:[" ","This asset is used in ",w.length," doc(s); those docs keep their copy of the file but will no longer receive updates."]})]}),e("div",{className:"AssetBrowser__details__confirmDelete__buttons",children:[e(g,{variant:"default",size:"xs",onClick:()=>v(!1),disabled:m,children:"Cancel"}),e(g,{color:"red",size:"xs",loading:m,onClick:()=>Z(),children:"Delete"})]})]})]})})}var Mt=100;function Ue(t){let[o,a]=i(t.folder??t.initialFolder??""),l=t.folder??o,[r,m]=i([]),[d,x]=i(!0),[v,f]=i(""),[B,w]=i(!1),[F,n]=i(!1),[u,N]=i(null),[R,X]=i(!1),[q,z]=i(null),[K,E]=i(null),[$,P]=i(null),[Z,c]=i(null),[b,p]=i(null),[y,ae]=i(new Map),{roles:At}=_t(),xt=window.firebase.user.email||"",J=ft(At,xt),Q=v.trim().length>0;function L(s){a(s),f(""),t.onFolderChange&&t.onFolderChange(s)}async function I(s){x(!0),N(null),ae(new Map),await M(async()=>{let _=await Me(s);m(_)}),x(!1)}U(()=>{I(l)},[l]),U(()=>{if(!Q||u!==null)return;let s=!1;return(async()=>{let _=[];await M(async()=>{_=await Ze(l)}),s||N(_)})(),()=>{s=!0}},[Q,u,l]);let Ae=t.mode==="manage"?t.initialAssetId:"";U(()=>{Ae&&M(async()=>{let s=await Qe(Ae);s&&s.type==="file"&&(L(s.parent),p(s))})},[Ae]);let Se=$e(()=>{let s=v.trim().toLowerCase(),_=s?u||[]:r;return t.mode==="pick"&&(_=_.filter(h=>h.type==="folder"||Xe(h.file?.filename||h.name,t.accept))),s&&(_=_.filter(h=>h.name.toLowerCase().includes(s))),_},[r,u,v,t.mode,t.accept]),T=mt(Se,{pageSize:Mt,resetDeps:[l,v]}),j=T.pageItems;async function Ee(s){if(s.length===0||F)return;let _="asset-browser-upload";n(!0),A({id:_,message:`Uploading ${s.length} file(s)...`,loading:!0,autoClose:!1,disallowClose:!0});let h=[],Be=[];for(let ne=0;ne<s.length;ne++){let ie=s[ne];He({id:_,message:`Uploading ${ie.name} (${ne+1} of ${s.length})...`,loading:!0,autoClose:!1,disallowClose:!0});try{let ye=await de(ie),kt=await et({parent:l,file:ye});h.push(kt)}catch(ye){console.error(`failed to upload ${ie.name}:`,ye),Be.push(ie.name)}}Oe(_),n(!1),Be.length>0?A({title:"Upload failed",message:`Failed to upload: ${Be.join(", ")}`,color:"red",autoClose:!1}):A({message:`Uploaded ${h.length} file(s).`,color:"green"}),await I(l),t.mode==="pick"&&h.length===1&&s.length===1&&t.onPickFile&&t.onPickFile(h[0])}function Bt(){let s=document.createElement("input");s.type="file",s.multiple=!0,t.mode==="pick"&&t.accept&&t.accept.length>0&&(s.accept=t.accept.join(",")),s.onchange=()=>{Ee(Array.from(s.files||[]))},s.click(),s.remove()}function yt(s){t.onPickFile&&t.onPickFile(s)}let Y=J,le=t.mode==="manage"&&J,ee=Array.from(y.values()),Pe=ee.filter(s=>s.type==="file"&&!s.file?.altDisabled&&(O(s.file?.filename||s.name)||V(s.file?.filename||s.name))),xe=j.length>0&&j.every(s=>y.has(s.id));function Re(s){ae(_=>{let h=new Map(_);return h.has(s.id)?h.delete(s.id):h.set(s.id,s),h})}function Ct(){ae(s=>{let _=new Map(s);return xe?j.forEach(h=>_.delete(h.id)):j.forEach(h=>_.set(h.id,h)),_})}return e("div",{className:ue("AssetBrowser",t.className,`AssetBrowser--${t.mode}`),children:[e("div",{className:"AssetBrowser__toolbar",children:[e(Ue.Breadcrumbs,{folder:l,onNavigate:L}),e("div",{className:"AssetBrowser__toolbar__actions",children:[e(H,{className:"AssetBrowser__toolbar__filter",placeholder:"Search by name",size:"xs",icon:e(dt,{size:14}),value:v,onChange:s=>f(s.currentTarget.value)}),Y&&t.mode==="manage"&&e(g,{variant:"default",size:"xs",leftIcon:e(it,{size:16}),onClick:()=>X(!0),children:"New folder"}),Y&&e(g,{color:"dark",size:"xs",leftIcon:e(ct,{size:16}),loading:F,onClick:()=>Bt(),children:"Upload"})]})]}),le&&ee.length>0&&e("div",{className:"AssetBrowser__selectionBar",children:[e("div",{className:"AssetBrowser__selectionBar__count",children:[ee.length," selected"]}),e("div",{className:"AssetBrowser__selectionBar__actions",children:[e(g,{variant:"default",size:"xs",leftIcon:e(ve,{size:14}),onClick:()=>E(ee),children:"Move"}),Pe.length>0&&e(g,{variant:"default",size:"xs",onClick:()=>c(Pe),children:"Disable alt text"}),e(g,{color:"red",size:"xs",leftIcon:e(W,{size:14}),onClick:()=>P(ee),children:"Delete"}),e(g,{variant:"subtle",color:"gray",size:"xs",onClick:()=>ae(new Map),children:"Clear"})]})]}),e("div",{className:ue("AssetBrowser__listing",B&&"dragging"),onDragOver:s=>{Y&&(s.preventDefault(),w(!0))},onDragLeave:s=>{s.preventDefault(),w(!1)},onDrop:s=>{s.preventDefault(),w(!1),Y&&Ee(Array.from(s.dataTransfer?.files||[]))},children:d||Q&&u===null?e("div",{className:"AssetBrowser__loading",children:e(te,{color:"gray",size:"lg"})}):Se.length===0?e("div",{className:"AssetBrowser__empty","data-testid":"asset-browser-empty",children:v?e("div",{children:['No assets match "',v,'" in this folder or its subfolders.']}):e(C,{children:[e("div",{children:"This folder is empty."}),Y&&e("div",{className:"AssetBrowser__empty__hint",children:'Drop files here or click "Upload" to add assets.'})]})}):e(re,{className:"AssetBrowser__table",verticalSpacing:"xs",fontSize:"xs",highlightOnHover:!0,children:[e("thead",{children:e("tr",{children:[le&&e("th",{className:"AssetBrowser__table__checkboxCol",children:e(G,{size:"xs","aria-label":"Select all",checked:xe,indeterminate:!xe&&j.some(s=>y.has(s.id)),onChange:()=>Ct()})}),e("th",{children:"name"}),e("th",{className:"AssetBrowser__table__modifiedCol",children:"modified"}),e("th",{className:"AssetBrowser__table__actionsCol"})]})}),e("tbody",{children:j.map(s=>s.type==="folder"?e("tr",{className:"AssetBrowser__row AssetBrowser__row--folder",onClick:()=>L(oe(s.parent,s.name)),children:[le&&e("td",{className:"AssetBrowser__checkboxCell",onClick:_=>_.stopPropagation(),children:e(G,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>Re(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e("div",{className:"AssetBrowser__thumb",children:e(ze,{size:24,stroke:"1.5"})}),e("div",{className:"AssetBrowser__nameCell__text",children:[e("div",{className:"AssetBrowser__nameCell__name",children:s.name}),e(wt,{asset:s,folder:l,searching:Q,onNavigate:L})]})]})}),e("td",{children:e(bt,{asset:s})}),e("td",{onClick:_=>_.stopPropagation(),children:e("div",{className:"AssetBrowser__actionsCell",children:t.mode==="manage"&&J&&e(k,{shadow:"sm",position:"bottom",placement:"end",control:e(se,{size:"sm",children:e(De,{size:16})}),children:[e(k.Item,{icon:e(Ie,{size:14}),onClick:()=>z(s),children:"Rename"}),e(k.Item,{icon:e(ve,{size:14}),onClick:()=>E([s]),children:"Move"}),e(k.Item,{color:"red",icon:e(W,{size:14}),onClick:()=>P([s]),children:"Delete"})]})})})]},s.id):e("tr",{className:"AssetBrowser__row AssetBrowser__row--file",onClick:()=>{t.mode==="pick"?yt(s):p(s)},children:[le&&e("td",{className:"AssetBrowser__checkboxCell",onClick:_=>_.stopPropagation(),children:e(G,{size:"xs","aria-label":`Select ${s.name}`,checked:y.has(s.id),onChange:()=>Re(s)})}),e("td",{children:e("div",{className:"AssetBrowser__nameCell",children:[e(ht,{file:s.file,size:36}),e("div",{className:"AssetBrowser__nameCell__text",children:[e("div",{className:"AssetBrowser__nameCell__name",children:[s.name,!!(s.file?.width&&s.file?.height)&&e("span",{className:"AssetBrowser__nameCell__dimens",children:[" ","(",s.file.width,"x",s.file.height,")"]})]}),e(wt,{asset:s,folder:l,searching:Q,onNavigate:L})]})]})}),e("td",{children:e(bt,{asset:s})}),e("td",{onClick:_=>_.stopPropagation(),children:e("div",{className:"AssetBrowser__actionsCell",children:t.mode!=="pick"&&e(Ft,{asset:s,canManage:J,onDetails:()=>p(s),onRename:()=>z(s),onMove:()=>E([s]),onDelete:()=>P([s])})})})]},s.id))})]})}),T.totalPages>1&&e("div",{className:"AssetBrowser__footer",children:[e(gt,{start:T.start,end:T.end,total:T.totalItems,noun:"asset"}),e(ut,{total:T.totalPages,page:T.page,onChange:T.setPage})]}),e(Nt,{opened:R,parent:l,onClose:()=>X(!1),onCreated:s=>{X(!1),L(oe(l,s))}}),q&&e(Dt,{asset:q,onClose:()=>z(null),onRenamed:()=>{z(null),I(l)}}),K&&K.length>0&&e(zt,{assets:K,onClose:()=>E(null),onMoved:()=>{E(null),I(l)}}),$&&$.length>0&&e(Tt,{assets:$,onClose:()=>P(null),onDeleted:()=>{P(null),I(l)}}),Z&&Z.length>0&&e(Ut,{assets:Z,onClose:()=>c(null),onDone:()=>{c(null),I(l)}}),b&&e(vt,{asset:b,canManage:J,onClose:()=>p(null),onChanged:()=>I(l),onDeleted:()=>{p(null),I(l)}})]})}Ue.Breadcrumbs=t=>{let o=Ke(t.folder),a=[{label:"Assets",path:""}];return o.forEach((l,r)=>{a.push({label:l,path:o.slice(0,r+1).join("/")})}),e("div",{className:"AssetBrowser__breadcrumbs",children:a.map((l,r)=>e("div",{className:"AssetBrowser__breadcrumbs__crumb",children:[r>0&&e(Ne,{className:"AssetBrowser__breadcrumbs__divider",size:14}),e("button",{className:ue("AssetBrowser__breadcrumbs__link",r===a.length-1&&"active"),disabled:r===a.length-1,onClick:()=>t.onNavigate(l.path),children:l.label})]},l.path))})};function Ft(t){let o=t.asset;return e(k,{shadow:"sm",position:"bottom",placement:"end",control:e(se,{size:"sm",children:e(De,{size:16})}),children:[e(k.Item,{icon:e(rt,{size:14}),onClick:t.onDetails,children:"Details"}),e(k.Item,{icon:e(ge,{size:14}),onClick:()=>we(o.file),children:"Copy URL"}),e(k.Item,{icon:e(pe,{size:14}),onClick:()=>be(o.file),children:"Download"}),t.canManage&&e(C,{children:[e(k.Item,{icon:e(Ie,{size:14}),onClick:t.onRename,children:"Rename"}),e(k.Item,{icon:e(ve,{size:14}),onClick:t.onMove,children:"Move"}),e(k.Item,{color:"red",icon:e(W,{size:14}),onClick:t.onDelete,children:"Delete"})]})]})}function wt(t){let o=t.asset;return!t.searching||o.parent===t.folder?null:e("button",{className:"AssetBrowser__nameCell__path",title:"Go to folder",onClick:a=>{a.stopPropagation(),t.onNavigate(o.parent)},children:["in ",Je(o.parent,t.folder)]})}function bt(t){let o=t.asset.modifiedAt||t.asset.createdAt,a=t.asset.modifiedBy||t.asset.createdBy||"",l=o&&typeof o.toMillis=="function"?o.toMillis():0;return e("div",{className:"AssetBrowser__modifiedCell",children:[a&&e(pt,{email:a,size:20}),e("span",{children:l?Ve(l):"\u2014"})]})}function Nt(t){let[o,a]=i(""),[l,r]=i(!1);async function m(){r(!0),await M(async()=>{let d=await Ye(t.parent,o);a(""),t.onCreated(d.name)}),r(!1)}return e(S,{opened:t.opened,onClose:t.onClose,title:"New folder",size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),m()},children:[e(H,{"data-autofocus":!0,placeholder:"Folder name",value:o,onChange:d=>a(d.currentTarget.value)}),e(g,{type:"submit",color:"dark",loading:l,disabled:!o,children:"Create"})]})})}function Dt(t){let[o,a]=i(t.asset.name),[l,r]=i(!1);async function m(){r(!0),await M(async()=>{await tt(t.asset,o),t.onRenamed()}),r(!1)}return e(S,{opened:!0,onClose:t.onClose,title:`Rename ${t.asset.type}`,size:"sm",centered:!0,children:e("form",{className:"AssetBrowser__modalForm",onSubmit:d=>{d.preventDefault(),m()},children:[e(H,{"data-autofocus":!0,value:o,onChange:d=>a(d.currentTarget.value)}),e(g,{type:"submit",color:"dark",loading:l,disabled:!o,children:"Rename"})]})})}function zt(t){let o=t.assets,[a,l]=i(o[0]?.parent||""),[r,m]=i([]),[d,x]=i(!0),[v,f]=i(!1);U(()=>{x(!0),M(async()=>{let n=await Me(a);m(n.filter(u=>u.type==="folder"))}).then(()=>x(!1))},[a]);let B=o.filter(n=>n.type==="folder").map(n=>oe(n.parent,n.name));function w(n){return B.some(u=>n===u||n.startsWith(`${u}/`))}async function F(){f(!0);let n=[],u=0;for(let N of o)try{await st(N,a),u+=1}catch(R){console.error(`failed to move ${N.name}:`,R),n.push(N.name)}f(!1),n.length>0&&A({title:"Move failed",message:`Failed to move: ${n.join(", ")}`,color:"red",autoClose:!1}),u>0&&A({message:o.length===1?`Moved "${o[0].name}" to ${a||"Assets"}.`:`Moved ${u} item(s) to ${a||"Assets"}.`,color:"green"}),t.onMoved()}return e(S,{opened:!0,onClose:t.onClose,title:o.length===1?`Move "${o[0].name}"`:`Move ${o.length} items`,size:"md",centered:!0,children:e("div",{className:"AssetBrowser__moveModal",children:[e(Ue.Breadcrumbs,{folder:a,onNavigate:l}),e("div",{className:"AssetBrowser__moveModal__folders",children:d?e(te,{color:"gray",size:"sm"}):r.length===0?e("div",{className:"AssetBrowser__moveModal__empty",children:"No subfolders."}):r.map(n=>{let u=oe(n.parent,n.name);return e("button",{className:"AssetBrowser__moveModal__folder",disabled:w(u),onClick:()=>l(u),children:[e(ze,{size:16,stroke:"1.5"}),e("span",{children:n.name}),e(Ne,{size:14})]},n.id)})}),e(g,{color:"dark",fullWidth:!0,loading:v,disabled:o.every(n=>n.parent===a),onClick:()=>F(),children:"Move here"})]})})}var It=20;function Tt(t){let o=t.assets,[a,l]=i(!1),[r,m]=i(null),d=o.filter(f=>f.type==="file"),x=o.some(f=>f.type==="folder");U(()=>{d.length===0||d.length>It||Promise.all(d.map(f=>_e(f.id))).then(f=>{let B=new Set(f.flat().map(w=>w.id));m(B.size)}).catch(()=>m(null))},[o.map(f=>f.id).join(",")]);async function v(){l(!0);let f=[],B=0;for(let w of o)try{await ce(w),B+=1}catch(F){console.error(`failed to delete ${w.name}:`,F),f.push(w.name)}l(!1),f.length>0&&A({title:"Delete failed",message:`Failed to delete: ${f.join(", ")}. Note that folders must be empty before they can be deleted.`,color:"red",autoClose:!1}),B>0&&A({message:o.length===1?`Deleted "${o[0].name}".`:`Deleted ${B} item(s).`,color:"green"}),t.onDeleted()}return e(S,{opened:!0,onClose:t.onClose,title:o.length===1?`Delete ${o[0].type}?`:`Delete ${o.length} items?`,size:"sm",centered:!0,children:e("div",{className:"AssetBrowser__deleteModal",children:[e("div",{className:"AssetBrowser__deleteModal__text",children:["Are you sure you want to delete"," ",o.length===1?e("b",{children:o[0].name}):e("b",{children:[o.length," items"]})," ","from the asset manager?",d.length>0&&e(C,{children:[" ","The underlying files are not deleted from GCS, and docs that currently use the assets keep their copy of the files."]}),x&&e(C,{children:" Folders must be empty before they can be deleted."})]}),r!==null&&r>0&&e("div",{className:"AssetBrowser__deleteModal__warning",children:[o.length===1?"This asset is":"These assets are"," ","currently used in ",r," doc(s). Those docs will no longer receive updates when the asset changes."]}),e("div",{className:"AssetBrowser__deleteModal__buttons",children:[e(g,{variant:"default",onClick:t.onClose,disabled:a,children:"Cancel"}),e(g,{color:"red",loading:a,onClick:()=>v(),children:"Delete"})]})]})})}function Ut(t){let o=t.assets,[a,l]=i(!1);async function r(){l(!0);let m=[],d=0;for(let x of o)try{let v=x.file,f=await me(x,!0);await fe(f,{previousFile:v}),d+=1}catch(v){console.error(`failed to disable alt text for ${x.name}:`,v),m.push(x.name)}l(!1),m.length>0&&A({title:"Failed to disable alt text",message:`Failed to update: ${m.join(", ")}`,color:"red",autoClose:!1}),d>0&&A({message:`Disabled alt text for ${d} file(s).`,color:"green"}),t.onDone()}return e(S,{opened:!0,onClose:t.onClose,title:"Disable alt text?",size:"sm",centered:!0,children:e("div",{className:"AssetBrowser__deleteModal",children:[e("div",{className:"AssetBrowser__deleteModal__text",children:["Disable alt text for ",e("b",{children:[o.length," file(s)"]}),"? The alt text input is hidden in docs that use these assets and their embedded alt text is cleared. Alt text can be re-enabled per asset from its details."]}),e("div",{className:"AssetBrowser__deleteModal__buttons",children:[e(g,{variant:"default",onClick:t.onClose,disabled:a,children:"Cancel"}),e(g,{color:"dark",loading:a,onClick:()=>r(),children:"Disable alt text"})]})]})})}export{Ue as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as z}from"./chunk-D3UIZHRK.js";import{c as T}from"./chunk-JDW4UORS.js";import{C as _}from"./chunk-AGFPVTBA.js";import{f as l}from"./chunk-KRNQ6L35.js";import{a as f,b as w,c as s,g as b,i as k,n as v,o as j,q as u,t as R,u as c,v as y,x as I}from"./chunk-VD6G5NV4.js";var O=["agile","airy","alert","amber","amused","ancient","aqua","arctic","astral","autumn","avid","azure","balmy","beige","big","bitter","black","blazing","blissful","blooming","blue","bold","bouncy","brainy","brave","breezy","bright","brisk","broad","bronze","brown","bubbly","busy","calm","candid","careful","caring","charming","cheerful","cherry","chilly","chipper","classic","clean","clear","clever","cloudy","coastal","cobalt","cold","cool","copper","coral","cosmic","cosy","cozy","crafty","creamy","crimson","crisp","cuddly","curious","dandy","dapper","daring","dark","dawn","dazzling","dear","deep","deft","delicate","dewy","dizzy","dotted","dreamy","driven","dry","dusky","dusty","eager","early","earnest","earthy","eastern","easy","ebony","elated","electric","elegant","emerald","empty","epic","even","every","faint","fair","falling","famous","fancy","fast","feisty","festive","fierce","fiery","fine","firm","flat","floral","flowing","fluffy","foggy","fond","forest","fragrant","fresh","friendly","frisky","frosty","funky","funny","fuzzy","gallant","gentle","giant","gilded","glad","gleaming","glossy","glowing","gold","golden","good","graceful","grand","grassy","gray","green","groovy","gusty","handy","happy","hardy","hazy","hearty","heavy","helpful","heroic","hidden","high","holy","honest","honeyed","hopeful","humble","humming","hushed","icy","ideal","idle","indigo","inky","iron","ivory","jade","jaunty","jazzy","jolly","jovial","joyful","jubilant","juicy","jumpy","keen","kind","kindly","lacy","late","lazy","leafy","lemon","light","limber","lime","linen","little","lively","lone","long","loud","lovely","loyal","lucid","lucky","luminous","lunar","lush","magenta","magic","majestic","mango","marble","maritime","maroon","massive","mauve","mellow","merry","mighty","mild","milky","mindful","minty","misty","mocha","modest","morning","mossy","muddy","mysterious","mythic","narrow","navy","neat","neon","new","nimble","noble","noisy","noon","northern","nosy","nutty","oaken","oceanic","odd","old","olive","onyx","opal","open","orange","orderly","pale","pastel","patient","peaceful","peach","peachy","pearly","pebbly","peppy","perky","pink","placid","plain","playful","pleasant","plucky","plum","plush","polar","polite","prime","pristine","proud","pure","purple","quaint","quick","quiet","quirky","radiant","rapid","rare","raven","ready","red","regal","restless","rich","rolling","rosy","rough","round","royal","ruby","rugged","rumbling","russet","rustic","sable","safe","sage","salty","sandy","sapphire","savvy","scarlet","scenic","secret","sepia","serene","shaggy","sharp","shimmering","shiny","short","shrewd","shy","silent","silky","silly","silver","simple","sleek","sleepy","slim","slow","small","smart","smoky","smooth","snappy","snowy","soaring","soft","solar","solid","southern","sparkly","speedy","spicy","spiffy","spotted","spry","square","starry","steady","steel","stellar","sticky","still","stony","stormy","striped","strong","sturdy","subtle","sunlit","sunny","super","supreme","swank","sweet","swift","tame","tan","tangy","tart","teal","tender","thin","thirsty","thriving","tidal","tidy","tiny","tireless","toasty","topaz","tough","tranquil","trim","tropical","true","twinkly","umber","upbeat","urban","useful","valiant","vast","velvet","verdant","vernal","vibrant","vintage","violet","vivid","wandering","warm","watchful","wavy","wee","western","whimsical","whispering","white","wholesome","wild","winding","windy","winter","wintry","wise","witty","wondrous","woody","wool","yellow","young","youthful","zany","zealous","zen","zesty","zippy"],A=["acorn","almond","alpaca","anchor","antler","apple","apricot","arrow","aspen","aurora","autumn","avocado","badger","bagel","bamboo","banana","basil","bay","bayou","beach","bear","bee","beetle","bell","berry","birch","bird","biscuit","bison","blossom","bluff","boat","bobcat","bonfire","book","boot","bottle","boulder","branch","brass","breeze","bridge","brook","broom","brunch","bubble","bucket","bud","buffalo","bug","bunny","burrow","butter","button","cabin","cactus","cake","camel","canary","candle","canyon","cape","caravan","cardinal","carrot","cascade","cashew","castle","cat","cave","cedar","chair","cherry","chestnut","chickpea","chime","cinnamon","citadel","cliff","cloud","clove","clover","cocoa","comet","compass","condor","cookie","coral","cottage","cotton","cove","coyote","crane","crayon","creek","cricket","crocus","crow","crumpet","crystal","cup","cupcake","currant","cypress","daffodil","dahlia","daisy","dawn","deer","delta","desert","dew","diamond","dingo","dock","dogwood","dolphin","donut","dove","dragon","drift","drizzle","drum","duck","dumpling","dune","eagle","echo","eclipse","eel","egg","elder","elephant","elk","ember","ermine","estuary","evergreen","falcon","fawn","feather","fennel","fern","ferret","field","fig","finch","fir","firefly","fish","fjord","flame","flamingo","flask","flax","fleece","flicker","flower","flute","fog","forest","fossil","fountain","fox","frog","frost","galaxy","garden","gazelle","gecko","gem","geyser","ginger","glacier","glade","glen","globe","glow","goat","goose","gorge","gourd","granite","grape","grass","grotto","grove","gull","hammock","harbor","hare","harp","harvest","hat","hawk","haystack","hazel","hearth","heather","hedge","heron","hibiscus","hickory","hill","hollow","honey","horizon","horse","hummingbird","ibis","iceberg","icicle","inlet","iris","island","ivy","jackal","jacket","jade","jaguar","jam","jar","jasmine","jay","jelly","jetty","juniper","kayak","kelp","kestrel","kettle","key","kingfisher","kite","kitten","kiwi","knoll","koala","ladybug","lagoon","lake","lamp","lantern","lark","lava","lavender","leaf","ledge","lemon","lemur","leopard","lichen","lighthouse","lilac","lily","lime","lion","llama","lobster","log","loon","lotus","lynx","lyric","magnet","manatee","mango","mangrove","maple","marble","marigold","marlin","marsh","meadow","melody","melon","mermaid","mesa","meteor","minnow","mint","mirage","mist","mitten","mole","monkey","moon","moose","morel","mosaic","moss","moth","mountain","mouse","muffin","mushroom","mussel","narwhal","nautilus","nectar","needle","nest","nettle","newt","nightingale","nimbus","noodle","north","note","nutmeg","oak","oasis","oats","ocean","ocelot","octopus","olive","onion","opal","orange","orca","orchid","oriole","osprey","otter","owl","oyster","paddle","palm","panda","pansy","panther","papaya","paper","parrot","parsley","partridge","pasture","path","peach","peacock","pear","pebble","pecan","pelican","penguin","peony","pepper","petal","petunia","pheasant","phoenix","pie","pigeon","pine","pineapple","pistachio","planet","plateau","plover","plum","pond","pony","poppy","porpoise","pouch","prairie","pretzel","primrose","puffin","pumpkin","quail","quartz","queen","quill","quince","quokka","rabbit","raccoon","radish","rain","rainbow","rapids","raspberry","raven","redwood","reef","reel","reindeer","rhino","ribbon","ridge","river","road","robin","rock","rooster","rose","rosemary","rowan","rye","saffron","sage","salmon","sand","sapphire","satellite","savanna","scallop","scarf","sea","seagull","seal","seed","sequoia","sesame","shark","shell","shore","shrimp","silk","silo","sky","skylark","sleet","snail","snake","snow","sock","sorbet","spark","sparrow","spider","spire","spoon","spring","sprout","spruce","squirrel","star","starfish","starling","stone","stork","storm","stream","summer","sun","sundial","sunflower","swan","swift","sycamore","tadpole","tamarind","tangerine","tea","teal","tern","terrace","thicket","thistle","thrush","thunder","tide","tiger","timber","toad","toffee","tooth","topaz","tortoise","totem","toucan","tower","tractor","trail","tree","trout","truffle","tugboat","tulip","tundra","turnip","turtle","twig","twilight","umbrella","unicorn","urchin","valley","vanilla","vine","violet","vista","volcano","voyage","vulture","wagon","walnut","walrus","wasp","water","waterfall","wave","whale","wharf","wheat","whisker","wildcat","wildflower","willow","wind","window","winter","wisteria","wolf","wombat","wood","wren","yak","yam","yarrow","yew","yucca","zebra","zephyr","zinnia","zucchini"];var x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",S="YYYYMMDD";function D(e,r){let a=r?.now??new Date,o=r?.random??Math.random,t=e.replace(/\{([^{}]+?)\}/g,(n,d)=>{let[p,g]=q(d);switch(p){case"date":return E(a,g||S);case"adjective":return C(O,o);case"noun":return C(A,o);case"random":return M(Y(g,6),o);default:return n}});return T(t.toLowerCase())}function q(e){let r=e.indexOf(":");return r===-1?[e.trim(),void 0]:[e.slice(0,r).trim(),e.slice(r+1)]}function Y(e,r){if(!e)return r;let a=parseInt(e,10);return Number.isFinite(a)&&a>0?a:r}function C(e,r){return e[Math.floor(r()*e.length)]}function M(e,r){let a=[];for(let o=0;o<e;o++)a.push(x.charAt(Math.floor(r()*x.length)));return a.join("")}function E(e,r){let a={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MM:m(e.getMonth()+1),DD:m(e.getDate()),HH:m(e.getHours()),mm:m(e.getMinutes()),ss:m(e.getSeconds())};return r.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,o=>a[o]??o)}function m(e){return e<10?`0${e}`:String(e)}var i="Releases";async function V(e,r){if(!e)throw new Error("missing data source id");let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await R(o,async n=>{if((await n.get(t)).exists())throw new Error(`release exists: ${e}`);await n.set(t,{...r,id:e,createdAt:y(),createdBy:window.firebase.user.email})}),l("release.create",{metadata:{releaseId:e}})}async function G(){let e=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,a=w(r,"Projects",e,i),o=b(a,k("createdAt","desc")),t=await j(o),n=[];return t.forEach(d=>{n.push(d.data())}),n}async function h(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e),t=await v(o);return t.exists()?t.data():null}async function K(e,r){let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,r),l("release.save",{metadata:{releaseId:e}})}async function Q(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:y(),archivedBy:window.firebase.user.email}),l("release.archive",{metadata:{releaseId:e}})}async function W(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:c(),archivedBy:c()}),l("release.unarchive",{metadata:{releaseId:e}})}async function Z(e){let r=await h(e);if(!r)throw new Error(`release not found: ${e}`);if(r.archivedAt)throw new Error(`release is archived: ${e}`);let a=r.docIds||[],o=r.dataSourceIds||[];if(a.length===0&&o.length===0)throw new Error(`no docs or data sources to publish for release: ${e}`);let t=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db,d=s(n,"Projects",t,i,e),p=I(n);p.update(d,{publishedAt:y(),publishedBy:window.firebase.user.email,scheduledAt:c(),scheduledBy:c()}),o.length>0&&await z(o,{batch:p,commitBatch:!1}),await _(a,{batch:p,releaseId:e,publishMessage:r.description}),console.log(`published release: ${e}`);let g={releaseId:e,docIds:a,dataSourceIds:o};r.description&&(g.publishMessage=r.description),l("release.publish",{metadata:g})}async function ee(e,r){let a=await h(e);if(!a)throw new Error(`release not found: ${e}`);if(a.archivedAt)throw new Error(`release is archived: ${e}`);typeof r=="number"&&(r=f.fromMillis(r));let o=window.__ROOT_CTX.rootConfig.projectId,t=window.firebase.db,n=s(t,"Projects",o,i,e);await u(n,{scheduledAt:r,scheduledBy:window.firebase.user.email}),l("release.publish",{metadata:{releaseId:e,scheduledAt:r.toMillis()}})}function re(){return D("{date}-{adjective}-{noun}")}async function ae(e){if(!await h(e))throw new Error(`release not found: ${e}`);let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,{scheduledAt:c(),scheduledBy:c()}),l("release.unschedule",{metadata:{releaseId:e}})}export{D as a,V as b,G as c,h as d,K as e,Q as f,W as g,Z as h,ee as i,re as j,ae as k};
|
|
1
|
+
import{k as z}from"./chunk-D3UIZHRK.js";import{c as T}from"./chunk-JDW4UORS.js";import{C as _}from"./chunk-Z6DBYLIM.js";import{f as l}from"./chunk-KRNQ6L35.js";import{a as f,b as w,c as s,g as b,i as k,n as v,o as j,q as u,t as R,u as c,v as y,x as I}from"./chunk-VD6G5NV4.js";var O=["agile","airy","alert","amber","amused","ancient","aqua","arctic","astral","autumn","avid","azure","balmy","beige","big","bitter","black","blazing","blissful","blooming","blue","bold","bouncy","brainy","brave","breezy","bright","brisk","broad","bronze","brown","bubbly","busy","calm","candid","careful","caring","charming","cheerful","cherry","chilly","chipper","classic","clean","clear","clever","cloudy","coastal","cobalt","cold","cool","copper","coral","cosmic","cosy","cozy","crafty","creamy","crimson","crisp","cuddly","curious","dandy","dapper","daring","dark","dawn","dazzling","dear","deep","deft","delicate","dewy","dizzy","dotted","dreamy","driven","dry","dusky","dusty","eager","early","earnest","earthy","eastern","easy","ebony","elated","electric","elegant","emerald","empty","epic","even","every","faint","fair","falling","famous","fancy","fast","feisty","festive","fierce","fiery","fine","firm","flat","floral","flowing","fluffy","foggy","fond","forest","fragrant","fresh","friendly","frisky","frosty","funky","funny","fuzzy","gallant","gentle","giant","gilded","glad","gleaming","glossy","glowing","gold","golden","good","graceful","grand","grassy","gray","green","groovy","gusty","handy","happy","hardy","hazy","hearty","heavy","helpful","heroic","hidden","high","holy","honest","honeyed","hopeful","humble","humming","hushed","icy","ideal","idle","indigo","inky","iron","ivory","jade","jaunty","jazzy","jolly","jovial","joyful","jubilant","juicy","jumpy","keen","kind","kindly","lacy","late","lazy","leafy","lemon","light","limber","lime","linen","little","lively","lone","long","loud","lovely","loyal","lucid","lucky","luminous","lunar","lush","magenta","magic","majestic","mango","marble","maritime","maroon","massive","mauve","mellow","merry","mighty","mild","milky","mindful","minty","misty","mocha","modest","morning","mossy","muddy","mysterious","mythic","narrow","navy","neat","neon","new","nimble","noble","noisy","noon","northern","nosy","nutty","oaken","oceanic","odd","old","olive","onyx","opal","open","orange","orderly","pale","pastel","patient","peaceful","peach","peachy","pearly","pebbly","peppy","perky","pink","placid","plain","playful","pleasant","plucky","plum","plush","polar","polite","prime","pristine","proud","pure","purple","quaint","quick","quiet","quirky","radiant","rapid","rare","raven","ready","red","regal","restless","rich","rolling","rosy","rough","round","royal","ruby","rugged","rumbling","russet","rustic","sable","safe","sage","salty","sandy","sapphire","savvy","scarlet","scenic","secret","sepia","serene","shaggy","sharp","shimmering","shiny","short","shrewd","shy","silent","silky","silly","silver","simple","sleek","sleepy","slim","slow","small","smart","smoky","smooth","snappy","snowy","soaring","soft","solar","solid","southern","sparkly","speedy","spicy","spiffy","spotted","spry","square","starry","steady","steel","stellar","sticky","still","stony","stormy","striped","strong","sturdy","subtle","sunlit","sunny","super","supreme","swank","sweet","swift","tame","tan","tangy","tart","teal","tender","thin","thirsty","thriving","tidal","tidy","tiny","tireless","toasty","topaz","tough","tranquil","trim","tropical","true","twinkly","umber","upbeat","urban","useful","valiant","vast","velvet","verdant","vernal","vibrant","vintage","violet","vivid","wandering","warm","watchful","wavy","wee","western","whimsical","whispering","white","wholesome","wild","winding","windy","winter","wintry","wise","witty","wondrous","woody","wool","yellow","young","youthful","zany","zealous","zen","zesty","zippy"],A=["acorn","almond","alpaca","anchor","antler","apple","apricot","arrow","aspen","aurora","autumn","avocado","badger","bagel","bamboo","banana","basil","bay","bayou","beach","bear","bee","beetle","bell","berry","birch","bird","biscuit","bison","blossom","bluff","boat","bobcat","bonfire","book","boot","bottle","boulder","branch","brass","breeze","bridge","brook","broom","brunch","bubble","bucket","bud","buffalo","bug","bunny","burrow","butter","button","cabin","cactus","cake","camel","canary","candle","canyon","cape","caravan","cardinal","carrot","cascade","cashew","castle","cat","cave","cedar","chair","cherry","chestnut","chickpea","chime","cinnamon","citadel","cliff","cloud","clove","clover","cocoa","comet","compass","condor","cookie","coral","cottage","cotton","cove","coyote","crane","crayon","creek","cricket","crocus","crow","crumpet","crystal","cup","cupcake","currant","cypress","daffodil","dahlia","daisy","dawn","deer","delta","desert","dew","diamond","dingo","dock","dogwood","dolphin","donut","dove","dragon","drift","drizzle","drum","duck","dumpling","dune","eagle","echo","eclipse","eel","egg","elder","elephant","elk","ember","ermine","estuary","evergreen","falcon","fawn","feather","fennel","fern","ferret","field","fig","finch","fir","firefly","fish","fjord","flame","flamingo","flask","flax","fleece","flicker","flower","flute","fog","forest","fossil","fountain","fox","frog","frost","galaxy","garden","gazelle","gecko","gem","geyser","ginger","glacier","glade","glen","globe","glow","goat","goose","gorge","gourd","granite","grape","grass","grotto","grove","gull","hammock","harbor","hare","harp","harvest","hat","hawk","haystack","hazel","hearth","heather","hedge","heron","hibiscus","hickory","hill","hollow","honey","horizon","horse","hummingbird","ibis","iceberg","icicle","inlet","iris","island","ivy","jackal","jacket","jade","jaguar","jam","jar","jasmine","jay","jelly","jetty","juniper","kayak","kelp","kestrel","kettle","key","kingfisher","kite","kitten","kiwi","knoll","koala","ladybug","lagoon","lake","lamp","lantern","lark","lava","lavender","leaf","ledge","lemon","lemur","leopard","lichen","lighthouse","lilac","lily","lime","lion","llama","lobster","log","loon","lotus","lynx","lyric","magnet","manatee","mango","mangrove","maple","marble","marigold","marlin","marsh","meadow","melody","melon","mermaid","mesa","meteor","minnow","mint","mirage","mist","mitten","mole","monkey","moon","moose","morel","mosaic","moss","moth","mountain","mouse","muffin","mushroom","mussel","narwhal","nautilus","nectar","needle","nest","nettle","newt","nightingale","nimbus","noodle","north","note","nutmeg","oak","oasis","oats","ocean","ocelot","octopus","olive","onion","opal","orange","orca","orchid","oriole","osprey","otter","owl","oyster","paddle","palm","panda","pansy","panther","papaya","paper","parrot","parsley","partridge","pasture","path","peach","peacock","pear","pebble","pecan","pelican","penguin","peony","pepper","petal","petunia","pheasant","phoenix","pie","pigeon","pine","pineapple","pistachio","planet","plateau","plover","plum","pond","pony","poppy","porpoise","pouch","prairie","pretzel","primrose","puffin","pumpkin","quail","quartz","queen","quill","quince","quokka","rabbit","raccoon","radish","rain","rainbow","rapids","raspberry","raven","redwood","reef","reel","reindeer","rhino","ribbon","ridge","river","road","robin","rock","rooster","rose","rosemary","rowan","rye","saffron","sage","salmon","sand","sapphire","satellite","savanna","scallop","scarf","sea","seagull","seal","seed","sequoia","sesame","shark","shell","shore","shrimp","silk","silo","sky","skylark","sleet","snail","snake","snow","sock","sorbet","spark","sparrow","spider","spire","spoon","spring","sprout","spruce","squirrel","star","starfish","starling","stone","stork","storm","stream","summer","sun","sundial","sunflower","swan","swift","sycamore","tadpole","tamarind","tangerine","tea","teal","tern","terrace","thicket","thistle","thrush","thunder","tide","tiger","timber","toad","toffee","tooth","topaz","tortoise","totem","toucan","tower","tractor","trail","tree","trout","truffle","tugboat","tulip","tundra","turnip","turtle","twig","twilight","umbrella","unicorn","urchin","valley","vanilla","vine","violet","vista","volcano","voyage","vulture","wagon","walnut","walrus","wasp","water","waterfall","wave","whale","wharf","wheat","whisker","wildcat","wildflower","willow","wind","window","winter","wisteria","wolf","wombat","wood","wren","yak","yam","yarrow","yew","yucca","zebra","zephyr","zinnia","zucchini"];var x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",S="YYYYMMDD";function D(e,r){let a=r?.now??new Date,o=r?.random??Math.random,t=e.replace(/\{([^{}]+?)\}/g,(n,d)=>{let[p,g]=q(d);switch(p){case"date":return E(a,g||S);case"adjective":return C(O,o);case"noun":return C(A,o);case"random":return M(Y(g,6),o);default:return n}});return T(t.toLowerCase())}function q(e){let r=e.indexOf(":");return r===-1?[e.trim(),void 0]:[e.slice(0,r).trim(),e.slice(r+1)]}function Y(e,r){if(!e)return r;let a=parseInt(e,10);return Number.isFinite(a)&&a>0?a:r}function C(e,r){return e[Math.floor(r()*e.length)]}function M(e,r){let a=[];for(let o=0;o<e;o++)a.push(x.charAt(Math.floor(r()*x.length)));return a.join("")}function E(e,r){let a={YYYY:String(e.getFullYear()),YY:String(e.getFullYear()).slice(-2),MM:m(e.getMonth()+1),DD:m(e.getDate()),HH:m(e.getHours()),mm:m(e.getMinutes()),ss:m(e.getSeconds())};return r.replace(/YYYY|YY|MM|DD|HH|mm|ss/g,o=>a[o]??o)}function m(e){return e<10?`0${e}`:String(e)}var i="Releases";async function V(e,r){if(!e)throw new Error("missing data source id");let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await R(o,async n=>{if((await n.get(t)).exists())throw new Error(`release exists: ${e}`);await n.set(t,{...r,id:e,createdAt:y(),createdBy:window.firebase.user.email})}),l("release.create",{metadata:{releaseId:e}})}async function G(){let e=window.__ROOT_CTX.rootConfig.projectId,r=window.firebase.db,a=w(r,"Projects",e,i),o=b(a,k("createdAt","desc")),t=await j(o),n=[];return t.forEach(d=>{n.push(d.data())}),n}async function h(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e),t=await v(o);return t.exists()?t.data():null}async function K(e,r){let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,r),l("release.save",{metadata:{releaseId:e}})}async function Q(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:y(),archivedBy:window.firebase.user.email}),l("release.archive",{metadata:{releaseId:e}})}async function W(e){let r=window.__ROOT_CTX.rootConfig.projectId,a=window.firebase.db,o=s(a,"Projects",r,i,e);await u(o,{archivedAt:c(),archivedBy:c()}),l("release.unarchive",{metadata:{releaseId:e}})}async function Z(e){let r=await h(e);if(!r)throw new Error(`release not found: ${e}`);if(r.archivedAt)throw new Error(`release is archived: ${e}`);let a=r.docIds||[],o=r.dataSourceIds||[];if(a.length===0&&o.length===0)throw new Error(`no docs or data sources to publish for release: ${e}`);let t=window.__ROOT_CTX.rootConfig.projectId,n=window.firebase.db,d=s(n,"Projects",t,i,e),p=I(n);p.update(d,{publishedAt:y(),publishedBy:window.firebase.user.email,scheduledAt:c(),scheduledBy:c()}),o.length>0&&await z(o,{batch:p,commitBatch:!1}),await _(a,{batch:p,releaseId:e,publishMessage:r.description}),console.log(`published release: ${e}`);let g={releaseId:e,docIds:a,dataSourceIds:o};r.description&&(g.publishMessage=r.description),l("release.publish",{metadata:g})}async function ee(e,r){let a=await h(e);if(!a)throw new Error(`release not found: ${e}`);if(a.archivedAt)throw new Error(`release is archived: ${e}`);typeof r=="number"&&(r=f.fromMillis(r));let o=window.__ROOT_CTX.rootConfig.projectId,t=window.firebase.db,n=s(t,"Projects",o,i,e);await u(n,{scheduledAt:r,scheduledBy:window.firebase.user.email}),l("release.publish",{metadata:{releaseId:e,scheduledAt:r.toMillis()}})}function re(){return D("{date}-{adjective}-{noun}")}async function ae(e){if(!await h(e))throw new Error(`release not found: ${e}`);let a=window.__ROOT_CTX.rootConfig.projectId,o=window.firebase.db,t=s(o,"Projects",a,i,e);await u(t,{scheduledAt:c(),scheduledBy:c()}),l("release.unschedule",{metadata:{releaseId:e}})}export{D as a,V as b,G as c,h as d,K as e,Q as f,W as g,Z as h,ee as i,re as j,ae as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as z}from"./chunk-2EPQJUGM.js";import{c as C}from"./chunk-NJMNOITA.js";import{f as h}from"./chunk-5MV6XVGA.js";import{U as b,Y as A,Z as I}from"./chunk-
|
|
1
|
+
import{a as z}from"./chunk-2EPQJUGM.js";import{c as C}from"./chunk-NJMNOITA.js";import{f as h}from"./chunk-5MV6XVGA.js";import{U as b,Y as A,Z as I}from"./chunk-Z6DBYLIM.js";import{a as x}from"./chunk-BW2MKGNP.js";import{a as P}from"./chunk-AAHM6RYJ.js";import{e as D}from"./chunk-BUNR5EU3.js";import{Ga as e,Gc as N,U as y,V as u,Zc as k,a as t,c as v,da as S,e as w,j as V}from"./chunk-LROR6N3B.js";import{d as g}from"./chunk-KUCVLANF.js";V();V();function R(o){let r=o.docId,[i,d]=t("idle"),[c,f]=t(""),[s,l]=t(""),m=w(!1);async function p(){d("loading");try{let n=await I(r,{beforeVersion:o.beforeVersion,afterVersion:o.afterVersion});f(n),d("success")}catch(n){console.error(n),l(n instanceof Error?n.message:"Unknown error"),d("error")}}function _(){m.current||(m.current=!0,p())}let a;return i==="idle"||i==="loading"?a=e("div",{className:"AiSummary__loading",children:e(u,{size:"md",color:"gray"})}):i==="error"?a=e(x,{className:"AiSummary__content",size:"body-sm",color:"gray",children:["Failed to load AI summary.",s&&e(g,{children:[e("br",{}),s]})]}):c?a=e(C,{className:"AiSummary__content",code:c}):a=e(x,{className:"AiSummary__content",size:"body-sm",color:"gray",children:"No AI summary available for this draft yet."}),e("div",{className:D(o.className,"AiSummary"),children:e(y,{iconPosition:"right",onChange:()=>_(),disableIconRotation:!0,children:e(y.Item,{label:"Summarize changes",icon:e(N,{stroke:"1.5"}),iconPosition:"left",children:a})})})}function me(o){let r=o.left,i=o.right,[d,c]=t(!1),[f,s]=t(null),[l,m]=t(null),p=P()&&r.docId===i.docId&&o.showAiSummary!==!1,_=h(E(f?.fields||{})),a=h(E(l?.fields||{})),n=!d&&f&&l&&_===a,M=`/cms/compare?left=${F(r)}&right=${F(i)}`;async function $(){c(!0);let[j,T]=await Promise.all([b(r.docId,r.versionId),b(i.docId,i.versionId)]);s(j),m(T),c(!1)}return v(()=>{$()},[]),d?e("div",{className:"DocDiffViewer DocDiffViewer--loading",children:e(u,{size:"md",color:"gray"})}):e(g,{children:[p&&e(R,{className:"DocDiffViewer__aiSummary",docId:r.docId,beforeVersion:String(r.versionId),afterVersion:String(i.versionId)}),e("div",{className:D(o.className,"DocDiffViewer"),children:[o.showExpandButton&&e("div",{className:"DocDiffViewer__expand",children:e(S,{component:"a",variant:"default",size:"xs",compact:!0,href:M,target:"_blank",children:"Open in new tab"})}),e("div",{className:"DocDiffViewer__header",children:[e("div",{className:"DocDiffViewer__header__label",children:[e("div",{className:"DocDiffViewer__header__label__title",children:[o.left.docId,"@",o.left.versionId]}),e("div",{className:"DocDiffViewer__header__label__meta",children:B(f)})]}),e("div",{className:"DocDiffViewer__header__label",children:[e("div",{className:"DocDiffViewer__header__label__title",children:[o.right.docId,"@",o.right.versionId]}),e("div",{className:"DocDiffViewer__header__label__meta",children:B(l)})]})]}),e("div",{className:"DocDiffViewer__diff",children:n?e("div",{className:"DocDiffViewer__identical",children:[e(k,{size:20}),e("span",{children:"No changes. Both versions are identical."})]}):e(z,{oldCode:_,newCode:a})})]})]})}function B(o){if(!o?.sys?.modifiedAt)return"never";let r=o.sys.modifiedAt.toDate();return`${new Intl.DateTimeFormat("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(r)} by ${o.sys.modifiedBy}`}function E(o){return A(o,{removeArrayKey:!0})}function F(o){return encodeURIComponent(`${o.docId}@${o.versionId}`).replaceAll("%2F","/").replaceAll("%40","@")}export{R as a,me as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as le}from"./chunk-JTIQBW33.js";import{a as oe}from"./chunk-
|
|
1
|
+
import{b as le}from"./chunk-JTIQBW33.js";import{a as oe}from"./chunk-IOR72US3.js";import{a as ee,b as R,c as T}from"./chunk-JDW4UORS.js";import{a as ie}from"./chunk-YDO2EDVY.js";import{a as M}from"./chunk-5MV6XVGA.js";import{P as re,c as ne}from"./chunk-Z6DBYLIM.js";import{b as te}from"./chunk-J5E457OI.js";import{a as $}from"./chunk-QHJOTXYB.js";import{a as j}from"./chunk-BW2MKGNP.js";import{b as K,f as U,g as _,i as y,o as Y}from"./chunk-VD6G5NV4.js";import{d as Z,e as se}from"./chunk-BUNR5EU3.js";import{A as G,Ga as f,a as p,c as w,da as P,e as v,g as B,h as I,i as W,j as O,ra as Q,ua as q,za as J}from"./chunk-LROR6N3B.js";import{j as X,k as Se}from"./chunk-KUCVLANF.js";function z(e){let t=window.__ROOT_CTX.collections[e.collectionId];if(!t)throw new Error(`collection not found: ${e.collectionId}`);if(!t.url)return"";let n=t.domain||window.__ROOT_CTX.rootConfig.domain||"https://example.com",r=Ee(e);return`${n}${r}`}function Ee(e){let o=window.__ROOT_CTX.collections,{collectionId:t,slug:n,locale:r}=e,s=o[t];if(!s)throw new Error(`collection not found: ${t}`);if(!s.url)return"";let l=window.__ROOT_CTX.rootConfig,g=l.base||"/",u="/[base]/[path]";r&&(u=l.i18n.urlFormat||"/[locale]/[base]/[path]");let d="",a=s?.url;if(a)if(n){let c=a.replace(/\[.*slug\]/,n).replaceAll("--","/").replace(/\/+/g,"/");c==="/index"&&(c="/"),d=c}else d=a;return ce(u,{base:g,path:d,locale:r||"",slug:n})}function ye(e){let o=window.__ROOT_CTX.collections,{collectionId:t,slug:n,locale:r}=e,s=o[t];if(!s)throw new Error(`collection not found: ${t}`);let l=window.__ROOT_CTX.rootConfig,g=l.base||"/",u="/[base]/[path]";r&&(u=l.i18n.urlFormat||"/[locale]/[base]/[path]");let d="",a=s?.previewUrl||s?.url;if(a)if(n){let c=a.replace(/\[.*slug\]/,n).replaceAll("--","/").replace(/\/+/g,"/");c==="/index"&&(c="/"),d=c}else d=a;return ce(u,{base:g,path:d,locale:r||"",slug:n})}function ce(e,o){let t=e.replaceAll(/\[\[?(\.\.\.)?([\w\-_]*)\]?\]/g,(n,r,s)=>o[s]??n);return Ce(t,{trailingSlash:window.__ROOT_CTX.rootConfig.server.trailingSlash})}function Ce(e,o){return e=e.replace(/\/+/g,"/"),o?.trailingSlash===!1&&e!=="/"&&e.endsWith("/")&&(e=e.replace(/\/*$/g,"")),(e.endsWith("/index")||e.endsWith("/index/"))&&(e=e.slice(0,-6)),e.startsWith("/")||(e=`/${e}`),o?.trailingSlash&&!e.endsWith("/")&&(e=`${e}/`),e}O();function Re(e,o){let[t,n]=p([]),[r,s]=p(!0),g=le().db,u=window.__ROOT_CTX.rootConfig.projectId||"default",d=o.includeArchived??!1,a=async()=>{s(!0);let c=K(g,"Projects",u,"Collections",e,"Drafts"),i=c,m=o.orderBy;if(m==="modifiedAt")i=_(c,y("sys.modifiedAt","desc"));else if(m==="newest")i=_(c,y("sys.createdAt","desc"));else if(m==="oldest")i=_(c,y("sys.createdAt"));else if(m==="slug")i=_(c,y(U()));else if(m==="slugDesc")i=_(c,y(U(),"desc"));else{let S=window.__ROOT_CTX.collections[e]?.sortOptions?.find(C=>C.id===m);S&&(i=S.direction==="desc"?_(c,y(S.field,"desc")):_(c,y(S.field)))}await te(async()=>{let h=await Y(i),S=[];h.docs.forEach(C=>{let k=C.data(),E=C.id,b=`${e}/${E}`,x={...k,id:b,slug:E};ne(b,x),!(!d&&x?.sys?.archivedAt)&&S.push(x)}),n(S)}),s(!1)};return w(()=>{s(!0),a()},[e,o.orderBy,d]),[r,a,t]}Se();O();var D={CONNECTED:"connected",SCHEMA_CHANGED:"schemaChanged"};function ae(e){let t=new URLSearchParams(window.location.search).get("e");return t?t.split(",").includes(e):!1}var ve="/cms/api/sse.connect",L=ae("EnableVerboseLogging"),ue=window.location.hostname==="localhost",F=class{constructor(){this.map=new Map}on(o,t){return this.map.has(o)||this.map.set(o,new Set),this.map.get(o).add(t),()=>{this.map.get(o)?.delete(t)}}emit(o,t,n){this.map.get(o)?.forEach(r=>r(t,n)),this.map.get("*")?.forEach(r=>r({type:o,data:t},n))}},fe=X(null);function Fe(e){let t=v(new F).current,n=v(null),r=v(!1),s=v({attempt:0,timer:0}),l=v(""),g=()=>{n.current&&(n.current.close(),n.current=null)},u=I(()=>{L&&console.log("[sse] connecting..."),g();let a=new EventSource(ve);n.current=a,a.addEventListener(D.CONNECTED,i=>{if(L&&console.log("[sse] connected"),r.current=!1,s.current.attempt=0,ue){let h=de(i.data)?.serverVersion||"";l.current?l.current!==h&&(console.log(`server version changed: ${l.current} -> ${h}`),console.log("reloading..."),window.location.reload()):l.current=h}});let c=i=>{if(!i||!i.type)return;let m=de(i.data);L&&console.log("[sse] event:",i.type,m),t.emit(i.type,m,i)};Object.values(D).forEach(i=>{a.addEventListener(i,c)}),a.addEventListener("error",()=>{L&&console.log("[sse] disconnected"),a.readyState===EventSource.CLOSED&&!r.current&&(r.current=!0,(()=>{let m=++s.current.attempt,h=Math.min(3e4,Math.pow(2,m)*500),S=Math.random()*.3*h,C=h+S;window.clearTimeout(s.current.timer),s.current.timer=window.setTimeout(()=>{r.current=!1,u()},C)})())})},[t]);w(()=>{if(!ue)return;u();let a=()=>{document.visibilityState==="visible"&&n.current?.readyState!==EventSource.OPEN&&u()};return document.addEventListener("visibilitychange",a),()=>{document.removeEventListener("visibilitychange",a),window.clearTimeout(s.current.timer),g()}},[u]);let d=B(()=>({emitter:t}),[t]);return f(fe.Provider,{value:d,children:e.children})}function de(e){try{return JSON.parse(e)}catch{return e}}function ge(e,o){let t=W(fe);if(!t)throw new Error("useSSE() must be used within an <SSEProvider>");let n=v(o);w(()=>{n.current=o},[o]),w(()=>t.emitter.on(e,(r,s)=>n.current(r,s)),[t,e])}O();O();function me(e){let[o,t]=p(!0),[n,r]=p(null),s=I(async()=>{try{let l=await ie(e);r(l)}catch(l){console.error(l),$({title:`Failed to load collection: ${e}`,message:String(l),color:"red",autoClose:!1})}t(!1)},[e]);return w(()=>{s()},[e]),ge(D.SCHEMA_CHANGED,async l=>{await s();let g=l.file?`Applied updates from changes to ${l.file}.`:"Applied updates from changes to a .schema.ts file.";$({title:"Updated schema!",message:g})}),{loading:o,schema:n}}function H(e){let o={_array:[]};return e.forEach(t=>{let n=we();o._array.push(n),o[n]=t}),o}function we(){let e=[],o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=o.length;for(let n=0;n<6;n++)e.push(o.charAt(Math.floor(Math.random()*t)));return e.join("")}function V(e){let o={};return e.fields.forEach(t=>{t.id&&(t.type==="array"&&t.default&&Array.isArray(t.default)?o[t.id]=H(t.default):t.default?o[t.id]=t.default:t.type==="object"&&(o[t.id]=V(t)))}),o}function A(e,o,t){let n={...o};return e.fields.forEach(r=>{if(!r.id)return;let s=n[r.id];if(s!=null){if(r.type==="array"&&Array.isArray(s)){let l=s.map(g=>_e(r.of,g,t));n[r.id]=H(l)}else if(r.type==="object"&&M(s))n[r.id]=A(r,s,t);else if(r.type==="oneof"&&M(s)&&typeof s._type=="string"&&t){let l=t[s._type];l&&(n[r.id]=A(l,s,t))}}}),n}function _e(e,o,t){if(!M(o))return o;if(e.type==="object")return A(e,o,t);if(e.type==="oneof"&&typeof o._type=="string"&&t){let n=t[o._type];if(n)return A(n,o,t)}return o}O();function pe(e){let[o,t]=p(e.collectionId||""),n=v(null),[r,s]=p(e.initialSlug||""),l=window.__ROOT_CTX.collections[o],g=[];e.collectionId&&e.collectionDisabled?g.push({value:e.collectionId,label:e.collectionId}):Object.keys(window.__ROOT_CTX.collections).forEach(i=>{g.push({value:i,label:i})});let u="",d="";if(l?.url){if(r){let i=T(r),m=l?.slugRegex;ee(i,m)?u=z({collectionId:o,slug:i}):d=R(i,m)}else u=z({collectionId:o,slug:"[slug]"});u.endsWith("/index")&&(u=u.replace(/\/index$/,"/"))}function a(i){t(i),e.onChange&&e.onChange({collectionId:i,slug:r})}function c(i){s(i),e.onChange&&e.onChange({collectionId:o,slug:i})}return f("div",{className:se(e.className,"SlugInput"),children:[f("div",{className:"SlugInput__inputs",children:[f(J,{className:"SlugInput__collection",placeholder:"Collection",size:"xs",data:g,onChange:i=>a(i),value:o,disabled:!!e.collectionDisabled}),f("div",{className:"SlugInput__divider",children:"/"}),f(q,{className:"SlugInput__slug",name:"slug",ref:n,value:r,onChange:i=>{c(i.currentTarget.value)},placeholder:"slug",autoComplete:"off",size:"xs"})]}),u&&f(j,{className:"SlugInput__urlHelp",size:"body-sm",children:u}),d&&f(j,{className:"SlugInput__slugError",size:"body-sm",children:d})]})}function bt(e){let{route:o}=Z(),t=G(),n=e.collection,r=window.__ROOT_CTX.collections[n];if(!r)throw new Error(`collection not found: ${n}`);let[s]=p(()=>r.autoSlug?oe(r.autoSlug):""),[l,g]=p(s),[u,d]=p(!1),[a,c]=p(()=>S(s)),[i,m]=p(""),h=me(n);function S(E){let b=T(E);return b?R(b,r.slugRegex):""}function C(){e.onClose&&e.onClose()}async function k(E){if(E.preventDefault(),d(!0),c(""),S(l)){d(!1);return}let x=T(l),he=`${n}/${x}`;try{let N={};!h.loading&&h.schema&&(N=await V(h.schema)),await re(he,{fields:N})}catch(N){m(String(N)),d(!1);return}d(!1),e.skipNavigation?C():o(`/cms/content/${e.collection}/${x}`)}return f(Q,{className:"NewDocModal",opened:e.opened||!1,onClose:()=>C(),title:"New",size:"500px",overlayColor:t.colorScheme==="dark"?t.colors.dark[9]:t.colors.gray[2],children:[f("div",{className:"NewDocModal__body",children:"Enter a slug for the new doc. The slug is the ID of the page and is what's used in the URL. Use only lowercase letters, numbers, and dashes."}),f("form",{onSubmit:E=>k(E),children:[f(pe,{className:"NewDocModal__slug",collectionId:n,initialSlug:s,onChange:E=>{g(E.slug),c(S(E.slug)),m("")}}),i&&f("div",{className:"NewDocModal__slugError",children:i}),f("div",{className:"NewDocModal__buttons",children:[f(P,{variant:"outline",onClick:()=>C(),type:"button",size:"xs",color:"dark",children:"Cancel"}),f(P,{variant:"filled",type:"submit",size:"xs",color:"dark",loading:h.loading||u,disabled:!!a||!!i,children:"Submit"})]})]})]})}export{z as a,Ee as b,ye as c,pe as d,Re as e,Fe as f,me as g,V as h,A as i,bt as j};
|