@obelism/content 0.27.1 → 0.27.2

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/README.md CHANGED
@@ -261,7 +261,8 @@ switches to prompts for the selected block — or the whole page — and shows
261
261
  the answer with what it changed, before and after; the change shows on the
262
262
  page straight away, outlined as a preview, and needs **Keep it** before it
263
263
  can be saved (**Try another** and **Undo** take it back). Hovered blocks
264
- show their name; Escape goes from a block back to the whole page. The header
264
+ show their name; Escape — or **Whole page** above the form — goes from a
265
+ block back to the whole page. The header
265
266
  names the page and opens every page of the space, drafts included, to go to
266
267
  one (at `pagePath`, in the page's language when it has a path there), and
267
268
  shows the environment. A launcher at the bottom left minimizes the panel,
@@ -507,7 +507,9 @@ textarea:disabled, .path input:disabled { opacity: .6; }
507
507
  .send .icon svg { stroke-width: 2; }
508
508
  .send .working svg, .send .working .accent { fill: rgb(var(--ink)); }
509
509
 
510
- .form { position: relative; flex: 1; min-height: 0; margin: 12px 14px 0; }
510
+ .fields { padding-top: 12px; }
511
+ .fields .note { margin: 0 14px 14px; }
512
+ .form { position: relative; flex: 1; min-height: 0; margin: 0 14px; }
511
513
  .form iframe {
512
514
  display: block; width: 100%; height: 100% !important; border: 0; border-radius: 12px; background: rgb(var(--subtle));
513
515
  }
@@ -573,4 +575,4 @@ textarea:disabled, .path input:disabled { opacity: .6; }
573
575
  .chips .accent-chip .mark { color: rgb(23 22 20); }
574
576
  .chips .accent-chip .mark svg { width: 11px; height: 11px; }
575
577
  .chips .ink-chip { background: rgb(23 22 20); color: rgb(255 255 255); font-weight: 500; }
576
- `,Z=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)},G=e=>!!e&&"object"==typeof e&&!Array.isArray(e),Q=(e,t,r,n)=>{if(null!=e&&""!==e){if("object"!=typeof e)return void n.set(r,{label:t,text:String(e)});if(Array.isArray(e)){if(e.every(e=>null===e||"object"!=typeof e)){e.length&&n.set(r,{label:t,text:e.join(", ")});return}e.forEach((e,a)=>{let i=G(e)&&"string"==typeof e._uid?e._uid:a,o=G(e)&&"string"==typeof e._type?e._type:null;Q(e,o?Z(o):t,`${r}/${i}`,n)});return}for(let[a,i]of Object.entries(e))"_uid"!==a&&"_type"!==a&&Q(i,t?`${t} \xb7 ${Z(a)}`:Z(a),`${r}/${a}`,n)}},ee=(e,n,a={})=>{let i,o={...O,...a.labels},s=e.defaultView,l=e.documentElement,d=(t,...r)=>N(e,"button",{className:t,type:"button"},...r),p=N(e,"div");p.setAttribute("data-obelism-content-editor","");let c=p.attachShadow({mode:"open"}),u=N(e,"style",{textContent:(i=`[${t}]`,`html[data-obelism-editor]{transition:margin-right .3s cubic-bezier(.2,.8,.2,1)}html[data-obelism-docked]{margin-right:436px!important}html[data-obelism-docked] [data-obelism-dock]{right:436px!important;max-width:calc(100vw - 436px)!important}html[data-obelism-editor][data-cms-selecting] ${i}:hover:not([data-cms-selected]){outline:none}html[data-obelism-editor][data-cms-selecting] ${i}[data-cms-selected]{outline:2px solid rgb(212 130 30);outline-offset:2px}@media (prefers-reduced-motion:reduce){html[data-obelism-editor]{transition:none}}`)}),g=N(e,"span",{className:"tile"},P(e,"mark",A)),h=N(e,"span"),b=d("page-button hit",h,N(e,"span",{className:"visually-hidden",textContent:`, ${o.pages}`}),M(e,"chevrons"));b.setAttribute("aria-haspopup","listbox"),b.setAttribute("aria-expanded","false"),b.setAttribute("aria-controls","obelism-pages");let m=N(e,"span",{className:"page-name"}),f=N(e,"span"),v=N(e,"span",{className:"env"},N(e,"span",{className:"visually-hidden",textContent:`${o.environment}: `}),f),x=d("icon-button hit",M(e,"dash"));x.setAttribute("aria-label",o.minimize),x.title=o.minimize;let y=d("mode hit",P(e,"mark",A),o.modePrompt);y.setAttribute("aria-pressed","false");let w=N(e,"div",{className:"head"},g,b,m,v,N(e,"span",{className:"spacer"}),y,x),k=j(e,n,o,{onLoad:()=>ta(),onClose:()=>tp(!1)}),C=d("button quiet new-page",M(e,"plus"),o.newPage),$=N(e,"div",{className:"pages"},k.searchRow,k.list,k.note,C),z=d("button primary",o.keep),I=d("button quiet",o.undo),B=N(e,"div",{className:"gate"},N(e,"p",{textContent:o.keepBeforeFields}),N(e,"div",{className:"actions"},z,I));B.setAttribute("role","alert");let _=N(e,"span"),H=d("",o.scopeEntry),V=d("",o.newPageCancel),W=N(e,"div",{className:"note"},M(e,"scope"),_,H,V),Y=N(e,"p",{className:"intro",textContent:o.askIntro}),X=N(e,"p",{className:"summary"}),ee=N(e,"span"),et=d("button primary",M(e,"plus"),ee),er=N(e,"div",{className:"shop"},X,et),en=N(e,"div",{className:"log"});en.setAttribute("role","log");let ea=N(e,"div",{className:"scroll"},W,Y,er,en),ei=N(e,"input",{type:"text",placeholder:o.pathPlaceholder,autocomplete:"off",spellcheck:!1}),eo=N(e,"label",{className:"path"},N(e,"span",{textContent:o.path}),ei),es=N(e,"textarea",{rows:1});es.setAttribute("aria-label",o.open);let el=M(e,"arrowUp"),ed=P(e,"working",L),ep=N(e,"button",{className:"send",type:"submit",title:o.send},N(e,"span",{className:"visually-hidden",textContent:o.send}),el,ed),ec=N(e,"div",{className:"bar"},P(e,"mark",A),es,ep),eu=N(e,"form",{className:"composer"},eo,ec),eg=N(e,"div",{className:"ask",id:"obelism-ask"},ea,eu);eg.setAttribute("role","tabpanel"),eg.setAttribute("aria-label",o.modePrompt);let eh=N(e,"p",{className:"form-note"});eh.setAttribute("role","status");let eb=N(e,"div",{className:"form"},eh),em=N(e,"div",{className:"fields",id:"obelism-fields"},eb);em.setAttribute("role","tabpanel"),em.setAttribute("aria-label",o.form);let ef=N(e,"p",{className:"save-state"});ef.setAttribute("aria-live","polite");let ev=N(e,"slot");ev.name="actions-footer";let ex=d("button quiet",M(e,"undo"),o.undo),ey=d("button secondary",o.saveDraft),ew=d("button primary",o.publish),ek=N(e,"div",{className:"foot"},ef,ev,ex,ey,ew),eE=N(e,"p",{className:"visually-hidden"});eE.setAttribute("role","status");let eC=N(e,"aside",{className:"panel",id:"obelism-editor"},w,$,B,eg,em,ek,eE);eC.setAttribute("aria-label",o.editor);let eN=d("launch",N(e,"span",{className:"launch-tile"},P(e,"mark",A)),o.editing);eN.setAttribute("aria-controls",eC.id);let eA=N(e,"span",{className:"reading"},N(e,"span",{className:"launch-tile"},P(e,"mark",A)),o.viewingDrafts),eL=M(e,"eye"),eP=M(e,"eyeOff"),eS=d("eye",eL,eP);eS.setAttribute("aria-label",o.hideOutlines),eS.title=o.hideOutlines;let e$=N(e,"slot");e$.name="actions-bar";let eM=d("exit",o.signOut),eU=N(e,"div",{className:"launcher"},eN,eA,eS,e$,eM);a.actions&&p.appendChild(a.actions);let ez=N(e,"div",{className:"layer"});ez.setAttribute("aria-hidden","true");let eI=N(e,"div",{className:"wash"});eI.setAttribute("aria-hidden","true");let eO=N(e,"div",{className:"root"},eI,ez,eC,eU);c.append(N(e,"style",{textContent:J}),eO);let ej=(e=>{try{return e?.localStorage.getItem(K)!=="minimised"}catch{return!0}})(s),eR="fields",eT="fields",eD=!1,eq=!1,eF=!0,eB=!1,e_=null,eH=!1,eV=null,eW=[],eY=!0,eX=null,eK=new Map,eJ="idle",eZ=!1,eG=U(n,eb,o.formTitle,{onReady:()=>{ta(),ej&&"fields"===eT&&eQ()},onError:()=>ta(),onEscape:()=>tc()}),eQ=()=>eb.querySelector("iframe")?.focus(),e0=()=>eW.filter(({status:e})=>"pending"===e),e1=()=>e0().slice(-1)[0]??null,e2=()=>eW.some(({status:e})=>"working"===e)?null:e1(),e4=e=>(eK.has(e)||"loading"===eJ||(eK.set(e,null),n.view({uid:e}).then(t=>{"string"==typeof t._type&&eK.set(e,Z(t._type)),ta()},()=>{})),eK.get(e)??o.block),e5=e=>{Array.isArray(e)?e.forEach(e5):G(e)&&("string"==typeof e._uid&&"string"==typeof e._type&&eK.set(e._uid,Z(e._type)),Object.values(e).forEach(e5))},e6=()=>k.current()?.name||e.title.trim(),e3=null,e8=()=>{null===e3&&s&&(e3=s.requestAnimationFrame(()=>{e3=null,(t=>{if(ez.replaceChildren(),eI.replaceChildren(),!e9(t))return;let n=t=>{let r=e.querySelector(t),n=r?.getBoundingClientRect();return n&&(n.width||n.height)?n:null},a=(t,r,n=ez)=>{let a=N(e,"div",{className:`box ${r}`});Object.assign(a.style,{top:`${t.top-3}px`,left:`${t.left-3}px`,width:`${t.width+6}px`,height:`${t.height+6}px`}),n.appendChild(a)},i=(t,...r)=>{let n=N(e,"div",{className:"chips"},...r),a=t.top-34<0?t.top+6:t.top-34;Object.assign(n.style,{top:`${a}px`,left:`${t.left-3}px`}),ez.appendChild(n)},s=(t,r)=>{let n=N(e,"span",{className:"accent-chip"});return r&&n.appendChild(P(e,"mark",A)),n.appendChild(e.createTextNode(t)),n},l=e1(),d=l?l.uid?E(l.uid):`[${r}]`:null,p=d?n(d):null;if(p&&a(p,"fill",eI),eX&&eX!==t.selectedUid){let t=n(E(eX));if(t){a(t,"hover");let r=t.top-23<0,n=N(e,"span",{className:`name-tab${r?" inside":""}`,textContent:e4(eX)});Object.assign(n.style,{top:`${r?t.top-1.5:t.top-23}px`,left:`${t.left-3}px`}),ez.appendChild(n)}}let c=!!l&&l.uid===t.selectedUid;if(t.selectedUid){let r=n(E(t.selectedUid));if(r){let n=e4(t.selectedUid),a=e6();i(r,s(c?S(o.previewChip,{name:n}):n,c),...a?[N(e,"span",{className:"ink-chip",textContent:a})]:[])}}if(p&&!c){a(p,"preview");let e=l.uid?e4(l.uid):e6()||o.pages;i(p,s(S(o.previewChip,{name:e}),!0))}})(n.getState())}))},e7=e=>e.features.includes("prompt")&&ej,e9=e=>e7(e)&&eF&&!eq,te=t=>N(e,"span",{className:`value${t?"":" none"}`,textContent:t||o.emptyValue}),tt=t=>{let r=t.node.querySelector(".card");if(r.querySelector(".status-line")?.remove(),"failed"===t.status)return void r.appendChild(N(e,"p",{className:"failure"},M(e,"alert"),t.summary));for(let n of(r.appendChild(t.eyebrow),t.summary&&r.appendChild(N(e,"p",{className:"summary",textContent:t.summary})),t.diffs.slice(0,3))){let a=N(e,"div",{className:"diff-field"},N(e,"span",{className:"diff-label",textContent:n.label}),N(e,"div",{className:"diff"},N(e,"div",{className:"before"},N(e,"span",{className:"tag",textContent:o.before}),te(n.before)),N(e,"div",{className:"after"},N(e,"span",{className:"tag",textContent:o.after}),te(n.after))));t.details.push(a),r.appendChild(a)}if(t.diffs.length>3){let n=N(e,"p",{className:"more",textContent:S(o.moreChanges,{count:t.diffs.length-3})});t.details.push(n),r.appendChild(n)}if("pending"===t.status){let n=d("button primary",o.keep),a=d("button secondary",o.retry),i=d("button quiet",o.undo);n.addEventListener("click",()=>tu()),a.addEventListener("click",()=>void tb(t)),i.addEventListener("click",()=>tg(t)),t.actions=N(e,"div",{className:"actions"},n,a,i),r.appendChild(t.actions)}},tr=(t,r)=>{let n=N(e,"div",{className:"card"},N(e,"span",{className:"visually-hidden",textContent:`${o.obelism}: `}),N(e,"p",{className:"status-line"},P(e,"working",L),eq?o.creating:o.working)),a=N(e,"div",{className:"answer"},N(e,"span",{className:"chip"},P(e,"mark",A)),n);a.dataset.status="working";let i={prompt:t,uid:r,status:"working",summary:"",diffs:[],step:null,node:a,eyebrow:N(e,"p",{className:"eyebrow"}),actions:null,details:[]};return eW.push(i),en.appendChild(a),i},tn=t=>{if(eZ)return;let r=t.features.includes("prompt"),i=t.saving||t.publishing,s=t.prompting||i,p=r&&ej,{site:c,canCreate:u,pageless:g,shopHere:x,onlyNew:w}=T(n,t,a.promptWithoutPage);u||(eq=!1),w&&(eq=!0);let E=c&&!eq&&!g&&t.features.includes("form");eT=E?eR:"ask";let A=e0().length>0;for(let e of(A&&"fields"!==eT||(eD=!1),eW))null!==e.step&&e.step>(t.undoSteps??0)&&(e.step=null);eO.hidden=!r&&!c,eC.toggleAttribute("data-closed",!p),eC.inert=!p,eN.hidden=!r,eN.setAttribute("aria-expanded",String(p)),eA.hidden=r,eS.hidden=!p,eS.setAttribute("aria-pressed",String(!eF)),eL.hidden=!eF,eP.hidden=eF,eM.hidden=!1===a.signOut;let S=p&&eY;l.toggleAttribute("data-obelism-docked",S),l.style.setProperty("--obelism-dock",`${436*!!S}px`);let U=p&&eF&&!eq;t.selecting!==U&&n.setSelecting(U);let O=p&&"fields"===eT;O&&!eG.mounted?eG.mount():!O&&eG.mounted&&eG.unmount(),eB&&!p&&(eB=!1),h.textContent=e6()||o.pages,b.hidden=null===k.pages&&null!==k.error,m.hidden=!b.hidden,m.textContent=e6()||o.pages,b.setAttribute("aria-expanded",String(eB)),$.hidden=!eB,C.hidden=!u||eq,C.disabled=s;let j=n.environment;v.hidden=!j,v.dataset.env=j??"",f.textContent="production"===j?o.envProduction:j??"",y.hidden=!E,y.setAttribute("aria-pressed",String("ask"===eT)),y.disabled=s,B.hidden=!eD,z.disabled=I.disabled=s,eg.hidden="ask"!==eT,em.hidden="fields"!==eT;let R=null!==x&&!eq;if(eq)_.textContent=o.newPage;else if(t.selectedUid){let[r,n=""]=o.scopeNoteBlock.split("{name}");_.replaceChildren(r??"",N(e,"strong",{textContent:e4(t.selectedUid)}),n)}else _.textContent=o.scopeNotePage;W.hidden=R||g&&!eq&&!a.promptWithoutPage,H.hidden=eq||!t.selectedUid,V.hidden=!eq||w,Y.hidden=eW.length>0||R||eq,er.hidden=!R;let q=D(o,x);ee.textContent=t.prompting&&R?q.adding:q.add,et.disabled=s,X.textContent=eV?.text??q.hint,X.className=eV?.error?"failure":"summary",eu.hidden=R,eo.hidden=!eq,ei.disabled=s,es.placeholder=eq?o.newPagePlaceholder:o.placeholder,es.disabled=s,ep.disabled=s||""===es.value.trim()||eq&&""===ei.value.trim(),ep.setAttribute("aria-busy",String(t.prompting)),el.hidden=t.prompting,ed.hidden=!t.prompting,ex.hidden=A||!t.canUndo||eq,ex.disabled=s,ey.hidden=!t.features.includes("save")||g,ey.disabled=s||A||!t.unsaved,ew.hidden=!t.features.includes("publish")||g,ew.disabled=s||A,a.actions&&(a.actions.slot=p?"actions-footer":"actions-bar"),ek.hidden=!c,t.unsaved&&!eH&&(e_=null),eH=t.unsaved;let F=i?P(e,"working",L):e_?.kind==="error"?M(e,"alert"):A||t.unsaved?N(e,"span",{className:"dot"}):M(e,"check"),K=t.saving?o.saving:t.publishing?o.publishing:e_?.kind==="error"?`${"save"===e_.action?o.saveFailed:o.publishFailed}: ${e_.text}`:A?o.keepFirst:t.unsaved?o.unsaved:e_?.kind==="saved"?o.saved:e_?.kind==="published"?o.published:o.upToDate,J=i?"saving":e_?.kind==="error"?"error":A||t.unsaved?"unsaved":"saved";if((ef.dataset.state!==J||ef.dataset.text!==K)&&(ef.dataset.state=J,ef.dataset.text=K,ef.replaceChildren(F,N(e,"span",{textContent:K})),e_?.kind==="error"&&!i)){let e=e_.action,t=d("link",o.tryAgain);t.addEventListener("click",()=>void tf(e)),ef.appendChild(t)}eb.classList.toggle("loading",eG.loading||null!==eG.error),eh.hidden=!eG.loading&&null===eG.error,eh.className=`form-note${null!==eG.error?" error":""}`,eh.textContent=eG.error??o.formLoading;let Z=e2();for(let e of eW){if("working"===e.status||"failed"===e.status)continue;e.node.dataset.status=e.status;let t="pending"===e.status?o.suggested:"kept"===e.status?o.kept:o.undone;for(let r of(e.eyebrow.textContent!==t&&(e.eyebrow.textContent=t),e.actions&&(e.actions.hidden=e!==Z),e.details))r.hidden="undone"===e.status}p&&((()=>{if("idle"!==eJ||null===n.entryId)return;eJ="loading";let e=()=>{eJ="done",ta()};n.view({uid:null}).then(t=>{e5(t),e()},e)})(),null===k.pages&&null===k.error&&k.fetch()),e8()},ta=()=>tn(n.getState()),ti=()=>{es.style.height="auto",es.style.height=`${es.scrollHeight}px`},to=()=>{ea.scrollTop=ea.scrollHeight},ts=e=>{ej=e;try{s?.localStorage.setItem(K,ej?"open":"minimised")}catch{}ej||(eB=!1),ta(),ej?eq?ei.focus():"fields"===eT?eQ():es.focus():eN.focus()},tl=e=>{if("fields"===e&&e0().length>0){eD=!0,ta(),z.focus();return}if(eD=!1,eR===e)return ta();eR=e,ta()},td=e=>{eB=!1,(eq=e)&&n.select(null),ta(),(eq?ei:es).focus()},tp=e=>{(eB=e)&&k.reset(),ta(),(eB?k.search:b).focus()},tc=()=>{let e=n.getState();if(!e7(e))return!1;if(eB)tp(!1);else{if(!e.selectedUid)return!1;n.select(null)}return!0},tu=(e=!0)=>{let t=e0();t.length&&e2()&&(t.forEach(e=>{e.status="kept"}),ta(),e&&es.focus())},tg=(e,t=!0)=>{e===e2()&&(n.undo(),e.status="undone",ta(),t&&es.focus())},th=async(e,t)=>{let r={uid:e.uid},a=await n.view(r).catch(()=>null);try{let{summary:i}=await n.prompt(t,r);e.step=n.getState().undoSteps??null;let o=a?await n.view(r).catch(()=>null):null;e.summary=i,e.diffs=a&&o?((e,t)=>{let r=new Map,n=new Map;Q(e,"","",r),Q(t,"","",n);let a=[];for(let e of new Set([...r.keys(),...n.keys()])){let t=r.get(e),i=n.get(e);t?.text!==i?.text&&a.push({label:(i??t).label,before:t?.text??"",after:i?.text??""})}return a})(a,o):[],e.status="pending"}catch(t){e.summary=R(t),e.status="failed"}tt(e),ta(),to()},tb=async e=>{if(e!==e2())return;n.undo(),e.status="undone";let t=tr(e.prompt,e.uid);ta(),to(),es.focus(),await th(t,S(o.retryPrompt,{prompt:e.prompt}))},tm=async()=>{let t=es.value.trim(),r=n.getState();if(!t||r.prompting)return;let a=ei.value.trim();if(eq&&!a)return ei.focus();let i=eq?null:r.selectedUid,s=eq?`${o.newPage} \xb7 ${a}`:i?e4(i):o.scopeEntry;en.appendChild(N(e,"p",{className:"bubble"},N(e,"span",{className:"visually-hidden",textContent:`${o.you} (${s}): `}),t)),es.value="",ti();let l=tr(t,i);if(ta(),to(),eq){try{await n.createPage(a,t),k.forget(),l.summary=o.created,l.status="kept"}catch(e){l.summary=R(e),l.status="failed"}tt(l),ta()}else await th(l,t);es.focus()},tf=async e=>{e_=null;let t=await F(n,e);e_=t?{kind:"error",action:e,text:t}:{kind:"save"===e?"saved":"published"},ta()};eN.addEventListener("click",()=>ts(!ej)),x.addEventListener("click",()=>ts(!1)),eS.addEventListener("click",()=>{eF=!eF,ta()}),eM.addEventListener("click",()=>n.signOut()),b.addEventListener("click",()=>tp(!eB)),C.addEventListener("click",()=>td(!0)),V.addEventListener("click",()=>td(!1)),H.addEventListener("click",()=>{n.select(null),es.focus()}),et.addEventListener("click",async()=>{eV=null,eV=await q(n,o),ta()}),y.addEventListener("click",()=>tl("ask"===eR?"fields":"ask")),z.addEventListener("click",()=>{tu(!1),tl("fields"),eQ()}),I.addEventListener("click",()=>{for(let e=e2();e;e=e2())tg(e,!1);tl("fields"),eQ()}),ex.addEventListener("click",()=>{let e=n.getState().undoSteps,t=void 0===e?void 0:eW.find(t=>"kept"===t.status&&t.step===e);if(n.undo(),t){var r;t.status="undone",ta(),r=`${o.undone}: ${t.summary}`,eE.textContent="",eE.textContent=r}ex.hidden&&es.focus()}),ey.addEventListener("click",()=>void tf("save")),ew.addEventListener("click",()=>void tf("publish")),eu.addEventListener("submit",e=>{e.preventDefault(),tm()}),es.addEventListener("input",()=>{ti(),ta()}),es.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey||e.isComposing||(e.preventDefault(),tm())}),ei.addEventListener("input",ta),ei.addEventListener("keydown",e=>{"Enter"!==e.key||e.isComposing||(e.preventDefault(),es.focus())});let tv=e=>{"Escape"===e.key&&!e.defaultPrevented&&tc()&&e.preventDefault()};e.addEventListener("keydown",tv);let tx=e=>{let r=e.target,n=r?.closest?.(`[${t}]`),a=n?.getAttribute(t)??null;a!==eX&&(eX=a,e8())},ty=()=>{eX=null,e8()};e.addEventListener("pointerover",tx),l.addEventListener("pointerleave",ty),s?.addEventListener("scroll",e8,{capture:!0,passive:!0}),s?.addEventListener("resize",e8);let tw=s?.MutationObserver,tk="function"==typeof tw?new tw(e8):null;tk?.observe(e.body,{childList:!0,subtree:!0});let tE=s?.ResizeObserver,tC="function"==typeof tE?new tE(e8):null;tC?.observe(l);let tN=s?.matchMedia?.("(min-width: 768px)")??null;eY=tN?.matches??!0;let tA=()=>{eY=tN?.matches??!0,ta()};tN?.addEventListener?.("change",tA);let tL=n.on("change",tn);return l.setAttribute("data-obelism-editor",""),e.head.appendChild(u),e.body.appendChild(p),ta(),()=>{eZ=!0,tL(),eG.unmount(),null!==e3&&s?.cancelAnimationFrame?.(e3),e.removeEventListener("keydown",tv),e.removeEventListener("pointerover",tx),l.removeEventListener("pointerleave",ty),s?.removeEventListener("scroll",e8,{capture:!0}),s?.removeEventListener("resize",e8),tN?.removeEventListener?.("change",tA),tk?.disconnect(),tC?.disconnect(),n.setSelecting(!1),l.removeAttribute("data-obelism-editor"),l.removeAttribute("data-obelism-docked"),l.style.removeProperty("--obelism-dock"),u.remove(),p.remove()}},et=Symbol.for("@obelism/content/bridge"),er=C({isEditing:!1,entryId:null,on:()=>{}},new URLSearchParams),en=({url:e,prompt:p=!0,pagePath:c,productPath:b,collectionPath:x}={})=>{let y;if("u"<typeof window)return er;let N=window;if(N[et])return N[et];if(N.ObelismBridge)y=C(N.ObelismBridge,new URLSearchParams(N.location.search));else{let C=(y=((e,r)=>{let n,a,p,c,b,x=new URLSearchParams(e.location.search),y=e.parent!==e&&x.has("cms_preview"),C=v(),N=[],A={...f,selecting:!0},L=e=>{A={...A,...e},C.emit("change",A)},P={isEditing:y,mode:y?"editor":null,entryId:x.get("cms_entry"),environment:x.get(i),product:null,collection:null,on:C.on,getState:()=>A,...w,destroy:()=>{N.splice(0).forEach(e=>e())}};if(!y)return P;let S=e.document,$=(t,n={})=>{e.parent.postMessage({source:h,type:t,...n},r)},M=S.createElement("style");M.textContent=m(),S.head.appendChild(M),N.push(()=>M.remove());let U=(e,t)=>{if(S.querySelectorAll("[data-cms-selected]").forEach(e=>{e.removeAttribute("data-cms-selected")}),A.selectedUid!==(e??null)&&L({selectedUid:e??null}),!e)return;let r=S.querySelector(E(e));r&&(r.setAttribute("data-cms-selected",""),t&&r.scrollIntoView({behavior:"smooth",block:"center"}))},z=e=>{let r=e.target,n=r?.closest?.(`[${t}]`);if(!n)return;e.preventDefault(),e.stopPropagation();let a=n.getAttribute(t);U(a,!1),$("select",{uid:a})};S.addEventListener("click",z,!0),N.push(()=>S.removeEventListener("click",z,!0));let I=()=>Math.ceil(Math.max(S.documentElement.scrollHeight,S.body?.scrollHeight??0)),O=0,j=()=>{O=I(),$("ready",{url:e.location.href,height:O})},R=e.ResizeObserver;if("function"==typeof R){let e=new R(()=>{let e=I();e!==O&&(O=e,$("size",{height:e}))});e.observe(S.documentElement),S.body&&e.observe(S.body),N.push(()=>e.disconnect())}let T=new Map,D=0,q=e=>{let t=T.get(e);return t?(clearTimeout(t.timer),T.delete(e),0===T.size&&L({prompting:!1}),t):null};P.prompt=(e,t={})=>{let r=e.trim();if(!r)return Promise.reject(Error("Say what to change"));if(!A.features.includes("prompt"))return Promise.reject(Error("The editor does not offer prompts here"));let n=`prompt_${++D}`,a=void 0===t.uid?A.selectedUid:t.uid;return new Promise((e,t)=>{let i=setTimeout(()=>{q(n)?.reject(Error("The editor did not answer in time"))},12e4);T.set(n,{resolve:e,reject:t,timer:i}),L({prompting:!0}),$("prompt",{id:n,prompt:r,uid:a})})},P.undo=()=>$("undo"),P.select=e=>{U(e,!1),$("select",{uid:e})};let F=null;N.push(()=>F?.destroy()),N.push(()=>{for(let e of T.keys())q(e)?.reject(Error("The bridge was destroyed"))});let B=(n=new WeakSet,a=null,p=null,c=!1,b=()=>{if(null!==a){for(let e of Array.from(S.styleSheets)){let t;if(!n.has(e)){try{t=e.cssRules}catch{continue}n.add(e),g(t,a)}}S.querySelectorAll('[style*="vh"]').forEach(e=>{u(e.style,a)})}},{freeze(e){if(null!==a||!(e>0))return;a=e,b();let t=S.defaultView?.MutationObserver;t&&(p=new t(()=>{if(c)return;c=!0;let e=()=>{c=!1,b()};S.defaultView?.requestAnimationFrame?S.defaultView.requestAnimationFrame(e):e()})).observe(S.documentElement,{childList:!0,subtree:!0})},destroy(){p?.disconnect()}});N.push(()=>B.destroy());let _=t=>{if(t.origin!==r||t.source!==e.parent)return;let n=t.data;if(n&&"obelism-content-editor"===n.source){if("connect"===n.type)j();else if("update"===n.type&&n.entry)C.emit("update",{entry:n.entry,selectedUid:n.selectedUid??null}),e.requestAnimationFrame(()=>U(n.selectedUid,!1)),F?.refresh();else if("select"===n.type)U(n.uid,!0);else if("saved"===n.type||"published"===n.type)C.emit(n.type,{}),0===C.listeners.update.size&&e.location.reload();else if("features"===n.type&&Array.isArray(n.features))L({features:n.features.filter(e=>"string"==typeof e)});else if("stats"===n.type)L({stats:(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return{};let t={};for(let[r,n]of Object.entries(e)){let{clicks:e,clickers:a,viewers:i,rate:o}=n??{};k(e)&&k(a)&&k(i)&&k(o)&&(t[r]={clicks:e,clickers:a,viewers:i,rate:o})}return t})(n.stats),statsVisible:!1!==n.visible}),(F||Object.keys(A.stats).length)&&(F??(F=((e,{selector:t,onSelect:r,labels:n})=>{let a=e.document,i={...o,...n},p=a.createElement("div");p.setAttribute("data-obelism-stats","");let c=p.attachShadow({mode:"open"}),u=a.createElement("style");u.textContent=l;let g=a.createElement("div");g.className="layer",c.append(u,g),a.body.appendChild(p);let h={},b=!1,m=null,f=()=>{if(m=null,g.replaceChildren(),g.hidden=!b,!b)return;let n=e.innerHeight;for(let[o,l]of Object.entries(h)){let p=a.querySelector(t(o));if(!p)continue;let c=p.getBoundingClientRect();if(!c.width&&!c.height||c.bottom<0||c.top>n)continue;let u=a.createElement("button");u.type="button",u.className="badge",u.dataset.uid=o,u.textContent=s(i.clicked,{rate:Math.round(100*l.rate)}),u.title=s(i.title,{clickers:l.clickers,viewers:l.viewers,clicks:l.clicks});let{place:h,top:b,left:m}=d(c,e.innerWidth);u.dataset.place=h,u.style.top=`${b}px`,u.style.left=`${m}px`,u.addEventListener("click",()=>r(o)),g.appendChild(u)}},v=()=>{null===m&&b&&(m=e.requestAnimationFrame(f))};e.addEventListener("scroll",v,{capture:!0,passive:!0}),e.addEventListener("resize",v);let x=e.MutationObserver,y="function"==typeof x?new x(v):null;return y?.observe(a.body,{childList:!0,subtree:!0}),{update(t,r){h=t,b=r,null!==m&&(e.cancelAnimationFrame?.(m),m=null),f()},refresh:v,destroy(){null!==m&&e.cancelAnimationFrame?.(m),e.removeEventListener("scroll",v,{capture:!0}),e.removeEventListener("resize",v),y?.disconnect(),p.remove()}}})(e,{selector:E,onSelect:e=>P.select(e)})),F.update(A.stats,A.statsVisible));else if("viewport"===n.type&&"number"==typeof n.height)B.freeze(n.height);else if("promptState"===n.type)L({canUndo:!0===n.canUndo});else if("promptResult"===n.type&&"string"==typeof n.id){let e=q(n.id);if(!e)return;!0===n.ok?e.resolve({summary:"string"==typeof n.summary?n.summary:""}):e.reject(Error("string"==typeof n.error?n.error:"The prompt failed"))}}};return e.addEventListener("message",_),N.push(()=>e.removeEventListener("message",_)),"loading"===S.readyState?(S.addEventListener("DOMContentLoaded",j,{once:!0}),N.push(()=>S.removeEventListener("DOMContentLoaded",j))):j(),P})(N,new URL(e||V).origin)).isEditing||N.parent!==N?null:(e=>{for(let t of e.cookie.split(";")){let[e,...r]=t.trim().split("=");if("obelism_content_editing"===e)try{let e=decodeURIComponent(r.join("="));return W.test(e)?e:null}catch{break}}return null})(N.document);if(C&&(y=((e,i,{pagePath:o=e=>`/${e.replace(/^\/+/,"")}`,productPath:s,collectionPath:l}={})=>{let d=e.document,p=v(),c=[],u=new Map,g=[],b=new Set,x=null,y=null,w=-1/0,k=new Map,C=f,N=e=>{C={...C,...e},p.emit("change",C)},A=()=>N({unsaved:[...u.values()].some(({content:e,saved:t})=>!X(e,t)),canUndo:g.length>0,undoSteps:g.length}),L=async(t,r)=>{let n=await e.fetch(`${i}/api/${t}`,void 0===r?{credentials:"same-origin"}:{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","x-obelism-content":"1"},body:JSON.stringify(r)}),a=await n.json().catch(()=>({}));if(401===n.status)throw N({features:[]}),Error("You were signed out. Sign in again to edit.");if(!n.ok)throw Error("string"==typeof a.error?a.error:`Obelism Content answered ${n.status}`);return a},P=()=>d.querySelector(`[${r}]`)?.getAttribute(r)??null,S=()=>{let e=d.querySelector(`[${n}]`),t=e?.getAttribute(n),r=e?.getAttribute("data-cms-product-handle");return t&&r?{id:t,handle:r}:null},$=()=>{let e=d.querySelector(`[${a}]`),t=e?.getAttribute(a),r=e?.getAttribute("data-cms-collection-handle");return t&&r?{id:t,handle:r}:null},M=e=>{let t=e?d.querySelector(E(e)):null;return t?.closest(`[${r}]`)?.getAttribute(r)??P()},U=()=>{if(!x)return;let e=x.space.locales.map(({code:e})=>e),t=d.documentElement.lang;if(e.includes(t))return t;let r=t.split("-")[0]??"";return e.includes(r)?r:x.space.defaultLocale},z=new Map,I=async e=>{let t=u.get(e);if(t)return t;let r=z.get(e);return r||(r=L(`entries/${encodeURIComponent(e)}`).then(t=>{let r=u.get(e)??{content:t.content,saved:t.content,revision:t.draftRevision};return u.set(e,r),r}).finally(()=>z.delete(e)),z.set(e,r)),r},O=e=>{let t=void 0===e?C.selectedUid:e,r=M(t);if(!r)throw Error("Nothing on this page is marked as an entry: add editable(entry)");return{uid:t,entryId:r}},j=e=>{d.querySelectorAll("[data-cms-selected]").forEach(e=>{e.removeAttribute("data-cms-selected")}),C.selectedUid!==e&&N({selectedUid:e}),e&&d.querySelector(E(e))?.setAttribute("data-cms-selected","")},R=async t=>{if(0===p.listeners.update.size)return;let r=u.get(t)?.content,{entry:n}=await L(`entries/${encodeURIComponent(t)}/preview`,{content:r,locale:U()});p.emit("update",{entry:n,selectedUid:C.selectedUid}),e.requestAnimationFrame(()=>j(C.selectedUid))},T=e=>console.error("[@obelism/content bridge]",e),D=t=>{p.emit(t,{}),0===p.listeners.update.size&&e.location.reload()},q=async()=>{for(let[e,t]of u){if(X(t.content,t.saved))continue;let{draftRevision:r}=await L(`entries/${encodeURIComponent(e)}/save`,{content:t.content,baseRevision:t.revision});t.saved=t.content,t.revision=r,b.add(e)}g.length=0,w=-1/0,A()},F={isEditing:!0,mode:"site",get entryId(){return P()},get product(){return S()},get collection(){return $()},get environment(){return x?.environment??null},on:p.on,getState:()=>C,async prompt(e,t={}){let r=e.trim();if(!r)throw Error("Say what to change");if(!C.features.includes("prompt"))throw Error("You may not edit content here");let{uid:n,entryId:a}=O(t.uid);N({prompting:!0});try{let e=await I(a),t=await L(`entries/${encodeURIComponent(a)}/prompt`,{prompt:r,content:e.content,locale:U(),uid:n});return g.push({entryId:a,content:e.content}),w=-1/0,e.content=t.content,A(),await R(a),{summary:t.summary}}finally{N({prompting:!1})}},async createPage(t,r){let n=r.trim();if(!n)throw Error("Say what the page is for");if(!t.trim())throw Error("Say where the page goes, like /pricing");if(!C.features.includes("create"))throw Error("You may not add pages here");if(C.unsaved)throw Error("Save or undo your changes before adding a page");N({prompting:!0});try{let r=await L("entries",{path:t,prompt:n,locale:U(),from:P()}),a=o(r.path,U()??"");return e.location.assign(Y(a)),{summary:r.summary,entryId:r.entryId,path:r.path,url:a}}finally{N({prompting:!1})}},async createProductPage(t=S()??void 0){if(!t)throw Error("Nothing on this page is marked as a product: add editableProduct(product)");if(!C.features.includes("create"))throw Error("You may not add pages here");if(C.unsaved)throw Error("Save or undo your changes before adding a page");N({prompting:!0});try{let r=await L("product-pages",{product:{id:t.id,handle:t.handle}});return e.location.reload(),r}finally{N({prompting:!1})}},async createCollectionPage(t=$()??void 0){if(!t)throw Error("Nothing on this page is marked as a collection: add editableCollection(collection)");if(!C.features.includes("create"))throw Error("You may not add pages here");if(C.unsaved)throw Error("Save or undo your changes before adding a page");N({prompting:!0});try{let r=await L("collection-pages",{collection:{id:t.id,handle:t.handle}});return e.location.reload(),r}finally{N({prompting:!1})}},async view(e={}){let{uid:t,entryId:r}=O(e.uid),n=await I(r),{view:a}=await L(`entries/${encodeURIComponent(r)}/view`,{content:n.content,locale:U(),uid:t});return a},async applyJson(e,t={}){if(!C.features.includes("prompt"))throw Error("You may not edit content here");if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Send the fields to change as an object");let{uid:r,entryId:n}=O(t.uid);N({prompting:!0});try{let t=await I(n),a=await L(`entries/${encodeURIComponent(n)}/apply`,{changes:e,content:t.content,locale:U(),uid:r});return X(a.content,t.content)||(g.push({entryId:n,content:t.content}),w=-1/0,t.content=a.content,A(),await R(n)),{changed:a.changed??[],...a.view&&{view:a.view}}}finally{N({prompting:!1})}},openForm(t,r={}){let{title:n="Content form",onReady:a,onError:i,onEscape:o}=r;y?.();let s=!1,l=null,d=null,c=()=>{},b=e=>{s||i?.(e instanceof Error?e.message:String(e))},m=()=>{s||(s=!0,c(),l?.destroy(),y===m&&(y=null))};y=m;let f=()=>{if(s||!l)return;let e=M(C.selectedUid);if(!e)return;let t=u.get(e);if(!t)return void I(e).then(f,b);let r={entryId:e,content:t.content,locale:U(),selectedUid:C.selectedUid};d&&d.entryId===r.entryId&&d.content===r.content&&d.locale===r.locale&&d.selectedUid===r.selectedUid||(d=r,l.show(r))},v=(e,t)=>{let r=t??d?.entryId,n=void 0===r?void 0:u.get(r);if(s||void 0===r||!n||X(e,n.content))return;let a=Date.now();a-w>=1e3&&g.push({entryId:r,content:n.content}),w=a,n.content=e,d?.entryId===r&&(d={...d,content:e}),A(),clearTimeout(k.get(r)),k.set(r,setTimeout(()=>{k.delete(r),R(r).catch(T)},300))};return(async()=>{if(!C.features.includes("form"))throw Error("You may not edit content here");await I(O(void 0).entryId);let{url:r}=await L("form",{});s||(l=((e,t,r,n,a)=>{let i=null;try{i=new URL(r)}catch{}if(!i||!/^https?:$/.test(i.protocol))throw Error("Obelism Content sent no form to open");let o=i.origin,s=t.ownerDocument.createElement("iframe");s.title=n,s.src=r;let l=!1,d=!1,p=null,c=()=>{l&&p&&s.contentWindow?.postMessage({source:h,type:"content",...p},o)},u=setTimeout(()=>{d||a.onError("The form did not open")},3e4),g=()=>{d=!0,clearTimeout(u),a.onReady()},b=e=>{if(e.origin!==o||!s.contentWindow||e.source!==s.contentWindow)return;let t=e.data;if(t&&"obelism-content-form"===t.source)if("ready"===t.type)l=!0,c(),!0!==t.loading&&g();else if("loaded"===t.type)l&&g();else{let e;if("change"!==t.type||!(e=t.content)||"object"!=typeof e||Array.isArray(e))if("height"===t.type){let e=t.height;if("number"==typeof e&&Number.isFinite(e)){let t=Math.round(Math.min(Math.max(e,80),4e3));s.style.height=`min(${t}px, 60vh)`}}else"escape"===t.type?a.onEscape?.():"error"===t.type&&a.onError("string"==typeof t.message&&t.message?t.message:"The form failed");else a.onChange(t.content,"string"==typeof t.entryId?t.entryId:void 0)}};return e.addEventListener("message",b),t.appendChild(s),{show(e){p=e,c()},destroy(){clearTimeout(u),e.removeEventListener("message",b),s.remove()}}})(e,t,"string"==typeof r?r:"",n,{onReady:()=>a?.(),onChange:v,onError:e=>i?.(e),onEscape:()=>o?.()}),c=p.on("change",f),f())})().catch(b),{close:m}},async pages(){let{pages:e}=await L("pages"),t=[U(),x?.space.defaultLocale];return e.flatMap(e=>{let r,n,a=t.find(t=>void 0!==t&&void 0!==e.paths[t])??Object.keys(e.paths)[0],i=void 0===a?void 0:e.paths[a];return void 0===a||void 0===i?[]:[{entryId:e.entryId,name:e.name,contentType:e.contentType,status:e.status,path:i,url:e.product?(r=e.product.handle,s?s(r,a):(x?.productPath??"/products/{handle}").replaceAll("{handle}",encodeURIComponent(r))):e.collection?(n=e.collection.handle,l?l(n,a):(x?.collectionPath??"/collections/{handle}").replaceAll("{handle}",encodeURIComponent(n))):o(i,a),product:e.product??null,collection:e.collection??null}]})},openPage(t){(!C.unsaved||e.confirm("Leave this page and lose the changes you have not saved?"))&&(u.clear(),g.length=0,A(),e.location.assign(Y(t.url)))},undo(){let e=g.pop(),t=e&&u.get(e.entryId);e&&t&&(w=-1/0,t.content=e.content,A(),R(e.entryId).catch(T))},async save(){if(!C.features.includes("save"))throw Error("You may not edit content here");N({saving:!0});try{await q()}finally{N({saving:!1})}D("saved")},async publish(){if(!C.features.includes("publish"))throw Error("You may not publish here");N({publishing:!0});try{await q();let e=P(),t=b.size>0?[...b]:e?[e]:[];if(0===t.length)throw Error("Nothing on this page is marked as an entry: add editable(entry)");for(let e of t)await L(`entries/${encodeURIComponent(e)}/publish`,{}),b.delete(e)}finally{N({publishing:!1})}D("published")},signOut(){if(C.unsaved&&!e.confirm("Sign out and lose the changes you have not saved?"))return;u.clear(),A();let t=e.location.pathname+e.location.search;e.location.href=`${i}/logout?return_to=${encodeURIComponent(t)}`},select(e){j(e)},setSelecting(e){e?d.documentElement.setAttribute("data-cms-selecting",""):d.documentElement.removeAttribute("data-cms-selecting"),N({selecting:e})},destroy(){y?.(),k.forEach(e=>clearTimeout(e)),k.clear(),c.splice(0).forEach(e=>e())}},B=d.createElement("style");B.textContent=m("html[data-cms-selecting] "),d.head.appendChild(B),c.push(()=>B.remove()),c.push(()=>d.documentElement.removeAttribute("data-cms-selecting"));let _=e=>{if(!C.selecting)return;let r=e.target,n=r?.closest?.(`[${t}]`);n&&(e.preventDefault(),e.stopPropagation(),j(n.getAttribute(t)))};d.addEventListener("click",_,!0),c.push(()=>d.removeEventListener("click",_,!0));let H=e=>{C.unsaved&&(e.preventDefault(),e.returnValue="")};return e.addEventListener("beforeunload",H),c.push(()=>e.removeEventListener("beforeunload",H)),L("session").then(e=>{x=e,N({features:e.features})}).catch(e=>console.error("[@obelism/content bridge]",e)),F})(N,C,{pagePath:c,productPath:b,collectionPath:x})),y.isEditing&&p){let e=N.document,t=()=>{},r=!1,n=C?ee:H,a=()=>{r||(t=n(e,y,!0===p?{}:p))};e.body?a():e.addEventListener("DOMContentLoaded",a,{once:!0});let i=y.destroy;y.destroy=()=>{r=!0,e.removeEventListener("DOMContentLoaded",a),t(),i()}}}return N[et]=y,y};(e=window).ObelismBridge=en((e=>{let t=e?.dataset.url,r=t||V;if(!t&&e?.src){let t=new URL(e.src);"/bridge.js"===t.pathname&&(r=t.origin)}return{url:r,prompt:e?.dataset.prompt!=="false"}})(document.currentScript)),e.ObelismContent={getContentBridge:en,mountPromptBox:H,mountSiteEditor:ee}}();
578
+ `,Z=e=>{let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)},G=e=>!!e&&"object"==typeof e&&!Array.isArray(e),Q=(e,t,r,n)=>{if(null!=e&&""!==e){if("object"!=typeof e)return void n.set(r,{label:t,text:String(e)});if(Array.isArray(e)){if(e.every(e=>null===e||"object"!=typeof e)){e.length&&n.set(r,{label:t,text:e.join(", ")});return}e.forEach((e,a)=>{let i=G(e)&&"string"==typeof e._uid?e._uid:a,o=G(e)&&"string"==typeof e._type?e._type:null;Q(e,o?Z(o):t,`${r}/${i}`,n)});return}for(let[a,i]of Object.entries(e))"_uid"!==a&&"_type"!==a&&Q(i,t?`${t} \xb7 ${Z(a)}`:Z(a),`${r}/${a}`,n)}},ee=(e,n,a={})=>{let i,o={...O,...a.labels},s=e.defaultView,l=e.documentElement,d=(t,...r)=>N(e,"button",{className:t,type:"button"},...r),p=N(e,"div");p.setAttribute("data-obelism-content-editor","");let c=p.attachShadow({mode:"open"}),u=N(e,"style",{textContent:(i=`[${t}]`,`html[data-obelism-editor]{transition:margin-right .3s cubic-bezier(.2,.8,.2,1)}html[data-obelism-docked]{margin-right:436px!important}html[data-obelism-docked] [data-obelism-dock]{right:436px!important;max-width:calc(100vw - 436px)!important}html[data-obelism-editor][data-cms-selecting] ${i}:hover:not([data-cms-selected]){outline:none}html[data-obelism-editor][data-cms-selecting] ${i}[data-cms-selected]{outline:2px solid rgb(212 130 30);outline-offset:2px}@media (prefers-reduced-motion:reduce){html[data-obelism-editor]{transition:none}}`)}),g=N(e,"span",{className:"tile"},P(e,"mark",A)),h=N(e,"span"),b=d("page-button hit",h,N(e,"span",{className:"visually-hidden",textContent:`, ${o.pages}`}),M(e,"chevrons"));b.setAttribute("aria-haspopup","listbox"),b.setAttribute("aria-expanded","false"),b.setAttribute("aria-controls","obelism-pages");let m=N(e,"span",{className:"page-name"}),f=N(e,"span"),v=N(e,"span",{className:"env"},N(e,"span",{className:"visually-hidden",textContent:`${o.environment}: `}),f),x=d("icon-button hit",M(e,"dash"));x.setAttribute("aria-label",o.minimize),x.title=o.minimize;let y=d("mode hit",P(e,"mark",A),o.modePrompt);y.setAttribute("aria-pressed","false");let w=N(e,"div",{className:"head"},g,b,m,v,N(e,"span",{className:"spacer"}),y,x),k=j(e,n,o,{onLoad:()=>ts(),onClose:()=>tg(!1)}),C=d("button quiet new-page",M(e,"plus"),o.newPage),$=N(e,"div",{className:"pages"},k.searchRow,k.list,k.note,C),z=d("button primary",o.keep),I=d("button quiet",o.undo),B=N(e,"div",{className:"gate"},N(e,"p",{textContent:o.keepBeforeFields}),N(e,"div",{className:"actions"},z,I));B.setAttribute("role","alert");let _=N(e,"span"),H=d("",o.scopeEntry),V=d("",o.newPageCancel),W=N(e,"div",{className:"note"},M(e,"scope"),_,H,V),Y=N(e,"p",{className:"intro",textContent:o.askIntro}),X=N(e,"p",{className:"summary"}),ee=N(e,"span"),et=d("button primary",M(e,"plus"),ee),er=N(e,"div",{className:"shop"},X,et),en=N(e,"div",{className:"log"});en.setAttribute("role","log");let ea=N(e,"div",{className:"scroll"},W,Y,er,en),ei=N(e,"input",{type:"text",placeholder:o.pathPlaceholder,autocomplete:"off",spellcheck:!1}),eo=N(e,"label",{className:"path"},N(e,"span",{textContent:o.path}),ei),es=N(e,"textarea",{rows:1});es.setAttribute("aria-label",o.open);let el=M(e,"arrowUp"),ed=P(e,"working",L),ep=N(e,"button",{className:"send",type:"submit",title:o.send},N(e,"span",{className:"visually-hidden",textContent:o.send}),el,ed),ec=N(e,"div",{className:"bar"},P(e,"mark",A),es,ep),eu=N(e,"form",{className:"composer"},eo,ec),eg=N(e,"div",{className:"ask",id:"obelism-ask"},ea,eu);eg.setAttribute("role","tabpanel"),eg.setAttribute("aria-label",o.modePrompt);let eh=N(e,"p",{className:"form-note"});eh.setAttribute("role","status");let eb=N(e,"div",{className:"form"},eh),em=N(e,"span"),ef=d("",o.scopeEntry),ev=N(e,"div",{className:"note"},M(e,"scope"),em,ef),ex=N(e,"div",{className:"fields",id:"obelism-fields"},ev,eb);ex.setAttribute("role","tabpanel"),ex.setAttribute("aria-label",o.form);let ey=N(e,"p",{className:"save-state"});ey.setAttribute("aria-live","polite");let ew=N(e,"slot");ew.name="actions-footer";let ek=d("button quiet",M(e,"undo"),o.undo),eE=d("button secondary",o.saveDraft),eC=d("button primary",o.publish),eN=N(e,"div",{className:"foot"},ey,ew,ek,eE,eC),eA=N(e,"p",{className:"visually-hidden"});eA.setAttribute("role","status");let eL=N(e,"aside",{className:"panel",id:"obelism-editor"},w,$,B,eg,ex,eN,eA);eL.setAttribute("aria-label",o.editor);let eP=d("launch",N(e,"span",{className:"launch-tile"},P(e,"mark",A)),o.editing);eP.setAttribute("aria-controls",eL.id);let eS=N(e,"span",{className:"reading"},N(e,"span",{className:"launch-tile"},P(e,"mark",A)),o.viewingDrafts),e$=M(e,"eye"),eM=M(e,"eyeOff"),eU=d("eye",e$,eM);eU.setAttribute("aria-label",o.hideOutlines),eU.title=o.hideOutlines;let ez=N(e,"slot");ez.name="actions-bar";let eI=d("exit",o.signOut),eO=N(e,"div",{className:"launcher"},eP,eS,eU,ez,eI);a.actions&&p.appendChild(a.actions);let ej=N(e,"div",{className:"layer"});ej.setAttribute("aria-hidden","true");let eR=N(e,"div",{className:"wash"});eR.setAttribute("aria-hidden","true");let eT=N(e,"div",{className:"root"},eR,ej,eL,eO);c.append(N(e,"style",{textContent:J}),eT);let eD=(e=>{try{return e?.localStorage.getItem(K)!=="minimised"}catch{return!0}})(s),eq="fields",eF="fields",eB=!1,e_=!1,eH=!0,eV=!1,eW=null,eY=!1,eX=null,eK=[],eJ=!0,eZ=null,eG=new Map,eQ="idle",e0=!1,e1=U(n,eb,o.formTitle,{onReady:()=>{ts(),eD&&"fields"===eF&&e2()},onError:()=>ts(),onEscape:()=>th()}),e2=()=>eb.querySelector("iframe")?.focus(),e4=()=>eK.filter(({status:e})=>"pending"===e),e5=()=>e4().slice(-1)[0]??null,e6=()=>eK.some(({status:e})=>"working"===e)?null:e5(),e3=e=>(eG.has(e)||"loading"===eQ||(eG.set(e,null),n.view({uid:e}).then(t=>{"string"==typeof t._type&&eG.set(e,Z(t._type)),ts()},()=>{})),eG.get(e)??o.block),e8=e=>{Array.isArray(e)?e.forEach(e8):G(e)&&("string"==typeof e._uid&&"string"==typeof e._type&&eG.set(e._uid,Z(e._type)),Object.values(e).forEach(e8))},e7=()=>k.current()?.name||e.title.trim(),e9=null,te=()=>{null===e9&&s&&(e9=s.requestAnimationFrame(()=>{e9=null,(t=>{if(ej.replaceChildren(),eR.replaceChildren(),!tr(t))return;let n=t=>{let r=e.querySelector(t),n=r?.getBoundingClientRect();return n&&(n.width||n.height)?n:null},a=(t,r,n=ej)=>{let a=N(e,"div",{className:`box ${r}`});Object.assign(a.style,{top:`${t.top-3}px`,left:`${t.left-3}px`,width:`${t.width+6}px`,height:`${t.height+6}px`}),n.appendChild(a)},i=(t,...r)=>{let n=N(e,"div",{className:"chips"},...r),a=t.top-34<0?t.top+6:t.top-34;Object.assign(n.style,{top:`${a}px`,left:`${t.left-3}px`}),ej.appendChild(n)},s=(t,r)=>{let n=N(e,"span",{className:"accent-chip"});return r&&n.appendChild(P(e,"mark",A)),n.appendChild(e.createTextNode(t)),n},l=e5(),d=l?l.uid?E(l.uid):`[${r}]`:null,p=d?n(d):null;if(p&&a(p,"fill",eR),eZ&&eZ!==t.selectedUid){let t=n(E(eZ));if(t){a(t,"hover");let r=t.top-23<0,n=N(e,"span",{className:`name-tab${r?" inside":""}`,textContent:e3(eZ)});Object.assign(n.style,{top:`${r?t.top-1.5:t.top-23}px`,left:`${t.left-3}px`}),ej.appendChild(n)}}let c=!!l&&l.uid===t.selectedUid;if(t.selectedUid){let r=n(E(t.selectedUid));if(r){let n=e3(t.selectedUid),a=e7();i(r,s(c?S(o.previewChip,{name:n}):n,c),...a?[N(e,"span",{className:"ink-chip",textContent:a})]:[])}}if(p&&!c){a(p,"preview");let e=l.uid?e3(l.uid):e7()||o.pages;i(p,s(S(o.previewChip,{name:e}),!0))}})(n.getState())}))},tt=e=>e.features.includes("prompt")&&eD,tr=e=>tt(e)&&eH&&!e_,tn=t=>N(e,"span",{className:`value${t?"":" none"}`,textContent:t||o.emptyValue}),ta=t=>{let r=t.node.querySelector(".card");if(r.querySelector(".status-line")?.remove(),"failed"===t.status)return void r.appendChild(N(e,"p",{className:"failure"},M(e,"alert"),t.summary));for(let n of(r.appendChild(t.eyebrow),t.summary&&r.appendChild(N(e,"p",{className:"summary",textContent:t.summary})),t.diffs.slice(0,3))){let a=N(e,"div",{className:"diff-field"},N(e,"span",{className:"diff-label",textContent:n.label}),N(e,"div",{className:"diff"},N(e,"div",{className:"before"},N(e,"span",{className:"tag",textContent:o.before}),tn(n.before)),N(e,"div",{className:"after"},N(e,"span",{className:"tag",textContent:o.after}),tn(n.after))));t.details.push(a),r.appendChild(a)}if(t.diffs.length>3){let n=N(e,"p",{className:"more",textContent:S(o.moreChanges,{count:t.diffs.length-3})});t.details.push(n),r.appendChild(n)}if("pending"===t.status){let n=d("button primary",o.keep),a=d("button secondary",o.retry),i=d("button quiet",o.undo);n.addEventListener("click",()=>tb()),a.addEventListener("click",()=>void tv(t)),i.addEventListener("click",()=>tm(t)),t.actions=N(e,"div",{className:"actions"},n,a,i),r.appendChild(t.actions)}},ti=(t,r)=>{let n=N(e,"div",{className:"card"},N(e,"span",{className:"visually-hidden",textContent:`${o.obelism}: `}),N(e,"p",{className:"status-line"},P(e,"working",L),e_?o.creating:o.working)),a=N(e,"div",{className:"answer"},N(e,"span",{className:"chip"},P(e,"mark",A)),n);a.dataset.status="working";let i={prompt:t,uid:r,status:"working",summary:"",diffs:[],step:null,node:a,eyebrow:N(e,"p",{className:"eyebrow"}),actions:null,details:[]};return eK.push(i),en.appendChild(a),i},to=t=>{if(e0)return;let r=t.features.includes("prompt"),i=t.saving||t.publishing,s=t.prompting||i,p=r&&eD,{site:c,canCreate:u,pageless:g,shopHere:x,onlyNew:w}=T(n,t,a.promptWithoutPage);u||(e_=!1),w&&(e_=!0);let E=c&&!e_&&!g&&t.features.includes("form");eF=E?eq:"ask";let A=e4().length>0;for(let e of(A&&"fields"!==eF||(eB=!1),eK))null!==e.step&&e.step>(t.undoSteps??0)&&(e.step=null);eT.hidden=!r&&!c,eL.toggleAttribute("data-closed",!p),eL.inert=!p,eP.hidden=!r,eP.setAttribute("aria-expanded",String(p)),eS.hidden=r,eU.hidden=!p,eU.setAttribute("aria-pressed",String(!eH)),e$.hidden=!eH,eM.hidden=eH,eI.hidden=!1===a.signOut;let S=p&&eJ;l.toggleAttribute("data-obelism-docked",S),l.style.setProperty("--obelism-dock",`${436*!!S}px`);let U=p&&eH&&!e_;t.selecting!==U&&n.setSelecting(U);let O=p&&"fields"===eF;O&&!e1.mounted?e1.mount():!O&&e1.mounted&&e1.unmount(),eV&&!p&&(eV=!1),h.textContent=e7()||o.pages,b.hidden=null===k.pages&&null!==k.error,m.hidden=!b.hidden,m.textContent=e7()||o.pages,b.setAttribute("aria-expanded",String(eV)),$.hidden=!eV,C.hidden=!u||e_,C.disabled=s;let j=n.environment;v.hidden=!j,v.dataset.env=j??"",f.textContent="production"===j?o.envProduction:j??"",y.hidden=!E,y.setAttribute("aria-pressed",String("ask"===eF)),y.disabled=s,B.hidden=!eB,z.disabled=I.disabled=s,eg.hidden="ask"!==eF,ex.hidden="fields"!==eF;let R=null!==x&&!e_;if(e_)_.textContent=o.newPage;else if(t.selectedUid){let[r,n=""]=o.scopeNoteBlock.split("{name}");for(let a of[_,em])a.replaceChildren(r??"",N(e,"strong",{textContent:e3(t.selectedUid)}),n)}else _.textContent=o.scopeNotePage;ev.hidden=e_||!t.selectedUid,W.hidden=R||g&&!e_&&!a.promptWithoutPage,H.hidden=e_||!t.selectedUid,V.hidden=!e_||w,Y.hidden=eK.length>0||R||e_,er.hidden=!R;let q=D(o,x);ee.textContent=t.prompting&&R?q.adding:q.add,et.disabled=s,X.textContent=eX?.text??q.hint,X.className=eX?.error?"failure":"summary",eu.hidden=R,eo.hidden=!e_,ei.disabled=s,es.placeholder=e_?o.newPagePlaceholder:o.placeholder,es.disabled=s,ep.disabled=s||""===es.value.trim()||e_&&""===ei.value.trim(),ep.setAttribute("aria-busy",String(t.prompting)),el.hidden=t.prompting,ed.hidden=!t.prompting,ek.hidden=A||!t.canUndo||e_,ek.disabled=s,eE.hidden=!t.features.includes("save")||g,eE.disabled=s||A||!t.unsaved,eC.hidden=!t.features.includes("publish")||g,eC.disabled=s||A,a.actions&&(a.actions.slot=p?"actions-footer":"actions-bar"),eN.hidden=!c,t.unsaved&&!eY&&(eW=null),eY=t.unsaved;let F=i?P(e,"working",L):eW?.kind==="error"?M(e,"alert"):A||t.unsaved?N(e,"span",{className:"dot"}):M(e,"check"),K=t.saving?o.saving:t.publishing?o.publishing:eW?.kind==="error"?`${"save"===eW.action?o.saveFailed:o.publishFailed}: ${eW.text}`:A?o.keepFirst:t.unsaved?o.unsaved:eW?.kind==="saved"?o.saved:eW?.kind==="published"?o.published:o.upToDate,J=i?"saving":eW?.kind==="error"?"error":A||t.unsaved?"unsaved":"saved";if((ey.dataset.state!==J||ey.dataset.text!==K)&&(ey.dataset.state=J,ey.dataset.text=K,ey.replaceChildren(F,N(e,"span",{textContent:K})),eW?.kind==="error"&&!i)){let e=eW.action,t=d("link",o.tryAgain);t.addEventListener("click",()=>void ty(e)),ey.appendChild(t)}eb.classList.toggle("loading",e1.loading||null!==e1.error),eh.hidden=!e1.loading&&null===e1.error,eh.className=`form-note${null!==e1.error?" error":""}`,eh.textContent=e1.error??o.formLoading;let Z=e6();for(let e of eK){if("working"===e.status||"failed"===e.status)continue;e.node.dataset.status=e.status;let t="pending"===e.status?o.suggested:"kept"===e.status?o.kept:o.undone;for(let r of(e.eyebrow.textContent!==t&&(e.eyebrow.textContent=t),e.actions&&(e.actions.hidden=e!==Z),e.details))r.hidden="undone"===e.status}p&&((()=>{if("idle"!==eQ||null===n.entryId)return;eQ="loading";let e=()=>{eQ="done",ts()};n.view({uid:null}).then(t=>{e8(t),e()},e)})(),null===k.pages&&null===k.error&&k.fetch()),te()},ts=()=>to(n.getState()),tl=()=>{es.style.height="auto",es.style.height=`${es.scrollHeight}px`},td=()=>{ea.scrollTop=ea.scrollHeight},tp=e=>{eD=e;try{s?.localStorage.setItem(K,eD?"open":"minimised")}catch{}eD||(eV=!1),ts(),eD?e_?ei.focus():"fields"===eF?e2():es.focus():eP.focus()},tc=e=>{if("fields"===e&&e4().length>0){eB=!0,ts(),z.focus();return}if(eB=!1,eq===e)return ts();eq=e,ts()},tu=e=>{eV=!1,(e_=e)&&n.select(null),ts(),(e_?ei:es).focus()},tg=e=>{(eV=e)&&k.reset(),ts(),(eV?k.search:b).focus()},th=()=>{let e=n.getState();if(!tt(e))return!1;if(eV)tg(!1);else{if(!e.selectedUid)return!1;n.select(null)}return!0},tb=(e=!0)=>{let t=e4();t.length&&e6()&&(t.forEach(e=>{e.status="kept"}),ts(),e&&es.focus())},tm=(e,t=!0)=>{e===e6()&&(n.undo(),e.status="undone",ts(),t&&es.focus())},tf=async(e,t)=>{let r={uid:e.uid},a=await n.view(r).catch(()=>null);try{let{summary:i}=await n.prompt(t,r);e.step=n.getState().undoSteps??null;let o=a?await n.view(r).catch(()=>null):null;e.summary=i,e.diffs=a&&o?((e,t)=>{let r=new Map,n=new Map;Q(e,"","",r),Q(t,"","",n);let a=[];for(let e of new Set([...r.keys(),...n.keys()])){let t=r.get(e),i=n.get(e);t?.text!==i?.text&&a.push({label:(i??t).label,before:t?.text??"",after:i?.text??""})}return a})(a,o):[],e.status="pending"}catch(t){e.summary=R(t),e.status="failed"}ta(e),ts(),td()},tv=async e=>{if(e!==e6())return;n.undo(),e.status="undone";let t=ti(e.prompt,e.uid);ts(),td(),es.focus(),await tf(t,S(o.retryPrompt,{prompt:e.prompt}))},tx=async()=>{let t=es.value.trim(),r=n.getState();if(!t||r.prompting)return;let a=ei.value.trim();if(e_&&!a)return ei.focus();let i=e_?null:r.selectedUid,s=e_?`${o.newPage} \xb7 ${a}`:i?e3(i):o.scopeEntry;en.appendChild(N(e,"p",{className:"bubble"},N(e,"span",{className:"visually-hidden",textContent:`${o.you} (${s}): `}),t)),es.value="",tl();let l=ti(t,i);if(ts(),td(),e_){try{await n.createPage(a,t),k.forget(),l.summary=o.created,l.status="kept"}catch(e){l.summary=R(e),l.status="failed"}ta(l),ts()}else await tf(l,t);es.focus()},ty=async e=>{eW=null;let t=await F(n,e);eW=t?{kind:"error",action:e,text:t}:{kind:"save"===e?"saved":"published"},ts()};eP.addEventListener("click",()=>tp(!eD)),x.addEventListener("click",()=>tp(!1)),eU.addEventListener("click",()=>{eH=!eH,ts()}),eI.addEventListener("click",()=>n.signOut()),b.addEventListener("click",()=>tg(!eV)),C.addEventListener("click",()=>tu(!0)),V.addEventListener("click",()=>tu(!1)),H.addEventListener("click",()=>{n.select(null),es.focus()}),ef.addEventListener("click",()=>{n.select(null),e2()}),et.addEventListener("click",async()=>{eX=null,eX=await q(n,o),ts()}),y.addEventListener("click",()=>tc("ask"===eq?"fields":"ask")),z.addEventListener("click",()=>{tb(!1),tc("fields"),e2()}),I.addEventListener("click",()=>{for(let e=e6();e;e=e6())tm(e,!1);tc("fields"),e2()}),ek.addEventListener("click",()=>{let e=n.getState().undoSteps,t=void 0===e?void 0:eK.find(t=>"kept"===t.status&&t.step===e);if(n.undo(),t){var r;t.status="undone",ts(),r=`${o.undone}: ${t.summary}`,eA.textContent="",eA.textContent=r}ek.hidden&&es.focus()}),eE.addEventListener("click",()=>void ty("save")),eC.addEventListener("click",()=>void ty("publish")),eu.addEventListener("submit",e=>{e.preventDefault(),tx()}),es.addEventListener("input",()=>{tl(),ts()}),es.addEventListener("keydown",e=>{"Enter"!==e.key||e.shiftKey||e.isComposing||(e.preventDefault(),tx())}),ei.addEventListener("input",ts),ei.addEventListener("keydown",e=>{"Enter"!==e.key||e.isComposing||(e.preventDefault(),es.focus())});let tw=e=>{"Escape"===e.key&&!e.defaultPrevented&&th()&&e.preventDefault()};e.addEventListener("keydown",tw);let tk=e=>{let r=e.target,n=r?.closest?.(`[${t}]`),a=n?.getAttribute(t)??null;a!==eZ&&(eZ=a,te())},tE=()=>{eZ=null,te()};e.addEventListener("pointerover",tk),l.addEventListener("pointerleave",tE),s?.addEventListener("scroll",te,{capture:!0,passive:!0}),s?.addEventListener("resize",te);let tC=s?.MutationObserver,tN="function"==typeof tC?new tC(te):null;tN?.observe(e.body,{childList:!0,subtree:!0});let tA=s?.ResizeObserver,tL="function"==typeof tA?new tA(te):null;tL?.observe(l);let tP=s?.matchMedia?.("(min-width: 768px)")??null;eJ=tP?.matches??!0;let tS=()=>{eJ=tP?.matches??!0,ts()};tP?.addEventListener?.("change",tS);let t$=n.on("change",to);return l.setAttribute("data-obelism-editor",""),e.head.appendChild(u),e.body.appendChild(p),ts(),()=>{e0=!0,t$(),e1.unmount(),null!==e9&&s?.cancelAnimationFrame?.(e9),e.removeEventListener("keydown",tw),e.removeEventListener("pointerover",tk),l.removeEventListener("pointerleave",tE),s?.removeEventListener("scroll",te,{capture:!0}),s?.removeEventListener("resize",te),tP?.removeEventListener?.("change",tS),tN?.disconnect(),tL?.disconnect(),n.setSelecting(!1),l.removeAttribute("data-obelism-editor"),l.removeAttribute("data-obelism-docked"),l.style.removeProperty("--obelism-dock"),u.remove(),p.remove()}},et=Symbol.for("@obelism/content/bridge"),er=C({isEditing:!1,entryId:null,on:()=>{}},new URLSearchParams),en=({url:e,prompt:p=!0,pagePath:c,productPath:b,collectionPath:x}={})=>{let y;if("u"<typeof window)return er;let N=window;if(N[et])return N[et];if(N.ObelismBridge)y=C(N.ObelismBridge,new URLSearchParams(N.location.search));else{let C=(y=((e,r)=>{let n,a,p,c,b,x=new URLSearchParams(e.location.search),y=e.parent!==e&&x.has("cms_preview"),C=v(),N=[],A={...f,selecting:!0},L=e=>{A={...A,...e},C.emit("change",A)},P={isEditing:y,mode:y?"editor":null,entryId:x.get("cms_entry"),environment:x.get(i),product:null,collection:null,on:C.on,getState:()=>A,...w,destroy:()=>{N.splice(0).forEach(e=>e())}};if(!y)return P;let S=e.document,$=(t,n={})=>{e.parent.postMessage({source:h,type:t,...n},r)},M=S.createElement("style");M.textContent=m(),S.head.appendChild(M),N.push(()=>M.remove());let U=(e,t)=>{if(S.querySelectorAll("[data-cms-selected]").forEach(e=>{e.removeAttribute("data-cms-selected")}),A.selectedUid!==(e??null)&&L({selectedUid:e??null}),!e)return;let r=S.querySelector(E(e));r&&(r.setAttribute("data-cms-selected",""),t&&r.scrollIntoView({behavior:"smooth",block:"center"}))},z=e=>{let r=e.target,n=r?.closest?.(`[${t}]`);if(!n)return;e.preventDefault(),e.stopPropagation();let a=n.getAttribute(t);U(a,!1),$("select",{uid:a})};S.addEventListener("click",z,!0),N.push(()=>S.removeEventListener("click",z,!0));let I=()=>Math.ceil(Math.max(S.documentElement.scrollHeight,S.body?.scrollHeight??0)),O=0,j=()=>{O=I(),$("ready",{url:e.location.href,height:O})},R=e.ResizeObserver;if("function"==typeof R){let e=new R(()=>{let e=I();e!==O&&(O=e,$("size",{height:e}))});e.observe(S.documentElement),S.body&&e.observe(S.body),N.push(()=>e.disconnect())}let T=new Map,D=0,q=e=>{let t=T.get(e);return t?(clearTimeout(t.timer),T.delete(e),0===T.size&&L({prompting:!1}),t):null};P.prompt=(e,t={})=>{let r=e.trim();if(!r)return Promise.reject(Error("Say what to change"));if(!A.features.includes("prompt"))return Promise.reject(Error("The editor does not offer prompts here"));let n=`prompt_${++D}`,a=void 0===t.uid?A.selectedUid:t.uid;return new Promise((e,t)=>{let i=setTimeout(()=>{q(n)?.reject(Error("The editor did not answer in time"))},12e4);T.set(n,{resolve:e,reject:t,timer:i}),L({prompting:!0}),$("prompt",{id:n,prompt:r,uid:a})})},P.undo=()=>$("undo"),P.select=e=>{U(e,!1),$("select",{uid:e})};let F=null;N.push(()=>F?.destroy()),N.push(()=>{for(let e of T.keys())q(e)?.reject(Error("The bridge was destroyed"))});let B=(n=new WeakSet,a=null,p=null,c=!1,b=()=>{if(null!==a){for(let e of Array.from(S.styleSheets)){let t;if(!n.has(e)){try{t=e.cssRules}catch{continue}n.add(e),g(t,a)}}S.querySelectorAll('[style*="vh"]').forEach(e=>{u(e.style,a)})}},{freeze(e){if(null!==a||!(e>0))return;a=e,b();let t=S.defaultView?.MutationObserver;t&&(p=new t(()=>{if(c)return;c=!0;let e=()=>{c=!1,b()};S.defaultView?.requestAnimationFrame?S.defaultView.requestAnimationFrame(e):e()})).observe(S.documentElement,{childList:!0,subtree:!0})},destroy(){p?.disconnect()}});N.push(()=>B.destroy());let _=t=>{if(t.origin!==r||t.source!==e.parent)return;let n=t.data;if(n&&"obelism-content-editor"===n.source){if("connect"===n.type)j();else if("update"===n.type&&n.entry)C.emit("update",{entry:n.entry,selectedUid:n.selectedUid??null}),e.requestAnimationFrame(()=>U(n.selectedUid,!1)),F?.refresh();else if("select"===n.type)U(n.uid,!0);else if("saved"===n.type||"published"===n.type)C.emit(n.type,{}),0===C.listeners.update.size&&e.location.reload();else if("features"===n.type&&Array.isArray(n.features))L({features:n.features.filter(e=>"string"==typeof e)});else if("stats"===n.type)L({stats:(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return{};let t={};for(let[r,n]of Object.entries(e)){let{clicks:e,clickers:a,viewers:i,rate:o}=n??{};k(e)&&k(a)&&k(i)&&k(o)&&(t[r]={clicks:e,clickers:a,viewers:i,rate:o})}return t})(n.stats),statsVisible:!1!==n.visible}),(F||Object.keys(A.stats).length)&&(F??(F=((e,{selector:t,onSelect:r,labels:n})=>{let a=e.document,i={...o,...n},p=a.createElement("div");p.setAttribute("data-obelism-stats","");let c=p.attachShadow({mode:"open"}),u=a.createElement("style");u.textContent=l;let g=a.createElement("div");g.className="layer",c.append(u,g),a.body.appendChild(p);let h={},b=!1,m=null,f=()=>{if(m=null,g.replaceChildren(),g.hidden=!b,!b)return;let n=e.innerHeight;for(let[o,l]of Object.entries(h)){let p=a.querySelector(t(o));if(!p)continue;let c=p.getBoundingClientRect();if(!c.width&&!c.height||c.bottom<0||c.top>n)continue;let u=a.createElement("button");u.type="button",u.className="badge",u.dataset.uid=o,u.textContent=s(i.clicked,{rate:Math.round(100*l.rate)}),u.title=s(i.title,{clickers:l.clickers,viewers:l.viewers,clicks:l.clicks});let{place:h,top:b,left:m}=d(c,e.innerWidth);u.dataset.place=h,u.style.top=`${b}px`,u.style.left=`${m}px`,u.addEventListener("click",()=>r(o)),g.appendChild(u)}},v=()=>{null===m&&b&&(m=e.requestAnimationFrame(f))};e.addEventListener("scroll",v,{capture:!0,passive:!0}),e.addEventListener("resize",v);let x=e.MutationObserver,y="function"==typeof x?new x(v):null;return y?.observe(a.body,{childList:!0,subtree:!0}),{update(t,r){h=t,b=r,null!==m&&(e.cancelAnimationFrame?.(m),m=null),f()},refresh:v,destroy(){null!==m&&e.cancelAnimationFrame?.(m),e.removeEventListener("scroll",v,{capture:!0}),e.removeEventListener("resize",v),y?.disconnect(),p.remove()}}})(e,{selector:E,onSelect:e=>P.select(e)})),F.update(A.stats,A.statsVisible));else if("viewport"===n.type&&"number"==typeof n.height)B.freeze(n.height);else if("promptState"===n.type)L({canUndo:!0===n.canUndo});else if("promptResult"===n.type&&"string"==typeof n.id){let e=q(n.id);if(!e)return;!0===n.ok?e.resolve({summary:"string"==typeof n.summary?n.summary:""}):e.reject(Error("string"==typeof n.error?n.error:"The prompt failed"))}}};return e.addEventListener("message",_),N.push(()=>e.removeEventListener("message",_)),"loading"===S.readyState?(S.addEventListener("DOMContentLoaded",j,{once:!0}),N.push(()=>S.removeEventListener("DOMContentLoaded",j))):j(),P})(N,new URL(e||V).origin)).isEditing||N.parent!==N?null:(e=>{for(let t of e.cookie.split(";")){let[e,...r]=t.trim().split("=");if("obelism_content_editing"===e)try{let e=decodeURIComponent(r.join("="));return W.test(e)?e:null}catch{break}}return null})(N.document);if(C&&(y=((e,i,{pagePath:o=e=>`/${e.replace(/^\/+/,"")}`,productPath:s,collectionPath:l}={})=>{let d=e.document,p=v(),c=[],u=new Map,g=[],b=new Set,x=null,y=null,w=-1/0,k=new Map,C=f,N=e=>{C={...C,...e},p.emit("change",C)},A=()=>N({unsaved:[...u.values()].some(({content:e,saved:t})=>!X(e,t)),canUndo:g.length>0,undoSteps:g.length}),L=async(t,r)=>{let n=await e.fetch(`${i}/api/${t}`,void 0===r?{credentials:"same-origin"}:{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json","x-obelism-content":"1"},body:JSON.stringify(r)}),a=await n.json().catch(()=>({}));if(401===n.status)throw N({features:[]}),Error("You were signed out. Sign in again to edit.");if(!n.ok)throw Error("string"==typeof a.error?a.error:`Obelism Content answered ${n.status}`);return a},P=()=>d.querySelector(`[${r}]`)?.getAttribute(r)??null,S=()=>{let e=d.querySelector(`[${n}]`),t=e?.getAttribute(n),r=e?.getAttribute("data-cms-product-handle");return t&&r?{id:t,handle:r}:null},$=()=>{let e=d.querySelector(`[${a}]`),t=e?.getAttribute(a),r=e?.getAttribute("data-cms-collection-handle");return t&&r?{id:t,handle:r}:null},M=e=>{let t=e?d.querySelector(E(e)):null;return t?.closest(`[${r}]`)?.getAttribute(r)??P()},U=()=>{if(!x)return;let e=x.space.locales.map(({code:e})=>e),t=d.documentElement.lang;if(e.includes(t))return t;let r=t.split("-")[0]??"";return e.includes(r)?r:x.space.defaultLocale},z=new Map,I=async e=>{let t=u.get(e);if(t)return t;let r=z.get(e);return r||(r=L(`entries/${encodeURIComponent(e)}`).then(t=>{let r=u.get(e)??{content:t.content,saved:t.content,revision:t.draftRevision};return u.set(e,r),r}).finally(()=>z.delete(e)),z.set(e,r)),r},O=e=>{let t=void 0===e?C.selectedUid:e,r=M(t);if(!r)throw Error("Nothing on this page is marked as an entry: add editable(entry)");return{uid:t,entryId:r}},j=e=>{d.querySelectorAll("[data-cms-selected]").forEach(e=>{e.removeAttribute("data-cms-selected")}),C.selectedUid!==e&&N({selectedUid:e}),e&&d.querySelector(E(e))?.setAttribute("data-cms-selected","")},R=async t=>{if(0===p.listeners.update.size)return;let r=u.get(t)?.content,{entry:n}=await L(`entries/${encodeURIComponent(t)}/preview`,{content:r,locale:U()});p.emit("update",{entry:n,selectedUid:C.selectedUid}),e.requestAnimationFrame(()=>j(C.selectedUid))},T=e=>console.error("[@obelism/content bridge]",e),D=t=>{p.emit(t,{}),0===p.listeners.update.size&&e.location.reload()},q=async()=>{for(let[e,t]of u){if(X(t.content,t.saved))continue;let{draftRevision:r}=await L(`entries/${encodeURIComponent(e)}/save`,{content:t.content,baseRevision:t.revision});t.saved=t.content,t.revision=r,b.add(e)}g.length=0,w=-1/0,A()},F={isEditing:!0,mode:"site",get entryId(){return P()},get product(){return S()},get collection(){return $()},get environment(){return x?.environment??null},on:p.on,getState:()=>C,async prompt(e,t={}){let r=e.trim();if(!r)throw Error("Say what to change");if(!C.features.includes("prompt"))throw Error("You may not edit content here");let{uid:n,entryId:a}=O(t.uid);N({prompting:!0});try{let e=await I(a),t=await L(`entries/${encodeURIComponent(a)}/prompt`,{prompt:r,content:e.content,locale:U(),uid:n});return g.push({entryId:a,content:e.content}),w=-1/0,e.content=t.content,A(),await R(a),{summary:t.summary}}finally{N({prompting:!1})}},async createPage(t,r){let n=r.trim();if(!n)throw Error("Say what the page is for");if(!t.trim())throw Error("Say where the page goes, like /pricing");if(!C.features.includes("create"))throw Error("You may not add pages here");if(C.unsaved)throw Error("Save or undo your changes before adding a page");N({prompting:!0});try{let r=await L("entries",{path:t,prompt:n,locale:U(),from:P()}),a=o(r.path,U()??"");return e.location.assign(Y(a)),{summary:r.summary,entryId:r.entryId,path:r.path,url:a}}finally{N({prompting:!1})}},async createProductPage(t=S()??void 0){if(!t)throw Error("Nothing on this page is marked as a product: add editableProduct(product)");if(!C.features.includes("create"))throw Error("You may not add pages here");if(C.unsaved)throw Error("Save or undo your changes before adding a page");N({prompting:!0});try{let r=await L("product-pages",{product:{id:t.id,handle:t.handle}});return e.location.reload(),r}finally{N({prompting:!1})}},async createCollectionPage(t=$()??void 0){if(!t)throw Error("Nothing on this page is marked as a collection: add editableCollection(collection)");if(!C.features.includes("create"))throw Error("You may not add pages here");if(C.unsaved)throw Error("Save or undo your changes before adding a page");N({prompting:!0});try{let r=await L("collection-pages",{collection:{id:t.id,handle:t.handle}});return e.location.reload(),r}finally{N({prompting:!1})}},async view(e={}){let{uid:t,entryId:r}=O(e.uid),n=await I(r),{view:a}=await L(`entries/${encodeURIComponent(r)}/view`,{content:n.content,locale:U(),uid:t});return a},async applyJson(e,t={}){if(!C.features.includes("prompt"))throw Error("You may not edit content here");if(!e||"object"!=typeof e||Array.isArray(e))throw Error("Send the fields to change as an object");let{uid:r,entryId:n}=O(t.uid);N({prompting:!0});try{let t=await I(n),a=await L(`entries/${encodeURIComponent(n)}/apply`,{changes:e,content:t.content,locale:U(),uid:r});return X(a.content,t.content)||(g.push({entryId:n,content:t.content}),w=-1/0,t.content=a.content,A(),await R(n)),{changed:a.changed??[],...a.view&&{view:a.view}}}finally{N({prompting:!1})}},openForm(t,r={}){let{title:n="Content form",onReady:a,onError:i,onEscape:o}=r;y?.();let s=!1,l=null,d=null,c=()=>{},b=e=>{s||i?.(e instanceof Error?e.message:String(e))},m=()=>{s||(s=!0,c(),l?.destroy(),y===m&&(y=null))};y=m;let f=()=>{if(s||!l)return;let e=M(C.selectedUid);if(!e)return;let t=u.get(e);if(!t)return void I(e).then(f,b);let r={entryId:e,content:t.content,locale:U(),selectedUid:C.selectedUid};d&&d.entryId===r.entryId&&d.content===r.content&&d.locale===r.locale&&d.selectedUid===r.selectedUid||(d=r,l.show(r))},v=(e,t)=>{let r=t??d?.entryId,n=void 0===r?void 0:u.get(r);if(s||void 0===r||!n||X(e,n.content))return;let a=Date.now();a-w>=1e3&&g.push({entryId:r,content:n.content}),w=a,n.content=e,d?.entryId===r&&(d={...d,content:e}),A(),clearTimeout(k.get(r)),k.set(r,setTimeout(()=>{k.delete(r),R(r).catch(T)},300))};return(async()=>{if(!C.features.includes("form"))throw Error("You may not edit content here");await I(O(void 0).entryId);let{url:r}=await L("form",{});s||(l=((e,t,r,n,a)=>{let i=null;try{i=new URL(r)}catch{}if(!i||!/^https?:$/.test(i.protocol))throw Error("Obelism Content sent no form to open");let o=i.origin,s=t.ownerDocument.createElement("iframe");s.title=n,s.src=r;let l=!1,d=!1,p=null,c=()=>{l&&p&&s.contentWindow?.postMessage({source:h,type:"content",...p},o)},u=setTimeout(()=>{d||a.onError("The form did not open")},3e4),g=()=>{d=!0,clearTimeout(u),a.onReady()},b=e=>{if(e.origin!==o||!s.contentWindow||e.source!==s.contentWindow)return;let t=e.data;if(t&&"obelism-content-form"===t.source)if("ready"===t.type)l=!0,c(),!0!==t.loading&&g();else if("loaded"===t.type)l&&g();else{let e;if("change"!==t.type||!(e=t.content)||"object"!=typeof e||Array.isArray(e))if("height"===t.type){let e=t.height;if("number"==typeof e&&Number.isFinite(e)){let t=Math.round(Math.min(Math.max(e,80),4e3));s.style.height=`min(${t}px, 60vh)`}}else"escape"===t.type?a.onEscape?.():"error"===t.type&&a.onError("string"==typeof t.message&&t.message?t.message:"The form failed");else a.onChange(t.content,"string"==typeof t.entryId?t.entryId:void 0)}};return e.addEventListener("message",b),t.appendChild(s),{show(e){p=e,c()},destroy(){clearTimeout(u),e.removeEventListener("message",b),s.remove()}}})(e,t,"string"==typeof r?r:"",n,{onReady:()=>a?.(),onChange:v,onError:e=>i?.(e),onEscape:()=>o?.()}),c=p.on("change",f),f())})().catch(b),{close:m}},async pages(){let{pages:e}=await L("pages"),t=[U(),x?.space.defaultLocale];return e.flatMap(e=>{let r,n,a=t.find(t=>void 0!==t&&void 0!==e.paths[t])??Object.keys(e.paths)[0],i=void 0===a?void 0:e.paths[a];return void 0===a||void 0===i?[]:[{entryId:e.entryId,name:e.name,contentType:e.contentType,status:e.status,path:i,url:e.product?(r=e.product.handle,s?s(r,a):(x?.productPath??"/products/{handle}").replaceAll("{handle}",encodeURIComponent(r))):e.collection?(n=e.collection.handle,l?l(n,a):(x?.collectionPath??"/collections/{handle}").replaceAll("{handle}",encodeURIComponent(n))):o(i,a),product:e.product??null,collection:e.collection??null}]})},openPage(t){(!C.unsaved||e.confirm("Leave this page and lose the changes you have not saved?"))&&(u.clear(),g.length=0,A(),e.location.assign(Y(t.url)))},undo(){let e=g.pop(),t=e&&u.get(e.entryId);e&&t&&(w=-1/0,t.content=e.content,A(),R(e.entryId).catch(T))},async save(){if(!C.features.includes("save"))throw Error("You may not edit content here");N({saving:!0});try{await q()}finally{N({saving:!1})}D("saved")},async publish(){if(!C.features.includes("publish"))throw Error("You may not publish here");N({publishing:!0});try{await q();let e=P(),t=b.size>0?[...b]:e?[e]:[];if(0===t.length)throw Error("Nothing on this page is marked as an entry: add editable(entry)");for(let e of t)await L(`entries/${encodeURIComponent(e)}/publish`,{}),b.delete(e)}finally{N({publishing:!1})}D("published")},signOut(){if(C.unsaved&&!e.confirm("Sign out and lose the changes you have not saved?"))return;u.clear(),A();let t=e.location.pathname+e.location.search;e.location.href=`${i}/logout?return_to=${encodeURIComponent(t)}`},select(e){j(e)},setSelecting(e){e?d.documentElement.setAttribute("data-cms-selecting",""):d.documentElement.removeAttribute("data-cms-selecting"),N({selecting:e})},destroy(){y?.(),k.forEach(e=>clearTimeout(e)),k.clear(),c.splice(0).forEach(e=>e())}},B=d.createElement("style");B.textContent=m("html[data-cms-selecting] "),d.head.appendChild(B),c.push(()=>B.remove()),c.push(()=>d.documentElement.removeAttribute("data-cms-selecting"));let _=e=>{if(!C.selecting)return;let r=e.target,n=r?.closest?.(`[${t}]`);n&&(e.preventDefault(),e.stopPropagation(),j(n.getAttribute(t)))};d.addEventListener("click",_,!0),c.push(()=>d.removeEventListener("click",_,!0));let H=e=>{C.unsaved&&(e.preventDefault(),e.returnValue="")};return e.addEventListener("beforeunload",H),c.push(()=>e.removeEventListener("beforeunload",H)),L("session").then(e=>{x=e,N({features:e.features})}).catch(e=>console.error("[@obelism/content bridge]",e)),F})(N,C,{pagePath:c,productPath:b,collectionPath:x})),y.isEditing&&p){let e=N.document,t=()=>{},r=!1,n=C?ee:H,a=()=>{r||(t=n(e,y,!0===p?{}:p))};e.body?a():e.addEventListener("DOMContentLoaded",a,{once:!0});let i=y.destroy;y.destroy=()=>{r=!0,e.removeEventListener("DOMContentLoaded",a),t(),i()}}}return N[et]=y,y};(e=window).ObelismBridge=en((e=>{let t=e?.dataset.url,r=t||V;if(!t&&e?.src){let t=new URL(e.src);"/bridge.js"===t.pathname&&(r=t.origin)}return{url:r,prompt:e?.dataset.prompt!=="false"}})(document.currentScript)),e.ObelismContent={getContentBridge:en,mountPromptBox:H,mountSiteEditor:ee}}();
package/dist/bridge.js CHANGED
@@ -2845,7 +2845,9 @@ textarea:disabled, .path input:disabled { opacity: .6; }
2845
2845
  .send .icon svg { stroke-width: 2; }
2846
2846
  .send .working svg, .send .working .accent { fill: rgb(var(--ink)); }
2847
2847
 
2848
- .form { position: relative; flex: 1; min-height: 0; margin: 12px 14px 0; }
2848
+ .fields { padding-top: 12px; }
2849
+ .fields .note { margin: 0 14px 14px; }
2850
+ .form { position: relative; flex: 1; min-height: 0; margin: 0 14px; }
2849
2851
  .form iframe {
2850
2852
  display: block; width: 100%; height: 100% !important; border: 0; border-radius: 12px; background: rgb(var(--subtle));
2851
2853
  }
@@ -3133,10 +3135,16 @@ const mountSiteEditor = (doc, bridge, options = {})=>{
3133
3135
  const formBox = element(doc, 'div', {
3134
3136
  className: 'form'
3135
3137
  }, formNote);
3138
+ // The same way back as the ask view's note, above the form it changes.
3139
+ const fieldsNoteText = element(doc, 'span');
3140
+ const wholePageFields = button('', labels.scopeEntry);
3141
+ const fieldsNote = element(doc, 'div', {
3142
+ className: 'note'
3143
+ }, icon('scope'), fieldsNoteText, wholePageFields);
3136
3144
  const fields = element(doc, 'div', {
3137
3145
  className: 'fields',
3138
3146
  id: 'obelism-fields'
3139
- }, formBox);
3147
+ }, fieldsNote, formBox);
3140
3148
  fields.setAttribute('role', 'tabpanel');
3141
3149
  fields.setAttribute('aria-label', labels.form);
3142
3150
  const saveState = element(doc, 'p', {
@@ -3538,12 +3546,16 @@ const mountSiteEditor = (doc, bridge, options = {})=>{
3538
3546
  noteText.textContent = labels.newPage;
3539
3547
  } else if (state.selectedUid) {
3540
3548
  const [beforeName, afterName = ''] = labels.scopeNoteBlock.split('{name}');
3541
- noteText.replaceChildren(beforeName ?? '', element(doc, 'strong', {
3549
+ for (const text of [
3550
+ noteText,
3551
+ fieldsNoteText
3552
+ ])text.replaceChildren(beforeName ?? '', element(doc, 'strong', {
3542
3553
  textContent: nameOf(state.selectedUid)
3543
3554
  }), afterName);
3544
3555
  } else {
3545
3556
  noteText.textContent = labels.scopeNotePage;
3546
3557
  }
3558
+ fieldsNote.hidden = creating || !state.selectedUid;
3547
3559
  note.hidden = offerShop || pageless && !creating && !options.promptWithoutPage;
3548
3560
  wholePage.hidden = creating || !state.selectedUid;
3549
3561
  cancelNew.hidden = !creating || onlyNew;
@@ -3779,6 +3791,10 @@ const mountSiteEditor = (doc, bridge, options = {})=>{
3779
3791
  bridge.select(null);
3780
3792
  input.focus();
3781
3793
  });
3794
+ wholePageFields.addEventListener('click', ()=>{
3795
+ bridge.select(null);
3796
+ focusForm();
3797
+ });
3782
3798
  shopButton.addEventListener('click', async ()=>{
3783
3799
  shopMessage = null;
3784
3800
  shopMessage = await addShopPage(bridge, labels);
package/dist/bridge.mjs CHANGED
@@ -2843,7 +2843,9 @@ textarea:disabled, .path input:disabled { opacity: .6; }
2843
2843
  .send .icon svg { stroke-width: 2; }
2844
2844
  .send .working svg, .send .working .accent { fill: rgb(var(--ink)); }
2845
2845
 
2846
- .form { position: relative; flex: 1; min-height: 0; margin: 12px 14px 0; }
2846
+ .fields { padding-top: 12px; }
2847
+ .fields .note { margin: 0 14px 14px; }
2848
+ .form { position: relative; flex: 1; min-height: 0; margin: 0 14px; }
2847
2849
  .form iframe {
2848
2850
  display: block; width: 100%; height: 100% !important; border: 0; border-radius: 12px; background: rgb(var(--subtle));
2849
2851
  }
@@ -3131,10 +3133,16 @@ const mountSiteEditor = (doc, bridge, options = {})=>{
3131
3133
  const formBox = element(doc, 'div', {
3132
3134
  className: 'form'
3133
3135
  }, formNote);
3136
+ // The same way back as the ask view's note, above the form it changes.
3137
+ const fieldsNoteText = element(doc, 'span');
3138
+ const wholePageFields = button('', labels.scopeEntry);
3139
+ const fieldsNote = element(doc, 'div', {
3140
+ className: 'note'
3141
+ }, icon('scope'), fieldsNoteText, wholePageFields);
3134
3142
  const fields = element(doc, 'div', {
3135
3143
  className: 'fields',
3136
3144
  id: 'obelism-fields'
3137
- }, formBox);
3145
+ }, fieldsNote, formBox);
3138
3146
  fields.setAttribute('role', 'tabpanel');
3139
3147
  fields.setAttribute('aria-label', labels.form);
3140
3148
  const saveState = element(doc, 'p', {
@@ -3536,12 +3544,16 @@ const mountSiteEditor = (doc, bridge, options = {})=>{
3536
3544
  noteText.textContent = labels.newPage;
3537
3545
  } else if (state.selectedUid) {
3538
3546
  const [beforeName, afterName = ''] = labels.scopeNoteBlock.split('{name}');
3539
- noteText.replaceChildren(beforeName ?? '', element(doc, 'strong', {
3547
+ for (const text of [
3548
+ noteText,
3549
+ fieldsNoteText
3550
+ ])text.replaceChildren(beforeName ?? '', element(doc, 'strong', {
3540
3551
  textContent: nameOf(state.selectedUid)
3541
3552
  }), afterName);
3542
3553
  } else {
3543
3554
  noteText.textContent = labels.scopeNotePage;
3544
3555
  }
3556
+ fieldsNote.hidden = creating || !state.selectedUid;
3545
3557
  note.hidden = offerShop || pageless && !creating && !options.promptWithoutPage;
3546
3558
  wholePage.hidden = creating || !state.selectedUid;
3547
3559
  cancelNew.hidden = !creating || onlyNew;
@@ -3777,6 +3789,10 @@ const mountSiteEditor = (doc, bridge, options = {})=>{
3777
3789
  bridge.select(null);
3778
3790
  input.focus();
3779
3791
  });
3792
+ wholePageFields.addEventListener('click', ()=>{
3793
+ bridge.select(null);
3794
+ focusForm();
3795
+ });
3780
3796
  shopButton.addEventListener('click', async ()=>{
3781
3797
  shopMessage = null;
3782
3798
  shopMessage = await addShopPage(bridge, labels);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@obelism/content",
3
3
  "description": "Obelism Content SDK: the delivery API client, the visual editor bridge with prompt editing, editing on your own site, webhook verification, and the content model CLI",
4
- "version": "0.27.1",
4
+ "version": "0.27.2",
5
5
  "keywords": [
6
6
  "cms",
7
7
  "headless-cms",