@panphora/hyper-cms 0.8.1 → 0.11.0
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 +33 -0
- package/dist/hypercms.min.js +442 -36
- package/package.json +7 -4
- package/packed-contract.json +1 -0
- package/src/anchor.js +24 -0
- package/src/apply-loop.js +79 -46
- package/src/enhance.js +79 -6
- package/src/events.js +102 -8
- package/src/hooks.js +100 -0
- package/src/hypercms-clayjs.js +10 -0
- package/src/hypercms.js +109 -379
- package/src/inline-icons.js +15 -0
- package/src/lib/content-dom.js +110 -0
- package/src/lib/region-capabilities.js +71 -0
- package/src/morph.js +1 -0
- package/src/place.js +131 -0
- package/src/platform.js +12 -0
- package/src/refresh.js +31 -14
- package/src/richclay-bridge.js +140 -0
- package/src/row-identity.js +109 -0
- package/src/session.js +303 -0
- package/src/shell.js +27 -6
- package/src/targets.js +149 -0
- package/src/theme/pixel-quiet.overrides.css +303 -9
- package/src/theme.generated.css +303 -9
- package/src/toggle.js +627 -34
- package/src/unresolved.js +87 -18
- package/src/views/inline-ghosts.js +139 -0
- package/src/views/inline-layer.js +663 -0
- package/src/views/inline.js +1092 -0
- package/src/views/sidebar.js +97 -0
package/dist/hypercms.min.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var hypercms=(()=>{var
|
|
2
|
-
`;)t++;continue}if(e[t]==="/"&&e[t+1]==="*"){let r=e.indexOf("*/",t+2);if(r===-1)return e.length;t=r+2;continue}return t}}function Pr(e){return e.replace(/\\'/g,"'").replace(/(\\*)"/g,(t,r)=>r.length%2===0?r+'\\"':t)}var Si=/^-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?$/,Ei=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function ot(e){try{return JSON.parse(e)}catch{return JSON.parse(Ci(e))}}function Ci(e){let t="",r=0,n=(i,o)=>{throw new Error(`Invalid relaxed JSON: ${i} at position ${o}`)};for(;r<e.length&&(r=Bt(e,r),!(r>=e.length));){let i=e[r];if("{}[]:".includes(i)){t+=i,r++;continue}if(i===","){let a=Bt(e,r+1);if(e[a]==="}"||e[a]==="]"){r++;continue}t+=i,r++;continue}if(i==='"'||i==="'"){let a=r+1;for(;a<e.length&&e[a]!==i;)e[a]==="\\"&&a++,a++;a>=e.length&&n("unterminated string",r);let l=e.slice(r+1,a);i==="'"&&(l=Pr(l)),t+='"'+l+'"',r=a+1;continue}let o=r;for(;o<e.length&&/[A-Za-z0-9_$.+\-]/.test(e[o]);)o++;o===r&&n("unexpected character "+JSON.stringify(i),r);let s=e.slice(r,o);if(s==="true"||s==="false"||s==="null"||Si.test(s)){t+=s,r=o;continue}if(Ei.test(s)){if(e[Bt(e,o)]===":"){t+='"'+s+'"',r=o;continue}n("unquoted value "+JSON.stringify(s),r)}n("invalid token "+JSON.stringify(s),r)}return t}function Br(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function r(i){let o=[],s=0;for(;s<i.length;){let a=i[s];if(/\s/.test(a)){s++;continue}if("{}".includes(a)){o.push({type:a,value:a}),s++;continue}if(a==="["){let g=!1,d=s+1;for(;d<i.length&&/\s/.test(i[d]);)d++;if(d<i.length&&/[a-zA-Z_]/.test(i[d])&&(g=!0),!g){o.push({type:a,value:a}),s++;continue}}if(a==="]"){o.push({type:a,value:a}),s++;continue}if(a===":"){o.push({type:t.COLON,value:a}),s++;continue}if(a===","){o.push({type:t.COMMA,value:a}),s++;continue}if(a==='"'||a==="'"){let g=a,d=s+1;for(;d<i.length&&i[d]!==g;)i[d]==="\\"&&d++,d++;o.push({type:t.STRING,value:i.substring(s+1,d),quoted:!0,sourceQuote:g}),s=d+1;continue}let l=s,c;for(;l<i.length&&!/[{},]/.test(i[l]);)if(i[l]===":"){let g=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],d=!1;for(let k of g){let y=k.substring(1);if(i.substring(l+1,l+1+y.length)===y){d=!0,l+=y.length;break}}if(!d)break}else if(i[l]==="["){for(l++;l<i.length&&i[l]!=="]";){if(i[l]==='"'||i[l]==="'"){let g=i[l];for(l++;l<i.length&&i[l]!==g;)i[l]==="\\"&&l++,l++}l++}l<i.length&&i[l]==="]"&&l++}else l++;c=i.substring(s,l);let u=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(c)?u=t.NUMBER:c==="true"||c==="false"||c==="null"?u=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(c)&&(u=t.SELECTOR),o.push({type:u,value:c,quoted:!1}),s=l}return o}function n(i){let o="";for(let s=0;s<i.length;s++){let a=i[s];if("{}".includes(a.type)||"[]".includes(a.type)){o+=a.value;continue}if(a.type===t.COLON){o+=a.value;continue}if(a.type===t.COMMA){let l=i[s+1];if(l&&(l.type==="}"||l.type==="]"))continue;o+=a.value;continue}if(a.type===t.STRING){let l=a.value;a.sourceQuote==="'"&&(l=Pr(l)),o+=`"${l}"`;continue}if(a.type===t.NUMBER||a.type===t.BOOLEAN){o+=a.value;continue}o+=`"${a.value}"`}return o}try{let i=r(e),o=n(i);return JSON.parse(o)}catch(i){throw new Error("Invalid extraction rules syntax: "+i.message)}}var J=Symbol("hyper-morph-json-merge:missing"),Ur=["id","_id","uuid","key","slug","code","name"];function Ce(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function He(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ti(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,writable:!0,configurable:!0})}function be(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!be(e[r],t[r]))return!1;return!0}if(Ce(e)&&Ce(t)){let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n of r)if(!He(t,n)||!be(e[n],t[n]))return!1;return!0}return!1}function zr(e,t,r,n){return be(t,r)?t:be(t,e)?r:be(r,e)?t:Ce(t)&&Ce(r)?Ri(Ce(e)?e:{},t,r,n):Array.isArray(t)&&Array.isArray(r)?Ii(Array.isArray(e)?e:[],t,r,n):r}function Hr(e,t,r,n){return t===J&&r===J?J:t===J?e===J?r:be(r,e)?J:r:r===J?e===J?t:J:zr(e,t,r,n)}function Ri(e,t,r,n){let i={},o=new Set([...Object.keys(e),...Object.keys(t),...Object.keys(r)]);for(let s of o){let a=Hr(He(e,s)?e[s]:J,He(t,s)?t[s]:J,He(r,s)?r[s]:J,n);a!==J&&Ti(i,s,a)}return i}function Oi(e){return e===null||typeof e!="object"}function st(e){return typeof e+":"+String(e)}function Mi(e,t){for(let r of t){let n=new Set;for(let i of r){if(!He(i,e))return!1;let o=i[e];if(typeof o!="string"&&typeof o!="number")return!1;let s=st(o);if(n.has(s))return!1;n.add(s)}}return!0}function Ni(e,t,r,n){let i=[e,t,r],o=!0;for(let s of i)for(let a of s)Ce(a)||(o=!1);if(o){for(let s of n.keyCandidates)if(Mi(s,i))return{kind:"keyed",field:s};return null}for(let s of i){let a=new Set;for(let l of s){if(!Oi(l))return null;let c=st(l);if(a.has(c))return null;a.add(c)}}return{kind:"self"}}function Ii(e,t,r,n){let i=Ni(e,t,r,n);if(!i)return r;let o=i.kind==="self"?st:k=>st(k[i.field]),s=k=>{let y=new Map;for(let N of k)y.set(o(N),N);return y},a=s(e),l=s(t),c=s(r),u=new Map,g=new Set([...a.keys(),...l.keys(),...c.keys()]);for(let k of g){let y=Hr(a.has(k)?a.get(k):J,l.has(k)?l.get(k):J,c.has(k)?c.get(k):J,n);y!==J&&u.set(k,y)}let d=[];for(let k of r){let y=o(k);u.has(y)&&d.push(y)}for(let k=0;k<t.length;k++){let y=o(t[k]);if(!u.has(y)||d.includes(y))continue;let N=0;for(let q=k-1;q>=0;q--){let H=d.indexOf(o(t[q]));if(H!==-1){N=H+1;break}}d.splice(N,0,y)}return d.map(k=>u.get(k))}function Ut(e,t,r,n={}){let i=n.keyCandidates?[...n.keyCandidates,...Ur]:Ur;return zr(e===void 0?J:e,t,r,{keyCandidates:i})}function zt(e,t,r,n={}){let i=n.parse||ot,o=[],s=(g,d)=>{if(typeof g!="string")return J;try{return i(g)}catch(k){return o.push(`${d} side is not valid JSON (${k.message})`),J}},a=s(t,"local"),l=s(r,"remote");if(a===J)return{text:r,warnings:o};if(l===J)return{text:t,warnings:o};let c=s(e,"base"),u=Ut(c===J?void 0:c,a,l,n);return be(u,l)?{text:r,warnings:o}:be(u,a)?{text:t,warnings:o}:{text:JSON.stringify(u,null,2),warnings:o}}var Ve=(function(){"use strict";let e=()=>{},t='[save-ignore],[snapshot-remove],[no-snapshot],[no-save],[save-remove],[freeze],[save-freeze],[clay~="no-save"],[clay~="no-snapshot"],[clay~="freeze"]';function r(p){if(!(p instanceof Element))return!1;if(p.matches(t))return!0;if(p.tagName==="LINK"||p.tagName==="SCRIPT"){let T=p.getAttribute("src")||p.getAttribute("href")||"";if(T.startsWith("chrome-extension://")||T.startsWith("moz-extension://")||T.startsWith("safari-web-extension://"))return!0}return!1}function n(p){return p instanceof Element?p.closest(t)?!0:r(p):!1}let i=$r({shouldIgnore:n});function o(p,T,E){if(E){let O=E.identityOf(p);if(O&&!E.disabled.has(O.key))return"hm-merge:"+O.key}if(T!=="smart")return p.outerHTML;let R=p.getAttribute("src"),C=p.getAttribute("type")||"text/javascript";if(R)try{let O=new URL(R,window.location.href);return`ext:${C}:${O.origin}${O.pathname}${O.search}`}catch{return`ext:${C}:${R}`}else{let O=p.textContent.trim(),v=5381;for(let A=0;A<O.length;A++)v=(v<<5)+v^O.charCodeAt(A);return`inline:${C}:${Math.abs(v).toString(36)}`}}let s="http://www.w3.org/1999/xhtml";function a(p){return p instanceof Element&&p.tagName==="SCRIPT"&&p.namespaceURI===s}function l(p){let T=document.createElement("div");T.innerHTML="<script><\/script>";let E=T.firstChild;for(let R of p.attributes)E.setAttribute(R.name,R.value);return E.textContent=p.textContent,E}function c(p){if(a(p))return l(p);if(p instanceof Element)for(let T of p.querySelectorAll("script"))a(T)&&T.replaceWith(l(T));return p}function u(p){let T=(p.getAttribute("type")||"").split(";")[0].trim().toLowerCase();return T==="application/json"||T.endsWith("+json")}let g={match:p=>p.hasAttribute("merge"),identity:p=>p.getAttribute("merge")};function d(p,T,E){if(E.merge===!1)return null;let R=[g,...E.mergeTags||[]],C=new WeakMap,O=f=>{if(C.has(f))return C.get(f);let w=null;if(a(f)&&!f.getAttribute("src")&&!n(f)){let _=f;for(let I=0;I<R.length;I++)if(R[I].match(_)){if(!u(_))console.warn("[hyper-morph] merge ignored: script type is not JSON",_);else{let P=R[I].identity(_);P!=null&&P!==""&&(w={key:I+":"+P,raw:P,recognizer:R[I]})}break}}return C.set(f,w),w},v=new Set,A=f=>{let w=new Map,_=I=>{let P=O(I);P&&(w.has(P.key)?(v.add(P.key),console.warn(`[hyper-morph] merge disabled for duplicate identity "${P.raw}"`)):w.set(P.key,I))};a(f)&&_(f);for(let I of f.querySelectorAll("script"))_(I);return w},b=A(p),h=A(T.__hyperMorphRoot||T);if(b.size===0&&h.size===0)return null;let m=null;return{identityOf:O,disabled:v,oldByKey:b,newByKey:h,baseTexts:()=>{if(m)return m;m=new Map;let f=E.mergeBase;if(!f)return m;let w;typeof f=="string"?w=new DOMParser().parseFromString(f,"text/html").documentElement:f instanceof Document?w=f.documentElement:w=f;let _=I=>{let P=O(I);P&&!m.has(P.key)&&m.set(P.key,I.textContent)};a(w)&&_(w);for(let I of w.querySelectorAll("script"))_(I);return m}}}function k(p,T,E){let R=p.merge;if(!R)return!1;let C=R.identityOf(T);if(!C||R.disabled.has(C.key))return!1;let O=R.identityOf(E);if(!O||O.key!==C.key)return!1;let v=T,A=E,b=A.getAttribute("merge-key")||v.getAttribute("merge-key"),{text:h,warnings:m}=zt(R.baseTexts().get(C.key),v.textContent,A.textContent,{parse:C.recognizer.parse,keyCandidates:b?b.split(/[\s,]+/).filter(Boolean):void 0});for(let x of m)console.warn(`[hyper-morph] merge "${C.raw}": ${x}`);return v.textContent!==h&&(v.textContent=h),!0}let y={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:e,afterNodeAdded:e,beforeNodeMorphed:e,afterNodeMorphed:e,beforeNodeRemoved:e,afterNodeRemoved:e,beforeAttributeUpdated:e},head:{style:"merge",shouldPreserve:p=>p.getAttribute("im-preserve")==="true",shouldReAppend:p=>p.getAttribute("im-re-append")==="true",shouldRemove:e,afterHeadMorphed:e},scripts:{handle:!0,matchMode:"outerHTML",shouldPreserve:p=>p.getAttribute("im-preserve")==="true",shouldReAppend:p=>p.getAttribute("im-re-append")==="true",shouldRemove:e,afterScriptsHandled:e},restoreFocus:!0},N={computeMatches(p,T){let{computeMatches:E}=i.session();return E(p,T)}};function q(p,T,E={}){p=ii(p);let R=_r(T),C=ni(p,R,E),O=C.scripts.handle?new Set(Array.from(p.querySelectorAll("script")).map(h=>o(h,C.scripts.matchMode,C.merge))):null,v=ee(C),A=Q(C,p,R,h=>h.morphStyle==="innerHTML"?(U(h,p,R),Array.from(p.childNodes)):oe(h,p,R)),b=h=>{v&&le(C,v),H(C);let m=O?Lt(h,O,C):[];return m.length>0?Promise.all(m).then(()=>h):h};return A instanceof Promise?A.then(b):b(A)}function H(p){for(let T of Array.from(p.pantry.childNodes))p.callbacks.beforeNodeRemoved(T)!==!1&&p.callbacks.afterNodeRemoved(T);p.pantry.remove()}function oe(p,T,E){let R=_r(T);return U(p,R,E,T,T.nextSibling),Array.from(R.childNodes)}function ee(p){if(!p.config.restoreFocus)return null;let T=document.activeElement;if(!(T instanceof HTMLInputElement||T instanceof HTMLTextAreaElement))return null;let{id:E,selectionStart:R,selectionEnd:C}=T;return{element:T,id:E,selectionStart:R,selectionEnd:C}}function le(p,T){let E=T.element;if(T.id&&T.id!==document.activeElement?.getAttribute("id")&&(E=p.target.querySelector(`[id="${CSS.escape(T.id)}"]`),E?.focus()),E&&!E.selectionEnd&&T.selectionEnd!=null)try{E.setSelectionRange(T.selectionStart,T.selectionEnd)}catch{}}let U=(function(){function p(h,m,x,f=null,w=null){m instanceof HTMLTemplateElement&&x instanceof HTMLTemplateElement&&(m=m.content,x=x.content),f||=m.firstChild;for(let _ of x.childNodes){if(r(_))continue;if(f&&f!=w){let P=E(h,_,f,w);if(P){P!==f&&C(h,f,P),ie(P,_,h),f=P.nextSibling;continue}}if(_ instanceof Element){let P=_.getAttribute("id");if(h.persistentIds.has(P)){let S=O(m,P,f,h);ie(S,_,h),f=S.nextSibling;continue}if(!h.idMap.has(_)){let S=h.hyperMatches.get(_);if(S&&!h.idMap.has(S)&&!b(S,m)){A(m,S,f),ie(S,_,h),f=S.nextSibling;continue}}}let I=T(m,_,f,h);I&&(f=I.nextSibling)}for(;f&&f!=w;){let _=f;f=f.nextSibling,r(_)||R(h,_)}}function T(h,m,x,f){if(f.callbacks.beforeNodeAdded(m)===!1)return null;if(f.idMap.has(m)){let w=m,_=document.createElementNS(w.namespaceURI,w.localName);return h.insertBefore(_,x),ie(_,m,f),f.callbacks.afterNodeAdded(_),_}else{let w=c(document.importNode(m,!0));return h.insertBefore(w,x),f.callbacks.afterNodeAdded(w),w}}let E=(function(){function h(f,w,_,I){let P=w instanceof Element&&!f.idMap.has(w)?f.hyperMatches.get(w):null,S=null,M=w.nextSibling,V=0,D=_;for(;D&&D!=I;){if(r(D)){D=D.nextSibling;continue}if(x(D,w)){if(m(f,D,w)||D===P&&!f.idMap.has(D))return D;if(S===null){let W=D instanceof Element&&f.hyperMatchedOldElements.has(D);!f.idMap.has(D)&&!W&&(S=D)}}if(S===null&&M&&x(D,M)&&(V++,M=M.nextSibling,V>=2&&(S=void 0)),f.activeElementAndParents.includes(D))break;D=D.nextSibling}return S||null}function m(f,w,_){let I=f.idMap.get(w),P=f.idMap.get(_);if(!P||!I)return!1;for(let S of I)if(P.has(S))return!0;return!1}function x(f,w){let _=f,I=w;return _.nodeType===I.nodeType&&_.tagName===I.tagName&&(!_.getAttribute?.("id")||_.getAttribute?.("id")===I.getAttribute?.("id"))}return h})();function R(h,m){let x=m instanceof Element&&h.hyperMatchedOldElements.has(m)&&!h.idMap.has(m);if(h.idMap.has(m)||x)A(h.pantry,m,null);else{if(h.callbacks.beforeNodeRemoved(m)===!1)return;m.parentNode?.removeChild(m),h.callbacks.afterNodeRemoved(m)}}function C(h,m,x){let f=m;for(;f&&f!==x;){let w=f;f=f.nextSibling,r(w)||R(h,w)}return f}function O(h,m,x,f){let w=f.target.getAttribute?.("id")===m&&f.target||f.target.querySelector(`[id="${CSS.escape(m)}"]`)||f.pantry.querySelector(`[id="${CSS.escape(m)}"]`);return v(w,f),A(h,w,x),w}function v(h,m){let x=h.getAttribute("id");for(;h=h.parentNode;){let f=m.idMap.get(h);f&&(f.delete(x),f.size||m.idMap.delete(h))}}function A(h,m,x){if(h.moveBefore)try{h.moveBefore(m,x)}catch{h.insertBefore(m,x)}else h.insertBefore(m,x)}function b(h,m){let x=m instanceof Element?m:m.realParentNode;return!!x&&h.contains(x)}return p})(),ie=(function(){function p(v,A,b){return b.ignoreActive&&v===document.activeElement?null:(b.callbacks.beforeNodeMorphed(v,A)===!1||(v instanceof HTMLHeadElement&&b.head.ignore||(v instanceof HTMLHeadElement&&b.head.style!=="morph"?fe(v,A,b):(T(v,A,b),k(b,v,A)||O(v,b)||U(b,v,A))),b.callbacks.afterNodeMorphed(v,A)),v)}function T(v,A,b){let h=A.nodeType;if(h===1){let m=v,x=A,f=m.attributes,w=x.attributes;for(let _ of w)C(_.name,m,"update",b)||m.getAttribute(_.name)!==_.value&&m.setAttribute(_.name,_.value);for(let _=f.length-1;0<=_;_--){let I=f[_];if(I&&!x.hasAttribute(I.name)){if(C(I.name,m,"remove",b))continue;m.removeAttribute(I.name)}}O(m,b)||E(m,x,b)}(h===8||h===3)&&v.nodeValue!==A.nodeValue&&(v.nodeValue=A.nodeValue)}function E(v,A,b){if(v instanceof HTMLInputElement&&A instanceof HTMLInputElement&&A.type!=="file"){let h=A.value,m=v.value;R(v,A,"checked",b),R(v,A,"disabled",b),b.formStateSync==="property"&&v.indeterminate!==A.indeterminate&&(v.indeterminate=A.indeterminate),b.formStateSync==="property"?m!==h&&(C("value",v,"update",b)||(v.value=h)):A.hasAttribute("value")?m!==h&&(C("value",v,"update",b)||(v.setAttribute("value",h),v.value=h)):C("value",v,"remove",b)||(v.value="",v.removeAttribute("value"))}else if(v instanceof HTMLOptionElement&&A instanceof HTMLOptionElement)R(v,A,"selected",b);else if(v instanceof HTMLTextAreaElement&&A instanceof HTMLTextAreaElement){let h=A.value,m=v.value;if(C("value",v,"update",b)||(h!==m&&(v.value=h),b.formStateSync==="property"))return;v.firstChild&&v.firstChild.nodeValue!==h&&(v.firstChild.nodeValue=h)}}function R(v,A,b,h){let m=A[b],x=v[b];if(m!==x){let f=C(b,v,"update",h);if(f||(v[b]=A[b]),h.formStateSync==="property")return;m?f||v.setAttribute(b,""):C(b,v,"remove",h)||v.removeAttribute(b)}}function C(v,A,b,h){return v==="value"&&h.ignoreActiveValue&&A===document.activeElement?!0:h.callbacks.beforeAttributeUpdated(v,A,b)===!1}function O(v,A){return!!A.ignoreActiveValue&&v===document.activeElement&&v!==document.body}return p})();function Q(p,T,E,R){if(p.head.block){let C=T.querySelector("head"),O=E.querySelector("head");if(C&&O){let v=fe(C,O,p);return Promise.all(v).then(()=>(p.head.block=!1,p.head.ignore=!0,R(p)))}}return R(p)}function pe(p){return p.tagName==="SCRIPT"?!!p.getAttribute("src"):p.tagName==="LINK"?(p.getAttribute("rel")||"").toLowerCase().split(/\s+/).includes("stylesheet")&&!!p.getAttribute("href"):!1}function fe(p,T,E){let R=[],C=[],O=[],v=[],A=E.scripts.matchMode,b=x=>{if(x.tagName==="SCRIPT")return o(x,A,E.merge);if(x.tagName==="LINK"&&A==="smart"){let f=x.getAttribute("href");if(f)try{let w=new URL(f,window.location.href);return`link:${x.getAttribute("rel")||""}:${w.origin}${w.pathname}${w.search}`}catch{}}return x.outerHTML},h=new Map;for(let x of T.children){if(r(x))continue;let f=b(x),w=h.get(f);w||(w=[],h.set(f,w)),w.push(x)}for(let x of p.children){let f=b(x),w=h.get(f),_=!!(w&&w.length),I=E.head.shouldReAppend(x),P=E.head.shouldPreserve(x);if(_||P)if(I)C.push(x);else{if(w&&w.length){let S=w.pop();w.length||h.delete(f),k(E,x,S)}O.push(x)}else E.head.style==="append"?I&&(C.push(x),v.push(x)):E.head.shouldRemove(x)!==!1&&!r(x)&&C.push(x)}for(let x of h.values())v.push(...x);let m=[];for(let x of v){let f=document.createRange().createContextualFragment(x.outerHTML).firstChild;if(E.callbacks.beforeNodeAdded(f)!==!1){if(f instanceof Element&&pe(f)){let w,_=new Promise(function(I){w=I});f.addEventListener("load",function(){w()}),f.addEventListener("error",function(){w()}),m.push(_)}p.appendChild(f),E.callbacks.afterNodeAdded(f),R.push(f)}}for(let x of C)E.callbacks.beforeNodeRemoved(x)!==!1&&(p.removeChild(x),E.callbacks.afterNodeRemoved(x));return E.head.afterHeadMorphed(p,{added:R,kept:O,removed:C}),m}function Lt(p,T,E){if(!E.scripts.handle)return[];let R=[],C=[],O=[],v=[],A=E.scripts.matchMode,b=[];for(let m of p)if(m instanceof Element){a(m)&&b.push(m);for(let x of m.querySelectorAll("script"))a(x)&&b.push(x)}for(let m of b){if(m.closest("head")||n(m))continue;let x=o(m,A,E.merge),f=T.has(x),w=E.scripts.shouldPreserve(m),_=E.scripts.shouldReAppend(m);f||w?_?(C.push(m),v.push(m)):O.push(m):v.push(m)}let h=[];for(let m of v){if(E.callbacks.beforeNodeAdded(m)===!1)continue;let x=document.createElement("script");for(let f of m.attributes)x.setAttribute(f.name,f.value);if(x.textContent=m.textContent,x.src){let f,w=new Promise(function(_){f=_});x.addEventListener("load",function(){f()}),x.addEventListener("error",function(){f()}),h.push(w)}m.replaceWith(x),E.callbacks.afterNodeAdded(x),R.push(x)}return E.scripts.afterScriptsHandled(E.target,{added:R,kept:O,removed:C}),h}let ni=(function(){function p(b,h,m){let{persistentIds:x,idMap:f}=v(b,h),w=N.computeMatches(b,h);if(typeof m.key=="function"){let M=new Map,V=new Set,D=F=>{let L=m.key(F);L!=null&&(M.has(L)?V.add(L):M.set(L,F))};b instanceof Element&&D(b);for(let F of b.querySelectorAll("*"))D(F);for(let F of V)M.delete(F);let W=new Map;for(let[F,L]of w)W.set(L,F);let te=h.__hyperMorphRoot||h,X=new Map,G=new Set,j=F=>{let L=m.key(F);L!=null&&(X.has(L)?G.add(L):X.set(L,F))};te instanceof Element&&j(te);for(let F of te.querySelectorAll("*"))j(F);for(let F of G)X.delete(F);for(let[F,L]of X){let z=M.get(F);if(!z||z.tagName!==L.tagName)continue;let K=W.get(z);K&&K!==L&&w.delete(K);let xe=w.get(L);xe&&xe!==z&&W.delete(xe),w.set(L,z),W.set(z,L)}}let _=T(m),I=d(b,h,_.scripts);if(I){let M=new Map;for(let[V,D]of w)M.set(D,V);for(let[V,D]of I.newByKey){if(I.disabled.has(V))continue;let W=I.oldByKey.get(V);if(!W)continue;let te=M.get(W);te&&te!==D&&w.delete(te);let X=w.get(D);X&&X!==W&&M.delete(X),w.set(D,W),M.set(W,D)}}let P=new Set;for(let M of w.values())P.add(M);let S=_.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(S))throw new Error(`Do not understand how to morph style ${S}`);return{target:b,newContent:h,config:_,morphStyle:S,ignoreActive:_.ignoreActive,ignoreActiveValue:_.ignoreActiveValue,restoreFocus:_.restoreFocus,formStateSync:_.formStateSync||"attribute",idMap:f,persistentIds:x,hyperMatches:w,hyperMatchedOldElements:P,merge:I,pantry:E(),activeElementAndParents:R(b),callbacks:_.callbacks,head:_.head,scripts:_.scripts}}function T(b){let h=Object.assign({},y);return Object.assign(h,b),h.callbacks=Object.assign({},y.callbacks,b.callbacks),h.head=Object.assign({},y.head,b.head),h.scripts=Object.assign({},y.scripts,b.scripts),h}function E(){let b=document.createElement("div");return b.hidden=!0,document.body.insertAdjacentElement("afterend",b),b}function R(b){let h=[],m=document.activeElement;if(m?.tagName!=="BODY"&&b.contains(m))for(;m&&(h.push(m),m!==b);)m=m.parentElement;return h}function C(b){let h=Array.from(b.querySelectorAll("[id]"));return b.getAttribute?.("id")&&h.push(b),h}function O(b,h,m,x){for(let f of x){let w=f.getAttribute("id");if(h.has(w)){let _=f;for(;_;){let I=b.get(_);if(I==null&&(I=new Set,b.set(_,I)),I.add(w),_===m)break;_=_.parentElement}}}}function v(b,h){let m=C(b),x=C(h),f=A(m,x),w=new Map;O(w,f,b,m);let _=h.__hyperMorphRoot||h;return O(w,f,_,x),{persistentIds:f,idMap:w}}function A(b,h){let m=new Set,x=new Map;for(let w of b){let _=w.getAttribute("id");x.has(_)?m.add(_):x.set(_,w.tagName)}let f=new Set;for(let w of h){let _=w.getAttribute("id");f.has(_)?m.add(_):x.get(_)===w.tagName&&f.add(_)}for(let w of m)f.delete(w);return f}return p})(),{normalizeElement:ii,normalizeParent:_r}=(function(){let p=new WeakSet;function T(v){return v instanceof Document?v.documentElement:v}function E(v){if(v==null)return document.createElement("div");if(typeof v=="string")return E(O(v));if(p.has(v))return v;if(v instanceof Node){if(v.parentNode)return new R(v);{let A=document.createElement("div");return A.append(v),A}}else{let A=document.createElement("div");for(let b of[...v])A.append(b);return A}}class R{constructor(A){this.originalNode=A,this.realParentNode=A.parentNode,this.previousSibling=A.previousSibling,this.nextSibling=A.nextSibling}get childNodes(){let A=[],b=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;b&&b!=this.nextSibling;)A.push(b),b=b.nextSibling;return A}querySelectorAll(A){return this.childNodes.reduce((b,h)=>{if(h instanceof Element){h.matches(A)&&b.push(h);let m=h.querySelectorAll(A);for(let x=0;x<m.length;x++)b.push(m[x])}return b},[])}insertBefore(A,b){return this.realParentNode.insertBefore(A,b)}moveBefore(A,b){return this.realParentNode.moveBefore(A,b)}get __hyperMorphRoot(){return this.originalNode}}function C(v){let A=x=>`<${x}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,b=v.replace(/<!--[\s\S]*?-->/g,"");for(let x of["script","style","textarea","title"])b=b.replace(new RegExp(`${A(x)}[\\s\\S]*?</${x}\\s*>`,"gi"),"");let h=new RegExp(`${A("svg")}[\\s\\S]*?</svg\\s*>`,"gi"),m;do m=b,b=b.replace(h,"");while(b!==m);return b}function O(v){let A=new DOMParser,b=C(v);if(b.match(/<\/html>/)||b.match(/<\/head>/)||b.match(/<\/body>/)){let h=A.parseFromString(v,"text/html");if(b.match(/<\/html>/))return p.add(h),h;{let m=h.firstChild;return m&&p.add(m),m}}else{let m=A.parseFromString("<body><template>"+v+"</template></body>","text/html").body.querySelector("template").content;return p.add(m),m}}return{normalizeElement:T,normalizeParent:E}})(),Ar=Symbol("hyper-morph-duplicate-key"),Sr=[p=>p.getAttribute("data-id"),p=>p.getAttribute("id")];function Ue(p,T){return T.map(E=>{let R=new Map;for(let C of p){if(C.nodeType!==1)continue;let O=E(C);O==null||O===""||R.set(O,R.has(O)?Ar:C)}return R})}function Er(p,T,E,R){for(let C=0;C<R.length;C++){let O=R[C](p);if(O==null||O===""||T[C].get(O)!==p)continue;let v=E[C].get(O);if(!(!v||v===Ar)&&v.tagName===p.tagName)return v}return null}function Se(p,T,E){for(let R=0;R<E.length;R++){let C=E[R](p);if(!(C==null||C==="")&&T[R].get(C)===p)return!0}return!1}function oi(p,T,E={}){let R=E.skip||(()=>!1),C=E.ignoreAttr||(()=>!1),O=E.tiers&&E.tiers.length?E.tiers:Sr,v=null;function A(){return v||(v=Ue([p,...p.querySelectorAll("*")],O)),v}let b=null;function h(){return b||(b=Ue([T,...T.querySelectorAll("*")],O)),b}function m(j){return!j.parentElement||!j.parentElement.parentElement}function x(j,F,L){return m(j)||Se(j,A(),O)?(L.push({type:"subtree",el:j,base:F}),!1):!0}function f(j,F){let L=[];for(let z of j.attributes)C(j,z.name)||F.getAttribute(z.name)!==z.value&&L.push(z.name);for(let z of F.attributes)C(j,z.name)||j.hasAttribute(z.name)||L.push(z.name);return L}function w(j){let F=[],L=null,z=()=>{L!==null&&(F.push({nodeType:3,nodeValue:L}),L=null)};for(let K of j.childNodes){if(K.nodeType===3){L=(L===null?"":L)+K.nodeValue;continue}K.nodeType===1&&R(K)||(z(),(K.nodeType===1||K.nodeType===8)&&F.push(K))}return z(),F}function _(j,F){if(j.nodeType!==F.nodeType)return!1;if(j.nodeType!==1)return!0;if(j.tagName!==F.tagName)return!1;for(let L of O){let z=L(j),K=L(F);if(z!=null&&z!==""&&K!=null&&K!==""&&z!==K)return!1}return!0}function I(j){let F="";for(let L of j)L.nodeType===3&&L.nodeValue.trim()!==""?F+="\0"+L.nodeValue:L.nodeType===8&&(F+=""+L.nodeValue);return F}function P(j,F,L){let z=w(j),K=w(F);if(z.length===K.length){let $=!0;for(let Y=0;Y<z.length;Y++)if(!_(z[Y],K[Y])){$=!1;break}if($){for(let Y=0;Y<z.length;Y++){let Ee=z[Y];if(Ee.nodeType===1){if(S(Ee,K[Y],L))return!0}else if(Ee.nodeValue!==K[Y].nodeValue)return!0}return!1}}let xe=z.filter($=>$.nodeType===1),jt=K.filter($=>$.nodeType===1);if(I(z)!==I(K))return!0;let Cr=Ue(xe,O),Tr=Ue(jt,O),Ft=[],qt=new Set,Rr=[];for(let $ of xe){let Y=Er($,Cr,Tr,O);Y&&!qt.has(Y)?(Ft.push([$,Y]),qt.add(Y)):Rr.push($)}let ge=[];for(let $ of Rr)Se($,Cr,O)?L.push({type:"subtree",el:$,base:null}):ge.push($);let ze=[];for(let $ of jt)qt.has($)||(Se($,Tr,O)?L.push({type:"deletion",el:$}):ze.push($));if(ge.length!==ze.length)return!0;for(let $=0;$<ge.length;$++)if(!_(ge[$],ze[$]))return!0;let Or=new Map(Ft);for(let $=0;$<ge.length;$++)Or.set(ge[$],ze[$]);let Mr=-1;for(let $ of xe){let Y=Or.get($);if(!Y)continue;let Ee=jt.indexOf(Y);if(Ee<Mr)return!0;Mr=Ee}for(let $=0;$<ge.length;$++)if(S(ge[$],ze[$],L))return!0;for(let[$,Y]of Ft)if(S($,Y,L))return!0;return!1}function S(j,F,L){if(j.tagName!==F.tagName)return x(j,F,L);let z=f(j,F),K=[];if(P(j,F,K))return x(j,F,L);if(z.length){if(!m(j)&&!Se(F,h(),O))return!0;L.push({type:"attrs",el:j,names:z,base:F})}return L.push(...K),!1}let M=[],V=f(p,T);V.length&&M.push({type:"attrs",el:p,names:V});let D=(j,F)=>Array.from(j.children).find(L=>L.tagName===F)||null,W=D(p,"HEAD"),te=D(T,"HEAD");if(W&&te){let j=[];S(W,te,j),j.length&&M.push({type:"head",el:W})}else(W||te)&&W&&M.push({type:"head",el:W});let X=D(p,"BODY"),G=D(T,"BODY");return X&&G?S(X,G,M):X&&M.push({type:"subtree",el:X,base:null}),{entries:M}}function si(p,T,E={}){let R=E.tiers&&E.tiers.length?E.tiers:Sr,C=p.documentElement,O=[],v=0,A=S=>({ok:!1,placed:O,held:S,skippedAttrs:v});if(!C)return A(null);function b(S){let M=[S,...S.querySelectorAll("*")];return Ue(M,R)}let h=b(C),m=new Map,x=S=>{let M=S.getRootNode(),V=m.get(M);if(!V){let D=M.nodeType===9?M.documentElement:M;V=b(D),m.set(M,V)}return V};function f(S){if(!S.parentElement&&S.tagName==="HTML")return C;if(S.parentElement&&!S.parentElement.parentElement&&S.parentElement.tagName==="HTML"){if(S.tagName==="BODY")return p.body||null;if(S.tagName==="HEAD")return p.head||null}return null}function w(S){let M=f(S);return M||Er(S,x(S),h,R)}function _(S){if(!S)return null;let M=w(S);return M&&M.isConnected?M:null}function I(S){for(let M=0;M<R.length;M++){let V=R[M](S);V!=null&&V!==""&&h[M].set(V,S)}}for(let S of T){if(S.type!=="deletion")continue;let M=w(S.el);M&&M!==C&&M.remove()}let P=T.filter(S=>S.type!=="deletion").sort((S,M)=>S.el===M.el?0:S.el.compareDocumentPosition(M.el)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);for(let S of P){if(S.type==="head"){let G=p.importNode(S.el,!0);p.head?p.head.replaceWith(G):C.insertBefore(G,C.firstChild),O.push({entry:S,imported:G});continue}if(S.type==="attrs"){let G=_(S.el)||_(S.base);if(!G){v++;continue}for(let j of S.names)S.el.hasAttribute(j)?G.setAttribute(j,S.el.getAttribute(j)):G.removeAttribute(j);continue}let M=S.el;if(f(M))return A(S);let V=_(M)||_(S.base);if(V){let G=p.importNode(M,!0);V.replaceWith(G),I(G),O.push({entry:S,imported:G});continue}if(S.base!=null&&!Se(S.base,x(S.base),R)||!Se(M,x(M),R))return A(S);let D=M.parentElement;if(!D)return A(S);let W=_(D);if(!W)return A(S);let te=null;for(let G=M.previousElementSibling;G;G=G.previousElementSibling){let j=_(G);if(j&&j.parentNode===W){te=j;break}}let X=p.importNode(M,!0);if(te)W.insertBefore(X,te.nextSibling);else{let G=Array.prototype.indexOf.call(D.children,M);W.insertBefore(X,W.children[G]||null)}I(X),O.push({entry:S,imported:X})}return{ok:!0,placed:O,held:null,skippedAttrs:v}}return{morph:q,defaults:y,findChangedRoots:oi,spliceProtected:si,mergeJson:Ut,mergeScriptText:zt,parseJsonRelaxed:ot,parseRulesRelaxed:Br}})();var ka=Ve.morph,ya=Ve.defaults,va=Ve.findChangedRoots,xa=Ve.spliceProtected;var Ht=Ve;var at=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],Vt=new Set(at),Vr=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),Wr=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]);var lt={};$t(lt,{EmptyListInsert:()=>Ke,MAX_RULE_DEPTH:()=>Oe,MaxRuleDepthExceeded:()=>we,RuleTargetReadOnly:()=>Ge,RulesParseError:()=>Te,ShapeMismatch:()=>We,UnknownRulesVersion:()=>Re});var Te=class extends Error{constructor(t,r){super(t),this.name="RulesParseError",this.cause=r}},Re=class extends Error{constructor(t){super(`unknown rules version: ${t}. Library supports "1".`),this.name="UnknownRulesVersion",this.version=t}},Oe=20,we=class extends Error{constructor(t){super(`rule depth exceeded ${Oe} at path: ${t.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=t}},We=class extends Error{constructor(t){super(`shape mismatch: ${t.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=t}},Ke=class extends Error{constructor(t){super(`cannot add items to empty list at "${t.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=t}},Ge=class extends Error{constructor(t){super(`cannot write to read-only DOM property "${t}"`),this.name="RuleTargetReadOnly",this.target=t}};function ke(e,t,r,n={}){return Wt(e,t,r,{depth:0,path:[]},n)}function Wt(e,t,r,n,i){if(n.depth>Oe)throw new we(n.path);if(typeof r=="string")return Di(e,t,r,i);if(Array.isArray(r)){let[o,s]=r;return e.find(t,o,i).map((l,c)=>Wt(e,l,s,{depth:n.depth+1,path:[...n.path,c]},i))}if(typeof r=="object"&&r!==null){let o={};for(let[s,a]of Object.entries(r))o[s]=Wt(e,t,a,{depth:n.depth+1,path:[...n.path,s]},i);return o}return null}function Di(e,t,r,n){if(r.endsWith("[]")){let s=r.slice(0,-2);return e.find(t,s,n).map(a=>e.text(a))}if(r.startsWith("@"))return Kr(e,t,r.slice(1));let i=Z(r);if(i!==-1){let s=r.slice(0,i),a=r.slice(i+1),l=s?e.find(t,s,n):[t];return l.length===0?null:Kr(e,l[0],a)}if(r===".")return e.text(t);let o=e.find(t,r,n);return o.length===0?null:e.text(o[0])}function Kr(e,t,r){if(Vt.has(r)){let i=e.prop(t,r);return i==null?null:String(i)}let n=e.attr(t,r);return n||null}function $i(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function Pi(e){return e?(e.nodeType===9||e.nodeType===11,e):null}var Bi={find(e,t,r={}){let n=Pi(e);if(!n||!n.querySelectorAll)return[];let i=Array.from(n.querySelectorAll(t));r.includeRulesTag||(i=i.filter(a=>!$i(a)));let o=[];r.skip&&o.push(r.skip);let s=r.templateAttr===null?null:r.templateAttr||"cms-template";if(s&&o.push("["+s+"]"),o.length){let a=o.join(", ");i=i.filter(l=>!l.closest||!l.closest(a))}return i},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t},attr(e,t,r){if(r===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,r)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t)},prop(e,t,r){if(r===void 0){let n=e?e[t]:void 0;return n!==void 0?n:null}e[t]=r},clone(e){return e.cloneNode(!0)},insertAt(e,t,r){let n=e.children[r]||null;e.insertBefore(t,n)},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let n=e.ownerDocument.createElement("template");n.innerHTML=t;let i=n.content.firstElementChild;if(!i)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(i,e),i},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(n=>{n.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}},de=Bi;function Kt(e){try{return JSON.parse(e)}catch(t){throw new Te(`Invalid strict JSON: ${t.message}`,t)}}function Me(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function r(i){let o=[],s=0;for(;s<i.length;){let a=i[s];if(/\s/.test(a)){s++;continue}if("{}".includes(a)){o.push({type:a,value:a}),s++;continue}if(a==="["){let g=!1,d=s+1;for(;d<i.length&&/\s/.test(i[d]);)d++;if(d<i.length&&/[a-zA-Z_]/.test(i[d])&&(g=!0),!g){o.push({type:a,value:a}),s++;continue}}if(a==="]"){o.push({type:a,value:a}),s++;continue}if(a===":"){o.push({type:t.COLON,value:a}),s++;continue}if(a===","){o.push({type:t.COMMA,value:a}),s++;continue}if(a==='"'||a==="'"){let g=a,d=s+1;for(;d<i.length&&i[d]!==g;)i[d]==="\\"&&d++,d++;o.push({type:t.STRING,value:i.substring(s+1,d),quoted:!0,sourceQuote:g}),s=d+1;continue}let l=s,c;for(;l<i.length&&!/[{},]/.test(i[l]);)if(i[l]===":"){let g=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],d=!1;for(let k of g){let y=k.substring(1);if(i.substring(l+1,l+1+y.length)===y){d=!0,l+=y.length;break}}if(!d)break}else if(i[l]==="["){for(l++;l<i.length&&i[l]!=="]";){if(i[l]==='"'||i[l]==="'"){let g=i[l];for(l++;l<i.length&&i[l]!==g;)i[l]==="\\"&&l++,l++}l++}l<i.length&&i[l]==="]"&&l++}else l++;c=i.substring(s,l);let u=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(c)?u=t.NUMBER:c==="true"||c==="false"||c==="null"?u=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(c)&&(u=t.SELECTOR),o.push({type:u,value:c,quoted:!1}),s=l}return o}function n(i){let o="";for(let s=0;s<i.length;s++){let a=i[s];if("{}".includes(a.type)||"[]".includes(a.type)){o+=a.value;continue}if(a.type===t.COLON){o+=a.value;continue}if(a.type===t.COMMA){let l=i[s+1];if(l&&(l.type==="}"||l.type==="]"))continue;o+=a.value;continue}if(a.type===t.STRING&&a.quoted){let l=a.value;a.sourceQuote==="'"&&(l=l.replace(/\\'/g,"'"),l=l.replace(/(\\*)"/g,(c,u)=>u.length%2===0?u+'\\"':c)),o+=`"${l}"`;continue}if(a.type===t.NUMBER||a.type===t.BOOLEAN){o+=a.value;continue}if(a.type===t.SELECTOR||a.type===t.IDENTIFIER){o+=`"${a.value}"`;continue}o+=`"${a.value}"`}return o}try{let i=r(e),o=n(i);return JSON.parse(o)}catch(i){throw new Te("Invalid extraction rules syntax: "+i.message,i)}}var Jr="1",Gr=/^[a-zA-Z0-9_-]+$/;function Je(e,t,r){let n;if(r===void 0)n="script[data-rules-name]";else{if(typeof r!="string"||!Gr.test(r))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(r)} (must match ${Gr})`);n=`script[data-rules-name~="${r}"]`}let i=e.find(t,n,{includeRulesTag:!0});if(i.length===0)return null;r!==void 0&&i.length>1&&console.warn(`hyper-html-api: ${i.length} rules tags match data-rules-name~="${r}"; using the first.`);let o=i[0],s=e.attr(o,"data-rules-version");if(s!==Jr)throw new Re(s);return{rules:Me(e.text(o)),tagNode:o}}var Za=new Function("url","return import(url)");var zi=.5;function Gt(e,t,r,n,i,o,s,a={}){let l=e.find(t,r,a);if(i.length===0){l.forEach(U=>e.remove(U));return}let c=i.length>l.length,u=l[0]||null;if(c&&!u&&(u=Ki(e,t,r,a),!u))throw new Ke(o.path);let g=l.map(U=>Hi(e,U,n,a)),d=null;if(u){d=e.clone(u),a.templateAttr&&e.removeAttr(d,a.templateAttr);let U=e.stripIds(d);U>0&&console.warn(`[hyper-html-api] stripped ${U} id attribute(s) from cloned template at "${o.path.join(".")||"(root)"}"`)}let k=Vi(i,g,n),y=l[0]||u,N=e.parent(y),q=l.length>0?en(e,N,y):0,H=Gi(e,l),oe=new Set,ee=[],le=i.map((U,ie)=>{let Q=k[ie];if(Q>=0)return oe.add(Q),ee.push(!1),l[Q];ee.push(!0);let pe=e.clone(d);return e.stripIds(pe),pe});if(l.forEach((U,ie)=>{oe.has(ie)||e.remove(U)}),H){le.forEach((U,ie)=>{let Q=q+ie;e.children(N).findIndex(Lt=>e.sameNode(Lt,U))!==Q&&e.insertAt(N,U,Q)}),Qr(e,le,n,i,o,s,a);return}Ji(e,le,ee,N,q),Qr(e,le,n,i,o,s,a)}function Qr(e,t,r,n,i,o,s){t.forEach((a,l)=>{if(r===null){let c=n[l],u=c==null?"":String(c);e.text(a)!==u&&e.text(a,u)}else{let c=o(e,a,r,n[l],{depth:i.depth+1,path:[...i.path,l]},s);c&&c!==a&&(t[l]=c)}})}function Hi(e,t,r,n){return r===null?e.text(t):ke(e,t,r,n)}function Vi(e,t,r){let n=new Array(e.length).fill(-1),i=new Set;return e.forEach((o,s)=>{let a=-1,l=-1;t.forEach((c,u)=>{if(i.has(u))return;let g=Wi(o,c,r),d=g===l&&a>=0?Math.abs(u-s)<Math.abs(a-s):!1;(g>l||d)&&(l=g,a=u)}),l>=zi&&(n[s]=a,i.add(a))}),n}function Wi(e,t,r){if(r===null)return e===t?1:0;let n=Object.keys(r||{});if(n.length===0)return 0;let i=0;for(let o of n)JSON.stringify(e?.[o])===JSON.stringify(t?.[o])&&i++;return i/n.length}function en(e,t,r){let n=e.children(t);for(let i=0;i<n.length;i++)if(e.sameNode(n[i],r))return i;return-1}function Ki(e,t,r,n){if(!n.templateAttr)return null;let i=t;for(;i;){let o=e.find(i,r,{includeRulesTag:!1,templateAttr:null});for(let s of o)if(e.attr(s,n.templateAttr)!=null)return s;i=e.parent(i)}return null}function Gi(e,t){if(t.length<=1)return!0;let r=e.parent(t[0]);if(!r)return!1;let n=e.children(r),i=[];for(let o of t){let s=n.findIndex(a=>e.sameNode(a,o));if(s===-1)return!1;i.push(s)}return i.sort((o,s)=>o-s),i[i.length-1]-i[0]===i.length-1}function Ji(e,t,r,n,i){let o=null,s=i;for(let a=0;a<t.length;a++){if(!r[a]){o=t[a];continue}let l=o?e.parent(o):n;if(!l)continue;let c=o?en(e,l,o)+1:s++;e.insertAt(l,t[a],c),o=t[a]}}var tn=new Set(["checked","selected","disabled","readOnly","paused"]);function Ne(e,t,r,n,i={}){let o=[];if(Jt(r,n,[],o),o.length)throw new We(o);ct(e,t,r,n,{depth:0,path:[]},i)}function ct(e,t,r,n,i,o={}){if(i.depth>Oe)throw new we(i.path);if(n===void 0)return t;if(typeof r=="string")return Yi(e,t,r,n,i,o);if(Array.isArray(r)){let[s,a]=r;return Gt(e,t,s,a,n,i,ct,o),t}if(typeof r=="object"&&r!==null){for(let[s,a]of Object.entries(r)){let l=ct(e,t,a,n==null?n:n[s],{depth:i.depth+1,path:[...i.path,s]},o);l&&l!==t&&(t=l)}return t}return t}function Yi(e,t,r,n,i,o){if(r.endsWith("[]")){let l=r.slice(0,-2);return Gt(e,t,l,null,n,i,ct,o),t}if(r.startsWith("@"))return rn(e,t,r.slice(1),n);let s=Z(r);if(s!==-1){let l=r.slice(0,s),c=r.slice(s+1),u=l?e.find(t,l,o):[t];return u.length===0||rn(e,u[0],c,n),t}if(r===".")return e.text(t,n==null?"":String(n)),t;let a=e.find(t,r,o);return a.length===0||e.text(a[0],n==null?"":String(n)),t}function rn(e,t,r,n){if(Wr.has(r))throw new Ge(r);if(r==="outerHTML"){let i=n==null?"":String(n);return e.replaceWith(t,i)}return Vr.has(r)?(e.prop(t,r,Xi(r,n)),t):(e.attr(t,r,n==null?"":String(n)),t)}function Xi(e,t){return t==null?tn.has(e)?!1:"":tn.has(e)?t==="false"?!1:!!t:t}function Jt(e,t,r,n){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]")){Array.isArray(t)?t.forEach((i,o)=>{typeof i=="object"&&i!==null&&n.push({path:Xe([...r,o]),expected:"scalar",got:Ye(i)})}):n.push({path:Xe(r),expected:"array",got:Ye(t)});return}t!==null&&typeof t=="object"&&n.push({path:Xe(r),expected:"scalar",got:Ye(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){n.push({path:Xe(r),expected:"array",got:Ye(t)});return}let i=e[1];t.forEach((o,s)=>Jt(i,o,[...r,s],n));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){n.push({path:Xe(r),expected:"object",got:Ye(t)});return}for(let[i,o]of Object.entries(e))Jt(o,t[i],[...r,i],n)}}}function Ye(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Xe(e){return e.join(".")}function Yt(e,t,r){if(r&&typeof r=="object")return{rules:r,tagNode:null};if(typeof r=="string"){let n=t&&t.ownerDocument?t.ownerDocument:t;return Je(e,n,r)}return null}function on(e,t,r,n){let i=Yt(e,t,r);if(!i){let a=typeof r=="string"?`data-rules-name~="${r}"`:"the provided rules object";throw new Error(`hyper-html-api: could not resolve rules for ${a}`)}let{rules:o,tagNode:s}=i;return{rules:o,tagNode:s,get:()=>ke(e,t,o,n),set:a=>Ne(e,t,o,a,n)}}var re={extract:(e,t,r)=>ke(de,e,t,r),apply:(e,t,r,n)=>Ne(de,e,t,r,n),findRulesIn:(e,t)=>Je(de,e,t),findRules:(e,t)=>Yt(de,e,t),bind:(e,t,r)=>on(de,e,t,r),parseStrict:Kt,parseRelaxed:Me,ruleAttrIndex:Z,splitRule:it,errors:lt,DOM_PROPERTIES:at};var Zt={};$t(Zt,{fromString:()=>me,getRuleAtPath:()=>_e,getValueAtPath:()=>mo,setAtPath:()=>Xt,toString:()=>uo});function uo(e){return e.map(String).join(".")}function me(e){return e===""?[]:e.split(".").map(t=>/^\d+$/.test(t)?Number(t):t)}function _e(e,t){let r=e;for(let n of t){if(r==null)return;if(typeof r=="string"){if(r.endsWith("[]")&&(typeof n=="number"||n==="*")){r=r.slice(0,-2);continue}return}if(Array.isArray(r)){if(typeof n!="number"&&n!=="*")return;r=r[1];continue}if(typeof r=="object"){if(typeof n=="number"||!(n in r))return;r=r[n];continue}return}return r}function mo(e,t){let r=e;for(let n of t){if(r==null)return;r=r[n]}return r}function Xt(e,t,r){if(t.length===0)return r;let[n,...i]=t;if(typeof n=="number"){let o=Array.isArray(e)?[...e]:[];return o[n]=Xt(o[n],i,r),o}return{...e&&typeof e=="object"?e:{},[n]:Xt((e||{})[n],i,r)}}function Ze(e){if(typeof e=="string")return e.endsWith("[]")?[]:"";if(Array.isArray(e))return[];if(typeof e=="object"&&e!==null){let t={};for(let[r,n]of Object.entries(e))t[r]=Ze(n);return t}return""}function dt(e,t,{ignoreActiveValue:r=!0}={}){Ht.morph(e,t,{morphStyle:"innerHTML",ignoreActiveValue:r,restoreFocus:!0,formStateSync:"property"})}function mt(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/[-_]/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}var ho='<div class="hcms-drag-handle mirk-sortable__grip" aria-hidden="true"><div class="mirk-sortable__dots"><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span></div></div>',Qt='<svg class="hcms-x" viewBox="0 0 16 16" shape-rendering="crispEdges" aria-hidden="true"><path d="M4 4 L12 12 M12 4 L4 12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square"></path></svg>',ln={"@scalar":`
|
|
1
|
+
var hypercms=(()=>{var Dr=Object.defineProperty;var _s=Object.getOwnPropertyDescriptor;var Ts=Object.getOwnPropertyNames;var Cs=Object.prototype.hasOwnProperty;var qr=(e,t)=>{for(var r in t)Dr(e,r,{get:t[r],enumerable:!0})},Os=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Ts(t))!Cs.call(e,i)&&i!==r&&Dr(e,i,{get:()=>t[i],enumerable:!(n=_s(t,i))||n.enumerable});return e};var Rs=e=>Os(Dr({},"__esModule",{value:!0}),e);var cu={};qr(cu,{cms:()=>au,default:()=>lu});function ae(e){let t=0,r=null,n=-1;for(let i=0;i<e.length;i++){let o=e[i];o==="\\"?i++:r?o===r&&(r=null):o==='"'||o==="'"?r=o:o==="["||o==="("?t++:o==="]"||o===")"?t>0&&t--:o==="@"&&t===0&&(n=i)}return n}function Ht(e){let t=ae(e);return t===-1?{selector:e,prop:null}:{selector:e.slice(0,t),prop:e.slice(t+1)||null}}var Vn={includeClasses:!0,includeAttributes:["href","src","name","type","role","aria-label","alt","title"],excludeAttributePrefixes:["data-morph-","data-hyper-","data-im-"],textHintLength:64,excludeIds:!0,maxPathDepth:4,landmarks:["HEADER","NAV","MAIN","ASIDE","FOOTER","SECTION","ARTICLE"],weights:{signature:100,pathSegment:10,textMatch:20,textMismatch:25,uniqueCandidate:50,positionPenalty:1,maxDriftPenalty:19,slotMatch:30},minConfidence:101,maxScoredCandidates:16};function Ns(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t^e.charCodeAt(r);return Math.abs(t).toString(36)}function Ls(e){if(e.classList&&e.classList.length>0)return Array.from(e.classList).sort().join(" ");let t=e.getAttribute?.("class");return t?t.split(/\s+/).filter(Boolean).sort().join(" "):""}function Is(e,t){let r=[];for(let n of e.attributes||[]){let i=n.name;i==="id"||i==="class"||t.excludeAttributePrefixes.some(o=>i.startsWith(o))||t.includeAttributes.includes(i)&&r.push(`${i}=${n.value}`)}return r.sort().join("|")}function js(e,t){return(e.textContent||"").replace(/\s+/g," ").trim().slice(0,t.textHintLength)}function Fs(e,t){let r=[e.tagName];return t.includeClasses&&r.push(Ls(e)),r.push(Is(e,t)),Ns(r.join("|"))}function Ds(e){let t=e.tagName,r=1,n=e.previousElementSibling;for(;n;)n.tagName===t&&r++,n=n.previousElementSibling;return r}function qs(e,t){return e.getAttribute?.("id")||e.getAttribute?.("role")?!0:t.landmarks.includes(e.tagName)}function $s(e){let t=e.getAttribute?.("id");if(t)return`#${t}`;let r=e.getAttribute?.("role");return r?`@${r}`:e.tagName}function Ps(e,t){let r=[],n=e;for(;n&&n.tagName&&r.length<t.maxPathDepth;){let i=`${n.tagName}:${Ds(n)}`;if(r.unshift(i),n!==e&&qs(n,t)){r.unshift($s(n));break}n=n.parentElement}return r}function Bs(e,t){let r=0,n=e.length-1,i=t.length-1;for(;n>=0&&i>=0&&e[n]===t[i];)r++,n--,i--;return r}function ye(e,t,r){if(r.has(e))return r.get(e);let n={signature:Fs(e,t),path:Ps(e,t),textHint:js(e,t)};return r.set(e,n),n}function Yn(e,t,r,n){if(n.has(e))return n.get(e);let i=new Map,o=e.querySelectorAll("*"),a=0;for(let s of o){let l=ye(s,t,r);l.domIndex=a++,!t.shouldIgnore?.(s)&&(i.has(l.signature)||i.set(l.signature,[]),i.get(l.signature).push(s))}return n.set(e,i),i}function zs(e,t,r){r.delete(e),t.delete(e);let n=e.querySelectorAll("*");for(let i of n)t.delete(i)}function $r(e,t,r,n,i){let o=ye(e,r,n),a=ye(t,r,n),s=r.weights,l={},u=0;if(o.signature!==a.signature)return{score:0,breakdown:{rejected:"signature mismatch"}};u+=s.signature,l.signature=s.signature;let y=Bs(o.path,a.path)*s.pathSegment;u+=y,l.path=y;let c=!0;if(o.textHint&&a.textHint?o.textHint===a.textHint?(u+=s.textMatch,l.text=s.textMatch):(u-=s.textMismatch,l.text=-s.textMismatch,c=!1):o.textHint!==a.textHint&&(u-=s.textMismatch,l.text=-s.textMismatch,c=!1),i.candidateCount===1&&c&&(u+=s.uniqueCandidate,l.unique=s.uniqueCandidate),typeof o.domIndex=="number"&&typeof a.domIndex=="number"){let h=Math.abs(o.domIndex-a.domIndex),f=Math.min(h*s.positionPenalty,s.maxDriftPenalty);u-=f,l.drift=-f}return{score:u,breakdown:l}}function Wn(e,t,r,n,i){if(r.excludeIds&&e.getAttribute("id"))return null;let o=Yn(t,r,n,i),a=ye(e,r,n);if(typeof a.domIndex!="number"){let c=0,h=e.previousElementSibling;for(;h;)c++,h=h.previousElementSibling;a.domIndex=c}let s=o.get(a.signature)||[],l=r.excludeIds?s.filter(c=>!c.getAttribute("id")):s;if(l.length===0)return null;let u=null,m=0,y=null;for(let c of l){let{score:h,breakdown:f}=$r(e,c,r,n,{candidateCount:l.length});h>m&&(m=h,u=c,y=f)}return m<r.minConfidence?null:{element:u,confidence:m,breakdown:y}}function Hs(e,t,r,n){let i=[],o=r.weights.signature+r.weights.slotMatch,a={slot:o};function s(y){if(y.children)return y.children;let c=y.childNodes;if(!c)return[];let h=[];for(let f=0;f<c.length;f++)c[f].nodeType===1&&h.push(c[f]);return h}function l(y,c){let h=s(y),f=s(c);if(h.length===f.length)for(let b=0;b<h.length;b++){let k=h[b],A=f[b];if(r.shouldIgnore?.(k)||r.shouldIgnore?.(A)||r.excludeIds&&(k.getAttribute("id")||A.getAttribute("id"))||k.tagName!==A.tagName)continue;let E=ye(k,r,n).signature,L=ye(A,r,n).signature;E!==L&&i.push({newEl:k,oldEl:A,score:o,breakdown:a}),l(k,A)}}function u(y,c){for(;;){if(y.tagName===c.tagName)return[y,c];let h=s(y);if(!y.tagName&&h.length===1){y=h[0];continue}let f=s(c);if(f.length===1&&f[0].tagName===y.tagName){c=f[0];continue}return null}}let m=u(e,t);return m&&l(m[0],m[1]),i}function Kn(e,t,r,n,i){let o=t.querySelectorAll("*"),a=Yn(e,r,n,i),s=0;for(let h of o){let f=ye(h,r,n);f.domIndex=s++}let l=[],u=new Map;function m(h,f,b){let k=new Set;if(h.textHint){let O=u.get(h.signature);if(!O){O=new Map;for(let U of f){let ie=ye(U,r,n).textHint,ee=O.get(ie);ee||(ee=[],O.set(ie,ee)),ee.push(U)}u.set(h.signature,O)}let W=O.get(h.textHint);if(W)for(let U=0;U<W.length&&U<b;U++)k.add(W[U])}let A=0,E=f.length;for(;A<E;){let O=A+E>>1;ye(f[O],r,n).domIndex<h.domIndex?A=O+1:E=O}let L=Math.max(0,Math.min(A-(b>>1),f.length-b)),D=Math.min(L+b,f.length);for(let O=L;O<D;O++)k.add(f[O]);return[...k]}for(let h of o){if(r.shouldIgnore?.(h)||r.excludeIds&&h.getAttribute("id"))continue;let f=ye(h,r,n),b=a.get(f.signature)||[],k=r.excludeIds?b.filter(L=>!L.getAttribute("id")):b,A=r.maxScoredCandidates,E=A&&k.length>A?m(f,k,A):k;for(let L of E){let{score:D,breakdown:O}=$r(h,L,r,n,{candidateCount:k.length});D>=r.minConfidence&&l.push({newEl:h,oldEl:L,score:D,breakdown:O})}}if(r.weights.slotMatch>0){let h=Hs(t,e,r,n);for(let f of h)l.push(f)}l.sort((h,f)=>f.score-h.score);let y=new Map,c=new Set;for(let{newEl:h,oldEl:f}of l)y.has(h)||c.has(f)||(y.set(h,f),c.add(f));return y}function Gn(e,t,r,n){let i=ye(e,r,n),o=ye(t,r,n),{score:a,breakdown:s}=$r(e,t,r,n,{candidateCount:1});return{matches:a>=r.minConfidence,score:a,breakdown:s,newMeta:{signature:i.signature,path:i.path,textHint:i.textHint},oldMeta:{signature:o.signature,path:o.path,textHint:o.textHint}}}function Jn(e={}){let t={...Vn,...e,weights:{...Vn.weights,...e.weights}},r=new WeakMap,n=new WeakMap;return{findMatch:(i,o)=>Wn(i,o,t,r,n),computeMatches:(i,o)=>Kn(i,o,t,r,n),explain:(i,o)=>Gn(i,o,t,r),invalidate:i=>zs(i,r,n),session:()=>{let i=new WeakMap,o=new WeakMap;return{findMatch:(a,s)=>Wn(a,s,t,i,o),computeMatches:(a,s)=>Kn(a,s,t,i,o),explain:(a,s)=>Gn(a,s,t,i)}},getConfig:()=>({...t})}}function Pr(e,t){for(;;){for(;t<e.length&&/\s/.test(e[t]);)t++;if(e[t]==="/"&&e[t+1]==="/"){for(;t<e.length&&e[t]!==`
|
|
2
|
+
`;)t++;continue}if(e[t]==="/"&&e[t+1]==="*"){let r=e.indexOf("*/",t+2);if(r===-1)return e.length;t=r+2;continue}return t}}function Xn(e){return e.replace(/\\'/g,"'").replace(/(\\*)"/g,(t,r)=>r.length%2===0?r+'\\"':t)}var Us=/^-?(0|[1-9]\d*)(\.\d+)?([eE][+-]?\d+)?$/,Vs=/^[A-Za-z_$][A-Za-z0-9_$]*$/;function Ut(e){try{return JSON.parse(e)}catch{return JSON.parse(Ws(e))}}function Ws(e){let t="",r=0,n=(i,o)=>{throw new Error(`Invalid relaxed JSON: ${i} at position ${o}`)};for(;r<e.length&&(r=Pr(e,r),!(r>=e.length));){let i=e[r];if("{}[]:".includes(i)){t+=i,r++;continue}if(i===","){let s=Pr(e,r+1);if(e[s]==="}"||e[s]==="]"){r++;continue}t+=i,r++;continue}if(i==='"'||i==="'"){let s=r+1;for(;s<e.length&&e[s]!==i;)e[s]==="\\"&&s++,s++;s>=e.length&&n("unterminated string",r);let l=e.slice(r+1,s);i==="'"&&(l=Xn(l)),t+='"'+l+'"',r=s+1;continue}let o=r;for(;o<e.length&&/[A-Za-z0-9_$.+\-]/.test(e[o]);)o++;o===r&&n("unexpected character "+JSON.stringify(i),r);let a=e.slice(r,o);if(a==="true"||a==="false"||a==="null"||Us.test(a)){t+=a,r=o;continue}if(Vs.test(a)){if(e[Pr(e,o)]===":"){t+='"'+a+'"',r=o;continue}n("unquoted value "+JSON.stringify(a),r)}n("invalid token "+JSON.stringify(a),r)}return t}function Zn(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function r(i){let o=[],a=0;for(;a<i.length;){let s=i[a];if(/\s/.test(s)){a++;continue}if("{}".includes(s)){o.push({type:s,value:s}),a++;continue}if(s==="["){let y=!1,c=a+1;for(;c<i.length&&/\s/.test(i[c]);)c++;if(c<i.length&&/[a-zA-Z_]/.test(i[c])&&(y=!0),!y){o.push({type:s,value:s}),a++;continue}}if(s==="]"){o.push({type:s,value:s}),a++;continue}if(s===":"){o.push({type:t.COLON,value:s}),a++;continue}if(s===","){o.push({type:t.COMMA,value:s}),a++;continue}if(s==='"'||s==="'"){let y=s,c=a+1;for(;c<i.length&&i[c]!==y;)i[c]==="\\"&&c++,c++;o.push({type:t.STRING,value:i.substring(a+1,c),quoted:!0,sourceQuote:y}),a=c+1;continue}let l=a,u;for(;l<i.length&&!/[{},]/.test(i[l]);)if(i[l]===":"){let y=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],c=!1;for(let h of y){let f=h.substring(1);if(i.substring(l+1,l+1+f.length)===f){c=!0,l+=f.length;break}}if(!c)break}else if(i[l]==="["){for(l++;l<i.length&&i[l]!=="]";){if(i[l]==='"'||i[l]==="'"){let y=i[l];for(l++;l<i.length&&i[l]!==y;)i[l]==="\\"&&l++,l++}l++}l<i.length&&i[l]==="]"&&l++}else l++;u=i.substring(a,l);let m=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(u)?m=t.NUMBER:u==="true"||u==="false"||u==="null"?m=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(u)&&(m=t.SELECTOR),o.push({type:m,value:u,quoted:!1}),a=l}return o}function n(i){let o="";for(let a=0;a<i.length;a++){let s=i[a];if("{}".includes(s.type)||"[]".includes(s.type)){o+=s.value;continue}if(s.type===t.COLON){o+=s.value;continue}if(s.type===t.COMMA){let l=i[a+1];if(l&&(l.type==="}"||l.type==="]"))continue;o+=s.value;continue}if(s.type===t.STRING){let l=s.value;s.sourceQuote==="'"&&(l=Xn(l)),o+=`"${l}"`;continue}if(s.type===t.NUMBER||s.type===t.BOOLEAN){o+=s.value;continue}o+=`"${s.value}"`}return o}try{let i=r(e),o=n(i);return JSON.parse(o)}catch(i){throw new Error("Invalid extraction rules syntax: "+i.message)}}var oe=Symbol("hyper-morph-json-merge:missing"),Qn=["id","_id","uuid","key","slug","code","name"];function We(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function bt(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ks(e,t,r){Object.defineProperty(e,t,{value:r,enumerable:!0,writable:!0,configurable:!0})}function Ce(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(!Ce(e[r],t[r]))return!1;return!0}if(We(e)&&We(t)){let r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(let n of r)if(!bt(t,n)||!Ce(e[n],t[n]))return!1;return!0}return!1}function ei(e,t,r,n){return Ce(t,r)?t:Ce(t,e)?r:Ce(r,e)?t:We(t)&&We(r)?Gs(We(e)?e:{},t,r,n):Array.isArray(t)&&Array.isArray(r)?Zs(Array.isArray(e)?e:[],t,r,n):r}function ti(e,t,r,n){return t===oe&&r===oe?oe:t===oe?e===oe?r:Ce(r,e)?oe:r:r===oe?e===oe?t:oe:ei(e,t,r,n)}function Gs(e,t,r,n){let i={},o=new Set([...Object.keys(e),...Object.keys(t),...Object.keys(r)]);for(let a of o){let s=ti(bt(e,a)?e[a]:oe,bt(t,a)?t[a]:oe,bt(r,a)?r[a]:oe,n);s!==oe&&Ks(i,a,s)}return i}function Ys(e){return e===null||typeof e!="object"}function Vt(e){return typeof e+":"+String(e)}function Js(e,t){for(let r of t){let n=new Set;for(let i of r){if(!bt(i,e))return!1;let o=i[e];if(typeof o!="string"&&typeof o!="number")return!1;let a=Vt(o);if(n.has(a))return!1;n.add(a)}}return!0}function Xs(e,t,r,n){let i=[e,t,r],o=!0;for(let a of i)for(let s of a)We(s)||(o=!1);if(o){for(let a of n.keyCandidates)if(Js(a,i))return{kind:"keyed",field:a};return null}for(let a of i){let s=new Set;for(let l of a){if(!Ys(l))return null;let u=Vt(l);if(s.has(u))return null;s.add(u)}}return{kind:"self"}}function Zs(e,t,r,n){let i=Xs(e,t,r,n);if(!i)return r;let o=i.kind==="self"?Vt:h=>Vt(h[i.field]),a=h=>{let f=new Map;for(let b of h)f.set(o(b),b);return f},s=a(e),l=a(t),u=a(r),m=new Map,y=new Set([...s.keys(),...l.keys(),...u.keys()]);for(let h of y){let f=ti(s.has(h)?s.get(h):oe,l.has(h)?l.get(h):oe,u.has(h)?u.get(h):oe,n);f!==oe&&m.set(h,f)}let c=[];for(let h of r){let f=o(h);m.has(f)&&c.push(f)}for(let h=0;h<t.length;h++){let f=o(t[h]);if(!m.has(f)||c.includes(f))continue;let b=0;for(let k=h-1;k>=0;k--){let A=c.indexOf(o(t[k]));if(A!==-1){b=A+1;break}}c.splice(b,0,f)}return c.map(h=>m.get(h))}function Br(e,t,r,n={}){let i=n.keyCandidates?[...n.keyCandidates,...Qn]:Qn;return ei(e===void 0?oe:e,t,r,{keyCandidates:i})}function zr(e,t,r,n={}){let i=n.parse||Ut,o=[],a=(y,c)=>{if(typeof y!="string")return oe;try{return i(y)}catch(h){return o.push(`${c} side is not valid JSON (${h.message})`),oe}},s=a(t,"local"),l=a(r,"remote");if(s===oe)return{text:r,warnings:o};if(l===oe)return{text:t,warnings:o};let u=a(e,"base"),m=Br(u===oe?void 0:u,s,l,n);return Ce(m,l)?{text:r,warnings:o}:Ce(m,s)?{text:t,warnings:o}:{text:JSON.stringify(m,null,2),warnings:o}}var Qs=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),Cu=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),Ou=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui"]);function ri(e){let t=Qs[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(r=>[`[clay~="${r}"]`,`[${r}]`]).join(", ")}var yt=(function(){"use strict";let e=()=>{},t='[editor-ui],[clay~="editor-ui"],[save-ignore],[snapshot-remove],[no-snapshot],[no-save],[save-remove],[freeze],[save-freeze],[clay~="no-save"],[clay~="no-snapshot"],[clay~="freeze"]',r=`${ri("history")},[no-undo],[clay~="no-undo"]`;function n(v){if(v?.nodeType!==1)return!1;if(v.matches(t))return!0;if(v.tagName==="LINK"||v.tagName==="SCRIPT"){let I=v.getAttribute("src")||v.getAttribute("href")||"";if(I.startsWith("chrome-extension://")||I.startsWith("moz-extension://")||I.startsWith("safari-web-extension://"))return!0}return!1}function i(v){return v?.nodeType!==1?!1:v.closest(t)?!0:n(v)}function o(v,I,N){if(N){let P=N.identityOf(v);if(P&&!N.disabled.has(P.key))return"hm-merge:"+P.key}if(I!=="smart")return v.outerHTML;let F=v.getAttribute("src"),j=v.getAttribute("type")||"text/javascript";if(F)try{let P=new URL(F,window.location.href);return`ext:${j}:${P.origin}${P.pathname}${P.search}`}catch{return`ext:${j}:${F}`}else{let P=v.textContent.trim(),_=5381;for(let T=0;T<P.length;T++)_=(_<<5)+_^P.charCodeAt(T);return`inline:${j}:${Math.abs(_).toString(36)}`}}let a="http://www.w3.org/1999/xhtml";function s(v){return v?.nodeType===1&&v.tagName==="SCRIPT"&&v.namespaceURI===a}function l(v){let I=document.createElement("div");I.innerHTML="<script><\/script>";let N=I.firstChild;for(let F of v.attributes)N.setAttribute(F.name,F.value);return N.textContent=v.textContent,N}function u(v){if(s(v))return l(v);if(v?.nodeType===1)for(let I of v.querySelectorAll("script"))s(I)&&I.replaceWith(l(I));return v}function m(v){let I=(v.getAttribute("type")||"").split(";")[0].trim().toLowerCase();return I==="application/json"||I.endsWith("+json")}let y={match:v=>v.hasAttribute("merge"),identity:v=>v.getAttribute("merge")};function c(v,I,N){if(N.merge===!1)return null;let F=[y,...N.mergeTags||[]],j=new WeakMap,P=p=>{if(j.has(p))return j.get(p);let S=null;if(s(p)&&!p.getAttribute("src")&&!i(p)){let w=p;for(let R=0;R<F.length;R++)if(F[R].match(w)){if(!m(w))console.warn("[hyper-morph] merge ignored: script type is not JSON",w);else{let B=F[R].identity(w);B!=null&&B!==""&&(S={key:R+":"+B,raw:B,recognizer:F[R]})}break}}return j.set(p,S),S},_=new Set,T=p=>{let S=new Map,w=R=>{let B=P(R);B&&(S.has(B.key)?(_.add(B.key),console.warn(`[hyper-morph] merge disabled for duplicate identity "${B.raw}"`)):S.set(B.key,R))};s(p)&&w(p);for(let R of p.querySelectorAll("script"))w(R);return S},C=T(v),x=T(I.__hyperMorphRoot||I);if(C.size===0&&x.size===0)return null;let d=null;return{identityOf:P,disabled:_,oldByKey:C,newByKey:x,baseTexts:()=>{if(d)return d;d=new Map;let p=N.mergeBase;if(!p)return d;let S;typeof p=="string"?S=new DOMParser().parseFromString(p,"text/html").documentElement:p?.nodeType===9?S=p.documentElement:S=p;let w=R=>{let B=P(R);B&&!d.has(B.key)&&d.set(B.key,R.textContent)};s(S)&&w(S);for(let R of S.querySelectorAll("script"))w(R);return d}}}function h(v,I,N){let F=v.merge;if(!F)return!1;let j=F.identityOf(I);if(!j||F.disabled.has(j.key))return!1;let P=F.identityOf(N);if(!P||P.key!==j.key)return!1;let _=I,T=N,C=T.getAttribute("merge-key")||_.getAttribute("merge-key"),{text:x,warnings:d}=zr(F.baseTexts().get(j.key),_.textContent,T.textContent,{parse:j.recognizer.parse,keyCandidates:C?C.split(/[\s,]+/).filter(Boolean):void 0});for(let g of d)console.warn(`[hyper-morph] merge "${j.raw}": ${g}`);return _.textContent!==x&&(_.textContent=x),!0}let f={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:e,afterNodeAdded:e,beforeNodeMorphed:e,afterNodeMorphed:e,beforeNodeRemoved:e,afterNodeRemoved:e,beforeAttributeUpdated:e},head:{style:"merge",shouldPreserve:v=>v.getAttribute("im-preserve")==="true",shouldReAppend:v=>v.getAttribute("im-re-append")==="true",shouldRemove:e,afterHeadMorphed:e},scripts:{handle:!0,matchMode:"outerHTML",shouldPreserve:v=>v.getAttribute("im-preserve")==="true",shouldReAppend:v=>v.getAttribute("im-re-append")==="true",shouldRemove:e,afterScriptsHandled:e},restoreFocus:!0},b={computeMatches(v,I,N=i){let{computeMatches:F}=Jn({shouldIgnore:N}).session();return F(v,I)}};function k(v,I,N={}){v=Bt(v);let F=mt(I),j=Lr(v,F,N),P=j.scripts.handle?new Set(Array.from(v.querySelectorAll("script")).map(x=>o(x,j.scripts.matchMode,j.merge))):null,_=U(j),T;try{T=q(j,v,F,x=>x.morphStyle==="innerHTML"?(ee(x,v,F),Array.from(v.childNodes)):W(x,v,F))}catch(x){throw E(j),x}let C=x=>{_&&ie(j,_),A(j);let d=P?Nr(x,P,j):[];return d.length>0?Promise.all(d).then(()=>x):x};if(T instanceof Promise)return T.then(x=>{try{return C(x)}catch(d){throw E(j),d}},x=>{throw E(j),x});try{return C(T)}catch(x){throw E(j),x}}function A(v){let I=v.pantry;if(I){for(let N of Array.from(I.childNodes))v.callbacks.beforeNodeRemoved(N)!==!1&&v.callbacks.afterNodeRemoved(N);for(let N of Array.from(I.childNodes))I.removeChild(N);I.remove(),v.pantry=null,v.stagedNodes.clear()}}function E(v){let I=v.pantry;if(!I)return;let N=Array.from(v.stagedNodes.entries()).reverse();for(let[F,j]of N){if(!I.contains(F))continue;let P=j.nextSibling?.parentNode===j.parent?j.nextSibling:null;try{D(j.parent,F,P)}catch{}}for(let F of Array.from(I.childNodes))I.removeChild(F);I.remove(),v.pantry=null,v.stagedNodes.clear()}function L(v){if(v.pantry)return v.pantry;let I=v.target.ownerDocument,N=I.createElement("div");return N.hidden=!0,N.setAttribute("mutations-ignore",""),I.body.insertAdjacentElement("afterend",N),v.pantry=N,N}function D(v,I,N){if(v.moveBefore)try{v.moveBefore(I,N)}catch{v.insertBefore(I,N)}else v.insertBefore(I,N)}function O(v,I){!v.stagedNodes.has(I)&&I.parentNode&&v.stagedNodes.set(I,{parent:I.parentNode,nextSibling:I.nextSibling}),D(L(v),I,null)}function W(v,I,N){let F=mt(I);return ee(v,F,N,I,I.nextSibling),Array.from(F.childNodes)}function U(v){if(!v.config.restoreFocus)return null;let I=document.activeElement;if(!(I instanceof HTMLInputElement||I instanceof HTMLTextAreaElement))return null;let{id:N,selectionStart:F,selectionEnd:j}=I;return{element:I,id:N,selectionStart:F,selectionEnd:j}}function ie(v,I){let N=I.element;if(I.id&&I.id!==document.activeElement?.getAttribute("id")&&(N=v.target.querySelector(`[id="${CSS.escape(I.id)}"]`),N?.focus()),N&&!N.selectionEnd&&I.selectionEnd!=null)try{N.setSelectionRange(I.selectionStart,I.selectionEnd)}catch{}}let ee=(function(){function v(x,d,g,p=null,S=null){d?.tagName==="TEMPLATE"&&g?.tagName==="TEMPLATE"&&(d=d.content,g=g.content),p||=d.firstChild;for(let w of g.childNodes){if(x.shouldIgnore(w))continue;if(p&&p!=S){let B=F(x,w,p,S);if(B){B!==p&&P(x,p,B),me(B,w,x),p=B.nextSibling;continue}}if(w?.nodeType===1){let B=w.getAttribute("id");if(x.persistentIds.has(B)){let M=_(d,B,p,x);me(M,w,x),p=M.nextSibling;continue}if(!x.idMap.has(w)){let M=x.hyperMatches.get(w);if(M&&!x.idMap.has(M)&&!C(M,d)){D(d,M,p),me(M,w,x),p=M.nextSibling;continue}}}let R=I(d,w,p,x);R&&(p=R.nextSibling)}for(;p&&p!=S;){let w=p;p=p.nextSibling,x.shouldIgnore(w)||j(x,w)}}function I(x,d,g,p){if(p.callbacks.beforeNodeAdded(d)===!1)return null;let S=x.ownerDocument||x.realParentNode?.ownerDocument||p.target.ownerDocument;if(p.idMap.has(d)){let w=d,R=S.createElementNS(w.namespaceURI,w.localName);return x.insertBefore(R,g),me(R,d,p),p.callbacks.afterNodeAdded(R),R}else{let w=u(N(d,S,p));return w?(x.insertBefore(w,g),p.callbacks.afterNodeAdded(w),w):null}}function N(x,d,g){if(g.shouldIgnore(x))return null;let p=d.importNode(x,!1),S=x.nodeType===1&&x.tagName==="TEMPLATE"?x.content:x,w=p.nodeType===1&&p.tagName==="TEMPLATE"?p.content:p;for(let R of Array.from(S.childNodes||[])){let B=N(R,d,g);B&&w.appendChild(B)}return p}let F=(function(){function x(p,S,w,R){let B=S?.nodeType===1&&!p.idMap.has(S)?p.hyperMatches.get(S):null,M=null,z=S.nextSibling,$=0,H=w;for(;H&&H!=R;){if(p.shouldIgnore(H)){H=H.nextSibling;continue}if(g(H,S)){if(d(p,H,S)||H===B&&!p.idMap.has(H))return H;if(M===null){let V=H?.nodeType===1&&p.hyperMatchedOldElements.has(H);!p.idMap.has(H)&&!V&&(M=H)}}if(M===null&&z&&g(H,z)&&($++,z=z.nextSibling,$>=2&&(M=void 0)),p.activeElementAndParents.includes(H))break;H=H.nextSibling}return M||null}function d(p,S,w){let R=p.idMap.get(S),B=p.idMap.get(w);if(!B||!R)return!1;for(let M of R)if(B.has(M))return!0;return!1}function g(p,S){let w=p,R=S;return w.nodeType===R.nodeType&&w.tagName===R.tagName&&(!w.getAttribute?.("id")||w.getAttribute?.("id")===R.getAttribute?.("id"))}return x})();function j(x,d){let g=d?.nodeType===1&&x.hyperMatchedOldElements.has(d)&&!x.idMap.has(d);if(x.idMap.has(d)||g)O(x,d);else{if(x.callbacks.beforeNodeRemoved(d)===!1)return;d.parentNode?.removeChild(d),x.callbacks.afterNodeRemoved(d)}}function P(x,d,g){let p=d;for(;p&&p!==g;){let S=p;p=p.nextSibling,x.shouldIgnore(S)||j(x,S)}return p}function _(x,d,g,p){let S=p.target.ownerDocument?.defaultView?.CSS?.escape?p.target.ownerDocument.defaultView.CSS.escape(d):String(d).replace(/["\\]/g,"\\$&"),w=p.target.getAttribute?.("id")===d&&p.target||p.target.querySelector(`[id="${S}"]`)||p.pantry?.querySelector(`[id="${S}"]`);return T(w,p),D(x,w,g),w}function T(x,d){let g=x.getAttribute("id");for(;x=x.parentNode;){let p=d.idMap.get(x);p&&(p.delete(g),p.size||d.idMap.delete(x))}}function C(x,d){let g=d?.nodeType===1?d:d.realParentNode;return!!g&&x.contains(g)}return v})(),me=(function(){function v(_,T,C){return C.ignoreActive&&_===document.activeElement?null:(C.callbacks.beforeNodeMorphed(_,T)===!1||(_?.tagName==="HEAD"&&C.head.ignore||(_?.tagName==="HEAD"&&C.head.style!=="morph"?xe(_,T,C):(I(_,T,C),h(C,_,T)||P(_,C)||ee(C,_,T))),C.callbacks.afterNodeMorphed(_,T)),_)}function I(_,T,C){let x=T.nodeType;if(x===1){let d=_,g=T,p=d.attributes,S=g.attributes;for(let w of S)j(w.name,d,"update",C)||d.getAttribute(w.name)!==w.value&&d.setAttribute(w.name,w.value);for(let w=p.length-1;0<=w;w--){let R=p[w];if(R&&!g.hasAttribute(R.name)){if(j(R.name,d,"remove",C))continue;d.removeAttribute(R.name)}}P(d,C)||N(d,g,C)}(x===8||x===3)&&_.nodeValue!==T.nodeValue&&(_.nodeValue=T.nodeValue)}function N(_,T,C){if(_.tagName==="INPUT"&&T.tagName==="INPUT"&&T.type!=="file"){let x=T.value,d=_.value;F(_,T,"checked",C),F(_,T,"disabled",C),C.formStateSync==="property"&&_.indeterminate!==T.indeterminate&&(_.indeterminate=T.indeterminate),C.formStateSync==="property"?d!==x&&(j("value",_,"update",C)||(_.value=x)):T.hasAttribute("value")?d!==x&&(j("value",_,"update",C)||(_.setAttribute("value",x),_.value=x)):j("value",_,"remove",C)||(_.value="",_.removeAttribute("value"))}else if(_.tagName==="OPTION"&&T.tagName==="OPTION")F(_,T,"selected",C);else if(_.tagName==="TEXTAREA"&&T.tagName==="TEXTAREA"){let x=T.value,d=_.value;if(j("value",_,"update",C)||(x!==d&&(_.value=x),C.formStateSync==="property"))return;_.firstChild&&_.firstChild.nodeValue!==x&&(_.firstChild.nodeValue=x)}}function F(_,T,C,x){let d=T[C],g=_[C];if(d!==g){let p=j(C,_,"update",x);if(p||(_[C]=T[C]),x.formStateSync==="property")return;d?p||_.setAttribute(C,""):j(C,_,"remove",x)||_.removeAttribute(C)}}function j(_,T,C,x){return _==="value"&&x.ignoreActiveValue&&T===document.activeElement?!0:x.callbacks.beforeAttributeUpdated(_,T,C)===!1}function P(_,T){return!!T.ignoreActiveValue&&_===document.activeElement&&_!==document.body}return v})();function q(v,I,N,F){if(v.head.block){let j=I.querySelector("head"),P=N.querySelector("head");if(j&&P){let _=xe(j,P,v);return Promise.all(_).then(()=>(v.head.block=!1,v.head.ignore=!0,F(v)))}}return F(v)}function te(v){return v.tagName==="SCRIPT"?!!v.getAttribute("src"):v.tagName==="LINK"?(v.getAttribute("rel")||"").toLowerCase().split(/\s+/).includes("stylesheet")&&!!v.getAttribute("href"):!1}function xe(v,I,N){let F=[],j=[],P=[],_=[],T=N.scripts.matchMode,C=g=>{if(g.tagName==="SCRIPT")return o(g,T,N.merge);if(g.tagName==="LINK"&&T==="smart"){let p=g.getAttribute("href");if(p)try{let S=new URL(p,window.location.href);return`link:${g.getAttribute("rel")||""}:${S.origin}${S.pathname}${S.search}`}catch{}}return g.outerHTML},x=new Map;for(let g of I.children){if(N.shouldIgnore(g))continue;let p=C(g),S=x.get(p);S||(S=[],x.set(p,S)),S.push(g)}for(let g of v.children){let p=C(g),S=x.get(p),w=!!(S&&S.length),R=N.head.shouldReAppend(g),B=N.head.shouldPreserve(g);if(w||B)if(R)j.push(g);else{if(S&&S.length){let M=S.pop();S.length||x.delete(p),h(N,g,M)}P.push(g)}else N.head.style==="append"?R&&(j.push(g),_.push(g)):N.head.shouldRemove(g)!==!1&&!N.shouldIgnore(g)&&j.push(g)}for(let g of x.values())_.push(...g);let d=[];for(let g of _){let p=document.createRange().createContextualFragment(g.outerHTML).firstChild;if(N.callbacks.beforeNodeAdded(p)!==!1){if(p instanceof Element&&te(p)){let S,w=new Promise(function(R){S=R});p.addEventListener("load",function(){S()}),p.addEventListener("error",function(){S()}),d.push(w)}v.appendChild(p),N.callbacks.afterNodeAdded(p),F.push(p)}}for(let g of j)N.callbacks.beforeNodeRemoved(g)!==!1&&(v.removeChild(g),N.callbacks.afterNodeRemoved(g));return N.head.afterHeadMorphed(v,{added:F,kept:P,removed:j}),d}function Nr(v,I,N){if(!N.scripts.handle)return[];let F=[],j=[],P=[],_=[],T=N.scripts.matchMode,C=[];for(let d of v)if(d instanceof Element){s(d)&&C.push(d);for(let g of d.querySelectorAll("script"))s(g)&&C.push(g)}for(let d of C){if(d.closest("head")||N.shouldIgnore(d))continue;let g=o(d,T,N.merge),p=I.has(g),S=N.scripts.shouldPreserve(d),w=N.scripts.shouldReAppend(d);p||S?w?(j.push(d),_.push(d)):P.push(d):_.push(d)}let x=[];for(let d of _){if(N.callbacks.beforeNodeAdded(d)===!1)continue;let g=document.createElement("script");for(let p of d.attributes)g.setAttribute(p.name,p.value);if(g.textContent=d.textContent,g.src){let p,S=new Promise(function(w){p=w});g.addEventListener("load",function(){p()}),g.addEventListener("error",function(){p()}),x.push(S)}d.replaceWith(g),N.callbacks.afterNodeAdded(g),F.push(g)}return N.scripts.afterScriptsHandled(N.target,{added:F,kept:P,removed:j}),x}let Lr=(function(){function v(T,C,x){let d=x.policy==="history"?r:t,g=x.policy==="raw"?()=>!1:$=>{if($?.nodeType!==1)return!1;if(x.policy!=="history"&&i($))return!0;let H=$.closest(d);return!(!H||x.policy==="history"&&H===T&&H.matches('[no-undo],[clay~="no-undo"]')&&!H.matches('[editor-ui],[clay~="editor-ui"]'))},{persistentIds:p,idMap:S}=P(T,C,g),w=b.computeMatches(T,C,g);if(typeof x.key=="function"){let $=new Map,H=new Set,V=K=>{let Y=x.key(K);Y!=null&&($.has(Y)?H.add(Y):$.set(Y,K))};T instanceof Element&&V(T);for(let K of T.querySelectorAll("*"))V(K);for(let K of H)$.delete(K);let se=new Map;for(let[K,Y]of w)se.set(Y,K);let he=C.__hyperMorphRoot||C,Z=new Map,G=new Set,Q=K=>{let Y=x.key(K);Y!=null&&(Z.has(Y)?G.add(Y):Z.set(Y,K))};he instanceof Element&&Q(he);for(let K of he.querySelectorAll("*"))Q(K);for(let K of G)Z.delete(K);for(let[K,Y]of Z){let re=$.get(K);if(!re||re.tagName!==Y.tagName)continue;let De=se.get(re);De&&De!==Y&&w.delete(De);let qe=w.get(Y);qe&&qe!==re&&se.delete(qe),w.set(Y,re),se.set(re,Y)}}let R=I(x),B=c(T,C,R.scripts);if(B){let $=new Map;for(let[H,V]of w)$.set(V,H);for(let[H,V]of B.newByKey){if(B.disabled.has(H))continue;let se=B.oldByKey.get(H);if(!se)continue;let he=$.get(se);he&&he!==V&&w.delete(he);let Z=w.get(V);Z&&Z!==se&&$.delete(Z),w.set(V,se),$.set(se,V)}}let M=new Set;for(let $ of w.values())M.add($);let z=R.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(z))throw new Error(`Do not understand how to morph style ${z}`);return{target:T,newContent:C,config:R,morphStyle:z,ignoreActive:R.ignoreActive,ignoreActiveValue:R.ignoreActiveValue,restoreFocus:R.restoreFocus,formStateSync:R.formStateSync||"attribute",idMap:S,persistentIds:p,hyperMatches:w,hyperMatchedOldElements:M,merge:B,pantry:null,stagedNodes:new Map,activeElementAndParents:N(T),callbacks:R.callbacks,head:R.head,scripts:R.scripts,shouldIgnore:g}}function I(T){let C=Object.assign({},f);return Object.assign(C,T),C.callbacks=Object.assign({},f.callbacks,T.callbacks),C.head=Object.assign({},f.head,T.head),C.scripts=Object.assign({},f.scripts,T.scripts),C}function N(T){let C=[],x=T.ownerDocument?.activeElement;if(x?.tagName!=="BODY"&&T.contains(x))for(;x&&(C.push(x),x!==T);)x=x.parentElement;return C}function F(T){let C=Array.from(T.querySelectorAll("[id]"));return T.getAttribute?.("id")&&C.push(T),C}function j(T,C,x,d){for(let g of d){let p=g.getAttribute("id");if(C.has(p)){let S=g;for(;S;){let w=T.get(S);if(w==null&&(w=new Set,T.set(S,w)),w.add(p),S===x)break;S=S.parentElement}}}}function P(T,C,x){let d=F(T).filter(R=>!x(R)),g=F(C).filter(R=>!x(R)),p=_(d,g),S=new Map;j(S,p,T,d);let w=C.__hyperMorphRoot||C;return j(S,p,w,g),{persistentIds:p,idMap:S}}function _(T,C){let x=new Set,d=new Map;for(let p of T){let S=p.getAttribute("id");d.has(S)?x.add(S):d.set(S,p.tagName)}let g=new Set;for(let p of C){let S=p.getAttribute("id");g.has(S)?x.add(S):d.get(S)===p.tagName&&g.add(S)}for(let p of x)g.delete(p);return g}return v})(),{normalizeElement:Bt,normalizeParent:mt}=(function(){let v=new WeakSet;function I(_){return _?.nodeType===9?_.documentElement:_}function N(_){if(_==null)return document.createElement("div");if(typeof _=="string")return N(P(_));if(v.has(_))return _;if(_&&typeof _=="object"&&"nodeType"in _){if(_.parentNode)return new F(_);{let T=_.ownerDocument.createElement("div");return T.append(_),T}}else{let C=[..._][0]?.ownerDocument?.createElement("div")||document.createElement("div");for(let x of[..._])C.append(x);return C}}class F{constructor(T){this.originalNode=T,this.realParentNode=T.parentNode,this.previousSibling=T.previousSibling,this.nextSibling=T.nextSibling}get childNodes(){let T=[],C=this.previousSibling?this.previousSibling.nextSibling:this.realParentNode.firstChild;for(;C&&C!=this.nextSibling;)T.push(C),C=C.nextSibling;return T}querySelectorAll(T){return this.childNodes.reduce((C,x)=>{if(x instanceof Element){x.matches(T)&&C.push(x);let d=x.querySelectorAll(T);for(let g=0;g<d.length;g++)C.push(d[g])}return C},[])}insertBefore(T,C){return this.realParentNode.insertBefore(T,C)}moveBefore(T,C){return this.realParentNode.moveBefore(T,C)}get __hyperMorphRoot(){return this.originalNode}}function j(_){let T=g=>`<${g}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,C=_.replace(/<!--[\s\S]*?-->/g,"");for(let g of["script","style","textarea","title"])C=C.replace(new RegExp(`${T(g)}[\\s\\S]*?</${g}\\s*>`,"gi"),"");let x=new RegExp(`${T("svg")}[\\s\\S]*?</svg\\s*>`,"gi"),d;do d=C,C=C.replace(x,"");while(C!==d);return C}function P(_){let T=new DOMParser,C=j(_);if(C.match(/<\/html>/)||C.match(/<\/head>/)||C.match(/<\/body>/)){let x=T.parseFromString(_,"text/html");if(C.match(/<\/html>/))return v.add(x),x;{let d=x.firstChild;return d&&v.add(d),d}}else{let d=T.parseFromString("<body><template>"+_+"</template></body>","text/html").body.querySelector("template").content;return v.add(d),d}}return{normalizeElement:I,normalizeParent:N}})(),zt=Symbol("hyper-morph-duplicate-key"),ft=[v=>v.getAttribute("data-id"),v=>v.getAttribute("id")];function Fe(v,I){return I.map(N=>{let F=new Map;for(let j of v){if(j.nodeType!==1)continue;let P=N(j);P==null||P===""||F.set(P,F.has(P)?zt:j)}return F})}function pt(v,I,N,F){for(let j=0;j<F.length;j++){let P=F[j](v);if(P==null||P===""||I[j].get(P)!==v)continue;let _=N[j].get(P);if(!(!_||_===zt)&&_.tagName===v.tagName)return _}return null}function we(v,I,N){for(let F=0;F<N.length;F++){let j=N[F](v);if(!(j==null||j==="")&&I[F].get(j)===v)return!0}return!1}function Ir(v,I,N={}){let F=N.skip||(()=>!1),j=N.ignoreAttr||(()=>!1),P=N.tiers&&N.tiers.length?N.tiers:ft,_=null;function T(){return _||(_=Fe([v,...v.querySelectorAll("*")],P)),_}let C=null;function x(){return C||(C=Fe([I,...I.querySelectorAll("*")],P)),C}function d(G){return!G.parentElement||!G.parentElement.parentElement}function g(G,Q,K){return d(G)||we(G,T(),P)?(K.push({type:"subtree",el:G,base:Q}),!1):!0}function p(G,Q){let K=[];for(let Y of G.attributes)j(G,Y.name)||Q.getAttribute(Y.name)!==Y.value&&K.push(Y.name);for(let Y of Q.attributes)j(G,Y.name)||G.hasAttribute(Y.name)||K.push(Y.name);return K}function S(G){let Q=[],K=null,Y=()=>{K!==null&&(Q.push({nodeType:3,nodeValue:K}),K=null)};for(let re of G.childNodes){if(re.nodeType===3){K=(K===null?"":K)+re.nodeValue;continue}re.nodeType===1&&F(re)||(Y(),(re.nodeType===1||re.nodeType===8)&&Q.push(re))}return Y(),Q}function w(G,Q){if(G.nodeType!==Q.nodeType)return!1;if(G.nodeType!==1)return!0;if(G.tagName!==Q.tagName)return!1;for(let K of P){let Y=K(G),re=K(Q);if(Y!=null&&Y!==""&&re!=null&&re!==""&&Y!==re)return!1}return!0}function R(G){let Q="";for(let K of G)K.nodeType===3&&K.nodeValue.trim()!==""?Q+="\0"+K.nodeValue:K.nodeType===8&&(Q+=""+K.nodeValue);return Q}function B(G,Q,K){let Y=S(G),re=S(Q);if(Y.length===re.length){let X=!0;for(let le=0;le<Y.length;le++)if(!w(Y[le],re[le])){X=!1;break}if(X){for(let le=0;le<Y.length;le++){let Ve=Y[le];if(Ve.nodeType===1){if(M(Ve,re[le],K))return!0}else if(Ve.nodeValue!==re[le].nodeValue)return!0}return!1}}let De=Y.filter(X=>X.nodeType===1),qe=re.filter(X=>X.nodeType===1);if(R(Y)!==R(re))return!0;let qn=Fe(De,P),$n=Fe(qe,P),jr=[],Fr=new Set,Pn=[];for(let X of De){let le=pt(X,qn,$n,P);le&&!Fr.has(le)?(jr.push([X,le]),Fr.add(le)):Pn.push(X)}let Te=[];for(let X of Pn)we(X,qn,P)?K.push({type:"subtree",el:X,base:null}):Te.push(X);let gt=[];for(let X of qe)Fr.has(X)||(we(X,$n,P)?K.push({type:"deletion",el:X}):gt.push(X));if(Te.length!==gt.length)return!0;for(let X=0;X<Te.length;X++)if(!w(Te[X],gt[X]))return!0;let Bn=new Map(jr);for(let X=0;X<Te.length;X++)Bn.set(Te[X],gt[X]);let zn=-1;for(let X of De){let le=Bn.get(X);if(!le)continue;let Ve=qe.indexOf(le);if(Ve<zn)return!0;zn=Ve}for(let X=0;X<Te.length;X++)if(M(Te[X],gt[X],K))return!0;for(let[X,le]of jr)if(M(X,le,K))return!0;return!1}function M(G,Q,K){if(G.tagName!==Q.tagName)return g(G,Q,K);let Y=p(G,Q),re=[];if(B(G,Q,re))return g(G,Q,K);if(Y.length){if(!d(G)&&!we(Q,x(),P))return!0;K.push({type:"attrs",el:G,names:Y,base:Q})}return K.push(...re),!1}let z=[],$=p(v,I);$.length&&z.push({type:"attrs",el:v,names:$});let H=(G,Q)=>Array.from(G.children).find(K=>K.tagName===Q)||null,V=H(v,"HEAD"),se=H(I,"HEAD");if(V&&se){let G=[];M(V,se,G),G.length&&z.push({type:"head",el:V})}else(V||se)&&V&&z.push({type:"head",el:V});let he=H(v,"BODY"),Z=H(I,"BODY");return he&&Z?M(he,Z,z):he&&z.push({type:"subtree",el:he,base:null}),{entries:z}}function ge(v,I,N={}){let F=N.tiers&&N.tiers.length?N.tiers:ft,j=v.documentElement,P=[],_=0,T=M=>({ok:!1,placed:P,held:M,skippedAttrs:_});if(!j)return T(null);function C(M){let z=[M,...M.querySelectorAll("*")];return Fe(z,F)}let x=C(j),d=new Map,g=M=>{let z=M.getRootNode(),$=d.get(z);if(!$){let H=z.nodeType===9?z.documentElement:z;$=C(H),d.set(z,$)}return $};function p(M){if(!M.parentElement&&M.tagName==="HTML")return j;if(M.parentElement&&!M.parentElement.parentElement&&M.parentElement.tagName==="HTML"){if(M.tagName==="BODY")return v.body||null;if(M.tagName==="HEAD")return v.head||null}return null}function S(M){let z=p(M);return z||pt(M,g(M),x,F)}function w(M){if(!M)return null;let z=S(M);return z&&z.isConnected?z:null}function R(M){for(let z=0;z<F.length;z++){let $=F[z](M);$!=null&&$!==""&&x[z].set($,M)}}for(let M of I){if(M.type!=="deletion")continue;let z=S(M.el);z&&z!==j&&z.remove()}let B=I.filter(M=>M.type!=="deletion").sort((M,z)=>M.el===z.el?0:M.el.compareDocumentPosition(z.el)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);for(let M of B){if(M.type==="head"){let Z=v.importNode(M.el,!0);v.head?v.head.replaceWith(Z):j.insertBefore(Z,j.firstChild),P.push({entry:M,imported:Z});continue}if(M.type==="attrs"){let Z=w(M.el)||w(M.base);if(!Z){_++;continue}for(let G of M.names)M.el.hasAttribute(G)?Z.setAttribute(G,M.el.getAttribute(G)):Z.removeAttribute(G);continue}let z=M.el;if(p(z))return T(M);let $=w(z)||w(M.base);if($){let Z=v.importNode(z,!0);$.replaceWith(Z),R(Z),P.push({entry:M,imported:Z});continue}if(M.base!=null&&!we(M.base,g(M.base),F)||!we(z,g(z),F))return T(M);let H=z.parentElement;if(!H)return T(M);let V=w(H);if(!V)return T(M);let se=null;for(let Z=z.previousElementSibling;Z;Z=Z.previousElementSibling){let G=w(Z);if(G&&G.parentNode===V){se=G;break}}let he=v.importNode(z,!0);if(se)V.insertBefore(he,se.nextSibling);else{let Z=Array.prototype.indexOf.call(H.children,z);V.insertBefore(he,V.children[Z]||null)}R(he),P.push({entry:M,imported:he})}return{ok:!0,placed:P,held:null,skippedAttrs:_}}return{morph:k,defaults:f,findChangedRoots:Ir,spliceProtected:ge,mergeJson:Br,mergeScriptText:zr,parseJsonRelaxed:Ut,parseRulesRelaxed:Zn}})();var kt=yt.morph,ju=yt.defaults,Fu=yt.findChangedRoots,Du=yt.spliceProtected;var Hr=yt;var Wt=["textContent","innerText","innerHTML","outerHTML","value","checked","selected","disabled","readOnly","type","tagName","nodeName","nodeType","nodeValue","childElementCount","id","className","classList","baseURI","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","dataset","currentSrc","duration","paused","title","documentURI","contentType"],Ur=new Set(Wt),ni=new Set(["textContent","innerText","innerHTML","value","checked","selected","disabled","readOnly","type","id","className","title"]),vt=new Set(["tagName","nodeName","nodeType","nodeValue","childElementCount","classList","baseURI","documentURI","contentType","offsetWidth","offsetHeight","clientWidth","clientHeight","scrollWidth","scrollHeight","currentSrc","duration","paused","dataset"]);var Kt={};qr(Kt,{EmptyListInsert:()=>wt,MAX_RULE_DEPTH:()=>Ye,MaxRuleDepthExceeded:()=>$e,RuleTargetReadOnly:()=>At,RulesParseError:()=>Ke,ShapeMismatch:()=>xt,UnknownRulesVersion:()=>Ge});var Ke=class extends Error{constructor(t,r){super(t),this.name="RulesParseError",this.cause=r}},Ge=class extends Error{constructor(t){super(`unknown rules version: ${t}. Library supports "1".`),this.name="UnknownRulesVersion",this.version=t}},Ye=20,$e=class extends Error{constructor(t){super(`rule depth exceeded ${Ye} at path: ${t.join(".")}`),this.name="MaxRuleDepthExceeded",this.path=t}},xt=class extends Error{constructor(t){super(`shape mismatch: ${t.length} field(s) failed validation`),this.name="ShapeMismatch",this.mismatches=t}},wt=class extends Error{constructor(t){super(`cannot add items to empty list at "${t.join(".")}" \u2014 no sibling to clone as template. Seed the list with a hidden item first.`),this.name="EmptyListInsert",this.path=t}},At=class extends Error{constructor(t){super(`cannot write to read-only DOM property "${t}"`),this.name="RuleTargetReadOnly",this.target=t}};function Oe(e,t,r,n={}){if(Object.prototype.hasOwnProperty.call(n,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");return Vr(e,t,r,{depth:0,path:[]},n)}function Vr(e,t,r,n,i){if(n.depth>Ye)throw new $e(n.path);if(typeof r=="string")return ia(e,t,r,n,i);if(Array.isArray(r)){let[o,a]=r,s=e.find(t,o,i);return oi(i,n,s),s.map((l,u)=>Vr(e,l,a,{depth:n.depth+1,path:[...n.path,u]},i))}if(typeof r=="object"&&r!==null){let o={};for(let[a,s]of Object.entries(r))o[a]=Vr(e,t,s,{depth:n.depth+1,path:[...n.path,a]},i);return o}return null}function ia(e,t,r,n,i){if(r.endsWith("[]")){let s=r.slice(0,-2),l=e.find(t,s,i);return oi(i,n,l),l.map(u=>e.text(u))}if(r.startsWith("@"))return ii(e,t,r.slice(1));let o=ae(r);if(o!==-1){let s=r.slice(0,o),l=r.slice(o+1),u=s?e.find(t,s,i):[t];return u.length===0?null:ii(e,u[0],l)}if(r===".")return e.text(t);let a=e.find(t,r,i);return a.length===0?null:e.text(a[0])}function oi(e,t,r){if(typeof e.onRowsRead=="function")try{e.onRowsRead(t.path.slice(),r)}catch(n){console.warn(`[hyper-html-api] onRowsRead threw at "${t.path.join(".")||"(root)"}"`,n)}}function ii(e,t,r){if(Ur.has(r)){let i=e.prop(t,r);return i==null?null:String(i)}let n=e.attr(t,r);return n||null}var si=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),oa=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),Xu=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui"]);function Wr(e,t){if(!e||e.nodeType!==1)return!1;let r=e.getAttribute?.("clay");return!!(r&&r.split(/\s+/).includes(t)||e.hasAttribute?.(t))}function sa(e,t){if(Wr(e,t))return!0;for(let[r,n]of Object.entries(oa))if(n.includes(t)&&Wr(e,r))return!0;return!1}function St(e){let t=si[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(r=>[`[clay~="${r}"]`,`[${r}]`]).join(", ")}function aa(e,t){let r=e&&e.nodeType===1?e:e?.parentElement;for(;r&&r.nodeType===1;){let n=si[t];if(!n)throw new Error(`Unknown region capability: ${t}`);if(n.tokens.some(i=>sa(r,i))||n.bundles.some(i=>Wr(r,i)))return r;r=r.parentElement}return null}function ai(e,t){return!!aa(e,t)}var la=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function li(e,t){if(!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(e.tagName||""))return;let r=(e.getAttribute?.("type")||"").toLowerCase();if("value"in e&&"value"in t&&e.tagName!=="OPTION"&&r!=="checkbox"&&r!=="radio"&&(t.value=e.value),"checked"in e&&"checked"in t&&(t.checked=e.checked),"selected"in e&&"selected"in t&&(t.selected=e.selected),e.tagName==="SELECT")for(let n=0;n<e.options.length;n++)t.options[n].selected=e.options[n].selected;"indeterminate"in e&&"indeterminate"in t&&(t.indeterminate=e.indeterminate)}function ci(e,t,r,n){if(n)return!!e.closest?.(t);let i=e;for(;i?.nodeType===1;){if(i.matches(t))return!0;if(i===r)break;i=i.parentElement}return!1}function ui(e,t,r,n,i,o,a,s){if(e.nodeType===1&&((a?ai(e,r):ci(e,n,o,!1))||i&&ci(e,i,o,a)))return null;let l=t.importNode(e,!1);s.cloneToLive.set(l,e),s.liveToClone.set(e,l);let u=e.nodeType===1&&e.tagName==="TEMPLATE"?e.content:e,m=l.nodeType===1&&l.tagName==="TEMPLATE"?l.content:l;u!==e&&(s.cloneToLive.set(m,u),s.liveToClone.set(u,m));for(let y of u.childNodes||[]){let c=ui(y,t,r,n,i,o,a,s);c&&(m.appendChild(c),y.nodeType===1&&li(y,c))}return e.nodeType===1&&li(e,l),l}function Et(e,{capability:t="data",exclude:r=null,inherit:n=!0}={}){if(!e)throw new TypeError("createContentView requires a DOM context");let i=e.nodeType===9?e:e.ownerDocument;if(!i?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let o=i.implementation.createHTMLDocument(""),a=new WeakMap,s=new WeakMap,l=e.nodeType===9?e.documentElement:e;r&&o.documentElement.matches(r);let u=St(t),m=ui(l,o,t,u,r,l,n,{cloneToLive:a,liveToClone:s});e.nodeType===9&&m&&(o.replaceChild(m,o.documentElement),s.set(e,o),a.set(o,e));let y=c=>{if(la.test(c))throw new Error(`Filtered content queries do not support stateful selector: ${c}`)};return{root:m,document:o,capability:t,selector:St(t),cloneToLive:a,liveToClone:s,original(c){return a.get(c)||null},cloneOf(c){return s.get(c)||null},query(c,h=m){return y(c),Array.from(h.querySelectorAll(c),f=>a.get(f)||f)},text(c=m){return(c===m?m:s.get(c))?.textContent||""},html(c=m){return(c===m?m:s.get(c))?.innerHTML??""},clone(c=m){let h=c===m?m:s.get(c);return h?o.importNode(h,!0):null}}}function di(e){return e&&e.nodeType===1&&e.tagName==="SCRIPT"&&e.hasAttribute&&e.hasAttribute("data-rules-name")}function ca(e){return e?(e.nodeType===9||e.nodeType===11,e):null}var ce={semanticExclude:!0,find(e,t,r={}){let n=ca(e);if(!n||!n.querySelectorAll)return[];let i=Array.from(n.querySelectorAll(t));r.includeRulesTag||(i=i.filter(s=>!di(s)));let o=[];r.skip&&o.push(r.skip);let a=r.templateAttr===null?null:r.templateAttr||"cms-template";if(a&&o.push("["+a+"]"),o.length){let s=o.join(", ");i=i.filter(l=>!l.closest||!l.closest(s))}return i},parent(e){return e?e.parentElement:null},children(e){return e?Array.from(e.children):[]},text(e,t){if(t===void 0)return(e.textContent||"").trim();e.textContent=t},attr(e,t,r){if(r===void 0)return e.hasAttribute&&e.hasAttribute(t)?e.getAttribute(t):null;e.setAttribute(t,r)},removeAttr(e,t){e&&e.removeAttribute&&e.removeAttribute(t)},prop(e,t,r){if(r===void 0){let n=e?e[t]:void 0;return n!==void 0?n:null}e[t]=r},clone(e){return e.cloneNode(!0)},insertAt(e,t,r){let n=e.children[r]||null;e.insertBefore(t,n)},remove(e){e&&e.parentNode&&e.parentNode.removeChild(e)},replaceWith(e,t){if(!e||!e.parentNode)throw new Error("dom.replaceWith: node has no parent");let n=e.ownerDocument.createElement("template");n.innerHTML=t;let i=n.content.firstElementChild;if(!i)throw new Error("dom.replaceWith: html did not parse to an element");return e.parentNode.replaceChild(i,e),i},stripIds(e){let t=0;return e.id&&(e.removeAttribute("id"),t++),(e.querySelectorAll?e.querySelectorAll("[id]"):[]).forEach(n=>{n.removeAttribute("id"),t++}),t},sameNode(e,t){return e===t}};function Ae(e,t={}){if(t.exclude===null)return ce;let r=[St("data"),t.exclude].filter(Boolean).join(", "),n=e.nodeType===9?e:e.ownerDocument||e,i=e.nodeType===9?e.documentElement:e;if(!t._write&&!i?.matches?.(r)&&!i?.querySelector?.(r)&&!n?.querySelector?.(r))return ce;let o=e.nodeType===9||!e.isConnected?e:e.ownerDocument,a=e.nodeType===9?e:e.ownerDocument,s=null,l=()=>s||(s=Et(o,{capability:"data",exclude:t.exclude||null})),u=f=>{let b=l();return f===e?b.cloneOf(e):b.cloneOf(f)||f},m=f=>s?.original(f)||f,y=(f,b)=>{l().liveToClone.set(f,b),l().cloneToLive.set(b,f);let k=f.childNodes||[],A=b.childNodes||[];for(let E=0;E<Math.min(k.length,A.length);E++)y(k[E],A[E])},c=(f,b,k,A)=>{let E=Array.from(f.childNodes).filter(U=>s.cloneOf(U)),D=E[0];for(;D&&E.includes(D);)D=D.nextSibling;for(let U of E)U.remove();if(k==="innerHTML"){let U=a.createElement("template");U.innerHTML=A;for(let ie of Array.from(U.content.childNodes))f.insertBefore(ie,D||null)}else f.insertBefore(a.createTextNode(A),D||null);let O=Et(f,{capability:"data",exclude:t.exclude||null});b.replaceChildren(...Array.from(O.root?.childNodes||[]));let W=U=>{let ie=O.original(U);ie&&(s.liveToClone.set(ie,U),s.cloneToLive.set(U,ie));for(let ee of Array.from(U.childNodes||[]))W(ee)};for(let U of Array.from(b.childNodes))W(U)},h={...ce,find(f,b,k={}){let A=u(f);if(!A?.querySelectorAll)return[];let E=l().query(b,A);k.includeRulesTag||(E=E.filter(O=>!di(O)));let L=[];k.skip&&L.push(k.skip);let D=k.templateAttr===null?null:k.templateAttr||"cms-template";if(D&&L.push(`[${D}]`),L.length){let O=L.join(", ");E=E.filter(W=>!W.closest?.(O))}return E},parent(f){let b=u(f)?.parentElement;return b?m(b):null},children(f){return Array.from(u(f)?.children||[],m)},text(f,b){if(b===void 0){let E=m(f);return!E?.matches?.(r)&&!E?.querySelector?.(r)?ce.text(E):(u(f)?.textContent||"").trim()}let k=m(f);if(!k?.matches?.(r)&&!k?.querySelector?.(r)&&!s){ce.text(k,b);return}let A=l().cloneOf(k);A?c(k,A,"textContent",b):ce.text(k,b)},attr(f,b,k){let A=m(f);if(k===void 0)return ce.attr(A,b);ce.attr(A,b,k);let E=s?.cloneOf(A);E&&(ce.attr(E,b,k),Et(A,{capability:"data",exclude:t.exclude||null}).root===null&&(E.remove(),s.liveToClone.delete(A),s.cloneToLive.delete(E)))},removeAttr(f,b){let k=m(f);ce.removeAttr(k,b);let A=s?.cloneOf(k);A&&ce.removeAttr(A,b)},prop(f,b,k){let A=m(f);if(k===void 0)return b==="innerHTML"||b==="outerHTML"||b==="textContent"||b==="innerText"?ce.prop(u(A),b):ce.prop(A,b);let E=b==="innerHTML"||b==="textContent"||b==="innerText",L=E?l().cloneOf(A):s?.cloneOf(A);L&&E?c(A,L,b,k):(ce.prop(A,b,k),L&&ce.prop(L,b,k))},clone(f){let b=u(f);return b===f?ce.clone(f):a.importNode(b,!0)},insertAt(f,b,k){let A=m(f),L=h.children(A)[k]||(()=>{for(let W=A.children.length-1;W>=0;W--){let U=A.children[W];if(l().cloneOf(U))return U.nextElementSibling}return A.firstElementChild})(),D=m(b);A.insertBefore(D,L||null);let O=l().cloneOf(A);if(O){let W=l().cloneOf(D);W||(W=a.importNode(D,!0),y(D,W));let U=Array.from(O.children);O.insertBefore(W,U[k]||null)}},remove(f){let b=m(f),k=l().cloneOf(b);ce.remove(b),k&&ce.remove(k)},replaceWith(f,b){let k=m(f),A=l().cloneOf(k),E=ce.replaceWith(k,b);if(A){let L=Et(E,{capability:"data",exclude:t.exclude||null});if(!L.root)A.remove();else{A.replaceWith(L.root);let D=O=>{let W=L.original(O);W&&(s.liveToClone.set(W,O),s.cloneToLive.set(O,W));for(let U of Array.from(O.childNodes||[]))D(U)};D(L.root)}}return E}};return h}var Je=ce;function Kr(e){try{return JSON.parse(e)}catch(t){throw new Ke(`Invalid strict JSON: ${t.message}`,t)}}function Xe(e){try{return JSON.parse(e)}catch{}let t={BRACE_OPEN:"{",BRACE_CLOSE:"}",BRACKET_OPEN:"[",BRACKET_CLOSE:"]",COLON:":",COMMA:",",STRING:"STRING",SELECTOR:"SELECTOR",IDENTIFIER:"IDENTIFIER",NUMBER:"NUMBER",BOOLEAN:"BOOLEAN"};function r(i){let o=[],a=0;for(;a<i.length;){let s=i[a];if(/\s/.test(s)){a++;continue}if("{}".includes(s)){o.push({type:s,value:s}),a++;continue}if(s==="["){let y=!1,c=a+1;for(;c<i.length&&/\s/.test(i[c]);)c++;if(c<i.length&&/[a-zA-Z_]/.test(i[c])&&(y=!0),!y){o.push({type:s,value:s}),a++;continue}}if(s==="]"){o.push({type:s,value:s}),a++;continue}if(s===":"){o.push({type:t.COLON,value:s}),a++;continue}if(s===","){o.push({type:t.COMMA,value:s}),a++;continue}if(s==='"'||s==="'"){let y=s,c=a+1;for(;c<i.length&&i[c]!==y;)i[c]==="\\"&&c++,c++;o.push({type:t.STRING,value:i.substring(a+1,c),quoted:!0,sourceQuote:y}),a=c+1;continue}let l=a,u;for(;l<i.length&&!/[{},]/.test(i[l]);)if(i[l]===":"){let y=[":first",":last",":nth-child",":nth-of-type",":first-child",":last-child",":first-of-type",":last-of-type",":only-child",":only-of-type",":hover",":focus",":active",":visited",":disabled",":enabled",":checked",":empty",":root",":target",":not",":before",":after",":nth-last-child",":nth-last-of-type"],c=!1;for(let h of y){let f=h.substring(1);if(i.substring(l+1,l+1+f.length)===f){c=!0,l+=f.length;break}}if(!c)break}else if(i[l]==="["){for(l++;l<i.length&&i[l]!=="]";){if(i[l]==='"'||i[l]==="'"){let y=i[l];for(l++;l<i.length&&i[l]!==y;)i[l]==="\\"&&l++,l++}l++}l<i.length&&i[l]==="]"&&l++}else l++;u=i.substring(a,l);let m=t.IDENTIFIER;/^-?\d+(\.\d+)?$/.test(u)?m=t.NUMBER:u==="true"||u==="false"||u==="null"?m=t.BOOLEAN:/^[.#@\[]|[.#@\[]| /.test(u)&&(m=t.SELECTOR),o.push({type:m,value:u,quoted:!1}),a=l}return o}function n(i){let o="";for(let a=0;a<i.length;a++){let s=i[a];if("{}".includes(s.type)||"[]".includes(s.type)){o+=s.value;continue}if(s.type===t.COLON){o+=s.value;continue}if(s.type===t.COMMA){let l=i[a+1];if(l&&(l.type==="}"||l.type==="]"))continue;o+=s.value;continue}if(s.type===t.STRING&&s.quoted){let l=s.value;s.sourceQuote==="'"&&(l=l.replace(/\\'/g,"'"),l=l.replace(/(\\*)"/g,(u,m)=>m.length%2===0?m+'\\"':u)),o+=`"${l}"`;continue}if(s.type===t.NUMBER||s.type===t.BOOLEAN){o+=s.value;continue}if(s.type===t.SELECTOR||s.type===t.IDENTIFIER){o+=`"${s.value}"`;continue}o+=`"${s.value}"`}return o}try{let i=r(e),o=n(i);return JSON.parse(o)}catch(i){throw new Ke("Invalid extraction rules syntax: "+i.message,i)}}var mi="1",hi=/^[a-zA-Z0-9_-]+$/;function _t(e,t,r){let n;if(r===void 0)n="script[data-rules-name]";else{if(typeof r!="string"||!hi.test(r))throw new Error(`hyper-html-api: invalid rules token ${JSON.stringify(r)} (must match ${hi})`);n=`script[data-rules-name~="${r}"]`}let i=e.find(t,n,{includeRulesTag:!0});if(i.length===0)return null;r!==void 0&&i.length>1&&console.warn(`hyper-html-api: ${i.length} rules tags match data-rules-name~="${r}"; using the first.`);let o=i[0],a=e.attr(o,"data-rules-version");if(a!==mi)throw new Ge(a);return{rules:Xe(e.text(o)),tagNode:o}}var vd=new Function("url","return import(url)");function ki(e,t,r,n){let i=e.length,o=t.length,a=new Array(i).fill(-1);if(n){let k=new Set;for(let A=0;A<i;A++){let E=n[A];!(E>=0&&E<o)||k.has(E)||(a[A]=E,k.add(E))}}if(i===0||o===0)return a;let s=e.map(k=>bi(k,r)),l=t.map(k=>bi(k,r)),u=new Array(o).fill(!1);for(let k of a)k>=0&&(u[k]=!0);let m=new Map;l.forEach((k,A)=>{u[A]||m.set(k,m.has(k)?-1:A)});let y=new Map;s.forEach((k,A)=>{a[A]>=0||y.set(k,(y.get(k)||0)+1)}),s.forEach((k,A)=>{if(a[A]>=0||y.get(k)!==1)return;let E=m.get(k);E===void 0||E===-1||u[E]||(a[A]=E,u[E]=!0)});let c=[];for(let k=0;k<i;k++)a[k]<0&&c.push(k);let h=[];for(let k=0;k<o;k++)u[k]||h.push(k);if(c.length===0||h.length===0)return a;let f=i*o+1,b=(k,A)=>da(e[k],t[A],r)*f+Math.abs(k-A);for(let[k,A]of ha(c,h,b))a[k]=A;return a}var vi=e=>typeof e=="object"&&e!==null;function bi(e,t){if(!vi(t))return e==null?" null":String(e);let r=Object.keys(t);return JSON.stringify(r.map(n=>{let i=JSON.stringify(e?.[n]);return i===void 0?" undef":i}))}function da(e,t,r){if(!vi(r))return e===t?0:1;let n=Object.keys(r);if(n.length===0)return 0;let i=0;for(let o of n){let a=JSON.stringify(e?.[o]),s=JSON.stringify(t?.[o]);a!==s&&i++}return i}function ha(e,t,r){return e.length<=t.length?yi(e,t,r,!1):yi(t,e,(n,i)=>r(i,n),!0)}function yi(e,t,r,n){let i=e.length,o=t.length,a=[];for(let y=0;y<=i;y++)a.push(new Float64Array(o+1).fill(1/0));let s=[];for(let y=0;y<=i;y++)s.push(new Uint8Array(o+1));for(let y=0;y<=o;y++)a[i][y]=0;for(let y=i-1;y>=0;y--)for(let c=o-1;c>=0;c--){let h=r(e[y],t[c])+a[y+1][c+1],f=a[y][c+1];h<=f?(a[y][c]=h,s[y][c]=1):a[y][c]=f}let l=[],u=0,m=0;for(;u<i&&m<o;)s[u][m]&&(l.push(n?[t[m],e[u]]:[e[u],t[m]]),u++),m++;return l}function Yr(e,t,r,n,i,o,a,s={}){let l=e.find(t,r,s);if(i.length===0){l.forEach(O=>e.remove(O)),Gr(s,"onRowsApplied",o.path,[]);return}let u=i.length>l.length,m=l[0]||null;if(u&&!m&&(m=ga(e,t,r,s),!m))throw new wt(o.path);let y=l.map(O=>pa(e,O,n,s)),c=null;if(u&&m){c=e.clone(m),s.templateAttr&&e.removeAttr(c,s.templateAttr);let O=e.stripIds(c);O>0&&console.warn(`[hyper-html-api] stripped ${O} id attribute(s) from cloned template at "${o.path.join(".")||"(root)"}"`)}let h=ki(i,y,n,ma(e,l,i,o,s)),f=l[0]||m,b=e.parent(f),k=l.length>0?xi(e,b,f):0,A=ba(e,l),E=new Set,L=[],D=i.map((O,W)=>{let U=h[W];if(U>=0)return E.add(U),L.push(!1),l[U];L.push(!0);let ie=e.clone(c);return e.stripIds(ie),ie});l.forEach((O,W)=>{E.has(W)||e.remove(O)}),A?D.forEach((O,W)=>{let U=k+W;e.children(b).findIndex(me=>e.sameNode(me,O))!==U&&e.insertAt(b,O,U)}):ya(e,D,L,b,k),fa(e,D,n,i,o,a,s),Gr(s,"onRowsApplied",o.path,D)}function Gr(e,t,r,n){if(typeof e[t]=="function")try{return e[t](r.slice(),n)}catch(i){console.warn(`[hyper-html-api] ${t} threw at "${r.join(".")||"(root)"}"`,i);return}}function ma(e,t,r,n,i){let o=Gr(i,"identifyRows",n.path,r);if(!Array.isArray(o))return null;let a=new Array(r.length).fill(-1),s=new Set;for(let l=0;l<r.length;l++)if(o[l]){for(let u=0;u<t.length;u++)if(!(s.has(u)||!e.sameNode(t[u],o[l]))){a[l]=u,s.add(u);break}}return a}function fa(e,t,r,n,i,o,a){t.forEach((s,l)=>{if(r===null){let u=n[l],m=u==null?"":String(u);e.text(s)!==m&&e.text(s,m)}else{let u=o(e,s,r,n[l],{depth:i.depth+1,path:[...i.path,l]},a);u&&u!==s&&(t[l]=u)}})}function pa(e,t,r,n){return r===null?e.text(t):Oe(e,t,r,n.onRowsRead?{...n,onRowsRead:void 0}:n)}function xi(e,t,r){let n=e.children(t);for(let i=0;i<n.length;i++)if(e.sameNode(n[i],r))return i;return-1}function ga(e,t,r,n){if(!n.templateAttr)return null;let i=t;for(;i;){let o=e.find(i,r,{includeRulesTag:!1,templateAttr:null});for(let a of o)if(e.attr(a,n.templateAttr)!=null)return a;i=e.parent(i)}return null}function ba(e,t){if(t.length<=1)return!0;let r=e.parent(t[0]);if(!r)return!1;let n=e.children(r),i=[];for(let o of t){let a=n.findIndex(s=>e.sameNode(s,o));if(a===-1)return!1;i.push(a)}return i.sort((o,a)=>o-a),i[i.length-1]-i[0]===i.length-1}function ya(e,t,r,n,i){let o=null,a=i;for(let s=0;s<t.length;s++){if(!r[s]){o=t[s];continue}let l=o?e.parent(o):n;if(!l)continue;let u=o?xi(e,l,o)+1:a++;e.insertAt(l,t[s],u),o=t[s]}}var wi=new Set(["checked","selected","disabled","readOnly","paused"]);function Ze(e,t,r,n,i={}){if(Object.prototype.hasOwnProperty.call(i,"exclude")&&e.semanticExclude===!1)throw new Error("This adapter does not support semantic exclude queries; omit exclude or use the DOM adapter.");let o=[];if(Jr(r,n,[],o),o.length)throw new xt(o);Gt(e,t,r,n,{depth:0,path:[]},i)}function Gt(e,t,r,n,i,o={}){if(i.depth>Ye)throw new $e(i.path);if(n===void 0)return t;if(typeof r=="string")return ka(e,t,r,n,i,o);if(Array.isArray(r)){let[a,s]=r;return Yr(e,t,a,s,n,i,Gt,o),t}if(typeof r=="object"&&r!==null){for(let[a,s]of Object.entries(r)){let l=Gt(e,t,s,n==null?n:n[a],{depth:i.depth+1,path:[...i.path,a]},o);l&&l!==t&&(t=l)}return t}return t}function ka(e,t,r,n,i,o){if(r.endsWith("[]")){let l=r.slice(0,-2);return Yr(e,t,l,null,n,i,Gt,o),t}if(r.startsWith("@"))return Si(e,t,r.slice(1),n);let a=ae(r);if(a!==-1){let l=r.slice(0,a),u=r.slice(a+1),m=l?e.find(t,l,o):[t];return m.length===0||Si(e,m[0],u,n),t}if(r===".")return Ai(e,t,n),t;let s=e.find(t,r,o);return s.length===0||Ai(e,s[0],n),t}function Ai(e,t,r){let n=r==null?"":String(r);e.text(t)!==n&&e.text(t,n)}function Si(e,t,r,n){if(vt.has(r))throw new At(r);if(r==="outerHTML"){let o=n==null?"":String(n);return e.replaceWith(t,o)}if(ni.has(r)){let o=va(r,n);return e.prop(t,r)!==o&&e.prop(t,r,o),t}let i=n==null?"":String(n);return e.attr(t,r)!==i&&e.attr(t,r,i),t}function va(e,t){return t==null?wi.has(e)?!1:"":wi.has(e)?t==="false"?!1:!!t:t}function Jr(e,t,r,n){if(t!==void 0){if(typeof e=="string"){if(e.endsWith("[]")){Array.isArray(t)?t.forEach((i,o)=>{typeof i=="object"&&i!==null&&n.push({path:Ct([...r,o]),expected:"scalar",got:Tt(i)})}):n.push({path:Ct(r),expected:"array",got:Tt(t)});return}t!==null&&typeof t=="object"&&n.push({path:Ct(r),expected:"scalar",got:Tt(t)});return}if(Array.isArray(e)){if(!Array.isArray(t)){n.push({path:Ct(r),expected:"array",got:Tt(t)});return}let i=e[1];t.forEach((o,a)=>Jr(i,o,[...r,a],n));return}if(typeof e=="object"&&e!==null){if(t===null||Array.isArray(t)||typeof t!="object"){n.push({path:Ct(r),expected:"object",got:Tt(t)});return}for(let[i,o]of Object.entries(e))Jr(o,t[i],[...r,i],n)}}}function Tt(e){return e===null?"null":Array.isArray(e)?"array":typeof e}function Ct(e){return e.join(".")}function Xr(e,t,r){if(r&&typeof r=="object")return{rules:r,tagNode:null};if(typeof r=="string"){let n=t&&t.ownerDocument?t.ownerDocument:t;return _t(e,n,r)}return null}var fe={extract:(e,t,r={})=>Oe(Ae(e,r),e,t,r),apply:(e,t,r,n={})=>Ze(Ae(e,{...n,_write:!0}),e,t,r,n),findRulesIn:(e,t)=>_t(Je,e,t),findRules:(e,t)=>Xr(Je,e,t),bind:(e,t,r={})=>{let n=Xr(Je,e,t);if(!n){let i=typeof t=="string"?`data-rules-name~="${t}"`:"the provided rules object";throw new Error(`hyper-html-api: could not resolve rules for ${i}`)}return{...n,get:()=>Oe(Ae(e,r),e,n.rules,r),set:i=>Ze(Ae(e,{...r,_write:!0}),e,n.rules,i,r)}},parseStrict:Kr,parseRelaxed:Xe,ruleAttrIndex:ae,splitRule:Ht,errors:Kt,DOM_PROPERTIES:Wt};var Qr={};qr(Qr,{fromString:()=>Se,getRuleAtPath:()=>Pe,getValueAtPath:()=>Ia,setAtPath:()=>Zr,toString:()=>La});function La(e){return e.map(String).join(".")}function Se(e){return e===""?[]:e.split(".").map(t=>/^\d+$/.test(t)?Number(t):t)}function Pe(e,t){let r=e;for(let n of t){if(r==null)return;if(typeof r=="string"){if(r.endsWith("[]")&&(typeof n=="number"||n==="*")){r=r.slice(0,-2);continue}return}if(Array.isArray(r)){if(typeof n!="number"&&n!=="*")return;r=r[1];continue}if(typeof r=="object"){if(typeof n=="number"||!(n in r))return;r=r[n];continue}return}return r}function Ia(e,t){let r=e;for(let n of t){if(r==null)return;r=r[n]}return r}function Zr(e,t,r){if(t.length===0)return r;let[n,...i]=t;if(typeof n=="number"){let o=Array.isArray(e)?[...e]:[];return o[n]=Zr(o[n],i,r),o}return{...e&&typeof e=="object"?e:{},[n]:Zr((e||{})[n],i,r)}}function Ot(e){if(typeof e=="string")return e.endsWith("[]")?[]:"";if(Array.isArray(e))return[];if(typeof e=="object"&&e!==null){let t={};for(let[r,n]of Object.entries(e))t[r]=Ot(n);return t}return""}function Yt(e,t,{ignoreActiveValue:r=!0}={}){Hr.morph(e,t,{morphStyle:"innerHTML",ignoreActiveValue:r,restoreFocus:!0,formStateSync:"property",policy:"raw"})}var _i=new WeakMap,en=e=>e.map(String).join(".");function ja(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}function Ti(e,t){if(!e||!e.querySelector)return null;let r=e.querySelector(`[data-hcms-path="${ja(t)}"]`),n=r&&r.querySelector(".hcms-array-items");return n?Array.from(n.children).filter(i=>i.matches&&i.matches("[data-hcms-card], [data-hcms-array-item]")):null}function Ci(e,t,r){let n=Ti(e,t);!n||n.length!==r.length||n.forEach((i,o)=>{r[o]&&_i.set(i,r[o])})}function Jt(){let e=new Map;return{hooks:{onRowsRead(t,r){e.set(en(t),r)}},seed(t){for(let[r,n]of e)Ci(t,r,n);e.clear()}}}function Oi(e){return{identifyRows(t,r){let n=Ti(e,en(t));return!n||n.length!==r.length?null:n.map(i=>_i.get(i)||null)},onRowsApplied(t,r){Ci(e,en(t),r)}}}var Ri={skip:"[data-hcms-shell]",templateAttr:"cms-template"},tn="data-hcms-rollback-ui",Fa=0;function Mi(e,t,r,n={}){return Da(e,t,r,n)}function Da(e,t,r,n){let{shellRoot:i,structural:o,structuralPath:a,formRoot:s}=n,l=s?{...Ri,...Oi(s)}:Ri;if(!o)try{return fe.apply(e,t,r,l),{ok:!0}}catch(c){return{ok:!1,error:c}}let u=qa(e,t,a),m=u?Pa(u):null,y=u?null:za(e,i);try{return fe.apply(e,t,r,l),{ok:!0}}catch(c){return m?Ba(u,m):y&&Ha(e,i,y),{ok:!1,error:c}}}function qa(e,t,r){if(!r||!e)return null;let n=Se(r),i=[],o=t;for(let a of n){if(typeof o=="string"||o==null||Array.isArray(o))break;if(typeof o=="object"&&a in o){if(i.push(a),o=o[a],Array.isArray(o)||typeof o=="string"&&o.endsWith("[]"))break}else return null}return!Array.isArray(o)&&!(typeof o=="string"&&o.endsWith("[]"))?null:$a(e,t,i)}function $a(e,t,r){if(r.length===0)return null;let n=e,i=t;for(let o=0;o<r.length;o++){let a=r[o];if(!i||typeof i!="object"||Array.isArray(i))return null;let s=i[a];if(s==null)return null;if(o===r.length-1){if(Array.isArray(s)){let[l]=s;return n.querySelector?.(l)?.parentElement||null}if(typeof s=="string"&&s.endsWith("[]")){let l=s.slice(0,-2);return n.querySelector?.(l)?.parentElement||null}return null}i=s}return null}function Pa(e){let t=[],r=[];for(let n of Array.from(e.childNodes))t.push(rn(n,r));return{nodes:t,retained:r}}function Ba(e,t){let r=e.cloneNode(!1);for(let n of t.nodes)r.appendChild(n);kt(e,Array.from(r.childNodes),Li()),Ni(e,t.retained)}function za(e,t){let r=[],n=[];for(let i of Array.from(e.childNodes))i===t||t&&i.contains?.(t)||r.push(rn(i,n));return{nodes:r,retained:n}}function Ha(e,t,r){let n=e.cloneNode(!1);for(let i of r.nodes)n.appendChild(i);kt(e,Array.from(n.childNodes),Li()),Ni(e,r.retained)}function rn(e,t){let r=e.cloneNode(!1);if(e.nodeType===1&&e.matches('[editor-ui],[clay~="editor-ui"]')){let o=String(++Fa);r.setAttribute(tn,o),t.push({id:o,node:e})}let n=e.nodeType===1&&e.tagName==="TEMPLATE"?e.content:e,i=r.nodeType===1&&r.tagName==="TEMPLATE"?r.content:r;for(let o of Array.from(n.childNodes||[]))i.appendChild(rn(o,t));return r}function Ni(e,t){for(let{id:r,node:n}of t){let i=e.querySelector(`[${tn}="${r}"]`);i===n?n.removeAttribute(tn):n.isConnected?i?.remove():i?.replaceWith(n)}}function Li(){return{morphStyle:"innerHTML",policy:"raw",restoreFocus:!1,scripts:{handle:!1,merge:!1}}}function Zt(e){return e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").replace(/[-_]/g," ").replace(/\s+/g," ").trim().replace(/^./,t=>t.toUpperCase())}var Ua='<div class="hcms-drag-handle mirk-sortable__grip" aria-hidden="true"><div class="mirk-sortable__dots"><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span><span class="mirk-sortable__dot"></span></div></div>',nn='<svg class="hcms-x" viewBox="0 0 16 16" shape-rendering="crispEdges" aria-hidden="true"><path d="M4 4 L12 12 M12 4 L4 12" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="square"></path></svg>',Fi={"@scalar":`
|
|
3
3
|
<label class="hcms-field" data-hcms-shape="scalar">
|
|
4
4
|
<span class="hcms-label" data-hcms-label></span>
|
|
5
5
|
<textarea class="mirk-textarea" rows="1" data-hcms-field></textarea>
|
|
@@ -39,13 +39,13 @@ var hypercms=(()=>{var Dt=Object.defineProperty;var ai=Object.getOwnPropertyDesc
|
|
|
39
39
|
</section>
|
|
40
40
|
`,"@object-array-item":`
|
|
41
41
|
<article class="hcms-card mirk-sortable__item" draggable="true">
|
|
42
|
-
${
|
|
42
|
+
${Ua}
|
|
43
43
|
<div class="hcms-card-body mirk-sortable__body">
|
|
44
44
|
<div class="hcms-card-fields"></div>
|
|
45
45
|
<div class="hcms-card-controls">
|
|
46
46
|
<button type="button" class="hcms-move hcms-move-up hcms-sr-only" data-hcms-action="move-up" aria-label="Move up">\u2191</button>
|
|
47
47
|
<button type="button" class="hcms-move hcms-move-down hcms-sr-only" data-hcms-action="move-down" aria-label="Move down">\u2193</button>
|
|
48
|
-
<button type="button" class="hcms-remove hcms-remove--card" data-hcms-action="remove" aria-label="Remove">${
|
|
48
|
+
<button type="button" class="hcms-remove hcms-remove--card" data-hcms-action="remove" aria-label="Remove">${nn}</button>
|
|
49
49
|
</div>
|
|
50
50
|
</div>
|
|
51
51
|
<div class="hcms-error" hidden></div>
|
|
@@ -59,7 +59,7 @@ var hypercms=(()=>{var Dt=Object.defineProperty;var ai=Object.getOwnPropertyDesc
|
|
|
59
59
|
<span class="mirk-button__label">Choose</span>
|
|
60
60
|
</label>
|
|
61
61
|
<a class="mirk-file__name" data-hcms-field></a>
|
|
62
|
-
<button type="button" class="hcms-upload-clear" data-hcms-action="clear-upload" aria-label="Remove file">${
|
|
62
|
+
<button type="button" class="hcms-upload-clear" data-hcms-action="clear-upload" aria-label="Remove file">${nn}</button>
|
|
63
63
|
</div>
|
|
64
64
|
<div class="hcms-error" hidden></div>
|
|
65
65
|
</div>
|
|
@@ -73,7 +73,7 @@ var hypercms=(()=>{var Dt=Object.defineProperty;var ai=Object.getOwnPropertyDesc
|
|
|
73
73
|
</label>
|
|
74
74
|
<figure class="mirk-image__thumb">
|
|
75
75
|
<span class="mirk-image__frame"><img class="mirk-image__preview" data-hcms-field alt="" /></span>
|
|
76
|
-
<button type="button" class="hcms-upload-clear hcms-upload-clear--badge" data-hcms-action="clear-upload" aria-label="Remove image">${
|
|
76
|
+
<button type="button" class="hcms-upload-clear hcms-upload-clear--badge" data-hcms-action="clear-upload" aria-label="Remove image">${nn}</button>
|
|
77
77
|
</figure>
|
|
78
78
|
</div>
|
|
79
79
|
<div class="hcms-error" hidden></div>
|
|
@@ -147,11 +147,11 @@ var hypercms=(()=>{var Dt=Object.defineProperty;var ai=Object.getOwnPropertyDesc
|
|
|
147
147
|
<input class="hcms-chip-field" data-hcms-field aria-label="Item" placeholder="\u2026" />
|
|
148
148
|
<button type="button" class="hcms-remove" data-hcms-action="remove" aria-label="Remove">\xD7</button>
|
|
149
149
|
</span>
|
|
150
|
-
`},po=["@scalar","@object","@scalar-array","@scalar-array-item","@object-array","@object-array-item"];function ht(e){let t=e.head||e.documentElement;if(t)for(let r of po)mn(e,t,r)}function er(e,t){if(!ln[t])return null;let r=e&&(e.head||e.documentElement);return r?mn(e,r,t):null}var sn={src:"@image",checked:"@checkbox",innerHTML:"@richtext"},ut={image:"@image",file:"@file",checkbox:"@checkbox",toggle:"@toggle",select:"@select",radio:"@radio",textarea:"@textarea",number:"@number",richtext:"@richtext"},fo=new Set([...Object.values(ut),"@chips","@chips-item"]);function Qe(e,t,r,n){if(typeof e!="string")return"@scalar";let i=Z(e),o=gt(e,i,r,n),s=bt(o,t,"data-hcms-component");if(s&&ut[s]){let a=ut[s],l=Array.isArray(r)&&r.some(c=>c==="*"||typeof c=="number");return a==="@number"&&!an(e,i,t,l,o).every(bo)||(a==="@checkbox"||a==="@toggle")&&(i<0||e.slice(i+1)!=="checked")&&!an(e,i,t,l,o).every(ko)?"@scalar":a}if(i>=0){let a=e.slice(i+1);if(sn[a])return sn[a]}return"@scalar"}function cn(e,t,r,n){if(typeof e!="string")return null;let i=Z(e),o=bt(gt(e,i,r,n),t,"data-hcms-component");return o&&ut[o]||null}var go=/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/;function bo(e){return e==null||e===""?!0:go.test(String(e))}function ko(e){return e==null||e===""||e==="true"||e==="false"}function an(e,t,r,n,i){if(!r||!r.querySelectorAll)return[];if(!i||i===".")return[];let o=null;try{o=r.querySelectorAll(i)}catch{return[]}let s=t>=0?e.slice(t+1):null,a=[];for(let l of o)if(!(l.closest&&l.closest("[cms-template], [data-hcms-shell]"))&&(s?s==="value"&&"value"in l?a.push(l.value):a.push(l.getAttribute?l.getAttribute(s):null):a.push((l.textContent||"").trim()),!n))break;return a}function pt(e,t){if(typeof e!="string"||!e.endsWith("[]")||!t||!t.querySelector)return null;let r=e.slice(0,-2).trim();if(!r)return null;let n=null;try{n=t.querySelector(r)}catch{return null}let i=n&&n.closest?n.closest("[data-hcms-component]"):null;return(i&&i.getAttribute?i.getAttribute("data-hcms-component"):null)==="chips"?{array:"@chips",item:"@chips-item"}:null}function Ie(e,t,r){let n=e.join("."),i=e.map(o=>typeof o=="number"?"*":o).join(".");return n&&ce(r,n)||i&&i!==n&&ce(r,i)||ce(r,t)}function ft(e,t,r){let n=pt(e,r);if(!n)return null;let i=Ie(t,n.array,r);return i&&i.getAttribute("data-hcms-tpl")===n.array?n:null}function dn(e,t,r,n){if(typeof e!="string")return null;let i=Z(e),o=bt(gt(e,i,r,n),t,"data-hcms-options");if(o==null)return null;let s=o.trim().split(/\s+/).filter(Boolean);return s.length?s:null}function un(e,t,r,n){if(typeof e!="string")return null;let i=Z(e);return bt(gt(e,i,r,n),t,"data-hcms-crop")}function yo(e,t){return t>=0?e.slice(0,t):e}function gt(e,t,r,n){let i=yo(e,t);return i&&i!=="."?i:vo(n,r)}function vo(e,t){if(e==null||!Array.isArray(t))return"";let r=[],n=e;for(let i of t){if(n==null||typeof n=="string")break;if(Array.isArray(n)){if(typeof n[0]!="string"||i!=="*"&&typeof i!="number")return"";r.push(n[0]),n=n[1];continue}if(typeof n!="object"||!Object.prototype.hasOwnProperty.call(n,i))return"";n=n[i]}return r.join(" ")}function bt(e,t,r){if(!t||!t.querySelector||!e||e===".")return null;let n=null;try{n=t.querySelector(e)}catch{return null}return n&&n.getAttribute?n.getAttribute(r):null}function kt(e,t){if(!e||t==null)return;r(t,[]);function r(n,i){let o=Ae(n);if(o==="scalar"){let s=Qe(n,e,i,t);fo.has(s)&&er(e,s);return}if(o==="scalar-array"){let s=pt(n,e);s&&(er(e,s.array),er(e,s.item));return}if(o==="object"){for(let[s,a]of Object.entries(n))r(a,[...i,s]);return}if(o==="object-array"){let s=n[1],a=[...i,"*"];if(s&&typeof s=="object"&&!Array.isArray(s))for(let[l,c]of Object.entries(s))r(c,[...a,l]);else r(s,a)}}}function mn(e,t,r){let n=ce(e,r);if(n)return n;let i=e.createElement("template");return i.setAttribute("data-hcms-tpl",r),i.setAttribute("save-remove",""),i.innerHTML=ln[r].trim(),t.appendChild(i),i}function ce(e,t){return!e||!e.querySelector?null:e.querySelector(`template[data-hcms-tpl="${xo(t)}"]`)}function xo(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}function Ae(e){return typeof e=="string"?e.endsWith("[]")?"scalar-array":"scalar":Array.isArray(e)?"object-array":typeof e=="object"&&e!==null?"object":"scalar"}function et(e){return e?!!(e.content||e).querySelector("[data-hcms-field]"):!1}var hn={IMG:"src",A:"href"};function yt(e){if(!e)return"value";let t=(e.tagName||"").toUpperCase();return t==="INPUT"?(e.getAttribute("type")||"text").toLowerCase()==="checkbox"?"checked":"value":t==="TEXTAREA"||t==="SELECT"?"value":hn[t]?hn[t]:e.hasAttribute&&e.hasAttribute("contenteditable")?"innerHTML":null}function pn(e,t){let r=(e.tagName||"").toUpperCase(),n=(e.getAttribute&&e.getAttribute("type")||"").toLowerCase(),i=yt(e),s=`${gn(r,n)}[data-hcms-field="${Le(t)}"]`;return r==="INPUT"&&n==="radio"?`${s}:checked@value`:i?`${s}@${i}`:s}function wo(e){let t=(e.tagName||"").toUpperCase(),r=(e.getAttribute&&e.getAttribute("type")||"").toLowerCase(),n=yt(e),o=`${gn(t,r)}[data-hcms-field]`;return t==="INPUT"&&r==="radio"?`${o}:checked@value`:n?`${o}@${n}`:o}function gn(e,t){return e==="INPUT"?t?`input[type="${t}"]`:"input":e==="TEXTAREA"?"textarea":e==="SELECT"?"select":e==="IMG"?"img":e==="A"?"a":':not([data-hcms-shape="scalar"]):not([data-hcms-shape="object"]):not([data-hcms-shape="object-array"]):not([data-hcms-shape="scalar-array"])'}function Le(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var fn=new Set(["__proto__","constructor","prototype"]);function vt(e,t){return r(e,[]);function r(c,u){let g=Ae(c);if(g==="scalar")return n(c,u);if(g==="scalar-array")return i(c,u);if(g==="object-array")return o(c,u);if(g==="object"){let d=Object.create(null);for(let[k,y]of Object.entries(c)){if(fn.has(k))throw new Error(`hypercms: rule key "${k}" is forbidden at "${u.join(".")||"<root>"}"`);d[k]=r(y,[...u,k])}return d}return null}function n(c,u){let g=u.length?u[u.length-1]:null,d=typeof g=="string"?g:"__value",k=l(u,d);if(k)return pn(k,d);let y=a(Qe(c,t,u,e),d);return y?pn(y,d):`input[data-hcms-field="${Le(d)}"]@value`}function i(c,u){let g=ft(c,u,t),d=g&&a(g.item,null)||a("@scalar-array-item",null),k=d?wo(d):"input[data-hcms-field]@value";return[s(u,"[data-hcms-array-item]"),k]}function o(c,u){let[,g]=c,d=[...u,"*"],k=s(u,"[data-hcms-card]");if(g&&typeof g=="object"&&!Array.isArray(g)){let y=Object.create(null);for(let[N,q]of Object.entries(g)){if(fn.has(N))throw new Error(`hypercms: rule key "${N}" is forbidden at "${d.join(".")}"`);y[N]=r(q,[...d,N])}return[k,y]}return[k,r(g,[...d,0])]}function s(c,u){let g=c.length?c[c.length-1]:"",d=c.some(N=>N==="*"),k=c.join(".");return`${d?`[data-hcms-field="${Le(g)}"]`:`[data-hcms-path="${Le(k)}"]`} > .hcms-array-items > ${u}`}function a(c,u){if(!t)return null;let g=ce(t,c);if(!g)return null;let d=g.content||g;if(u){let k=d.querySelector(`[data-hcms-field="${Le(u)}"]`);if(k)return k}return d.querySelector("[data-hcms-field]")}function l(c,u){if(!t)return null;let g=c.map(y=>typeof y=="number"?"*":y).join("."),k=[c.join("."),g];for(let y=c.length-1;y>=0;y--){let N=c.slice(0,y).map(q=>typeof q=="number"?"*":q);N.push("*"),k.push(N.join("."))}for(let y of k){if(!y)continue;let N=ce(t,y);if(!N||!et(N))continue;let q=N.content||N,H=q.querySelector(`[data-hcms-field="${Le(u)}"]`)||q.querySelector("[data-hcms-field]");if(H)return H}return null}}function tr(e){if(!e)return"";let t=String(e).split(/[?#]/)[0],r=t.split("/").pop()||t;try{return decodeURIComponent(r)}catch{return r}}function xt({pageRules:e,formRules:t,data:r,doc:n}){let i=n.createDocumentFragment(),o=rr(e,[],r,n,e);return o&&i.appendChild(o),i}function kn({shape:e,itemShape:t,pathArr:r,data:n,doc:i,itemKey:o,pageRules:s}){if(e==="object-array-item")return vn(t,r,n,i,s);if(e==="scalar-array-item")return xn(r,n,i,o||null);throw new Error(`hypercms: buildItem called with unknown shape "${e}"`)}function rr(e,t,r,n,i){let o=Ae(e);return o==="scalar"?_o(e,t,r,n,i):o==="object"?Co(e,t,r,n,i):o==="object-array"?To(e,t,r,n,i):o==="scalar-array"?Ro(e,t,r,n):null}function _o(e,t,r,n,i){let o=Qe(e,n,t,i),s=Ie(t,o,n);if(!s)throw new Error(`hypercms: missing template for scalar at "${t.join(".")}"`);let a=cn(e,n,t,i);a==="@number"&&o==="@scalar"&&console.info(`[hypercms] field "${t.join(".")}" declares component "@number" but its value isn't a plain number; rendering a text input so the value is preserved`),(a==="@checkbox"||a==="@toggle")&&o==="@scalar"&&console.info(`[hypercms] field "${t.join(".")}" declares component "${a}" but its value isn't true/false; rendering a text input so the value is preserved`),yn(s,a===o?a:null,t);let l=je(s,n);Fe(l,t);let c=s.getAttribute?.("data-hcms-tpl");if((o==="@select"||o==="@radio")&&c===o&&Ao(l,e,t,r,n,o,i),o==="@image"&&c==="@image"){let u=un(e,n,t,i);u!=null&&!l.hasAttribute("data-hcms-crop")&&l.setAttribute("data-hcms-crop",u)}return Oo(l,he(t)),wt(l,he(t)),_t(l,he(t)),En(l,r),o==="@file"&&Eo(l),l}function yn(e,t,r){if(!t)return;let n=e.getAttribute?.("data-hcms-tpl");n&&n!==t&&console.info(`[hypercms] field "${r.join(".")}" declares component "${t}" but custom template "${n}" wins`)}function Ao(e,t,r,n,i,o,s){let a=dn(t,i,r,s),l=a?[...a]:[],c=n==null?"":String(n);if(c!==""&&!l.includes(c)&&l.unshift(c),!a&&(So(e,"data-hcms-options required (space-separated values)"),l.length===0)){e.querySelector(".mirk-radio")?.remove();return}if(o==="@select"){let d=e.querySelector("select[data-hcms-field]");if(!d)return;for(let k of l){let y=i.createElement("option");y.value=k,y.textContent=mt(k),d.appendChild(y)}return}let u=e.querySelector(".mirk-radio");if(!u||!u.parentNode)return;let g=nr(r.join("."));for(let d of l){let k=u.cloneNode(!0),y=k.querySelector('input[type="radio"]');y&&(y.value=d,y.name=g);let N=k.querySelector(".mirk-radio__label");N&&(N.textContent=mt(d)),u.parentNode.insertBefore(k,u)}u.remove()}function nr(e){return"hcms-"+String(e).replace(/[^A-Za-z0-9_-]/g,"-")}function So(e,t){let r=e.querySelector?e.querySelector(".hcms-error"):null;r&&(r.textContent=t,r.hidden=!1)}function Eo(e){let t=e.querySelector?e.querySelector("a.mirk-file__name[data-hcms-field]"):null;t&&(t.textContent=tr(t.getAttribute("href")))}function Co(e,t,r,n,i){let o=Ie(t,"@object",n);if(!o)throw new Error(`hypercms: missing template for object at "${t.join(".")}"`);let s=je(o,n);if(Fe(s,t),wt(s,he(t)),_t(s,he(t)),et(o))return Tn(s,e,t),Cn(s,e,r),s;let a=At(s,".hcms-object-fields",o,t);for(let[l,c]of Object.entries(e)){let u=r==null?null:r[l],g=rr(c,[...t,l],u,n,i);g&&a.appendChild(g)}return s}function To(e,t,r,n,i){let o=Ie(t,"@object-array",n);if(!o)throw new Error(`hypercms: missing template for object-array at "${t.join(".")}"`);let s=je(o,n);Fe(s,t),wt(s,he(t)),_t(s,he(t)),_n(s,o),Sn(s,o,t);let a=At(s,".hcms-array-items",o,t),[,l]=e;return(Array.isArray(r)?r:[]).forEach((u,g)=>{let d=vn(l,[...t,g],u,n,i);d&&a.appendChild(d)}),An(s),s}function vn(e,t,r,n,i){let o=wn(t,"object-array-item",n);if(!o)throw new Error(`hypercms: missing item template for "${t.join(".")}"`);let s=je(o,n);if(s.setAttribute("data-hcms-card",""),s.classList.contains("hcms-card")||s.classList.add("hcms-card"),Fe(s,t),et(o))return e&&typeof e=="object"&&!Array.isArray(e)&&(Tn(s,e,t),Cn(s,e,r)),s;let a=At(s,".hcms-card-fields",o,t);if(e&&typeof e=="object"&&!Array.isArray(e))for(let[l,c]of Object.entries(e)){let u=r==null?null:r[l],g=rr(c,[...t,l],u,n,i);g&&a.appendChild(g)}return s}function Ro(e,t,r,n){let i=pt(e,n),o=ft(e,t,n),s=i?i.array:"@scalar-array",a=Ie(t,s,n);if(!a)throw new Error(`hypercms: missing template for scalar-array at "${t.join(".")}"`);yn(a,i?i.array:null,t);let l=je(a,n);Fe(l,t),wt(l,he(t)),_t(l,he(t)),_n(l,a),Sn(l,a,t),o&&l.setAttribute("data-hcms-item-tpl",o.item);let c=At(l,".hcms-array-items",a,t);return(Array.isArray(r)?r:[]).forEach((g,d)=>{let k=xn([...t,d],g,n,o?o.item:null);k&&c.appendChild(k)}),An(l),l}function xn(e,t,r,n){let i=wn(e,"scalar-array-item",r,n);if(!i)throw new Error(`hypercms: missing item template for "${e.join(".")}"`);let o=je(i,r);return o.setAttribute("data-hcms-array-item",""),o.classList.contains("hcms-array-item")||o.classList.add("hcms-array-item"),Fe(o,e),En(o,t),o}function wn(e,t,r,n){let i=e.map(o=>typeof o=="number"?"*":o).join(".");return ce(r,i)||n&&ce(r,n)||ce(r,"@"+t)}function je(e,t){let r=e.content||e,n=t.createElement("div");return n.appendChild(r.cloneNode(!0)),n.firstElementChild||n}function Fe(e,t){e.setAttribute("data-hcms-path",t.join("."))}function Oo(e,t){let r=t==null?"":String(t);if(e.matches&&e.matches("[data-hcms-field]")){e.getAttribute("data-hcms-field")||e.setAttribute("data-hcms-field",r);return}(e.querySelectorAll?e.querySelectorAll("[data-hcms-field]"):[]).forEach(i=>{i.getAttribute("data-hcms-field")||i.setAttribute("data-hcms-field",r)})}function wt(e,t){t==null||t===""||!e.setAttribute||e.hasAttribute?.("data-hcms-field")||e.setAttribute("data-hcms-field",String(t))}function _t(e,t){if(t==null||t==="")return;(e.querySelectorAll?e.querySelectorAll("[data-hcms-label]"):[]).forEach(n=>{(n.textContent||"").trim()===""&&(n.textContent=mt(String(t)))})}function _n(e,t){["data-hcms-no-add","data-hcms-no-remove","data-hcms-no-reorder"].forEach(r=>{t.hasAttribute(r)&&e.setAttribute(r,"")}),["data-hcms-min-items","data-hcms-max-items"].forEach(r=>{t.hasAttribute(r)&&e.setAttribute(r,t.getAttribute(r))})}function An(e){let t=e.querySelector?e.querySelector(".hcms-array-items"):null;if(!t)return;let r=Array.from(t.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")),n=r.length,i=bn(e,"data-hcms-max-items"),o=bn(e,"data-hcms-min-items"),s=e.hasAttribute("data-hcms-no-add"),a=e.hasAttribute("data-hcms-no-remove"),l=e.hasAttribute("data-hcms-no-reorder"),c=e.querySelector('[data-hcms-action="add"]');c&&(c.hidden=s||i!=null&&n>=i),r.forEach((u,g)=>{let d=u.querySelector('[data-hcms-action="remove"]');d&&(d.hidden=a||o!=null&&n<=o);let k=u.querySelector('[data-hcms-action="move-up"]');k&&(k.hidden=l||g===0);let y=u.querySelector('[data-hcms-action="move-down"]');y&&(y.hidden=l||g===n-1)})}function bn(e,t){if(!e||!e.hasAttribute(t))return null;let r=parseInt(e.getAttribute(t),10);return Number.isFinite(r)?r:null}function Sn(e,t,r){if(e.hasAttribute("data-hcms-no-reorder")||t.hasAttribute("data-hcms-no-reorder"))return;let n=e.querySelector(".hcms-array-items");if(!n)return;let i="hcms-"+r.join(".");n.setAttribute("sortable",i),n.setAttribute("onsorted","hypercmsCommit && hypercmsCommit()")}function he(e){return e.length?e[e.length-1]:null}function En(e,t){let r=Mo(e);if(r.length!==0)for(let n of r)Rn(n,t)}function Mo(e){if(!e)return[];let t=[];return e.matches?.("[data-hcms-field]")&&No(e)&&t.push(e),(e.querySelectorAll?e.querySelectorAll("input[data-hcms-field], textarea[data-hcms-field], select[data-hcms-field], img[data-hcms-field], a[data-hcms-field], [contenteditable][data-hcms-field]"):[]).forEach(n=>t.push(n)),t}function No(e){let t=(e.tagName||"").toUpperCase();return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||t==="IMG"||t==="A"||e.hasAttribute?.("contenteditable"))}function Cn(e,t,r){(e.querySelectorAll?e.querySelectorAll("[data-hcms-field]"):[]).forEach(i=>{let o=i.getAttribute("data-hcms-field");if(!o)return;if(!t||typeof t!="object"||!(o in t)){console.warn(`[hypercms] inline template field "${o}" is not in the rule shape; ignoring`);return}let s=r==null?null:r[o];Rn(i,s)})}function Tn(e,t,r){if(!e.querySelectorAll)return;e.querySelectorAll("[data-hcms-field]").forEach(i=>{let o=i.getAttribute("data-hcms-field");if(!o||t&&typeof t=="object"&&!(o in t))return;let s=[...r,o].join(".");i.setAttribute("data-hcms-path",s)})}function At(e,t,r,n){if(!e.querySelector)return e;let i=e.querySelector(t);if(i)return i;let o=r?.getAttribute?.("data-hcms-tpl")||n.join(".");throw new Error(`hypercms: template "${o}" is in slotted mode but has no ${t} element`)}function Rn(e,t){let r=yt(e),n=(e.tagName||"").toUpperCase(),i=(e.getAttribute("type")||"").toLowerCase();if(n==="INPUT"&&i==="radio"){e.checked=e.value!=null&&String(e.value)===String(t??"");return}if(r==="checked"){e.checked=t===!0||t==="true";return}if(r){e[r]=t==null?"":String(t);return}e.textContent=t==null?"":String(t)}var On={skip:"[data-hcms-shell]",templateAttr:"cms-template"};function Mn(e,t,r,n={}){let{observerHandle:i,shellRoot:o,structural:s,structuralPath:a}=n;i?.pause?.();try{if(!s)try{return re.apply(e,t,r,On),{ok:!0}}catch(g){return{ok:!1,error:g}}let l=Io(e,t,a),c=l?jo(l):null,u=l?null:qo(e,o);try{return re.apply(e,t,r,On),{ok:!0}}catch(g){return c?Fo(l,c):u&&Do(e,o,u),{ok:!1,error:g}}}finally{i?.resume?.()}}function Io(e,t,r){if(!r||!e)return null;let n=me(r),i=[],o=t;for(let s of n){if(typeof o=="string"||o==null||Array.isArray(o))break;if(typeof o=="object"&&s in o){if(i.push(s),o=o[s],Array.isArray(o)||typeof o=="string"&&o.endsWith("[]"))break}else return null}return!Array.isArray(o)&&!(typeof o=="string"&&o.endsWith("[]"))?null:Lo(e,t,i)}function Lo(e,t,r){if(r.length===0)return null;let n=e,i=t;for(let o=0;o<r.length;o++){let s=r[o];if(!i||typeof i!="object"||Array.isArray(i))return null;let a=i[s];if(a==null)return null;if(o===r.length-1){if(Array.isArray(a)){let[l]=a;return n.querySelector?.(l)?.parentElement||null}if(typeof a=="string"&&a.endsWith("[]")){let l=a.slice(0,-2);return n.querySelector?.(l)?.parentElement||null}return null}i=a}return null}function jo(e){let t=[];for(let r of Array.from(e.childNodes))t.push(r.cloneNode(!0));return t}function Fo(e,t){for(;e.firstChild;)e.removeChild(e.firstChild);for(let r of t)e.appendChild(r)}function qo(e,t){let r=[];for(let n of Array.from(e.childNodes))n===t||t&&n.contains?.(t)||r.push(n.cloneNode(!0));return r}function Do(e,t,r){for(let i of Array.from(e.childNodes))i===t||t&&i.contains?.(t)||e.removeChild(i);let n=$o(e,t);for(let i of r)e.insertBefore(i,n||null)}function $o(e,t){if(!t)return null;for(let r of Array.from(e.childNodes))if(r===t||r.contains?.(t))return r;return null}var Po={Mutation:(e,t)=>e?.Mutation??t?.Mutation,undo:(e,t)=>e?.undo??t?.undo,onPrepareForSave:(e,t)=>e?.addDocumentTransform??t?.onPrepareForSave,consent:(e,t)=>e?.confirm??t?.consent,RichClay:(e,t)=>e?.RichClay??t?.RichClay,quickcrop:(e,t)=>e?.quickcrop??t?.quickcrop,upload:(e,t)=>e?.upload??(t?.uploadFileBasic?Uo(t.uploadFileBasic):null)},Bo={402:"payment-required",413:"too-large",415:"unsupported-type",401:"unauthorized",403:"forbidden",404:"not-found"},ir=()=>({ok:!1,msg:"Upload cancelled",msgType:"skipped",code:"aborted",uploads:[]});function Uo(e){return async function(r,{onProgress:n,signal:i}={}){if(i?.aborted)return ir();try{let o=await e(r,{onProgress:a=>{n?.({loaded:null,total:null,percent:a})}});if(i?.aborted)return ir();let s=o&&o.uploads||[];return typeof s[0]?.url!="string"?{ok:!1,msg:"The host accepted the file but did not say where it put it",msgType:"error",code:"bad-response",uploads:[]}:{ok:!0,msg:o.msg||"Uploaded",msgType:o.msgType||"success",code:o.code||null,uploads:s}}catch(o){if(i?.aborted)return ir();let s={};try{s=JSON.parse(o?.response||"{}")}catch{s={}}let a=s.code||Bo[o?.status]||"error";return{ok:!1,msg:o&&o.message||"Upload failed",msgType:"error",code:a,uploads:[]}}}}function ne(e,t){let r=Po[e];if(!r)throw new Error(`hypercms: unknown platform capability "${e}"`);let n=t||(typeof window<"u"?window:null);return n&&r(n.clay,n.hyperclay)||null}var Nn=["clay:mutation-ready","hyperclay:mutation-ready"],In=["clay:sync-applied","hyperclay:livesync-applied"];function or(e,t,r){let n=null,i=o=>{n!==null&&n!==o.type||(n=o.type,queueMicrotask(()=>{n=null}),r(o))};for(let o of t)e.addEventListener(o,i);return()=>{for(let o of t)e.removeEventListener(o,i)}}function St(e,t){if(!t||e==null)return e;return r(e);function r(n){if(typeof n=="string"){if(n.endsWith("[]")||Z(n)!==-1)return n;let i=null;try{i=t.querySelector(n)}catch{return n}return i&&i.children.length>0?n+"@innerHTML":n}if(Array.isArray(n))return n;if(n&&typeof n=="object"){let i=Object.create(null);for(let[o,s]of Object.entries(n))i[o]=r(s);return i}return n}}function sr(e){if(!e||e.tagName!=="TEXTAREA")return;let t=e.ownerDocument.defaultView||(typeof window<"u"?window:null);t&&t.CSS&&t.CSS.supports&&t.CSS.supports("field-sizing: content")||(e.style.height="auto",e.style.height=e.scrollHeight+"px")}function qe(e,t){if(!e||!e.querySelectorAll)return;e.querySelectorAll("textarea[data-hcms-field]").forEach(sr);let r=t&&t.defaultView||(typeof window<"u"?window:null),n=r&&r.richclay&&r.richclay.RichClay||ne("RichClay",r)||(r&&typeof r.RichClay=="function"?r.RichClay:null);n&&e.querySelectorAll("[contenteditable][data-hcms-field]").forEach(i=>{if(i.__hcmsRichclay)return;let o;try{o=new n(i,{inline:!0,hyperclay:!1,toolbar:["bold","italic","link","undo","redo"]})}catch(a){console.warn("[hypercms] richclay activation failed; field stays plain contenteditable",a);return}i.__hcmsRichclay=o;let s=o&&o.squire;s&&typeof s.addEventListener=="function"&&s.addEventListener("input",()=>{let a=r&&r.Event||Event;i.dispatchEvent(new a("input",{bubbles:!0}))})})}var ar=new WeakSet;function Pe(e,t){let r=ne("undo");if(!r)return t();r.pause();try{let n=t();return n&&n.ok?r.commitCaptured(e):r.discardCaptured(),n}finally{r.resume()}}function Tt(e){let t=ne("undo");if(!t)return e();t.pause();try{return e()}finally{t.discardCaptured(),t.resume()}}function Dn(e){let{formRoot:t}=e;if(!t||ar.has(t))return;ar.add(t);let r=s=>{let a=s.target;!a||!a.closest||a.closest("[data-hcms-form-root]")&&a.matches("input, textarea, select, [contenteditable][data-hcms-field]")&&(a.tagName==="TEXTAREA"&&sr(a),!a.matches('input[type="file"]')&&(!a.closest("[data-hcms-field]")&&!a.hasAttribute?.("data-hcms-field")||Ln(a,e)))},n=s=>{let a=s.target;if(!(!a||!a.closest)&&a.closest("[data-hcms-form-root]")){if(a.matches('input[type="file"][data-hcms-upload]')){Yo(a,e);return}a.matches('input[type="checkbox"], input[type="radio"], select')&&Ln(a,e)}},i=s=>{let a=s.target;if(!a||!a.closest)return;let l=a.closest("[data-hcms-action]");if(!l)return;let c=l.getAttribute("data-hcms-action");if(c==="add"||c==="remove"||c==="move-up"||c==="move-down"||c==="clear-upload"){if(!l.closest("[data-hcms-form-root]"))return}else if(c==="close"&&!l.closest("[data-hcms-shell]"))return;if(c==="add"){let u=l.closest("[data-hcms-path]");if(!u)return;let g=u.getAttribute("data-hcms-path");cr(g,e)}else if(c==="remove"){let u=l.closest("[data-hcms-card], [data-hcms-array-item]");if(!u)return;os(u,e)}else if(c==="move-up"||c==="move-down"){let u=l.closest("[data-hcms-card], [data-hcms-array-item]");if(!u)return;ns(u,c==="move-up"?-1:1,e)}else c==="clear-upload"?es(l,e):c==="close"&&e.onCloseRequested?.()},o=t.ownerDocument;o.addEventListener("input",r,!0),o.addEventListener("change",n,!0),o.addEventListener("click",i,!0),e.detachEvents=()=>{o.removeEventListener("input",r,!0),o.removeEventListener("change",n,!0),o.removeEventListener("click",i,!0),ar.delete(t)}}var zo=new Set(["value","checked"]);function Ho(e,t){if(!t)return null;let r=me(t);if(r.some(l=>typeof l=="number"||l==="*"))return null;let n=_e(e.pageRules,r);if(typeof n!="string")return null;let i=re.ruleAttrIndex(n);if(i===-1)return null;let o=n.slice(i+1);if(!zo.has(o))return null;let s=n.slice(0,i),a=s?e.pageRoot.querySelector(s):e.pageRoot;return a?{el:a,prop:o,oldValue:a[o]}:null}function Ln(e,t){let n=(e.closest("[data-hcms-field]")||e).closest("[data-hcms-path]")?.getAttribute("data-hcms-path")||"",i=Ho(t,n);if(ue(ae(t),{path:n,structural:!1},t),i){let o=ne("undo");o&&typeof o.recordValue=="function"&&o.recordValue(i.el,{prop:i.prop,oldValue:i.oldValue,newValue:i.el[i.prop]})}}var Vo={type:"image/webp",quality:.85,maxWidth:2048,maxHeight:2048};async function Wo(e,t){let r=t&&t.getAttribute?t.getAttribute("data-hcms-crop"):null;if(r==null)return{file:e};let n=ne("quickcrop");if(typeof n!="function")return{file:e};try{let i=typeof window<"u"&&(window.clay?.modal??window.themodal)||"auto",o=await n(e,{aspect:Ko(r),modal:i,...Vo});return o===null?null:{file:Go(o.blob,e.name),dataURL:o.dataURL}}catch(i){return $e(t,i&&i.message||"Crop failed"),null}}function Ko(e){let t=String(e??"").trim().toLowerCase();if(t===""||t==="free")return null;let r=t.match(/^(\d+(?:\.\d+)?)\s*[:/]\s*(\d+(?:\.\d+)?)$/);if(!r)return null;let n=parseFloat(r[1]),i=parseFloat(r[2]);return!n||!i?null:n/i}function Go(e,t){let r=e.type==="image/webp"?".webp":e.type==="image/jpeg"?".jpg":".png",n=String(t||"image").replace(/\.[^.]+$/,"");try{return new File([e],n+r,{type:e.type})}catch{return e}}var Jo=new Set(["unsupported","payment-required"]);async function Yo(e,t){let r=e.files&&e.files[0];if(!r)return;let n=e.closest("[data-hcms-path]");if(!n)return;let i=n.getAttribute("data-hcms-path")||"";$e(n,null);let o=await Wo(r,n);if(!o||t.closed){ye(e);return}let s=o.file,a=o.dataURL||null,l=ne("upload");if(typeof l!="function")return lr(e,n,t,i,await jn(s,a,n),s);Pn(n,a),Fn(n,0);let c=Zo(t),u;try{u=await l(s,{signal:c?.signal,onProgress:({percent:d})=>Fn(n,d)})}finally{Qo(t,c),rs(n)}if(t.closed){ye(e);return}if(u.code==="aborted"){ye(e);return}if(u.ok)return lr(e,n,t,i,u.uploads[0].url,s);if(!Jo.has(u.code)){$e(n,u.msg||"Upload failed"),t.dispatch?.("hcms:error",{error:new Error(u.msg||"Upload failed"),code:u.code,path:i}),ye(e);return}let g=u.code==="payment-required"?"This file is stored in the page. Add a paid plan to upload files.":null;return lr(e,n,t,i,await jn(s,a,n),s,g)}function lr(e,t,r,n,i,o,s=null){if(r.closed){ye(e);return}if(Pn(t,null),$e(t,null),!i){ye(e);return}$n(t,i,o.name),ue(ae(r),{path:n,structural:!1},r),s&&$e(t,s,"info"),ye(e)}async function jn(e,t,r){return t||await Xo(e,r)}function Xo(e,t){let r=t?.ownerDocument?.defaultView?.FileReader||globalThis.FileReader;return r?new Promise(n=>{let i=new r;i.onload=()=>n(typeof i.result=="string"?i.result:""),i.onerror=()=>n("");try{i.readAsDataURL(e)}catch{n("")}}):Promise.resolve("")}function Zo(e){if(typeof AbortController!="function")return null;let t=new AbortController;return(e.uploads||(e.uploads=new Set)).add(t),t}function Qo(e,t){t&&e.uploads?.delete(t)}function es(e,t){let r=e.closest("[data-hcms-path]");if(!r)return;let n=r.getAttribute("data-hcms-path")||"";$n(r,"","");let i=r.querySelector('input[type="file"][data-hcms-upload]');i&&ye(i),$e(r,null),ue(ae(t),{path:n,structural:!1},t)}function ts(e){return e.querySelector?e.querySelector("img[data-hcms-field], a[data-hcms-field]"):null}function $n(e,t,r){let n=ts(e);if(!n)return;let i=(n.tagName||"").toUpperCase();i==="IMG"?n.src=t||"":i==="A"&&(n.href=t||"",n.textContent=t?r||tr(t):"")}function ye(e){try{e.value=""}catch{}}function Pn(e,t){let r=e.querySelector?e.querySelector(".mirk-image__frame"):null;r&&(t?r.style.backgroundImage=`url("${t.replace(/"/g,"%22")}")`:r.style.removeProperty("background-image"))}function Fn(e,t){let r=Math.max(0,Math.min(100,Number(t)||0));e.setAttribute("data-hcms-uploading",""),e.style?.setProperty?.("--hcms-upload-progress",`${r}%`)}function rs(e){e.removeAttribute("data-hcms-uploading"),e.style?.removeProperty?.("--hcms-upload-progress")}function $e(e,t,r="error"){let n=e.querySelector?e.querySelector(":scope > .hcms-error"):null;n&&(n.classList.toggle("hcms-error--info",!!t&&r==="info"),t?(n.textContent=t,n.hidden=!1):(n.textContent="",n.hidden=!0))}function cr(e,t){let{formRoot:r,pageRules:n}=t,i=r.querySelector(`[data-hcms-path="${ms(e)}"]`);if(!i)throw new Error(`hypercms: no element at path "${e}"`);let o=i.querySelector(".hcms-array-items");if(!o)throw new Error(`hypercms: array container missing .hcms-array-items at "${e}"`);let s=me(e),a=cs(n,s),l=Array.isArray(a),c=typeof a=="string"&&a.endsWith("[]");if(!l&&!c)throw new Error(`hypercms: path "${e}" is not an array`);let u=Ct(i,"data-hcms-max-items"),g=o.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]");if(i.hasAttribute("data-hcms-no-add")||u!=null&&g.length>=u)return;let d=g.length,k=l?a[1]:a.replace(/\[\]$/,""),y=Ze(l?k:"string"),N=kn({shape:l?"object-array-item":"scalar-array-item",itemShape:k,pathArr:[...s,d],data:y,doc:t.doc,itemKey:i.getAttribute("data-hcms-item-tpl")||null,pageRules:n});return o.appendChild(N),qe(N,t.doc),ur(i),Pe(`Add ${e}`,()=>ue(ae(t),{path:e,structural:!0},t))}function ns(e,t,r){let n=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]');if(!n||n.hasAttribute("data-hcms-no-reorder"))return;let i=n.querySelector(".hcms-array-items");if(!i)return;let o=Array.from(i.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")),s=o.indexOf(e);if(s<0)return;let a=s+t;if(a<0||a>=o.length)return;let l=e.querySelector(`[data-hcms-action="${t<0?"move-up":"move-down"}"]`);return t<0?i.insertBefore(e,o[a]):i.insertBefore(e,o[a].nextSibling),hr(i),ur(n),l&&typeof l.focus=="function"&&e.querySelector(`[data-hcms-action="${t<0?"move-up":"move-down"}"]`)?.focus?.(),Pe(`Reorder ${n.getAttribute("data-hcms-path")||""}`,()=>ue(ae(r),{path:n.getAttribute("data-hcms-path")||"",structural:!0},r))}var Et="Delete this item?";function is(e,t){let r=e&&e.getAttribute("data-hcms-confirm-remove");if(r!=null)return/^(off|false|no|0)$/i.test(r.trim())?null:r||Et;let n=t&&t.confirmRemove;return n===!1?null:typeof n=="string"?n||Et:n===!0||e&&e.getAttribute("data-hcms-shape")==="object-array"?Et:null}function os(e,t){let r=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]'),n=is(r,t);if(n==null)return De(e,t);let i=ne("consent")||typeof window<"u"&&window.consent;typeof i=="function"?Promise.resolve(i(n)).then(()=>De(e,t),()=>{}):typeof window<"u"&&typeof window.confirm=="function"?window.confirm(n)&&De(e,t):De(e,t)}function De(e,t){let r=e.getAttribute("data-hcms-path")||"",n=e.parentElement,i=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]');if(!i?.hasAttribute("data-hcms-no-remove")){if(i){let o=Ct(i,"data-hcms-min-items"),s=i.querySelector(".hcms-array-items"),a=s?s.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]").length:0;if(o!=null&&a<=o)return}return e.remove(),n&&hr(n),i&&ur(i),Pe(`Remove ${r}`,()=>ue(ae(t),{path:r,structural:!0},t))}}function ue(e,t,r){let n=tt(e);if(n===r.lastFingerprint)return{ok:!0,skipped:!0};let i=Mn(r.pageRoot,r.pageRules,e,{observerHandle:r.observerHandle,shellRoot:r.shellRoot,structural:!!t.structural,structuralPath:t.path||null});return i.ok?(r.lastFingerprint=n,r.lastData=e,qn(r,null),r.dispatch?.("hcms:change",{data:e,path:t.path,structural:!!t.structural}),r.onChange?.(e,t)):(qn(r,ls(i.error,t.path)),r.dispatch?.("hcms:error",{error:i.error,attemptedData:e}),r.onError?.(i.error)),i}function ae(e){let t=re.extract(e.formRoot,e.formRules);return ve(t,e.formRules)}function ve(e,t){if(t==null||e==null)return e;if(typeof t=="string")return t.endsWith("@checked")?e===!0||e==="true":e;if(Array.isArray(t)){if(!Array.isArray(e))return e;let[,r]=t;return e.map(n=>ve(n,r))}if(typeof t=="object"){if(typeof e!="object"||Array.isArray(e))return e;let r={};for(let[n,i]of Object.entries(t))r[n]=ve(e[n],i);return r}return e}function qn(e,t){e.lastErrors=t&&t.length?t:null,dr(e)}function dr(e){if(ss(e),e.errorEl&&(e.errorEl.textContent="",e.errorEl.hidden=!0),!e.lastErrors)return;let t=[];for(let{message:r,path:n}of e.lastErrors){if(n!=null&&n!==""){let i=as(e.formRoot,n);if(i){i.textContent=i.textContent?`${i.textContent}
|
|
150
|
+
`},Va=["@scalar","@object","@scalar-array","@scalar-array-item","@object-array","@object-array-item"];function Qt(e){let t=e.head||e.documentElement;if(t)for(let r of Va)Pi(e,t,r)}function on(e,t){if(!Fi[t])return null;let r=e&&(e.head||e.documentElement);return r?Pi(e,r,t):null}var Ii={src:"@image",checked:"@checkbox",innerHTML:"@richtext"},Xt={image:"@image",file:"@file",checkbox:"@checkbox",toggle:"@toggle",select:"@select",radio:"@radio",textarea:"@textarea",number:"@number",richtext:"@richtext"},Wa=new Set([...Object.values(Xt),"@chips","@chips-item"]);function Rt(e,t,r,n){if(typeof e!="string")return"@scalar";let i=ae(e),o=rr(e,i,r,n),a=nr(o,t,"data-hcms-component");if(a&&Xt[a]){let s=Xt[a],l=Array.isArray(r)&&r.some(u=>u==="*"||typeof u=="number");return s==="@number"&&!ji(e,i,t,l,o).every(Ga)||(s==="@checkbox"||s==="@toggle")&&(i<0||e.slice(i+1)!=="checked")&&!ji(e,i,t,l,o).every(Ya)?"@scalar":s}if(i>=0){let s=e.slice(i+1);if(Ii[s])return Ii[s]}return"@scalar"}function Di(e,t,r,n){if(typeof e!="string")return null;let i=ae(e),o=nr(rr(e,i,r,n),t,"data-hcms-component");return o&&Xt[o]||null}var Ka=/^-?\d+(\.\d+)?([eE][+-]?\d+)?$/;function Ga(e){return e==null||e===""?!0:Ka.test(String(e))}function Ya(e){return e==null||e===""||e==="true"||e==="false"}function ji(e,t,r,n,i){if(!r||!r.querySelectorAll)return[];if(!i||i===".")return[];let o=null;try{o=r.querySelectorAll(i)}catch{return[]}let a=t>=0?e.slice(t+1):null,s=[];for(let l of o)if(!(l.closest&&l.closest("[cms-template], [data-hcms-shell]"))&&(a?a==="value"&&"value"in l?s.push(l.value):s.push(l.getAttribute?l.getAttribute(a):null):s.push((l.textContent||"").trim()),!n))break;return s}function er(e,t){if(typeof e!="string"||!e.endsWith("[]")||!t||!t.querySelector)return null;let r=e.slice(0,-2).trim();if(!r)return null;let n=null;try{n=t.querySelector(r)}catch{return null}let i=n&&n.closest?n.closest("[data-hcms-component]"):null;return(i&&i.getAttribute?i.getAttribute("data-hcms-component"):null)==="chips"?{array:"@chips",item:"@chips-item"}:null}function Qe(e,t,r){let n=e.join("."),i=e.map(o=>typeof o=="number"?"*":o).join(".");return n&&ke(r,n)||i&&i!==n&&ke(r,i)||ke(r,t)}function tr(e,t,r){let n=er(e,r);if(!n)return null;let i=Qe(t,n.array,r);return i&&i.getAttribute("data-hcms-tpl")===n.array?n:null}function qi(e,t,r,n){if(typeof e!="string")return null;let i=ae(e),o=nr(rr(e,i,r,n),t,"data-hcms-options");if(o==null)return null;let a=o.trim().split(/\s+/).filter(Boolean);return a.length?a:null}function $i(e,t,r,n){if(typeof e!="string")return null;let i=ae(e);return nr(rr(e,i,r,n),t,"data-hcms-crop")}function Ja(e,t){return t>=0?e.slice(0,t):e}function rr(e,t,r,n){let i=Ja(e,t);return i&&i!=="."?i:Xa(n,r)}function Xa(e,t){if(e==null||!Array.isArray(t))return"";let r=[],n=e;for(let i of t){if(n==null||typeof n=="string")break;if(Array.isArray(n)){if(typeof n[0]!="string"||i!=="*"&&typeof i!="number")return"";r.push(n[0]),n=n[1];continue}if(typeof n!="object"||!Object.prototype.hasOwnProperty.call(n,i))return"";n=n[i]}return r.join(" ")}function nr(e,t,r){if(!t||!t.querySelector||!e||e===".")return null;let n=null;try{n=t.querySelector(e)}catch{return null}return n&&n.getAttribute?n.getAttribute(r):null}function ir(e,t){if(!e||t==null)return;r(t,[]);function r(n,i){let o=Be(n);if(o==="scalar"){let a=Rt(n,e,i,t);Wa.has(a)&&on(e,a);return}if(o==="scalar-array"){let a=er(n,e);a&&(on(e,a.array),on(e,a.item));return}if(o==="object"){for(let[a,s]of Object.entries(n))r(s,[...i,a]);return}if(o==="object-array"){let a=n[1],s=[...i,"*"];if(a&&typeof a=="object"&&!Array.isArray(a))for(let[l,u]of Object.entries(a))r(u,[...s,l]);else r(a,s)}}}function Pi(e,t,r){let n=ke(e,r);if(n)return n;let i=e.createElement("template");return i.setAttribute("data-hcms-tpl",r),i.setAttribute("save-remove",""),i.innerHTML=Fi[r].trim(),t.appendChild(i),i}function ke(e,t){return!e||!e.querySelector?null:e.querySelector(`template[data-hcms-tpl="${Za(t)}"]`)}function Za(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}function Be(e){return typeof e=="string"?e.endsWith("[]")?"scalar-array":"scalar":Array.isArray(e)?"object-array":typeof e=="object"&&e!==null?"object":"scalar"}function Mt(e){return e?!!(e.content||e).querySelector("[data-hcms-field]"):!1}var Bi={IMG:"src",A:"href"};function or(e){if(!e)return"value";let t=(e.tagName||"").toUpperCase();return t==="INPUT"?(e.getAttribute("type")||"text").toLowerCase()==="checkbox"?"checked":"value":t==="TEXTAREA"||t==="SELECT"?"value":Bi[t]?Bi[t]:e.hasAttribute&&e.hasAttribute("contenteditable")?"innerHTML":null}function zi(e,t){let r=(e.tagName||"").toUpperCase(),n=(e.getAttribute&&e.getAttribute("type")||"").toLowerCase(),i=or(e),a=`${Ui(r,n)}[data-hcms-field="${et(t)}"]`;return r==="INPUT"&&n==="radio"?`${a}:checked@value`:i?`${a}@${i}`:a}function Qa(e){let t=(e.tagName||"").toUpperCase(),r=(e.getAttribute&&e.getAttribute("type")||"").toLowerCase(),n=or(e),o=`${Ui(t,r)}[data-hcms-field]`;return t==="INPUT"&&r==="radio"?`${o}:checked@value`:n?`${o}@${n}`:o}function Ui(e,t){return e==="INPUT"?t?`input[type="${t}"]`:"input":e==="TEXTAREA"?"textarea":e==="SELECT"?"select":e==="IMG"?"img":e==="A"?"a":':not([data-hcms-shape="scalar"]):not([data-hcms-shape="object"]):not([data-hcms-shape="object-array"]):not([data-hcms-shape="scalar-array"])'}function et(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var Hi=new Set(["__proto__","constructor","prototype"]);function sr(e,t){return r(e,[]);function r(u,m){let y=Be(u);if(y==="scalar")return n(u,m);if(y==="scalar-array")return i(u,m);if(y==="object-array")return o(u,m);if(y==="object"){let c=Object.create(null);for(let[h,f]of Object.entries(u)){if(Hi.has(h))throw new Error(`hypercms: rule key "${h}" is forbidden at "${m.join(".")||"<root>"}"`);c[h]=r(f,[...m,h])}return c}return null}function n(u,m){let y=m.length?m[m.length-1]:null,c=typeof y=="string"?y:"__value",h=l(m,c);if(h)return zi(h,c);let f=s(Rt(u,t,m,e),c);return f?zi(f,c):`input[data-hcms-field="${et(c)}"]@value`}function i(u,m){let y=tr(u,m,t),c=y&&s(y.item,null)||s("@scalar-array-item",null),h=c?Qa(c):"input[data-hcms-field]@value";return[a(m,"[data-hcms-array-item]"),h]}function o(u,m){let[,y]=u,c=[...m,"*"],h=a(m,"[data-hcms-card]");if(y&&typeof y=="object"&&!Array.isArray(y)){let f=Object.create(null);for(let[b,k]of Object.entries(y)){if(Hi.has(b))throw new Error(`hypercms: rule key "${b}" is forbidden at "${c.join(".")}"`);f[b]=r(k,[...c,b])}return[h,f]}return[h,r(y,[...c,0])]}function a(u,m){let y=u.length?u[u.length-1]:"",c=u.some(b=>b==="*"),h=u.join(".");return`${c?`[data-hcms-field="${et(y)}"]`:`[data-hcms-path="${et(h)}"]`} > .hcms-array-items > ${m}`}function s(u,m){if(!t)return null;let y=ke(t,u);if(!y)return null;let c=y.content||y;if(m){let h=c.querySelector(`[data-hcms-field="${et(m)}"]`);if(h)return h}return c.querySelector("[data-hcms-field]")}function l(u,m){if(!t)return null;let y=u.map(f=>typeof f=="number"?"*":f).join("."),h=[u.join("."),y];for(let f=u.length-1;f>=0;f--){let b=u.slice(0,f).map(k=>typeof k=="number"?"*":k);b.push("*"),h.push(b.join("."))}for(let f of h){if(!f)continue;let b=ke(t,f);if(!b||!Mt(b))continue;let k=b.content||b,A=k.querySelector(`[data-hcms-field="${et(m)}"]`)||k.querySelector("[data-hcms-field]");if(A)return A}return null}}function sn(e){if(!e)return"";let t=String(e).split(/[?#]/)[0],r=t.split("/").pop()||t;try{return decodeURIComponent(r)}catch{return r}}function tt({pageRules:e,formRules:t,data:r,doc:n}){let i=n.createDocumentFragment(),o=an(e,[],r,n,e);return o&&i.appendChild(o),i}function Wi({shape:e,itemShape:t,pathArr:r,data:n,doc:i,itemKey:o,pageRules:a}){if(e==="object-array-item")return Gi(t,r,n,i,a);if(e==="scalar-array-item")return Yi(r,n,i,o||null);throw new Error(`hypercms: buildItem called with unknown shape "${e}"`)}function an(e,t,r,n,i){let o=Be(e);return o==="scalar"?el(e,t,r,n,i):o==="object"?il(e,t,r,n,i):o==="object-array"?ol(e,t,r,n,i):o==="scalar-array"?sl(e,t,r,n):null}function el(e,t,r,n,i){let o=Rt(e,n,t,i),a=Qe(t,o,n);if(!a)throw new Error(`hypercms: missing template for scalar at "${t.join(".")}"`);let s=Di(e,n,t,i);s==="@number"&&o==="@scalar"&&console.info(`[hypercms] field "${t.join(".")}" declares component "@number" but its value isn't a plain number; rendering a text input so the value is preserved`),(s==="@checkbox"||s==="@toggle")&&o==="@scalar"&&console.info(`[hypercms] field "${t.join(".")}" declares component "${s}" but its value isn't true/false; rendering a text input so the value is preserved`),Ki(a,s===o?s:null,t);let l=rt(a,n);nt(l,t);let u=a.getAttribute?.("data-hcms-tpl");if((o==="@select"||o==="@radio")&&u===o&&tl(l,e,t,r,n,o,i),o==="@image"&&u==="@image"){let m=$i(e,n,t,i);m!=null&&!l.hasAttribute("data-hcms-crop")&&l.setAttribute("data-hcms-crop",m)}return al(l,Ee(t)),ar(l,Ee(t)),lr(l,Ee(t)),eo(l,r),o==="@file"&&nl(l),l}function Ki(e,t,r){if(!t)return;let n=e.getAttribute?.("data-hcms-tpl");n&&n!==t&&console.info(`[hypercms] field "${r.join(".")}" declares component "${t}" but custom template "${n}" wins`)}function tl(e,t,r,n,i,o,a){let s=qi(t,i,r,a),l=s?[...s]:[],u=n==null?"":String(n);if(u!==""&&!l.includes(u)&&l.unshift(u),!s&&(rl(e,"data-hcms-options required (space-separated values)"),l.length===0)){e.querySelector(".mirk-radio")?.remove();return}if(o==="@select"){let c=e.querySelector("select[data-hcms-field]");if(!c)return;for(let h of l){let f=i.createElement("option");f.value=h,f.textContent=Zt(h),c.appendChild(f)}return}let m=e.querySelector(".mirk-radio");if(!m||!m.parentNode)return;let y=ln(r.join("."));for(let c of l){let h=m.cloneNode(!0),f=h.querySelector('input[type="radio"]');f&&(f.value=c,f.name=y);let b=h.querySelector(".mirk-radio__label");b&&(b.textContent=Zt(c)),m.parentNode.insertBefore(h,m)}m.remove()}function ln(e){return"hcms-"+String(e).replace(/[^A-Za-z0-9_-]/g,"-")}function rl(e,t){let r=e.querySelector?e.querySelector(".hcms-error"):null;r&&(r.textContent=t,r.hidden=!1)}function nl(e){let t=e.querySelector?e.querySelector("a.mirk-file__name[data-hcms-field]"):null;t&&(t.textContent=sn(t.getAttribute("href")))}function il(e,t,r,n,i){let o=Qe(t,"@object",n);if(!o)throw new Error(`hypercms: missing template for object at "${t.join(".")}"`);let a=rt(o,n);if(nt(a,t),ar(a,Ee(t)),lr(a,Ee(t)),Mt(o))return ro(a,e,t),to(a,e,r),a;let s=cr(a,".hcms-object-fields",o,t);for(let[l,u]of Object.entries(e)){let m=r==null?null:r[l],y=an(u,[...t,l],m,n,i);y&&s.appendChild(y)}return a}function ol(e,t,r,n,i){let o=Qe(t,"@object-array",n);if(!o)throw new Error(`hypercms: missing template for object-array at "${t.join(".")}"`);let a=rt(o,n);nt(a,t),ar(a,Ee(t)),lr(a,Ee(t)),Xi(a,o),Qi(a,o,t);let s=cr(a,".hcms-array-items",o,t),[,l]=e;return(Array.isArray(r)?r:[]).forEach((m,y)=>{let c=Gi(l,[...t,y],m,n,i);c&&s.appendChild(c)}),Zi(a),a}function Gi(e,t,r,n,i){let o=Ji(t,"object-array-item",n);if(!o)throw new Error(`hypercms: missing item template for "${t.join(".")}"`);let a=rt(o,n);if(a.setAttribute("data-hcms-card",""),a.classList.contains("hcms-card")||a.classList.add("hcms-card"),nt(a,t),Mt(o))return e&&typeof e=="object"&&!Array.isArray(e)&&(ro(a,e,t),to(a,e,r)),a;let s=cr(a,".hcms-card-fields",o,t);if(e&&typeof e=="object"&&!Array.isArray(e))for(let[l,u]of Object.entries(e)){let m=r==null?null:r[l],y=an(u,[...t,l],m,n,i);y&&s.appendChild(y)}return a}function sl(e,t,r,n){let i=er(e,n),o=tr(e,t,n),a=i?i.array:"@scalar-array",s=Qe(t,a,n);if(!s)throw new Error(`hypercms: missing template for scalar-array at "${t.join(".")}"`);Ki(s,i?i.array:null,t);let l=rt(s,n);nt(l,t),ar(l,Ee(t)),lr(l,Ee(t)),Xi(l,s),Qi(l,s,t),o&&l.setAttribute("data-hcms-item-tpl",o.item);let u=cr(l,".hcms-array-items",s,t);return(Array.isArray(r)?r:[]).forEach((y,c)=>{let h=Yi([...t,c],y,n,o?o.item:null);h&&u.appendChild(h)}),Zi(l),l}function Yi(e,t,r,n){let i=Ji(e,"scalar-array-item",r,n);if(!i)throw new Error(`hypercms: missing item template for "${e.join(".")}"`);let o=rt(i,r);return o.setAttribute("data-hcms-array-item",""),o.classList.contains("hcms-array-item")||o.classList.add("hcms-array-item"),nt(o,e),eo(o,t),o}function Ji(e,t,r,n){let i=e.map(o=>typeof o=="number"?"*":o).join(".");return ke(r,i)||n&&ke(r,n)||ke(r,"@"+t)}function rt(e,t){let r=e.content||e,n=t.createElement("div");return n.appendChild(r.cloneNode(!0)),n.firstElementChild||n}function nt(e,t){e.setAttribute("data-hcms-path",t.join("."))}function al(e,t){let r=t==null?"":String(t);if(e.matches&&e.matches("[data-hcms-field]")){e.getAttribute("data-hcms-field")||e.setAttribute("data-hcms-field",r);return}(e.querySelectorAll?e.querySelectorAll("[data-hcms-field]"):[]).forEach(i=>{i.getAttribute("data-hcms-field")||i.setAttribute("data-hcms-field",r)})}function ar(e,t){t==null||t===""||!e.setAttribute||e.hasAttribute?.("data-hcms-field")||e.setAttribute("data-hcms-field",String(t))}function lr(e,t){if(t==null||t==="")return;(e.querySelectorAll?e.querySelectorAll("[data-hcms-label]"):[]).forEach(n=>{(n.textContent||"").trim()===""&&(n.textContent=Zt(String(t)))})}function Xi(e,t){["data-hcms-no-add","data-hcms-no-remove","data-hcms-no-reorder"].forEach(r=>{t.hasAttribute(r)&&e.setAttribute(r,"")}),["data-hcms-min-items","data-hcms-max-items"].forEach(r=>{t.hasAttribute(r)&&e.setAttribute(r,t.getAttribute(r))})}function Zi(e){let t=e.querySelector?e.querySelector(".hcms-array-items"):null;if(!t)return;let r=Array.from(t.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")),n=r.length,i=Vi(e,"data-hcms-max-items"),o=Vi(e,"data-hcms-min-items"),a=e.hasAttribute("data-hcms-no-add"),s=e.hasAttribute("data-hcms-no-remove"),l=e.hasAttribute("data-hcms-no-reorder"),u=e.querySelector('[data-hcms-action="add"]');u&&(u.hidden=a||i!=null&&n>=i),r.forEach((m,y)=>{let c=m.querySelector('[data-hcms-action="remove"]');c&&(c.hidden=s||o!=null&&n<=o);let h=m.querySelector('[data-hcms-action="move-up"]');h&&(h.hidden=l||y===0);let f=m.querySelector('[data-hcms-action="move-down"]');f&&(f.hidden=l||y===n-1)})}function Vi(e,t){if(!e||!e.hasAttribute(t))return null;let r=parseInt(e.getAttribute(t),10);return Number.isFinite(r)?r:null}function Qi(e,t,r){if(e.hasAttribute("data-hcms-no-reorder")||t.hasAttribute("data-hcms-no-reorder"))return;let n=e.querySelector(".hcms-array-items");if(!n)return;let i="hcms-"+r.join(".");n.setAttribute("sortable",i),n.setAttribute("onsorted","hypercmsCommit && hypercmsCommit()")}function Ee(e){return e.length?e[e.length-1]:null}function eo(e,t){let r=ll(e);if(r.length!==0)for(let n of r)no(n,t)}function ll(e){if(!e)return[];let t=[];return e.matches?.("[data-hcms-field]")&&cl(e)&&t.push(e),(e.querySelectorAll?e.querySelectorAll("input[data-hcms-field], textarea[data-hcms-field], select[data-hcms-field], img[data-hcms-field], a[data-hcms-field], [contenteditable][data-hcms-field]"):[]).forEach(n=>t.push(n)),t}function cl(e){let t=(e.tagName||"").toUpperCase();return!!(t==="INPUT"||t==="TEXTAREA"||t==="SELECT"||t==="IMG"||t==="A"||e.hasAttribute?.("contenteditable"))}function to(e,t,r){(e.querySelectorAll?e.querySelectorAll("[data-hcms-field]"):[]).forEach(i=>{let o=i.getAttribute("data-hcms-field");if(!o)return;if(!t||typeof t!="object"||!(o in t)){console.warn(`[hypercms] inline template field "${o}" is not in the rule shape; ignoring`);return}let a=r==null?null:r[o];no(i,a)})}function ro(e,t,r){if(!e.querySelectorAll)return;e.querySelectorAll("[data-hcms-field]").forEach(i=>{let o=i.getAttribute("data-hcms-field");if(!o||t&&typeof t=="object"&&!(o in t))return;let a=[...r,o].join(".");i.setAttribute("data-hcms-path",a)})}function cr(e,t,r,n){if(!e.querySelector)return e;let i=e.querySelector(t);if(i)return i;let o=r?.getAttribute?.("data-hcms-tpl")||n.join(".");throw new Error(`hypercms: template "${o}" is in slotted mode but has no ${t} element`)}function no(e,t){let r=or(e),n=(e.tagName||"").toUpperCase(),i=(e.getAttribute("type")||"").toLowerCase();if(n==="INPUT"&&i==="radio"){e.checked=e.value!=null&&String(e.value)===String(t??"");return}if(r==="checked"){e.checked=t===!0||t==="true";return}if(r){e[r]=t==null?"":String(t);return}e.textContent=t==null?"":String(t)}var ul={Mutation:(e,t)=>e?.Mutation??t?.Mutation,undo:(e,t)=>e?.undo??t?.undo,onPrepareForSave:(e,t)=>e?.addDocumentTransform??t?.onPrepareForSave,onSnapshot:(e,t)=>e?.onSnapshot??t?.onSnapshot,consent:(e,t)=>e?.confirm??t?.consent,RichClay:(e,t)=>e?.RichClay??t?.RichClay,quickcrop:(e,t)=>e?.quickcrop??t?.quickcrop,upload:(e,t)=>e?.upload??(t?.uploadFileBasic?hl(t.uploadFileBasic):null)},dl={402:"payment-required",413:"too-large",415:"unsupported-type",401:"unauthorized",403:"forbidden",404:"not-found"},cn=()=>({ok:!1,msg:"Upload cancelled",msgType:"skipped",code:"aborted",uploads:[]});function hl(e){return async function(r,{onProgress:n,signal:i}={}){if(i?.aborted)return cn();try{let o=await e(r,{onProgress:s=>{n?.({loaded:null,total:null,percent:s})}});if(i?.aborted)return cn();let a=o&&o.uploads||[];return typeof a[0]?.url!="string"?{ok:!1,msg:"The host accepted the file but did not say where it put it",msgType:"error",code:"bad-response",uploads:[]}:{ok:!0,msg:o.msg||"Uploaded",msgType:o.msgType||"success",code:o.code||null,uploads:a}}catch(o){if(i?.aborted)return cn();let a={};try{a=JSON.parse(o?.response||"{}")}catch{a={}}let s=a.code||dl[o?.status]||"error";return{ok:!1,msg:o&&o.message||"Upload failed",msgType:"error",code:s,uploads:[]}}}}function ue(e,t){let r=ul[e];if(!r)throw new Error(`hypercms: unknown platform capability "${e}"`);let n=t||(typeof window<"u"?window:null);return n&&r(n.clay,n.hyperclay)||null}var io=["clay:mutation-ready","hyperclay:mutation-ready"],oo=["clay:sync-applied","hyperclay:livesync-applied"],so=["clay:ready","hyperclay:ready"];function it(e,t,r){let n=null,i=o=>{n!==null&&n!==o.type||(n=o.type,queueMicrotask(()=>{n=null}),r(o))};for(let o of t)e.addEventListener(o,i);return()=>{for(let o of t)e.removeEventListener(o,i)}}var ve="data-hcms-bound",Re="data-hcms-bound-id",un=new Map;function ao(e,t){un.set(e,t)}function lo(e){un.delete(e)}function co(e){let t=e.getAttribute(Re);if(!t)return null;let r=un.get(t);return!r||!r.restorable()?null:r.originalHTML}var ze="data-hcms-owns-richclay";function ot(e){return e&&e.richclay&&e.richclay.RichClay||ue("RichClay",e)||(e&&typeof e.RichClay=="function"?e.RichClay:null)}function uo(e,t,r){!e||typeof e.setAttribute!="function"||(e.setAttribute(ve,t?"rich":"plain"),r&&e.setAttribute(ze,"true"))}function ho(e,t){if(!e||typeof e.querySelectorAll!="function")return;let r=e.querySelectorAll(`[${ve}]`);if(!r.length)return;let n=ot(t);if(n&&typeof n.stripFromClone=="function")try{n.stripFromClone(e)}catch(i){console.warn("[hypercms] richclay strip failed; editor state may reach the save",i)}for(let i of r)i.getAttribute(ze)==="true"&&i.removeAttribute("data-richclay"),i.removeAttribute(ze),i.removeAttribute(ve)}function mo(e,t){if(!e||typeof e.removeAttribute!="function")return;let r=ot(t);if(r&&typeof r.stripElement=="function")try{r.stripElement(e)}catch(n){console.warn("[hypercms] richclay element strip failed; the clone stays editable",n)}else e.removeAttribute("contenteditable"),e.removeAttribute("no-undo");e.getAttribute(ze)==="true"&&e.removeAttribute("data-richclay"),e.removeAttribute(ze),e.removeAttribute(ve),e.removeAttribute(Re)}function fo(e,t){if(!t||e==null)return e;return r(e);function r(n){if(typeof n=="string"){if(n.endsWith("[]")||ae(n)!==-1)return n;let i=null;try{i=t.querySelector(n)}catch{return n}return i&&i.children.length>0?n+"@innerHTML":n}if(Array.isArray(n))return n;if(n&&typeof n=="object"){let i=Object.create(null);for(let[o,a]of Object.entries(n))i[o]=r(a);return i}return n}}function po(e,t){if(!t||e==null)return e;return r(e,[t]);function r(n,i){if(typeof n=="string")return n.endsWith("[]")||ae(n)!==-1?n:i.some(o=>ml(o,n))?n+"@innerHTML":n;if(Array.isArray(n)){let[o,a]=n;if(typeof o!="string"||!o)return n;let s=fl(t,o);return s.length?[o,r(a,s)]:n}if(n&&typeof n=="object"){let o=Object.create(null);for(let[a,s]of Object.entries(n))o[a]=r(s,i);return o}return n}}function ml(e,t){let r=null;try{r=e.querySelector(t)}catch{return!1}return r?r.hasAttribute(ve)?r.getAttribute(ve)==="rich":r.children.length>0:!1}function fl(e,t){try{return[...e.querySelectorAll(t)]}catch{return[]}}function st(e){if(!e||e.tagName!=="TEXTAREA")return;let t=e.ownerDocument.defaultView||(typeof window<"u"?window:null);t&&t.CSS&&t.CSS.supports&&t.CSS.supports("field-sizing: content")||(e.style.height="auto",e.style.height=e.scrollHeight+"px")}function Me(e,t,r=!0){if(!e||!e.querySelectorAll||(e.querySelectorAll("textarea[data-hcms-field]").forEach(st),r===!1))return;let n=t&&t.defaultView||(typeof window<"u"?window:null),i=ot(n);i&&e.querySelectorAll("[contenteditable][data-hcms-field]").forEach(o=>{if(o.__hcmsRichclay)return;let a;try{a=new i(o,{inline:!0,hyperclay:!1,toolbar:["bold","italic","link","undo","redo"]})}catch(l){console.warn("[hypercms] richclay activation failed; field stays plain contenteditable",l);return}o.__hcmsRichclay=a;let s=a&&a.squire;s&&typeof s.addEventListener=="function"&&s.addEventListener("input",()=>{let l=n&&n.Event||Event;o.dispatchEvent(new l("input",{bubbles:!0}))})})}var dn=new WeakSet;function He(e,t){let r=ue("undo");if(!r)return t();r.pause();try{let n=t();return n&&n.ok?r.commitCaptured(e):r.discardCaptured(),n}finally{r.resume()}}function _e(e){let t=ue("undo");if(!t)return e();t.pause();try{return e()}finally{t.discardCaptured(),t.resume()}}function hr(e){let{formRoot:t}=e;if(!t||dn.has(t))return;dn.add(t);let r=a=>{let s=a.target;!s||!s.closest||s.closest("[data-hcms-form-root]")&&s.matches("input, textarea, select, [contenteditable][data-hcms-field]")&&(s.tagName==="TEXTAREA"&&st(s),!s.matches('input[type="file"]')&&(!s.closest("[data-hcms-field]")&&!s.hasAttribute?.("data-hcms-field")||go(s,e)))},n=a=>{let s=a.target;if(!(!s||!s.closest)&&s.closest("[data-hcms-form-root]")){if(s.matches('input[type="file"][data-hcms-upload]')){wl(s,e);return}s.matches('input[type="checkbox"], input[type="radio"], select')&&go(s,e)}},i=a=>{let s=a.target;if(!s||!s.closest)return;let l=s.closest("[data-hcms-action]");if(!l)return;let u=l.getAttribute("data-hcms-action");if(u==="add"||u==="remove"||u==="move-up"||u==="move-down"||u==="clear-upload"){if(!l.closest("[data-hcms-form-root]"))return}else if(u==="close"&&!l.closest("[data-hcms-shell]"))return;if(u==="add"){let m=l.closest("[data-hcms-path]");if(!m)return;let y=m.getAttribute("data-hcms-path");Nt(y,e)}else if(u==="remove"){let m=l.closest("[data-hcms-card], [data-hcms-array-item]");if(!m)return;fn(m,e)}else if(u==="move-up"||u==="move-down"){let m=l.closest("[data-hcms-card], [data-hcms-array-item]");if(!m)return;mn(m,u==="move-up"?-1:1,e)}else u==="clear-upload"?_l(l,e):u==="close"&&e.onCloseRequested?.()},o=t.ownerDocument;o.addEventListener("input",r,!0),o.addEventListener("change",n,!0),o.addEventListener("click",i,!0),e.detachEvents=()=>{o.removeEventListener("input",r,!0),o.removeEventListener("change",n,!0),o.removeEventListener("click",i,!0),dn.delete(t)}}var pl=new Set(["value","checked"]);function gl(e,t){if(!t)return null;let r=Se(t);if(r.some(l=>typeof l=="number"||l==="*"))return null;let n=Pe(e.pageRules,r);if(typeof n!="string")return null;let i=fe.ruleAttrIndex(n);if(i===-1)return null;let o=n.slice(i+1);if(!pl.has(o))return null;let a=n.slice(0,i),s=a?e.pageRoot.querySelector(a):e.pageRoot;return s?{el:s,prop:o,oldValue:s[o]}:null}function go(e,t){let n=(e.closest("[data-hcms-field]")||e).closest("[data-hcms-path]")?.getAttribute("data-hcms-path")||"",i=gl(t,n);if(be(pe(t),{path:n,structural:!1},t),i){let o=ue("undo");o&&typeof o.recordValue=="function"&&o.recordValue(i.el,{prop:i.prop,oldValue:i.oldValue,newValue:i.el[i.prop]})}}var bl={type:"image/webp",quality:.85,maxWidth:2048,maxHeight:2048};async function yl(e,t){let r=t&&t.getAttribute?t.getAttribute("data-hcms-crop"):null;if(r==null)return{file:e};let n=ue("quickcrop");if(typeof n!="function")return{file:e};try{let i=typeof window<"u"&&(window.clay?.modal??window.themodal)||"auto",o=await n(e,{aspect:kl(r),modal:i,...bl});return o===null?null:{file:vl(o.blob,e.name),dataURL:o.dataURL}}catch(i){return lt(t,i&&i.message||"Crop failed"),null}}function kl(e){let t=String(e??"").trim().toLowerCase();if(t===""||t==="free")return null;let r=t.match(/^(\d+(?:\.\d+)?)\s*[:/]\s*(\d+(?:\.\d+)?)$/);if(!r)return null;let n=parseFloat(r[1]),i=parseFloat(r[2]);return!n||!i?null:n/i}function vl(e,t){let r=e.type==="image/webp"?".webp":e.type==="image/jpeg"?".jpg":".png",n=String(t||"image").replace(/\.[^.]+$/,"");try{return new File([e],n+r,{type:e.type})}catch{return e}}var xl=new Set(["unsupported","payment-required"]);async function wl(e,t){let r=e.files&&e.files[0];if(!r)return;let n=e.closest("[data-hcms-path]");if(!n)return;let i=n.getAttribute("data-hcms-path")||"";lt(n,null);let o=await yl(r,n);if(!o||t.closed){Ne(e);return}let a=o.file,s=o.dataURL||null,l=ue("upload");if(typeof l!="function")return hn(e,n,t,i,await bo(a,s,n),a);xo(n,s),yo(n,0);let u=Sl(t),m;try{m=await l(a,{signal:u?.signal,onProgress:({percent:c})=>yo(n,c)})}finally{El(t,u),Cl(n)}if(t.closed){Ne(e);return}if(m.code==="aborted"){Ne(e);return}if(m.ok)return hn(e,n,t,i,m.uploads[0].url,a);if(!xl.has(m.code)){lt(n,m.msg||"Upload failed"),t.dispatch?.("hcms:error",{error:new Error(m.msg||"Upload failed"),code:m.code,path:i}),Ne(e);return}let y=m.code==="payment-required"?"This file is stored in the page. Add a paid plan to upload files.":null;return hn(e,n,t,i,await bo(a,s,n),a,y)}function hn(e,t,r,n,i,o,a=null){if(r.closed){Ne(e);return}if(xo(t,null),lt(t,null),!i){Ne(e);return}vo(t,i,o.name),be(pe(r),{path:n,structural:!1},r),a&<(t,a,"info"),Ne(e)}async function bo(e,t,r){return t||await Al(e,r)}function Al(e,t){let r=t?.ownerDocument?.defaultView?.FileReader||globalThis.FileReader;return r?new Promise(n=>{let i=new r;i.onload=()=>n(typeof i.result=="string"?i.result:""),i.onerror=()=>n("");try{i.readAsDataURL(e)}catch{n("")}}):Promise.resolve("")}function Sl(e){if(typeof AbortController!="function")return null;let t=new AbortController;return(e.uploads||(e.uploads=new Set)).add(t),t}function El(e,t){t&&e.uploads?.delete(t)}function _l(e,t){let r=e.closest("[data-hcms-path]");if(!r)return;let n=r.getAttribute("data-hcms-path")||"";vo(r,"","");let i=r.querySelector('input[type="file"][data-hcms-upload]');i&&Ne(i),lt(r,null),be(pe(t),{path:n,structural:!1},t)}function Tl(e){return e.querySelector?e.querySelector("img[data-hcms-field], a[data-hcms-field]"):null}function vo(e,t,r){let n=Tl(e);if(!n)return;let i=(n.tagName||"").toUpperCase();i==="IMG"?n.src=t||"":i==="A"&&(n.href=t||"",n.textContent=t?r||sn(t):"")}function Ne(e){try{e.value=""}catch{}}function xo(e,t){let r=e.querySelector?e.querySelector(".mirk-image__frame"):null;r&&(t?r.style.backgroundImage=`url("${t.replace(/"/g,"%22")}")`:r.style.removeProperty("background-image"))}function yo(e,t){let r=Math.max(0,Math.min(100,Number(t)||0));e.setAttribute("data-hcms-uploading",""),e.style?.setProperty?.("--hcms-upload-progress",`${r}%`)}function Cl(e){e.removeAttribute("data-hcms-uploading"),e.style?.removeProperty?.("--hcms-upload-progress")}function lt(e,t,r="error"){let n=e.querySelector?e.querySelector(":scope > .hcms-error"):null;n&&(n.classList.toggle("hcms-error--info",!!t&&r==="info"),t?(n.textContent=t,n.hidden=!1):(n.textContent="",n.hidden=!0))}function Nt(e,t){let{formRoot:r,pageRules:n}=t,i=r.querySelector(`[data-hcms-path="${ct(e)}"]`);if(!i)throw new Error(`hypercms: no element at path "${e}"`);let o=i.querySelector(".hcms-array-items");if(!o)throw new Error(`hypercms: array container missing .hcms-array-items at "${e}"`);let a=Se(e),s=Ll(n,a),l=Array.isArray(s),u=typeof s=="string"&&s.endsWith("[]");if(!l&&!u)throw new Error(`hypercms: path "${e}" is not an array`);let m=dr(i,"data-hcms-max-items"),y=o.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]");if(i.hasAttribute("data-hcms-no-add")||m!=null&&y.length>=m)return;let c=y.length,h=l?s[1]:s.replace(/\[\]$/,""),f=Ot(l?h:"string"),b=Wi({shape:l?"object-array-item":"scalar-array-item",itemShape:h,pathArr:[...a,c],data:f,doc:t.doc,itemKey:i.getAttribute("data-hcms-item-tpl")||null,pageRules:n});return o.appendChild(b),Me(b,t.doc,t.view?.enhanceFormRichText!==!1),gn(i),He(`Add ${e}`,()=>be(pe(t),{path:e,structural:!0},t))}function mn(e,t,r){let n=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]');if(!n||n.hasAttribute("data-hcms-no-reorder"))return;let i=n.querySelector(".hcms-array-items");if(!i)return;let o=Array.from(i.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")),a=o.indexOf(e);if(a<0)return;let s=a+t;if(s<0||s>=o.length)return;let l=e.querySelector(`[data-hcms-action="${t<0?"move-up":"move-down"}"]`);return t<0?i.insertBefore(e,o[s]):i.insertBefore(e,o[s].nextSibling),bn(i),gn(n),l&&typeof l.focus=="function"&&e.querySelector(`[data-hcms-action="${t<0?"move-up":"move-down"}"]`)?.focus?.(),He(`Reorder ${n.getAttribute("data-hcms-path")||""}`,()=>be(pe(r),{path:n.getAttribute("data-hcms-path")||"",structural:!0},r))}var ur="Delete this item?";function Ol(e,t){let r=e&&e.getAttribute("data-hcms-confirm-remove");if(r!=null)return/^(off|false|no|0)$/i.test(r.trim())?null:r||ur;let n=t&&t.confirmRemove;return n===!1?null:typeof n=="string"?n||ur:n===!0||e&&e.getAttribute("data-hcms-shape")==="object-array"?ur:null}function fn(e,t){let r=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]'),n=Ol(r,t);if(n==null)return at(e,t);let i=ue("consent")||typeof window<"u"&&window.consent;typeof i=="function"?Promise.resolve(i(n)).then(()=>{t.closed||at(e,t)},()=>{}):typeof window<"u"&&typeof window.confirm=="function"?window.confirm(n)&&at(e,t):at(e,t)}function at(e,t){let r=e.getAttribute("data-hcms-path")||"",n=e.parentElement,i=e.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]');if(!i?.hasAttribute("data-hcms-no-remove")){if(i){let o=dr(i,"data-hcms-min-items"),a=i.querySelector(".hcms-array-items"),s=a?a.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]").length:0;if(o!=null&&s<=o)return}return e.remove(),n&&bn(n),i&&gn(i),He(`Remove ${r}`,()=>be(pe(t),{path:r,structural:!0},t))}}function be(e,t,r){if(r.closed)return{ok:!1,skipped:!0,closed:!0};let n=Lt(e);if(!t.structural&&n===r.lastFingerprint)return{ok:!0,skipped:!0};let i=Object.hasOwn(r,"writeRules")?r.writeRules:r.pageRules,o=Mi(r.pageRoot,i,e,{shellRoot:r.shellRoot,structural:!!t.structural,structuralPath:t.path||null,formRoot:r.formRoot});return o.ok?(r.lastFingerprint=n,r.lastData=e,ko(r,null),r.dispatch?.("hcms:change",{data:e,path:t.path,structural:!!t.structural}),r.onChange?.(e,t)):(ko(r,Nl(o.error,t.path)),r.dispatch?.("hcms:error",{error:o.error,attemptedData:e}),r.onError?.(o.error)),o}function mr(e,t){let r=ct(t),n=`[data-hcms-path="${r}"] input[data-hcms-field], [data-hcms-path="${r}"] textarea[data-hcms-field], [data-hcms-path="${r}"] select[data-hcms-field], [data-hcms-path="${r}"] img[data-hcms-field], [data-hcms-path="${r}"] a[data-hcms-field], [data-hcms-path="${r}"] [contenteditable][data-hcms-field], input[data-hcms-path="${r}"][data-hcms-field], textarea[data-hcms-path="${r}"][data-hcms-field], select[data-hcms-path="${r}"][data-hcms-field], img[data-hcms-path="${r}"][data-hcms-field], a[data-hcms-path="${r}"][data-hcms-field], [contenteditable][data-hcms-path="${r}"][data-hcms-field]`;return e.querySelector(n)}function fr(e,t,r,n){let i=(e.tagName||"").toUpperCase(),o=(e.getAttribute("type")||"").toLowerCase();if(i==="INPUT"&&o==="checkbox"){e.checked=t===!0||t==="true";return}if(i==="INPUT"&&o==="radio"){let a=ct(n),s=r.querySelectorAll(`[data-hcms-path="${a}"][data-hcms-field][type="radio"], [data-hcms-path="${a}"] [data-hcms-field][type="radio"]`);s.length?s.forEach(l=>{l.checked=String(l.value)===String(t??"")}):e.checked=String(e.value)===String(t??"");return}if(i==="IMG"){e.src=t==null?"":String(t);return}if(i==="A"){e.href=t==null?"":String(t);return}if(e.hasAttribute&&e.hasAttribute("contenteditable")){e.innerHTML=t==null?"":String(t);return}if("value"in e){e.value=t==null?"":String(t);return}e.textContent=t==null?"":String(t)}function pe(e){let t=fe.extract(e.formRoot,e.formRules,{exclude:null});return Le(t,e.formRules)}function Le(e,t){if(t==null||e==null)return e;if(typeof t=="string")return t.endsWith("@checked")?e===!0||e==="true":e;if(Array.isArray(t)){if(!Array.isArray(e))return e;let[,r]=t;return e.map(n=>Le(n,r))}if(typeof t=="object"){if(typeof e!="object"||Array.isArray(e))return e;let r={};for(let[n,i]of Object.entries(t))r[n]=Le(e[n],i);return r}return e}function ko(e,t){e.lastErrors=t&&t.length?t:null,pn(e)}function pn(e){if(Rl(e),e.errorEl&&(e.errorEl.textContent="",e.errorEl.hidden=!0),!e.lastErrors)return;let t=[];for(let{message:r,path:n}of e.lastErrors){if(n!=null&&n!==""){let i=Ml(e.formRoot,n);if(i){i.textContent=i.textContent?`${i.textContent}
|
|
151
151
|
${r}`:r,i.hidden=!1;continue}}t.push(r)}t.length&&e.errorEl&&(e.errorEl.textContent=t.join(`
|
|
152
|
-
`),e.errorEl.hidden=!1)}function
|
|
152
|
+
`),e.errorEl.hidden=!1)}function Rl(e){if(e.formRoot)for(let t of e.formRoot.querySelectorAll(".hcms-error"))t.textContent="",t.hidden=!0}function Ml(e,t){if(!e)return null;let r=t.split(".");for(;r.length>0;){let n=r.join("."),i=typeof CSS<"u"&&CSS.escape?CSS.escape(n):n.replace(/[^a-zA-Z0-9_\-.*]/g,a=>"\\"+a),o=e.querySelector(`[data-hcms-path="${i}"]`);if(o){for(let a of o.children)if(a.classList&&a.classList.contains("hcms-error"))return a}r.pop()}return null}function Nl(e,t){return e?e.name==="EmptyListInsert"?[{message:"Add a seed item in HTML first.",path:t}]:e.name==="ShapeMismatch"&&Array.isArray(e.mismatches)&&e.mismatches.length?e.mismatches.map(r=>({message:`Shape mismatch: expected ${r.expected}, got ${r.got}`,path:r.path})):[{message:e.message||String(e),path:t}]:[{message:"unknown error",path:t}]}function Ll(e,t){let r=e;for(let n of t){if(r==null||typeof r=="string")return;if(Array.isArray(r)){if(typeof n!="number"&&n!=="*")return;r=r[1];continue}if(typeof r=="object"){if(typeof n=="number"||!(n in r))return;r=r[n];continue}return}return r}function dr(e,t){if(!e||!e.hasAttribute(t))return null;let r=parseInt(e.getAttribute(t),10);return Number.isFinite(r)?r:null}function gn(e){if(!e)return;let t=e.querySelector(".hcms-array-items");if(!t)return;let r=Array.from(t.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")),n=r.length,i=dr(e,"data-hcms-max-items"),o=dr(e,"data-hcms-min-items"),a=e.hasAttribute("data-hcms-no-add"),s=e.hasAttribute("data-hcms-no-remove"),l=e.hasAttribute("data-hcms-no-reorder"),u=e.querySelector(':scope > .hcms-add, :scope > * > .hcms-add, :scope > [data-hcms-action="add"]');u&&(u.hidden=a||i!=null&&n>=i),r.forEach((m,y)=>{let c=m.querySelector('[data-hcms-action="remove"]');c&&(c.hidden=s||o!=null&&n<=o);let h=m.querySelector('[data-hcms-action="move-up"]');h&&(h.hidden=l||y===0);let f=m.querySelector('[data-hcms-action="move-down"]');f&&(f.hidden=l||y===n-1)})}function pr(e){!e||!e.querySelectorAll||e.querySelectorAll(".hcms-array-items").forEach(t=>bn(t))}function bn(e){let t=e.querySelectorAll?Array.from(e.querySelectorAll('input[type="radio"][data-hcms-field]'),n=>[n,n.checked]):[],r=0;for(let n of e.children){if(!n.matches?.("[data-hcms-card], [data-hcms-array-item]"))continue;let i=n.getAttribute("data-hcms-path");if(!i)continue;let o=i.split(".");o[o.length-1]=String(r);let a=o.join(".");a!==i&&Il(n,i,a),r++}for(let[n,i]of t)n.checked!==i&&(n.checked=i)}function Il(e,t,r){let n=e.querySelectorAll("[data-hcms-path]");e.setAttribute("data-hcms-path",r);for(let i of n){let o=i.getAttribute("data-hcms-path");o===t?i.setAttribute("data-hcms-path",r):o&&o.startsWith(t+".")&&i.setAttribute("data-hcms-path",r+o.slice(t.length))}jl(e)}function jl(e){for(let t of e.querySelectorAll('input[type="radio"][data-hcms-field]')){if(!t.name||!t.name.startsWith("hcms-"))continue;let r=t.closest("[data-hcms-path]");r&&(t.name=ln(r.getAttribute("data-hcms-path")))}}function Lt(e){return JSON.stringify(e,(t,r)=>{if(r&&typeof r=="object"&&!Array.isArray(r)){let n=Object.create(null);for(let i of Object.keys(r).sort())n[i]=r[i];return n}return r})}function ct(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var Bl={},gr="hcms-shell-styles",Fl="hcms-bundled-styles-installed",br="hcms-session-open",Dl='a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',ut=new WeakSet,yn="";function Ao(e){yn=e}function It(e){e?.body?.classList.add(br)}function kn(e){e?.body?.classList.remove(br)}var ql=0;function wo(e){return String(e).replace(/[&<>"]/g,t=>({"&":"&","<":"<",">":">",'"':"""})[t])}function So({mountTo:e,side:t="right",overlay:r=!1,showSaveButton:n=!1,title:i="Page content",eyebrow:o="Edit",theme:a=null,doc:s}){Eo(s);let l=`hcms-shell-title-${++ql}`,u=s.createElement("div");u.setAttribute("data-hcms-shell",""),u.setAttribute("editor-ui",""),u.setAttribute("save-remove",""),u.setAttribute("save-ignore",""),u.setAttribute("tabindex","-1"),u.setAttribute("role","dialog"),u.setAttribute("aria-modal","true"),u.setAttribute("aria-labelledby",l);let m=a==="dark"?" dark":a==="light"?" light":"";u.className="hcms-shell pixel-quiet hcms-panel hcms-side-"+t+(r?" hcms-overlay":"")+m;let y=wo(i),c=wo(o);u.innerHTML=`
|
|
153
153
|
<div class="hcms-shell-minibar" aria-hidden="true">
|
|
154
|
-
<span class="hcms-shell-minibar-title">${
|
|
154
|
+
<span class="hcms-shell-minibar-title">${y}</span>
|
|
155
155
|
<button type="button" class="hcms-shell-close mirk-button mirk-button--small" data-hcms-action="close" aria-label="Close">
|
|
156
156
|
<span class="mirk-button__label">\xD7</span>
|
|
157
157
|
</button>
|
|
@@ -159,8 +159,8 @@ ${r}`:r,i.hidden=!1;continue}}t.push(r)}t.length&&e.errorEl&&(e.errorEl.textCont
|
|
|
159
159
|
<div class="hcms-shell-body">
|
|
160
160
|
<header class="hcms-shell-header">
|
|
161
161
|
<div class="hcms-shell-heading">
|
|
162
|
-
<div class="hcms-shell-eyebrow">${
|
|
163
|
-
<h2 class="hcms-shell-title" id="${l}">${
|
|
162
|
+
<div class="hcms-shell-eyebrow">${c}</div>
|
|
163
|
+
<h2 class="hcms-shell-title" id="${l}">${y}</h2>
|
|
164
164
|
</div>
|
|
165
165
|
<button type="button" class="hcms-shell-close mirk-button mirk-button--small" data-hcms-action="close" aria-label="Close">
|
|
166
166
|
<span class="mirk-button__label">\xD7</span>
|
|
@@ -175,21 +175,133 @@ ${r}`:r,i.hidden=!1;continue}}t.push(r)}t.length&&e.errorEl&&(e.errorEl.textCont
|
|
|
175
175
|
</button>
|
|
176
176
|
</footer>
|
|
177
177
|
</div>
|
|
178
|
-
`,(e||
|
|
179
|
-
#hcms-toggle {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
178
|
+
`,(e||s.body).appendChild(u);let f=s.body;f.classList.add("hcms-open"),It(s),r&&f.classList.add("hcms-overlay"),t==="left"&&f.classList.add("hcms-side-left");let b=Pl(u,s),k=$l(u);return{root:u,formRoot:u.querySelector("[data-hcms-form-root]"),noticeEl:u.querySelector(".hcms-shell-notice"),errorEl:u.querySelector(".hcms-shell-error"),saveButton:u.querySelector(".hcms-shell-save"),destroy(){b.detach(),k.detach(),u.remove(),f.classList.remove("hcms-open","hcms-overlay","hcms-side-left"),kn(s)},restoreChrome(){Ie(s),f.classList.add("hcms-open"),It(s),r&&f.classList.add("hcms-overlay"),t==="left"&&f.classList.add("hcms-side-left")}}}function Ie(e){e&&(e.getElementById(gr)||e.querySelector("style[data-hcms-bundled-styles]")||(ut.delete(e),Eo(e)))}function Eo(e){if(e&&!ut.has(e)){if(e[Fl]){ut.add(e);return}if(e.getElementById(gr)||e.querySelector("style[data-hcms-bundled-styles]")){ut.add(e);return}if(yn){let t=e.createElement("style");t.id=gr,t.setAttribute("save-remove",""),t.setAttribute("save-ignore",""),t.textContent=yn,(e.head||e.documentElement).appendChild(t),ut.add(e);return}try{let t=new URL("./theme.generated.css",Bl.url).href,r=e.createElement("link");r.rel="stylesheet",r.id=gr,r.setAttribute("save-remove",""),r.setAttribute("save-ignore",""),r.href=t,(e.head||e.documentElement).appendChild(r),ut.add(e)}catch{let r=()=>{link.isConnected&&console.warn("hypercms: shell stylesheet not applied \u2014 cssText is empty and the co-located theme fallback is unavailable. Call installStyles(themeText) before opening the CMS.")};e.defaultView?.queueMicrotask?e.defaultView.queueMicrotask(r):r()}}}function $l(e){let t=e.querySelector(".hcms-shell-body"),r=e.querySelector(".hcms-shell-header");if(!t||!r||typeof t.addEventListener!="function")return{detach(){}};let n=()=>{let i=(r.offsetHeight||0)-12;e.classList.toggle("is-condensed",t.scrollTop>i)};return t.addEventListener("scroll",n,{passive:!0}),n(),{detach(){t.removeEventListener("scroll",n)}}}function Pl(e,t){function r(n){if(n.key!=="Tab"||!e.contains(t.activeElement))return;let i=Array.from(e.querySelectorAll(Dl));if(i.length===0)return;let o=i[0],a=i[i.length-1];n.shiftKey&&t.activeElement===o?(n.preventDefault(),a.focus()):!n.shiftKey&&t.activeElement===a&&(n.preventDefault(),o.focus())}return t.addEventListener("keydown",r),{detach:()=>t.removeEventListener("keydown",r)}}var zl="[hypercms]",_o={skip:"[data-hcms-shell]",templateAttr:"cms-template"},To={skip:"[data-hcms-shell]",templateAttr:null},vn=class extends Error{constructor(t,r,n){super(`hypercms: rule at "${t}" has an invalid CSS selector: "${r}"`),this.name="InvalidRuleSelector",this.path=t,this.selector=r,this.cause=n}};function kr(e,t){let r=[],n=[],i=[];return wn(Ae(e),e,t,[],r,n,i),{missing:Co(r),twins:Kl(n),readOnly:Co(i)}}function vr(e){return xn(e)}function xn(e){if(typeof e=="string")return Oo(e)?void 0:e;if(Array.isArray(e)){let[t,r]=e;return[t,xn(r)]}if(e&&typeof e=="object"){let t={};for(let[r,n]of Object.entries(e)){let i=xn(n);i!==void 0&&(t[r]=i)}return t}return e}function wn(e,t,r,n,i,o,a){if(typeof r=="string"){let s=Hl(r),l=s?yr(e,t,s,_o,n):[];if(Oo(r)){a.push(dt(n));return}if(!s)return;if(r.endsWith("[]")){l.length===0&&yr(e,t,s,To,n).length===0&&i.push(dt(n));return}l.length===0?i.push(dt(n)):l.length>1&&o.push({path:dt(n),count:l.length});return}if(Array.isArray(r)){let[s,l]=r;if(typeof s!="string"||!s)return;let u=yr(e,t,s,_o,n);if(u.length===0){yr(e,t,s,To,n).length===0&&i.push(dt(n));return}for(let m of u)wn(e,m,l,[...n,"*"],i,o,a);return}if(r&&typeof r=="object")for(let[s,l]of Object.entries(r))wn(e,t,l,[...n,s],i,o,a)}function yr(e,t,r,n,i){try{return e.find(t,r,n)}catch(o){throw new vn(dt(i),r,o)}}function Hl(e){if(e==="."||e.startsWith("@"))return null;if(e.endsWith("[]"))return e.slice(0,-2)||null;let t=ae(e);return(t===-1?e:e.slice(0,t))||null}function Ul(e){if(e.endsWith("[]"))return null;let t=ae(e);return t===-1?null:e.slice(t+1)||null}function Oo(e){let t=Ul(e);return t!=null&&vt.has(t)}function ht(e){Vl(e),Wl(e)}function Vl(e){let t=e.noticeEl;if(!t)return;let r=e.unresolved&&e.unresolved.missing||[],n=e.unresolved&&e.unresolved.readOnly||[];if(r.length===0&&n.length===0){t.textContent="",t.hidden=!0;return}let i=[];if(r.length){let o=r.length===1?"1 field no longer matches this page":`${r.length} fields no longer match this page`;i.push(`${o}: ${r.join(", ")}`)}if(n.length){let o=n.length===1?"1 field reads a property the browser will not let anything write":`${n.length} fields read properties the browser will not let anything write`;i.push(`${o}: ${n.join(", ")}`)}t.textContent=i.join(`
|
|
179
|
+
`),t.hidden=!1}function Wl(e){let t=e.unresolved&&e.unresolved.twins||[],r=t.map(n=>`${n.path}:${n.count}`).join("|");if(r!==e.lastTwinSignature){e.lastTwinSignature=r;for(let{path:n,count:i}of t)console.warn(`${zl} "${n}" matches ${i} elements; edits go to the first one.`)}}function Co(e){return[...new Set(e)]}function Kl(e){let t=new Map;for(let r of e){let n=t.get(r.path);(!n||r.count>n.count)&&t.set(r.path,r)}return[...t.values()]}function dt(e){return e.length?e.join("."):"(whole page)"}var Gl={skip:"[data-hcms-shell]",templateAttr:"cms-template"};function je(e,{ignoreActiveValue:t}={}){return Yl(e,{ignoreActiveValue:t})}function Yl(e,{ignoreActiveValue:t}){let r=fe.findRules(e.doc,e.rulesSource||"cms");r&&(e.pageRules=e.view.prepareRules(r.rules),e.rulesTagNode=r.tagNode),Qt(e.doc),ir(e.doc,e.pageRules),e.formRules=sr(e.pageRules,e.doc),e.writeRules=vr(e.pageRules),e.unresolved=kr(e.pageRoot,e.pageRules);let n=Jt(),i=Le(fe.extract(e.pageRoot,e.pageRules,{...Gl,...n.hooks}),e.pageRules),o=tt({pageRules:e.pageRules,formRules:e.formRules,data:i,doc:e.doc});Yt(e.formRoot,o,{ignoreActiveValue:t}),n.seed(e.formRoot),Me(e.formRoot,e.doc,e.view?.enhanceFormRichText!==!1),pn(e),ht(e),e.updateFingerprint&&e.updateFingerprint()}function Ro({debounce:e=100,onRefresh:t}){let r=ue("Mutation");if(!r||typeof r.onAnyChange!="function")throw new Error("hypercms: a mutation hub is required (clay.Mutation or hyperclay.Mutation). Load clayjs or hyperclayjs, or just the mutation utility, before initializing hypercms.");let n=r.onAnyChange({debounce:e},i=>{t(i)});return{unsubscribe:typeof n=="function"?n:()=>{}}}var Jl='input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex="-1"])';function Mo({doc:e,pageRoot:t,opts:r={}}){let n=r.richText!==!1,i=null;return{name:"sidebar",richText:n,enhanceFormRichText:!0,ctx:null,root:null,formRoot:null,errorEl:null,noticeEl:null,prepareRules(o){return n?fo(o,t):o},mount(o){let a=this.ctx;i=_e(()=>So({mountTo:r.mountTo||e.body,side:r.side||"right",overlay:!!r.overlay,showSaveButton:!!r.showSaveButton,title:r.title,eyebrow:r.eyebrow,theme:r.theme,doc:e})),this.root=i.root,this.formRoot=i.formRoot,this.errorEl=i.errorEl,this.noticeEl=i.noticeEl;let s=tt({pageRules:a.pageRules,formRules:a.formRules,data:o,doc:e});i.formRoot.appendChild(s),a.seeder.seed(i.formRoot),Me(i.formRoot,e),ht(a),hr(a)},refresh(o){if(o==="livesync"){i?.restoreChrome?.(),je(this.ctx,{ignoreActiveValue:!0});return}if(o==="undo"){je(this.ctx,{ignoreActiveValue:!1});return}je(this.ctx)},focusOnOpen(){let o=this.root&&this.root.querySelector(Jl);o&&typeof o.focus=="function"&&o.focus()},destroy(){i?.destroy(),i=null}}}var Xl="[cms-template], [data-hcms-shell]";function jt(e){if(!e||typeof e.getBoundingClientRect!="function"||typeof e.closest=="function"&&e.closest(Xl))return!1;let t=e.getBoundingClientRect();return t.width>=8&&t.height>=8}var Zl={skip:"[data-hcms-shell]",templateAttr:"cms-template"},Ql={skip:"[data-hcms-shell]",templateAttr:null},ec="text",tc="native",No="handle",rc=new Set(["INPUT","TEXTAREA","SELECT"]),jo=new Set(["IMG","INPUT","TEXTAREA","SELECT","OPTION","BR","HR","VIDEO","AUDIO","IFRAME","EMBED","OBJECT","CANVAS","SOURCE","TRACK","AREA","COL","PARAM","BUTTON"]);function Sn(e,t){return nc(e,t)}function nc(e,t){let r=[],n=[],i=Ae(e);return An(i,e,t,[],r,n),{targets:r,lists:n}}function An(e,t,r,n,i,o){if(typeof r=="string"){if(r.endsWith("[]")){let m=r.slice(0,-2);if(!m)return;let y=xr(e,t,m);y.forEach((c,h)=>{i.push(Io([...n,h],c,r,null))}),o.push(Lo(e,t,n,m,y,!0));return}let a=ae(r),s=a===-1?null:r.slice(a+1),l=a===-1?r:r.slice(0,a),u=!l||l==="."?t:xr(e,t,l)[0];u&&i.push(Io(n,u,r,s));return}if(Array.isArray(r)){let[a,s]=r;if(typeof a!="string"||!a)return;let l=xr(e,t,a);l.forEach((u,m)=>An(e,u,s,[...n,m],i,o)),o.push(Lo(e,t,n,a,l,typeof s=="string"));return}if(r&&typeof r=="object")for(let[a,s]of Object.entries(r))An(e,t,s,[...n,a],i,o)}function Lo(e,t,r,n,i,o){let a=i[0]?i[0].parentElement:null;if(!a){let s=xr(e,t,n,Ql)[0];a=s?s.parentElement:null}return{path:r,items:i,container:a,scalar:o}}function Io(e,t,r,n){return{path:e,el:t,rule:r,attr:n,kind:ic(t,n),icon:sc(t,n)}}function ic(e,t){let r=(e.tagName||"").toUpperCase();return!t||t==="innerHTML"?jo.has(r)?No:ec:t==="value"&&rc.has(r)&&!e.readOnly&&!oc(e)?tc:No}function oc(e){return e.disabled?!0:typeof e.matches=="function"&&e.matches(":disabled")}function sc(e,t){let r=(e.tagName||"").toUpperCase();return(!t||t==="innerHTML")&&!jo.has(r)?null:r==="IMG"||t==="srcset"?"camera":r==="A"&&t==="href"?"paperclip":"pencil"}function xr(e,t,r,n=Zl){try{return e.find(t,r,n)}catch{return[]}}var Fo=Object.freeze({data:Object.freeze({tokens:["no-data"],bundles:["editor-ui"]}),save:Object.freeze({tokens:["no-save"],bundles:["editor-ui"]}),snapshot:Object.freeze({tokens:["no-snapshot"],bundles:["editor-ui"]}),watch:Object.freeze({tokens:["no-watch"],bundles:["editor-ui"]}),undo:Object.freeze({tokens:["no-undo"],bundles:["editor-ui"]}),history:Object.freeze({tokens:[],bundles:["editor-ui"]})}),ac=Object.freeze({"editor-ui":Object.freeze(["no-data","no-save","no-snapshot","no-watch","no-undo"])}),xm=Object.freeze(["no-save","no-snapshot","no-trigger-autosave","no-dirty","no-watch","no-undo","no-data","freeze","editor-ui"]);function En(e,t){if(!e||e.nodeType!==1)return!1;let r=e.getAttribute?.("clay");return!!(r&&r.split(/\s+/).includes(t)||e.hasAttribute?.(t))}function lc(e,t){if(En(e,t))return!0;for(let[r,n]of Object.entries(ac))if(n.includes(t)&&En(e,r))return!0;return!1}function Ft(e){let t=Fo[e];if(!t)throw new Error(`Unknown region capability: ${e}`);return[...t.tokens,...t.bundles].flatMap(r=>[`[clay~="${r}"]`,`[${r}]`]).join(", ")}function cc(e,t){let r=e&&e.nodeType===1?e:e?.parentElement;for(;r&&r.nodeType===1;){let n=Fo[t];if(!n)throw new Error(`Unknown region capability: ${t}`);if(n.tokens.some(i=>lc(r,i))||n.bundles.some(i=>En(r,i)))return r;r=r.parentElement}return null}function Do(e,t){return!!cc(e,t)}var uc=/:(?:focus(?:-within|-visible)?|hover|active|visited|defined)\b/i;function qo(e,t){if(!/^(INPUT|TEXTAREA|SELECT|OPTION)$/.test(e.tagName||""))return;let r=(e.getAttribute?.("type")||"").toLowerCase();if("value"in e&&"value"in t&&e.tagName!=="OPTION"&&r!=="checkbox"&&r!=="radio"&&(t.value=e.value),"checked"in e&&"checked"in t&&(t.checked=e.checked),"selected"in e&&"selected"in t&&(t.selected=e.selected),e.tagName==="SELECT")for(let n=0;n<e.options.length;n++)t.options[n].selected=e.options[n].selected;"indeterminate"in e&&"indeterminate"in t&&(t.indeterminate=e.indeterminate)}function $o(e,t,r,n){if(n)return!!e.closest?.(t);let i=e;for(;i?.nodeType===1;){if(i.matches(t))return!0;if(i===r)break;i=i.parentElement}return!1}function Po(e,t,r,n,i,o,a,s){if(e.nodeType===1&&((a?Do(e,r):$o(e,n,o,!1))||i&&$o(e,i,o,a)))return null;let l=t.importNode(e,!1);s.cloneToLive.set(l,e),s.liveToClone.set(e,l);let u=e.nodeType===1&&e.tagName==="TEMPLATE"?e.content:e,m=l.nodeType===1&&l.tagName==="TEMPLATE"?l.content:l;u!==e&&(s.cloneToLive.set(m,u),s.liveToClone.set(u,m));for(let y of u.childNodes||[]){let c=Po(y,t,r,n,i,o,a,s);c&&(m.appendChild(c),y.nodeType===1&&qo(y,c))}return e.nodeType===1&&qo(e,l),l}function _n(e,{capability:t="data",exclude:r=null,inherit:n=!0}={}){if(!e)throw new TypeError("createContentView requires a DOM context");let i=e.nodeType===9?e:e.ownerDocument;if(!i?.implementation?.createHTMLDocument)throw new TypeError("createContentView requires an HTML DOM implementation");let o=i.implementation.createHTMLDocument(""),a=new WeakMap,s=new WeakMap,l=e.nodeType===9?e.documentElement:e;r&&o.documentElement.matches(r);let u=Ft(t),m=Po(l,o,t,u,r,l,n,{cloneToLive:a,liveToClone:s});e.nodeType===9&&m&&(o.replaceChild(m,o.documentElement),s.set(e,o),a.set(o,e));let y=c=>{if(uc.test(c))throw new Error(`Filtered content queries do not support stateful selector: ${c}`)};return{root:m,document:o,capability:t,selector:Ft(t),cloneToLive:a,liveToClone:s,original(c){return a.get(c)||null},cloneOf(c){return s.get(c)||null},query(c,h=m){return y(c),Array.from(h.querySelectorAll(c),f=>a.get(f)||f)},text(c=m){return(c===m?m:s.get(c))?.textContent||""},html(c=m){return(c===m?m:s.get(c))?.innerHTML??""},clone(c=m){let h=c===m?m:s.get(c);return h?o.importNode(h,!0):null}}}var dc=[16,8,0],de=8,hc=4;function Bo({anchor:e,bar:t,rail:r=t,viewport:n,current:i=null}){let o=c=>i===c?hc:0;if(e.bottom<=0||e.top>=n.height||e.right<=0||e.left>=n.width)return{mode:"hidden",x:0,y:0};let a=c=>Math.max(de,Math.min(e.left,n.width-c-de)),s=e.top-16-t.height;if(s>=de-o("above"))return{mode:"above",x:a(t.width),y:s};let l=e.bottom+16;if(l+t.height<=n.height-de+o("below"))return{mode:"below",x:a(t.width),y:l};let u=n.width-e.right-de,m=e.left-de,y=u>=m?[["rail-right",u],["rail-left",m]]:[["rail-left",m],["rail-right",u]];for(let[c,h]of y)for(let f of dc){if(r.width+f>h+o(c))continue;let b=c==="rail-right"?Math.min(e.right+f,n.width-r.width-de):Math.max(e.left-f-r.width,de),k=Math.min(e.bottom,n.height-de)-r.height,A=Math.max(de,Math.min(Math.max(e.top,de),k));return{mode:c,x:b,y:A,gap:f}}return{mode:"pinned",x:a(t.width),y:de}}function Tn({anchor:e,handle:t,viewport:r,inset:n=6,prefer:i="auto"}){let o=e.height>=t.height*1.5&&e.width>=t.width*2;if(i==="corner"||o){let c=Math.max(de,Math.min(e.right-t.width+n,r.width-t.width-de)),h=Math.max(de,Math.min(e.top-n,r.height-t.height-de));return{x:c,y:h,mode:"over"}}let a=4,s=e.right+a+t.width<=r.width-de,l=s?e.right+a:e.left-a-t.width,u=Math.max(de,l),m=e.top+e.height/2-t.height/2,y=Math.max(de,Math.min(m,r.height-t.height-de));return{x:u,y,mode:s?"beside-right":"beside-left"}}var Ar=!1;function zo(){if(Ar)return;let e=ue("onPrepareForSave");typeof e=="function"&&(e(t=>{Uo(t),Ho(t)}),Ar=!0)}function Ho(e){let t=e&&e.querySelector&&e.querySelector("body");t&&t.classList.remove("hcms-open","hcms-overlay","hcms-side-left",br)}function Uo(e){if(!(!e||typeof e.querySelectorAll!="function"))for(let t of e.querySelectorAll(`[${Re}]`)){let r=co(t);r!==null&&(t.innerHTML=r),t.removeAttribute(Re)}}var Sr=!1;function Er(){if(Sr)return;let e=ue("onSnapshot");typeof e=="function"&&(e(t=>{Uo(t),ho(t,typeof window<"u"?window:null),Ho(t)}),Sr=!0)}function Vo(){zo(),Er(),(!Ar||!Sr)&&mc()}var wr=null;function mc(){if(wr||typeof document>"u")return;wr=it(document,so,()=>{zo(),Er(),Ar&&Sr&&(wr?.(),wr=null)})}var fc={edit:"M8 10h2v6H8zm2 4h4v2h-4zm0-6h2v2h-2zm2-2h2v2h-2zm2-2h2v2h-2zm2-2h2v2h-2zm2 2h2v2h-2zm2 2h2v2h-2zm-2 2h2v2h-2zm-2 2h2v2h-2zm-2 2h2v2h-2zm-4 0h2v2h-2z","move-up":"M11 4h2v2h2v2h2v2h2v2h-4v-2h-2v10h-2V10H9v2H5v-2h2V8h2V6h2z","move-down":"M11 4h2v10h2v-2h4v2h-2v2h-2v2h-2v2h-2v-2H9v-2H7v-2H5v-2h4v2h2z",remove:"M5 5h3v3h3v3h2V8h3V5h3v3h-3v3h-3v2h3v3h3v3h-3v-3h-3v-3h-2v3H8v3H5v-3h3v-3h3v-2H8V8H5z",add:"M10 4h4v6h6v4h-6v6h-4v-6H4v-4h6z"};function Ue(e){let t=e==="edit"?"6 0 18 18":"0 0 24 24",r=e==="settings"?'<circle cx="6" cy="12" r="1.5"/><circle cx="12" cy="12" r="1.5"/><circle cx="18" cy="12" r="1.5"/>':`<path d="${fc[e]}"/>`;return`<svg class="hcms-inline-icon" xmlns="http://www.w3.org/2000/svg" viewBox="${t}" width="24" height="24" fill="currentColor" aria-hidden="true" focusable="false">${r}</svg>`}var Wo="data-hcms-ghost",pc=Ft("history");function gc(e){let t=e.container,r=null;for(;t&&(t.namespaceURI!=="http://www.w3.org/1999/xhtml"||["SELECT","OPTGROUP","DATALIST"].includes(t.tagName));)r=t,t=t.parentElement;return{parent:t,anchor:r}}function Ko({doc:e,themeRoot:t,onAdd:r,onResize:n}){let i=e.defaultView,o=[],a=!1,s=null,l=new Map;function u(h,f,b){h.style[f]!==b&&(h.style[f]=b)}function m(){let h=new Set(o.map(f=>f.node.parentElement));for(let[f,b]of l)h.has(f)&&i?.Sortable?.get(f)===b.instance||(b.instance.option("draggable")===b.selector&&b.instance.option("draggable",b.original),l.delete(f));for(let f of h){let b=i?.Sortable?.get(f);if(!b)continue;let k=b.option("draggable");if(l.get(f)?.selector===k)continue;let A=k,L=`${A.trim().startsWith(">")?"> ":""}:is(${A.trim().replace(/^>\s*/,"")}):not(${pc})`;b.option("draggable",L),l.set(f,{instance:b,original:A,selector:L})}}function y(){for(let h of o){let{node:f,slot:b,list:k}=h,A=k.items.filter(E=>E.isConnected).map(E=>E.getBoundingClientRect()).filter(E=>E.width>0&&E.height>0);A.length&&(h.width=A.reduce((E,L)=>E+L.width,0)/A.length,h.height=A.reduce((E,L)=>E+L.height,0)/A.length),u(f,"width",h.width?`${Math.round(h.width)}px`:"100%"),u(b,"height",`${Math.max(48,Math.round(h.height||64))}px`),b!==f&&(b.colSpan=Math.max(1,...k.items.map(E=>[...E.children].reduce((L,D)=>L+(D.colSpan||1),0)))),f.hidden!==a&&(f.hidden=a)}m()}function c(h,f){let b=f.tagName,k=["TBODY","THEAD","TFOOT","TABLE"].includes(b),A=e.createElement(k?"tr":["UL","OL","MENU"].includes(b)?"li":"div");for(let O of[Wo,"data-hcms-shell","editor-ui","no-watch","no-save","save-remove","snapshot-remove"])A.setAttribute(O,"");A.setAttribute("draggable","false"),A.setAttribute("contenteditable","false"),A.className="hcms-shell pixel-quiet hcms-inline-ghost";for(let O of["light","dark"])A.classList.toggle(O,!!t?.classList.contains(O));let E=k?e.createElement("td"):A;E!==A&&(E.className="hcms-inline-ghost-cell",A.appendChild(E));let L=e.createElement("button");L.type="button",L.className="hcms-inline-list-button hcms-inline-list-add mirk-button mirk-button--small",L.setAttribute("data-hcms-list-action","add"),L.innerHTML=`<span class="mirk-button__label">${Ue("add")}<span>Add</span></span>`,E.appendChild(L);let D={node:A,slot:E,button:L,list:h,width:0,height:0};L.addEventListener("click",O=>{O.preventDefault(),O.stopPropagation(),r(D.list)});for(let O of["pointerdown","mousedown","touchstart","click"])A.addEventListener(O,W=>W.stopPropagation());return A.addEventListener("dragstart",O=>{O.preventDefault(),O.stopPropagation()}),D}return{setLists(h){let f=new Set(o),b=[],k=new Set(o.map(E=>E.node)),A=new Set;for(let E of h||[]){if(!E.container||!E.container.isConnected)continue;let{parent:L,anchor:D}=gc(E);if(!L)continue;if(!A.has(L)){for(let U of L.querySelectorAll(`:scope > [${Wo}]`))k.has(U)||U.remove();A.add(L)}let O=o.find(U=>f.has(U)&&U.list.container===E.container&&U.list.path.join(".")===E.path.join("."))||c(E,L);f.delete(O),O.list=E,O.button.setAttribute("data-hcms-list",E.path.join(".")),O.button.setAttribute("aria-label",`Add to ${E.path.join(".")||"the list"}`);let W=D||E.items.filter(U=>U.parentElement===L).at(-1);W?W.nextSibling!==O.node&&W.after(O.node):O.node.parentElement!==L&&L.appendChild(O.node),b.push(O)}for(let E of f)E.node.remove();o=b,s?.disconnect(),!s&&typeof i?.ResizeObserver=="function"&&(s=new i.ResizeObserver(()=>{y(),n?.()}));for(let E of o)for(let L of E.list.items)s?.observe(L);y()},update:y,setHidden(h){a=!!h,y()},destroy(){s?.disconnect();for(let h of o)h.node.remove();o=[],m()}}}var Go=[["move-up","Move up"],["move-down","Move down"]],bc={prefer:"corner",inset:0};function yc(e,t){return t.width<=e.width&&t.height<=e.height}function Yo({doc:e,layerEl:t,onActivate:r,onListAction:n}){let i=e.defaultView,o=[],a=new Map,s=0,l=new Map,u=null,m=new Set,y=0,c=!1,h=null,f=null,b=null,k=null,A=new Map,E=!1,L=null,D=Ko({doc:e,themeRoot:t.closest("[data-hcms-shell]"),onResize:W,onAdd:d=>n?.({action:"add",list:d,index:d.items.length})}),O=e.createElement("div");O.className="hcms-inline-highlight",O.hidden=!0,O.setAttribute("aria-hidden","true"),t.appendChild(O);function W(){if(!(y||!i)){if(typeof i.requestAnimationFrame!="function")return ie();y=i.requestAnimationFrame(()=>{y=0,ie()})}}let U=()=>b||k;function ie(){if(!i)return;D.update();let d={width:i.innerWidth,height:i.innerHeight},g=U();for(let p of o){if(!p.visible){p.node.hidden=!0;continue}for(let V of p.members)V.node.hidden=E&&V.kind!=="handle";p.node.hidden=!1;let S=p.el.getBoundingClientRect(),w=p.node.getBoundingClientRect(),R=w.width,B=p.kind==="row"&&!yc(S,w);if(B&&p.el!==g){for(let V of p.members)V.kind==="row"&&(V.node.hidden=!0);w=p.node.getBoundingClientRect()}if(p.members.every(V=>V.node.hidden)){p.node.hidden=!0;continue}let M=p.kind==="handle"?null:bc,{x:z,y:$}=Tn({anchor:S,handle:w,viewport:d,...M}),H=p.members.find(V=>V.kind==="handle");if(B&&H){let V=H.node.getBoundingClientRect(),se=Tn({anchor:S,handle:V,viewport:d}),he=p.members.slice(p.members.indexOf(H)+1).filter(Z=>!Z.node.hidden).reduce((Z,G)=>Z+G.node.getBoundingClientRect().width+2,0);z=Math.max(8+R,Math.min(d.width-8,se.x+V.width+he))-w.width,$=se.y}p.node.style.transform=`translate(${Math.round(z)}px, ${Math.round($)}px)`}if(L)if(!L.node.isConnected||L.node.closest("[hidden]"))ge();else{let p=L.button.getBoundingClientRect(),S=L.menu.getBoundingClientRect();L.menu.style.left=`${Math.max(8,p.right-S.width)-p.left}px`,L.menu.style.right="auto",L.menu.style.top=p.bottom+6+S.height>d.height-8?"auto":"calc(100% + 6px)",L.menu.style.bottom=p.bottom+6+S.height>d.height-8?"calc(100% + 6px)":"auto"}te(),h?.()}function ee(d){if(d?.closest?.("[data-hcms-ghost]"))return null;for(let g=d;g&&g.nodeType===1;g=g.parentElement){let p=A.get(g);if(p)return p}return null}function me(d){L&&!L.node.contains(d.target)&&ge();let g=U();k=ee(d.target),k&&t.contains(d.target)&&(b=null),U()!==g&&W()}function q(d){if(d.relatedTarget||!k)return;let g=U();k=null,U()!==g&&W()}function te(){if(!f||O.hidden)return;let d=f.getBoundingClientRect();O.style.width=`${Math.round(d.width)}px`,O.style.height=`${Math.round(d.height)}px`,O.style.transform=`translate(${Math.round(d.left)}px, ${Math.round(d.top)}px)`}function xe(){if(!i||typeof i.IntersectionObserver!="function"){for(let g of o)g.visible=!0;return}u||(u=new i.IntersectionObserver(g=>{let p=!1;for(let S of g)for(let w of a.get(S.target)||[])w.visible!==S.isIntersecting&&(w.visible=S.isIntersecting,p=!0);p&&W()},{threshold:0}));let d=new Set(a.keys());for(let g of m)d.has(g)||u.unobserve(g);for(let g of d)m.has(g)||u.observe(g);m=d}function Nr(){c||!i||(i.addEventListener("scroll",W,{passive:!0,capture:!0}),i.addEventListener("resize",W,{passive:!0}),e.addEventListener("focusin",me),e.addEventListener("focusout",q),e.addEventListener("pointerdown",v,!0),e.addEventListener("keydown",I,!0),c=!0)}function Lr(){!c||!i||(i.removeEventListener("scroll",W,{capture:!0}),i.removeEventListener("resize",W),e.removeEventListener("focusin",me),e.removeEventListener("focusout",q),e.removeEventListener("pointerdown",v,!0),e.removeEventListener("keydown",I,!0),c=!1)}function Bt(d){return`${d.kind}\0${d.attr||""}`}function mt(d,g){return d.container===g.container&&d.scalar===g.scalar}function zt(d,g){return d.kind!==g.kind?!1:d.kind==="handle"?Bt(d.target)===Bt(g.target):d.kind==="row"?d.row===g.row&&mt(d.list,g.list):mt(d.list,g.list)}function ft(d,g){d.target=g;let p=g.path.join(".");d.node.setAttribute("data-hcms-target",p),g.icon?d.node.setAttribute("data-hcms-icon",g.icon):d.node.removeAttribute("data-hcms-icon"),d.node.setAttribute("aria-label",`Edit ${p}`)}function Fe(d){let g=e.createElement("button");g.type="button",g.className="hcms-inline-handle mirk-button mirk-button--small",g.innerHTML=`<span class="mirk-button__label">${Ue("edit")}</span>`;let p={node:g,kind:"handle",target:d};return ft(p,d),g.addEventListener("click",S=>{S.preventDefault(),S.stopPropagation(),r?.(p.target,g)}),p}function pt(d,g){let p=e.createElement("button");return p.type="button",p.className="hcms-inline-list-button mirk-button mirk-button--small",p.setAttribute("data-hcms-list-action",d),p.setAttribute("aria-label",g),p.innerHTML=`<span class="mirk-button__label">${Ue(d)}${d==="add"?"<span>Add</span>":""}</span>`,p}function we(d,{list:g,row:p,rowIndex:S,count:w}){let R=g.path.join(".");d.list=g,d.row=p,d.index=S,d.count=w,d.node.setAttribute("data-hcms-list",R),d.node.setAttribute("data-hcms-row",String(S));for(let B of d.node.querySelectorAll("[data-hcms-list-action]")){let M=B.getAttribute("data-hcms-list-action"),z=Go.find(([$])=>$===M)?.[1]||M;B.setAttribute("aria-label",`${z} ${R}.${S}`),B.disabled=M==="move-up"&&S===0||M==="move-down"&&S===w-1}}function Ir(d,g,p,S){let w=e.createElement("div");w.className="hcms-inline-row-controls";let R={node:w,kind:"row",list:d,row:g,index:p,count:S};for(let[B,M]of Go){let z=pt(B,M);z.addEventListener("click",$=>{$.preventDefault(),$.stopPropagation(),!z.disabled&&n?.({action:B,list:R.list,index:R.index,row:R.row})}),w.appendChild(z)}return we(R,{list:d,row:g,rowIndex:p,count:S}),R}function ge(d=!1){if(!L)return;let g=L;L=null,g.menu.hidden=!0,g.button.setAttribute("aria-expanded","false"),g.node.parentElement?.classList.remove("has-open-settings"),d&&g.button.isConnected&&g.button.focus({preventScroll:!0})}function v(d){L&&!L.node.contains(d.target)&&ge()}function I(d){L&&(d.key==="Escape"?(d.preventDefault(),d.stopPropagation(),ge(!0)):d.key==="Tab"?ge(!0):["ArrowDown","ArrowUp","Home","End"].includes(d.key)&&L.menu.contains(d.target)&&(d.preventDefault(),L.menu.querySelector('[role="menuitem"]').focus({preventScroll:!0})))}function N(d,{list:g,row:p,rowIndex:S}){Object.assign(d,{list:g,row:p,index:S}),d.node.setAttribute("data-hcms-list",g.path.join(".")),d.node.setAttribute("data-hcms-row",String(S)),d.button.setAttribute("aria-label",`Settings ${g.path.join(".")}.${S}`)}function F(d){let g=e.createElement("div");g.className="hcms-inline-settings";let p=pt("settings","Settings");p.setAttribute("aria-haspopup","menu"),p.setAttribute("aria-expanded","false");let S=e.createElement("div");S.className="hcms-inline-settings-menu",S.setAttribute("role","menu"),S.setAttribute("aria-label","Item settings"),S.hidden=!0;let w=e.createElement("button");w.type="button",w.setAttribute("role","menuitem"),w.setAttribute("data-hcms-list-action","remove"),w.textContent="Delete",S.appendChild(w),g.append(p,S);let R={node:g,button:p,menu:S,kind:"settings"};N(R,d);let B=()=>{ge(),L=R,S.hidden=!1,p.setAttribute("aria-expanded","true"),g.parentElement.classList.add("has-open-settings"),w.focus({preventScroll:!0}),W()};return p.addEventListener("click",M=>{M.preventDefault(),M.stopPropagation(),L===R?ge(!0):B()}),p.addEventListener("keydown",M=>{(M.key==="ArrowDown"||M.key==="ArrowUp")&&(M.preventDefault(),B())}),w.addEventListener("click",M=>{M.preventDefault(),M.stopPropagation(),ge(!0),n?.({action:"remove",list:R.list,index:R.index,row:R.row})}),R}function j(d,g){d.kind==="handle"?ft(d,g.target):d.kind==="row"?we(d,g):d.kind==="settings"&&N(d,g)}function P(d,g,p,S,w){let R=g.get(p)?.find(B=>B.category===w);if(!R){R={el:p,category:w,members:[]},d.push(R);let B=g.get(p);B?B.push(R):g.set(p,[R])}R.members.push(S)}function _(d,g,p){let S=p.items||[];S.forEach((w,R)=>{jt(w)&&(P(d,g,w,{kind:"row",list:p,row:w,rowIndex:R,count:S.length},"item"),P(d,g,w,{kind:"settings",list:p,row:w,rowIndex:R},"item"))})}function T(d,g){let p=new Set(d.members),S=[];for(let w of g){let R=d.members.find(B=>p.has(B)&&zt(B,w))||(w.kind==="handle"?Fe(w.target):w.kind==="row"?Ir(w.list,w.row,w.rowIndex,w.count):F(w));p.delete(R),j(R,w),E&&R.kind!=="handle"&&(R.node.hidden=!0),S.push(R)}for(let w of p)w===L&&ge(),w.node.remove();S.sort((w,R)=>["row","handle","settings"].indexOf(w.kind)-["row","handle","settings"].indexOf(R.kind)),S.forEach((w,R)=>{d.node.children[R]!==w.node&&d.node.insertBefore(w.node,d.node.children[R]||null)}),d.members=S}function C(d,g){let p=[],S=new Map,w=new Map,R=0;for(let $ of d||[])w.has($.el)||w.set($.el,$),!($.kind!=="handle"||!jt($.el))&&(P(p,S,$.el,{kind:"handle",target:$},"item"),R++);for(let $ of g||[])_(p,S,$);let B=new Set(o),M=new Map;for(let $ of o)M.has($.el)||M.set($.el,$.visible);let z=[];for(let $ of p){let H=o.find(V=>B.has(V)&&V.el===$.el&&V.category===$.category);if(!H){let V=e.createElement("div");V.className="hcms-inline-item-controls",V.setAttribute("role","group"),H={el:$.el,node:V,category:$.category,kind:$.category==="add"?"add":"handle",members:[],visible:M.get($.el)??!1},t.appendChild(V)}B.delete(H),H.el=$.el,H.category=$.category,T(H,$.members),H.kind=H.members.some(V=>V.kind==="row")?"row":H.members.some(V=>V.kind==="handle")?"handle":"add",H.node.setAttribute("aria-label",H.category==="add"?"List controls":"Item controls"),z.push(H)}for(let $ of B)$.node.remove();o=z,a=new Map,A=new Map;for(let $ of o){let H=a.get($.el);H?H.push($):a.set($.el,[$]);for(let V of $.members)V.kind!=="row"&&V.kind!=="settings"||(A.set(V.row,V.row),A.set(V.node,V.row),A.set($.node,V.row))}b&&!A.has(b)&&(b=null),k&&!A.has(k)&&(k=null),l=w,s=R}function x(){ge(),u?.disconnect(),u=null,m=new Set;for(let d of o)d.node.remove();o=[],a=new Map,l=new Map,A=new Map,s=0}return{setTargets(d,g){C(d,g),D.setLists(g),xe(),Nr(),W()},refresh:W,get count(){return s},get controlsHidden(){return E},setControlsHidden(d){if(E=!!d,D.setHidden(E),E){ge();for(let g of o){for(let p of g.members)p.kind!=="handle"&&(p.node.hidden=!0);g.members.every(p=>p.node.hidden)&&(g.node.hidden=!0)}}W()},elementToTarget(d){if(d?.closest?.("[data-hcms-ghost]"))return null;for(let g=d;g&&g.nodeType===1;g=g.parentElement){let p=l.get(g);if(p)return p}return null},setHoveredRow(d){let g=U();b=d?ee(d):null,U()!==g&&W()},showHighlight(d){d&&(f=d,O.hidden=!1,te())},hideHighlight(){f=null,O.hidden=!0},setFollower(d){h=typeof d=="function"?d:null},destroy(){D.destroy(),y&&i&&i.cancelAnimationFrame(y),y=0,h=null,f=null,b=null,k=null,O.remove(),Lr(),x()}}}var kc="hypercms-inline",$t="is-hcms-inline-active",Cn="is-hcms-inline-onpath",Jo='input:not([disabled]):not([type="hidden"]), textarea:not([disabled]), select:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex="-1"])',vc=["bold","italic","link","undo","redo"],xc=/^H[1-6]$/,wc=0;function Qo({doc:e,pageRoot:t,opts:r={}}){let n=r.richText!==!1,i=null,o=null,a=null,s=new Map,l=null,u=null,m=null;function y(c,h,f,b,k){let A=ot(e.defaultView);if(typeof A!="function")return null;let E=k||{},L=E.originalHTML??_n(h,{capability:"history"}).html(),D=E.richClayIsOurs??!h.hasAttribute("data-richclay"),O=E.adopted??h.getAttribute("data-richclay-active")==="true",W=Dt(h,b,"history"),U=Ac(c,A,h,b,D);if(!U)return null;uo(h,b==="innerHTML",D);let ie=String(++wc);h.setAttribute(Re,ie),Er();let ee={el:h,editor:U,path:f,prop:b,boundId:ie,originalHTML:L,oldValue:W,richClayIsOurs:D,adopted:O,dirty:!1,written:!1,restorable(){return!this.adopted&&!this.dirty&&!this.written},lastEdited:void 0};s.set(h,ee),ao(ie,ee);let me=U.squire;if(me&&typeof me.addEventListener=="function"){let te=()=>{ee.dirty=!0,ee.lastEdited=Dt(h,ee.prop,"history"),Sc(c,ee)};me.addEventListener("input",te),ee.detachInput=()=>me.removeEventListener?.("input",te)}let q=()=>es(ee);return h.addEventListener("blur",q),ee.detachBlur=()=>h.removeEventListener("blur",q),ee}return{name:"inline",richText:n,ctx:null,root:null,formRoot:null,errorEl:null,noticeEl:null,handoffEl:null,handoffCountEl:null,popEl:null,enhanceFormRichText:!1,prepareRules(c){return n?po(c,t):c},bindText(c,h,f,b){return y(this.ctx,c,h,f,b)},mount(c){let h=this.ctx;i=Oc(e,r.theme),this.root=i.root,this.formRoot=i.formRoot,this.errorEl=i.errorEl,this.noticeEl=i.noticeEl,this.handoffEl=i.handoffEl,this.handoffCountEl=i.handoffCountEl,this.popEl=i.popEl,_e(()=>It(e));let f=tt({pageRules:h.pageRules,formRules:h.formRules,data:c,doc:e});i.formRoot.appendChild(f),h.seeder.seed(i.formRoot),Me(i.formRoot,e,this.enhanceFormRichText),ht(h),hr(h),o=Yo({doc:e,layerEl:i.layerEl,onActivate:(b,k)=>this.activate(b,k),onListAction:b=>this.listAction(b)}),o.setFollower(()=>this.placePopover()),i.closeEl.addEventListener("click",()=>this.deactivate()),i.toggleEl.addEventListener("click",b=>{b.preventDefault(),b.stopPropagation(),this.toggleControls()}),i.handoffEl.querySelector("[data-hcms-open-view]").addEventListener("click",b=>{b.preventDefault(),b.stopPropagation(),h.onViewRequested?.("sidebar")}),this.bindPage(),this.syncTargets()},listAction({action:c,list:h,index:f,row:b}){let k=this.ctx,A=h.path.join("."),E=k.formRoot.querySelector(`[data-hcms-path="${ct(A)}"]`);if(!E)return;if(c==="add"){Nt(A,k);return}let L=b?Mc(k,A,b):f;if(L===-1)return;let D=Rc(E,L);if(D){if(c==="remove"){fn(D,k),this.syncTargets();return}mn(D,c==="move-up"?-1:1,k),this.syncTargets()}},toggleControls(){if(!o||!i)return;let c=!o.controlsHidden;o.setControlsHidden(c),i.toggleEl.setAttribute("aria-pressed",String(c));let h=i.toggleEl.querySelector(".mirk-button__label");h&&(h.textContent=c?"Show controls":"Hide controls")},bindPage(){let c=this.ctx.pageRoot,h=i.root,f=D=>{let O=o&&o.elementToTarget(D.target);O?o.showHighlight(O.el):o?.hideHighlight(),o?.setHoveredRow(D.target)},b=()=>{o?.hideHighlight(),o?.setHoveredRow(null)},k=D=>{if(h.contains(D.target))return;let O=o&&o.elementToTarget(D.target);!O||O.kind!=="text"||s.has(O.el)||y(this.ctx,O.el,O.path.join("."),Tr(O))},A=D=>{if(h.contains(D.target))return;let O=o&&o.elementToTarget(D.target);if(!O){this.deactivate();return}(typeof D.target.closest=="function"&&D.target.closest("a[href]")||O.kind!=="text")&&D.preventDefault(),this.activate(O)},E=D=>{D.key==="Escape"&&this.deactivate()},L=D=>{let O=D.detail;if(!(!O||O.pageRoot!==this.ctx.pageRoot||!O.path))for(let W of s.values())W.path===O.path&&(W.written=!0)};c.addEventListener("pointerover",f),c.addEventListener("pointerleave",b),c.addEventListener("pointerdown",k),c.addEventListener("click",A),h.addEventListener("keydown",E),e.addEventListener("hcms:change",L),a=()=>{c.removeEventListener("pointerover",f),c.removeEventListener("pointerleave",b),c.removeEventListener("pointerdown",k),c.removeEventListener("click",A),h.removeEventListener("keydown",E),e.removeEventListener("hcms:change",L)}},activate(c,h){if(!c||!i||c.kind==="text"&&this.activateText(c))return;let f=Xo(this,i,c.path.join("."));if(!f){this.deactivate();return}l=c,u=h||null,m=null,i.popEl.hidden=!1,i.formRoot.querySelectorAll(`.${$t}`).forEach(Zo),this.placePopover(),Cc(f)},activateText(c){let h=c.el,f=s.get(h);if(f)return _r(f),!0;let b=y(this.ctx,h,c.path.join("."),Tr(c));return b?(_r(b),!0):!1},placePopover(){if(!i||!l||i.popEl.hidden)return;let c=e.defaultView;if(!c)return;let h={width:c.innerWidth,height:c.innerHeight},f=l.el.getBoundingClientRect(),b=i.popEl.getBoundingClientRect(),{mode:k,x:A,y:E}=Bo({anchor:f,bar:b,viewport:h,current:m});m=k,i.popEl.style.transform=`translate(${Math.round(A)}px, ${Math.round(E)}px)`},deactivate(){if(!i||!l&&i.popEl.hidden)return;i.popEl.hidden=!0,rs(i.root);let c=u;if(l=null,u=null,m=null,c&&e.contains(c)&&typeof c.focus=="function")try{c.focus({preventScroll:!0})}catch{c.focus()}},syncTargets(){if(!o)return;let c=this.ctx,{targets:h,lists:f}=Sn(c.pageRoot,c.pageRules);o.setTargets(h,f);let b=Ec(this,s,h,e);if(l){let A=b.get(l.el)||[],E=A.find(L=>_c(L,l))||A.find(L=>L.path.join(".")===l.path.join("."))||(A.length===1?A[0]:null);E?l=E:this.deactivate()}Tc(this.ctx,s,e);let k=h.reduce((A,E)=>A+(jt(E.el)?0:1),0);this.handoffEl&&(this.handoffCountEl.textContent=k===0?"":`${k} ${k===1?"field isn't":"fields aren't"} visible right now.`,this.handoffEl.hidden=k===0)},refresh(c,h){c==="livesync"?(Ie(e),It(e),je(this.ctx,{ignoreActiveValue:!0})):c==="undo"?je(this.ctx,{ignoreActiveValue:!1}):je(this.ctx),this.syncTargets(),(c==="livesync"||c==="undo")&&this.rebindText(c),this.restoreActive()},rebindText(c){let h=c!=="undo";for(let[f,b]of[...s]){if(!e.contains(f)){qt(this.ctx,b,{restore:!1,record:h}),s.delete(f);continue}if(f.hasAttribute(ve)){let E=Dt(f,b.prop);E!==b.lastEdited&&(b.oldValue=E,b.lastEdited=void 0);continue}let k=e.activeElement===f;qt(this.ctx,b,{restore:!1,record:h}),s.delete(f);let A=y(this.ctx,f,b.path,b.prop,{richClayIsOurs:b.richClayIsOurs,adopted:b.adopted});A&&k&&_r(A)}},restoreActive(){if(!i||!l||i.popEl.hidden)return;if(!e.contains(l.el)){this.deactivate();return}if(!Xo(this,i,l.path.join("."))){this.deactivate();return}i.formRoot.querySelectorAll(`.${$t}`).forEach(Zo),this.placePopover()},focusOnOpen(){if(this.root&&typeof this.root.focus=="function")try{this.root.focus({preventScroll:!0})}catch{this.root.focus()}},destroy(){u=null,this.deactivate();for(let c of s.values())qt(this.ctx,c);s.clear(),a?.(),a=null,o?.destroy(),o=null,i?.destroy(),i=null,kn(e),this.popEl=null,this.handoffEl=null,this.handoffCountEl=null}}}function Ac(e,t,r,n,i){return _e(()=>{let o=null;try{o=new t(r,{inline:!0,hyperclay:!1,toolbar:n==="innerHTML"?vc:!1,...xc.test(r.tagName)?{singleLine:!0}:null})}catch(a){return console.warn("[hypercms] richclay activation failed; the field falls back to the popover",a),null}if(o.unsupported||!o.active){if(i)try{o.destroy()}catch{}return null}return typeof o.reattach=="function"&&o.reattach(),o})}function Sc(e,{path:t,el:r,prop:n}){let i=mr(e.formRoot,t);i&&(fr(i,Dt(r,n),e.formRoot,t),be(pe(e),{path:t,structural:!1},e))}function Dt(e,t,r="data"){let n=_n(e,{capability:r});return t==="innerHTML"?n.html():n.text().trim()}function es(e){let{el:t,prop:r,oldValue:n,lastEdited:i}=e,o=i;if(o===void 0||o===n)return;e.oldValue=o;let a=ue("undo");if(!a||typeof a.recordValue!="function")return;let s={prop:r,oldValue:n,newValue:o,read:l=>Dt(l,r,"history"),write:(l,u)=>ts(l,r,u)};a.isPaused?queueMicrotask(()=>{t.isConnected&&a.recordValue(t,s)}):a.recordValue(t,s)}function ts(e,t,r){let n=e.cloneNode(!1);t==="innerHTML"?n.innerHTML=r:n.textContent=r,kt(e,Array.from(n.childNodes),{morphStyle:"innerHTML",policy:"history",restoreFocus:!1,scripts:{handle:!1,merge:!1}})}function qt(e,t,{restore:r=!0,record:n=!0}={}){n&&es(t),t.detachInput?.(),t.detachBlur?.(),_e(()=>{if(!t.adopted){try{t.editor.destroy()}catch(i){console.warn("[hypercms] richclay teardown failed; editor state may reach the save",i)}t.richClayIsOurs&&t.el.removeAttribute("data-richclay")}t.el.removeAttribute(ve),t.el.removeAttribute(ze),t.el.removeAttribute(Re),lo(t.boundId),r&&t.restorable()&&ts(t.el,"innerHTML",t.originalHTML)})}function _r(e){let{editor:t,el:r}=e;if(r.ownerDocument.activeElement!==r)try{typeof t.focus=="function"?t.focus():r.focus()}catch{}}function Ec(e,t,r,n){let i=new Map;for(let o of r){let a=i.get(o.el);a?a.push(o):i.set(o.el,[o])}for(let[o,a]of[...t]){let s=i.get(o)||[],l=s.find(c=>Tr(c)===a.prop)||s[0];if(!l){qt(e.ctx,a,{restore:!0}),t.delete(o);continue}a.path=l.path.join(".");let u=Tr(l);if(u===a.prop)continue;let m=n.activeElement===o;qt(e.ctx,a,{restore:!1}),t.delete(o);let y=e.bindText(o,a.path,u,{richClayIsOurs:a.richClayIsOurs,adopted:a.adopted,originalHTML:a.originalHTML});y&&m&&_r(y)}return i}function _c(e,t){return e.el===t.el&&e.kind===t.kind&&e.attr===t.attr}function Tr(e){return e.attr==="innerHTML"?"innerHTML":"textContent"}function Tc(e,t,r){for(let n of e.pageRoot.querySelectorAll(`[${ve}]`))t.has(n)||_e(()=>mo(n,r.defaultView))}function Xo(e,t,r){let n=e.formRoot&&e.formRoot.querySelector(`[data-hcms-path="${ct(r)}"]`);if(rs(t.root),!n)return null;let i=n.closest("[data-hcms-card]"),o=i?[...i.querySelectorAll('[data-hcms-shape="scalar"][data-hcms-path]')].filter(a=>a.closest("[data-hcms-card]")===i&&a.closest('[data-hcms-shape="object-array"], [data-hcms-shape="scalar-array"]')===i.parentElement.closest('[data-hcms-shape="object-array"]')):[n];o.includes(n)||o.push(n);for(let a of o){a.classList.add($t),a.removeAttribute("draggable");for(let s=a.parentElement;s&&(s.classList.add(Cn),s.removeAttribute("draggable"),s!==e.formRoot);s=s.parentElement);}return n}function rs(e){if(e)for(let t of e.querySelectorAll(`.${$t}, .${Cn}`))t.classList.remove($t,Cn)}function Zo(e){e.tagName==="TEXTAREA"&&st(e),e.querySelectorAll?.("textarea").forEach(st)}function Cc(e){let t=e.matches?.(Jo)?e:e.querySelector?.(Jo);if(!(!t||typeof t.focus!="function"))try{t.focus({preventScroll:!0})}catch{t.focus()}}function Oc(e,t){Ie(e);let r=e.createElement(kc),n=t==="dark"?" dark":t==="light"?" light":"";return r.className="hcms-shell pixel-quiet hcms-inline"+n,r.setAttribute("data-hcms-shell",""),r.setAttribute("editor-ui",""),r.setAttribute("no-save",""),r.setAttribute("save-remove",""),r.setAttribute("snapshot-remove",""),r.setAttribute("no-watch",""),r.setAttribute("tabindex","-1"),r.innerHTML=`
|
|
180
|
+
<div class="hcms-inline-bar">
|
|
181
|
+
<div class="hcms-inline-handoff" hidden>
|
|
182
|
+
<span class="hcms-inline-handoff-count"></span>
|
|
183
|
+
<button type="button" class="hcms-inline-handoff-open mirk-button mirk-button--small" data-hcms-open-view="sidebar">
|
|
184
|
+
<span class="mirk-button__label">Edit in the sidebar</span>
|
|
185
|
+
</button>
|
|
186
|
+
</div>
|
|
187
|
+
<button type="button" class="hcms-inline-toggle mirk-button mirk-button--small" data-hcms-controls-toggle aria-pressed="false" hidden>
|
|
188
|
+
<span class="mirk-button__label">Hide controls</span>
|
|
189
|
+
</button>
|
|
190
|
+
<div class="hcms-inline-notice" role="status" hidden></div>
|
|
191
|
+
<div class="hcms-inline-error" role="alert" hidden></div>
|
|
192
|
+
</div>
|
|
193
|
+
<div class="hcms-inline-layer"></div>
|
|
194
|
+
<div class="hcms-inline-pop" role="dialog" aria-label="Edit content" hidden>
|
|
195
|
+
<div class="hcms-inline-pop-header">
|
|
196
|
+
<span>Edit content</span>
|
|
197
|
+
<button type="button" class="hcms-inline-pop-close mirk-button mirk-button--small" aria-label="Close field editor">
|
|
198
|
+
<span class="mirk-button__label">${Ue("remove")}</span>
|
|
199
|
+
</button>
|
|
200
|
+
</div>
|
|
201
|
+
<div data-hcms-form-root class="hcms-form"></div>
|
|
202
|
+
</div>
|
|
203
|
+
`,e.body.appendChild(r),{root:r,formRoot:r.querySelector("[data-hcms-form-root]"),noticeEl:r.querySelector(".hcms-inline-notice"),errorEl:r.querySelector(".hcms-inline-error"),handoffEl:r.querySelector(".hcms-inline-handoff"),handoffCountEl:r.querySelector(".hcms-inline-handoff-count"),layerEl:r.querySelector(".hcms-inline-layer"),popEl:r.querySelector(".hcms-inline-pop"),closeEl:r.querySelector(".hcms-inline-pop-close"),toggleEl:r.querySelector("[data-hcms-controls-toggle]"),destroy(){r.remove()}}}function Rc(e,t){let r=e.querySelector(".hcms-array-items");return r&&r.querySelectorAll(":scope > [data-hcms-card], :scope > [data-hcms-array-item]")[t]||null}function Mc(e,t,r){let{lists:n}=Sn(e.pageRoot,e.pageRules),i=n.find(o=>o.path.join(".")===t);return i?i.items.indexOf(r):-1}var Nc="[hypercms]";function ns(e,t){if(!e||!e.querySelectorAll||!t)return;let r=Lc(t);e.querySelectorAll("template[data-hcms-tpl]").forEach(i=>{let o=i.getAttribute("data-hcms-tpl");o&&(o.startsWith("@")||r.has(o)||console.warn(`${Nc} template "${o}" doesn't match any rule path; ignored`))})}function Lc(e){let t=new Set;return r([],e),t;function r(n,i){let o=n.join("."),a=n.map(l=>typeof l=="number"?"*":l).join(".");o&&t.add(o),a&&t.add(a);let s=Be(i);if(s==="object")for(let[l,u]of Object.entries(i))r([...n,l],u);else if(s==="object-array"||s==="scalar-array"){let l=[...n,"*"],u=l.map(m=>typeof m=="number"?"*":m).join(".");if(t.add(u),s==="object-array"){let m=i[1];if(m&&typeof m=="object"&&!Array.isArray(m))for(let[y,c]of Object.entries(m))r([...l,y],c)}}}}var os={skip:"[data-hcms-shell]",templateAttr:"cms-template"},J={isOpen:!1,ctx:null,opts:null};function ss({view:e,doc:t,pageRoot:r,opts:n={},onCloseRequested:i,onViewRequested:o}){let a=n.rules!==void 0?n.rules:"cms",s=fe.findRules(t,a);if(!s){let k=typeof a=="string"?`data-rules-name~="${a}"`:"the provided rules object";throw new Error(`hypercms: no rules found for ${k}`)}let l=e.prepareRules(s.rules),u=s.tagNode;Qt(t),ir(t,l),ns(t,l);let m=sr(l,t),y=vr(l),c=kr(r,l),h=Jt(),f=Le(fe.extract(r,l,{...os,...h.hooks}),l),b={doc:t,pageRoot:r,pageRules:l,writeRules:y,formRules:m,rulesTagNode:u,rulesSource:a,richText:e.richText,view:e,seeder:h,initialData:f,get formRoot(){return e.formRoot},get shellRoot(){return e.root},get errorEl(){return e.errorEl},get noticeEl(){return e.noticeEl},unresolved:c,lastTwinSignature:null,lastFingerprint:null,lastData:null,observerHandle:null,undoUnsub:null,livesyncUnsub:null,onChange:n.onChange,onError:n.onError,confirmRemove:n.confirmRemove,previouslyFocused:t.activeElement,dispatch(k,A){let E=t.defaultView&&t.defaultView.CustomEvent||(typeof CustomEvent<"u"?CustomEvent:null);if(!E)return;let L={...A||{},pageRoot:r,view:e.name},D=new E(k,{bubbles:!0,cancelable:k==="hcms:change",detail:L});(e.root&&e.root.isConnected!==!1?e.root:r).dispatchEvent(D)},onCloseRequested:i,onViewRequested:o};return b.updateFingerprint=()=>{b.lastFingerprint=Lt(pe(b))},e.ctx=b,b}function as(e){e.updateFingerprint(),e.observerHandle=Ro({onRefresh:n=>e.view.refresh("observer",n)});let t=ue("undo");if(t&&typeof t.on=="function"){let n=()=>{if(J.ctx!==e)return;is(e,"undo");let i=Le(fe.extract(e.pageRoot,e.pageRules,os),e.pageRules);Lt(i)!==Lt(e.lastData)&&(e.lastData=i,e.onChange?.(i,{path:"",structural:!1}))};t.on("undo",n),t.on("redo",n),e.undoUnsub=()=>{t.off("undo",n),t.off("redo",n)}}let r=()=>is(e,"livesync");e.livesyncUnsub=it(e.doc,oo,r),Rn.ctx=e,jc(e.doc)}function is(e,t){J.ctx===e&&e.view.refresh(t)}function Cr(e,{dispatch:t=!0,restoreFocus:r=!0,updateUrl:n=!0,reason:i="close"}={}){if(!e||e.closed)return;e.closed=!0;for(let a of e.uploads||[])try{a.abort()}catch{}e.uploads?.clear();let o=e.previouslyFocused;if(t&&e.dispatch("hcms:close",{reason:i}),n&&Fc(),e.observerHandle?.unsubscribe?.(),e.undoUnsub?.(),e.livesyncUnsub?.(),e.detachEvents?.(),_e(()=>e.view.destroy()),Ic(),r&&typeof o?.focus=="function")try{o.focus()}catch{}}function Ic(){J.isOpen=!1,J.ctx=null,J.opts=null,Rn.ctx=null}var Rn={ctx:null};function jc(e){let t=e.defaultView||(typeof globalThis<"u"?globalThis:null);if(!t)return;let r=function(){let i=Rn.ctx;if(i)return pr(i.formRoot),He("Reorder",()=>be(pe(i),{path:"",structural:!0},i))};typeof t.hypercmsCommit!="function"&&(t.hypercmsCommit=r),typeof globalThis<"u"&&typeof globalThis.hypercmsCommit!="function"&&(globalThis.hypercmsCommit=r)}var On="cms";function ls(e){let t=typeof e=="string"?e:"",r=t.indexOf("?"),n=r===-1?t:t.slice(r+1);if(!n)return t;let i=new URLSearchParams(n);return i.get(On)!=="true"?t:(i.set(On,"false"),"?"+i.toString())}function cs(e){let t=typeof e=="string"?e:"",r=t.indexOf("?"),n=r===-1?t:t.slice(r+1);return n?new URLSearchParams(n).get(On)==="true":!1}function Fc(){if(typeof window>"u"||!window.location||!window.history||typeof window.history.replaceState!="function")return;let e=window.location.search,t=ls(e);t!==e&&window.history.replaceState(window.history.state,"",t+window.location.hash)}var us="hcms-toggle",ne="data-hcms-toggle-host",ds="hcms-toggle-style",hs="data-hcms-toggle-style",Or="data-hcms-session",ks="data-hcms-split",vs="hcms.view",Rr=["sidebar","inline"],Dc={sidebar:"In the sidebar",inline:"On the page"},Ln="var(--hcms-toggle-bg, var(--hcms-toggle-_surface))";function ms(e){try{let t=e&&e.localStorage?e.localStorage.getItem(vs):null;return Rr.includes(t)?t:null}catch{return null}}function qc(e,t){if(Rr.includes(t))try{e?.localStorage?.setItem(vs,t)}catch{}}var $c="#fafafa",Pc="#0a0a0a",Bc=`
|
|
204
|
+
[${ne}] {
|
|
205
|
+
all: unset;
|
|
206
|
+
box-sizing: border-box;
|
|
207
|
+
display: var(--hcms-toggle-display, inline-flex);
|
|
208
|
+
font-family: 'Departure Mono', ui-monospace, Menlo, monospace;
|
|
209
|
+
--hcms-toggle-_surface: ${$c};
|
|
210
|
+
}
|
|
211
|
+
[${ne}][data-hcms-surface="dark"] {
|
|
212
|
+
--hcms-toggle-_surface: ${Pc};
|
|
213
|
+
}
|
|
214
|
+
[${ne}] .hcms-toggle__main,
|
|
215
|
+
[${ne}] .hcms-toggle__arrow {
|
|
216
|
+
all: unset;
|
|
217
|
+
box-sizing: border-box;
|
|
218
|
+
display: inline-flex;
|
|
219
|
+
align-items: center;
|
|
220
|
+
gap: 7px;
|
|
221
|
+
padding: 0 14px;
|
|
222
|
+
min-height: 40px;
|
|
223
|
+
font-family: inherit;
|
|
224
|
+
font-weight: 400;
|
|
225
|
+
line-height: 1.5;
|
|
226
|
+
font-size: 14px;
|
|
227
|
+
color: var(--hcms-toggle-color, currentColor);
|
|
228
|
+
border: 2px solid;
|
|
229
|
+
border-color: var(--mirk-bevel-tl, #F0E7D8) var(--mirk-bevel-br, #E2D4BF) var(--mirk-bevel-br, #E2D4BF) var(--mirk-bevel-tl, #F0E7D8);
|
|
230
|
+
border-radius: 0;
|
|
231
|
+
cursor: pointer;
|
|
232
|
+
box-shadow: none;
|
|
233
|
+
}
|
|
234
|
+
[${ne}] .hcms-toggle__main:hover,
|
|
235
|
+
[${ne}] .hcms-toggle__arrow:hover {
|
|
236
|
+
border-color: var(--mirk-focus-color, #C7AE93);
|
|
237
|
+
box-shadow: none;
|
|
238
|
+
}
|
|
239
|
+
[${ne}] .hcms-toggle__main:active,
|
|
240
|
+
[${ne}] .hcms-toggle__arrow:active {
|
|
241
|
+
border-color: var(--mirk-bevel-br, #E2D4BF) var(--mirk-bevel-tl, #F0E7D8) var(--mirk-bevel-tl, #F0E7D8) var(--mirk-bevel-br, #E2D4BF);
|
|
242
|
+
}
|
|
243
|
+
[${ne}] .hcms-toggle__main:focus-visible,
|
|
244
|
+
[${ne}] .hcms-toggle__arrow:focus-visible {
|
|
245
|
+
outline: 2px solid currentColor;
|
|
246
|
+
outline-offset: -5px;
|
|
247
|
+
}
|
|
248
|
+
[${ne}] .hcms-toggle__close { display: none; }
|
|
249
|
+
[${ne}][${Or}="open"] .hcms-toggle__open { display: none; }
|
|
250
|
+
[${ne}][${Or}="open"] .hcms-toggle__close { display: inline; }
|
|
251
|
+
[${ne}][${ks}] .hcms-toggle__main {
|
|
252
|
+
border-radius: 0;
|
|
253
|
+
padding-right: 12px;
|
|
254
|
+
}
|
|
255
|
+
[${ne}] .hcms-toggle__arrow {
|
|
256
|
+
gap: 0;
|
|
257
|
+
padding: 0 10px;
|
|
258
|
+
border-radius: 0;
|
|
259
|
+
border-left-width: 0;
|
|
260
|
+
}
|
|
261
|
+
[${ne}] .hcms-toggle__menu {
|
|
262
|
+
all: unset;
|
|
263
|
+
box-sizing: border-box;
|
|
264
|
+
min-width: 180px;
|
|
265
|
+
padding: 4px;
|
|
266
|
+
font-family: inherit;
|
|
267
|
+
font-size: 14px;
|
|
268
|
+
line-height: 1.5;
|
|
269
|
+
color: var(--hcms-toggle-color, currentColor);
|
|
270
|
+
background: ${Ln};
|
|
271
|
+
border: 1px solid var(--mirk-input-border, #D8C8AF);
|
|
272
|
+
border-radius: var(--mirk-radius, 5px);
|
|
273
|
+
box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .45);
|
|
274
|
+
}
|
|
275
|
+
[${ne}] .hcms-toggle__item {
|
|
276
|
+
all: unset;
|
|
277
|
+
box-sizing: border-box;
|
|
278
|
+
display: block;
|
|
279
|
+
width: 100%;
|
|
280
|
+
padding: 9px 10px;
|
|
281
|
+
border-radius: 0;
|
|
282
|
+
cursor: pointer;
|
|
283
|
+
}
|
|
284
|
+
[${ne}] .hcms-toggle__item::before {
|
|
285
|
+
content: "\u25CB";
|
|
286
|
+
margin-right: 8px;
|
|
287
|
+
opacity: .55;
|
|
288
|
+
}
|
|
289
|
+
[${ne}] .hcms-toggle__item[aria-checked="true"]::before {
|
|
290
|
+
content: "\u25CF";
|
|
291
|
+
opacity: 1;
|
|
292
|
+
}
|
|
293
|
+
[${ne}] .hcms-toggle__item:hover {
|
|
294
|
+
background: color-mix(in srgb, currentColor 12%, transparent);
|
|
295
|
+
}
|
|
296
|
+
[${ne}] .hcms-toggle__item:focus-visible {
|
|
297
|
+
outline: 2px solid currentColor;
|
|
298
|
+
outline-offset: -3px;
|
|
299
|
+
}
|
|
300
|
+
@media (pointer: coarse) {
|
|
301
|
+
[${ne}] .hcms-toggle__main,
|
|
302
|
+
[${ne}] .hcms-toggle__arrow { min-height: 44px; }
|
|
303
|
+
}
|
|
304
|
+
`;function zc({search:e="",cookie:t="",forced:r=null}={}){let n=typeof e=="string"?e:"",i=n.indexOf("?"),o=i===-1?n:n.slice(i+1),a=new URLSearchParams(o).get("editmode");return a?a==="true":r!=null?!!r:/(?:^|;\s*)isAdminOfCurrentResource=[^;]/.test(t)}var Mn=new WeakMap;function xs(e,t){try{e.globalCompositeOperation="copy",e.fillStyle=t,e.fillRect(0,0,1,1);let r=e.getImageData(0,0,1,1).data;return{r:r[0],g:r[1],b:r[2],a:r[3]/255}}catch{return null}}function Hc(e){if(Mn.has(e))return Mn.get(e);let t=null;try{let r=e.createElement("canvas");if(r.width=r.height=1,t=r.getContext?r.getContext("2d",{willReadFrequently:!0}):null,t){let n=xs(t,"rgb(1, 2, 3)");(!n||n.r!==1||n.g!==2||n.b!==3||n.a!==1)&&(t=null)}}catch{t=null}return Mn.set(e,t),t}function Uc(e,t){let r=String(e??"").trim();if(!r)return null;let n=Vc(r);if(n)return n;let i=t&&t.defaultView;if(!i||!i.CSS||typeof i.CSS.supports!="function"||!i.CSS.supports("color",r))return null;let o=Hc(t);return o?xs(o,r):null}function Vc(e){let t=/rgba?\(([^)]+)\)/.exec(String(e??""));if(!t)return null;let r=t[1].split(/[\s,/]+/).filter(Boolean);if(r.length<3)return null;let n=r.slice(0,3).map(Number);if(n.some(Number.isNaN))return null;let i=r[3],o=i===void 0?1:i.endsWith("%")?Number(i.slice(0,-1))/100:Number(i);return{r:n[0],g:n[1],b:n[2],a:Number.isNaN(o)?1:o}}function fs({r:e,g:t,b:r}){let n=i=>{let o=i/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4};return .2126*n(e)+.7152*n(t)+.0722*n(r)}function ps(e,t){let r=fs(e),n=fs(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}var gs={r:10,g:10,b:10},bs={r:250,g:250,b:250};function ys(e,t){let r=e.a==null?1:e.a;return{r:e.r*r+t.r*(1-r),g:e.g*r+t.g*(1-r),b:e.b*r+t.b*(1-r)}}function Wc(e){if(!e)return"light";let t=ps(ys(e,gs),gs),r=ps(ys(e,bs),bs);return t>r?"dark":"light"}function Pt(e,t){for(let[r,n]of Object.entries(t))e.style.setProperty(r,n,"important")}function Nn(e){let t=e.ownerDocument&&e.ownerDocument.defaultView,r=e.querySelector(".hcms-toggle__main");if(!t||!r||typeof t.getComputedStyle!="function")return;let n=Uc(t.getComputedStyle(r).color,e.ownerDocument);e.setAttribute("data-hcms-surface",Wc(n))}function Kc(e){Nn(e);let t=e.ownerDocument,r=t&&t.defaultView;if(!r)return;let n=0,i=()=>{if(!n){if(typeof r.requestAnimationFrame!="function")return e.isConnected?Nn(e):s();n=r.requestAnimationFrame(()=>{if(n=0,!e.isConnected)return s();Nn(e)})}};typeof r.requestAnimationFrame=="function"&&i(),t.readyState!=="complete"&&r.addEventListener("load",i,{once:!0});let o=typeof r.MutationObserver=="function"?new r.MutationObserver(i):null;o&&(o.observe(t.documentElement,{attributes:!0}),t.body&&o.observe(t.body,{attributes:!0}));let a=typeof r.matchMedia=="function"?r.matchMedia("(prefers-color-scheme: dark)"):null;a&&typeof a.addEventListener=="function"&&a.addEventListener("change",i);function s(){o&&o.disconnect(),a&&typeof a.removeEventListener=="function"&&a.removeEventListener("change",i)}}function Gc({open:e,close:t,isOpen:r,getTheme:n=()=>null,views:i=Rr},o=document){let a=o.querySelector(`[${ne}]`);if(a)return a;if(!o.querySelector(`[${hs}]`)){let q=o.createElement("style");q.setAttribute(hs,""),q.setAttribute("editor-ui",""),o.getElementById(ds)||(q.id=ds),q.setAttribute("no-save",""),q.setAttribute("snapshot-remove",""),q.setAttribute("save-ignore",""),q.textContent=Bc,o.head.insertBefore(q,o.head.firstChild)}let s=o.createElement("hypercms-toggle");s.className="hcms-shell pixel-quiet",o.getElementById(us)||(s.id=us),s.setAttribute(ne,""),s.setAttribute("editor-ui",""),s.setAttribute("no-save",""),s.setAttribute("snapshot-remove",""),s.setAttribute("save-ignore",""),s.innerHTML='<button type="button" class="hcms-toggle__main mirk-button"><span class="hcms-toggle__open">Edit content</span><span class="hcms-toggle__close">Close editor</span></button>';let l=o.defaultView,u=s.querySelector(".hcms-toggle__main"),m=Rr.filter(q=>i.includes(q)),y=m.length>1,c=y?Yc(o):null,h=y?Jc(o,m):null;y&&(s.setAttribute(ks,""),s.appendChild(c),s.appendChild(h)),Pt(s,{position:"fixed",right:"calc(var(--hcms-toggle-offset, 16px) + var(--hcms-toggle-shift, 0px))",bottom:"calc(var(--hcms-toggle-offset, 16px) + env(safe-area-inset-bottom, 0px))","z-index":"var(--hcms-toggle-z, 2147482900)"}),Pt(u,{background:Ln}),c&&Pt(c,{background:Ln}),h&&Pt(h,{position:"absolute",right:"0",bottom:"calc(100% + 8px)","z-index":"var(--hcms-toggle-z, 2147482900)",display:"none"});let f=()=>h?[...h.querySelectorAll('[role="menuitemradio"]')]:[];function b(q){if(!(!q||typeof q.focus!="function"))try{q.focus({preventScroll:!0})}catch{q.focus()}}function k(q){let te=f();te.length&&b(te[(q+te.length)%te.length])}function A(){let q=ms(l);for(let te of f())te.setAttribute("aria-checked",String(te.getAttribute("data-hcms-view")===q))}function E(q){s.contains(q.target)||O()}function L(q){h&&(h.hidden=!q,Pt(h,{display:q?"block":"none"}),c.setAttribute("aria-expanded",String(q)),q?(A(),o.addEventListener("pointerdown",E,!0)):o.removeEventListener("pointerdown",E,!0))}function D(q=0){L(!0),k(q)}function O({focusArrow:q=!1}={}){!h||h.hidden||(L(!1),q&&b(c))}function W(){let q=ms(l);return q&&m.includes(q)?q:null}async function U(q){await e({view:q}),qc(l,q)}async function ie(){if(r()){t();return}let q=W();return q?e({view:q}):y?D():e(m[0]?{view:m[0]}:{})}async function ee(q){try{await q()}catch(te){console.warn("hypercms: toggle failed to open the CMS",te)}}s.addEventListener("click",async q=>{c&&c.contains(q.target)||h&&h.contains(q.target)||await ee(ie)}),c&&(c.addEventListener("click",q=>{q.preventDefault(),h.hidden?D():O({focusArrow:!0})}),c.addEventListener("keydown",q=>{if(q.key==="ArrowUp"){q.preventDefault(),D(-1);return}(q.key==="ArrowDown"||q.key==="Enter"||q.key===" ")&&(q.preventDefault(),D(0))}),h.addEventListener("click",q=>{let te=q.target.closest?.('[role="menuitemradio"]');te&&(q.preventDefault(),O(),ee(()=>U(te.getAttribute("data-hcms-view"))))}),h.addEventListener("keydown",q=>{let te=f(),xe=te.indexOf(o.activeElement);switch(q.key){case"ArrowDown":q.preventDefault(),k(xe+1);break;case"ArrowUp":q.preventDefault(),k(xe-1);break;case"Home":q.preventDefault(),k(0);break;case"End":q.preventDefault(),k(te.length-1);break;case"Enter":case" ":if(q.preventDefault(),xe===-1)break;O(),ee(()=>U(te[xe].getAttribute("data-hcms-view")));break;case"Escape":q.preventDefault(),O({focusArrow:!0});break;case"Tab":O();break}}));let me=q=>{let te=n();s.classList.toggle("light",te==="light"),s.classList.toggle("dark",te==="dark"),q?s.setAttribute(Or,"open"):s.removeAttribute(Or)};return me(r()),o.addEventListener("hcms:open",()=>me(!0)),o.addEventListener("hcms:close",()=>me(!1)),o.body.appendChild(s),Ie(o),Kc(s),s}function Yc(e){let t=e.createElement("button");return t.type="button",t.className="hcms-toggle__arrow mirk-button",t.setAttribute("aria-haspopup","menu"),t.setAttribute("aria-expanded","false"),t.setAttribute("aria-label","Choose where to edit"),t.textContent="\u25BE",t}function Jc(e,t){let r=e.createElement("div");r.className="hcms-toggle__menu",r.setAttribute("role","menu"),r.setAttribute("aria-label","Where to edit"),r.hidden=!0;for(let n of t){let i=e.createElement("button");i.type="button",i.className="hcms-toggle__item",i.setAttribute("role","menuitemradio"),i.setAttribute("aria-checked","false"),i.setAttribute("data-hcms-view",n),i.tabIndex=-1,i.textContent=Dc[n],r.appendChild(i)}return r}function ws(e){if(typeof window>"u"||typeof document>"u")return;let t=window.__hyperclayEditMode!=null?window.__hyperclayEditMode:null;if(!zc({search:window.location.search,cookie:document.cookie,forced:t}))return;let r=()=>{document.body&&e.hasRules(document)&&Gc(e)};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r,{once:!0}):r()}function As(e){if(Ao(e),typeof document<"u"){let t=document.getElementById("hcms-shell-styles");t?.tagName==="LINK"&&t.remove(),Ie(document)}}var jn={sidebar:Mo,inline:Qo};function Mr(e={}){let t=e.view||(J.isOpen?J.ctx.view.name:"sidebar"),r=jn[t];if(!r)throw new Error(`hypercms: unknown view "${t}" (expected ${Object.keys(jn).join(" or ")})`);let n=J.isOpen?{...J.opts,...e,view:t}:e,i=n.pageRoot||(typeof document<"u"?document.body:null);if(!i)throw new Error("hypercms: no pageRoot available");let o=i.ownerDocument||(typeof document<"u"?document:null);if(!o)throw new Error("hypercms: no document available");let a=null,s=null;if(J.isOpen){if(J.ctx.view.name===t)return;a=J.ctx.previouslyFocused,s=J.ctx.view.name,Cr(J.ctx,{restoreFocus:!1,updateUrl:!1,reason:"switch"})}Vo();let l=r({doc:o,pageRoot:i,opts:n}),u=ss({view:l,doc:o,pageRoot:i,opts:n,onCloseRequested:()=>Fn(),onViewRequested:m=>Mr({view:m})});a&&(u.previouslyFocused=a);try{l.mount(u.initialData),as(u),l.focusOnOpen(),J.isOpen=!0,J.ctx=u,J.opts=n,u.dispatch("hcms:open",{pageRoot:i,previous:s})}catch(m){throw Cr(u,{dispatch:!1,restoreFocus:!!a,updateUrl:!1}),m}}function Fn(){J.isOpen&&Cr(J.ctx)}function Ss(){J.isOpen&&J.ctx.view.refresh("api")}function Xc(){return J.isOpen}function Zc(){return J.isOpen&&J.ctx?J.ctx.view.name:null}var Qc={getData(){return J.isOpen?pe(J.ctx):null},setValue(e,t){if(!J.isOpen)throw new Error("hypercms: cms is not open");let r=J.ctx,n=Se(e),i=Pe(r.pageRules,n);if(i===void 0)throw new Error(`hypercms: no rule at path "${e}"`);if(typeof i!="string"||i.endsWith("[]"))throw new Error(`hypercms: setValue requires a leaf scalar path; "${e}" is not a leaf`);let o=mr(r.formRoot,e);if(!o)throw new Error(`hypercms: no field element at path "${e}"`);fr(o,t,r.formRoot,e),be(pe(r),{path:e,structural:!1},r)},addItem(e){if(!J.isOpen)throw new Error("hypercms: cms is not open");Nt(e,J.ctx)},removeItem(e){if(!J.isOpen)throw new Error("hypercms: cms is not open");let t=J.ctx,r=Se(e);if(typeof r[r.length-1]!="number")throw new Error(`hypercms: removeItem requires an item path; "${e}" is not an array index`);let i=Pe(t.pageRules,r.slice(0,-1));if(!(Array.isArray(i)||typeof i=="string"&&i.endsWith("[]")))throw new Error(`hypercms: removeItem requires an item path; parent of "${e}" is not an array`);let a=t.formRoot.querySelector(`[data-hcms-path="${iu(e)}"]`);if(!a)throw new Error(`hypercms: no element at path "${e}"`);at(a,t)},refresh:Ss,_commit(){if(!J.isOpen)return;let e=J.ctx;return pr(e.formRoot),He("Update",()=>be(pe(e),{path:"",structural:!0},e))}},eu=250,tu=1e4;function ru(){typeof window>"u"||typeof document>"u"||cs(window.location?window.location.search:"")&&(J.isOpen||nu(()=>{if(!J.isOpen)try{Mr()}catch(e){console.warn("hypercms: auto-open failed",e)}}))}function In(){return!!document.body&&!!ue("Mutation")}function nu(e){if(In()){queueMicrotask(e);return}let t=Date.now()+tu,r=!1,n=null,i=null,o=()=>{r||(r=!0,n!==null&&clearInterval(n),i&&i())};function a(){if(J.isOpen){o();return}In()&&(o(),e())}i=it(document,io,a),n=setInterval(()=>{if(J.isOpen){o();return}if(In()){o(),e();return}Date.now()>=t&&(o(),console.warn("hypercms: ?cms=true auto-open gave up \u2014 no mutation hub appeared. Load clayjs or hyperclayjs (or just the mutation utility) so the CMS can initialize."))},eu)}ru();ws({open:Mr,close:Fn,isOpen:Xc,getTheme:()=>J.opts?.theme,views:Object.keys(jn),hasRules:e=>!!fe.findRules(e,"cms")});var Dn={open:Mr,close:Fn,refresh:Ss,api:Qc,get isOpen(){return J.isOpen},currentView:Zc,path:Qr,scaffold:Ot,morphForm:Yt};function iu(e){return typeof CSS<"u"&&CSS.escape?CSS.escape(e):String(e).replace(/[^a-zA-Z0-9_\-.*]/g,t=>"\\"+t)}var Es=`/* GENERATED by scripts/build-theme.js from mirk-interface/mirk.css \u2014 DO NOT EDIT.
|
|
193
305
|
Source of truth: mirk-interface/mirk.css + src/theme/pixel-quiet.overrides.css.
|
|
194
306
|
Regenerate with: npm run build:theme */
|
|
195
307
|
|
|
@@ -1203,7 +1315,7 @@ body.hcms-open.hcms-overlay #hcms-toggle { display: none; }
|
|
|
1203
1315
|
/* =====================================================================
|
|
1204
1316
|
Pixel Quiet \u2014 hypercms theme overrides (hypercms-owned).
|
|
1205
1317
|
|
|
1206
|
-
Adapted from cms-sidebar/pixel-quiet/overrides.css. Two jobs:
|
|
1318
|
+
Adapted from ARCHIVE_PROJECTS/cms-sidebar/pixel-quiet/overrides.css. Two jobs:
|
|
1207
1319
|
1. Retune --mirk-* tokens, scoped to .hcms-shell.pixel-quiet (never :root).
|
|
1208
1320
|
2. Author the panel geometry + the functional chrome the static mockup
|
|
1209
1321
|
doesn't have (error banner, add/remove/move controls, the engine's
|
|
@@ -1314,13 +1426,13 @@ body.hcms-open.hcms-overlay #hcms-toggle { display: none; }
|
|
|
1314
1426
|
position: fixed makes the shell a containing block so the absolute
|
|
1315
1427
|
minibar anchors to it; flex column so the body owns the scroll.
|
|
1316
1428
|
============================================================ */
|
|
1317
|
-
.hcms-shell.pixel-quiet {
|
|
1429
|
+
.hcms-shell.pixel-quiet.hcms-panel {
|
|
1318
1430
|
box-sizing: border-box;
|
|
1319
1431
|
position: fixed;
|
|
1320
1432
|
top: 0;
|
|
1321
1433
|
right: 0;
|
|
1322
1434
|
bottom: 0;
|
|
1323
|
-
width: 380px;
|
|
1435
|
+
width: var(--hcms-shell-width, 380px);
|
|
1324
1436
|
max-width: 100vw;
|
|
1325
1437
|
z-index: 2147483000;
|
|
1326
1438
|
display: flex;
|
|
@@ -1330,7 +1442,7 @@ body.hcms-open.hcms-overlay #hcms-toggle { display: none; }
|
|
|
1330
1442
|
border-left: 1px solid var(--mirk-input-border);
|
|
1331
1443
|
box-shadow: -16px 0 48px -28px rgba(43, 36, 27, 0.45);
|
|
1332
1444
|
}
|
|
1333
|
-
.hcms-shell.pixel-quiet.dark {
|
|
1445
|
+
.hcms-shell.pixel-quiet.hcms-panel.dark {
|
|
1334
1446
|
box-shadow: -16px 0 48px -28px rgba(0, 0, 0, 0.6);
|
|
1335
1447
|
}
|
|
1336
1448
|
|
|
@@ -1342,13 +1454,20 @@ body.hcms-open.hcms-overlay #hcms-toggle { display: none; }
|
|
|
1342
1454
|
box-shadow: 16px 0 48px -28px rgba(43, 36, 27, 0.45);
|
|
1343
1455
|
}
|
|
1344
1456
|
|
|
1345
|
-
/* Push the page over so docked content is never hidden underneath
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1457
|
+
/* Push the page over so docked content is never hidden underneath, and publish
|
|
1458
|
+
the geometry the floating toggle has to compose with. --hcms-toggle-shift is
|
|
1459
|
+
the distance the toggle moves left, which is the shell width only while the
|
|
1460
|
+
shell is docked on the right; docked left, as an overlay, or full-viewport it
|
|
1461
|
+
is zero. */
|
|
1462
|
+
body.hcms-open { --hcms-shell-width: 380px; }
|
|
1463
|
+
body.hcms-open:not(.hcms-overlay) { padding-right: var(--hcms-shell-width); }
|
|
1464
|
+
body.hcms-open:not(.hcms-overlay):not(.hcms-side-left) { --hcms-toggle-shift: var(--hcms-shell-width); }
|
|
1465
|
+
body.hcms-open.hcms-side-left:not(.hcms-overlay) { padding-right: 0; padding-left: var(--hcms-shell-width); }
|
|
1466
|
+
body.hcms-open.hcms-overlay { overflow: hidden; --hcms-toggle-display: none; }
|
|
1349
1467
|
|
|
1350
1468
|
@media (max-width: 799px) {
|
|
1351
|
-
.hcms-
|
|
1469
|
+
body.hcms-open { --hcms-shell-width: 100vw; }
|
|
1470
|
+
body.hcms-open:not(.hcms-overlay):not(.hcms-side-left) { --hcms-toggle-shift: 0px; }
|
|
1352
1471
|
body.hcms-open:not(.hcms-overlay),
|
|
1353
1472
|
body.hcms-open.hcms-side-left:not(.hcms-overlay) { padding-right: 0; padding-left: 0; }
|
|
1354
1473
|
body.hcms-open { overflow: hidden; }
|
|
@@ -1725,6 +1844,7 @@ body.hcms-open.hcms-overlay { overflow: hidden; }
|
|
|
1725
1844
|
.hcms-shell-notice {
|
|
1726
1845
|
font-size: 12px;
|
|
1727
1846
|
line-height: 1.45;
|
|
1847
|
+
white-space: pre-line;
|
|
1728
1848
|
color: var(--mirk-mark-fg);
|
|
1729
1849
|
background: var(--mirk-bevel-bg);
|
|
1730
1850
|
border: 1px solid var(--mirk-input-border);
|
|
@@ -1791,4 +1911,290 @@ body.hcms-open.hcms-overlay { overflow: hidden; }
|
|
|
1791
1911
|
cursor: pointer;
|
|
1792
1912
|
}
|
|
1793
1913
|
.hcms-sr-only[hidden] { display: none; }
|
|
1794
|
-
|
|
1914
|
+
|
|
1915
|
+
/* ============================================================
|
|
1916
|
+
INLINE VIEW GEOMETRY \u2014 not a panel. A transparent full-viewport
|
|
1917
|
+
host whose children are the only interactive surfaces, so the page
|
|
1918
|
+
underneath stays fully usable while the editor is open.
|
|
1919
|
+
============================================================ */
|
|
1920
|
+
.hcms-shell.pixel-quiet.hcms-inline {
|
|
1921
|
+
position: fixed;
|
|
1922
|
+
inset: 0;
|
|
1923
|
+
z-index: 2147483000;
|
|
1924
|
+
/* The host must never intercept a click meant for the page. Each child
|
|
1925
|
+
re-enables pointer events for itself. */
|
|
1926
|
+
pointer-events: none;
|
|
1927
|
+
background: none;
|
|
1928
|
+
border: 0;
|
|
1929
|
+
box-shadow: none;
|
|
1930
|
+
color: var(--mirk-fg);
|
|
1931
|
+
}
|
|
1932
|
+
.hcms-inline > *,
|
|
1933
|
+
.hcms-inline-layer > * { pointer-events: auto; }
|
|
1934
|
+
.hcms-inline-layer { position: absolute; inset: 0; pointer-events: none; }
|
|
1935
|
+
|
|
1936
|
+
.hcms-inline-bar {
|
|
1937
|
+
position: absolute;
|
|
1938
|
+
left: 50%;
|
|
1939
|
+
bottom: 16px;
|
|
1940
|
+
transform: translateX(-50%);
|
|
1941
|
+
max-width: min(560px, calc(100vw - 32px));
|
|
1942
|
+
display: flex;
|
|
1943
|
+
flex-direction: column;
|
|
1944
|
+
gap: 6px;
|
|
1945
|
+
}
|
|
1946
|
+
|
|
1947
|
+
.hcms-inline-notice,
|
|
1948
|
+
.hcms-inline-error {
|
|
1949
|
+
padding: 8px 12px;
|
|
1950
|
+
border-radius: 8px;
|
|
1951
|
+
font-size: 14px;
|
|
1952
|
+
line-height: 1.4;
|
|
1953
|
+
border: 1px solid var(--mirk-input-border);
|
|
1954
|
+
background: var(--mirk-bg);
|
|
1955
|
+
color: var(--mirk-fg);
|
|
1956
|
+
box-shadow: 0 12px 32px -20px rgba(43, 36, 27, 0.5);
|
|
1957
|
+
}
|
|
1958
|
+
.hcms-inline-notice { white-space: pre-line; }
|
|
1959
|
+
.hcms-inline-error { border-color: var(--mirk-destructive); color: var(--mirk-destructive); }
|
|
1960
|
+
.hcms-inline-notice[hidden],
|
|
1961
|
+
.hcms-inline-error[hidden] { display: none; }
|
|
1962
|
+
|
|
1963
|
+
.hcms-inline-pop {
|
|
1964
|
+
position: absolute;
|
|
1965
|
+
top: 0;
|
|
1966
|
+
left: 0;
|
|
1967
|
+
box-sizing: border-box;
|
|
1968
|
+
width: min(340px, calc(100vw - 24px));
|
|
1969
|
+
max-height: calc(100dvh - 24px);
|
|
1970
|
+
overflow: auto;
|
|
1971
|
+
padding: 16px;
|
|
1972
|
+
border-radius: 8px;
|
|
1973
|
+
border: 1px solid var(--mirk-input-border);
|
|
1974
|
+
background: var(--mirk-bg);
|
|
1975
|
+
color: var(--mirk-fg);
|
|
1976
|
+
box-shadow: 0 16px 40px -22px rgba(43, 36, 27, 0.55);
|
|
1977
|
+
/* Above the handles. They are positioned with z-index: 1 while the popover
|
|
1978
|
+
sat at auto, so a handle painted over the very field it had just opened
|
|
1979
|
+
and covered the text in it. The popover is what someone is using; a handle
|
|
1980
|
+
is only an offer to open one. */
|
|
1981
|
+
z-index: 2;
|
|
1982
|
+
}
|
|
1983
|
+
.hcms-inline-pop[hidden] { display: none; }
|
|
1984
|
+
.hcms-inline-pop-header {
|
|
1985
|
+
display: flex;
|
|
1986
|
+
align-items: center;
|
|
1987
|
+
justify-content: space-between;
|
|
1988
|
+
gap: 16px;
|
|
1989
|
+
margin-bottom: 16px;
|
|
1990
|
+
font-size: 14px;
|
|
1991
|
+
}
|
|
1992
|
+
.hcms-shell .hcms-inline-pop-close {
|
|
1993
|
+
display: inline-flex;
|
|
1994
|
+
align-items: center;
|
|
1995
|
+
justify-content: center;
|
|
1996
|
+
min-width: 36px;
|
|
1997
|
+
min-height: 36px;
|
|
1998
|
+
padding: 4px;
|
|
1999
|
+
}
|
|
2000
|
+
|
|
2001
|
+
.hcms-inline-item-controls {
|
|
2002
|
+
position: absolute;
|
|
2003
|
+
top: 0;
|
|
2004
|
+
left: 0;
|
|
2005
|
+
z-index: 1;
|
|
2006
|
+
will-change: transform;
|
|
2007
|
+
display: flex;
|
|
2008
|
+
align-items: center;
|
|
2009
|
+
gap: 2px;
|
|
2010
|
+
}
|
|
2011
|
+
.hcms-inline-item-controls[hidden],
|
|
2012
|
+
.hcms-inline-handle[hidden] { display: none; }
|
|
2013
|
+
.hcms-inline-item-controls.has-open-settings { z-index: 3; }
|
|
2014
|
+
.hcms-inline-settings { position: relative; display: flex; flex: none; }
|
|
2015
|
+
.hcms-inline-settings[hidden],
|
|
2016
|
+
.hcms-inline-settings-menu[hidden] { display: none; }
|
|
2017
|
+
.hcms-inline-settings-menu {
|
|
2018
|
+
position: absolute;
|
|
2019
|
+
top: calc(100% + 6px);
|
|
2020
|
+
right: 0;
|
|
2021
|
+
min-width: 120px;
|
|
2022
|
+
padding: 4px;
|
|
2023
|
+
border: 1px solid var(--mirk-input-border);
|
|
2024
|
+
border-radius: 5px;
|
|
2025
|
+
background: var(--mirk-bg);
|
|
2026
|
+
box-shadow: 0 8px 24px #0003;
|
|
2027
|
+
}
|
|
2028
|
+
.hcms-inline-settings-menu button {
|
|
2029
|
+
display: block;
|
|
2030
|
+
box-sizing: border-box;
|
|
2031
|
+
width: 100%;
|
|
2032
|
+
padding: 10px 12px;
|
|
2033
|
+
border: 0;
|
|
2034
|
+
background: transparent;
|
|
2035
|
+
color: var(--mirk-destructive);
|
|
2036
|
+
font: inherit;
|
|
2037
|
+
text-align: left;
|
|
2038
|
+
cursor: pointer;
|
|
2039
|
+
}
|
|
2040
|
+
.hcms-inline-settings-menu button:hover,
|
|
2041
|
+
.hcms-inline-settings-menu button:focus-visible {
|
|
2042
|
+
background: var(--mirk-bevel-bg);
|
|
2043
|
+
outline: 1px solid var(--mirk-focus-color);
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
/* Buttons flow within the positioned item container. */
|
|
2047
|
+
.hcms-inline-row-controls {
|
|
2048
|
+
display: flex;
|
|
2049
|
+
gap: 2px;
|
|
2050
|
+
}
|
|
2051
|
+
.hcms-inline-row-controls[hidden] { display: none; }
|
|
2052
|
+
|
|
2053
|
+
.hcms-inline-list-add[hidden] { display: none; }
|
|
2054
|
+
|
|
2055
|
+
.hcms-shell.hcms-inline-ghost {
|
|
2056
|
+
box-sizing: border-box;
|
|
2057
|
+
position: relative;
|
|
2058
|
+
display: flex;
|
|
2059
|
+
align-items: center;
|
|
2060
|
+
justify-content: center;
|
|
2061
|
+
flex: none;
|
|
2062
|
+
max-width: 100%;
|
|
2063
|
+
min-width: 0;
|
|
2064
|
+
margin: 8px 0 0;
|
|
2065
|
+
padding: 0;
|
|
2066
|
+
border: 1px dashed color-mix(in srgb, currentColor 25%, transparent);
|
|
2067
|
+
border-radius: 3px;
|
|
2068
|
+
background: color-mix(in srgb, currentColor 3%, transparent);
|
|
2069
|
+
color: inherit;
|
|
2070
|
+
list-style: none;
|
|
2071
|
+
}
|
|
2072
|
+
.hcms-shell.hcms-inline-ghost[hidden] { display: none; }
|
|
2073
|
+
tr.hcms-shell.hcms-inline-ghost { display: table-row; }
|
|
2074
|
+
.hcms-inline-ghost-cell { padding: 0; text-align: center; vertical-align: middle; }
|
|
2075
|
+
|
|
2076
|
+
.hcms-shell .hcms-inline-handle,
|
|
2077
|
+
.hcms-shell .hcms-inline-list-button {
|
|
2078
|
+
display: inline-flex;
|
|
2079
|
+
align-items: center;
|
|
2080
|
+
justify-content: center;
|
|
2081
|
+
min-width: 36px;
|
|
2082
|
+
min-height: 36px;
|
|
2083
|
+
padding: 4px;
|
|
2084
|
+
line-height: 1;
|
|
2085
|
+
}
|
|
2086
|
+
.hcms-inline-handle .mirk-button__label,
|
|
2087
|
+
.hcms-inline-list-button .mirk-button__label {
|
|
2088
|
+
display: inline-flex;
|
|
2089
|
+
align-items: center;
|
|
2090
|
+
gap: 6px;
|
|
2091
|
+
line-height: 1;
|
|
2092
|
+
}
|
|
2093
|
+
.hcms-inline-icon { display: block; width: 24px; height: 24px; flex: none; }
|
|
2094
|
+
.hcms-inline-handle .hcms-inline-icon { width: 20.4px; height: 20.4px; transform: translateY(-1px); }
|
|
2095
|
+
.hcms-inline-list-add .hcms-inline-icon { width: 16.8px; height: 16.8px; }
|
|
2096
|
+
.hcms-shell .hcms-inline-list-add { padding-inline: 10px; }
|
|
2097
|
+
|
|
2098
|
+
.hcms-inline-list-button {
|
|
2099
|
+
flex: none;
|
|
2100
|
+
}
|
|
2101
|
+
.hcms-inline-list-button[hidden] { display: none; }
|
|
2102
|
+
.hcms-shell .hcms-inline-list-button:disabled {
|
|
2103
|
+
opacity: 1;
|
|
2104
|
+
color: #626B96;
|
|
2105
|
+
background: var(--mirk-bevel-bg);
|
|
2106
|
+
border-color: var(--mirk-bevel-tl) var(--mirk-bevel-br) var(--mirk-bevel-br) var(--mirk-bevel-tl);
|
|
2107
|
+
}
|
|
2108
|
+
.hcms-shell .hcms-inline-list-button:disabled .mirk-button__label { translate: none; }
|
|
2109
|
+
|
|
2110
|
+
/* A finger is not a mouse pointer: on touch the same three controls get the
|
|
2111
|
+
44px target the platform guidelines ask for. */
|
|
2112
|
+
@media (pointer: coarse) {
|
|
2113
|
+
.hcms-shell .hcms-inline-handle,
|
|
2114
|
+
.hcms-shell .hcms-inline-list-button {
|
|
2115
|
+
min-width: 44px;
|
|
2116
|
+
min-height: 44px;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
|
|
2120
|
+
.hcms-inline-toggle { align-self: center; }
|
|
2121
|
+
.hcms-inline-toggle[hidden] { display: none; }
|
|
2122
|
+
|
|
2123
|
+
/* Fields with no visible anchor can still be edited through the sidebar. */
|
|
2124
|
+
.hcms-inline-handoff {
|
|
2125
|
+
display: flex;
|
|
2126
|
+
align-items: center;
|
|
2127
|
+
gap: 10px;
|
|
2128
|
+
padding: 6px 6px 6px 12px;
|
|
2129
|
+
border-radius: 999px;
|
|
2130
|
+
font-size: 13px;
|
|
2131
|
+
border: 1px solid var(--mirk-input-border);
|
|
2132
|
+
background: var(--mirk-bg);
|
|
2133
|
+
color: var(--mirk-fg);
|
|
2134
|
+
align-self: center;
|
|
2135
|
+
}
|
|
2136
|
+
.hcms-inline-handoff[hidden] { display: none; }
|
|
2137
|
+
|
|
2138
|
+
/* Selected fields only. Scoped to the inline host: [data-hcms-shell] is on BOTH
|
|
2139
|
+
hosts, so an unscoped rule hides the sidebar's whole form too. */
|
|
2140
|
+
.hcms-inline .hcms-form [data-hcms-path] { display: none; }
|
|
2141
|
+
.hcms-inline .hcms-form [data-hcms-path].is-hcms-inline-onpath,
|
|
2142
|
+
.hcms-inline .hcms-form [data-hcms-path].is-hcms-inline-active { display: block; }
|
|
2143
|
+
|
|
2144
|
+
.hcms-inline .hcms-form .is-hcms-inline-onpath,
|
|
2145
|
+
.hcms-inline .hcms-form {
|
|
2146
|
+
margin: 0;
|
|
2147
|
+
padding: 0;
|
|
2148
|
+
border: 0;
|
|
2149
|
+
border-radius: 0;
|
|
2150
|
+
box-shadow: none;
|
|
2151
|
+
background: transparent;
|
|
2152
|
+
min-width: 0;
|
|
2153
|
+
min-height: 0;
|
|
2154
|
+
width: 100%;
|
|
2155
|
+
}
|
|
2156
|
+
.hcms-inline-pop .hcms-object-title,
|
|
2157
|
+
.hcms-inline-pop .hcms-array-header,
|
|
2158
|
+
.hcms-inline-pop .hcms-drag-handle,
|
|
2159
|
+
.hcms-inline-pop [data-hcms-action="add"],
|
|
2160
|
+
.hcms-inline-pop [data-hcms-action="remove"],
|
|
2161
|
+
.hcms-inline-pop [data-hcms-action="move-up"],
|
|
2162
|
+
.hcms-inline-pop [data-hcms-action="move-down"],
|
|
2163
|
+
.hcms-inline-pop .hcms-card-controls { display: none; }
|
|
2164
|
+
.hcms-inline .hcms-form .hcms-field.is-hcms-inline-active {
|
|
2165
|
+
display: flex;
|
|
2166
|
+
gap: 8px;
|
|
2167
|
+
padding: 0;
|
|
2168
|
+
margin: 0 0 16px;
|
|
2169
|
+
border: 0;
|
|
2170
|
+
min-width: min(260px, 100%);
|
|
2171
|
+
}
|
|
2172
|
+
.hcms-inline .hcms-form .hcms-field.is-hcms-inline-active:last-child { margin-bottom: 0; }
|
|
2173
|
+
.hcms-shell.pixel-quiet .hcms-inline-pop .mirk-input,
|
|
2174
|
+
.hcms-shell.pixel-quiet .hcms-inline-pop .mirk-textarea {
|
|
2175
|
+
box-sizing: border-box;
|
|
2176
|
+
width: 100%;
|
|
2177
|
+
min-width: min(260px, 100%);
|
|
2178
|
+
min-height: 42px;
|
|
2179
|
+
padding: 10px 12px;
|
|
2180
|
+
border: 1px solid var(--mirk-input-border);
|
|
2181
|
+
background: var(--mirk-input-bg);
|
|
2182
|
+
}
|
|
2183
|
+
.hcms-inline-pop .mirk-input:focus-visible,
|
|
2184
|
+
.hcms-inline-pop .mirk-textarea:focus-visible {
|
|
2185
|
+
outline: 2px solid var(--mirk-focus-color);
|
|
2186
|
+
outline-offset: 2px;
|
|
2187
|
+
}
|
|
2188
|
+
|
|
2189
|
+
.hcms-inline-highlight {
|
|
2190
|
+
position: absolute;
|
|
2191
|
+
top: 0;
|
|
2192
|
+
left: 0;
|
|
2193
|
+
pointer-events: none;
|
|
2194
|
+
border: 2px solid var(--mirk-focus-color);
|
|
2195
|
+
border-radius: 4px;
|
|
2196
|
+
box-sizing: border-box;
|
|
2197
|
+
will-change: transform;
|
|
2198
|
+
}
|
|
2199
|
+
.hcms-inline-highlight[hidden] { display: none; }
|
|
2200
|
+
`;typeof window<"u"&&typeof document<"u"&&(function(){if(window.__mirk)return;window.__mirk=!0;let e='<svg viewBox="0 0 16 16" aria-hidden="true"><path d="M4 4 12 12M12 4 4 12" stroke="currentColor" stroke-width="2" stroke-linecap="square" fill="none"/></svg>';document.addEventListener("click",r=>{let n=r.target.closest(".mirk-number__step");if(!n)return;let i=n.closest(".mirk-number").querySelector("input[type=number]");i&&(n.dataset.step==="up"?i.stepUp():i.stepDown(),i.dispatchEvent(new Event("change",{bubbles:!0})))}),document.addEventListener("input",r=>{let n=r.target.closest(".mirk-slider__input");n&&n.closest(".mirk-slider").style.setProperty("--mirk-value",`${n.value}%`)}),document.addEventListener("change",r=>{let n=r.target.closest(".mirk-file__input");if(!n||!n.files.length)return;let i=n.closest(".mirk-file"),o=i.querySelector(".mirk-file__name");if(!o)return;let a=n.files[0],s=document.createElement("a");if(s.className="mirk-file__name",s.dataset.filled="",s.href=URL.createObjectURL(a),s.target="_blank",s.rel="noopener",s.textContent=a.name,o.replaceWith(s),!i.querySelector(".mirk-file__remove")){let l=document.createElement("button");l.type="button",l.className="mirk-file__remove",l.setAttribute("aria-label","Remove file"),l.innerHTML=e,s.after(l)}}),document.addEventListener("change",r=>{let n=r.target.closest(".mirk-image__input");if(!n||!n.files.length)return;let i=n.closest(".mirk-image"),o=i.querySelector(".mirk-image__preview");if(!o)return;let a=i.querySelector(".mirk-image__placeholder"),s=new FileReader;s.onload=l=>{o.src=l.target.result,o.removeAttribute("hidden"),a&&a.setAttribute("hidden",""),i.querySelector(".mirk-image__thumb")?.removeAttribute("hidden"),i.querySelector(".mirk-image__upload")?.setAttribute("hidden","")},s.readAsDataURL(n.files[0])}),document.addEventListener("click",r=>{let n=r.target.closest(".mirk-file__remove");if(n){let o=n.closest(".mirk-file"),a=o?.querySelector(".mirk-file__input"),s=o?.querySelector(".mirk-file__name");if(a&&(a.value=""),s){let l=document.createElement("span");l.className="mirk-file__name",l.textContent="No file chosen",s.replaceWith(l)}n.remove();return}let i=r.target.closest(".mirk-image__remove");if(i){let o=i.closest(".mirk-image"),a=o?.querySelector(".mirk-image__input"),s=o?.querySelector(".mirk-image__preview");a&&(a.value=""),s&&(s.removeAttribute("src"),s.setAttribute("hidden","")),o?.querySelector(".mirk-image__thumb")?.setAttribute("hidden",""),o?.querySelector(".mirk-image__upload")?.removeAttribute("hidden")}});function t(r,n){let i=document.createElement("span");i.textContent=r;let o=document.createElement("input");o.type="hidden",o.name="tags[]",o.value=r;let a=document.createElement("button");a.type="button",a.className="mirk-tags__remove",a.textContent="\xD7";let s=document.createElement("span");if(s.className="mirk-tags__chip",n){let l=document.createElement("span");l.className="mirk-tags__chip-inner",l.append(i,o,a),s.append(l)}else s.append(i,o,a);return s}document.addEventListener("keydown",r=>{let n=r.target.closest(".mirk-tags__input");if(!n)return;let i=n.closest(".mirk-tags");if(r.key==="Enter"||r.key===","){let o=n.value.trim();if(!o)return;r.preventDefault(),n.before(t(o,i.classList.contains("mirk-tags--round"))),n.value=""}else if(r.key==="Backspace"&&!n.value){let o=i.querySelectorAll(".mirk-tags__chip");o[o.length-1]?.remove()}}),document.addEventListener("click",r=>{let n=r.target.closest(".mirk-tags__remove");if(n){n.closest(".mirk-tags__chip").remove();return}let i=r.target.closest(".mirk-tags");i&&r.target===i&&i.querySelector(".mirk-tags__input")?.focus()}),document.addEventListener("click",r=>{let n=r.target.closest("[data-mirk-chip]");if(!n)return;let i=n.getAttribute("data-mirk-chip");if(i==="open")n.closest(".mirk-chip")?.classList.add("mirk-chip--open");else if(i==="collapse")n.closest(".mirk-chip")?.classList.remove("mirk-chip--open");else if(i==="changes"){let o=n.closest(".mirk-chip__panel")?.classList.toggle("is-changes");n.textContent=o?"(hide changes)":"(view changes)"}}),document.addEventListener("click",r=>{let n=r.target.closest("[data-copy-btn]");if(!n)return;let i=n.closest("[data-copy]");if(!i)return;let o=i.cloneNode(!0);o.querySelectorAll("[data-copy-btn]").forEach(l=>l.remove());let s=i.getAttribute("data-copy")==="text"?o.textContent.replace(/^\s+|\s+$/g,""):o.innerHTML.replace(/\s+data-copy(="[^"]*")?/g,"").replace(/^\s*\n/gm,"").trim();navigator.clipboard.writeText(s).then(()=>{let l=n.textContent;n.textContent="copied",n.dataset.copied="",setTimeout(()=>{n.textContent=l,delete n.dataset.copied},1200)}).catch(()=>{n.textContent="error",setTimeout(()=>{n.textContent="copy"},1200)})})})();As(Es);var au=Dn,lu={cms:Dn};return Rs(cu);})();
|