@uniweb/runtime 0.9.10 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,132 +0,0 @@
1
- const Rt=Symbol.for("yaml.alias"),Lt=Symbol.for("yaml.document"),z=Symbol.for("yaml.map"),Ps=Symbol.for("yaml.pair"),U=Symbol.for("yaml.scalar"),de=Symbol.for("yaml.seq"),x=Symbol.for("yaml.node.type"),Z=s=>!!s&&typeof s=="object"&&s[x]===Rt,Xe=s=>!!s&&typeof s=="object"&&s[x]===Lt,Ne=s=>!!s&&typeof s=="object"&&s[x]===z,C=s=>!!s&&typeof s=="object"&&s[x]===Ps,L=s=>!!s&&typeof s=="object"&&s[x]===U,Oe=s=>!!s&&typeof s=="object"&&s[x]===de;function N(s){if(s&&typeof s=="object")switch(s[x]){case z:case de:return!0}return!1}function O(s){if(s&&typeof s=="object")switch(s[x]){case Rt:case z:case U:case de:return!0}return!1}const Ms=s=>(L(s)||N(s))&&!!s.anchor,J=Symbol("break visit"),Cn=Symbol("skip children"),Se=Symbol("remove node");function pe(s,e){const t=Tn(e);Xe(s)?re(null,s.contents,t,Object.freeze([s]))===Se&&(s.contents=null):re(null,s,t,Object.freeze([]))}pe.BREAK=J;pe.SKIP=Cn;pe.REMOVE=Se;function re(s,e,t,n){const i=En(s,e,t,n);if(O(i)||C(i))return Pn(s,n,i),re(s,i,t,n);if(typeof i!="symbol"){if(N(e)){n=Object.freeze(n.concat(e));for(let r=0;r<e.items.length;++r){const o=re(r,e.items[r],t,n);if(typeof o=="number")r=o-1;else{if(o===J)return J;o===Se&&(e.items.splice(r,1),r-=1)}}}else if(C(e)){n=Object.freeze(n.concat(e));const r=re("key",e.key,t,n);if(r===J)return J;r===Se&&(e.key=null);const o=re("value",e.value,t,n);if(o===J)return J;o===Se&&(e.value=null)}}return i}function Tn(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function En(s,e,t,n){if(typeof t=="function")return t(s,e,n);if(Ne(e))return t.Map?.(s,e,n);if(Oe(e))return t.Seq?.(s,e,n);if(C(e))return t.Pair?.(s,e,n);if(L(e))return t.Scalar?.(s,e,n);if(Z(e))return t.Alias?.(s,e,n)}function Pn(s,e,t){const n=e[e.length-1];if(N(n))n.items[s]=t;else if(C(n))s==="key"?n.key=t:n.value=t;else if(Xe(n))n.contents=t;else{const i=Z(n)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const Mn={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Bn=s=>s.replace(/[!,[\]{}]/g,e=>Mn[e]);class E{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},E.defaultYaml,e),this.tags=Object.assign({},E.defaultTags,t)}clone(){const e=new E(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new E(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:E.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},E.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:E.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},E.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(n.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[r,o]=n;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,n.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=n;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}const[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const r=this.tags[n];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return n==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Bn(e.substring(n.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],n=Object.entries(this.tags);let i;if(e&&n.length>0&&O(e.contents)){const r={};pe(e.contents,(o,a)=>{O(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of n)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
2
- `)}}E.defaultYaml={explicit:!1,version:"1.2"};E.defaultTags={"!!":"tag:yaml.org,2002:"};function Bs(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function js(s){const e=new Set;return pe(s,{Value(t,n){n.anchor&&e.add(n.anchor)}}),e}function xs(s,e){for(let t=1;;++t){const n=`${s}${t}`;if(!e.has(n))return n}}function jn(s,e){const t=[],n=new Map;let i=null;return{onAnchor:r=>{t.push(r),i??(i=js(s));const o=xs(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=n.get(r);if(typeof o=="object"&&o.anchor&&(L(o.node)||N(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:n}}function oe(s,e,t,n){if(n&&typeof n=="object")if(Array.isArray(n))for(let i=0,r=n.length;i<r;++i){const o=n[i],a=oe(s,n,String(i),o);a===void 0?delete n[i]:a!==o&&(n[i]=a)}else if(n instanceof Map)for(const i of Array.from(n.keys())){const r=n.get(i),o=oe(s,n,i,r);o===void 0?n.delete(i):o!==r&&n.set(i,o)}else if(n instanceof Set)for(const i of Array.from(n)){const r=oe(s,n,i,i);r===void 0?n.delete(i):r!==i&&(n.delete(i),n.add(r))}else for(const[i,r]of Object.entries(n)){const o=oe(s,n,i,r);o===void 0?delete n[i]:o!==r&&(n[i]=o)}return s.call(e,t,n)}function j(s,e,t){if(Array.isArray(s))return s.map((n,i)=>j(n,String(i),t));if(s&&typeof s.toJSON=="function"){if(!t||!Ms(s))return s.toJSON(e,t);const n={aliasCount:0,count:1,res:void 0};t.anchors.set(s,n),t.onCreate=r=>{n.res=r,delete t.onCreate};const i=s.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof s=="bigint"&&!t?.keep?Number(s):s}class Dt{constructor(e){Object.defineProperty(this,x,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:i,reviver:r}={}){if(!Xe(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},a=j(this,"",o);if(typeof i=="function")for(const{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?oe(r,{"":a},"",a):a}}class Ft extends Dt{constructor(e){super(Rt),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],pe(e,{Node:(r,o)=>{(Z(o)||Ms(o))&&n.push(o)}}),t&&(t.aliasResolveCache=n));let i;for(const r of n){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:r}=t,o=this.resolve(i,t);if(!o){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=n.get(o);if(a||(j(o,null,t),a=n.get(o)),a?.res===void 0){const l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Ue(i,o,n)),a.count*a.aliasCount>r)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(Bs(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function Ue(s,e,t){if(Z(e)){const n=e.resolve(s),i=t&&n&&t.get(n);return i?i.count*i.aliasCount:0}else if(N(e)){let n=0;for(const i of e.items){const r=Ue(s,i,t);r>n&&(n=r)}return n}else if(C(e)){const n=Ue(s,e.key,t),i=Ue(s,e.value,t);return Math.max(n,i)}return 1}const Rs=s=>!s||typeof s!="function"&&typeof s!="object";class I extends Dt{constructor(e){super(U),this.value=e}toJSON(e,t){return t?.keep?this.value:j(this.value,e,t)}toString(){return String(this.value)}}I.BLOCK_FOLDED="BLOCK_FOLDED";I.BLOCK_LITERAL="BLOCK_LITERAL";I.PLAIN="PLAIN";I.QUOTE_DOUBLE="QUOTE_DOUBLE";I.QUOTE_SINGLE="QUOTE_SINGLE";const xn="tag:yaml.org,2002:";function Rn(s,e,t){if(e){const n=t.filter(r=>r.tag===e),i=n.find(r=>!r.format)??n[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(n=>n.identify?.(s)&&!n.format)}function Ae(s,e,t){if(Xe(s)&&(s=s.contents),O(s))return s;if(C(s)){const u=t.schema[z].createNode?.(t.schema,null,t);return u.items.push(s),u}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());const{aliasDuplicateObjects:n,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t;let l;if(n&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor??(l.anchor=i(s)),new Ft(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=xn+e.slice(2));let c=Rn(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){const u=new I(s);return l&&(l.node=u),u}c=s instanceof Map?o[z]:Symbol.iterator in Object(s)?o[de]:o[z]}r&&(r(c),delete t.onTagObj);const f=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new I(s);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}function We(s,e,t){let n=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=n,n=o}else n=new Map([[r,n]])}return Ae(n,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}const be=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done;class Ds extends Dt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(n=>O(n)||C(n)?n.clone(e):n),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(be(e))this.add(t);else{const[n,...i]=e,r=this.get(n,!0);if(N(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(n,We(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}deleteIn(e){const[t,...n]=e;if(n.length===0)return this.delete(t);const i=this.get(t,!0);if(N(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,r=this.get(n,!0);return i.length===0?!t&&L(r)?r.value:r:N(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!C(t))return!1;const n=t.value;return n==null||e&&L(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(n.length===0)return this.has(t);const i=this.get(t,!0);return N(i)?i.hasIn(n):!1}setIn(e,t){const[n,...i]=e;if(i.length===0)this.set(n,t);else{const r=this.get(n,!0);if(N(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(n,We(this.schema,i,t));else throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`)}}}const Dn=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function q(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}const Y=(s,e,t)=>s.endsWith(`
3
- `)?q(t,e):t.includes(`
4
- `)?`
5
- `+q(t,e):(s.endsWith(" ")?"":" ")+t,Fs="flow",$t="block",qe="quoted";function Ze(s,e,t="flow",{indentAtStart:n,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return s;i<r&&(r=0);const l=Math.max(1+r,1+i-e.length);if(s.length<=l)return s;const c=[],f={};let u=i-e.length;typeof n=="number"&&(n>i-Math.max(2,r)?c.push(0):u=i-n);let h,p,m=!1,d=-1,g=-1,b=-1;t===$t&&(d=ns(s,d,e.length),d!==-1&&(u=d+l));for(let S;S=s[d+=1];){if(t===qe&&S==="\\"){switch(g=d,s[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}b=d}if(S===`
6
- `)t===$t&&(d=ns(s,d,e.length)),u=d+e.length+l,h=void 0;else{if(S===" "&&p&&p!==" "&&p!==`
7
- `&&p!==" "){const v=s[d+1];v&&v!==" "&&v!==`
8
- `&&v!==" "&&(h=d)}if(d>=u)if(h)c.push(h),u=h+l,h=void 0;else if(t===qe){for(;p===" "||p===" ";)p=S,S=s[d+=1],m=!0;const v=d>b+1?d-2:g-1;if(f[v])return s;c.push(v),f[v]=!0,u=v+l,h=void 0}else m=!0}p=S}if(m&&a&&a(),c.length===0)return s;o&&o();let y=s.slice(0,c[0]);for(let S=0;S<c.length;++S){const v=c[S],w=c[S+1]||s.length;v===0?y=`
9
- ${e}${s.slice(0,w)}`:(t===qe&&f[v]&&(y+=`${s[v]}\\`),y+=`
10
- ${e}${s.slice(v+1,w)}`)}return y}function ns(s,e,t){let n=e,i=e+1,r=s[i];for(;r===" "||r===" ";)if(e<i+t)r=s[++e];else{do r=s[++e];while(r&&r!==`
11
- `);n=e,i=e+1,r=s[i]}return n}const et=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),tt=s=>/^(%|---|\.\.\.)/m.test(s);function Fn(s,e,t){if(!e||e<0)return!1;const n=e-t,i=s.length;if(i<=n)return!1;for(let r=0,o=0;r<i;++r)if(s[r]===`
12
- `){if(r-o>n)return!0;if(o=r+1,i-o<=n)return!1}return!0}function _e(s,e){const t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:n}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(tt(s)?" ":"");let o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);const f=t.substr(l+2,4);switch(f){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(n||t[l+2]==='"'||t.length<i)l+=1;else{for(o+=t.slice(a,l)+`
13
-
14
- `;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
15
- `,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,n?o:Ze(o,r,qe,et(e,!1))}function Nt(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(`
16
- `)||/[ \t]\n|\n[ \t]/.test(s))return _e(s,e);const t=e.indent||(tt(s)?" ":""),n="'"+s.replace(/'/g,"''").replace(/\n+/g,`$&
17
- ${t}`)+"'";return e.implicitKey?n:Ze(n,t,Fs,et(e,!1))}function ae(s,e){const{singleQuote:t}=e.options;let n;if(t===!1)n=_e;else{const i=s.includes('"'),r=s.includes("'");i&&!r?n=Nt:r&&!i?n=_e:n=t?Nt:_e}return n(s,e)}let Ot;try{Ot=new RegExp(`(^|(?<!
18
- ))
19
- +(?!
20
- |$)`,"g")}catch{Ot=/\n+(?!\n|$)/g}function Ve({comment:s,type:e,value:t},n,i,r){const{blockQuote:o,commentString:a,lineWidth:l}=n.options;if(!o||/\n[\t ]+$/.test(t))return ae(t,n);const c=n.indent||(n.forceBlockIndent||tt(t)?" ":""),f=o==="literal"?!0:o==="folded"||e===I.BLOCK_FOLDED?!1:e===I.BLOCK_LITERAL?!0:!Fn(t,l,c.length);if(!t)return f?`|
21
- `:`>
22
- `;let u,h;for(h=t.length;h>0;--h){const w=t[h-1];if(w!==`
23
- `&&w!==" "&&w!==" ")break}let p=t.substring(h);const m=p.indexOf(`
24
- `);m===-1?u="-":t===p||m!==p.length-1?(u="+",r&&r()):u="",p&&(t=t.slice(0,-p.length),p[p.length-1]===`
25
- `&&(p=p.slice(0,-1)),p=p.replace(Ot,`$&${c}`));let d=!1,g,b=-1;for(g=0;g<t.length;++g){const w=t[g];if(w===" ")d=!0;else if(w===`
26
- `)b=g;else break}let y=t.substring(0,b<g?b+1:g);y&&(t=t.substring(y.length),y=y.replace(/\n+/g,`$&${c}`));let v=(d?c?"2":"1":"")+u;if(s&&(v+=" "+a(s.replace(/ ?[\r\n]+/g," ")),i&&i()),!f){const w=t.replace(/\n+/g,`
27
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);let k=!1;const A=et(n,!0);o!=="folded"&&e!==I.BLOCK_FOLDED&&(A.onOverflow=()=>{k=!0});const _=Ze(`${y}${w}${p}`,c,$t,A);if(!k)return`>${v}
28
- ${c}${_}`}return t=t.replace(/\n+/g,`$&${c}`),`|${v}
29
- ${c}${y}${t}${p}`}function Kn(s,e,t,n){const{type:i,value:r}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&r.includes(`
30
- `)||f&&/[[\]{},]/.test(r))return ae(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||f||!r.includes(`
31
- `)?ae(r,e):Ve(s,e,t,n);if(!a&&!f&&i!==I.PLAIN&&r.includes(`
32
- `))return Ve(s,e,t,n);if(tt(r)){if(l==="")return e.forceBlockIndent=!0,Ve(s,e,t,n);if(a&&l===c)return ae(r,e)}const u=r.replace(/\n+/g,`$&
33
- ${l}`);if(o){const h=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(u),{compat:p,tags:m}=e.doc.schema;if(m.some(h)||p?.some(h))return ae(r,e)}return a?u:Ze(u,l,Fs,et(e,!1))}function Kt(s,e,t,n){const{implicitKey:i,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)});let{type:a}=s;a!==I.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=I.QUOTE_DOUBLE);const l=f=>{switch(f){case I.BLOCK_FOLDED:case I.BLOCK_LITERAL:return i||r?ae(o.value,e):Ve(o,e,t,n);case I.QUOTE_DOUBLE:return _e(o.value,e);case I.QUOTE_SINGLE:return Nt(o.value,e);case I.PLAIN:return Kn(o,e,t,n);default:return null}};let c=l(a);if(c===null){const{defaultKeyType:f,defaultStringType:u}=e.options,h=i&&f||u;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function Ks(s,e){const t=Object.assign({blockQuote:!0,commentString:Dn,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e);let n;switch(t.collectionStyle){case"block":n=!1;break;case"flow":n=!0;break;default:n=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:n,options:t}}function Un(s,e){if(e.tag){const i=s.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,n;if(L(e)){n=e.value;let i=s.filter(r=>r.identify?.(n));if(i.length>1){const r=i.filter(o=>o.test);r.length>0&&(i=r)}t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else n=e,t=s.find(i=>i.nodeClass&&n instanceof i.nodeClass);if(!t){const i=n?.constructor?.name??(n===null?"null":typeof n);throw new Error(`Tag not resolved for ${i} value`)}return t}function qn(s,e,{anchors:t,doc:n}){if(!n.directives)return"";const i=[],r=(L(s)||N(s))&&s.anchor;r&&Bs(r)&&(t.add(r),i.push(`&${r}`));const o=s.tag??(e.default?null:e.tag);return o&&i.push(n.directives.tagString(o)),i.join(" ")}function fe(s,e,t,n){if(C(s))return s.toString(e,t,n);if(Z(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let i;const r=O(s)?s:e.doc.createNode(s,{onTagObj:l=>i=l});i??(i=Un(e.doc.schema.tags,r));const o=qn(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const a=typeof i.stringify=="function"?i.stringify(r,e,t,n):L(r)?Kt(r,e,t,n):r.toString(e,t,n);return o?L(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
34
- ${e.indent}${a}`:a}function Vn({key:s,value:e},t,n,i){const{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:u}}=t;let h=O(s)&&s.comment||null;if(u){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(N(s)||!O(s)&&typeof s=="object"){const A="With simple keys, collection cannot be used as a key value";throw new Error(A)}}let p=!u&&(!s||h&&e==null&&!t.inFlow||N(s)||(L(s)?s.type===I.BLOCK_FOLDED||s.type===I.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(u||!r),indent:a+l});let m=!1,d=!1,g=fe(s,t,()=>m=!0,()=>d=!0);if(!p&&!t.inFlow&&g.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return m&&n&&n(),g===""?"?":p?`? ${g}`:g}else if(r&&!u||e==null&&p)return g=`? ${g}`,h&&!m?g+=Y(g,t.indent,c(h)):d&&i&&i(),g;m&&(h=null),p?(h&&(g+=Y(g,t.indent,c(h))),g=`? ${g}
35
- ${a}:`):(g=`${g}:`,h&&(g+=Y(g,t.indent,c(h))));let b,y,S;O(e)?(b=!!e.spaceBefore,y=e.commentBefore,S=e.comment):(b=!1,y=null,S=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!h&&L(e)&&(t.indentAtStart=g.length+1),d=!1,!f&&l.length>=2&&!t.inFlow&&!p&&Oe(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let v=!1;const w=fe(e,t,()=>v=!0,()=>d=!0);let k=" ";if(h||b||y){if(k=b?`
36
- `:"",y){const A=c(y);k+=`
37
- ${q(A,t.indent)}`}w===""&&!t.inFlow?k===`
38
- `&&S&&(k=`
39
-
40
- `):k+=`
41
- ${t.indent}`}else if(!p&&N(e)){const A=w[0],_=w.indexOf(`
42
- `),$=_!==-1,R=t.inFlow??e.flow??e.items.length===0;if($||!R){let H=!1;if($&&(A==="&"||A==="!")){let T=w.indexOf(" ");A==="&"&&T!==-1&&T<_&&w[T+1]==="!"&&(T=w.indexOf(" ",T+1)),(T===-1||_<T)&&(H=!0)}H||(k=`
43
- ${t.indent}`)}}else(w===""||w[0]===`
44
- `)&&(k="");return g+=k+w,t.inFlow?v&&n&&n():S&&!v?g+=Y(g,t.indent,c(S)):d&&i&&i(),g}function Us(s,e){(s==="debug"||s==="warn")&&console.warn(e)}const Ee="<<",V={identify:s=>s===Ee||typeof s=="symbol"&&s.description===Ee,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new I(Symbol(Ee)),{addToJSMap:qs}),stringify:()=>Ee},Hn=(s,e)=>(V.identify(e)||L(e)&&(!e.type||e.type===I.PLAIN)&&V.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===V.tag&&t.default);function qs(s,e,t){if(t=s&&Z(t)?t.resolve(s.doc):t,Oe(t))for(const n of t.items)ft(s,e,n);else if(Array.isArray(t))for(const n of t)ft(s,e,n);else ft(s,e,t)}function ft(s,e,t){const n=s&&Z(t)?t.resolve(s.doc):t;if(!Ne(n))throw new Error("Merge sources must be maps or map aliases");const i=n.toJSON(null,s,Map);for(const[r,o]of i)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}function Vs(s,e,{key:t,value:n}){if(O(t)&&t.addToJSMap)t.addToJSMap(s,e,n);else if(Hn(s,t))qs(s,e,n);else{const i=j(t,"",s);if(e instanceof Map)e.set(i,j(n,i,s));else if(e instanceof Set)e.add(i);else{const r=Wn(t,i,s),o=j(n,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Wn(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(O(s)&&t?.doc){const n=Ks(t.doc,{});n.anchors=new Set;for(const r of t.anchors.keys())n.anchors.add(r.anchor);n.inFlow=!0,n.inStringifyKey=!0;const i=s.toString(n);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),Us(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return i}return JSON.stringify(e)}function Ut(s,e,t){const n=Ae(s,void 0,t),i=Ae(e,void 0,t);return new P(n,i)}class P{constructor(e,t=null){Object.defineProperty(this,x,{value:Ps}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return O(t)&&(t=t.clone(e)),O(n)&&(n=n.clone(e)),new P(t,n)}toJSON(e,t){const n=t?.mapAsMap?new Map:{};return Vs(t,n,this)}toString(e,t,n){return e?.doc?Vn(this,e,t,n):JSON.stringify(this)}}function Hs(s,e,t){return(e.inFlow??s.flow?Jn:zn)(s,e,t)}function zn({comment:s,items:e},t,{blockItemPrefix:n,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){const{indent:l,options:{commentString:c}}=t,f=Object.assign({},t,{indent:r,type:null});let u=!1;const h=[];for(let m=0;m<e.length;++m){const d=e[m];let g=null;if(O(d))!u&&d.spaceBefore&&h.push(""),ze(t,h,d.commentBefore,u),d.comment&&(g=d.comment);else if(C(d)){const y=O(d.key)?d.key:null;y&&(!u&&y.spaceBefore&&h.push(""),ze(t,h,y.commentBefore,u))}u=!1;let b=fe(d,f,()=>g=null,()=>u=!0);g&&(b+=Y(b,r,c(g))),u&&g&&(u=!1),h.push(n+b)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let m=1;m<h.length;++m){const d=h[m];p+=d?`
45
- ${l}${d}`:`
46
- `}}return s?(p+=`
47
- `+q(c(s),l),a&&a()):u&&o&&o(),p}function Jn({items:s},e,{flowChars:t,itemIndent:n}){const{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=e;n+=r;const l=Object.assign({},e,{indent:n,inFlow:!0,type:null});let c=!1,f=0;const u=[];for(let m=0;m<s.length;++m){const d=s[m];let g=null;if(O(d))d.spaceBefore&&u.push(""),ze(e,u,d.commentBefore,!1),d.comment&&(g=d.comment);else if(C(d)){const y=O(d.key)?d.key:null;y&&(y.spaceBefore&&u.push(""),ze(e,u,y.commentBefore,!1),y.comment&&(c=!0));const S=O(d.value)?d.value:null;S?(S.comment&&(g=S.comment),S.commentBefore&&(c=!0)):d.value==null&&y?.comment&&(g=y.comment)}g&&(c=!0);let b=fe(d,l,()=>g=null);c||(c=u.length>f||b.includes(`
48
- `)),m<s.length-1?b+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=u.reduce((y,S)=>y+S.length+2,2)+(b.length+2)>e.options.lineWidth)),c&&(b+=",")),g&&(b+=Y(b,n,a(g))),u.push(b),f=u.length}const{start:h,end:p}=t;if(u.length===0)return h+p;if(!c){const m=u.reduce((d,g)=>d+g.length+2,2);c=e.options.lineWidth>0&&m>e.options.lineWidth}if(c){let m=h;for(const d of u)m+=d?`
49
- ${r}${i}${d}`:`
50
- `;return`${m}
51
- ${i}${p}`}else return`${h}${o}${u.join(" ")}${o}${p}`}function ze({indent:s,options:{commentString:e}},t,n,i){if(n&&i&&(n=n.replace(/^\n+/,"")),n){const r=q(e(n),s);t.push(r.trimStart())}}function Q(s,e){const t=L(e)?e.value:e;for(const n of s)if(C(n)&&(n.key===e||n.key===t||L(n.key)&&n.key.value===t))return n}class B extends Ds{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(z,e),this.items=[]}static from(e,t,n){const{keepUndefined:i,replacer:r}=n,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(t,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||i)&&o.items.push(Ut(l,c,n))};if(t instanceof Map)for(const[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(const l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let n;C(e)?n=e:!e||typeof e!="object"||!("key"in e)?n=new P(e,e?.value):n=new P(e.key,e.value);const i=Q(this.items,n.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);L(i.value)&&Rs(n.value)?i.value.value=n.value:i.value=n.value}else if(r){const o=this.items.findIndex(a=>r(n,a)<0);o===-1?this.items.push(n):this.items.splice(o,0,n)}else this.items.push(n)}delete(e){const t=Q(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const i=Q(this.items,e)?.value;return(!t&&L(i)?i.value:i)??void 0}has(e){return!!Q(this.items,e)}set(e,t){this.add(new P(e,t),!0)}toJSON(e,t,n){const i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(const r of this.items)Vs(t,i,r);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(const i of this.items)if(!C(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Hs(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}const ge={collection:"map",default:!0,nodeClass:B,tag:"tag:yaml.org,2002:map",resolve(s,e){return Ne(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>B.from(s,e,t)};class X extends Ds{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(de,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Pe(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const n=Pe(e);if(typeof n!="number")return;const i=this.items[n];return!t&&L(i)?i.value:i}has(e){const t=Pe(e);return typeof t=="number"&&t<this.items.length}set(e,t){const n=Pe(e);if(typeof n!="number")throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[n];L(i)&&Rs(t)?i.value=t:this.items[n]=t}toJSON(e,t){const n=[];t?.onCreate&&t.onCreate(n);let i=0;for(const r of this.items)n.push(j(r,String(i++),t));return n}toString(e,t,n){return e?Hs(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){const{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof i=="function"){const l=t instanceof Set?a:String(o++);a=i.call(t,l,a)}r.items.push(Ae(a,void 0,n))}}return r}}function Pe(s){let e=L(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const me={collection:"seq",default:!0,nodeClass:X,tag:"tag:yaml.org,2002:seq",resolve(s,e){return Oe(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>X.from(s,e,t)},st={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,n){return e=Object.assign({actualString:!0},e),Kt(s,e,t,n)}},nt={identify:s=>s==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new I(null),stringify:({source:s},e)=>typeof s=="string"&&nt.test.test(s)?s:e.options.nullStr},qt={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new I(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&qt.test.test(s)){const n=s[0]==="t"||s[0]==="T";if(e===n)return s}return e?t.options.trueStr:t.options.falseStr}};function F({format:s,minFractionDigits:e,tag:t,value:n}){if(typeof n=="bigint")return String(n);const i=typeof n=="number"?n:Number(n);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(n,-0)?"-0":JSON.stringify(n);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}const Ws={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:F},zs={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():F(s)}},Js={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){const e=new I(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:F},it=s=>typeof s=="bigint"||Number.isInteger(s),Vt=(s,e,t,{intAsBigInt:n})=>n?BigInt(s):parseInt(s.substring(e),t);function Gs(s,e,t){const{value:n}=s;return it(n)&&n>=0?t+n.toString(e):F(s)}const Ys={identify:s=>it(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>Vt(s,2,8,t),stringify:s=>Gs(s,8,"0o")},Qs={identify:it,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>Vt(s,0,10,t),stringify:F},Xs={identify:s=>it(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>Vt(s,2,16,t),stringify:s=>Gs(s,16,"0x")},Gn=[ge,me,st,nt,qt,Ys,Qs,Xs,Ws,zs,Js];function is(s){return typeof s=="bigint"||Number.isInteger(s)}const Me=({value:s})=>JSON.stringify(s),Yn=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:Me},{identify:s=>s==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Me},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:Me},{identify:is,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>is(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:Me}],Qn={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Xn=[ge,me].concat(Yn,Qn),Ht={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof atob=="function"){const t=atob(s.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let i=0;i<t.length;++i)n[i]=t.charCodeAt(i);return n}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},n,i,r){if(!t)return"";const o=t;let a;if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[c]);a=btoa(l)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=I.BLOCK_LITERAL),e!==I.QUOTE_DOUBLE){const l=Math.max(n.options.lineWidth-n.indent.length,n.options.minContentWidth),c=Math.ceil(a.length/l),f=new Array(c);for(let u=0,h=0;u<c;++u,h+=l)f[u]=a.substr(h,l);a=f.join(e===I.BLOCK_LITERAL?`
52
- `:" ")}return Kt({comment:s,type:e,value:a},n,i,r)}};function Zs(s,e){if(Oe(s))for(let t=0;t<s.items.length;++t){let n=s.items[t];if(!C(n)){if(Ne(n)){n.items.length>1&&e("Each pair must have its own sequence indicator");const i=n.items[0]||new P(new I(null));if(n.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${n.commentBefore}
53
- ${i.key.commentBefore}`:n.commentBefore),n.comment){const r=i.value??i.key;r.comment=r.comment?`${n.comment}
54
- ${r.comment}`:n.comment}n=i}s.items[t]=C(n)?n:new P(n)}}else e("Expected a sequence for this tag");return s}function en(s,e,t){const{replacer:n}=t,i=new X(s);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof n=="function"&&(o=n.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(Ut(a,l,t))}return i}const Wt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Zs,createNode:en};class le extends X{constructor(){super(),this.add=B.prototype.add.bind(this),this.delete=B.prototype.delete.bind(this),this.get=B.prototype.get.bind(this),this.has=B.prototype.has.bind(this),this.set=B.prototype.set.bind(this),this.tag=le.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t?.onCreate&&t.onCreate(n);for(const i of this.items){let r,o;if(C(i)?(r=j(i.key,"",t),o=j(i.value,r,t)):r=j(i,"",t),n.has(r))throw new Error("Ordered maps must not include duplicate keys");n.set(r,o)}return n}static from(e,t,n){const i=en(e,t,n),r=new this;return r.items=i.items,r}}le.tag="tag:yaml.org,2002:omap";const zt={collection:"seq",identify:s=>s instanceof Map,nodeClass:le,default:!1,tag:"tag:yaml.org,2002:omap",resolve(s,e){const t=Zs(s,e),n=[];for(const{key:i}of t.items)L(i)&&(n.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):n.push(i.value));return Object.assign(new le,t)},createNode:(s,e,t)=>le.from(s,e,t)};function tn({value:s,source:e},t){return e&&(s?sn:nn).test.test(e)?e:s?t.options.trueStr:t.options.falseStr}const sn={identify:s=>s===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new I(!0),stringify:tn},nn={identify:s=>s===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new I(!1),stringify:tn},Zn={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:F},ei={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s.replace(/_/g,"")),stringify(s){const e=Number(s.value);return isFinite(e)?e.toExponential():F(s)}},ti={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(s){const e=new I(parseFloat(s.replace(/_/g,""))),t=s.indexOf(".");if(t!==-1){const n=s.substring(t+1).replace(/_/g,"");n[n.length-1]==="0"&&(e.minFractionDigits=n.length)}return e},stringify:F},Ce=s=>typeof s=="bigint"||Number.isInteger(s);function rt(s,e,t,{intAsBigInt:n}){const i=s[0];if((i==="-"||i==="+")&&(e+=1),s=s.substring(e).replace(/_/g,""),n){switch(t){case 2:s=`0b${s}`;break;case 8:s=`0o${s}`;break;case 16:s=`0x${s}`;break}const o=BigInt(s);return i==="-"?BigInt(-1)*o:o}const r=parseInt(s,t);return i==="-"?-1*r:r}function Jt(s,e,t){const{value:n}=s;if(Ce(n)){const i=n.toString(e);return n<0?"-"+t+i.substr(1):t+i}return F(s)}const si={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(s,e,t)=>rt(s,2,2,t),stringify:s=>Jt(s,2,"0b")},ni={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(s,e,t)=>rt(s,1,8,t),stringify:s=>Jt(s,8,"0")},ii={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(s,e,t)=>rt(s,0,10,t),stringify:F},ri={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(s,e,t)=>rt(s,2,16,t),stringify:s=>Jt(s,16,"0x")};class ce extends B{constructor(e){super(e),this.tag=ce.tag}add(e){let t;C(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new P(e.key,null):t=new P(e,null),Q(this.items,t.key)||this.items.push(t)}get(e,t){const n=Q(this.items,e);return!t&&C(n)?L(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const n=Q(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new P(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw new Error("Set items must all have null values")}static from(e,t,n){const{replacer:i}=n,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i=="function"&&(o=i.call(t,o,o)),r.items.push(Ut(o,null,n));return r}}ce.tag="tag:yaml.org,2002:set";const Gt={collection:"map",identify:s=>s instanceof Set,nodeClass:ce,default:!1,tag:"tag:yaml.org,2002:set",createNode:(s,e,t)=>ce.from(s,e,t),resolve(s,e){if(Ne(s)){if(s.hasAllNullValues(!0))return Object.assign(new ce,s);e("Set items must all have null values")}else e("Expected a mapping for this tag");return s}};function Yt(s,e){const t=s[0],n=t==="-"||t==="+"?s.substring(1):s,i=o=>e?BigInt(o):Number(o),r=n.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return t==="-"?i(-1)*r:r}function rn(s){let{value:e}=s,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return F(s);let n="";e<0&&(n="-",e*=t(-1));const i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),n+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const on={identify:s=>typeof s=="bigint"||Number.isInteger(s),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(s,e,{intAsBigInt:t})=>Yt(s,t),stringify:rn},an={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:s=>Yt(s,!1),stringify:rn},ot={identify:s=>s instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(s){const e=s.match(ot.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,n,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0;let c=Date.UTC(t,n-1,i,r||0,o||0,a||0,l);const f=e[8];if(f&&f!=="Z"){let u=Yt(f,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:s})=>s?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},rs=[ge,me,st,nt,sn,nn,si,ni,ii,ri,Zn,ei,ti,Ht,V,zt,Wt,Gt,on,an,ot],os=new Map([["core",Gn],["failsafe",[ge,me,st]],["json",Xn],["yaml11",rs],["yaml-1.1",rs]]),as={binary:Ht,bool:qt,float:Js,floatExp:zs,floatNaN:Ws,floatTime:an,int:Qs,intHex:Xs,intOct:Ys,intTime:on,map:ge,merge:V,null:nt,omap:zt,pairs:Wt,seq:me,set:Gt,timestamp:ot},oi={"tag:yaml.org,2002:binary":Ht,"tag:yaml.org,2002:merge":V,"tag:yaml.org,2002:omap":zt,"tag:yaml.org,2002:pairs":Wt,"tag:yaml.org,2002:set":Gt,"tag:yaml.org,2002:timestamp":ot};function ut(s,e,t){const n=os.get(e);if(n&&!s)return t&&!n.includes(V)?n.concat(V):n.slice();let i=n;if(!i)if(Array.isArray(s))i=[];else{const r=Array.from(os.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(s))for(const r of s)i=i.concat(r);else typeof s=="function"&&(i=s(i.slice()));return t&&(i=i.concat(V)),i.reduce((r,o)=>{const a=typeof o=="string"?as[o]:o;if(!a){const l=JSON.stringify(o),c=Object.keys(as).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}const ai=(s,e)=>s.key<e.key?-1:s.key>e.key?1:0;class Qt{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ut(e,"compat"):e?ut(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?oi:{},this.tags=ut(t,this.name,n),this.toStringOptions=a??null,Object.defineProperty(this,z,{value:ge}),Object.defineProperty(this,U,{value:st}),Object.defineProperty(this,de,{value:me}),this.sortMapEntries=typeof o=="function"?o:o===!0?ai:null}clone(){const e=Object.create(Qt.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function li(s,e){const t=[];let n=e.directives===!0;if(e.directives!==!1&&s.directives){const l=s.directives.toString(s);l?(t.push(l),n=!0):s.directives.docStart&&(n=!0)}n&&t.push("---");const i=Ks(s,e),{commentString:r}=i.options;if(s.commentBefore){t.length!==1&&t.unshift("");const l=r(s.commentBefore);t.unshift(q(l,""))}let o=!1,a=null;if(s.contents){if(O(s.contents)){if(s.contents.spaceBefore&&n&&t.push(""),s.contents.commentBefore){const f=r(s.contents.commentBefore);t.push(q(f,""))}i.forceBlockIndent=!!s.comment,a=s.contents.comment}const l=a?void 0:()=>o=!0;let c=fe(s.contents,i,()=>a=null,l);a&&(c+=Y(c,"",r(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(fe(s.contents,i));if(s.directives?.docEnd)if(s.comment){const l=r(s.comment);l.includes(`
55
- `)?(t.push("..."),t.push(q(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(q(r(l),"")))}return t.join(`
56
- `)+`
57
- `}class at{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,x,{value:Lt});let i=null;typeof t=="function"||Array.isArray(t)?i=t:n===void 0&&t&&(n=t,t=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=r;let{version:o}=r;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new E({version:o}),this.setSchema(o,n),this.contents=e===void 0?null:this.createNode(e,i,n)}clone(){const e=Object.create(at.prototype,{[x]:{value:Lt}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=O(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ee(this.contents)&&this.contents.add(e)}addIn(e,t){ee(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=js(this);e.anchor=!t||n.has(t)?xs(t||"a",n):t}return new Ft(e.anchor)}createNode(e,t,n){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){const g=y=>typeof y=="number"||y instanceof String||y instanceof Number,b=t.filter(g).map(String);b.length>0&&(t=t.concat(b)),i=t}else n===void 0&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=n??{},{onAnchor:u,setAnchors:h,sourceObjects:p}=jn(this,o||"a"),m={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},d=Ae(e,f,m);return a&&N(d)&&(d.flow=!0),h(),d}createPair(e,t,n={}){const i=this.createNode(e,null,n),r=this.createNode(t,null,n);return new P(i,r)}delete(e){return ee(this.contents)?this.contents.delete(e):!1}deleteIn(e){return be(e)?this.contents==null?!1:(this.contents=null,!0):ee(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return N(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return be(e)?!t&&L(this.contents)?this.contents.value:this.contents:N(this.contents)?this.contents.getIn(e,t):void 0}has(e){return N(this.contents)?this.contents.has(e):!1}hasIn(e){return be(e)?this.contents!==void 0:N(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=We(this.schema,[e],t):ee(this.contents)&&this.contents.set(e,t)}setIn(e,t){be(e)?this.contents=t:this.contents==null?this.contents=We(this.schema,Array.from(e),t):ee(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let n;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new E({version:"1.1"}),n={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new E({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Qt(Object.assign(n,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:r,reviver:o}={}){const a={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=j(this.contents,t??"",a);if(typeof r=="function")for(const{count:c,res:f}of a.anchors.values())r(f,c);return typeof o=="function"?oe(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return li(this,e)}}function ee(s){if(N(s))return!0;throw new Error("Expected a YAML collection as document contents")}class ln extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}}class we extends ln{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class ci extends ln{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const ls=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));const{line:n,col:i}=t.linePos[0];t.message+=` at line ${n}, column ${i}`;let r=i-1,o=s.substring(e.lineStarts[n-1],e.lineStarts[n]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){const a=Math.min(r-39,o.length-79);o="…"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"…"),n>1&&/^ *$/.test(o.substring(0,r))){let a=s.substring(e.lineStarts[n-2],e.lineStarts[n-1]);a.length>80&&(a=a.substring(0,79)+`…
58
- `),o=a+o}if(/[^ ]/.test(o)){let a=1;const l=t.linePos[1];l?.line===n&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-r)));const c=" ".repeat(r)+"^".repeat(a);t.message+=`:
59
-
60
- ${o}
61
- ${c}
62
- `}};function ue(s,{flow:e,indicator:t,next:n,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,f=a,u="",h="",p=!1,m=!1,d=null,g=null,b=null,y=null,S=null,v=null,w=null;for(const _ of s)switch(m&&(_.type!=="space"&&_.type!=="newline"&&_.type!=="comma"&&r(_.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),d&&(c&&_.type!=="comment"&&_.type!=="newline"&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),_.type){case"space":!e&&(t!=="doc-start"||n?.type!=="flow-collection")&&_.source.includes(" ")&&(d=_),f=!0;break;case"comment":{f||r(_,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const $=_.source.substring(1)||" ";u?u+=h+$:u=$,h="",c=!1;break}case"newline":c?u?u+=_.source:(!v||t!=="seq-item-ind")&&(l=!0):h+=_.source,c=!0,p=!0,(g||b)&&(y=_),f=!0;break;case"anchor":g&&r(_,"MULTIPLE_ANCHORS","A node can have at most one anchor"),_.source.endsWith(":")&&r(_.offset+_.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=_,w??(w=_.offset),c=!1,f=!1,m=!0;break;case"tag":{b&&r(_,"MULTIPLE_TAGS","A node can have at most one tag"),b=_,w??(w=_.offset),c=!1,f=!1,m=!0;break}case t:(g||b)&&r(_,"BAD_PROP_ORDER",`Anchors and tags must be after the ${_.source} indicator`),v&&r(_,"UNEXPECTED_TOKEN",`Unexpected ${_.source} in ${e??"collection"}`),v=_,c=t==="seq-item-ind"||t==="explicit-key-ind",f=!1;break;case"comma":if(e){S&&r(_,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=_,c=!1,f=!1;break}default:r(_,"UNEXPECTED_TOKEN",`Unexpected ${_.type} token`),c=!1,f=!1}const k=s[s.length-1],A=k?k.offset+k.source.length:i;return m&&n&&n.type!=="space"&&n.type!=="newline"&&n.type!=="comma"&&(n.type!=="scalar"||n.source!=="")&&r(n.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=o||n?.type==="block-map"||n?.type==="block-seq")&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:v,spaceBefore:l,comment:u,hasNewline:p,anchor:g,tag:b,newlineAfterProp:y,end:A,start:w??A}}function Le(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(`
63
- `))return!0;if(s.end){for(const e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of s.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(Le(e.key)||Le(e.value))return!0}return!1;default:return!0}}function Ct(s,e,t){if(e?.type==="flow-collection"){const n=e.end[0];n.indent===s&&(n.source==="]"||n.source==="}")&&Le(e)&&t(n,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function cn(s,e,t){const{uniqueKeys:n}=s.options;if(n===!1)return!1;const i=typeof n=="function"?n:(r,o)=>r===o||L(r)&&L(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}const cs="All mapping items must start at the same column";function fi({composeNode:s,composeEmptyNode:e},t,n,i,r){const o=r?.nodeClass??B,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=n.offset,c=null;for(const f of n.items){const{start:u,key:h,sep:p,value:m}=f,d=ue(u,{indicator:"explicit-key-ind",next:h??p?.[0],offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0}),g=!d.found;if(g){if(h&&(h.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==n.indent&&i(l,"BAD_INDENT",cs)),!d.anchor&&!d.tag&&!p){c=d.end,d.comment&&(a.comment?a.comment+=`
64
- `+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||Le(h))&&i(h??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==n.indent&&i(l,"BAD_INDENT",cs);t.atKey=!0;const b=d.end,y=h?s(t,h,d,i):e(t,b,u,null,d,i);t.schema.compat&&Ct(n.indent,h,i),t.atKey=!1,cn(t,a.items,y)&&i(b,"DUPLICATE_KEY","Map keys must be unique");const S=ue(p??[],{indicator:"map-value-ind",next:m,offset:y.range[2],onError:i,parentIndent:n.indent,startOnNewline:!h||h.type==="block-scalar"});if(l=S.end,S.found){g&&(m?.type==="block-map"&&!S.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start<S.found.offset-1024&&i(y.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const v=m?s(t,m,S,i):e(t,l,p,null,S,i);t.schema.compat&&Ct(n.indent,m,i),l=v.range[2];const w=new P(y,v);t.options.keepSourceTokens&&(w.srcToken=f),a.items.push(w)}else{g&&i(y.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(y.comment?y.comment+=`
65
- `+S.comment:y.comment=S.comment);const v=new P(y);t.options.keepSourceTokens&&(v.srcToken=f),a.items.push(v)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[n.offset,l,c??l],a}function ui({composeNode:s,composeEmptyNode:e},t,n,i,r){const o=r?.nodeClass??X,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=n.offset,c=null;for(const{start:f,value:u}of n.items){const h=ue(f,{indicator:"seq-item-ind",next:u,offset:l,onError:i,parentIndent:n.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||u)u?.type==="block-seq"?i(h.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=h.end,h.comment&&(a.comment=h.comment);continue}const p=u?s(t,u,h,i):e(t,h.end,f,null,h,i);t.schema.compat&&Ct(n.indent,u,i),l=p.range[2],a.items.push(p)}return a.range=[n.offset,l,c??l],a}function Te(s,e,t,n){let i="";if(s){let r=!1,o="";for(const a of s){const{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&n(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const f=l.substring(1)||" ";i?i+=o+f:i=f,o="";break}case"newline":i&&(o+=l),r=!0;break;default:n(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}const ht="Block collections are not allowed within flow collections",dt=s=>s&&(s.type==="block-map"||s.type==="block-seq");function hi({composeNode:s,composeEmptyNode:e},t,n,i,r){const o=n.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?B:X),c=new l(t.schema);c.flow=!0;const f=t.atRoot;f&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=n.offset+n.start.source.length;for(let g=0;g<n.items.length;++g){const b=n.items[g],{start:y,key:S,sep:v,value:w}=b,k=ue(y,{flow:a,indicator:"explicit-key-ind",next:S??v?.[0],offset:u,onError:i,parentIndent:n.indent,startOnNewline:!1});if(!k.found){if(!k.anchor&&!k.tag&&!v&&!w){g===0&&k.comma?i(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<n.items.length-1&&i(k.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),k.comment&&(c.comment?c.comment+=`
66
- `+k.comment:c.comment=k.comment),u=k.end;continue}!o&&t.options.strict&&Le(S)&&i(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)k.comma&&i(k.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(k.comma||i(k.start,"MISSING_CHAR",`Missing , between ${a} items`),k.comment){let A="";e:for(const _ of y)switch(_.type){case"comma":case"space":break;case"comment":A=_.source.substring(1);break e;default:break e}if(A){let _=c.items[c.items.length-1];C(_)&&(_=_.value??_.key),_.comment?_.comment+=`
67
- `+A:_.comment=A,k.comment=k.comment.substring(A.length+1)}}if(!o&&!v&&!k.found){const A=w?s(t,w,k,i):e(t,k.end,v,null,k,i);c.items.push(A),u=A.range[2],dt(w)&&i(A.range,"BLOCK_IN_FLOW",ht)}else{t.atKey=!0;const A=k.end,_=S?s(t,S,k,i):e(t,A,y,null,k,i);dt(S)&&i(_.range,"BLOCK_IN_FLOW",ht),t.atKey=!1;const $=ue(v??[],{flow:a,indicator:"map-value-ind",next:w,offset:_.range[2],onError:i,parentIndent:n.indent,startOnNewline:!1});if($.found){if(!o&&!k.found&&t.options.strict){if(v)for(const T of v){if(T===$.found)break;if(T.type==="newline"){i(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}k.start<$.found.offset-1024&&i($.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source?.[0]===":"?i(w,"MISSING_CHAR",`Missing space after : in ${a}`):i($.start,"MISSING_CHAR",`Missing , or : between ${a} items`));const R=w?s(t,w,$,i):$.found?e(t,$.end,v,null,$,i):null;R?dt(w)&&i(R.range,"BLOCK_IN_FLOW",ht):$.comment&&(_.comment?_.comment+=`
68
- `+$.comment:_.comment=$.comment);const H=new P(_,R);if(t.options.keepSourceTokens&&(H.srcToken=b),o){const T=c;cn(t,T.items,_)&&i(A,"DUPLICATE_KEY","Map keys must be unique"),T.items.push(H)}else{const T=new B(t.schema);T.flow=!0,T.items.push(H);const ss=(R??_).range;T.range=[_.range[0],ss[1],ss[2]],c.items.push(T)}u=R?R.range[2]:$.end}}const h=o?"}":"]",[p,...m]=n.end;let d=u;if(p?.source===h)d=p.offset+p.source.length;else{const g=a[0].toUpperCase()+a.substring(1),b=f?`${g} must end with a ${h}`:`${g} in block collection must be sufficiently indented and end with a ${h}`;i(u,f?"MISSING_CHAR":"BAD_INDENT",b),p&&p.source.length!==1&&m.unshift(p)}if(m.length>0){const g=Te(m,d,t.options.strict,i);g.comment&&(c.comment?c.comment+=`
69
- `+g.comment:c.comment=g.comment),c.range=[n.offset,d,g.offset]}else c.range=[n.offset,d,d];return c}function pt(s,e,t,n,i,r){const o=t.type==="block-map"?fi(s,e,t,n,r):t.type==="block-seq"?ui(s,e,t,n,r):hi(s,e,t,n,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function di(s,e,t,n,i){const r=n.tag,o=r?e.directives.tagName(r.source,h=>i(r,"TAG_RESOLVE_FAILED",h)):null;if(t.type==="block-seq"){const{anchor:h,newlineAfterProp:p}=n,m=h&&r?h.offset>r.offset?h:r:h??r;m&&(!p||p.offset<m.offset)&&i(m,"MISSING_CHAR","Missing newline after block sequence props")}const a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===B.tagName&&a==="map"||o===X.tagName&&a==="seq")return pt(s,e,t,i,o);let l=e.schema.tags.find(h=>h.tag===o&&h.collection===a);if(!l){const h=e.schema.knownTags[o];if(h?.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),l=h;else return h?i(r,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),pt(s,e,t,i,o)}const c=pt(s,e,t,i,o,l),f=l.resolve?.(c,h=>i(r,"TAG_RESOLVE_FAILED",h),e.options)??c,u=O(f)?f:new I(f);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}function pi(s,e,t){const n=e.offset,i=gi(e,s.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[n,n,n]};const r=i.mode===">"?I.BLOCK_FOLDED:I.BLOCK_LITERAL,o=e.source?mi(e.source):[];let a=o.length;for(let d=o.length-1;d>=0;--d){const g=o[d][1];if(g===""||g==="\r")a=d;else break}if(a===0){const d=i.chomp==="+"&&o.length>0?`
70
- `.repeat(Math.max(1,o.length-1)):"";let g=n+i.length;return e.source&&(g+=e.source.length),{value:d,type:r,comment:i.comment,range:[n,g,g]}}let l=e.indent+i.indent,c=e.offset+i.length,f=0;for(let d=0;d<a;++d){const[g,b]=o[d];if(b===""||b==="\r")i.indent===0&&g.length>l&&(l=g.length);else{g.length<l&&t(c+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=g.length),f=d,l===0&&!s.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=g.length+b.length+1}for(let d=o.length-1;d>=a;--d)o[d][0].length>l&&(a=d+1);let u="",h="",p=!1;for(let d=0;d<f;++d)u+=o[d][0].slice(l)+`
71
- `;for(let d=f;d<a;++d){let[g,b]=o[d];c+=g.length+b.length+1;const y=b[b.length-1]==="\r";if(y&&(b=b.slice(0,-1)),b&&g.length<l){const v=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-b.length-(y?2:1),"BAD_INDENT",v),g=""}r===I.BLOCK_LITERAL?(u+=h+g.slice(l)+b,h=`
72
- `):g.length>l||b[0]===" "?(h===" "?h=`
73
- `:!p&&h===`
74
- `&&(h=`
75
-
76
- `),u+=h+g.slice(l)+b,h=`
77
- `,p=!0):b===""?h===`
78
- `?u+=`
79
- `:h=`
80
- `:(u+=h+b,h=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let d=a;d<o.length;++d)u+=`
81
- `+o[d][0].slice(l);u[u.length-1]!==`
82
- `&&(u+=`
83
- `);break;default:u+=`
84
- `}const m=n+i.length+e.source.length;return{value:u,type:r,comment:i.comment,range:[n,m,m]}}function gi({offset:s,props:e},t,n){if(e[0].type!=="block-scalar-header")return n(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:i}=e[0],r=i[0];let o=0,a="",l=-1;for(let h=1;h<i.length;++h){const p=i[h];if(!a&&(p==="-"||p==="+"))a=p;else{const m=Number(p);!o&&m?o=m:l===-1&&(l=s+h)}}l!==-1&&n(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,f="",u=i.length;for(let h=1;h<e.length;++h){const p=e[h];switch(p.type){case"space":c=!0;case"newline":u+=p.source.length;break;case"comment":t&&!c&&n(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,f=p.source.substring(1);break;case"error":n(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{const m=`Unexpected token in block scalar header: ${p.type}`;n(p,"UNEXPECTED_TOKEN",m);const d=p.source;d&&typeof d=="string"&&(u+=d.length)}}}return{mode:r,indent:o,chomp:a,comment:f,length:u}}function mi(s){const e=s.split(/\n( *)/),t=e[0],n=t.match(/^( *)/),r=[n?.[1]?[n[1],t.slice(n[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function yi(s,e,t){const{offset:n,type:i,source:r,end:o}=s;let a,l;const c=(h,p,m)=>t(n+h,p,m);switch(i){case"scalar":a=I.PLAIN,l=bi(r,c);break;case"single-quoted-scalar":a=I.QUOTE_SINGLE,l=wi(r,c);break;case"double-quoted-scalar":a=I.QUOTE_DOUBLE,l=ki(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[n,n+r.length,n+r.length]}}const f=n+r.length,u=Te(o,f,e,t);return{value:l,type:a,comment:u.comment,range:[n,f,u.offset]}}function bi(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),fn(s)}function wi(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),fn(s.slice(1,-1)).replace(/''/g,"'")}function fn(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
85
- `,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
86
- `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let n=e.exec(s);if(!n)return s;let i=n[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;n=t.exec(s);)n[1]===""?r===`
87
- `?i+=r:r=`
88
- `:(i+=r+n[1],r=" "),o=t.lastIndex;const a=/[ \t]*(.*)/sy;return a.lastIndex=o,n=a.exec(s),i+r+(n?.[1]??"")}function ki(s,e){let t="";for(let n=1;n<s.length-1;++n){const i=s[n];if(!(i==="\r"&&s[n+1]===`
89
- `))if(i===`
90
- `){const{fold:r,offset:o}=Si(s,n);t+=r,n=o}else if(i==="\\"){let r=s[++n];const o=_i[r];if(o)t+=o;else if(r===`
91
- `)for(r=s[n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="\r"&&s[n+1]===`
92
- `)for(r=s[++n+1];r===" "||r===" ";)r=s[++n+1];else if(r==="x"||r==="u"||r==="U"){const a={x:2,u:4,U:8}[r];t+=vi(s,n+1,a,e),n+=a}else{const a=s.substr(n-1,2);e(n-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(i===" "||i===" "){const r=n;let o=s[n+1];for(;o===" "||o===" ";)o=s[++n+1];o!==`
93
- `&&!(o==="\r"&&s[n+2]===`
94
- `)&&(t+=n>r?s.slice(r,n+1):i)}else t+=i}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function Si(s,e){let t="",n=s[e+1];for(;(n===" "||n===" "||n===`
95
- `||n==="\r")&&!(n==="\r"&&s[e+2]!==`
96
- `);)n===`
97
- `&&(t+=`
98
- `),e+=1,n=s[e+1];return t||(t=" "),{fold:t,offset:e}}const _i={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
99
- `,r:"\r",t:" ",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function vi(s,e,t,n){const i=s.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){const a=s.substr(e-2,t+2);return n(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function un(s,e,t,n){const{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?pi(s,e,n):yi(e,s.options.strict,n),l=t?s.directives.tagName(t.source,u=>n(t,"TAG_RESOLVE_FAILED",u)):null;let c;s.options.stringKeys&&s.atKey?c=s.schema[U]:l?c=Ii(s.schema,i,l,t,n):e.type==="scalar"?c=Ai(s,i,e,n):c=s.schema[U];let f;try{const u=c.resolve(i,h=>n(t??e,"TAG_RESOLVE_FAILED",h),s.options);f=L(u)?u:new I(u)}catch(u){const h=u instanceof Error?u.message:String(u);n(t??e,"TAG_RESOLVE_FAILED",h),f=new I(i)}return f.range=a,f.source=i,r&&(f.type=r),l&&(f.tag=l),c.format&&(f.format=c.format),o&&(f.comment=o),f}function Ii(s,e,t,n,i){if(t==="!")return s[U];const r=[];for(const a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(const a of r)if(a.test?.test(e))return a;const o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(n,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[U])}function Ai({atKey:s,directives:e,schema:t},n,i,r){const o=t.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(n))||t[U];if(t.compat){const a=t.compat.find(l=>l.default&&l.test?.test(n))??t[U];if(o.tag!==a.tag){const l=e.tagString(o.tag),c=e.tagString(a.tag),f=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",f,!0)}}return o}function Li(s,e,t){if(e){t??(t=e.length);for(let n=t-1;n>=0;--n){let i=e[n];switch(i.type){case"space":case"comment":case"newline":s-=i.source.length;continue}for(i=e[++n];i?.type==="space";)s+=i.source.length,i=e[++n];break}}return s}const $i={composeNode:hn,composeEmptyNode:Xt};function hn(s,e,t,n){const i=s.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=t;let c,f=!0;switch(e.type){case"alias":c=Ni(s,e,n),(a||l)&&n(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":c=un(s,e,l,n),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=di($i,s,e,t,n),a&&(c.anchor=a.source.substring(1))}catch(u){const h=u instanceof Error?u.message:String(u);n(e,"RESOURCE_EXHAUSTION",h)}break;default:{const u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;n(e,"UNEXPECTED_TOKEN",u),f=!1}}return c??(c=Xt(s,e.offset,void 0,null,t,n)),a&&c.anchor===""&&n(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&s.options.stringKeys&&(!L(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&n(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),s.options.keepSourceTokens&&f&&(c.srcToken=e),c}function Xt(s,e,t,n,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){const f={type:"scalar",offset:Li(e,t,n),indent:-1,source:""},u=un(s,f,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=l),u}function Ni({options:s},{offset:e,source:t,end:n},i){const r=new Ft(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+t.length,a=Te(n,o,s.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}function Oi(s,e,{offset:t,start:n,value:i,end:r},o){const a=Object.assign({_directives:e},s),l=new at(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=ue(n,{indicator:"doc-start",next:i??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?hn(c,i,f,o):Xt(c,f.end,n,null,f,o);const u=l.contents.range[2],h=Te(r,u,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,u,h.offset],l}function ye(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];const{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function fs(s){let e="",t=!1,n=!1;for(let i=0;i<s.length;++i){const r=s[i];switch(r[0]){case"#":e+=(e===""?"":n?`
100
-
101
- `:`
102
- `)+(r.substring(1)||" "),t=!0,n=!1;break;case"%":s[i+1]?.[0]!=="#"&&(i+=1),t=!1;break;default:t||(n=!0),t=!1}}return{comment:e,afterEmptyLine:n}}class Ci{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,n,i,r)=>{const o=ye(t);r?this.warnings.push(new ci(o,n,i)):this.errors.push(new we(o,n,i))},this.directives=new E({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:i}=fs(this.prelude);if(n){const r=e.contents;if(t)e.comment=e.comment?`${e.comment}
103
- ${n}`:n;else if(i||e.directives.docStart||!r)e.commentBefore=n;else if(N(r)&&!r.flow&&r.items.length>0){let o=r.items[0];C(o)&&(o=o.key);const a=o.commentBefore;o.commentBefore=a?`${n}
104
- ${a}`:n}else{const o=r.commentBefore;r.commentBefore=o?`${n}
105
- ${o}`:n}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:fs(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(const i of e)yield*this.next(i);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{const r=ye(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=Oi(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new we(ye(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case"doc-end":{if(!this.doc){const n="Unexpected doc-end without preceding document";this.errors.push(new we(ye(e),"UNEXPECTED_TOKEN",n));break}this.doc.directives.docEnd=!0;const t=Te(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const n=this.doc.comment;this.doc.comment=n?`${n}
106
- ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new we(ye(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){const n=Object.assign({_directives:this.directives},this.options),i=new at(void 0,n);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}}const dn="\uFEFF",pn="",gn="",Tt="";function Ti(s){switch(s){case dn:return"byte-order-mark";case pn:return"doc-mode";case gn:return"flow-error-end";case Tt:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
107
- `:case`\r
108
- `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function D(s){switch(s){case void 0:case" ":case`
109
- `:case"\r":case" ":return!0;default:return!1}}const us=new Set("0123456789ABCDEFabcdef"),Ei=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Be=new Set(",[]{}"),Pi=new Set(` ,[]{}
110
- \r `),gt=s=>!s||Pi.has(s);class Mi{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??"stream";for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
111
- `?!0:t==="\r"?this.buffer[e+1]===`
112
- `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===" ";)t=this.buffer[++n+e];if(t==="\r"){const i=this.buffer[n+e+1];if(i===`
113
- `||!i&&!this.atEnd)return e+n+1}return t===`
114
- `||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t==="-"||t==="."){const n=this.buffer.substr(e,3);if((n==="---"||n==="...")&&D(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
115
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===dn&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,n=e.indexOf("#");for(;n!==-1;){const r=e[n-1];if(r===" "||r===" "){t=n-1;break}else n=e.indexOf("#",n+1)}for(;;){const r=e[t-1];if(r===" "||r===" ")t-=1;else break}const i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){const t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield pn,yield*this.parseLineStart()}*parseLineStart(){const e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");const t=this.peek(3);if((t==="---"||t==="...")&&D(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!D(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&D(t)){const n=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=n,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(gt),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((n!==-1&&n<this.indentNext&&i[0]!=="#"||n===0&&(i.startsWith("---")||i.startsWith("..."))&&D(i[3]))&&!(n===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield gn,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-r),"flow";case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,"flow";case"}":case"]":return yield*this.pushCount(1),this.flowKey=!0,this.flowLevel-=1,this.flowLevel?"flow":"doc";case"*":return yield*this.pushUntil(gt),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const o=this.charAt(1);if(this.flowKey||D(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}const n=this.buffer.substring(0,t);let i=n.indexOf(`
116
- `,this.pos);if(i!==-1){for(;i!==-1;){const r=this.continueScalar(i+1);if(r===-1)break;i=n.indexOf(`
117
- `,r)}i!==-1&&(t=i-(n[i-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){const t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>D(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,n;e:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case" ":t+=1;break;case`
118
- `:e=r,t=0;break;case"\r":{const o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
119
- `)break}default:break e}if(!n&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{const r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`
120
- `,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(n=this.buffer[i];n===" ";)n=this.buffer[++i];if(n===" "){for(;n===" "||n===" "||n==="\r"||n===`
121
- `;)n=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);const a=r;for(;o===" ";)o=this.buffer[--r];if(o===`
122
- `&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield Tt,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t=this.pos-1,n=this.pos-1,i;for(;i=this.buffer[++n];)if(i===":"){const r=this.buffer[n+1];if(D(r)||e&&Be.has(r))break;t=n}else if(D(i)){let r=this.buffer[n+1];if(i==="\r"&&(r===`
123
- `?(n+=1,i=`
124
- `,r=this.buffer[n+1]):t=n),r==="#"||e&&Be.has(r))break;if(i===`
125
- `){const o=this.continueScalar(n+1);if(o===-1)break;n=Math.max(n,o-2)}}else{if(e&&Be.has(i))break;t=n}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Tt,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){const n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(gt))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(D(t)||e&&Be.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!D(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Ei.has(t))t=this.buffer[++e];else if(t==="%"&&us.has(this.buffer[e+1])&&us.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
126
- `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
127
- `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===" "||e&&n===" ");const i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class Bi{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){const r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};const i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}}function W(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function hs(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function mn(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function je(s){switch(s.type){case"document":return s.start;case"block-map":{const e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function te(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function ds(s){if(s.start.type==="flow-seq-start")for(const e of s.items)e.sep&&!e.value&&!W(e.start,"explicit-key-ind")&&!W(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,mn(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}class ji{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new Mi,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=Ti(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{const n=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:n,source:e}),this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){const e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{const n=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in n?n.indent:0:t.type==="flow-collection"&&n.type==="document"&&(t.indent=0),t.type==="flow-collection"&&ds(t),n.type){case"document":n.value=t;break;case"block-scalar":n.props.push(t);break;case"block-map":{const i=n.items[n.items.length-1];if(i.value){n.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=n.items[n.items.length-1];i.value?n.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{const i=n.items[n.items.length-1];!i||i.value?n.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((n.type==="document"||n.type==="block-map"||n.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&hs(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(n.type==="document"?n.end=i.start:n.items.push({start:i.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{hs(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}const t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){const t=je(this.peek(2)),n=te(t);let i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];const r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(`
128
- `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
129
- `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const n=!this.onKeyLine&&this.indent===e.indent,i=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind";let r=[];if(i&&t.sep&&!t.value){const o=[];for(let a=0;a<t.sep.length;++a){const l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":i||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):i||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(W(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(mn(t.key)&&!W(t.sep,"newline")){const o=te(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(W(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const o=te(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):W(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const o=this.flowScalar(this.type);i||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{const o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!W(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else n&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const n="end"in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment"?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||W(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){const i=je(n),r=te(i);ds(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
130
- `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
131
- `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;const t=je(e),n=te(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=je(e),n=te(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(n=>n.type==="newline"||n.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function xi(s){const e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new Bi||null,prettyErrors:e}}function Ri(s,e={}){const{lineCounter:t,prettyErrors:n}=xi(e),i=new ji(t?.addNewLine),r=new Ci(e);let o=null;for(const a of r.compose(i.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new we(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return n&&t&&(o.errors.forEach(ls(s,t)),o.warnings.forEach(ls(s,t))),o}function Di(s,e,t){let n;const i=Ri(s,t);if(!i)return null;if(i.warnings.forEach(r=>Us(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:n},t))}function Fi(s){return String(s).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ki(s,e){const{language:t,tag:n,data:i}=e||{};if(!n)return s;if(i!==void 0)return i;const r=(t||"").toLowerCase();if(r==="json")try{return JSON.parse(s)}catch{return s}if(r==="yaml"||r==="yml")try{return Di(s)}catch{return s}return s}function $e(s){return s.type==="UniwebIcon"||s.type==="image"&&s.attrs?.role==="icon"}function ne(s,e={}){const t=[];return Ui(s,t,e),t}function Ui(s,e,t){s.content&&Array.isArray(s.content)&&s.content?.forEach(n=>{const i=qi(n,t);i&&(Array.isArray(i)?e.push(...i):e.push(i))})}function qi(s,e={}){const t=s.attrs,n=s.content,i=er(s);if(i)return{type:"link",attrs:i};const r=tr(s);if(r)return r;const o=sr(s);if(o)return o;switch(s.type){case"heading":return{type:"heading",level:s.attrs.level,text:ie(n,e),children:ve(n),attrs:t};case"paragraph":return{type:"paragraph",text:ie(n,e),children:ve(n),attrs:t};case"blockquote":return{type:"blockquote",children:ne({content:n}),attrs:t};case"inset_block":{const{component:l,...c}=t||{};return{type:"inset_block",component:l,params:c,children:ne({content:n})}}case"concept_block":return{type:"concept_block",tag:t?.tag,children:ne({content:n},e)};case"dataBlock":return{type:"dataBlock",data:t.data,tag:t.tag};case"codeBlock":{const l=ie(n,e);return t?.tag?{type:"dataBlock",tag:t.tag,data:Ki(l,t)}:{type:"codeBlock",text:l,attrs:t}}case"inset_placeholder":return{type:"inset",refId:t.refId};case"math_display":return{type:"math",display:!0,id:s.attrs?.id||null,latex:s.attrs?.latex||"",mathml:s.attrs?.mathml||"",attrs:t};case"ImageBlock":return{type:"image",attrs:Et(t)};case"image":return t?.role==="video"?{type:"video",attrs:bn(t)}:{type:"image",attrs:Et(t||{})};case"Video":return{type:"video",attrs:Zi(t)};case"bulletList":case"orderedList":{const l=n.map(c=>c.type==="listItem"&&c.content?c.content:null).filter(Boolean);return{type:"list",style:s.type==="bulletList"?"bullet":"ordered",children:l.map(c=>ne({content:c})),attrs:t}}case"table":return{type:"table",rows:(n||[]).filter(c=>c.type==="tableRow").map(c=>({cells:(c.content||[]).filter(f=>f.type==="tableCell").map(f=>({children:ne({content:f.content},e),header:f.attrs?.header===!0,align:f.attrs?.align||null,colspan:f.attrs?.colspan||1,rowspan:f.attrs?.rowspan||1}))})),attrs:t};case"divider":case"DividerBlock":case"horizontalRule":return{type:"divider",attrs:t};case"card-group":return{type:"card-group",cards:s.content?.filter(l=>l.type==="card"&&!l.attrs?.hidden).map(l=>Yi(l.attrs))||[]};case"document-group":return{type:"document-group",documents:s.content?.filter(l=>l.type==="document").map(l=>Qi(l.attrs))||[]};case"StructuredContent":case"FormBlock":let a=t?.data;if(typeof a=="string")try{a=JSON.parse(a)}catch{}return{type:"form",schemaId:t?.activeSchemaId||null,data:a,attrs:t};case"button":{let l=ie(n,e);return l?{type:"button",text:l,children:ve(n),attrs:t}:null}case"UniwebIcon":return{type:"icon",attrs:lt(t)};case"Icon":return{type:"icon",attrs:Xi(t)};default:return{type:s.type,content:ie(n,e)}}}const Vi=["pdf","doc","docx","xls","xlsx","ppt","pptx","jpg","jpeg","png","webp","gif","svg","mp4","mp3","wav","mov","zip"];function Hi(s){return(s?.marks||[]).find(e=>e.type==="link")||null}function Wi(s,e){return!s||!e?!1:JSON.stringify(s.attrs||{})===JSON.stringify(e.attrs||{})}function zi(s,e){const t=e.attrs.href,n=e.attrs.target||"_self",i=t.split(".").pop()?.toLowerCase(),r=Vi.includes(i);return`<a href="${t}" target="${n}"${r?" download":""}>${s}</a>`}function ie(s,e={}){if(!s)return"";const t=[];for(const n of s){const i=n?.type==="text"?Hi(n):null,r=t[t.length-1];i&&r?.link&&Wi(r.link,i)?r.nodes.push(n):t.push({link:i,nodes:[n]})}return t.reduce((n,i)=>{const r=i.nodes.reduce((o,a)=>o+Ji(a),"");return!r&&!i.link?n:n+(i.link?zi(r,i.link):r)},"").trim()}function Ji(s){return[s].reduce((e,t)=>{const{type:n,marks:i=[],text:r}=t;if(n==="text"){let o=r||"";if(i.some(a=>a.type==="textStyle")){const a=i.find(l=>l.type==="textStyle")?.attrs?.color;a&&(o=`<span style="color: var(--${a})">${o}</span>`)}if(i.some(a=>a.type==="highlight")&&(o=`<span style="background-color: var(--highlight)">${o}</span>`),i.some(a=>a.type==="span")){const l=i.find(h=>h.type==="span")?.attrs||{},c=[],f=[];l.class&&c.push(`class="${l.class}"`),l.id&&c.push(`id="${l.id}"`);for(const[h,p]of Object.entries(l))h==="class"||h==="id"||(h==="color"?f.push(`color: ${p}`):h==="bg"?f.push(`background: ${p}`):c.push(`${h}="${p}"`));f.length>0&&c.push(`style="${f.join("; ")}"`),o=`<span${c.length>0?` ${c.join(" ")}`:""}>${o}</span>`}return i.some(a=>a.type==="code")&&(o=`<code>${o}</code>`),i.some(a=>a.type==="bold")&&(o=`<strong>${o}</strong>`),i.some(a=>a.type==="italic")&&(o=`<em>${o}</em>`),e+o}else if(n==="math_inline"){const o=Fi(t.attrs?.latex||""),a=t.attrs?.mathml||"";return e+`<span data-type="math" data-latex="${o}" data-display="false">${a}</span>`}else if(n==="inset_placeholder"){const o=t.attrs?.refId;return o?e+`<uniweb-inset data-ref-id="${o}"></uniweb-inset>`:e}else return n==="hardBreak"?e+"<br>":e},"")}function ve(s){if(!s)return[];const e=[];for(const t of s)if($e(t))e.push({type:"icon",attrs:lt(t.attrs)});else if(t.type==="image"||t.type==="ImageBlock"){const n=t.attrs?.role==="video";e.push({type:n?"video":"image",attrs:n?bn(t.attrs):Et(t.attrs||{})})}else if(t.type==="math-inline"||t.type==="math_inline")e.push(t);else if(t.type==="inset_placeholder")e.push({type:"inset",refId:t.attrs?.refId,embedKind:t.attrs?.embedKind||"visual"});else if(t.type==="text"&&t.marks){const n=t.marks.find(i=>i.type==="link");n&&e.push({type:"link",attrs:{...n.attrs,label:t.text||""}})}return e}const Gi="https://assets.uniweb.app/";function yn(s){if(!s||typeof s!="string")return"";const[e,t]=s.split("/");if(!t)return"";const n=t.substring(t.lastIndexOf(".")+1);return`${Gi}dist/${e}/base.${n}`}function he(s){const e=s?.src||s?.url||"";return e||(s?.identifier?yn(s.identifier):"")}function Yi(s){const{address:e,...t}=s;let n=null;try{e&&(n=JSON.parse(e))}catch{}const{coverImg:i=null,icon:r}=t;return r&&(t.icon=lt(r)),{...t,address:n,coverImg:he(i)}}function Qi(s){const{src:e,info:t={},coverImg:n=null,...i}=s;let r={...i,coverImg:he(n)};if(e)r.href=e;else{const{identifier:o=""}=t;o&&(r.downloadUrl=yn(o))}return r}function lt(s){const{svg:e,url:t,src:n,size:i,color:r,preserveColors:o,href:a,target:l,library:c,name:f}=s||{},u={};e&&(u.svg=e),(t||n)&&(u.url=t||n),i&&(u.size=i),r&&(u.color=r),o&&(u.preserveColors=o),a&&(u.href=a),l&&(u.target=l);let h=c,p=f;if(!h&&typeof f=="string"&&f.includes(":")){const[m,...d]=f.split(":");h=m,p=d.join(":")}return h&&(u.library=h),p&&(u.name=p),u}function Xi(s){const{svg:e,theme:t}=s||{},n={};return e&&(n.svg=e),t&&(n.theme=t),n}function Et(s){let{info:e,targetId:t,caption:n="",direction:i,filter:r,alt:o="",src:a,url:l,href:c="",target:f="",theme:u,role:h,credit:p="",id:m,width:d,height:g,loading:b,fit:y,position:S,preview:v,author:w,description:k}=s,{contentType:A,viewType:_,contentId:$,identifier:R}=e||{};const H={center:"basic",wide:"lg",fill:"full"};return n=wn(n),R?l=he(e):!l&&a&&(l=a),{contentType:A,viewType:_,contentId:t||$,url:l,value:R||"",alt:o||n,caption:n,direction:i,filter:r,imgPos:i==="left"||i==="right"?i:"",size:H[i]||"basic",href:c,target:f,theme:u,role:h,credit:p,id:m||void 0,...d!=null&&{width:d},...g!=null&&{height:g},...b&&{loading:b},...y&&{fit:y},...S&&{position:S},...v&&{preview:v},...w&&{author:w},...k&&{description:k}}}function bn(s){const{src:e,url:t,info:n,poster:i,alt:r="",caption:o="",autoplay:a,muted:l,loop:c,controls:f,href:u="",target:h="",role:p,id:m}=s||{},d={src:he({src:t||e,...n}),alt:r,caption:wn(o),role:p,href:u,target:h};return i&&(d.poster=i),a!==void 0&&(d.autoplay=a),l!==void 0&&(d.muted=l),c!==void 0&&(d.loop=c),f!==void 0&&(d.controls=f),m&&(d.id=m),d}function Zi(s){let{src:e,caption:t="",direction:n,info:i={},coverImg:r={},alt:o,href:a="",target:l=""}=s;return{src:he({src:e,...i}),caption:t,direction:n,coverImg:he(r),alt:o,href:a,target:l}}function wn(s){return!s||typeof s!="string"?"":s.replace(/<[^>]*>/g,"").replace(/&amp;/g,"&").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&apos;/g,"'").replace(/&nbsp;/g," ").replace(/&#(\d+);/g,(t,n)=>String.fromCharCode(Number(n))).replace(/&#x([0-9a-fA-F]+);/g,(t,n)=>String.fromCharCode(parseInt(n,16)))}function er(s){if(["paragraph","heading"].includes(s.type)){const e=s?.content||[],t=e.filter(n=>$e(n)?!1:n.type==="text"?(n.text||"").trim()!=="":!0);if(t.length===1){let n=t[0],i=n?.marks||[];for(let r=0;r<i.length;r++){let o=i[r];if(o?.type==="link"){const a=e.findIndex(f=>f.type==="text"&&f.text===n.text);let l=null,c=null;for(let f=0;f<e.length;f++)if($e(e[f])){const u=lt(e[f].attrs);f<a?l=u:f>a&&(c||(c=u))}return{...o?.attrs,label:n?.text||"",iconBefore:l,iconAfter:c,children:ve(e)}}}}}return!1}function tr(s){if(s.type!=="paragraph")return!1;const e=s?.content||[];if(!e.length)return!1;const t=e.filter(i=>!($e(i)||i.type==="text"&&!(i.text||"").trim()));return t.length<2||!t.every(i=>i.type!=="text"?!1:i.marks?.some(o=>o.type==="link"))?!1:t.map(i=>({type:"link",attrs:{...i.marks.find(o=>o.type==="link")?.attrs,label:i.text||""}}))}function sr(s){if(!["paragraph","heading"].includes(s.type))return!1;let e=s?.content||[];if(!e.length)return!1;e=e.filter(a=>!$e(a));let t=e[0]?.marks?.find(a=>a.type==="link"&&a.attrs);if(!t||!e.every(a=>a?.marks?.some(l=>l.type==="link"&&l.attrs?.href===t.attrs?.href)||!1))return!1;const{href:n,target:i}=t.attrs,r=e.map(a=>{const l=a.marks?.filter(c=>c.type!=="link")||[];return{...a,marks:l}});let o=ie(r);return o?{type:"paragraph",children:ve(s.content),text:`<a target="${i}" href="${n}">${o}</a>`,attrs:s.attrs}:!1}function ps(s){if(!s)return null;const e={title:s.header.title||"",pretitle:s.header.pretitle||"",subtitle:s.header.subtitle||"",paragraphs:s.body.paragraphs||[],links:s.body.links||[],images:s.body.images||[],icons:s.body.icons||[],lists:s.body.lists||[],videos:s.body.videos||[],insets:s.body.insets||[],snippets:s.body.snippets||[],data:s.body.data||{},quotes:s.body.quotes||[],headings:s.body.headings||[]};return s.body.math&&s.body.math.length&&(e.math=s.body.math),s.body.tables&&s.body.tables.length&&(e.tables=s.body.tables),e}function kn(s,e={}){if(!s.length)return{title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],icons:[],lists:[],videos:[],insets:[],snippets:[],data:{},quotes:[],headings:[],items:[]};const n=nr(s,e).map(c=>Pt(c));let i=null,r=[];(e.alwaysItems?!1:ar(n))?(i=n[0],r=n.slice(1)):r=n;const a=ps(i)||{title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],icons:[],lists:[],videos:[],insets:[],data:{},quotes:[],headings:[]},l=r.map(ps);return{...a,items:l}}function nr(s,e={}){const t=[];let n=[];for(let i=0;i<s.length;i++){const r=s[i];if(r.type==="divider"){n.length>0&&(t.push(n),n=[]);continue}if(r.type==="heading"){const o=i===1&&rr(s,0);n.length>0&&!o&&(t.push(n),n=[]);const a=or(s,i,e);n.push(...a),i+=a.length-1}else n.push(r)}return n.length>0&&t.push(n),t}function ir(s,e){return e+1<s.length&&s[e].type==="heading"&&s[e+1].type==="heading"&&s[e].level>s[e+1].level}function rr(s,e){return e+1<s.length&&s[e].type==="image"&&(s[e].role==="banner"||s[e+1].type==="heading")}function or(s,e,t={}){const n=[s[e]];let i=!1;for(let r=e+1;r<s.length;r++){const o=s[r],a=n[n.length-1];if(o.type!=="heading")break;if(o.level-a.level===1){i=!0,n.push(o);continue}if(n.length===1&&o.level<a.level){n.push(o);continue}if(o.level===a.level&&!i&&!t.alwaysItems){n.push(o);continue}break}return n}function Pt(s){const e={pretitle:"",title:"",subtitle:""},t={images:[],icons:[],videos:[],insets:[],snippets:[],paragraphs:[],links:[],lists:[],data:{},quotes:[],headings:[]},n={level:null,contentTypes:new Set};if(!s)return{header:e,body:t,metadata:n};let i=null,r=null;for(let o=0;o<s.length;o++){ir(s,o)&&!e.pretitle&&(e.pretitle=s[o].text,o++);const a=s[o];if(a.type==="heading"){if(a.children&&Array.isArray(a.children)&&mt(a.children,t),n.level??=a.level,r!==null&&a.level===r&&i){const l=e[i];Array.isArray(l)?l.push(a.text):e[i]=[l,a.text]}else e.title?e.subtitle?(t.headings.push(a.text),i=null):(e.subtitle=a.text,i="subtitle"):(e.title=a.text,i="title");r=a.level}else if(a.type==="list"){const l=a.children;t.lists.push(l.map(c=>Pt(c).body))}else{let l={...a.attrs};switch(a.type){case"paragraph":a.children&&Array.isArray(a.children)&&mt(a.children,t),a.text&&t.paragraphs.push(a.text);break;case"image":a.attrs?.role==="icon"?t.icons.push(a.attrs):t.images.push(l);break;case"video":t.videos.push(l);break;case"link":a.children&&Array.isArray(a.children)&&mt(a.children,t),t.links.push(l);break;case"icon":t.icons.push(a.attrs);break;case"button":t.links.push({href:a.attrs?.href||"",label:a.text||"",role:a.attrs?.variant?`button-${a.attrs.variant}`:"button",variant:a.attrs?.variant||"primary",size:a.attrs?.size,icon:a.attrs?.icon,target:a.attrs?.target,class:a.attrs?.class});break;case"blockquote":const c=Pt(a.children);t.quotes.push(c.body);break;case"concept_block":{const f=a.children||[];t.data[a.tag]={items:kn(f,{alwaysItems:!0}).items,sequence:f};break}case"dataBlock":t.data[a.tag]=a.data;break;case"codeBlock":t.snippets.push({language:a.attrs?.language||"",code:typeof a.text=="string"?a.text:""});break;case"math":(t.math||=[]).push({id:a.id||null,latex:a.latex||"",mathml:a.mathml||""});break;case"table":(t.tables||=[]).push({rows:a.rows||[],attrs:a.attrs||{}});break;case"inset":t.insets.push({refId:a.refId});break;case"form":{const f=a.data||a.attrs,u=a.schemaId||"form";t.data[u]=f}break;case"card-group":(a.cards||[]).forEach(f=>{const u=f.cardType||"card";t.data[u]||(t.data[u]=[]);const{cardType:h,...p}=f;t.data[u].push(p)});break;case"document-group":a.documents.forEach(f=>{t.links.push({href:f.href||f.downloadUrl||"",label:f.title||"",role:"document",download:!0,preview:f.coverImg,fileType:f.fileType})});break}}}return{header:e,body:t,metadata:n}}function ar(s){if(s.length===0)return!1;if(s.length===1)return!0;const e=s[0].metadata.level,t=s[1].metadata.level;return!!(e&&(!t||e<t)||!e&&t)}function mt(s,e){s.forEach(t=>{t.type==="icon"?e.icons.push(t.attrs):t.type==="image"?t.attrs?.role==="icon"?e.icons.push(t.attrs):e.images.push(t.attrs):t.type==="video"?e.videos.push(t.attrs):t.type==="link"&&e.links.push(t.attrs)})}function lr(s,e={}){const t={...e},n=ne(s,t),i=kn(n,t);return{raw:s,sequence:n,...i}}const Je=[50,100,200,300,400,500,600,700,800,900,950],M={50:.97,100:.93,200:.87,300:.78,400:.68,500:.55,600:.48,700:.4,800:.32,900:.24,950:.14},cr={50:.15,100:.25,200:.4,300:.65,400:.85,500:1,600:.95,700:.85,800:.75,900:.6,950:.45},fr=M[50]-M[500],ur=M[500]-M[950],Ge={};for(const s of Je)s<500?Ge[s]=(M[s]-M[500])/fr:s>500&&(Ge[s]=(M[500]-M[s])/ur);const gs={fixed:{hueShift:{light:0,dark:0},chromaBoost:1,lightEndChroma:.15,darkEndChroma:.45},natural:{hueShift:{light:5,dark:-15},chromaBoost:1.1,lightEndChroma:.2,darkEndChroma:.4},vivid:{hueShift:{light:3,dark:-10},chromaBoost:1.4,lightEndChroma:.35,darkEndChroma:.55}};function Sn(s){if(!s||typeof s!="string")throw new Error(`Invalid color: ${s}`);const e=s.trim().toLowerCase();if(e.startsWith("oklch("))return hr(e);if(e.startsWith("#"))return ms(e);if(e.startsWith("rgb"))return pr(e);if(e.startsWith("hsl"))return gr(e);if(/^[0-9a-f]{3,8}$/i.test(e))return ms("#"+e);throw new Error(`Unsupported color format: ${s}`)}function hr(s){const e=s.match(/oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)(deg)?\s*\)/);if(!e)throw new Error(`Invalid oklch format: ${s}`);let t=parseFloat(e[1]);e[2]==="%"&&(t/=100);const n=parseFloat(e[3]),i=parseFloat(e[4]);return{l:t,c:n,h:i}}function ms(s){const e=dr(s);return Zt(e.r,e.g,e.b)}function dr(s){let e=s.replace("#","");e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),e.length===4&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e.slice(0,6),16);return{r:t>>16&255,g:t>>8&255,b:t&255}}function pr(s){const e=s.match(/rgba?\(\s*([0-9.]+)[\s,]+([0-9.]+)[\s,]+([0-9.]+)/);if(!e)throw new Error(`Invalid rgb format: ${s}`);const t=parseFloat(e[1]),n=parseFloat(e[2]),i=parseFloat(e[3]);return Zt(t,n,i)}function gr(s){const e=s.match(/hsla?\(\s*([0-9.]+)(deg)?[\s,]+([0-9.]+)%[\s,]+([0-9.]+)%/);if(!e)throw new Error(`Invalid hsl format: ${s}`);const t=parseFloat(e[1]),n=parseFloat(e[3])/100,i=parseFloat(e[4])/100,r=mr(t,n,i);return Zt(r.r*255,r.g*255,r.b*255)}function mr(s,e,t){const n=s/360;let i,r,o;if(e===0)i=r=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;i=yt(l,a,n+1/3),r=yt(l,a,n),o=yt(l,a,n-1/3)}return{r:i,g:r,b:o}}function yt(s,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?s+(e-s)*6*t:t<1/2?e:t<2/3?s+(e-s)*(2/3-t)*6:s}function Zt(s,e,t){s/=255,e/=255,t/=255,s=bt(s),e=bt(e),t=bt(t);const n=.4122214708*s+.5363325363*e+.0514459929*t,i=.2119034982*s+.6806995451*e+.1073969566*t,r=.0883024619*s+.2817188376*e+.6299787005*t,o=Math.cbrt(n),a=Math.cbrt(i),l=Math.cbrt(r),c=.2104542553*o+.793617785*a-.0040720468*l,f=1.9779984951*o-2.428592205*a+.4505937099*l,u=.0259040371*o+.7827717662*a-.808675766*l,h=Math.sqrt(f*f+u*u);let p=Math.atan2(u,f)*(180/Math.PI);return p<0&&(p+=360),{l:c,c:h,h:p}}function bt(s){return s<=.04045?s/12.92:Math.pow((s+.055)/1.055,2.4)}function wt(s){return s<=.0031308?12.92*s:1.055*Math.pow(s,1/2.4)-.055}function ct(s,e,t){const n=t*(Math.PI/180),i=e*Math.cos(n),r=e*Math.sin(n),o=s+.3963377774*i+.2158037573*r,a=s-.1055613458*i-.0638541728*r,l=s-.0894841775*i-1.291485548*r,c=o*o*o,f=a*a*a,u=l*l*l;let h=4.0767416621*c-3.3077115913*f+.2309699292*u,p=-1.2684380046*c+2.6097574011*f-.3413193965*u,m=-.0041960863*c-.7034186147*f+1.707614701*u;return h=Math.round(Math.max(0,Math.min(1,wt(h)))*255),p=Math.round(Math.max(0,Math.min(1,wt(p)))*255),m=Math.round(Math.max(0,Math.min(1,wt(m)))*255),{r:h,g:p,b:m}}function yr(s,e,t){return s>=-.5&&s<=255.5&&e>=-.5&&e<=255.5&&t>=-.5&&t<=255.5}function _n(s,e,t){let n=0,i=t,r=0;for(let o=0;o<8;o++){const a=(n+i)/2,l=ct(s,a,e);yr(l.r,l.g,l.b)?(r=a,n=a):i=a}return r}function ys(s,e,t,n){const i=1-n;return i*i*s+2*i*n*e+n*n*t}function xe(s,e,t){return s+(e-s)*t}function kt(s){return s=s%360,s<0?s+360:s}function br(s){return s>=0&&s<120||s>300}function Ye(s,e,t){const n=(s*100).toFixed(1),i=e.toFixed(4),r=t.toFixed(1);return`oklch(${n}% ${i} ${r})`}function es(s,e,t){const n=i=>i.toString(16).padStart(2,"0");return`#${n(s)}${n(e)}${n(t)}`}function bs(s,e={}){const{format:t="oklch",mode:n="fixed",exactMatch:i}=e,r=Sn(s),o=gs[n]||gs.fixed;return n==="fixed"?wr(r,s,t,i):kr(r,s,t,o,i)}function wr(s,e,t,n){const i={},r=n!==!1;for(const o of Je){if(r&&o===500){t==="hex"?i[o]=e.startsWith("#")?e:vn(s):i[o]=Ye(s.l,s.c,s.h);continue}let a;r?o<500?a=s.l+Ge[o]*(M[50]-s.l):a=s.l-Ge[o]*(s.l-M[950]):a=M[o];const l=cr[o],c=s.c*l,f=_n(a,s.h,c);if(t==="hex"){const u=ct(a,f,s.h);i[o]=es(u.r,u.g,u.b)}else i[o]=Ye(a,f,s.h)}return i}function kr(s,e,t,n,i){const r={},o=br(s.h),a=o?n.hueShift.light:-n.hueShift.light,l=o?n.hueShift.dark:-n.hueShift.dark,c={l:M[50],c:s.c*n.lightEndChroma,h:kt(s.h+a)},f={l:M[950],c:s.c*n.darkEndChroma,h:kt(s.h+l)},u=s.c*n.chromaBoost;for(let h=0;h<Je.length;h++){const p=Je[h];if(i!==!1&&p===500){t==="hex"?r[p]=e.startsWith("#")?e:vn(s):r[p]=Ye(s.l,s.c,s.h);continue}let m,d,g;if(h<=5){const y=h/5;m=xe(c.l,s.l,y),g=xe(c.h,s.h,y);const S=(c.c+u)/2;d=ys(c.c,S,u,y)}else{const y=(h-5)/5;m=xe(s.l,f.l,y),g=xe(s.h,f.h,y);const S=(u+f.c)/2;d=ys(u,S,f.c,y)}g=kt(g);const b=_n(m,g,d);if(t==="hex"){const y=ct(m,b,g);r[p]=es(y.r,y.g,y.b)}else r[p]=Ye(m,b,g)}return r}function vn(s){const e=ct(s.l,s.c,s.h);return es(e.r,e.g,e.b)}function lo(s,e={}){const t={};for(const[n,i]of Object.entries(s)){if(typeof i=="object"&&i!==null&&!i.base&&Object.keys(i).some(o=>!isNaN(parseInt(o)))){t[n]=i;continue}if(typeof i=="object"&&i!==null&&i.base){const{base:r,...o}=i;t[n]=bs(r,{...e,...o})}else typeof i=="string"&&(t[n]=bs(i,e))}return t}function co(s){try{return Sn(s),!0}catch{return!1}}const ws=new Set([50,100,200,300,400,500,600,700,800,900,950]),ks=/^([a-z][a-z0-9]*)-(\d+)$/,Sr=/^([a-z][a-z0-9]*-\d+)\/(\d+)$/,_r=/^rgba\(\s*(var\(--[^)]+\))\s*\/\s*([\d.]+)\s*\)$/;function Ss(s){if(typeof s!="string")return s;const e=s.match(_r);if(e){const r=e[1],o=parseFloat(e[2]);return o>=.999?r:`color-mix(in srgb, ${r} ${Math.round(o*100)}%, transparent)`}if(s.includes("(")||s.startsWith("#"))return s;const t=s.replace(/^-{0,2}/,""),n=t.match(Sr);if(n){const r=n[1],o=parseInt(n[2],10),a=r.match(ks);if(a&&ws.has(parseInt(a[2],10)))return o>=100?`var(--${r})`:`color-mix(in srgb, var(--${r}) ${o}%, transparent)`}const i=t.match(ks);if(i){const r=parseInt(i[2],10);if(ws.has(r))return`var(--${t})`}return s}function vr(s){if(!s||!Array.isArray(s.content))return{content:s,refs:[]};const e=[],t=i=>{let r=!1;const o=i.map(a=>{if(!a)return a;if(a.type==="inset_block"){const{component:l,...c}=a.attrs||{},f=`container_${e.length}`;return e.push({refId:f,type:l,params:c,content:{type:"doc",content:a.content||[]}}),r=!0,{type:"inset_placeholder",attrs:{refId:f,embedKind:"block"}}}if(Array.isArray(a.content)){const l=t(a.content);if(l!==a.content)return r=!0,{...a,content:l}}return a});return r?o:i},n=t(s.content);return n===s.content?{content:s,refs:e}:{content:{...s,content:n},refs:e}}class K{constructor(e,t,n){this.id=t,this.stableId=e.stableId||null,this.page=n,this.website=n.website,this.type=e.type||this.website.getDefaultBlockType(),this.Component=null;const i=vr(e.content);this.rawContent=i.content||{},this.parsedContent=this.parseContent(i.content),e.parsedContent?.data&&(this.parsedContent.data={...this.parsedContent.data||{},...e.parsedContent.data}),this.items=this.parsedContent.items||[];const r=e.params||e.config||{};this.preset=e.preset;const o=r.theme;if(o&&typeof o=="object"){const{mode:c,...f}=o;if(this.themeName=c||"",Object.keys(f).length>0){for(const u of Object.keys(f))f[u]=Ss(f[u]);this.contextOverrides=f}else this.contextOverrides=null}else this.themeName=o??"",this.contextOverrides=null;this.standardOptions=r.standardOptions||{},this.properties=r.properties||r,this.properties.theme&&typeof this.properties.theme=="object"&&(this.properties={...this.properties,theme:this.themeName});const a=r.background;a&&!this.standardOptions.background&&(this.standardOptions={...this.standardOptions,background:K.normalizeBackground(a)}),this.childBlocks=e.subsections?e.subsections.map((c,f)=>new K(c,`${t}_${f}`,this.page)):[],this.insets=[];const l=e.insets;if(l?.length>0)for(let c=0;c<l.length;c++){const f=l[c],u=f.title||"",h=new K({type:f.type,params:f.params||{},content:{title:u},stableId:f.refId,refId:f.refId},`${t}_inset_${c}`,this.page);this.insets.push(h)}for(let c=0;c<i.refs.length;c++){const f=i.refs[c];this.insets.push(new K({type:f.type,params:f.params||{},content:f.content,stableId:f.refId,refId:f.refId},`${t}_container_${c}`,this.page))}this.fetch=e.fetch||null,this.dataLoading=!1,this.hasBackground=!1,this.refId=e.refId||null,this.dynamicContext=e.dynamicContext||null,this.startState=null,this.state=null,this.resetStateHook=null,this.context=null,this.componentVars=null,Object.seal(this)}get path(){return this.page.getNavRoute()}get key(){return`${this.path}-${this.id}`}get parentPath(){return this.dynamicContext?.templateRoute?this.dynamicContext.templateRoute.split("/").slice(0,-1).join("/")||"/":this.path.split("/").slice(0,-1).join("/")||"/"}parseContent(e){return e?.groups?e.groups:e?.type==="doc"?this.extractFromProseMirror(e):e?.doc?.type==="doc"?this.extractFromProseMirror(e.doc):e&&typeof e=="object"&&!Array.isArray(e)?e:{title:"",paragraphs:[],items:[],sequence:[]}}extractFromProseMirror(e){try{return lr(e)}catch(t){return console.warn("[Block] Semantic parser error, using fallback:",t.message),this.extractFromProseMirrorFallback(e)}}extractFromProseMirrorFallback(e){const t={title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],lists:[],icons:[],items:[],sequence:[]};if(!e.content)return t;for(const n of e.content)if(n.type==="heading"){const i=this.extractText(n);n.attrs?.level===1?t.title=i:n.attrs?.level===2&&(t.subtitle=i)}else if(n.type==="paragraph"){const i=this.extractText(n);t.paragraphs.push(i)}return t}extractText(e){return e.content?e.content.filter(t=>t.type==="text").map(t=>t.text).join(""):""}initComponent(){if(this.Component)return this.Component;if(this.Component=globalThis.uniweb?.getComponent(this.type),!this.Component)return console.warn(`[Block] Component not found: ${this.type}`),null;const e=globalThis.uniweb?.getComponentMeta(this.type)||{},t=e.initialState;return this.startState=t?{...t}:null,this.initState(),this.context=e.context?{...e.context}:null,e.vars&&(this.componentVars=K.mergeComponentVars(e.vars,this.properties.vars)),this.Component}getBlockProperties(){return this.properties}getInset(e){return this.insets.find(t=>t.refId===e)||null}getChildBlockRenderer(){return globalThis.uniweb.childBlockRenderer}getBlockLinks(e={}){const t=globalThis.uniweb?.activeWebsite,n=this.parsedContent||{};if(e.nested){const o=(n.lists||[])[0];return K.parseNestedLinks(o,t)}return(n.links||[]).map(r=>({route:t?.makeHref(r.href)||r.href,label:r.label}))}initState(){this.state=this.startState,this.resetStateHook&&this.resetStateHook()}getIndex(){return this.page?this.page.getBlockIndex(this):-1}getBlockInfo(){return{type:this.type,theme:this.themeName,contextOverrides:this.contextOverrides,state:this.state,context:this.context}}getNextBlockInfo(){const e=this.website?.activePage;if(e&&e!==this.page)return e.getFirstBodyBlockInfo();const t=this.getIndex();return t<0||!this.page?null:this.page.getBlockInfo(t+1)}getPrevBlockInfo(){const e=this.website?.activePage;if(e&&e!==this.page)return e.getLastBodyBlockInfo();const t=this.getIndex();return t<=0||!this.page?null:this.page.getBlockInfo(t-1)}useBlockState(e,t){t!==void 0&&this.startState===null?(this.startState=t,this.state=t):t=this.startState;const[n,i]=e(t);return this.resetStateHook=()=>i(t),[n,r=>i(this.state=r)]}getDynamicContext(){return this.dynamicContext}static mergeComponentVars(e,t={}){const n={};for(const[i,r]of Object.entries(e)){const o=typeof r=="string"?r:r?.default;o!=null&&(n[i]=o)}if(t&&typeof t=="object")for(const[i,r]of Object.entries(t))r!=null&&i in e&&(n[i]=String(r));return Object.keys(n).length>0?n:null}static normalizeBackground(e){if(typeof e=="string"){if(/^(\/|\.\/|\.\.\/|https?:\/\/)/.test(e)||/\.(jpe?g|png|webp|gif|svg|avif|mp4|webm|ogv|ogg)$/i.test(e)){const t=e.split(".").pop()?.toLowerCase();return["mp4","webm","ogv","ogg"].includes(t)?{mode:"video",video:{src:e}}:{mode:"image",image:{src:e}}}return/^(linear|radial|conic)-gradient\(/.test(e)?{mode:"gradient",gradient:e}:{mode:"color",color:Ss(e)}}if(e.mode)return e;if(typeof e.overlay=="number"&&(e={...e,overlay:{enabled:!0,type:"dark",opacity:e.overlay}}),e.video||e.sources)return{mode:"video",...e};if(e.image||e.src){if(e.src){const{src:t,position:n,size:i,lazy:r,...o}=e;return{mode:"image",image:{src:t,position:n,size:i,lazy:r},...o}}if(typeof e.image=="string"){const{image:t,...n}=e;return{mode:"image",image:{src:t},...n}}return{mode:"image",...e}}return e.gradient?{mode:"gradient",...e}:e.color?{mode:"color",...e}:e}static parseNestedLinks(e,t){const n=[];if(!e?.length)return n;for(const i of e){const{links:r=[],lists:o=[],paragraphs:a=[]}=i,l=r[0],c=o[0],f=a[0];let u="",h="",p=[],m=!0;l?(u=l.label,h=l.href,c&&(p=K.parseNestedLinks(c,t))):(u=f,m=!1,c&&(p=K.parseNestedLinks(c,t))),n.push({label:u,route:t?.makeHref(h)||h,child_items:p,hasData:m})}return n}}class In{constructor(){this._values=new Map,this._keyListeners=new Map,Object.seal(this)}get(e){return this._values.get(e)}has(e){return this._values.has(e)}set(e,t){this._values.has(e)&&this._values.get(e)===t||(this._values.set(e,t),this._notify(e))}delete(e){return this._values.has(e)?(this._values.delete(e),this._notify(e),!0):!1}subscribe(e,t){let n=this._keyListeners.get(e);return n||(n=new Set,this._keyListeners.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&this._keyListeners.delete(e)}}_notify(e){const t=this._keyListeners.get(e);if(t)for(const n of t)n()}}function An(s){const e=s||{};return{noindex:e.noindex||!1,image:e.image||null,ogTitle:e.ogTitle||null,ogDescription:e.ogDescription||null,canonical:e.canonical||null,changefreq:e.changefreq||null,priority:e.priority||null}}function Ir(s){const e=[],t=new Set,n=r=>{typeof r=="string"&&r&&!t.has(r)&&(t.add(r),e.push(r))},i=s.hideIn;return Array.isArray(i)?i.forEach(n):n(i),s.hideInHeader&&n("header"),s.hideInFooter&&n("footer"),e}class Re{constructor(e,t,n){this.id=t,this.stableId=e.id||null,this.route=e.route,this.sourcePath=e.sourcePath||null,this.isIndex=e.isIndex||!1,this.parentRoute=e.parent||null,this.title=e.title||"",this.description=e.description||"",this.label=e.label||null,this.keywords=e.keywords||null,this.lastModified=e.lastModified||null,this.redirect=e.redirect||null,this.rewrite=e.rewrite||null,this.hidden=e.hidden||!1,this.hideIn=Ir(e),this.hideInHeader=this.hideIn.includes("header"),this.hideInFooter=this.hideIn.includes("footer"),this.layout={name:e.layout?.name||null,hide:e.layout?.hide||[],params:e.layout?.params||{}},this.seo=An(e.seo),this.parent=null,this.children=[],this.website=n,this.scrollY=0,this.fetch=e.fetch||null,this.dynamicContext=e.dynamicContext||null,this.version=e.version||null,this.versionMeta=e.versionMeta||null,this.versionScope=e.versionScope||null,this._hasContent=e.hasContent??e.sections?.length>0,this._bodySections=e.sections,this._bodyBlocks=null,this._loadingContent=null,this._state=null,Object.seal(this)}get state(){return this._state||(this._state=new In),this._state}get bodyBlocks(){if(!this._bodyBlocks){if(this._bodySections===void 0)return[];this._bodyBlocks=(this._bodySections||[]).map((e,t)=>new K(e,t,this))}return this._bodyBlocks}getHeadMeta(){const e=this.getTitle(),t=this.website?.seo||{},n=this.website?.keywords||null;return{title:e,description:this.description,keywords:this.keywords||n,canonical:this.seo.canonical,robots:this.seo.noindex||t.noindex?"noindex, nofollow":null,og:{title:this.seo.ogTitle||e||t.ogTitle,description:this.seo.ogDescription||this.description||t.ogDescription,image:this.seo.image||t.image,url:this.route}}}isDynamicPage(){return this.dynamicContext!==null}getDynamicContext(){return this.dynamicContext}getDynamicParam(){return this.dynamicContext?.paramValue||null}getLayoutName(){return this.layout.name||this.website?.getDefaultLayoutName()||null}getBlockGroups(){return{body:this.bodyBlocks,...this.getLayoutAreas()}}getBlockIndex(e){return this.getPageBlocks().indexOf(e)}getBlockInfo(e){return this.getPageBlocks()[e]?.getBlockInfo()||null}getFirstBodyBlockInfo(){return this.bodyBlocks?.[0]?.getBlockInfo()||null}getLastBodyBlockInfo(){const e=this.bodyBlocks;return e?.[e.length-1]?.getBlockInfo()||null}getPageBlocks(){const e=[],t=this.getLayoutAreas(),n=t.header,i=t.footer;return n&&e.push(...n),e.push(...this.bodyBlocks),i&&e.push(...i),e}getBodyBlocks(){return this.bodyBlocks}getAreaBlocks(e){return this.layout.hide.includes(e)?null:this.website.getAreaBlocks(e,this.getLayoutName())}getLayoutAreas(){const e=this.website.getLayoutAreas(this.getLayoutName()),t={};for(const[n,i]of Object.entries(e))this.layout.hide.includes(n)||(t[n]=i);return t}getLayoutParams(){return this.layout.params}resetBlockStates(){const e=this.getLayoutAreas(),t=[...this.bodyBlocks,...Object.values(e).flat()];for(const n of t)typeof n.initState=="function"&&n.initState()}getNavRoute(){return this.isIndex&&this.route.endsWith("/index")?this.route.slice(0,-6)||"/":this.route}getTitle(){if(this.isIndex&&this.route.endsWith("/index")){const e=this.title?.trim();if(!e||e.toLowerCase()==="index")return this.parent?.title||e||""}return this.title}getLabel(){return this.label||this.getTitle()}isHidden(){return this.hidden}showInNav(e){return!this.hidden&&!this.hideIn.includes("*")&&!this.hideIn.includes(e)}showInHeader(){return this.showInNav("header")}showInFooter(){return this.showInNav("footer")}hasChildren(){return this.children.length>0}hasContent(){return this._hasContent}isContentLoaded(){return this._bodySections!==void 0}async loadContent(){if(this._bodySections===void 0)return this._loadingContent?this._loadingContent:(this._loadingContent=(async()=>{try{const e=this.website.basePath||"",t=this.website.activeLocale,n=this.website.defaultLocale,r=this.website.config?.pageHashes?.[t]?.[this.route];let o;if(r)o=`${e}${r}`;else{const c=t!==n?`/${t}`:"",f=this.route==="/"?"/index":this.route;o=`${e}${c}/_pages${f}.json`}const a=await fetch(o);if(a.status===404&&Ar(r)){window.location.reload();return}if(!a.ok){console.warn(`[Page] Failed to load content for ${this.route}: ${a.status}`),this._bodySections=[];return}const l=await a.json();this._bodySections=l.sections||[],this._bodyBlocks=null,typeof sessionStorage<"u"&&sessionStorage.removeItem("uniwebReloadCount")}finally{this._loadingContent=null}})(),this._loadingContent)}getNavigableRoute(){if(this.hasContent())return this.route;const e=this.children||[];if(e.find(n=>n.isIndex))return this.route;for(const n of e){const i=n.getNavigableRoute();if(i)return i}return this.route}getRenderableSelf(){return this.hasContent()?this:this.children?.find(t=>t.isIndex)||this}getNormalizedRoute(){return this.website.normalizeRoute(this.route)}isActiveFor(e){return this.website.isRouteActive(this.route,e)}isActiveOrAncestor(e){if(this.website.isRouteActive(this.route,e))return!0;const t=this.sourcePath||this.route;return this.website.isRouteActiveOrAncestor(t,e)}isVersioned(){return this.version!==null}getVersion(){return this.version}getVersions(){return this.versionMeta?.versions||[]}isLatestVersion(){return this.version?.latest===!0}isDeprecatedVersion(){return this.version?.deprecated===!0}getVersionUrl(e){return this.isVersioned()?this.website.getVersionUrl(e,this.route):null}}function Ar(s){if(!s||typeof sessionStorage>"u"||typeof window>"u"||!window.location)return!1;try{const e=parseInt(sessionStorage.getItem("uniwebReloadCount")||"0",10)||0;return e>=2?!1:(sessionStorage.setItem("uniwebReloadCount",String(e+1)),!0)}catch{return!1}}function Lr(s){const{path:e,url:t,schema:n,transform:i}=s||{},r=s?.method&&s.method.toUpperCase()!=="GET"?s.method.toUpperCase():void 0,o=r==="POST"?s?.body:void 0;return JSON.stringify({path:e,url:t,schema:n,transform:i,method:r,body:o})}class $r{constructor(){this._cache=new Map,this._inflight=new Map,this._listeners=new Set,this._keyedListeners=new Map,Object.seal(this)}subscribe(e,t){if(typeof e=="string"&&typeof t=="function"){const n=e;let i=this._keyedListeners.get(n);return i||(i=new Set,this._keyedListeners.set(n,i)),i.add(t),()=>{const r=this._keyedListeners.get(n);r&&(r.delete(t),r.size===0&&this._keyedListeners.delete(n))}}if(typeof e=="function")return this._listeners.add(e),()=>this._listeners.delete(e);throw new TypeError("DataStore.subscribe: expected (fn) or (key, fn)")}has(e){return this._cache.has(e)}get(e){return this._cache.has(e)?this._cache.get(e):null}set(e,t){this._cache.set(e,t);for(const i of this._listeners)i();const n=this._keyedListeners.get(e);if(n)for(const i of n)i()}get inflight(){return this._inflight}clear(){this._cache.clear(),this._inflight.clear()}}const Nr=/\{([A-Za-z_][A-Za-z0-9_]*)\}/g;function Ie(s,e,t={}){const{encode:n=!0}=t;if(typeof s=="string")return s.replace(Nr,(i,r)=>{if(!(r in(e||{})))return i;const o=e[r];return o==null?i:n?encodeURIComponent(String(o)):String(o)});if(Array.isArray(s))return s.map(i=>Ie(i,e,t));if(s&&typeof s=="object"){const i={};for(const r of Object.keys(s))i[r]=Ie(s[r],e,t);return i}return s}const Ln="data",ts=`/${Ln}/`;function fo(s){return`${ts}${s}.json`}function Or(s,e){return`${ts}${s}/${e}.json`}function uo(s){return typeof s!="string"?"":s.replace(new RegExp(`^/?${Ln}/`),"").replace(/\.json$/i,"")}function Cr(s){return typeof s=="string"&&s.startsWith(ts)}function Tr(s){return s?.refine===!0||s?.inherit===!0}function Er(s,e,t){return!s.path||!e||e===t||!Cr(s.path)?s:{...s,path:`/${e}${s.path}`}}function Pr(s,e){if(s.detail!==void 0)return s;const t=s.schema;if(!t||!e)return s;const n=e[t];if(!n||typeof n!="object")return s;const i=Array.isArray(n.deferred)?n.deferred:null;if(!i||i.length===0)return s;const r=typeof n.detailUrl=="string"?n.detailUrl:Or(t,"{slug}");return{...s,detail:r}}function Mr(s,e={}){const{schemas:t=[],locale:n=null,defaultLocale:i=null,collections:r=null}=e,o=new Map,a=t.length===0;for(const l of s){if(!l)continue;const c=Array.isArray(l)?l:[l];for(const f of c){if(!f?.schema||o.has(f.schema)||!a&&!t.includes(f.schema))continue;const u=Er(f,n,i);o.set(f.schema,Pr(u,r))}}return o}const De=Tr;let _s=!1;function Br(s){_s||(_s=!0,console.warn(`[uniweb] 'fetch: { inherit: true }' is deprecated; rename to 'fetch: { refine: true }'. Accepted for one release; will be removed in the next minor. First seen on block ${s?.id??"(unknown)"} of page ${s?.page?.route??"(unknown)"}.`))}class jr{constructor({website:e}){this.website=e,Object.seal(this)}_shouldInheritDetail(e,t){const n=t?.fetch;return De(n)&&n?.detail!==void 0?n.detail!==!1:e?e.inheritDetail!==!1:!0}_inheritLimit(e,t){const n=t?.fetch;return De(n)&&n?.limit>0?n.limit:e?.inheritLimit>0?e.inheritLimit:null}_inheritOrder(e){const t=e?.fetch;return De(t)&&t?.order?.orderBy?t.order:null}_sortItems(e,t){if(!t?.orderBy||!Array.isArray(e)||e.length===0)return e;const{orderBy:n,sortOrder:i="ASC"}=t,r=i==="DESC";return[...e].sort((o,a)=>{const l=o[n]??"",c=a[n]??"",f=typeof l=="string"&&typeof c=="string"?l.localeCompare(c):l>c?1:l<c?-1:0;return r?-f:f})}_getRequestedSchemas(e){return e?e.inheritData===!1?null:[]:[]}_findFetchConfigs(e,t){e.fetch?.inherit===!0&&e.fetch?.refine!==!0&&Br(e);const n=e.page,i=e.website;return Mr([e.fetch&&!De(e.fetch)?e.fetch:null,n?.fetch,n?.parent?.fetch,i?.config?.fetch],{schemas:t,locale:i?.getActiveLocale?.()??null,defaultLocale:i?.getDefaultLocale?.()??null,collections:i?.config?.collections??null})}_applyDetailRoutes(e,t,n){if(!(!e||!n?.resolveDetailPageTemplate))for(const[i,r]of t){if(!r.detailPage)continue;const o=e[i];if(!Array.isArray(o)||o.length===0)continue;const a=n.resolveDetailPageTemplate(r.detailPage);a&&(e[i]=o.map(l=>xr(l,a)))}}_buildDetailConfig(e,t){const{detail:n}=e;if(!n)return null;const{paramName:i,paramValue:r}=t;if(!i||r===void 0)return null;const o=e.url||e.path;if(!o)return null;const a=!!e.path&&!e.url;if(n&&typeof n=="object"){const c={...a?{path:o}:{url:o},schema:e.schema,transform:e.transform};return e.method&&(c.method=e.method),n.body!==void 0?c.body=Ie(n.body,{[i]:r},{encode:!1}):e.body!==void 0&&(c.body=Ie(e.body,{[i]:r},{encode:!1})),n.envelope&&(c.envelope=n.envelope),c}let l;if(n==="rest"){const[c,f]=o.split("?"),u=c.replace(/\/$/,"");l=f?`${u}/${encodeURIComponent(r)}?${f}`:`${u}/${encodeURIComponent(r)}`}else if(n==="query"){const c=o.includes("?")?"&":"?";l=`${o}${c}${i}=${encodeURIComponent(r)}`}else l=Ie(n,{[i]:r});return{...a?{path:l}:{url:l},schema:e.schema,transform:e.transform}}_ctx(e,t={}){return{website:this.website,page:e?.page||null,block:e||null,signal:t.signal}}resolve(e,t){const n=this.website?.fetcher;let i=this._getRequestedSchemas(t);if(i===null&&e.fetch){const d=(Array.isArray(e.fetch)?e.fetch:[e.fetch]).filter(g=>g.schema).map(g=>g.schema);d.length>0&&(i=d)}if(i===null)return{status:"none",data:null};const r=this._findFetchConfigs(e,i);if(r.size===0)return{status:"none",data:null};const o=e.dynamicContext||e.page?.dynamicContext,a=this._shouldInheritDetail(t,e),l=this._inheritLimit(t,e),c=this._inheritOrder(e),f=this._ctx(e),u={};let h=!0;const p=o?.schema;for(const[m,d]of r){const g=o&&m===p;if(g&&!a){const b=n?.peek(d,f);if(b){const{paramName:y,paramValue:S}=o,v=b.data;let w=Array.isArray(v)?v.filter(k=>String(k[y])!==String(S)):v;c&&(w=this._sortItems(w,c)),u[m]=l&&Array.isArray(w)?w.slice(0,l):w}else h=!1}else if(g){const b=n?.peek(d,f);if(b){const{paramName:y,paramValue:S}=o,v=b.data,w=Array.isArray(v)?v.find(k=>String(k[y])===String(S)):null;if(!w)u[m]=[];else if(d.detail){const k=this._buildDetailConfig(d,o),A=k?n?.peek(k,f):null;k&&A?u[m]=[A.data]:k?h=!1:u[m]=[w]}else u[m]=[w]}else h=!1}else{const b=n?.peek(d,f);if(b){const y=b.data;u[m]=c?this._sortItems(y,c):y}else h=!1}}return h?(this._applyDetailRoutes(u,r,e.website),{status:"ready",data:u}):{status:"pending",data:null}}async fetch(e,t,{signal:n}={}){const i=this.website?.fetcher;if(!i)return{data:null};let r=this._getRequestedSchemas(t);if(r===null&&e.fetch){const g=(Array.isArray(e.fetch)?e.fetch:[e.fetch]).filter(b=>b.schema).map(b=>b.schema);g.length>0&&(r=g)}if(r===null)return{data:null};const o=this._findFetchConfigs(e,r);if(o.size===0)return{data:null};const a=e.dynamicContext||e.page?.dynamicContext,l=this._shouldInheritDetail(t,e),c=this._inheritLimit(t,e),f=this._inheritOrder(e),u=this._ctx(e,{signal:n}),h={},p=[],m=a?.schema;for(const[d,g]of o){const b=a&&d===m;if(b&&!l){let y=vs(i,g,u);if(y===null){const k=await i.dispatch(g,u);y=Array.isArray(k?.data)?k.data:null}const{paramName:S,paramValue:v}=a;let w=Array.isArray(y)?y.filter(k=>String(k[S])!==String(v)):y??[];f&&(w=this._sortItems(w,f)),h[d]=c&&Array.isArray(w)?w.slice(0,c):w}else if(b){const{paramName:y,paramValue:S}=a;let v=vs(i,g,u);if(v===null){const k=await i.dispatch(g,u);v=Array.isArray(k?.data)?k.data:null}const w=v?.find(k=>String(k[y])===String(S))??null;if(!w){h[d]=[];continue}if(g.detail){const k=this._buildDetailConfig(g,a);k?p.push(i.dispatch(k,u).then(A=>{const _=A?.data!==void 0&&A?.data!==null?A.data:w;h[d]=[_]})):h[d]=[w]}else h[d]=[w]}else p.push(i.dispatch(g,u).then(y=>{y?.data!==void 0&&y?.data!==null&&(h[d]=y.data)}))}return p.length>0&&await Promise.all(p),this._applyDetailRoutes(h,o,e.website),{data:h}}}function vs(s,e,t){const n=s.peek(e,t);return n&&Array.isArray(n.data)?n.data:null}function xr(s,e){if(!s||typeof s!="object"||s.route!==void 0)return s;let t=!1;const n=e.replace(/:(\w+)/g,(i,r)=>{const o=s[r];return o==null?(t=!0,""):encodeURIComponent(String(o))});return t?s:{...s,route:n}}function Is(s){return s?s.default&&typeof s.default=="object"?s.default:typeof s=="object"?s:null:null}function $n(s){return!!s&&typeof s.resolve=="function"}function As(s,{source:e,dev:t}){const n=new Map;if(!s)return n;let i;try{i=s.capabilities?.transports}catch(r){return t&&console.warn(`[FetcherDispatcher] ${e} transports getter threw:`,r),n}if(!i||typeof i!="object"||Array.isArray(i))return n;for(const r of Object.keys(i)){let o;try{o=i[r]}catch(a){t&&console.warn(`[FetcherDispatcher] ${e} transport "${r}" getter threw:`,a);continue}if(!$n(o)){t&&console.warn(`[FetcherDispatcher] ${e} transport "${r}" missing resolve(); skipped.`);continue}n.set(r,o)}return n}class Ls{constructor({foundation:e,extensions:t=[],dataStore:n,defaultFetcher:i=null,transport:r=null,dev:o=!1}){if(!n)throw new Error("FetcherDispatcher: dataStore is required");this._dataStore=n,this._defaultFetcher=i,this._transportOverride=$n(r)?r:null,this._dev=!!o;const a=new Map,l=As(Is(e),{source:"primary foundation",dev:this._dev});for(const[c,f]of l)a.set(c,f);for(const c of t){let f;try{f=As(Is(c),{source:"extension",dev:this._dev})}catch(u){this._dev&&console.warn("[FetcherDispatcher] extension transports collection threw:",u);continue}for(const[u,h]of f){if(a.has(u)){this._dev&&console.warn(`[FetcherDispatcher] extension transport "${u}" ignored — primary foundation already provides it.`);continue}a.set(u,h)}}this._namedTransports=a,Object.freeze(this)}_selectFetcher(e,t){if(this._transportOverride)return this._transportOverride;const n=t?.website?.config?.fetcher?.transports;if(n&&typeof n=="object"){const i=e?.schema,r=i&&n[i]||n.default;if(r){const o=this._namedTransports.get(r);if(o)return o;this._dev&&console.warn(`[FetcherDispatcher] site selected transport "${r}" for schema "${i??"(none)"}" but no foundation or extension registered it; falling back to the framework default.`)}}return this._defaultFetcher}_cacheKey(e,t){if(e&&typeof e.cacheKey=="function")try{return String(e.cacheKey(t))}catch(n){console.warn("[FetcherDispatcher] fetcher.cacheKey threw:",n)}return Lr(t)}peek(e,t={}){const n=this._selectFetcher(e,t),i=this._cacheKey(n,e);return this._dataStore.get(i)}async dispatch(e,t={}){const n=this._selectFetcher(e,t);if(!n)return{data:[],error:"FetcherDispatcher: no fetcher selected and no default configured"};const i=this._cacheKey(n,e),r=this._dataStore.get(i);if(r)return{data:r.data,meta:r.meta};const o=this._dataStore.inflight.get(i);if(o)return this._attachSignal(o,t.signal),o.promise;const a=typeof AbortController<"u"?new AbortController:null,l={promise:null,master:a,signals:new Set,everAttached:!1};this._attachSignal(l,t.signal),this._dataStore.inflight.set(i,l);const c=a?{...t,signal:a.signal}:t;return l.promise=this._runFetcher(n,e,c,i,l),l.promise}_attachSignal(e,t){if(!t||!e.master)return;if(e.everAttached=!0,t.aborted){this._maybeAbortMaster(e);return}e.signals.add(t);const n=()=>{e.signals.delete(t),this._maybeAbortMaster(e)};t.addEventListener("abort",n,{once:!0})}_maybeAbortMaster(e){e.master&&(e.master.signal.aborted||e.everAttached&&(e.signals.size>0||e.master.abort()))}async _runFetcher(e,t,n,i,r){try{const o=await e.resolve(t,n);if(this._dataStore.inflight.get(i)===r&&this._dataStore.inflight.delete(i),!o||typeof o!="object")return this._dev&&console.warn("[FetcherDispatcher] Fetcher returned a non-object; expected { data, error?, meta? }.",{request:t,result:o}),{data:[],error:"Fetcher returned a non-object"};const{data:a,error:l,meta:c}=o;if(this._dev&&this._validateReturnShape(o,t),l)return{data:a??[],error:l,meta:c};if(a==null)return{data:a??[],meta:c};const f=c!==void 0?{data:a,meta:c}:{data:a};return this._dataStore.set(i,f),{data:a,meta:c}}catch(o){return this._dataStore.inflight.get(i)===r&&this._dataStore.inflight.delete(i),{data:[],error:String(o?.message||o)}}}_validateReturnShape(e,t){const n=new Set(["data","error","meta"]),i=Object.keys(e).filter(r=>!n.has(r));i.length>0&&console.warn(`[FetcherDispatcher] Fetcher return has unexpected keys: ${i.join(", ")}. Expected { data, error?, meta? }.`,{request:t,result:e})}}function Nn(s){return typeof s=="string"&&s.trim()&&s.trim()!=="*"?s.trim():s&&typeof s=="object"&&typeof s.code=="string"&&s.code.trim()?s.code.trim():null}function Rr(s){return s==="*"||Array.isArray(s)&&s.includes("*")}function Mt(s){if(!Array.isArray(s))return[];const e=new Set,t=[];for(const n of s){const i=Nn(n);!i||e.has(i)||(e.add(i),t.push(i))}return t}function Bt(s={}){return typeof s?.defaultLanguage=="string"&&s.defaultLanguage.trim()?s.defaultLanguage.trim():Mt(s?.languages)[0]||"en"}function Dr(s={}){const e=Mt(s?.languages),t=s?.publishLanguages;if(t==null)return{publishable:e,dangling:[],explicit:!1};const n=Mt(t);if(Rr(s?.languages))return{publishable:n,dangling:[],explicit:!0};const i=new Set(e),r=new Set(n);return{publishable:e.filter(o=>r.has(o)),dangling:n.filter(o=>!i.has(o)),explicit:!0}}function ho(s={}){const e=[],t=[],n=(a,l,c)=>{if(a==null||a==="*")return;if(!Array.isArray(a)){t.push({code:c,message:`${l} must be a list of locale codes (got ${typeof a}) — ignored`});return}const f=new Set;for(const u of a){if(u==="*")continue;const h=Nn(u);if(!h){t.push({code:c,message:`${l} entry ${JSON.stringify(u)} is not a locale code string — dropped`});continue}typeof u!="string"&&t.push({code:c,message:`${l} entry for '${h}' uses the legacy object form — use the plain string '${h}'`}),f.has(h)&&t.push({code:"duplicate-language",message:`${l} lists '${h}' more than once — deduped`}),f.add(h)}};n(s?.languages,"languages","invalid-language-entry"),n(s?.publishLanguages,"publishLanguages","invalid-publish-language-entry");const{publishable:i,dangling:r,explicit:o}=Dr(s);for(const a of r)t.push({code:"dangling-publish-language",message:`publishLanguages lists '${a}' but languages does not declare it — ignored at publish (kept in the file so a re-declared language keeps its publish intent)`});if(o&&i.length===0)e.push({code:"nothing-publishable",message:"publishLanguages leaves no publishable language (empty list, or nothing it lists is declared) — a publishable default language is required"});else if(o){const a=Bt(s);i.includes(a)||e.push({code:"default-not-publishable",message:`the default language '${a}' is not in publishLanguages — the effective default must be publishable`})}return{errors:e,warnings:t}}const Fr="[A-Za-z0-9_-]+",Kr=/[.*+?^${}()|[\]\\]/g;function On(s){return typeof s!="string"||s===""||s==="/"?"/":s.replace(/\/+$/,"")||"/"}function Ur(s){const e=[],t=On(s).replace(Kr,"\\$&").replace(new RegExp(`:(${Fr})`,"g"),(n,i)=>(e.push(i),"([^/]+)"));return{regex:new RegExp(`^${t}$`),paramNames:e}}function qr(s,e){const{regex:t,paramNames:n}=Ur(s),i=On(e).match(t);if(!i)return null;const r={};return n.forEach((o,a)=>{r[o]=decodeURIComponent(i[a+1])}),{params:r}}class Vr{constructor({content:e={},foundation:t=null,extensions:n=[],defaultFetcher:i=null,transport:r=null,dev:o=!1}={}){this._foundation=t,this._extensions=n,this._defaultFetcher=i,this._transport=r,this._dev=o,this.dataStore=new $r,this.fetcher=new Ls({foundation:t,extensions:n,dataStore:this.dataStore,defaultFetcher:i,transport:r,dev:o}),this.entityStore=new jr({website:this}),this._state=null,this.name="",this.description="",this.url="",this._layoutSets={},this.notFoundPage=null,this._dynamicPageData=new Map,this._dynamicPageCache=new Map,this.pages=[],this.activePage=null,this.pageRoutes=[],this.themeData={},this.config={},this.seo={},this.keywords=null,this.siteDefaultLocale="en",this.defaultLocale="en",this.activeLocale="en",this.locales=[],this.activeLang="en",this.langs=[],this._routeTranslations={},this.basePath="",this.versionedScopes={},this.assets={},this._pageIdMap=new Map,this._applyContent(e),Object.seal(this)}_applyContent(e){const{pages:t=[],theme:n={},config:i={},layouts:r,notFound:o,versionedScopes:a={},assets:l={}}=e||{};if(this.name=i.name||"",this.description=i.description||"",this.url=i.url||"",this._layoutSets={},r&&typeof r=="object")for(const[u,h]of Object.entries(r)){this._layoutSets[u]={};for(const[p,m]of Object.entries(h))m&&(this._layoutSets[u][p]=new Re(m,`layout-${u}-${p}`,this))}const c=o||t.find(u=>u.route==="/404")||null;this.notFoundPage=c?new Re(c,"notFound",this):null;const f=t.filter(u=>u.route!=="/404");this._dynamicPageData=new Map;for(const u of f)(u.isDynamic||u.route?.includes(":"))&&this._dynamicPageData.set(u.route,u);this._dynamicPageCache=new Map,this.pages=f.map((u,h)=>new Re(u,h,this)),this.buildPageHierarchy(),this.activePage=this.pages.find(u=>u.isIndex&&u.getNavRoute()==="/")||this.pages[0]||null,this.pageRoutes=this.pages.map(u=>u.route),this.themeData=n,this.config=i,this.seo=An(i.seo),this.keywords=i.keywords||null,this.siteDefaultLocale=Bt(i),this.defaultLocale=i.domainLocale||this.siteDefaultLocale,this.activeLocale=i.activeLocale||this.defaultLocale,this.locales=this.buildLocalesList(i),this.activeLang=this.activeLocale,this.langs=this.locales.map(u=>({label:u.label||u.code,value:u.code})),this._routeTranslations=this._buildRouteTranslations(i),this.versionedScopes=a,this.assets=l}rebuild({content:e,foundation:t,extensions:n}={}){const i=t!==void 0,r=n!==void 0;return i&&(this._foundation=t),r&&(this._extensions=n),(i||r)&&(this.fetcher=new Ls({foundation:this._foundation,extensions:this._extensions,dataStore:this.dataStore,defaultFetcher:this._defaultFetcher,transport:this._transport,dev:this._dev})),e!==void 0&&this._applyContent(e),this}get state(){return this._state||(this._state=new In),this._state}buildLocalesList(e){const t=Bt(e),n=e.languages||[],i=o=>typeof o=="string"?{code:o}:{code:o.code,...o.label&&{label:o.label}},r=new Map;r.set(t,{code:t});for(const o of n){const a=i(o);if(r.has(a.code)){const l=r.get(a.code);r.set(a.code,{...l,...a})}else r.set(a.code,a)}return Array.from(r.values()).map(o=>({...o,isDefault:o.code===t}))}_buildRouteTranslations(e){const t=e.i18n?.routeTranslations||{},n={};for(const[i,r]of Object.entries(t)){const o=new Map,a=new Map;for(const[l,c]of Object.entries(r))o.set(l,c),a.set(c,l);n[i]={forward:o,reverse:a}}return n}translateRoute(e,t=this.activeLocale){if(!t||t===this.siteDefaultLocale)return e;const n=this._routeTranslations[t];if(!n)return e;const i=n.forward.get(e);if(i)return i;for(const[r,o]of n.forward)if(e.startsWith(r+"/"))return o+e.slice(r.length);return e}reverseTranslateRoute(e,t=this.activeLocale){if(!t||t===this.siteDefaultLocale)return e;const n=this._routeTranslations[t];if(!n)return e;const i=n.reverse.get(e);if(i)return i;for(const[r,o]of n.reverse)if(e.startsWith(r+"/"))return o+e.slice(r.length);return e}buildPageHierarchy(){const e=new Map;for(const t of this.pages)e.set(t.route,t);for(const t of this.pages)if(t.parentRoute){const n=e.get(t.parentRoute);n&&(n.children.push(t),t.parent=n)}for(const t of this.pages){if(t.parent||t.route==="/")continue;const n=t.route.replace(/\/[^/]+$/,"");if(!n||n==="/"||n===t.route)continue;const i=e.get(n);i&&(i.children.push(t),t.parent=i)}this._pageIdMap=new Map;for(const t of this.pages){t.stableId&&this._pageIdMap.set(t.stableId,t);const n=this.normalizeRoute(t.route);if(n&&!this._pageIdMap.has(n)&&this._pageIdMap.set(n,t),t.sourcePath){const i=t.sourcePath.replace(/^\//,"").replace(/\/$/,"");i&&!this._pageIdMap.has(i)&&this._pageIdMap.set(i,t)}}}getPage(e){let t=e;if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const l=`/${this.activeLocale}`;t===l||t===`${l}/`?t="/":t.startsWith(`${l}/`)&&(t=t.slice(l.length))}const n=t==="/"?"/":t.replace(/\/$/,""),i=this.pages.find(l=>l.route===n);if(i){const l=i.children.find(c=>c.isIndex);return l||i}t=this.reverseTranslateRoute(t);const r=t==="/"?"/":t.replace(/\/$/,""),o=this.pages.find(l=>l.route===r);if(o){const l=o.children.find(c=>c.isIndex);return l||o}const a=this.pages.find(l=>l.isIndex&&l.getNavRoute()===r);if(a)return a;if(this._dynamicPageCache.has(r))return this._dynamicPageCache.get(r);for(const l of this.pages){if(!l.route.includes(":"))continue;const c=this._matchDynamicRoute(l.route,r);if(c){const f=this._createDynamicPage(l,r,c.params);if(f){const{page:u,collectionLoaded:h}=f;return h&&this._dynamicPageCache.set(r,u),u}}}}_matchDynamicRoute(e,t){return qr(e,t)}_createDynamicPage(e,t,n){const i=this._dynamicPageData.get(e.route);if(!i)return null;const r=JSON.parse(JSON.stringify(i));r.route=t,r.isDynamic=!1;const o=Object.keys(n)[0],a=Object.values(n)[0],l=i.parentSchema;if(r.dynamicContext={templateRoute:e.route,params:n,paramName:o,paramValue:a,schema:l},r.sections&&Array.isArray(r.sections))for(const h of r.sections)h.dynamicContext=r.dynamicContext;const c=e.route.replace(/\/:[\w]+$/,"")||"/",f=this.pages.find(h=>h.route===c||h.getNavRoute()===c);if(f&&l){const h=f.fetch;let p=[];if(h&&this.fetcher){const d=Array.isArray(h)?h.find(g=>g.schema===l):h.schema===l?h:null;if(d){const g=this.fetcher.peek(d,{website:this});p=Array.isArray(g?.data)?g.data:[]}}const m=p.find(d=>String(d[o])===String(a));m?(m.title&&(r.title=m.title),(m.description||m.excerpt)&&(r.description=m.description||m.excerpt)):p.length>0&&(r.title="Not found",r.notFound=!0),r._collectionLoaded=p.length>0}const u=new Re(r,`dynamic-${t}`,this);return u.parent=e.parent,{page:u,collectionLoaded:r._collectionLoaded??!0}}setActivePage(e){const t=this.getPage(e);t&&(this.activePage=t)}setBasePath(e){!e||e==="/"?this.basePath="":this.basePath=e.endsWith("/")?e.slice(0,-1):e}getRemoteLayout(e){const t=globalThis.uniweb?.foundationConfig;return t?.layouts&&e&&t.layouts[e]?t.layouts[e]:null}getDefaultLayoutName(){return globalThis.uniweb?.foundationConfig?.defaultLayout||null}getDefaultBlockType(){return globalThis.uniweb?.foundationConfig?.defaultSection||"Section"}getAreaBlocks(e,t){return t&&this._layoutSets[t]?this._layoutSets[t][e]?.bodyBlocks||null:this._layoutSets.default&&this._layoutSets.default[e]?.bodyBlocks||null}getLayoutAreas(e){const t=e||"default",n=this._layoutSets[t]||this._layoutSets.default;if(!n)return{};const i={};for(const[r,o]of Object.entries(n))o?.bodyBlocks&&(i[r]=o.bodyBlocks);return i}getLayoutMeta(e){return globalThis.uniweb?.foundationConfig?.layoutMeta?.[e]||null}get viewTransitions(){return globalThis.uniweb.foundationConfig?.viewTransitions!==!1}getRemoteProps(){return globalThis.uniweb?.foundationConfig?.props||null}getRoutingComponents(){return globalThis.uniweb?.routingComponents||{}}makeHref(e){if(!e)return e;let t;if(e.startsWith("page:"))t=e.slice(5);else if(e.startsWith("topic:"))t=e.slice(6);else return e;const[n,i]=t.split("#"),r=this._pageIdMap?.get(n);if(!r)return e;let o=r.route;return i&&(o+=`#section-${i}`),o}resolveDetailPageTemplate(e){if(!e||typeof e!="string")return null;const t=e.startsWith("page:")?e.slice(5):e,n=this._pageIdMap?.get(t);return!n||!n.route?null:this.translateRoute(n.route)}getLanguages(){return this.langs}getLanguage(){return this.activeLang}getLocales(){return this.locales}getActiveLocale(){return this.activeLocale}getDefaultLocale(){return this.defaultLocale}hasMultipleLocales(){return this.locales.length>1}setActiveLocale(e){this.locales.find(n=>n.code===e)&&(this.activeLocale=e,this.activeLang=e)}getLocaleUrl(e,t=null){let n=t||this.activePage.getNavRoute();if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const o=`/${this.activeLocale}`;n===o||n===`${o}/`?n="/":n.startsWith(`${o}/`)&&(n=n.slice(o.length))}n=this.reverseTranslateRoute(n);const i=this.config?.domainLocales;if(i){const o=Object.entries(i).find(([,a])=>a===e);if(o){const a=o[0],l=this.translateRoute(n,e);return`https://${a}${l==="/"?"/":l}`}}if(e===this.defaultLocale)return n;const r=this.translateRoute(n,e);return r==="/"?`/${e}/`:`/${e}${r}`}getLocale(e){return this.locales.find(t=>t.code===e)}localize(e,t="",n="",i=!1){const r=n||this.activeLang,o=this.langs[0]?.value||"en";if(typeof e=="object"&&!Array.isArray(e))return i?e?.[r]||e?.[o]||t:e?.[r]||t;if(typeof e=="string"){if(!e.startsWith("{")&&!e.startsWith('"'))return e;try{const a=JSON.parse(e);return typeof a=="object"?i?a?.[r]||a?.[o]||t:a?.[r]||t:a}catch{return e}}return t}isSearchEnabled(){return this.config?.search?.enabled!==!1}getSearchConfig(){const e=this.config?.search||{};return{enabled:this.isSearchEnabled(),provider:e.provider||"index",endpoint:e.endpoint,indexUrl:this.getSearchIndexUrl(),locale:this.getActiveLocale(),include:{pages:e.include?.pages!==!1,sections:e.include?.sections!==!1,headings:e.include?.headings!==!1,paragraphs:e.include?.paragraphs!==!1,links:e.include?.links!==!1,lists:e.include?.lists!==!1},exclude:{routes:e.exclude?.routes||[],components:e.exclude?.components||[]}}}getSearchIndexUrl(){const e=this.getActiveLocale(),n=e===this.getDefaultLocale()?"/search-index.json":`/${e}/search-index.json`;return`${this.basePath||""}${n}`}getSearchData(){return this.pages.map(e=>({id:e.id,title:e.title,href:e.route,route:e.route,description:e.description,content:e.getPageBlocks().map(t=>t.title).filter(Boolean).join(`
132
- `)}))}getPageHierarchy(e={}){const{nested:t=!0,for:n,includeHidden:i=!1,filter:r,sort:o}=e,a=f=>!(f.route.includes(":")||f.isIndex&&f.route.endsWith("/index")||!i&&(f.hidden||f.hideIn?.includes("*")||n&&f.hideIn?.includes(n))||!f.hasContent()&&!f.children?.some(h=>h.isIndex)&&!f.children?.some(a)||r&&!r(f));let l=this.pages.filter(a);t&&(l=l.filter(f=>!f.parent&&!f.parentRoute)),o&&l.sort(o);const c=f=>{const u=f.getNavRoute();return{id:f.id,route:u,navigableRoute:f.getNavigableRoute(),translatedRoute:this.translateRoute(u),title:f.getTitle(),label:f.getLabel(),description:f.description,hasContent:f.hasContent(),version:f.version||null,children:t&&f.hasChildren()?f.children.filter(a).map(c):[]}};return l.map(c)}getBranchHierarchy({route:e="",for:t,includeHidden:n=!1}={}){const i=l=>(l||"").replace(/^\/+/,"").replace(/\/+$/,""),r=this.getPageHierarchy({for:t,includeHidden:n}),o=i(e).split("/")[0];if(!o)return r;const a=r.find(l=>i(l.route)===o);return a?a.children?.length?a.children:[a]:r}getHeaderPages(){return this.getPageHierarchy({for:"header"})}getFooterPages(){return this.getPageHierarchy({for:"footer"})}getAllPages(e=!1){return this.getPageHierarchy({nested:!1,includeHidden:e})}getNotFoundPage(){return this.notFoundPage}getActiveRoute(){return this.activePage.getNormalizedRoute()}getActiveRootSegment(){return this.getActiveRoute().split("/")[0]}normalizeRoute(e){let t=(e||"").replace(/^\/+/,"").replace(/\/+$/,"");if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const r=this.activeLocale;t===r?t="":t.startsWith(`${r}/`)&&(t=t.slice(r.length+1))}const n="/"+t;return t=this.reverseTranslateRoute(n).replace(/^\//,""),t}isRouteActive(e,t){return this.normalizeRoute(e)===this.normalizeRoute(t)}isRouteActiveOrAncestor(e,t){const n=this.normalizeRoute(e),i=this.normalizeRoute(t);return n===i?!0:n===""?!1:i.startsWith(n+"/")}getVersionedScopes(){return this.versionedScopes}hasVersionedContent(){return Object.keys(this.versionedScopes).length>0}getVersionScope(e){const t=e||"";for(const n of Object.keys(this.versionedScopes)){if(t===n)return n;if(n==="/"){if(t.startsWith("/")||t==="")return n}else if(t.startsWith(n+"/"))return n}return null}isVersionedRoute(e){return this.getVersionScope(e)!==null}getVersionMeta(e){return this.versionedScopes[e]||null}getPageVersion(e){return e?.version||null}getVersionsForRoute(e){const t=this.getVersionScope(e);return t?this.versionedScopes[t]?.versions||[]:[]}getVersionUrl(e,t){const n=this.getVersionScope(t);if(!n)return null;const i=this.versionedScopes[n];if(!i)return null;const r=i.versions.find(l=>l.id===e);if(!r)return null;const o=n==="/"?t:t.slice(n.length);let a=o;for(const l of i.versions){const c=`/${l.id}`;if(o.startsWith(c+"/")||o===c){a=o.slice(c.length);break}}return r.latest?n==="/"?a:n+a:n==="/"?"/"+e+a:n+"/"+e+a}getLatestVersion(e){return this.versionedScopes[e]?.latestId||null}}const St=typeof window<"u"&&typeof document<"u";class Hr{constructor(e={}){this.endpoint=e.endpoint||null,this.flushInterval=e.flushInterval||5e3,this.maxQueueSize=e.maxQueueSize||10,this.debug=e.debug||!1,this.queue=[],this.scrollMilestones=new Set,this.sessionId=this.generateSessionId(),this.sessionStart=Date.now(),this.flushIntervalId=null,St&&this.isEnabled()&&(this.setupFlushInterval(),this.setupUnloadHandler()),Object.seal(this)}isEnabled(){return!!this.endpoint}generateSessionId(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}setupFlushInterval(){this.flushIntervalId=setInterval(()=>{this.flush()},this.flushInterval)}setupUnloadHandler(){const e=()=>{this.flush(!0)};window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e()}),window.addEventListener("pagehide",e)}addToQueue(e,t){if(!this.isEnabled()||!St)return;const n={type:e,data:t,timestamp:Date.now(),sessionId:this.sessionId,url:window.location.href,referrer:document.referrer||null};this.queue.push(n),this.debug&&console.log("[Analytics] Event queued:",n),this.queue.length>=this.maxQueueSize&&this.flush()}trackPageView(e,t,n={}){this.scrollMilestones.clear(),this.addToQueue("pageview",{path:e,title:t,...n})}trackEvent(e,t={}){this.addToQueue("event",{name:e,...t})}trackScrollDepth(e){[25,50,75,100].includes(e)&&(this.scrollMilestones.has(e)||(this.scrollMilestones.add(e),this.addToQueue("scroll_depth",{depth:e})))}flush(e=!1){if(!this.isEnabled()||!St||this.queue.length===0)return;const t=[...this.queue];this.queue=[];const n=JSON.stringify({events:t,sessionId:this.sessionId,sessionDuration:Date.now()-this.sessionStart});if(this.debug&&console.log("[Analytics] Flushing",t.length,"events"),e&&navigator.sendBeacon){const i=new Blob([n],{type:"application/json"});!navigator.sendBeacon(this.endpoint,i)&&this.debug&&console.warn("[Analytics] sendBeacon failed, events may be lost");return}fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:n,keepalive:!0}).catch(i=>{this.debug&&console.warn("[Analytics] Flush failed:",i),this.queue.unshift(...t)})}destroy(){this.flushIntervalId&&clearInterval(this.flushIntervalId),this.flush(!0)}}class Wr{constructor({content:e={},foundation:t=null,extensions:n=[],defaultFetcher:i=null,transport:r=null,dev:o=!1}={}){this.activeWebsite=new Vr({content:e,foundation:t,extensions:n,defaultFetcher:i,transport:r,dev:o}),this.foundation=t,this.foundationConfig={},this.meta=t?.default?.meta||{},this.extensions=[],t?.default?.capabilities&&(this.foundationConfig={...t.default.capabilities}),t?.default?.layoutMeta&&(this.foundationConfig.layoutMeta=t.default.layoutMeta),t?.default?.handlers&&(this.foundationConfig.handlers=t.default.handlers),t?.default?.viewTransitions!==void 0&&(this.foundationConfig.viewTransitions=t.default.viewTransitions);for(const a of n)this._wireExtension(a);this.childBlockRenderer=null,this.routingComponents={},this.language="en",this.defaultInsets=null,this.iconResolver=null,this.iconCache=new Map,this.analytics=new Hr(e?.analytics||e?.config?.analytics||{}),Object.seal(this)}_wireExtension(e){const t=e?.default?.meta||{};this.extensions.push({foundation:e,meta:t})}async resolveIcon(e,t){return this.iconResolver?this.iconResolver(e,t):(console.warn("[Uniweb] No icon resolver configured"),null)}getIconSync(e,t){return this.iconCache.get(`${e}:${t}`)||null}getComponentMeta(e){const t=this.meta[e];if(t)return t;for(const n of this.extensions){const i=n.meta[e];if(i)return i}return null}getComponentDefaults(e){return this.getComponentMeta(e)?.defaults||{}}getComponent(e){if(!this.foundation){console.warn("[Runtime] No foundation loaded");return}const t=this.foundation[e];if(t)return t;for(const n of this.extensions){const i=n.foundation[e];if(i)return i}if(this.defaultInsets&&this.defaultInsets[e])return this.defaultInsets[e]}listComponents(){const e=new Set;if(this.foundation)for(const t of Object.keys(this.foundation))t!=="default"&&e.add(t);for(const t of this.extensions)for(const n of Object.keys(t.foundation))n!=="default"&&e.add(n);return[...e]}}const zr=[50,100,200,300,400,500,600,700,800,900,950],_t=["light","medium","dark"];class po{constructor(e={}){this._data=e,this._palettes=e.palettes||e.colors||{},this._rawColors=e.colors||{},this._contexts=e.contexts||{},this._fonts=e.fonts||{},this._appearance=e.appearance||{default:"light"},this._foundationVars=e.foundationVars||{},this._css=e.css||null,Object.seal(this)}get css(){return this._css}get data(){return this._data}getColor(e,t=500){const n=this._palettes[e];return n&&n[t]||null}getPalette(e){return this._palettes[e]||null}getPaletteNames(){return Object.keys(this._palettes)}hasPalette(e){return e in this._palettes}getColorVar(e,t=500){return`var(--${e}-${t})`}getContextClass(e){return _t.includes(e)?`context-${e}`:(console.warn(`Invalid context: ${e}. Using 'light'.`),"context-light")}isValidContext(e){return _t.includes(e)}getValidContexts(){return[..._t]}getAppearance(){return{default:this._appearance.default||"light",allowToggle:this._appearance.allowToggle||!1,respectSystemPreference:this._appearance.respectSystemPreference??!0,schemes:this._appearance.schemes||["light"]}}getDefaultScheme(){return this._appearance.default||"light"}supportsScheme(e){return(this._appearance.schemes||["light"]).includes(e)}hasSchemeToggle(){return this._appearance.allowToggle===!0}getSchemeClass(e){return`scheme-${e}`}getFonts(){return{...this._fonts}}getFont(e){return this._fonts[e]||null}getFontVar(e){return`var(--font-${e})`}getFoundationVar(e){const t=this._foundationVars[e];return t?typeof t=="object"?t.default:t:null}getFoundationVars(){const e={};for(const[t,n]of Object.entries(this._foundationVars))e[t]=typeof n=="object"?n.default:n;return e}getFoundationVarRef(e){return`var(--${e})`}getShadeLevels(){return[...zr]}hasCustomization(){return Object.keys(this._palettes).length>0||Object.keys(this._contexts).length>0||Object.keys(this._fonts).length>0}toJSON(){return{palettes:this._palettes,colors:this._rawColors,contexts:this._contexts,fonts:this._fonts,appearance:this._appearance,foundationVars:this._foundationVars}}}function go(s={}){return!!(s.allowToggle||s.default==="dark"||s.default==="system"||s.schemes?.includes("dark"))}const Jr=new Set(["eq","ne","gt","gte","lt","lte","in","nin","like","exists"]);function He(s,e){if(s==null)return!0;if(typeof s!="object"||Array.isArray(s)||e==null||typeof e!="object")return!1;for(const t of Object.keys(s))if(!Gr(t,s[t],e))return!1;return!0}function mo(s,e){return Array.isArray(e)?s==null?e.slice():e.filter(t=>He(s,t)):[]}function Gr(s,e,t){if(s==="and")return Array.isArray(e)?e.every(i=>He(i,t)):!1;if(s==="or")return Array.isArray(e)?e.some(i=>He(i,t)):!1;if(s==="not")return!He(e,t);const n=Zr(t,s);return e===null?n==null:typeof e=="object"&&!Array.isArray(e)&&Yr(e)?Qr(e,n):ke(n,e)}function Yr(s){if(s==null||typeof s!="object"||Array.isArray(s))return!1;const e=Object.keys(s);return e.length===0?!1:e.every(t=>Jr.has(t))}function Qr(s,e){for(const t of Object.keys(s))if(!Xr(t,s[t],e))return!1;return!0}function Xr(s,e,t){switch(s){case"eq":return ke(t,e);case"ne":return!ke(t,e);case"gt":return Fe(t,e)&&t>e;case"gte":return Fe(t,e)&&t>=e;case"lt":return Fe(t,e)&&t<e;case"lte":return Fe(t,e)&&t<=e;case"in":return Array.isArray(e)?e.some(n=>ke(t,n)):!1;case"nin":return Array.isArray(e)?!e.some(n=>ke(t,n)):!1;case"like":return typeof t!="string"||typeof e!="string"?!1:eo(e,t);case"exists":return!!t==!!e;default:return!1}}function ke(s,e){return s===e?!0:s==null||e==null?!1:Array.isArray(s)&&!Array.isArray(e)?s.some(t=>t===e):!1}function Fe(s,e){return s==null||e==null?!1:typeof s==typeof e}function Zr(s,e){if(typeof e!="string")return;if(e.indexOf(".")===-1)return s[e];let t=s;for(const n of e.split(".")){if(t==null||typeof t!="object")return;t=t[n]}return t}function eo(s,e){const t="^"+s.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")+"$";return new RegExp(t).test(e)}function yo(s){return!s||typeof s!="object"?!1:!!(Array.isArray(s.fields)||s.isComposite===!0||s.childSchema&&typeof s.childSchema=="object")}function bo(s){if(!s||typeof s!="object"||Array.isArray(s))return null;if(Array.isArray(s.fields)||s.isComposite===!0||s.childSchema)return s;if(s.sections!==void 0)return null;const e=i=>Object.entries(i).map(([r,o])=>typeof o=="string"?{id:r,type:o}:{id:r,...o});if(s.fields&&typeof s.fields=="object"){const{fields:i,...r}=s;return{...r,fields:e(i)}}const t=Object.entries(s);if(!t.length)return null;const n=([,i])=>i&&typeof i=="object"&&!Array.isArray(i)&&i.type!==void 0;return t.every(n)?{fields:e(s)}:null}const Qe={name:"json-body",canPush:new Set(["where","limit","sort"]),defaultEnvelope:null,encode(s,{method:e,pushCandidates:t,rename:n}){const i=new Set,r=[];let o=null;if(e==="GET")t.has("where")&&s.where!==void 0&&(r.push([se("where","_where",n),JSON.stringify(s.where)]),i.add("where")),t.has("limit")&&s.limit!==void 0&&(r.push([se("limit","_limit",n),String(s.limit)]),i.add("limit")),t.has("sort")&&s.sort!==void 0&&(r.push([se("sort","_sort",n),String(s.sort)]),i.add("sort"));else if(e==="POST"){const a={};t.has("where")&&s.where!==void 0&&(a[se("where","where",n)]=s.where,i.add("where")),t.has("limit")&&s.limit!==void 0&&(a[se("limit","limit",n)]=s.limit,i.add("limit")),t.has("sort")&&s.sort!==void 0&&(a[se("sort","sort",n)]=s.sort,i.add("sort")),Object.keys(a).length>0&&(o=a)}return{queryParams:r,bodyMerge:o,pushed:i}}};function se(s,e,t){return t&&typeof t[s]=="string"&&t[s].length>0?t[s]:e}const $s={name:"flat-query",canPush:new Set(["where","limit","sort"]),defaultEnvelope:null,encode(s,{method:e,pushCandidates:t,rename:n}){const i=new Set,r=[];if(e!=="GET")return{queryParams:r,bodyMerge:null,pushed:i};if(t.has("where")&&s.where!==void 0){const o=to(s.where);if(o!==null){for(const[a,l]of o)r.push([no(a),l]);i.add("where")}}if(t.has("limit")&&s.limit!==void 0&&(r.push([Cs("limit","limit",n),String(s.limit)]),i.add("limit")),t.has("sort")&&s.sort!==void 0){const o=so(s.sort);o!==null&&(r.push([Cs("sort","sort",n),o]),i.add("sort"))}return{queryParams:r,bodyMerge:null,pushed:i}}};function to(s){if(!s||typeof s!="object"||Array.isArray(s))return null;const e=[];for(const[t,n]of Object.entries(s)){if(t==="and"||t==="or"||t==="not"||t.includes("."))return null;if(Ns(n)){e.push([t,Os(n)]);continue}if(n&&typeof n=="object"&&!Array.isArray(n)){const i=Object.keys(n);if(i.length===1&&i[0]==="eq"&&Ns(n.eq)){e.push([t,Os(n.eq)]);continue}}return null}return e}function so(s){if(typeof s!="string"||s.length===0)return null;const e=s.split(",").map(n=>n.trim()).filter(Boolean);if(e.length===0)return null;const t=[];for(const n of e){const[i,r]=n.split(/\s+/);if(!i)return null;const o=(r||"asc").toLowerCase()==="desc";t.push(o?`-${i}`:i)}return t.join(",")}function Ns(s){if(s===null)return!0;const e=typeof s;return e==="string"||e==="number"||e==="boolean"}function Os(s){return s===null?"":String(s)}function Cs(s,e,t){return t&&typeof t[s]=="string"&&t[s].length>0?t[s]:e}function no(s,e){return s}const Ts={name:"strapi",canPush:new Set(["where","limit","sort"]),defaultEnvelope:{collection:"data",item:"data"},encode(s,{method:e,pushCandidates:t,rename:n}){const i=new Set,r=[];if(e!=="GET")return{queryParams:r,bodyMerge:null,pushed:i};if(t.has("where")&&s.where!==void 0){const o=At("where","filters",n),a=ro(s.where,o);if(a!==null){for(const l of a)r.push(l);i.add("where")}}if(t.has("limit")&&s.limit!==void 0){const o=At("limit","pagination[limit]",n);r.push([o,String(s.limit)]),i.add("limit")}if(t.has("sort")&&s.sort!==void 0){const o=ao(s.sort,At("sort","sort",n));if(o!==null){for(const a of o)r.push(a);i.add("sort")}}return{queryParams:r,bodyMerge:null,pushed:i}}},io={eq:"[$eq]",ne:"[$ne]",gt:"[$gt]",gte:"[$gte]",lt:"[$lt]",lte:"[$lte]",in:"[$in]",nin:"[$notIn]",like:"[$containsi]",exists:"[$notNull]"};function ro(s,e){const t=[];try{jt(s,[e],t)}catch(n){if(n&&n.unencodable)return null;throw n}return t.length>0?t:null}function jt(s,e,t){(!s||typeof s!="object"||Array.isArray(s))&&G();for(const[n,i]of Object.entries(s))n==="and"||n==="or"?(Array.isArray(i)||G(),i.forEach((r,o)=>{jt(r,[...e,`[$${n}]`,`[${o}]`],t)})):n==="not"?jt(i,[...e,"[$not]"],t):oo(n,i,e,t)}function oo(s,e,t,n){const i=s.split(".").map(o=>`[${o}]`),r=[...t,...i];if(vt(e)){n.push([Ke(r)+"[$eq]",It(e)]);return}if(e&&typeof e=="object"&&!Array.isArray(e)){for(const[o,a]of Object.entries(e)){const l=io[o];if(l||G(),o==="in"||o==="nin"){Array.isArray(a)||G(),a.forEach((c,f)=>{vt(c)||G(),n.push([Ke(r)+l+`[${f}]`,It(c)])});continue}if(o==="exists"){const c=!!a;n.push([Ke(r)+(c?"[$notNull]":"[$null]"),"true"]);continue}vt(a)||G(),n.push([Ke(r)+l,It(a)])}return}G()}function Ke(s){return s.join("")}function G(){const s=new Error("unencodable predicate");throw s.unencodable=!0,s}function ao(s,e){if(typeof s!="string"||s.length===0)return null;const t=s.split(",").map(i=>i.trim()).filter(Boolean);if(t.length===0)return null;const n=[];for(const i of t){const[r,o]=i.split(/\s+/);if(!r)return null;const a=(o||"asc").toLowerCase()==="desc"?"desc":"asc";n.push(`${r}:${a}`)}return n.length===1?[[e,n[0]]]:n.map((i,r)=>[`${e}[${r}]`,i])}function vt(s){if(s===null)return!0;const e=typeof s;return e==="string"||e==="number"||e==="boolean"}function It(s){return s===null?"":String(s)}function At(s,e,t){return t&&typeof t[s]=="string"&&t[s].length>0?t[s]:e}const xt=new Map([[Qe.name,Qe],[$s.name,$s],[Ts.name,Ts]]);function wo(s,{dev:e=!1}={}){if(!s)return Qe;const t=xt.get(s);return t||(e&&!Es.has(s)&&(Es.add(s),console.warn(`[default-fetcher] unknown request style "${s}"; falling back to "json-body". Known styles: ${[...xt.keys()].join(", ")}.`)),Qe)}const Es=new Set;function ko(){return[...xt.keys()]}function So(){return globalThis.uniweb}function _o(s,e=null,t=[],{defaultFetcher:n=null,transport:i=null,dev:r=!1}={}){const o=new Wr({content:s,foundation:e,extensions:t,defaultFetcher:n,transport:i,dev:r});return globalThis.uniweb=o,o}export{K as B,Ln as D,jr as E,Ls as F,In as O,Re as P,po as T,Wr as U,Vr as W,yo as a,ts as b,_o as c,Lr as d,$r as e,fo as f,lo as g,go as h,co as i,uo as j,He as k,So as l,mo as m,Ss as n,Cr as o,Rr as p,ko as q,wo as r,Ie as s,Mt as t,bo as u,Or as v,Bt as w,Dr as x,ho as y};