payload-live-preview 2.2.1 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/adapters/astro/index.d.ts +2 -2
- package/dist/adapters/astro/index.js +1 -1
- package/dist/adapters/astro/index.js.map +1 -1
- package/dist/adapters/astro/middleware-entry.js +1 -1
- package/dist/adapters/astro/middleware-entry.js.map +1 -1
- package/dist/adapters/nextjs/index.d.ts +1 -1
- package/dist/adapters/nextjs/index.js +1 -1
- package/dist/adapters/nextjs/index.js.map +1 -1
- package/dist/adapters/nuxt/index.d.ts +2 -2
- package/dist/adapters/nuxt/index.js +1 -1
- package/dist/adapters/nuxt/index.js.map +1 -1
- package/dist/adapters/sveltekit/index.d.ts +2 -2
- package/dist/adapters/sveltekit/index.js +1 -1
- package/dist/adapters/sveltekit/index.js.map +1 -1
- package/dist/client.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +1 -1
- package/dist/client.js.map +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/{fragment-endpoint-DGGLIijM.d.ts → fragment-endpoint-CLRpNQ3n.d.ts} +4 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lean.cjs +1 -1
- package/dist/lean.cjs.map +1 -1
- package/dist/lean.js +1 -1
- package/dist/lean.js.map +1 -1
- package/dist/lexical.cjs +1 -1
- package/dist/lexical.cjs.map +1 -1
- package/dist/lexical.js +1 -1
- package/dist/lexical.js.map +1 -1
- package/dist/plugins.cjs +1 -1
- package/dist/plugins.cjs.map +1 -1
- package/dist/plugins.js +1 -1
- package/dist/plugins.js.map +1 -1
- package/dist/server.cjs +1 -1
- package/dist/server.cjs.map +1 -1
- package/dist/server.d.cts +4 -2
- package/dist/server.d.ts +4 -2
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/structural.cjs +2 -2
- package/dist/structural.cjs.map +1 -1
- package/dist/structural.js +1 -1
- package/dist/structural.js.map +1 -1
- package/package.json +6 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var e=/[\t\n\f\r ]+/;function t(e,t){const n=e.charCodeAt(t);return 9===n||10===n||12===n||13===n||32===n}function n(e){let n=0,i=e.length;for(;n<i&&t(e,n);)n+=1;for(;i>n&&t(e,i-1);)i-=1;return 0===n&&i===e.length?e:e.slice(n,i)}function i(e){return e.replace(/[A-Z]/g,e=>e.toLowerCase())}function buildFrameAncestors(e={}){const{self:t=!0,origins:n=[],allowNone:i=!1}=e,r=/* @__PURE__ */new Set,o=[];if(i&&!t&&0===n.length)return"'none'";t&&(o.push("'self'"),r.add("'self'"));for(const e of n){const t=e.trim();0===t.length||r.has(t)||(r.add(t),o.push(t))}return o.length>0?o.join(" "):"'none'"}function r(t,r){const o=/* @__PURE__ */new Map;for(const r of t.split(";")){const t=n(r);if(0===t.length)continue;const l=t.search(e),a=i(l<0?t:t.slice(0,l));if(o.has(a))continue;const s=l<0?"":n(t.slice(l));o.set(a,s)}for(const[t,n]of Object.entries(r)){const r=i(t),l="string"==typeof n?{value:n}:n,a=l.mode??"union",s=o.get(r);if("replace"===a||void 0===s||0===s.length){o.set(r,l.value);continue}const u=/* @__PURE__ */new Set,d=[];for(const t of[...s.split(e),...l.value.split(e)])0===t.length||u.has(t)||(u.add(t),d.push(t));const c=d.filter(e=>"'none'"!==e);o.set(r,(c.length>0?c:d).join(" "))}const l=[];for(const[e,t]of o)l.push(0===t.length?e:`${e} ${t}`);return l.join("; ")}function o(e){if("v1"!==e.defaults&&""!==(e.serverURL??"")&&null==e.mergeDepth)throw new Error("payload-live-preview: `serverURL` needs an explicit `mergeDepth` under the 2.0 defaults — choose the population depth deliberately (0 for none), or pass `defaults: 'v1'` to keep the 1.x default of 1 while migrating (ADR 0007, entry 10).")}function l(){try{const e=globalThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}function a(e,t){if(!l())return;const n=globalThis,i=n.__payloadLivePreviewDeprecationsWarned??=/* @__PURE__ */new Set;if(!i.has(e)){i.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}function s(e){"v1"===e.defaults&&a("defaults-v1","`defaults: 'v1'` is removed in 3.0: `pll migrate` writes the 1.x rows it stands for into your options, where they keep working (ADR 0026)."),void 0!==e.onUnboundChange&&a("on-unbound-change","`onUnboundChange` is removed in 3.0: name it `onUnfaithfulPatch`, where 'route' is 'escalate'; `pll migrate` renames it (ADR 0026).")}var u=Object.freeze({strict:!0,previewSignals:Object.freeze(["query"])}),d=Object.freeze({disableReferrerDetection:!0,eventSourcePolicy:"parent-or-opener",skipUnchanged:!0,sanitizerPolicy:"strict"}),c=Object.freeze({strict:!1,previewSignals:Object.freeze(["query","fetch-dest","referer"])}),f=Object.freeze({disableReferrerDetection:!1,eventSourcePolicy:"any",skipUnchanged:!1,sanitizerPolicy:"compat"}),h=/* @__PURE__ */['(()=>{function e(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then&&(Promise.resolve(e).catch(()=>{}),!0)}function t(t){return(...i)=>{try{e(t(...i))}catch{}}}function i(){}function n(e){switch(typeof e){case"string":return e.length>65536?void 0:`s:${e}`;case"number":return`n:${Object.is(e,-0)?"-0":String(e)}`;case"boolean":return"b:"+(e?"1":"0");case"bigint":return`i:${String(e)}`;case"undefined":return"u";case"object":{if(null===e)return"z";let t;try{t=JSON.stringify(e)}catch{return}return t.length>65536?void 0:`o:${t}`}case"symbol":case"function":return}}function r(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function l(e,t,i,r,l){let o=e.onUnfaithfulPatch,a=t.reportedUnfaithful.get(i.element),s=n(l),u=Date.now(),d=void 0!==a&&("escalate"!==o||void 0===s||s===a.identity||u-a.at<Mn);if((d||"escalate"!==o)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:i.fieldName}),!d){if(t.reportedUnfaithful.set(i.element,{identity:s,at:u}),void 0===a){if(t.unfaithfulCount+=1,t.unfaithfulFields.add(i.fieldName),"ignore"===o)return;if("warn"===o){e.warn(`[live-preview] LP0411: "${i.fieldName}" ${r}`);return}}e.log("LP0411",i.fieldName,r),t.unfaithfulPatches.push(i)}}function o(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}function a(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function s(e){let t=e.trim();return JSON.stringify(t.length>On?`${t.slice(0,On)}\\u2026`:t)}function u(){return function(){if(typ','eof document>"u")return;let e=document.documentElement.getAttribute("lang");return null===e||0===e.length?void 0:e}()??function(){if(typeof navigator>"u")return;let e=navigator.language;return"string"==typeof e&&e.length>0?e:void 0}()??"en"}function d(e){null!==e.timer&&(clearTimeout(e.timer),e.timer=null),e.messageNode?.remove(),e.messageNode=null}function c(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function h(e,t,i){if(c(t),i>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function f(e){try{return p(e,{nodes:0,active:new WeakSet},0)}catch{return[]}}function p(e,t,i){if(!Array.isArray(e))return[];h(e,t,i);let n=[];for(let r of e){let e=g(r,t,i);e&&n.push(e)}return t.active.delete(e),n}function g(e,t,i){if(c(t),"object"!=typeof e||null===e)return;let n=e,r=n.name,l=n.type;if("string"!=typeof r||0===r.length||"string"!=typeof l||0===l.length)return;let o=p(n.fields,t,i+1),a=function(e,t,i){if("object"==typeof e&&null!==e&&!Array.isArray(e)){h(e,t,i);let n=[];for(let r in e){if(!Object.hasOwn(e,r))continue;c(t);let l=Reflect.get(e,r);"object"!=typeof l||null===l||["__proto__","constructor","prototype"].includes(r)||n.push({...l,slug:r,fields:p(l.fields,t,i+1)})}return t.active.delete(e),n}if(!Array.isArray(e))return[];h(e,t,i);let n=[];for(let r of e){if(c(t),"object"!=typeof r||null===r)continue;let e=r,l=e.slug;if("string"!=typeof l||0===l.length)continue;let o=p(e.fields,t,i+1);n.push({...e,slug:l,fields:o})}return t.active.delete(e),n}(n.blocks,t,i+1),s={...n,name:r,type:l},u=n.relationTo;if(Array.isArray(u)){let e=[];for(let i of u)c(t),e.push(i);s.relationTo=e}return o.length>0?s.fields=o:delete s.fields,a.length>0?s.blocks=a:delete s.blocks,s}function m(e,t){return void 0===e||t(e)}function v(e,t){return null==e||t(e)}function y(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function b(e,t=[]){let i="number"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0,n=Math.min(4,i??1),r=new Set(t),l=new Set;for(let e of jn)(n>=In[e].since||r.has(e))&&l.add(e);return{ours:4,...void 0!==i?{theirs:i}:{theirs:void 0},negotiated:n,capabilities:l,observed:r}}function w(e,t){return e.generation===t.generation&&e.revision===t.revision}function S(e){return function(e){if(!1===e.enableA11y)return null;let t=e.root,i=void 0===t?void 0:function(e){return 9===e.nodeType}(t)?t:t.ownerDocument;return new Pn(e.a11yLocale,i)}(e)}function A(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),Dn.sendReady(t,e)}function k(e,t,i,n){for(let r of e){if(Wn.has(r.type)){let e=r.fields;e&&k(e,n&&"tabs"===r.type?""===t?r.name:`${t}.${r.name}`:t,i,n);continue}let e=""===t?r.name:`${t}.${r.name}`;if(i.set(e,r),"group"===r.type)r.fields&&k(r.fields,e,i,n);else if("array"===r.type&&r.fields)k(r.fields,`${e}.*`,i,n);else if("blocks"===r.type&&r.blocks)for(let t of r.blocks)k(t.fields,`${e}.*.${t.slug}`,i,n)}}function T(e,t){if(e.has(t))return e.get(t);let i=t.replace(/\\.\\d+(?=\\.|$)/g,".*");return e.has(i)?e.get(i):void 0}function C(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?t:void 0}function R(e){if("object"!=typeof e||null===e)return;let t=e.blockType;return"string"==typeof t?t:void 0}function $(e,t){return t.every(e=>void 0!==C(e))?function(e,t){let i=[],n=new Map;for(let t=0;t<e.length;t+=1){let i=C(e[t]);void 0!==i&&n.set(i,t)}let r=new Set;for(let l=0;l<t.length;l+=1){let o=t[l],a=C(o);if(void 0===a){i.push({kind:"insert",index:l,value:o});continue}let s=n.get(a);if(void 0===s){i.push({kind:"insert",index:l,value:o});continue}r.add(s);let u=e[s];R(u)===R(o)?(s!==l&&i.push({kind:"move",from:s,to:l,value:o}),F(u,o)||i.push({kind:"update",index:l,value:o})):i.push({kind:"replace",index:l,oldValue:u,value:o})}for(let t=0;t<e.length;t+=1)r.has(t)||i.push({kind:"remove",index:t,value:e[t]});return i}(e,t):function(e,t){let i=[],n=Math.min(e.length,t.length);for(let r=0;r<n;r+=1)F(e[r],t[r])||i.push({kind:"update",index:r,value:t[r]});if(t.length>e.length)for(let n=e.length;n<t.length;n+=1)i.push({kind:"insert",index:n,value:t[n]});if(e.length>t.length)for(let n=t.length;n<e.length;n+=1)i.push({kind:"remove",index:n,value:e[n]});return i}(e,t)}function F(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;let i=e,n=t,r=Object.keys(i),l=Object.keys(n);if(r.length!==l.length)return!1;for(let e of r)if(!Object.is(i[e],n[e]))return!1;return!0}function N(e){if("string"!=typeof e)return!1;let t=e.trim().replace(qn,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?")||Vn.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return _n.has(e.protocol)}catch{return zn.test(t)&&!function(e){let t=Gn.exec(e.replace(Hn,""))?.[1];return void 0!==t&&!_n.has(`${t.toLowerCase()}:`)}(t)}}function M(e){let t=e.trim().replace(qn,"");return/^https?:\\/\\//i.test(t)||Vn.test(t)}function E(e){return!e.startsWith("on")&&!Kn.has(e)}function O(e){return Xn.add(e),e}function x(){return!0}function L(e,t,i,n=!1){if(n&&void 0!==i){let n=P(e,`${t}_${i}`);if(void 0!==n)return n}let r=P(e,t);if(void 0!==r)return r;if(t.includes(".")){let i=e,n=!0;for(let e of t.split(".")){if(Zn.has(e)||null===i||"object"!=typeof i){n=!1;break}if(i=P(i,e),void 0===i){n=!1;break}}if(n)return i}return void 0===i?void 0:P(e,`${t}_${i}`)}function P(e,t){if(!Zn.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function U(e,t,i,n){return L(e,i,t.locale??n,void 0!==t.locale)}function I(e,t,i,r){let l=n(t);if(void 0===l)return;let o=[e.hrefField,e.srcField,e.altField],a=JSON.stringify([e.format,e.locale??r])+l;for(let t of o){if(void 0===t||0===t.length)continue;let l=n(U(i,e,t,r));if(void 0===l)return;a+=`|${t}=${l}`}return a}function j(e){return e.closest(`[${Yn}]`)}function D(e,t,i){let n=new Set(t);return{boundaries:t,strategy:e,ownerKeys:i,covers:e=>void 0!==e.fragmentBoundary&&n.has(e.fragmentBoundary)}}function W(e){let t=e.getAttribute(tr);return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==j(e)?"fragment":null!==e.closest("head")?"route":"patch"}function B(e){return`global:${e}`}function _(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function z(e){return"string"==typeof e&&e.length>0}function V(e,t){return null!==t&&void 0!==e&&t.includes(e)}function q(e){let t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function H(e){return"object"==typeof e&&null!==e}function G(e){return Array.isArray(e)?"array":H(e)?"object":"scalar"}function K(e,t){return H(e)?e[t]:void 0}function J(e,t){return("string"==typeof t||"number"==typeof t)&&H(e)&&!Array.isArray(e)&&e.id===t}function X(e,t){if(!H(e)||!H(t))return J(e,t)||J(t,e)||n(e)===n(t);if(Array.isArray(e)!==Array.isArray(t))return!1;let i=Object.keys(t);return i.length===Object.keys(e).length&&i.every(i=>Object.hasOwn(e,i)&&X(K(e,i),K(t,i)))}function Q(e,t){let i=n(t),r=n(e);return!!(void 0!==i&&i===r||J(e,t)||J(t,e))||void 0!==i&&void 0!==r&&X(e,t)}function Z(e,t,i){let n=t,r=i;for(let t of e.split("."))n=K(n,t),r=K(r,t);return!Q(n,r)}function Y(e,t,i,n){let r=[],l=0,o=(e,t,i,a)=>{if(l+=1,n.covers(e)||Q(t,i))return;if(!((void 0===t||G(t)===G(i))&&H(i)&&n.reachesBelow(e)&&a<ir)){r.push({path:e,value:i});return}let s=function(e,t){let i=new Set(Object.keys(t));if(H(e))for(let t of Object.keys(e))i.add(t);return[...i]}(t,i);0===s.length&&r.push({path:e,value:i});for(let n of s){if(l>=nr){r.push({path:e,value:i});return}o(`${e}.${n}`,K(t,n),K(i,n),a+1)}};return o(e,t,i,0),r}function ee(e,t,i={}){let n=e=>!1===t||V(e,t),r=[];for(let[t,i]of e.entries())i.some(e=>n(e.owner))&&r.push(t);let l=e.rendered.filter(e=>void 0!==i[e.strategy]);return function(e,t){let i=new Set(e),n=[...t],r=(e,t)=>{let i=`${t}.`;for(let t of e)if(t.startsWith(i))return!0;return!1};return{covers:e=>i.has(e)||n.some(t=>t===e||e.startsWith(`${t}.`)),reachesBelow:e=>r(i,e)||r(n,e)}}(r,[...e.covers,...l].filter(e=>n(e.owner)).flatMap(e=>e.paths))}function te(e,t){if(void 0===t||0===t.length)return e;let i=`_${t}`;return e.endsWith(i)?e.slice(0,-i.length):e}function ie(e,t,i,n=ee(e,i)){let r,l=n.covers,o=n.reachesBelow;return n=>{let a=te(n,t);return l(n)||a!==n&&l(a)||(r??(r=function(e,t){let i=new Set;for(let[n,r]of e.entries())for(let e of r)!1!==t&&!V(e.owner,t)||void 0!==e.locale&&i.add(`${n}_${e.locale}`);return i}(e,i)),r.has(n))?"whole":o(n)||a!==n&&o(a)?"below":"none"}}function ne(e,t,i,n,r){return oe(i)?!oe(t)||function(e,t,i){let n=void 0===i?void 0:T(i,e);return void 0!==n&&!lr.has(n.type)||!0===t.get(e)?.some(re)||function(e,t){let i=`${t}.`;for(let[t,n]of e.entries())if(t.startsWith(i))return!0;return!1}(t,e)}(e,n,r)?"keep":null==t?"ask":"own":"ask"}function re(e){return!lr.has(e.fieldType)}function le(e){let t=[e],i=new Set;for(let e=t.pop();void 0!==e;e=t.pop()){if("object"!=typeof e||null===e||i.has(e))continue;i.add(e);let{type:n,fields:r,children:l}=e;if(!or.has(n)||"internal"===r?.linkType)return!0;if(Array.isArray(l))for(let e of l)t.push(e)}return!1}function oe(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function ae(e){return!0===e?.includes(".")}function se(e,t){let i=t.globalSlug??t.collectionSlug;if("string"!=typeof i||e.entitySlug!==i)return!0;let n=q(e),r=q(t.data??{});return void 0!==n&&void 0!==r&&n!==r}function ue(e){return null!==e&&e.forceRender&&!e.completed}function de(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ce(e,t){let i=t.element.ownerDocument.defaultView;return null===i?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,i)}function he(e){let t=e.getAttribute(er);return{kind:"fragment",id:e.getAttribute(Yn)??"",key:null===t||0===t.length?void 0:t,code:"LP0801"}}function fe(e){if("object"!=typeof e||null===e||!("root"in e))return!1;let t=e.root;return"object"==typeof t&&null!==t&&Array.isArray(t.children)}function pe(e){return!!fe(e)&&e.root.children.every(e=>{let{type:t,children:i}=e??{};return"paragraph"===t&&(!Array.isArray(i)||0===i.length)})}function ge(e){if(null==e)return[];let t=new Set,i=[];for(let n of e.split(/[\\s,]+/)){let e=n.trim();0===e.length||t.has(e)||(t.add(e),i.push(e))}return i}function me(...e){let t=new Map;for(let i of e)for(let[e,n]of Object.entries(i)){let i=t.get(e);void 0===i&&(i=new Set,t.set(e,i));for(let e of n)i.add(e)}let i={};for(let[e,n]of t)i[e]=[...n];return i}function ve(e,t){let i={};for(let n of t)n!==e&&(i[n]=[e]);return i}function ye(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(Ar)||we(e)||e.hasAttribute(Sr))return!0;let t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function be(e){return"patch"===e.getAttribute(br)}function we(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(br)}(e)&&!be(e)}function Se(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}function Ae(e){return"astro-island"===e.tagName.toLowerCase()}function ke(e){let t="";for(let i of e.querySelectorAll("astro-slot, template[data-astro-template]"))i.parentElement?.closest("astro-island")===e&&(t+=`${i.getAttribute("name")??i.getAttribute("data-astro-template")??""}\\0${i.innerHTML}\\0`);return t}function Te(e,t){if(!Ae(e)||!Ae(t))return!0;let i=ke(t);if(!kr.every(i=>e.getAttribute(i)===t.getAttribute(i))||(Tr.get(e)??ke(e))!==i||e.getAttribute("props")!==t.getAttribute("props")&&!function(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return void 0!==t&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}(e))return Tr.set(t,i),!1;Tr.set(e,i);let n=t.getAttribute("props");return n!==e.getAttribute("props")&&(e.setAttribute("ssr",""),null===n?e.removeAttribute("props"):e.setAttribute("props",n)),!0}function Ce(e){return Array.from(e.querySelectorAll("astro-island"))}function Re(e){let t=e.ownerDocument.defaultView;if(void 0===t?.customElements.get("astro-island"))return"element";let i=e.getAttribute("client"),n=Reflect.get(t,"Astro");return null===i||"object"!=typeof n||null===n||void 0===Reflect.get(n,i)?"directive":void 0}function $e(e){let t=e.closest(Kr)?.getAttribute(Wr);return null==t||0===t.length?void 0:t}function Fe(e){return Qr.has(e)||Xr.test(e)}function Ne(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}function Me(e){let t=e.getAttribute($r);if(null!==t&&Fe(t))return t;if(e.hasAttribute(Ur))return"richText";if(e.hasAttribute(Ir))return"html";if(e.hasAttribute(Dr))return"structural-array";if(e.hasAttribute(jr))return"array";if("IMG"===e.tagName)return"image";if("A"===e.tagName)return"url";if("TIME"===e.tagName)return"date";if("INPUT"===e.tagName){let t=e.type;if("checkbox"===t)return"checkbox";if("number"===t)return"number";if("date"===t||"datetime-local"===t)return"date"}return"text"}function Ee(){return!0}function Oe(){throw new Error("invalid or oversized legacy population")}function xe(e){for(let t=0;t<e.length;t+=1){let i=e.charCodeAt(t);if(i<=31||127===i)return!0}return!1}function Le(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e||e.includes("/")||e.includes("\\\\")||xe(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function Pe(e){return Le(e,128)&&!/[?#%]/u.test(e)&&!al.has(e)}function Ue(e){return Number.isFinite(e)?String(e):Le(e,512)?e:Oe()}function Ie(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function je(e,t,i){Object.defineProperty(e,t,{value:i,writable:!0,configurable:!0,enumerable:!0})}function De(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function We(e){let t=new WeakSet,i=0,n=0;return function e(r,l){if(++i>el||l>Yr)return Oe();if("string"==typeof r)return n+=r.length,n>rl&&Oe(),r;if(null==r||"boolean"==typeof r)return r;if("number"==typeof r)return Number.isFinite(r)?r:Oe();if(!Array.isArray(r)&&!y(r))return Oe();if(Array.isArray(r)){r.length>el&&Oe();for(let e=0;e<r.length;e+=1)Object.hasOwn(r,e)||Oe()}if(t.has(r))return Oe();t.add(r);let o=Array.isArray(r)?[]:{};for(let t of Object.keys(r))je(o,t,e(Reflect.get(r,t),l+1));return t.delete(r),o}(e,0)}function Be(e,t,i,n,r,l){function o(e,t,i,n){if(null==n||""===n)return;let l=y(n)?Ie(n,"id"):n,o=Ue(l);if(0===r){je(e,t,l);return}let a=JSON.stringify([i,o]);c.add(a),c.size>tl&&Oe();let s=d.get(i)??[];s.push({owner:e,key:t,id:o}),d.set(i,s)}function a(e,t,i){void 0!==i.hasMany&&"boolean"!=typeof i.hasMany&&Oe();let n=i.relationTo,r=Ie(e,t);if(Array.isArray(n)){0===n.length&&Oe();let e,t=y(r)?Ie(r,"relationTo"):void 0;for(let i of n)p(0),Pe(i)||Oe(),i===t&&(e=i);if(null==r||""===r)return;(!y(r)||void 0===e)&&Oe(),o(r,"value",e,Ie(r,"value"))}else Pe(n)||Oe(),o(e,t,n,r)}function s(e,t){if(p(t),Array.isArray(e)||y(e)){if(y(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){let t=Ie(e,"relationTo");Pe(t)||Oe(),o(e,"value",t,Ie(e,"value"));return}for(let i of Object.keys(e))s(Reflect.get(e,i),t+1)}}if(!Number.isSafeInteger(r)||r<0||r>Yr)return Oe();void 0!==l&&("string"!=typeof l||l.length>128||xe(l))&&Oe();let u=We(e);if(!y(u))return Oe();let d=new Map,c=new Set,h=0,f=new WeakSet,p=e=>{(++h>el||e>Yr)&&Oe()};(function e(t,i,n){p(n),f.has(t)&&Oe(),f.add(t);for(let r of t){p(n),(!y(r)||!Le(r.name,512)||al.has(r.name))&&Oe();let t=Ie(i,r.name);if("relationship"===r.type||"upload"===r.type)if(r.hasMany)if(null!=t&&!Array.isArray(t)&&Oe(),Array.isArray(t))for(let e=0;e<t.length;e+=1)a(t,e,r);else a(i,r.name,r);else a(i,r.name,r);else if("group"===r.type||"tabs"===r.type)null!=t&&!y(t)&&Oe(),y(t)&&r.fields&&e(r.fields,t,n+1);else if("row"===r.type||"collapsible"===r.type)r.fields&&e(r.fields,i,n+1);else if("array"===r.type||"blocks"===r.type){if(0===t?je(i,r.name,[]):null!=t&&!Array.isArray(t)&&Oe(),Array.isArray(t))for(let i of t)if(y(i)||Oe(),"array"===r.type&&r.fields)e(r.fields,i,n+1);else if("blocks"===r.type){let t=Ie(i,"blockType"),l=r.blocks?.find(e=>(p(n),e.slug===t));void 0===l&&Oe(),e(l.fields,i,n+1)}}else"richText"===r.type&&s(t,n+1)}f.delete(t)})(t,u,0),d.size>25&&Oe();let g=[];if(0===d.size)return{doc:u,requests:g};let m=new URL(i);(!["http:","https:"].includes(m.protocol)||m.username||m.password||m.search||m.hash)&&Oe(),(!n.startsWith("/")||n.includes("\\\\")||/[%?#]/u.test(n)||xe(n))&&Oe(),n.split("/").some(e=>"."===e||".."===e)&&Oe();let v=`${De(i)}${De(n)}/`;for(let[e,t]of d){let i=[...new Set(t.map(e=>e.id))],n=0;for(;n<i.length;){let o=i[n];void 0===o&&Oe();let a=o.includes(","),s=[],u="";for(;n<i.length&&s.length<ol;){let t=i[n];if(void 0===t||s.length>0&&(a||t.includes(",")))break;let o=[...s,t],d=new URLSearchParams({depth:String(r),limit:String(o.length)});void 0!==l&&d.set("locale",l),d.set(a?"where[id][equals]":"where[id][in]",a?t:o.join(","));let c=`${v}${encodeURIComponent(e)}?${d}`;if(c.length>nl){0===s.length&&Oe();break}new URL(c).origin!==m.origin&&Oe(),s.push(t),n+=1,u=c}(0===s.length||g.length>=il)&&Oe();let d=new Set(s);g.push({url:u,ids:d,slots:t.filter(e=>d.has(e.id))})}}return{doc:u,requests:g}}async function _e(e,t,i){let n,r,l=!1,o=!1,a=Symbol(),s=new Promise(e=>{r=()=>{e(a)}}),u=()=>{(!i()||t.aborted)&&Oe()},d=()=>{if(void 0!==n&&!l){l=!0;try{Promise.resolve(n.cancel()).catch(()=>{})}catch{}}},c=()=>{r?.(),d()};t.addEventListener("abort",c,{once:!0});try{u();let t=e.body??null;if(u(),null===t){let t=e.json.bind(e);u();let i=await Promise.race([Promise.resolve().then(()=>(u(),t())),s]);return u(),i===a&&Oe(),i}let i=t.getReader.bind(t);u();let r=i();n=r,u();let l=[],d=0,c=0;for(;;){let e=Promise.resolve().then(()=>{u();let e=r.read.bind(r);return u(),e()}),t=await Promise.race([e,s]);if(u(),t===a&&Oe(),t.done)break;d+=t.value.byteLength,(++c>ll||d>rl)&&Oe(),l.push(t.value)}o=!0;let h=new Uint8Array(d),f=0;for(let e of l)h.set(e,f),f+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(h))}catch{return Oe()}}finally{t.removeEventListener("abort",c),o||d();try{n?.releaseLock()}catch{}}}function ze(e,t){let i=We(t);y(i)||Oe();let n=Ie(i,"docs");(!Array.isArray(n)||n.length>ol)&&Oe();let r=new Map;for(let t of n){y(t)||Oe();let i=Ue(Ie(t,"id"));(!e.ids.has(i)||r.has(i))&&Oe(),r.set(i,t)}r.size!==e.ids.size&&Oe();for(let t of e.slots)je(t.owner,t.key,r.get(t.id))}function Ve(e,t){return e.length>0&&e.length<=t&&"."!==e&&".."!==e&&!e.includes("/")&&!e.includes("\\\\")&&!function(e){for(let t of e){let e=t.codePointAt(0)??0;if(e<=31||127===e)return!0}return!1}(e)}function qe(e){return Ve(e,128)&&!e.includes("?")&&!e.includes("#")}function He(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Ve(e,512)}function Ge(e){return e.has("schema-json")?dl:e.has("document-events")||e.has("relationship-events")?cl:hl}function Ke(e){if("attributes"!==e.type||e.attributeName!==fl||e.target.nodeType!==pl)return null;let t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(fl)?null:t}function Je(e){if(e.nodeType!==pl)return!1;let t=e;return t.matches(ml)||null!==t.querySelector(ml)}function Xe(){if(typ','eof window>"u")return;let e=window;return e[Tl]??(e[Tl]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function Qe(){let e=Xe();if(void 0===e||e.armed)return;e.armed=!0;let t=window,i=t.__REACT_DEVTOOLS_GLOBAL_HOOK__??(t.__REACT_DEVTOOLS_GLOBAL_HOOK__=function(){let e=new Map;return{supportsFiber:!0,renderers:e,inject:t=>{let i=e.size+1;return e.set(i,t),i}}}()),n=i.onCommitFiberRoot;i.onCommitFiberRoot=function(t,i,...r){try{n?.call(this,t,i,...r)}catch{}void 0===e.onCommit?e.commits.push(i):e.onCommit(i)}}function Ze(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function Ye(e,t){let i=e.waiters.indexOf(t);i>=0&&e.waiters.splice(i,1)}function et(e,t,i){if(e.committed)return null;let n=null,r=()=>{null!==n&&clearTimeout(n),n=null,t("committed")};return e.waiters.push(r),n=setTimeout(()=>{n=null,Ye(e,r),t("timed-out")},i),()=>{null!==n&&clearTimeout(n),n=null,Ye(e,r)}}function tt(){if(typ','eof window>"u")return;let e=window;return e[$l]??(e[$l]={armed:!1,committed:!1,waiters:[]})}function it(e){return Object.prototype.hasOwnProperty.call(e,Rl)?e[Rl]:void 0}function nt(){let e=tt();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,Rl)&&Object.defineProperty(t,Rl,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,Rl,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=tt();void 0===t||t.committed||null===this.querySelector(Cl)||function(e,t){let i=t?.$nuxt;!0!==i?.isHydrating||"function"!=typeof i.hook?Ze(e):i.hook(Fl,()=>{e.committed||Ze(e)})}(t,e)}})}function rt(e){let t=e.hydration;if(void 0===t){e.startNow();return}let i=Nl[t](e.root,i=>{e.later(()=>{lt(e,t,i)})});null!==i?(e.defer(i),e.hydrated("waiting")):lt(e,t,"committed")}function lt(e,t,i){e.hydrated(i),"timed-out"===i&&e.warn(`[live-preview] LP0607: no ${Ml[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function ot(e){return 9===e.nodeType}function at(e){return e.body}function st(e,t=Ll){if("string"!=typeof e)return!1;let i=e.trim();return!(i.length<t||Ul.test(i)||Pl.has(i.toLowerCase())||Il.test(i)||jl.test(i))}function ut(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function dt(e,t,i=Ll){let n=new Map,r=(e,t,i)=>{n.set(e,n.has(e)?null:{field:t,media:i})};for(let[n,l]of Object.entries(e)){if(rr.has(n))continue;let e=te(n,t);if(st(l,i))r(l.trim(),e,!1);else if(ut(l))if("string"==typeof l.url)r(l.url,e,!0);else if(!("id"in l)&&!("_id"in l))for(let[t,n]of Object.entries(l))rr.has(t)||!st(n,i)||r(n.trim(),`${e}.${t}`,!1)}return n}function ct(e){if(e.namespaceURI!==Wl||Dl.has(e.tagName)||e.hasAttribute(Rr)||e.hasAttribute(xl)||e.hasAttribute(Sr)||we(e))return!0;let t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function ht(e){let t;for(let i=e.firstChild;null!==i;i=i.nextSibling){if(1===i.nodeType)return;if(3!==i.nodeType)continue;let e=i.data.trim();if(0!==e.length){if(void 0!==t)return;t=e}}return t}function ft(e){return E(e)&&!e.startsWith("data-payload-")&&"value"!==e}function pt(e,t,i){let n=e.byElement.get(t);void 0===n&&(n={attributes:new Map},e.byElement.set(t,n));let r=e.byField.get(i.field);return void 0===r&&(r=new Set,e.byField.set(i.field,r)),r.add(t),n}function gt(e,t){for(let i=e.firstElementChild;null!==i;i=i.nextElementSibling){if(ct(i))continue;let e=ht(i),n=void 0===e?void 0:t.values.get(e);null!=n&&!n.media&&(pt(t,i,n).text=n.field);for(let e of i.getAttributeNames()){if(!ft(e))continue;let n=t.values.get(i.getAttribute(e)??"");null!=n&&(n.media&&("IMG"!==i.tagName||"src"!==e)||pt(t,i,n).attributes.set(e,n))}gt(i,t)}}function mt(e,t,i){let n=e.tagName;if(void 0!==t){let r={[Rr]:t};if("A"===n){let e=i.get("href");void 0===e?r[$r]="text":e!==t&&(r[Nr]=e)}return{element:e,fieldName:t,matched:ht(e)??"",stamps:r}}if("IMG"===n){let t=i.get("src");if(void 0!==t){let n=i.get("alt");return{element:e,fieldName:t,matched:e.getAttribute("src")??"",attribute:"src",stamps:{[Rr]:t,...void 0!==n&&n!==t?{[Er]:n}:{}}}}}let r=i.entries().next();if(r.done)return;let[l,o]=r.value;return{element:e,fieldName:o,matched:e.getAttribute(l)??"",attribute:l,stamps:{[Rr]:o,[Fr]:l}}}function vt(e,t){let i={values:t,byElement:new Map,byField:new Map};t.size>0&&!ct(e)&>(e,i);let n=e=>1===i.byField.get(e)?.size,r=[];for(let[e,t]of i.byElement){let i=void 0!==t.text&&n(t.text)?t.text:void 0,l=new Map;for(let[e,i]of t.attributes)n(i.field)&&l.set(e,i.field);let o=mt(e,i,l);void 0!==o&&r.push(o)}return r}function yt(e){return 9===e.nodeType?e.body:e}function bt(e,t){for(let i=t.length-1;i>=0;i-=1){let n=t[i];if(void 0!==n){n.observed&&e.observers.unobserveElement(n.element);for(let e=n.attributes.length-1;e>=0;e-=1){let t=n.attributes[e];if(void 0===t)continue;let{name:i,before:r,written:l}=t;r===l||n.element.getAttribute(i)!==l||(null===r?n.element.removeAttribute(i):n.element.setAttribute(i,r))}n.cacheTouched&&(n.element.hasAttribute(Rr)?e.cache.add(n.element):e.cache.remove(n.element))}}}function wt(e,t,i,n,r){let l=[],o=[],a=()=>(bt(e,o),[]);for(let s of t){if(!r())return a();let{element:t}=s;if(t.hasAttribute(Rr))continue;if(!r())return a();if(!1!==i&&!V($e(t),i))continue;if(!r())return a();let u={element:t,attributes:[],cacheTouched:!1,observed:!1};o.push(u);for(let[e,i]of[...Object.entries(s.stamps),[Vr,s.matched]]){let n=t.getAttribute(e);if(!r()||(u.attributes.push({name:e,before:n,written:i}),t.setAttribute(e,i),!r()))return a()}if(u.cacheTouched=!0,void 0!==e.cache.add(t)){if(!r()||(e.observers.observeElement(t),u.observed=!0,!r())||(e.log("autoBind",s.fieldName,"\\u2192",`<${t.tagName.toLowerCase()}>`,s.attribute??"text",JSON.stringify(s.matched),n),!r()))return a();l.push(s)}else bt(e,[u]),o.pop()}return l}function St(e,t,i,n){if(!e.scopeBindingsByOwner)return!1;let{message:r}=i,l=function(e){if(z(e.globalSlug))return[B(e.globalSlug)];if(!z(e.collectionSlug))return null;let t=_(e.collectionSlug);return z(e.documentId)?[t,_(e.collectionSlug,e.documentId)]:[t]}({globalSlug:"string"==typeof r.globalSlug?r.globalSlug:void 0,collectionSlug:"string"==typeof r.collectionSlug?r.collectionSlug:void 0,documentId:q(n)});return null===l&&!t.warnedUnattributableMessage&&(t.warnedUnattributableMessage=!0,e.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),l}function At(e,t,i,n,r){!function(e,t,i){let n=0;for(let r of e)if(!i()||(r.dispatchEvent(new CustomEvent(yr,{detail:t,bubbles:!1})),n+=1,!i()))break}(i,{fields:t.fields,revision:e.revision.revision,receivedAt:e.receivedAt,locale:e.locale,displayed:r},n)}function kt(e,t,i,n,r){let{warned:l,warn:o}=e;if(l.has(i)||t(i))return;l.add(i);let a=`data-payload-field="${te(i,n)}"`;o(""!==r?`[live-preview] LP0203: field "${i}" has a value and no <\\u2026 ${a}> on this page; editing it changes nothing here. Expected where the page shows part of the document: inspect().fidelity.fields lists these, onUnfaithfulPatch decides whether a server render is asked for.`:`[live-preview] LP0201: no <\\u2026 ${a}> for the empty field "${i}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)}function Tt(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function Ct(e){return Array.isArray(e.docs)&&"boolean"==typeof e.hasNextPage}function Rt(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function $t(e){let t=function(){let e=function(){let e=globalThis,t=e[zl];if(void 0!==t)return t;let i={};return e[zl]=i,i}();if(void 0!==e.override)return e.override;if(void 0!==e.auto)return e.auto;let t=function(){let e=globalThis.trustedTypes;return"object"!=typeof e||null===e?void 0:"function"==typeof e.createPolicy?e:void 0}();try{e.auto=void 0===t?null:t.createPolicy(_l,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}function Ft(e,t){for(let i of t.keyAttributes){let t=e.getAttribute(i);if(null!==t&&t.length>0)return`${i}=${t}`}}function Nt(e,t,i){if(!Ot(e,t))return t;let n=i.boundary??ye,r=n(e),l=n(t);if(r||l)return r&&l&&(i.retainBoundary?.(e,t)??1)?e:t;let o=xt(e);return function(e,t){for(let i of Array.from(e.attributes))t.hasAttribute(i.name)||Vl.has(i.name.toLowerCase())||e.removeAttribute(i.name);for(let i of Array.from(t.attributes))e.getAttribute(i.name)!==i.value&&e.setAttribute(i.name,i.value)}(e,t),!0!==i.retainChildrenOf?.(e,t)&&function(e,t,i){let n=function(e,t){let i,n=new Map;for(let r of Array.from(e.children)){let e=Ft(r,t);if(void 0!==e){if(n.has(e)){i??(i=e.slice(e.indexOf("=")+1));continue}n.set(e,r)}}return void 0!==i&&t.onDuplicateKey?.(e,i),n}(e,i),r=new Set(n.values()),l=Array.from(e.childNodes).filter(e=>!r.has(e)),o=new Set,a=new Set,s=Array.from(t.childNodes),u=e.firstChild,d=0;for(let t=0;t<s.length;t+=1){let r=s[t],c=null,h=r instanceof Element?Ft(r,i):void 0;if(void 0!==h&&a.has(h)&&(h=void 0),void 0!==h){a.add(h);let e=n.get(h);if(void 0!==e&&!o.has(e)&&(c=Mt(e,r,i)===e?e:null,null===c)){e.replaceWith(r),o.add(r),u=r.nextSibling;continue}}else{for(;d<l.length;){let n=l[d];if(d+=1,!o.has(n)){if(Ot(n,r)){c=Mt(n,r,i)===n?n:null,null===c&&(e.replaceChild(r,n),o.add(r),u=r.nextSibling);break}if(n instanceof Element){let i=s[t+1];if(!(r instanceof Element)||void 0!==i&&Ot(n,i)){d-=1;break}e.replaceChild(r,n),o.add(r),u=r.nextSibling;break}if(!(r instanceof Element)){e.replaceChild(r,n),o.add(r),u=r.nextSibling;break}}}if(null===c&&o.has(r))continue}let f=c??r;for(o.add(f);null!==u&&u!==f&&!o.has(u)&&Et(u);)u=u.nextSibling;f!==u&&e.insertBefore(f,u),u=f.nextSibling}for(let t of Array.from(e.childNodes))o.has(t)||t.remove()}(e,t,i),Lt(o),e}function Mt(e,t,i){return e instanceof Element&&t instanceof Element?Nt(e,t,i):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function Et(e){return e.nodeType===Node.TEXT_NODE&&0===(e.nodeValue??"").trim().length}function Ot(e,t){return e.nodeType===t.nodeType&&(!(e instanceof Element&&t instanceof Element)||e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI)}function xt(e){let t=e.ownerDocument.activeElement;return t instanceof HTMLElement&&e.contains(t)?{element:t,selection:t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null}:null}function Lt(e){if(null===e)return;let{element:t,selection:i}=e;if(t.ownerDocument.activeElement!==t&&t.isConnected)try{t.focus({preventScroll:!0});let[e,n]=i??[null,null];null!==e&&null!==n&&t.setSelectionRange(e,n)}catch{}}function Pt(e){Hl.has(e)||(Hl.add(e),function(e){try{console.warn(e)}catch{}}(`[live-preview] LP0409: the strict sanitizer removed \\`${e}\\` from written markup; the 1.x default (\\`sanitizerPolicy: \'compat\'\\`) kept it. ${function(e){return e.startsWith(Gl)?"A binding inside CMS content is refused by design \\u2014 an editor could otherwise aim a write at any element on the page (docs/security.md)":"id"===e||"name"===e?"CMS content that can name an element can shadow a global of that name \\u2014 DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: \'compat\'` to keep every `data-*` as 1.x did"}(e)}.`))}function Ut(e,t){return It(e,void 0,t)}function It(e,t,i){let n=i?.document??Wt();if(!n)throw jt();if(""===e)return"";let r=function(e,t){let i=e?.policy??t??ao;if(!e){let e=new Map;for(let[t,i]of Object.entries(to))e.set(t,i);return{allowedTags:Kl,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:i,allowedData:new Set}}let n=new Set(Kl);if(e.additionalAllowedTags?.forEach(e=>n.add(e)),!0===e.allowFormControls)for(let e of Jl)n.add(e);let r=new Map;for(let[e,t]of Object.entries(to))r.set(e,t);for(let[t,i]of Object.entries(e.additionalAllowedAttributes??{})){let e=new Set(r.get(t));for(let t of i)e.add(t);r.set(t,e)}return{allowedTags:n,attrByTag:r,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:i,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(i,t),l=e;for(let e=0;e<no;e+=1){let e=n.createElement("template");e.innerHTML=$t(l);let t=e.content;Bt(t,r);let i=Dt(t);if(i===l)return i;l=i}return function(e,t){if(!function(){try{let e=glo','balThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;let i=globalThis,n=i[ql]??(i[ql]=new Set);if(!n.has(e)){n.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(no)} passes, so it returned an empty string (ADR 0016).`),""}function jt(){return new Error("sanitizeHtml needs a DOM")}function Dt(e){let t=e.ownerDocument?.createElement("div");if(void 0===t)throw jt();let i=e.firstChild;if(t.append(e),t.firstChild!==i)throw jt();return t.innerHTML}function Wt(){if(!(typ','eof document>"u"))return document}function Bt(e,t){for(let i of Array.from(e.childNodes))i.nodeType===ro?_t(i,t):i.nodeType===lo&&i.remove()}function _t(e,t){let i=e.tagName.toLowerCase();!Xl.has(i)||t.allowFormControls&&Jl.has(i)?t.allowedTags.has(i)?(function(e,t,i){let n=i.attrByTag.get(t);for(let t of Array.from(e.attributes)){let r=t.name.toLowerCase();if(r.startsWith("on")||"style"===r)e.removeAttribute(t.name);else if("is"!==r){if("strict"===i.mode){if(i.templateMode&&oo.has(r))continue;if("id"===r||"name"===r||r.startsWith(eo)){e.removeAttribute(t.name),("name"!==r||!0===n?.has(r))&&Pt(r);continue}if(r.startsWith(Yl)){i.allowedData.has(r)||(e.removeAttribute(t.name),Pt(r));continue}if(Ql.has(r)||r.startsWith(Zl))continue}else if(Ql.has(r)||r.startsWith(Zl)||r.startsWith(Yl))continue;n?.has(r)?(io.has(r)&&!N(t.value)||"srcset"===r&&!zt(t.value))&&e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,i,t),"a"===i&&function(e){let t=e.getAttribute("href");null===t||!M(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),Bt(e,t)):(Bt(e,t),e.replaceWith(...e.childNodes)):e.remove()}function zt(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[i=e]=e.split(/\\s/,1);if(!N(i)||!N(e))return!1}return!0}function Vt(e){return e.replace(uo,e=>so[e])}function qt(e){return e.replace(ho,e=>co[e])}function Ht(e){let t=new Set;for(let i of e)if("object"==typeof i&&null!==i)for(let e of Object.keys(i))t.add(e);return t}function Gt(e,t,i,n,r){let l="object"==typeof t&&null!==t?t:null;return e.replace(fo,(e,o)=>null!==l&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(l,o)?Vt(n(Reflect.get(l,o))):null===l&&"value"===o?Vt(n(t)):"index"===o?String(i):null!==l&&!0===r?.has(o)?"":e)}function Kt(e){let t=e.children,i=t[0];if(void 0===i)return[];let n=[];for(let{name:e,value:r}of Array.from(i.attributes)){if(!E(e)||e.startsWith(po))continue;let i=!0;for(let n=1;n<t.length&&i;n+=1)i=t[n]?.getAttribute(e)===r;i&&n.push([e,r])}return n}function Jt(e,t){for(let[i,n]of t)e.hasAttribute(i)||e.setAttribute(i,n)}function Xt(e){if(null==e)return"";if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e||"bigint"==typeof e)return String(e);try{return JSON.stringify(e)}catch{return""}}function Qt(e){return null==e||""===e}function Zt(e,t){let i=e.get(t);return void 0!==i&&(e.delete(t),e.set(t,i)),i}function Yt(e,t,i,n){return e.set(t,i),function(e,t){for(let i of e.keys()){if(e.size<=t)break;e.delete(i)}}(e,n),i}function ei(e){let t=Zt(bo,e);if(void 0!==t)return t;let i=new Set(go);for(let t of e.matchAll(vo)){let e=t[1]?.toLowerCase();void 0!==e&&i.add(e)}let n={};for(let e of i)n[e]=mo;let r={additionalAllowedTags:[...i],additionalAllowedAttributes:n,allowFormControls:!0,templateMode:!0};return Yt(bo,e,r,yo)}function ti(e){let t=ni(e.container,e.patches,e);return null===t?null:ri(t,e.store,{morph:e.morph??!0,onDuplicateKey:e.onDuplicateKey})}function ii(e,t){return t.hasAttribute(So)&&t.hasAttribute(Ao)}function ni(e,t,i){let n=function(e,t,i){let{template:n,nextItems:r,forceRender:l=!1,store:o,sanitizerPolicy:a}=i,s=o.get(e),u=Kt(e),d=Ht(r),c=Array.from(e.children),h=ci(c,wo),f=new Set,p=[];for(let o=0;o<r.length;o+=1){let g=r[o],m=di(g),v=void 0===m?c[o]??null:hi(h,m)??null;null!==v&&f.has(v)&&(v=null),null!==v&&f.add(v);let y=t.replaces.has(o),b=l||t.renders.has(o)||null===v?fi(e.ownerDocument,n,g,o,a,u,d):void 0;if(null===b)return null;let w=void 0===b?[]:li(y?null:v,b,g,void 0===m?void 0:s?.get(m),i);if(null===w)return null;p.push([o,v,b,w,y])}return p}(e,function(e){let t=new Set,i=new Set;for(let n of e)"insert"===n.kind||"update"===n.kind?t.add(n.index):"replace"===n.kind&&(t.add(n.index),i.add(n.index));return{renders:t,replaces:i}}(t),i);return null===n?null:[e,n,i.nextItems]}function ri(e,t,i){let[n,r,l]=e,o=new Set,a=!1,s=xt(n);for(let[e,l,s,u,d]of r){let r=l;if(void 0!==s){let e=!(!i.morph||d||null===l)&&Nt(l,s,{keyAttributes:[wo,So],boundary:ye,retainBoundary:Te,retainChildrenOf:ii,...void 0!==i.onDuplicateKey?{onDuplicateKey:i.onDuplicateKey}:{}})===l;if(!e)for(let[e,t]of u)null!==e&&(ai(e,t),t.replaceWith(e));for(let[,,e]of u)void 0!==e&&ri(e,t,i);e?a=!0:(null!==l&&(l.replaceWith(s),a=!0),r=s)}if(null===r)continue;let c=n.children[e]??null;r!==c&&(n.insertBefore(r,c),a=!0),o.add(r)}for(let e of Array.from(n.children))o.has(e)||(e.remove(),a=!0);Lt(s);let u=function(e,t){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}(n,t);u.clear();for(let e of l)ui(u,e);return a}function li(e,t,i,n,r){let l=ci(null===e?[]:oi(e),So),o=[];for(let e of oi(t)){let t=e.getAttribute(So);if(null===t)continue;let a,s=hi(l,t)??null,u=e.getAttribute(Ao),d=u?s:null,c=d?.getAttribute(Ao)??null;if(u){let l=si(i,t);if(void 0!==l||null!==d){let i=l??[],o=$(null===d?[]:si(n,t)??[],i),s=null!==d&&c!==u;if((o.length>0||s)&&(a=ni(d??e,o,{template:u,nextItems:i,forceRender:s,store:r.store,sanitizerPolicy:r.sanitizerPolicy})??void 0,void 0===a))return null}}o.push([d,e,a])}return o}function oi(e){return Array.from(e.querySelectorAll(`[${So}]`)).filter(t=>{let i=t.parentElement;for(;null!==i&&i!==e;){if(i.hasAttribute(So))return!1;i=i.parentElement}return i===e})}function ai(e,t){for(let i of Array.from(e.attributes))t.hasAttribute(i.name)||e.removeAttribute(i.name);for(let i of Array.from(t.attributes))e.getAttribute(i.name)!==i.value&&e.setAttribute(i.name,i.value)}function si(e,t){if("object"!=typeof e||null===e)return;let i=e[t];return Array.isArray(i)?i:void 0}function ui(e,t){let i=di(t);void 0!==i&&e.set(i,t)}function di(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function ci(e,t){let i=new Map;for(let n=e.length-1;n>=0;n-=1){let r=e[n];if(void 0===r)continue;let l=r.getAttribute(t);if(null===l)continue;let o=i.get(l);void 0===o?i.set(l,[r]):o.push(r)}return i}function hi(e,t){return e.get(t)?.pop()}function fi(e,t,i,n,r,l,o){let a=It(Gt(t,i,n,Xt,o),r,ei(t)),s=e.createElement("template");s.innerHTML=$t(a);let u=s.content.firstElementChild;if(!u)return null;Jt(u,l);let d=di(i);return void 0!==d&&u.setAttribute(wo,d),u}function pi(e,t,i){if(t.warnedEscalationUnavailable)return;t.warnedEscalationUnavailable=!0;let n=`[live-preview] LP0808: onUnfaithfulPatch: \'escalate\' has nowhere to go: ${String(i)} field(s) fell short`,r="or onUnfaithfulPatch: \'warn\' to keep the patch and say so.";e.warn(void 0===e.strategies.fragment?`${n} and no route or fragment strategy is configured. Set routeStrategy: true or fragments: { endpoint }, ${r}`:`${n}, not all of them inside a data-payload-fragment boundary of this document, and no route strategy is configured. Cover them with a boundary or add the route strategy, ${r}`)}function gi(e,t){return!1===t||V($e(e),t)}function mi(t,i,n,r,l){let o=t.transformValue;if(void 0===o)return n;try{let t=o(i.fieldName,n,{element:i.element,allFields:r},l),a=e(t);if(!l())return n;if(a)throw new TypeError(`Transform for "${i.fieldName}" returned a thenable; transforms must be synchronous`);return t}catch(e){if(!l())return n;let i=e instanceof Error?e:new Error(String(e));return t.emitter.emit("error",{error:i,context:"transform",code:"LP0602"}),n}}function vi(e){if(!0!==e.hidesWhenEmpty)return!1;let{element:t}=e;if(t.hasAttribute("hidden"))return!0;let i=t.getBoundingClientRect();return 0===i.width||0===i.height}function yi(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function bi(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!Eo.test(e.origin)?void 0:e.origin}catch{return}}function wi(e){let t=e.format;return"string"==typeof t&&jo.has(t)?t:"number"==typeof t?Io[t]:void 0}function Si(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function Ai(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function ki(e){let t=wi(e),i=Si(e),n=[];return void 0!==t&&n.push(`lp-align-${t}`),i>0&&n.push(`lp-indent-${String(i)}`),0===n.length?"":` class="${n.join(" ")}"`}function Ti(e){return"object"==typeof e&&null!==e?e:void 0}function Ci(e){return Ti(e)}function Ri(e,t){if(void 0===t||""===t||!e.startsWith("/"))return e;try{let i=new URL(t),n=new URL(e,i);return n.origin===i.origin?n.href:e}catch{return e}}function $i(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function Fi(e){return"string"==typeof e&&e.length>0?e:void 0}function Ni(e){let t=Fi(e.title)??Fi(e.name)??Fi(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}function Mi(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(let i of e.children)t+=Mi(i);return t}function Ei(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function Oi(e){return"string"==typeof e.mimeType?` type="${qt(e.mimeType)}"`:""}function xi(e){return _o.get(e)}function Li(e,t,i,n){let r=Ti(e.fields)??{},l="string"==typeof r.blockType?r.blockType:"",o=$i(l),a=""===o?n:`${n} ${n}--${o}`;if(""!==l){let e=xi(l)??xi(o);if(e)return e(r,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(l,a)}return`<${i} class="${a}"></${i}>`}function Pi(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function Ui(e){if("object"!=typeof e||null===e||!("root"in e))return!1;let t=e.root;return"object"==typeof t&&null!==t&&"children"in t&&Array.isArray(t.children)}function Ii(e,t){let i=function(e){return qo.get(e)??Vo[e]}(e.type);return i?i(e,t):void 0!==e.children?t.renderChildren(e.children):""}function ji(e){if("string"==typeof e.text)return e.text;if("linebreak"===e.type)return"\\n";if(void 0===e.children)return"";let t="";for(let i of e.children)t+=ji(i);return t}function Di(e="text"){let t=new WeakSet;return{name:e,render:O((e,i)=>{let n=e.element,r=function(e){return null==e?"":Ui(e)?function(e){return Ui(e)?e.root.children.map(ji).join("\\n").trim():""}(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(i);if("INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName){if(n.textContent.trim()!==r.trim()){if(function(e){return null!==e.querySelector(":scope > :not(br)")}(n)&&!n.hasAttribute(Go))return function(e,t,i){e.has(t)||(e.add(t),wn(`[live-preview] LP0402: Skipping text update for "${i}": <${t.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,n,e.fieldName),!1;if(r.includes("\\n")||r.includes("\\r")){n.innerHTML=$t(function(e){return Vt(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r));return}n.textContent=r}}else n.value=r})}}function Wi(e,t){let i=e.cloneNode(!1);i.innerHTML=$t(t);let n=function(e,t){let i=e.firstElementChild,n=1===t.children.length?t.firstElementChild:null;if(null!==i?.nextElementSibling||0===t.children.length||!Xo.has(i.tagName)||i.hasAttribute(Rr)||n?.tagName===i.tagName||!0===n?.matches(zo))return null;for(let e of t.children)if(e.tagName===i.tagName&&e.className===i.className)return null;return i}(e,i)??e,r=new Map,l=i.querySelectorAll(zo);if(l.length>0&&null!==n.firstElementChild){let e=[];Bi(n,i,e);for(let[t,i]of e)t.replaceWith(i),i.matches(zo)||r.set(t.className,!1);for(let e of l)null!==e.parentNode&&r.set(e.className,!0)}return n.replaceChildren(...i.childNodes),r}function Bi(e,t,i){let n=(e,t)=>{e.matches(zo)?i.push([e,t]):Bi(t,e,i)},r=e.firstElementChild,l=t.firstElementChild;if(e.children.length===t.children.length){for(;null!==r&&null!==l;r=r.nextElementSibling)n(l,r),l=l.nextElementSibling;return}let o=new Set;for(let e of t.children)e.matches(zo)||o.add(e.tagName);let a=(e,t)=>e.matches(zo)?!o.has(t.tagName):e.tagName===t.tagName,s=0;for(;null!==r&&null!==l&&a(l,r);s+=1)n(l,r),r=r.nextElementSibling,l=l.nextElementSibling;let u=Math.min(e.children.length,t.children.length);r=e.lastElementChild,l=t.lastElementChild;for(let e=s;e<u&&null!==r&&null!==l;e+=1){if(!a(l,r))return;n(l,r),r=r.previousElementSibling,l=l.previousElementSibling}}function _i(e,t,i,n){n&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${i}"`);let r=n?Jo:Ko;r.has(i)||(r.add(i),wn(`[live-preview] ${n?`LP0413: no renderer for block "${i}", and the markup the server rendered for it is lost.`:`LP0410: no renderer for block "${i}"; keeping what the server rendered for it.`} Register one with registerBlockRenderer().`))}function zi(e,t,i,n){if("string"!=typeof i||0===i.length)return{kind:"none"};let r=Ri(i,n);return N(r)?{kind:"safe",url:r}:(Yo.has(e)||(Yo.add(e),wn(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function Vi(e,t=e=>e){return{name:e,render(e,i,n){let r=e.element;if(Qt(i)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let l=Xt(i);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if("A"===r.tagName){let i=e.hrefField,o=void 0===i||0===i.length?t(l):L(n.allFields,i,n.locale,void 0!==e.locale),a=zi(r,e.fieldName,o);"safe"===a.kind?r.setAttribute("href",a.url):"unsafe"===a.kind&&r.removeAttribute("href")}r.textContent=l}else r.value=l}}}function qi(e){for(let t of na)e.removeAttribute(t)}function Hi(e,t,i,n){let r=function(e,t){let i=[];for(let[n,r]of Object.entries(e?.sizes??{})){if("string"!=typeof r.url||"number"!=typeof r.width)continue;let e=Ri(r.url,t);N(e)&&i.push({...r,name:n,url:e,width:r.width})}return i}(i,n),l=e.getAttribute("src"),o=r.find(t=>null!==l&&function(e,t,i){try{return new URL(t,e.baseURI).href===new URL(i,e.baseURI).href}catch{return t===i}}(e,t.url,l))??r.find(t=>t.name===ra.get(e));void 0===o?.name?ra.delete(e):ra.set(e,o.name),e.src=o?.url??t;let a=o??i,s=r.filter(e=>Gi(e,a));if(0===s.length){e.removeAttribute("srcset"),e.removeAttribute("sizes");return}if("number"==typeof i?.width&&"string"==typeof i.url){let e=Ri(i.url,n),t={...i,url:e,width:i.width};N(e)&&Gi(t,a)&&s.push(t)}let u=new Set,d=[];for(let e of s)u.has(e.width)||(u.add(e.width),d.push(`${Ki(e.url)} ${String(e.width)}w`));let c=d.join(", ");e.setAttribute("srcset",c)}function Gi(e,t){if(void 0===t)return!0;if("string"==typeof e.mimeType&&"string"==typeof t.mimeType&&e.mimeType!==t.mimeType)return!1;let{width:i,height:n}=t;return"number"!=typeof i||"number"!=typeof n||"number"!=typeof e.width||"number"!=typeof e.height||Math.abs(e.width*n-e.height*i)<=Math.max(i,e.width)}function Ki(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function Ji(e){"IMG"===e.tagName?qi(e):e.style.backgroundImage=""}function Xi(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):qi(e)}function Qi(e){let t=Ti(e);return void 0===t?Xt(e):Ni(t)??""}function Zi(e,t){let i=e??"";if(null==t)return i;let n=Yi(t);return"{}"===n?i:`${i}|${n}`}function Yi(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>Yi(e)).join(",")}]`;let t=e,i=Object.keys(t).sort(),n=[];for(let e of i){let i=t[e];void 0!==i&&n.push(`${JSON.stringify(e)}:${Yi(i)}`)}return`{${n.join(",")}}`}function en(e){return{kind:"date",options:e}}function tn(e){return{kind:"number",options:e}}function nn(e,t,i,n){if(void 0===t||""===t)return;let r=function(e){let t=e.indexOf(":"),i=-1===t?e:e.slice(0,t),n=-1===t?void 0:e.slice(t+1);switch(i){case"date":return void 0===n?en({dateStyle:"medium"}):pa.has(n)?en({dateStyle:n}):void 0;case"time":return void 0===n?en({timeStyle:"short"}):ga.has(n)?en({timeStyle:n}):void 0;case"datetime":return void 0===n?en({dateStyle:"medium",timeStyle:"short"}):pa.has(n)?en({dateStyle:n,timeStyle:"short"===n?"short":"medium"}):void 0;case"number":return void 0===n?tn({}):va.test(n)?tn({minimumFractionDigits:Number(n),maximumFractionDigits:Number(n)}):void 0;case"currency":return void 0!==n&&ma.test(n)?tn({style:"currency",currency:n.toUpperCase()}):void 0;case"percent":return void 0===n?tn({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,i){ya.has(e)||(ya.add(e),wn(`[live-preview] LP0408: data-payload-format="${i}" on "${t}" is not a known format; the default formatting was used. Known: date, time, datetime (each also :short|medium|long|full), number, number:0-4, currency:XXX, percent.`))}(i,n,t)}function rn(e){return String(e).padStart(2,"0")}function ln(){let e=new WeakMap,t=new WeakSet,i=new WeakMap,n=new WeakMap;return{name:"structural-array",render:O((r,l,o)=>{let a=Qt(l)?[]:l;if(!Array.isArray(a))return!1;let s=r.element,u=r.arrayTemplate;if(void 0===u||0===u.length)return function(e,t,i){e.has(t)||(e.add(t),wn(`[live-preview] LP0403: Skipping structural update for "${i}": <${t.tagName.toLowerCase()} data-payload-structural> needs data-payload-array-template (for example "<li>{{label}}</li>").`))}(t,s,r.fieldName),!1;let d=e.get(s),c=on(s),h=d?.values??function(e){return e.map((e,t)=>null===e?{__payloadDomPosition:t}:{id:e})}(c),f=$(h,a),p=function(e,t,i){return void 0===e||e.template!==t||!function(e,t){return e.length===t.length&&e.every((e,i)=>e===t[i])}(e.domSnapshot,i)}(d,u,c);if(0===f.length&&!p)return e.set(s,{values:a.slice(),template:u,domSnapshot:c}),!1;!function(e,t,i,n,r){let l=r.map(an),o=new Set,a=l.find(e=>!(void 0===e||!o.has(e)&&(o.add(e),1)));if(void 0!==a&&sn(e,t,i,a),l.some(e=>void 0===e)&&un(e,t,"LP0404",`LP0404: an item of "${i}" has no id and pairs by position, so an insert re-renders every row after it. Give items a stable id.`),n?.length===r.length&&r.length>1){let r=new Set(n.map(an).filter(e=>void 0!==e)),o=l.some(e=>void 0!==e&&r.has(e));r.size>0&&!o&&un(e,t,"LP0406",`LP0406: every key of "${i}" changed at once; the source generates ids per message, so no item can be retained across updates.`)}}(i,s,r.fieldName,d?.values,a);let g=ti({template:u,container:s,patches:f,nextItems:a,store:n,forceRender:p,sanitizerPolicy:o.sanitizerPolicy,onDuplicateKey:(e,t)=>{sn(i,e,r.fieldName,t)}});return null!==g&&(e.set(s,{values:a.slice(),template:u,domSnapshot:on(s)}),!!g&&void 0)})}}function on(e){return Array.from(e.children,e=>e.getAttribute(wo))}function an(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function sn(e,t,i,n){un(e,t,"LP0405",`LP0405: two items of "${i}" share the key "${n}"; later ones pair by position. Make \\`id\\` unique per item.`)}function un(e,t,i,n){let r=e.get(t);void 0===r&&(r=new Set,e.set(t,r)),!r.has(i)&&(r.add(i),wn(`[live-preview] ${n}`))}function dn(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var cn=Object.defineProperty,hn=e=>{throw TypeError(e)},fn=(e,t,i)=>((e,t,i)=>t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),pn=(e,t,i)=>t.has(e)||hn("Cannot "+i),gn=(e,t,i)=>(pn(e,t,"read from private field"),i?i.call(e):t.get(e)),mn=(e,t,i)=>t.has(e)?hn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),vn=(e,t,i,n)=>(pn(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),yn=(e,t,i)=>(pn(e,t,"access private method"),i),bn=t((...e)=>console.error(...e)),wn=t((...e)=>console.warn(...e)),Sn=t((...e)=>console.debug(...e)),An=class{constructor(){mn(this,Cn);mn(this,kn,new Map);mn(this,Tn,new Map)}on(e,t){return yn(this,Cn,$n).call(this,gn(this,kn),e,t)}once(e,t){return yn(this,Cn,$n).call(this,gn(this,Tn),e,t)}off(e,t){yn(this,Cn,Fn).call(this,gn(this,kn),e,t),yn(this,Cn,Fn).call(this,gn(this,Tn),e,t)}async emit(e,t){await yn(this,Cn,Rn).call(this,e,t)}async emitWhile(e,t,i){return yn(this,Cn,Rn).call(this,e,t,i)}listenerCount(e){return(gn(this,kn).get(e)?.size??0)+(gn(this,Tn).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(gn(this,kn).delete(e),gn(this,Tn).delete(e)):(gn(this,kn).clear(),gn(this,Tn).clear())}eventNames(){let e=new Set;for(let t of gn(this,kn).keys())e.add(t);for(let t of gn(this,Tn).keys())e.add(t);return[...e]}},kn=new WeakMap,Tn=new WeakMap,Cn=new WeakSet,Rn=async function(e,t,i){let n=()=>i?.()??!0;if(!n())return!1;let r=gn(this,kn).get(e);if(r)for(let i of[...r])if(!n()||(await yn(this,Cn,Nn).call(this,i,t,e),!n()))return!1;if(!n())return!1;let l=gn(this,Tn).get(e);if(l&&l.size>0){let i=[...l];gn(this,Tn).delete(e);for(let r of i)if(!n()||(await yn(this,Cn,Nn).call(this,r,t,e),!n()))return!1}return n()},$n=function(e,t,i){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n.add(i),()=>{yn(this,Cn,Fn).call(this,e,t,i)}},Fn=function(e,t,i){let n=e.get(t);void 0!==n&&(n.delete(i),0===n.size&&e.delete(t))},Nn=async function(e,t,i){try{await e(t)}catch(e){let t="string"==typeof i||"number"==typeof i?String(i):"<event>";bn(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},Mn=1e3,En=new Set(["date","number","checkbox"]),On=40,xn="payload-live-preview-a11y",Ln=new WeakMap,Pn=class{constructor(e,t){fn(this,"german");fn(this,"document");fn(this,"lease",null);let i=t??(typ','eof document>"u"?null:document),n=i?.documentElement.getAttribute("lang")??"";this.german=function(e){return/^de(?:[-_]|$)/i.test(e)}(e??(n.length>0?n:u())),this.document=i}mount(){let e=this.document;if(null==e?.body)return null;this.lease??(this.lease=function(e){let t=Ln.get(e);return void 0===t&&(t={element:null,owned:!1,messageNode:null,refs:0,timer:null},Ln.set(e,t)),t.refs+=1,t}(e));let t=this.lease,i=t.element;if(i?.isConnected&&i.ownerDocument===e)return i;if(null!==i){let e=t.owned;d(t),e&&i.remove()}let n=e.getElementById(xn);return t.owned=null===n,null===n&&(n=e.createElement("div"),n.id=xn,n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0",e.body.appendChild(n)),t.element=n,n}announceConnected(){this.say(this.german?"Vorschau verbunden":"Live preview connected")}announceDisconnected(){this.say(this.german?"Vorschau getrennt":"Live preview disconnected")}announceUpdate(e){e<=0||this.say(this.german?`${String(e)} ${1===e?"\\xc4nderung":"\\xc4nderungen"} angewendet`:`${String(e)} ${1===e?"change":"changes"} applied`)}announcePartial(){this.say(this.german?"Vorschau teilweise aktualisiert":"Preview partly updated")}detach(){let e=this.lease,t=this.document;if(null===e||null===t||(this.lease=null,e.refs-=1,e.refs>0))return;let i=e.element;null!==i&&d(e),e.owned&&i?.remove(),e.element=null,Ln.delete(t)}say(e){let t=this.mount(),i=this.lease;if(null===t||null===i)return;let n=i.messageNode;n?.parentNode!==t?(n?.remove(),n=t.ownerDocument.createTextNode(t.hasChildNodes()?` ${e}`:e),i.messageNode=n,t.appendChild(n)):n.data=null===n.previousSibling?e:` ${e}`,null!==i.timer&&clearTimeout(i.timer);let r=setTimeout(()=>{i.timer===r&&i.element===t&&d(i)},1500);i.timer=r}},Un=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],In={basic:{since:1},"schema-json":{since:2,observed:"schema"},locale:{since:2,observed:"locale"},"preview-token":{since:3,observed:"preview-token"},"nested-arrays":{since:4},"recursive-diffs":{since:4},"document-events":{since:4,observed:"document-event"},"relationship-events":{since:4,observed:"relationship-event"}},jn=Object.keys(In),Dn=class{constructor(e,t){fn(this,"matcher");fn(this,"handlers");fn(this,"boundListener");fn(this,"attachedTarget");fn(this,"generation",0);fn(this,"revision",0);fn(this,"queueHead");fn(this,"queueTail");fn(this,"lastAccepted");fn(this,"replayedGeneration",0);fn(this,"latestAcceptedAttempt");this.matcher=e,this.handlers=t}attach(e=window){if(void 0!==this.attachedTarget)return;let t=!1,i=n=>{if(!t||this.boundListener!==i)return;let r=this.generation;try{this.receive(n,r,e)}catch{let e;try{e=n.origin}catch{e=""}this.reportInvalid("shape",e,r)}};this.generation+=1,this.resetQueue(),this.attachedTarget=e,this.boundListener=i;try{e.addEventListener("message",i)}catch(t){this.boundListener===i&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue());try{e.removeEventListener("message",i)}catch{}throw t}if(this.boundListener===i)t=!0;else try{e.removeEventListener("message",i)}catch{}}detach(){let e=this.attachedTarget,t=this.boundListener;void 0===e||void 0===t||(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue(),e.removeEventListener("message",t))}advanceGeneration(){return void 0!==this.attachedTarget&&(this.generation+=1,this.resetQueue(),!0)}replayLastAccepted(){let e=this.lastAccepted,t=this.generation,i=this.handlers.onReplay;if(void 0===i||void 0===e||e.generation>=t||this.replayedGeneration===t||!this.matchesOrigin(e.origin,t)||this.lastAccepted!==e)return!1;this.replayedGeneration=t;let n={generation:t,revision:this.revision+=1};return this.invokeHandler(t,i,structuredClone(e.message),e.origin,n),!0}forgetLastAccepted(){this.lastAccepted=void 0,this.replayedGeneration=0,this.latestAcceptedAttempt=void 0}static sendReady(e,t){let i={type:"payload-live-preview",ready:!0,protocolVersion:4};for(let n of e)for(let e of t)try{n.postMessage(i,e)}catch{}}receive(e,t,i){let n=e.origin;if(!this.matchesOrigin(n,t)){this.reportInvalid("origin",n,t);return}if(!this.matchesSource(e,i)){this.reportInvalid("source",n,t);return}let r=e.data;if(function(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type}(r))switch(r.type){case"payload-live-preview":if(!function(e){let t=e;return!(void 0!==t.data&&null!==t.data&&!y(t.data))&&v(t.fieldSchemaJSON,e=>Array.isArray(e))&&v(t.globalSlug,e=>"string"==typeof e)&&v(t.collectionSlug,e=>"string"==typeof e)&&v(t.locale,e=>"string"==typeof e)&&v(t.ready,e=>"boolean"==typeof e)&&v(t.previewToken,e=>"string"==typeof e)&&v(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",n,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of Un)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:f(t.fieldSchemaJSON)}:t}(r),n,t);return;case"payload-document-event":if(!function(e){let t=e;return m(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&m(t.slug,e=>"string"==typeof e)&&m(t.id,e=>"string"==typeof e||Number.isFinite(e))}(r)){this.reportInvalid("shape",n,t);return}this.invokeHandler(t,this.handlers.onDocumentEvent,r,n);return;case"payload-live-preview-focus":{let e=function(e){let t=e.field;return"string"==typeof t&&t.length>0?t:void 0}(r);if(void 0===e){this.reportInvalid("shape",n,t);return}this.invokeHandler(t,this.handlers.onFocusField,e,n);return}default:this.reportInvalid("type",n,t)}else this.reportInvalid("shape",n,t)}dispatchUpdate(e,t,i){let n=y(e.data);if(!this.isCurrentGeneration(i))return;let r=n?{generation:i,revision:this.revision+=1}:void 0,l=this.handlers.validateToken;if(!this.isCurrentGeneration(i))return;if(void 0===l){this.commitUpdate(e,t,i,r);return}if(!0===e.ready&&void 0===e.data){this.commitUpdate(e,t,i,void 0);return}let o={generation:i,message:e,origin:t,messageRevision:r,verdict:void 0,next:void 0};this.enqueue(o);let a;try{a=l(e.previewToken,t)}catch{this.settleValidation(o,!1);return}"boolean"!=typeof a?Promise.resolve(a).then(e=>{this.settleValidation(o,!0===e)},()=>{this.settleValidation(o,!1)}):this.settleValidation(o,a)}settleValidation(e,t){e.verdict=t,this.drainQueue(e.generation)}drainQueue(e){for(;this.isCurrentGeneration(e);){let t=this.queueHead;if(void 0===t)return;if(this.matchesOrigin(t.origin,e)){if(void 0===t.verdict)return;this.dequeue(t)&&(t.verdict?this.commitUpdate(t.message,t.origin,t.generation,t.messageRevision):this.reportInvalid("token",t.origin,t.generation))}else{if(!this.dequeue(t))continue;this.reportInvalid("origin",t.origin,t.generation)}}}commitUpdate(e,t,i,n){if(void 0===n)this.invokeHandler(i,this.handlers.onUpdate,e,t);else{let r={};this.latestAcceptedAttempt=r;let l=function(e){let t={...e};delete t.previewToken;try{return structuredClone(t)}catch{return null}}(e);if(this.latestAcceptedAttempt!==r||!this.isCurrentGeneration(i))return;this.lastAccepted=null===l?void 0:{generation:i,message:l,origin:t},this.invokeHandler(i,this.handlers.onUpdate,e,t,n)}}reportInvalid(e,t,i){this.invokeHandler(i,this.handlers.onInvalid,e,t)}matchesSource(e,t){if("parent-or-opener"!==this.handlers.sourcePolicy)return!0;try{let i=e.source;if("object"!=typeof i||null===i)return!1;let n=t.parent;return n!==t&&i===n||i===t.opener}catch{return!1}}matchesOrigin(e,t){try{return!0===(this.isCurrentGeneration(t)&&this.matcher(e))&&this.isCurrentGeneration(t)}catch{return!1}}invokeHandler(t,i,...n){if(void 0!==i&&this.isCurrentGeneration(t))try{e(i(...n))}catch{}}isCurrentGeneration(e){return void 0!==this.attachedTarget&&this.generation===e}enqueue(e){void 0===this.queueTail?this.queueHead=e:this.queueTail.next=e,this.queueTail=e}dequeue(e){return this.queueHead===e&&(this.queueHead=e.next,void 0===this.queueHead&&(this.queueTail=void 0),!0)}resetQueue(){this.queueHead=void 0,this.queueTail=void 0}},Wn=new Set(["tabs","row","collapsible"]),Bn={text:"text",textarea:"textarea",richText:"richText",email:"email",number:"number",checkbox:"checkbox",date:"date",select:"select",radio:"radio",array:"array",blocks:"blocks",group:"text",tabs:"text",row:"text",collapsible:"text",relationship:"relationship",upload:"upload",point:"text",json:"text",code:"text",ui:"text"},_n=new Set(["http:","https:","mailto:","tel:"]),zn=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,Vn=/^[\\\\/]{2}/,qn=/[\\t\\n\\r]/g,Hn=/[\\s\\u0000-\\u001f\\u180e\\u2000-\\u2029]/g,Gn=/^([a-z][a-z0-9+.-]*):/i,Kn=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),Jn=new Set(["href","src","poster","cite","action","xlink:href","data"]),Xn=new WeakSet,Qn=class{constructor(){fn(this,"previous",null);fn(this,"lastFields");fn(this,"priorFields");fn(this,"keepValues",!1)}get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,i=x){let r=this.previous,l=null===r,o=new Map,a=new Set,s=Object.entries(e);if(!i())return null;for(let[e,t]of s){let l=n(t);if(!i())return null;o.set(e,l),(null===r||void 0===l||r.get(e)!==l)&&a.add(e)}if(null!==r)for(let e of r.keys())o.has(e)||a.add(e);let u=new Set,d=Object.entries(t);if(!i())return null;for(let[e,t]of d)if(a.has(e))for(let e of t)if(u.add(e),!i())return null;return i()?(this.previous=o,this.priorFields=this.keepValues?this.lastFields:void 0,this.lastFields=this.keepValues?e:void 0,{changed:a,invalidated:u,baseline:l}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}},Zn=new Set(["__proto__","prototype","constructor"]),Yn="data-payload-fragment",er="data-payload-fragment-key",tr="data-payload-strategy",ir=8,nr=1024,rr=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),lr=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),or=new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),ar={},sr=class{constructor(){fn(this,"rawChanges",new Qn);fn(this,"resolved",null);fn(this,"resolvedLocale",null);fn(this,"trailing",null);fn(this,"openUntil",0);fn(this,"requestAttempt",0)}decide(e,t){let i=t.rawData;if(!function(e){let{cache:t,emitter:i}=e;if(t.islands.length>0||i.listenerCount("beforeUpdate")>0||i.listenerCount("afterUpdate")>0)return!0;for(let e of t.values())if(re(e)||e.fieldName.includes(".")||ae(e.hrefField)||ae(e.srcField)||ae(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${Yn}]`)}(e)&&!function(e,t,i){for(let n of e.values()){if("text"!==n.fieldType||!0===n.explicitFieldType)continue;let e=U(t,n,n.fieldName,i);if(fe(e)&&le(e.root))return!0}return!1}(e.cache,i,t.locale))return t.forceRender&&(this.resolvedLocale=null),{merge:!1,fields:i};let{changed:n}=this.rawChanges.diff(i,ar),r=this.resolvedLocale!==t.locale,l=this.resolved;if(null===l)return this.resolved=i,{merge:!0,fields:i};let o={...l};t.forceRender&&(this.resolvedLocale=null);let a=t.forceRender||r;for(let r of n){let n=i[r];if(rr.has(r)){o[r]=n;continue}let s=ne(r,l[r],n,e.cache,t.schemaIndex);"own"!==s&&(a=!0,this.resolvedLocale=null),"keep"!==s&&(o[r]=n)}return this.resolved=o,{merge:a,fields:o}}request(e,t,i){let n=++this.requestAttempt,r=Date.now();if(r>=this.openUntil)return this.openUntil=r+t,this.dropQueued(),this.requestAttempt!==n?{leading:!0,result:Promise.resolve({status:"superseded"})}:{leading:!0,result:e.merge(i)};let l=this.trailing,o=l?.pending??function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}(),a={request:i,pending:o,timer:null};if(this.trailing=a,this.openUntil=r+t,null!==l&&null!==l.timer&&clearTimeout(l.timer),this.trailing!==a)return{leading:!1,result:o.promise};let s=setTimeout(()=>{this.flush(e,a)},t);return this.trailing===a?a.timer=s:clearTimeout(s),{leading:!1,result:o.promise}}recordMerged(e,t){this.resolved=e,this.resolvedLocale=t}resetRawChanges(){this.rawChanges.reset()}destroy(){this.requestAttempt+=1,this.openUntil=0,this.dropQueued()}dropQueued(){let e=this.trailing;this.trailing=null,null!==e&&(null!==e.timer&&clearTimeout(e.timer),e.pending.settle({status:"superseded"}))}flush(e,t){this.trailing===t&&(this.trailing=null,t.timer=null,e.merge(t.request).then(t.pending.settle))}},ur=class{constructor(){fn(this,"negotiation",b(void 0));fn(this,"observed",new Set)}observe(e,t){let i=e.filter(e=>!this.observed.has(e));if(0!==i.length){for(let e of i)this.observed.add(e);this.negotiation=b(this.negotiation.theirs,this.observed),t("protocol",`observed=${i.join(",")}`)}}applyVersion(e,t){let i=this.negotiation;if(i.theirs===e)return;let n=b(e,this.observed);this.negotiation=n,n.negotiated!==i.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${n.negotiated}`)}},dr=class{constructor(){fn(this,"lastIdentity")}inspect(e){let t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;let i=JSON.stringify([t.entitySlug,q(t),t.updatedAt]);return{identity:i,edit:i!==this.lastIdentity&&se(t,e)?t:null}}commit(e){let t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}},cr=class{constructor(){mn(this,hr)}reveal(e,t,i){return e===gn(this,hr)?"skipped-same":(vn(this,hr,e),function(e,t){return function(e,t){let i=e.getBoundingClientRect(),n=i.bottom>0&&i.top<t.innerHeight,r=i.right>0&&i.left<t.innerWidth;return n&&r}(e,t)?"already-visible":(e.scrollIntoView({behavior:de(t)?"auto":"smooth",block:"center"}),"revealed")}(t,i))}reset(){vn(this,hr,void 0)}},hr=new WeakMap,fr=class{constructor(){fn(this,"seen",new Map)}note(e,t,i){let r=n(i);if(void 0===r)return;let l=`${t.owner??""}\\0${t.locale??""}\\0${t.fieldName}`,o=this.seen.get(l);void 0!==o?o!==r&&(e.revealIdentities.push([l,r]),e.revealTarget??(e.revealTarget=t)):this.seen.set(l,r)}commit(e){for(let[t,i]of e.revealIdentities)this.seen.set(t,i);e.revealIdentities=[];let t=e.revealTarget;return e.revealTarget=void 0,t}},pr=()=>{},gr=class{constructor(){fn(this,"host",{outstanding:()=>!1,report:pr,failed:pr});fn(this,"entry",null);fn(this,"ended")}begin(e,t){let i=this.entry,n=null===i?void 0:this.view(i);null!==i&&(i.key=void 0),this.ended=void 0,this.entry={key:e,revision:t,shortfalls:[],seen:new Set,deferred:0,awaiting:0,reported:void 0,queued:!1},null!==i&&void 0!==n&&this.publish(i,"pending"===n.state?{...n,state:"superseded"}:n)}end(){let e=this.entry;if(null!==e){this.entry=null;try{this.ended=this.view(e)}finally{e.key=void 0}}}snapshot(){return null!==this.entry?this.view(this.entry):void 0===this.ended?void 0:{...this.ended,shortfalls:[...this.ended.shortfalls]}}shortfall(e,t){let i=this.entry;if(i?.key!==e)return;let n=JSON.stringify(t);i.seen.has(n)||(i.seen.add(n),i.shortfalls.push(t),this.requestSettle(i.key))}deferred(e,t){this.entry?.key===e&&(this.entry.deferred=t)}handIsland(e){let t=this.entry;if(t?.key!==e)return pr;t.awaiting+=1;let i=!1;return()=>{i||this.entry!==t||(i=!0,t.awaiting-=1,this.settle(t))}}requestSettle(e){let t=this.entry;t?.key!==e||t.queued||(t.queued=!0,queueMicrotask(()=>{t.queued=!1;try{this.entry===t&&this.settle(t)}catch(e){this.host.failed(e)}}))}settle(e){let t=this.view(e);"pending"!==t.state&&this.publish(e,t)}publish(e,t){e.reported!==t.state&&(e.reported=t.state,this.host.report(t))}view(e){let t=void 0!==e.key&&this.host.outstanding(e.key)?"pending":e.shortfalls.length>0?"partial":e.awaiting>0?"unconfirmed":"current";return{revision:e.revision,state:t,shortfalls:[...e.shortfalls],deferred:e.deferred,awaitingIslands:e.awaiting}}},mr=class{constructor(){fn(this,"started",!1);fn(this,"suspended",!1);fn(this,"deferredStart",null);fn(this,"hydration","idle");fn(this,"activeUpdate",null);fn(this,"locale");fn(this,"schema");fn(this,"schemaIndex");fn(this,"updateCount",0);fn(this,"supersededCount",0);fn(this,"completedCount",0);fn(this,"skippedUnchangedCount",0);fn(this,"lastFlush",null);fn(this,"absentFields",new Set);fn(this,"warnedOrphanFields",new Set);fn(this,"warnedStrategy",new WeakSet);fn(this,"warnedUnattributableMessage",!1);fn(this,"warnedVisibilityGate",!1);fn(this,"warnedFragmentFallback",!1);fn(this,"warnedIslandStart",!1);fn(this,"warnedEscalationUnavailable",!1);fn(this,"warnedProtocolShape",!1);fn(this,"reportedUnfaithful",new WeakMap);fn(this,"checkedServerFormat",new WeakSet);fn(this,"unfaithfulPatches",[]);fn(this,"unfaithfulCount",0);fn(this,"escalatedCount",0);fn(this,"unfaithfulFields",new Set);fn(this,"autoBindSearchMs");fn(this,"autoBindGuesses",null);fn(this,"warnedForeignSource",!1);fn(this,"lastAppliedIdentity",new WeakMap);fn(this,"navigationReplayPending",!1);fn(this,"navigationBindingReplay",!1);fn(this,"revealLedger",new fr);fn(this,"display",new gr);fn(this,"fragmentStats",{rendered:0,failed:0,superseded:0});fn(this,"routeStats",{refreshes:0,partial:0,failed:0,refused:0,loopStopped:0});fn(this,"fragmentControllers",new Map);fn(this,"routeController",null);fn(this,"routeRetry",null);fn(this,"routeRefreshOwed",!1);fn(this,"routeAwaitsSave",!1);fn(this,"fragmentsOwed",new Set);fn(this,"readyTimers",[]);fn(this,"revealer",new cr);fn(this,"changes",new Qn);fn(this,"merges",new sr);fn(this,"protocol",new ur);fn(this,"relationships",new dr)}isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){this.display.requestSettle(e),!e.completed&&(e.completed=!0,e.countsAsUpdate&&(this.completedCount+=1))}forgetOwedWork(){this.routeRefreshOwed=!1,this.routeAwaitsSave=!1,this.fragmentsOwed.clear()}supersedeStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null,this.routeRefreshOwed=!0);for(let[e,t]of this.fragmentControllers){for(let e of t)this.fragmentsOwed.add(e);e.abort()}this.fragmentControllers.clear()}abortStrategies(){this.supersedeStrategies();let e=this.routeController;this.routeController=null,e?.abort()}},vr=class{constructor(e,t){fn(this,"deps",e);fn(this,"state",t);fn(this,"writing");fn(this,"instanceContext");this.instanceContext=function(e){let t={};for(let[i,n]of Object.entries(e))void 0!==n&&(t[i]=n);return t}({renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,serverURL:e.serverURL,reportUnfaithful:(i,n)=>{l(e,t,i,n,this.writing)}})}apply(e){let{deps:t,state:i}=this,n=i.activeUpdate;if(null===n||void 0===e.revision||!w(n.revision,e.revision)||!i.isCurrent(n))return!1;let{target:r,value:o}=e,u=void 0!==n.schemaIndex?T(n.schemaIndex,r.fieldName):void 0,d=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(Bn,e))return Bn[e]}(t);if(void 0!==e)return e}return e.fieldType}(r,u?.type);"text"===d&&!0!==r.explicitFieldType&&fe(o)&&(d="richText");let c;try{c=t.resolveRenderer(d,r)}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;let h=t.emitter.listenerCount("elementUpdate")>0,f=h?function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:"IMG"===e.tagName?e.src:e.textContent}(r.element):void 0;if(!i.isCurrent(n))return!1;let p={allFields:e.allFields,locale:r.locale??n.locale,schema:u,...this.instanceContext};!0===r.hidesWhenEmpty&&r.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length||pe(e))}(o));try{if(void 0!==r.targetAttribute){if("blocked"===function(e,t,i){let n=t.toLowerCase().trim();if(0===n.length||!E(n))return"blocked";if(null==i)return e.removeAttribute(n),"applied";if("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i)return"blocked";let r=String(i);return Jn.has(n)&&!N(r)?"blocked":(e.setAttribute(n,r),"applied")}(r.element,r.targetAttribute,o))return t.warn(`[live-preview] LP0401: refused to write "${r.fieldName}" into attribute "${r.targetAttribute}"`),i.display.shortfall(n,{kind:"write",field:r.fieldName,code:"LP0401"}),!1}else{if(void 0===c)return t.log("no renderer for",d),l(t,i,r,`has no renderer for "${d}"`,o),!1;{let e=function(e,t,i,n){if("ignore"===e.onUnfaithfulPatch||void 0!==i.format||!En.has(n)||t.checkedServerFormat.has(i.element))return;t.checkedServerFormat.add(i.element);let r=a(i.element);return r.trim().length>0?r:void 0}(t,i,r,d);if(this.writing=o,!1===function(e,t,i,n){return e.render(t,i,n)}(c,r,o,p)&&function(e){return Xn.has(e.render)}(c))return l(t,i,r,`is a value ${c.name} cannot render`,o),!1;void 0!==e&&function(e,t,i){let n=a(t.element);n!==i&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${s(i)}, the patch wrote ${s(n)} \\u2014 either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it.`)}(t,r,e)}}}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;h&&t.emitter.emitWhile("elementUpdate",{element:r.element,fieldName:r.fieldName,previousValue:f,nextValue:o,revision:n.revision.revision,receivedAt:n.receivedAt,source:"patch"},()=>i.isCurrent(n));let g=i.isCurrent(n);return g&&(void 0!==e.valueIdentity?i.lastAppliedIdentity.set(r.element,e.valueIdentity):i.lastAppliedIdentity.delete(r.element)),g}fail(e,t,i){if(!this.state.isCurrent(e))return!1;this.state.display.shortfall(e,{kind:"write",field:t,code:"LP0603"});let n=i instanceof Error?i:new Error(String(i));return this.deps.emitter.emitWhile("error",{error:n,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}},yr="payload-live-preview:update",br="data-payload-island",wr=`astro-island, [${br}]`,Sr="data-payload-owned",Ar="data-payload-morph",kr=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],Tr=new WeakMap,Cr=new WeakSet,Rr="data-payload-field",$r="data-payload-type",Fr="data-payload-attribute",Nr="data-payload-href",Mr="data-payload-src",Er="data-payload-alt",Or="data-payload-array-template",xr="data-payload-array-separator",Lr="data-payload-locale",Pr="data-payload-format",Ur="data-payload-richtext",Ir="data-payload-html",jr="data-payload-array",Dr="data-payload-structural",Wr="data-payload-owner",Br="data-payload-depends",_r="data-payload-strategy",zr="data-payload-boundary",Vr="data-payload-guessed",qr="data-payload-covers",Hr=[Rr,$r,Fr,Nr,Mr,Er,Or,xr,Lr,Pr,Ur,Ir,jr,Dr,Wr,Br,_r,zr,"type"],Gr=`[${Rr}]`,Kr=`[${Wr}]`,Jr=`[${Yn}], [${_r}="route"]`,Xr=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Qr=new Set(["text","textarea","richText","email","number","checkbox","date","select","radio","array","blocks","group","tabs","row","collapsible","relationship","upload","point","json","code","ui","html","url","image","structural-array"]),Zr=class{constructor(e={}){fn(this,"entriesByField",new Map);fn(this,"entryByElement",new WeakMap);fn(this,"filter");fn(this,"count",0);fn(this,"dependencies",null);fn(this,"islandRoots",[]);fn(this,"ownersByIsland",new Map);fn(this,"navigationRoots",[]);fn(this,"coverDeclarations",[]);fn(this,"renderedDeclarations",[]);this.filter=e.filter??Ee}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(ve(t.fieldName,t.dependsOn));return this.dependencies=me(...e),this.dependencies}get islands(){return this.islandRoots}get islandOwners(){return this.ownersByIsland}get covers(){return this.coverDeclarations}get rendered(){return this.renderedDeclarations}get navigationReplayRoots(){return this.navigationRoots}buildFromRoot(e){let t=performance.now();this.clear();let i=0;for(let t of e.querySelectorAll(Gr))void 0!==this.add(t)&&(i+=1);return this.islandRoots=function(e){let t=[];for(let i of e.querySelectorAll(wr))be(i)||t.push(i);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,$e(e)])),this.navigationRoots=[...e.querySelectorAll(Jr)].filter(e=>this.filter(e)&&(e.hasAttribute(Yn)||0===(e.getAttribute(Rr)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${qr}]`)].filter(e=>this.filter(e)).map(e=>({paths:ge(e.getAttribute(qr)),owner:$e(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${Br}]`)].filter(e=>this.filter(e)).flatMap(e=>{let t=function(e){if((e.getAttribute(Yn)??"").length>0)return"fragment";let t=e.getAttribute(_r);return null!==t?"route"===t?"route":void 0:e.hasAttribute(Rr)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:ge(e.getAttribute(Br)),owner:$e(e)}]}),{elementCount:i,fieldCount:this.entriesByField.size,durationMs:performance.now()-t}}add(e){let t=this.filter(e)?this.resolveBinding(e):void 0,i=this.entryByElement.get(e);if(this.dependencies=null,void 0!==t)return void 0!==i&&this.replaceEntry(i,t)?(this.entryByElement.set(e,t),t):(void 0!==i&&this.removeEntry(e,i),this.append(t),this.entryByElement.set(e,t),t);void 0!==i&&this.removeEntry(e,i)}remove(e){let t=this.entryByElement.get(e);return!!t&&(this.dependencies=null,this.removeEntry(e,t))}get(e){return this.entriesByField.get(e)}getByElement(e){return this.entryByElement.get(e)}get fieldCount(){return this.entriesByField.size}get elementCount(){return this.count}entries(){return this.entriesByField.entries()}*values(){for(let e of this.entriesByField.values())yield*e}has(e){return this.entryByElement.has(e)}clear(){this.entriesByField.clear(),this.entryByElement=new WeakMap,this.count=0,this.dependencies=null,this.islandRoots=[],this.ownersByIsland=new Map,this.navigationRoots=[],this.coverDeclarations=[],this.renderedDeclarations=[]}replaceEntry(e,t){if(e.fieldName!==t.fieldName)return!1;let i=this.entriesByField.get(e.fieldName),n=void 0===i?-1:i.indexOf(e);return!(void 0===i||n<0||(i[n]=t,0))}removeEntry(e,t){this.entryByElement.delete(e);let i=this.entriesByField.get(t.fieldName),n=void 0===i?-1:i.indexOf(t);return!(void 0===i||n<0||(i.splice(n,1),0===i.length&&this.entriesByField.delete(t.fieldName),this.count-=1,0))}append(e){let t=this.entriesByField.get(e.fieldName);t?t.push(e):this.entriesByField.set(e.fieldName,[e]),this.count+=1}resolveBinding(e){let t=e.getAttribute(Rr);if(null===t||0===t.length)return;let i=e.getAttribute($r),n=e.getAttribute(Fr),r=e.getAttribute(Nr),l=e.getAttribute(Mr),o=e.getAttribute(Er),a=e.getAttribute(Or),s=e.getAttribute(xr),u=e.getAttribute(Lr),d=e.getAttribute(Pr),c=$e(e),h=ge(e.getAttribute(Br)),f=e.getAttribute(_r),p=e.getAttribute(Vr),g=j(e);return{element:e,fieldName:t,fieldType:Me(e),explicitFieldType:null!==i&&Fe(i),strategyKind:W(e)??"unknown",...null!==g?{fragmentBoundary:g}:{},...null!==n&&n.length>0?{targetAttribute:n}:{},...null!==r&&r.length>0?{hrefField:r}:{},...null!==l&&l.length>0?{srcField:l}:{},...null!==o&&o.length>0?{altField:o}:{},...null!==a?{arrayTemplate:a}:{},...null!==s?{arraySeparator:s}:{},...null!==u&&u.length>0?{locale:u}:{},...null!==d&&d.length>0?{format:d}:{},...void 0!==c?{owner:c}:{},...h.length>0?{dependsOn:h}:{},...null!==f&&f.length>0?{strategy:f}:{},...e.hasAttribute(zr)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},Yr=64,el=1e4,tl=1e3,il=64,nl=8192,rl=1048576,ll=1e4,ol=20,al=new Set(["__proto__","constructor","prototype"]),sl=class{constructor(e){fn(this,"serverURL");fn(this,"apiRoute");fn(this,"depth");fn(this,"fetchFn");fn(this,"log");fn(this,"inflight",null);fn(this,"attempt",0);fn(this,"destroyDepth",0);this.serverURL=function(e){let t=e.length;for(;e.endsWith("/",t);)t-=1;return e.slice(0,t)}(e.serverURL);let n=e.apiRoute??"/api";this.apiRoute=n.startsWith("/")?n:`/${n}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=t(e.log??i)}canMerge(e){try{let t=e.schema;return void 0!==t?(Be(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale),!0):null!==this.endpointOf(e)}catch{return!1}}endpointOf(e){try{let t=e.globalSlug;if(t)return qe(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;let i=e.collectionSlug??"",n=e.data.id;return qe(i)&&He(n)?{path:`${encodeURIComponent(i)}/${encodeURIComponent(String(n))}`,field:"id",value:String(n)}:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};let t=this.attempt+=1,i=this.inflight;this.inflight=null;let n=null,r=!1,l=()=>this.attempt!==t;try{if(i?.abort(),l())return{status:"superseded"};let t=e.schema;if(r=void 0!==t,void 0!==t){let i=Be(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(l())return{status:"superseded"};if(0===i.requests.length)return{status:"merged",doc:i.doc};let r=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(l())return{status:"superseded"};if(void 0===r)return{status:"unavailable"};n=new AbortController,this.inflight=n;for(let e of i.requests){let t=await r(e.url,{method:"GET",credentials:"include",redirect:"error",signal:n.signal});if(l())return{status:"superseded"};let i=t.ok;if(l())return{status:"superseded"};if(!i){let e=t.status;return l()?{status:"superseded"}:(n.abort(),l()?{status:"superseded"}:(this.log("merge HTTP",e),l()?{status:"superseded"}:{status:"unavailable"}))}let o=await _e(t,n.signal,()=>!l());if(l())return{status:"superseded"};if(ze(e,o),l())return{status:"superseded"}}return{status:"merged",doc:i.doc}}let o=this.endpointOf(e);if(l())return{status:"superseded"};if(null===o)return{status:"unavailable"};let a=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(l())return{status:"superseded"};if(void 0===a)return{status:"unavailable"};let s=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(l())return{status:"superseded"};n=new AbortController,this.inflight=n;let u=`${this.serverURL}${this.apiRoute}/${o.path}`,d=await a(u,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:s,signal:n.signal});if(l())return{status:"superseded"};let c=d.ok;if(l())return{status:"superseded"};if(!c){let e=d.status;return l()?{status:"superseded"}:(this.log("merge HTTP",e,u),l()?{status:"superseded"}:{status:"unavailable"})}let h=d.json.bind(d);if(l())return{status:"superseded"};let f=await h();if(l())return{status:"superseded"};if(null===f||"object"!=typeof f||Array.isArray(f))return this.log("merge invalid",u),l()?{status:"superseded"}:{status:"unavailable"};let p=f,g=p[o.field],m=Object.hasOwn(p,o.field)&&("id"===o.field?!He(g)||String(g)!==o.value:g!==o.value);return l()?{status:"superseded"}:m?(this.log("merge invalid",u),l()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:p}}catch(e){return l()||r&&(n?.abort(),l())?{status:"superseded"}:(this.log("merge exception",r?new Error("legacy population could not be resolved"):e),l()?{status:"superseded"}:{status:"unavailable"})}finally{this.inflight===n&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},ul="2.2.1",dl={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},cl={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},hl={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},fl="ssr",pl=1,gl=[Rr,Wr,qr,Br],ml=`[${Rr}], [${qr}], ${wr}, ${Jr}`,vl=class{constructor(e,t={}){fn(this,"callbacks");fn(this,"debounceMs");fn(this,"rootMargin");fn(this,"visible",new Set);fn(this,"mutation",null);fn(this,"intersection",null);fn(this,"debounceTimer",null);fn(this,"generation",0);this.callbacks=e,this.debounceMs=t.mutationDebounceMs??100,this.rootMargin=t.intersectionRootMargin??"200px"}start(e){let t=this.generation;this.stop();let i=t+1;if(this.generation!==i)return;let n=null,r=null;try{n=new MutationObserver(e=>{this.handleMutations(e,i)}),r=new IntersectionObserver(e=>{this.handleIntersection(e,i)},{rootMargin:this.rootMargin,threshold:0}),n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Hr,qr,br,fl]})}catch(e){throw n?.disconnect(),r?.disconnect(),e}this.generation===i?(this.mutation=n,this.intersection=r):(n.disconnect(),r.disconnect())}observeElement(e){this.intersection?.observe(e)}unobserveElement(e){this.intersection?.unobserve(e),this.visible.delete(e)}markVisible(e,t){t?this.visible.add(e):this.visible.delete(e)}isVisible(e){return this.visible.has(e)}stop(){this.generation+=1;let e=this.debounceTimer,t=this.mutation,i=this.intersection;this.debounceTimer=null,this.mutation=null,this.intersection=null,this.visible.clear(),null!==e&&clearTimeout(e);try{t?.disconnect()}finally{i?.disconnect()}}handleMutations(e,t){if(!this.isCurrentGeneration(t))return;for(let i of e){let e=Ke(i);if(null!==e&&(this.callbacks.onIslandHydrated?.(e),!this.isCurrentGeneration(t)))return}if(!function(e){for(let t of e){if("attributes"===t.type&&t.attributeName===br||"attributes"===t.type&&null!==t.attributeName&&(gl.includes(t.attributeName)||Hr.includes(t.attributeName)&&t.target.nodeType===pl&&t.target.hasAttribute(Rr)))return!0;for(let e of t.addedNodes)if(Je(e))return!0;for(let e of t.removedNodes)if(Je(e))return!0}return!1}(e))return;null!==this.debounceTimer&&clearTimeout(this.debounceTimer);let i=setTimeout(()=>{!this.isCurrentGeneration(t)||this.debounceTimer!==i||(this.debounceTimer=null,this.callbacks.onStructuralChange())},this.debounceMs);this.debounceTimer=i}handleIntersection(e,t){for(let i of e){if(!this.isCurrentGeneration(t))return;let{target:e}=i;if(i.isIntersecting){if(this.visible.has(e))continue;this.visible.add(e),this.callbacks.onVisibilityChange(e,!0)}else this.visible.has(e)&&(this.visible.delete(e),this.callbacks.onVisibilityChange(e,!1))}}isCurrentGeneration(e){return this.generation===e&&null!==this.intersection}},yl=class{constructor(e){mn(this,Al);mn(this,bl,[]);mn(this,wl);mn(this,Sl,!1);vn(this,wl,e)}get closed(){return gn(this,Sl)}own(e){gn(this,Sl)?yn(this,Al,kl).call(this,e):gn(this,bl).push(e)}close(){if(gn(this,Sl))return;vn(this,Sl,!0);let e=gn(this,bl).splice(0).reverse();for(let t of e)yn(this,Al,kl).call(this,t)}},bl=new WeakMap,wl=new WeakMap,Sl=new WeakMap,Al=new WeakSet,kl=function(e){try{e()}catch(e){gn(this,wl).call(this,"runtime cleanup failed:",e)}},Tl="__livePreviewHydration",Cl="[data-payload-field]",Rl="__vue_app__",$l="__livePreviewVueHydration",Fl="app:suspense:resolve",Nl={react:(e,t)=>function(e,t=5e3){Qe();let i=Xe();if(void 0===i)return null;if(void 0===i.onCommit){let e=e=>{!i.committed&&function(e){let t=e;return null!=t&&function(e){let t=e;return 9===t?.nodeType||null!=t?.querySelector?.(Cl)}(t.containerInfo)&&!function(e){let t=[];for(null!==e.current&&void 0!==e.current&&t.push(e.current);t.length>0;){let e=t.pop();if(void 0===e)continue;let i=e.memoizedState;if((13===e.tag||31===e.tag)&&"object"==typeof i&&null!==i&&"dehydrated"in i&&"object"==typeof i.dehydrated&&null!==i.dehydrated&&"nodeType"in i.dehydrated&&8===i.dehydrated.nodeType)return!0;null!==e.sibling&&void 0!==e.sibling&&t.push(e.sibling),null!==e.child&&void 0!==e.child&&t.push(e.child)}return!1}(t)}(e)&&Ze(i)};i.onCommit=e;for(let t of i.commits.splice(0))e(t)}return et(i,e,t)}(t),vue:function(e,t,i=5e3){nt();let n=tt();return void 0===n?null:(!n.committed&&function(e){for(let t=e.querySelector(Cl);null!==t;t=t.parentElement)if(void 0!==it(t))return!0;return!1}(e)&&Ze(n),et(n,t,i))},sveltekit:function(e,t,i=5e3){let n=e.ownerDocument??e,r=()=>null!==n.querySelector("#svelte-announcer");if(r()||!Object.keys(window).some(e=>e.startsWith("__sveltekit_")))return null;let l={committed:!1,waiters:[]},o=new MutationObserver(()=>{!l.committed&&r()&&Ze(l)});o.observe(n,{childList:!0,subtree:!0});let a=et(l,e=>{o.disconnect(),t(e)},i);return()=>{o.disconnect(),a?.()}}},Ml={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount"},El=class{constructor(e){fn(this,"timeoutMs");fn(this,"onTimeout");fn(this,"handle",null);fn(this,"lastKick",null);this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){this.lastKick=Date.now(),!(this.timeoutMs<=0)&&(this.stop(),this.arm(this.timeoutMs))}resume(){if(this.timeoutMs<=0||null!==this.handle||null===this.lastKick)return!1;let e=Math.max(0,Date.now()-this.lastKick),t=this.timeoutMs-e;return t<=0?(this.lastKick=null,this.onTimeout(),!0):(this.arm(Math.min(t,this.timeoutMs)),!1)}arm(e){let t=setTimeout(()=>{this.handle===t&&(this.handle=null,this.lastKick=null,this.onTimeout())},e);this.handle=t}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick??0}get pending(){return null!==this.handle}},Ol=class{constructor(){fn(this,"current","disconnected")}get status(){return this.current}markConnected(){return this.transition("connected")}markDisconnected(){return this.transition("disconnected")}transition(e){return this.current!==e&&(this.current=e,!0)}},xl="data-payload-no-bind",Ll=13,Pl=new Set(["true","false","yes","no","on","off"]),Ul=/^[\\d\\s.,:+/-]+$/u,Il=/^[a-z][a-z0-9_-]*$/u,jl=/^[a-z]{2,3}(?:[-_][A-Za-z0-9]{2,8})*$/u,Dl=new Set(["SCRIPT","STYLE","TEMPLATE","TITLE","NOSCRIPT","TEXTAREA","SELECT","OPTION","INPUT","IFRAME"]),Wl="http://www.w3.org/1999/xhtml",Bl=class{constructor(e,t,i){fn(this,"deps",e);fn(this,"state",t);fn(this,"host",i);fn(this,"awaitingHydration",new WeakSet);fn(this,"delivered",new WeakMap);fn(this,"confirmations",new WeakMap)}reapplyBindings(e){let t=this.currentTransaction();void 0!==t?.renderData&&this.host.schedule(t,t.renderData,e)}reapplyIslands(e,t=!1){let i=t?e.filter(e=>this.awaitingHydration.delete(e)):e,n=this.state.activeUpdate,r=t&&null!==n&&this.state.isCurrent(n)?n:this.currentTransaction();void 0!==r?.renderData&&this.dispatchIslands(r,r.renderData,i)}dispatchIslands(e,t,i){let n=St(this.deps,this.state,e,t.fields),r=()=>!e.cancelled&&this.state.isCurrent(e);if(!r())return;let l=this.delivered.get(t);void 0===l&&(l=new WeakSet,this.delivered.set(t,l));for(let o of i){let i=$e(o);if(!r())return;if(!1!==n&&!V(i,n)){this.awaitingHydration.delete(o);continue}let a=this.confirmation(o,e);if(Se(o))this.awaitingHydration.add(o);else{if(this.awaitingHydration.delete(o),l.has(o))continue;l.add(o),At(e,t,[o],r,a)}}}hasLateRouteBinding(e,t,i,n){for(let n of e){if((n.getAttribute(Rr)??"").length>0||"route"!==n.getAttribute(_r)||!1!==t&&!V($e(n),t))continue;let e=ge(n.getAttribute(Br));if(0===e.length||e.some(e=>i.touched.has(e)))return!0}for(let[r,l]of this.deps.cache.entries())for(let o of l){if(!e.has(o.element)||!1!==t&&!V(o.owner,t)||"route"!==(o.strategyKind??W(o.element)??"unknown"))continue;let l=U(n.fields,o,r,i.locale);if(!this.state.isCurrent(i))return!1;if(void 0!==l)return!0}return!1}fieldsForElements(e,t){let i=new Set(t);for(let[t,n]of this.deps.cache.entries())n.some(t=>e.has(t.element))&&i.add(t);return i}unrunFragmentPlan(e,t,i){if(null===t)return null;let n=t.boundaries.filter(t=>!e.fragmentBoundariesRun.has(t)&&(void 0===i||[...i].some(e=>e===t||t.contains(e))));return D(t.strategy,n,t.ownerKeys)}confirmation(e,t){let i=this.confirmations.get(e);if(i?.transaction===t)return i.displayed;let n=this.state.display.handIsland(t);return this.confirmations.set(e,{transaction:t,displayed:n}),n}currentTransaction(){let e=this.state.activeUpdate;return this.state.navigationBindingReplay&&null!==e&&this.state.isCurrent(e)?e:null}},_l="payload-live-preview",zl=Symbol.for("payload-live-preview.trusted-types"),Vl=new Set(["open","value","checked","selected"]),ql="__payloadLivePreviewDeprecationsWarned",Hl=new Set,Gl="data-payload-",Kl=new Set(["p","br","strong","b","em","i","u","s","strike","mark","small","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","blockquote","code","pre","kbd","samp","var","a","span","div","section","article","aside","header","footer","nav","figure","figcaption","img","picture","source","audio","video","sub","sup","hr","time","abbr","cite","q","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col"]),Jl=new Set(["input","button","textarea","select","option","label"]),Xl=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),Ql=new Set(["id","class","lang","dir","title","role","tabindex"]),Zl="aria-",Yl="data-",eo="data-payload-",to={a:new Set(["href","target","rel","download","hreflang","type"]),img:new Set(["src","srcset","sizes","alt","width","height","loading","decoding"]),picture:new Set([]),source:new Set(["src","srcset","sizes","type","media"]),audio:new Set(["src","controls","autoplay","loop","muted","preload"]),video:new Set(["src","poster","controls","autoplay","loop","muted","preload","width","height","playsinline"]),time:new Set(["datetime"]),abbr:new Set(["title"]),q:new Set(["cite"]),blockquote:new Set(["cite"]),table:new Set(["summary"]),th:new Set(["colspan","rowspan","scope","headers","abbr"]),td:new Set(["colspan","rowspan","headers"]),col:new Set(["span"]),colgroup:new Set(["span"]),ol:new Set(["start","reversed","type"]),li:new Set(["value"]),code:new Set(["class"]),pre:new Set(["class"])},io=new Set(["href","src","cite","poster"]),no=6,ro=1,lo=8,oo=(Error,new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"])),ao="strict",so=(Object.freeze({allowedTags:Kl,removeCompletely:Xl,globalAttributes:Ql,attributesByTag:to,urlAttributes:io}),Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="})),uo=/[&<>"\'/`=]/g,co=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),ho=/[&<>"\']/g,fo=/\\{\\{([\\s\\S]*?)\\}\\}/g,po="data-payload-",go=["input","textarea","select","option","button","label","details","summary","dialog","video","audio","progress","meter"],mo=["type","name","placeholder","open","disabled","readonly","required","checked","selected","value","min","max","step","rows","cols","for","controls","muted","loop","poster","src"],vo=/<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)\\b/gi,yo=64,bo=new Map,wo="data-payload-key",So="data-payload-nested-key",Ao="data-payload-nested-template",ko=class{constructor(e,t,i){fn(this,"deps",e);fn(this,"state",t);fn(this,"host",i)}planFragments(e,t){let{deps:i,state:n}=this,r=i.strategies.fragment;if(void 0===r)return null;let l=new Set(r.plan(i.root,e));for(let e of n.fragmentsOwed)i.root.contains(e)?l.add(e):n.fragmentsOwed.delete(e);return D(r,[...l].filter(e=>gi(e,t)),t)}escalateUnfaithful(e,t,i,n){if(e.routeRefreshed){this.kept(e,i);return}let{fragment:r,route:l}=this.deps.strategies,o=void 0===r?void 0:function(e){let t=[];for(let i of e){let e=i.fragmentBoundary;if(void 0===e)return;t.includes(e)||t.push(e)}return t}(i),a=void 0===o||o.every(e=>gi(e,n))?o:void 0;void 0===r||void 0===a?void 0!==l?(this.state.escalatedCount+=i.length,this.refreshRoute(e,t,l)):(pi(this.deps,this.state,i.length),this.kept(e,i)):(this.state.escalatedCount+=i.length,e.pendingFragments+=a.length,this.runFragments(e,t,D(r,a,n)))}kept(e,t){for(let i of t)this.state.display.shortfall(e,{kind:"unfaithful",field:i.fieldName})}hasUnboundChange(e,t){let{deps:i,state:n}=this;if(e.baseline||e.routeRefreshed)return!1;let r=function(e,t,i,n,r,l){let o=ee(e,n,l),a=ie(e,i,n,o),s=[];for(let e of t){if(rr.has(e))continue;let t=a(e);if("none"===t&&s.push(e),"below"!==t||void 0===r)continue;let n=te(e,i),{previous:l,next:u}=r;for(let{path:t}of Y(n,l[e],u[e],o))s.push(t)}return s}(i.cache,e.touched,e.locale,t,this.subfields(e),i.strategies),l=0;for(let e of r)o(n,e)&&(l+=1);let[a]=r;if(void 0===a)return!1;if("escalate"!==i.onUnfaithfulPatch||void 0===i.strategies.route){"escalate"===i.onUnfaithfulPatch&&pi(i,n,r.length);for(let t of r)n.display.shortfall(e,{kind:"unbound",field:t});return!1}return e.navigated?(n.routeAwaitsSave=!0,n.display.shortfall(e,{kind:"route-saved"}),!1):(i.log("route","LP0807",`field "${a}" has no binding; refreshing the route`),n.escalatedCount+=l,!0)}subfields(e){let{previousFields:t}=this.state.changes;return function(e,t,i){return"declared"===e&&void 0!==t&&void 0!==i?{previous:t,next:i}:void 0}(this.deps.subfieldCoverage,t,e.renderData?.fields)}plansRoute(e,t,i){let n=e=>!1===i||V(e,i),r=function(e,t,i){let n=e.rendered.flatMap(e=>"route"===e.strategy?e.paths:[]);for(let[t,i]of e.entries())i.some(e=>"route"===e.strategyKind)&&n.push(t);let r=new Set(t);for(let e of n){let[n=e]=e.split(".");t.has(n)&&(void 0===i||Z(e,i.previous,i.next))&&r.add(e)}return r}(this.deps.cache,t.touched,this.subfields(t));if(e.plan(this.deps.root,r,{inScope:e=>n($e(e))}))return!0;for(let[e,t]of this.deps.cache.entries())if(r.has(e)&&t.some(e=>"route"===e.strategyKind&&n(e.owner)))return!0;return!1}async runFragments(e,t,i){let{deps:n,state:r}=this,l=new AbortController,o=new Set(i.boundaries);for(let e of o)r.fragmentsOwed.delete(e);r.fragmentControllers.set(l,o);let a=t=>{o.delete(t)&&(e.pendingFragments-=1)},s=()=>r.isCurrent(e)&&!l.signal.aborted,u=e=>function(e,t,i){if(t.isConnected)return t;let n,r=t.getAttribute(Yn),l=t.getAttribute(er);for(let t of e.querySelectorAll(`[${Yn}]`))if(t.getAttribute(Yn)===r&&t.getAttribute(er)===l&&i(t)){if(void 0!==n)return;n=t}return n}(n.root,e,e=>gi(e,i.ownerKeys)),{emitter:d}=n,{message:c}=e,h=e.revision.revision,f=e.receivedAt,p={root:n.root,revision:h,receivedAt:f,fields:t.fields,locale:e.locale,collectionSlug:"string"==typeof c.collectionSlug?c.collectionSlug:void 0,globalSlug:"string"==typeof c.globalSlug?c.globalSlug:void 0,signal:l.signal,isCurrent:s,log:(e,t)=>{n.log("fragment",e,t)},morph:(e,t)=>{let i=s()?u(e):void 0;void 0!==i&&function(e,t,i){let n=e.ownerDocument.createElement("template");n.innerHTML=$t(t);let r=e.cloneNode(!1);r.append(n.content);let l=Ce(e);Nt(e,r,{keyAttributes:[wo],boundary:ye,retainBoundary:Te}),function(e){for(let t of e)t.isConnected||Cr.has(t)||(Cr.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}(l);let o=new Set(l);for(let t of Ce(e)){let e=o.has(t)?void 0:Re(t);void 0!==e&&i(t,e)}}(i,t,(e,t)=>{!function(e,t,i,n){if(t.warnedIslandStart)return;t.warnedIslandStart=!0;let r="element"===n?"<astro-island>":`client:${i.getAttribute("client")??""}`;e.warn(`[live-preview] LP0809: a fragment island cannot start: this page never loaded ${r}; render one on the page`)}(this.deps,this.state,e,t)})},patch:n=>{let r=u(n);void 0!==r&&(r!==n&&this.host.rebuildCache(),this.patchFallback(e,t,r,i.ownerKeys,s))},rendered:(e,t,i)=>{a(e);let n=u(e)??e;d.emitWhile("fragmentRender",{element:n,id:t,key:i,status:"rendered",revision:h,receivedAt:f},s)},failed:(t,i,l,o,c)=>{a(t);let p=u(t)??t;r.display.shortfall(e,{kind:"fragment",id:i,key:l,code:o});let g=`fragment "${i}" fell back to patch: ${c}`;n.log("fragment",o,g),d.emitWhile("error",{error:new Error(g),context:"fragment",code:o},s),d.emitWhile("fragmentRender",{element:p,id:i,key:l,status:"failed",code:o,revision:h,receivedAt:f},s)}},g={rendered:0,failed:0,superseded:0};try{g=await i.strategy.render(p,i.boundaries)}catch(t){if(n.log("fragment","LP0801",t),s()){for(let t of i.boundaries)p.patch(t),r.display.shortfall(e,he(t));g={rendered:0,failed:i.boundaries.length,superseded:0}}}r.fragmentStats.rendered+=g.rendered,r.fragmentStats.failed+=g.failed,r.fragmentStats.superseded+=g.superseded,r.fragmentControllers.delete(l);for(let e of o)a(e);s()&&(g.rendered>0&&this.host.restoreGuesses(e,t),0===e.pendingFragments&&0===n.scheduler.pendingCount&&r.complete(e),this.host.revealPending(e),s()&&(0===g.rendered||0===d.listenerCount("afterUpdate")||d.emitWhile("afterUpdate",{data:t,updatedCount:g.rendered,durationMs:Date.now()-f,revision:h,receivedAt:f,source:"fragment"},s)))}async refreshRoute(e,t,i){let{deps:n,state:r}=this;e.routeRefreshed?(r.routeStats.loopStopped+=1,n.log("route","LP0805",`revision ${String(e.revision.revision)} asked for a second refresh`)):(e.routeRefreshed=!0,await this.runRoute(e,t,i,!1).catch(e=>{this.routeFailed(e)}))}refreshAfterSave(){let{deps:e,state:t}=this,{route:i}=e.strategies,n=t.activeUpdate;!t.routeAwaitsSave||void 0===i||void 0===n?.renderData||(e.log("route","document saved; refreshing the route"),this.runRoute(n,n.renderData,i,!0).catch(e=>{this.routeFailed(e)}))}routeFailed(e){this.deps.log("route refresh failed:",e)}armRouteRetry(e,t,i,n,r){let{state:l}=this;null!==l.routeRetry&&clearTimeout(l.routeRetry),l.routeRetry=setTimeout(()=>{l.routeRetry=null,l.isCurrent(e)&&this.runRoute(e,t,i,r).catch(e=>{this.routeFailed(e)})},n)}async runRoute(e,t,i,n){let{deps:r,state:l}=this,o=l.routeStats,a=new AbortController;l.routeController?.abort(),l.routeController=a;let s,u=()=>!a.signal.aborted;try{s=await i.refresh({revision:e.revision.revision,receivedAt:e.receivedAt,signal:a.signal,isCurrent:u,log:(e,t)=>{r.log("route",e,t)},retryAfter:r=>{this.armRouteRetry(e,t,i,r,n)}})}catch(e){r.log("route","LP0801",e),s="failed"}if(!u())return;l.routeController=null;let d=l.activeUpdate;if(null===d)return;let c=d.renderData,h=()=>l.isCurrent(d);if("partial"===s?l.display.shortfall(d,{kind:"route-saved"}):("failed"===s||"superseded"===s||"refused"===s&&null===l.routeRetry)&&l.display.shortfall(d,{kind:"route-failed",outcome:s}),"refreshed"!==s&&"partial"!==s)"failed"===s?o.failed+=1:"refused"===s&&(o.refused+=1),void 0!==c&&this.host.reapply(d,c);else{if(o.refreshes+=1,"partial"===s&&(o.partial+=1),l.routeAwaitsSave="partial"===s&&!n,l.lastAppliedIdentity=new WeakMap,void 0!==c&&this.host.restoreGuesses(d,c),this.host.rebuildCache(),void 0===c||!h())return;this.host.reapply(d,c),r.emitter.listenerCount("afterUpdate")>0&&r.emitter.emitWhile("afterUpdate",{data:c,updatedCount:r.cache.elementCount,durationMs:Date.now()-d.receivedAt,revision:d.revision.revision,receivedAt:d.receivedAt,source:"route"},h)}}warnFragmentFallback(e){!function(e,t,i){t.warnedFragmentFallback||(t.warnedFragmentFallback=!0,e.warn(`[live-preview] LP0806: "${i.fieldName}" asks for the fragment strategy but no handler is configured; patching instead`))}(this.deps,this.state,e)}warnUnsupportedStrategy(e){!function(e,t,i){t.warnedStrategy.has(i.element)||(t.warnedStrategy.add(i.element),e.warn(`[live-preview] LP0407: "${i.fieldName}" asks for strategy "${String(i.strategy)}"; only patch, fragment and route exist`))}(this.deps,this.state,e)}patchFallback(e,t,i,n,r){if(r())for(let[l,o]of this.deps.cache.entries())for(let a of o){if(a.fragmentBoundary!==i||!1!==n&&!V(a.owner,n))continue;let o=U(t.fields,a,l,e.locale);void 0===o||!r()||this.deps.scheduler.schedule({target:a,value:this.host.transform(a,o,t.fields,r),allFields:t.fields,revision:e.revision,data:t})}}},To=new Set,Co={kind:"merge"},Ro=class{constructor(e,t,i){fn(this,"deps",e);fn(this,"state",t);fn(this,"strategies");fn(this,"navigationReplay");t.changes.keepValues="declared"===e.subfieldCoverage,t.display.host=function(e,t){return{outstanding:i=>!i.completed||i.pendingFragments>0||null!==t.routeController||null!==t.routeRetry||e.scheduler.pendingCount>0,report:t=>{"partial"===t.state&&e.a11y?.announcePartial(),e.emitter.emit("revisionDisplay",t)},failed:t=>{e.log("revision display failed:",t)}}}(e,t),this.strategies=new ko(e,t,{reapply:(e,t)=>{this.scheduleAllFields(e,t)},transform:(t,i,n,r)=>mi(e,t,i,n,r),rebuildCache:i,restoreGuesses:(e,t)=>{this.restoreGuesses(e,t)},revealPending:e=>{this.revealPending(e)}}),this.navigationReplay=new Bl(e,t,{schedule:(e,t,i)=>{this.scheduleAllFields(e,t,i)}})}handleUpdate(e,t,i){let{deps:n,state:r}=this;n.heartbeat.kick(),r.protocol.observe(function(e){let t=[];return Array.isArray(e.fieldSchemaJSON)&&t.push("schema-json"),"string"==typeof e.locale&&t.push("locale"),"string"==typeof e.previewToken&&t.push("preview-token"),"object"==typeof e.externallyUpdatedRelationship&&null!==e.externallyUpdatedRelationship&&t.push("relationship-events"),t}(e),n.log);let l=e.data;void 0!==l?void 0!==i&&this.acceptDataUpdate(e,l,t,i,!0):void 0!==e.protocolVersion&&r.protocol.applyVersion(e.protocolVersion,n.log)}handleReplay(e,t,i){let n=e.data;void 0!==n&&this.acceptDataUpdate(e,n,t,i,!1)}reapplyNavigationBindings(e){this.navigationReplay.reapplyBindings(e)}reapplyNavigationIslands(e,t=!1){this.navigationReplay.reapplyIslands(e,t)}acceptDataUpdate(e,t,i,n,r){let{deps:l,state:o}=this,a=r?o.relationships.inspect(e):null,s="string"==typeof e.locale?e.locale:o.locale,u=o.schema,d=o.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(u=e.fieldSchemaJSON,d=function(e,t=""){let i=new Map;return k(e,t,i,!1),k(e,t,i,!0),i}(e.fieldSchemaJSON));let c=o.activeUpdate;if(!o.isRunning()||null!==c&&c.revision.revision>n.revision)return;let h=null===a?null:o.relationships.commit(a),f=c,p={revision:n,message:e,rawData:t,locale:s,schema:u,schemaIndex:d,receivedAt:Date.now(),forceRender:null!==h||ue(f),countsAsUpdate:r,renderData:void 0,fragmentBoundariesRun:new WeakSet,touched:new Set,baseline:!1,navigated:!1,invalidated:new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1};o.locale=s,o.schema=u,o.schemaIndex=d,null!==f&&!f.completed&&f.countsAsUpdate&&(o.supersededCount+=1),o.activeUpdate=p,r&&(o.updateCount+=1),o.display.begin(p,n.revision),o.isCurrent(p)&&(l.scheduler.acceptRevision(n),o.isCurrent(p)&&(o.supersedeStrategies(),o.isCurrent(p)&&(null!==h&&(l.emitter.emitWhile("relationshipUpdate",{detail:h,timestamp:Date.now()},()=>o.isCurrent(p)),!o.isCurrent(p))||r&&void 0!==e.protocolVersion&&(o.protocol.applyVersion(e.protocolVersion,l.log),!o.isCurrent(p))||r&&l.connection.markConnected()&&(l.a11y?.announceConnected(),l.emitter.emit("connect",{origin:i,timestamp:Date.now()}),!o.isCurrent(p)||(l.log("connection","disconnected","\\u2192","connected"),!o.isCurrent(p)))||this.processUpdate(p).catch(e=>{l.log("update failed:",e)}))))}async processUpdate(e){let{deps:t,state:i}=this,n=await this.resolveIncomingFields(e);if(null===n||!i.isCurrent(e))return;let r=this.dataFor(e,n);t.emitter.listenerCount("beforeUpdate")>0&&(!await t.emitter.emitWhile("beforeUpdate",{data:r,revision:e.revision.revision,receivedAt:e.receivedAt,source:"patch",cancel:()=>{e.cancelled=!0,t.scheduler.cancelRevision(e.revision)}},()=>!e.cancelled&&i.isCurrent(e))||e.cancelled||!i.isCurrent(e))||this.applyFields(e,r,!1)}dataFor(e,t){let{message:i}=e;return{fields:t,...void 0!==e.schema?{schema:e.schema}:{},..."string"==typeof i.globalSlug?{globalSlug:i.globalSlug}:{},..."string"==typeof i.collectionSlug?{collectionSlug:i.collectionSlug}:{},...void 0!==e.locale?{locale:e.locale}:{}}}applyFields(e,t,i){let{deps:n,state:r}=this;if(!r.isCurrent(e))return;if(r.changes.isBaseline&&!i&&"off"!==n.autoBind){{let i=St(n,r,e,t.fields);!function(e,t,i,n,r,l){if(!l())return 0;let o=performance.now(),a=yt(e.root),s=dt(i,n);if(!l())return 0;let u=null===a?[]:vt(a,s);if(!l())return 0;let d=wt(e,u,r,"on the first message",l);if(!l())return 0;let c=function(e,t){let i=new Set;for(let{fieldName:e,stamps:n}of t){i.add(e);for(let e of[Nr,Er]){let t=n[e];void 0!==t&&i.add(t)}}let n=new Map;for(let[t,r]of e)null!==r&&i.has(r.field)&&n.set(t,r);return{fields:i,values:n}}(s,d),h=performance.now()-o;l()&&(t.autoBindGuesses=c,t.autoBindSearchMs=h,d.length)}(n,r,t.fields,e.locale,i,()=>r.isCurrent(e))}if(!r.isCurrent(e))return}let l=me(n.dependencies,n.cache.dependencyMap());if(!r.isCurrent(e))return;let o=r.changes.diff(t.fields,l,()=>r.isCurrent(e));if(null===o)return;let a=!i&&r.navigationReplayPending;a&&(r.navigationReplayPending=!1,r.navigationBindingReplay=!0),e.baseline=o.baseline&&!a,e.navigated=a,e.invalidated=i?To:o.invalidated,e.touched=i?To:new Set([...o.changed,...o.invalidated]),e.renderData=t,this.scheduleAllFields(e,t)}async resolveIncomingFields(e){let{deps:t,state:i}=this,n=e.rawData;if(null===t.merger)return n;let r=i.merges.decide(t,e);if(!r.merge)return r.fields;let{message:l}=e,o=i.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:l.collectionSlug,globalSlug:l.globalSlug,data:n,...void 0===e.schema?{}:{schema:e.schema},locale:e.locale});if(!o.leading)return this.applyMerged(e,o.result).catch(e=>{t.log("update failed:",e)}),r.fields;let a=await o.result;return i.isCurrent(e)?"merged"===a.status?(i.merges.recordMerged(a.doc,e.locale),a.doc):"superseded"===a.status?null:(i.display.shortfall(e,Co),r.fields):null}async applyMerged(e,t){let{state:i}=this,n=await t;"unavailable"===n.status&&i.display.shortfall(e,Co),"merged"===n.status&&i.isCurrent(e)&&(i.merges.recordMerged(n.doc,e.locale),this.applyFields(e,this.dataFor(e,n.doc),!0))}scheduleAllFields(e,t,i){let{deps:n,state:r}=this;if(!r.isCurrent(e))return;let l=void 0!==i,o=()=>r.isCurrent(e),a=St(n,r,e,t.fields);if(!o())return;let{touched:s}=e,u=n.strategies.route;if(l&&void 0!==u&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(i,a,e,t)){o()&&this.strategies.refreshRoute(e,t,u);return}let d=!l&&this.strategies.hasUnboundChange(e,a),c=r.routeRefreshOwed;if(!l&&void 0!==u&&!e.routeRefreshed&&(d||c||this.strategies.plansRoute(u,e,a))&&o()){r.routeRefreshOwed=!1,this.strategies.refreshRoute(e,t,u);return}let h=l?this.navigationReplay.fieldsForElements(i,s):s,f=this.navigationReplay.unrunFragmentPlan(e,this.strategies.planFragments(h,a),i);if(!o())return;let p=n.skipUnchanged,g=0;for(let[s,u]of n.cache.entries()){if(!o())return;for(let d of u){if(void 0!==i&&!i.has(d.element)||!1!==a&&!V(d.owner,a))continue;if(!0===f?.covers(d)){if(n.revealEditedField){let i=U(t.fields,d,s,e.locale);r.revealLedger.note(e,d,i)}continue}let u=d.strategyKind??W(d.element)??"unknown";if("unknown"===u){this.strategies.warnUnsupportedStrategy(d);continue}"fragment"===u&&null===f&&this.strategies.warnFragmentFallback(d);let c=U(t.fields,d,s,e.locale);if(void 0===c){r.absentFields.add(s);continue}if(!l&&n.revealEditedField&&r.revealLedger.note(e,d,c),!o())return;let h=mi(n,d,c,t.fields,o);if(!o())return;let m=p?I(d,h,t.fields,e.locale):void 0,v=r.lastAppliedIdentity.get(d.element);if(!e.forceRender&&n.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(s)){r.skippedUnchangedCount+=1;continue}let y={target:d,value:h,allFields:t.fields,revision:e.revision,...l?{}:{data:t},valueIdentity:m};n.scheduler.schedule(y),g+=1}}if(l||function(e,t,i,n,r){let{cache:l,strategies:o}=e,a={cache:l,warned:t,warn:e.warn};if(0===l.fieldCount||!1!==r&&!function(e,t){for(let i of e.values())if(V(i.owner,t))return!0;return!1}(l,r))return;let s=function(e,t,i,n){let r=ie(e,t,i,ee(e,i,n));return e=>"none"!==r(e)}(l,n,r,o);for(let[e,t]of Object.entries(i)){if(rr.has(e))continue;if(Tt(t)){kt(a,s,e,n,t);continue}if(!Rt(t)||s(e)||Ct(t))continue;let i=te(e,n);for(let[e,r]of Object.entries(t))!Tt(r)||rr.has(e)||kt(a,s,`${i}.${e}`,n,r)}if("declared"!==e.subfieldCoverage)return;let u=function(e,t,i,n,r){let l=ee(e,n,r),o=ie(e,i,n,l),a=[];for(let[e,n]of Object.entries(t)){if(rr.has(e)||"below"!==o(e))continue;let t=te(e,i);a.push(...Y(t,void 0,n,l))}return a}(l,i,n,r,o);for(let{path:e,value:t}of u)if(Tt(t)&&kt(a,s,e,n,t),Rt(t)&&!Ct(t))for(let[i,r]of Object.entries(t))Tt(r)&&kt(a,s,`${e}.${i}`,n,r)}(n,r.warnedOrphanFields,e.rawData,e.locale,a),o()){if(null!==f&&f.boundaries.length>0){for(let t of f.boundaries)e.fragmentBoundariesRun.add(t);e.pendingFragments+=f.boundaries.length,this.strategies.runFragments(e,t,f)}l||!o()||0===g&&(0===e.pendingFragments&&0===n.scheduler.pendingCount&&(r.complete(e),this.revealPending(e)),this.notifyIslands(e,t))}}notifyIslands(e,t){0!==e.touched.size&&this.navigationReplay.dispatchIslands(e,t,this.deps.cache.islands)}restoreGuesses(e,t){let{deps:i,state:n}=this;if("off"!==i.autoBind&&null!==n.autoBindGuesses){let r=St(i,n,e,t.fields);!function(e,t,i,n,r,l){if(!l())return 0;let o=t.autoBindGuesses,a=yt(e.root);if(null===o||0===o.fields.size||null===a)return 0;let s=new Map(o.values);for(let[e,t]of dt(i,n)){if(null===t||!o.fields.has(t.field))continue;let i=s.get(e);void 0===i?s.set(e,t):i?.field!==t.field&&s.set(e,null)}if(!l())return 0;let u=vt(a,s);l()&&wt(e,u,r,"after a server render",l).length}(i,n,t.fields,e.locale,r,()=>n.isCurrent(e))}}onFlush(e){let{deps:t,state:i}=this;i.lastFlush=e,e.deferred>0&&!i.warnedVisibilityGate&&(i.warnedVisibilityGate=!0,t.warn(`[live-preview] LP0301: visibility gate held ${String(e.deferred)} off-screen update(s) until scrolled into view; see visibilityGateThreshold`));let{revision:n,data:r}=e;if(void 0===n)return;let l=i.activeUpdate;if(null===l||!i.isCurrent(l)||!w(l.revision,n))return;i.display.deferred(l,e.deferred),0===l.pendingFragments&&i.complete(l);let o=()=>i.isCurrent(l)&&w(l.revision,n),a=r??l.renderData;if(this.revealPending(l),!o())return;let s=i.unfaithfulPatches;if(s.length>0){if(i.unfaithfulPatches=[],void 0!==a){let e=St(t,i,l,a.fields);this.strategies.escalateUnfaithful(l,a,s,e)}if(!o())return}void 0!==r&&(e.applied>0&&t.a11y?.announceUpdate(e.applied),o()&&(this.notifyIslands(l,r),o()&&0!==e.applied&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:r,updatedCount:e.applied,durationMs:e.durationMs,revision:n.revision,receivedAt:l.receivedAt,source:"patch"},o)))}revealPending(e){let t=this.state.revealLedger.commit(e);if(void 0!==t)try{ce(this.state.revealer,t)}catch(e){this.deps.log("reveal",e)}}revealField(e){let t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":ce(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},$o=class{constructor(e,t){fn(this,"apply");fn(this,"debounceMs");fn(this,"maxWaitMs");fn(this,"isVisible");fn(this,"gateThresholdValue");fn(this,"gateDisabled");fn(this,"getCacheSize");fn(this,"onFlush");fn(this,"scheduleFrame");fn(this,"cancelFrame");fn(this,"pending",new Map);fn(this,"replay",new Map);fn(this,"activeFlushes",new Set);fn(this,"debounceTimer",null);fn(this,"debounceToken",0);fn(this,"deadlineTimer",null);fn(this,"frameHandle",null);fn(this,"frameFallback",null);fn(this,"frameToken",0);fn(this,"windowUntil",0);fn(this,"activeRevision",null);fn(this,"activeRevisionCancelled",!1);fn(this,"destroying",!1);this.apply=e,this.debounceMs=t.debounceMs??50,this.maxWaitMs=t.maxWaitMs??4*this.debounceMs,this.isVisible=t.isVisible,this.gateThresholdValue=t.visibilityGateThreshold??50,this.gateDisabled=t.disableVisibilityGate??!1,this.getCacheSize=t.getCacheSize,this.onFlush=t.onFlush,this.scheduleFrame=t.scheduleFrame??("function"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):e=>setTimeout(()=>{e(performance.now())},0)),this.cancelFrame=t.cancelFrame??("function"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):e=>{clearTimeout(e)})}schedule(e){if(this.destroying||void 0!==e.revision&&(this.activeRevisionCancelled||null===this.activeRevision||!w(e.revision,this.activeRevision)))return;let t=this.pending.get(e.target.element);t?(t.value=e.value,t.allFields=e.allFields,t.revision=e.revision,t.data=e.data,t.valueIdentity=e.valueIdentity):this.pending.set(e.target.element,{target:e.target,value:e.value,allFields:e.allFields,revision:e.revision,data:e.data,valueIdentity:e.valueIdentity}),this.armDebounce()}acceptRevision(e){this.destroying||null!==this.activeRevision&&w(e,this.activeRevision)||null!==this.activeRevision&&function(e,t){return e.generation!==t.generation?e.generation-t.generation:e.revision-t.revision}(e,this.activeRevision)<0||(this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1,this.cancelScheduledWork())}cancelRevision(e){null===this.activeRevision||!w(e,this.activeRevision)||(this.clearWork(),this.activeRevisionCancelled=!0,this.cancelScheduledWork())}flushNow(){return this.cancelScheduledWork(),this.flush()}notifyVisible(e){let t=this.replay.get(e);if(!t||(this.replay.delete(e),!this.isCurrent(t)))return;let i=performance.now(),n=this.didApply(t)?1:0;this.onFlush?.(this.statsFor(t,n,0,performance.now()-i,1===n?[t.target.fieldName]:[]))}retarget(e){this.retargetBuffer(this.pending,e),this.retargetBuffer(this.replay,e);for(let t of this.activeFlushes)this.retargetBuffer(t,e)}forget(e){this.pending.delete(e),this.replay.delete(e);for(let t of this.activeFlushes)t.delete(e)}destroy(){if(!this.destroying){this.destroying=!0;try{this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0,this.cancelScheduledWork()}finally{this.destroying=!1}}}get pendingCount(){return this.pending.size}get replayCount(){return this.replay.size}get gateThreshold(){return this.gateThresholdValue}get gateActive(){return!this.gateDisabled&&this.getCacheSize()>this.gateThresholdValue}armDebounce(){let e=Date.now(),t=e>=this.windowUntil;if(this.windowUntil=e+this.debounceMs,t){this.requestFrame();return}let i=this.debounceToken+=1,n=this.debounceTimer;if(this.debounceTimer=null,null!==n&&clearTimeout(n),this.debounceToken!==i)return;let r=setTimeout(()=>{this.debounceToken===i&&(this.debounceTimer=null,this.pending.size>0&&this.requestFrame())},this.debounceMs);this.debounceToken===i&&(this.debounceTimer=r),null===this.deadlineTimer&&this.maxWaitMs>this.debounceMs&&(this.deadlineTimer=setTimeout(()=>{this.deadlineTimer=null,this.pending.size>0&&this.requestFrame()},this.maxWaitMs))}requestFrame(){let e=this.frameToken+=1,t=this.frameHandle;if(this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let i=!1,n=()=>{if(this.frameToken!==e||i)return;i=!0;let t=this.frameHandle;this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.flush()},r=this.scheduleFrame(n);i||this.frameToken!==e||(this.frameHandle=r,this.frameFallback=setTimeout(n,100))}clearFrameFallback(){clearTimeout(this.frameFallback??void 0),this.frameFallback=null}flush(){let e=performance.now();this.clearDeadline();let t=this.gateActive,i=this.pending;this.pending=new Map;let n,r=0,l=[],o=0;this.activeFlushes.add(i);try{for(let e of i.values()){if(!this.isCurrent(e))continue;let i=!t||this.isVisible(e.target.element)||vi(e.target);if(this.isCurrent(e)){if(n??(n=e),!i){this.replay.set(e.target.element,e),o+=1;continue}this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,l.push(e.target.fieldName))}}}finally{this.activeFlushes.delete(i)}let a=this.statsFor(n,r,o,performance.now()-e,l);return this.onFlush?.(a),a}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&w(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return Xn.has(e)}(this.apply)}retargetBuffer(e,t){let i=e.get(t.element);if(void 0!==i){if(!Ne(i.target,t)){e.delete(t.element);return}i.target=t}}clearWork(){this.pending.clear(),this.replay.clear();for(let e of this.activeFlushes)e.clear()}statsFor(e,t,i,n,r){return{applied:t,appliedFields:r,deferred:i,durationMs:n,...void 0!==e?.revision?{revision:e.revision}:{},...void 0!==e?.data?{data:e.data}:{}}}clearDeadline(){null!==this.deadlineTimer&&(clearTimeout(this.deadlineTimer),this.deadlineTimer=null)}cancelScheduledWork(){let e=this.debounceTimer,t=this.frameHandle;this.debounceToken+=1,this.frameToken+=1,this.debounceTimer=null,this.frameHandle=null,this.clearDeadline(),this.clearFrameFallback(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}},Fo=[0,500,1e3,2e3],No=class{constructor(e){fn(this,"deps");fn(this,"state",new mr);fn(this,"pipeline");fn(this,"writer");fn(this,"rootSentinel",null);fn(this,"scope",null);fn(this,"closingSession",!1);fn(this,"observedRoot",null);fn(this,"replayRetainedOnStart",!1);let{emitter:n,renderers:l}=e,o=void 0===e.log?i:t(e.log),a=void 0===e.warn?wn:t(e.warn),s=e.root??(typ','eof document<"u"?document:void 0);if(void 0===s)throw new Error("LivePreviewRuntime: no document; pass options.root");let u=new Zr({filter:e=>!function(e){let t=e;for(;null!==t;){if(we(t))return!0;t=t.parentElement}return!1}(e)}),d=new vl({onStructuralChange:()=>{this.rebuildCache()},onIslandHydrated:e=>{this.pipeline.reapplyNavigationIslands([e],!0)},onVisibilityChange:(e,t)=>{t&&c.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),c=new $o(O(e=>this.writer.apply(e)),{...void 0!==e.debounceMs?{debounceMs:e.debounceMs}:{},...void 0!==e.disableVisibilityGate?{disableVisibilityGate:e.disableVisibilityGate}:{},...void 0!==e.visibilityGateThreshold?{visibilityGateThreshold:e.visibilityGateThreshold}:{},isVisible:e=>d.isVisible(e),getCacheSize:()=>u.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),h=new Dn(e.originMatcher,{onUpdate:(e,t,i)=>{this.pipeline.handleUpdate(e,t,i)},onReplay:(e,t,i)=>{this.pipeline.handleReplay(e,t,i)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],o),n.emit("documentSave",{timestamp:Date.now()}),this.pipeline.documentSaved()},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,t)=>{if("token"===e){let e=new Error(`Preview token rejected (origin: ${t})`);n.emit("error",{error:e,context:"token",code:"LP0502"})}("shape"===e||"type"===e)&&!this.state.warnedProtocolShape&&(this.state.warnedProtocolShape=!0,a(`[live-preview] LP0503: ${t} posted a message this runtime does not recognise (${"type"===e?"unknown message type":"unexpected shape"}); it was ignored. A newer Payload or a custom sender: check that the versions match.`)),"source"===e&&!this.state.warnedForeignSource&&(this.state.warnedForeignSource=!0,a(`[live-preview] LP0501: a message from ${t} was ignored because it did not come from the window that framed or opened this page. \\`eventSourcePolicy\\` is \'parent-or-opener\' by default since 2.0, where 1.x accepted any window on a trusted origin. Set \\`eventSourcePolicy: \'any\'\\` if the admin posts from elsewhere.`)),o("LP0501 message rejected:",e,t)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),f=e.dataMerge;this.deps={emitter:n,cache:u,observers:d,scheduler:c,bus:h,connection:new Ol,heartbeat:new El({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:l,resolveRenderer:e.resolveRenderer??(e=>l[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,root:s,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??A,onHeartbeatTimeout:e.onHeartbeatTimeout,log:o,warn:a,a11y:S(e),serverURL:f?.serverURL,merger:void 0===f?null:new sl({serverURL:f.serverURL,...void 0!==f.apiRoute?{apiRoute:f.apiRoute}:{},...void 0!==f.depth?{depth:f.depth}:{},...void 0!==f.fetchFn?{fetchFn:f.fetchFn}:{},log:o}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:r(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new vr(this.deps,this.state),this.pipeline=new Ro(this.deps,this.state,()=>{this.rebuildCache()})}start(){let{state:e}=this;if(e.isRunning()||this.closingSession)return!1;e.suspended&&(this.replayRetainedOnStart=!0),e.started=!0,e.suspended=!1,this.openScope();try{return function(e){"react"===e.hydration?Qe():"vue"===e.hydration&&nt();let{root:t}=e;if(!ot(t)||"loading"!==t.readyState){rt(e);return}let i=()=>{e.isRunning()&&e.later(()=>{rt(e)})};t.addEventListener("DOMContentLoaded",i,{once:!0}),e.defer(()=>{t.removeEventListener("DOMContentLoaded",i)})}(this.startupHost()),!0}catch(e){throw this.rollbackFailedStart(),e}}startupHost(){let{state:e,deps:t}=this;return{root:t.root,hydration:t.hydration,isRunning:()=>e.isRunning(),defer:t=>{e.deferredStart=t,this.scope?.own(()=>{e.deferredStart===t&&(e.deferredStart=null,t())})},later:t=>{e.deferredStart=null;try{t()}catch(e){this.rollbackFailedStart(),this.reportError(e,"startup","LP0605")}},hydrated:t=>{e.hydration=t},warn:t.warn,startNow:()=>{this.startNow()}}}startNow(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=ot(t.root)?at(t.root):t.root;if(null===i)throw new Error("LivePreviewRuntime: document.body unavailable");if(t.observers.start(i),this.observedRoot=i,this.watchRootReplacement(),this.buildCacheAndObserve(),!e.isRunning()||(t.bus.attach(),t.emitter.emitWhile("init",{timestamp:Date.now()},()=>e.isRunning()),!e.isRunning()))return;let n=this.replayRetainedOnStart;this.replayRetainedOnStart=!1;let r=n&&t.heartbeat.resume();if(e.isRunning()&&(!n||r||(e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.navigationReplayPending=!0,t.bus.replayLastAccepted()||(e.navigationReplayPending=!1),e.isRunning())))for(let i of Fo){if(!e.isRunning())return;0===i?t.sendReady(t.readyTargets()):e.readyTimers.push(setTimeout(()=>{e.isRunning()&&this.sendReadyAfterStart()},i))}}suspend(){if(!this.state.isRunning())return!1;let e=this.release();return this.state.suspended=!0,e&&this.deps.emitter.emit("disconnect",{reason:"unload",timestamp:Date.now()}),!0}destroy(){let{state:e,deps:t}=this;if(!e.isRunning()&&!e.suspended)return;let i=!!e.isRunning()&&this.release();e.suspended=!1,this.replayRetainedOnStart=!1,t.bus.forgetLastAccepted(),i&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}openScope(){let{state:e,deps:t}=this,i=new yl(t.log);i.own(()=>{t.merger?.destroy(),e.merges.destroy()}),i.own(()=>{t.scheduler.destroy()}),i.own(()=>{t.observers.stop()}),i.own(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),i.own(()=>{e.abortStrategies()}),i.own(()=>{t.bus.detach()}),i.own(()=>{t.heartbeat.stop()}),i.own(()=>{for(let t of e.readyTimers)clearTimeout(t);e.readyTimers.length=0}),this.scope=i}release(){let{state:e,deps:t}=this;e.display.end(),e.activeUpdate=null,e.navigationBindingReplay=!1,e.started=!1;let i=this.scope;this.scope=null,this.closingSession=!0;try{i?.close()}finally{this.closingSession=!1}return t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release();try{this.deps.a11y?.detach()}catch(e){this.deps.log("runtime cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}navigationCommit(){let{state:e,deps:t}=this;!e.isRunning()||null!==e.deferredStart||(this.cancelActiveUpdate(!0),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!0),e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.isRunning()&&(t.bus.advanceGeneration(),e.navigationReplayPending=!0,this.followReplacedRoot()||this.rebuildCache(),e.isRunning()&&(t.bus.replayLastAccepted(),e.isRunning()&&this.sendReadyAfterStart())))}watchRootReplacement(){let{root:e}=this.deps;!ot(e)||typeof MutationObserver>"u"||(this.rootSentinel?.disconnect(),this.rootSentinel=new MutationObserver(()=>{this.followReplacedRoot()}),this.rootSentinel.observe(e.documentElement,{childList:!0}))}followReplacedRoot(){let{root:e}=this.deps;if(!this.state.isRunning()||!ot(e))return!1;let t=at(e);return null!==t&&t!==this.observedRoot&&(this.observedRoot=t,this.deps.observers.start(t),this.rebuildCache(),!0)}get status(){return this.deps.connection.status}get cache(){return this.deps.cache}get updateCount(){return this.state.updateCount}get protocol(){return this.state.protocol.negotiation}inspect(){return function(e,t){let{cache:i,scheduler:n}=e,r=t.protocol.negotiation,l=t.activeUpdate,o=t.lastFlush,a=[],s=new Set,u=[];for(let[e,t]of i.entries()){a.push(e);for(let i of t)void 0!==i.owner&&s.add(i.owner),void 0!==i.guessed&&u.push({field:e,matched:i.guessed,attribute:i.targetAttribute??("IMG"===i.element.tagName?"src":void 0)})}return{version:ul,started:t.started,status:e.connection.status,origins:{trusted:[...e.readyTargets()],locked:e.lockedOrigin()},protocol:{ours:r.ours,theirs:r.theirs,negotiated:r.negotiated,capabilities:[...r.capabilities].sort(),observed:[...r.observed].sort(),profile:Ge(r.observed).name},revisions:{accepted:t.updateCount,superseded:t.supersededCount,completed:t.completedCount,skippedUnchanged:t.skippedUnchangedCount,active:null===l?void 0:l.revision.revision,display:t.display.snapshot()},bindings:{elements:i.elementCount,fields:i.fieldCount,fieldNames:a.sort(),absentFields:[...t.absentFields].sort(),orphanFields:[...t.warnedOrphanFields].sort(),ownerScoped:e.scopeBindingsByOwner,owners:[...s].sort(),guessed:u.sort((e,t)=>e.field.localeCompare(t.field)),autoBind:{mode:e.autoBind,searchMs:t.autoBindSearchMs}},route:{handler:void 0!==e.strategies.route,...t.routeStats},fidelity:{mode:e.onUnfaithfulPatch,canEscalate:void 0!==e.strategies.fragment||void 0!==e.strategies.route,unfaithful:t.unfaithfulCount,escalated:t.escalatedCount,fields:[...t.unfaithfulFields].sort()},hydration:{mode:e.hydration??"off",state:t.hydration},fragments:{handler:void 0!==e.strategies.fragment,inFlight:l?.pendingFragments??0,...t.fragmentStats},scheduler:{pending:n.pendingCount,deferred:n.replayCount,visibilityGateThreshold:n.gateThreshold,visibilityGateActive:n.gateActive,lastFlush:null===o?void 0:{applied:o.applied,appliedFields:o.appliedFields,deferred:o.deferred,durationMs:o.durationMs}},plugins:[],renderers:Object.keys(e.renderers).sort()}}(this.deps,this.state)}buildCacheAndObserve(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=t.cache.buildFromRoot(t.root);if(t.log("cache",i),e.isRunning()&&(t.emitter.emitWhile("cacheRefresh",i,()=>e.isRunning()),e.isRunning()))for(let i of t.cache.values()){if(!e.isRunning())return;t.observers.observeElement(i.element)}}rebuildCache(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=new Map,n=t.cache.islandOwners,r=new Set(t.cache.navigationReplayRoots);for(let e of t.cache.values())i.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),!e.isRunning())return;let l=new Set(t.cache.navigationReplayRoots.filter(e=>!r.has(e)));for(let e of t.cache.values()){let n=i.get(e.element);void 0!==n&&Ne(n,e)?t.scheduler.retarget(e):(t.scheduler.forget(e.element),l.add(e.element)),i.delete(e.element)}for(let e of i.values())t.scheduler.forget(e.element);l.size>0&&this.pipeline.reapplyNavigationBindings(l);let o=t.cache.islands.filter(e=>!n.has(e)||t.scopeBindingsByOwner&&n.get(e)!==t.cache.islandOwners.get(e));o.length>0&&this.pipeline.reapplyNavigationIslands(o)}onHeartbeatTimeout(){let{state:e,deps:t}=this;if(!e.isRunning()||(this.cancelActiveUpdate(!1),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!1),!e.isRunning()))return;t.bus.advanceGeneration(),t.bus.forgetLastAccepted(),e.navigationBindingReplay=!1;let i=t.connection.markDisconnected();try{t.onHeartbeatTimeout?.()}catch(e){t.log("heartbeat:",e)}e.isRunning()&&(i&&this.isIdleDisconnected()&&(t.a11y?.announceDisconnected(),t.emitter.emitWhile("disconnect",{reason:"timeout",timestamp:Date.now()},()=>this.isIdleDisconnected()),!e.isRunning()||(this.isIdleDisconnected()&&t.log("connection","connected","\\u2192","disconnected"),!e.isRunning()))||this.sendReadyAfterStart())}cancelActiveUpdate(e){let{state:t,deps:i}=this,n=t.activeUpdate;t.display.end(),t.activeUpdate=null,null!==n&&(n.cancelled=!0,i.scheduler.cancelRevision(n.revision),e&&!n.completed&&n.countsAsUpdate&&(t.supersededCount+=1))}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,i){let n=e instanceof Error?e:new Error(String(e));this.deps.emitter.emit("error",{error:n,context:t,code:i})}isIdleDisconnected(){return this.state.isRunning()&&"disconnected"===this.deps.connection.status&&null===this.state.activeUpdate}},Mo=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Eo=/^https?:\\/\\/[^/?#\\s]+$/i,Oo=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],xo=class{constructor(e={}){mn(this,Lo);let t=new Set;for(let i of e.additionalOrigins??[]){let e=bi(i);void 0!==e&&t.add(e)}let i;if(e.enableReferrerDetection??1){let t=e.referrer??(typ','eof document<"u"?document.referrer:"");if(t.length>0)try{let e=new URL(t).origin;e&&"null"!==e&&(i=e)}catch{}}let n=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??function(){let e=function(){if(!(typ','eof process>"u"))return"production"}();if(void 0!==e)return"production"!==e;if(typ','eof window<"u"){let e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e}return!1}());vn(this,Lo,[t,i,n,void 0!==i,void 0,typeof location>"u"?void 0:location.ancestorOrigins?.[0]])}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==gn(this,Lo)[4]?e===gn(this,Lo)[4]:!!(gn(this,Lo)[0].has(e)||0===gn(this,Lo)[0].size&&void 0!==gn(this,Lo)[1]&&e===gn(this,Lo)[1]||gn(this,Lo)[2]&&Mo.test(e)))}lockOrigin(e){return!!this.matches(e)&&(gn(this,Lo)[4]=e,!0)}unlockOrigin(){let e=gn(this,Lo)[4];return gn(this,Lo)[4]=void 0,e}get lockedOrigin(){return gn(this,Lo)[4]}enumerate(){if(void 0!==gn(this,Lo)[4])return[gn(this,Lo)[4]];let e=new Set(gn(this,Lo)[0]);0===gn(this,Lo)[0].size&&void 0!==gn(this,Lo)[1]&&e.add(gn(this,Lo)[1]);let t=gn(this,Lo)[5];if(gn(this,Lo)[2]&&void 0!==t)Mo.test(t)&&e.add(t);else if(gn(this,Lo)[2])for(let t of Oo)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return gn(this,Lo)[3]}get isProductionUnconfigured(){return!(!yi()||gn(this,Lo)[0].size>0||gn(this,Lo)[2]||void 0!==gn(this,Lo)[1])}get isReferrerOnlyTrust(){return!(gn(this,Lo)[0].size>0||gn(this,Lo)[2])&&void 0!==gn(this,Lo)[1]}},Lo=new WeakMap,Po="astro:page-load",Uo="astro:after-swap",Io={1:"left",2:"center",3:"right",4:"justify"},jo=new Set(["left","center","right","justify","start","end"]),Do=new Set(["h1","h2","h3","h4","h5","h6"]),Wo=\' target="_blank" rel="noopener noreferrer"\',Bo=(e,t)=>{let i=t.renderChildren(e.children??[]),n=Ti(e.fields),r=function(e,t){if("internal"===t?.linkType)return function(e){let t=Ti(Ti(e)?.value),i=t?.url;if("string"==typeof i&&i.length>0)return i;let n=t?.slug;return"string"==typeof n&&n.length>0?`/${n}`:void 0}(t.doc);let i=t?.url??e.url;return"string"==typeof i&&i.length>0?i:void 0}(e,n);if(void 0===r||!N(r))return i;let l="string"==typeof e.title?` title="${Vt(e.title)}"`:"";return`<a href="${qt(r)}"${function(e,t,i){if(!0===t?.newTab||M(i))return Wo;let n="string"==typeof e.target?e.target:"";return""===n?"":"_blank"===n?Wo:` target="${Vt(n)}"`}(e,n,r)}${l}>${i}</a>`},_o=new Map,zo=".lp-block:empty,.lp-inline-block:empty",Vo={text:e=>{let t=Vt("string"==typeof e.text?e.text:""),i="number"==typeof e.format?e.format:0;return!!(16&i)&&(t=`<code>${t}</code>`),!!(1&i)&&(t=`<strong>${t}</strong>`),!!(2&i)&&(t=`<em>${t}</em>`),!!(8&i)&&(t=`<u>${t}</u>`),!!(4&i)&&(t=`<s>${t}</s>`),!!(32&i)&&(t=`<sub>${t}</sub>`),!!(64&i)&&(t=`<sup>${t}</sup>`),!!(128&i)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<p${Ai(e)}${ki(e)}>${i}</p>`},heading:(e,t)=>{let i="string"==typeof e.tag?e.tag.toLowerCase():"h2",n=Do.has(i)?i:"h2",r=t.renderChildren(e.children??[]);return`<${n}${Ai(e)}${ki(e)}>${r}</${n}>`},list:(e,t)=>{let i="string"==typeof e.listType?e.listType:"bullet",n="number"===i?"ol":"ul",r="number"===i&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",l="check"===i?\' role="list"\':"",o=t.renderChildren(e.children??[]);return`<${n}${Ai(e)}${ki(e)}${r}${l}>${o}</${n}>`},listitem:(e,t)=>{let i=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${ki(e)}>${i}</li>`;let n="number"==typeof e.value?` value="${Vt(String(e.value))}"`:"";return`<li${Ai(e)}${ki(e)}${n}>${i}</li>`},link:Bo,autolink:Bo,quote:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<blockquote${Ai(e)}${ki(e)}>${i}</blockquote>`},code:e=>{let t=$i("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${Vt(Mi(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${$i(e.highlightType)}"`:""}>${Vt(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=Ci(e.value);if(void 0===t)return"";let i=t.url;if("string"!=typeof i||!N(i))return"";let n="string"==typeof t.mimeType?t.mimeType:"";return n.startsWith("video/")?function(e,t){return`<video controls${Ei(e)}><source src="${qt(t)}"${Oi(e)}></video>`}(t,i):n.startsWith("audio/")?function(e,t){return`<audio controls><source src="${qt(t)}"${Oi(e)}></audio>`}(t,i):""===n||n.startsWith("image/")?function(e,t){let i="string"==typeof e.alt?Vt(e.alt):"";return`<img src="${qt(t)}" alt="${i}"${Ei(e)} loading="lazy" decoding="async">`}(t,i):function(e,t){let i="string"==typeof e.filename?Vt(e.filename):Vt(t);return`<a href="${qt(t)}" target="_blank" rel="noopener noreferrer">${i}</a>`}(t,i)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",i=Ti(e.value),n=Vt((i&&Ni(i))??`#${t}`),r=$i(t),l=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,o=i?.url;return"string"==typeof o&&N(o)?`<a href="${qt(o)}"${l}>${n}</a>`:`<span${l}>${n}</span>`},block:(e,t)=>Li(e,t,"div","lp-block"),inlineBlock:(e,t)=>Li(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${Ai(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{let i="number"==typeof e.headerState?e.headerState:0,n=3&i?"th":"td";return`<${n}${1===i?\' scope="col"\':2===i?\' scope="row"\':""}${Pi("colspan",e.colSpan)}${Pi("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${n}>`}},qo=new Map,Ho=!1,Go="data-payload-text",Ko=new Set,Jo=new Set,Xo=new Set(["DIV","SECTION","ARTICLE"]),Qo={name:"richText",render:O((e,t,i)=>{let n=e.element;if(Qt(t)){n.textContent="";return}let r=i.sanitizerPolicy;if(void 0!==i.renderRichText){let l=i.renderRichText(t,{fieldName:e.fieldName,element:n,locale:i.locale});n.innerHTML=$t(It(l,r));return}if(Ui(t)){if(pe(t)){n.textContent="";return}let l=new Map,o=Wi(n,It(function(e,t={}){if(!Ui(e))return"";let i=function(e){let t={renderChildren:e=>{let i="";for(let n of e)i+=Ii(n,t);return i},resolveAlignment:wi,resolveIndent:Si,onUnrenderedBlock:e};return t}(t.onUnrenderedBlock).renderChildren(e.root.children);return!1===t.sanitize?i:void 0!==t.document?Ut(i,{document:t.document}):!0===t.requireDocument||void 0!==Wt()?Ut(i):(function(){if(!Ho){Ho=!0;try{console.warn(\'[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.\')}catch{}}}(),i)}(t,{sanitize:!1,onUnrenderedBlock:(e,t)=>{l.set(t,e)}}),r));for(let[t,n]of o){let r=l.get(t);void 0!==r&&_i(e,i,r,n)}return}if("string"!=typeof t)return!1;n.innerHTML=$t(It(t,r))})},Zo={name:"html",render(e,t,i){if(Qt(t)){e.element.textContent="";return}let n="string"==typeof t?t:Xt(t);e.element.innerHTML=$t(It(n,i.sanitizerPolicy))}},Yo=new WeakSet,ea=Vi("url"),ta=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,ia=Vi("email",function(e){let t=e.trim();return ta.test(t)||!t.includes("@")?t:`mailto:${t}`}),na=["src","srcset","sizes"],ra=new WeakMap,la=/^\\S*[/.:]\\S*$/,oa={name:"image",render:O((e,t,i)=>{let n=e.element;if("IMG"===n.tagName&&e.altField===e.fieldName&&void 0===e.srcField&&("string"==typeof t||Qt(t))){n.alt=t??"";return}if(Qt(t)){Ji(n);return}let r=void 0!==e.locale,{media:l,candidate:o}=function(e,t,i,n){let r=void 0!==e.srcField&&e.srcField.length>0?L(i.allFields,e.srcField,i.locale,n):t,l=Ci(r);return{media:l,candidate:void 0===l?r:l.url}}(e,t,i,r);if(void 0===l&&"string"==typeof o&&!la.test(o.trim()))return!1;let a=zi(n,e.fieldName,o,void 0===l?void 0:i.serverURL);if("none"===a.kind)return!1;if("unsafe"!==a.kind){if("IMG"===n.tagName){let t=n;Hi(t,a.url,l,i.serverURL);let o=function(e,t,i,n,r){if(void 0!==t&&t.length>0){let e=L(i,t,n,r);return"string"==typeof e?e:void 0}return e?.alt}(l,e.altField,i.allFields,i.locale,r);void 0!==o&&(t.alt=o);return}n.style.backgroundImage=`url(\'${function(e){return e.replace(/[\'"()\\\\]/g,"\\\\$&")}(a.url)}\')`}else Ji(n)})},aa={name:"upload",render:O((e,t,i)=>{let n=e.element;if(Qt(t)){Xi(n);return}let r=Ci(t);if(void 0===r)return!1;let l=zi(n,e.fieldName,r.url,i.serverURL);if("none"===l.kind)return!1;if("unsafe"===l.kind){Xi(n);return}let o=l.url;if("IMG"===n.tagName){let e=n;Hi(e,o,r,i.serverURL),void 0!==r.alt&&(e.alt=r.alt);return}if("A"===n.tagName){n.setAttribute("href",o),n.textContent=r.filename??o;return}let a=Vt(r.filename??o);n.innerHTML=$t(`<a href="${qt(o)}">${a}</a>`)})},sa={name:"relationship",render(e,t){let i=e.element;if(Qt(t))i.removeAttribute("href"),i.textContent="";else{if("A"===i.tagName&&!Array.isArray(t)){let n=zi(i,e.fieldName,Ti(t)?.url);"safe"===n.kind?i.setAttribute("href",n.url):"unsafe"===n.kind&&i.removeAttribute("href")}i.textContent=Array.isArray(t)?t.map(Qi).join(", "):Qi(t)}}},ua={name:"select",render(e,t,i){let n=e.element,r=Qt(t)?[]:function(e){return Array.isArray(e)?e.map(Xt):[Xt(e)]}(t);if("SELECT"!==n.tagName){if("INPUT"===n.tagName&&"radio"===n.type){let e=n;e.checked=r.includes(e.value);return}n.textContent=r.map(e=>function(e,t){let i=t.schema?.options;if(!Array.isArray(i))return e;for(let t of i){let i=Ti(t);if(void 0!==i&&Xt(i.value)===e)return"string"==typeof i.label?i.label:e}return e}(e,i)).join(", ")}else!function(e,t){if(e.multiple)for(let i of Array.from(e.options))i.selected=t.includes(i.value);else e.value=t[0]??""}(n,r)}},da=new Set(["","false","0","off","no"]),ca={name:"checkbox",render(e,t){let i=e.element,n=function(e){return"boolean"==typeof e?e:"string"==typeof e?!da.has(e.trim().toLowerCase()):"number"==typeof e?0!==e:null!=e}(t);"INPUT"!==i.tagName||"checkbox"!==i.type?i.hasAttribute("aria-checked")?i.setAttribute("aria-checked",n?"true":"false"):i.textContent=n?"true":"false":i.checked=n}},ha=new Map,fa=new Map,pa=new Set(["short","medium","long","full"]),ga=new Set(["short","medium","long","full"]),ma=/^[A-Za-z]{3}$/u,va=/^[0-4]$/u,ya=new WeakSet,ba={name:"date",render(e,t,i){let n=e.element;if(Qt(t)){"INPUT"===n.tagName?n.value="":(n.removeAttribute("datetime"),n.textContent="");return}let r="number"==typeof t?t:Xt(t),l=new Date(r),o=!Number.isNaN(l.getTime()),a=String(r);"INPUT"!==n.tagName?("TIME"===n.tagName&&n.setAttribute("datetime",o?l.toISOString():a),n.textContent=o?function(e,t,i){let n=t.locale??i.locale??u(),r=nn("date",t.format,t.element,t.fieldName)??wa;try{return function(e,t){let i=Zi(e,t);return Zt(fa,i)??Yt(fa,i,new Intl.DateTimeFormat(e,t),64)}(n,r).format(e)}catch{return e.toISOString()}}(l,e,i):a):n.value=o?function(e,t){let i=`${String(t.getFullYear()).padStart(4,"0")}-${rn(t.getMonth()+1)}-${rn(t.getDate())}`,n=`${rn(t.getHours())}:${rn(t.getMinutes())}`;return"date"===e?i:"datetime-local"===e?`${i}T${n}`:"time"===e?n:t.toISOString()}(n.type,l):a}},wa={dateStyle:"medium",timeStyle:"short"},Sa={name:"number",render(e,t,i){let n=e.element;if(Qt(t)){"INPUT"===n.tagName?n.value="":n.textContent="";return}let r="number"==typeof t?t:Number(Xt(t));Number.isNaN(r)?n.textContent=Xt(t):"INPUT"!==n.tagName?n.textContent=function(e,t,i){let n=t.locale??i.locale??u(),r=nn("number",t.format,t.element,t.fieldName);try{return function(e,t){let i=Zi(e,t);return Zt(ha,i)??Yt(ha,i,new Intl.NumberFormat(e,t),64)}(n,r).format(e)}catch{return String(e)}}(r,e,i):n.value=String(r)}},Aa={name:"array",render:O((e,t,i)=>{let n=e.element;if(Qt(t)){n.textContent="";return}if(!Array.isArray(t))return!1;let r=e.arrayTemplate;if(void 0!==r&&r.length>0){let e=function(e,t){let i=Ht(t),n="";for(let r=0;r<t.length;r+=1)n+=Gt(e,t[r],r,Xt,i);return n}(r,t),l=i.sanitizerPolicy,o=ei(r),a=Kt(n);n.innerHTML=$t(It(e,l,o));for(let e of Array.from(n.children))Jt(e,a);return}n.textContent=t.map(Xt).join(e.arraySeparator??", ")})},ka=new Map;!function(){if(typ','eof window>"u"||!yi()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(dn());if(void 0!==e&&(void 0===e.configSignature||e.configSignature===t))return e.refresh(),e;let[i=[],n="",l="/api",o=1,a=!1,s=50,u=!0,d=0,c=!1,h=50,f="200px",p=!0,g=!1,m=!1,v=!0,y="parent-or-opener",b="strict",w,S=!1,A=!1,k,T,C="off",R,$,F=[],N="descendant"]=dn(),M=function(e){let t=typeof __LIVE_PREVIEW_FRAGMENT__<"u"?__LIVE_PREVIEW_FRAGMENT__:void 0,i=t??(typeof __LIVE_PREVIEW_ROUTE__<"u"?__LIVE_PREVIEW_ROUTE__:void 0);if(void 0===i)return;let n=i.createRouteStrategy();return void 0===t||void 0===e||""===e?{route:n}:{fragment:t.createFragmentStrategy({endpoint:e}),route:n}}(w),E=new xo({additionalOrigins:i,enableReferrerDetection:!p,enableLocalhostMatching:!g});E.isProductionUnconfigured?wn("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):E.isReferrerOnlyTrust&&wn("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let O=new An,x=function(){let e=[Qo,Zo,ea,ia,oa,aa,sa,ua,{...ua,name:"radio"},ca,ba,Sa,Aa,{...Aa,name:"blocks"}];return function(e=[]){let t={};for(let i of e)t[i.name]=i;for(let[e,i]of ka)t[e]=i;return Object.freeze(t)}([Di("text"),Di("textarea"),...e,ln()])}(),L=new No({renderers:x,originMatcher:e=>E.matches(e),lockedOrigin:()=>E.lockedOrigin,readyTargets:()=>E.enumerate(),emitter:O,eventSourcePolicy:y,...""!==n?{dataMerge:{serverURL:n,apiRoute:l,depth:o}}:{},debounceMs:s,heartbeatMs:d,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:u,scopeBindingsByOwner:m,subfieldCoverage:N,skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:r({onUnfaithfulPatch:T,onUnboundChange:k}),autoBind:C,...void 0!==R?{hydration:R}:{},sanitizerPolicy:b,...void 0!==M?{strategies:M}:{},onHeartbeatTimeout:()=>{E.unlockOrigin()},...a?{log:(...e)=>{Sn("[live-preview]",...e)}}:{}});O.on("connect",e=>{E.lockOrigin(e.origin)}),L.start(),e?.destroy();let P=function(e,t={}){let i=t.windowTarget??globalThis.window,n=t.documentTarget??globalThis.document,r=[...new Set(t.softNavigationEvents??[])],l=()=>{e.suspend()},o=t=>{!0===t.persisted&&e.resume()},a=!1,s=()=>{a=!0},u=t=>{if(t.type===Po){if(!a)return;a=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()},d=!1;i?.addEventListener("pagehide",l),i?.addEventListener("pageshow",o);for(let e of r)n?.addEventListener(e,u);let c=r.includes(Po);return c&&n?.addEventListener(Uo,s),()=>{if(!d){d=!0,i?.removeEventListener("pagehide",l),i?.removeEventListener("pageshow",o);for(let e of r)n?.removeEventListener(e,u);c&&n?.removeEventListener(Uo,s)}}}({suspend:()=>L.suspend(),resume:()=>L.start(),refreshCache:()=>{L.refreshCache()},refreshAfterNavigation:()=>{L.navigationCommit()}},{softNavigationEvents:F}),U=Object.freeze({version:ul,configSignature:t,destroy:()=>{P(),L.destroy();let e=window;e.__livePreview===U&&delete e.__livePreview},refresh:()=>{L.refreshCache()},refreshAfterNavigation:()=>{L.navigationCommit()},enumerateOrigins:()=>E.enumerate(),inspect:()=>L.inspect()});try{Object.defineProperty(window,"__livePreview",{value:U,writable:!1,configurable:!0})}catch(e){throw P(),L.destroy(),e}}()})();'].join(""),p=/* @__PURE__ */['"use strict";var __LIVE_PREVIEW_FRAGMENT__=(()=>{var P=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var pe=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},ge=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of me(t))!ye.call(e,o)&&o!==n&&P(e,o,{get:()=>t[o],enumerable:!(a=fe(t,o))||a.enumerable});return e};var he=e=>ge(P({},"__esModule",{value:!0}),e);var Ye={};pe(Ye,{createFragmentStrategy:()=>ce,createRouteStrategy:()=>ue});function k(e,t){let n=new AbortController,a=!1,o=()=>{n.abort()};e.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>{a=!0,n.abort()},t);return{signal:n.signal,timedOut:()=>a,dispose:()=>{clearTimeout(r),e.removeEventListener("abort",o)}}}function R(e){return e instanceof Error?e.message:String(e)}var D="data-payload-island",Qe=`astro-island, [${D}]`,w="data-payload-owned",be="data-payload-morph";function F(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(be)||z(e)||e.hasAttribute(w))return!0;let n=e.getAttribute("contenteditable");return n!==null&&n!=="false"}function Ee(e){return e.tagName.toLowerCase()==="astro-island"||e.hasAttribute(D)}function Se(e){return e.getAttribute(D)==="patch"}function z(e){return Ee(e)&&!Se(e)}function V(e){let t=e;for(;t!==null;){if(z(t))return!0;t=t.parentElement}return!1}var Re=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],v=new WeakMap,G=new WeakSet;function W(e){return e.tagName.toLowerCase()==="astro-island"}function q(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]")){if(n.parentElement?.closest("astro-island")!==e)continue;let a=n.getAttribute("name")??n.getAttribute("data-astro-template")??"";t+=`${a}\\0${n.innerHTML}\\0`}return t}function Ae(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return t!==void 0&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}function j(e,t){if(!W(e)||!W(t))return!0;let n=q(t);if(!(Re.every(r=>e.getAttribute(r)===t.getAttribute(r))&&(v.get(e)??q(e))===n&&(e.getAttribute("props")===t.getAttribute("props")||Ae(e))))return v.set(t,n),!1;v.set(e,n);let o=t.getAttribute("props");return o!==e.getAttribute("props")&&(e.setAttribute("ssr",""),o===null?e.removeAttribute("props"):e.setAttribute("props",o)),!0}function Y(e){return Array.from(e.querySelectorAll("astro-island"))}function X(e){for(let t of e)t.isConnected||G.has(t)||(G.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}function O(e){if(e==null)return[];let t=new Set,n=[];for(let a of e.split(/[\\s,]+/)){let o=a.trim();o.length===0||t.has(o)||(t.add(o),n.push(o))}return n}var A="data-payload-fragment",I="data-payload-fragment-key";var Te="data-payload-depends";function B(e){let t=e.getAttribute(A);if(t===null||t.length===0)return null;let n=e.getAttribute(I);return{element:e,id:t,key:n===null||n.length===0?void 0:n,dependsOn:O(e.getAttribute(Te))}}function J(e,t){let n=[];for(let a of e.querySelectorAll(`[${A}]`)){let o=B(a);o===null||V(a)||o.dependsOn.length>0&&!o.dependsOn.some(r=>t.has(r))||n.push(o)}return n}var Q="x-payload-fragment-version";function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Z(e){if(!_(e))return null;let{html:t,boundary:n,revision:a,metadata:o}=e;return typeof t!="string"||!_(n)||typeof n.id!="string"||n.key!==void 0&&typeof n.key!="string"||typeof a!="number"||!_(o)||typeof o.renderedAt!="string"||typeof o.renderer!="string"?null:e}function ee(e){let t={};for(let[n,a]of Object.entries(e))a!==void 0&&(t[n]=a);return t}function L(e){return e.reason instanceof Error?e.reason:new DOMException("The operation was aborted.","AbortError")}function C(e){return e?.aborted===!0}function te(e){let t=0,n=[],a=()=>{let o=n.shift();o===void 0?t-=1:o.resume()};return async(o,r)=>{if(r!==void 0&&C(r))throw L(r);if(t<e)t+=1;else if(await new Promise((d,m)=>{let l=()=>{},u={resume:()=>{l(),d()}};if(n.push(u),r!==void 0){let s=()=>{let c=n.indexOf(u);c!==-1&&(n.splice(c,1),l(),m(L(r)))};l=()=>{r.removeEventListener("abort",s)},r.addEventListener("abort",s,{once:!0}),C(r)&&s()}}),r!==void 0&&C(r))throw a(),L(r);try{return await o()}finally{a()}}}var xe=5e3,ke=4,Fe=512*1024,T={status:"superseded"};function b(e,t){return{status:"failed",code:e,reason:t}}function Oe(e){let t=()=>{throw new TypeError(\'createFragmentStrategy: endpoint must be a same-origin path starting with "/"\')};if((typeof e!="string"||!e.startsWith("/")||e.startsWith("//")||e.includes("\\\\"))&&t(),typeof location<"u"){let n;try{n=new URL(e,location.href)}catch{n=void 0}n?.origin!==location.origin&&t()}return e}function Ie(e){return typeof e=="object"&&e!==null&&typeof e.getReader=="function"}async function Ne(e,t,n){let a=e.body;if(!Ie(a)){let u=await e.text();return new TextEncoder().encode(u).byteLength>t?null:u}let o=a.getReader(),r=()=>{o.cancel().catch(()=>{})};n.addEventListener("abort",r,{once:!0});let d=new TextDecoder,m="",l=0;try{for(;;){let{done:u,value:s}=await o.read();if(u)break;if(l+=s.byteLength,l>t)return r(),null;m+=d.decode(s,{stream:!0})}}finally{n.removeEventListener("abort",r),o.releaseLock()}return m+d.decode()}function ne(e){let t=Oe(e.endpoint),n=e.timeoutMs??xe,a=e.maxResponseBytes??Fe,o=te(Math.max(1,e.maxConcurrent??ke)),r=new Map,d=new WeakMap,m=0,l=s=>{let c=d.get(s);return c!==void 0?c:(m+=1,d.set(s,m),m)};async function u(s,c){let i=()=>s.signal.aborted;if(i())return T;let h=e.location??location,p=ee({fragment:c.id,key:c.key,route:h.pathname,search:h.search,revision:s.revision,locale:s.locale,collectionSlug:s.collectionSlug,globalSlug:s.globalSlug,fields:s.fields}),f=k(s.signal,n),y=E=>i()?T:f.timedOut()?b("LP0801",`timeout after ${String(n)} ms`):b("LP0801",R(E)),g,x=!1;try{try{g=await(e.fetch??fetch)(t,{method:"POST",credentials:"same-origin",headers:{...e.headers,accept:"application/json","content-type":"application/json",[Q]:String(1)},body:JSON.stringify(p),signal:f.signal})}catch(M){return y(M)}if(i())return T;if(g.status===401||g.status===403)return b("LP0803",`endpoint refused the preview (${String(g.status)})`);if(!g.ok)return b("LP0801",`endpoint answered ${String(g.status)}`);let E=g.headers.get("content-type")??"";if(!E.toLowerCase().startsWith("application/json"))return b("LP0802",`unexpected content type "${E}"`);if(Number(g.headers.get("content-length")??"0")>a)return b("LP0802","response exceeds the size limit");if(f.signal.aborted)return y(f.signal.reason);let N;try{x=!0,N=await Ne(g,a,f.signal)}catch(M){return y(M)}if(i())return T;if(f.timedOut())return b("LP0801",`timeout after ${String(n)} ms`);if(N===null)return b("LP0802","response exceeds the size limit");let $;try{$=JSON.parse(N)}catch{return b("LP0802","response is not JSON")}let S=Z($);return S===null?b("LP0802","response has the wrong shape"):S.boundary.id!==c.id||S.boundary.key!==c.key?b("LP0802","response is for another boundary"):S.revision!==s.revision?T:{status:"rendered",html:S.html,metadata:S.metadata}}finally{if(f.dispose(),g!==void 0&&!x)try{g.body?.cancel().catch(()=>{})}catch{}}}return(s,c)=>{let i=JSON.stringify([l(s.signal),c.id,c.key,s.revision]),h=r.get(i);if(h!==void 0)return h;let p=!1,f=o(()=>(p=!0,u(s,c)),s.signal).catch(g=>{if(!p&&s.signal.aborted)return T;throw g});r.set(i,f);let y=()=>{r.get(i)===f&&r.delete(i)};return f.then(y,y),f}}var Me=new Set(["open","value","checked","selected"]);function oe(e,t){for(let n of t.keyAttributes){let a=e.getAttribute(n);if(a!==null&&a.length>0)return`${n}=${a}`}}function H(e,t,n){if(!U(e,t))return t;let a=n.boundary??F,o=a(e),r=a(t);if(o||r)return!o||!r?t:n.retainBoundary?.(e,t)??!0?e:t;let d=_e(e);return Pe(e,t),n.retainChildrenOf?.(e,t)!==!0&&ve(e,t,n),Le(d),e}function Pe(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||Me.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function ve(e,t,n){let a=Be(e,n),o=new Set(a.values()),r=Array.from(e.childNodes).filter(c=>!o.has(c)),d=new Set,m=new Set,l=Array.from(t.childNodes),u=e.firstChild,s=0;for(let c=0;c<l.length;c+=1){let i=l[c],h=null,p=i instanceof Element?oe(i,n):void 0;if(p!==void 0&&m.has(p)&&(p=void 0),p!==void 0){m.add(p);let y=a.get(p);if(y!==void 0&&!d.has(y)&&(h=re(y,i,n)===y?y:null,h===null)){y.replaceWith(i),d.add(i),u=i.nextSibling;continue}}else{for(;s<r.length;){let y=r[s];if(s+=1,!d.has(y)){if(U(y,i)){h=re(y,i,n)===y?y:null,h===null&&(e.replaceChild(i,y),d.add(i),u=i.nextSibling);break}if(y instanceof Element){let g=l[c+1];if(!(i instanceof Element)||g!==void 0&&U(y,g)){s-=1;break}e.replaceChild(i,y),d.add(i),u=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,y),d.add(i),u=i.nextSibling;break}}}if(h===null&&d.has(i))continue}let f=h??i;for(d.add(f);u!==null&&u!==f&&!d.has(u)&&De(u);)u=u.nextSibling;f!==u&&e.insertBefore(f,u),u=f.nextSibling}for(let c of Array.from(e.childNodes))d.has(c)||c.remove()}function re(e,t,n){return e instanceof Element&&t instanceof Element?H(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function De(e){return e.nodeType===Node.TEXT_NODE&&(e.nodeValue??"").trim().length===0}function U(e,t){return e.nodeType!==t.nodeType?!1:e instanceof Element&&t instanceof Element?e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI:!0}function Be(e,t){let n=new Map,a;for(let o of Array.from(e.children)){let r=oe(o,t);if(r!==void 0){if(n.has(r)){a??(a=r.slice(r.indexOf("=")+1));continue}n.set(r,o)}}return a!==void 0&&t.onDuplicateKey?.(e,a),n}function _e(e){let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t))return null;let n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null;return{element:t,selection:n}}function Le(e){if(e===null)return;let{element:t,selection:n}=e;if(!(t.ownerDocument.activeElement===t||!t.isConnected))try{t.focus({preventScroll:!0});let[a,o]=n??[null,null];a!==null&&o!==null&&t.setSelectionRange(a,o)}catch{}}var ae="data-payload-key";var Ce="__livePreviewRouteRefresh";function Ue(){return typ','eof window>"u"?void 0:window}function ie(){return Ue()?.[Ce]}var le="data-payload-strategy",de="data-payload-field",He="data-payload-depends",Ke="x-payload-live-preview",$e=8e3,Ge="route refresh returned no promise; re-applied before the host committed (see LivePreviewRouteRefresh)",We=1e3;function qe(e){let t=e.getAttribute(le);return t!==null?t==="route":e.closest("head")!==null}function ze(e){let t=e.getAttribute(de),n=O(e.getAttribute(He));return t===null||t.length===0?n:[t,...n]}function se(e){return e.hasAttribute(w)?!1:e.tagName==="META"?e.hasAttribute("name")||e.hasAttribute("property"):e.tagName==="LINK"&&e.getAttribute("rel")==="canonical"}function Ve(e,t){let n=Array.from(e.head.children).find(l=>l.tagName==="TITLE"),a=Array.from(t.head.children).find(l=>l.tagName==="TITLE");!n?.hasAttribute(w)&&!a?.hasAttribute(w)&&t.title!==e.title&&(e.title=t.title);let o=Array.from(e.head.children).filter(se),r=Array.from(t.head.children).filter(se),d=Math.min(o.length,r.length);o.slice(0,d).forEach((l,u)=>{let s=r[u];if(s===void 0)return;if(l.tagName===s.tagName){for(let i of Array.from(l.attributes))s.hasAttribute(i.name)||l.removeAttribute(i.name);for(let i of Array.from(s.attributes))l.getAttribute(i.name)!==i.value&&l.setAttribute(i.name,i.value);return}let c=e.importNode(s,!0);l.replaceWith(c),o[u]=c});let m=o.at(-1);for(let l of r.slice(o.length)){let u=e.importNode(l,!0);m===void 0?e.head.append(u):m.after(u),m=u}for(let l of o.slice(r.length))l.remove()}function ue(e={}){let t=e.timeoutMs??$e,n=e.minIntervalMs??We,a=-1/0,o=!1;return{plan(r,d,m){for(let l of r.querySelectorAll(`[${de}], [${le}="route"]`)){if(!qe(l)||m?.inScope(l)===!1)continue;let u=ze(l);if(u.length===0||u.some(s=>d.has(s)))return!0}return!1},async refresh(r){let d=Date.now(),m=n-(d-a);if(m>0)return r.retryAfter?.(m),r.log("LP0805",`route refresh for revision ${String(r.revision)} refused: the previous one was ${String(d-a)} ms ago`),"refused";a=d;let l=e.document??document,u=e.location??location,s=e.window??window,c=k(r.signal,t),i=h=>{if(r.signal.aborted)return"superseded";let p=c.timedOut()?`route refresh timed out after ${String(t)} ms`:R(h);return r.log("LP0801",p),"failed"};try{let h=ie();if(h!==void 0){try{let f=h();typeof f?.then!="function"&&!o&&(o=!0,r.log("LP0810",Ge)),await f}catch(f){return i(f)}return r.isCurrent()?"partial":"superseded"}let p;try{p=await(e.fetch??fetch)(u.href,{method:"GET",credentials:"same-origin",cache:"no-store",headers:{accept:"text/html",[Ke]:"route"},signal:c.signal})}catch(f){return i(f)}if(r.signal.aborted)return"superseded";if(!p.ok||!(p.headers.get("content-type")??"").includes("text/html"))return r.log("LP0802",`route answered ${String(p.status)} ${p.headers.get("content-type")??""}`),"failed";try{let f=await p.text();if(!r.isCurrent())return"superseded";let y=new DOMParser().parseFromString(f,"text/html"),g=s.scrollX,x=s.scrollY;Ve(l,y);let E=Y(l.body);return H(l.body,y.body,{boundary:F,retainBoundary:j,keyAttributes:[ae,I,A],retainChildrenOf:K=>K.hasAttribute(A)}),X(E),s.scrollTo(g,x),"partial"}catch(f){return i(f)}}finally{c.dispose()}}}}function je(e){return{plan:(t,n)=>J(t,n).map(a=>a.element),async render(t,n){let a={rendered:0,failed:0,superseded:0},o={revision:t.revision,receivedAt:t.receivedAt,fields:t.fields,locale:t.locale,collectionSlug:t.collectionSlug,globalSlug:t.globalSlug,signal:t.signal};return await Promise.all(n.map(async r=>{let d=B(r);if(d===null)return;let m;try{m=await e(o,d)}catch(l){m={status:"failed",code:"LP0801",reason:R(l)}}if(!t.isCurrent()||m.status==="superseded"){a.superseded+=1,t.log("LP0804",`fragment "${d.id}" for revision ${String(o.revision)} discarded as superseded`);return}if(m.status==="rendered"){t.morph(r,m.html),t.rendered(r,d.id,d.key),a.rendered+=1;return}t.failed(r,d.id,d.key,m.code,m.reason),t.isCurrent()&&t.patch(r),a.failed+=1})),a}}}function ce(e){return je(ne(e))}return he(Ye);})();'].join(""),g=/* @__PURE__ */['"use strict";var __LIVE_PREVIEW_ROUTE__=(()=>{var S=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var X=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},J=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of V(t))!j.call(e,r)&&r!==n&&S(e,r,{get:()=>t[r],enumerable:!(a=G(t,r))||a.enumerable});return e};var Q=e=>J(S({},"__esModule",{value:!0}),e);var Re={};X(Re,{createRouteStrategy:()=>W});var T="data-payload-island",xe=`astro-island, [${T}]`,E="data-payload-owned",Z="data-payload-morph";function b(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(Z)||ne(e)||e.hasAttribute(E))return!0;let n=e.getAttribute("contenteditable");return n!==null&&n!=="false"}function ee(e){return e.tagName.toLowerCase()==="astro-island"||e.hasAttribute(T)}function te(e){return e.getAttribute(T)==="patch"}function ne(e){return ee(e)&&!te(e)}var re=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],R=new WeakMap,I=new WeakSet;function N(e){return e.tagName.toLowerCase()==="astro-island"}function M(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]")){if(n.parentElement?.closest("astro-island")!==e)continue;let a=n.getAttribute("name")??n.getAttribute("data-astro-template")??"";t+=`${a}\\0${n.innerHTML}\\0`}return t}function oe(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return t!==void 0&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}function v(e,t){if(!N(e)||!N(t))return!0;let n=M(t);if(!(re.every(o=>e.getAttribute(o)===t.getAttribute(o))&&(R.get(e)??M(e))===n&&(e.getAttribute("props")===t.getAttribute("props")||oe(e))))return R.set(t,n),!1;R.set(e,n);let r=t.getAttribute("props");return r!==e.getAttribute("props")&&(e.setAttribute("ssr",""),r===null?e.removeAttribute("props"):e.setAttribute("props",r)),!0}function P(e){return Array.from(e.querySelectorAll("astro-island"))}function D(e){for(let t of e)t.isConnected||I.has(t)||(I.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}var ae=new Set(["open","value","checked","selected"]);function C(e,t){for(let n of t.keyAttributes){let a=e.getAttribute(n);if(a!==null&&a.length>0)return`${n}=${a}`}}function w(e,t,n){if(!x(e,t))return t;let a=n.boundary??b,r=a(e),o=a(t);if(r||o)return!r||!o?t:n.retainBoundary?.(e,t)??!0?e:t;let d=ue(e);return ie(e,t),n.retainChildrenOf?.(e,t)!==!0&&le(e,t,n),ce(d),e}function ie(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||ae.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function le(e,t,n){let a=de(e,n),r=new Set(a.values()),o=Array.from(e.childNodes).filter(f=>!r.has(f)),d=new Set,p=new Set,l=Array.from(t.childNodes),s=e.firstChild,c=0;for(let f=0;f<l.length;f+=1){let i=l[f],g=null,y=i instanceof Element?C(i,n):void 0;if(y!==void 0&&p.has(y)&&(y=void 0),y!==void 0){p.add(y);let u=a.get(y);if(u!==void 0&&!d.has(u)&&(g=B(u,i,n)===u?u:null,g===null)){u.replaceWith(i),d.add(i),s=i.nextSibling;continue}}else{for(;c<o.length;){let u=o[c];if(c+=1,!d.has(u)){if(x(u,i)){g=B(u,i,n)===u?u:null,g===null&&(e.replaceChild(i,u),d.add(i),s=i.nextSibling);break}if(u instanceof Element){let h=l[f+1];if(!(i instanceof Element)||h!==void 0&&x(u,h)){c-=1;break}e.replaceChild(i,u),d.add(i),s=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,u),d.add(i),s=i.nextSibling;break}}}if(g===null&&d.has(i))continue}let m=g??i;for(d.add(m);s!==null&&s!==m&&!d.has(s)&&se(s);)s=s.nextSibling;m!==s&&e.insertBefore(m,s),s=m.nextSibling}for(let f of Array.from(e.childNodes))d.has(f)||f.remove()}function B(e,t,n){return e instanceof Element&&t instanceof Element?w(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function se(e){return e.nodeType===Node.TEXT_NODE&&(e.nodeValue??"").trim().length===0}function x(e,t){return e.nodeType!==t.nodeType?!1:e instanceof Element&&t instanceof Element?e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI:!0}function de(e,t){let n=new Map,a;for(let r of Array.from(e.children)){let o=C(r,t);if(o!==void 0){if(n.has(o)){a??(a=o.slice(o.indexOf("=")+1));continue}n.set(o,r)}}return a!==void 0&&t.onDuplicateKey?.(e,a),n}function ue(e){let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t))return null;let n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null;return{element:t,selection:n}}function ce(e){if(e===null)return;let{element:t,selection:n}=e;if(!(t.ownerDocument.activeElement===t||!t.isConnected))try{t.focus({preventScroll:!0});let[a,r]=n??[null,null];a!==null&&r!==null&&t.setSelectionRange(a,r)}catch{}}var O="data-payload-key";function F(e){if(e==null)return[];let t=new Set,n=[];for(let a of e.split(/[\\s,]+/)){let r=a.trim();r.length===0||t.has(r)||(t.add(r),n.push(r))}return n}var fe="__livePreviewRouteRefresh";function me(){return typ','eof window>"u"?void 0:window}function _(){return me()?.[fe]}var A="data-payload-fragment",k="data-payload-fragment-key";function L(e,t){let n=new AbortController,a=!1,r=()=>{n.abort()};e.addEventListener("abort",r,{once:!0});let o=setTimeout(()=>{a=!0,n.abort()},t);return{signal:n.signal,timedOut:()=>a,dispose:()=>{clearTimeout(o),e.removeEventListener("abort",r)}}}function U(e){return e instanceof Error?e.message:String(e)}var H="data-payload-strategy",$="data-payload-field",ye="data-payload-depends",pe="x-payload-live-preview",ge=8e3,Ee="route refresh returned no promise; re-applied before the host committed (see LivePreviewRouteRefresh)",he=1e3;function be(e){let t=e.getAttribute(H);return t!==null?t==="route":e.closest("head")!==null}function Ae(e){let t=e.getAttribute($),n=F(e.getAttribute(ye));return t===null||t.length===0?n:[t,...n]}function K(e){return e.hasAttribute(E)?!1:e.tagName==="META"?e.hasAttribute("name")||e.hasAttribute("property"):e.tagName==="LINK"&&e.getAttribute("rel")==="canonical"}function Se(e,t){let n=Array.from(e.head.children).find(l=>l.tagName==="TITLE"),a=Array.from(t.head.children).find(l=>l.tagName==="TITLE");!n?.hasAttribute(E)&&!a?.hasAttribute(E)&&t.title!==e.title&&(e.title=t.title);let r=Array.from(e.head.children).filter(K),o=Array.from(t.head.children).filter(K),d=Math.min(r.length,o.length);r.slice(0,d).forEach((l,s)=>{let c=o[s];if(c===void 0)return;if(l.tagName===c.tagName){for(let i of Array.from(l.attributes))c.hasAttribute(i.name)||l.removeAttribute(i.name);for(let i of Array.from(c.attributes))l.getAttribute(i.name)!==i.value&&l.setAttribute(i.name,i.value);return}let f=e.importNode(c,!0);l.replaceWith(f),r[s]=f});let p=r.at(-1);for(let l of o.slice(r.length)){let s=e.importNode(l,!0);p===void 0?e.head.append(s):p.after(s),p=s}for(let l of r.slice(o.length))l.remove()}function W(e={}){let t=e.timeoutMs??ge,n=e.minIntervalMs??he,a=-1/0,r=!1;return{plan(o,d,p){for(let l of o.querySelectorAll(`[${$}], [${H}="route"]`)){if(!be(l)||p?.inScope(l)===!1)continue;let s=Ae(l);if(s.length===0||s.some(c=>d.has(c)))return!0}return!1},async refresh(o){let d=Date.now(),p=n-(d-a);if(p>0)return o.retryAfter?.(p),o.log("LP0805",`route refresh for revision ${String(o.revision)} refused: the previous one was ${String(d-a)} ms ago`),"refused";a=d;let l=e.document??document,s=e.location??location,c=e.window??window,f=L(o.signal,t),i=g=>{if(o.signal.aborted)return"superseded";let y=f.timedOut()?`route refresh timed out after ${String(t)} ms`:U(g);return o.log("LP0801",y),"failed"};try{let g=_();if(g!==void 0){try{let m=g();typeof m?.then!="function"&&!r&&(r=!0,o.log("LP0810",Ee)),await m}catch(m){return i(m)}return o.isCurrent()?"partial":"superseded"}let y;try{y=await(e.fetch??fetch)(s.href,{method:"GET",credentials:"same-origin",cache:"no-store",headers:{accept:"text/html",[pe]:"route"},signal:f.signal})}catch(m){return i(m)}if(o.signal.aborted)return"superseded";if(!y.ok||!(y.headers.get("content-type")??"").includes("text/html"))return o.log("LP0802",`route answered ${String(y.status)} ${y.headers.get("content-type")??""}`),"failed";try{let m=await y.text();if(!o.isCurrent())return"superseded";let u=new DOMParser().parseFromString(m,"text/html"),h=c.scrollX,q=c.scrollY;Se(l,u);let z=P(l.body);return w(l.body,u.body,{boundary:b,retainBoundary:v,keyAttributes:[O,k,A],retainChildrenOf:Y=>Y.hasAttribute(A)}),D(z),c.scrollTo(h,q),"partial"}catch(m){return i(m)}}finally{f.dispose()}}}}return Q(Re);})();'].join(""),m=/* @__PURE__ */['"use strict";(()=>{function o(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function t(){return typ','eof window>"u"?!1:window.opener!=null}function e(){return o()||t()}function i(){let n=document.createElement("script");n.src=__LP_RUNTIME_SRC__,__LP_RUNTIME_INTEGRITY__!==""&&(n.integrity=__LP_RUNTIME_INTEGRITY__,n.crossOrigin="anonymous"),n.async=!0,document.head.appendChild(n)}e()&&i();})();'].join(""),v=/* @__PURE__ */['"use strict";(()=>{function c(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function s(){return typ','eof window>"u"?!1:window.opener!=null}function r(){return c()||s()}var i="__livePreviewHydration";function f(){if(typ','eof window>"u")return;let e=window;return e[i]??(e[i]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function d(){let e=f();if(e===void 0||e.armed)return;e.armed=!0;let n=window,o=n.__REACT_DEVTOOLS_GLOBAL_HOOK__??(n.__REACT_DEVTOOLS_GLOBAL_HOOK__=m()),u=o.onCommitFiberRoot;o.onCommitFiberRoot=function(a,t,...l){try{u?.call(this,a,t,...l)}catch{}e.onCommit===void 0?e.commits.push(t):e.onCommit(t)}}function m(){let e=new Map;return{supportsFiber:!0,renderers:e,inject:n=>{let o=e.size+1;return e.set(o,n),o}}}function p(){let e=document.createElement("script");e.src=__LP_RUNTIME_SRC__,__LP_RUNTIME_INTEGRITY__!==""&&(e.integrity=__LP_RUNTIME_INTEGRITY__,e.crossOrigin="anonymous"),e.async=!0,document.head.appendChild(e)}d();r()&&p();})();'].join(""),y=["allowedOrigins","serverURL","apiRoute","mergeDepth","debug","debounceMs","enableA11y","heartbeatMs","disableVisibilityGate","visibilityGateThreshold","intersectionRootMargin","disableReferrerDetection","disableLocalhostMatching","scopeBindingsByOwner","skipUnchanged","eventSourcePolicy","sanitizerPolicy","fragmentEndpoint","revealEditedField","routeStrategy","onUnboundChange","onUnfaithfulPatch","autoBind","hydration","defaults","softNavigationEvents","subfieldCoverage"];function b(e,t){if(0===e.length)throw new Error(`[live-preview] ${t} is empty. Run \`npm run build:runtime\` before bundling.`)}function w(e){return null!=e.fragmentEndpoint?(b(p,"fragment.generated.ts"),[p]):!0===e.routeStrategy?(b(g,"route.generated.ts"),[g]):[]}function S(e){return`var __LIVE_PREVIEW_CONFIG__=${function(e){o(e);const t=function(e){const t=e.defaults??"v2";return"v1"===t?{...f,defaults:t}:{defaults:t}}(e),n=y.map(n=>{const i=e[n]??t[n];return function(e,t){if("number"!=typeof t||Number.isFinite(t))return;const n="visibilityGateThreshold"===e?" To never defer, set `disableVisibilityGate: true`.":"";throw new Error(`[live-preview] \`${e}\` is ${String(t)}, which the inline configuration writes as null, so the runtime would never see it. Pass a finite number.${n}`)}(n,i),i});for(;void 0===n.at(-1);)n.pop();return`[${n.map(e=>void 0===e?"":JSON.stringify(e)).join(",")}]`.replace(/</g,"\\u003C")}(e)};`}function A(e,t={}){return`<script${void 0!==t.nonce?` nonce="${function(e){if(!/^[A-Za-z0-9+/=_-]+$/.test(e))throw new RangeError("nonce contains characters CSP does not allow");return e}(t.nonce)}"`:""}>${e}<\/script>`}function k(e){let t=0,n=e.length;for(;t<n&&"/"===e[t];)t+=1;for(;n>t&&"/"===e[n-1];)n-=1;const i=e.slice(t,n);return""===i?"":`/${i}`}function T(e={}){const t=e.runtime,n=`runtime.${t?.contentHash??"da94bf0c6042732f"}.js`;return{fileName:n,urlPath:`${k(e.assetPath??"/payload-live-preview")}/${n}`,integrity:t?.integrity??"sha384-QFA9AGwkNUJFVJ+z4kg/D2CxT7JhWy4/5fzEJN2v9Ec4oXnhAD92FEg3WvS6nf1g",source:t?.source??h}}function R(e){s({defaults:e.defaults,onUnboundChange:e.onUnboundChange});const t="v1"===e.defaults?c:u,n="v1"===e.defaults?f:d,i=e=>n[e]!==d[e]?n[e]:void 0;return{strict:e.strict??t.strict,previewSignals:e.previewSignals??t.previewSignals,skipUnchanged:e.skipUnchanged??i("skipUnchanged"),disableReferrerDetection:e.disableReferrerDetection??i("disableReferrerDetection"),disableLocalhostMatching:e.disableLocalhostMatching,eventSourcePolicy:e.eventSourcePolicy??i("eventSourcePolicy"),sanitizerPolicy:e.sanitizerPolicy??i("sanitizerPolicy")}}function C(e,t={}){const n=function(e,t={}){o(e);const n=R(e);return{...void 0!==e.defaults?{defaults:e.defaults}:{},...void 0!==e.allowedOrigins?{allowedOrigins:e.allowedOrigins}:{},...void 0!==e.serverURL?{serverURL:e.serverURL}:{},...void 0!==e.apiRoute?{apiRoute:e.apiRoute}:{},...void 0!==e.mergeDepth?{mergeDepth:e.mergeDepth}:{},...void 0!==e.revealEditedField?{revealEditedField:e.revealEditedField}:{},...void 0!==e.debug?{debug:e.debug}:{},...void 0!==e.debounceMs?{debounceMs:e.debounceMs}:{},...void 0!==e.heartbeatMs?{heartbeatMs:e.heartbeatMs}:{},...void 0!==e.disableVisibilityGate?{disableVisibilityGate:e.disableVisibilityGate}:{},...void 0!==e.visibilityGateThreshold?{visibilityGateThreshold:e.visibilityGateThreshold}:{},...void 0!==n.skipUnchanged?{skipUnchanged:n.skipUnchanged}:{},...void 0!==e.scopeBindingsByOwner?{scopeBindingsByOwner:e.scopeBindingsByOwner}:{},...void 0!==n.disableReferrerDetection?{disableReferrerDetection:n.disableReferrerDetection}:{},...void 0!==n.disableLocalhostMatching?{disableLocalhostMatching:n.disableLocalhostMatching}:{},...void 0!==n.eventSourcePolicy?{eventSourcePolicy:n.eventSourcePolicy}:{},...void 0!==n.sanitizerPolicy?{sanitizerPolicy:n.sanitizerPolicy}:{},...void 0!==e.runtime?{runtime:e.runtime}:{},...void 0!==e.fragments?{fragmentEndpoint:e.fragments.endpoint}:{},...!0===e.routeStrategy&&void 0===e.fragments?{routeStrategy:!0}:{},...void 0!==e.onUnboundChange?{onUnboundChange:e.onUnboundChange}:{},...void 0!==e.onUnfaithfulPatch?{onUnfaithfulPatch:e.onUnfaithfulPatch}:{},...void 0!==e.autoBind?{autoBind:e.autoBind}:{},...void 0!==e.subfieldCoverage?{subfieldCoverage:e.subfieldCoverage}:{},...void 0!==t.hydration?{hydration:t.hydration}:{},...void 0!==t.softNavigationEvents?{softNavigationEvents:t.softNavigationEvents}:{}}}(e,t);if("asset"!==e.delivery)return function generateInlineScript(e={}){s({defaults:e.defaults,onUnboundChange:e.onUnboundChange});const t=function(e){const t=e.runtime;if(void 0===t)return b(h,"runtime.generated.ts"),h;if(b(t.source,`the ${t.profile} runtime`),null!=e.fragmentEndpoint||!0===e.routeStrategy)throw new Error(`[live-preview] the ${t.profile} runtime and the fragment or route strategy exclude each other: it carries no strategy runner, so the prelude would have nothing to talk to. Drop the runtime option, or drop \`fragmentEndpoint\`/\`routeStrategy\`.`);return t.source}(e);return[S(e),...w(e),t].join("\n")}(n);const i=T(e);return function(e={},t){const n=function(e){return"react"===e.hydration?(b(v,"loader-react.generated.ts"),v):(b(m,"loader.generated.ts"),m)}(e);if(""===t.runtimeSrc)throw new Error("[live-preview] generateLoaderScript needs a runtimeSrc.");const i=e=>JSON.stringify(e).replace(/</gu,"\\u003C");return[S(e),`var __LP_RUNTIME_SRC__=${i(t.runtimeSrc)};`,`var __LP_RUNTIME_INTEGRITY__=${i(t.integrity??"")};`,...w(e),n].join("\n")}(n,{runtimeSrc:i.urlPath,integrity:i.integrity})}var $=["preview","draft","livePreview"],E=class extends Error{name="PreviewConfigurationError"};function L(e){return{authorized:!1,outcome:e,context:null}}var O="payload-live-preview.authorized-preview-context",N=Symbol.for(O);function isAuthorizedPreviewContext(e){return"object"==typeof e&&null!==e&&!0===e[N]&&Object.isFrozen(e)}function x(e){return Object.freeze({...e,scope:Object.freeze({...e.scope,...void 0===e.scope.payload?{}:{payload:Object.freeze({...e.scope.payload,document:Object.freeze({...e.scope.payload.document})})}}),payloadHeaders:Object.freeze({...e.payloadHeaders}),[N]:!0,[O]:!0})}async function P(e){let t;try{t=await e()}catch(e){if(function(e){return e instanceof E||e instanceof Error&&"PreviewConfigurationError"===e.name}(e))throw e;return L("unavailable")}return function(e){return isAuthorizedPreviewContext(e)?{authorized:!0,outcome:"authorized",context:e}:"object"==typeof e&&null!==e&&"authorized"in e?e.authorized&&isAuthorizedPreviewContext(e.context)?{authorized:!0,outcome:"authorized",context:e.context}:L(e.authorized?"invalid":e.outcome):L("invalid")}(t)}var M=" New in 2.0; `defaults: 'v1'` keeps the 1.x table while you migrate (docs/migration.md).";function F(e){return!1!==e&&("full"===e?"full":"frame-ancestors")}function U(e,t,n,i){const o={"frame-ancestors":buildFrameAncestors({self:!0,origins:[...e.allowedOrigins??[],...e.frameAncestorsExtra??[]]})};return"full"===i&&(o["script-src"]=function buildScriptSrcWithNonce(e,t={}){if(0===e.length)throw new RangeError("buildScriptSrcWithNonce: nonce is empty");const{self:n=!0,extra:i=[],strictDynamic:r=!1}=t,o=[];n&&o.push("'self'"),o.push(`'nonce-${e}'`),r&&o.push("'strict-dynamic'");for(const e of i){const t=e.trim();t.length>0&&o.push(t)}return o.join(" ")}(t,{self:!0,strictDynamic:e.strictDynamic??!1,...void 0!==e.scriptSrcExtra?{extra:e.scriptSrcExtra}:{}})),function(e,t){const n=e.split(",").filter(e=>e.trim().length>0);return 0===n.length?r("",t):n.map(e=>r(e,t)).join(", ")}(n,o)}var I=Object.freeze({isPreview:!1,authorization:null,outcome:void 0,inject:!1,cspMode:!1,exposeNonce:!1});function j(e,t={}){const n=R(e);o(e);const i="function"==typeof e.authorizePreview;n.strict?function(e){if("function"!=typeof e.authorizePreview)throw new Error("payload-live-preview: strict mode requires `authorizePreview` — response changes must be gated on a verified context, not on intent (ADR 0006)."+M);const t=e.allowedOrigins??[];if(0===t.length)throw new Error("payload-live-preview: strict mode requires explicit, non-empty `allowedOrigins`."+M);if(!l())for(const e of t){let t;try{t=new URL(e).protocol}catch{t=void 0}if("https:"!==t)throw new Error(`payload-live-preview: strict mode requires https admin origins in production; got "${e}".`+M)}if(!0===R(e).previewSignals?.includes("referer"))throw new Error("payload-live-preview: strict mode disables referrer trust; remove 'referer' from `previewSignals` (the 'v1' profile includes it).")}(e):i||a("intent-only-preview","preview responses are gated on client-controlled intent only. Configure `authorizePreview` (see authorizePreviewRequest) before production; `strict: true` enforces it. ADR 0006 explains why intent is not authorization.");const r=F(e.manageCsp),s=e.autoInject??!0;let u;return{authorizes:i,async decide(t,n={}){if(i&&void 0===n.authorize)throw new Error("payload-live-preview: `authorizePreview` is configured but decide() was called without an `authorize` hook; bind the hook to the request (bindDecisionHooks).");const o=function(e,t){const n=R(t).previewSignals;return"always"===(t.inject??"preview-only")||function(e,t={}){const n=new Set(t.signals??["query","fetch-dest","referer"]),i=t.queryParams??$;if(n.has("query")){let t;try{t=new URL(e.url)}catch{t=void 0}if(void 0!==t)for(const e of i){const n=t.searchParams.getAll(e).at(-1);if("true"===n||"1"===n)return!0}}if(n.has("fetch-dest")&&"iframe"===e.headers.get("sec-fetch-dest"))return!0;const r=t.adminOrigins;void 0!==r&&a("admin-origins","`hasPreviewIntent({ adminOrigins })` is removed in 3.0: name the option `allowedOrigins`; `pll migrate` renames it (ADR 0026).");const o=t.allowedOrigins??r??[],l=n.has("referer")?o:[];if(l.length>0){const t=e.headers.get("referer");if(null!==t)try{const e=new URL(t).origin;for(const t of l)try{if(new URL(t).origin===e)return!0}catch{}}catch{}}return!1}(e,{...void 0!==t.previewQueryParams?{queryParams:t.previewQueryParams}:{},...void 0!==n?{signals:n}:{},allowedOrigins:t.allowedOrigins??[]})}(t,e);if(!o)return I;let l,u=null;if(void 0!==n.authorize){const e=await P(n.authorize);if(l=e.outcome,!e.authorized)return{isPreview:o,authorization:null,outcome:l,inject:!1,cspMode:!1,exposeNonce:!1};u=e.context}return{isPreview:o,authorization:u,outcome:l,inject:s&&(n.shouldInject?.()??!0),cspMode:r,exposeNonce:!0}},scriptTag:n=>A((u??=C(e,t),u),{nonce:n}),csp:(t,n,i)=>U(e,n,t,i),nonce:()=>function generateCspNonce(e=16){if(!Number.isInteger(e)||e<8)throw new RangeError(`generateCspNonce: bytes must be an integer >= 8, got ${String(e)}`);const t=function(){const e=globalThis.crypto;return e?.getRandomValues?e:void 0}();if(!t)throw new Error("generateCspNonce: Web Crypto is unavailable. On Node 18 call setCspCrypto(webcrypto) once at startup, or run with --experimental-global-webcrypto. We won't fabricate a predictable nonce — that would silently defeat the entire CSP.");const n=new Uint8Array(e);return t.getRandomValues(n),function(e){let t="";for(const n of e)t+=String.fromCharCode(n);return("function"==typeof btoa?btoa(t):Buffer.from(e).toString("base64")).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}(n)}()}}var _={hydration:"vue",softNavigationEvents:["payload-live-preview:navigation"]},z="livePreviewDecision";function D(e={}){const t=j(e,_);return n=>{n.hooks.hook("render:html",async(n,{event:i})=>{const{decision:r,nonce:o}=await B(i,t,e);if(!r.isPreview)return;r.inject&&n.head.push(t.scriptTag(o));const l=function(e){const t=e.node?.res??e.res;if("function"==typeof t?.setHeader)return{get:e=>{return n=t.getHeader?.(e),Array.isArray(n)?n.join(", "):"number"==typeof n?String(n):n;var n},set:(e,n)=>{t.setHeader?.(e,n)}};const n=e.res?.headers;return H(n)&&"function"==typeof n.set?{get:e=>n.get(e)??void 0,set:n.set.bind(n)}:void 0}(i);void 0===l||!r.inject&&!1===r.cspMode||function(e,t,n,i){const r=n.cspMode;if(!1!==r){const n=e.get("content-security-policy")??"";e.set("content-security-policy",t.csp(n,i,r))}!function(e){const t=e.get("cache-control")??"";/\bno-store\b/i.test(t)||e.set("cache-control","private, no-store");const n=(e.get("vary")??"").trim(),i=n.split(",").map(e=>e.trim().toLowerCase());i.includes("*")||i.includes("cookie")||e.set("vary",0===n.length?"Cookie":`${n}, Cookie`)}(e)}(l,t,r,o)})}}function W(e={}){const t=j(e,_);return async n=>{await B(n,t,e)}}async function B(e,t,n){const i=e.context??{},r=i[z];if(void 0!==r)return r;const o=function(e){const t=G(e,"host")??"localhost",n=e.path??e.node?.req?.url??e.req?.url??"/";return{url:K("string"==typeof e.url?e.url:e.url?.href)??`http://${t}${n}`,headers:{get:t=>G(e,t)}}}(e),l=await t.decide(o,function(e,t,n){return{shouldInject:()=>t.shouldInject?.(n)??!0,...e.authorizes?{authorize:()=>t.authorizePreview?.(n)}:{}}}(t,n,o)),a={decision:l,nonce:t.nonce()};return i[z]=a,function(e,t,n){!t.exposeNonce&&t.isPreview||(e.livePreviewNonce=n),null!==t.authorization&&(e.livePreviewAuthorization=t.authorization),void 0!==t.outcome&&(e.livePreviewAuthorizationOutcome=t.outcome)}(i,l,a.nonce),a}function V(e={}){return function(e,t={}){return A(C(e,t),void 0!==e.nonce?{nonce:e.nonce}:{})}(e,_)}function q(e,t,n="",i){return U(e,t,n,"full"===(i??F(e.manageCsp))?"full":"frame-ancestors")}function H(e){return"function"==typeof e?.get}function G(e,t){const n=H(e.headers)?e.headers:H(e.req?.headers)?e.req.headers:void 0;if(void 0!==n)return n.get(t);const i=e.node?.req?.headers??e.req?.headers,r=i?.[t.toLowerCase()];return(Array.isArray(r)?r[0]:r)??null}function K(e){if(void 0!==e)try{return new URL(e).href}catch{return}}var J,X="users",Q=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,Y=/^[A-Za-z0-9._~-]+$/;function Z(e,t){let n;try{n=new URL(e)}catch{throw new E(`payload-live-preview: ${t} "${e}" is not an absolute URL`)}if("https:"!==n.protocol&&"http:"!==n.protocol)throw new E(`payload-live-preview: ${t} must be http(s), got "${n.protocol}"`);return n.origin}function ee(){return J??=new TextEncoder,J}function te(e){if(!/^[A-Za-z0-9_-]*$/.test(e))return;const t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4);try{const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)n[t]=e.charCodeAt(t);return n}catch{return}}function ne(e){return"string"==typeof e&&e.length>0&&"."!==e&&".."!==e&&!/[\s\p{Cc}\p{Cs}/\\?#%]/u.test(e)}function ie(e){return"number"==typeof e?Number.isSafeInteger(e):ne(e)}function re(e){return void 0!==e.expiresAt&&Number.isFinite(e.expiresAt)&&e.expiresAt>Date.now()}function oe(e,t){return e.kind===t.kind&&e.slug===t.slug&&("global"===e.kind||ie(t.id)&&String(e.id)===String(t.id))}async function le(e,t){switch(t.type){case"payload-session":return async function(e,t){const n=function(e){const t=e??"payload-token";if(!Q.test(t))throw new E(`payload-live-preview: cookie name "${t}" is not a valid cookie-name token`);return t}(t.cookieName),i=Z(t.serverURL,"serverURL"),r=void 0===t.origin?void 0:Z(t.origin,"origin"),o=function(e,t,n=4096){if(null===e||0===e.length)return null;const i=`${t}=`,r=[];for(const t of e.split(";")){const e=t.trim();e.startsWith(i)&&r.push(e.slice(i.length))}if(1!==r.length)return null;const o=r[0]??"";return 0===o.length||o.length>n||!Y.test(o)?null:o}(e.headers.get("cookie"),n,t.maxCookieLength??4096);if(null===o)return L("missing-credential");const l=t.now??Date.now,a=Math.max(250,t.timeoutMs??3e3);if(!Number.isSafeInteger(a))return L("unavailable");const s=t.fetch??globalThis.fetch,u=encodeURIComponent(t.usersSlug??X),d=`${n}=${o}`;let c={cookie:d};void 0!==r&&(c.origin=r);const f=new AbortController,h=()=>{f.abort(e.signal?.reason)},p=()=>f.signal.aborted;let g,m;e.signal?.addEventListener("abort",h,{once:!0}),!0===e.signal?.aborted&&h();try{if(p())return L("unavailable");g=setTimeout(()=>{f.abort(new DOMException("The operation timed out","TimeoutError"))},a);for(let e=0;e<2;e++){const t=await s(`${i}/api/${u}/me?depth=0`,{headers:{...c,accept:"application/json"},signal:f.signal});if(p())return L("unavailable");if(!t.ok)return L(401===t.status?"invalid":"unavailable");if(m=await t.json(),p())return L("unavailable");if(0!==e||void 0!==r||"object"!=typeof m||null===m||null!==m.user)break;c={cookie:d,origin:i}}}catch{return L("unavailable")}finally{void 0!==g&&clearTimeout(g),e.signal?.removeEventListener("abort",h)}const v=function(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return null;const n=e.user;if("object"!=typeof n||null===n||Array.isArray(n))return null;const i=e.collection??n.collection;if(void 0!==i&&i!==t)return null;const r=n.id;return"string"==typeof r&&r.length>0?r:"number"==typeof r&&Number.isFinite(r)?String(r):null}(m,t.usersSlug??X);if(null===v)return L("invalid");const y=function(e){const t=e.exp;return"number"!=typeof t||!Number.isFinite(t)||t<=0?void 0:t<1e11?1e3*t:t}(m);return void 0!==y&&y<=l()?L("expired"):{authorized:!0,outcome:"authorized",context:x({strategy:"payload-session",subject:v,authorizedAt:l(),expiresAt:y,scope:{},payloadHeaders:c})}}(e,t);case"signed-token":return async function(e,t){const n=function(e){const t="string"==typeof e?ee().encode(e):e;if(t.byteLength<32)throw new E(`payload-live-preview: the preview token secret must be at least ${String(32)} bytes`);return t}(t.secret),i=function(e){if(void 0!==e)return e;const t=globalThis.crypto;return"object"==typeof t?.subtle?t:void 0}(t.crypto);if(void 0===i)return L("unavailable");const r=function(e,t){if("header"===t?.kind)return e.headers.get(t.name??"x-preview-token");let n;try{n=new URL(e.url)}catch{return null}const i=n.searchParams.getAll(t?.param??"previewToken");return 1===i.length?i[0]??null:null}(e,t.transport);if(null===r||0===r.length)return L("missing-credential");if(r.length>4096)return L("invalid");const o=r.split(".");if(3!==o.length||"v1"!==o[0])return L("invalid");const l=o[1]??"",s=te(l),u=te(o[2]??"");if(void 0===s||32!==u?.byteLength)return L("invalid");let d;try{const e=await async function(e,t){return e.subtle.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"])}(i,n);d=await i.subtle.verify("HMAC",e,u,ee().encode(`v1.${l}`))}catch{return L("unavailable")}if(!d)return L("invalid");const c=function(e){let t;try{t=JSON.parse((new TextDecoder).decode(e))}catch{return}if("object"!=typeof t||null===t)return;const n=t,i=e=>void 0===n[e]||"string"==typeof n[e];return 1===n.v&&"string"==typeof n.aud&&"string"==typeof n.pur&&"number"==typeof n.iat&&"number"==typeof n.exp&&"string"==typeof n.jti&&i("pth")&&i("loc")&&i("sub")?n:void 0}(s);if(void 0===c)return L("invalid");const f=(t.now??Date.now)();if(c.exp<=f||c.iat>c.exp)return L("expired");if(c.aud!==t.audience)return L("wrong-audience");if(c.pur!==(t.purpose??"live-preview"))return L("wrong-purpose");if(void 0!==c.pth){let t;try{t=new URL(e.url).pathname}catch{return L("invalid")}if(c.pth!==t)return L("wrong-path")}if(void 0!==c.loc){const n=t.locale?.(e);if(n!==c.loc)return L("wrong-locale")}if(void 0!==t.replay){let e;try{e=await async function(e,t,n){return"consume"in e?!0===await e.consume(t,n):(a("replay-is-used","A `signed-token` replay store with `isUsed` and `markUsed` is removed in 3.0: implement `consume(id, expiresAt)`, which checks and records in one step (ADR 0026)."),!await e.isUsed(t)&&(await e.markUsed(t,n),!0))}(t.replay,c.jti,c.exp)}catch{return L("unavailable")}if(!e)return L("replayed")}return{authorized:!0,outcome:"authorized",context:x({strategy:"signed-token",subject:c.sub,authorizedAt:f,expiresAt:c.exp,scope:{audience:c.aud,...void 0!==c.pth?{path:c.pth}:{},...void 0!==c.loc?{locale:c.loc}:{}},payloadHeaders:{}})}}(e,t);case"verifier":return async function(e,t){let n;try{n=await t.verify(e)}catch{return L("unavailable")}if(null===n)return L("invalid");if(!(void 0===n.scope?.payload||function(e){if("object"!=typeof e||null===e)return!1;const t=e,n=t.document;return!(null===function(e,t="/api"){if("string"!=typeof e||"string"!=typeof t)return null;try{const n=new URL(e);if(!["http:","https:"].includes(n.protocol)||n.username||n.password||n.search||n.hash)return null;const i=e.replace(/^[a-z]+:\/\/[^/]+/iu,"").replace(/\/+$/,""),r=t.replace(/^\//,"").replace(/\/$/,"");return""!==i&&!i.slice(1).split("/").every(ne)||!r.split("/").every(ne)?null:`${n.origin}${n.pathname.replace(/\/+$/,"")}/${r}`}catch{return null}}(t.serverURL,t.apiRoute)||"number"!=typeof t.maxDepth||!Number.isSafeInteger(t.maxDepth)||t.maxDepth<0||"object"!=typeof n||null===n||!ne(n.slug))&&("global"===n.kind||"collection"===n.kind&&ie(n.id))}(n.scope.payload)&&Number.isFinite(n.expiresAt)))return L("invalid");const i=(t.now??Date.now)();return void 0!==n.expiresAt&&n.expiresAt<=i?L("expired"):{authorized:!0,outcome:"authorized",context:x({strategy:"verifier",subject:n.subject,authorizedAt:i,expiresAt:n.expiresAt,scope:n.scope??{},payloadHeaders:n.payloadHeaders??{}})}}(e,t)}}function ae(e,t,n,i){const r=t??n;if(!Number.isSafeInteger(r)||r<=0||r>i)throw new RangeError(`payload-live-preview: createFragmentEndpoint() limits.${e} must be a positive integer no greater than ${String(i)}.`);return r}var se="x-payload-fragment-version",ue=64;function de(e,t,n){if(t>n||"object"!=typeof e||null===e)return t;let i=t;for(const r of Object.values(e))if(i=Math.max(i,de(r,t+1,n)),i>n)break;return i}function ce(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function fe(e,t=ue){if(!Number.isInteger(t)||t<0||t>ue)return null;if(!ce(e))return null;const n=e.fragment;if("string"!=typeof n||!/^[a-z][a-z0-9-]{0,63}$/iu.test(n))return null;const i=e.key;if(void 0!==i&&("string"!=typeof i||i.length>128))return null;const r=e.route;if("string"!=typeof r||!r.startsWith("/")||r.length>2048)return null;const o=e.search;if("string"!=typeof o||o.length>4096||""!==o&&!o.startsWith("?"))return null;const l=e.revision;if("number"!=typeof l||!Number.isInteger(l)||l<0)return null;const a=[];for(const t of["locale","collectionSlug","globalSlug"]){const n=e[t];if(void 0!==n){if("string"!=typeof n||n.length>128)return null;a.push(n)}else a.push(void 0)}const[s,u,d]=a,c=e.fields;return ce(c)?de(c,0,t)>t?"field-depth":{fragment:n,..."string"==typeof i?{key:i}:{},route:r,search:o,revision:l,...void 0!==s?{locale:s}:{},...void 0!==u?{collectionSlug:u}:{},...void 0!==d?{globalSlug:d}:{},fields:c}:null}var he=2147483647,pe={"cache-control":"private, no-store","x-content-type-options":"nosniff",vary:"Cookie",[se]:String(1)};function ge(e,t,n){return new Response(JSON.stringify({error:t,...void 0!==n?{maxDepth:n}:{}}),{status:e,headers:{...pe,"content-type":"application/json; charset=utf-8"}})}var me=class extends Error{name="EndpointStopped"};function ve(e,t){if(null!==e&&!e.locked)try{Promise.resolve(e.cancel(t)).catch(()=>{})}catch{}}function ye(e){return e.aborted}function be(e,t){const n=function(e){const{authorize:t,authorizePreview:n}=e;if(void 0!==n&&void 0!==t)throw new Error("payload-live-preview: createFragmentEndpoint() takes `authorizePreview` or `authorize`, not both — pass the middleware hook as `authorizePreview`, or a strategy as `authorize`.");if(void 0!==n)return e=>P(()=>n(e));if(void 0!==t)return e=>le(e,t);throw new Error("payload-live-preview: createFragmentEndpoint() needs `authorizePreview` (the middleware hook) or `authorize` (a strategy); without one it would render drafts for anyone.")}(e),i=e.render??t.render,r=void 0===e.render?t.rendererName:"custom",o=new Set(e.allowedOrigins??[]),l=ae("bodyBytes",e.limits?.bodyBytes,65536,Number.MAX_SAFE_INTEGER),s=ae("timeoutMs",e.limits?.timeoutMs,5e3,he),u=void 0===e.limits?.totalTimeoutMs?void 0:ae("totalTimeoutMs",e.limits.totalTimeoutMs,0,he),{fieldDepth:d=ue}=e.limits??{};if(!Number.isInteger(d)||d<0||d>ue)throw new TypeError("createFragmentEndpoint: limits.fieldDepth must be an integer from 0 to 64");const c=e.registry;return async(e,f)=>{if("POST"!==e.method)return ge(405,"method");if(!function(e,t){const n=e.headers.get("sec-fetch-site");if(null!==n&&"same-origin"!==n&&"none"!==n)return!1;const i=e.headers.get("origin");return null===i||i===new URL(e.url).origin||t.has(i)}(e,o))return ge(403,"origin");if(!(e.headers.get("content-type")??"").toLowerCase().startsWith("application/json"))return ge(415,"content-type");const h=function(e,t){const n=new AbortController,i=void 0===t?void 0:performance.now()+t;let r,o;const l=new Promise(e=>{o=e}),a=e=>{void 0===r&&(r=e,n.abort(e),o?.(e))},s=()=>{a("request-aborted")};e.addEventListener("abort",s,{once:!0}),e.aborted&&s();const u=void 0===t?void 0:setTimeout(()=>{a("total-timeout")},t),d=()=>{if(void 0!==i&&performance.now()>=i&&a("total-timeout"),void 0!==r)throw new me(r)};return{signal:n.signal,reason:()=>r,run:async(e,t)=>{d();const n=void 0===t?void 0:setTimeout(()=>{a("phase-timeout")},t);try{const t=await Promise.race([Promise.resolve().then(()=>(d(),e())),l.then(e=>{throw new me(e)})]);return d(),t}catch(e){throw d(),e}finally{void 0!==n&&clearTimeout(n)}},dispose:()=>{void 0!==u&&clearTimeout(u),e.removeEventListener("abort",s)}}}(e.signal,u),p={started:!1,read:!1};try{const o=await h.run(()=>(p.started=!0,async function(e,t,n,i,r){const o=e.body;if(ye(t)||e.bodyUsed||!0===o?.locked)return ve(o,"unreadable"),{kind:"unreadable"};if(function(e,t){const n=e.headers.get("content-length");if(null===n||!/^[0-9]+$/u.test(n))return!1;const i=n.replace(/^0+/u,"")||"0",r=String(t);return i.length>r.length||i.length===r.length&&i>r}(e,n))return{kind:"too-large"};if(null===o)return{kind:"parsed",value:null};let l,a,s;try{l=o.getReader()}catch{return ve(o,"unreadable"),{kind:"unreadable"}}const u=new Promise(e=>{s=e}),d=e=>{if(void 0===a){a=e,s?.({kind:"stopped",reason:e});try{Promise.resolve(l.cancel(e)).catch(()=>{})}catch{}}},c=()=>{d("unreadable")};t.addEventListener("abort",c,{once:!0}),ye(t)&&c();const f=setTimeout(()=>{d("timed-out")},i),h=new TextDecoder;let p="",g=0,m=!1;try{for(;;){const e=Promise.resolve().then(()=>l.read()).then(e=>({kind:"read",result:e}),()=>({kind:"read-error"})),t=await Promise.race([e,u]);if("stopped"===t.kind)return{kind:t.reason};if("read-error"===t.kind)return m?{kind:"too-large"}:(d("unreadable"),{kind:"unreadable"});if(void 0!==a)return{kind:a};if(t.result.done){if(m)return{kind:"too-large"};break}if(!m){if(t.result.value.byteLength>n-g){if("drain"===r){m=!0;continue}return d("too-large"),{kind:"too-large"}}g+=t.result.value.byteLength;try{p+=h.decode(t.result.value,{stream:!0})}catch{return d("unreadable"),{kind:"unreadable"}}}}try{return p+=h.decode(),{kind:"parsed",value:JSON.parse(p)}}catch{return{kind:"parsed",value:null}}}finally{clearTimeout(f),t.removeEventListener("abort",c);try{l.releaseLock()}catch{}}}(e,h.signal,l,s,t.overLimitBody??"cancel")));if("parsed"!==o.kind)return"too-large"===o.kind?ge(413,"body"):"timed-out"===o.kind?ge(408,"body"):ge(400,"body");const u=fe(o.value,d);if("field-depth"===u)return ge(400,"field-depth",d);if(null===u)return ge(400,"shape");p.read=!0;const g=new URL(e.url).origin,m=new Request(`${g}${u.route}${u.search}`,{headers:e.headers,signal:h.signal}),v=await h.run(()=>n(m));if(!v.authorized||!function(e,t,n){const i=e.scope;if(void 0!==i.locale&&i.locale!==t.locale)return!1;if(void 0!==i.payload){if(!re(e)||void 0!==i.audience&&i.audience!==n.origin||void 0!==i.path&&i.path!==n.pathname)return!1;if(void 0!==t.collectionSlug&&void 0!==t.globalSlug)return!1;if(!oe(i.payload.document,{kind:void 0===t.globalSlug?"collection":"global",slug:t.globalSlug??t.collectionSlug,id:t.fields.id}))return!1;if(!function(e,t){if("object"!=typeof t||null===t||Array.isArray(t))return!1;const n=t;return"global"===e.kind?!Object.hasOwn(n,"globalType")||n.globalType===e.slug:Object.hasOwn(n,"id")&&oe(e,{kind:"collection",slug:e.slug,id:n.id})}(i.payload.document,t.fields))return!1}return!0}(v.context,u,new URL(m.url)))return ge(403,"unauthorized");const y=Object.prototype.hasOwnProperty.call(c,u.fragment)?c[u.fragment]:void 0;if(void 0===y)return ge(404,"fragment");const b={locals:f,id:u.fragment,key:u.key,revision:u.revision,fields:u.fields,locale:u.locale,collectionSlug:u.collectionSlug,globalSlug:u.globalSlug,route:u.route,authorization:v.context,signal:h.signal,request:e},w=Date.now();let S;try{const e=await h.run(()=>y.props(b),s);if(void 0!==b.authorization.scope.payload&&!re(b.authorization))return ge(403,"unauthorized");const t=e;if(S=await h.run(()=>i(y.component,t,b),s),void 0!==b.authorization.scope.payload&&!re(b.authorization))return ge(403,"unauthorized")}catch(e){if(e instanceof me)throw e;return a(`fragment-render:${u.fragment}`,`fragment "${u.fragment}" did not render: ${e instanceof Error?e.message:String(e)}`),ge(500,"render")}const A={html:S,boundary:{id:u.fragment,...void 0!==u.key?{key:u.key}:{}},revision:u.revision,metadata:{renderedAt:/* @__PURE__ */(new Date).toISOString(),renderer:r,durationMs:Date.now()-w}};return new Response(JSON.stringify(A),{status:200,headers:{...pe,"content-type":"application/json; charset=utf-8"}})}catch(t){if(!(t instanceof me))throw t;return p.started||ve(e.body,"unreadable"),"total-timeout"===h.reason()?ge(504,"timeout"):"phase-timeout"===h.reason()?ge(500,"render"):ge(400,p.read?"request":"body")}finally{h.dispose()}}}var we=function(){let e;return()=>{if(void 0===e){const t=(async()=>{const e="vue",t="vue/server-renderer";try{const[n,i]=await Promise.all([import(e),import(t)]);return{createSSRApp:n.createSSRApp,renderToString:i.renderToString}}catch(e){throw function(e,t){const n=e.map(e=>`\`${e}\``).join(" and "),i=1===e.length;return new Error(`payload-live-preview: this fragment endpoint renders with ${n}, ${i?"an optional peer":"optional peers"} this package does not install. ${i?"Install it":"Install them"}, or pass your own \`render\`.`,{cause:t})}(["vue"],e)}})();e=t,t.catch(()=>{e===t&&(e=void 0)})}return e}}(),Se=async(e,t)=>{const{createSSRApp:n,renderToString:i}=await we(),r=n(e,t),o=[];r.config.errorHandler=e=>{o.push(e)};const l=await i(r);if(o.length>0)throw o[0];return l};function Ae(e){const t=be(e,{render:Se,rendererName:"vue-server-renderer"});return(e,n)=>async function(e,t,n){if(!function(e){if("object"!=typeof e||null===e)return!1;if(!("httpVersionMajor"in e)||1!==e.httpVersionMajor)return!1;if(!("pause"in e)||"function"!=typeof e.pause)return!1;if(!("socket"in e)||"object"!=typeof e.socket||null===e.socket)return!1;const{socket:t}=e;return"destroyed"in t&&"boolean"==typeof t.destroyed&&"on"in t&&"function"==typeof t.on&&"removeListener"in t&&"function"==typeof t.removeListener}(t)||e.bodyUsed||!0===e.body?.locked)return n(e);const i=new AbortController,r=()=>{i.abort()};t.socket.on("close",r),e.signal.addEventListener("abort",r,{once:!0}),(t.socket.destroyed||e.signal.aborted)&&r();const o=e.body;let l,a=null===o,s=!1;const u=()=>s,d=()=>{if(!s){s=!0;try{a||t.pause()}finally{l?.releaseLock(),l=void 0}}};try{const t=null===o?null:new ReadableStream({async pull(e){if(!u())try{l??=o.getReader();const t=await l.read();if(u())return;t.done?(a=!0,e.close()):e.enqueue(t.value)}catch(t){u()||e.error(t)}},cancel:d},{highWaterMark:0}),r=new Request(e,{body:t,signal:i.signal,duplex:"half"}),s=await n(r);if(a)return s;const c=new Headers(s.headers);return c.set("connection","close"),new Response(s.body,{status:s.status,statusText:s.statusText,headers:c})}finally{try{d()}finally{t.socket.removeListener("close",r),e.signal.removeEventListener("abort",r)}}}(e,n?.node?.req,e=>t(e,n?.context))}function ke(e={}){return t=>function(e,t={}){const n=T(t),i=e.split("?")[0]??"";return i.slice(i.lastIndexOf("/")+1)!==n.fileName?new Response("Not found",{status:404,headers:{"content-type":"text/plain; charset=utf-8","cache-control":"no-store"}}):new Response(n.source,{status:200,headers:{"content-type":"text/javascript; charset=utf-8","cache-control":"public, max-age=31536000, immutable","access-control-allow-origin":"*","x-content-type-options":"nosniff"}})}(t.url,e)}export{z as DECISION_CONTEXT_KEY,q as buildLivePreviewCsp,Ae as createFragmentEndpoint,ke as createRuntimeAssetRoute,W as defineLivePreviewServerHandler,D as livePreviewNitroPlugin,V as renderLivePreviewScript};
|
|
1
|
+
var e=/[\t\n\f\r ]+/;function t(e,t){const n=e.charCodeAt(t);return 9===n||10===n||12===n||13===n||32===n}function n(e){let n=0,i=e.length;for(;n<i&&t(e,n);)n+=1;for(;i>n&&t(e,i-1);)i-=1;return 0===n&&i===e.length?e:e.slice(n,i)}function i(e){return e.replace(/[A-Z]/g,e=>e.toLowerCase())}function buildFrameAncestors(e={}){const{self:t=!0,origins:n=[],allowNone:i=!1}=e,r=/* @__PURE__ */new Set,o=[];if(i&&!t&&0===n.length)return"'none'";t&&(o.push("'self'"),r.add("'self'"));for(const e of n){const t=e.trim();0===t.length||r.has(t)||(r.add(t),o.push(t))}return o.length>0?o.join(" "):"'none'"}var r=/* @__PURE__ */new Map([["child-src",["default-src"]],["connect-src",["default-src"]],["font-src",["default-src"]],["frame-src",["child-src","default-src"]],["img-src",["default-src"]],["manifest-src",["default-src"]],["media-src",["default-src"]],["object-src",["default-src"]],["script-src",["default-src"]],["script-src-elem",["script-src","default-src"]],["script-src-attr",["script-src","default-src"]],["style-src",["default-src"]],["style-src-elem",["style-src","default-src"]],["style-src-attr",["style-src","default-src"]],["worker-src",["child-src","script-src","default-src"]]]);function o(e,t){const n=r.get(e);if(void 0!==n)for(const e of n){const n=t.get(e);if(void 0!==n)return n}}function l(t,r){const l=/* @__PURE__ */new Map;for(const r of t.split(";")){const t=n(r);if(0===t.length)continue;const o=t.search(e),a=i(o<0?t:t.slice(0,o));if(l.has(a))continue;const s=o<0?"":n(t.slice(o));l.set(a,s)}for(const[t,n]of Object.entries(r)){const r=i(t),a="string"==typeof n?{value:n}:n,s=a.mode??"union",u=l.get(r)??o(r,l);if("replace"===s||void 0===u||0===u.length){l.set(r,a.value);continue}const d=/* @__PURE__ */new Set,c=[];for(const t of[...u.split(e),...a.value.split(e)])0===t.length||d.has(t)||(d.add(t),c.push(t));const f=c.filter(e=>"'none'"!==e);l.set(r,(f.length>0?f:c).join(" "))}const a=[];for(const[e,t]of l)a.push(0===t.length?e:`${e} ${t}`);return a.join("; ")}function a(e){if("v1"!==e.defaults&&""!==(e.serverURL??"")&&null==e.mergeDepth)throw new Error("payload-live-preview: `serverURL` needs an explicit `mergeDepth` under the 2.0 defaults — choose the population depth deliberately (0 for none), or pass `defaults: 'v1'` to keep the 1.x default of 1 while migrating (ADR 0007, entry 10).")}function s(){try{const e=globalThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}function u(e,t){if(!s())return;const n=globalThis,i=n.__payloadLivePreviewDeprecationsWarned??=/* @__PURE__ */new Set;if(!i.has(e)){i.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}function d(e){"v1"===e.defaults&&u("defaults-v1","`defaults: 'v1'` is removed in 3.0: `pll migrate` writes the 1.x rows it stands for into your options, where they keep working (ADR 0026)."),void 0!==e.onUnboundChange&&u("on-unbound-change","`onUnboundChange` is removed in 3.0: name it `onUnfaithfulPatch`, where 'route' is 'escalate'; `pll migrate` renames it (ADR 0026).")}var c=Object.freeze({strict:!0,previewSignals:Object.freeze(["query"])}),f=Object.freeze({disableReferrerDetection:!0,eventSourcePolicy:"parent-or-opener",skipUnchanged:!0,sanitizerPolicy:"strict"}),h=Object.freeze({strict:!1,previewSignals:Object.freeze(["query","fetch-dest","referer"])}),p=Object.freeze({disableReferrerDetection:!1,eventSourcePolicy:"any",skipUnchanged:!1,sanitizerPolicy:"compat"}),g=/* @__PURE__ */['(()=>{function e(e){return("object"==typeof e&&null!==e||"function"==typeof e)&&"function"==typeof e.then&&(Promise.resolve(e).catch(()=>{}),!0)}function t(t){return(...i)=>{try{e(t(...i))}catch{}}}function i(){}function n(e){switch(typeof e){case"string":return e.length>65536?void 0:`s:${e}`;case"number":return`n:${Object.is(e,-0)?"-0":String(e)}`;case"boolean":return"b:"+(e?"1":"0");case"bigint":return`i:${String(e)}`;case"undefined":return"u";case"object":{if(null===e)return"z";let t;try{t=JSON.stringify(e)}catch{return}return t.length>65536?void 0:`o:${t}`}case"symbol":case"function":return}}function r(e){return e.onUnfaithfulPatch??("ignore"===e.onUnboundChange?"ignore":"escalate")}function l(e,t,i,r,l){let o=e.onUnfaithfulPatch,a=t.reportedUnfaithful.get(i.element),s=n(l),u=Date.now(),d=void 0!==a&&("escalate"!==o||void 0===s||s===a.identity||u-a.at<Mn);if((d||"escalate"!==o)&&t.display.shortfall(t.activeUpdate,{kind:"unfaithful",field:i.fieldName}),!d){if(t.reportedUnfaithful.set(i.element,{identity:s,at:u}),void 0===a){if(t.unfaithfulCount+=1,t.unfaithfulFields.add(i.fieldName),"ignore"===o)return;if("warn"===o){e.warn(`[live-preview] LP0411: "${i.fieldName}" ${r}`);return}}e.log("LP0411",i.fieldName,r),t.unfaithfulPatches.push(i)}}function o(e,t){return!e.unfaithfulFields.has(t)&&(e.unfaithfulFields.add(t),e.unfaithfulCount+=1,!0)}function a(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:e.textContent}function s(e){let t=e.trim();return JSON.stringify(t.length>On?`${t.slice(0,On)}\\u2026`:t)}function u(){return function(){if(typ','eof document>"u")return;let e=document.documentElement.getAttribute("lang");return null===e||0===e.length?void 0:e}()??function(){if(typeof navigator>"u")return;let e=navigator.language;return"string"==typeof e&&e.length>0?e:void 0}()??"en"}function d(e){null!==e.timer&&(clearTimeout(e.timer),e.timer=null),e.messageNode?.remove(),e.messageNode=null}function c(e){if(++e.nodes>1e4)throw new Error("invalid or oversized field schema")}function h(e,t,i){if(c(t),i>64||t.active.has(e))throw new Error("invalid or oversized field schema");t.active.add(e)}function f(e){try{return p(e,{nodes:0,active:new WeakSet},0)}catch{return[]}}function p(e,t,i){if(!Array.isArray(e))return[];h(e,t,i);let n=[];for(let r of e){let e=g(r,t,i);e&&n.push(e)}return t.active.delete(e),n}function g(e,t,i){if(c(t),"object"!=typeof e||null===e)return;let n=e,r=n.name,l=n.type;if("string"!=typeof r||0===r.length||"string"!=typeof l||0===l.length)return;let o=p(n.fields,t,i+1),a=function(e,t,i){if("object"==typeof e&&null!==e&&!Array.isArray(e)){h(e,t,i);let n=[];for(let r in e){if(!Object.hasOwn(e,r))continue;c(t);let l=Reflect.get(e,r);"object"!=typeof l||null===l||["__proto__","constructor","prototype"].includes(r)||n.push({...l,slug:r,fields:p(l.fields,t,i+1)})}return t.active.delete(e),n}if(!Array.isArray(e))return[];h(e,t,i);let n=[];for(let r of e){if(c(t),"object"!=typeof r||null===r)continue;let e=r,l=e.slug;if("string"!=typeof l||0===l.length)continue;let o=p(e.fields,t,i+1);n.push({...e,slug:l,fields:o})}return t.active.delete(e),n}(n.blocks,t,i+1),s={...n,name:r,type:l},u=n.relationTo;if(Array.isArray(u)){let e=[];for(let i of u)c(t),e.push(i);s.relationTo=e}return o.length>0?s.fields=o:delete s.fields,a.length>0?s.blocks=a:delete s.blocks,s}function m(e,t){return void 0===e||t(e)}function v(e,t){return null==e||t(e)}function y(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return null===t||null===Object.getPrototypeOf(t)}function b(e,t=[]){let i="number"==typeof e&&Number.isFinite(e)&&e>=1?Math.floor(e):void 0,n=Math.min(4,i??1),r=new Set(t),l=new Set;for(let e of jn)(n>=In[e].since||r.has(e))&&l.add(e);return{ours:4,...void 0!==i?{theirs:i}:{theirs:void 0},negotiated:n,capabilities:l,observed:r}}function w(e,t){return e.generation===t.generation&&e.revision===t.revision}function S(e){return function(e){if(!1===e.enableA11y)return null;let t=e.root,i=void 0===t?void 0:function(e){return 9===e.nodeType}(t)?t:t.ownerDocument;return new Pn(e.a11yLocale,i)}(e)}function A(e){if(typ','eof window>"u")return;let t=[];window.parent!==window&&t.push(window.parent),window.opener instanceof Window&&t.push(window.opener),Dn.sendReady(t,e)}function k(e,t,i,n){for(let r of e){if(Wn.has(r.type)){let e=r.fields;e&&k(e,n&&"tabs"===r.type?""===t?r.name:`${t}.${r.name}`:t,i,n);continue}let e=""===t?r.name:`${t}.${r.name}`;if(i.set(e,r),"group"===r.type)r.fields&&k(r.fields,e,i,n);else if("array"===r.type&&r.fields)k(r.fields,`${e}.*`,i,n);else if("blocks"===r.type&&r.blocks)for(let t of r.blocks)k(t.fields,`${e}.*.${t.slug}`,i,n)}}function T(e,t){if(e.has(t))return e.get(t);let i=t.replace(/\\.\\d+(?=\\.|$)/g,".*");return e.has(i)?e.get(i):void 0}function C(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?t:void 0}function R(e){if("object"!=typeof e||null===e)return;let t=e.blockType;return"string"==typeof t?t:void 0}function $(e,t){return t.every(e=>void 0!==C(e))?function(e,t){let i=[],n=new Map;for(let t=0;t<e.length;t+=1){let i=C(e[t]);void 0!==i&&n.set(i,t)}let r=new Set;for(let l=0;l<t.length;l+=1){let o=t[l],a=C(o);if(void 0===a){i.push({kind:"insert",index:l,value:o});continue}let s=n.get(a);if(void 0===s){i.push({kind:"insert",index:l,value:o});continue}r.add(s);let u=e[s];R(u)===R(o)?(s!==l&&i.push({kind:"move",from:s,to:l,value:o}),F(u,o)||i.push({kind:"update",index:l,value:o})):i.push({kind:"replace",index:l,oldValue:u,value:o})}for(let t=0;t<e.length;t+=1)r.has(t)||i.push({kind:"remove",index:t,value:e[t]});return i}(e,t):function(e,t){let i=[],n=Math.min(e.length,t.length);for(let r=0;r<n;r+=1)F(e[r],t[r])||i.push({kind:"update",index:r,value:t[r]});if(t.length>e.length)for(let n=e.length;n<t.length;n+=1)i.push({kind:"insert",index:n,value:t[n]});if(e.length>t.length)for(let n=t.length;n<e.length;n+=1)i.push({kind:"remove",index:n,value:e[n]});return i}(e,t)}function F(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||"object"!=typeof t||null===e||null===t)return!1;let i=e,n=t,r=Object.keys(i),l=Object.keys(n);if(r.length!==l.length)return!1;for(let e of r)if(!Object.is(i[e],n[e]))return!1;return!0}function N(e){if("string"!=typeof e)return!1;let t=e.trim().replace(qn,"");if(0===t.length)return!1;if(t.startsWith("#")||t.startsWith("?")||Vn.test(t)||t.startsWith("/"))return!0;try{let e=new URL(t);return _n.has(e.protocol)}catch{return zn.test(t)&&!function(e){let t=Gn.exec(e.replace(Hn,""))?.[1];return void 0!==t&&!_n.has(`${t.toLowerCase()}:`)}(t)}}function M(e){let t=e.trim().replace(qn,"");return/^https?:\\/\\//i.test(t)||Vn.test(t)}function E(e){return!e.startsWith("on")&&!Kn.has(e)}function O(e){return Xn.add(e),e}function x(){return!0}function L(e,t,i,n=!1){if(n&&void 0!==i){let n=P(e,`${t}_${i}`);if(void 0!==n)return n}let r=P(e,t);if(void 0!==r)return r;if(t.includes(".")){let i=e,n=!0;for(let e of t.split(".")){if(Zn.has(e)||null===i||"object"!=typeof i){n=!1;break}if(i=P(i,e),void 0===i){n=!1;break}}if(n)return i}return void 0===i?void 0:P(e,`${t}_${i}`)}function P(e,t){if(!Zn.has(t)&&Object.prototype.hasOwnProperty.call(e,t))return e[t]}function U(e,t,i,n){return L(e,i,t.locale??n,void 0!==t.locale)}function I(e,t,i,r){let l=n(t);if(void 0===l)return;let o=[e.hrefField,e.srcField,e.altField],a=JSON.stringify([e.format,e.locale??r])+l;for(let t of o){if(void 0===t||0===t.length)continue;let l=n(U(i,e,t,r));if(void 0===l)return;a+=`|${t}=${l}`}return a}function j(e){return e.closest(`[${Yn}]`)}function D(e,t,i){let n=new Set(t);return{boundaries:t,strategy:e,ownerKeys:i,covers:e=>void 0!==e.fragmentBoundary&&n.has(e.fragmentBoundary)}}function W(e){let t=e.getAttribute(tr);return null!==t&&t.length>0?"patch"===t||"fragment"===t||"route"===t?t:void 0:null!==j(e)?"fragment":null!==e.closest("head")?"route":"patch"}function B(e){return`global:${e}`}function _(e,t){return void 0===t||""===t?`collection:${e}`:`collection:${e}:${t}`}function z(e){return"string"==typeof e&&e.length>0}function V(e,t){return null!==t&&void 0!==e&&t.includes(e)}function q(e){let t=e.id;return"string"==typeof t&&t.length>0?t:"number"==typeof t&&Number.isFinite(t)?String(t):void 0}function H(e){return"object"==typeof e&&null!==e}function G(e){return Array.isArray(e)?"array":H(e)?"object":"scalar"}function K(e,t){return H(e)?e[t]:void 0}function J(e,t){return("string"==typeof t||"number"==typeof t)&&H(e)&&!Array.isArray(e)&&e.id===t}function X(e,t){if(!H(e)||!H(t))return J(e,t)||J(t,e)||n(e)===n(t);if(Array.isArray(e)!==Array.isArray(t))return!1;let i=Object.keys(t);return i.length===Object.keys(e).length&&i.every(i=>Object.hasOwn(e,i)&&X(K(e,i),K(t,i)))}function Q(e,t){let i=n(t),r=n(e);return!!(void 0!==i&&i===r||J(e,t)||J(t,e))||void 0!==i&&void 0!==r&&X(e,t)}function Z(e,t,i){let n=t,r=i;for(let t of e.split("."))n=K(n,t),r=K(r,t);return!Q(n,r)}function Y(e,t,i,n){let r=[],l=0,o=(e,t,i,a)=>{if(l+=1,n.covers(e)||Q(t,i))return;if(!((void 0===t||G(t)===G(i))&&H(i)&&n.reachesBelow(e)&&a<ir)){r.push({path:e,value:i});return}let s=function(e,t){let i=new Set(Object.keys(t));if(H(e))for(let t of Object.keys(e))i.add(t);return[...i]}(t,i);0===s.length&&r.push({path:e,value:i});for(let n of s){if(l>=nr){r.push({path:e,value:i});return}o(`${e}.${n}`,K(t,n),K(i,n),a+1)}};return o(e,t,i,0),r}function ee(e,t,i={}){let n=e=>!1===t||V(e,t),r=[];for(let[t,i]of e.entries())i.some(e=>n(e.owner))&&r.push(t);let l=e.rendered.filter(e=>void 0!==i[e.strategy]);return function(e,t){let i=new Set(e),n=[...t],r=(e,t)=>{let i=`${t}.`;for(let t of e)if(t.startsWith(i))return!0;return!1};return{covers:e=>i.has(e)||n.some(t=>t===e||e.startsWith(`${t}.`)),reachesBelow:e=>r(i,e)||r(n,e)}}(r,[...e.covers,...l].filter(e=>n(e.owner)).flatMap(e=>e.paths))}function te(e,t){if(void 0===t||0===t.length)return e;let i=`_${t}`;return e.endsWith(i)?e.slice(0,-i.length):e}function ie(e,t,i,n=ee(e,i)){let r,l=n.covers,o=n.reachesBelow;return n=>{let a=te(n,t);return l(n)||a!==n&&l(a)||(r??(r=function(e,t){let i=new Set;for(let[n,r]of e.entries())for(let e of r)!1!==t&&!V(e.owner,t)||void 0!==e.locale&&i.add(`${n}_${e.locale}`);return i}(e,i)),r.has(n))?"whole":o(n)||a!==n&&o(a)?"below":"none"}}function ne(e,t,i,n,r){return oe(i)?!oe(t)||function(e,t,i){let n=void 0===i?void 0:T(i,e);return void 0!==n&&!lr.has(n.type)||!0===t.get(e)?.some(re)||function(e,t){let i=`${t}.`;for(let[t,n]of e.entries())if(t.startsWith(i))return!0;return!1}(t,e)}(e,n,r)?"keep":null==t?"ask":"own":"ask"}function re(e){return!lr.has(e.fieldType)}function le(e){let t=[e],i=new Set;for(let e=t.pop();void 0!==e;e=t.pop()){if("object"!=typeof e||null===e||i.has(e))continue;i.add(e);let{type:n,fields:r,children:l}=e;if(!or.has(n)||"internal"===r?.linkType)return!0;if(Array.isArray(l))for(let e of l)t.push(e)}return!1}function oe(e){return null===e||"object"!=typeof e&&"function"!=typeof e}function ae(e){return!0===e?.includes(".")}function se(e,t){let i=t.globalSlug??t.collectionSlug;if("string"!=typeof i||e.entitySlug!==i)return!0;let n=q(e),r=q(t.data??{});return void 0!==n&&void 0!==r&&n!==r}function ue(e){return null!==e&&e.forceRender&&!e.completed}function de(e){try{return!0===e.matchMedia?.("(prefers-reduced-motion: reduce)").matches}catch{return!1}}function ce(e,t){let i=t.element.ownerDocument.defaultView;return null===i?"no-element":e.reveal(`${t.owner??""} ${t.fieldName}`,t.element,i)}function he(e){let t=e.getAttribute(er);return{kind:"fragment",id:e.getAttribute(Yn)??"",key:null===t||0===t.length?void 0:t,code:"LP0801"}}function fe(e){if("object"!=typeof e||null===e||!("root"in e))return!1;let t=e.root;return"object"==typeof t&&null!==t&&Array.isArray(t.children)}function pe(e){return!!fe(e)&&e.root.children.every(e=>{let{type:t,children:i}=e??{};return"paragraph"===t&&(!Array.isArray(i)||0===i.length)})}function ge(e){if(null==e)return[];let t=new Set,i=[];for(let n of e.split(/[\\s,]+/)){let e=n.trim();0===e.length||t.has(e)||(t.add(e),i.push(e))}return i}function me(...e){let t=new Map;for(let i of e)for(let[e,n]of Object.entries(i)){let i=t.get(e);void 0===i&&(i=new Set,t.set(e,i));for(let e of n)i.add(e)}let i={};for(let[e,n]of t)i[e]=[...n];return i}function ve(e,t){let i={};for(let n of t)n!==e&&(i[n]=[e]);return i}function ye(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(Ar)||we(e)||e.hasAttribute(Sr))return!0;let t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function be(e){return"patch"===e.getAttribute(br)}function we(e){return function(e){return"astro-island"===e.tagName.toLowerCase()||e.hasAttribute(br)}(e)&&!be(e)}function Se(e){return"astro-island"===e.tagName.toLowerCase()&&e.hasAttribute("ssr")}function Ae(e){return"astro-island"===e.tagName.toLowerCase()}function ke(e){let t="";for(let i of e.querySelectorAll("astro-slot, template[data-astro-template]"))i.parentElement?.closest("astro-island")===e&&(t+=`${i.getAttribute("name")??i.getAttribute("data-astro-template")??""}\\0${i.innerHTML}\\0`);return t}function Te(e,t){if(!Ae(e)||!Ae(t))return!0;let i=ke(t);if(!kr.every(i=>e.getAttribute(i)===t.getAttribute(i))||(Tr.get(e)??ke(e))!==i||e.getAttribute("props")!==t.getAttribute("props")&&!function(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return void 0!==t&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}(e))return Tr.set(t,i),!1;Tr.set(e,i);let n=t.getAttribute("props");return n!==e.getAttribute("props")&&(e.setAttribute("ssr",""),null===n?e.removeAttribute("props"):e.setAttribute("props",n)),!0}function Ce(e){return Array.from(e.querySelectorAll("astro-island"))}function Re(e){let t=e.ownerDocument.defaultView;if(void 0===t?.customElements.get("astro-island"))return"element";let i=e.getAttribute("client"),n=Reflect.get(t,"Astro");return null===i||"object"!=typeof n||null===n||void 0===Reflect.get(n,i)?"directive":void 0}function $e(e){let t=e.closest(Kr)?.getAttribute(Wr);return null==t||0===t.length?void 0:t}function Fe(e){return Qr.has(e)||Xr.test(e)}function Ne(e,t){return e.fieldName===t.fieldName&&e.locale===t.locale&&e.owner===t.owner&&e.strategyKind===t.strategyKind&&e.fragmentBoundary===t.fragmentBoundary}function Me(e){let t=e.getAttribute($r);if(null!==t&&Fe(t))return t;if(e.hasAttribute(Ur))return"richText";if(e.hasAttribute(Ir))return"html";if(e.hasAttribute(Dr))return"structural-array";if(e.hasAttribute(jr))return"array";if("IMG"===e.tagName)return"image";if("A"===e.tagName)return"url";if("TIME"===e.tagName)return"date";if("INPUT"===e.tagName){let t=e.type;if("checkbox"===t)return"checkbox";if("number"===t)return"number";if("date"===t||"datetime-local"===t)return"date"}return"text"}function Ee(){return!0}function Oe(){throw new Error("invalid or oversized legacy population")}function xe(e){for(let t=0;t<e.length;t+=1){let i=e.charCodeAt(t);if(i<=31||127===i)return!0}return!1}function Le(e,t){if("string"!=typeof e||0===e.length||e.length>t||"."===e||".."===e||e.includes("/")||e.includes("\\\\")||xe(e))return!1;try{return encodeURIComponent(e),!0}catch{return!1}}function Pe(e){return Le(e,128)&&!/[?#%]/u.test(e)&&!al.has(e)}function Ue(e){return Number.isFinite(e)?String(e):Le(e,512)?e:Oe()}function Ie(e,t){return Object.hasOwn(e,t)?Reflect.get(e,t):void 0}function je(e,t,i){Object.defineProperty(e,t,{value:i,writable:!0,configurable:!0,enumerable:!0})}function De(e){let t=e.length;for(;t>0&&47===e.charCodeAt(t-1);)t-=1;return e.slice(0,t)}function We(e){let t=new WeakSet,i=0,n=0;return function e(r,l){if(++i>el||l>Yr)return Oe();if("string"==typeof r)return n+=r.length,n>rl&&Oe(),r;if(null==r||"boolean"==typeof r)return r;if("number"==typeof r)return Number.isFinite(r)?r:Oe();if(!Array.isArray(r)&&!y(r))return Oe();if(Array.isArray(r)){r.length>el&&Oe();for(let e=0;e<r.length;e+=1)Object.hasOwn(r,e)||Oe()}if(t.has(r))return Oe();t.add(r);let o=Array.isArray(r)?[]:{};for(let t of Object.keys(r))je(o,t,e(Reflect.get(r,t),l+1));return t.delete(r),o}(e,0)}function Be(e,t,i,n,r,l){function o(e,t,i,n){if(null==n||""===n)return;let l=y(n)?Ie(n,"id"):n,o=Ue(l);if(0===r){je(e,t,l);return}let a=JSON.stringify([i,o]);c.add(a),c.size>tl&&Oe();let s=d.get(i)??[];s.push({owner:e,key:t,id:o}),d.set(i,s)}function a(e,t,i){void 0!==i.hasMany&&"boolean"!=typeof i.hasMany&&Oe();let n=i.relationTo,r=Ie(e,t);if(Array.isArray(n)){0===n.length&&Oe();let e,t=y(r)?Ie(r,"relationTo"):void 0;for(let i of n)p(0),Pe(i)||Oe(),i===t&&(e=i);if(null==r||""===r)return;(!y(r)||void 0===e)&&Oe(),o(r,"value",e,Ie(r,"value"))}else Pe(n)||Oe(),o(e,t,n,r)}function s(e,t){if(p(t),Array.isArray(e)||y(e)){if(y(e)&&Object.hasOwn(e,"relationTo")&&Object.hasOwn(e,"value")){let t=Ie(e,"relationTo");Pe(t)||Oe(),o(e,"value",t,Ie(e,"value"));return}for(let i of Object.keys(e))s(Reflect.get(e,i),t+1)}}if(!Number.isSafeInteger(r)||r<0||r>Yr)return Oe();void 0!==l&&("string"!=typeof l||l.length>128||xe(l))&&Oe();let u=We(e);if(!y(u))return Oe();let d=new Map,c=new Set,h=0,f=new WeakSet,p=e=>{(++h>el||e>Yr)&&Oe()};(function e(t,i,n){p(n),f.has(t)&&Oe(),f.add(t);for(let r of t){p(n),(!y(r)||!Le(r.name,512)||al.has(r.name))&&Oe();let t=Ie(i,r.name);if("relationship"===r.type||"upload"===r.type)if(r.hasMany)if(null!=t&&!Array.isArray(t)&&Oe(),Array.isArray(t))for(let e=0;e<t.length;e+=1)a(t,e,r);else a(i,r.name,r);else a(i,r.name,r);else if("group"===r.type||"tabs"===r.type)null!=t&&!y(t)&&Oe(),y(t)&&r.fields&&e(r.fields,t,n+1);else if("row"===r.type||"collapsible"===r.type)r.fields&&e(r.fields,i,n+1);else if("array"===r.type||"blocks"===r.type){if(0===t?je(i,r.name,[]):null!=t&&!Array.isArray(t)&&Oe(),Array.isArray(t))for(let i of t)if(y(i)||Oe(),"array"===r.type&&r.fields)e(r.fields,i,n+1);else if("blocks"===r.type){let t=Ie(i,"blockType"),l=r.blocks?.find(e=>(p(n),e.slug===t));void 0===l&&Oe(),e(l.fields,i,n+1)}}else"richText"===r.type&&s(t,n+1)}f.delete(t)})(t,u,0),d.size>25&&Oe();let g=[];if(0===d.size)return{doc:u,requests:g};let m=new URL(i);(!["http:","https:"].includes(m.protocol)||m.username||m.password||m.search||m.hash)&&Oe(),(!n.startsWith("/")||n.includes("\\\\")||/[%?#]/u.test(n)||xe(n))&&Oe(),n.split("/").some(e=>"."===e||".."===e)&&Oe();let v=`${De(i)}${De(n)}/`;for(let[e,t]of d){let i=[...new Set(t.map(e=>e.id))],n=0;for(;n<i.length;){let o=i[n];void 0===o&&Oe();let a=o.includes(","),s=[],u="";for(;n<i.length&&s.length<ol;){let t=i[n];if(void 0===t||s.length>0&&(a||t.includes(",")))break;let o=[...s,t],d=new URLSearchParams({depth:String(r),limit:String(o.length)});void 0!==l&&d.set("locale",l),d.set(a?"where[id][equals]":"where[id][in]",a?t:o.join(","));let c=`${v}${encodeURIComponent(e)}?${d}`;if(c.length>nl){0===s.length&&Oe();break}new URL(c).origin!==m.origin&&Oe(),s.push(t),n+=1,u=c}(0===s.length||g.length>=il)&&Oe();let d=new Set(s);g.push({url:u,ids:d,slots:t.filter(e=>d.has(e.id))})}}return{doc:u,requests:g}}async function _e(e,t,i){let n,r,l=!1,o=!1,a=Symbol(),s=new Promise(e=>{r=()=>{e(a)}}),u=()=>{(!i()||t.aborted)&&Oe()},d=()=>{if(void 0!==n&&!l){l=!0;try{Promise.resolve(n.cancel()).catch(()=>{})}catch{}}},c=()=>{r?.(),d()};t.addEventListener("abort",c,{once:!0});try{u();let t=e.body??null;if(u(),null===t){let t=e.json.bind(e);u();let i=await Promise.race([Promise.resolve().then(()=>(u(),t())),s]);return u(),i===a&&Oe(),i}let i=t.getReader.bind(t);u();let r=i();n=r,u();let l=[],d=0,c=0;for(;;){let e=Promise.resolve().then(()=>{u();let e=r.read.bind(r);return u(),e()}),t=await Promise.race([e,s]);if(u(),t===a&&Oe(),t.done)break;d+=t.value.byteLength,(++c>ll||d>rl)&&Oe(),l.push(t.value)}o=!0;let h=new Uint8Array(d),f=0;for(let e of l)h.set(e,f),f+=e.byteLength;try{return JSON.parse((new TextDecoder).decode(h))}catch{return Oe()}}finally{t.removeEventListener("abort",c),o||d();try{n?.releaseLock()}catch{}}}function ze(e,t){let i=We(t);y(i)||Oe();let n=Ie(i,"docs");(!Array.isArray(n)||n.length>ol)&&Oe();let r=new Map;for(let t of n){y(t)||Oe();let i=Ue(Ie(t,"id"));(!e.ids.has(i)||r.has(i))&&Oe(),r.set(i,t)}r.size!==e.ids.size&&Oe();for(let t of e.slots)je(t.owner,t.key,r.get(t.id))}function Ve(e,t){return e.length>0&&e.length<=t&&"."!==e&&".."!==e&&!e.includes("/")&&!e.includes("\\\\")&&!function(e){for(let t of e){let e=t.codePointAt(0)??0;if(e<=31||127===e)return!0}return!1}(e)}function qe(e){return Ve(e,128)&&!e.includes("?")&&!e.includes("#")}function He(e){return"number"==typeof e?Number.isFinite(e):"string"==typeof e&&Ve(e,512)}function Ge(e){return e.has("schema-json")?dl:e.has("document-events")||e.has("relationship-events")?cl:hl}function Ke(e){if("attributes"!==e.type||e.attributeName!==fl||e.target.nodeType!==pl)return null;let t=e.target;return"astro-island"!==t.tagName.toLowerCase()||t.hasAttribute(fl)?null:t}function Je(e){if(e.nodeType!==pl)return!1;let t=e;return t.matches(ml)||null!==t.querySelector(ml)}function Xe(){if(typ','eof window>"u")return;let e=window;return e[Tl]??(e[Tl]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function Qe(){let e=Xe();if(void 0===e||e.armed)return;e.armed=!0;let t=window,i=t.__REACT_DEVTOOLS_GLOBAL_HOOK__??(t.__REACT_DEVTOOLS_GLOBAL_HOOK__=function(){let e=new Map;return{supportsFiber:!0,renderers:e,inject:t=>{let i=e.size+1;return e.set(i,t),i}}}()),n=i.onCommitFiberRoot;i.onCommitFiberRoot=function(t,i,...r){try{n?.call(this,t,i,...r)}catch{}void 0===e.onCommit?e.commits.push(i):e.onCommit(i)}}function Ze(e){e.committed=!0;let t=e.waiters;e.waiters=[];for(let e of t)e()}function Ye(e,t){let i=e.waiters.indexOf(t);i>=0&&e.waiters.splice(i,1)}function et(e,t,i){if(e.committed)return null;let n=null,r=()=>{null!==n&&clearTimeout(n),n=null,t("committed")};return e.waiters.push(r),n=setTimeout(()=>{n=null,Ye(e,r),t("timed-out")},i),()=>{null!==n&&clearTimeout(n),n=null,Ye(e,r)}}function tt(){if(typ','eof window>"u")return;let e=window;return e[$l]??(e[$l]={armed:!1,committed:!1,waiters:[]})}function it(e){return Object.prototype.hasOwnProperty.call(e,Rl)?e[Rl]:void 0}function nt(){let e=tt();if(void 0===e||e.armed)return;e.armed=!0;let t=Element.prototype;void 0===Object.getOwnPropertyDescriptor(t,Rl)&&Object.defineProperty(t,Rl,{configurable:!0,get:()=>{},set(e){Object.defineProperty(this,Rl,{value:e,writable:!0,configurable:!0,enumerable:!0});let t=tt();void 0===t||t.committed||null===this.querySelector(Cl)||function(e,t){let i=t?.$nuxt;!0!==i?.isHydrating||"function"!=typeof i.hook?Ze(e):i.hook(Fl,()=>{e.committed||Ze(e)})}(t,e)}})}function rt(e){let t=e.hydration;if(void 0===t){e.startNow();return}let i=Nl[t](e.root,i=>{e.later(()=>{lt(e,t,i)})});null!==i?(e.defer(i),e.hydrated("waiting")):lt(e,t,"committed")}function lt(e,t,i){e.hydrated(i),"timed-out"===i&&e.warn(`[live-preview] LP0607: no ${Ml[t]} in ${String(5e3)} ms; started without waiting for hydration.`),e.startNow()}function ot(e){return 9===e.nodeType}function at(e){return e.body}function st(e,t=Ll){if("string"!=typeof e)return!1;let i=e.trim();return!(i.length<t||Ul.test(i)||Pl.has(i.toLowerCase())||Il.test(i)||jl.test(i))}function ut(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function dt(e,t,i=Ll){let n=new Map,r=(e,t,i)=>{n.set(e,n.has(e)?null:{field:t,media:i})};for(let[n,l]of Object.entries(e)){if(rr.has(n))continue;let e=te(n,t);if(st(l,i))r(l.trim(),e,!1);else if(ut(l))if("string"==typeof l.url)r(l.url,e,!0);else if(!("id"in l)&&!("_id"in l))for(let[t,n]of Object.entries(l))rr.has(t)||!st(n,i)||r(n.trim(),`${e}.${t}`,!1)}return n}function ct(e){if(e.namespaceURI!==Wl||Dl.has(e.tagName)||e.hasAttribute(Rr)||e.hasAttribute(xl)||e.hasAttribute(Sr)||we(e))return!0;let t=e.getAttribute("contenteditable");return null!==t&&"false"!==t}function ht(e){let t;for(let i=e.firstChild;null!==i;i=i.nextSibling){if(1===i.nodeType)return;if(3!==i.nodeType)continue;let e=i.data.trim();if(0!==e.length){if(void 0!==t)return;t=e}}return t}function ft(e){return E(e)&&!e.startsWith("data-payload-")&&"value"!==e}function pt(e,t,i){let n=e.byElement.get(t);void 0===n&&(n={attributes:new Map},e.byElement.set(t,n));let r=e.byField.get(i.field);return void 0===r&&(r=new Set,e.byField.set(i.field,r)),r.add(t),n}function gt(e,t){for(let i=e.firstElementChild;null!==i;i=i.nextElementSibling){if(ct(i))continue;let e=ht(i),n=void 0===e?void 0:t.values.get(e);null!=n&&!n.media&&(pt(t,i,n).text=n.field);for(let e of i.getAttributeNames()){if(!ft(e))continue;let n=t.values.get(i.getAttribute(e)??"");null!=n&&(n.media&&("IMG"!==i.tagName||"src"!==e)||pt(t,i,n).attributes.set(e,n))}gt(i,t)}}function mt(e,t,i){let n=e.tagName;if(void 0!==t){let r={[Rr]:t};if("A"===n){let e=i.get("href");void 0===e?r[$r]="text":e!==t&&(r[Nr]=e)}return{element:e,fieldName:t,matched:ht(e)??"",stamps:r}}if("IMG"===n){let t=i.get("src");if(void 0!==t){let n=i.get("alt");return{element:e,fieldName:t,matched:e.getAttribute("src")??"",attribute:"src",stamps:{[Rr]:t,...void 0!==n&&n!==t?{[Er]:n}:{}}}}}let r=i.entries().next();if(r.done)return;let[l,o]=r.value;return{element:e,fieldName:o,matched:e.getAttribute(l)??"",attribute:l,stamps:{[Rr]:o,[Fr]:l}}}function vt(e,t){let i={values:t,byElement:new Map,byField:new Map};t.size>0&&!ct(e)&>(e,i);let n=e=>1===i.byField.get(e)?.size,r=[];for(let[e,t]of i.byElement){let i=void 0!==t.text&&n(t.text)?t.text:void 0,l=new Map;for(let[e,i]of t.attributes)n(i.field)&&l.set(e,i.field);let o=mt(e,i,l);void 0!==o&&r.push(o)}return r}function yt(e){return 9===e.nodeType?e.body:e}function bt(e,t){for(let i=t.length-1;i>=0;i-=1){let n=t[i];if(void 0!==n){n.observed&&e.observers.unobserveElement(n.element);for(let e=n.attributes.length-1;e>=0;e-=1){let t=n.attributes[e];if(void 0===t)continue;let{name:i,before:r,written:l}=t;r===l||n.element.getAttribute(i)!==l||(null===r?n.element.removeAttribute(i):n.element.setAttribute(i,r))}n.cacheTouched&&(n.element.hasAttribute(Rr)?e.cache.add(n.element):e.cache.remove(n.element))}}}function wt(e,t,i,n,r){let l=[],o=[],a=()=>(bt(e,o),[]);for(let s of t){if(!r())return a();let{element:t}=s;if(t.hasAttribute(Rr))continue;if(!r())return a();if(!1!==i&&!V($e(t),i))continue;if(!r())return a();let u={element:t,attributes:[],cacheTouched:!1,observed:!1};o.push(u);for(let[e,i]of[...Object.entries(s.stamps),[Vr,s.matched]]){let n=t.getAttribute(e);if(!r()||(u.attributes.push({name:e,before:n,written:i}),t.setAttribute(e,i),!r()))return a()}if(u.cacheTouched=!0,void 0!==e.cache.add(t)){if(!r()||(e.observers.observeElement(t),u.observed=!0,!r())||(e.log("autoBind",s.fieldName,"\\u2192",`<${t.tagName.toLowerCase()}>`,s.attribute??"text",JSON.stringify(s.matched),n),!r()))return a();l.push(s)}else bt(e,[u]),o.pop()}return l}function St(e,t,i,n){if(!e.scopeBindingsByOwner)return!1;let{message:r}=i,l=function(e){if(z(e.globalSlug))return[B(e.globalSlug)];if(!z(e.collectionSlug))return null;let t=_(e.collectionSlug);return z(e.documentId)?[t,_(e.collectionSlug,e.documentId)]:[t]}({globalSlug:"string"==typeof r.globalSlug?r.globalSlug:void 0,collectionSlug:"string"==typeof r.collectionSlug?r.collectionSlug:void 0,documentId:q(n)});return null===l&&!t.warnedUnattributableMessage&&(t.warnedUnattributableMessage=!0,e.warn("[live-preview] LP0202: scopeBindingsByOwner: update names no document; nothing applied")),l}function At(e,t,i,n,r){!function(e,t,i){let n=0;for(let r of e)if(!i()||(r.dispatchEvent(new CustomEvent(yr,{detail:t,bubbles:!1})),n+=1,!i()))break}(i,{fields:t.fields,revision:e.revision.revision,receivedAt:e.receivedAt,locale:e.locale,displayed:r},n)}function kt(e,t,i,n,r){let{warned:l,warn:o}=e;if(l.has(i)||t(i))return;l.add(i);let a=`data-payload-field="${te(i,n)}"`;o(""!==r?`[live-preview] LP0203: field "${i}" has a value and no <\\u2026 ${a}> on this page; editing it changes nothing here. Expected where the page shows part of the document: inspect().fidelity.fields lists these, onUnfaithfulPatch decides whether a server render is asked for.`:`[live-preview] LP0201: no <\\u2026 ${a}> for the empty field "${i}"; render the anchor unconditionally so edits to an empty field have somewhere to land.`)}function Tt(e){let t=typeof e;return"string"===t||"number"===t||"boolean"===t||"bigint"===t}function Ct(e){return Array.isArray(e.docs)&&"boolean"==typeof e.hasNextPage}function Rt(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function $t(e){let t=function(){let e=function(){let e=globalThis,t=e[zl];if(void 0!==t)return t;let i={};return e[zl]=i,i}();if(void 0!==e.override)return e.override;if(void 0!==e.auto)return e.auto;let t=function(){let e=globalThis.trustedTypes;return"object"!=typeof e||null===e?void 0:"function"==typeof e.createPolicy?e:void 0}();try{e.auto=void 0===t?null:t.createPolicy(_l,{createHTML:e=>e})}catch{e.auto=null}return e.auto}();return null===t?e:t.createHTML(e)}function Ft(e,t){for(let i of t.keyAttributes){let t=e.getAttribute(i);if(null!==t&&t.length>0)return`${i}=${t}`}}function Nt(e,t,i){if(!Ot(e,t))return t;let n=i.boundary??ye,r=n(e),l=n(t);if(r||l)return r&&l&&(i.retainBoundary?.(e,t)??1)?e:t;let o=xt(e);return function(e,t){for(let i of Array.from(e.attributes))t.hasAttribute(i.name)||Vl.has(i.name.toLowerCase())||e.removeAttribute(i.name);for(let i of Array.from(t.attributes))e.getAttribute(i.name)!==i.value&&e.setAttribute(i.name,i.value)}(e,t),!0!==i.retainChildrenOf?.(e,t)&&function(e,t,i){let n=function(e,t){let i,n=new Map;for(let r of Array.from(e.children)){let e=Ft(r,t);if(void 0!==e){if(n.has(e)){i??(i=e.slice(e.indexOf("=")+1));continue}n.set(e,r)}}return void 0!==i&&t.onDuplicateKey?.(e,i),n}(e,i),r=new Set(n.values()),l=Array.from(e.childNodes).filter(e=>!r.has(e)),o=new Set,a=new Set,s=Array.from(t.childNodes),u=e.firstChild,d=0;for(let t=0;t<s.length;t+=1){let r=s[t],c=null,h=r instanceof Element?Ft(r,i):void 0;if(void 0!==h&&a.has(h)&&(h=void 0),void 0!==h){a.add(h);let e=n.get(h);if(void 0!==e&&!o.has(e)&&(c=Mt(e,r,i)===e?e:null,null===c)){e.replaceWith(r),o.add(r),u=r.nextSibling;continue}}else{for(;d<l.length;){let n=l[d];if(d+=1,!o.has(n)){if(Ot(n,r)){c=Mt(n,r,i)===n?n:null,null===c&&(e.replaceChild(r,n),o.add(r),u=r.nextSibling);break}if(n instanceof Element){let i=s[t+1];if(!(r instanceof Element)||void 0!==i&&Ot(n,i)){d-=1;break}e.replaceChild(r,n),o.add(r),u=r.nextSibling;break}if(!(r instanceof Element)){e.replaceChild(r,n),o.add(r),u=r.nextSibling;break}}}if(null===c&&o.has(r))continue}let f=c??r;for(o.add(f);null!==u&&u!==f&&!o.has(u)&&Et(u);)u=u.nextSibling;f!==u&&e.insertBefore(f,u),u=f.nextSibling}for(let t of Array.from(e.childNodes))o.has(t)||t.remove()}(e,t,i),Lt(o),e}function Mt(e,t,i){return e instanceof Element&&t instanceof Element?Nt(e,t,i):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function Et(e){return e.nodeType===Node.TEXT_NODE&&0===(e.nodeValue??"").trim().length}function Ot(e,t){return e.nodeType===t.nodeType&&(!(e instanceof Element&&t instanceof Element)||e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI)}function xt(e){let t=e.ownerDocument.activeElement;return t instanceof HTMLElement&&e.contains(t)?{element:t,selection:t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null}:null}function Lt(e){if(null===e)return;let{element:t,selection:i}=e;if(t.ownerDocument.activeElement!==t&&t.isConnected)try{t.focus({preventScroll:!0});let[e,n]=i??[null,null];null!==e&&null!==n&&t.setSelectionRange(e,n)}catch{}}function Pt(e){Hl.has(e)||(Hl.add(e),function(e){try{console.warn(e)}catch{}}(`[live-preview] LP0409: the strict sanitizer removed \\`${e}\\` from written markup; the 1.x default (\\`sanitizerPolicy: \'compat\'\\`) kept it. ${function(e){return e.startsWith(Gl)?"A binding inside CMS content is refused by design \\u2014 an editor could otherwise aim a write at any element on the page (docs/security.md)":"id"===e||"name"===e?"CMS content that can name an element can shadow a global of that name \\u2014 DOM clobbering, refused by design (docs/security.md)":"Put it on an element the template owns, or set `sanitizerPolicy: \'compat\'` to keep every `data-*` as 1.x did"}(e)}.`))}function Ut(e,t){return It(e,void 0,t)}function It(e,t,i){let n=i?.document??Wt();if(!n)throw jt();if(""===e)return"";let r=function(e,t){let i=e?.policy??t??ao;if(!e){let e=new Map;for(let[t,i]of Object.entries(to))e.set(t,i);return{allowedTags:Kl,attrByTag:e,allowFormControls:!1,templateMode:!1,mode:i,allowedData:new Set}}let n=new Set(Kl);if(e.additionalAllowedTags?.forEach(e=>n.add(e)),!0===e.allowFormControls)for(let e of Jl)n.add(e);let r=new Map;for(let[e,t]of Object.entries(to))r.set(e,t);for(let[t,i]of Object.entries(e.additionalAllowedAttributes??{})){let e=new Set(r.get(t));for(let t of i)e.add(t);r.set(t,e)}return{allowedTags:n,attrByTag:r,allowFormControls:!0===e.allowFormControls,templateMode:!0===e.templateMode,mode:i,allowedData:new Set(e.allowedDataAttributes?.map(e=>e.toLowerCase()))}}(i,t),l=e;for(let e=0;e<no;e+=1){let e=n.createElement("template");e.innerHTML=$t(l);let t=e.content;Bt(t,r);let i=Dt(t);if(i===l)return i;l=i}return function(e,t){if(!function(){try{let e=glo','balThis.process?.env;return void 0!==e&&"production"!==e.NODE_ENV}catch{return!1}}())return;let i=globalThis,n=i[ql]??(i[ql]=new Set);if(!n.has(e)){n.add(e);try{console.warn(`[payload-live-preview] ${t}`)}catch{}}}("sanitizer-unsettled",`sanitizeHtml: the output did not settle after ${String(no)} passes, so it returned an empty string (ADR 0016).`),""}function jt(){return new Error("sanitizeHtml needs a DOM")}function Dt(e){let t=e.ownerDocument?.createElement("div");if(void 0===t)throw jt();let i=e.firstChild;if(t.append(e),t.firstChild!==i)throw jt();return t.innerHTML}function Wt(){if(!(typ','eof document>"u"))return document}function Bt(e,t){for(let i of Array.from(e.childNodes))i.nodeType===ro?_t(i,t):i.nodeType===lo&&i.remove()}function _t(e,t){let i=e.tagName.toLowerCase();!Xl.has(i)||t.allowFormControls&&Jl.has(i)?t.allowedTags.has(i)?(function(e,t,i){let n=i.attrByTag.get(t);for(let t of Array.from(e.attributes)){let r=t.name.toLowerCase();if(r.startsWith("on")||"style"===r)e.removeAttribute(t.name);else if("is"!==r){if("strict"===i.mode){if(i.templateMode&&oo.has(r))continue;if("id"===r||"name"===r||r.startsWith(eo)){e.removeAttribute(t.name),("name"!==r||!0===n?.has(r))&&Pt(r);continue}if(r.startsWith(Yl)){i.allowedData.has(r)||(e.removeAttribute(t.name),Pt(r));continue}if(Ql.has(r)||r.startsWith(Zl))continue}else if(Ql.has(r)||r.startsWith(Zl)||r.startsWith(Yl))continue;n?.has(r)?(io.has(r)&&!N(t.value)||"srcset"===r&&!zt(t.value)||"ping"===r&&!t.value.trim().split(/\\s+/u).every(N))&&e.removeAttribute(t.name):e.removeAttribute(t.name)}else e.setAttribute("is","")}}(e,i,t),"a"===i&&function(e){let t=e.getAttribute("href");null===t||!M(t)||(e.setAttribute("rel","noopener noreferrer"),e.hasAttribute("target")||e.setAttribute("target","_blank"))}(e),Bt(e,t)):(Bt(e,t),e.replaceWith(...e.childNodes)):e.remove()}function zt(e){for(let t of e.split(",")){let e=t.trim();if(0===e.length)continue;let[i=e]=e.split(/\\s/,1);if(!N(i)||!N(e))return!1}return!0}function Vt(e){return e.replace(uo,e=>so[e])}function qt(e){return e.replace(ho,e=>co[e])}function Ht(e){let t=new Set;for(let i of e)if("object"==typeof i&&null!==i)for(let e of Object.keys(i))t.add(e);return t}function Gt(e,t,i,n,r){let l="object"==typeof t&&null!==t?t:null;return e.replace(fo,(e,o)=>null!==l&&function(e,t){return Object.prototype.hasOwnProperty.call(e,t)}(l,o)?Vt(n(Reflect.get(l,o))):null===l&&"value"===o?Vt(n(t)):"index"===o?String(i):null!==l&&!0===r?.has(o)?"":e)}function Kt(e){let t=e.children,i=t[0];if(void 0===i)return[];let n=[];for(let{name:e,value:r}of Array.from(i.attributes)){if(!E(e)||e.startsWith(po))continue;let i=!0;for(let n=1;n<t.length&&i;n+=1)i=t[n]?.getAttribute(e)===r;i&&n.push([e,r])}return n}function Jt(e,t){for(let[i,n]of t)e.hasAttribute(i)||e.setAttribute(i,n)}function Xt(e){if(null==e)return"";if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e||"bigint"==typeof e)return String(e);try{return JSON.stringify(e)}catch{return""}}function Qt(e){return null==e||""===e}function Zt(e,t){let i=e.get(t);return void 0!==i&&(e.delete(t),e.set(t,i)),i}function Yt(e,t,i,n){return e.set(t,i),function(e,t){for(let i of e.keys()){if(e.size<=t)break;e.delete(i)}}(e,n),i}function ei(e){let t=Zt(bo,e);if(void 0!==t)return t;let i=new Set(go);for(let t of e.matchAll(vo)){let e=t[1]?.toLowerCase();void 0!==e&&i.add(e)}let n={};for(let e of i)n[e]=mo;let r={additionalAllowedTags:[...i],additionalAllowedAttributes:n,allowFormControls:!0,templateMode:!0};return Yt(bo,e,r,yo)}function ti(e){let t=ni(e.container,e.patches,e);return null===t?null:ri(t,e.store,{morph:e.morph??!0,onDuplicateKey:e.onDuplicateKey})}function ii(e,t){return t.hasAttribute(So)&&t.hasAttribute(Ao)}function ni(e,t,i){let n=function(e,t,i){let{template:n,nextItems:r,forceRender:l=!1,store:o,sanitizerPolicy:a}=i,s=o.get(e),u=Kt(e),d=Ht(r),c=Array.from(e.children),h=ci(c,wo),f=new Set,p=[];for(let o=0;o<r.length;o+=1){let g=r[o],m=di(g),v=void 0===m?c[o]??null:hi(h,m)??null;null!==v&&f.has(v)&&(v=null),null!==v&&f.add(v);let y=t.replaces.has(o),b=l||t.renders.has(o)||null===v?fi(e.ownerDocument,n,g,o,a,u,d):void 0;if(null===b)return null;let w=void 0===b?[]:li(y?null:v,b,g,void 0===m?void 0:s?.get(m),i);if(null===w)return null;p.push([o,v,b,w,y])}return p}(e,function(e){let t=new Set,i=new Set;for(let n of e)"insert"===n.kind||"update"===n.kind?t.add(n.index):"replace"===n.kind&&(t.add(n.index),i.add(n.index));return{renders:t,replaces:i}}(t),i);return null===n?null:[e,n,i.nextItems]}function ri(e,t,i){let[n,r,l]=e,o=new Set,a=!1,s=xt(n);for(let[e,l,s,u,d]of r){let r=l;if(void 0!==s){let e=!(!i.morph||d||null===l)&&Nt(l,s,{keyAttributes:[wo,So],boundary:ye,retainBoundary:Te,retainChildrenOf:ii,...void 0!==i.onDuplicateKey?{onDuplicateKey:i.onDuplicateKey}:{}})===l;if(!e)for(let[e,t]of u)null!==e&&(ai(e,t),t.replaceWith(e));for(let[,,e]of u)void 0!==e&&ri(e,t,i);e?a=!0:(null!==l&&(l.replaceWith(s),a=!0),r=s)}if(null===r)continue;let c=n.children[e]??null;r!==c&&(n.insertBefore(r,c),a=!0),o.add(r)}for(let e of Array.from(n.children))o.has(e)||(e.remove(),a=!0);Lt(s);let u=function(e,t){let i=t.get(e);return i||(i=new Map,t.set(e,i)),i}(n,t);u.clear();for(let e of l)ui(u,e);return a}function li(e,t,i,n,r){let l=ci(null===e?[]:oi(e),So),o=[];for(let e of oi(t)){let t=e.getAttribute(So);if(null===t)continue;let a,s=hi(l,t)??null,u=e.getAttribute(Ao),d=u?s:null,c=d?.getAttribute(Ao)??null;if(u){let l=si(i,t);if(void 0!==l||null!==d){let i=l??[],o=$(null===d?[]:si(n,t)??[],i),s=null!==d&&c!==u;if((o.length>0||s)&&(a=ni(d??e,o,{template:u,nextItems:i,forceRender:s,store:r.store,sanitizerPolicy:r.sanitizerPolicy})??void 0,void 0===a))return null}}o.push([d,e,a])}return o}function oi(e){return Array.from(e.querySelectorAll(`[${So}]`)).filter(t=>{let i=t.parentElement;for(;null!==i&&i!==e;){if(i.hasAttribute(So))return!1;i=i.parentElement}return i===e})}function ai(e,t){for(let i of Array.from(e.attributes))t.hasAttribute(i.name)||e.removeAttribute(i.name);for(let i of Array.from(t.attributes))e.getAttribute(i.name)!==i.value&&e.setAttribute(i.name,i.value)}function si(e,t){if("object"!=typeof e||null===e)return;let i=e[t];return Array.isArray(i)?i:void 0}function ui(e,t){let i=di(t);void 0!==i&&e.set(i,t)}function di(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function ci(e,t){let i=new Map;for(let n=e.length-1;n>=0;n-=1){let r=e[n];if(void 0===r)continue;let l=r.getAttribute(t);if(null===l)continue;let o=i.get(l);void 0===o?i.set(l,[r]):o.push(r)}return i}function hi(e,t){return e.get(t)?.pop()}function fi(e,t,i,n,r,l,o){let a=It(Gt(t,i,n,Xt,o),r,ei(t)),s=e.createElement("template");s.innerHTML=$t(a);let u=s.content.firstElementChild;if(!u)return null;Jt(u,l);let d=di(i);return void 0!==d&&u.setAttribute(wo,d),u}function pi(e,t,i){if(t.warnedEscalationUnavailable)return;t.warnedEscalationUnavailable=!0;let n=`[live-preview] LP0808: onUnfaithfulPatch: \'escalate\' has nowhere to go: ${String(i)} field(s) fell short`,r="or onUnfaithfulPatch: \'warn\' to keep the patch and say so.";e.warn(void 0===e.strategies.fragment?`${n} and no route or fragment strategy is configured. Set routeStrategy: true or fragments: { endpoint }, ${r}`:`${n}, not all of them inside a data-payload-fragment boundary of this document, and no route strategy is configured. Cover them with a boundary or add the route strategy, ${r}`)}function gi(e,t){return!1===t||V($e(e),t)}function mi(t,i,n,r,l){let o=t.transformValue;if(void 0===o)return n;try{let t=o(i.fieldName,n,{element:i.element,allFields:r},l),a=e(t);if(!l())return n;if(a)throw new TypeError(`Transform for "${i.fieldName}" returned a thenable; transforms must be synchronous`);return t}catch(e){if(!l())return n;let i=e instanceof Error?e:new Error(String(e));return t.emitter.emit("error",{error:i,context:"transform",code:"LP0602"}),n}}function vi(e){if(!0!==e.hidesWhenEmpty)return!1;let{element:t}=e;if(t.hasAttribute("hidden"))return!0;let i=t.getBoundingClientRect();return 0===i.width||0===i.height}function yi(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function bi(e){let t=e.trim();if(0!==t.length)try{let e=new URL(t);return"http:"!==e.protocol&&"https:"!==e.protocol||!Eo.test(e.origin)?void 0:e.origin}catch{return}}function wi(e){let t=e.format;return"string"==typeof t&&jo.has(t)?t:"number"==typeof t?Io[t]:void 0}function Si(e){let t=e.indent;return"number"==typeof t&&t>0?t:0}function Ai(e){return"rtl"===e.direction?\' dir="rtl"\':"ltr"===e.direction?\' dir="ltr"\':""}function ki(e){let t=wi(e),i=Si(e),n=[];return void 0!==t&&n.push(`lp-align-${t}`),i>0&&n.push(`lp-indent-${String(i)}`),0===n.length?"":` class="${n.join(" ")}"`}function Ti(e){return"object"==typeof e&&null!==e?e:void 0}function Ci(e){return Ti(e)}function Ri(e,t){if(void 0===t||""===t||!e.startsWith("/"))return e;try{let i=new URL(t),n=new URL(e,i);return n.origin===i.origin?n.href:e}catch{return e}}function $i(e){return e.replace(/[^a-zA-Z0-9_-]/g,"-").toLowerCase()}function Fi(e){return"string"==typeof e&&e.length>0?e:void 0}function Ni(e){let t=Fi(e.title)??Fi(e.name)??Fi(e.slug);return void 0!==t?t:void 0===e.id?void 0:String(e.id)}function Mi(e){if("string"==typeof e.text)return e.text;if(!e.children)return"";let t="";for(let i of e.children)t+=Mi(i);return t}function Ei(e){return`${"number"==typeof e.width?` width="${String(e.width)}"`:""}${"number"==typeof e.height?` height="${String(e.height)}"`:""}`}function Oi(e){return"string"==typeof e.mimeType?` type="${qt(e.mimeType)}"`:""}function xi(e){return _o.get(e)}function Li(e,t,i,n){let r=Ti(e.fields)??{},l="string"==typeof r.blockType?r.blockType:"",o=$i(l),a=""===o?n:`${n} ${n}--${o}`;if(""!==l){let e=xi(l)??xi(o);if(e)return e(r,{renderChildren:t.renderChildren});t.onUnrenderedBlock?.(l,a)}return`<${i} class="${a}"></${i}>`}function Pi(e,t){return"number"==typeof t&&t>1?` ${e}="${String(t)}"`:""}function Ui(e){if("object"!=typeof e||null===e||!("root"in e))return!1;let t=e.root;return"object"==typeof t&&null!==t&&"children"in t&&Array.isArray(t.children)}function Ii(e,t){let i=function(e){return qo.get(e)??Vo[e]}(e.type);return i?i(e,t):void 0!==e.children?t.renderChildren(e.children):""}function ji(e){if("string"==typeof e.text)return e.text;if("linebreak"===e.type)return"\\n";if(void 0===e.children)return"";let t="";for(let i of e.children)t+=ji(i);return t}function Di(e="text"){let t=new WeakSet;return{name:e,render:O((e,i)=>{let n=e.element,r=function(e){return null==e?"":Ui(e)?function(e){return Ui(e)?e.root.children.map(ji).join("\\n").trim():""}(e):"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):JSON.stringify(e)}(i);if("INPUT"!==n.tagName&&"TEXTAREA"!==n.tagName){if(n.textContent.trim()!==r.trim()){if(function(e){return null!==e.querySelector(":scope > :not(br)")}(n)&&!n.hasAttribute(Go))return function(e,t,i){e.has(t)||(e.add(t),wn(`[live-preview] LP0402: Skipping text update for "${i}": <${t.tagName.toLowerCase()}> has structured children. Move data-payload-field to the value element, or add data-payload-text to replace them.`))}(t,n,e.fieldName),!1;if(r.includes("\\n")||r.includes("\\r")){n.innerHTML=$t(function(e){return Vt(e).replace(/\\r\\n|\\r|\\n/g,"<br>")}(r));return}n.textContent=r}}else n.value=r})}}function Wi(e,t){let i=e.cloneNode(!1);i.innerHTML=$t(t);let n=function(e,t){let i=e.firstElementChild,n=1===t.children.length?t.firstElementChild:null;if(null!==i?.nextElementSibling||0===t.children.length||!Xo.has(i.tagName)||i.hasAttribute(Rr)||n?.tagName===i.tagName||!0===n?.matches(zo))return null;for(let e of t.children)if(e.tagName===i.tagName&&e.className===i.className)return null;return i}(e,i)??e,r=new Map,l=i.querySelectorAll(zo);if(l.length>0&&null!==n.firstElementChild){let e=[];Bi(n,i,e);for(let[t,i]of e)t.replaceWith(i),i.matches(zo)||r.set(t.className,!1);for(let e of l)null!==e.parentNode&&r.set(e.className,!0)}return n.replaceChildren(...i.childNodes),r}function Bi(e,t,i){let n=(e,t)=>{e.matches(zo)?i.push([e,t]):Bi(t,e,i)},r=e.firstElementChild,l=t.firstElementChild;if(e.children.length===t.children.length){for(;null!==r&&null!==l;r=r.nextElementSibling)n(l,r),l=l.nextElementSibling;return}let o=new Set;for(let e of t.children)e.matches(zo)||o.add(e.tagName);let a=(e,t)=>e.matches(zo)?!o.has(t.tagName):e.tagName===t.tagName,s=0;for(;null!==r&&null!==l&&a(l,r);s+=1)n(l,r),r=r.nextElementSibling,l=l.nextElementSibling;let u=Math.min(e.children.length,t.children.length);r=e.lastElementChild,l=t.lastElementChild;for(let e=s;e<u&&null!==r&&null!==l;e+=1){if(!a(l,r))return;n(l,r),r=r.previousElementSibling,l=l.previousElementSibling}}function _i(e,t,i,n){n&&t.reportUnfaithful?.(e,`lost the markup the server drew for block "${i}"`);let r=n?Jo:Ko;r.has(i)||(r.add(i),wn(`[live-preview] ${n?`LP0413: no renderer for block "${i}", and the markup the server rendered for it is lost.`:`LP0410: no renderer for block "${i}"; keeping what the server rendered for it.`} Register one with registerBlockRenderer().`))}function zi(e,t,i,n){if("string"!=typeof i||0===i.length)return{kind:"none"};let r=Ri(i,n);return N(r)?{kind:"safe",url:r}:(Yo.has(e)||(Yo.add(e),wn(`[live-preview] LP0401: refused an unsafe URL for "${t}" on <${e.tagName.toLowerCase()}>; the attribute was cleared.`)),{kind:"unsafe"})}function Vi(e,t=e=>e){return{name:e,render(e,i,n){let r=e.element;if(Qt(i)){!function(e){"INPUT"!==e.tagName&&"TEXTAREA"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):e.value=""}(r);return}let l=Xt(i);if("INPUT"!==r.tagName&&"TEXTAREA"!==r.tagName){if("A"===r.tagName){let i=e.hrefField,o=void 0===i||0===i.length?t(l):L(n.allFields,i,n.locale,void 0!==e.locale),a=zi(r,e.fieldName,o);"safe"===a.kind?r.setAttribute("href",a.url):"unsafe"===a.kind&&r.removeAttribute("href")}r.textContent=l}else r.value=l}}}function qi(e){for(let t of na)e.removeAttribute(t)}function Hi(e,t,i,n){let r=function(e,t){let i=[];for(let[n,r]of Object.entries(e?.sizes??{})){if("string"!=typeof r.url||"number"!=typeof r.width)continue;let e=Ri(r.url,t);N(e)&&i.push({...r,name:n,url:e,width:r.width})}return i}(i,n),l=e.getAttribute("src"),o=r.find(t=>null!==l&&function(e,t,i){try{return new URL(t,e.baseURI).href===new URL(i,e.baseURI).href}catch{return t===i}}(e,t.url,l))??r.find(t=>t.name===ra.get(e));void 0===o?.name?ra.delete(e):ra.set(e,o.name),e.src=o?.url??t;let a=o??i,s=r.filter(e=>Gi(e,a));if(0===s.length){e.removeAttribute("srcset"),e.removeAttribute("sizes");return}if("number"==typeof i?.width&&"string"==typeof i.url){let e=Ri(i.url,n),t={...i,url:e,width:i.width};N(e)&&Gi(t,a)&&s.push(t)}let u=new Set,d=[];for(let e of s)u.has(e.width)||(u.add(e.width),d.push(`${Ki(e.url)} ${String(e.width)}w`));let c=d.join(", ");e.setAttribute("srcset",c)}function Gi(e,t){if(void 0===t)return!0;if("string"==typeof e.mimeType&&"string"==typeof t.mimeType&&e.mimeType!==t.mimeType)return!1;let{width:i,height:n}=t;return"number"!=typeof i||"number"!=typeof n||"number"!=typeof e.width||"number"!=typeof e.height||Math.abs(e.width*n-e.height*i)<=Math.max(i,e.width)}function Ki(e){return e.replace(/[\\s,]/g,encodeURIComponent)}function Ji(e){"IMG"===e.tagName?qi(e):e.style.backgroundImage=""}function Xi(e){"IMG"!==e.tagName?(e.removeAttribute("href"),e.textContent=""):qi(e)}function Qi(e){let t=Ti(e);return void 0===t?Xt(e):Ni(t)??""}function Zi(e,t){let i=e??"";if(null==t)return i;let n=Yi(t);return"{}"===n?i:`${i}|${n}`}function Yi(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>Yi(e)).join(",")}]`;let t=e,i=Object.keys(t).sort(),n=[];for(let e of i){let i=t[e];void 0!==i&&n.push(`${JSON.stringify(e)}:${Yi(i)}`)}return`{${n.join(",")}}`}function en(e){return{kind:"date",options:e}}function tn(e){return{kind:"number",options:e}}function nn(e,t,i,n){if(void 0===t||""===t)return;let r=function(e){let t=e.indexOf(":"),i=-1===t?e:e.slice(0,t),n=-1===t?void 0:e.slice(t+1);switch(i){case"date":return void 0===n?en({dateStyle:"medium"}):pa.has(n)?en({dateStyle:n}):void 0;case"time":return void 0===n?en({timeStyle:"short"}):ga.has(n)?en({timeStyle:n}):void 0;case"datetime":return void 0===n?en({dateStyle:"medium",timeStyle:"short"}):pa.has(n)?en({dateStyle:n,timeStyle:"short"===n?"short":"medium"}):void 0;case"number":return void 0===n?tn({}):va.test(n)?tn({minimumFractionDigits:Number(n),maximumFractionDigits:Number(n)}):void 0;case"currency":return void 0!==n&&ma.test(n)?tn({style:"currency",currency:n.toUpperCase()}):void 0;case"percent":return void 0===n?tn({style:"percent"}):void 0;default:return}}(t);if(void 0!==r)return r.kind===e?r.options:void 0;!function(e,t,i){ya.has(e)||(ya.add(e),wn(`[live-preview] LP0408: data-payload-format="${i}" on "${t}" is not a known format; the default formatting was used. Known: date, time, datetime (each also :short|medium|long|full), number, number:0-4, currency:XXX, percent.`))}(i,n,t)}function rn(e){return String(e).padStart(2,"0")}function ln(){let e=new WeakMap,t=new WeakSet,i=new WeakMap,n=new WeakMap;return{name:"structural-array",render:O((r,l,o)=>{let a=Qt(l)?[]:l;if(!Array.isArray(a))return!1;let s=r.element,u=r.arrayTemplate;if(void 0===u||0===u.length)return function(e,t,i){e.has(t)||(e.add(t),wn(`[live-preview] LP0403: Skipping structural update for "${i}": <${t.tagName.toLowerCase()} data-payload-structural> needs data-payload-array-template (for example "<li>{{label}}</li>").`))}(t,s,r.fieldName),!1;let d=e.get(s),c=on(s),h=d?.values??function(e){return e.map((e,t)=>null===e?{__payloadDomPosition:t}:{id:e})}(c),f=$(h,a),p=function(e,t,i){return void 0===e||e.template!==t||!function(e,t){return e.length===t.length&&e.every((e,i)=>e===t[i])}(e.domSnapshot,i)}(d,u,c);if(0===f.length&&!p)return e.set(s,{values:a.slice(),template:u,domSnapshot:c}),!1;!function(e,t,i,n,r){let l=r.map(an),o=new Set,a=l.find(e=>!(void 0===e||!o.has(e)&&(o.add(e),1)));if(void 0!==a&&sn(e,t,i,a),l.some(e=>void 0===e)&&un(e,t,"LP0404",`LP0404: an item of "${i}" has no id and pairs by position, so an insert re-renders every row after it. Give items a stable id.`),n?.length===r.length&&r.length>1){let r=new Set(n.map(an).filter(e=>void 0!==e)),o=l.some(e=>void 0!==e&&r.has(e));r.size>0&&!o&&un(e,t,"LP0406",`LP0406: every key of "${i}" changed at once; the source generates ids per message, so no item can be retained across updates.`)}}(i,s,r.fieldName,d?.values,a);let g=ti({template:u,container:s,patches:f,nextItems:a,store:n,forceRender:p,sanitizerPolicy:o.sanitizerPolicy,onDuplicateKey:(e,t)=>{sn(i,e,r.fieldName,t)}});return null!==g&&(e.set(s,{values:a.slice(),template:u,domSnapshot:on(s)}),!!g&&void 0)})}}function on(e){return Array.from(e.children,e=>e.getAttribute(wo))}function an(e){if("object"!=typeof e||null===e)return;let t=e.id;return"string"==typeof t||"number"==typeof t?String(t):void 0}function sn(e,t,i,n){un(e,t,"LP0405",`LP0405: two items of "${i}" share the key "${n}"; later ones pair by position. Make \\`id\\` unique per item.`)}function un(e,t,i,n){let r=e.get(t);void 0===r&&(r=new Set,e.set(t,r)),!r.has(i)&&(r.add(i),wn(`[live-preview] ${n}`))}function dn(){return typeof __LIVE_PREVIEW_CONFIG__>"u"?[]:__LIVE_PREVIEW_CONFIG__}var cn=Object.defineProperty,hn=e=>{throw TypeError(e)},fn=(e,t,i)=>((e,t,i)=>t in e?cn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i)(e,"symbol"!=typeof t?t+"":t,i),pn=(e,t,i)=>t.has(e)||hn("Cannot "+i),gn=(e,t,i)=>(pn(e,t,"read from private field"),i?i.call(e):t.get(e)),mn=(e,t,i)=>t.has(e)?hn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,i),vn=(e,t,i,n)=>(pn(e,t,"write to private field"),n?n.call(e,i):t.set(e,i),i),yn=(e,t,i)=>(pn(e,t,"access private method"),i),bn=t((...e)=>console.error(...e)),wn=t((...e)=>console.warn(...e)),Sn=t((...e)=>console.debug(...e)),An=class{constructor(){mn(this,Cn);mn(this,kn,new Map);mn(this,Tn,new Map)}on(e,t){return yn(this,Cn,$n).call(this,gn(this,kn),e,t)}once(e,t){return yn(this,Cn,$n).call(this,gn(this,Tn),e,t)}off(e,t){yn(this,Cn,Fn).call(this,gn(this,kn),e,t),yn(this,Cn,Fn).call(this,gn(this,Tn),e,t)}async emit(e,t){await yn(this,Cn,Rn).call(this,e,t)}async emitWhile(e,t,i){return yn(this,Cn,Rn).call(this,e,t,i)}listenerCount(e){return(gn(this,kn).get(e)?.size??0)+(gn(this,Tn).get(e)?.size??0)}removeAllListeners(e){void 0!==e?(gn(this,kn).delete(e),gn(this,Tn).delete(e)):(gn(this,kn).clear(),gn(this,Tn).clear())}eventNames(){let e=new Set;for(let t of gn(this,kn).keys())e.add(t);for(let t of gn(this,Tn).keys())e.add(t);return[...e]}},kn=new WeakMap,Tn=new WeakMap,Cn=new WeakSet,Rn=async function(e,t,i){let n=()=>i?.()??!0;if(!n())return!1;let r=gn(this,kn).get(e);if(r)for(let i of[...r])if(!n()||(await yn(this,Cn,Nn).call(this,i,t,e),!n()))return!1;if(!n())return!1;let l=gn(this,Tn).get(e);if(l&&l.size>0){let i=[...l];gn(this,Tn).delete(e);for(let r of i)if(!n()||(await yn(this,Cn,Nn).call(this,r,t,e),!n()))return!1}return n()},$n=function(e,t,i){let n=e.get(t);return n||(n=new Set,e.set(t,n)),n.add(i),()=>{yn(this,Cn,Fn).call(this,e,t,i)}},Fn=function(e,t,i){let n=e.get(t);void 0!==n&&(n.delete(i),0===n.size&&e.delete(t))},Nn=async function(e,t,i){try{await e(t)}catch(e){let t="string"==typeof i||"number"==typeof i?String(i):"<event>";bn(`[live-preview] LP0601: handler for "${t}" threw:`,e)}},Mn=1e3,En=new Set(["date","number","checkbox"]),On=40,xn="payload-live-preview-a11y",Ln=new WeakMap,Pn=class{constructor(e,t){fn(this,"german");fn(this,"document");fn(this,"lease",null);let i=t??(typ','eof document>"u"?null:document),n=i?.documentElement.getAttribute("lang")??"";this.german=function(e){return/^de(?:[-_]|$)/i.test(e)}(e??(n.length>0?n:u())),this.document=i}mount(){let e=this.document;if(null==e?.body)return null;this.lease??(this.lease=function(e){let t=Ln.get(e);return void 0===t&&(t={element:null,owned:!1,messageNode:null,refs:0,timer:null},Ln.set(e,t)),t.refs+=1,t}(e));let t=this.lease,i=t.element;if(i?.isConnected&&i.ownerDocument===e)return i;if(null!==i){let e=t.owned;d(t),e&&i.remove()}let n=e.getElementById(xn);return t.owned=null===n,null===n&&(n=e.createElement("div"),n.id=xn,n.setAttribute("role","status"),n.setAttribute("aria-live","polite"),n.setAttribute("aria-atomic","true"),n.style.cssText="position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0",e.body.appendChild(n)),t.element=n,n}announceConnected(){this.say(this.german?"Vorschau verbunden":"Live preview connected")}announceDisconnected(){this.say(this.german?"Vorschau getrennt":"Live preview disconnected")}announceUpdate(e){e<=0||this.say(this.german?`${String(e)} ${1===e?"\\xc4nderung":"\\xc4nderungen"} angewendet`:`${String(e)} ${1===e?"change":"changes"} applied`)}announcePartial(){this.say(this.german?"Vorschau teilweise aktualisiert":"Preview partly updated")}detach(){let e=this.lease,t=this.document;if(null===e||null===t||(this.lease=null,e.refs-=1,e.refs>0))return;let i=e.element;null!==i&&d(e),e.owned&&i?.remove(),e.element=null,Ln.delete(t)}say(e){let t=this.mount(),i=this.lease;if(null===t||null===i)return;let n=i.messageNode;n?.parentNode!==t?(n?.remove(),n=t.ownerDocument.createTextNode(t.hasChildNodes()?` ${e}`:e),i.messageNode=n,t.appendChild(n)):n.data=null===n.previousSibling?e:` ${e}`,null!==i.timer&&clearTimeout(i.timer);let r=setTimeout(()=>{i.timer===r&&i.element===t&&d(i)},1500);i.timer=r}},Un=["data","fieldSchemaJSON","globalSlug","collectionSlug","locale","ready","previewToken","protocolVersion"],In={basic:{since:1},"schema-json":{since:2,observed:"schema"},locale:{since:2,observed:"locale"},"preview-token":{since:3,observed:"preview-token"},"nested-arrays":{since:4},"recursive-diffs":{since:4},"document-events":{since:4,observed:"document-event"},"relationship-events":{since:4,observed:"relationship-event"}},jn=Object.keys(In),Dn=class{constructor(e,t){fn(this,"matcher");fn(this,"handlers");fn(this,"boundListener");fn(this,"attachedTarget");fn(this,"generation",0);fn(this,"revision",0);fn(this,"queueHead");fn(this,"queueTail");fn(this,"lastAccepted");fn(this,"replayedGeneration",0);fn(this,"latestAcceptedAttempt");this.matcher=e,this.handlers=t}attach(e=window){if(void 0!==this.attachedTarget)return;let t=!1,i=n=>{if(!t||this.boundListener!==i)return;let r=this.generation;try{this.receive(n,r,e)}catch{let e;try{e=n.origin}catch{e=""}this.reportInvalid("shape",e,r)}};this.generation+=1,this.resetQueue(),this.attachedTarget=e,this.boundListener=i;try{e.addEventListener("message",i)}catch(t){this.boundListener===i&&(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue());try{e.removeEventListener("message",i)}catch{}throw t}if(this.boundListener===i)t=!0;else try{e.removeEventListener("message",i)}catch{}}detach(){let e=this.attachedTarget,t=this.boundListener;void 0===e||void 0===t||(this.attachedTarget=void 0,this.boundListener=void 0,this.resetQueue(),e.removeEventListener("message",t))}advanceGeneration(){return void 0!==this.attachedTarget&&(this.generation+=1,this.resetQueue(),!0)}replayLastAccepted(){let e=this.lastAccepted,t=this.generation,i=this.handlers.onReplay;if(void 0===i||void 0===e||e.generation>=t||this.replayedGeneration===t||!this.matchesOrigin(e.origin,t)||this.lastAccepted!==e)return!1;this.replayedGeneration=t;let n={generation:t,revision:this.revision+=1};return this.invokeHandler(t,i,structuredClone(e.message),e.origin,n),!0}forgetLastAccepted(){this.lastAccepted=void 0,this.replayedGeneration=0,this.latestAcceptedAttempt=void 0}static sendReady(e,t){let i={type:"payload-live-preview",ready:!0,protocolVersion:4};for(let n of e)for(let e of t)try{n.postMessage(i,e)}catch{}}receive(e,t,i){let n=e.origin;if(!this.matchesOrigin(n,t)){this.reportInvalid("origin",n,t);return}if(!this.matchesSource(e,i)){this.reportInvalid("source",n,t);return}let r=e.data;if(function(e){return"object"==typeof e&&null!==e&&"type"in e&&"string"==typeof e.type}(r))switch(r.type){case"payload-live-preview":if(!function(e){let t=e;return!(void 0!==t.data&&null!==t.data&&!y(t.data))&&v(t.fieldSchemaJSON,e=>Array.isArray(e))&&v(t.globalSlug,e=>"string"==typeof e)&&v(t.collectionSlug,e=>"string"==typeof e)&&v(t.locale,e=>"string"==typeof e)&&v(t.ready,e=>"boolean"==typeof e)&&v(t.previewToken,e=>"string"==typeof e)&&v(t.protocolVersion,e=>"number"==typeof e)}(r)){this.reportInvalid("shape",n,t);return}this.dispatchUpdate(function(e){let t={...e};for(let e of Un)null===Reflect.get(t,e)&&Reflect.deleteProperty(t,e);return Array.isArray(t.fieldSchemaJSON)?{...t,fieldSchemaJSON:f(t.fieldSchemaJSON)}:t}(r),n,t);return;case"payload-document-event":if(!function(e){let t=e;return m(t.action,e=>"updated"===e||"created"===e||"deleted"===e)&&m(t.slug,e=>"string"==typeof e)&&m(t.id,e=>"string"==typeof e||Number.isFinite(e))}(r)){this.reportInvalid("shape",n,t);return}this.invokeHandler(t,this.handlers.onDocumentEvent,r,n);return;case"payload-live-preview-focus":{let e=function(e){let t=e.field;return"string"==typeof t&&t.length>0?t:void 0}(r);if(void 0===e){this.reportInvalid("shape",n,t);return}this.invokeHandler(t,this.handlers.onFocusField,e,n);return}default:this.reportInvalid("type",n,t)}else this.reportInvalid("shape",n,t)}dispatchUpdate(e,t,i){let n=y(e.data);if(!this.isCurrentGeneration(i))return;let r=n?{generation:i,revision:this.revision+=1}:void 0,l=this.handlers.validateToken;if(!this.isCurrentGeneration(i))return;if(void 0===l){this.commitUpdate(e,t,i,r);return}if(!0===e.ready&&void 0===e.data){this.commitUpdate(e,t,i,void 0);return}let o={generation:i,message:e,origin:t,messageRevision:r,verdict:void 0,next:void 0};this.enqueue(o);let a;try{a=l(e.previewToken,t)}catch{this.settleValidation(o,!1);return}"boolean"!=typeof a?Promise.resolve(a).then(e=>{this.settleValidation(o,!0===e)},()=>{this.settleValidation(o,!1)}):this.settleValidation(o,a)}settleValidation(e,t){e.verdict=t,this.drainQueue(e.generation)}drainQueue(e){for(;this.isCurrentGeneration(e);){let t=this.queueHead;if(void 0===t)return;if(this.matchesOrigin(t.origin,e)){if(void 0===t.verdict)return;this.dequeue(t)&&(t.verdict?this.commitUpdate(t.message,t.origin,t.generation,t.messageRevision):this.reportInvalid("token",t.origin,t.generation))}else{if(!this.dequeue(t))continue;this.reportInvalid("origin",t.origin,t.generation)}}}commitUpdate(e,t,i,n){if(void 0===n)this.invokeHandler(i,this.handlers.onUpdate,e,t);else{let r={};this.latestAcceptedAttempt=r;let l=function(e){let t={...e};delete t.previewToken;try{return structuredClone(t)}catch{return null}}(e);if(this.latestAcceptedAttempt!==r||!this.isCurrentGeneration(i))return;this.lastAccepted=null===l?void 0:{generation:i,message:l,origin:t},this.invokeHandler(i,this.handlers.onUpdate,e,t,n)}}reportInvalid(e,t,i){this.invokeHandler(i,this.handlers.onInvalid,e,t)}matchesSource(e,t){if("parent-or-opener"!==this.handlers.sourcePolicy)return!0;try{let i=e.source;if("object"!=typeof i||null===i)return!1;let n=t.parent;return n!==t&&i===n||i===t.opener}catch{return!1}}matchesOrigin(e,t){try{return!0===(this.isCurrentGeneration(t)&&this.matcher(e))&&this.isCurrentGeneration(t)}catch{return!1}}invokeHandler(t,i,...n){if(void 0!==i&&this.isCurrentGeneration(t))try{e(i(...n))}catch{}}isCurrentGeneration(e){return void 0!==this.attachedTarget&&this.generation===e}enqueue(e){void 0===this.queueTail?this.queueHead=e:this.queueTail.next=e,this.queueTail=e}dequeue(e){return this.queueHead===e&&(this.queueHead=e.next,void 0===this.queueHead&&(this.queueTail=void 0),!0)}resetQueue(){this.queueHead=void 0,this.queueTail=void 0}},Wn=new Set(["tabs","row","collapsible"]),Bn={text:"text",textarea:"textarea",richText:"richText",email:"email",number:"number",checkbox:"checkbox",date:"date",select:"select",radio:"radio",array:"array",blocks:"blocks",group:"text",tabs:"text",row:"text",collapsible:"text",relationship:"relationship",upload:"upload",point:"text",json:"text",code:"text",ui:"text"},_n=new Set(["http:","https:","mailto:","tel:"]),zn=/^(?:\\.{1,2}\\/|[a-zA-Z0-9_-]+\\/?)/,Vn=/^[\\\\/]{2}/,qn=/[\\t\\n\\r]/g,Hn=/[\\s\\u0000-\\u001f\\u180e\\u2000-\\u2029]/g,Gn=/^([a-z][a-z0-9+.-]*):/i,Kn=new Set(["style","srcdoc","formaction","form","id","name","is","srcset","imagesrcset"]),Jn=new Set(["href","src","poster","cite","action","xlink:href","data"]),Xn=new WeakSet,Qn=class{constructor(){fn(this,"previous",null);fn(this,"lastFields");fn(this,"priorFields");fn(this,"keepValues",!1)}get previousFields(){return this.priorFields}get isBaseline(){return null===this.previous}diff(e,t,i=x){let r=this.previous,l=null===r,o=new Map,a=new Set,s=Object.entries(e);if(!i())return null;for(let[e,t]of s){let l=n(t);if(!i())return null;o.set(e,l),(null===r||void 0===l||r.get(e)!==l)&&a.add(e)}if(null!==r)for(let e of r.keys())o.has(e)||a.add(e);let u=new Set,d=Object.entries(t);if(!i())return null;for(let[e,t]of d)if(a.has(e))for(let e of t)if(u.add(e),!i())return null;return i()?(this.previous=o,this.priorFields=this.keepValues?this.lastFields:void 0,this.lastFields=this.keepValues?e:void 0,{changed:a,invalidated:u,baseline:l}):null}reset(){this.previous=null,this.lastFields=void 0,this.priorFields=void 0}},Zn=new Set(["__proto__","prototype","constructor"]),Yn="data-payload-fragment",er="data-payload-fragment-key",tr="data-payload-strategy",ir=8,nr=1024,rr=new Set(["id","_id","createdAt","updatedAt","createdBy","updatedBy","_status","globalType","collection","locale","localized"]),lr=new Set(["text","textarea","email","number","checkbox","date","select","radio","point","code","json","ui","html"]),or=new Set(["root","paragraph","text","heading","quote","list","listitem","linebreak","tab","horizontalrule","code","code-highlight","table","tablerow","tablecell","link","autolink"]),ar={},sr=class{constructor(){fn(this,"rawChanges",new Qn);fn(this,"resolved",null);fn(this,"resolvedLocale",null);fn(this,"trailing",null);fn(this,"openUntil",0);fn(this,"requestAttempt",0)}decide(e,t){let i=t.rawData;if(!function(e){let{cache:t,emitter:i}=e;if(t.islands.length>0||i.listenerCount("beforeUpdate")>0||i.listenerCount("afterUpdate")>0)return!0;for(let e of t.values())if(re(e)||e.fieldName.includes(".")||ae(e.hrefField)||ae(e.srcField)||ae(e.altField))return!0;return void 0!==e.strategies.fragment&&null!==e.root.querySelector(`[${Yn}]`)}(e)&&!function(e,t,i){for(let n of e.values()){if("text"!==n.fieldType||!0===n.explicitFieldType)continue;let e=U(t,n,n.fieldName,i);if(fe(e)&&le(e.root))return!0}return!1}(e.cache,i,t.locale))return t.forceRender&&(this.resolvedLocale=null),{merge:!1,fields:i};let{changed:n}=this.rawChanges.diff(i,ar),r=this.resolvedLocale!==t.locale,l=this.resolved;if(null===l)return this.resolved=i,{merge:!0,fields:i};let o={...l};t.forceRender&&(this.resolvedLocale=null);let a=t.forceRender||r;for(let r of n){let n=i[r];if(rr.has(r)){o[r]=n;continue}let s=ne(r,l[r],n,e.cache,t.schemaIndex);"own"!==s&&(a=!0,this.resolvedLocale=null),"keep"!==s&&(o[r]=n)}return this.resolved=o,{merge:a,fields:o}}request(e,t,i){let n=++this.requestAttempt,r=Date.now();if(r>=this.openUntil)return this.openUntil=r+t,this.dropQueued(),this.requestAttempt!==n?{leading:!0,result:Promise.resolve({status:"superseded"})}:{leading:!0,result:e.merge(i)};let l=this.trailing,o=l?.pending??function(){let e;return{promise:new Promise(t=>{e=t}),settle:e}}(),a={request:i,pending:o,timer:null};if(this.trailing=a,this.openUntil=r+t,null!==l&&null!==l.timer&&clearTimeout(l.timer),this.trailing!==a)return{leading:!1,result:o.promise};let s=setTimeout(()=>{this.flush(e,a)},t);return this.trailing===a?a.timer=s:clearTimeout(s),{leading:!1,result:o.promise}}recordMerged(e,t){this.resolved=e,this.resolvedLocale=t}resetRawChanges(){this.rawChanges.reset()}destroy(){this.requestAttempt+=1,this.openUntil=0,this.dropQueued()}dropQueued(){let e=this.trailing;this.trailing=null,null!==e&&(null!==e.timer&&clearTimeout(e.timer),e.pending.settle({status:"superseded"}))}flush(e,t){this.trailing===t&&(this.trailing=null,t.timer=null,e.merge(t.request).then(t.pending.settle))}},ur=class{constructor(){fn(this,"negotiation",b(void 0));fn(this,"observed",new Set)}observe(e,t){let i=e.filter(e=>!this.observed.has(e));if(0!==i.length){for(let e of i)this.observed.add(e);this.negotiation=b(this.negotiation.theirs,this.observed),t("protocol",`observed=${i.join(",")}`)}}applyVersion(e,t){let i=this.negotiation;if(i.theirs===e)return;let n=b(e,this.observed);this.negotiation=n,n.negotiated!==i.negotiated&&t("protocol","ours=4",`theirs=${e}`,`negotiated=${n.negotiated}`)}},dr=class{constructor(){fn(this,"lastIdentity")}inspect(e){let t=e.externallyUpdatedRelationship;if("object"!=typeof t||null===t)return null;let i=JSON.stringify([t.entitySlug,q(t),t.updatedAt]);return{identity:i,edit:i!==this.lastIdentity&&se(t,e)?t:null}}commit(e){let t=e.identity!==this.lastIdentity;return this.lastIdentity=e.identity,t?e.edit:null}},cr=class{constructor(){mn(this,hr)}reveal(e,t,i){return e===gn(this,hr)?"skipped-same":(vn(this,hr,e),function(e,t){return function(e,t){let i=e.getBoundingClientRect(),n=i.bottom>0&&i.top<t.innerHeight,r=i.right>0&&i.left<t.innerWidth;return n&&r}(e,t)?"already-visible":(e.scrollIntoView({behavior:de(t)?"auto":"smooth",block:"center"}),"revealed")}(t,i))}reset(){vn(this,hr,void 0)}},hr=new WeakMap,fr=class{constructor(){fn(this,"seen",new Map)}note(e,t,i){let r=n(i);if(void 0===r)return;let l=`${t.owner??""}\\0${t.locale??""}\\0${t.fieldName}`,o=this.seen.get(l);void 0!==o?o!==r&&(e.revealIdentities.push([l,r]),e.revealTarget??(e.revealTarget=t)):this.seen.set(l,r)}commit(e){for(let[t,i]of e.revealIdentities)this.seen.set(t,i);e.revealIdentities=[];let t=e.revealTarget;return e.revealTarget=void 0,t}},pr=()=>{},gr=class{constructor(){fn(this,"host",{outstanding:()=>!1,report:pr,failed:pr});fn(this,"entry",null);fn(this,"ended")}begin(e,t){let i=this.entry,n=null===i?void 0:this.view(i);null!==i&&(i.key=void 0),this.ended=void 0,this.entry={key:e,revision:t,shortfalls:[],seen:new Set,deferred:0,awaiting:0,reported:void 0,queued:!1},null!==i&&void 0!==n&&this.publish(i,"pending"===n.state?{...n,state:"superseded"}:n)}end(){let e=this.entry;if(null!==e){this.entry=null;try{this.ended=this.view(e)}finally{e.key=void 0}}}snapshot(){return null!==this.entry?this.view(this.entry):void 0===this.ended?void 0:{...this.ended,shortfalls:[...this.ended.shortfalls]}}shortfall(e,t){let i=this.entry;if(i?.key!==e)return;let n=JSON.stringify(t);i.seen.has(n)||(i.seen.add(n),i.shortfalls.push(t),this.requestSettle(i.key))}deferred(e,t){this.entry?.key===e&&(this.entry.deferred=t)}handIsland(e){let t=this.entry;if(t?.key!==e)return pr;t.awaiting+=1;let i=!1;return()=>{i||this.entry!==t||(i=!0,t.awaiting-=1,this.settle(t))}}requestSettle(e){let t=this.entry;t?.key!==e||t.queued||(t.queued=!0,queueMicrotask(()=>{t.queued=!1;try{this.entry===t&&this.settle(t)}catch(e){this.host.failed(e)}}))}settle(e){let t=this.view(e);"pending"!==t.state&&this.publish(e,t)}publish(e,t){e.reported!==t.state&&(e.reported=t.state,this.host.report(t))}view(e){let t=void 0!==e.key&&this.host.outstanding(e.key)?"pending":e.shortfalls.length>0?"partial":e.awaiting>0?"unconfirmed":"current";return{revision:e.revision,state:t,shortfalls:[...e.shortfalls],deferred:e.deferred,awaitingIslands:e.awaiting}}},mr=class{constructor(){fn(this,"started",!1);fn(this,"suspended",!1);fn(this,"deferredStart",null);fn(this,"hydration","idle");fn(this,"activeUpdate",null);fn(this,"locale");fn(this,"schema");fn(this,"schemaIndex");fn(this,"updateCount",0);fn(this,"supersededCount",0);fn(this,"completedCount",0);fn(this,"skippedUnchangedCount",0);fn(this,"lastFlush",null);fn(this,"absentFields",new Set);fn(this,"warnedOrphanFields",new Set);fn(this,"warnedStrategy",new WeakSet);fn(this,"warnedUnattributableMessage",!1);fn(this,"warnedVisibilityGate",!1);fn(this,"warnedFragmentFallback",!1);fn(this,"warnedIslandStart",!1);fn(this,"warnedEscalationUnavailable",!1);fn(this,"warnedProtocolShape",!1);fn(this,"reportedUnfaithful",new WeakMap);fn(this,"checkedServerFormat",new WeakSet);fn(this,"unfaithfulPatches",[]);fn(this,"unfaithfulCount",0);fn(this,"escalatedCount",0);fn(this,"unfaithfulFields",new Set);fn(this,"autoBindSearchMs");fn(this,"autoBindGuesses",null);fn(this,"warnedForeignSource",!1);fn(this,"lastAppliedIdentity",new WeakMap);fn(this,"navigationReplayPending",!1);fn(this,"navigationBindingReplay",!1);fn(this,"revealLedger",new fr);fn(this,"display",new gr);fn(this,"fragmentStats",{rendered:0,failed:0,superseded:0});fn(this,"routeStats",{refreshes:0,partial:0,failed:0,refused:0,loopStopped:0});fn(this,"fragmentControllers",new Map);fn(this,"routeController",null);fn(this,"routeRetry",null);fn(this,"routeRefreshOwed",!1);fn(this,"routeAwaitsSave",!1);fn(this,"fragmentsOwed",new Set);fn(this,"readyTimers",[]);fn(this,"revealer",new cr);fn(this,"changes",new Qn);fn(this,"merges",new sr);fn(this,"protocol",new ur);fn(this,"relationships",new dr)}isRunning(){return this.started}isCurrent(e){return this.started&&this.activeUpdate===e}complete(e){this.display.requestSettle(e),!e.completed&&(e.completed=!0,e.countsAsUpdate&&(this.completedCount+=1))}forgetOwedWork(){this.routeRefreshOwed=!1,this.routeAwaitsSave=!1,this.fragmentsOwed.clear()}supersedeStrategies(){null!==this.routeRetry&&(clearTimeout(this.routeRetry),this.routeRetry=null,this.routeRefreshOwed=!0);for(let[e,t]of this.fragmentControllers){for(let e of t)this.fragmentsOwed.add(e);e.abort()}this.fragmentControllers.clear()}abortStrategies(){this.supersedeStrategies();let e=this.routeController;this.routeController=null,e?.abort()}},vr=class{constructor(e,t){fn(this,"deps",e);fn(this,"state",t);fn(this,"writing");fn(this,"instanceContext");this.instanceContext=function(e){let t={};for(let[i,n]of Object.entries(e))void 0!==n&&(t[i]=n);return t}({renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,serverURL:e.serverURL,reportUnfaithful:(i,n)=>{l(e,t,i,n,this.writing)}})}apply(e){let{deps:t,state:i}=this,n=i.activeUpdate;if(null===n||void 0===e.revision||!w(n.revision,e.revision)||!i.isCurrent(n))return!1;let{target:r,value:o}=e,u=void 0!==n.schemaIndex?T(n.schemaIndex,r.fieldName):void 0,d=function(e,t){if(e.explicitFieldType)return e.fieldType;if(void 0!==t){let e=function(e){if(Object.prototype.hasOwnProperty.call(Bn,e))return Bn[e]}(t);if(void 0!==e)return e}return e.fieldType}(r,u?.type);"text"===d&&!0!==r.explicitFieldType&&fe(o)&&(d="richText");let c;try{c=t.resolveRenderer(d,r)}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;let h=t.emitter.listenerCount("elementUpdate")>0,f=h?function(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e.value:"IMG"===e.tagName?e.src:e.textContent}(r.element):void 0;if(!i.isCurrent(n))return!1;let p={allFields:e.allFields,locale:r.locale??n.locale,schema:u,...this.instanceContext};!0===r.hidesWhenEmpty&&r.element.toggleAttribute("hidden",function(e){return null==e||("string"==typeof e?0===e.trim().length:Array.isArray(e)&&0===e.length||pe(e))}(o));try{if(void 0!==r.targetAttribute){if("blocked"===function(e,t,i){let n=t.toLowerCase().trim();if(0===n.length||!E(n))return"blocked";if(null==i)return e.removeAttribute(n),"applied";if("string"!=typeof i&&"number"!=typeof i&&"boolean"!=typeof i)return"blocked";let r=String(i);return Jn.has(n)&&!N(r)?"blocked":(e.setAttribute(n,r),"applied")}(r.element,r.targetAttribute,o))return t.warn(`[live-preview] LP0401: refused to write "${r.fieldName}" into attribute "${r.targetAttribute}"`),i.display.shortfall(n,{kind:"write",field:r.fieldName,code:"LP0401"}),!1}else{if(void 0===c)return t.log("no renderer for",d),l(t,i,r,`has no renderer for "${d}"`,o),!1;{let e=function(e,t,i,n){if("ignore"===e.onUnfaithfulPatch||void 0!==i.format||!En.has(n)||t.checkedServerFormat.has(i.element))return;t.checkedServerFormat.add(i.element);let r=a(i.element);return r.trim().length>0?r:void 0}(t,i,r,d);if(this.writing=o,!1===function(e,t,i,n){return e.render(t,i,n)}(c,r,o,p)&&function(e){return Xn.has(e.render)}(c))return l(t,i,r,`is a value ${c.name} cannot render`,o),!1;void 0!==e&&function(e,t,i){let n=a(t.element);n!==i&&e.warn(`[live-preview] LP0412: "${t.fieldName}" showed ${s(i)}, the patch wrote ${s(n)} \\u2014 either an edit that arrived before the preview connected, or a template that formats this value differently. Set data-payload-format to match it.`)}(t,r,e)}}}catch(e){return this.fail(n,r.fieldName,e)}if(!i.isCurrent(n))return!1;h&&t.emitter.emitWhile("elementUpdate",{element:r.element,fieldName:r.fieldName,previousValue:f,nextValue:o,revision:n.revision.revision,receivedAt:n.receivedAt,source:"patch"},()=>i.isCurrent(n));let g=i.isCurrent(n);return g&&(void 0!==e.valueIdentity?i.lastAppliedIdentity.set(r.element,e.valueIdentity):i.lastAppliedIdentity.delete(r.element)),g}fail(e,t,i){if(!this.state.isCurrent(e))return!1;this.state.display.shortfall(e,{kind:"write",field:t,code:"LP0603"});let n=i instanceof Error?i:new Error(String(i));return this.deps.emitter.emitWhile("error",{error:n,context:"renderer",code:"LP0603"},()=>this.state.isCurrent(e)),!1}},yr="payload-live-preview:update",br="data-payload-island",wr=`astro-island, [${br}]`,Sr="data-payload-owned",Ar="data-payload-morph",kr=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],Tr=new WeakMap,Cr=new WeakSet,Rr="data-payload-field",$r="data-payload-type",Fr="data-payload-attribute",Nr="data-payload-href",Mr="data-payload-src",Er="data-payload-alt",Or="data-payload-array-template",xr="data-payload-array-separator",Lr="data-payload-locale",Pr="data-payload-format",Ur="data-payload-richtext",Ir="data-payload-html",jr="data-payload-array",Dr="data-payload-structural",Wr="data-payload-owner",Br="data-payload-depends",_r="data-payload-strategy",zr="data-payload-boundary",Vr="data-payload-guessed",qr="data-payload-covers",Hr=[Rr,$r,Fr,Nr,Mr,Er,Or,xr,Lr,Pr,Ur,Ir,jr,Dr,Wr,Br,_r,zr,"type"],Gr=`[${Rr}]`,Kr=`[${Wr}]`,Jr=`[${Yn}], [${_r}="route"]`,Xr=/^[a-z][a-z0-9-]*:[a-z][a-z0-9-]*$/i,Qr=new Set(["text","textarea","richText","email","number","checkbox","date","select","radio","array","blocks","group","tabs","row","collapsible","relationship","upload","point","json","code","ui","html","url","image","structural-array"]),Zr=class{constructor(e={}){fn(this,"entriesByField",new Map);fn(this,"entryByElement",new WeakMap);fn(this,"filter");fn(this,"count",0);fn(this,"dependencies",null);fn(this,"islandRoots",[]);fn(this,"ownersByIsland",new Map);fn(this,"navigationRoots",[]);fn(this,"coverDeclarations",[]);fn(this,"renderedDeclarations",[]);this.filter=e.filter??Ee}dependencyMap(){if(null!==this.dependencies)return this.dependencies;let e=[];for(let t of this.values())void 0!==t.dependsOn&&e.push(ve(t.fieldName,t.dependsOn));return this.dependencies=me(...e),this.dependencies}get islands(){return this.islandRoots}get islandOwners(){return this.ownersByIsland}get covers(){return this.coverDeclarations}get rendered(){return this.renderedDeclarations}get navigationReplayRoots(){return this.navigationRoots}buildFromRoot(e){let t=performance.now();this.clear();let i=0;for(let t of e.querySelectorAll(Gr))void 0!==this.add(t)&&(i+=1);return this.islandRoots=function(e){let t=[];for(let i of e.querySelectorAll(wr))be(i)||t.push(i);return t}(e),this.ownersByIsland=new Map(this.islandRoots.map(e=>[e,$e(e)])),this.navigationRoots=[...e.querySelectorAll(Jr)].filter(e=>this.filter(e)&&(e.hasAttribute(Yn)||0===(e.getAttribute(Rr)??"").length)),this.coverDeclarations=[...e.querySelectorAll(`[${qr}]`)].filter(e=>this.filter(e)).map(e=>({paths:ge(e.getAttribute(qr)),owner:$e(e)})),this.renderedDeclarations=[...e.querySelectorAll(`[${Br}]`)].filter(e=>this.filter(e)).flatMap(e=>{let t=function(e){if((e.getAttribute(Yn)??"").length>0)return"fragment";let t=e.getAttribute(_r);return null!==t?"route"===t?"route":void 0:e.hasAttribute(Rr)&&null!==e.closest("head")?"route":void 0}(e);return void 0===t?[]:[{strategy:t,paths:ge(e.getAttribute(Br)),owner:$e(e)}]}),{elementCount:i,fieldCount:this.entriesByField.size,durationMs:performance.now()-t}}add(e){let t=this.filter(e)?this.resolveBinding(e):void 0,i=this.entryByElement.get(e);if(this.dependencies=null,void 0!==t)return void 0!==i&&this.replaceEntry(i,t)?(this.entryByElement.set(e,t),t):(void 0!==i&&this.removeEntry(e,i),this.append(t),this.entryByElement.set(e,t),t);void 0!==i&&this.removeEntry(e,i)}remove(e){let t=this.entryByElement.get(e);return!!t&&(this.dependencies=null,this.removeEntry(e,t))}get(e){return this.entriesByField.get(e)}getByElement(e){return this.entryByElement.get(e)}get fieldCount(){return this.entriesByField.size}get elementCount(){return this.count}entries(){return this.entriesByField.entries()}*values(){for(let e of this.entriesByField.values())yield*e}has(e){return this.entryByElement.has(e)}clear(){this.entriesByField.clear(),this.entryByElement=new WeakMap,this.count=0,this.dependencies=null,this.islandRoots=[],this.ownersByIsland=new Map,this.navigationRoots=[],this.coverDeclarations=[],this.renderedDeclarations=[]}replaceEntry(e,t){if(e.fieldName!==t.fieldName)return!1;let i=this.entriesByField.get(e.fieldName),n=void 0===i?-1:i.indexOf(e);return!(void 0===i||n<0||(i[n]=t,0))}removeEntry(e,t){this.entryByElement.delete(e);let i=this.entriesByField.get(t.fieldName),n=void 0===i?-1:i.indexOf(t);return!(void 0===i||n<0||(i.splice(n,1),0===i.length&&this.entriesByField.delete(t.fieldName),this.count-=1,0))}append(e){let t=this.entriesByField.get(e.fieldName);t?t.push(e):this.entriesByField.set(e.fieldName,[e]),this.count+=1}resolveBinding(e){let t=e.getAttribute(Rr);if(null===t||0===t.length)return;let i=e.getAttribute($r),n=e.getAttribute(Fr),r=e.getAttribute(Nr),l=e.getAttribute(Mr),o=e.getAttribute(Er),a=e.getAttribute(Or),s=e.getAttribute(xr),u=e.getAttribute(Lr),d=e.getAttribute(Pr),c=$e(e),h=ge(e.getAttribute(Br)),f=e.getAttribute(_r),p=e.getAttribute(Vr),g=j(e);return{element:e,fieldName:t,fieldType:Me(e),explicitFieldType:null!==i&&Fe(i),strategyKind:W(e)??"unknown",...null!==g?{fragmentBoundary:g}:{},...null!==n&&n.length>0?{targetAttribute:n}:{},...null!==r&&r.length>0?{hrefField:r}:{},...null!==l&&l.length>0?{srcField:l}:{},...null!==o&&o.length>0?{altField:o}:{},...null!==a?{arrayTemplate:a}:{},...null!==s?{arraySeparator:s}:{},...null!==u&&u.length>0?{locale:u}:{},...null!==d&&d.length>0?{format:d}:{},...void 0!==c?{owner:c}:{},...h.length>0?{dependsOn:h}:{},...null!==f&&f.length>0?{strategy:f}:{},...e.hasAttribute(zr)?{hidesWhenEmpty:!0}:{},...null!==p?{guessed:p}:{}}}},Yr=64,el=1e4,tl=1e3,il=64,nl=8192,rl=1048576,ll=1e4,ol=20,al=new Set(["__proto__","constructor","prototype"]),sl=class{constructor(e){fn(this,"serverURL");fn(this,"apiRoute");fn(this,"depth");fn(this,"fetchFn");fn(this,"log");fn(this,"inflight",null);fn(this,"attempt",0);fn(this,"destroyDepth",0);this.serverURL=function(e){let t=e.length;for(;e.endsWith("/",t);)t-=1;return e.slice(0,t)}(e.serverURL);let n=e.apiRoute??"/api";this.apiRoute=n.startsWith("/")?n:`/${n}`,this.depth=e.depth??1,this.fetchFn=e.fetchFn,this.log=t(e.log??i)}canMerge(e){try{let t=e.schema;return void 0!==t?(Be(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale),!0):null!==this.endpointOf(e)}catch{return!1}}endpointOf(e){try{let t=e.globalSlug;if(t)return qe(t)?{path:`globals/${encodeURIComponent(t)}`,field:"globalType",value:t}:null;let i=e.collectionSlug??"",n=e.data.id;return qe(i)&&He(n)?{path:`${encodeURIComponent(i)}/${encodeURIComponent(String(n))}`,field:"id",value:String(n)}:null}catch{return null}}async merge(e){if(this.destroyDepth>0)return{status:"superseded"};let t=this.attempt+=1,i=this.inflight;this.inflight=null;let n=null,r=!1,l=()=>this.attempt!==t;try{if(i?.abort(),l())return{status:"superseded"};let t=e.schema;if(r=void 0!==t,void 0!==t){let i=Be(e.data,t,this.serverURL,this.apiRoute,this.depth,e.locale);if(l())return{status:"superseded"};if(0===i.requests.length)return{status:"merged",doc:i.doc};let r=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(l())return{status:"superseded"};if(void 0===r)return{status:"unavailable"};n=new AbortController,this.inflight=n;for(let e of i.requests){let t=await r(e.url,{method:"GET",credentials:"include",redirect:"error",signal:n.signal});if(l())return{status:"superseded"};let i=t.ok;if(l())return{status:"superseded"};if(!i){let e=t.status;return l()?{status:"superseded"}:(n.abort(),l()?{status:"superseded"}:(this.log("merge HTTP",e),l()?{status:"superseded"}:{status:"unavailable"}))}let o=await _e(t,n.signal,()=>!l());if(l())return{status:"superseded"};if(ze(e,o),l())return{status:"superseded"}}return{status:"merged",doc:i.doc}}let o=this.endpointOf(e);if(l())return{status:"superseded"};if(null===o)return{status:"unavailable"};let a=this.fetchFn??("function"==typeof fetch?fetch:void 0);if(l())return{status:"superseded"};if(void 0===a)return{status:"unavailable"};let s=JSON.stringify({data:e.data,depth:this.depth,flattenLocales:!1,locale:e.locale});if(l())return{status:"superseded"};n=new AbortController,this.inflight=n;let u=`${this.serverURL}${this.apiRoute}/${o.path}`,d=await a(u,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json","X-Payload-HTTP-Method-Override":"GET"},body:s,signal:n.signal});if(l())return{status:"superseded"};let c=d.ok;if(l())return{status:"superseded"};if(!c){let e=d.status;return l()?{status:"superseded"}:(this.log("merge HTTP",e,u),l()?{status:"superseded"}:{status:"unavailable"})}let h=d.json.bind(d);if(l())return{status:"superseded"};let f=await h();if(l())return{status:"superseded"};if(null===f||"object"!=typeof f||Array.isArray(f))return this.log("merge invalid",u),l()?{status:"superseded"}:{status:"unavailable"};let p=f,g=p[o.field],m=Object.hasOwn(p,o.field)&&("id"===o.field?!He(g)||String(g)!==o.value:g!==o.value);return l()?{status:"superseded"}:m?(this.log("merge invalid",u),l()?{status:"superseded"}:{status:"unavailable"}):{status:"merged",doc:p}}catch(e){return l()||r&&(n?.abort(),l())?{status:"superseded"}:(this.log("merge exception",r?new Error("legacy population could not be resolved"):e),l()?{status:"superseded"}:{status:"unavailable"})}finally{this.inflight===n&&(this.inflight=null)}}destroy(){this.attempt+=1;let e=this.inflight;this.inflight=null,this.destroyDepth+=1;try{e?.abort()}finally{this.destroyDepth-=1}}},ul="2.2.2",dl={name:"payload-2",fieldTyping:"schema",populatesRelationships:"admin",documentEvents:!1},cl={name:"payload-3",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!0},hl={name:"unknown",fieldTyping:"heuristic",populatesRelationships:"server",documentEvents:!1},fl="ssr",pl=1,gl=[Rr,Wr,qr,Br],ml=`[${Rr}], [${qr}], ${wr}, ${Jr}`,vl=class{constructor(e,t={}){fn(this,"callbacks");fn(this,"debounceMs");fn(this,"rootMargin");fn(this,"visible",new Set);fn(this,"mutation",null);fn(this,"intersection",null);fn(this,"debounceTimer",null);fn(this,"generation",0);this.callbacks=e,this.debounceMs=t.mutationDebounceMs??100,this.rootMargin=t.intersectionRootMargin??"200px"}start(e){let t=this.generation;this.stop();let i=t+1;if(this.generation!==i)return;let n=null,r=null;try{n=new MutationObserver(e=>{this.handleMutations(e,i)}),r=new IntersectionObserver(e=>{this.handleIntersection(e,i)},{rootMargin:this.rootMargin,threshold:0}),n.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[...Hr,qr,br,fl]})}catch(e){throw n?.disconnect(),r?.disconnect(),e}this.generation===i?(this.mutation=n,this.intersection=r):(n.disconnect(),r.disconnect())}observeElement(e){this.intersection?.observe(e)}unobserveElement(e){this.intersection?.unobserve(e),this.visible.delete(e)}markVisible(e,t){t?this.visible.add(e):this.visible.delete(e)}isVisible(e){return this.visible.has(e)}stop(){this.generation+=1;let e=this.debounceTimer,t=this.mutation,i=this.intersection;this.debounceTimer=null,this.mutation=null,this.intersection=null,this.visible.clear(),null!==e&&clearTimeout(e);try{t?.disconnect()}finally{i?.disconnect()}}handleMutations(e,t){if(!this.isCurrentGeneration(t))return;for(let i of e){let e=Ke(i);if(null!==e&&(this.callbacks.onIslandHydrated?.(e),!this.isCurrentGeneration(t)))return}if(!function(e){for(let t of e){if("attributes"===t.type&&t.attributeName===br||"attributes"===t.type&&null!==t.attributeName&&(gl.includes(t.attributeName)||Hr.includes(t.attributeName)&&t.target.nodeType===pl&&t.target.hasAttribute(Rr)))return!0;for(let e of t.addedNodes)if(Je(e))return!0;for(let e of t.removedNodes)if(Je(e))return!0}return!1}(e))return;null!==this.debounceTimer&&clearTimeout(this.debounceTimer);let i=setTimeout(()=>{!this.isCurrentGeneration(t)||this.debounceTimer!==i||(this.debounceTimer=null,this.callbacks.onStructuralChange())},this.debounceMs);this.debounceTimer=i}handleIntersection(e,t){for(let i of e){if(!this.isCurrentGeneration(t))return;let{target:e}=i;if(i.isIntersecting){if(this.visible.has(e))continue;this.visible.add(e),this.callbacks.onVisibilityChange(e,!0)}else this.visible.has(e)&&(this.visible.delete(e),this.callbacks.onVisibilityChange(e,!1))}}isCurrentGeneration(e){return this.generation===e&&null!==this.intersection}},yl=class{constructor(e){mn(this,Al);mn(this,bl,[]);mn(this,wl);mn(this,Sl,!1);vn(this,wl,e)}get closed(){return gn(this,Sl)}own(e){gn(this,Sl)?yn(this,Al,kl).call(this,e):gn(this,bl).push(e)}close(){if(gn(this,Sl))return;vn(this,Sl,!0);let e=gn(this,bl).splice(0).reverse();for(let t of e)yn(this,Al,kl).call(this,t)}},bl=new WeakMap,wl=new WeakMap,Sl=new WeakMap,Al=new WeakSet,kl=function(e){try{e()}catch(e){gn(this,wl).call(this,"runtime cleanup failed:",e)}},Tl="__livePreviewHydration",Cl="[data-payload-field]",Rl="__vue_app__",$l="__livePreviewVueHydration",Fl="app:suspense:resolve",Nl={react:(e,t)=>function(e,t=5e3){Qe();let i=Xe();if(void 0===i)return null;if(void 0===i.onCommit){let e=e=>{!i.committed&&function(e){let t=e;return null!=t&&function(e){let t=e;return 9===t?.nodeType||null!=t?.querySelector?.(Cl)}(t.containerInfo)&&!function(e){let t=[];for(null!==e.current&&void 0!==e.current&&t.push(e.current);t.length>0;){let e=t.pop();if(void 0===e)continue;let i=e.memoizedState;if((13===e.tag||31===e.tag)&&"object"==typeof i&&null!==i&&"dehydrated"in i&&"object"==typeof i.dehydrated&&null!==i.dehydrated&&"nodeType"in i.dehydrated&&8===i.dehydrated.nodeType)return!0;null!==e.sibling&&void 0!==e.sibling&&t.push(e.sibling),null!==e.child&&void 0!==e.child&&t.push(e.child)}return!1}(t)}(e)&&Ze(i)};i.onCommit=e;for(let t of i.commits.splice(0))e(t)}return et(i,e,t)}(t),vue:function(e,t,i=5e3){nt();let n=tt();return void 0===n?null:(!n.committed&&function(e){for(let t=e.querySelector(Cl);null!==t;t=t.parentElement)if(void 0!==it(t))return!0;return!1}(e)&&Ze(n),et(n,t,i))},sveltekit:function(e,t,i=5e3){let n=e.ownerDocument??e,r=()=>null!==n.querySelector("#svelte-announcer");if(r()||!Object.keys(window).some(e=>e.startsWith("__sveltekit_")))return null;let l={committed:!1,waiters:[]},o=new MutationObserver(()=>{!l.committed&&r()&&Ze(l)});o.observe(n,{childList:!0,subtree:!0});let a=et(l,e=>{o.disconnect(),t(e)},i);return()=>{o.disconnect(),a?.()}}},Ml={react:"React commit",vue:"Vue mount",sveltekit:"SvelteKit mount"},El=class{constructor(e){fn(this,"timeoutMs");fn(this,"onTimeout");fn(this,"handle",null);fn(this,"lastKick",null);this.timeoutMs=e.timeoutMs??0,this.onTimeout=e.onTimeout}kick(){this.lastKick=Date.now(),!(this.timeoutMs<=0)&&(this.stop(),this.arm(this.timeoutMs))}resume(){if(this.timeoutMs<=0||null!==this.handle||null===this.lastKick)return!1;let e=Math.max(0,Date.now()-this.lastKick),t=this.timeoutMs-e;return t<=0?(this.lastKick=null,this.onTimeout(),!0):(this.arm(Math.min(t,this.timeoutMs)),!1)}arm(e){let t=setTimeout(()=>{this.handle===t&&(this.handle=null,this.lastKick=null,this.onTimeout())},e);this.handle=t}stop(){null!==this.handle&&(clearTimeout(this.handle),this.handle=null)}get lastKickAt(){return this.lastKick??0}get pending(){return null!==this.handle}},Ol=class{constructor(){fn(this,"current","disconnected")}get status(){return this.current}markConnected(){return this.transition("connected")}markDisconnected(){return this.transition("disconnected")}transition(e){return this.current!==e&&(this.current=e,!0)}},xl="data-payload-no-bind",Ll=13,Pl=new Set(["true","false","yes","no","on","off"]),Ul=/^[\\d\\s.,:+/-]+$/u,Il=/^[a-z][a-z0-9_-]*$/u,jl=/^[a-z]{2,3}(?:[-_][A-Za-z0-9]{2,8})*$/u,Dl=new Set(["SCRIPT","STYLE","TEMPLATE","TITLE","NOSCRIPT","TEXTAREA","SELECT","OPTION","INPUT","IFRAME"]),Wl="http://www.w3.org/1999/xhtml",Bl=class{constructor(e,t,i){fn(this,"deps",e);fn(this,"state",t);fn(this,"host",i);fn(this,"awaitingHydration",new WeakSet);fn(this,"delivered",new WeakMap);fn(this,"confirmations",new WeakMap)}reapplyBindings(e){let t=this.currentTransaction();void 0!==t?.renderData&&this.host.schedule(t,t.renderData,e)}reapplyIslands(e,t=!1){let i=t?e.filter(e=>this.awaitingHydration.delete(e)):e,n=this.state.activeUpdate,r=t&&null!==n&&this.state.isCurrent(n)?n:this.currentTransaction();void 0!==r?.renderData&&this.dispatchIslands(r,r.renderData,i)}dispatchIslands(e,t,i){let n=St(this.deps,this.state,e,t.fields),r=()=>!e.cancelled&&this.state.isCurrent(e);if(!r())return;let l=this.delivered.get(t);void 0===l&&(l=new WeakSet,this.delivered.set(t,l));for(let o of i){let i=$e(o);if(!r())return;if(!1!==n&&!V(i,n)){this.awaitingHydration.delete(o);continue}let a=this.confirmation(o,e);if(Se(o))this.awaitingHydration.add(o);else{if(this.awaitingHydration.delete(o),l.has(o))continue;l.add(o),At(e,t,[o],r,a)}}}hasLateRouteBinding(e,t,i,n){for(let n of e){if((n.getAttribute(Rr)??"").length>0||"route"!==n.getAttribute(_r)||!1!==t&&!V($e(n),t))continue;let e=ge(n.getAttribute(Br));if(0===e.length||e.some(e=>i.touched.has(e)))return!0}for(let[r,l]of this.deps.cache.entries())for(let o of l){if(!e.has(o.element)||!1!==t&&!V(o.owner,t)||"route"!==(o.strategyKind??W(o.element)??"unknown"))continue;let l=U(n.fields,o,r,i.locale);if(!this.state.isCurrent(i))return!1;if(void 0!==l)return!0}return!1}fieldsForElements(e,t){let i=new Set(t);for(let[t,n]of this.deps.cache.entries())n.some(t=>e.has(t.element))&&i.add(t);return i}unrunFragmentPlan(e,t,i){if(null===t)return null;let n=t.boundaries.filter(t=>!e.fragmentBoundariesRun.has(t)&&(void 0===i||[...i].some(e=>e===t||t.contains(e))));return D(t.strategy,n,t.ownerKeys)}confirmation(e,t){let i=this.confirmations.get(e);if(i?.transaction===t)return i.displayed;let n=this.state.display.handIsland(t);return this.confirmations.set(e,{transaction:t,displayed:n}),n}currentTransaction(){let e=this.state.activeUpdate;return this.state.navigationBindingReplay&&null!==e&&this.state.isCurrent(e)?e:null}},_l="payload-live-preview",zl=Symbol.for("payload-live-preview.trusted-types"),Vl=new Set(["open","value","checked","selected"]),ql="__payloadLivePreviewDeprecationsWarned",Hl=new Set,Gl="data-payload-",Kl=new Set(["p","br","strong","b","em","i","u","s","strike","mark","small","h1","h2","h3","h4","h5","h6","ul","ol","li","dl","dt","dd","blockquote","code","pre","kbd","samp","var","a","span","div","section","article","aside","header","footer","nav","figure","figcaption","img","picture","source","audio","video","sub","sup","hr","time","abbr","cite","q","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col"]),Jl=new Set(["input","button","textarea","select","option","label"]),Xl=new Set(["script","style","iframe","object","embed","link","meta","base","form","input","button","select","textarea","svg","math","template","frame","frameset","noframes","noscript"]),Ql=new Set(["id","class","lang","dir","title","role","tabindex"]),Zl="aria-",Yl="data-",eo="data-payload-",to={a:new Set(["href","target","rel","download","hreflang","type"]),img:new Set(["src","srcset","sizes","alt","width","height","loading","decoding"]),picture:new Set([]),source:new Set(["src","srcset","sizes","type","media"]),audio:new Set(["src","controls","autoplay","loop","muted","preload"]),video:new Set(["src","poster","controls","autoplay","loop","muted","preload","width","height","playsinline"]),time:new Set(["datetime"]),abbr:new Set(["title"]),q:new Set(["cite"]),blockquote:new Set(["cite"]),table:new Set(["summary"]),th:new Set(["colspan","rowspan","scope","headers","abbr"]),td:new Set(["colspan","rowspan","headers"]),col:new Set(["span"]),colgroup:new Set(["span"]),ol:new Set(["start","reversed","type"]),li:new Set(["value"]),code:new Set(["class"]),pre:new Set(["class"])},io=new Set(["href","src","cite","poster","action","formaction"]),no=6,ro=1,lo=8,oo=(Error,new Set(["id","name","data-payload-key","data-payload-morph","data-payload-nested-key","data-payload-nested-template"])),ao="strict",so=(Object.freeze({allowedTags:Kl,removeCompletely:Xl,globalAttributes:Ql,attributesByTag:to,urlAttributes:io}),Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'","/":"/","`":"`","=":"="})),uo=/[&<>"\'/`=]/g,co=Object.freeze({"&":"&","<":"<",">":">",\'"\':""","\'":"'"}),ho=/[&<>"\']/g,fo=/\\{\\{([\\s\\S]*?)\\}\\}/g,po="data-payload-",go=["input","textarea","select","option","button","label","details","summary","dialog","video","audio","progress","meter"],mo=["type","name","placeholder","open","disabled","readonly","required","checked","selected","value","min","max","step","rows","cols","for","controls","muted","loop","poster","src"],vo=/<([a-z][a-z0-9]*(?:-[a-z0-9]+)+)\\b/gi,yo=64,bo=new Map,wo="data-payload-key",So="data-payload-nested-key",Ao="data-payload-nested-template",ko=class{constructor(e,t,i){fn(this,"deps",e);fn(this,"state",t);fn(this,"host",i)}planFragments(e,t){let{deps:i,state:n}=this,r=i.strategies.fragment;if(void 0===r)return null;let l=new Set(r.plan(i.root,e));for(let e of n.fragmentsOwed)i.root.contains(e)?l.add(e):n.fragmentsOwed.delete(e);return D(r,[...l].filter(e=>gi(e,t)),t)}escalateUnfaithful(e,t,i,n){if(e.routeRefreshed){this.kept(e,i);return}let{fragment:r,route:l}=this.deps.strategies,o=void 0===r?void 0:function(e){let t=[];for(let i of e){let e=i.fragmentBoundary;if(void 0===e)return;t.includes(e)||t.push(e)}return t}(i),a=void 0===o||o.every(e=>gi(e,n))?o:void 0;void 0===r||void 0===a?void 0!==l?(this.state.escalatedCount+=i.length,this.refreshRoute(e,t,l)):(pi(this.deps,this.state,i.length),this.kept(e,i)):(this.state.escalatedCount+=i.length,e.pendingFragments+=a.length,this.runFragments(e,t,D(r,a,n)))}kept(e,t){for(let i of t)this.state.display.shortfall(e,{kind:"unfaithful",field:i.fieldName})}hasUnboundChange(e,t){let{deps:i,state:n}=this;if(e.baseline||e.routeRefreshed)return!1;let r=function(e,t,i,n,r,l){let o=ee(e,n,l),a=ie(e,i,n,o),s=[];for(let e of t){if(rr.has(e))continue;let t=a(e);if("none"===t&&s.push(e),"below"!==t||void 0===r)continue;let n=te(e,i),{previous:l,next:u}=r;for(let{path:t}of Y(n,l[e],u[e],o))s.push(t)}return s}(i.cache,e.touched,e.locale,t,this.subfields(e),i.strategies),l=0;for(let e of r)o(n,e)&&(l+=1);let[a]=r;if(void 0===a)return!1;if("escalate"!==i.onUnfaithfulPatch||void 0===i.strategies.route){"escalate"===i.onUnfaithfulPatch&&pi(i,n,r.length);for(let t of r)n.display.shortfall(e,{kind:"unbound",field:t});return!1}return e.navigated?(n.routeAwaitsSave=!0,n.display.shortfall(e,{kind:"route-saved"}),!1):(i.log("route","LP0807",`field "${a}" has no binding; refreshing the route`),n.escalatedCount+=l,!0)}subfields(e){let{previousFields:t}=this.state.changes;return function(e,t,i){return"declared"===e&&void 0!==t&&void 0!==i?{previous:t,next:i}:void 0}(this.deps.subfieldCoverage,t,e.renderData?.fields)}plansRoute(e,t,i){let n=e=>!1===i||V(e,i),r=function(e,t,i){let n=e.rendered.flatMap(e=>"route"===e.strategy?e.paths:[]);for(let[t,i]of e.entries())i.some(e=>"route"===e.strategyKind)&&n.push(t);let r=new Set(t);for(let e of n){let[n=e]=e.split(".");t.has(n)&&(void 0===i||Z(e,i.previous,i.next))&&r.add(e)}return r}(this.deps.cache,t.touched,this.subfields(t));if(e.plan(this.deps.root,r,{inScope:e=>n($e(e))}))return!0;for(let[e,t]of this.deps.cache.entries())if(r.has(e)&&t.some(e=>"route"===e.strategyKind&&n(e.owner)))return!0;return!1}async runFragments(e,t,i){let{deps:n,state:r}=this,l=new AbortController,o=new Set(i.boundaries);for(let e of o)r.fragmentsOwed.delete(e);r.fragmentControllers.set(l,o);let a=t=>{o.delete(t)&&(e.pendingFragments-=1)},s=()=>r.isCurrent(e)&&!l.signal.aborted,u=e=>function(e,t,i){if(t.isConnected)return t;let n,r=t.getAttribute(Yn),l=t.getAttribute(er);for(let t of e.querySelectorAll(`[${Yn}]`))if(t.getAttribute(Yn)===r&&t.getAttribute(er)===l&&i(t)){if(void 0!==n)return;n=t}return n}(n.root,e,e=>gi(e,i.ownerKeys)),{emitter:d}=n,{message:c}=e,h=e.revision.revision,f=e.receivedAt,p={root:n.root,revision:h,receivedAt:f,fields:t.fields,locale:e.locale,collectionSlug:"string"==typeof c.collectionSlug?c.collectionSlug:void 0,globalSlug:"string"==typeof c.globalSlug?c.globalSlug:void 0,signal:l.signal,isCurrent:s,log:(e,t)=>{n.log("fragment",e,t)},morph:(e,t)=>{let i=s()?u(e):void 0;void 0!==i&&function(e,t,i){let n=e.ownerDocument.createElement("template");n.innerHTML=$t(t);let r=e.cloneNode(!1);r.append(n.content);let l=Ce(e);Nt(e,r,{keyAttributes:[wo],boundary:ye,retainBoundary:Te}),function(e){for(let t of e)t.isConnected||Cr.has(t)||(Cr.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}(l);let o=new Set(l);for(let t of Ce(e)){let e=o.has(t)?void 0:Re(t);void 0!==e&&i(t,e)}}(i,t,(e,t)=>{!function(e,t,i,n){if(t.warnedIslandStart)return;t.warnedIslandStart=!0;let r="element"===n?"<astro-island>":`client:${i.getAttribute("client")??""}`;e.warn(`[live-preview] LP0809: a fragment island cannot start: this page never loaded ${r}; render one on the page`)}(this.deps,this.state,e,t)})},patch:n=>{let r=u(n);void 0!==r&&(r!==n&&this.host.rebuildCache(),this.patchFallback(e,t,r,i.ownerKeys,s))},rendered:(e,t,i)=>{a(e);let n=u(e)??e;d.emitWhile("fragmentRender",{element:n,id:t,key:i,status:"rendered",revision:h,receivedAt:f},s)},failed:(t,i,l,o,c)=>{a(t);let p=u(t)??t;r.display.shortfall(e,{kind:"fragment",id:i,key:l,code:o});let g=`fragment "${i}" fell back to patch: ${c}`;n.log("fragment",o,g),d.emitWhile("error",{error:new Error(g),context:"fragment",code:o},s),d.emitWhile("fragmentRender",{element:p,id:i,key:l,status:"failed",code:o,revision:h,receivedAt:f},s)}},g={rendered:0,failed:0,superseded:0};try{g=await i.strategy.render(p,i.boundaries)}catch(t){if(n.log("fragment","LP0801",t),s()){for(let t of i.boundaries)p.patch(t),r.display.shortfall(e,he(t));g={rendered:0,failed:i.boundaries.length,superseded:0}}}r.fragmentStats.rendered+=g.rendered,r.fragmentStats.failed+=g.failed,r.fragmentStats.superseded+=g.superseded,r.fragmentControllers.delete(l);for(let e of o)a(e);s()&&(g.rendered>0&&this.host.restoreGuesses(e,t),0===e.pendingFragments&&0===n.scheduler.pendingCount&&r.complete(e),this.host.revealPending(e),s()&&(0===g.rendered||0===d.listenerCount("afterUpdate")||d.emitWhile("afterUpdate",{data:t,updatedCount:g.rendered,durationMs:Date.now()-f,revision:h,receivedAt:f,source:"fragment"},s)))}async refreshRoute(e,t,i){let{deps:n,state:r}=this;e.routeRefreshed?(r.routeStats.loopStopped+=1,n.log("route","LP0805",`revision ${String(e.revision.revision)} asked for a second refresh`)):(e.routeRefreshed=!0,await this.runRoute(e,t,i,!1).catch(e=>{this.routeFailed(e)}))}refreshAfterSave(){let{deps:e,state:t}=this,{route:i}=e.strategies,n=t.activeUpdate;!t.routeAwaitsSave||void 0===i||void 0===n?.renderData||(e.log("route","document saved; refreshing the route"),this.runRoute(n,n.renderData,i,!0).catch(e=>{this.routeFailed(e)}))}routeFailed(e){this.deps.log("route refresh failed:",e)}armRouteRetry(e,t,i,n,r){let{state:l}=this;null!==l.routeRetry&&clearTimeout(l.routeRetry),l.routeRetry=setTimeout(()=>{l.routeRetry=null,l.isCurrent(e)&&this.runRoute(e,t,i,r).catch(e=>{this.routeFailed(e)})},n)}async runRoute(e,t,i,n){let{deps:r,state:l}=this,o=l.routeStats,a=new AbortController;l.routeController?.abort(),l.routeController=a;let s,u=()=>!a.signal.aborted;try{s=await i.refresh({revision:e.revision.revision,receivedAt:e.receivedAt,signal:a.signal,isCurrent:u,log:(e,t)=>{r.log("route",e,t)},retryAfter:r=>{this.armRouteRetry(e,t,i,r,n)}})}catch(e){r.log("route","LP0801",e),s="failed"}if(!u())return;l.routeController=null;let d=l.activeUpdate;if(null===d)return;let c=d.renderData,h=()=>l.isCurrent(d);if("partial"===s?l.display.shortfall(d,{kind:"route-saved"}):("failed"===s||"superseded"===s||"refused"===s&&null===l.routeRetry)&&l.display.shortfall(d,{kind:"route-failed",outcome:s}),"refreshed"!==s&&"partial"!==s)"failed"===s?o.failed+=1:"refused"===s&&(o.refused+=1),void 0!==c&&this.host.reapply(d,c);else{if(o.refreshes+=1,"partial"===s&&(o.partial+=1),l.routeAwaitsSave="partial"===s&&!n,l.lastAppliedIdentity=new WeakMap,void 0!==c&&this.host.restoreGuesses(d,c),this.host.rebuildCache(),void 0===c||!h())return;this.host.reapply(d,c),r.emitter.listenerCount("afterUpdate")>0&&r.emitter.emitWhile("afterUpdate",{data:c,updatedCount:r.cache.elementCount,durationMs:Date.now()-d.receivedAt,revision:d.revision.revision,receivedAt:d.receivedAt,source:"route"},h)}}warnFragmentFallback(e){!function(e,t,i){t.warnedFragmentFallback||(t.warnedFragmentFallback=!0,e.warn(`[live-preview] LP0806: "${i.fieldName}" asks for the fragment strategy but no handler is configured; patching instead`))}(this.deps,this.state,e)}warnUnsupportedStrategy(e){!function(e,t,i){t.warnedStrategy.has(i.element)||(t.warnedStrategy.add(i.element),e.warn(`[live-preview] LP0407: "${i.fieldName}" asks for strategy "${String(i.strategy)}"; only patch, fragment and route exist`))}(this.deps,this.state,e)}patchFallback(e,t,i,n,r){if(r())for(let[l,o]of this.deps.cache.entries())for(let a of o){if(a.fragmentBoundary!==i||!1!==n&&!V(a.owner,n))continue;let o=U(t.fields,a,l,e.locale);void 0===o||!r()||this.deps.scheduler.schedule({target:a,value:this.host.transform(a,o,t.fields,r),allFields:t.fields,revision:e.revision,data:t})}}},To=new Set,Co={kind:"merge"},Ro=class{constructor(e,t,i){fn(this,"deps",e);fn(this,"state",t);fn(this,"strategies");fn(this,"navigationReplay");t.changes.keepValues="declared"===e.subfieldCoverage,t.display.host=function(e,t){return{outstanding:i=>!i.completed||i.pendingFragments>0||null!==t.routeController||null!==t.routeRetry||e.scheduler.pendingCount>0,report:t=>{"partial"===t.state&&e.a11y?.announcePartial(),e.emitter.emit("revisionDisplay",t)},failed:t=>{e.log("revision display failed:",t)}}}(e,t),this.strategies=new ko(e,t,{reapply:(e,t)=>{this.scheduleAllFields(e,t)},transform:(t,i,n,r)=>mi(e,t,i,n,r),rebuildCache:i,restoreGuesses:(e,t)=>{this.restoreGuesses(e,t)},revealPending:e=>{this.revealPending(e)}}),this.navigationReplay=new Bl(e,t,{schedule:(e,t,i)=>{this.scheduleAllFields(e,t,i)}})}handleUpdate(e,t,i){let{deps:n,state:r}=this;n.heartbeat.kick(),r.protocol.observe(function(e){let t=[];return Array.isArray(e.fieldSchemaJSON)&&t.push("schema-json"),"string"==typeof e.locale&&t.push("locale"),"string"==typeof e.previewToken&&t.push("preview-token"),"object"==typeof e.externallyUpdatedRelationship&&null!==e.externallyUpdatedRelationship&&t.push("relationship-events"),t}(e),n.log);let l=e.data;void 0!==l?void 0!==i&&this.acceptDataUpdate(e,l,t,i,!0):void 0!==e.protocolVersion&&r.protocol.applyVersion(e.protocolVersion,n.log)}handleReplay(e,t,i){let n=e.data;void 0!==n&&this.acceptDataUpdate(e,n,t,i,!1)}reapplyNavigationBindings(e){this.navigationReplay.reapplyBindings(e)}reapplyNavigationIslands(e,t=!1){this.navigationReplay.reapplyIslands(e,t)}acceptDataUpdate(e,t,i,n,r){let{deps:l,state:o}=this,a=r?o.relationships.inspect(e):null,s="string"==typeof e.locale?e.locale:o.locale,u=o.schema,d=o.schemaIndex;Array.isArray(e.fieldSchemaJSON)&&(u=e.fieldSchemaJSON,d=function(e,t=""){let i=new Map;return k(e,t,i,!1),k(e,t,i,!0),i}(e.fieldSchemaJSON));let c=o.activeUpdate;if(!o.isRunning()||null!==c&&c.revision.revision>n.revision)return;let h=null===a?null:o.relationships.commit(a),f=c,p={revision:n,message:e,rawData:t,locale:s,schema:u,schemaIndex:d,receivedAt:Date.now(),forceRender:null!==h||ue(f),countsAsUpdate:r,renderData:void 0,fragmentBoundariesRun:new WeakSet,touched:new Set,baseline:!1,navigated:!1,invalidated:new Set,revealTarget:void 0,revealIdentities:[],pendingFragments:0,routeRefreshed:!1,cancelled:!1,completed:!1};o.locale=s,o.schema=u,o.schemaIndex=d,null!==f&&!f.completed&&f.countsAsUpdate&&(o.supersededCount+=1),o.activeUpdate=p,r&&(o.updateCount+=1),o.display.begin(p,n.revision),o.isCurrent(p)&&(l.scheduler.acceptRevision(n),o.isCurrent(p)&&(o.supersedeStrategies(),o.isCurrent(p)&&(null!==h&&(l.emitter.emitWhile("relationshipUpdate",{detail:h,timestamp:Date.now()},()=>o.isCurrent(p)),!o.isCurrent(p))||r&&void 0!==e.protocolVersion&&(o.protocol.applyVersion(e.protocolVersion,l.log),!o.isCurrent(p))||r&&l.connection.markConnected()&&(l.a11y?.announceConnected(),l.emitter.emit("connect",{origin:i,timestamp:Date.now()}),!o.isCurrent(p)||(l.log("connection","disconnected","\\u2192","connected"),!o.isCurrent(p)))||this.processUpdate(p).catch(e=>{l.log("update failed:",e)}))))}async processUpdate(e){let{deps:t,state:i}=this,n=await this.resolveIncomingFields(e);if(null===n||!i.isCurrent(e))return;let r=this.dataFor(e,n);t.emitter.listenerCount("beforeUpdate")>0&&(!await t.emitter.emitWhile("beforeUpdate",{data:r,revision:e.revision.revision,receivedAt:e.receivedAt,source:"patch",cancel:()=>{e.cancelled=!0,t.scheduler.cancelRevision(e.revision)}},()=>!e.cancelled&&i.isCurrent(e))||e.cancelled||!i.isCurrent(e))||this.applyFields(e,r,!1)}dataFor(e,t){let{message:i}=e;return{fields:t,...void 0!==e.schema?{schema:e.schema}:{},..."string"==typeof i.globalSlug?{globalSlug:i.globalSlug}:{},..."string"==typeof i.collectionSlug?{collectionSlug:i.collectionSlug}:{},...void 0!==e.locale?{locale:e.locale}:{}}}applyFields(e,t,i){let{deps:n,state:r}=this;if(!r.isCurrent(e))return;if(r.changes.isBaseline&&!i&&"off"!==n.autoBind){{let i=St(n,r,e,t.fields);!function(e,t,i,n,r,l){if(!l())return 0;let o=performance.now(),a=yt(e.root),s=dt(i,n);if(!l())return 0;let u=null===a?[]:vt(a,s);if(!l())return 0;let d=wt(e,u,r,"on the first message",l);if(!l())return 0;let c=function(e,t){let i=new Set;for(let{fieldName:e,stamps:n}of t){i.add(e);for(let e of[Nr,Er]){let t=n[e];void 0!==t&&i.add(t)}}let n=new Map;for(let[t,r]of e)null!==r&&i.has(r.field)&&n.set(t,r);return{fields:i,values:n}}(s,d),h=performance.now()-o;l()&&(t.autoBindGuesses=c,t.autoBindSearchMs=h,d.length)}(n,r,t.fields,e.locale,i,()=>r.isCurrent(e))}if(!r.isCurrent(e))return}let l=me(n.dependencies,n.cache.dependencyMap());if(!r.isCurrent(e))return;let o=r.changes.diff(t.fields,l,()=>r.isCurrent(e));if(null===o)return;let a=!i&&r.navigationReplayPending;a&&(r.navigationReplayPending=!1,r.navigationBindingReplay=!0),e.baseline=o.baseline&&!a,e.navigated=a,e.invalidated=i?To:o.invalidated,e.touched=i?To:new Set([...o.changed,...o.invalidated]),e.renderData=t,this.scheduleAllFields(e,t)}async resolveIncomingFields(e){let{deps:t,state:i}=this,n=e.rawData;if(null===t.merger)return n;let r=i.merges.decide(t,e);if(!r.merge)return r.fields;let{message:l}=e,o=i.merges.request(t.merger,t.mergeWindowMs,{collectionSlug:l.collectionSlug,globalSlug:l.globalSlug,data:n,...void 0===e.schema?{}:{schema:e.schema},locale:e.locale});if(!o.leading)return this.applyMerged(e,o.result).catch(e=>{t.log("update failed:",e)}),r.fields;let a=await o.result;return i.isCurrent(e)?"merged"===a.status?(i.merges.recordMerged(a.doc,e.locale),a.doc):"superseded"===a.status?null:(i.display.shortfall(e,Co),r.fields):null}async applyMerged(e,t){let{state:i}=this,n=await t;"unavailable"===n.status&&i.display.shortfall(e,Co),"merged"===n.status&&i.isCurrent(e)&&(i.merges.recordMerged(n.doc,e.locale),this.applyFields(e,this.dataFor(e,n.doc),!0))}scheduleAllFields(e,t,i){let{deps:n,state:r}=this;if(!r.isCurrent(e))return;let l=void 0!==i,o=()=>r.isCurrent(e),a=St(n,r,e,t.fields);if(!o())return;let{touched:s}=e,u=n.strategies.route;if(l&&void 0!==u&&!e.routeRefreshed&&this.navigationReplay.hasLateRouteBinding(i,a,e,t)){o()&&this.strategies.refreshRoute(e,t,u);return}let d=!l&&this.strategies.hasUnboundChange(e,a),c=r.routeRefreshOwed;if(!l&&void 0!==u&&!e.routeRefreshed&&(d||c||this.strategies.plansRoute(u,e,a))&&o()){r.routeRefreshOwed=!1,this.strategies.refreshRoute(e,t,u);return}let h=l?this.navigationReplay.fieldsForElements(i,s):s,f=this.navigationReplay.unrunFragmentPlan(e,this.strategies.planFragments(h,a),i);if(!o())return;let p=n.skipUnchanged,g=0;for(let[s,u]of n.cache.entries()){if(!o())return;for(let d of u){if(void 0!==i&&!i.has(d.element)||!1!==a&&!V(d.owner,a))continue;if(!0===f?.covers(d)){if(n.revealEditedField){let i=U(t.fields,d,s,e.locale);r.revealLedger.note(e,d,i)}continue}let u=d.strategyKind??W(d.element)??"unknown";if("unknown"===u){this.strategies.warnUnsupportedStrategy(d);continue}"fragment"===u&&null===f&&this.strategies.warnFragmentFallback(d);let c=U(t.fields,d,s,e.locale);if(void 0===c){r.absentFields.add(s);continue}if(!l&&n.revealEditedField&&r.revealLedger.note(e,d,c),!o())return;let h=mi(n,d,c,t.fields,o);if(!o())return;let m=p?I(d,h,t.fields,e.locale):void 0,v=r.lastAppliedIdentity.get(d.element);if(!e.forceRender&&n.skipUnchanged&&void 0!==m&&v===m&&!e.invalidated.has(s)){r.skippedUnchangedCount+=1;continue}let y={target:d,value:h,allFields:t.fields,revision:e.revision,...l?{}:{data:t},valueIdentity:m};n.scheduler.schedule(y),g+=1}}if(l||function(e,t,i,n,r){let{cache:l,strategies:o}=e,a={cache:l,warned:t,warn:e.warn};if(0===l.fieldCount||!1!==r&&!function(e,t){for(let i of e.values())if(V(i.owner,t))return!0;return!1}(l,r))return;let s=function(e,t,i,n){let r=ie(e,t,i,ee(e,i,n));return e=>"none"!==r(e)}(l,n,r,o);for(let[e,t]of Object.entries(i)){if(rr.has(e))continue;if(Tt(t)){kt(a,s,e,n,t);continue}if(!Rt(t)||s(e)||Ct(t))continue;let i=te(e,n);for(let[e,r]of Object.entries(t))!Tt(r)||rr.has(e)||kt(a,s,`${i}.${e}`,n,r)}if("declared"!==e.subfieldCoverage)return;let u=function(e,t,i,n,r){let l=ee(e,n,r),o=ie(e,i,n,l),a=[];for(let[e,n]of Object.entries(t)){if(rr.has(e)||"below"!==o(e))continue;let t=te(e,i);a.push(...Y(t,void 0,n,l))}return a}(l,i,n,r,o);for(let{path:e,value:t}of u)if(Tt(t)&&kt(a,s,e,n,t),Rt(t)&&!Ct(t))for(let[i,r]of Object.entries(t))Tt(r)&&kt(a,s,`${e}.${i}`,n,r)}(n,r.warnedOrphanFields,e.rawData,e.locale,a),o()){if(null!==f&&f.boundaries.length>0){for(let t of f.boundaries)e.fragmentBoundariesRun.add(t);e.pendingFragments+=f.boundaries.length,this.strategies.runFragments(e,t,f)}l||!o()||0===g&&(0===e.pendingFragments&&0===n.scheduler.pendingCount&&(r.complete(e),this.revealPending(e)),this.notifyIslands(e,t))}}notifyIslands(e,t){0!==e.touched.size&&this.navigationReplay.dispatchIslands(e,t,this.deps.cache.islands)}restoreGuesses(e,t){let{deps:i,state:n}=this;if("off"!==i.autoBind&&null!==n.autoBindGuesses){let r=St(i,n,e,t.fields);!function(e,t,i,n,r,l){if(!l())return 0;let o=t.autoBindGuesses,a=yt(e.root);if(null===o||0===o.fields.size||null===a)return 0;let s=new Map(o.values);for(let[e,t]of dt(i,n)){if(null===t||!o.fields.has(t.field))continue;let i=s.get(e);void 0===i?s.set(e,t):i?.field!==t.field&&s.set(e,null)}if(!l())return 0;let u=vt(a,s);l()&&wt(e,u,r,"after a server render",l).length}(i,n,t.fields,e.locale,r,()=>n.isCurrent(e))}}onFlush(e){let{deps:t,state:i}=this;i.lastFlush=e,e.deferred>0&&!i.warnedVisibilityGate&&(i.warnedVisibilityGate=!0,t.warn(`[live-preview] LP0301: visibility gate held ${String(e.deferred)} off-screen update(s) until scrolled into view; see visibilityGateThreshold`));let{revision:n,data:r}=e;if(void 0===n)return;let l=i.activeUpdate;if(null===l||!i.isCurrent(l)||!w(l.revision,n))return;i.display.deferred(l,e.deferred),0===l.pendingFragments&&i.complete(l);let o=()=>i.isCurrent(l)&&w(l.revision,n),a=r??l.renderData;if(this.revealPending(l),!o())return;let s=i.unfaithfulPatches;if(s.length>0){if(i.unfaithfulPatches=[],void 0!==a){let e=St(t,i,l,a.fields);this.strategies.escalateUnfaithful(l,a,s,e)}if(!o())return}void 0!==r&&(e.applied>0&&t.a11y?.announceUpdate(e.applied),o()&&(this.notifyIslands(l,r),o()&&0!==e.applied&&0!==t.emitter.listenerCount("afterUpdate")&&t.emitter.emitWhile("afterUpdate",{data:r,updatedCount:e.applied,durationMs:e.durationMs,revision:n.revision,receivedAt:l.receivedAt,source:"patch"},o)))}revealPending(e){let t=this.state.revealLedger.commit(e);if(void 0!==t)try{ce(this.state.revealer,t)}catch(e){this.deps.log("reveal",e)}}revealField(e){let t=this.deps.cache.get(e)?.[0];return void 0===t?"no-element":ce(this.state.revealer,t)}documentSaved(){this.strategies.refreshAfterSave()}},$o=class{constructor(e,t){fn(this,"apply");fn(this,"debounceMs");fn(this,"maxWaitMs");fn(this,"isVisible");fn(this,"gateThresholdValue");fn(this,"gateDisabled");fn(this,"getCacheSize");fn(this,"onFlush");fn(this,"scheduleFrame");fn(this,"cancelFrame");fn(this,"pending",new Map);fn(this,"replay",new Map);fn(this,"activeFlushes",new Set);fn(this,"debounceTimer",null);fn(this,"debounceToken",0);fn(this,"deadlineTimer",null);fn(this,"frameHandle",null);fn(this,"frameFallback",null);fn(this,"frameToken",0);fn(this,"windowUntil",0);fn(this,"activeRevision",null);fn(this,"activeRevisionCancelled",!1);fn(this,"destroying",!1);this.apply=e,this.debounceMs=t.debounceMs??50,this.maxWaitMs=t.maxWaitMs??4*this.debounceMs,this.isVisible=t.isVisible,this.gateThresholdValue=t.visibilityGateThreshold??50,this.gateDisabled=t.disableVisibilityGate??!1,this.getCacheSize=t.getCacheSize,this.onFlush=t.onFlush,this.scheduleFrame=t.scheduleFrame??("function"==typeof requestAnimationFrame?requestAnimationFrame.bind(globalThis):e=>setTimeout(()=>{e(performance.now())},0)),this.cancelFrame=t.cancelFrame??("function"==typeof cancelAnimationFrame?cancelAnimationFrame.bind(globalThis):e=>{clearTimeout(e)})}schedule(e){if(this.destroying||void 0!==e.revision&&(this.activeRevisionCancelled||null===this.activeRevision||!w(e.revision,this.activeRevision)))return;let t=this.pending.get(e.target.element);t?(t.value=e.value,t.allFields=e.allFields,t.revision=e.revision,t.data=e.data,t.valueIdentity=e.valueIdentity):this.pending.set(e.target.element,{target:e.target,value:e.value,allFields:e.allFields,revision:e.revision,data:e.data,valueIdentity:e.valueIdentity}),this.armDebounce()}acceptRevision(e){this.destroying||null!==this.activeRevision&&w(e,this.activeRevision)||null!==this.activeRevision&&function(e,t){return e.generation!==t.generation?e.generation-t.generation:e.revision-t.revision}(e,this.activeRevision)<0||(this.clearWork(),this.activeRevision=e,this.activeRevisionCancelled=!1,this.cancelScheduledWork())}cancelRevision(e){null===this.activeRevision||!w(e,this.activeRevision)||(this.clearWork(),this.activeRevisionCancelled=!0,this.cancelScheduledWork())}flushNow(){return this.cancelScheduledWork(),this.flush()}notifyVisible(e){let t=this.replay.get(e);if(!t||(this.replay.delete(e),!this.isCurrent(t)))return;let i=performance.now(),n=this.didApply(t)?1:0;this.onFlush?.(this.statsFor(t,n,0,performance.now()-i,1===n?[t.target.fieldName]:[]))}retarget(e){this.retargetBuffer(this.pending,e),this.retargetBuffer(this.replay,e);for(let t of this.activeFlushes)this.retargetBuffer(t,e)}forget(e){this.pending.delete(e),this.replay.delete(e);for(let t of this.activeFlushes)t.delete(e)}destroy(){if(!this.destroying){this.destroying=!0;try{this.clearWork(),this.activeRevision=null,this.activeRevisionCancelled=!1,this.windowUntil=0,this.cancelScheduledWork()}finally{this.destroying=!1}}}get pendingCount(){return this.pending.size}get replayCount(){return this.replay.size}get gateThreshold(){return this.gateThresholdValue}get gateActive(){return!this.gateDisabled&&this.getCacheSize()>this.gateThresholdValue}armDebounce(){let e=Date.now(),t=e>=this.windowUntil;if(this.windowUntil=e+this.debounceMs,t){this.requestFrame();return}let i=this.debounceToken+=1,n=this.debounceTimer;if(this.debounceTimer=null,null!==n&&clearTimeout(n),this.debounceToken!==i)return;let r=setTimeout(()=>{this.debounceToken===i&&(this.debounceTimer=null,this.pending.size>0&&this.requestFrame())},this.debounceMs);this.debounceToken===i&&(this.debounceTimer=r),null===this.deadlineTimer&&this.maxWaitMs>this.debounceMs&&(this.deadlineTimer=setTimeout(()=>{this.deadlineTimer=null,this.pending.size>0&&this.requestFrame()},this.maxWaitMs))}requestFrame(){let e=this.frameToken+=1,t=this.frameHandle;if(this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.frameToken!==e)return;let i=!1,n=()=>{if(this.frameToken!==e||i)return;i=!0;let t=this.frameHandle;this.frameHandle=null,this.clearFrameFallback(),null!==t&&this.cancelFrame(t),this.flush()},r=this.scheduleFrame(n);i||this.frameToken!==e||(this.frameHandle=r,this.frameFallback=setTimeout(n,100))}clearFrameFallback(){clearTimeout(this.frameFallback??void 0),this.frameFallback=null}flush(){let e=performance.now();this.clearDeadline();let t=this.gateActive,i=this.pending;this.pending=new Map;let n,r=0,l=[],o=0;this.activeFlushes.add(i);try{for(let e of i.values()){if(!this.isCurrent(e))continue;let i=!t||this.isVisible(e.target.element)||vi(e.target);if(this.isCurrent(e)){if(n??(n=e),!i){this.replay.set(e.target.element,e),o+=1;continue}this.replay.delete(e.target.element),this.didApply(e)&&(r+=1,l.push(e.target.fieldName))}}}finally{this.activeFlushes.delete(i)}let a=this.statsFor(n,r,o,performance.now()-e,l);return this.onFlush?.(a),a}isCurrent(e){return void 0===e.revision||!this.activeRevisionCancelled&&null!==this.activeRevision&&w(e.revision,this.activeRevision)}didApply(e){return!1!==this.apply(e)||!function(e){return Xn.has(e)}(this.apply)}retargetBuffer(e,t){let i=e.get(t.element);if(void 0!==i){if(!Ne(i.target,t)){e.delete(t.element);return}i.target=t}}clearWork(){this.pending.clear(),this.replay.clear();for(let e of this.activeFlushes)e.clear()}statsFor(e,t,i,n,r){return{applied:t,appliedFields:r,deferred:i,durationMs:n,...void 0!==e?.revision?{revision:e.revision}:{},...void 0!==e?.data?{data:e.data}:{}}}clearDeadline(){null!==this.deadlineTimer&&(clearTimeout(this.deadlineTimer),this.deadlineTimer=null)}cancelScheduledWork(){let e=this.debounceTimer,t=this.frameHandle;this.debounceToken+=1,this.frameToken+=1,this.debounceTimer=null,this.frameHandle=null,this.clearDeadline(),this.clearFrameFallback(),null!==e&&clearTimeout(e),null!==t&&this.cancelFrame(t)}},Fo=[0,500,1e3,2e3],No=class{constructor(e){fn(this,"deps");fn(this,"state",new mr);fn(this,"pipeline");fn(this,"writer");fn(this,"rootSentinel",null);fn(this,"scope",null);fn(this,"closingSession",!1);fn(this,"observedRoot",null);fn(this,"replayRetainedOnStart",!1);let{emitter:n,renderers:l}=e,o=void 0===e.log?i:t(e.log),a=void 0===e.warn?wn:t(e.warn),s=e.root??(typ','eof document<"u"?document:void 0);if(void 0===s)throw new Error("LivePreviewRuntime: no document; pass options.root");let u=new Zr({filter:e=>!function(e){let t=e;for(;null!==t;){if(we(t))return!0;t=t.parentElement}return!1}(e)}),d=new vl({onStructuralChange:()=>{this.rebuildCache()},onIslandHydrated:e=>{this.pipeline.reapplyNavigationIslands([e],!0)},onVisibilityChange:(e,t)=>{t&&c.notifyVisible(e)}},void 0!==e.intersectionRootMargin?{intersectionRootMargin:e.intersectionRootMargin}:{}),c=new $o(O(e=>this.writer.apply(e)),{...void 0!==e.debounceMs?{debounceMs:e.debounceMs}:{},...void 0!==e.disableVisibilityGate?{disableVisibilityGate:e.disableVisibilityGate}:{},...void 0!==e.visibilityGateThreshold?{visibilityGateThreshold:e.visibilityGateThreshold}:{},isVisible:e=>d.isVisible(e),getCacheSize:()=>u.elementCount,onFlush:e=>{this.pipeline.onFlush(e)}}),h=new Dn(e.originMatcher,{onUpdate:(e,t,i)=>{this.pipeline.handleUpdate(e,t,i)},onReplay:(e,t,i)=>{this.pipeline.handleReplay(e,t,i)},onDocumentEvent:()=>{this.state.protocol.observe(["document-events"],o),n.emit("documentSave",{timestamp:Date.now()}),this.pipeline.documentSaved()},onFocusField:e=>{this.deps.revealEditedField&&this.pipeline.revealField(e)},onInvalid:(e,t)=>{if("token"===e){let e=new Error(`Preview token rejected (origin: ${t})`);n.emit("error",{error:e,context:"token",code:"LP0502"})}("shape"===e||"type"===e)&&!this.state.warnedProtocolShape&&(this.state.warnedProtocolShape=!0,a(`[live-preview] LP0503: ${t} posted a message this runtime does not recognise (${"type"===e?"unknown message type":"unexpected shape"}); it was ignored. A newer Payload or a custom sender: check that the versions match.`)),"source"===e&&!this.state.warnedForeignSource&&(this.state.warnedForeignSource=!0,a(`[live-preview] LP0501: a message from ${t} was ignored because it did not come from the window that framed or opened this page. \\`eventSourcePolicy\\` is \'parent-or-opener\' by default since 2.0, where 1.x accepted any window on a trusted origin. Set \\`eventSourcePolicy: \'any\'\\` if the admin posts from elsewhere.`)),o("LP0501 message rejected:",e,t)},...void 0!==e.validateToken?{validateToken:e.validateToken}:{},...void 0!==e.eventSourcePolicy?{sourcePolicy:e.eventSourcePolicy}:{}}),f=e.dataMerge;this.deps={emitter:n,cache:u,observers:d,scheduler:c,bus:h,connection:new Ol,heartbeat:new El({...void 0!==e.heartbeatMs?{timeoutMs:e.heartbeatMs}:{},onTimeout:()=>{this.onHeartbeatTimeout()}}),renderers:l,resolveRenderer:e.resolveRenderer??(e=>l[e]),transformValue:e.transformValue,renderRichText:e.renderRichText,sanitizerPolicy:e.sanitizerPolicy,root:s,readyTargets:"function"==typeof e.readyTargets?e.readyTargets:(e=>()=>e)(e.readyTargets),sendReady:e.sendReady??A,onHeartbeatTimeout:e.onHeartbeatTimeout,log:o,warn:a,a11y:S(e),serverURL:f?.serverURL,merger:void 0===f?null:new sl({serverURL:f.serverURL,...void 0!==f.apiRoute?{apiRoute:f.apiRoute}:{},...void 0!==f.depth?{depth:f.depth}:{},...void 0!==f.fetchFn?{fetchFn:f.fetchFn}:{},log:o}),mergeWindowMs:e.debounceMs??50,scopeBindingsByOwner:!0===e.scopeBindingsByOwner,subfieldCoverage:e.subfieldCoverage??"descendant",lockedOrigin:e.lockedOrigin??(()=>{}),skipUnchanged:!0===e.skipUnchanged,dependencies:e.dependencies??{},strategies:e.strategies??{},revealEditedField:!0===e.revealEditedField,onUnfaithfulPatch:r(e),autoBind:e.autoBind??"off",hydration:e.hydration},this.writer=new vr(this.deps,this.state),this.pipeline=new Ro(this.deps,this.state,()=>{this.rebuildCache()})}start(){let{state:e}=this;if(e.isRunning()||this.closingSession)return!1;e.suspended&&(this.replayRetainedOnStart=!0),e.started=!0,e.suspended=!1,this.openScope();try{return function(e){"react"===e.hydration?Qe():"vue"===e.hydration&&nt();let{root:t}=e;if(!ot(t)||"loading"!==t.readyState){rt(e);return}let i=()=>{e.isRunning()&&e.later(()=>{rt(e)})};t.addEventListener("DOMContentLoaded",i,{once:!0}),e.defer(()=>{t.removeEventListener("DOMContentLoaded",i)})}(this.startupHost()),!0}catch(e){throw this.rollbackFailedStart(),e}}startupHost(){let{state:e,deps:t}=this;return{root:t.root,hydration:t.hydration,isRunning:()=>e.isRunning(),defer:t=>{e.deferredStart=t,this.scope?.own(()=>{e.deferredStart===t&&(e.deferredStart=null,t())})},later:t=>{e.deferredStart=null;try{t()}catch(e){this.rollbackFailedStart(),this.reportError(e,"startup","LP0605")}},hydrated:t=>{e.hydration=t},warn:t.warn,startNow:()=>{this.startNow()}}}startNow(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=ot(t.root)?at(t.root):t.root;if(null===i)throw new Error("LivePreviewRuntime: document.body unavailable");if(t.observers.start(i),this.observedRoot=i,this.watchRootReplacement(),this.buildCacheAndObserve(),!e.isRunning()||(t.bus.attach(),t.emitter.emitWhile("init",{timestamp:Date.now()},()=>e.isRunning()),!e.isRunning()))return;let n=this.replayRetainedOnStart;this.replayRetainedOnStart=!1;let r=n&&t.heartbeat.resume();if(e.isRunning()&&(!n||r||(e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.navigationReplayPending=!0,t.bus.replayLastAccepted()||(e.navigationReplayPending=!1),e.isRunning())))for(let i of Fo){if(!e.isRunning())return;0===i?t.sendReady(t.readyTargets()):e.readyTimers.push(setTimeout(()=>{e.isRunning()&&this.sendReadyAfterStart()},i))}}suspend(){if(!this.state.isRunning())return!1;let e=this.release();return this.state.suspended=!0,e&&this.deps.emitter.emit("disconnect",{reason:"unload",timestamp:Date.now()}),!0}destroy(){let{state:e,deps:t}=this;if(!e.isRunning()&&!e.suspended)return;let i=!!e.isRunning()&&this.release();e.suspended=!1,this.replayRetainedOnStart=!1,t.bus.forgetLastAccepted(),i&&t.emitter.emit("disconnect",{reason:"destroy",timestamp:Date.now()}),t.a11y?.detach(),t.emitter.emit("destroy",{timestamp:Date.now()})}openScope(){let{state:e,deps:t}=this,i=new yl(t.log);i.own(()=>{t.merger?.destroy(),e.merges.destroy()}),i.own(()=>{t.scheduler.destroy()}),i.own(()=>{t.observers.stop()}),i.own(()=>{this.rootSentinel?.disconnect(),this.rootSentinel=null,this.observedRoot=null}),i.own(()=>{e.abortStrategies()}),i.own(()=>{t.bus.detach()}),i.own(()=>{t.heartbeat.stop()}),i.own(()=>{for(let t of e.readyTimers)clearTimeout(t);e.readyTimers.length=0}),this.scope=i}release(){let{state:e,deps:t}=this;e.display.end(),e.activeUpdate=null,e.navigationBindingReplay=!1,e.started=!1;let i=this.scope;this.scope=null,this.closingSession=!0;try{i?.close()}finally{this.closingSession=!1}return t.cache.clear(),t.connection.markDisconnected()}rollbackFailedStart(){this.release();try{this.deps.a11y?.detach()}catch(e){this.deps.log("runtime cleanup failed:",e)}}refreshCache(){this.state.isRunning()&&(this.state.revealer.reset(),this.followReplacedRoot()||this.rebuildCache())}navigationCommit(){let{state:e,deps:t}=this;!e.isRunning()||null!==e.deferredStart||(this.cancelActiveUpdate(!0),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!0),e.forgetOwedWork(),e.merges.resetRawChanges(),e.unfaithfulPatches=[],e.revealer.reset(),e.lastAppliedIdentity=new WeakMap,e.changes.reset(),e.isRunning()&&(t.bus.advanceGeneration(),e.navigationReplayPending=!0,this.followReplacedRoot()||this.rebuildCache(),e.isRunning()&&(t.bus.replayLastAccepted(),e.isRunning()&&this.sendReadyAfterStart())))}watchRootReplacement(){let{root:e}=this.deps;!ot(e)||typeof MutationObserver>"u"||(this.rootSentinel?.disconnect(),this.rootSentinel=new MutationObserver(()=>{this.followReplacedRoot()}),this.rootSentinel.observe(e.documentElement,{childList:!0}))}followReplacedRoot(){let{root:e}=this.deps;if(!this.state.isRunning()||!ot(e))return!1;let t=at(e);return null!==t&&t!==this.observedRoot&&(this.observedRoot=t,this.deps.observers.start(t),this.rebuildCache(),!0)}get status(){return this.deps.connection.status}get cache(){return this.deps.cache}get updateCount(){return this.state.updateCount}get protocol(){return this.state.protocol.negotiation}inspect(){return function(e,t){let{cache:i,scheduler:n}=e,r=t.protocol.negotiation,l=t.activeUpdate,o=t.lastFlush,a=[],s=new Set,u=[];for(let[e,t]of i.entries()){a.push(e);for(let i of t)void 0!==i.owner&&s.add(i.owner),void 0!==i.guessed&&u.push({field:e,matched:i.guessed,attribute:i.targetAttribute??("IMG"===i.element.tagName?"src":void 0)})}return{version:ul,started:t.started,status:e.connection.status,origins:{trusted:[...e.readyTargets()],locked:e.lockedOrigin()},protocol:{ours:r.ours,theirs:r.theirs,negotiated:r.negotiated,capabilities:[...r.capabilities].sort(),observed:[...r.observed].sort(),profile:Ge(r.observed).name},revisions:{accepted:t.updateCount,superseded:t.supersededCount,completed:t.completedCount,skippedUnchanged:t.skippedUnchangedCount,active:null===l?void 0:l.revision.revision,display:t.display.snapshot()},bindings:{elements:i.elementCount,fields:i.fieldCount,fieldNames:a.sort(),absentFields:[...t.absentFields].sort(),orphanFields:[...t.warnedOrphanFields].sort(),ownerScoped:e.scopeBindingsByOwner,owners:[...s].sort(),guessed:u.sort((e,t)=>e.field.localeCompare(t.field)),autoBind:{mode:e.autoBind,searchMs:t.autoBindSearchMs}},route:{handler:void 0!==e.strategies.route,...t.routeStats},fidelity:{mode:e.onUnfaithfulPatch,canEscalate:void 0!==e.strategies.fragment||void 0!==e.strategies.route,unfaithful:t.unfaithfulCount,escalated:t.escalatedCount,fields:[...t.unfaithfulFields].sort()},hydration:{mode:e.hydration??"off",state:t.hydration},fragments:{handler:void 0!==e.strategies.fragment,inFlight:l?.pendingFragments??0,...t.fragmentStats},scheduler:{pending:n.pendingCount,deferred:n.replayCount,visibilityGateThreshold:n.gateThreshold,visibilityGateActive:n.gateActive,lastFlush:null===o?void 0:{applied:o.applied,appliedFields:o.appliedFields,deferred:o.deferred,durationMs:o.durationMs}},plugins:[],renderers:Object.keys(e.renderers).sort()}}(this.deps,this.state)}buildCacheAndObserve(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=t.cache.buildFromRoot(t.root);if(t.log("cache",i),e.isRunning()&&(t.emitter.emitWhile("cacheRefresh",i,()=>e.isRunning()),e.isRunning()))for(let i of t.cache.values()){if(!e.isRunning())return;t.observers.observeElement(i.element)}}rebuildCache(){let{state:e,deps:t}=this;if(!e.isRunning())return;let i=new Map,n=t.cache.islandOwners,r=new Set(t.cache.navigationReplayRoots);for(let e of t.cache.values())i.set(e.element,e),t.observers.unobserveElement(e.element);if(this.buildCacheAndObserve(),!e.isRunning())return;let l=new Set(t.cache.navigationReplayRoots.filter(e=>!r.has(e)));for(let e of t.cache.values()){let n=i.get(e.element);void 0!==n&&Ne(n,e)?t.scheduler.retarget(e):(t.scheduler.forget(e.element),l.add(e.element)),i.delete(e.element)}for(let e of i.values())t.scheduler.forget(e.element);l.size>0&&this.pipeline.reapplyNavigationBindings(l);let o=t.cache.islands.filter(e=>!n.has(e)||t.scopeBindingsByOwner&&n.get(e)!==t.cache.islandOwners.get(e));o.length>0&&this.pipeline.reapplyNavigationIslands(o)}onHeartbeatTimeout(){let{state:e,deps:t}=this;if(!e.isRunning()||(this.cancelActiveUpdate(!1),t.merger?.destroy(),e.merges.destroy(),e.abortStrategies(),this.cancelActiveUpdate(!1),!e.isRunning()))return;t.bus.advanceGeneration(),t.bus.forgetLastAccepted(),e.navigationBindingReplay=!1;let i=t.connection.markDisconnected();try{t.onHeartbeatTimeout?.()}catch(e){t.log("heartbeat:",e)}e.isRunning()&&(i&&this.isIdleDisconnected()&&(t.a11y?.announceDisconnected(),t.emitter.emitWhile("disconnect",{reason:"timeout",timestamp:Date.now()},()=>this.isIdleDisconnected()),!e.isRunning()||(this.isIdleDisconnected()&&t.log("connection","connected","\\u2192","disconnected"),!e.isRunning()))||this.sendReadyAfterStart())}cancelActiveUpdate(e){let{state:t,deps:i}=this,n=t.activeUpdate;t.display.end(),t.activeUpdate=null,null!==n&&(n.cancelled=!0,i.scheduler.cancelRevision(n.revision),e&&!n.completed&&n.countsAsUpdate&&(t.supersededCount+=1))}sendReadyAfterStart(){try{this.deps.sendReady(this.deps.readyTargets())}catch(e){this.reportError(e,"ready","LP0606")}}reportError(e,t,i){let n=e instanceof Error?e:new Error(String(e));this.deps.emitter.emit("error",{error:n,context:t,code:i})}isIdleDisconnected(){return this.state.isRunning()&&"disconnected"===this.deps.connection.status&&null===this.state.activeUpdate}},Mo=/^https?:\\/\\/(localhost|127\\.0\\.0\\.1)(?::\\d+)?$/i,Eo=/^https?:\\/\\/[^/?#\\s]+$/i,Oo=[3e3,3001,3333,4e3,4321,5e3,5173,5174,8e3,8080,8888,9e3],xo=class{constructor(e={}){mn(this,Lo);let t=new Set;for(let i of e.additionalOrigins??[]){let e=bi(i);void 0!==e&&t.add(e)}let i;if(e.enableReferrerDetection??1){let t=e.referrer??(typ','eof document<"u"?document.referrer:"");if(t.length>0)try{let e=new URL(t).origin;e&&"null"!==e&&(i=e)}catch{}}let n=(e.enableLocalhostMatching??!0)&&(e.forceDevMode??function(){let e=function(){if(!(typ','eof process>"u"))return"production"}();if(void 0!==e)return"production"!==e;if(typ','eof window<"u"){let e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e}return!1}());vn(this,Lo,[t,i,n,void 0!==i,void 0,typeof location>"u"?void 0:location.ancestorOrigins?.[0]])}matches(e){return 0!==e.length&&"null"!==e&&(void 0!==gn(this,Lo)[4]?e===gn(this,Lo)[4]:!!(gn(this,Lo)[0].has(e)||0===gn(this,Lo)[0].size&&void 0!==gn(this,Lo)[1]&&e===gn(this,Lo)[1]||gn(this,Lo)[2]&&Mo.test(e)))}lockOrigin(e){return!!this.matches(e)&&(gn(this,Lo)[4]=e,!0)}unlockOrigin(){let e=gn(this,Lo)[4];return gn(this,Lo)[4]=void 0,e}get lockedOrigin(){return gn(this,Lo)[4]}enumerate(){if(void 0!==gn(this,Lo)[4])return[gn(this,Lo)[4]];let e=new Set(gn(this,Lo)[0]);0===gn(this,Lo)[0].size&&void 0!==gn(this,Lo)[1]&&e.add(gn(this,Lo)[1]);let t=gn(this,Lo)[5];if(gn(this,Lo)[2]&&void 0!==t)Mo.test(t)&&e.add(t);else if(gn(this,Lo)[2])for(let t of Oo)e.add(`http://localhost:${String(t)}`),e.add(`http://127.0.0.1:${String(t)}`);return[...e]}get referrerWasAvailable(){return gn(this,Lo)[3]}get isProductionUnconfigured(){return!(!yi()||gn(this,Lo)[0].size>0||gn(this,Lo)[2]||void 0!==gn(this,Lo)[1])}get isReferrerOnlyTrust(){return!(gn(this,Lo)[0].size>0||gn(this,Lo)[2])&&void 0!==gn(this,Lo)[1]}},Lo=new WeakMap,Po="astro:page-load",Uo="astro:after-swap",Io={1:"left",2:"center",3:"right",4:"justify"},jo=new Set(["left","center","right","justify","start","end"]),Do=new Set(["h1","h2","h3","h4","h5","h6"]),Wo=\' target="_blank" rel="noopener noreferrer"\',Bo=(e,t)=>{let i=t.renderChildren(e.children??[]),n=Ti(e.fields),r=function(e,t){if("internal"===t?.linkType)return function(e){let t=Ti(Ti(e)?.value),i=t?.url;if("string"==typeof i&&i.length>0)return i;let n=t?.slug;return"string"==typeof n&&n.length>0?`/${n}`:void 0}(t.doc);let i=t?.url??e.url;return"string"==typeof i&&i.length>0?i:void 0}(e,n);if(void 0===r||!N(r))return i;let l="string"==typeof e.title?` title="${Vt(e.title)}"`:"";return`<a href="${qt(r)}"${function(e,t,i){if(!0===t?.newTab||M(i))return Wo;let n="string"==typeof e.target?e.target:"";return""===n?"":"_blank"===n?Wo:` target="${Vt(n)}"`}(e,n,r)}${l}>${i}</a>`},_o=new Map,zo=".lp-block:empty,.lp-inline-block:empty",Vo={text:e=>{let t=Vt("string"==typeof e.text?e.text:""),i="number"==typeof e.format?e.format:0;return!!(16&i)&&(t=`<code>${t}</code>`),!!(1&i)&&(t=`<strong>${t}</strong>`),!!(2&i)&&(t=`<em>${t}</em>`),!!(8&i)&&(t=`<u>${t}</u>`),!!(4&i)&&(t=`<s>${t}</s>`),!!(32&i)&&(t=`<sub>${t}</sub>`),!!(64&i)&&(t=`<sup>${t}</sup>`),!!(128&i)&&(t=`<mark>${t}</mark>`),t},paragraph:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<p${Ai(e)}${ki(e)}>${i}</p>`},heading:(e,t)=>{let i="string"==typeof e.tag?e.tag.toLowerCase():"h2",n=Do.has(i)?i:"h2",r=t.renderChildren(e.children??[]);return`<${n}${Ai(e)}${ki(e)}>${r}</${n}>`},list:(e,t)=>{let i="string"==typeof e.listType?e.listType:"bullet",n="number"===i?"ol":"ul",r="number"===i&&"number"==typeof e.start&&e.start>1?` start="${String(e.start)}"`:"",l="check"===i?\' role="list"\':"",o=t.renderChildren(e.children??[]);return`<${n}${Ai(e)}${ki(e)}${r}${l}>${o}</${n}>`},listitem:(e,t)=>{let i=t.renderChildren(e.children??[]);if("boolean"==typeof e.checked)return`<li role="checkbox" aria-checked="${e.checked?"true":"false"}"${ki(e)}>${i}</li>`;let n="number"==typeof e.value?` value="${Vt(String(e.value))}"`:"";return`<li${Ai(e)}${ki(e)}${n}>${i}</li>`},link:Bo,autolink:Bo,quote:(e,t)=>{let i=t.renderChildren(e.children??[]);return`<blockquote${Ai(e)}${ki(e)}>${i}</blockquote>`},code:e=>{let t=$i("string"==typeof e.language?e.language:"");return`<pre><code${""===t?"":` class="language-${t}"`}>${Vt(Mi(e))}</code></pre>`},"code-highlight":e=>{let t="string"==typeof e.text?e.text:"";return`<span${"string"==typeof e.highlightType?` class="token-${$i(e.highlightType)}"`:""}>${Vt(t)}</span>`},linebreak:()=>"<br>",horizontalrule:()=>"<hr>",tab:()=>"\\t",upload:e=>{let t=Ci(e.value);if(void 0===t)return"";let i=t.url;if("string"!=typeof i||!N(i))return"";let n="string"==typeof t.mimeType?t.mimeType:"";return n.startsWith("video/")?function(e,t){return`<video controls${Ei(e)}><source src="${qt(t)}"${Oi(e)}></video>`}(t,i):n.startsWith("audio/")?function(e,t){return`<audio controls><source src="${qt(t)}"${Oi(e)}></audio>`}(t,i):""===n||n.startsWith("image/")?function(e,t){let i="string"==typeof e.alt?Vt(e.alt):"";return`<img src="${qt(t)}" alt="${i}"${Ei(e)} loading="lazy" decoding="async">`}(t,i):function(e,t){let i="string"==typeof e.filename?Vt(e.filename):Vt(t);return`<a href="${qt(t)}" target="_blank" rel="noopener noreferrer">${i}</a>`}(t,i)},relationship:e=>{let t="string"==typeof e.relationTo?e.relationTo:"",i=Ti(e.value),n=Vt((i&&Ni(i))??`#${t}`),r=$i(t),l=""===r?\' class="lp-relation"\':` class="lp-relation lp-relation--${r}"`,o=i?.url;return"string"==typeof o&&N(o)?`<a href="${qt(o)}"${l}>${n}</a>`:`<span${l}>${n}</span>`},block:(e,t)=>Li(e,t,"div","lp-block"),inlineBlock:(e,t)=>Li(e,t,"span","lp-inline-block"),table:(e,t)=>`<table${Ai(e)}><tbody>${t.renderChildren(e.children??[])}</tbody></table>`,tablerow:(e,t)=>`<tr>${t.renderChildren(e.children??[])}</tr>`,tablecell:(e,t)=>{let i="number"==typeof e.headerState?e.headerState:0,n=3&i?"th":"td";return`<${n}${1===i?\' scope="col"\':2===i?\' scope="row"\':""}${Pi("colspan",e.colSpan)}${Pi("rowspan",e.rowSpan)}>${t.renderChildren(e.children??[])}</${n}>`}},qo=new Map,Ho=!1,Go="data-payload-text",Ko=new Set,Jo=new Set,Xo=new Set(["DIV","SECTION","ARTICLE"]),Qo={name:"richText",render:O((e,t,i)=>{let n=e.element;if(Qt(t)){n.textContent="";return}let r=i.sanitizerPolicy;if(void 0!==i.renderRichText){let l=i.renderRichText(t,{fieldName:e.fieldName,element:n,locale:i.locale});n.innerHTML=$t(It(l,r));return}if(Ui(t)){if(pe(t)){n.textContent="";return}let l=new Map,o=Wi(n,It(function(e,t={}){if(!Ui(e))return"";let i=function(e){let t={renderChildren:e=>{let i="";for(let n of e)i+=Ii(n,t);return i},resolveAlignment:wi,resolveIndent:Si,onUnrenderedBlock:e};return t}(t.onUnrenderedBlock).renderChildren(e.root.children);return!1===t.sanitize?i:void 0!==t.document?Ut(i,{document:t.document}):!0===t.requireDocument||void 0!==Wt()?Ut(i):(function(){if(!Ho){Ho=!0;try{console.warn(\'[live-preview] lexicalToHtml() has no sanitizer document and returned unsanitised HTML; pass { document } (linkedom, jsdom) per call. 3.0 throws here instead: opt in now with { requireDocument: true }. See "HTML sanitization" in docs/security.md.\')}catch{}}}(),i)}(t,{sanitize:!1,onUnrenderedBlock:(e,t)=>{l.set(t,e)}}),r));for(let[t,n]of o){let r=l.get(t);void 0!==r&&_i(e,i,r,n)}return}if("string"!=typeof t)return!1;n.innerHTML=$t(It(t,r))})},Zo={name:"html",render(e,t,i){if(Qt(t)){e.element.textContent="";return}let n="string"==typeof t?t:Xt(t);e.element.innerHTML=$t(It(n,i.sanitizerPolicy))}},Yo=new WeakSet,ea=Vi("url"),ta=/^[a-zA-Z][a-zA-Z0-9+.-]*:/,ia=Vi("email",function(e){let t=e.trim();return ta.test(t)||!t.includes("@")?t:`mailto:${t}`}),na=["src","srcset","sizes"],ra=new WeakMap,la=/^\\S*[/.:]\\S*$/,oa={name:"image",render:O((e,t,i)=>{let n=e.element;if("IMG"===n.tagName&&e.altField===e.fieldName&&void 0===e.srcField&&("string"==typeof t||Qt(t))){n.alt=t??"";return}if(Qt(t)){Ji(n);return}let r=void 0!==e.locale,{media:l,candidate:o}=function(e,t,i,n){let r=void 0!==e.srcField&&e.srcField.length>0?L(i.allFields,e.srcField,i.locale,n):t,l=Ci(r);return{media:l,candidate:void 0===l?r:l.url}}(e,t,i,r);if(void 0===l&&"string"==typeof o&&!la.test(o.trim()))return!1;let a=zi(n,e.fieldName,o,void 0===l?void 0:i.serverURL);if("none"===a.kind)return!1;if("unsafe"!==a.kind){if("IMG"===n.tagName){let t=n;Hi(t,a.url,l,i.serverURL);let o=function(e,t,i,n,r){if(void 0!==t&&t.length>0){let e=L(i,t,n,r);return"string"==typeof e?e:void 0}return e?.alt}(l,e.altField,i.allFields,i.locale,r);void 0!==o&&(t.alt=o);return}n.style.backgroundImage=`url(\'${function(e){return e.replace(/[\'"()\\\\]/g,"\\\\$&")}(a.url)}\')`}else Ji(n)})},aa={name:"upload",render:O((e,t,i)=>{let n=e.element;if(Qt(t)){Xi(n);return}let r=Ci(t);if(void 0===r)return!1;let l=zi(n,e.fieldName,r.url,i.serverURL);if("none"===l.kind)return!1;if("unsafe"===l.kind){Xi(n);return}let o=l.url;if("IMG"===n.tagName){let e=n;Hi(e,o,r,i.serverURL),void 0!==r.alt&&(e.alt=r.alt);return}if("A"===n.tagName){n.setAttribute("href",o),n.textContent=r.filename??o;return}let a=Vt(r.filename??o);n.innerHTML=$t(`<a href="${qt(o)}">${a}</a>`)})},sa={name:"relationship",render(e,t){let i=e.element;if(Qt(t))i.removeAttribute("href"),i.textContent="";else{if("A"===i.tagName&&!Array.isArray(t)){let n=zi(i,e.fieldName,Ti(t)?.url);"safe"===n.kind?i.setAttribute("href",n.url):"unsafe"===n.kind&&i.removeAttribute("href")}i.textContent=Array.isArray(t)?t.map(Qi).join(", "):Qi(t)}}},ua={name:"select",render(e,t,i){let n=e.element,r=Qt(t)?[]:function(e){return Array.isArray(e)?e.map(Xt):[Xt(e)]}(t);if("SELECT"!==n.tagName){if("INPUT"===n.tagName&&"radio"===n.type){let e=n;e.checked=r.includes(e.value);return}n.textContent=r.map(e=>function(e,t){let i=t.schema?.options;if(!Array.isArray(i))return e;for(let t of i){let i=Ti(t);if(void 0!==i&&Xt(i.value)===e)return"string"==typeof i.label?i.label:e}return e}(e,i)).join(", ")}else!function(e,t){if(e.multiple)for(let i of Array.from(e.options))i.selected=t.includes(i.value);else e.value=t[0]??""}(n,r)}},da=new Set(["","false","0","off","no"]),ca={name:"checkbox",render(e,t){let i=e.element,n=function(e){return"boolean"==typeof e?e:"string"==typeof e?!da.has(e.trim().toLowerCase()):"number"==typeof e?0!==e:null!=e}(t);"INPUT"!==i.tagName||"checkbox"!==i.type?i.hasAttribute("aria-checked")?i.setAttribute("aria-checked",n?"true":"false"):i.textContent=n?"true":"false":i.checked=n}},ha=new Map,fa=new Map,pa=new Set(["short","medium","long","full"]),ga=new Set(["short","medium","long","full"]),ma=/^[A-Za-z]{3}$/u,va=/^[0-4]$/u,ya=new WeakSet,ba={name:"date",render(e,t,i){let n=e.element;if(Qt(t)){"INPUT"===n.tagName?n.value="":(n.removeAttribute("datetime"),n.textContent="");return}let r="number"==typeof t?t:Xt(t),l=new Date(r),o=!Number.isNaN(l.getTime()),a=String(r);"INPUT"!==n.tagName?("TIME"===n.tagName&&n.setAttribute("datetime",o?l.toISOString():a),n.textContent=o?function(e,t,i){let n=t.locale??i.locale??u(),r=nn("date",t.format,t.element,t.fieldName)??wa;try{return function(e,t){let i=Zi(e,t);return Zt(fa,i)??Yt(fa,i,new Intl.DateTimeFormat(e,t),64)}(n,r).format(e)}catch{return e.toISOString()}}(l,e,i):a):n.value=o?function(e,t){let i=`${String(t.getFullYear()).padStart(4,"0")}-${rn(t.getMonth()+1)}-${rn(t.getDate())}`,n=`${rn(t.getHours())}:${rn(t.getMinutes())}`;return"date"===e?i:"datetime-local"===e?`${i}T${n}`:"time"===e?n:t.toISOString()}(n.type,l):a}},wa={dateStyle:"medium",timeStyle:"short"},Sa={name:"number",render(e,t,i){let n=e.element;if(Qt(t)){"INPUT"===n.tagName?n.value="":n.textContent="";return}let r="number"==typeof t?t:Number(Xt(t));Number.isNaN(r)?n.textContent=Xt(t):"INPUT"!==n.tagName?n.textContent=function(e,t,i){let n=t.locale??i.locale??u(),r=nn("number",t.format,t.element,t.fieldName);try{return function(e,t){let i=Zi(e,t);return Zt(ha,i)??Yt(ha,i,new Intl.NumberFormat(e,t),64)}(n,r).format(e)}catch{return String(e)}}(r,e,i):n.value=String(r)}},Aa={name:"array",render:O((e,t,i)=>{let n=e.element;if(Qt(t)){n.textContent="";return}if(!Array.isArray(t))return!1;let r=e.arrayTemplate;if(void 0!==r&&r.length>0){let e=function(e,t){let i=Ht(t),n="";for(let r=0;r<t.length;r+=1)n+=Gt(e,t[r],r,Xt,i);return n}(r,t),l=i.sanitizerPolicy,o=ei(r),a=Kt(n);n.innerHTML=$t(It(e,l,o));for(let e of Array.from(n.children))Jt(e,a);return}n.textContent=t.map(Xt).join(e.arraySeparator??", ")})},ka=new Map;!function(){if(typ','eof window>"u"||!yi()&&(typ','eof window>"u"||null==window.opener))return;let e=window.__livePreview,t=JSON.stringify(dn());if(void 0!==e&&(void 0===e.configSignature||e.configSignature===t))return e.refresh(),e;let[i=[],n="",l="/api",o=1,a=!1,s=50,u=!0,d=0,c=!1,h=50,f="200px",p=!0,g=!1,m=!1,v=!0,y="parent-or-opener",b="strict",w,S=!1,A=!1,k,T,C="off",R,$,F=[],N="descendant"]=dn(),M=function(e){let t=typeof __LIVE_PREVIEW_FRAGMENT__<"u"?__LIVE_PREVIEW_FRAGMENT__:void 0,i=t??(typeof __LIVE_PREVIEW_ROUTE__<"u"?__LIVE_PREVIEW_ROUTE__:void 0);if(void 0===i)return;let n=i.createRouteStrategy();return void 0===t||void 0===e||""===e?{route:n}:{fragment:t.createFragmentStrategy({endpoint:e}),route:n}}(w),E=new xo({additionalOrigins:i,enableReferrerDetection:!p,enableLocalhostMatching:!g});E.isProductionUnconfigured?wn("[live-preview] LP0101: No trusted origin. Pass allowedOrigins to generateInlineScript() (or to the adapter) \\u2014 the runtime reads no environment variable in the browser."):E.isReferrerOnlyTrust&&wn("[live-preview] LP0102: document.referrer fallback trusts any framing site. Set allowedOrigins and a frame-ancestors CSP in production.");let O=new An,x=function(){let e=[Qo,Zo,ea,ia,oa,aa,sa,ua,{...ua,name:"radio"},ca,ba,Sa,Aa,{...Aa,name:"blocks"}];return function(e=[]){let t={};for(let i of e)t[i.name]=i;for(let[e,i]of ka)t[e]=i;return Object.freeze(t)}([Di("text"),Di("textarea"),...e,ln()])}(),L=new No({renderers:x,originMatcher:e=>E.matches(e),lockedOrigin:()=>E.lockedOrigin,readyTargets:()=>E.enumerate(),emitter:O,eventSourcePolicy:y,...""!==n?{dataMerge:{serverURL:n,apiRoute:l,depth:o}}:{},debounceMs:s,heartbeatMs:d,intersectionRootMargin:f,disableVisibilityGate:c,visibilityGateThreshold:h,enableA11y:u,scopeBindingsByOwner:m,subfieldCoverage:N,skipUnchanged:v,revealEditedField:S,onUnfaithfulPatch:r({onUnfaithfulPatch:T,onUnboundChange:k}),autoBind:C,...void 0!==R?{hydration:R}:{},sanitizerPolicy:b,...void 0!==M?{strategies:M}:{},onHeartbeatTimeout:()=>{E.unlockOrigin()},...a?{log:(...e)=>{Sn("[live-preview]",...e)}}:{}});O.on("connect",e=>{E.lockOrigin(e.origin)}),L.start(),e?.destroy();let P=function(e,t={}){let i=t.windowTarget??globalThis.window,n=t.documentTarget??globalThis.document,r=[...new Set(t.softNavigationEvents??[])],l=()=>{e.suspend()},o=t=>{!0===t.persisted&&e.resume()},a=!1,s=()=>{a=!0},u=t=>{if(t.type===Po){if(!a)return;a=!1}void 0===e.refreshAfterNavigation?e.refreshCache():e.refreshAfterNavigation()},d=!1;i?.addEventListener("pagehide",l),i?.addEventListener("pageshow",o);for(let e of r)n?.addEventListener(e,u);let c=r.includes(Po);return c&&n?.addEventListener(Uo,s),()=>{if(!d){d=!0,i?.removeEventListener("pagehide",l),i?.removeEventListener("pageshow",o);for(let e of r)n?.removeEventListener(e,u);c&&n?.removeEventListener(Uo,s)}}}({suspend:()=>L.suspend(),resume:()=>L.start(),refreshCache:()=>{L.refreshCache()},refreshAfterNavigation:()=>{L.navigationCommit()}},{softNavigationEvents:F}),U=Object.freeze({version:ul,configSignature:t,destroy:()=>{P(),L.destroy();let e=window;e.__livePreview===U&&delete e.__livePreview},refresh:()=>{L.refreshCache()},refreshAfterNavigation:()=>{L.navigationCommit()},enumerateOrigins:()=>E.enumerate(),inspect:()=>L.inspect()});try{Object.defineProperty(window,"__livePreview",{value:U,writable:!1,configurable:!0})}catch(e){throw P(),L.destroy(),e}}()})();'].join(""),m=/* @__PURE__ */['"use strict";var __LIVE_PREVIEW_FRAGMENT__=(()=>{var P=Object.defineProperty;var fe=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var ye=Object.prototype.hasOwnProperty;var pe=(e,t)=>{for(var n in t)P(e,n,{get:t[n],enumerable:!0})},ge=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of me(t))!ye.call(e,o)&&o!==n&&P(e,o,{get:()=>t[o],enumerable:!(a=fe(t,o))||a.enumerable});return e};var he=e=>ge(P({},"__esModule",{value:!0}),e);var Ye={};pe(Ye,{createFragmentStrategy:()=>ce,createRouteStrategy:()=>ue});function k(e,t){let n=new AbortController,a=!1,o=()=>{n.abort()};e.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>{a=!0,n.abort()},t);return{signal:n.signal,timedOut:()=>a,dispose:()=>{clearTimeout(r),e.removeEventListener("abort",o)}}}function R(e){return e instanceof Error?e.message:String(e)}var D="data-payload-island",Qe=`astro-island, [${D}]`,w="data-payload-owned",be="data-payload-morph";function F(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(be)||z(e)||e.hasAttribute(w))return!0;let n=e.getAttribute("contenteditable");return n!==null&&n!=="false"}function Ee(e){return e.tagName.toLowerCase()==="astro-island"||e.hasAttribute(D)}function Se(e){return e.getAttribute(D)==="patch"}function z(e){return Ee(e)&&!Se(e)}function V(e){let t=e;for(;t!==null;){if(z(t))return!0;t=t.parentElement}return!1}var Re=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],v=new WeakMap,G=new WeakSet;function W(e){return e.tagName.toLowerCase()==="astro-island"}function q(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]")){if(n.parentElement?.closest("astro-island")!==e)continue;let a=n.getAttribute("name")??n.getAttribute("data-astro-template")??"";t+=`${a}\\0${n.innerHTML}\\0`}return t}function Ae(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return t!==void 0&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}function j(e,t){if(!W(e)||!W(t))return!0;let n=q(t);if(!(Re.every(r=>e.getAttribute(r)===t.getAttribute(r))&&(v.get(e)??q(e))===n&&(e.getAttribute("props")===t.getAttribute("props")||Ae(e))))return v.set(t,n),!1;v.set(e,n);let o=t.getAttribute("props");return o!==e.getAttribute("props")&&(e.setAttribute("ssr",""),o===null?e.removeAttribute("props"):e.setAttribute("props",o)),!0}function Y(e){return Array.from(e.querySelectorAll("astro-island"))}function X(e){for(let t of e)t.isConnected||G.has(t)||(G.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}function O(e){if(e==null)return[];let t=new Set,n=[];for(let a of e.split(/[\\s,]+/)){let o=a.trim();o.length===0||t.has(o)||(t.add(o),n.push(o))}return n}var A="data-payload-fragment",I="data-payload-fragment-key";var Te="data-payload-depends";function B(e){let t=e.getAttribute(A);if(t===null||t.length===0)return null;let n=e.getAttribute(I);return{element:e,id:t,key:n===null||n.length===0?void 0:n,dependsOn:O(e.getAttribute(Te))}}function J(e,t){let n=[];for(let a of e.querySelectorAll(`[${A}]`)){let o=B(a);o===null||V(a)||o.dependsOn.length>0&&!o.dependsOn.some(r=>t.has(r))||n.push(o)}return n}var Q="x-payload-fragment-version";function _(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Z(e){if(!_(e))return null;let{html:t,boundary:n,revision:a,metadata:o}=e;return typeof t!="string"||!_(n)||typeof n.id!="string"||n.key!==void 0&&typeof n.key!="string"||typeof a!="number"||!_(o)||typeof o.renderedAt!="string"||typeof o.renderer!="string"?null:e}function ee(e){let t={};for(let[n,a]of Object.entries(e))a!==void 0&&(t[n]=a);return t}function L(e){return e.reason instanceof Error?e.reason:new DOMException("The operation was aborted.","AbortError")}function C(e){return e?.aborted===!0}function te(e){let t=0,n=[],a=()=>{let o=n.shift();o===void 0?t-=1:o.resume()};return async(o,r)=>{if(r!==void 0&&C(r))throw L(r);if(t<e)t+=1;else if(await new Promise((d,m)=>{let l=()=>{},u={resume:()=>{l(),d()}};if(n.push(u),r!==void 0){let s=()=>{let c=n.indexOf(u);c!==-1&&(n.splice(c,1),l(),m(L(r)))};l=()=>{r.removeEventListener("abort",s)},r.addEventListener("abort",s,{once:!0}),C(r)&&s()}}),r!==void 0&&C(r))throw a(),L(r);try{return await o()}finally{a()}}}var xe=5e3,ke=4,Fe=512*1024,T={status:"superseded"};function b(e,t){return{status:"failed",code:e,reason:t}}function Oe(e){let t=()=>{throw new TypeError(\'createFragmentStrategy: endpoint must be a same-origin path starting with "/"\')};if((typeof e!="string"||!e.startsWith("/")||e.startsWith("//")||e.includes("\\\\"))&&t(),typeof location<"u"){let n;try{n=new URL(e,location.href)}catch{n=void 0}n?.origin!==location.origin&&t()}return e}function Ie(e){return typeof e=="object"&&e!==null&&typeof e.getReader=="function"}async function Ne(e,t,n){let a=e.body;if(!Ie(a)){let u=await e.text();return new TextEncoder().encode(u).byteLength>t?null:u}let o=a.getReader(),r=()=>{o.cancel().catch(()=>{})};n.addEventListener("abort",r,{once:!0});let d=new TextDecoder,m="",l=0;try{for(;;){let{done:u,value:s}=await o.read();if(u)break;if(l+=s.byteLength,l>t)return r(),null;m+=d.decode(s,{stream:!0})}}finally{n.removeEventListener("abort",r),o.releaseLock()}return m+d.decode()}function ne(e){let t=Oe(e.endpoint),n=e.timeoutMs??xe,a=e.maxResponseBytes??Fe,o=te(Math.max(1,e.maxConcurrent??ke)),r=new Map,d=new WeakMap,m=0,l=s=>{let c=d.get(s);return c!==void 0?c:(m+=1,d.set(s,m),m)};async function u(s,c){let i=()=>s.signal.aborted;if(i())return T;let h=e.location??location,p=ee({fragment:c.id,key:c.key,route:h.pathname,search:h.search,revision:s.revision,locale:s.locale,collectionSlug:s.collectionSlug,globalSlug:s.globalSlug,fields:s.fields}),f=k(s.signal,n),y=E=>i()?T:f.timedOut()?b("LP0801",`timeout after ${String(n)} ms`):b("LP0801",R(E)),g,x=!1;try{try{g=await(e.fetch??fetch)(t,{method:"POST",credentials:"same-origin",headers:{...e.headers,accept:"application/json","content-type":"application/json",[Q]:String(1)},body:JSON.stringify(p),signal:f.signal})}catch(M){return y(M)}if(i())return T;if(g.status===401||g.status===403)return b("LP0803",`endpoint refused the preview (${String(g.status)})`);if(!g.ok)return b("LP0801",`endpoint answered ${String(g.status)}`);let E=g.headers.get("content-type")??"";if(!E.toLowerCase().startsWith("application/json"))return b("LP0802",`unexpected content type "${E}"`);if(Number(g.headers.get("content-length")??"0")>a)return b("LP0802","response exceeds the size limit");if(f.signal.aborted)return y(f.signal.reason);let N;try{x=!0,N=await Ne(g,a,f.signal)}catch(M){return y(M)}if(i())return T;if(f.timedOut())return b("LP0801",`timeout after ${String(n)} ms`);if(N===null)return b("LP0802","response exceeds the size limit");let $;try{$=JSON.parse(N)}catch{return b("LP0802","response is not JSON")}let S=Z($);return S===null?b("LP0802","response has the wrong shape"):S.boundary.id!==c.id||S.boundary.key!==c.key?b("LP0802","response is for another boundary"):S.revision!==s.revision?T:{status:"rendered",html:S.html,metadata:S.metadata}}finally{if(f.dispose(),g!==void 0&&!x)try{g.body?.cancel().catch(()=>{})}catch{}}}return(s,c)=>{let i=JSON.stringify([l(s.signal),c.id,c.key,s.revision]),h=r.get(i);if(h!==void 0)return h;let p=!1,f=o(()=>(p=!0,u(s,c)),s.signal).catch(g=>{if(!p&&s.signal.aborted)return T;throw g});r.set(i,f);let y=()=>{r.get(i)===f&&r.delete(i)};return f.then(y,y),f}}var Me=new Set(["open","value","checked","selected"]);function oe(e,t){for(let n of t.keyAttributes){let a=e.getAttribute(n);if(a!==null&&a.length>0)return`${n}=${a}`}}function H(e,t,n){if(!U(e,t))return t;let a=n.boundary??F,o=a(e),r=a(t);if(o||r)return!o||!r?t:n.retainBoundary?.(e,t)??!0?e:t;let d=_e(e);return Pe(e,t),n.retainChildrenOf?.(e,t)!==!0&&ve(e,t,n),Le(d),e}function Pe(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||Me.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function ve(e,t,n){let a=Be(e,n),o=new Set(a.values()),r=Array.from(e.childNodes).filter(c=>!o.has(c)),d=new Set,m=new Set,l=Array.from(t.childNodes),u=e.firstChild,s=0;for(let c=0;c<l.length;c+=1){let i=l[c],h=null,p=i instanceof Element?oe(i,n):void 0;if(p!==void 0&&m.has(p)&&(p=void 0),p!==void 0){m.add(p);let y=a.get(p);if(y!==void 0&&!d.has(y)&&(h=re(y,i,n)===y?y:null,h===null)){y.replaceWith(i),d.add(i),u=i.nextSibling;continue}}else{for(;s<r.length;){let y=r[s];if(s+=1,!d.has(y)){if(U(y,i)){h=re(y,i,n)===y?y:null,h===null&&(e.replaceChild(i,y),d.add(i),u=i.nextSibling);break}if(y instanceof Element){let g=l[c+1];if(!(i instanceof Element)||g!==void 0&&U(y,g)){s-=1;break}e.replaceChild(i,y),d.add(i),u=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,y),d.add(i),u=i.nextSibling;break}}}if(h===null&&d.has(i))continue}let f=h??i;for(d.add(f);u!==null&&u!==f&&!d.has(u)&&De(u);)u=u.nextSibling;f!==u&&e.insertBefore(f,u),u=f.nextSibling}for(let c of Array.from(e.childNodes))d.has(c)||c.remove()}function re(e,t,n){return e instanceof Element&&t instanceof Element?H(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function De(e){return e.nodeType===Node.TEXT_NODE&&(e.nodeValue??"").trim().length===0}function U(e,t){return e.nodeType!==t.nodeType?!1:e instanceof Element&&t instanceof Element?e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI:!0}function Be(e,t){let n=new Map,a;for(let o of Array.from(e.children)){let r=oe(o,t);if(r!==void 0){if(n.has(r)){a??(a=r.slice(r.indexOf("=")+1));continue}n.set(r,o)}}return a!==void 0&&t.onDuplicateKey?.(e,a),n}function _e(e){let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t))return null;let n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null;return{element:t,selection:n}}function Le(e){if(e===null)return;let{element:t,selection:n}=e;if(!(t.ownerDocument.activeElement===t||!t.isConnected))try{t.focus({preventScroll:!0});let[a,o]=n??[null,null];a!==null&&o!==null&&t.setSelectionRange(a,o)}catch{}}var ae="data-payload-key";var Ce="__livePreviewRouteRefresh";function Ue(){return typ','eof window>"u"?void 0:window}function ie(){return Ue()?.[Ce]}var le="data-payload-strategy",de="data-payload-field",He="data-payload-depends",Ke="x-payload-live-preview",$e=8e3,Ge="route refresh returned no promise; re-applied before the host committed (see LivePreviewRouteRefresh)",We=1e3;function qe(e){let t=e.getAttribute(le);return t!==null?t==="route":e.closest("head")!==null}function ze(e){let t=e.getAttribute(de),n=O(e.getAttribute(He));return t===null||t.length===0?n:[t,...n]}function se(e){return e.hasAttribute(w)?!1:e.tagName==="META"?e.hasAttribute("name")||e.hasAttribute("property"):e.tagName==="LINK"&&e.getAttribute("rel")==="canonical"}function Ve(e,t){let n=Array.from(e.head.children).find(l=>l.tagName==="TITLE"),a=Array.from(t.head.children).find(l=>l.tagName==="TITLE");!n?.hasAttribute(w)&&!a?.hasAttribute(w)&&t.title!==e.title&&(e.title=t.title);let o=Array.from(e.head.children).filter(se),r=Array.from(t.head.children).filter(se),d=Math.min(o.length,r.length);o.slice(0,d).forEach((l,u)=>{let s=r[u];if(s===void 0)return;if(l.tagName===s.tagName){for(let i of Array.from(l.attributes))s.hasAttribute(i.name)||l.removeAttribute(i.name);for(let i of Array.from(s.attributes))l.getAttribute(i.name)!==i.value&&l.setAttribute(i.name,i.value);return}let c=e.importNode(s,!0);l.replaceWith(c),o[u]=c});let m=o.at(-1);for(let l of r.slice(o.length)){let u=e.importNode(l,!0);m===void 0?e.head.append(u):m.after(u),m=u}for(let l of o.slice(r.length))l.remove()}function ue(e={}){let t=e.timeoutMs??$e,n=e.minIntervalMs??We,a=-1/0,o=!1;return{plan(r,d,m){for(let l of r.querySelectorAll(`[${de}], [${le}="route"]`)){if(!qe(l)||m?.inScope(l)===!1)continue;let u=ze(l);if(u.length===0||u.some(s=>d.has(s)))return!0}return!1},async refresh(r){let d=Date.now(),m=n-(d-a);if(m>0)return r.retryAfter?.(m),r.log("LP0805",`route refresh for revision ${String(r.revision)} refused: the previous one was ${String(d-a)} ms ago`),"refused";a=d;let l=e.document??document,u=e.location??location,s=e.window??window,c=k(r.signal,t),i=h=>{if(r.signal.aborted)return"superseded";let p=c.timedOut()?`route refresh timed out after ${String(t)} ms`:R(h);return r.log("LP0801",p),"failed"};try{let h=ie();if(h!==void 0){try{let f=h();typeof f?.then!="function"&&!o&&(o=!0,r.log("LP0810",Ge)),await f}catch(f){return i(f)}return r.isCurrent()?"partial":"superseded"}let p;try{p=await(e.fetch??fetch)(u.href,{method:"GET",credentials:"same-origin",cache:"no-store",headers:{accept:"text/html",[Ke]:"route"},signal:c.signal})}catch(f){return i(f)}if(r.signal.aborted)return"superseded";if(!p.ok||!(p.headers.get("content-type")??"").includes("text/html"))return r.log("LP0802",`route answered ${String(p.status)} ${p.headers.get("content-type")??""}`),"failed";try{let f=await p.text();if(!r.isCurrent())return"superseded";let y=new DOMParser().parseFromString(f,"text/html"),g=s.scrollX,x=s.scrollY;Ve(l,y);let E=Y(l.body);return H(l.body,y.body,{boundary:F,retainBoundary:j,keyAttributes:[ae,I,A],retainChildrenOf:K=>K.hasAttribute(A)}),X(E),s.scrollTo(g,x),"partial"}catch(f){return i(f)}}finally{c.dispose()}}}}function je(e){return{plan:(t,n)=>J(t,n).map(a=>a.element),async render(t,n){let a={rendered:0,failed:0,superseded:0},o={revision:t.revision,receivedAt:t.receivedAt,fields:t.fields,locale:t.locale,collectionSlug:t.collectionSlug,globalSlug:t.globalSlug,signal:t.signal};return await Promise.all(n.map(async r=>{let d=B(r);if(d===null)return;let m;try{m=await e(o,d)}catch(l){m={status:"failed",code:"LP0801",reason:R(l)}}if(!t.isCurrent()||m.status==="superseded"){a.superseded+=1,t.log("LP0804",`fragment "${d.id}" for revision ${String(o.revision)} discarded as superseded`);return}if(m.status==="rendered"){t.morph(r,m.html),t.rendered(r,d.id,d.key),a.rendered+=1;return}t.failed(r,d.id,d.key,m.code,m.reason),t.isCurrent()&&t.patch(r),a.failed+=1})),a}}}function ce(e){return je(ne(e))}return he(Ye);})();'].join(""),v=/* @__PURE__ */['"use strict";var __LIVE_PREVIEW_ROUTE__=(()=>{var S=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var X=(e,t)=>{for(var n in t)S(e,n,{get:t[n],enumerable:!0})},J=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of V(t))!j.call(e,r)&&r!==n&&S(e,r,{get:()=>t[r],enumerable:!(a=G(t,r))||a.enumerable});return e};var Q=e=>J(S({},"__esModule",{value:!0}),e);var Re={};X(Re,{createRouteStrategy:()=>W});var T="data-payload-island",xe=`astro-island, [${T}]`,E="data-payload-owned",Z="data-payload-morph";function b(e){if(e.tagName.toLowerCase().includes("-")&&!e.hasAttribute(Z)||ne(e)||e.hasAttribute(E))return!0;let n=e.getAttribute("contenteditable");return n!==null&&n!=="false"}function ee(e){return e.tagName.toLowerCase()==="astro-island"||e.hasAttribute(T)}function te(e){return e.getAttribute(T)==="patch"}function ne(e){return ee(e)&&!te(e)}var re=["component-url","component-export","renderer-url","client","opts","before-hydration-url"],R=new WeakMap,I=new WeakSet;function N(e){return e.tagName.toLowerCase()==="astro-island"}function M(e){let t="";for(let n of e.querySelectorAll("astro-slot, template[data-astro-template]")){if(n.parentElement?.closest("astro-island")!==e)continue;let a=n.getAttribute("name")??n.getAttribute("data-astro-template")??"";t+=`${a}\\0${n.innerHTML}\\0`}return t}function oe(e){let t=e.ownerDocument.defaultView?.customElements.get("astro-island");return t!==void 0&&e instanceof t&&Array.isArray(t.observedAttributes)&&t.observedAttributes.includes("props")}function v(e,t){if(!N(e)||!N(t))return!0;let n=M(t);if(!(re.every(o=>e.getAttribute(o)===t.getAttribute(o))&&(R.get(e)??M(e))===n&&(e.getAttribute("props")===t.getAttribute("props")||oe(e))))return R.set(t,n),!1;R.set(e,n);let r=t.getAttribute("props");return r!==e.getAttribute("props")&&(e.setAttribute("ssr",""),r===null?e.removeAttribute("props"):e.setAttribute("props",r)),!0}function P(e){return Array.from(e.querySelectorAll("astro-island"))}function D(e){for(let t of e)t.isConnected||I.has(t)||(I.add(t),t.dispatchEvent(new CustomEvent("astro:unmount")))}var ae=new Set(["open","value","checked","selected"]);function C(e,t){for(let n of t.keyAttributes){let a=e.getAttribute(n);if(a!==null&&a.length>0)return`${n}=${a}`}}function w(e,t,n){if(!x(e,t))return t;let a=n.boundary??b,r=a(e),o=a(t);if(r||o)return!r||!o?t:n.retainBoundary?.(e,t)??!0?e:t;let d=ue(e);return ie(e,t),n.retainChildrenOf?.(e,t)!==!0&&le(e,t,n),ce(d),e}function ie(e,t){for(let n of Array.from(e.attributes))t.hasAttribute(n.name)||ae.has(n.name.toLowerCase())||e.removeAttribute(n.name);for(let n of Array.from(t.attributes))e.getAttribute(n.name)!==n.value&&e.setAttribute(n.name,n.value)}function le(e,t,n){let a=de(e,n),r=new Set(a.values()),o=Array.from(e.childNodes).filter(f=>!r.has(f)),d=new Set,p=new Set,l=Array.from(t.childNodes),s=e.firstChild,c=0;for(let f=0;f<l.length;f+=1){let i=l[f],g=null,y=i instanceof Element?C(i,n):void 0;if(y!==void 0&&p.has(y)&&(y=void 0),y!==void 0){p.add(y);let u=a.get(y);if(u!==void 0&&!d.has(u)&&(g=B(u,i,n)===u?u:null,g===null)){u.replaceWith(i),d.add(i),s=i.nextSibling;continue}}else{for(;c<o.length;){let u=o[c];if(c+=1,!d.has(u)){if(x(u,i)){g=B(u,i,n)===u?u:null,g===null&&(e.replaceChild(i,u),d.add(i),s=i.nextSibling);break}if(u instanceof Element){let h=l[f+1];if(!(i instanceof Element)||h!==void 0&&x(u,h)){c-=1;break}e.replaceChild(i,u),d.add(i),s=i.nextSibling;break}if(!(i instanceof Element)){e.replaceChild(i,u),d.add(i),s=i.nextSibling;break}}}if(g===null&&d.has(i))continue}let m=g??i;for(d.add(m);s!==null&&s!==m&&!d.has(s)&&se(s);)s=s.nextSibling;m!==s&&e.insertBefore(m,s),s=m.nextSibling}for(let f of Array.from(e.childNodes))d.has(f)||f.remove()}function B(e,t,n){return e instanceof Element&&t instanceof Element?w(e,t,n):(e.nodeValue!==t.nodeValue&&(e.nodeValue=t.nodeValue),e)}function se(e){return e.nodeType===Node.TEXT_NODE&&(e.nodeValue??"").trim().length===0}function x(e,t){return e.nodeType!==t.nodeType?!1:e instanceof Element&&t instanceof Element?e.tagName===t.tagName&&e.namespaceURI===t.namespaceURI:!0}function de(e,t){let n=new Map,a;for(let r of Array.from(e.children)){let o=C(r,t);if(o!==void 0){if(n.has(o)){a??(a=o.slice(o.indexOf("=")+1));continue}n.set(o,r)}}return a!==void 0&&t.onDuplicateKey?.(e,a),n}function ue(e){let t=e.ownerDocument.activeElement;if(!(t instanceof HTMLElement)||!e.contains(t))return null;let n=t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?[t.selectionStart,t.selectionEnd]:null;return{element:t,selection:n}}function ce(e){if(e===null)return;let{element:t,selection:n}=e;if(!(t.ownerDocument.activeElement===t||!t.isConnected))try{t.focus({preventScroll:!0});let[a,r]=n??[null,null];a!==null&&r!==null&&t.setSelectionRange(a,r)}catch{}}var O="data-payload-key";function F(e){if(e==null)return[];let t=new Set,n=[];for(let a of e.split(/[\\s,]+/)){let r=a.trim();r.length===0||t.has(r)||(t.add(r),n.push(r))}return n}var fe="__livePreviewRouteRefresh";function me(){return typ','eof window>"u"?void 0:window}function _(){return me()?.[fe]}var A="data-payload-fragment",k="data-payload-fragment-key";function L(e,t){let n=new AbortController,a=!1,r=()=>{n.abort()};e.addEventListener("abort",r,{once:!0});let o=setTimeout(()=>{a=!0,n.abort()},t);return{signal:n.signal,timedOut:()=>a,dispose:()=>{clearTimeout(o),e.removeEventListener("abort",r)}}}function U(e){return e instanceof Error?e.message:String(e)}var H="data-payload-strategy",$="data-payload-field",ye="data-payload-depends",pe="x-payload-live-preview",ge=8e3,Ee="route refresh returned no promise; re-applied before the host committed (see LivePreviewRouteRefresh)",he=1e3;function be(e){let t=e.getAttribute(H);return t!==null?t==="route":e.closest("head")!==null}function Ae(e){let t=e.getAttribute($),n=F(e.getAttribute(ye));return t===null||t.length===0?n:[t,...n]}function K(e){return e.hasAttribute(E)?!1:e.tagName==="META"?e.hasAttribute("name")||e.hasAttribute("property"):e.tagName==="LINK"&&e.getAttribute("rel")==="canonical"}function Se(e,t){let n=Array.from(e.head.children).find(l=>l.tagName==="TITLE"),a=Array.from(t.head.children).find(l=>l.tagName==="TITLE");!n?.hasAttribute(E)&&!a?.hasAttribute(E)&&t.title!==e.title&&(e.title=t.title);let r=Array.from(e.head.children).filter(K),o=Array.from(t.head.children).filter(K),d=Math.min(r.length,o.length);r.slice(0,d).forEach((l,s)=>{let c=o[s];if(c===void 0)return;if(l.tagName===c.tagName){for(let i of Array.from(l.attributes))c.hasAttribute(i.name)||l.removeAttribute(i.name);for(let i of Array.from(c.attributes))l.getAttribute(i.name)!==i.value&&l.setAttribute(i.name,i.value);return}let f=e.importNode(c,!0);l.replaceWith(f),r[s]=f});let p=r.at(-1);for(let l of o.slice(r.length)){let s=e.importNode(l,!0);p===void 0?e.head.append(s):p.after(s),p=s}for(let l of r.slice(o.length))l.remove()}function W(e={}){let t=e.timeoutMs??ge,n=e.minIntervalMs??he,a=-1/0,r=!1;return{plan(o,d,p){for(let l of o.querySelectorAll(`[${$}], [${H}="route"]`)){if(!be(l)||p?.inScope(l)===!1)continue;let s=Ae(l);if(s.length===0||s.some(c=>d.has(c)))return!0}return!1},async refresh(o){let d=Date.now(),p=n-(d-a);if(p>0)return o.retryAfter?.(p),o.log("LP0805",`route refresh for revision ${String(o.revision)} refused: the previous one was ${String(d-a)} ms ago`),"refused";a=d;let l=e.document??document,s=e.location??location,c=e.window??window,f=L(o.signal,t),i=g=>{if(o.signal.aborted)return"superseded";let y=f.timedOut()?`route refresh timed out after ${String(t)} ms`:U(g);return o.log("LP0801",y),"failed"};try{let g=_();if(g!==void 0){try{let m=g();typeof m?.then!="function"&&!r&&(r=!0,o.log("LP0810",Ee)),await m}catch(m){return i(m)}return o.isCurrent()?"partial":"superseded"}let y;try{y=await(e.fetch??fetch)(s.href,{method:"GET",credentials:"same-origin",cache:"no-store",headers:{accept:"text/html",[pe]:"route"},signal:f.signal})}catch(m){return i(m)}if(o.signal.aborted)return"superseded";if(!y.ok||!(y.headers.get("content-type")??"").includes("text/html"))return o.log("LP0802",`route answered ${String(y.status)} ${y.headers.get("content-type")??""}`),"failed";try{let m=await y.text();if(!o.isCurrent())return"superseded";let u=new DOMParser().parseFromString(m,"text/html"),h=c.scrollX,q=c.scrollY;Se(l,u);let z=P(l.body);return w(l.body,u.body,{boundary:b,retainBoundary:v,keyAttributes:[O,k,A],retainChildrenOf:Y=>Y.hasAttribute(A)}),D(z),c.scrollTo(h,q),"partial"}catch(m){return i(m)}}finally{f.dispose()}}}}return Q(Re);})();'].join(""),y=/* @__PURE__ */['"use strict";(()=>{function o(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function t(){return typ','eof window>"u"?!1:window.opener!=null}function e(){return o()||t()}function i(){let n=document.createElement("script");n.src=__LP_RUNTIME_SRC__,__LP_RUNTIME_INTEGRITY__!==""&&(n.integrity=__LP_RUNTIME_INTEGRITY__,n.crossOrigin="anonymous"),n.async=!0,document.head.appendChild(n)}e()&&i();})();'].join(""),b=/* @__PURE__ */['"use strict";(()=>{function c(){if(typ','eof window>"u")return!1;try{return window.self!==window.top}catch{return!0}}function s(){return typ','eof window>"u"?!1:window.opener!=null}function r(){return c()||s()}var i="__livePreviewHydration";function f(){if(typ','eof window>"u")return;let e=window;return e[i]??(e[i]={armed:!1,committed:!1,commits:[],onCommit:void 0,waiters:[]})}function d(){let e=f();if(e===void 0||e.armed)return;e.armed=!0;let n=window,o=n.__REACT_DEVTOOLS_GLOBAL_HOOK__??(n.__REACT_DEVTOOLS_GLOBAL_HOOK__=m()),u=o.onCommitFiberRoot;o.onCommitFiberRoot=function(a,t,...l){try{u?.call(this,a,t,...l)}catch{}e.onCommit===void 0?e.commits.push(t):e.onCommit(t)}}function m(){let e=new Map;return{supportsFiber:!0,renderers:e,inject:n=>{let o=e.size+1;return e.set(o,n),o}}}function p(){let e=document.createElement("script");e.src=__LP_RUNTIME_SRC__,__LP_RUNTIME_INTEGRITY__!==""&&(e.integrity=__LP_RUNTIME_INTEGRITY__,e.crossOrigin="anonymous"),e.async=!0,document.head.appendChild(e)}d();r()&&p();})();'].join(""),w=["allowedOrigins","serverURL","apiRoute","mergeDepth","debug","debounceMs","enableA11y","heartbeatMs","disableVisibilityGate","visibilityGateThreshold","intersectionRootMargin","disableReferrerDetection","disableLocalhostMatching","scopeBindingsByOwner","skipUnchanged","eventSourcePolicy","sanitizerPolicy","fragmentEndpoint","revealEditedField","routeStrategy","onUnboundChange","onUnfaithfulPatch","autoBind","hydration","defaults","softNavigationEvents","subfieldCoverage"];function S(e,t){if(0===e.length)throw new Error(`[live-preview] ${t} is empty. Run \`npm run build:runtime\` before bundling.`)}function A(e){return null!=e.fragmentEndpoint?(S(m,"fragment.generated.ts"),[m]):!0===e.routeStrategy?(S(v,"route.generated.ts"),[v]):[]}function k(e){return`var __LIVE_PREVIEW_CONFIG__=${function(e){a(e);const t=function(e){const t=e.defaults??"v2";return"v1"===t?{...p,defaults:t}:{defaults:t}}(e),n=w.map(n=>{const i=e[n]??t[n];return function(e,t){if("number"!=typeof t||Number.isFinite(t))return;const n="visibilityGateThreshold"===e?" To never defer, set `disableVisibilityGate: true`.":"";throw new Error(`[live-preview] \`${e}\` is ${String(t)}, which the inline configuration writes as null, so the runtime would never see it. Pass a finite number.${n}`)}(n,i),i});for(;void 0===n.at(-1);)n.pop();return`[${n.map(e=>void 0===e?"":JSON.stringify(e)).join(",")}]`.replace(/</g,"\\u003C")}(e)};`}function T(e,t={}){return`<script${void 0!==t.nonce?` nonce="${function(e){if(!/^[A-Za-z0-9+/=_-]+$/.test(e))throw new RangeError("nonce contains characters CSP does not allow");return e}(t.nonce)}"`:""}>${e}<\/script>`}function R(e){let t=0,n=e.length;for(;t<n&&"/"===e[t];)t+=1;for(;n>t&&"/"===e[n-1];)n-=1;const i=e.slice(t,n);return""===i?"":`/${i}`}function C(e={}){const t=e.runtime,n=`runtime.${t?.contentHash??"126324a400e59c43"}.js`;return{fileName:n,urlPath:`${R(e.assetPath??"/payload-live-preview")}/${n}`,integrity:t?.integrity??"sha384-0KboZFh/wbXgla+l5I69XH7qHy58Pk9J5RoqL1Zy8a7wE9yQpOF1G4kOBWHsiblS",source:t?.source??g}}function $(e){d({defaults:e.defaults,onUnboundChange:e.onUnboundChange});const t="v1"===e.defaults?h:c,n="v1"===e.defaults?p:f,i=e=>n[e]!==f[e]?n[e]:void 0;return{strict:e.strict??t.strict,previewSignals:e.previewSignals??t.previewSignals,skipUnchanged:e.skipUnchanged??i("skipUnchanged"),disableReferrerDetection:e.disableReferrerDetection??i("disableReferrerDetection"),disableLocalhostMatching:e.disableLocalhostMatching,eventSourcePolicy:e.eventSourcePolicy??i("eventSourcePolicy"),sanitizerPolicy:e.sanitizerPolicy??i("sanitizerPolicy")}}function E(e,t={}){const n=function(e,t={}){a(e);const n=$(e);return{...void 0!==e.defaults?{defaults:e.defaults}:{},...void 0!==e.allowedOrigins?{allowedOrigins:e.allowedOrigins}:{},...void 0!==e.serverURL?{serverURL:e.serverURL}:{},...void 0!==e.apiRoute?{apiRoute:e.apiRoute}:{},...void 0!==e.mergeDepth?{mergeDepth:e.mergeDepth}:{},...void 0!==e.revealEditedField?{revealEditedField:e.revealEditedField}:{},...void 0!==e.debug?{debug:e.debug}:{},...void 0!==e.debounceMs?{debounceMs:e.debounceMs}:{},...void 0!==e.heartbeatMs?{heartbeatMs:e.heartbeatMs}:{},...void 0!==e.disableVisibilityGate?{disableVisibilityGate:e.disableVisibilityGate}:{},...void 0!==e.visibilityGateThreshold?{visibilityGateThreshold:e.visibilityGateThreshold}:{},...void 0!==n.skipUnchanged?{skipUnchanged:n.skipUnchanged}:{},...void 0!==e.scopeBindingsByOwner?{scopeBindingsByOwner:e.scopeBindingsByOwner}:{},...void 0!==n.disableReferrerDetection?{disableReferrerDetection:n.disableReferrerDetection}:{},...void 0!==n.disableLocalhostMatching?{disableLocalhostMatching:n.disableLocalhostMatching}:{},...void 0!==n.eventSourcePolicy?{eventSourcePolicy:n.eventSourcePolicy}:{},...void 0!==n.sanitizerPolicy?{sanitizerPolicy:n.sanitizerPolicy}:{},...void 0!==e.runtime?{runtime:e.runtime}:{},...void 0!==e.fragments?{fragmentEndpoint:e.fragments.endpoint}:{},...!0===e.routeStrategy&&void 0===e.fragments?{routeStrategy:!0}:{},...void 0!==e.onUnboundChange?{onUnboundChange:e.onUnboundChange}:{},...void 0!==e.onUnfaithfulPatch?{onUnfaithfulPatch:e.onUnfaithfulPatch}:{},...void 0!==e.autoBind?{autoBind:e.autoBind}:{},...void 0!==e.subfieldCoverage?{subfieldCoverage:e.subfieldCoverage}:{},...void 0!==t.hydration?{hydration:t.hydration}:{},...void 0!==t.softNavigationEvents?{softNavigationEvents:t.softNavigationEvents}:{}}}(e,t);if("asset"!==e.delivery)return function generateInlineScript(e={}){d({defaults:e.defaults,onUnboundChange:e.onUnboundChange});const t=function(e){const t=e.runtime;if(void 0===t)return S(g,"runtime.generated.ts"),g;if(S(t.source,`the ${t.profile} runtime`),null!=e.fragmentEndpoint||!0===e.routeStrategy)throw new Error(`[live-preview] the ${t.profile} runtime and the fragment or route strategy exclude each other: it carries no strategy runner, so the prelude would have nothing to talk to. Drop the runtime option, or drop \`fragmentEndpoint\`/\`routeStrategy\`.`);return t.source}(e);return[k(e),...A(e),t].join("\n")}(n);const i=C(e);return function(e={},t){const n=function(e){return"react"===e.hydration?(S(b,"loader-react.generated.ts"),b):(S(y,"loader.generated.ts"),y)}(e);if(""===t.runtimeSrc)throw new Error("[live-preview] generateLoaderScript needs a runtimeSrc.");const i=e=>JSON.stringify(e).replace(/</gu,"\\u003C");return[k(e),`var __LP_RUNTIME_SRC__=${i(t.runtimeSrc)};`,`var __LP_RUNTIME_INTEGRITY__=${i(t.integrity??"")};`,...A(e),n].join("\n")}(n,{runtimeSrc:i.urlPath,integrity:i.integrity})}var L=["preview","draft","livePreview"],O=class extends Error{name="PreviewConfigurationError"};function N(e){return{authorized:!1,outcome:e,context:null}}var x="payload-live-preview.authorized-preview-context",P=Symbol.for(x);function isAuthorizedPreviewContext(e){return"object"==typeof e&&null!==e&&!0===e[P]&&Object.isFrozen(e)}function M(e){const t={...e,scope:Object.freeze({...e.scope,...void 0===e.scope.payload?{}:{payload:Object.freeze({...e.scope.payload,document:Object.freeze({...e.scope.payload.document})})}}),payloadHeaders:Object.freeze({...e.payloadHeaders}),[P]:!0,[x]:!0};return Object.defineProperty(t,"payloadHeaders",{enumerable:!1}),Object.freeze(t)}async function F(e){let t;try{t=await e()}catch(e){if(function(e){return e instanceof O||e instanceof Error&&"PreviewConfigurationError"===e.name}(e))throw e;return N("unavailable")}return function(e){return isAuthorizedPreviewContext(e)?{authorized:!0,outcome:"authorized",context:e}:"object"==typeof e&&null!==e&&"authorized"in e?e.authorized&&isAuthorizedPreviewContext(e.context)?{authorized:!0,outcome:"authorized",context:e.context}:N(e.authorized?"invalid":e.outcome):N("invalid")}(t)}var U=" New in 2.0; `defaults: 'v1'` keeps the 1.x table while you migrate (docs/migration.md).";function I(e){return!1!==e&&("full"===e?"full":"frame-ancestors")}var j=/[;,\p{Cc}]/u;function _(e){for(const t of["allowedOrigins","frameAncestorsExtra","scriptSrcExtra"]){const n=e[t]?.find(e=>j.test(e));if(void 0!==n)throw new Error(`payload-live-preview: \`${t}\` holds ${JSON.stringify(n)}, which a CSP header cannot carry: ";" ends a directive and "," a policy.`)}}function z(e,t,n,i){_(e);const r={"frame-ancestors":buildFrameAncestors({self:!0,origins:[...e.allowedOrigins??[],...e.frameAncestorsExtra??[]]})};return"full"===i&&(r["script-src"]=function buildScriptSrcWithNonce(e,t={}){if(0===e.length)throw new RangeError("buildScriptSrcWithNonce: nonce is empty");const{self:n=!0,extra:i=[],strictDynamic:r=!1}=t,o=[];n&&o.push("'self'"),o.push(`'nonce-${e}'`),r&&o.push("'strict-dynamic'");for(const e of i){const t=e.trim();t.length>0&&o.push(t)}return o.join(" ")}(t,{self:!0,strictDynamic:e.strictDynamic??!1,...void 0!==e.scriptSrcExtra?{extra:e.scriptSrcExtra}:{}})),function(e,t){const n=e.split(",").filter(e=>e.trim().length>0);return 0===n.length?l("",t):n.map(e=>l(e,t)).join(", ")}(n,r)}var D=Object.freeze({isPreview:!1,authorization:null,outcome:void 0,inject:!1,cspMode:!1,exposeNonce:!1});function W(e,t={}){const n=$(e);a(e),_(e);const i="function"==typeof e.authorizePreview;n.strict?function(e){if("function"!=typeof e.authorizePreview)throw new Error("payload-live-preview: strict mode requires `authorizePreview` — response changes must be gated on a verified context, not on intent (ADR 0006)."+U);const t=e.allowedOrigins??[];if(0===t.length)throw new Error("payload-live-preview: strict mode requires explicit, non-empty `allowedOrigins`."+U);const n=t.filter(e=>!function(e){try{return"https:"===new URL(e).protocol}catch{return!1}}(e));if(n.length>0&&!s())throw new Error(`payload-live-preview: strict mode requires https admin origins in production; got "${n[0]}".`+U);const i=globalThis.process?.env;if(n.length>0&&void 0===i?.NODE_ENV&&u("strict-http-without-node-env",`strict mode accepted ${n.map(e=>`"${e}"`).join(", ")} because \`NODE_ENV\` is not set, which it treats as development. Set \`NODE_ENV=production\` on a production server, and strict mode requires https admin origins there.`),!0===$(e).previewSignals?.includes("referer"))throw new Error("payload-live-preview: strict mode disables referrer trust; remove 'referer' from `previewSignals` (the 'v1' profile includes it).")}(e):i||u("intent-only-preview","preview responses are gated on client-controlled intent only. Configure `authorizePreview` (see authorizePreviewRequest) before production; `strict: true` enforces it. ADR 0006 explains why intent is not authorization.");const r=I(e.manageCsp),o=e.autoInject??!0;let l;return{authorizes:i,async decide(t,n={}){if(i&&void 0===n.authorize)throw new Error("payload-live-preview: `authorizePreview` is configured but decide() was called without an `authorize` hook; bind the hook to the request (bindDecisionHooks).");const l=function(e,t){const n=$(t).previewSignals;return"always"===(t.inject??"preview-only")||function(e,t={}){const n=new Set(t.signals??["query","fetch-dest","referer"]),i=t.queryParams??L;if(n.has("query")){let t;try{t=new URL(e.url)}catch{t=void 0}if(void 0!==t)for(const e of i){const n=t.searchParams.getAll(e).at(-1);if("true"===n||"1"===n)return!0}}if(n.has("fetch-dest")&&"iframe"===e.headers.get("sec-fetch-dest"))return!0;const r=t.adminOrigins;void 0!==r&&u("admin-origins","`hasPreviewIntent({ adminOrigins })` is removed in 3.0: name the option `allowedOrigins`; `pll migrate` renames it (ADR 0026).");const o=t.allowedOrigins??r??[],l=n.has("referer")?o:[];if(l.length>0){const t=e.headers.get("referer");if(null!==t)try{const e=new URL(t).origin;for(const t of l)try{if(new URL(t).origin===e)return!0}catch{}}catch{}}return!1}(e,{...void 0!==t.previewQueryParams?{queryParams:t.previewQueryParams}:{},...void 0!==n?{signals:n}:{},allowedOrigins:t.allowedOrigins??[]})}(t,e);if(!l)return D;let a,s=null;if(void 0!==n.authorize){const e=await F(n.authorize);if(a=e.outcome,!e.authorized)return{isPreview:l,authorization:null,outcome:a,inject:!1,cspMode:!1,exposeNonce:!1};s=e.context}return{isPreview:l,authorization:s,outcome:a,inject:o&&(n.shouldInject?.()??!0),cspMode:r,exposeNonce:!0}},scriptTag:n=>T((l??=E(e,t),l),{nonce:n}),csp:(t,n,i)=>z(e,n,t,i),nonce:()=>function generateCspNonce(e=16){if(!Number.isInteger(e)||e<8)throw new RangeError(`generateCspNonce: bytes must be an integer >= 8, got ${String(e)}`);const t=function(){const e=globalThis.crypto;return e?.getRandomValues?e:void 0}();if(!t)throw new Error("generateCspNonce: Web Crypto is unavailable. On Node 18 call setCspCrypto(webcrypto) once at startup, or run with --experimental-global-webcrypto. We won't fabricate a predictable nonce — that would silently defeat the entire CSP.");const n=new Uint8Array(e);return t.getRandomValues(n),function(e){let t="";for(const n of e)t+=String.fromCharCode(n);return("function"==typeof btoa?btoa(t):Buffer.from(e).toString("base64")).replaceAll("+","-").replaceAll("/","_").replaceAll("=","")}(n)}()}}var B={hydration:"vue",softNavigationEvents:["payload-live-preview:navigation"]},V="livePreviewDecision";function q(e={}){const t=W(e,B);return n=>{n.hooks.hook("render:html",async(n,{event:i})=>{const{decision:r,nonce:o}=await G(i,t,e);if(!r.isPreview)return;r.inject&&n.head.push(t.scriptTag(o));const l=function(e){const t=e.node?.res??e.res;if("function"==typeof t?.setHeader)return{get:e=>{return n=t.getHeader?.(e),Array.isArray(n)?n.join(", "):"number"==typeof n?String(n):n;var n},set:(e,n)=>{t.setHeader?.(e,n)}};const n=e.res?.headers;return X(n)&&"function"==typeof n.set?{get:e=>n.get(e)??void 0,set:n.set.bind(n)}:void 0}(i);void 0!==l&&function(e){return e.inject||!1!==e.cspMode||null!==e.authorization}(r)&&function(e,t,n,i){const r=n.cspMode;if(!1!==r){const n=e.get("content-security-policy")??"";e.set("content-security-policy",t.csp(n,i,r))}!function(e){const t=e.get("cache-control")??"";/\bno-store\b/i.test(t)||e.set("cache-control","private, no-store");const n=(e.get("vary")??"").trim(),i=n.split(",").map(e=>e.trim().toLowerCase());i.includes("*")||i.includes("cookie")||e.set("vary",0===n.length?"Cookie":`${n}, Cookie`)}(e)}(l,t,r,o)})}}function H(e={}){const t=W(e,B);return async n=>{await G(n,t,e)}}async function G(e,t,n){const i=e.context??{},r=i[V];if(void 0!==r)return r;const o=function(e){const t=Q(e,"host")??"localhost",n=e.path??e.node?.req?.url??e.req?.url??"/";return{url:Y("string"==typeof e.url?e.url:e.url?.href)??`http://${t}${n}`,headers:{get:t=>Q(e,t)}}}(e),l=await t.decide(o,function(e,t,n){return{shouldInject:()=>t.shouldInject?.(n)??!0,...e.authorizes?{authorize:()=>t.authorizePreview?.(n)}:{}}}(t,n,o)),a={decision:l,nonce:t.nonce()};return i[V]=a,function(e,t,n){!t.exposeNonce&&t.isPreview||(e.livePreviewNonce=n),null!==t.authorization&&(e.livePreviewAuthorization=t.authorization),void 0!==t.outcome&&(e.livePreviewAuthorizationOutcome=t.outcome)}(i,l,a.nonce),a}function K(e={}){return function(e,t={}){return T(E(e,t),void 0!==e.nonce?{nonce:e.nonce}:{})}(e,B)}function J(e,t,n="",i){return z(e,t,n,"full"===(i??I(e.manageCsp))?"full":"frame-ancestors")}function X(e){return"function"==typeof e?.get}function Q(e,t){const n=X(e.headers)?e.headers:X(e.req?.headers)?e.req.headers:void 0;if(void 0!==n)return n.get(t);const i=e.node?.req?.headers??e.req?.headers,r=i?.[t.toLowerCase()];return(Array.isArray(r)?r[0]:r)??null}function Y(e){if(void 0!==e)try{return new URL(e).href}catch{return}}var Z,ee="users",te=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,ne=/^[A-Za-z0-9._~-]+$/,ie=/* @__PURE__ */new WeakMap;function re(e,t){let n;try{n=new URL(e)}catch{throw new O(`payload-live-preview: ${t} "${e}" is not an absolute URL`)}if("https:"!==n.protocol&&"http:"!==n.protocol)throw new O(`payload-live-preview: ${t} must be http(s), got "${n.protocol}"`);return n.origin}function oe(){return Z??=new TextEncoder,Z}function le(e){if(!/^[A-Za-z0-9_-]*$/.test(e))return;const t=e.replace(/-/g,"+").replace(/_/g,"/")+"=".repeat((4-e.length%4)%4);try{const e=atob(t),n=new Uint8Array(e.length);for(let t=0;t<e.length;t+=1)n[t]=e.charCodeAt(t);return n}catch{return}}function ae(e){return"string"==typeof e&&e.length>0&&"."!==e&&".."!==e&&!/[\s\p{Cc}\p{Cs}/\\?#%]/u.test(e)}function se(e){return"number"==typeof e?Number.isSafeInteger(e):ae(e)}function ue(e){return void 0!==e.expiresAt&&Number.isFinite(e.expiresAt)&&e.expiresAt>Date.now()}function de(e,t){return e.kind===t.kind&&e.slug===t.slug&&("global"===e.kind||se(t.id)&&String(e.id)===String(t.id))}async function ce(e,t){switch(t.type){case"payload-session":return async function(e,t){const n=function(e){const t=e??"payload-token";if(!te.test(t))throw new O(`payload-live-preview: cookie name "${t}" is not a valid cookie-name token`);return t}(t.cookieName),i=re(t.serverURL,"serverURL"),r=void 0===t.origin?void 0:re(t.origin,"origin"),o=function(e,t,n=4096){if(null===e||0===e.length)return null;const i=`${t}=`,r=[];for(const t of e.split(";")){const e=t.trim();e.startsWith(i)&&r.push(e.slice(i.length))}if(1!==r.length)return null;const o=r[0]??"";return 0===o.length||o.length>n||!ne.test(o)?null:o}(e.headers.get("cookie"),n,t.maxCookieLength??4096);if(null===o)return N("missing-credential");const l=t.now??Date.now,a=Math.max(250,t.timeoutMs??3e3);if(!Number.isSafeInteger(a))return N("unavailable");const s=t.fetch??globalThis.fetch,u=`${i}/api/${encodeURIComponent(t.usersSlug??ee)}/me?depth=0`,d=ie.get(s)??/* @__PURE__ */new Map,c=`${n}=${o}`;let f={cookie:c};void 0!==r?f.origin=r:d.has(u)&&(f.origin=i);const h=new AbortController,p=()=>{h.abort(e.signal?.reason)},g=()=>h.signal.aborted;let m,v;e.signal?.addEventListener("abort",p,{once:!0}),!0===e.signal?.aborted&&p();try{if(g())return N("unavailable");m=setTimeout(()=>{h.abort(new DOMException("The operation timed out","TimeoutError"))},a);for(let e=0;e<2;e++){const t=await s(u,{headers:{...f,accept:"application/json"},signal:h.signal});if(g())return N("unavailable");if(!t.ok)return N(401===t.status?"invalid":"unavailable");if(v=await t.json(),g())return N("unavailable");const n="object"==typeof v&&null!==v?v.user:void 0;if(0!==e){if("object"!=typeof n||null===n||Array.isArray(n))break;void 0===f.origin?d.delete(u):(ie.set(s,d),d.set(u,l()));break}if(void 0!==r||null!==n)break;if(void 0!==f.origin){if(l()-(d.get(u)??0)<6e4)break;d.set(u,l()),f={cookie:c}}else f={cookie:c,origin:i}}}catch{return N("unavailable")}finally{void 0!==m&&clearTimeout(m),e.signal?.removeEventListener("abort",p)}const y=function(e,t){if("object"!=typeof e||null===e||Array.isArray(e))return null;const n=e.user;if("object"!=typeof n||null===n||Array.isArray(n))return null;const i=e.collection??n.collection;if(void 0!==i&&i!==t)return null;const r=n.id;return"string"==typeof r&&r.length>0?r:"number"==typeof r&&Number.isFinite(r)?String(r):null}(v,t.usersSlug??ee);if(null===y)return N("invalid");const b=function(e){const t=e.exp;return"number"!=typeof t||!Number.isFinite(t)||t<=0?void 0:t<1e11?1e3*t:t}(v);return void 0!==b&&b<=l()?N("expired"):{authorized:!0,outcome:"authorized",context:M({strategy:"payload-session",subject:y,authorizedAt:l(),expiresAt:b,scope:{},payloadHeaders:f})}}(e,t);case"signed-token":return async function(e,t){const n=function(e){const t="string"==typeof e?oe().encode(e):e;if(t.byteLength<32)throw new O(`payload-live-preview: the preview token secret must be at least ${String(32)} bytes`);return t}(t.secret),i=function(e){if(void 0!==e)return e;const t=globalThis.crypto;return"object"==typeof t?.subtle?t:void 0}(t.crypto);if(void 0===i)return N("unavailable");const r=function(e,t){if("header"===t?.kind)return e.headers.get(t.name??"x-preview-token");let n;try{n=new URL(e.url)}catch{return null}const i=n.searchParams.getAll(t?.param??"previewToken");return 1===i.length?i[0]??null:null}(e,t.transport);if(null===r||0===r.length)return N("missing-credential");if(r.length>4096)return N("invalid");const o=r.split(".");if(3!==o.length||"v1"!==o[0])return N("invalid");const l=o[1]??"",a=le(l),s=le(o[2]??"");if(void 0===a||32!==s?.byteLength)return N("invalid");let d;try{const e=await async function(e,t){return e.subtle.importKey("raw",t,{name:"HMAC",hash:"SHA-256"},!1,["sign","verify"])}(i,n);d=await i.subtle.verify("HMAC",e,s,oe().encode(`v1.${l}`))}catch{return N("unavailable")}if(!d)return N("invalid");const c=function(e){let t;try{t=JSON.parse((new TextDecoder).decode(e))}catch{return}if("object"!=typeof t||null===t)return;const n=t,i=e=>void 0===n[e]||"string"==typeof n[e];return 1===n.v&&"string"==typeof n.aud&&"string"==typeof n.pur&&"number"==typeof n.iat&&"number"==typeof n.exp&&"string"==typeof n.jti&&i("pth")&&i("loc")&&i("sub")?n:void 0}(a);if(void 0===c)return N("invalid");const f=(t.now??Date.now)();if(c.exp<=f||c.iat>c.exp)return N("expired");if(c.exp-c.iat>36e5)return N("invalid");if(c.aud!==t.audience)return N("wrong-audience");if(c.pur!==(t.purpose??"live-preview"))return N("wrong-purpose");if(void 0!==c.pth){let t;try{t=new URL(e.url).pathname}catch{return N("invalid")}if(c.pth!==t)return N("wrong-path")}if(void 0!==c.loc){const n=t.locale?.(e);if(n!==c.loc)return N("wrong-locale")}if(void 0!==t.replay){let e;try{e=await async function(e,t,n){return"consume"in e?!0===await e.consume(t,n):(u("replay-is-used","A `signed-token` replay store with `isUsed` and `markUsed` is removed in 3.0: implement `consume(id, expiresAt)`, which checks and records in one step (ADR 0026)."),!await e.isUsed(t)&&(await e.markUsed(t,n),!0))}(t.replay,c.jti,c.exp)}catch{return N("unavailable")}if(!e)return N("replayed")}return{authorized:!0,outcome:"authorized",context:M({strategy:"signed-token",subject:c.sub,authorizedAt:f,expiresAt:c.exp,scope:{audience:c.aud,...void 0!==c.pth?{path:c.pth}:{},...void 0!==c.loc?{locale:c.loc}:{}},payloadHeaders:{}})}}(e,t);case"verifier":return async function(e,t){let n;try{n=await t.verify(e)}catch{return N("unavailable")}if(null===n)return N("invalid");if(!(void 0===n.scope?.payload||function(e){if("object"!=typeof e||null===e)return!1;const t=e,n=t.document;return!(null===function(e,t="/api"){if("string"!=typeof e||"string"!=typeof t)return null;try{const n=new URL(e);if(!["http:","https:"].includes(n.protocol)||n.username||n.password||n.search||n.hash)return null;const i=e.replace(/^[a-z]+:\/\/[^/]+/iu,"").replace(/\/+$/,""),r=t.replace(/^\//,"").replace(/\/$/,"");return""!==i&&!i.slice(1).split("/").every(ae)||!r.split("/").every(ae)?null:`${n.origin}${n.pathname.replace(/\/+$/,"")}/${r}`}catch{return null}}(t.serverURL,t.apiRoute)||"number"!=typeof t.maxDepth||!Number.isSafeInteger(t.maxDepth)||t.maxDepth<0||"object"!=typeof n||null===n||!ae(n.slug))&&("global"===n.kind||"collection"===n.kind&&se(n.id))}(n.scope.payload)&&Number.isFinite(n.expiresAt)))return N("invalid");const i=(t.now??Date.now)();return void 0!==n.expiresAt&&n.expiresAt<=i?N("expired"):{authorized:!0,outcome:"authorized",context:M({strategy:"verifier",subject:n.subject,authorizedAt:i,expiresAt:n.expiresAt,scope:n.scope??{},payloadHeaders:n.payloadHeaders??{}})}}(e,t)}}function fe(e,t,n,i){const r=t??n;if(!Number.isSafeInteger(r)||r<=0||r>i)throw new RangeError(`payload-live-preview: createFragmentEndpoint() limits.${e} must be a positive integer no greater than ${String(i)}.`);return r}var he="x-payload-fragment-version",pe=64;function ge(e,t,n){if(t>n||"object"!=typeof e||null===e)return t;let i=t;for(const r of Object.values(e))if(i=Math.max(i,ge(r,t+1,n)),i>n)break;return i}function me(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ve(e,t=pe){if(!Number.isInteger(t)||t<0||t>pe)return null;if(!me(e))return null;const n=e.fragment;if("string"!=typeof n||!/^[a-z][a-z0-9-]{0,63}$/iu.test(n))return null;const i=e.key;if(void 0!==i&&("string"!=typeof i||i.length>128))return null;const r=e.route;if("string"!=typeof r||!r.startsWith("/")||r.length>2048)return null;const o=e.search;if("string"!=typeof o||o.length>4096||""!==o&&!o.startsWith("?"))return null;const l=e.revision;if("number"!=typeof l||!Number.isInteger(l)||l<0)return null;const a=[];for(const t of["locale","collectionSlug","globalSlug"]){const n=e[t];if(void 0!==n){if("string"!=typeof n||n.length>128)return null;a.push(n)}else a.push(void 0)}const[s,u,d]=a,c=e.fields;return me(c)?ge(c,0,t)>t?"field-depth":{fragment:n,..."string"==typeof i?{key:i}:{},route:r,search:o,revision:l,...void 0!==s?{locale:s}:{},...void 0!==u?{collectionSlug:u}:{},...void 0!==d?{globalSlug:d}:{},fields:c}:null}var ye=2147483647,be={"cache-control":"private, no-store","x-content-type-options":"nosniff",vary:"Cookie",[he]:String(1)};function we(e,t,n){return new Response(JSON.stringify({error:t,...void 0!==n?{maxDepth:n}:{}}),{status:e,headers:{...be,"content-type":"application/json; charset=utf-8"}})}var Se=class extends Error{name="EndpointStopped"};function Ae(e,t){if(null!==e&&!e.locked)try{Promise.resolve(e.cancel(t)).catch(()=>{})}catch{}}function ke(e){return e.aborted}function Te(e,t){const n=function(e){const{authorize:t,authorizePreview:n}=e;if(void 0!==n&&void 0!==t)throw new Error("payload-live-preview: createFragmentEndpoint() takes `authorizePreview` or `authorize`, not both — pass the middleware hook as `authorizePreview`, or a strategy as `authorize`.");if(void 0!==n)return e=>F(()=>n(e));if(void 0!==t)return e=>ce(e,t);throw new Error("payload-live-preview: createFragmentEndpoint() needs `authorizePreview` (the middleware hook) or `authorize` (a strategy); without one it would render drafts for anyone.")}(e),i=e.render??t.render,r=void 0===e.render?t.rendererName:"custom",o=new Set(e.allowedOrigins??[]),l=fe("bodyBytes",e.limits?.bodyBytes,65536,Number.MAX_SAFE_INTEGER),a=fe("timeoutMs",e.limits?.timeoutMs,5e3,ye),s=void 0===e.limits?.totalTimeoutMs?void 0:fe("totalTimeoutMs",e.limits.totalTimeoutMs,0,ye),{fieldDepth:d=pe}=e.limits??{};if(!Number.isInteger(d)||d<0||d>pe)throw new TypeError("createFragmentEndpoint: limits.fieldDepth must be an integer from 0 to 64");const c=e.registry;return async(e,f)=>{if("POST"!==e.method)return we(405,"method");if(!function(e,t){const n=e.headers.get("sec-fetch-site");if(null!==n&&"same-origin"!==n&&"none"!==n)return!1;const i=e.headers.get("origin");return null===i||i===new URL(e.url).origin||t.has(i)}(e,o))return we(403,"origin");if(!(e.headers.get("content-type")??"").toLowerCase().startsWith("application/json"))return we(415,"content-type");const h=function(e,t){const n=new AbortController,i=void 0===t?void 0:performance.now()+t;let r,o;const l=new Promise(e=>{o=e}),a=e=>{void 0===r&&(r=e,n.abort(e),o?.(e))},s=()=>{a("request-aborted")};e.addEventListener("abort",s,{once:!0}),e.aborted&&s();const u=void 0===t?void 0:setTimeout(()=>{a("total-timeout")},t),d=()=>{if(void 0!==i&&performance.now()>=i&&a("total-timeout"),void 0!==r)throw new Se(r)};return{signal:n.signal,reason:()=>r,run:async(e,t)=>{d();const n=void 0===t?void 0:setTimeout(()=>{a("phase-timeout")},t);try{const t=await Promise.race([Promise.resolve().then(()=>(d(),e())),l.then(e=>{throw new Se(e)})]);return d(),t}catch(e){throw d(),e}finally{void 0!==n&&clearTimeout(n)}},dispose:()=>{void 0!==u&&clearTimeout(u),e.removeEventListener("abort",s)}}}(e.signal,s),p={started:!1,read:!1};try{const o=await h.run(()=>(p.started=!0,async function(e,t,n,i,r){const o=e.body;if(ke(t)||e.bodyUsed||!0===o?.locked)return Ae(o,"unreadable"),{kind:"unreadable"};if(function(e,t){const n=e.headers.get("content-length");if(null===n||!/^[0-9]+$/u.test(n))return!1;const i=n.replace(/^0+/u,"")||"0",r=String(t);return i.length>r.length||i.length===r.length&&i>r}(e,n))return{kind:"too-large"};if(null===o)return{kind:"parsed",value:null};let l,a,s;try{l=o.getReader()}catch{return Ae(o,"unreadable"),{kind:"unreadable"}}const u=new Promise(e=>{s=e}),d=e=>{if(void 0===a){a=e,s?.({kind:"stopped",reason:e});try{Promise.resolve(l.cancel(e)).catch(()=>{})}catch{}}},c=()=>{d("unreadable")};t.addEventListener("abort",c,{once:!0}),ke(t)&&c();const f=setTimeout(()=>{d("timed-out")},i),h=new TextDecoder;let p="",g=0,m=!1;try{for(;;){const e=Promise.resolve().then(()=>l.read()).then(e=>({kind:"read",result:e}),()=>({kind:"read-error"})),t=await Promise.race([e,u]);if("stopped"===t.kind)return{kind:t.reason};if("read-error"===t.kind)return m?{kind:"too-large"}:(d("unreadable"),{kind:"unreadable"});if(void 0!==a)return{kind:a};if(t.result.done){if(m)return{kind:"too-large"};break}if(!m){if(t.result.value.byteLength>n-g){if("drain"===r){m=!0;continue}return d("too-large"),{kind:"too-large"}}g+=t.result.value.byteLength;try{p+=h.decode(t.result.value,{stream:!0})}catch{return d("unreadable"),{kind:"unreadable"}}}}try{return p+=h.decode(),{kind:"parsed",value:JSON.parse(p)}}catch{return{kind:"parsed",value:null}}}finally{clearTimeout(f),t.removeEventListener("abort",c);try{l.releaseLock()}catch{}}}(e,h.signal,l,a,t.overLimitBody??"cancel")));if("parsed"!==o.kind)return"too-large"===o.kind?we(413,"body"):"timed-out"===o.kind?we(408,"body"):we(400,"body");const s=ve(o.value,d);if("field-depth"===s)return we(400,"field-depth",d);if(null===s)return we(400,"shape");p.read=!0;const g=new URL(e.url).origin,m=new Request(`${g}${s.route}${s.search}`,{headers:e.headers,signal:h.signal}),v=await h.run(()=>n(m));if(!v.authorized||!function(e,t,n){const i=e.scope;if(void 0!==i.locale&&i.locale!==t.locale)return!1;if(void 0!==i.payload){if(!ue(e)||void 0!==i.audience&&i.audience!==n.origin||void 0!==i.path&&i.path!==n.pathname)return!1;if(void 0!==t.collectionSlug&&void 0!==t.globalSlug)return!1;if(!de(i.payload.document,{kind:void 0===t.globalSlug?"collection":"global",slug:t.globalSlug??t.collectionSlug,id:t.fields.id}))return!1;if(!function(e,t){if("object"!=typeof t||null===t||Array.isArray(t))return!1;const n=t;return"global"===e.kind?!Object.hasOwn(n,"globalType")||n.globalType===e.slug:Object.hasOwn(n,"id")&&de(e,{kind:"collection",slug:e.slug,id:n.id})}(i.payload.document,t.fields))return!1}return!0}(v.context,s,new URL(m.url)))return we(403,"unauthorized");const y=Object.prototype.hasOwnProperty.call(c,s.fragment)?c[s.fragment]:void 0;if(void 0===y)return we(404,"fragment");const b={locals:f,id:s.fragment,key:s.key,revision:s.revision,fields:s.fields,locale:s.locale,collectionSlug:s.collectionSlug,globalSlug:s.globalSlug,route:s.route,authorization:v.context,signal:h.signal,request:e},w=Date.now();let S;try{const e=await h.run(()=>y.props(b),a);if(void 0!==b.authorization.scope.payload&&!ue(b.authorization))return we(403,"unauthorized");const t=e;if(S=await h.run(()=>i(y.component,t,b),a),void 0!==b.authorization.scope.payload&&!ue(b.authorization))return we(403,"unauthorized")}catch(e){if(e instanceof Se)throw e;return u(`fragment-render:${s.fragment}`,`fragment "${s.fragment}" did not render: ${e instanceof Error?e.message:String(e)}`),we(500,"render")}const A={html:S,boundary:{id:s.fragment,...void 0!==s.key?{key:s.key}:{}},revision:s.revision,metadata:{renderedAt:/* @__PURE__ */(new Date).toISOString(),renderer:r,durationMs:Date.now()-w}};return new Response(JSON.stringify(A),{status:200,headers:{...be,"content-type":"application/json; charset=utf-8"}})}catch(t){if(!(t instanceof Se))throw t;return p.started||Ae(e.body,"unreadable"),"total-timeout"===h.reason()?we(504,"timeout"):"phase-timeout"===h.reason()?we(500,"render"):we(400,p.read?"request":"body")}finally{h.dispose()}}}var Re=function(){let e;return()=>{if(void 0===e){const t=(async()=>{const e="vue",t="vue/server-renderer";try{const[n,i]=await Promise.all([import(e),import(t)]);return{createSSRApp:n.createSSRApp,renderToString:i.renderToString}}catch(e){throw function(e,t){const n=e.map(e=>`\`${e}\``).join(" and "),i=1===e.length;return new Error(`payload-live-preview: this fragment endpoint renders with ${n}, ${i?"an optional peer":"optional peers"} this package does not install. ${i?"Install it":"Install them"}, or pass your own \`render\`.`,{cause:t})}(["vue"],e)}})();e=t,t.catch(()=>{e===t&&(e=void 0)})}return e}}(),Ce=async(e,t)=>{const{createSSRApp:n,renderToString:i}=await Re(),r=n(e,t),o=[];r.config.errorHandler=e=>{o.push(e)};const l=await i(r);if(o.length>0)throw o[0];return l};function $e(e){const t=Te(e,{render:Ce,rendererName:"vue-server-renderer"});return(e,n)=>async function(e,t,n){if(!function(e){if("object"!=typeof e||null===e)return!1;if(!("httpVersionMajor"in e)||1!==e.httpVersionMajor)return!1;if(!("pause"in e)||"function"!=typeof e.pause)return!1;if(!("socket"in e)||"object"!=typeof e.socket||null===e.socket)return!1;const{socket:t}=e;return"destroyed"in t&&"boolean"==typeof t.destroyed&&"on"in t&&"function"==typeof t.on&&"removeListener"in t&&"function"==typeof t.removeListener}(t)||e.bodyUsed||!0===e.body?.locked)return n(e);const i=new AbortController,r=()=>{i.abort()};t.socket.on("close",r),e.signal.addEventListener("abort",r,{once:!0}),(t.socket.destroyed||e.signal.aborted)&&r();const o=e.body;let l,a=null===o,s=!1;const u=()=>s,d=()=>{if(!s){s=!0;try{a||t.pause()}finally{l?.releaseLock(),l=void 0}}};try{const t=null===o?null:new ReadableStream({async pull(e){if(!u())try{l??=o.getReader();const t=await l.read();if(u())return;t.done?(a=!0,e.close()):e.enqueue(t.value)}catch(t){u()||e.error(t)}},cancel:d},{highWaterMark:0}),r=new Request(e,{body:t,signal:i.signal,duplex:"half"}),s=await n(r);if(a)return s;const c=new Headers(s.headers);return c.set("connection","close"),new Response(s.body,{status:s.status,statusText:s.statusText,headers:c})}finally{try{d()}finally{t.socket.removeListener("close",r),e.signal.removeEventListener("abort",r)}}}(e,n?.node?.req,e=>t(e,n?.context))}function Ee(e={}){return t=>function(e,t={}){const n=C(t),i=e.split("?")[0]??"";return i.slice(i.lastIndexOf("/")+1)!==n.fileName?new Response("Not found",{status:404,headers:{"content-type":"text/plain; charset=utf-8","cache-control":"no-store"}}):new Response(n.source,{status:200,headers:{"content-type":"text/javascript; charset=utf-8","cache-control":"public, max-age=31536000, immutable","access-control-allow-origin":"*","x-content-type-options":"nosniff"}})}(t.url,e)}export{V as DECISION_CONTEXT_KEY,J as buildLivePreviewCsp,$e as createFragmentEndpoint,Ee as createRuntimeAssetRoute,H as defineLivePreviewServerHandler,q as livePreviewNitroPlugin,K as renderLivePreviewScript};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|