skir-converter 0.1.6 → 0.1.7

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.
@@ -41,7 +41,7 @@ const qm=e=>(t,n)=>{void 0!==n?n.addInitializer(()=>{customElements.define(e,t)}
41
41
  * Copyright 2017 Google LLC
42
42
  * SPDX-License-Identifier: BSD-3-Clause
43
43
  */
44
- function Gm(e,t){return(t,n,i)=>((e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,n),n))(t,n,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}function Qm(e){return e[0].toUpperCase()+e.slice(1)}function Xm(e){const t=e.slice(1,-1).split("\\\\");for(let e=0;e<t.length;++e){const n=t[e].replace(/\\(\r\n|\n|\r)/g,"\\n").replace(/(?<=^|[^\\])"/g,'\\"');t[e]=JSON.parse(`"${n}"`)}return t.join("\\")}function eg(e,t){const n=[];for(const[i,s]of Object.entries(e)){if("removed"===s.kind||!t(s))continue;const e="import"!==s.kind&&"import-alias"!==s.kind?s.doc:void 0;n.push({name:i,doc:e})}return n}class tg{constructor(){this.expectedNamesData=[],this.expectedNameSet=new Set}collect(e){for(const t of e)t.modulePath?this.expectedNamesData.push(t):this.expectedNameSet.has(t.name)||(this.expectedNamesData.push(t),this.expectedNameSet.add(t.name))}get expectedNames(){return this.expectedNamesData}}function ng(e,t,n,i,s){const r=("field"===e.kind?e.field.doc:e.doc).pieces.filter(e=>"reference"===e.kind);if(r.length<=0)return;const o=function(e,t,n){const i=[],s=e=>{const{key:t}=e,s=[...n.get(t).recordAncestors].reverse();for(const e of s)i.push(e)},r=e=>{if(e){const t=rg(e);if(t){const{record:e}=n.get(t);i.push(e)}}};switch(e.kind){case"constant":i.push(t),r(e.type);break;case"field":{const{field:n,record:o}=e;s(o),i.push(t),r(n.type);break}case"method":i.push(t),r(e.requestType),r(e.responseType);break;case"record":s(e),i.push(t)}return i}(e,t,i);for(const e of r)ig(e,o,t,n,s)}function ig(e,t,n,i,s){const{nameParts:r}=e;if(r.length<=0)return;const o=new tg;for(const a of t){if(e.absolute&&a!==n)continue;const t=sg(r,a,n,i);if("no-match"!==t.kind)return"failed-match"===t.kind?void(t.error&&s.push(t.error)):void(e.referee=t);o.collect(t.expectedNames)}const a=r[0].token;s.push({token:a,message:"Not found",expectedNames:o.expectedNames})}function sg(e,t,n,i){let s=!1;for(let r=0;r<e.length;r++){const o=e[r],a=t.nameToDeclaration[o.token.text];if(!a){const e=eg(t.nameToDeclaration,e=>t===n||"import"!==e.kind&&"import-alias"!==e.kind);return s?{kind:"failed-match",error:{token:o.token,message:"Not found",expectedNames:e}}:{kind:"no-match",expectedNames:e}}s=!0;const l=r===e.length-1,c=()=>({kind:"failed-match",error:{token:o.token,message:"Expected to be the last name in the sequence"}});switch(a.kind){case"constant":case"method":return o.declaration=a,l?a:c();case"record":if(t=a,o.declaration=a,l)return a;break;case"field":return o.declaration=a,l?{kind:"field",field:a,record:t}:c();case"import-alias":if(l)return{kind:"failed-match",error:{token:o.token,message:"Cannot be the last name in the sequence"}};case"import":{if(t!==n)return{kind:"failed-match",error:{token:o.token,message:"Cannot refer to other module's imports"}};const{resolvedModulePath:e}=a;if(!e)return{kind:"failed-match",error:null};const s=i(e);if(!s)return{kind:"failed-match",error:null};t=s,"import"===a.kind?--r:o.declaration=a;break}case"removed":throw new TypeError}}throw new Error("Unreachable")}function rg(e){switch(e.kind){case"array":return rg(e.item);case"optional":return rg(e.other);case"record":return e.key;case"primitive":return null}}function og(e,t){switch(t){case"bool":return"false"===e||"true"===e;case"bytes":return ag(e)&&/^hex:([0-9A-Fa-f]{2})*$/.test(Xm(e));case"timestamp":{if(!ag(e))return!1;const t=Xm(e),n=Date.parse(t).valueOf();return/(Z|[+-]\d\d:\d\d)$/.test(t)&&-864e13<=n&&n<=864e13&&n===Math.round(n)}case"int32":return lg(e,BigInt(-2147483648),BigInt(2147483647));case"int64":return lg(e,BigInt("-9223372036854775808"),BigInt("9223372036854775807"));case"hash64":return lg(e,BigInt(0),BigInt("18446744073709551615"));case"float32":case"float64":if(ag(e)){const t=Xm(e);return"NaN"===t||"Infinity"===t||"-Infinity"===t}return/^[-0-9]/.test(e);case"string":return ag(e)}}function ag(e){return/^['"]/.test(e)}function lg(e,t,n){if(!/^-?[0-9]+$/.test(e))return!1;const i=BigInt(e);return t<=i&&i<=n}function cg(e,t){switch(t){case"bool":return"true"===e?1:0;case"bytes":return function(e){const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);const n=Array.from(t,e=>String.fromCharCode(e)).join("");return btoa(n)}(Xm(e).substring(4));case"timestamp":{const t=Xm(e);return Math.round(new Date(t).valueOf())}case"int32":case"float32":case"float64":return ag(e)?Xm(e):Number(e);case"int64":case"hash64":return String(BigInt(e));case"string":return Xm(e)}}function hg(e,t){const n=cg(e,t);return"string"==typeof n?n:JSON.stringify(n)}function ug(e,t,n){(function(e,t){switch(t){case"lower_underscore":return/^[a-z][0-9a-z]*(_[a-z][0-9a-z]*)*$/.test(e);case"UpperCamel":return/^[A-Z][0-9A-Za-z]*$/.test(e)&&(/^[A-Z][0-9]*$/.test(e)||/[a-z]/.test(e));case"UPPER_UNDERSCORE":return/^[A-Z][0-9A-Z]*(_[A-Z][0-9A-Z]*)*$/.test(e)}})(e.text,t)||n.push({token:e,expected:t})}function dg(e,t){return new fg(e,t).parse()}class fg{constructor(e,t){this.docComment=e,this.completionMode=t,this.pieces=[],this.errors=[],this.currentText="",this.charIndex=-1;const{text:n}=e;if(n.startsWith("/// "))this.content=n.slice(4);else{if(!n.startsWith("///"))throw new Error("Expected doc comment to start with ///");this.content=n.slice(3)}this.charIndex=0}parse(){this.parseDocComment(),this.currentText.length>0&&this.pieces.push({kind:"text",text:this.currentText});const{pieces:e}=this,t=e.map(e=>{switch(e.kind){case"text":return e.text;case"reference":return e.referenceRange.text}}).join("");return{result:{text:t,pieces:this.pieces},errors:this.errors}}parseDocComment(){const e=/\[\[|\]\]|\[|\]/g;for(;this.charIndex<this.content.length;){e.lastIndex=this.charIndex;const t=e.exec(this.content);if(!t){this.currentText+=this.content.slice(this.charIndex);break}t.index>this.charIndex&&(this.currentText+=this.content.slice(this.charIndex,t.index));const n=t[0];if(this.charIndex=t.index,"[["===n)this.currentText+="[",this.charIndex+=2;else if("]]"===n)this.currentText+="]",this.charIndex+=2;else if("["===n){this.currentText.length>0&&(this.pieces.push({kind:"text",text:this.currentText}),this.currentText="");const e=this.parseReference();this.pieces.push(e)}else"]"===n&&(this.currentText+=n,this.charIndex++)}}parseReference(){const{content:e,docComment:t}=this,n=this.charIndex,i=t.text.length-e.length,s=t.position+i+n,r=e.indexOf("]",n),o=r<0?e.length:r+1,a=e.slice(n,o),l={text:a,originalText:a,position:s,line:t.line,colNumber:s-t.line.position};let c=!1;r<0&&(c=!0,this.errors.push({token:l,message:"Unterminated reference"})),this.charIndex++;const h=/[a-zA-Z][_a-zA-Z0-9]*/g,u=[];for(;this.charIndex<o;){const n=e[this.charIndex],i=t.text.length-e.length,s=t.position+i+this.charIndex,r=e=>({text:e,originalText:e,position:s,line:t.line,colNumber:s-t.line.position});if("."===n)u.push(r(".")),this.charIndex++;else if(/^[a-zA-Z]/.test(n)){h.lastIndex=this.charIndex;const t=h.exec(e)[0];u.push(r(t)),this.charIndex+=t.length}else if("]"===n)u.push(r("]")),this.charIndex++;else{const n=t.text.length-e.length,i=this.docComment.colNumber+n+this.charIndex;c=!0,this.errors.push({token:l,message:`Invalid character in reference at column ${i+1}`}),this.charIndex=o}}if(!c&&this.completionMode){const{position:e}=this.completionMode,n=s,r=t.position+i+o;if(e>=n&&e<r){const n=u.some(t=>/^[a-zA-Z]/.test(t.text)&&e>=t.position&&e<=t.position+t.text.length);if(!n){const n={text:"...",originalText:"",position:e,line:t.line,colNumber:e-t.line.position},i=u.findIndex(t=>t.position>=e);-1===i?u.push(n):u.splice(i,0,n)}}}return{kind:"reference",nameParts:c?[]:this.parseNameParts(u),absolute:"."===u[0]?.text,referee:void 0,docComment:this.docComment,referenceRange:l}}parseNameParts(e){const t=[];let n="identifier or '.'";for(const i of e){let e;if(/^[a-zA-Z]/.test(i.text)||"..."===i.text)e="identifier or '.'"===n||"identifier"===n,n="'.' or ']'",t.push({token:i,declaration:void 0});else if("."===i.text)e="identifier or '.'"===n||"'.' or ']'"===n,n="identifier";else{if("]"!==i.text)throw new Error(`Unexpected token in doc reference: ${i.text}`);e="'.' or ']'"===n}if(!e)return this.errors.push({token:i,expected:n}),[];if("]"===i.text)return t}return[]}}const pg=Object.freeze({text:"",pieces:Object.freeze([])});function mg(e,t){const{modulePath:n,sourceCode:i}=e,s=[],r=new Ig(e,t,s),o=gg(r,"module"),a=o.filter(e=>"broken-constant"===e.kind),l=o.filter(e=>"broken-method"===e.kind),c=o.filter(e=>"broken-constant"!==e.kind&&"broken-method"!==e.kind);r.expectThenNext([""]);const h={},u=new Map;for(const e of c){let t,i,r;if("import"===e.kind?(t=e.importedNames,i=$g(e.modulePath,n,s),r=e):"import-alias"===e.kind?(t=[e.name],i=$g(e.modulePath,n,s),r=e):t=[e.name],i){let e=u.get(i);e||(e=[],u.set(i,e)),e.push(r),r.resolvedModulePath=i}for(const n of t){const t=n.text;t in h?s.push({token:n,message:`Duplicate identifier '${t}'`}):h[t]=e}}const d=function(e,t,n){let i,s="no-import-seen",r=-1,o=!1;for(const t of e)"import"===t.kind||"import-alias"===t.kind?("no-import-seen"===s?(s="first-legal-import-seen",i=t.range.start):"last-legal-import-seen"===s&&(n.push({token:t.importToken,message:"Import declarations must be grouped together at the top"}),o=!0),r=Math.max(r,t.range.end)):s="last-legal-import-seen";if(void 0===i||o)return null;const a={start:i,end:r};{let e=t.tokensWithComments;e=e.slice(e.findIndex(e=>e.position>=a.start)),e=e.slice(0,e.findIndex(e=>e.position>=a.end));for(const t of e)t.text.startsWith("//")&&(n.push({token:t,message:"Comments not allowed within import block"}),o=!0)}return o?null:a}(c,e,s),f={};for(const[e,t]of u){const n=t.filter(e=>"import"===e.kind),i=t.filter(e=>"import-alias"===e.kind);if(n.length&&i.length)for(const e of n)s.push({token:e.modulePath,message:"Module already imported with an alias"});else if(i.length>=2)for(const e of i.slice(1))s.push({token:e.modulePath,message:"Module already imported with a different alias"});else if(n.length){const t=new Set;for(const e of n)for(const n of e.importedNames)t.add(n.text);f[e]={kind:"some",names:t}}else{const t=i[0].name.text;f[e]={kind:"all",alias:t}}}const p=c.filter(e=>"method"===e.kind),m=c.filter(e=>"constant"===e.kind);return{result:{kind:"module",path:n,sourceCode:i,nameToDeclaration:h,declarations:c,importBlockRange:d,records:Bg(c),pathToImportedNames:f,methods:p,brokenMethods:l,constants:m,brokenConstants:a},errors:s}}function gg(e,t){const n=[],i=e=>""===e||"module"!==t&&"}"===e,s=e=>"}"===e||";"===e;for(;!i(e.current);){const i=e.index,r=bg(e,t);if(null!==r)n.push(r),"method"!==r.kind&&"broken-method"!==r.kind||(r.inlineRequestRecord&&n.push(r.inlineRequestRecord),r.inlineResponseRecord&&n.push(r.inlineResponseRecord));else{const t=e.index===i;if(t&&(e.next(),s(e.previous)))continue;if(t||""!==e.current&&!s(e.previous)){let t=0;for(;;){const n=e.current;if(""===n)break;if(e.next(),"{"===n?++t:"}"===n&&--t,t<=0&&s(n))break}}}}return n}function bg(e,t){const n=function(e){const{moduleTokens:t}=e,n=[];for(;e.current.startsWith("///");)n.push(e.currentToken),e.next();return function(e){if(e.length<=0)return pg;const t=e.map(e=>e.text).join("\n"),n=[];for(let t=0;t<e.length;++t){const i=e[t];0!==t&&n.push({kind:"text",text:"\n"}),i.pieces.forEach(e=>n.push(e))}return{text:t,pieces:n}}(n.map(e=>t.posToDoc[e.position]??Ng))}(e);let i="enum";const s="module"===t,r=["struct","enum",s?null:"removed",s?null:Mg,s?"import":null,s?"method":null,s?"const":null],o=e.expectThenNext(r);switch(o.case){case 0:i="struct";case 1:return vg(e,i,n);case 2:return function(e,t){const n=[];let i,s="?";e:for(;;){const r="?"===s||","===s||".."===s,o=[","===s||".."===s?",":null,"?"===s||"0"===s||"1"===s?Eg:null,r?";":null,".."===s?"..":null],a=e.expectThenNext(o);switch(a.case){case 0:s="0";break;case 1:{const r=+a.token.text;if(void 0===i)s="..",n.push(r);else{s=",",r<=i&&e.errors.push({token:t,message:"Upper bound must be greater than lower bound"});for(let e=i;e<=r;++e)n.push(e);i=void 0}break}case 2:break e;case 3:s="1",i=n.pop();break;case-1:if(r)break e;return null}}const r=new Set;for(const i of n){if(r.has(i))return e.errors.push({token:t,message:`Duplicate field number ${i}`}),null;r.add(i)}return{kind:"removed",removedToken:t,numbers:n}}(e,o.token);case 3:return function(e,t,n,i){let s,r,o=-1;const a=()=>({kind:"field",name:t,number:o,doc:n,unresolvedType:s,type:void 0,isRecursive:!1,inlineRecord:r});for(;;){const n=void 0!==s||"enum"===i,l=[void 0===s&&o<0?":":null,o<0&&n?"=":null,n?";":null];switch(e.expectThenNext(l).case){case 0:{const n=wg(e,{context:"field",originalName:t});if(s=n.type,r=n.inlineRecord,void 0===s)return null;break}case 1:if(o=Cg(e),o<0)return null;break;case 2:return ug(t,s?"lower_underscore":"UPPER_UNDERSCORE",e.errors),"enum"===i&&"UNKNOWN"===t.text&&e.errors.push({token:t,message:"Cannot name field of enum: UNKNOWN"}),a();case-1:return n?a():null}}}(e,o.token,n,t);case 4:return function(e,t){const n=e.expectThenNext(["*","{",Mg]);switch(n.case){case 0:return function(e,t){if(e.expectThenNext(["as"]).case<0)return null;const n=e.expectThenNext([Mg]);if(n.case<0)return null;if(ug(n.token,"lower_underscore",e.errors),e.expectThenNext(["from"]).case<0)return null;const i=e.expectThenNext([_g]);if(i.case<0)return null;const s={start:t.position,end:e.currentToken.position+e.current.length};e.expectThenNext([";"]);const r=i.token;return{kind:"import-alias",importToken:t,name:n.token,range:s,modulePath:r}}(e,t);case 1:return Ag(e,t);case 2:return Ag(e,t,n.token);default:return null}}(e,o.token);case 5:return function(e,t){const n=e.expectThenNext([Mg]);if(n.case<0)return null;const i=n.token;if(ug(i,"UpperCamel",e.errors),e.expectThenNext(["("]).case<0)return null;const s=wg(e,{context:"method-request",originalName:i}),r=s.type;if(!r)return null;if(e.expectThenNext([")"]).case<0)return null;if(e.expectThenNext([":"]).case<0)return{kind:"broken-method",unresolvedRequestType:r,inlineRequestRecord:s.inlineRecord,unresolvedResponseType:void 0,inlineResponseRecord:void 0};const o=wg(e,{context:"method-response",originalName:i}),a=o.type;if(!a)return null;if(e.expectThenNext(["="]).case<0)return{kind:"broken-method",unresolvedRequestType:r,inlineRequestRecord:s.inlineRecord,unresolvedResponseType:a,inlineResponseRecord:o.inlineRecord};const l=Cg(e,"?");if(-2===l)return null;return e.expectThenNext([";"]),{kind:"method",name:n.token,doc:t,unresolvedRequestType:r,unresolvedResponseType:a,requestType:void 0,responseType:void 0,number:l,inlineRequestRecord:s.inlineRecord,inlineResponseRecord:o.inlineRecord}}(e,n);case 6:return function(e,t){const n=e.expectThenNext([Mg]);if(n.case<0)return null;if(ug(n.token,"UPPER_UNDERSCORE",e.errors),e.expectThenNext([":"]).case<0)return null;const i=xg(e);if(!i)return null;if(e.expectThenNext(["="]).case<0)return{kind:"broken-constant",unresolvedType:i};const s=Tg(e);if(null===s)return null;return e.expectThenNext([";"]),{kind:"constant",name:n.token,doc:t,unresolvedType:i,type:void 0,value:s,valueAsDenseJson:void 0}}(e,n);default:return null}}class yg{constructor(e,t,n,i,s,r){this.recordName=e,this.recordType=t,this.doc=n,this.stableId=i,this.inlineContext=s,this.errors=r,this.nameToDeclaration={},this.numbers=new Set,this.numbering="",this.removedNumbers=[]}addDeclaration(e){if("broken"===this.numbering)return;let t,n,i=[],s=this.numbering;const r=this.numbers.size+("enum"===this.recordType?1:0);switch(e.kind){case"field":t=e.name,n=t,s=e.number<0?"implicit":"explicit",e.number<0&&(e={...e,number:r}),i=[e.number];break;case"record":t=e.name,n=t;break;case"removed":n=e.removedToken,e.numbers.length?(s="explicit",i=e.numbers):(s="implicit",i=[r])}if(""===this.numbering?this.numbering=s:this.numbering!==s&&(this.errors.push({token:n,message:"Cannot mix implicit and explicit numbering"}),this.numbering="broken"),void 0!==t){const n=t.text;if(n in this.nameToDeclaration)return void this.errors.push({token:t,message:`Duplicate identifier '${n}'`});this.nameToDeclaration[n]=e}for(const e of i){if(this.numbers.has(e))return this.errors.push({token:n,message:`Duplicate field number ${e}`}),void(this.numbering="broken");if(0===e&&"enum"===this.recordType)return void this.errors.push({token:n,message:"Number 0 is reserved for UNKNOWN field"});this.numbers.add(e)}"removed"===e.kind&&this.removedNumbers.push(...i)}build(){const e="struct"===this.recordType;if(e)for(let e=0;e<this.numbers.size;++e)if(!this.numbers.has(e)){this.errors.push({token:this.recordName,message:`Missing field number ${e}`});break}const t=Object.values(this.nameToDeclaration),n=t.filter(e=>"field"===e.kind),i=t.filter(e=>"record"===e.kind),{recordName:s}=this;let r=`${s.line.modulePath}:${s.position}`;this.inlineContext&&(r+=`:${this.inlineContext.context}`);const o=e&&n.length?Math.max(...n.map(e=>e.number))+1:0,a=e?this.numbers.size:0;return{kind:"record",key:r,name:this.recordName,recordType:this.recordType,doc:this.doc,nameToDeclaration:this.nameToDeclaration,declarations:Object.values(this.nameToDeclaration),fields:n,nestedRecords:i,removedNumbers:this.removedNumbers.sort(),recordNumber:this.stableId,numSlots:o,numSlotsInclRemovedNumbers:a}}}function vg(e,t,n,i){let s;if(i){const{originalName:e}=i;let t=function(e,t){let n;switch(n=e.includes("_")||!/[a-z]/.test(e)?e.split("_").map(e=>e.toLowerCase()):e.split(/(?=[A-Z])/).map(e=>e.toLowerCase()),t){case"lowerCamel":return n.map((e,t)=>t?Qm(e):e).join("");case"lower_underscore":return n.join("_");case"UpperCamel":return n.map(Qm).join("");case"UPPER_UNDERSCORE":return n.map(e=>e.toUpperCase()).join("_")}}(e.text,"UpperCamel");"method-request"===i.context?t+="Request":"method-response"===i.context&&(t+="Response"),s={...e,text:t}}else{const t=e.expectThenNext([Mg]);if(t.case<0)return null;ug(t.token,"UpperCamel",e.errors),s=t.token}let r=null;if("("===e.current){if(e.next(),r=Cg(e,"?"),-2===r)return null;if(e.expectThenNext([")"]).case<0)return null}if(e.expectThenNext(["{"]).case<0)return null;const o=gg(e,t);e.expectThenNext(["}"]);const a=new yg(s,t,n,r,i,e.errors);for(const e of o)a.addDeclaration(e),"field"===e.kind&&e.inlineRecord&&a.addDeclaration(e.inlineRecord);return a.build()}const kg=new Set(["bool","int32","int64","hash64","float32","float64","timestamp","string","bytes"]);function wg(e,t){if("struct"===e.current||"enum"===e.current){const n=e.current;e.next();const i=vg(e,n,Ng,t);return{type:i?{kind:"record",nameParts:[i.name],absolute:!1}:void 0,inlineRecord:i||void 0}}return{type:xg(e),inlineRecord:void 0}}function xg(e){const t=e.expectThenNext(["[",Mg,"."]);let n;switch(t.case){case 0:n=function(e){const t=xg(e);if(void 0===t)return;let n;for(;;){const i=!n&&"record"===t.kind,s=e.expectThenNext([i?"|":null,"]"]);switch(s.case){case 0:if(n=Sg(e,s.token),null===n)return;break;case 1:return{kind:"array",item:t,key:n};default:return}}}(e);break;case 1:if(kg.has(t.token.text)){n={kind:"primitive",primitive:t.token.text};break}case 2:n=function(e,t){const n="."===t.text,i=[];if("."===t.text){const t=e.expectThenNext([Mg]);if(t.case<0)return;i.push(t.token)}else i.push(t);for(;"."===e.current;){e.next();const t=e.expectThenNext([Mg]);if(t.case<0)return;i.push(t.token)}return{kind:"record",nameParts:i,absolute:n}}(e,t.token);break;default:return}if(void 0!==n)return"?"===e.current?(e.next(),{kind:"optional",other:n}):n}function Sg(e,t){const n=[];for(;;){const t=e.expectThenNext([Mg]);if(t.case<0)return;if(n.push(t.token),"."!==e.current)break;e.next()}const i=n.map(e=>({name:e}));return{pipeToken:t,path:i,keyType:{kind:"primitive",primitive:"bool"}}}function Cg(e,t){if(t&&"lenient"===e.mode&&"?"===e.current)return e.next(),-1;const n=e.expectThenNext([Eg]);if(n.case<0)return-2;const{text:i}=n.token;return BigInt(i)<BigInt(2**32)?+i:(e.errors.push({token:n.token,message:"Value out of uint32 range"}),-2)}function Ag(e,t,n){const i=n?[n]:[];if(n)for(;","===e.current;){e.next();const t=e.expectThenNext([Mg]);if(t.case<0)return null;i.push(t.token)}else for(;;){let t=e.expectThenNext([Mg,"}"]);if(0!==t.case){if(1===t.case)break;return null}if(i.push(t.token),t=e.expectThenNext([",","}"]),1===t.case)break;if(t.case<0)return null}if(e.expectThenNext(["from"]).case<0)return null;const s=e.expectThenNext([_g]);if(s.case<0)return null;const r={start:t.position,end:e.currentToken.position+e.current.length};e.expectThenNext([";"]);return{kind:"import",importToken:t,importedNames:i,range:r,modulePath:s.token}}function Tg(e){const t=["{","{|","[","false","true","null",Dg,_g],n=e.expectThenNext(t);switch(n.case){case 0:case 1:{const t=1===n.case;return function(e,t,n){const i=n?"|}":"}",s={},r=[],o=()=>({kind:"object",token:e,entries:s,orphanNames:r,partial:n});for(;;){if(t.current===i)return t.next(),o();const e=t.expectThenNext([Mg]);if(e.case<0)return null;const n=e.token,a=e.token.text;if(t.expectThenNext([":"]).case<0){r.push(n);continue}a in s&&t.errors.push({token:e.token,message:"Duplicate field"});const l=Tg(t);if(null===l)return null;s[a]={name:n,value:l};const c=t.expectThenNext([",",i]);if(c.case<0)return null;if(c.token.text===i)return o()}}(n.token,e,t)}case 2:{const t=function(e){if("]"===e.current)return e.next(),[];const t=[];for(;;){const n=Tg(e);if(null===n)return null;t.push(n);const i=e.expectThenNext([",","]"]);if(i.case<0)return null;if("]"===i.token.text)return t;if("]"===e.current)return e.next(),t}}(e);return null===t?null:{kind:"array",token:n.token,items:t}}case 3:case 4:case 5:case 6:case 7:return{kind:"literal",token:n.token};default:return null}}const Ng=Object.freeze({text:"",pieces:Object.freeze([])});class Og{}const Mg=new class extends Og{matches(e){return/^\w/.test(e)||"..."===e}what(){return"identifier"}};const Eg=new class extends Og{matches(e){return/^[0-9]+$/.test(e)}what(){return"positive integer"}};const Dg=new class extends Og{matches(e){return/^[0-9-]/.test(e)}what(){return"number"}};const _g=new class extends Og{matches(e){return/^["']/.test(e)}what(){return"string literal"}};class Ig{constructor(e,t,n){this.moduleTokens=e,this.mode=t,this.errors=n,this.tokenIndex=0,this.tokens=e.tokens}expectThenNext(e){let t=this.tokens[this.tokenIndex];for(;t.text.startsWith("///");)this.errors.push({token:t,message:"Doc comments can only precede declarations"}),++this.tokenIndex,t=this.tokens[this.tokenIndex];for(let n=0;n<e.length;++n){const i=e[n];if(null===i)continue;if(i instanceof Og?i.matches(t.text):t.text===i)return++this.tokenIndex,{case:n,token:t}}const n=[];for(let t=0;t<e.length;++t){const i=e[t];null!==i&&n.push(i instanceof Og?i.what():`'${i}'`)}const i=1===n.length?n[0]:`one of: ${n.join(", ")}`;return this.errors.push({token:t,expected:i}),{case:-1,token:t}}get currentToken(){return this.tokens[this.tokenIndex]}get current(){return this.currentToken.text}get previous(){return this.tokens[this.tokenIndex-1].text}next(){++this.tokenIndex}get index(){return this.tokenIndex}}function Bg(e){const t=[],n=(e,i)=>{for(const s of e){if("record"!==s.kind)continue;const e=i.concat([s]),r={kind:"record-location",record:s,recordAncestors:e,modulePath:s.name.line.modulePath};n(s.declarations,e),t.push(r)}};return n(e,[]),t}function Pg(e){const t=e.match(/^(@[^/]+\/[^/]+\/)/);return t?.at(1)??""}function Rg(e){const t=e.split("/"),n=[];for(const e of t)".."===e?n.length>0&&".."!==n[n.length-1]?n.pop():n.push(".."):"."!==e&&""!==e&&n.push(e);return 0===n.length?".":n.join("/")}function $g(e,t,n){let i=Xm(e.text);if(/\\/.test(i))n.push({token:e,message:"Replace backslash with slash"});else{if(i.startsWith("./")||i.startsWith("../")){if(i.includes("/@"))return void n.push({token:e,message:"Use absolute path"});i=Rg(function(e){const t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}(t)+"/"+i)}else if(t.startsWith("@")&&!i.startsWith("@")){i=Pg(t)+i}if(i=Rg(i),!i.startsWith("../"))return i;n.push({token:e,message:"Module path must point to a file within skir-src"})}}function Lg(e,t){return/^[0-9]/.test(e.text)?(t.push({token:e,message:"Invalid number"}),!1):e.text.startsWith("_")?(t.push({token:e,message:"Identifier cannot start with _"}),!1):e.text.endsWith("_")?(t.push({token:e,message:"Identifier cannot end with _"}),!1):e.text.includes("__")?(t.push({token:e,message:"Identifier cannot contain __ sequence"}),!1):!/_[0-9]/.test(e.text)||(t.push({token:e,message:"Digit cannot follow _"}),!1)}class zg{constructor(e,t){this.lines=[];const n=this.lines;let i,s=0;const r=/\n|\r|\n\r|$/g;for(;null!==(i=r.exec(e));){const o=i[0],a=r.lastIndex-o.length,l=e.substring(s,a);if(n.push({lineNumber:n.length,line:l,position:s,modulePath:t}),s=r.lastIndex,""===o)break}}advancePosition(e){const t=this.lines;for(;t.length>=2&&e>=this.lines[1].position;)t.shift();return t[0]}}class Fg{static compile(e,t,n="strict"){return new Fg(e,t,n)}static compileForCompletion(e,t,n,i){if(!n.has(e))throw new Error(`Not found: ${e}`);return new Fg(n,i,"lenient",{modulePath:e,position:t}).modules.get(e)}constructor(e,t,n,i){this.modulePathToContent=e,this.parseMode=n,this.completionMode=i,this.moduleBundles=new Map,this.registry=new Ug,this.cache=t?new Wg(e,t.moduleBundles,t.registry):void 0;const s=i?[i.modulePath]:e.keys();for(const e of s)this.parseAndResolve(e,new Set);this.finalizationResult=this.finalize(),this.cache=void 0}parseAndResolve(e,t){const n=this.moduleBundles.get(e);if(void 0!==n)return n;const i=this.doParseAndResolve(e,t);return i&&this.moduleBundles.set(e,i),i}doParseAndResolve(e,t){const n=this.modulePathToContent.get(e);if(void 0===n)return null;let i,s;{let t;switch(t=e===this.completionMode?.modulePath?{kind:"no-cache"}:this.cache?.getModuleCacheResult(e)??{kind:"no-cache"},t.kind){case"no-cache":i=function(e,t,n){const i=[],s=[],r=new zg(e,t),o=/(\/\*([^*]|\*[^/])*(\*\/)?)|(\/\/[^\n\r]*)|(-?(0|[1-9][0-9]*)(\.[0-9]+)?\b)|\b(\w+)\b|([ \n\r\t]+)|(\.\.|\{\||\|\}|[{}[\]()*.:=;|?,])|("(\\(\n|\r|\n\r|.)|[^\\"\n\r])*"?)|('(\\(\n|\r|\n\r|.)|[^\\'\n\r])*'?)|($)/g;let a,l=0;for(;null!==(a=o.exec(e));){const t=o.lastIndex-a[0].length;if(t!==l){const n=r.advancePosition(l),i=l-n.position,o=e.substring(l,t);s.push({token:{text:o,originalText:o,position:l,line:n,colNumber:i},message:"Invalid sequence of characters"})}l=o.lastIndex;const n=r.advancePosition(t),c=t-n.position,h={text:a[0],originalText:a[0],position:t,line:n,colNumber:c};if(void 0===a[1]||a[1].endsWith("*/")||s.push({token:h,message:"Unterminated multi-line comment"}),void 0!==a[8]&&!Lg(h,s))continue;if(void 0!==a[9])continue;const u=a[11]||a[14];if(void 0!==u){if(!u.endsWith(u[0])){s.push({token:h,message:"Unterminated string literal"});continue}if(!/^["'](\\(\r\n|u[0-9A-Fa-f]{4}|["'\\/bfnrt\n\r])|[^\\])*["']$/.test(u)){s.push({token:h,message:"String literal contains invalid escape sequence"});continue}const e=Xm(u);try{encodeURIComponent(e)}catch{s.push({token:h,message:"String literal contains lone surrogates"});continue}}if(i.push(h),void 0!==a[17])break}if(void 0!==n){const{position:s}=n,r=i.find(e=>{const t=e.position,n=e.position+e.text.length;return/^\w/.test(e.text)?s>=t&&s<=n:s>t&&s<n});if(void 0===r){const n=new zg(e,t).advancePosition(s),r=s-n.position,o={text:"...",originalText:"",position:s,line:n,colNumber:r},a=i.findIndex(e=>e.position>=s);-1===a?i.push(o):i.splice(a,0,o)}}const c={};for(const e of i){if(!e.text.startsWith("///"))continue;const t=dg(e,n);c[e.position]=t.result,t.errors.forEach(e=>s.push(e))}return{result:{tokens:i.filter(e=>{return!((t=e.originalText).startsWith("/*")||t.startsWith("//")&&!t.startsWith("///"));var t}),tokensWithComments:i,posToDoc:c,sourceCode:e,modulePath:t},errors:s}}(n,e,this.completionMode);break;case"module-tokens":i=t.tokens;break;case"module-bundle":return this.registry.mergeFrom(t.bundle.registry),t.bundle}}const r=[];{const e=mg(i.result,this.parseMode);r.push(...e.errors),s=e.result}const o=new Vg(i,{result:s,errors:r});for(const n of s.declarations){if("import"!==n.kind&&"import-alias"!==n.kind)continue;const i=n.resolvedModulePath;if(void 0===i)continue;const s="Circular dependency between modules";if(t.has(e)){r.push({token:n.modulePath,message:s});continue}t.add(e);const o=this.parseAndResolve(i,t);if(t.delete(e),null===o)r.push({token:n.modulePath,message:"Module not found",expectedNames:Kg(Xm(n.modulePath.text),e,this.modulePathToContent.keys())});else if(0!==o.tokens.errors.length||0!==o.module.errors.length){const e=o.module.errors.some(e=>e.message===s);e?r.push({token:n.modulePath,message:s}):r.push({token:n.modulePath,message:"Imported module has errors",errorIsInOtherModule:!0})}else if("import"===n.kind)for(const e of n.importedNames){const t=o.module.result.nameToDeclaration[e.text];void 0===t?r.push({token:e,message:"Not found",expectedNames:eg(o.module.result.nameToDeclaration,e=>"record"===e.kind)}):"import"===t.kind?r.push({token:e,message:"Cannot reimport imported record"}):"record"!==t.kind&&r.push({token:e,message:"Not a record"})}}if(r.length&&!this.completionMode)return o;for(const t of s.records){const{key:n}=t.record;this.registry.recordMap.set(n,t),o.registry.recordMap.set(n,t);const{recordNumber:i}=t.record;null==i||e.startsWith("@")||o.registry.pushNumberRecord(i,n)}const a=new Set,l=new jg(s,this.moduleBundles,this.completionMode?this.cache?.registry.topLevelNameToRecordLocations:void 0,a,r);for(const e of s.records)this.storeResolvedFieldTypes(e,l);const c=e=>ng(e,s,e=>this.moduleBundles.get(e)?.module.result,this.recordMap,r);for(const e of s.records){const{record:t}=e;this.storeFieldRecursivity(t);for(const e of t.fields){const{type:n}=e;n&&this.validateArrayKeys(n,r),c({kind:"field",field:e,record:t})}c(t)}const h=e=>{const t=l.resolve(e,"top-level");return t&&this.validateArrayKeys(t,r),t};for(const t of s.methods){const{unresolvedRequestType:n,unresolvedResponseType:i}=t;t.requestType=h(n),t.responseType=h(i);const{number:s}=t;e.startsWith("@")||o.registry.pushNumberMethod(s,t),c(t)}for(const e of s.brokenMethods){const{unresolvedRequestType:t,unresolvedResponseType:n}=e;h(t),n&&h(n)}for(const e of s.constants){const{unresolvedType:t}=e,n=h(t);e.type=n,n&&(e.valueAsDenseJson=this.valueToDenseJson(e.value,n,r)),c(e)}for(const e of s.brokenConstants){const{unresolvedType:t}=e;h(t)}return o.registry.pushTopLevelNames(s.declarations.filter(e=>"record"===e.kind).map(t=>({name:t.name.text,doc:t.doc,modulePath:e}))),function(e,t,n){for(const i of e.declarations)if("import"===i.kind)for(const e of i.importedNames)t.has(e.text)||n.push({token:e,message:"Unused import"});else"import-alias"===i.kind&&(t.has(i.name.text)||n.push({token:i.name,message:"Unused import alias"}))}(s,a,r),this.registry.mergeFrom(o.registry),o}storeResolvedFieldTypes(e,t){for(const n of e.record.fields)void 0!==n.unresolvedType&&(n.type=t.resolve(n.unresolvedType,e))}storeFieldRecursivity(e){for(const t of e.fields){if(!t.type)continue;const n="struct"===e.recordType?["hard","via-optional","soft"]:["soft"];for(const i of n){const n=new Set;if(this.collectTypeDeps(t.type,i,n),n.has(e.key)){t.isRecursive=i;break}}}}collectTypeDeps(e,t,n){switch(e.kind){case"record":{if("via-optional"===t)return;const{key:i}=e;if(n.has(i))return;n.add(i);const s=this.recordMap.get(i)?.record;if(!s)return void console.error("collectTypeDeps: record not found",i);if("hard"===t&&"enum"===s.recordType)return;for(const e of s.fields)void 0!==e.type&&this.collectTypeDeps(e.type,t,n);break}case"array":"soft"===t&&this.collectTypeDeps(e.item,t,n);break;case"optional":switch(t){case"soft":this.collectTypeDeps(e.other,t,n);break;case"via-optional":this.collectTypeDeps(e.other,"hard",n)}}}validateArrayKeys(e,t){const n=e=>{const{key:n,item:i}=e;if(!n)return;const{path:s}=n;let r,o=i;for(let e=0;e<s.length;++e){const i=s[e],a=i.name;if("record"!==o.kind){if(0===e)t.push({token:n.pipeToken,message:"Item must have struct type"});else{const n=s[e-1].name;t.push({token:n,message:"Must have struct type"})}return}const l=this.recordMap.get(o.key)?.record;if(!l)return void console.error("validateArrayKeys: record not found",o.key);if("struct"===l.recordType){const e=l.nameToDeclaration[a.text];if("field"!==e?.kind)return void t.push({token:a,message:`Field not found in struct ${l.name.text}`,expectedNames:eg(l.nameToDeclaration,e=>"field"===e.kind)});if(i.declaration=e,!e.type)return;o=e.type}else{if("kind"!==a.text)return void t.push({token:a,expected:"'kind'",expectedNames:[{name:"kind"}]});r=o,o={kind:"primitive",primitive:"string"}}}"primitive"===o.kind?n.keyType=r||o:t.push({token:s.at(-1).name,message:"Does not have primitive type"})},i=e=>{switch(e.kind){case"array":return n(e),i(e.item);case"optional":return i(e.other)}};i(e)}valueToDenseJson(e,t,n){switch(t.kind){case"optional":return"literal"===e.kind&&"null"===e.token.text?(e.type={kind:"null"},null):this.valueToDenseJson(e,t.other,n);case"array":{if("array"!==e.kind)return void n.push({token:e.token,expected:"array"});const i=[];let s=!0;for(const r of e.items){const e=this.valueToDenseJson(r,t.item,n);void 0!==e?i.push(e):s=!1}if(!s)return;const{key:r}=t;return e.key=r,r&&function(e,t,n){const{keyType:i,path:s}=t,r=e=>{let t=e;for(const e of s){const i=e.name;if("literal"===t.kind&&"kind"===i.text)return t;if("object"!==t.kind)return;const s=t.entries[i.text];if(!s)return void n.push({token:t.token,message:`Missing entry: ${i.text}`});t=s.value}return t},o=new Map;for(const t of e){const e=r(t);if(!e)return;if("literal"!==e.kind)return;let n;const s=e.token.text;if("primitive"===i.kind){const{primitive:e}=i;if(!og(s,e))continue;n=hg(s,e)}else{if(!ag(s))continue;n=Xm(s)}o.has(n)?o.get(n).push(e):o.set(n,[e])}for(const e of o.values())if(!(e.length<=1))for(const t of e)n.push({token:t.token,message:"Duplicate key"})}(e.items,r,n),i}case"record":{const i=this.recordMap.get(t.key);if(!i)return;return"struct"===i.record.recordType?this.structValueToDenseJson(e,i.record,n):this.enumValueToDenseJson(e,i.record,n)}case"primitive":{const{token:i}=e,{primitive:s}=t;return"literal"===e.kind&&og(i.text,s)?(e.type=t,cg(i.text,t.primitive)):void n.push({token:e.token,expected:s})}}}structValueToDenseJson(e,t,n){const{token:i}=e;if("object"!==e.kind)return void n.push({token:i,expected:"object"});const s=Array(t.numSlotsInclRemovedNumbers).fill(0);let r=!0;const o=Object.values(e.entries).map(e=>e.name).concat(e.orphanNames),a=new Set(o.map(e=>e.text));for(const e of o){const i=t.nameToDeclaration[e.text];"field"===i?.kind||(n.push({token:e,message:`Field not found in struct ${t.name.text}`,expectedNames:eg(t.nameToDeclaration,e=>"field"===e.kind&&!a.has(e.name.text))}),r=!1)}let l=0;for(const o of t.fields){const{type:t}=o;if(!t){r=!1;continue}const a=e.entries[o.name.text];let c;if(a?(a.fieldDeclaration=o,c=this.valueToDenseJson(a.value,t,n)):e.partial?c=this.getDefaultJson(t):n.push({token:i,message:`Missing entry: ${o.name.text}`}),void 0===c){r=!1;continue}s[o.number]=c;("optional"===t.kind?null===c:!c||Array.isArray(c)&&!c.length||"primitive"===t.kind&&("int64"===t.primitive||"hash64"===t.primitive)&&"0"===c)||(l=Math.max(l,o.number+1))}return r?(e.record=t,s.slice(0,l)):void 0}enumValueToDenseJson(e,t,n){const{token:i}=e;if("literal"===e.kind&&ag(i.text)){const s=Xm(i.text);if("UNKNOWN"===s)return 0;const r=t.nameToDeclaration[s];return"field"!==r?.kind?void n.push({token:i,message:`Variant not found in enum ${t.name.text}`,expectedNames:[{name:"UNKNOWN"}].concat(eg(t.nameToDeclaration,e=>"field"===e.kind&&!e.type))}):r.type?void n.push({token:i,message:"Refers to a wrapper variant"}):(e.type={kind:"enum",enum:t,variant:r},r.number)}if("object"===e.kind){const{entries:s}=e,r=s.kind,o=s.value,a=Object.values(s).map(e=>e.name).concat(e.orphanNames);for(const e of a){if("kind"===e.text||"value"===e.text)continue;const t=(r?[]:[{name:"kind"}]).concat(o?[]:[{name:"value"}]);return void n.push({token:e,message:"Extraneous entry",expectedNames:t})}if(!r)return void n.push({token:i,message:"Missing entry: kind"});const l=r.value.token;if("literal"!==r.value.kind||!ag(l.text))return void n.push({token:l,expected:"string"});const c=Xm(l.text),h=t.nameToDeclaration[c];if("field"!==h?.kind)return void n.push({token:l,message:`Variant not found in enum ${t.name.text}`,expectedNames:eg(t.nameToDeclaration,e=>"field"===e.kind&&!!e.type)});if(!h.type)return void n.push({token:l,message:"Refers to a constant variant"});if(!o)return void n.push({token:i,message:"Missing entry: value"});const u=this.valueToDenseJson(o.value,h.type,n);if(void 0===u)return;return e.record=t,[h.number,u]}n.push({token:i,expected:"string or object"})}getDefaultJson(e){switch(e.kind){case"primitive":switch(e.primitive){case"bool":case"int32":case"int64":case"hash64":case"float32":case"float64":case"timestamp":return 0;case"string":case"bytes":return"";default:{const t=e.primitive;throw new TypeError(t)}}case"array":return[];case"optional":return null;case"record":switch(this.recordMap.get(e.key).record.recordType){case"struct":return[];case"enum":return 0}}}finalize(){const e=new Map;for(const[t,n]of this.moduleBundles){const{module:i,tokens:s}=n,r=s.errors.length?s.errors:i.errors;e.set(t,{result:i.result,errors:[...r]})}for(const t of this.registry.numberToMethods.values()){if(t.length<=1)continue;const n=(t,n)=>{const i=t.name.line.modulePath,s=e.get(i),r=n.name.text,o=n.name.line.modulePath;s.errors.push({token:t.name,message:`Same number as ${r} in ${o}`})};n(t[0],t[1]);for(let e=1;e<t.length;++e)n(t[e],t[0])}for(const t of this.registry.numberToRecords.values()){if(t.length<=1)continue;const n=(t,n)=>{const i=this.registry.recordMap.get(t),s=this.registry.recordMap.get(n),r=i.record.name.line.modulePath,o=e.get(r),a=s.record.name.text,l=s.modulePath;o.errors.push({token:i.record.name,message:`Same number as ${a} in ${l}`})};n(t[0],t[1]);for(let e=1;e<t.length;++e)n(t[e],t[0])}const t=[];for(const n of e.values())t.push(...n.errors);return{modules:e,errors:t}}findRecordByNumber(e){const{numberToRecords:t,recordMap:n}=this.registry,i=t.get(e);return 1===i?.length?n.get(i[0]):void 0}findMethodByNumber(e){const{numberToMethods:t}=this.registry,n=t.get(e);return 1===n?.length?n[0]:void 0}get recordMap(){return this.registry.recordMap}get errors(){return this.finalizationResult.errors}get modules(){return this.finalizationResult.modules}}class jg{constructor(e,t,n,i,s){this.module=e,this.moduleBundles=t,this.topLevelNameToRecordLocations=n,this.usedImports=i,this.errors=s}resolve(e,t){switch(e.kind){case"primitive":return e;case"array":{const n=this.resolve(e.item,t);if(!n)return;return{kind:"array",item:n,key:e.key}}case"optional":{const n=this.resolve(e.other,t);if(!n)return;return{kind:"optional",other:n}}case"record":return this.resolveRecordRef(e,t)}}resolveRecordRef(e,t){const n=e.nameParts[0],i=e=>({token:e,message:"Does not refer to a struct or an enum"}),s=(e,t)=>({token:e,message:`Cannot find name '${e.text}'`,expectedNames:t}),{errors:r,module:o,moduleBundles:a,usedImports:l}=this;let c;const h=new tg;if("top-level"!==t&&!e.absolute)for(const e of[...t.recordAncestors].reverse()){const t=e.nameToDeclaration[n.text];if(t&&"record"===t.kind){c=e;break}h.collect(eg(e.nameToDeclaration,e=>"record"===e.kind))}if(void 0===c){if(!o.nameToDeclaration[n.text])return h.collect(eg(o.nameToDeclaration,e=>"record"===e.kind||"import"===e.kind||"import-alias"===e.kind)),h.collect(this.topLevelNameToRecordLocations?.get(n.text)?.filter(e=>e.modulePath!==o.path)??[]),void r.push(s(n,h.expectedNames));c=o}let u=c;const d=[];for(let t=0;t<e.nameParts.length;++t){const n=e.nameParts[t],o=n.text;let c=u.nameToDeclaration[o];if(void 0===c)return void r.push(s(n,eg(u.nameToDeclaration,e=>"record"===e.kind||0===t&&"import-alias"===e.kind||0===t&&"import"===e.kind)));if("record"===c.kind)u=c;else{if("import"!==c.kind&&"import-alias"!==c.kind)return void this.errors.push(i(n));{const e=()=>({token:n,message:"Cannot refer to imports of imported module"});if(0!==t)return void r.push(e());l.add(o);const h=c.resolvedModulePath;if(void 0===h)return;const d=a.get(h);if(!d)return;const f=d.module.result;if("import"===c.kind){if(c=f.nameToDeclaration[o],!c)return void r.push(s(n,eg(f.nameToDeclaration,e=>"record"===e.kind)));if("record"!==c.kind)return void this.errors.push("import"===c.kind||"import-alias"===c.kind?e():i(n));u=c}else u=f}}d.push({token:n,declaration:c})}if("record"!==u.kind){const t=e.nameParts[0];return void this.errors.push(i(t))}return{kind:"record",key:u.key,recordType:u.recordType,nameParts:d,refToken:e.nameParts.at(-1)}}}class Wg{constructor(e,t,n){this.registry=n,this.modulePathToCacheResult=new Map;const i=new Set;for(const[n,s]of e){const e=t.get(n);e?.tokens.result.sourceCode===s&&i.add(n)}const s=n=>{const i=t.get(n);if(!i)return{kind:"no-cache"};{const e=this.modulePathToCacheResult.get(n);if(e)return e}let r;if(e.get(n)===i.tokens.result.sourceCode){this.modulePathToCacheResult.set(n,{kind:"module-bundle",bundle:i});r=Object.keys(i.module.result?.pathToImportedNames).every(e=>"module-bundle"===s(e).kind)?{kind:"module-bundle",bundle:i}:{kind:"module-tokens",tokens:i.tokens}}else r={kind:"no-cache"};return this.modulePathToCacheResult.set(n,r),r};for(const e of t.keys())s(e)}getModuleCacheResult(e){return this.modulePathToCacheResult.get(e)??{kind:"no-cache"}}}class Ug{constructor(){this.recordMap=new Map,this.numberToRecords=new Map,this.numberToMethods=new Map,this.topLevelNameToRecordLocations=new Map}mergeFrom(e){for(const[t,n]of e.recordMap)this.recordMap.set(t,n);for(const[t,n]of e.numberToRecords){let e=this.numberToRecords.get(t);e||(e=[],this.numberToRecords.set(t,e)),e.push(...n)}for(const[t,n]of e.numberToMethods){let e=this.numberToMethods.get(t);e||(e=[],this.numberToMethods.set(t,e)),e.push(...n)}for(const[t,n]of e.topLevelNameToRecordLocations){let e=this.topLevelNameToRecordLocations.get(t);e||(e=[],this.topLevelNameToRecordLocations.set(t,e)),e.push(...n)}}pushNumberRecord(e,t){let n=this.numberToRecords.get(e);n||(n=[],this.numberToRecords.set(e,n)),n.push(t)}pushNumberMethod(e,t){let n=this.numberToMethods.get(e);n||(n=[],this.numberToMethods.set(e,n)),n.push(t)}pushTopLevelNames(e){for(const t of e){let e=this.topLevelNameToRecordLocations.get(t.name);e||(e=[],this.topLevelNameToRecordLocations.set(t.name,e)),e.push(t)}}}class Vg{constructor(e,t){this.tokens=e,this.module=t,this.registry=new Ug}}function Hg(e){const t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}function qg(e,t){const n=""===e?[]:e.split("/"),i=""===t?[]:t.split("/");let s=0;for(;s<n.length&&s<i.length&&n[s]===i[s];)s++;const r=n.length-s,o=i.slice(s);return[...Array(r).fill(".."),...o].join("/")}function Kg(e,t,n){const i=e.startsWith("./")||e.startsWith("../");let s;if(i){const n=e.lastIndexOf("/"),i=e.slice(0,n+1),r=e.slice(n+1),o=i+"__dummy__",a=function(e,t){const n=(e+"/"+t).split("/"),i=[];for(const e of n)".."===e?i.length>0&&".."!==i[i.length-1]?i.pop():i.push(".."):"."!==e&&""!==e&&i.push(e);return i.join("/")}(Hg(t),o.startsWith("./")?o.slice(2):o);s=a.slice(0,a.length-9)+r}else s=t.startsWith("@")&&!e.startsWith("@")?Pg(t)+e:e;if(s=s.replace(/\\/g,"/"),s.startsWith("../"))return[];const r=Hg(t),o=new Set;for(const a of n){if(!a.startsWith(s))continue;if(a===t)continue;if(i&&a.startsWith("@"))continue;const n=a.slice(s.length),l=n.indexOf("/"),c=l>=0?s+n.slice(0,l+1):a;if(i){const t=c.endsWith("/");let n=qg(r,t?c.slice(0,-1):c);""===n&&(n="."),n.startsWith(".")||(n="./"+n);const i=t?n+"/":n;if(e.startsWith("../")&&"./"===i)continue;o.add(i)}else o.add(c)}return[...o].map(e=>({name:e}))}const Jg=Symbol.for("yaml.alias"),Zg=Symbol.for("yaml.document"),Yg=Symbol.for("yaml.map"),Gg=Symbol.for("yaml.pair"),Qg=Symbol.for("yaml.scalar"),Xg=Symbol.for("yaml.seq"),eb=Symbol.for("yaml.node.type"),tb=e=>!!e&&"object"==typeof e&&e[eb]===Jg,nb=e=>!!e&&"object"==typeof e&&e[eb]===Zg,ib=e=>!!e&&"object"==typeof e&&e[eb]===Yg,sb=e=>!!e&&"object"==typeof e&&e[eb]===Gg,rb=e=>!!e&&"object"==typeof e&&e[eb]===Qg,ob=e=>!!e&&"object"==typeof e&&e[eb]===Xg;function ab(e){if(e&&"object"==typeof e)switch(e[eb]){case Yg:case Xg:return!0}return!1}function lb(e){if(e&&"object"==typeof e)switch(e[eb]){case Jg:case Yg:case Qg:case Xg:return!0}return!1}const cb=e=>(rb(e)||ab(e))&&!!e.anchor,hb=Symbol("break visit"),ub=Symbol("skip children"),db=Symbol("remove node");function fb(e,t){const n=function(e){if("object"==typeof e&&(e.Collection||e.Node||e.Value))return Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e);return e}(t);if(nb(e)){pb(null,e.contents,n,Object.freeze([e]))===db&&(e.contents=null)}else pb(null,e,n,Object.freeze([]))}function pb(e,t,n,i){const s=function(e,t,n,i){return"function"==typeof n?n(e,t,i):ib(t)?n.Map?.(e,t,i):ob(t)?n.Seq?.(e,t,i):sb(t)?n.Pair?.(e,t,i):rb(t)?n.Scalar?.(e,t,i):tb(t)?n.Alias?.(e,t,i):void 0}(e,t,n,i);if(lb(s)||sb(s))return function(e,t,n){const i=t[t.length-1];if(ab(i))i.items[e]=n;else if(sb(i))"key"===e?i.key=n:i.value=n;else{if(!nb(i)){const e=tb(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${e} parent`)}i.contents=n}}(e,i,s),pb(e,s,n,i);if("symbol"!=typeof s)if(ab(t)){i=Object.freeze(i.concat(t));for(let e=0;e<t.items.length;++e){const s=pb(e,t.items[e],n,i);if("number"==typeof s)e=s-1;else{if(s===hb)return hb;s===db&&(t.items.splice(e,1),e-=1)}}}else if(sb(t)){i=Object.freeze(i.concat(t));const e=pb("key",t.key,n,i);if(e===hb)return hb;e===db&&(t.key=null);const s=pb("value",t.value,n,i);if(s===hb)return hb;s===db&&(t.value=null)}return s}fb.BREAK=hb,fb.SKIP=ub,fb.REMOVE=db;const mb={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},gb=e=>e.replace(/[!,[\]{}]/g,e=>mb[e]);class bb{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},bb.defaultYaml,e),this.tags=Object.assign({},bb.defaultTags,t)}clone(){const e=new bb(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new bb(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:bb.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},bb.defaultTags)}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:bb.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},bb.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(2!==n.length&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[e,i]=n;return this.tags[e]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,1!==n.length)return t(0,"%YAML directive should contain exactly one part"),!1;const[e]=n;if("1.1"===e||"1.2"===e)return this.yaml.version=e,!0;return t(6,`Unsupported YAML version ${e}`,/^\d+\.\d+$/.test(e)),!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 n=e.slice(2,-1);return"!"===n||"!!"===n?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(">"!==e[e.length-1]&&t("Verbatim tags must end with a >"),n)}const[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(e){return t(String(e)),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+gb(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&&lb(e.contents)){const t={};fb(e.contents,(e,n)=>{lb(n)&&n.tag&&(t[n.tag]=!0)}),i=Object.keys(t)}else i=[];for(const[s,r]of n)"!!"===s&&"tag:yaml.org,2002:"===r||e&&!i.some(e=>e.startsWith(r))||t.push(`%TAG ${s} ${r}`);return t.join("\n")}}function yb(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const t=JSON.stringify(e);throw new Error(`Anchor must not contain whitespace or control characters: ${t}`)}return!0}function vb(e){const t=new Set;return fb(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function kb(e,t){for(let n=1;;++n){const i=`${e}${n}`;if(!t.has(i))return i}}function wb(e,t,n,i){if(i&&"object"==typeof i)if(Array.isArray(i))for(let t=0,n=i.length;t<n;++t){const n=i[t],s=wb(e,i,String(t),n);void 0===s?delete i[t]:s!==n&&(i[t]=s)}else if(i instanceof Map)for(const t of Array.from(i.keys())){const n=i.get(t),s=wb(e,i,t,n);void 0===s?i.delete(t):s!==n&&i.set(t,s)}else if(i instanceof Set)for(const t of Array.from(i)){const n=wb(e,i,t,t);void 0===n?i.delete(t):n!==t&&(i.delete(t),i.add(n))}else for(const[t,n]of Object.entries(i)){const s=wb(e,i,t,n);void 0===s?delete i[t]:s!==n&&(i[t]=s)}return e.call(t,n,i)}function xb(e,t,n){if(Array.isArray(e))return e.map((e,t)=>xb(e,String(t),n));if(e&&"function"==typeof e.toJSON){if(!n||!cb(e))return e.toJSON(t,n);const i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=e=>{i.res=e,delete n.onCreate};const s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return"bigint"!=typeof e||n?.keep?e:Number(e)}bb.defaultYaml={explicit:!1,version:"1.2"},bb.defaultTags={"!!":"tag:yaml.org,2002:"};class Sb{constructor(e){Object.defineProperty(this,eb,{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:s}={}){if(!nb(e))throw new TypeError("A document argument is required");const r={anchors:new Map,doc:e,keep:!0,mapAsMap:!0===t,mapKeyWarned:!1,maxAliasCount:"number"==typeof n?n:100},o=xb(this,"",r);if("function"==typeof i)for(const{count:e,res:t}of r.anchors.values())i(t,e);return"function"==typeof s?wb(s,{"":o},"",o):o}}class Cb extends Sb{constructor(e){super(Jg),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n,i;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],fb(e,{Node:(e,t)=>{(tb(t)||cb(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));for(const e of n){if(e===this)break;e.anchor===this.source&&(i=e)}return i}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:s}=t,r=this.resolve(i,t);if(!r){const e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(e)}let o=n.get(r);if(o||(xb(r,null,t),o=n.get(r)),void 0===o?.res){throw new ReferenceError("This should not happen: Alias anchor was not resolved?")}if(s>=0&&(o.count+=1,0===o.aliasCount&&(o.aliasCount=Ab(i,r,n)),o.count*o.aliasCount>s)){throw new ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return o.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(yb(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(e)}if(e.implicitKey)return`${i} `}return i}}function Ab(e,t,n){if(tb(t)){const i=t.resolve(e),s=n&&i&&n.get(i);return s?s.count*s.aliasCount:0}if(ab(t)){let i=0;for(const s of t.items){const t=Ab(e,s,n);t>i&&(i=t)}return i}if(sb(t)){const i=Ab(e,t.key,n),s=Ab(e,t.value,n);return Math.max(i,s)}return 1}const Tb=e=>!e||"function"!=typeof e&&"object"!=typeof e;class Nb extends Sb{constructor(e){super(Qg),this.value=e}toJSON(e,t){return t?.keep?this.value:xb(this.value,e,t)}toString(){return String(this.value)}}Nb.BLOCK_FOLDED="BLOCK_FOLDED",Nb.BLOCK_LITERAL="BLOCK_LITERAL",Nb.PLAIN="PLAIN",Nb.QUOTE_DOUBLE="QUOTE_DOUBLE",Nb.QUOTE_SINGLE="QUOTE_SINGLE";function Ob(e,t,n){if(nb(e)&&(e=e.contents),lb(e))return e;if(sb(e)){const t=n.schema[Yg].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||"undefined"!=typeof BigInt&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:i,onAnchor:s,onTagObj:r,schema:o,sourceObjects:a}=n;let l;if(i&&e&&"object"==typeof e){if(l=a.get(e),l)return l.anchor??(l.anchor=s(e)),new Cb(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t="tag:yaml.org,2002:"+t.slice(2));let c=function(e,t,n){if(t){const e=n.filter(e=>e.tag===t),i=e.find(e=>!e.format)??e[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(t=>t.identify?.(e)&&!t.format)}(e,t,o.tags);if(!c){if(e&&"function"==typeof e.toJSON&&(e=e.toJSON()),!e||"object"!=typeof e){const t=new Nb(e);return l&&(l.node=t),t}c=e instanceof Map?o[Yg]:Symbol.iterator in Object(e)?o[Xg]:o[Yg]}r&&(r(c),delete n.onTagObj);const h=c?.createNode?c.createNode(n.schema,e,n):"function"==typeof c?.nodeClass?.from?c.nodeClass.from(n.schema,e,n):new Nb(e);return t?h.tag=t:c.default||(h.tag=c.tag),l&&(l.node=h),h}function Mb(e,t,n){let i=n;for(let e=t.length-1;e>=0;--e){const n=t[e];if("number"==typeof n&&Number.isInteger(n)&&n>=0){const e=[];e[n]=i,i=e}else i=new Map([[n,i]])}return Ob(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Eb=e=>null==e||"object"==typeof e&&!!e[Symbol.iterator]().next().done;class Db extends Sb{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(t=>lb(t)||sb(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Eb(e))this.add(t);else{const[n,...i]=e,s=this.get(n,!0);if(ab(s))s.addIn(i,t);else{if(void 0!==s||!this.schema)throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);this.set(n,Mb(this.schema,i,t))}}}deleteIn(e){const[t,...n]=e;if(0===n.length)return this.delete(t);const i=this.get(t,!0);if(ab(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,s=this.get(n,!0);return 0===i.length?!t&&rb(s)?s.value:s:ab(s)?s.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!sb(t))return!1;const n=t.value;return null==n||e&&rb(n)&&null==n.value&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(0===n.length)return this.has(t);const i=this.get(t,!0);return!!ab(i)&&i.hasIn(n)}setIn(e,t){const[n,...i]=e;if(0===i.length)this.set(n,t);else{const e=this.get(n,!0);if(ab(e))e.setIn(i,t);else{if(void 0!==e||!this.schema)throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);this.set(n,Mb(this.schema,i,t))}}}}const _b=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Ib(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Bb=(e,t,n)=>e.endsWith("\n")?Ib(n,t):n.includes("\n")?"\n"+Ib(n,t):(e.endsWith(" ")?"":" ")+n,Pb="flow",Rb="block",$b="quoted";function Lb(e,t,n="flow",{indentAtStart:i,lineWidth:s=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!s||s<0)return e;s<r&&(r=0);const l=Math.max(1+r,1+s-t.length);if(e.length<=l)return e;const c=[],h={};let u,d,f=s-t.length;"number"==typeof i&&(i>s-Math.max(2,r)?c.push(0):f=s-i);let p=!1,m=-1,g=-1,b=-1;n===Rb&&(m=zb(e,m,t.length),-1!==m&&(f=m+l));for(let i;i=e[m+=1];){if(n===$b&&"\\"===i){switch(g=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}b=m}if("\n"===i)n===Rb&&(m=zb(e,m,t.length)),f=m+t.length+l,u=void 0;else{if(" "===i&&d&&" "!==d&&"\n"!==d&&"\t"!==d){const t=e[m+1];t&&" "!==t&&"\n"!==t&&"\t"!==t&&(u=m)}if(m>=f)if(u)c.push(u),f=u+l,u=void 0;else if(n===$b){for(;" "===d||"\t"===d;)d=i,i=e[m+=1],p=!0;const t=m>b+1?m-2:g-1;if(h[t])return e;c.push(t),h[t]=!0,f=t+l,u=void 0}else p=!0}d=i}if(p&&a&&a(),0===c.length)return e;o&&o();let y=e.slice(0,c[0]);for(let i=0;i<c.length;++i){const s=c[i],r=c[i+1]||e.length;0===s?y=`\n${t}${e.slice(0,r)}`:(n===$b&&h[s]&&(y+=`${e[s]}\\`),y+=`\n${t}${e.slice(s+1,r)}`)}return y}function zb(e,t,n){let i=t,s=t+1,r=e[s];for(;" "===r||"\t"===r;)if(t<s+n)r=e[++t];else{do{r=e[++t]}while(r&&"\n"!==r);i=t,s=t+1,r=e[s]}return i}const Fb=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),jb=e=>/^(%|---|\.\.\.)/m.test(e);function Wb(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:i}=t,s=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(jb(e)?" ":"");let o="",a=0;for(let e=0,t=n[e];t;t=n[++e])if(" "===t&&"\\"===n[e+1]&&"n"===n[e+2]&&(o+=n.slice(a,e)+"\\ ",e+=1,a=e,t="\\"),"\\"===t)switch(n[e+1]){case"u":{o+=n.slice(a,e);const t=n.substr(e+2,4);switch(t){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:"00"===t.substr(0,2)?o+="\\x"+t.substr(2):o+=n.substr(e,6)}e+=5,a=e+1}break;case"n":if(i||'"'===n[e+2]||n.length<s)e+=1;else{for(o+=n.slice(a,e)+"\n\n";"\\"===n[e+2]&&"n"===n[e+3]&&'"'!==n[e+4];)o+="\n",e+=2;o+=r," "===n[e+2]&&(o+="\\"),e+=1,a=e+1}break;default:e+=1}return o=a?o+n.slice(a):n,i?o:Lb(o,r,$b,Fb(t,!1))}function Ub(e,t){if(!1===t.options.singleQuote||t.implicitKey&&e.includes("\n")||/[ \t]\n|\n[ \t]/.test(e))return Wb(e,t);const n=t.indent||(jb(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&\n${n}`)+"'";return t.implicitKey?i:Lb(i,n,Pb,Fb(t,!1))}function Vb(e,t){const{singleQuote:n}=t.options;let i;if(!1===n)i=Wb;else{const t=e.includes('"'),s=e.includes("'");i=t&&!s?Ub:s&&!t?Wb:n?Ub:Wb}return i(e,t)}let Hb;try{Hb=new RegExp("(^|(?<!\n))\n+(?!\n|$)","g")}catch{Hb=/\n+(?!\n|$)/g}function qb({comment:e,type:t,value:n},i,s,r){const{blockQuote:o,commentString:a,lineWidth:l}=i.options;if(!o||/\n[\t ]+$/.test(n))return Vb(n,i);const c=i.indent||(i.forceBlockIndent||jb(n)?" ":""),h="literal"===o||"folded"!==o&&t!==Nb.BLOCK_FOLDED&&(t===Nb.BLOCK_LITERAL||!function(e,t,n){if(!t||t<0)return!1;const i=t-n,s=e.length;if(s<=i)return!1;for(let t=0,n=0;t<s;++t)if("\n"===e[t]){if(t-n>i)return!0;if(n=t+1,s-n<=i)return!1}return!0}(n,l,c.length));if(!n)return h?"|\n":">\n";let u,d;for(d=n.length;d>0;--d){const e=n[d-1];if("\n"!==e&&"\t"!==e&&" "!==e)break}let f=n.substring(d);const p=f.indexOf("\n");-1===p?u="-":n===f||p!==f.length-1?(u="+",r&&r()):u="",f&&(n=n.slice(0,-f.length),"\n"===f[f.length-1]&&(f=f.slice(0,-1)),f=f.replace(Hb,`$&${c}`));let m,g=!1,b=-1;for(m=0;m<n.length;++m){const e=n[m];if(" "===e)g=!0;else{if("\n"!==e)break;b=m}}let y=n.substring(0,b<m?b+1:m);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${c}`));let v=(g?c?"2":"1":"")+u;if(e&&(v+=" "+a(e.replace(/ ?[\r\n]+/g," ")),s&&s()),!h){const e=n.replace(/\n+/g,"\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);let s=!1;const r=Fb(i,!0);"folded"!==o&&t!==Nb.BLOCK_FOLDED&&(r.onOverflow=()=>{s=!0});const a=Lb(`${y}${e}${f}`,c,Rb,r);if(!s)return`>${v}\n${c}${a}`}return`|${v}\n${c}${y}${n=n.replace(/\n+/g,`$&${c}`)}${f}`}function Kb(e,t,n,i){const{implicitKey:s,inFlow:r}=t,o="string"==typeof e.value?e:Object.assign({},e,{value:String(e.value)});let{type:a}=e;a!==Nb.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Nb.QUOTE_DOUBLE);const l=e=>{switch(e){case Nb.BLOCK_FOLDED:case Nb.BLOCK_LITERAL:return s||r?Vb(o.value,t):qb(o,t,n,i);case Nb.QUOTE_DOUBLE:return Wb(o.value,t);case Nb.QUOTE_SINGLE:return Ub(o.value,t);case Nb.PLAIN:return function(e,t,n,i){const{type:s,value:r}=e,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:h}=t;if(a&&r.includes("\n")||h&&/[[\]{},]/.test(r))return Vb(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||h||!r.includes("\n")?Vb(r,t):qb(e,t,n,i);if(!a&&!h&&s!==Nb.PLAIN&&r.includes("\n"))return qb(e,t,n,i);if(jb(r)){if(""===l)return t.forceBlockIndent=!0,qb(e,t,n,i);if(a&&l===c)return Vb(r,t)}const u=r.replace(/\n+/g,`$&\n${l}`);if(o){const e=e=>e.default&&"tag:yaml.org,2002:str"!==e.tag&&e.test?.test(u),{compat:n,tags:i}=t.doc.schema;if(i.some(e)||n?.some(e))return Vb(r,t)}return a?u:Lb(u,l,Pb,Fb(t,!1))}(o,t,n,i);default:return null}};let c=l(a);if(null===c){const{defaultKeyType:e,defaultStringType:n}=t.options,i=s&&e||n;if(c=l(i),null===c)throw new Error(`Unsupported default string type ${i}`)}return c}function Jb(e,t){const n=Object.assign({blockQuote:!0,commentString:_b,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},e.schema.toStringOptions,t);let i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:"number"==typeof n.indent?" ".repeat(n.indent):" ",inFlow:i,options:n}}function Zb(e,t,n,i){if(sb(e))return e.toString(t,n,i);if(tb(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let s;const r=lb(e)?e:t.doc.createNode(e,{onTagObj:e=>s=e});s??(s=function(e,t){if(t.tag){const n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,i;if(rb(t)){i=t.value;let s=e.filter(e=>e.identify?.(i));if(s.length>1){const e=s.filter(e=>e.test);e.length>0&&(s=e)}n=s.find(e=>e.format===t.format)??s.find(e=>!e.format)}else i=t,n=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!n)throw new Error(`Tag not resolved for ${i?.constructor?.name??(null===i?"null":typeof i)} value`);return n}(t.doc.schema.tags,r));const o=function(e,t,{anchors:n,doc:i}){if(!i.directives)return"";const s=[],r=(rb(e)||ab(e))&&e.anchor;r&&yb(r)&&(n.add(r),s.push(`&${r}`));const o=e.tag??(t.default?null:t.tag);return o&&s.push(i.directives.tagString(o)),s.join(" ")}(r,s,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);const a="function"==typeof s.stringify?s.stringify(r,t,n,i):rb(r)?Kb(r,t,n,i):r.toString(t,n,i);return o?rb(r)||"{"===a[0]||"["===a[0]?`${o} ${a}`:`${o}\n${t.indent}${a}`:a}const Yb="<<",Gb={identify:e=>e===Yb||"symbol"==typeof e&&e.description===Yb,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Nb(Symbol(Yb)),{addToJSMap:Qb}),stringify:()=>Yb};function Qb(e,t,n){if(n=e&&tb(n)?n.resolve(e.doc):n,ob(n))for(const i of n.items)Xb(e,t,i);else if(Array.isArray(n))for(const i of n)Xb(e,t,i);else Xb(e,t,n)}function Xb(e,t,n){const i=e&&tb(n)?n.resolve(e.doc):n;if(!ib(i))throw new Error("Merge sources must be maps or map aliases");const s=i.toJSON(null,e,Map);for(const[e,n]of s)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function ey(e,t,{key:n,value:i}){if(lb(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(((e,t)=>(Gb.identify(t)||rb(t)&&(!t.type||t.type===Nb.PLAIN)&&Gb.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Gb.tag&&e.default))(e,n))Qb(e,t,i);else{const s=xb(n,"",e);if(t instanceof Map)t.set(s,xb(i,s,e));else if(t instanceof Set)t.add(s);else{const r=function(e,t,n){if(null===t)return"";if("object"!=typeof t)return String(t);if(lb(e)&&n?.doc){const t=Jb(n.doc,{});t.anchors=new Set;for(const e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;const r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+'..."'),i=n.doc.options.logLevel,s=`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`,"debug"!==i&&"warn"!==i||console.warn(s),n.mapKeyWarned=!0}return r}var i,s;return JSON.stringify(t)}(n,s,e),o=xb(i,r,e);r in t?Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[r]=o}}return t}function ty(e,t,n){const i=Ob(e,void 0,n),s=Ob(t,void 0,n);return new ny(i,s)}class ny{constructor(e,t=null){Object.defineProperty(this,eb,{value:Gg}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return lb(t)&&(t=t.clone(e)),lb(n)&&(n=n.clone(e)),new ny(t,n)}toJSON(e,t){return ey(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?function({key:e,value:t},n,i,s){const{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:h,simpleKeys:u}}=n;let d=lb(e)&&e.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ab(e)||!lb(e)&&"object"==typeof e)throw new Error("With simple keys, collection cannot be used as a key value")}let f=!u&&(!e||d&&null==t&&!n.inFlow||ab(e)||(rb(e)?e.type===Nb.BLOCK_FOLDED||e.type===Nb.BLOCK_LITERAL:"object"==typeof e));n=Object.assign({},n,{allNullValues:!1,implicitKey:!f&&(u||!r),indent:a+l});let p,m,g,b=!1,y=!1,v=Zb(e,n,()=>b=!0,()=>y=!0);if(!f&&!n.inFlow&&v.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");f=!0}if(n.inFlow){if(r||null==t)return b&&i&&i(),""===v?"?":f?`? ${v}`:v}else if(r&&!u||null==t&&f)return v=`? ${v}`,d&&!b?v+=Bb(v,n.indent,c(d)):y&&s&&s(),v;b&&(d=null),f?(d&&(v+=Bb(v,n.indent,c(d))),v=`? ${v}\n${a}:`):(v=`${v}:`,d&&(v+=Bb(v,n.indent,c(d)))),lb(t)?(p=!!t.spaceBefore,m=t.commentBefore,g=t.comment):(p=!1,m=null,g=null,t&&"object"==typeof t&&(t=o.createNode(t))),n.implicitKey=!1,f||d||!rb(t)||(n.indentAtStart=v.length+1),y=!1,h||!(l.length>=2)||n.inFlow||f||!ob(t)||t.flow||t.tag||t.anchor||(n.indent=n.indent.substring(2));let k=!1;const w=Zb(t,n,()=>k=!0,()=>y=!0);let x=" ";if(d||p||m)x=p?"\n":"",m&&(x+=`\n${Ib(c(m),n.indent)}`),""!==w||n.inFlow?x+=`\n${n.indent}`:"\n"===x&&g&&(x="\n\n");else if(!f&&ab(t)){const e=w[0],i=w.indexOf("\n"),s=-1!==i,r=n.inFlow??t.flow??0===t.items.length;if(s||!r){let t=!1;if(s&&("&"===e||"!"===e)){let n=w.indexOf(" ");"&"===e&&-1!==n&&n<i&&"!"===w[n+1]&&(n=w.indexOf(" ",n+1)),(-1===n||i<n)&&(t=!0)}t||(x=`\n${n.indent}`)}}else""!==w&&"\n"!==w[0]||(x="");return v+=x+w,n.inFlow?k&&i&&i():g&&!k?v+=Bb(v,n.indent,c(g)):y&&s&&s(),v}(this,e,t,n):JSON.stringify(this)}}function iy(e,t,n){return(t.inFlow??e.flow?ry:sy)(e,t,n)}function sy({comment:e,items:t},n,{blockItemPrefix:i,flowChars:s,itemIndent:r,onChompKeep:o,onComment:a}){const{indent:l,options:{commentString:c}}=n,h=Object.assign({},n,{indent:r,type:null});let u=!1;const d=[];for(let e=0;e<t.length;++e){const s=t[e];let o=null;if(lb(s))!u&&s.spaceBefore&&d.push(""),oy(n,d,s.commentBefore,u),s.comment&&(o=s.comment);else if(sb(s)){const e=lb(s.key)?s.key:null;e&&(!u&&e.spaceBefore&&d.push(""),oy(n,d,e.commentBefore,u))}u=!1;let a=Zb(s,h,()=>o=null,()=>u=!0);o&&(a+=Bb(a,r,c(o))),u&&o&&(u=!1),d.push(i+a)}let f;if(0===d.length)f=s.start+s.end;else{f=d[0];for(let e=1;e<d.length;++e){const t=d[e];f+=t?`\n${l}${t}`:"\n"}}return e?(f+="\n"+Ib(c(e),l),a&&a()):u&&o&&o(),f}function ry({items:e},t,{flowChars:n,itemIndent:i}){const{indent:s,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=t;i+=r;const l=Object.assign({},t,{indent:i,inFlow:!0,type:null});let c=!1,h=0;const u=[];for(let n=0;n<e.length;++n){const s=e[n];let r=null;if(lb(s))s.spaceBefore&&u.push(""),oy(t,u,s.commentBefore,!1),s.comment&&(r=s.comment);else if(sb(s)){const e=lb(s.key)?s.key:null;e&&(e.spaceBefore&&u.push(""),oy(t,u,e.commentBefore,!1),e.comment&&(c=!0));const n=lb(s.value)?s.value:null;n?(n.comment&&(r=n.comment),n.commentBefore&&(c=!0)):null==s.value&&e?.comment&&(r=e.comment)}r&&(c=!0);let o=Zb(s,l,()=>r=null);c||(c=u.length>h||o.includes("\n")),n<e.length-1?o+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=u.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth)),c&&(o+=",")),r&&(o+=Bb(o,i,a(r))),u.push(o),h=u.length}const{start:d,end:f}=n;if(0===u.length)return d+f;if(!c){const e=u.reduce((e,t)=>e+t.length+2,2);c=t.options.lineWidth>0&&e>t.options.lineWidth}if(c){let e=d;for(const t of u)e+=t?`\n${r}${s}${t}`:"\n";return`${e}\n${s}${f}`}return`${d}${o}${u.join(" ")}${o}${f}`}function oy({indent:e,options:{commentString:t}},n,i,s){if(i&&s&&(i=i.replace(/^\n+/,"")),i){const s=Ib(t(i),e);n.push(s.trimStart())}}function ay(e,t){const n=rb(t)?t.value:t;for(const i of e)if(sb(i)){if(i.key===t||i.key===n)return i;if(rb(i.key)&&i.key.value===n)return i}}class ly extends Db{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Yg,e),this.items=[]}static from(e,t,n){const{keepUndefined:i,replacer:s}=n,r=new this(e),o=(e,o)=>{if("function"==typeof s)o=s.call(t,e,o);else if(Array.isArray(s)&&!s.includes(e))return;(void 0!==o||i)&&r.items.push(ty(e,o,n))};if(t instanceof Map)for(const[e,n]of t)o(e,n);else if(t&&"object"==typeof t)for(const e of Object.keys(t))o(e,t[e]);return"function"==typeof e.sortMapEntries&&r.items.sort(e.sortMapEntries),r}add(e,t){let n;n=sb(e)?e:e&&"object"==typeof e&&"key"in e?new ny(e.key,e.value):new ny(e,e?.value);const i=ay(this.items,n.key),s=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);rb(i.value)&&Tb(n.value)?i.value.value=n.value:i.value=n.value}else if(s){const e=this.items.findIndex(e=>s(n,e)<0);-1===e?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){const t=ay(this.items,e);if(!t)return!1;return this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){const n=ay(this.items,e),i=n?.value;return(!t&&rb(i)?i.value:i)??void 0}has(e){return!!ay(this.items,e)}set(e,t){this.add(new ny(e,t),!0)}toJSON(e,t,n){const i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(const e of this.items)ey(t,i,e);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(const e of this.items)if(!sb(e))throw new Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),iy(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}const cy={collection:"map",default:!0,nodeClass:ly,tag:"tag:yaml.org,2002:map",resolve:(e,t)=>(ib(e)||t("Expected a mapping for this tag"),e),createNode:(e,t,n)=>ly.from(e,t,n)};class hy extends Db{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Xg,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=uy(e);if("number"!=typeof t)return!1;return this.items.splice(t,1).length>0}get(e,t){const n=uy(e);if("number"!=typeof n)return;const i=this.items[n];return!t&&rb(i)?i.value:i}has(e){const t=uy(e);return"number"==typeof t&&t<this.items.length}set(e,t){const n=uy(e);if("number"!=typeof n)throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[n];rb(i)&&Tb(t)?i.value=t:this.items[n]=t}toJSON(e,t){const n=[];t?.onCreate&&t.onCreate(n);let i=0;for(const e of this.items)n.push(xb(e,String(i++),t));return n}toString(e,t,n){return e?iy(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,s=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let r of t){if("function"==typeof i){const n=t instanceof Set?r:String(e++);r=i.call(t,n,r)}s.items.push(Ob(r,void 0,n))}}return s}}function uy(e){let t=rb(e)?e.value:e;return t&&"string"==typeof t&&(t=Number(t)),"number"==typeof t&&Number.isInteger(t)&&t>=0?t:null}const dy={collection:"seq",default:!0,nodeClass:hy,tag:"tag:yaml.org,2002:seq",resolve:(e,t)=>(ob(e)||t("Expected a sequence for this tag"),e),createNode:(e,t,n)=>hy.from(e,t,n)},fy={identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:(e,t,n,i)=>Kb(e,t=Object.assign({actualString:!0},t),n,i)},py={identify:e=>null==e,createNode:()=>new Nb(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Nb(null),stringify:({source:e},t)=>"string"==typeof e&&py.test.test(e)?e:t.options.nullStr},my={identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Nb("t"===e[0]||"T"===e[0]),stringify({source:e,value:t},n){if(e&&my.test.test(e)){if(t===("t"===e[0]||"T"===e[0]))return e}return t?n.options.trueStr:n.options.falseStr}};function gy({format:e,minFractionDigits:t,tag:n,value:i}){if("bigint"==typeof i)return String(i);const s="number"==typeof i?i:Number(i);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let r=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!n||"tag:yaml.org,2002:float"===n)&&/^\d/.test(r)){let e=r.indexOf(".");e<0&&(e=r.length,r+=".");let n=t-(r.length-e-1);for(;n-- >0;)r+="0"}return r}const by={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:gy},yy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():gy(e)}},vy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Nb(parseFloat(e)),n=e.indexOf(".");return-1!==n&&"0"===e[e.length-1]&&(t.minFractionDigits=e.length-n-1),t},stringify:gy},ky=e=>"bigint"==typeof e||Number.isInteger(e),wy=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function xy(e,t,n){const{value:i}=e;return ky(i)&&i>=0?n+i.toString(t):gy(e)}const Sy={identify:e=>ky(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>wy(e,2,8,n),stringify:e=>xy(e,8,"0o")},Cy={identify:ky,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>wy(e,0,10,n),stringify:gy},Ay={identify:e=>ky(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>wy(e,2,16,n),stringify:e=>xy(e,16,"0x")},Ty=[cy,dy,fy,py,my,Sy,Cy,Ay,by,yy,vy];function Ny(e){return"bigint"==typeof e||Number.isInteger(e)}const Oy=({value:e})=>JSON.stringify(e),My=[cy,dy].concat([{identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Oy},{identify:e=>null==e,createNode:()=>new Nb(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Oy},{identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>"true"===e,stringify:Oy},{identify:Ny,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Ny(e)?e.toString():JSON.stringify(e)},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Oy}],{default:!0,tag:"",test:/^/,resolve:(e,t)=>(t(`Unresolved plain scalar ${JSON.stringify(e)}`),e)}),Ey={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if("function"==typeof atob){const t=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},i,s,r){if(!n)return"";const o=n;let a;if("function"!=typeof btoa)throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");{let e="";for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);a=btoa(e)}if(t??(t=Nb.BLOCK_LITERAL),t!==Nb.QUOTE_DOUBLE){const e=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),n=Math.ceil(a.length/e),s=new Array(n);for(let t=0,i=0;t<n;++t,i+=e)s[t]=a.substr(i,e);a=s.join(t===Nb.BLOCK_LITERAL?"\n":" ")}return Kb({comment:e,type:t,value:a},i,s,r)}};function Dy(e,t){if(ob(e))for(let n=0;n<e.items.length;++n){let i=e.items[n];if(!sb(i)){if(ib(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");const e=i.items[0]||new ny(new Nb(null));if(i.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${i.commentBefore}\n${e.key.commentBefore}`:i.commentBefore),i.comment){const t=e.value??e.key;t.comment=t.comment?`${i.comment}\n${t.comment}`:i.comment}i=e}e.items[n]=sb(i)?i:new ny(i)}}else t("Expected a sequence for this tag");return e}function _y(e,t,n){const{replacer:i}=n,s=new hy(e);s.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let e of t){let o,a;if("function"==typeof i&&(e=i.call(t,String(r++),e)),Array.isArray(e)){if(2!==e.length)throw new TypeError(`Expected [key, value] tuple: ${e}`);o=e[0],a=e[1]}else if(e&&e instanceof Object){const t=Object.keys(e);if(1!==t.length)throw new TypeError(`Expected tuple with one key, not ${t.length} keys`);o=t[0],a=e[o]}else o=e;s.items.push(ty(o,a,n))}return s}const Iy={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Dy,createNode:_y};class By extends hy{constructor(){super(),this.add=ly.prototype.add.bind(this),this.delete=ly.prototype.delete.bind(this),this.get=ly.prototype.get.bind(this),this.has=ly.prototype.has.bind(this),this.set=ly.prototype.set.bind(this),this.tag=By.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t?.onCreate&&t.onCreate(n);for(const e of this.items){let i,s;if(sb(e)?(i=xb(e.key,"",t),s=xb(e.value,i,t)):i=xb(e,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,s)}return n}static from(e,t,n){const i=_y(e,t,n),s=new this;return s.items=i.items,s}}By.tag="tag:yaml.org,2002:omap";const Py={collection:"seq",identify:e=>e instanceof Map,nodeClass:By,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=Dy(e,t),i=[];for(const{key:e}of n.items)rb(e)&&(i.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new By,n)},createNode:(e,t,n)=>By.from(e,t,n)};function Ry({value:e,source:t},n){return t&&(e?$y:Ly).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const $y={identify:e=>!0===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Nb(!0),stringify:Ry},Ly={identify:e=>!1===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Nb(!1),stringify:Ry},zy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:gy},Fy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():gy(e)}},jy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Nb(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(-1!==n){const i=e.substring(n+1).replace(/_/g,"");"0"===i[i.length-1]&&(t.minFractionDigits=i.length)}return t},stringify:gy},Wy=e=>"bigint"==typeof e||Number.isInteger(e);function Uy(e,t,n,{intAsBigInt:i}){const s=e[0];if("-"!==s&&"+"!==s||(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}const t=BigInt(e);return"-"===s?BigInt(-1)*t:t}const r=parseInt(e,n);return"-"===s?-1*r:r}function Vy(e,t,n){const{value:i}=e;if(Wy(i)){const e=i.toString(t);return i<0?"-"+n+e.substr(1):n+e}return gy(e)}const Hy={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Uy(e,2,2,n),stringify:e=>Vy(e,2,"0b")},qy={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Uy(e,1,8,n),stringify:e=>Vy(e,8,"0")},Ky={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Uy(e,0,10,n),stringify:gy},Jy={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Uy(e,2,16,n),stringify:e=>Vy(e,16,"0x")};class Zy extends ly{constructor(e){super(e),this.tag=Zy.tag}add(e){let t;t=sb(e)?e:e&&"object"==typeof e&&"key"in e&&"value"in e&&null===e.value?new ny(e.key,null):new ny(e,null);ay(this.items,t.key)||this.items.push(t)}get(e,t){const n=ay(this.items,e);return!t&&sb(n)?rb(n.key)?n.key.value:n.key:n}set(e,t){if("boolean"!=typeof t)throw new Error("Expected boolean value for set(key, value) in a YAML set, not "+typeof t);const n=ay(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new ny(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,s=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)"function"==typeof i&&(e=i.call(t,e,e)),s.items.push(ty(e,null,n));return s}}Zy.tag="tag:yaml.org,2002:set";const Yy={collection:"map",identify:e=>e instanceof Set,nodeClass:Zy,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Zy.from(e,t,n),resolve(e,t){if(ib(e)){if(e.hasAllNullValues(!0))return Object.assign(new Zy,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function Gy(e,t){const n=e[0],i="-"===n||"+"===n?e.substring(1):e,s=e=>t?BigInt(e):Number(e),r=i.replace(/_/g,"").split(":").reduce((e,t)=>e*s(60)+s(t),s(0));return"-"===n?s(-1)*r:r}function Qy(e){let{value:t}=e,n=e=>e;if("bigint"==typeof t)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return gy(e);let i="";t<0&&(i="-",t*=n(-1));const s=n(60),r=[t%s];return t<60?r.unshift(0):(t=(t-r[0])/s,r.unshift(t%s),t>=60&&(t=(t-r[0])/s,r.unshift(t))),i+r.map(e=>String(e).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const Xy={identify:e=>"bigint"==typeof e||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Gy(e,n),stringify:Qy},ev={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Gy(e,!1),stringify:Qy},tv={identify:e=>e 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(e){const t=e.match(tv.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,i,s,r,o,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0;let c=Date.UTC(n,i-1,s,r||0,o||0,a||0,l);const h=t[8];if(h&&"Z"!==h){let e=Gy(h,!1);Math.abs(e)<30&&(e*=60),c-=6e4*e}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},nv=[cy,dy,fy,py,$y,Ly,Hy,qy,Ky,Jy,zy,Fy,jy,Ey,Gb,Py,Iy,Yy,Xy,ev,tv],iv=new Map([["core",Ty],["failsafe",[cy,dy,fy]],["json",My],["yaml11",nv],["yaml-1.1",nv]]),sv={binary:Ey,bool:my,float:vy,floatExp:yy,floatNaN:by,floatTime:ev,int:Cy,intHex:Ay,intOct:Sy,intTime:Xy,map:cy,merge:Gb,null:py,omap:Py,pairs:Iy,seq:dy,set:Yy,timestamp:tv},rv={"tag:yaml.org,2002:binary":Ey,"tag:yaml.org,2002:merge":Gb,"tag:yaml.org,2002:omap":Py,"tag:yaml.org,2002:pairs":Iy,"tag:yaml.org,2002:set":Yy,"tag:yaml.org,2002:timestamp":tv};function ov(e,t,n){const i=iv.get(t);if(i&&!e)return n&&!i.includes(Gb)?i.concat(Gb):i.slice();let s=i;if(!s){if(!Array.isArray(e)){const e=Array.from(iv.keys()).filter(e=>"yaml11"!==e).map(e=>JSON.stringify(e)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}s=[]}if(Array.isArray(e))for(const t of e)s=s.concat(t);else"function"==typeof e&&(s=e(s.slice()));return n&&(s=s.concat(Gb)),s.reduce((e,t)=>{const n="string"==typeof t?sv[t]:t;if(!n){const e=JSON.stringify(t),n=Object.keys(sv).map(e=>JSON.stringify(e)).join(", ");throw new Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}const av=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class lv{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:s,sortMapEntries:r,toStringDefaults:o}){this.compat=Array.isArray(e)?ov(e,"compat"):e?ov(null,e):null,this.name="string"==typeof s&&s||"core",this.knownTags=i?rv:{},this.tags=ov(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,Yg,{value:cy}),Object.defineProperty(this,Qg,{value:fy}),Object.defineProperty(this,Xg,{value:dy}),this.sortMapEntries="function"==typeof r?r:!0===r?av:null}clone(){const e=Object.create(lv.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}let cv=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,eb,{value:Zg});let i=null;"function"==typeof t||Array.isArray(t)?i=t:void 0===n&&t&&(n=t,t=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:r}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(r=this.directives.yaml.version)):this.directives=new bb({version:r}),this.setSchema(r,n),this.contents=void 0===e?null:this.createNode(e,i,n)}clone(){const t=Object.create(e.prototype,{[eb]:{value:Zg}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=lb(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){hv(this.contents)&&this.contents.add(e)}addIn(e,t){hv(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=vb(this);e.anchor=!t||n.has(t)?kb(t||"a",n):t}return new Cb(e.anchor)}createNode(e,t,n){let i;if("function"==typeof t)e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){const e=e=>"number"==typeof e||e instanceof String||e instanceof Number,n=t.filter(e).map(String);n.length>0&&(t=t.concat(n)),i=t}else void 0===n&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:s,anchorPrefix:r,flow:o,keepUndefined:a,onTagObj:l,tag:c}=n??{},{onAnchor:h,setAnchors:u,sourceObjects:d}=function(e,t){const n=[],i=new Map;let s=null;return{onAnchor:i=>{n.push(i),s??(s=vb(e));const r=kb(t,s);return s.add(r),r},setAnchors:()=>{for(const e of n){const t=i.get(e);if("object"!=typeof t||!t.anchor||!rb(t.node)&&!ab(t.node)){const t=new Error("Failed to resolve repeated object (this should not happen)");throw t.source=e,t}t.node.anchor=t.anchor}},sourceObjects:i}}(this,r||"a"),f=Ob(e,c,{aliasDuplicateObjects:s??!0,keepUndefined:a??!1,onAnchor:h,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:d});return o&&ab(f)&&(f.flow=!0),u(),f}createPair(e,t,n={}){const i=this.createNode(e,null,n),s=this.createNode(t,null,n);return new ny(i,s)}delete(e){return!!hv(this.contents)&&this.contents.delete(e)}deleteIn(e){return Eb(e)?null!=this.contents&&(this.contents=null,!0):!!hv(this.contents)&&this.contents.deleteIn(e)}get(e,t){return ab(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Eb(e)?!t&&rb(this.contents)?this.contents.value:this.contents:ab(this.contents)?this.contents.getIn(e,t):void 0}has(e){return!!ab(this.contents)&&this.contents.has(e)}hasIn(e){return Eb(e)?void 0!==this.contents:!!ab(this.contents)&&this.contents.hasIn(e)}set(e,t){null==this.contents?this.contents=Mb(this.schema,[e],t):hv(this.contents)&&this.contents.set(e,t)}setIn(e,t){Eb(e)?this.contents=t:null==this.contents?this.contents=Mb(this.schema,Array.from(e),t):hv(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){let n;switch("number"==typeof e&&(e=String(e)),e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new bb({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 bb({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const t=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else{if(!n)throw new Error("With a null YAML version, the { schema: Schema } option is required");this.schema=new lv(Object.assign(n,t))}}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:s,reviver:r}={}){const o={anchors:new Map,doc:this,keep:!e,mapAsMap:!0===n,mapKeyWarned:!1,maxAliasCount:"number"==typeof i?i:100},a=xb(this.contents,t??"",o);if("function"==typeof s)for(const{count:e,res:t}of o.anchors.values())s(t,e);return"function"==typeof r?wb(r,{"":a},"",a):a}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 function(e,t){const n=[];let i=!0===t.directives;if(!1!==t.directives&&e.directives){const t=e.directives.toString(e);t?(n.push(t),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");const s=Jb(e,t),{commentString:r}=s.options;if(e.commentBefore){1!==n.length&&n.unshift("");const t=r(e.commentBefore);n.unshift(Ib(t,""))}let o=!1,a=null;if(e.contents){if(lb(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){const t=r(e.contents.commentBefore);n.push(Ib(t,""))}s.forceBlockIndent=!!e.comment,a=e.contents.comment}const t=a?void 0:()=>o=!0;let l=Zb(e.contents,s,()=>a=null,t);a&&(l+=Bb(l,"",r(a))),"|"!==l[0]&&">"!==l[0]||"---"!==n[n.length-1]?n.push(l):n[n.length-1]=`--- ${l}`}else n.push(Zb(e.contents,s));if(e.directives?.docEnd)if(e.comment){const t=r(e.comment);t.includes("\n")?(n.push("..."),n.push(Ib(t,""))):n.push(`... ${t}`)}else n.push("...");else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,"")),t&&(o&&!a||""===n[n.length-1]||n.push(""),n.push(Ib(r(t),"")))}return n.join("\n")+"\n"}(this,e)}};function hv(e){if(ab(e))return!0;throw new Error("Expected a YAML collection as document contents")}class uv extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}}class dv extends uv{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class fv extends uv{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const pv=(e,t)=>n=>{if(-1===n.pos[0])return;n.linePos=n.pos.map(e=>t.linePos(e));const{line:i,col:s}=n.linePos[0];n.message+=` at line ${i}, column ${s}`;let r=s-1,o=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){const e=Math.min(r-39,o.length-79);o="…"+o.substring(e),r-=e-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,r))){let n=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);n.length>80&&(n=n.substring(0,79)+"…\n"),o=n+o}if(/[^ ]/.test(o)){let e=1;const t=n.linePos[1];t?.line===i&&t.col>s&&(e=Math.max(1,Math.min(t.col-s,80-r)));const a=" ".repeat(r)+"^".repeat(e);n.message+=`:\n\n${o}\n${a}\n`}};function mv(e,{flow:t,indicator:n,next:i,offset:s,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,h=a,u="",d="",f=!1,p=!1,m=null,g=null,b=null,y=null,v=null,k=null,w=null;for(const s of e)switch(p&&("space"!==s.type&&"newline"!==s.type&&"comma"!==s.type&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p=!1),m&&(c&&"comment"!==s.type&&"newline"!==s.type&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),s.type){case"space":t||"doc-start"===n&&"flow-collection"===i?.type||!s.source.includes("\t")||(m=s),h=!0;break;case"comment":{h||r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const e=s.source.substring(1)||" ";u?u+=d+e:u=e,d="",c=!1;break}case"newline":c?u?u+=s.source:k&&"seq-item-ind"===n||(l=!0):d+=s.source,c=!0,f=!0,(g||b)&&(y=s),h=!0;break;case"anchor":g&&r(s,"MULTIPLE_ANCHORS","A node can have at most one anchor"),s.source.endsWith(":")&&r(s.offset+s.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=s,w??(w=s.offset),c=!1,h=!1,p=!0;break;case"tag":b&&r(s,"MULTIPLE_TAGS","A node can have at most one tag"),b=s,w??(w=s.offset),c=!1,h=!1,p=!0;break;case n:(g||b)&&r(s,"BAD_PROP_ORDER",`Anchors and tags must be after the ${s.source} indicator`),k&&r(s,"UNEXPECTED_TOKEN",`Unexpected ${s.source} in ${t??"collection"}`),k=s,c="seq-item-ind"===n||"explicit-key-ind"===n,h=!1;break;case"comma":if(t){v&&r(s,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),v=s,c=!1,h=!1;break}default:r(s,"UNEXPECTED_TOKEN",`Unexpected ${s.type} token`),c=!1,h=!1}const x=e[e.length-1],S=x?x.offset+x.source.length:s;return p&&i&&"space"!==i.type&&"newline"!==i.type&&"comma"!==i.type&&("scalar"!==i.type||""!==i.source)&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.indent<=o||"block-map"===i?.type||"block-seq"===i?.type)&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:v,found:k,spaceBefore:l,comment:u,hasNewline:f,anchor:g,tag:b,newlineAfterProp:y,end:S,start:w??S}}function gv(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes("\n"))return!0;if(e.end)for(const t of e.end)if("newline"===t.type)return!0;return!1;case"flow-collection":for(const t of e.items){for(const e of t.start)if("newline"===e.type)return!0;if(t.sep)for(const e of t.sep)if("newline"===e.type)return!0;if(gv(t.key)||gv(t.value))return!0}return!1;default:return!0}}function bv(e,t,n){if("flow-collection"===t?.type){const i=t.end[0];if(i.indent===e&&("]"===i.source||"}"===i.source)&&gv(t)){n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}}function yv(e,t,n){const{uniqueKeys:i}=e.options;if(!1===i)return!1;const s="function"==typeof i?i:(e,t)=>e===t||rb(e)&&rb(t)&&e.value===t.value;return t.some(e=>s(e.key,n))}const vv="All mapping items must start at the same column";function kv(e,t,n,i){let s="";if(e){let r=!1,o="";for(const a of e){const{source:e,type:l}=a;switch(l){case"space":r=!0;break;case"comment":{n&&!r&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const t=e.substring(1)||" ";s?s+=o+t:s=t,o="";break}case"newline":s&&(o+=e),r=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=e.length}}return{comment:s,offset:t}}const wv="Block collections are not allowed within flow collections",xv=e=>e&&("block-map"===e.type||"block-seq"===e.type);function Sv(e,t,n,i,s,r){const o="block-map"===n.type?function({composeNode:e,composeEmptyNode:t},n,i,s,r){const o=new(r?.nodeClass??ly)(n.schema);n.atRoot&&(n.atRoot=!1);let a=i.offset,l=null;for(const r of i.items){const{start:c,key:h,sep:u,value:d}=r,f=mv(c,{indicator:"explicit-key-ind",next:h??u?.[0],offset:a,onError:s,parentIndent:i.indent,startOnNewline:!0}),p=!f.found;if(p){if(h&&("block-seq"===h.type?s(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==i.indent&&s(a,"BAD_INDENT",vv)),!f.anchor&&!f.tag&&!u){l=f.end,f.comment&&(o.comment?o.comment+="\n"+f.comment:o.comment=f.comment);continue}(f.newlineAfterProp||gv(h))&&s(h??c[c.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else f.found?.indent!==i.indent&&s(a,"BAD_INDENT",vv);n.atKey=!0;const m=f.end,g=h?e(n,h,f,s):t(n,m,c,null,f,s);n.schema.compat&&bv(i.indent,h,s),n.atKey=!1,yv(n,o.items,g)&&s(m,"DUPLICATE_KEY","Map keys must be unique");const b=mv(u??[],{indicator:"map-value-ind",next:d,offset:g.range[2],onError:s,parentIndent:i.indent,startOnNewline:!h||"block-scalar"===h.type});if(a=b.end,b.found){p&&("block-map"!==d?.type||b.hasNewline||s(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&f.start<b.found.offset-1024&&s(g.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const l=d?e(n,d,b,s):t(n,a,u,null,b,s);n.schema.compat&&bv(i.indent,d,s),a=l.range[2];const c=new ny(g,l);n.options.keepSourceTokens&&(c.srcToken=r),o.items.push(c)}else{p&&s(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(g.comment?g.comment+="\n"+b.comment:g.comment=b.comment);const e=new ny(g);n.options.keepSourceTokens&&(e.srcToken=r),o.items.push(e)}}return l&&l<a&&s(l,"IMPOSSIBLE","Map comment with trailing content"),o.range=[i.offset,a,l??a],o}(e,t,n,i,r):"block-seq"===n.type?function({composeNode:e,composeEmptyNode:t},n,i,s,r){const o=new(r?.nodeClass??hy)(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let a=i.offset,l=null;for(const{start:r,value:c}of i.items){const h=mv(r,{indicator:"seq-item-ind",next:c,offset:a,onError:s,parentIndent:i.indent,startOnNewline:!0});if(!h.found){if(!(h.anchor||h.tag||c)){l=h.end,h.comment&&(o.comment=h.comment);continue}"block-seq"===c?.type?s(h.end,"BAD_INDENT","All sequence items must start at the same column"):s(a,"MISSING_CHAR","Sequence item without - indicator")}const u=c?e(n,c,h,s):t(n,h.end,r,null,h,s);n.schema.compat&&bv(i.indent,c,s),a=u.range[2],o.items.push(u)}return o.range=[i.offset,a,l??a],o}(e,t,n,i,r):function({composeNode:e,composeEmptyNode:t},n,i,s,r){const o="{"===i.start.source,a=o?"flow map":"flow sequence",l=new(r?.nodeClass??(o?ly:hy))(n.schema);l.flow=!0;const c=n.atRoot;c&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let h=i.offset+i.start.source.length;for(let r=0;r<i.items.length;++r){const c=i.items[r],{start:u,key:d,sep:f,value:p}=c,m=mv(u,{flow:a,indicator:"explicit-key-ind",next:d??f?.[0],offset:h,onError:s,parentIndent:i.indent,startOnNewline:!1});if(!m.found){if(!(m.anchor||m.tag||f||p)){0===r&&m.comma?s(m.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):r<i.items.length-1&&s(m.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),m.comment&&(l.comment?l.comment+="\n"+m.comment:l.comment=m.comment),h=m.end;continue}!o&&n.options.strict&&gv(d)&&s(d,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(0===r)m.comma&&s(m.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(m.comma||s(m.start,"MISSING_CHAR",`Missing , between ${a} items`),m.comment){let e="";e:for(const t of u)switch(t.type){case"comma":case"space":break;case"comment":e=t.source.substring(1);break e;default:break e}if(e){let t=l.items[l.items.length-1];sb(t)&&(t=t.value??t.key),t.comment?t.comment+="\n"+e:t.comment=e,m.comment=m.comment.substring(e.length+1)}}if(o||f||m.found){n.atKey=!0;const r=m.end,g=d?e(n,d,m,s):t(n,r,u,null,m,s);xv(d)&&s(g.range,"BLOCK_IN_FLOW",wv),n.atKey=!1;const b=mv(f??[],{flow:a,indicator:"map-value-ind",next:p,offset:g.range[2],onError:s,parentIndent:i.indent,startOnNewline:!1});if(b.found){if(!o&&!m.found&&n.options.strict){if(f)for(const e of f){if(e===b.found)break;if("newline"===e.type){s(e,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}m.start<b.found.offset-1024&&s(b.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else p&&("source"in p&&":"===p.source?.[0]?s(p,"MISSING_CHAR",`Missing space after : in ${a}`):s(b.start,"MISSING_CHAR",`Missing , or : between ${a} items`));const y=p?e(n,p,b,s):b.found?t(n,b.end,f,null,b,s):null;y?xv(p)&&s(y.range,"BLOCK_IN_FLOW",wv):b.comment&&(g.comment?g.comment+="\n"+b.comment:g.comment=b.comment);const v=new ny(g,y);if(n.options.keepSourceTokens&&(v.srcToken=c),o){const e=l;yv(n,e.items,g)&&s(r,"DUPLICATE_KEY","Map keys must be unique"),e.items.push(v)}else{const e=new ly(n.schema);e.flow=!0,e.items.push(v);const t=(y??g).range;e.range=[g.range[0],t[1],t[2]],l.items.push(e)}h=y?y.range[2]:b.end}else{const i=p?e(n,p,m,s):t(n,m.end,f,null,m,s);l.items.push(i),h=i.range[2],xv(p)&&s(i.range,"BLOCK_IN_FLOW",wv)}}const u=o?"}":"]",[d,...f]=i.end;let p=h;if(d?.source===u)p=d.offset+d.source.length;else{const e=a[0].toUpperCase()+a.substring(1);s(h,c?"MISSING_CHAR":"BAD_INDENT",c?`${e} must end with a ${u}`:`${e} in block collection must be sufficiently indented and end with a ${u}`),d&&1!==d.source.length&&f.unshift(d)}if(f.length>0){const e=kv(f,p,n.options.strict,s);e.comment&&(l.comment?l.comment+="\n"+e.comment:l.comment=e.comment),l.range=[i.offset,p,e.offset]}else l.range=[i.offset,p,p];return l}(e,t,n,i,r),a=o.constructor;return"!"===s||s===a.tagName?(o.tag=a.tagName,o):(s&&(o.tag=s),o)}function Cv(e,t,n){const i=t.offset,s=function({offset:e,props:t},n,i){if("block-scalar-header"!==t[0].type)return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:s}=t[0],r=s[0];let o=0,a="",l=-1;for(let t=1;t<s.length;++t){const n=s[t];if(a||"-"!==n&&"+"!==n){const i=Number(n);!o&&i?o=i:-1===l&&(l=e+t)}else a=n}-1!==l&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let c=!1,h="",u=s.length;for(let e=1;e<t.length;++e){const s=t[e];switch(s.type){case"space":c=!0;case"newline":u+=s.source.length;break;case"comment":if(n&&!c){i(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters")}u+=s.source.length,h=s.source.substring(1);break;case"error":i(s,"UNEXPECTED_TOKEN",s.message),u+=s.source.length;break;default:{i(s,"UNEXPECTED_TOKEN",`Unexpected token in block scalar header: ${s.type}`);const e=s.source;e&&"string"==typeof e&&(u+=e.length)}}}return{mode:r,indent:o,chomp:a,comment:h,length:u}}(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[i,i,i]};const r=">"===s.mode?Nb.BLOCK_FOLDED:Nb.BLOCK_LITERAL,o=t.source?function(e){const t=e.split(/\n( *)/),n=t[0],i=n.match(/^( *)/),s=i?.[1]?[i[1],n.slice(i[1].length)]:["",n],r=[s];for(let e=1;e<t.length;e+=2)r.push([t[e],t[e+1]]);return r}(t.source):[];let a=o.length;for(let e=o.length-1;e>=0;--e){const t=o[e][1];if(""!==t&&"\r"!==t)break;a=e}if(0===a){const e="+"===s.chomp&&o.length>0?"\n".repeat(Math.max(1,o.length-1)):"";let n=i+s.length;return t.source&&(n+=t.source.length),{value:e,type:r,comment:s.comment,range:[i,n,n]}}let l=t.indent+s.indent,c=t.offset+s.length,h=0;for(let t=0;t<a;++t){const[i,r]=o[t];if(""!==r&&"\r"!==r){if(i.length<l){const e="Block scalars with more-indented leading empty lines must use an explicit indentation indicator";n(c+i.length,"MISSING_CHAR",e)}if(0===s.indent&&(l=i.length),h=t,0===l&&!e.atRoot){n(c,"BAD_INDENT","Block scalar values in collections must be indented")}break}0===s.indent&&i.length>l&&(l=i.length),c+=i.length+r.length+1}for(let e=o.length-1;e>=a;--e)o[e][0].length>l&&(a=e+1);let u="",d="",f=!1;for(let e=0;e<h;++e)u+=o[e][0].slice(l)+"\n";for(let e=h;e<a;++e){let[t,i]=o[e];c+=t.length+i.length+1;const a="\r"===i[i.length-1];if(a&&(i=i.slice(0,-1)),i&&t.length<l){const e=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;n(c-i.length-(a?2:1),"BAD_INDENT",e),t=""}r===Nb.BLOCK_LITERAL?(u+=d+t.slice(l)+i,d="\n"):t.length>l||"\t"===i[0]?(" "===d?d="\n":f||"\n"!==d||(d="\n\n"),u+=d+t.slice(l)+i,d="\n",f=!0):""===i?"\n"===d?u+="\n":d="\n":(u+=d+i,d=" ",f=!1)}switch(s.chomp){case"-":break;case"+":for(let e=a;e<o.length;++e)u+="\n"+o[e][0].slice(l);"\n"!==u[u.length-1]&&(u+="\n");break;default:u+="\n"}const p=i+s.length+t.source.length;return{value:u,type:r,comment:s.comment,range:[i,p,p]}}function Av(e,t,n){const{offset:i,type:s,source:r,end:o}=e;let a,l;const c=(e,t,s)=>n(i+e,t,s);switch(s){case"scalar":a=Nb.PLAIN,l=function(e,t){let n="";switch(e[0]){case"\t":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":n=`block scalar indicator ${e[0]}`;break;case"@":case"`":n=`reserved character ${e[0]}`}n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`);return Tv(e)}(r,c);break;case"single-quoted-scalar":a=Nb.QUOTE_SINGLE,l=function(e,t){"'"===e[e.length-1]&&1!==e.length||t(e.length,"MISSING_CHAR","Missing closing 'quote");return Tv(e.slice(1,-1)).replace(/''/g,"'")}(r,c);break;case"double-quoted-scalar":a=Nb.QUOTE_DOUBLE,l=function(e,t){let n="";for(let i=1;i<e.length-1;++i){const s=e[i];if("\r"!==s||"\n"!==e[i+1])if("\n"===s){const{fold:t,offset:s}=Nv(e,i);n+=t,i=s}else if("\\"===s){let s=e[++i];const r=Ov[s];if(r)n+=r;else if("\n"===s)for(s=e[i+1];" "===s||"\t"===s;)s=e[1+ ++i];else if("\r"===s&&"\n"===e[i+1])for(s=e[1+ ++i];" "===s||"\t"===s;)s=e[1+ ++i];else if("x"===s||"u"===s||"U"===s){const r={x:2,u:4,U:8}[s];n+=Mv(e,i+1,r,t),i+=r}else{const s=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),n+=s}}else if(" "===s||"\t"===s){const t=i;let r=e[i+1];for(;" "===r||"\t"===r;)r=e[1+ ++i];"\n"===r||"\r"===r&&"\n"===e[i+2]||(n+=i>t?e.slice(t,i+1):s)}else n+=s}'"'===e[e.length-1]&&1!==e.length||t(e.length,"MISSING_CHAR",'Missing closing "quote');return n}(r,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}const h=i+r.length,u=kv(o,h,t,n);return{value:l,type:a,comment:u.comment,range:[i,h,u.offset]}}function Tv(e){let t,n;try{t=new RegExp("(.*?)(?<![ \t])[ \t]*\r?\n","sy"),n=new RegExp("[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n","sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=t.exec(e);if(!i)return e;let s=i[1],r=" ",o=t.lastIndex;for(n.lastIndex=o;i=n.exec(e);)""===i[1]?"\n"===r?s+=r:r="\n":(s+=r+i[1],r=" "),o=n.lastIndex;const a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(e),s+r+(i?.[1]??"")}function Nv(e,t){let n="",i=e[t+1];for(;!(" "!==i&&"\t"!==i&&"\n"!==i&&"\r"!==i||"\r"===i&&"\n"!==e[t+2]);)"\n"===i&&(n+="\n"),i=e[(t+=1)+1];return n||(n=" "),{fold:n,offset:t}}const Ov={0:"\0",a:"",b:"\b",e:"",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function Mv(e,t,n,i){const s=e.substr(t,n),r=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(r)){const s=e.substr(t-2,n+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}return String.fromCodePoint(r)}function Ev(e,t,n,i){const{value:s,type:r,comment:o,range:a}="block-scalar"===t.type?Cv(e,t,i):Av(t,e.options.strict,i),l=n?e.directives.tagName(n.source,e=>i(n,"TAG_RESOLVE_FAILED",e)):null;let c,h;c=e.options.stringKeys&&e.atKey?e.schema[Qg]:l?function(e,t,n,i,s){if("!"===n)return e[Qg];const r=[];for(const t of e.tags)if(!t.collection&&t.tag===n){if(!t.default||!t.test)return t;r.push(t)}for(const e of r)if(e.test?.test(t))return e;const o=e.knownTags[n];if(o&&!o.collection)return e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o;return s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,"tag:yaml.org,2002:str"!==n),e[Qg]}(e.schema,s,l,n,i):"scalar"===t.type?function({atKey:e,directives:t,schema:n},i,s,r){const o=n.tags.find(t=>(!0===t.default||e&&"key"===t.default)&&t.test?.test(i))||n[Qg];if(n.compat){const e=n.compat.find(e=>e.default&&e.test?.test(i))??n[Qg];if(o.tag!==e.tag){r(s,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}}return o}(e,s,t,i):e.schema[Qg];try{const r=c.resolve(s,e=>i(n??t,"TAG_RESOLVE_FAILED",e),e.options);h=rb(r)?r:new Nb(r)}catch(e){const r=e instanceof Error?e.message:String(e);i(n??t,"TAG_RESOLVE_FAILED",r),h=new Nb(s)}return h.range=a,h.source=s,r&&(h.type=r),l&&(h.tag=l),c.format&&(h.format=c.format),o&&(h.comment=o),h}function Dv(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let n=t[i];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++i];"space"===n?.type;)e+=n.source.length,n=t[++i];break}}return e}const _v={composeNode:Iv,composeEmptyNode:Bv};function Iv(e,t,n,i){const s=e.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=n;let c,h=!0;switch(t.type){case"alias":c=function({options:e},{offset:t,source:n,end:i},s){const r=new Cb(n.substring(1));""===r.source&&s(t,"BAD_ALIAS","Alias cannot be an empty string");r.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=t+n.length,a=kv(i,o,e.strict,s);r.range=[t,o,a.offset],a.comment&&(r.comment=a.comment);return r}(e,t,i),(a||l)&&i(t,"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=Ev(e,t,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=function(e,t,n,i,s){const r=i.tag,o=r?t.directives.tagName(r.source,e=>s(r,"TAG_RESOLVE_FAILED",e)):null;if("block-seq"===n.type){const{anchor:e,newlineAfterProp:t}=i,n=e&&r?e.offset>r.offset?e:r:e??r;n&&(!t||t.offset<n.offset)&&s(n,"MISSING_CHAR","Missing newline after block sequence props")}const a="block-map"===n.type?"map":"block-seq"===n.type?"seq":"{"===n.start.source?"map":"seq";if(!r||!o||"!"===o||o===ly.tagName&&"map"===a||o===hy.tagName&&"seq"===a)return Sv(e,t,n,s,o);let l=t.schema.tags.find(e=>e.tag===o&&e.collection===a);if(!l){const i=t.schema.knownTags[o];if(i?.collection!==a)return i?s(r,"BAD_COLLECTION_TYPE",`${i.tag} used for ${a} collection, but expects ${i.collection??"scalar"}`,!0):s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Sv(e,t,n,s,o);t.schema.tags.push(Object.assign({},i,{default:!1})),l=i}const c=Sv(e,t,n,s,o,l),h=l.resolve?.(c,e=>s(r,"TAG_RESOLVE_FAILED",e),t.options)??c,u=lb(h)?h:new Nb(h);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}(_v,e,t,n,i),a&&(c.anchor=a.source.substring(1))}catch(e){i(t,"RESOURCE_EXHAUSTION",e instanceof Error?e.message:String(e))}break;default:i(t,"UNEXPECTED_TOKEN","error"===t.type?t.message:`Unsupported token (type: ${t.type})`),h=!1}if(c??(c=Bv(e,t.offset,void 0,null,n,i)),a&&""===c.anchor&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!rb(c)||"string"!=typeof c.value||c.tag&&"tag:yaml.org,2002:str"!==c.tag)){i(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings")}return r&&(c.spaceBefore=!0),o&&("scalar"===t.type&&""===t.source?c.comment=o:c.commentBefore=o),e.options.keepSourceTokens&&h&&(c.srcToken=t),c}function Bv(e,t,n,i,{spaceBefore:s,comment:r,anchor:o,tag:a,end:l},c){const h=Ev(e,{type:"scalar",offset:Dv(t,n,i),indent:-1,source:""},a,c);return o&&(h.anchor=o.source.substring(1),""===h.anchor&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(h.spaceBefore=!0),r&&(h.comment=r,h.range[2]=l),h}function Pv(e){if("number"==typeof e)return[e,e+1];if(Array.isArray(e))return 2===e.length?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+("string"==typeof n?n.length:1)]}function Rv(e){let t="",n=!1,i=!1;for(let s=0;s<e.length;++s){const r=e[s];switch(r[0]){case"#":t+=(""===t?"":i?"\n\n":"\n")+(r.substring(1)||" "),n=!0,i=!1;break;case"%":"#"!==e[s+1]?.[0]&&(s+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}class $v{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,i)=>{const s=Pv(e);i?this.warnings.push(new fv(s,t,n)):this.errors.push(new dv(s,t,n))},this.directives=new bb({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:i}=Rv(this.prelude);if(n){const s=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(i||e.directives.docStart||!s)e.commentBefore=n;else if(ab(s)&&!s.flow&&s.items.length>0){let e=s.items[0];sb(e)&&(e=e.key);const t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{const e=s.commentBefore;s.commentBefore=e?`${n}\n${e}`: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:Rv(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(const t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{const s=Pv(e);s[0]+=t,this.onError(s,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=function(e,t,{offset:n,start:i,value:s,end:r},o){const a=Object.assign({_directives:t},e),l=new cv(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},h=mv(i,{indicator:"doc-start",next:s??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});h.found&&(l.directives.docStart=!0,!s||"block-map"!==s.type&&"block-seq"!==s.type||h.hasNewline||o(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=s?Iv(c,s,h,o):Bv(c,h.end,i,null,h,o);const u=l.contents.range[2],d=kv(r,u,!1,o);return d.comment&&(l.comment=d.comment),l.range=[n,u,d.offset],l}(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 dv(Pv(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 t="Unexpected doc-end without preceding document";this.errors.push(new dv(Pv(e),"UNEXPECTED_TOKEN",t));break}this.doc.directives.docEnd=!0;const t=kv(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new dv(Pv(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 e=Object.assign({_directives:this.directives},this.options),n=new cv(void 0,e);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}}function Lv(e){switch(e){case void 0:case" ":case"\n":case"\r":case"\t":return!0;default:return!1}}const zv=new Set("0123456789ABCDEFabcdef"),Fv=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),jv=new Set(",[]{}"),Wv=new Set(" ,[]{}\n\r\t"),Uv=e=>!e||Wv.has(e);class Vv{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("string"!=typeof e)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;)t=this.buffer[++e];return!t||"#"===t||"\n"===t||"\r"===t&&"\n"===this.buffer[e+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("\r"===t){const t=this.buffer[n+e+1];if("\n"===t||!t&&!this.atEnd)return e+n+1}return"\n"===t||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if("-"===t||"."===t){const t=this.buffer.substr(e,3);if(("---"===t||"..."===t)&&Lv(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return("number"!=typeof e||-1!==e&&e<this.pos)&&(e=this.buffer.indexOf("\n",this.pos),this.lineEndPos=e),-1===e?this.atEnd?this.buffer.substring(this.pos):null:("\r"===this.buffer[e-1]&&(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(null===e)return this.setNext("stream");if("\ufeff"===e[0]&&(yield*this.pushCount(1),e=e.substring(1)),"%"===e[0]){let t=e.length,n=e.indexOf("#");for(;-1!==n;){const i=e[n-1];if(" "===i||"\t"===i){t=n-1;break}n=e.indexOf("#",n+1)}for(;;){const n=e[t-1];if(" "!==n&&"\t"!==n)break;t-=1}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"",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 e=this.peek(3);if(("---"===e||"..."===e)&&Lv(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"---"===e?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Lv(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)&&Lv(t)){const e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(null===e)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(Uv),"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(null===i)return this.setNext("flow");if(-1!==n&&n<this.indentNext&&"#"!==i[0]||0===n&&(i.startsWith("---")||i.startsWith("..."))&&Lv(i[3])){if(!(n===this.indentNext-1&&1===this.flowLevel&&("]"===i[0]||"}"===i[0])))return this.flowLevel=0,yield"",yield*this.parseLineStart()}let s=0;for(;","===i[s];)s+=(yield*this.pushCount(1)),s+=(yield*this.pushSpaces(!0)),this.flowKey=!1;switch(s+=(yield*this.pushIndicators()),i[s]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-s),"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(Uv),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const e=this.charAt(1);if(this.flowKey||Lv(e)||","===e)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(;-1!==t&&"'"===this.buffer[t+1];)t=this.buffer.indexOf("'",t+2);else for(;-1!==t;){let e=0;for(;"\\"===this.buffer[t-1-e];)e+=1;if(e%2==0)break;t=this.buffer.indexOf('"',t+1)}const n=this.buffer.substring(0,t);let i=n.indexOf("\n",this.pos);if(-1!==i){for(;-1!==i;){const e=this.continueScalar(i+1);if(-1===e)break;i=n.indexOf("\n",e)}-1!==i&&(t=i-("\r"===n[i-1]?2:1))}if(-1===t){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(e=>Lv(e)||"#"===e)}*parseBlockScalar(){let e,t=this.pos-1,n=0;e:for(let i=this.pos;e=this.buffer[i];++i)switch(e){case" ":n+=1;break;case"\n":t=i,n=0;break;case"\r":{const e=this.buffer[i+1];if(!e&&!this.atEnd)return this.setNext("block-scalar");if("\n"===e)break}default:break e}if(!e&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){-1===this.blockScalarIndent?this.indentNext=n:this.indentNext=this.blockScalarIndent+(0===this.indentNext?1:this.indentNext);do{const e=this.continueScalar(t+1);if(-1===e)break;t=this.buffer.indexOf("\n",e)}while(-1!==t);if(-1===t){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(e=this.buffer[i];" "===e;)e=this.buffer[++i];if("\t"===e){for(;"\t"===e||" "===e||"\r"===e||"\n"===e;)e=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)for(;;){let e=t-1,i=this.buffer[e];"\r"===i&&(i=this.buffer[--e]);const s=e;for(;" "===i;)i=this.buffer[--e];if(!("\n"===i&&e>=this.pos&&e+1+n>s))break;t=e}return yield"",yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t,n=this.pos-1,i=this.pos-1;for(;t=this.buffer[++i];)if(":"===t){const t=this.buffer[i+1];if(Lv(t)||e&&jv.has(t))break;n=i}else if(Lv(t)){let s=this.buffer[i+1];if("\r"===t&&("\n"===s?(i+=1,t="\n",s=this.buffer[i+1]):n=i),"#"===s||e&&jv.has(s))break;if("\n"===t){const e=this.continueScalar(i+1);if(-1===e)break;i=Math.max(i,e-2)}}else{if(e&&jv.has(t))break;n=i}return t||this.atEnd?(yield"",yield*this.pushToIndex(n+1,!0),e?"flow":"doc"):this.setNext("plain-scalar")}*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(Uv))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(Lv(t)||e&&jv.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(;!Lv(t)&&">"!==t;)t=this.buffer[++e];return yield*this.pushToIndex(">"===t?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Fv.has(t))t=this.buffer[++e];else{if("%"!==t||!zv.has(this.buffer[e+1])||!zv.has(this.buffer[e+2]))break;t=this.buffer[e+=3]}return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return"\n"===e?yield*this.pushCount(1):"\r"===e&&"\n"===this.charAt(1)?yield*this.pushCount(2):0}*pushSpaces(e){let t,n=this.pos-1;do{t=this.buffer[++n]}while(" "===t||e&&"\t"===t);const i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),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 Hv{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){const i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(0===t)return{line:0,col:e};return{line:t,col:e-this.lineStarts[t-1]+1}}}}function qv(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Kv(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Jv(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Zv(e){switch(e.type){case"document":return e.start;case"block-map":{const t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Yv(e){if(0===e.length)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;"space"===e[++t]?.type;);return e.splice(t,e.length)}function Gv(e){if("flow-seq-start"===e.start.type)for(const t of e.items)!t.sep||t.value||qv(t.start,"explicit-key-ind")||qv(t.sep,"map-value-ind")||(t.key&&(t.value=t.key),delete t.key,Jv(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}class Qv{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 Vv,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&0===this.offset&&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)return this.atScalar=!1,yield*this.step(),void(this.offset+=e.length);const t=function(e){switch(e){case"\ufeff":return"byte-order-mark";case"":return"doc-mode";case"":return"flow-error-end";case"":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case"\n":case"\r\n":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(e[0]){case" ":case"\t":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}(e);if(t)if("scalar"===t)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 t=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:t,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("doc-end"!==this.type||"doc-end"===e?.type){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()}else{for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source})}}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(t)if(0===this.stack.length)yield t;else{const e=this.peek(1);switch("block-scalar"===t.type?t.indent="indent"in e?e.indent:0:"flow-collection"===t.type&&"document"===e.type&&(t.indent=0),"flow-collection"===t.type&&Gv(t),e.type){case"document":e.value=t;break;case"block-scalar":e.props.push(t);break;case"block-map":{const n=e.items[e.items.length-1];if(n.value)return e.items.push({start:[],key:t,sep:[]}),void(this.onKeyLine=!0);if(!n.sep)return Object.assign(n,{key:t,sep:[]}),void(this.onKeyLine=!n.explicitKey);n.value=t;break}case"block-seq":{const n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{const n=e.items[e.items.length-1];return void(!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]}))}default:yield*this.pop(),yield*this.pop(t)}if(!("document"!==e.type&&"block-map"!==e.type&&"block-seq"!==e.type||"block-map"!==t.type&&"block-seq"!==t.type)){const n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&-1===Kv(n.start)&&(0===t.indent||n.start.every(e=>"comment"!==e.type||e.indent<t.indent))&&("document"===e.type?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}else{const e="Tried to pop an empty stack";yield{type:"error",offset:this.offset,source:"",message:e}}}*stream(){switch(this.type){case"directive-line":return void(yield{type:"directive",offset:this.offset,source:this.source});case"byte-order-mark":case"space":case"comment":case"newline":return void(yield this.sourceToken);case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};return"doc-start"===this.type&&e.start.push(this.sourceToken),void this.stack.push(e)}}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":return void(-1!==Kv(e.start)?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken));case"anchor":case"tag":case"space":case"comment":case"newline":return void e.start.push(this.sourceToken)}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("map-value-ind"===this.type){const t=Yv(Zv(this.peek(2)));let n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];const i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":return void e.props.push(this.sourceToken);case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+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,i=Array.isArray(n)?n[n.length-1]:void 0;"comment"===i?.type?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 n=e.items[e.items.length-2],i=n?.value?.end;if(Array.isArray(i))return Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),void e.items.pop()}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)&&"seq-item-ind"!==this.type;let s=[];if(i&&t.sep&&!t.value){const n=[];for(let i=0;i<t.sep.length;++i){const s=t.sep[i];switch(s.type){case"newline":n.push(i);break;case"space":break;case"comment":s.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(s=t.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":return void(i||t.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken));case"explicit-key-ind":return t.sep||t.explicitKey?i||t.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}):(t.start.push(this.sourceToken),t.explicitKey=!0),void(this.onKeyLine=!0);case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(qv(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(Jv(t.key)&&!qv(t.sep,"newline")){const e=Yv(t.start),n=t.key,i=t.sep;i.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:i}]})}else s.length>0?t.sep=t.sep.concat(s,this.sourceToken):t.sep.push(this.sourceToken);else if(qv(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const e=Yv(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):qv(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]});return void(this.onKeyLine=!0);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const n=this.flowScalar(this.type);return void(i||t.value?(e.items.push({start:s,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0))}default:{const i=this.startBlockValue(e);if(i){if("block-seq"===i.type){if(!t.explicitKey&&t.sep&&!qv(t.sep,"newline"))return void(yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source}))}else n&&e.items.push({start:s});return void this.stack.push(i)}}}}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,i=Array.isArray(n)?n[n.length-1]:void 0;"comment"===i?.type?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 n=e.items[e.items.length-2],i=n?.value?.end;if(Array.isArray(i))return Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),void e.items.pop()}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;return void t.start.push(this.sourceToken);case"seq-item-ind":if(this.indent!==e.indent)break;return void(t.value||qv(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken))}if(this.indent>e.indent){const t=this.startBlockValue(e);if(t)return void this.stack.push(t)}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if("flow-error-end"===this.type){let e;do{yield*this.pop(),e=this.peek(1)}while("flow-collection"===e?.type)}else if(0===e.end.length){switch(this.type){case"comma":case"explicit-key-ind":return void(!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken));case"map-value-ind":return void(!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]}));case"space":case"comment":case"newline":case"anchor":case"tag":return void(!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken));case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const n=this.flowScalar(this.type);return void(!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]}))}case"flow-map-end":case"flow-seq-end":return void e.end.push(this.sourceToken)}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const t=this.peek(2);if("block-map"===t.type&&("map-value-ind"===this.type&&t.indent===e.indent||"newline"===this.type&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if("map-value-ind"===this.type&&"flow-collection"!==t.type){const n=Yv(Zv(t));Gv(e);const i=e.end.splice(1,e.end.length);i.push(this.sourceToken);const s={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]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+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=Yv(Zv(e));return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Yv(Zv(e));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return"comment"===this.type&&(!(this.indent<=t)&&e.every(e=>"newline"===e.type||"space"===e.type))}*documentEnd(e){"doc-mode"!==this.type&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],"newline"===this.type&&(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],"newline"===this.type&&(yield*this.pop())}}}function Xv(e,t={}){const{lineCounter:n,prettyErrors:i}=function(e){const t=!1!==e.prettyErrors;return{lineCounter:e.lineCounter||t&&new Hv||null,prettyErrors:t}}(t),s=new Qv(n?.addNewLine),r=new $v(t);let o=null;for(const t of r.compose(s.parse(e),!0,e.length))if(o){if("silent"!==o.options.logLevel){o.errors.push(new dv(t.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else o=t;return i&&n&&(o.errors.forEach(pv(e,n)),o.warnings.forEach(pv(e,n))),o}function ek(e,t,n){function i(n,i){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:i,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,i);const s=o.prototype,r=Object.keys(s);for(let e=0;e<r.length;e++){const t=r[e];t in n||(n[t]=s[t].bind(n))}}const s=n?.Parent??Object;class r extends s{}function o(e){var t;const s=n?.Parent?new r:this;i(s,e),(t=s._zod).deferred??(t.deferred=[]);for(const e of s._zod.deferred)e();return s}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class tk extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class nk extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const ik={};function sk(e){return ik}function rk(e){const t=Object.values(e).filter(e=>"number"==typeof e),n=Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t);return n}function ok(e,t){return"bigint"==typeof t?t.toString():t}function ak(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function lk(e){return null==e}function ck(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const hk=Symbol("evaluating");function uk(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==hk)return void 0===i&&(i=hk,i=n()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function dk(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fk(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function pk(e){return JSON.stringify(e)}const mk="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function gk(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const bk=ak(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function yk(e){if(!1===gk(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==gk(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function vk(e){return yk(e)?{...e}:Array.isArray(e)?[...e]:e}const kk=new Set(["string","number","symbol"]);function wk(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xk(e,t,n){const i=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(i._zod.parent=e),i}function Sk(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function Ck(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function Ak(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Tk(e){return"string"==typeof e?e:e?.message}function Nk(e,t,n){const i={...e,path:e.path??[]};if(!e.message){const s=Tk(e.inst?._zod.def?.error?.(e))??Tk(t?.error?.(e))??Tk(n.customError?.(e))??Tk(n.localeError?.(e))??"Invalid input";i.message=s}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Ok(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Mk(...e){const[t,n,i]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:i}:{...t}}const Ek=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ok,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Dk=ek("$ZodError",Ek),_k=ek("$ZodError",Ek,{Parent:Error});const Ik=e=>(t,n,i,s)=>{const r=i?Object.assign(i,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new tk;if(o.issues.length){const t=new(s?.Err??e)(o.issues.map(e=>Nk(e,r,sk())));throw mk(t,s?.callee),t}return o.value},Bk=e=>async(t,n,i,s)=>{const r=i?Object.assign(i,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(s?.Err??e)(o.issues.map(e=>Nk(e,r,sk())));throw mk(t,s?.callee),t}return o.value},Pk=e=>(t,n,i)=>{const s=i?{...i,async:!1}:{async:!1},r=t._zod.run({value:n,issues:[]},s);if(r instanceof Promise)throw new tk;return r.issues.length?{success:!1,error:new(e??Dk)(r.issues.map(e=>Nk(e,s,sk())))}:{success:!0,data:r.value}},Rk=Pk(_k),$k=e=>async(t,n,i)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},s);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map(e=>Nk(e,s,sk())))}:{success:!0,data:r.value}},Lk=$k(_k),zk=e=>(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ik(e)(t,n,s)},Fk=e=>(t,n,i)=>Ik(e)(t,n,i),jk=e=>async(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Bk(e)(t,n,s)},Wk=e=>async(t,n,i)=>Bk(e)(t,n,i),Uk=e=>(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Pk(e)(t,n,s)},Vk=e=>(t,n,i)=>Pk(e)(t,n,i),Hk=e=>async(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return $k(e)(t,n,s)},qk=e=>async(t,n,i)=>$k(e)(t,n,i),Kk=/^[cC][^\s-]{8,}$/,Jk=/^[0-9a-z]+$/,Zk=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Yk=/^[0-9a-vA-V]{20}$/,Gk=/^[A-Za-z0-9]{27}$/,Qk=/^[a-zA-Z0-9_-]{21}$/,Xk=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ew=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tw=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,nw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const iw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,rw=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ow=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,aw=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lw=/^[A-Za-z0-9_-]*$/,cw=/^\+[1-9]\d{6,14}$/,hw="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",uw=new RegExp(`^${hw}$`);function dw(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const fw=/^-?\d+(?:\.\d+)?$/,pw=/^[^A-Z]*$/,mw=/^[^a-z]*$/,gw=ek("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bw=ek("$ZodCheckMaxLength",(e,t)=>{var n;gw.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!lk(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const s=Ok(i);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),yw=ek("$ZodCheckMinLength",(e,t)=>{var n;gw.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!lk(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const s=Ok(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),vw=ek("$ZodCheckLengthEquals",(e,t)=>{var n;gw.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!lk(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const i=n.value,s=i.length;if(s===t.length)return;const r=Ok(i),o=s>t.length;n.issues.push({origin:r,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),kw=ek("$ZodCheckStringFormat",(e,t)=>{var n,i;gw.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),ww=ek("$ZodCheckRegex",(e,t)=>{kw.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),xw=ek("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=pw),kw.init(e,t)}),Sw=ek("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=mw),kw.init(e,t)}),Cw=ek("$ZodCheckIncludes",(e,t)=>{gw.init(e,t);const n=wk(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Aw=ek("$ZodCheckStartsWith",(e,t)=>{gw.init(e,t);const n=new RegExp(`^${wk(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Tw=ek("$ZodCheckEndsWith",(e,t)=>{gw.init(e,t);const n=new RegExp(`.*${wk(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Nw=ek("$ZodCheckOverwrite",(e,t)=>{gw.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Ow{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),i=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of i)this.content.push(e)}compile(){const e=Function,t=this?.args,n=[...(this?.content??[""]).map(e=>` ${e}`)];return new e(...t,n.join("\n"))}}const Mw={major:4,minor:3,patch:6},Ew=ek("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mw;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let i,s=Ck(e);for(const r of t){if(r._zod.def.when){if(!r._zod.def.when(e))continue}else if(s)continue;const t=e.issues.length,o=r._zod.check(e);if(o instanceof Promise&&!1===n?.async)throw new tk;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(s||(s=Ck(e,t)))});else{if(e.issues.length===t)continue;s||(s=Ck(e,t))}}return i?i.then(()=>e):e},n=(n,s,r)=>{if(Ck(n))return n.aborted=!0,n;const o=t(s,i,r);if(o instanceof Promise){if(!1===r.async)throw new tk;return o.then(t=>e._zod.parse(t,r))}return e._zod.parse(o,r)};e._zod.run=(s,r)=>{if(r.skipChecks)return e._zod.parse(s,r);if("backward"===r.direction){const t=e._zod.parse({value:s.value,issues:[]},{...r,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,s,r)):n(t,s,r)}const o=e._zod.parse(s,r);if(o instanceof Promise){if(!1===r.async)throw new tk;return o.then(e=>t(e,i,r))}return t(o,i,r)}}uk(e,"~standard",()=>({validate:t=>{try{const n=Rk(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Lk(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Dw=ek("$ZodString",(e,t)=>{var n;Ew.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),_w=ek("$ZodStringFormat",(e,t)=>{kw.init(e,t),Dw.init(e,t)}),Iw=ek("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ew),_w.init(e,t)}),Bw=ek("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tw(e))}else t.pattern??(t.pattern=tw());_w.init(e,t)}),Pw=ek("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=nw),_w.init(e,t)}),Rw=ek("$ZodURL",(e,t)=>{_w.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),s=new URL(i);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=s.href:n.value=i)}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),$w=ek("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),_w.init(e,t)}),Lw=ek("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Qk),_w.init(e,t)}),zw=ek("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Kk),_w.init(e,t)}),Fw=ek("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Jk),_w.init(e,t)}),jw=ek("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Zk),_w.init(e,t)}),Ww=ek("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Yk),_w.init(e,t)}),Uw=ek("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Gk),_w.init(e,t)}),Vw=ek("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=dw({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${n.join("|")})`;return new RegExp(`^${hw}T(?:${i})$`)}(t)),_w.init(e,t)}),Hw=ek("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=uw),_w.init(e,t)}),qw=ek("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${dw(t)}$`)),_w.init(e,t)}),Kw=ek("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Xk),_w.init(e,t)}),Jw=ek("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=iw),_w.init(e,t),e._zod.bag.format="ipv4"}),Zw=ek("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=sw),_w.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Yw=ek("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=rw),_w.init(e,t)}),Gw=ek("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ow),_w.init(e,t),e._zod.check=n=>{const i=n.value.split("/");try{if(2!==i.length)throw new Error;const[e,t]=i;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Qw(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Xw=ek("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=aw),_w.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Qw(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const ex=ek("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=lw),_w.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!lw.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Qw(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),tx=ek("$ZodE164",(e,t)=>{t.pattern??(t.pattern=cw),_w.init(e,t)});const nx=ek("$ZodJWT",(e,t)=>{_w.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[i]=n;if(!i)return!1;const s=JSON.parse(atob(i));return!("typ"in s&&"JWT"!==s?.typ||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ix=ek("$ZodUnknown",(e,t)=>{Ew.init(e,t),e._zod.parse=e=>e}),sx=ek("$ZodNever",(e,t)=>{Ew.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function rx(e,t,n){e.issues.length&&t.issues.push(...Ak(n,e.issues)),t.value[n]=e.value}const ox=ek("$ZodArray",(e,t)=>{Ew.init(e,t),e._zod.parse=(n,i)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const r=[];for(let e=0;e<s.length;e++){const o=s[e],a=t.element._zod.run({value:o,issues:[]},i);a instanceof Promise?r.push(a.then(t=>rx(t,n,e))):rx(a,n,e)}return r.length?Promise.all(r).then(()=>n):n}});function ax(e,t,n,i,s){if(e.issues.length){if(s&&!(n in i))return;t.issues.push(...Ak(n,e.issues))}void 0===e.value?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function lx(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(i=e.shape,Object.keys(i).filter(e=>"optional"===i[e]._zod.optin&&"optional"===i[e]._zod.optout));var i;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function cx(e,t,n,i,s,r){const o=[],a=s.keySet,l=s.catchall._zod,c=l.def.type,h="optional"===l.optout;for(const s in t){if(a.has(s))continue;if("never"===c){o.push(s);continue}const r=l.run({value:t[s],issues:[]},i);r instanceof Promise?e.push(r.then(e=>ax(e,n,s,t,h))):ax(r,n,s,t,h)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:r}),e.length?Promise.all(e).then(()=>n):n}const hx=ek("$ZodObject",(e,t)=>{Ew.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const i=ak(()=>lx(t));uk(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const i=e[t]._zod;if(i.values){n[t]??(n[t]=new Set);for(const e of i.values)n[t].add(e)}}return n});const s=gk,r=t.catchall;let o;e._zod.parse=(t,n)=>{o??(o=i.value);const a=t.value;if(!s(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const l=[],c=o.shape;for(const e of o.keys){const i=c[e],s="optional"===i._zod.optout,r=i._zod.run({value:a[e],issues:[]},n);r instanceof Promise?l.push(r.then(n=>ax(n,t,e,a,s))):ax(r,t,e,a,s)}return r?cx(l,a,t,n,i.value,e):l.length?Promise.all(l).then(()=>t):t}}),ux=ek("$ZodObjectJIT",(e,t)=>{hx.init(e,t);const n=e._zod.parse,i=ak(()=>lx(t));let s;const r=gk,o=!ik.jitless,a=o&&bk.value,l=t.catchall;let c;e._zod.parse=(h,u)=>{c??(c=i.value);const d=h.value;return r(d)?o&&a&&!1===u?.async&&!0!==u.jitless?(s||(s=(e=>{const t=new Ow(["shape","payload","ctx"]),n=i.value,s=e=>{const t=pk(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const r=Object.create(null);let o=0;for(const e of n.keys)r[e]="key_"+o++;t.write("const newResult = {};");for(const i of n.keys){const n=r[i],o=pk(i),a=e[i],l="optional"===a?._zod?.optout;t.write(`const ${n} = ${s(i)};`),l?t.write(`\n if (${n}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),h=s(h,u),l?cx([],d,h,u,c,e):h):n(h,u):(h.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),h)}});function dx(e,t,n,i){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const s=e.filter(e=>!Ck(e));return 1===s.length?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Nk(e,i,sk())))}),t)}const fx=ek("$ZodUnion",(e,t)=>{Ew.init(e,t),uk(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),uk(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),uk(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),uk(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>ck(e.source)).join("|")})$`)}});const n=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(s,r)=>{if(n)return i(s,r);let o=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:s.value,issues:[]},r);if(t instanceof Promise)a.push(t),o=!0;else{if(0===t.issues.length)return t;a.push(t)}}return o?Promise.all(a).then(t=>dx(t,s,e,r)):dx(a,s,e,r)}}),px=ek("$ZodIntersection",(e,t)=>{Ew.init(e,t),e._zod.parse=(e,n)=>{const i=e.value,s=t.left._zod.run({value:i,issues:[]},n),r=t.right._zod.run({value:i,issues:[]},n);return s instanceof Promise||r instanceof Promise?Promise.all([s,r]).then(([t,n])=>gx(e,t,n)):gx(e,s,r)}});function mx(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(yk(e)&&yk(t)){const n=Object.keys(t),i=Object.keys(e).filter(e=>-1!==n.indexOf(e)),s={...e,...t};for(const n of i){const i=mx(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};s[n]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const s=mx(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function gx(e,t,n){const i=new Map;let s;for(const n of t.issues)if("unrecognized_keys"===n.code){s??(s=n);for(const e of n.keys)i.has(e)||i.set(e,{}),i.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);const r=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(r.length&&s&&e.issues.push({...s,keys:r}),Ck(e))return e;const o=mx(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const bx=ek("$ZodRecord",(e,t)=>{Ew.init(e,t),e._zod.parse=(n,i)=>{const s=n.value;if(!yk(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const r=[],o=t.keyType._zod.values;if(o){n.value={};const a=new Set;for(const e of o)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){a.add("number"==typeof e?e.toString():e);const o=t.valueType._zod.run({value:s[e],issues:[]},i);o instanceof Promise?r.push(o.then(t=>{t.issues.length&&n.issues.push(...Ak(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Ak(e,o.issues)),n.value[e]=o.value)}let l;for(const e in s)a.has(e)||(l=l??[],l.push(e));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:l})}else{n.value={};for(const o of Reflect.ownKeys(s)){if("__proto__"===o)continue;let a=t.keyType._zod.run({value:o,issues:[]},i);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof o&&fw.test(o)&&a.issues.length){const e=t.keyType._zod.run({value:Number(o),issues:[]},i);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?n.value[o]=s[o]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>Nk(e,i,sk())),input:o,path:[o],inst:e});continue}const l=t.valueType._zod.run({value:s[o],issues:[]},i);l instanceof Promise?r.push(l.then(e=>{e.issues.length&&n.issues.push(...Ak(o,e.issues)),n.value[a.value]=e.value})):(l.issues.length&&n.issues.push(...Ak(o,l.issues)),n.value[a.value]=l.value)}}return r.length?Promise.all(r).then(()=>n):n}}),yx=ek("$ZodEnum",(e,t)=>{Ew.init(e,t);const n=rk(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter(e=>kk.has(typeof e)).map(e=>"string"==typeof e?wk(e):e.toString()).join("|")})$`),e._zod.parse=(t,s)=>{const r=t.value;return i.has(r)||t.issues.push({code:"invalid_value",values:n,input:r,inst:e}),t}}),vx=ek("$ZodTransform",(e,t)=>{Ew.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new nk(e.constructor.name);const s=t.transform(n.value,n);if(i.async){return(s instanceof Promise?s:Promise.resolve(s)).then(e=>(n.value=e,n))}if(s instanceof Promise)throw new tk;return n.value=s,n}});function kx(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const wx=ek("$ZodOptional",(e,t)=>{Ew.init(e,t),e._zod.optin="optional",e._zod.optout="optional",uk(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),uk(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ck(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(t=>kx(t,e.value)):kx(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),xx=ek("$ZodExactOptional",(e,t)=>{wx.init(e,t),uk(e._zod,"values",()=>t.innerType._zod.values),uk(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Sx=ek("$ZodNullable",(e,t)=>{Ew.init(e,t),uk(e._zod,"optin",()=>t.innerType._zod.optin),uk(e._zod,"optout",()=>t.innerType._zod.optout),uk(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ck(e.source)}|null)$`):void 0}),uk(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Cx=ek("$ZodDefault",(e,t)=>{Ew.init(e,t),e._zod.optin="optional",uk(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Ax(e,t)):Ax(i,t)}});function Ax(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Tx=ek("$ZodPrefault",(e,t)=>{Ew.init(e,t),e._zod.optin="optional",uk(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Nx=ek("$ZodNonOptional",(e,t)=>{Ew.init(e,t),uk(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,i)=>{const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(t=>Ox(t,e)):Ox(s,e)}});function Ox(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Mx=ek("$ZodCatch",(e,t)=>{Ew.init(e,t),uk(e._zod,"optin",()=>t.innerType._zod.optin),uk(e._zod,"optout",()=>t.innerType._zod.optout),uk(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(i=>(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>Nk(e,n,sk()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>Nk(e,n,sk()))},input:e.value}),e.issues=[]),e)}}),Ex=ek("$ZodPipe",(e,t)=>{Ew.init(e,t),uk(e._zod,"values",()=>t.in._zod.values),uk(e._zod,"optin",()=>t.in._zod.optin),uk(e._zod,"optout",()=>t.out._zod.optout),uk(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const i=t.out._zod.run(e,n);return i instanceof Promise?i.then(e=>Dx(e,t.in,n)):Dx(i,t.in,n)}const i=t.in._zod.run(e,n);return i instanceof Promise?i.then(e=>Dx(e,t.out,n)):Dx(i,t.out,n)}});function Dx(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const _x=ek("$ZodReadonly",(e,t)=>{Ew.init(e,t),uk(e._zod,"propValues",()=>t.innerType._zod.propValues),uk(e._zod,"values",()=>t.innerType._zod.values),uk(e._zod,"optin",()=>t.innerType?._zod?.optin),uk(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(Ix):Ix(i)}});function Ix(e){return e.value=Object.freeze(e.value),e}const Bx=ek("$ZodCustom",(e,t)=>{gw.init(e,t),Ew.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const i=n.value,s=t.fn(i);if(s instanceof Promise)return s.then(t=>Px(t,n,i,e));Px(s,n,i,e)}});function Px(e,t,n,i){if(!e){const e={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(Mk(e))}}var Rx;class $x{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(Rx=globalThis).__zod_globalRegistry??(Rx.__zod_globalRegistry=new $x);const Lx=globalThis.__zod_globalRegistry;function zx(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Sk(t)})}function Fx(e,t){return new bw({check:"max_length",...Sk(t),maximum:e})}function jx(e,t){return new yw({check:"min_length",...Sk(t),minimum:e})}function Wx(e,t){return new vw({check:"length_equals",...Sk(t),length:e})}function Ux(e){return new Nw({check:"overwrite",tx:e})}function Vx(e){const t=function(e,t){const n=new gw({check:"custom",...Sk(t)});return n._zod.check=e,n}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(Mk(e,n.value,t._zod.def));else{const i=e;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(Mk(i))}},e(n.value,n)));return t}function Hx(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Lx,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function qx(e,t,n={path:[],schemaPath:[]}){var i;const s=e._zod.def,r=t.seen.get(e);if(r){r.count++;return n.schemaPath.includes(e)&&(r.cycle=n.path),r.schema}const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);const a=e._zod.toJSONSchema?.();if(a)o.schema=a;else{const i={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,i);else{const n=o.schema,r=t.processors[s.type];if(!r)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);r(e,t,n,i)}const r=e._zod.parent;r&&(o.ref||(o.ref=r),qx(r,t,i),t.seen.get(r).isParent=!0)}const l=t.metadataRegistry.get(e);l&&Object.assign(o.schema,l),"input"===t.io&&Zx(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&o.schema._prefault&&((i=o.schema).default??(i.default=o.schema._prefault)),delete o.schema._prefault;return t.seen.get(e).schema}function Kx(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=i.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(n,t[0])}}const s=t=>{if(t[1].schema.$ref)return;const i=t[1],{ref:s,defId:r}=(t=>{const i="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,s=e.external.uri??(e=>e);if(n)return{ref:s(n)};const r=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=r,{defId:r,ref:`${s("__shared")}#/${i}/${r}`}}if(t[1]===n)return{ref:"#"};const s=`#/${i}/`,r=t[1].schema.id??"__schema"+e.counter++;return{defId:r,ref:s+r}})(t);i.def={...i.schema},r&&(i.defId=r);const o=i.schema;for(const e in o)delete o[e];o.$ref=s};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const i=n[1];if(t===n[0]){s(n);continue}if(e.external){const i=e.external.registry.get(n[0])?.id;if(t!==n[0]&&i){s(n);continue}}const r=e.metadataRegistry.get(n[0])?.id;r?s(n):(i.cycle||i.count>1&&"ref"===e.reused)&&s(n)}}function Jx(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=t=>{const n=e.seen.get(t);if(null===n.ref)return;const s=n.def??n.schema,r={...s},o=n.ref;if(n.ref=null,o){i(o);const n=e.seen.get(o),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(s,a):(s.allOf=s.allOf??[],s.allOf.push(a)),Object.assign(s,r);if(t._zod.parent===o)for(const e in s)"$ref"!==e&&"allOf"!==e&&(e in r||delete s[e]);if(a.$ref&&n.def)for(const e in s)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(s[e])===JSON.stringify(n.def[e])&&delete s[e]}const a=t._zod.parent;if(a&&a!==o){i(a);const t=e.seen.get(a);if(t?.schema.$ref&&(s.$ref=t.schema.$ref,t.def))for(const e in s)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(s[e])===JSON.stringify(t.def[e])&&delete s[e]}e.override({zodSchema:t,jsonSchema:s,path:n.path??[]})};for(const t of[...e.seen.entries()].reverse())i(t[0]);const s={};if("draft-2020-12"===e.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?s.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(n)}Object.assign(s,n.def??n.schema);const r=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(r[e.defId]=e.def)}e.external||Object.keys(r).length>0&&("draft-2020-12"===e.target?s.$defs=r:s.definitions=r);try{const n=JSON.parse(JSON.stringify(s));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:Yx(t,"input",e.processors),output:Yx(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function Zx(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return Zx(i.element,n);if("set"===i.type)return Zx(i.valueType,n);if("lazy"===i.type)return Zx(i.getter(),n);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return Zx(i.innerType,n);if("intersection"===i.type)return Zx(i.left,n)||Zx(i.right,n);if("record"===i.type||"map"===i.type)return Zx(i.keyType,n)||Zx(i.valueType,n);if("pipe"===i.type)return Zx(i.in,n)||Zx(i.out,n);if("object"===i.type){for(const e in i.shape)if(Zx(i.shape[e],n))return!0;return!1}if("union"===i.type){for(const e of i.options)if(Zx(e,n))return!0;return!1}if("tuple"===i.type){for(const e of i.items)if(Zx(e,n))return!0;return!(!i.rest||!Zx(i.rest,n))}return!1}const Yx=(e,t,n={})=>i=>{const{libraryOptions:s,target:r}=i??{},o=Hx({...s??{},target:r,io:t,processors:n});return qx(e,o),Kx(o,e),Jx(o,e)},Gx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Qx=(e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i);t.seen.get(e).ref=s.innerType},Xx=ek("ZodISODateTime",(e,t)=>{Vw.init(e,t),CS.init(e,t)});function eS(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Sk(t)})}(Xx,e)}const tS=ek("ZodISODate",(e,t)=>{Hw.init(e,t),CS.init(e,t)});function nS(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Sk(t)})}(tS,e)}const iS=ek("ZodISOTime",(e,t)=>{qw.init(e,t),CS.init(e,t)});function sS(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Sk(t)})}(iS,e)}const rS=ek("ZodISODuration",(e,t)=>{Kw.init(e,t),CS.init(e,t)});function oS(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Sk(t)})}(rS,e)}const aS=ek("ZodError",(e,t)=>{Dk.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},i=e=>{for(const s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>i({issues:e}));else if("invalid_key"===s.code)i({issues:s.issues});else if("invalid_element"===s.code)i({issues:s.issues});else if(0===s.path.length)n._errors.push(t(s));else{let e=n,i=0;for(;i<s.path.length;){const n=s.path[i];i===s.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(s))):e[n]=e[n]||{_errors:[]},e=e[n],i++}}};return i(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},i=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):i.push(t(s));return{formErrors:i,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ok,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ok,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),lS=Ik(aS),cS=Bk(aS),hS=Pk(aS),uS=$k(aS),dS=zk(aS),fS=Fk(aS),pS=jk(aS),mS=Wk(aS),gS=Uk(aS),bS=Vk(aS),yS=Hk(aS),vS=qk(aS),kS=ek("ZodType",(e,t)=>(Ew.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yx(e,"input"),output:Yx(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const i=Hx({...n,processors:t});return qx(e,i),Kx(i,e),Jx(i,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(fk(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>xk(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>lS(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>hS(e,t,n),e.parseAsync=async(t,n)=>cS(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>uS(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>dS(e,t,n),e.decode=(t,n)=>fS(e,t,n),e.encodeAsync=async(t,n)=>pS(e,t,n),e.decodeAsync=async(t,n)=>mS(e,t,n),e.safeEncode=(t,n)=>gS(e,t,n),e.safeDecode=(t,n)=>bS(e,t,n),e.safeEncodeAsync=async(t,n)=>yS(e,t,n),e.safeDecodeAsync=async(t,n)=>vS(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Sk(n)})}(fC,e,t)}(t,n)),e.superRefine=t=>e.check(Vx(t)),e.overwrite=t=>e.check(Ux(t)),e.optional=()=>nC(e),e.exactOptional=()=>new iC({type:"optional",innerType:e}),e.nullable=()=>rC(e),e.nullish=()=>nC(rC(e)),e.nonoptional=t=>function(e,t){return new lC({type:"nonoptional",innerType:e,...Sk(t)})}(e,t),e.array=()=>{return function(e,t,n){return new e({type:"array",element:t,...Sk(n)})}(JS,e,t);var t},e.or=t=>{return new YS({type:"union",options:[e,t],...Sk(n)});var n},e.and=t=>new GS({type:"intersection",left:e,right:t}),e.transform=t=>uC(e,new eC({type:"transform",transform:t})),e.default=t=>{return n=t,new oC({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():vk(n)}});var n},e.prefault=t=>{return n=t,new aC({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():vk(n)}});var n},e.catch=t=>{return new cC({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>uC(e,t),e.readonly=()=>new dC({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Lx.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Lx.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Lx.get(e);const n=e.clone();return Lx.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),wS=ek("_ZodString",(e,t)=>{Dw.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n)=>{const i=n;i.type="string";const{minimum:s,maximum:r,format:o,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof s&&(i.minLength=s),"number"==typeof r&&(i.maxLength=r),o&&(i.format=Gx[o]??o,""===i.format&&delete i.format,"time"===o&&delete i.format),l&&(i.contentEncoding=l),a&&a.size>0){const e=[...a];1===e.length?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new ww({check:"string_format",format:"regex",...Sk(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Cw({check:"string_format",format:"includes",...Sk(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Aw({check:"string_format",format:"starts_with",...Sk(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Tw({check:"string_format",format:"ends_with",...Sk(t),suffix:e})}(...t)),e.min=(...t)=>e.check(jx(...t)),e.max=(...t)=>e.check(Fx(...t)),e.length=(...t)=>e.check(Wx(...t)),e.nonempty=(...t)=>e.check(jx(1,...t)),e.lowercase=t=>e.check(function(e){return new xw({check:"string_format",format:"lowercase",...Sk(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Sw({check:"string_format",format:"uppercase",...Sk(e)})}(t)),e.trim=()=>e.check(Ux(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Ux(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Ux(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Ux(e=>e.toUpperCase())),e.slugify=()=>e.check(Ux(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),xS=ek("ZodString",(e,t)=>{Dw.init(e,t),wS.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Sk(t)})}(AS,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Sk(t)})}(OS,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Sk(t)})}(US,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Sk(t)})}(MS,t)),e.guid=t=>e.check(zx(TS,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Sk(t)})}(NS,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Sk(t)})}(NS,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Sk(t)})}(NS,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Sk(t)})}(NS,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Sk(t)})}(ES,t)),e.guid=t=>e.check(zx(TS,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Sk(t)})}(DS,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Sk(t)})}(_S,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Sk(t)})}(IS,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Sk(t)})}(FS,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Sk(t)})}(jS,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Sk(t)})}(BS,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Sk(t)})}(PS,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Sk(t)})}(RS,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Sk(t)})}($S,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Sk(t)})}(LS,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Sk(t)})}(zS,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Sk(t)})}(WS,t)),e.datetime=t=>e.check(eS(t)),e.date=t=>e.check(nS(t)),e.time=t=>e.check(sS(t)),e.duration=t=>e.check(oS(t))});function SS(e){return function(e,t){return new e({type:"string",...Sk(t)})}(xS,e)}const CS=ek("ZodStringFormat",(e,t)=>{_w.init(e,t),wS.init(e,t)}),AS=ek("ZodEmail",(e,t)=>{Pw.init(e,t),CS.init(e,t)}),TS=ek("ZodGUID",(e,t)=>{Iw.init(e,t),CS.init(e,t)}),NS=ek("ZodUUID",(e,t)=>{Bw.init(e,t),CS.init(e,t)}),OS=ek("ZodURL",(e,t)=>{Rw.init(e,t),CS.init(e,t)}),MS=ek("ZodEmoji",(e,t)=>{$w.init(e,t),CS.init(e,t)}),ES=ek("ZodNanoID",(e,t)=>{Lw.init(e,t),CS.init(e,t)}),DS=ek("ZodCUID",(e,t)=>{zw.init(e,t),CS.init(e,t)}),_S=ek("ZodCUID2",(e,t)=>{Fw.init(e,t),CS.init(e,t)}),IS=ek("ZodULID",(e,t)=>{jw.init(e,t),CS.init(e,t)}),BS=ek("ZodXID",(e,t)=>{Ww.init(e,t),CS.init(e,t)}),PS=ek("ZodKSUID",(e,t)=>{Uw.init(e,t),CS.init(e,t)}),RS=ek("ZodIPv4",(e,t)=>{Jw.init(e,t),CS.init(e,t)}),$S=ek("ZodIPv6",(e,t)=>{Zw.init(e,t),CS.init(e,t)}),LS=ek("ZodCIDRv4",(e,t)=>{Yw.init(e,t),CS.init(e,t)}),zS=ek("ZodCIDRv6",(e,t)=>{Gw.init(e,t),CS.init(e,t)}),FS=ek("ZodBase64",(e,t)=>{Xw.init(e,t),CS.init(e,t)}),jS=ek("ZodBase64URL",(e,t)=>{ex.init(e,t),CS.init(e,t)}),WS=ek("ZodE164",(e,t)=>{tx.init(e,t),CS.init(e,t)}),US=ek("ZodJWT",(e,t)=>{nx.init(e,t),CS.init(e,t)}),VS=ek("ZodUnknown",(e,t)=>{ix.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function HS(){return new VS({type:"unknown"})}const qS=ek("ZodNever",(e,t)=>{sx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function KS(e){return function(e,t){return new e({type:"never",...Sk(t)})}(qS,e)}const JS=ek("ZodArray",(e,t)=>{ox.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=n,r=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;"number"==typeof o&&(s.minItems=o),"number"==typeof a&&(s.maxItems=a),s.type="array",s.items=qx(r.element,t,{...i,path:[...i.path,"items"]})})(e,t,n,i),e.element=t.element,e.min=(t,n)=>e.check(jx(t,n)),e.nonempty=t=>e.check(jx(1,t)),e.max=(t,n)=>e.check(Fx(t,n)),e.length=(t,n)=>e.check(Wx(t,n)),e.unwrap=()=>e.element});const ZS=ek("ZodObject",(e,t)=>{ux.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=n,r=e._zod.def;s.type="object",s.properties={};const o=r.shape;for(const e in o)s.properties[e]=qx(o[e],t,{...i,path:[...i.path,"properties",e]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(e=>{const n=r.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));l.size>0&&(s.required=Array.from(l)),"never"===r.catchall?._zod.def.type?s.additionalProperties=!1:r.catchall?r.catchall&&(s.additionalProperties=qx(r.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):"output"===t.io&&(s.additionalProperties=!1)})(e,t,n,i),uk(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new XS({type:"enum",entries:n,...Sk(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:HS()}),e.loose=()=>e.clone({...e._zod.def,catchall:HS()}),e.strict=()=>e.clone({...e._zod.def,catchall:KS()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!yk(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=fk(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return dk(this,"shape",n),n}});return xk(e,i)}(e,t),e.safeExtend=t=>function(e,t){if(!yk(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=fk(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return dk(this,"shape",n),n}});return xk(e,n)}(e,t),e.merge=t=>function(e,t){const n=fk(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return dk(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return xk(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return xk(e,fk(e._zod.def,{get shape(){const e={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=n.shape[i])}return dk(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=fk(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return dk(this,"shape",i),i},checks:[]});return xk(e,s)}(e,t),e.partial=(...t)=>function(e,t,n){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=fk(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(s[t]=e?new e({type:"optional",innerType:i[t]}):i[t])}else for(const t in i)s[t]=e?new e({type:"optional",innerType:i[t]}):i[t];return dk(this,"shape",s),s},checks:[]});return xk(t,s)}(tC,e,t[0]),e.required=(...t)=>function(e,t,n){const i=fk(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(n)for(const t in n){if(!(t in s))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(s[t]=new e({type:"nonoptional",innerType:i[t]}))}else for(const t in i)s[t]=new e({type:"nonoptional",innerType:i[t]});return dk(this,"shape",s),s}});return xk(t,i)}(lC,e,t[0])});const YS=ek("ZodUnion",(e,t)=>{fx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def,r=!1===s.inclusive,o=s.options.map((e,n)=>qx(e,t,{...i,path:[...i.path,r?"oneOf":"anyOf",n]}));r?n.oneOf=o:n.anyOf=o})(e,t,n,i),e.options=t.options});const GS=ek("ZodIntersection",(e,t)=>{px.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def,r=qx(s.left,t,{...i,path:[...i.path,"allOf",0]}),o=qx(s.right,t,{...i,path:[...i.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,l=[...a(r)?r.allOf:[r],...a(o)?o.allOf:[o]];n.allOf=l})(e,t,n,i)});const QS=ek("ZodRecord",(e,t)=>{bx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=n,r=e._zod.def;s.type="object";const o=r.keyType,a=o._zod.bag,l=a?.patterns;if("loose"===r.mode&&l&&l.size>0){const e=qx(r.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});s.patternProperties={};for(const t of l)s.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(s.propertyNames=qx(r.keyType,t,{...i,path:[...i.path,"propertyNames"]})),s.additionalProperties=qx(r.valueType,t,{...i,path:[...i.path,"additionalProperties"]});const c=o._zod.values;if(c){const e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(s.required=e)}})(e,t,n,i),e.keyType=t.keyType,e.valueType=t.valueType});const XS=ek("ZodEnum",(e,t)=>{yx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n)=>{const i=rk(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=i})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,i)=>{const s={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);s[i]=t.entries[i]}return new XS({...t,checks:[],...Sk(i),entries:s})},e.exclude=(e,i)=>{const s={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete s[t]}return new XS({...t,checks:[],...Sk(i),entries:s})}});const eC=ek("ZodTransform",(e,t)=>{vx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new nk(e.constructor.name);n.addIssue=i=>{if("string"==typeof i)n.issues.push(Mk(i,n.value,t));else{const t=i;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(Mk(t))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(e=>(n.value=e,n)):(n.value=s,n)}});const tC=ek("ZodOptional",(e,t)=>{wx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>Qx(e,t,0,i),e.unwrap=()=>e._zod.def.innerType});function nC(e){return new tC({type:"optional",innerType:e})}const iC=ek("ZodExactOptional",(e,t)=>{xx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>Qx(e,t,0,i),e.unwrap=()=>e._zod.def.innerType});const sC=ek("ZodNullable",(e,t)=>{Sx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def,r=qx(s.innerType,t,i),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=s.innerType,n.nullable=!0):n.anyOf=[r,{type:"null"}]})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType});function rC(e){return new sC({type:"nullable",innerType:e})}const oC=ek("ZodDefault",(e,t)=>{Cx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const aC=ek("ZodPrefault",(e,t)=>{Tx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType});const lC=ek("ZodNonOptional",(e,t)=>{Nx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType})(e,t,0,i),e.unwrap=()=>e._zod.def.innerType});const cC=ek("ZodCatch",(e,t)=>{Mx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;let r;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType;try{r=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=r})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const hC=ek("ZodPipe",(e,t)=>{Ex.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def,r="input"===t.io?"transform"===s.in._zod.def.type?s.out:s.in:s.out;qx(r,t,i),t.seen.get(e).ref=r})(e,t,0,i),e.in=t.in,e.out=t.out});function uC(e,t){return new hC({type:"pipe",in:e,out:t})}const dC=ek("ZodReadonly",(e,t)=>{_x.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType,n.readOnly=!0})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType});const fC=ek("ZodCustom",(e,t)=>{Bx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function pC(e){return`${e}`}function mC(e){return`${e}`}async function gC(e,t,n){const i=e.substring(1),s=await async function(e,t,n){const i=`https://api.github.com/repos/${e}/git/trees/${t}?recursive=1`,s=await bC(i,AC(n));if(!s.ok){if(404===s.status){const i=`https://api.github.com/repos/${e}`;return(await bC(i,AC(n))).ok?{kind:"error",message:`Version not found: https://github.com/${e}/releases/tag/${t}`}:{kind:"error",message:`Repository not found: https://github.com/${e}`}}throw new Error(`Github API request failed: ${s.status} ${s.statusText}`)}return{kind:"success",tree:await s.json()}}(i,t,n);if("error"===s.kind)return s;const r=s.tree,o={},a=r.tree.filter(e=>"blob"===e.type&&e.path.startsWith("skir-src/")&&e.path.endsWith(".skir")).map(async t=>{const s=await yC(i,t.sha,n);return{modulePath:e+t.path.substring(8),content:s}}),l=await Promise.all(a);for(const{modulePath:e,content:t}of l)o[e]=t;const c=r.tree.find(e=>"blob"===e.type&&"skir.yml"===e.path);if(!c)return{kind:"error",message:`Package ${e}@${t} is missing required skir.yml configuration file`};const h=function(e){const t=[],n=new Hv,i=Xv(e,{lineCounter:n}),s=e=>{const t=n.linePos(e);return{offset:e,lineNumber:t.line,colNumber:t.col}},r=(e,t)=>({start:s(e),end:s(t)}),o=e=>{const t=i.getIn(e,!0);if(t?.range)return r(t.range[0],t.range[1])},a=(e,n)=>{let i=e;const s=[];for(;0!==i.length;){if(o(i))break;s.push(i.at(-1)),i=i.slice(0,-1)}s.reverse();const r=s.map((e,t)=>"number"==typeof e?`[${e}]`:0===t?e:`.${String(e)}`).join(""),a=s.length?`Missing property '${r}': `:"";t.push({message:a+n,range:o(i)})};if(i.errors.length>0){for(const e of i.errors)t.push({message:e.message,range:r(e.pos[0],e.pos[1])});return{dependencies:void 0,errors:t}}const l=wC.safeParse(i.toJS());if(!l.success){for(const e of l.error.issues)a(e.path,e.message);return{dependencies:void 0,errors:t}}return{dependencies:l.data.dependencies,errors:t}}(await yC(i,c.sha,n));if(h.errors.length>0)return{kind:"error",message:h.errors.map(t=>function(e,t){const{message:n,range:i}=e,{skirConfigPath:s}=t;return[i?[pC(s),mC(i.start.lineNumber.toString()),mC(i.start.colNumber.toString())].join(":"):pC(s)," - ",(r="error",`${r}`),": ",n].join("");var r}(t,{skirConfigPath:`${e}/skir.yml`})).join("\n")};const u=h.dependencies??{};return{kind:"success",package:{packageId:e,version:t,modules:o,dependencies:u}}}async function bC(e,t,n=3){let i;for(let s=0;s<=n;s++){const r=await fetch(e,{headers:t});if(403!==r.status&&429!==r.status)return r;if(i=r,s===n)break;const o=r.headers.get("Retry-After"),a=o?1e3*parseInt(o,10):1e3*2**s;await new Promise(e=>setTimeout(e,a))}return i}async function yC(e,t,n){const i=`https://api.github.com/repos/${e}/git/blobs/${t}`,s=await bC(i,AC(n));if(!s.ok)throw new Error(`Failed to download file: ${s.status} ${s.statusText}`);const r=await s.json();return"base64"===r.encoding?function(e){const t=e.replace(/\s/g,""),n=atob(t),i=Uint8Array.from(n,e=>e.charCodeAt(0));return(new TextDecoder).decode(i)}(r.content):r.content}const vC=SS().regex(/^@[A-Za-z0-9-]+\/[A-Za-z0-9\-_.]+$/),kC=SS().regex(/^[A-Za-z0-9\-_./+]+$/),wC=function(e,t){const n={type:"object",shape:e??{},...Sk(t)};return new ZS(n)}({dependencies:(xC=vC,SC=kC,new QS({type:"record",keyType:xC,valueType:SC,...Sk(CC)})).default({})});var xC,SC,CC;function AC(e){const t={Accept:"application/vnd.github.v3+json"};return e&&(t.Authorization=`token ${e}`),t}class TC{constructor(e,t,n){this.cachedPackages=e,this.githubToken=t,this.packageDownloader=n,this.packageBundles={},this.dependencyChain=[],this.errors=[],this.allDependenciesOnDisk=!0}async run(e){for(const[t,n]of Object.entries(e))if(await this.getDependency(t,n),this.errors.length>0)return this.errors[0];const t=!(this.allDependenciesOnDisk&&Object.keys(e).length===Object.keys(this.cachedPackages).length);return{kind:"success",packages:Object.fromEntries(Object.entries(this.packageBundles).map(([e,t])=>[e,t.pkg])),changed:t}}async getDependency(e,t){this.dependencyChain.push({packageId:e,version:t});try{const n=this.packageBundles[e];if(n?.pkg.version===t)return;if(n)return void this.errors.push({kind:"error",message:[`Version conflict for package ${e}:`,`- ${NC(this.dependencyChain)}`,`- ${NC(n.dependencyChain)}`].join("\n")});let i=this.getCachedPackage(e,t);if(!i){this.allDependenciesOnDisk=!1;const n=await this.packageDownloader(e,t,this.githubToken);if("success"!==n.kind)return void this.errors.push(n);i=n.package}this.packageBundles[e]={pkg:i,dependencyChain:[...this.dependencyChain]};for(const[e,t]of Object.entries(i.dependencies))await this.getDependency(e,t)}finally{this.dependencyChain.pop()}}getCachedPackage(e,t){const n=this.cachedPackages[e];return n?.version===t?n:void 0}}function NC(e){return"main depends on "+e.map(e=>`${e.packageId}:${e.version}`).join(" which depends on ")}async function OC(e,t,n=gC){const i=function(e){const t=e.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/blob\/([^/]+)\/(.+)#L(\d+)$/);if(!t)return{kind:"error",message:`Invalid GitHub URL: ${e}`};const n=t[1],i=t[2],s=t[3],r=t[4],o=Number(t[5]);if(!r.startsWith("skir-src/")||!r.endsWith(".skir"))return{kind:"error",message:`URL must target a .skir file in skir-src: ${e}`};if(!Number.isInteger(o)||o<=0)return{kind:"error",message:`Invalid line number in URL: ${e}`};const a=`@${n}/${i}`,l=a+r.substring(8);return{kind:"success",packageId:a,version:s,modulePath:l,lineNumber:o-1}}(e);if("error"===i.kind)return i;const{packageId:s,version:r,modulePath:o,lineNumber:a}=i,l=new TC({},t,n),c=await l.run({[s]:r});if("error"===c.kind)return c;const h=new Map;for(const e of Object.values(c.packages))for(const[t,n]of Object.entries(e.modules))h.set(t,n);const u=Fg.compile(h);if(u.errors.length>0)return{kind:"error",message:u.errors[0].message||"Compilation failed"};const d=u.modules.get(o);if(!d)return{kind:"error",message:`Module not found: ${o}`};const f=d.result.records.find(e=>e.record.name.line.lineNumber===a);return f?{kind:"success",record:f.record,moduleSet:u}:{kind:"error",message:`No record found at line ${a+1} in ${o}`}}class MC{static from(e){return this.fromUnixMillis(e.getTime())}static fromUnixMillis(e){if(e<=this.MIN.unixMillis)return MC.MIN;if(e<MC.MAX.unixMillis)return new MC(Math.round(e));if(Number.isNaN(e))throw new Error("Cannot construct Timestamp from NaN");return MC.MAX}static fromUnixSeconds(e){return this.fromUnixMillis(1e3*e)}static parse(e){return this.fromUnixMillis(Date.parse(e))}static now(){return this.fromUnixMillis(Date.now())}constructor(e){this.unixMillis=e,Object.freeze(this)}get unixSeconds(){return this.unixMillis/1e3}toDate(){return new Date(this.unixMillis)}toString(){return this.toDate().toISOString()}}MC.UNIX_EPOCH=new MC(0),MC.MIN=new MC(-864e13),MC.MAX=new MC(864e13);class EC{static sliceOf(e,t=0,n){const{byteLength:i}=e;if(t<0&&(t=0),(void 0===n||n>i)&&(n=i),n<=t)return EC.EMPTY;if(e instanceof EC){if(t<=0&&i<=n)return e;{const i=e.byteOffset+t,s=n-t;return new EC(e.arrayBuffer,i,s)}}if(e instanceof ArrayBuffer)return new EC(e.slice(t,n));if(e instanceof SharedArrayBuffer){const i=e.slice(t,n),s=new ArrayBuffer(i.byteLength);return new Uint8Array(s).set(new Uint8Array(i)),new EC(s)}throw new TypeError(e)}static fromBase64(e){const t=atob(e),n=Uint8Array.from(t,e=>e.codePointAt(0));return new this(n.buffer)}static fromBase16(e){const t=new Uint8Array(e.length/2);for(let n=0;n<t.length;++n){const i=parseInt(e.substring(2*n,2*n+2),16);if(Number.isNaN(i))throw new Error("Not a valid Base64 string");t[n]=i}return new EC(t.buffer)}copyTo(e,t=0){new Uint8Array(e).set(this.uint8Array,t)}toBuffer(){return this.arrayBuffer.slice(this.byteOffset,this.byteOffset+this.byteLength)}toBase64(){const e=Array.from(this.uint8Array,e=>String.fromCodePoint(e)).join("");return btoa(e)}toBase16(){return[...this.uint8Array].map(e=>e.toString(16).padStart(2,"0")).join("")}at(e){return this.uint8Array[e<0?e+this.byteLength:e]}toString(){return`ByteString(${this.byteLength})`}constructor(e,t=0,n=e.byteLength){this.arrayBuffer=e,this.byteOffset=t,this.byteLength=n,this.uint8Array=new Uint8Array(e,t,n),Object.freeze(this)}}function DC(e){return QC[e]}EC.EMPTY=new EC(new ArrayBuffer(0));class _C{constructor(e,t){this.buffer=e,this.offset=0,this.dataView=new DataView(e),this.keepUnrecognizedValues=!!t}readUint8(){return this.dataView.getUint8(this.offset++)}}const IC=[e=>e.dataView.getUint16((e.offset+=2)-2,!0),e=>e.dataView.getUint32((e.offset+=4)-4,!0),e=>e.dataView.getBigUint64((e.offset+=8)-8,!0),e=>e.readUint8()-256,e=>e.dataView.getUint16((e.offset+=2)-2,!0)-65536,e=>e.dataView.getInt32((e.offset+=4)-4,!0),e=>e.dataView.getBigInt64((e.offset+=8)-8,!0),e=>e.dataView.getBigInt64((e.offset+=8)-8,!0),e=>e.dataView.getFloat32((e.offset+=4)-4,!0),e=>e.dataView.getFloat64((e.offset+=8)-8,!0)];function BC(e){const t=e.readUint8();return t<232?t:IC[t-232](e)}function PC(e){const t=BC(e);return"bigint"==typeof t?t:BigInt(Math.round(t))}class RC{constructor(){this.buffer=new ArrayBuffer(128),this.dataView=new DataView(this.buffer),this.offset=0,this.pieces=[],this.byteLength=0}writeUint8(e){this.reserve(1).setUint8(++this.offset-1,e)}writeUint16(e){this.reserve(2).setUint16((this.offset+=2)-2,e,!0)}writeUint32(e){this.reserve(4).setUint32((this.offset+=4)-4,e,!0)}writeInt32(e){this.reserve(4).setInt32((this.offset+=4)-4,e,!0)}writeHash64(e){this.reserve(8).setBigUint64((this.offset+=8)-8,e,!0)}writeInt64(e){this.reserve(8).setBigInt64((this.offset+=8)-8,e,!0)}writeFloat32(e){this.reserve(4).setFloat32((this.offset+=4)-4,e,!0)}writeFloat64(e){this.reserve(8).setFloat64((this.offset+=8)-8,e,!0)}putUtf8String(e){let t=this.dataView,n=0;for(;e;){const i=JC.encodeInto(e,new Uint8Array(t.buffer,this.offset));this.offset+=i.written,n+=i.written,(e=e.substring(i.read))&&(t=this.reserve(2*e.length))}return n}putBytes(e){const{buffer:t}=this,n=t.byteLength-this.offset,i=EC.sliceOf(e,0,n);i.copyTo(t,this.offset),this.offset+=i.byteLength;const s=e.byteLength-i.byteLength;if(s<=0)return;const r=EC.sliceOf(e,s);this.reserve(s),r.copyTo(t,this.offset),this.offset+=s}finalize(){return this.flush(),Object.freeze(this.pieces),Object.freeze(this),this}copyTo(e,t=0){const n=new Uint8Array(e);for(const e of this.pieces)n.set(e,t),t+=e.length}toBuffer(){const e=new ArrayBuffer(this.byteLength);return this.copyTo(e),e}reserve(e){if(this.offset<this.buffer.byteLength-e)return this.dataView;this.flush();const t=Math.max(this.byteLength,e);return this.offset=0,this.buffer=new ArrayBuffer(t),this.dataView=new DataView(this.buffer)}flush(){const{offset:e}=this;this.pieces.push(new Uint8Array(this.dataView.buffer,0,e)),this.byteLength+=e}}function $C(e,t){if(e<232)t.writeUint8(e);else if(e<65536)t.writeUint8(232),t.writeUint16(e);else{if(!(e<4294967296))throw new Error(`max length exceeded: ${e}`);t.writeUint8(233),t.writeUint32(e)}}class LC{fromJsonCode(e,t){return this.fromJson(JSON.parse(e),t)}fromBytes(e,t){const n=new _C(e,t);return n.offset=4,this.decode(n)}toJsonCode(e,t){const n="readable"===t?" ":void 0;return JSON.stringify(this.toJson(e,t),void 0,n)}toBytes(e){const t=new RC;return t.putUtf8String("skir"),this.encode(e,t),t.finalize()}isDefault(e){return!e}get typeDescriptor(){return this}asJson(){const e={};this.addRecordDefinitionsTo(e);return{type:this.typeSignature,records:Object.values(e)}}asJsonCode(){return JSON.stringify(this.asJson(),void 0," ")}transform(e,t){const n=e instanceof ArrayBuffer?this.fromBytes(e):this.fromJson(e);return"bytes"===t?this.toBytes(n).toBuffer():this.toJson(n,t)}}const zC={name:"UNKNOWN",number:0};class FC extends LC{constructor(){super(...arguments),this.kind="primitive"}get typeSignature(){return{kind:"primitive",value:this.primitive}}addRecordDefinitionsTo(e){}}const jC=new class extends FC{constructor(){super(...arguments),this.primitive="int32",this.defaultValue=0}toJson(e){return 0|e}fromJson(e){return 0|+e}encode(e,t){e<0?e>=-256?(t.writeUint8(235),t.writeUint8(e+256)):e>=-65536?(t.writeUint8(236),t.writeUint16(e+65536)):(t.writeUint8(237),t.writeInt32(e>=-2147483648?e:-2147483648)):e<232?t.writeUint8(e):e<65536?(t.writeUint8(232),t.writeUint16(e)):(t.writeUint8(233),t.writeUint32(e<=2147483647?e:2147483647))}decode(e){return 0|Number(BC(e))}};class WC extends FC{constructor(){super(...arguments),this.defaultValue=0}toJson(e){if(Number.isFinite(e))return e;if("number"==typeof e)return e.toString();throw new TypeError}fromJson(e){return+e}decode(e){return Number(BC(e))}isDefault(e){return 0===e}}class UC extends FC{constructor(){super(...arguments),this.defaultValue=BigInt(0)}fromJson(e){try{return BigInt(e)}catch(t){if("number"==typeof e)return BigInt(Math.round(e));throw t}}}const VC=BigInt("-9223372036854775808"),HC=BigInt("9223372036854775807");const qC=BigInt("18446744073709551615");class KC{constructor(e,t,n,i,s){this.name=e,this.property=t,this.number=n,this.serializer=i,this.doc=s}get type(){return this.serializer.typeDescriptor}get(e){return Reflect.get(e,this.property)}set(e,t){Reflect.set(e,this.property,t)}}const JC=new TextEncoder,ZC=new TextDecoder;class YC extends LC{constructor(e,t){super(),this.itemSerializer=e,this.keyExtractor=t,this.kind="array",this.defaultValue=hA}toJson(e,t){return e.map(e=>this.itemSerializer.toJson(e,t))}fromJson(e,t){return 0===e?hA:cA(e.map(e=>this.itemSerializer.fromJson(e,t)))}encode(e,t){const{length:n}=e;n<=3?t.writeUint8(246+n):(t.writeUint8(250),$C(n,t));const{itemSerializer:i}=this;for(let n=0;n<e.length;++n)i.encode(e[n],t)}decode(e){const t=e.readUint8();if(0===t||246===t)return hA;const n=250===t?BC(e):t-246,{itemSerializer:i}=this,s=new Array(n);for(let t=0;t<n;++t)s[t]=i.decode(e);return cA(s)}isDefault(e){return!e.length}get itemType(){return this.itemSerializer.typeDescriptor}get typeSignature(){return{kind:"array",value:{item:this.itemSerializer.typeSignature,key_extractor:this.keyExtractor}}}addRecordDefinitionsTo(e){this.itemSerializer.addRecordDefinitionsTo(e)}}class GC extends LC{constructor(e){super(),this.otherSerializer=e,this.kind="optional",this.defaultValue=null}toJson(e,t){return null!==e?this.otherSerializer.toJson(e,t):null}fromJson(e,t){return null!==e?this.otherSerializer.fromJson(e,t):null}encode(e,t){null===e?t.writeUint8(255):this.otherSerializer.encode(e,t)}decode(e){return 255===e.dataView.getUint8(e.offset)?(++e.offset,null):this.otherSerializer.decode(e)}isDefault(e){return null===e}get otherType(){return this.otherSerializer.typeDescriptor}get typeSignature(){return{kind:"optional",value:this.otherSerializer.typeSignature}}addRecordDefinitionsTo(e){this.otherSerializer.addRecordDefinitionsTo(e)}}const QC={bool:new class extends FC{constructor(){super(...arguments),this.primitive="bool",this.defaultValue=!1}toJson(e,t){return"readable"===t?!!e:e?1:0}fromJson(e){return!!e&&"0"!==e}encode(e,t){t.writeUint8(e?1:0)}decode(e){return!!BC(e)}},int32:jC,int64:new class extends UC{constructor(){super(...arguments),this.primitive="int64"}toJson(e){if(-9007199254740991<=e&&e<=9007199254740991)return Number(e);const t=BigInt(e).toString();return t.length<=18?t:e<VC?VC.toString():e<HC?t:HC.toString()}encode(e,t){e?-2147483648<=e&&e<=2147483647?jC.encode(Number(e),t):(t.writeUint8(238),t.writeInt64(e<VC?VC:e<HC?e:HC)):t.writeUint8(0)}decode(e){return PC(e)}},hash64:new class extends UC{constructor(){super(...arguments),this.primitive="hash64"}toJson(e){return e<=9007199254740991?e<=0?0:Number(e):(e=BigInt(e),qC<e?qC.toString():e.toString())}encode(e,t){e<232?t.writeUint8(e<=0?0:Number(e)):e<4294967296?e<65536?(t.writeUint8(232),t.writeUint16(Number(e))):(t.writeUint8(233),t.writeUint32(Number(e))):(t.writeUint8(234),t.writeHash64(e<=qC?e:qC))}decode(e){return PC(e)}},float32:new class extends WC{constructor(){super(...arguments),this.primitive="float32"}encode(e,t){0===e?t.writeUint8(0):(t.writeUint8(240),t.writeFloat32(e))}},float64:new class extends WC{constructor(){super(...arguments),this.primitive="float64"}encode(e,t){0===e?t.writeUint8(0):(t.writeUint8(241),t.writeFloat64(e))}},timestamp:new class extends FC{constructor(){super(...arguments),this.primitive="timestamp",this.defaultValue=MC.UNIX_EPOCH}toJson(e,t){return"readable"===t?{unix_millis:e.unixMillis,formatted:e.toDate().toISOString()}:e.unixMillis}fromJson(e){return MC.fromUnixMillis("number"==typeof e?e:"string"==typeof e?+e:e.unix_millis)}encode(e,t){const{unixMillis:n}=e;n?(t.writeUint8(239),t.writeInt64(BigInt(n))):t.writeUint8(0)}decode(e){const t=BC(e);return MC.fromUnixMillis(Number(t))}isDefault(e){return!e.unixMillis}},string:new class extends FC{constructor(){super(...arguments),this.primitive="string",this.defaultValue=""}toJson(e){if("string"==typeof e)return e;throw this.newTypeError(e)}fromJson(e){if("string"==typeof e)return e;if(0===e)return"";throw this.newTypeError(e)}encode(e,t){if(!e)return void t.writeUint8(242);t.writeUint8(243);const n=3*e.length;n<232?t.writeUint8(0):n<65536?(t.writeUint8(232),t.writeUint16(0)):(t.writeUint8(233),t.writeUint32(0));const{dataView:i,offset:s}=t,r=t.putUtf8String(e);n<232?i.setUint8(s-1,r):n<65536?i.setUint16(s-2,r,!0):i.setUint32(s-4,r,!0)}decode(e){const t=e.readUint8();if(0===t||242===t)return"";const n=BC(e);return ZC.decode(new Uint8Array(e.buffer,(e.offset+=n)-n,n))}newTypeError(e){return new TypeError("expected: string; actual: "+typeof e)}},bytes:new class extends FC{constructor(){super(...arguments),this.primitive="bytes",this.defaultValue=EC.EMPTY}toJson(e,t){return"readable"===t?"hex:"+e.toBase16():e.toBase64()}fromJson(e){if(0===e)return EC.EMPTY;const t=e;return t.startsWith("hex:")?EC.fromBase16(t.substring(4)):EC.fromBase64(t)}encode(e,t){const{byteLength:n}=e;n?(t.writeUint8(245),$C(n,t),t.putBytes(e)):t.writeUint8(244)}decode(e){const t=e.readUint8();if(0===t||244===t)return EC.EMPTY;const n=BC(e);return EC.sliceOf(e.buffer,e.offset,e.offset+=n)}isDefault(e){return!e.byteLength}}};function XC(e){const t=e.readUint8();if(!(t<232))switch(t-232){case 0:case 4:e.offset+=2;break;case 1:case 5:case 8:e.offset+=4;break;case 2:case 6:case 7:case 9:e.offset+=8;break;case 3:++e.offset;break;case 11:case 13:{const t=BC(e);e.offset+=t;break}case 15:case 19:case 20:case 21:case 22:XC(e);break;case 16:XC(e),XC(e);break;case 17:XC(e),XC(e),XC(e);break;case 18:{const t=BC(e);for(let n=0;n<t;++n)XC(e);break}}}class eA extends LC{constructor(){super(...arguments),this.token=Symbol(),this.name="",this.modulePath="",this.doc="",this.removedNumbers=new Set}init(e,t,n,i,s,r){this.name=e,this.modulePath=t,this.parentType=n,this.doc=i,this.removedNumbers=new Set(r),this.registerFieldsOrVariants(s),this.initialized=!0,aA(this)}get qualifiedName(){const{name:e,parentType:t}=this;return t?`${t.name}.${e}`:e}addRecordDefinitionsTo(e){const t=`${this.modulePath}:${this.qualifiedName}`;if(e[t])return;const n=this.makeRecordDefinition(t);this.doc&&(n.doc=this.doc),this.removedNumbers.size&&(n.removed_numbers=[...this.removedNumbers]),e[t]=n;for(const t of this.dependencies())t.addRecordDefinitionsTo(e)}}class tA{constructor(e,t,n,i){this.token=e,this.totalSlots=t,this.json=n,this.bytes=i,Object.freeze(this)}}class nA extends eA{constructor(e,t,n){super(),this.defaultValue=e,this.createFn=t,this.newMutableFn=n,this.kind="struct",this.fields=[],this.fieldMapping={},this.reversedFields=[],this.slots=[],this.recognizedSlots=0,this.zeros=[],this.initializerTemplate={}}toJson(e,t){if(e===this.defaultValue)return"readable"===t?{}:[];if("readable"===t){const{fields:n}=this,i={};for(const s of n){const{serializer:n}=s,r=e[s.property];s.serializer.isDefault(r)||(i[s.name]=n.toJson(r,t))}return i}{const{slots:n}=this;let i;const s=e["^"];if(s&&s.json&&s.token===this.token){i=this.zeros.concat(s.json);for(const n of this.fields)i[n.number]=n.serializer.toJson(e[n.property],t)}else{i=[];const s=this.getArrayLength(e);for(let r=0;r<s;++r){const s=n[r];i[r]=s?s.serializer.toJson(e[s.property],t):0}}return i}}fromJson(e,t){if(!e)return this.defaultValue;const n=Object.assign({},this.initializerTemplate);if(e instanceof Array){const{slots:i,recognizedSlots:s}=this;if(e.length>s){if(t){const t=new tA(this.token,e.length,oA(e.slice(s)));n["^"]=t}e=e.slice(0,s)}for(let s=0;s<e.length&&s<i.length;++s){const r=i[s];r&&(n[r.property]=r.serializer.fromJson(e[s],t))}return this.createFn(n)}if(e instanceof Object){const{fieldMapping:i}=this;for(const s in e){const r=i[s];r&&(n[r.property]=r.serializer.fromJson(e[s],t))}return this.createFn(n)}throw TypeError()}encode(e,t){let n,i,s;const r=e["^"];r&&r.bytes&&r.token===this.token?(n=r.totalSlots,i=this.recognizedSlots,s=r.bytes):n=i=this.getArrayLength(e),n<=3?t.writeUint8(246+n):(t.writeUint8(250),$C(n,t));const{slots:o}=this;for(let n=0;n<i;++n){const i=o[n];i?i.serializer.encode(e[i.property],t):t.writeUint8(0)}s&&t.putBytes(s)}decode(e){const t=e.readUint8();if(0===t||246===t)return this.defaultValue;const n=Object.assign({},this.initializerTemplate),i=250===t?BC(e):t-246,{slots:s,recognizedSlots:r}=this;for(let t=0;t<i&&t<r;++t){const i=s[t];i?n[i.property]=i.serializer.decode(e):XC(e)}if(i>r){const t=e.offset;for(let t=r;t<i;++t)XC(e);if(e.keepUnrecognizedValues){const s=e.offset,r=EC.sliceOf(e.buffer,t,s),o=new tA(this.token,i,void 0,r);n["^"]=o}}return this.createFn(n)}getArrayLength(e){const{reversedFields:t}=this;for(let n=0;n<t.length;++n){const i=t[n];if(!i.serializer.isDefault(e[i.property]))return i.number+1}return 0}isDefault(e){return e===this.defaultValue||!e["^"]&&this.fields.every(t=>t.serializer.isDefault(e[t.property]))}get typeSignature(){return{kind:"record",value:`${this.modulePath}:${this.qualifiedName}`}}getField(e){return this.fieldMapping[e]}newMutable(e){return this.newMutableFn(e)}registerFieldsOrVariants(e){for(const t of e){const{name:e,number:n,property:i}=t;this.fields.push(t),this.slots[n]=t,this.fieldMapping[e]=t,this.fieldMapping[i]=t,this.fieldMapping[n]=t,this.initializerTemplate[i]=this.defaultValue[t.property]}this.recognizedSlots=Math.max(this.slots.length-1,...this.removedNumbers)+1,this.zeros.push(...Array(this.recognizedSlots).fill(0)),this.reversedFields=[...this.fields].sort((e,t)=>t.number-e.number)}makeRecordDefinition(e){return{kind:"struct",id:e,doc:void 0,fields:this.fields.map(e=>({name:e.name,number:e.number,type:e.serializer.typeSignature,doc:gA(e.doc)}))}}dependencies(){return this.fields.map(e=>e.serializer)}}class iA{constructor(e,t,n){this.token=e,this.json=t,this.bytes=n,Object.freeze(this)}}class sA{constructor(e,t,n,i,s){this.name=e,this.number=t,this.serializer=n,this.doc=i,this.createFn=s}get type(){return this.serializer.typeDescriptor}get(e){return e.kind===this.name?e.value:void 0}wrap(e){return this.createFn({kind:this.name,value:e})}}class rA extends eA{constructor(e){super(),this.createFn=e,this.kind="enum",this.variants=[],this.variantMapping={},this.defaultValue=e("UNKNOWN")}toJson(e,t){const n=e["^"],i=e.kind;if("UNKNOWN"===i&&n&&n.json&&n.token===this.token)return n.json;if("UNKNOWN"===i)return"readable"===t?"UNKNOWN":0;const s=this.variantMapping[i],{serializer:r}=s;if(r){const n=e.value;return"readable"===t?{kind:s.name,value:r.toJson(n,t)}:[s.number,r.toJson(n,t)]}return"readable"===t?s.name:s.number}fromJson(e,t){const n="number"==typeof e;if(n||"string"==typeof e){const i=this.variantMapping[n?e:String(e)];return i?i.serializer?i.wrap(i.serializer.defaultValue):i.constant:!t||n&&this.removedNumbers.has(e)?this.defaultValue:this.createFn(new iA(this.token,oA(e)))}let i,s;if(e instanceof Array)i=e[0],s=e[1];else{if(!(e instanceof Object))throw TypeError();i=e.kind,s=e.value}const r=this.variantMapping[i];if(!r)return!t||"number"==typeof i&&this.removedNumbers.has(i)?this.defaultValue:this.createFn(new iA(this.token,oA(e),void 0));const{serializer:o}=r;return o?r.wrap(o.fromJson(s,t)):r.constant}encode(e,t){const n=e["^"],i=e.kind;if("UNKNOWN"===i&&n&&n.bytes&&n.token===this.token)return void t.putBytes(n.bytes);if("UNKNOWN"===i)return void t.writeUint8(0);const s=this.variantMapping[i],{number:r,serializer:o}=s;if(o){const n=e.value;r<5?t.writeUint8(250+r):(t.writeUint8(248),$C(r,t)),o.encode(n,t)}else $C(r,t)}decode(e){const t=e.offset,n=e.dataView.getUint8(t);if(n<242){const n=BC(e),i=this.variantMapping[n];if(!i){if(!e.keepUnrecognizedValues||this.removedNumbers.has(n))return this.defaultValue;{const{offset:n}=e,i=EC.sliceOf(e.buffer,t,n);return this.createFn(new iA(this.token,void 0,i))}}return i.serializer?i.wrap(i.serializer.defaultValue):i.constant}{++e.offset;const i=248===n?BC(e):n-250,s=this.variantMapping[i];if(!s){if(XC(e),!e.keepUnrecognizedValues||this.removedNumbers.has(i))return this.defaultValue;{const{offset:n}=e,i=EC.sliceOf(e.buffer,t,n);return this.createFn(new iA(this.token,void 0,i))}}const{serializer:r}=s;return r?s.wrap(r.decode(e)):(XC(e),s.constant)}}get typeSignature(){return{kind:"record",value:`${this.modulePath}:${this.qualifiedName}`}}isDefault(e){return"UNKNOWN"===e.kind&&!e["^"]}getVariant(e){return this.variantMapping[e]}registerFieldsOrVariants(e){for(const t of e){if(this.variants.push(t),this.variantMapping[t.name]=t,void 0===t.serializer){const e=t.name.toUpperCase();e!==t.name&&(this.variantMapping[e]=t);const n=t.name.toLowerCase();n!==t.name&&(this.variantMapping[n]=t)}this.variantMapping[t.number]=t}}makeRecordDefinition(e){return{kind:"enum",id:e,doc:void 0,variants:this.variants.filter(e=>e.number).map(e=>{var t;const n={name:e.name,number:e.number,doc:gA(e.doc)},i=null===(t=null==e?void 0:e.serializer)||void 0===t?void 0:t.typeSignature;return i?Object.assign(Object.assign({},n),{type:i}):n})}}dependencies(){const e=[];for(const t of this.variants)t.serializer&&e.push(t.serializer);return e}}function oA(e){return e instanceof Array?Object.freeze(e.map(oA)):e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map((e,t)=>[e,oA(t)]))):e}function aA(e){if(e instanceof Object&&!(e instanceof fA||e instanceof pA)&&(!(e instanceof eA)||e.initialized)&&!Object.isFrozen(e)){Object.freeze(e);for(const t of Object.values(e))aA(t)}}const lA=new WeakMap;function cA(e){return lA.has(e)||lA.set(Object.freeze(e),{}),e}const hA=cA([]),uA=Symbol();function dA(e){const t=Object.getPrototypeOf(e).constructor,{qualifiedName:n}=t.serializer;return Error(["Do not call the constructor directly; ",`instead, call ${n}.create(...)`].join(""))}class fA{constructor(e){if(e!==uA)throw dA(this)}toMutable(){return new(Object.getPrototypeOf(this).constructor.Mutable)(this)}toFrozen(){return this}toString(){return mA(this)}}class pA{constructor(e,t,n,i){if(e!==uA)throw dA(this);if(this.kind=t,this.value=n,i){if(!(i instanceof iA))throw new TypeError;this["^"]=i}Object.freeze(this)}toString(){return mA(this)}}function mA(e){return Object.getPrototypeOf(e).constructor.serializer.toJsonCode(e,"readable")}function gA(e){return e||void 0}function bA(){return bA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},bA.apply(null,arguments)}Object.defineProperty(pA.prototype,"union",{get:function(){return this}});var yA=e=>{var{theme:t,settings:n={},styles:i=[]}=e,s={".cm-gutters":{}},r={};n.background&&(r.backgroundColor=n.background),n.backgroundImage&&(r.backgroundImage=n.backgroundImage),n.foreground&&(r.color=n.foreground),n.fontSize&&(r.fontSize=n.fontSize),(n.background||n.foreground)&&(s["&"]=r),n.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(s[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(s[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(s[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(s[".cm-content"]={caretColor:n.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var o={};return n.gutterActiveForeground&&(o.color=n.gutterActiveForeground),n.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:n.lineHighlight},o.backgroundColor=n.lineHighlight),s[".cm-activeLineGutter"]=o,n.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch}),[Uo.theme(s,{dark:"dark"===t}),Wc(Lc.define(i))]},vA={background:"#0f0f0f",foreground:"#defdef",caret:"#00FF00",selection:"#515151",selectionMatch:"#515151",gutterBackground:"#555",gutterForeground:"#FFFFFF",lineHighlight:"#0a6bcb3d"},kA=[{tag:Te.keyword,color:"darkgoldenrod",fontWeight:"bold"},{tag:Te.atom,color:"#77F"},{tag:Te.comment,color:"#7a7b7c",fontStyle:"italic"},{tag:Te.number,color:"violet"},{tag:Te.definition(Te.variableName),color:"#fffabc"},{tag:Te.variableName,color:"#abcdef"},{tag:Te.function(Te.variableName),color:"#fffabc"},{tag:Te.typeName,color:"#FFDD44"},{tag:Te.tagName,color:"#def"},{tag:Te.string,color:"#2b4"},{tag:Te.meta,color:"#C9F"},{tag:Te.bracket,color:"#8a8a8a"},{tag:Te.attributeName,color:"#DDFF00"},{tag:Te.heading,color:"aquamarine",fontWeight:"bold"},{tag:Te.link,color:"blueviolet",fontWeight:"bold"}],wA=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},vA,t),styles:[...kA,...n]})})(),xA="#000c18",SA="#6688cc",CA="#770811",AA="#770811",TA="#ddbb88",NA="#0055ff30",OA="#225588",MA="#2277ff",EA="#9966b8",DA="#22aa44",_A="#f280d0",IA="#9966b8",BA="#ddbb88",PA="#f280d0",RA="#384887",$A="#6688cc",LA="#A22D44",zA="#22aa44",FA="#225588",jA={background:xA,foreground:SA,caret:TA,selection:CA,selectionMatch:AA,gutterBackground:xA,gutterForeground:SA,lineHighlight:NA},WA=[{tag:Te.keyword,color:OA},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:MA},{tag:[Te.propertyName],color:EA},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:DA},{tag:[Te.function(Te.variableName),Te.labelName],color:EA},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:_A},{tag:[Te.definition(Te.name),Te.separator],color:MA},{tag:[Te.className],color:BA},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:PA},{tag:[Te.typeName],color:IA,fontStyle:IA},{tag:[Te.operator,Te.operatorKeyword],color:OA},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:zA},{tag:[Te.meta,Te.comment],color:RA},{tag:Te.tagName,color:FA},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:$A},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:MA},{tag:Te.invalid,color:LA},{tag:Te.strikethrough,textDecoration:"line-through"}],UA=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},jA,t),styles:[...WA,...n]})})(),VA={background:"#282b2e",foreground:"#a9b7c6",caret:"#00FF00",selection:"#4e5254",selectionMatch:"#4e5254",lineHighlight:"#7f85891f"},HA=[{tag:[Te.keyword,Te.deleted,Te.className],color:"#cc7832"},{tag:[Te.number,Te.literal,Te.derefOperator],color:"#6897bb"},{tag:[Te.link,Te.variableName],color:"#629755"},{tag:[Te.comment,Te.quote],color:"grey"},{tag:[Te.meta,Te.documentMeta],color:"#bbb529"},{tag:[Te.string,Te.propertyName,Te.attributeValue],color:"#6a8759"},{tag:[Te.heading,Te.typeName],color:"#ffc66d"},{tag:[Te.attributeName],color:"#a9b7c6"},{tag:[Te.emphasis],fontStyle:"italic"}],qA=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},VA,t),styles:[...HA,...n]})})(),KA="#23262E",JA="#D5CED9",ZA="#db45a280",YA="#db45a280",GA="#FFF",QA="#596a992e",XA="#c74ded",eT="#00e8c6",tT="#FFE66D",nT="#96E072",iT="#ee5d43",sT="#FFE66D",rT="#FFE66D",oT="#ee5d43",aT="#A0A1A7cc",lT="#ff00aa",cT=null,hT="#96E072",uT="#f92672",dT={background:KA,foreground:JA,caret:GA,selection:ZA,selectionMatch:YA,gutterBackground:KA,gutterForeground:JA,lineHighlight:QA},fT=[{tag:Te.keyword,color:XA},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:eT},{tag:[Te.propertyName],color:tT},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:nT},{tag:[Te.function(Te.variableName),Te.labelName],color:tT},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:iT},{tag:[Te.definition(Te.name),Te.separator],color:eT},{tag:[Te.className],color:rT},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:oT},{tag:[Te.typeName],color:sT,fontStyle:sT},{tag:[Te.operator],color:XA},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:hT},{tag:[Te.meta,Te.comment],color:aT},{tag:Te.tagName,color:uT},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:lT},{tag:[Te.atom,Te.special(Te.variableName)],color:eT},{tag:Te.invalid,color:cT},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.operatorKeyword,Te.bool,Te.null,Te.variableName],color:iT}],pT=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},dT,t),styles:[...fT,...n]})})(),mT={background:"#272C35",foreground:"#9d9b97",caret:"#797977",selection:"#3d4c64",selectionMatch:"#3d4c64",gutterBackground:"#272C35",gutterForeground:"#465063",gutterBorder:"transparent",lineHighlight:"#2e3f5940"},gT=[{tag:[Te.function(Te.variableName),Te.function(Te.propertyName),Te.url,Te.processingInstruction],color:"hsl(207, 82%, 66%)"},{tag:[Te.tagName,Te.heading],color:"#e06c75"},{tag:Te.comment,color:"#54636D"},{tag:[Te.propertyName],color:"hsl(220, 14%, 71%)"},{tag:[Te.attributeName,Te.number],color:"hsl( 29, 54%, 61%)"},{tag:Te.className,color:"hsl( 39, 67%, 69%)"},{tag:Te.keyword,color:"hsl(286, 60%, 67%)"},{tag:[Te.string,Te.regexp,Te.special(Te.propertyName)],color:"#98c379"}],bT=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},mT,t),styles:[...gT,...n]})})(),yT={background:"#21202e",foreground:"#edecee",caret:"#a277ff",selection:"#5a51898f",selectionMatch:"#5a51898f",gutterBackground:"#21202e",gutterForeground:"#edecee",gutterBorder:"transparent",lineHighlight:"#a394f033"},vT=[{tag:Te.keyword,color:"#a277ff"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#edecee"},{tag:[Te.propertyName],color:"#ffca85"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#61ffca"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#ffca85"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#61ffca"},{tag:[Te.definition(Te.name),Te.separator],color:"#edecee"},{tag:[Te.className],color:"#82e2ff"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#61ffca"},{tag:[Te.typeName],color:"#82e2ff"},{tag:[Te.operator,Te.operatorKeyword],color:"#a277ff"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#61ffca"},{tag:[Te.meta,Te.comment],color:"#6d6d6d"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#a277ff"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#edecee"},{tag:Te.invalid,color:"#ff6767"},{tag:Te.strikethrough,textDecoration:"line-through"}],kT=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},yT,t),styles:[...vT,...n]})})(),wT={background:"#2E3235",foreground:"#DDDDDD",caret:"#DDDDDD",selection:"#202325",selectionMatch:"#202325",gutterBackground:"#292d30",gutterForeground:"#808080",gutterBorder:"1px solid #ffffff10",lineHighlight:"#B9D2FF30"},xT=[{tag:Te.keyword,color:"#fda331"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#b5bd68"},{tag:[Te.variableName],color:"#6fb3d2"},{tag:[Te.function(Te.variableName)],color:"#fda331"},{tag:[Te.labelName],color:"#fc6d24"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#fda331"},{tag:[Te.definition(Te.name),Te.separator],color:"#cc99cc"},{tag:[Te.brace],color:"#cc99cc"},{tag:[Te.annotation],color:"#fc6d24"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#fda331"},{tag:[Te.typeName,Te.className],color:"#6fb3d2"},{tag:[Te.operator,Te.operatorKeyword],color:"#cc99cc"},{tag:[Te.tagName],color:"#fda331"},{tag:[Te.squareBracket],color:"#cc99cc"},{tag:[Te.angleBracket],color:"#cc99cc"},{tag:[Te.attributeName],color:"#6fb3d2"},{tag:[Te.regexp],color:"#fda331"},{tag:[Te.quote],color:"#DDDDDD"},{tag:[Te.string],color:"#b5bd68"},{tag:Te.link,color:"#6987AF",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#8abeb7"},{tag:[Te.meta],color:"#A54543"},{tag:[Te.comment],color:"#808080",fontStyle:"italic"},{tag:Te.monospace,color:"#DDDDDD"},{tag:Te.strong,fontWeight:"bold",color:"#fda331"},{tag:Te.emphasis,fontStyle:"italic",color:"#6fb3d2"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#DDDDDD"},{tag:Te.special(Te.heading1),fontWeight:"bold",color:"#DDDDDD"},{tag:Te.heading1,fontWeight:"bold",color:"#DDDDDD"},{tag:[Te.heading2,Te.heading3,Te.heading4],fontWeight:"bold",color:"#DDDDDD"},{tag:[Te.heading5,Te.heading6],color:"#DDDDDD"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#8abeb7"},{tag:[Te.processingInstruction,Te.inserted],color:"#8abeb7"},{tag:[Te.contentSeparator],color:"#6fb3d2"},{tag:Te.invalid,color:"#B9D2FF",borderBottom:"1px dotted #fc6d24"}],ST=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},wT,t),styles:[...xT,...n]})})(),CT={background:"#ffffff",foreground:"#2e3440",caret:"#3b4252",selection:"#eceff4",selectionMatch:"#e5e9f0",gutterBackground:"#eceff4",gutterForeground:"#2e3440",gutterBorder:"none",lineHighlight:"#02255f11"},AT=[{tag:Te.keyword,color:"#5e81ac"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#d08770"},{tag:[Te.variableName],color:"#d08770"},{tag:[Te.function(Te.variableName)],color:"#5e81ac"},{tag:[Te.labelName],color:"#81a1c1"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#5e81ac"},{tag:[Te.definition(Te.name),Te.separator],color:"#a3be8c"},{tag:[Te.brace],color:"#8fbcbb"},{tag:[Te.annotation],color:"#d30102"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#88c0d0"},{tag:[Te.typeName,Te.className],color:"#ebcb8b"},{tag:[Te.operator,Te.operatorKeyword],color:"#a3be8c"},{tag:[Te.tagName],color:"#b48ead"},{tag:[Te.squareBracket],color:"#bf616a"},{tag:[Te.angleBracket],color:"#d08770"},{tag:[Te.attributeName],color:"#ebcb8b"},{tag:[Te.regexp],color:"#5e81ac"},{tag:[Te.quote],color:"#3b4252"},{tag:[Te.string],color:"#d08770"},{tag:Te.link,color:"#8fbcbb",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#d08770"},{tag:[Te.meta],color:"#88c0d0"},{tag:[Te.comment],color:"#434c5e",fontStyle:"italic"},{tag:Te.strong,fontWeight:"bold",color:"#5e81ac"},{tag:Te.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#5e81ac"},{tag:Te.special(Te.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:Te.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[Te.heading2,Te.heading3,Te.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[Te.heading5,Te.heading6],color:"#5e81ac"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#d08770"},{tag:[Te.processingInstruction,Te.inserted],color:"#8fbcbb"},{tag:[Te.contentSeparator],color:"#ebcb8b"},{tag:Te.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}],TT=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},CT,t),styles:[...AT,...n]})})(),NT={background:"#FFFFFF",foreground:"#000000",caret:"#FBAC52",selection:"#FFD420",selectionMatch:"#FFD420",gutterBackground:"#f5f5f5",gutterForeground:"#4D4D4C",gutterBorder:"transparent",lineHighlight:"#00000012"},OT=[{tag:[Te.meta,Te.comment],color:"#804000"},{tag:[Te.keyword,Te.strong],color:"#0000FF"},{tag:[Te.number],color:"#FF0080"},{tag:[Te.string],color:"#FF0080"},{tag:[Te.variableName],color:"#006600"},{tag:[Te.escape],color:"#33CC33"},{tag:[Te.tagName],color:"#1C02FF"},{tag:[Te.heading],color:"#0C07FF"},{tag:[Te.quote],color:"#000000"},{tag:[Te.list],color:"#B90690"},{tag:[Te.documentMeta],color:"#888888"},{tag:[Te.function(Te.variableName)],color:"#0000A2"},{tag:[Te.definition(Te.typeName),Te.typeName],color:"#6D79DE"}],MT=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},NT,t),styles:[...OT,...n]})})(),ET={background:"#28211c",foreground:"#9d9b97",caret:"#797977",selection:"#4f382b",selectionMatch:"#4f382b",gutterBackground:"#28211c",gutterForeground:"#666666",lineHighlight:"#ffffff1a"},DT=[{tag:[Te.atom,Te.number,Te.link,Te.bool],color:"#9b859d"},{tag:Te.comment,color:"#937121"},{tag:[Te.keyword,Te.tagName],color:"#cf6a4c"},{tag:Te.string,color:"#f9ee98"},{tag:Te.bracket,color:"#9d9b97"},{tag:[Te.variableName],color:"#5ea6ea"},{tag:Te.definition(Te.variableName),color:"#cf7d34"},{tag:[Te.function(Te.variableName),Te.className],color:"#cf7d34"},{tag:[Te.propertyName,Te.attributeName],color:"#54be0d"}],_T=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},ET,t),styles:[...DT,...n]})})(),IT={background:"#000",foreground:"#fff",caret:"#fff",selection:"#5c6c9b",selectionMatch:"#2a3967",gutterBackground:"#000",gutterForeground:"#ada9a9",gutterActiveForeground:"#fff",lineHighlight:"#82828275"},BT=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},IT,t),styles:[...n]})})(),PT={background:"#fff",foreground:"#000",caret:"#000",selection:"#c2d2ff",selectionMatch:"#b1c1ef",gutterBackground:"#fff",gutterForeground:"#ada9a9",gutterActiveForeground:"#000",lineHighlight:"#c7c5c575"},RT=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},PT,t),styles:[...n]})})(),$T="#232a2f",LT="#939da5",zT="#204062",FT="#204062",jT="#939da5",WT="#4469832b",UT="#ba8ef7",VT="#939da5",HT="#ffea6b",qT="#5bec95",KT="#939da5",JT="#89ddff",ZT="#ffea6b",YT="#89ddff",GT="#707a84",QT="#5bec95",XT="#ff6a80",eN="#56adb7",tN="#ff6a80",nN={background:$T,foreground:LT,caret:jT,selection:zT,selectionMatch:FT,gutterBackground:$T,gutterForeground:LT,lineHighlight:WT},iN=[{tag:Te.keyword,color:UT},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:VT},{tag:[Te.propertyName],color:HT},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:qT},{tag:[Te.function(Te.variableName),Te.labelName],color:HT},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:KT},{tag:[Te.definition(Te.name),Te.separator],color:VT},{tag:[Te.className],color:ZT},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:YT},{tag:[Te.typeName],color:JT,fontStyle:JT},{tag:[Te.operator],color:UT},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:eN},{tag:[Te.meta,Te.comment],color:GT},{tag:Te.tagName,color:tN},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:QT},{tag:[Te.atom,Te.special(Te.variableName)],color:VT},{tag:Te.invalid,color:XT},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.operatorKeyword,Te.bool,Te.null,Te.variableName],color:KT}],sN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},nN,t),styles:[...iN,...n]})})(),rN={background:"#2B2B2B",foreground:"#f8f8f2",caret:"#FFFFFF",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"rgba(255, 255, 255, 0.1)",gutterForeground:"#999",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},oN=[{tag:[Te.atom,Te.number],color:"#bd93f9"},{tag:[Te.comment],color:"#61A151"},{tag:[Te.string],color:"#6A8759"},{tag:[Te.variableName,Te.operator],color:"#A9B7C6"},{tag:[Te.meta,Te.className],color:"#A9B7C6"},{tag:[Te.propertyName],color:"#FFC66D"},{tag:[Te.keyword],color:"#CC7832"},{tag:[Te.tagName],color:"#ff79c6"},{tag:[Te.typeName],color:"#ffb86c"}],aN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},rN,t),styles:[...oN,...n]})})(),lN={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},cN=[{tag:Te.comment,color:"#6272a4"},{tag:Te.string,color:"#f1fa8c"},{tag:Te.atom,color:"#bd93f9"},{tag:Te.meta,color:"#f8f8f2"},{tag:[Te.keyword,Te.operator,Te.tagName],color:"#ff79c6"},{tag:[Te.function(Te.propertyName),Te.propertyName],color:"#66d9ef"},{tag:[Te.definition(Te.variableName),Te.function(Te.variableName),Te.className,Te.attributeName],color:"#50fa7b"},{tag:Te.atom,color:"#bd93f9"}],hN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},lN,t),styles:[...cN,...n]})})(),uN={background:"#faf8f5",foreground:"#b29762",caret:"#93abdc",selection:"#e3dcce",selectionMatch:"#e3dcce",gutterBackground:"#faf8f5",gutterForeground:"#cdc4b1",gutterBorder:"transparent",lineHighlight:"#ddceb154"},dN=[{tag:[Te.comment,Te.bracket],color:"#b6ad9a"},{tag:[Te.atom,Te.number,Te.keyword,Te.link,Te.attributeName,Te.quote],color:"#063289"},{tag:[Te.emphasis,Te.heading,Te.tagName,Te.propertyName,Te.variableName],color:"#2d2006"},{tag:[Te.typeName,Te.url,Te.string],color:"#896724"},{tag:[Te.operator,Te.string],color:"#1659df"},{tag:[Te.propertyName],color:"#b29762"},{tag:[Te.unit,Te.punctuation],color:"#063289"}],fN=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},uN,t),styles:[...dN,...n]})})(),pN={background:"#2a2734",foreground:"#6c6783",caret:"#ffad5c",selection:"#91ff6c26",selectionMatch:"#91ff6c26",gutterBackground:"#2a2734",gutterForeground:"#545167",lineHighlight:"#36334280"},mN=[{tag:[Te.comment,Te.bracket],color:"#6c6783"},{tag:[Te.atom,Te.number,Te.keyword,Te.link,Te.attributeName,Te.quote],color:"#ffcc99"},{tag:[Te.emphasis,Te.heading,Te.tagName,Te.propertyName,Te.className,Te.variableName],color:"#eeebff"},{tag:[Te.typeName,Te.url],color:"#7a63ee"},{tag:Te.operator,color:"#ffad5c"},{tag:Te.string,color:"#ffb870"},{tag:[Te.propertyName],color:"#9a86fd"},{tag:[Te.unit,Te.punctuation],color:"#e09142"}],gN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},pN,t),styles:[...mN,...n]})})(),bN={background:"#fff",foreground:"#000",caret:"#FFFFFF",selection:"#d7d4f0",selectionMatch:"#d7d4f0",gutterBackground:"#f7f7f7",gutterForeground:"#999",lineHighlight:"#006fff1c",gutterBorder:"transparent"},yN=[{tag:[Te.comment],color:"#3F7F5F"},{tag:[Te.documentMeta],color:"#FF1717"},{tag:Te.keyword,color:"#7F0055",fontWeight:"bold"},{tag:Te.atom,color:"#00f"},{tag:Te.number,color:"#164"},{tag:Te.propertyName,color:"#164"},{tag:[Te.variableName,Te.definition(Te.variableName)],color:"#0000C0"},{tag:Te.function(Te.variableName),color:"#0000C0"},{tag:Te.string,color:"#2A00FF"},{tag:Te.operator,color:"black"},{tag:Te.tagName,color:"#170"},{tag:Te.attributeName,color:"#00c"},{tag:Te.link,color:"#219"}],vN=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},bN,t),styles:[...yN,...n]})})(),kN={background:"#fff",foreground:"#24292e",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#6e7781"},wN=[{tag:[Te.standard(Te.tagName),Te.tagName],color:"#116329"},{tag:[Te.comment,Te.bracket],color:"#6a737d"},{tag:[Te.className,Te.propertyName],color:"#6f42c1"},{tag:[Te.variableName,Te.attributeName,Te.number,Te.operator],color:"#005cc5"},{tag:[Te.keyword,Te.typeName,Te.typeOperator,Te.typeName],color:"#d73a49"},{tag:[Te.string,Te.meta,Te.regexp],color:"#032f62"},{tag:[Te.name,Te.quote],color:"#22863a"},{tag:[Te.heading,Te.strong],color:"#24292e",fontWeight:"bold"},{tag:[Te.emphasis],color:"#24292e",fontStyle:"italic"},{tag:[Te.deleted],color:"#b31d28",backgroundColor:"ffeef0"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#e36209"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#032f62"},{tag:Te.link,textDecoration:"underline"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.invalid,color:"#cb2431"}],xN=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},kN,t),styles:[...wN,...n]})})(),SN={background:"#0d1117",foreground:"#c9d1d9",caret:"#c9d1d9",selection:"#003d73",selectionMatch:"#003d73",lineHighlight:"#36334280"},CN=[{tag:[Te.standard(Te.tagName),Te.tagName],color:"#7ee787"},{tag:[Te.comment,Te.bracket],color:"#8b949e"},{tag:[Te.className,Te.propertyName],color:"#d2a8ff"},{tag:[Te.variableName,Te.attributeName,Te.number,Te.operator],color:"#79c0ff"},{tag:[Te.keyword,Te.typeName,Te.typeOperator,Te.typeName],color:"#ff7b72"},{tag:[Te.string,Te.meta,Te.regexp],color:"#a5d6ff"},{tag:[Te.name,Te.quote],color:"#7ee787"},{tag:[Te.heading,Te.strong],color:"#d2a8ff",fontWeight:"bold"},{tag:[Te.emphasis],color:"#d2a8ff",fontStyle:"italic"},{tag:[Te.deleted],color:"#ffdcd7",backgroundColor:"ffeef0"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#ffab70"},{tag:Te.link,textDecoration:"underline"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.invalid,color:"#f97583"}],AN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},SN,t),styles:[...CN,...n]})})(),TN={background:"#282828",foreground:"#ebdbb2",caret:"#ebdbb2",selection:"#b99d555c",selectionMatch:"#b99d555c",lineHighlight:"#baa1602b",gutterBackground:"#282828",gutterForeground:"#7c6f64"},NN=[{tag:Te.keyword,color:"#fb4934"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#8ec07c"},{tag:[Te.variableName],color:"#83a598"},{tag:[Te.function(Te.variableName)],color:"#b8bb26",fontStyle:"bold"},{tag:[Te.labelName],color:"#ebdbb2"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#d3869b"},{tag:[Te.definition(Te.name),Te.separator],color:"#ebdbb2"},{tag:[Te.brace],color:"#ebdbb2"},{tag:[Te.annotation],color:"#fb4934d"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#d3869b"},{tag:[Te.typeName,Te.className],color:"#fabd2f"},{tag:[Te.operator,Te.operatorKeyword],color:"#fb4934"},{tag:[Te.tagName],color:"#8ec07c",fontStyle:"bold"},{tag:[Te.squareBracket],color:"#fe8019"},{tag:[Te.angleBracket],color:"#83a598"},{tag:[Te.attributeName],color:"#8ec07c"},{tag:[Te.regexp],color:"#8ec07c"},{tag:[Te.quote],color:"#928374"},{tag:[Te.string],color:"#ebdbb2"},{tag:Te.link,color:"#a89984",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#d3869b"},{tag:[Te.meta],color:"#fabd2f"},{tag:[Te.comment],color:"#928374",fontStyle:"italic"},{tag:Te.strong,fontWeight:"bold",color:"#fe8019"},{tag:Te.emphasis,fontStyle:"italic",color:"#b8bb26"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#b8bb26"},{tag:[Te.heading1,Te.heading2],fontWeight:"bold",color:"#b8bb26"},{tag:[Te.heading3,Te.heading4],fontWeight:"bold",color:"#fabd2f"},{tag:[Te.heading5,Te.heading6],color:"#fabd2f"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#d3869b"},{tag:[Te.processingInstruction,Te.inserted],color:"#83a598"},{tag:[Te.contentSeparator],color:"#fb4934"},{tag:Te.invalid,color:"#fe8019",borderBottom:"1px dotted #fb4934d"}],ON=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},TN,t),styles:[...NN,...n]})})(),MN={background:"#fbf1c7",foreground:"#3c3836",caret:"#af3a03",selection:"#bdae9391",selectionMatch:"#bdae9391",lineHighlight:"#a37f2238",gutterBackground:"#ebdbb2",gutterForeground:"#665c54",gutterBorder:"transparent"},EN=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},MN,t),styles:[{tag:Te.keyword,color:"#9d0006"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#427b58"},{tag:[Te.variableName],color:"#076678"},{tag:[Te.function(Te.variableName)],color:"#79740e",fontStyle:"bold"},{tag:[Te.labelName],color:"#3c3836"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#8f3f71"},{tag:[Te.definition(Te.name),Te.separator],color:"#3c3836"},{tag:[Te.brace],color:"#3c3836"},{tag:[Te.annotation],color:"#9d0006"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#8f3f71"},{tag:[Te.typeName,Te.className],color:"#b57614"},{tag:[Te.operator,Te.operatorKeyword],color:"#9d0006"},{tag:[Te.tagName],color:"#427b58",fontStyle:"bold"},{tag:[Te.squareBracket],color:"#af3a03"},{tag:[Te.angleBracket],color:"#076678"},{tag:[Te.attributeName],color:"#427b58"},{tag:[Te.regexp],color:"#427b58"},{tag:[Te.quote],color:"#928374"},{tag:[Te.string],color:"#3c3836"},{tag:Te.link,color:"#7c6f64",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#8f3f71"},{tag:[Te.meta],color:"#b57614"},{tag:[Te.comment],color:"#928374",fontStyle:"italic"},{tag:Te.strong,fontWeight:"bold",color:"#af3a03"},{tag:Te.emphasis,fontStyle:"italic",color:"#79740e"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#79740e"},{tag:[Te.heading1,Te.heading2],fontWeight:"bold",color:"#79740e"},{tag:[Te.heading3,Te.heading4],fontWeight:"bold",color:"#b57614"},{tag:[Te.heading5,Te.heading6],color:"#b57614"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#8f3f71"},{tag:[Te.processingInstruction,Te.inserted],color:"#076678"},{tag:[Te.contentSeparator],color:"#9d0006"},{tag:Te.invalid,color:"#af3a03",borderBottom:"1px dotted #9d0006"},...n]})})(),DN="#221a0f",_N="#d3af86",IN="#84613daa",BN="#98676a",PN="#dc3958",RN="#7e602c",$N="#889b4a",LN="#f79a32",zN="#f06431",FN="#f06431",jN="#f79a32",WN="#a57a4c",UN="#8ab1b0",VN="#dc3958",HN="#7e602c",qN="#dc3958",KN={background:DN,foreground:_N,caret:"#d3af86",selection:IN,selectionMatch:IN,gutterBackground:DN,gutterForeground:_N,lineHighlight:"#5e452b52"},JN=[{tag:Te.keyword,color:BN},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:PN},{tag:[Te.propertyName],color:RN},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:$N},{tag:[Te.function(Te.variableName),Te.labelName],color:RN},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:LN},{tag:[Te.definition(Te.name),Te.separator],color:PN},{tag:[Te.className],color:FN},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:jN},{tag:[Te.typeName],color:zN,fontStyle:zN},{tag:[Te.operator,Te.operatorKeyword],color:BN},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:HN},{tag:[Te.meta,Te.comment],color:WN},{tag:Te.tagName,color:qN},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:UN},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:PN},{tag:Te.invalid,color:VN},{tag:Te.strikethrough,textDecoration:"line-through"}],ZN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},KN,t),styles:[...JN,...n]})})(),YN={background:"#2e3235",foreground:"#bdbdbd",caret:"#a0a4ae",selection:"#d7d4f063",selectionMatch:"#d7d4f063",gutterBackground:"#2e3235",gutterForeground:"#999",gutterActiveForeground:"#4f5b66",lineHighlight:"#545b6130"},GN=YN,QN=[{tag:Te.keyword,color:"#cf6edf"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#56c8d8"},{tag:[Te.propertyName],color:"#facf4e"},{tag:[Te.variableName],color:"#bdbdbd"},{tag:[Te.function(Te.variableName)],color:"#56c8d8"},{tag:[Te.labelName],color:"#cf6edf"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#facf4e"},{tag:[Te.definition(Te.name),Te.separator],color:"#fa5788"},{tag:[Te.brace],color:"#cf6edf"},{tag:[Te.annotation],color:"#ff5f52"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#ffad42"},{tag:[Te.typeName,Te.className],color:"#ffad42"},{tag:[Te.operator,Te.operatorKeyword],color:"#7186f0"},{tag:[Te.tagName],color:"#99d066"},{tag:[Te.squareBracket],color:"#ff5f52"},{tag:[Te.angleBracket],color:"#606f7a"},{tag:[Te.attributeName],color:"#bdbdbd"},{tag:[Te.regexp],color:"#ff5f52"},{tag:[Te.quote],color:"#6abf69"},{tag:[Te.string],color:"#99d066"},{tag:Te.link,color:"#56c8d8",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#facf4e"},{tag:[Te.meta],color:"#707d8b"},{tag:[Te.comment],color:"#707d8b",fontStyle:"italic"},{tag:Te.monospace,color:"#bdbdbd"},{tag:Te.strong,fontWeight:"bold",color:"#ff5f52"},{tag:Te.emphasis,fontStyle:"italic",color:"#99d066"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#facf4e"},{tag:Te.heading1,fontWeight:"bold",color:"#facf4e"},{tag:[Te.heading2,Te.heading3,Te.heading4],fontWeight:"bold",color:"#facf4e"},{tag:[Te.heading5,Te.heading6],color:"#facf4e"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#56c8d8"},{tag:[Te.processingInstruction,Te.inserted],color:"#ff5f52"},{tag:[Te.contentSeparator],color:"#56c8d8"},{tag:Te.invalid,color:"#606f7a",borderBottom:"1px dotted #ff5f52"}],XN=e=>{var{theme:t="dark",settings:n={},styles:i=[]}=e||{};return yA({theme:t,settings:bA({},YN,n),styles:[...QN,...i]})},eO=XN(),tO=XN(),nO={background:"#FAFAFA",foreground:"#90A4AE",caret:"#272727",selection:"#80CBC440",selectionMatch:"#80CBC440",gutterBackground:"#FAFAFA",gutterForeground:"#90A4AE",gutterBorder:"transparent",lineHighlight:"#CCD7DA50"},iO=[{tag:Te.keyword,color:"#39ADB5"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#90A4AE"},{tag:[Te.propertyName],color:"#6182B8"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#91B859"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#6182B8"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#39ADB5"},{tag:[Te.definition(Te.name),Te.separator],color:"#90A4AE"},{tag:[Te.className],color:"#E2931D"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#F76D47"},{tag:[Te.typeName],color:"#E2931D",fontStyle:"#E2931D"},{tag:[Te.operator,Te.operatorKeyword],color:"#39ADB5"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#91B859"},{tag:[Te.meta,Te.comment],color:"#90A4AE"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#39ADB5"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#90A4AE"},{tag:Te.invalid,color:"#E5393570"},{tag:Te.strikethrough,textDecoration:"line-through"}],sO=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},nO,t),styles:[...iO,...n]})})(),rO="#272822",oO="#f8f8f2",aO="#4a4a76",lO="#F92672",cO="#FD971F",hO="#66D9EF",uO="#E6DB74",dO="#AE81FF",fO="#66D9EF",pO="#A6E22E",mO="#AE81FF",gO="#88846f",bO="#A6E22E",yO="#F44747",vO="#E6DB74",kO="#F92672",wO={background:rO,foreground:oO,caret:"#f8f8f0",selection:aO,selectionMatch:aO,gutterBackground:rO,gutterForeground:oO,lineHighlight:"#3e3d3257"},xO=[{tag:Te.keyword,color:lO},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:cO},{tag:[Te.propertyName],color:hO},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:uO},{tag:[Te.function(Te.variableName),Te.labelName],color:hO},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:dO},{tag:[Te.definition(Te.name),Te.separator],color:cO},{tag:[Te.className],color:pO},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:mO},{tag:[Te.typeName],color:fO,fontStyle:fO},{tag:[Te.operator,Te.operatorKeyword],color:lO},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:vO},{tag:[Te.meta,Te.comment],color:gO},{tag:Te.tagName,color:kO},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:bO},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:cO},{tag:Te.invalid,color:yO},{tag:Te.strikethrough,textDecoration:"line-through"}],SO=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},wO,t),styles:[...xO,...n]})})(),CO="#1e1e1e",AO="#c5c8c6",TO="#4747a1",NO="#676867",OO="#c7444a",MO="#9872A2",EO="#D08442",DO="#8080FF",_O="#9B0000",IO="#CE6700",BO="#6089B4",PO="#9A9B99",RO="#D0B344",$O="#FF0B00",LO="#D08442",zO="#6089B4",FO={background:CO,foreground:AO,caret:"#c07020",selection:TO,selectionMatch:TO,gutterBackground:CO,gutterForeground:AO,lineHighlight:"#30303078"},jO=[{tag:Te.keyword,color:NO},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:OO},{tag:[Te.propertyName],color:MO},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:EO},{tag:[Te.function(Te.variableName),Te.labelName],color:MO},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:DO},{tag:[Te.definition(Te.name),Te.separator],color:OO},{tag:[Te.className],color:IO},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:BO},{tag:[Te.typeName],color:_O,fontStyle:_O},{tag:[Te.operator,Te.operatorKeyword],color:NO},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:LO},{tag:[Te.meta,Te.comment],color:PO},{tag:Te.tagName,color:zO},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:RO},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:OO},{tag:Te.invalid,color:$O},{tag:Te.strikethrough,textDecoration:"line-through"}],WO=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},FO,t),styles:[...jO,...n]})})(),UO={background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",selectionMatch:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#16067911"},VO=[{tag:Te.comment,color:"#9995b7"},{tag:Te.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[Te.definitionKeyword,Te.modifier],color:"#ff5792"},{tag:[Te.className,Te.tagName,Te.definition(Te.typeName)],color:"#0094f0"},{tag:[Te.number,Te.bool,Te.null,Te.special(Te.brace)],color:"#5842ff"},{tag:[Te.definition(Te.propertyName),Te.function(Te.variableName)],color:"#0095a8"},{tag:Te.typeName,color:"#b3694d"},{tag:[Te.propertyName,Te.variableName],color:"#fa8900"},{tag:Te.operator,color:"#ff5792"},{tag:Te.self,color:"#e64100"},{tag:[Te.string,Te.regexp],color:"#00b368"},{tag:[Te.paren,Te.bracket],color:"#0431fa"},{tag:Te.labelName,color:"#00bdd6"},{tag:Te.attributeName,color:"#e64100"},{tag:Te.angleBracket,color:"#9995b7"}],HO=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},UO,t),styles:[...VO,...n]})})(),qO={background:"#2e3440",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#00000073",selectionMatch:"#00000073",gutterBackground:"#2e3440",gutterForeground:"#4c566a",gutterActiveForeground:"#d8dee9",lineHighlight:"#4c566a29"},KO=[{tag:Te.keyword,color:"#5e81ac"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#88c0d0"},{tag:[Te.variableName],color:"#8fbcbb"},{tag:[Te.function(Te.variableName)],color:"#8fbcbb"},{tag:[Te.labelName],color:"#81a1c1"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#5e81ac"},{tag:[Te.definition(Te.name),Te.separator],color:"#a3be8c"},{tag:[Te.brace],color:"#8fbcbb"},{tag:[Te.annotation],color:"#d30102"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#b48ead"},{tag:[Te.typeName,Te.className],color:"#ebcb8b"},{tag:[Te.operator,Te.operatorKeyword],color:"#a3be8c"},{tag:[Te.tagName],color:"#b48ead"},{tag:[Te.squareBracket],color:"#bf616a"},{tag:[Te.angleBracket],color:"#d08770"},{tag:[Te.attributeName],color:"#ebcb8b"},{tag:[Te.regexp],color:"#5e81ac"},{tag:[Te.quote],color:"#b48ead"},{tag:[Te.string],color:"#a3be8c"},{tag:Te.link,color:"#a3be8c",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#8fbcbb"},{tag:[Te.meta],color:"#88c0d0"},{tag:[Te.monospace],color:"#d8dee9",fontStyle:"italic"},{tag:[Te.comment],color:"#4c566a",fontStyle:"italic"},{tag:Te.strong,fontWeight:"bold",color:"#5e81ac"},{tag:Te.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#5e81ac"},{tag:Te.special(Te.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:Te.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[Te.heading2,Te.heading3,Te.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[Te.heading5,Te.heading6],color:"#5e81ac"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#d08770"},{tag:[Te.processingInstruction,Te.inserted],color:"#8fbcbb"},{tag:[Te.contentSeparator],color:"#ebcb8b"},{tag:Te.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}],JO=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},qO,t),styles:[...KO,...n]})})(),ZO={background:"#272822",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#49483E",selectionMatch:"#49483E",gutterBackground:"#272822",gutterForeground:"#FFFFFF70",lineHighlight:"#0000003b"},YO=[{tag:[Te.comment,Te.documentMeta],color:"#8292a2"},{tag:[Te.number,Te.bool,Te.null,Te.atom],color:"#ae81ff"},{tag:[Te.attributeValue,Te.className,Te.name],color:"#e6db74"},{tag:[Te.propertyName,Te.attributeName],color:"#a6e22e"},{tag:[Te.variableName],color:"#9effff"},{tag:[Te.squareBracket],color:"#bababa"},{tag:[Te.string,Te.special(Te.brace)],color:"#e6db74"},{tag:[Te.regexp,Te.className,Te.typeName,Te.definition(Te.typeName)],color:"#66d9ef"},{tag:[Te.definition(Te.variableName),Te.definition(Te.propertyName),Te.function(Te.variableName)],color:"#fd971f"},{tag:[Te.keyword,Te.definitionKeyword,Te.modifier,Te.tagName,Te.angleBracket],color:"#f92672"}],GO=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},ZO,t),styles:[...YO,...n]})})(),QO="#F5F5F5",XO="#333333",eM="#C9D0D9",tM="#4B69C6",nM="#7A3E9D",iM="#AA3731",sM="#448C27",rM="#9C5D27",oM="#7A3E9D",aM="#AA3731",lM="#9C5D27",cM="#AAAAAA",hM="#AA3731",uM="#cd3131",dM="#4B69C6",fM="#4B69C6",pM={background:QO,foreground:XO,caret:"#54494B",selection:eM,selectionMatch:eM,gutterBackground:QO,gutterForeground:XO,gutterBorder:"transparent",lineHighlight:"#79ff002b"},mM=[{tag:Te.keyword,color:tM},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:nM},{tag:[Te.propertyName],color:iM},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:sM},{tag:[Te.function(Te.variableName),Te.labelName],color:iM},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:rM},{tag:[Te.definition(Te.name),Te.separator],color:nM},{tag:[Te.className],color:aM},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:lM},{tag:[Te.typeName],color:oM,fontStyle:oM},{tag:[Te.operator,Te.operatorKeyword],color:tM},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:dM},{tag:[Te.meta,Te.comment],color:cM},{tag:Te.tagName,color:fM},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:hM},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:nM},{tag:Te.invalid,color:uM},{tag:Te.strikethrough,textDecoration:"line-through"}],gM=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},pM,t),styles:[...mM,...n]})})(),bM="#390000",yM="#F8F8F8",vM="#750000",kM="#f12727ff",wM="#edef7dff",xM="#ffb454ff",SM="#edef7dff",CM="#ec0d1e",AM="#9df39fff",TM="#fec758ff",NM="#994646ff",OM="#e7c0c0ff",MM="#fec758ff",EM="#ffffffff",DM="#edef7dff",_M="#aa5507ff",IM={background:bM,foreground:yM,caret:"#970000",selection:vM,selectionMatch:vM,gutterBackground:bM,gutterForeground:yM,lineHighlight:"#ff000033"},BM=[{tag:Te.keyword,color:kM},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:wM},{tag:[Te.propertyName],color:xM},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:SM},{tag:[Te.function(Te.variableName),Te.labelName],color:xM},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:CM},{tag:[Te.definition(Te.name),Te.separator],color:wM},{tag:[Te.className],color:TM},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:NM},{tag:[Te.typeName],color:AM,fontStyle:AM},{tag:[Te.operator,Te.operatorKeyword],color:kM},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:DM},{tag:[Te.meta,Te.comment],color:OM},{tag:Te.tagName,color:_M},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:MM},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:wM},{tag:Te.invalid,color:EM},{tag:Te.strikethrough,textDecoration:"line-through"}],PM=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},IM,t),styles:[...BM,...n]})})(),RM="#002B36",$M="#839496",LM="#004454AA",zM="#859900",FM="#268BD2",jM="#268BD2",WM="#2AA198",UM="#CB4B16",VM="#859900",HM="#268BD2",qM="#D33682",KM="#586E75",JM="#268BD2",ZM="#DC322F",YM="#DC322F",GM="#268BD2",QM={background:RM,foreground:$M,caret:"#D30102",selection:LM,selectionMatch:LM,gutterBackground:RM,gutterForeground:$M,gutterBorder:"transparent",lineHighlight:"#00cafe11"},XM=[{tag:Te.keyword,color:zM},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:FM},{tag:[Te.propertyName],color:jM},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:WM},{tag:[Te.function(Te.variableName),Te.labelName],color:jM},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:UM},{tag:[Te.definition(Te.name),Te.separator],color:FM},{tag:[Te.className],color:HM},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:qM},{tag:[Te.typeName],color:VM,fontStyle:VM},{tag:[Te.operator,Te.operatorKeyword],color:zM},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:YM},{tag:[Te.meta,Te.comment],color:KM},{tag:Te.tagName,color:GM},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:JM},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:FM},{tag:Te.invalid,color:ZM},{tag:Te.strikethrough,textDecoration:"line-through"}],eE=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},QM,t),styles:[...XM,...n]})})(),tE="#FDF6E3",nE="#657B83",iE="#859900",sE="#268BD2",rE="#268BD2",oE="#2AA198",aE="#CB4B16",lE="#859900",cE="#268BD2",hE="#D33682",uE="#93A1A1",dE="#268BD2",fE="#DC322F",pE="#DC322F",mE="#268BD2",gE={background:tE,foreground:nE,caret:"#657B83",selection:"#EEE8D5",selectionMatch:"#EEE8D5",gutterBackground:tE,gutterForeground:nE,gutterBorder:"transparent",lineHighlight:"#3d392d11"},bE=[{tag:Te.keyword,color:iE},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:sE},{tag:[Te.propertyName],color:rE},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:oE},{tag:[Te.function(Te.variableName),Te.labelName],color:rE},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:aE},{tag:[Te.definition(Te.name),Te.separator],color:sE},{tag:[Te.className],color:cE},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:hE},{tag:[Te.typeName],color:lE,fontStyle:lE},{tag:[Te.operator,Te.operatorKeyword],color:iE},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:pE},{tag:[Te.meta,Te.comment],color:uE},{tag:Te.tagName,color:mE},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:dE},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:sE},{tag:Te.invalid,color:fE},{tag:Te.strikethrough,textDecoration:"line-through"}],yE=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},gE,t),styles:[...bE,...n]})})(),vE={background:"#303841",foreground:"#FFFFFF",caret:"#FBAC52",selection:"#4C5964",selectionMatch:"#3A546E",gutterBackground:"#303841",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},kE=[{tag:[Te.meta,Te.comment],color:"#A2A9B5"},{tag:[Te.attributeName,Te.keyword],color:"#B78FBA"},{tag:Te.function(Te.variableName),color:"#5AB0B0"},{tag:[Te.string,Te.regexp,Te.attributeValue],color:"#99C592"},{tag:Te.operator,color:"#f47954"},{tag:[Te.tagName,Te.modifier],color:"#E35F63"},{tag:[Te.number,Te.definition(Te.tagName),Te.className,Te.definition(Te.variableName)],color:"#fbac52"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#E35F63"},{tag:Te.variableName,color:"#539ac4"},{tag:[Te.propertyName,Te.typeName],color:"#629ccd"},{tag:Te.propertyName,color:"#36b7b5"}];var wE=function(){var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},vE,t),styles:[...kE,...n]})}(),xE={background:"#1a1b26",foreground:"#787c99",caret:"#c0caf5",selection:"#515c7e40",selectionMatch:"#16161e",gutterBackground:"#1a1b26",gutterForeground:"#787c99",gutterBorder:"transparent",lineHighlight:"#474b6611"},SE=[{tag:Te.keyword,color:"#bb9af7"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#c0caf5"},{tag:[Te.propertyName],color:"#7aa2f7"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#9ece6a"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#7aa2f7"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#bb9af7"},{tag:[Te.definition(Te.name),Te.separator],color:"#c0caf5"},{tag:[Te.className],color:"#c0caf5"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#ff9e64"},{tag:[Te.typeName],color:"#0db9d7"},{tag:[Te.operator,Te.operatorKeyword],color:"#bb9af7"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#b4f9f8"},{tag:[Te.meta,Te.comment],color:"#444b6a"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#89ddff"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#c0caf5"},{tag:Te.invalid,color:"#ff5370"},{tag:Te.strikethrough,textDecoration:"line-through"}],CE=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},xE,t),styles:[...SE,...n]})})(),AE={background:"#24283b",foreground:"#7982a9",caret:"#c0caf5",selection:"#6f7bb630",selectionMatch:"#343b5f",gutterBackground:"#24283b",gutterForeground:"#7982a9",gutterBorder:"transparent",lineHighlight:"#292e427a"},TE=[{tag:Te.keyword,color:"#bb9af7"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#c0caf5"},{tag:[Te.propertyName],color:"#7aa2f7"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#9ece6a"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#7aa2f7"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#bb9af7"},{tag:[Te.definition(Te.name),Te.separator],color:"#c0caf5"},{tag:[Te.className],color:"#c0caf5"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#ff9e64"},{tag:[Te.typeName],color:"#2ac3de",fontStyle:"#2ac3de"},{tag:[Te.operator,Te.operatorKeyword],color:"#bb9af7"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#b4f9f8"},{tag:[Te.meta,Te.comment],color:"#565f89"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#89ddff"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#c0caf5"},{tag:Te.invalid,color:"#ff5370"},{tag:Te.strikethrough,textDecoration:"line-through"}],NE=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},AE,t),styles:[...TE,...n]})})(),OE={background:"#e1e2e7",foreground:"#3760bf",caret:"#3760bf",selection:"#99a7df",selectionMatch:"#99a7df",gutterBackground:"#e1e2e7",gutterForeground:"#3760bf",gutterBorder:"transparent",lineHighlight:"#5f5faf11"},ME=[{tag:Te.keyword,color:"#007197"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#3760bf"},{tag:[Te.propertyName],color:"#3760bf"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#587539"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#3760bf"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#3760bf"},{tag:[Te.definition(Te.name),Te.separator],color:"#3760bf"},{tag:[Te.className],color:"#3760bf"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#b15c00"},{tag:[Te.typeName],color:"#007197",fontStyle:"#007197"},{tag:[Te.operator,Te.operatorKeyword],color:"#007197"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#587539"},{tag:[Te.meta,Te.comment],color:"#848cb5"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#b15c00"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#3760bf"},{tag:Te.invalid,color:"#f52a65"},{tag:Te.strikethrough,textDecoration:"line-through"}],EE=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},OE,t),styles:[...ME,...n]})})(),DE="#002451",_E="#ffffff",IE="#003f8e",BE="#EBBBFF",PE="#FFC58F",RE="#BBDAFF",$E="#D1F1A9",LE="#FFC58F",zE="#FFEEAD",FE="#BBDAFF",jE="#FFC58F",WE="#7285B7",UE="#D1F1A9",VE="#a92049",HE="#D1F1A9",qE="#FF9DA4",KE={background:DE,foreground:_E,caret:"#ffffff",selection:IE,selectionMatch:IE,gutterBackground:DE,gutterForeground:_E,lineHighlight:"#00346e7a"},JE=[{tag:Te.keyword,color:BE},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:PE},{tag:[Te.propertyName],color:RE},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:$E},{tag:[Te.function(Te.variableName),Te.labelName],color:RE},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:LE},{tag:[Te.definition(Te.name),Te.separator],color:PE},{tag:[Te.className],color:FE},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:jE},{tag:[Te.typeName],color:zE,fontStyle:zE},{tag:[Te.operator,Te.operatorKeyword],color:BE},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:HE},{tag:[Te.meta,Te.comment],color:WE},{tag:Te.tagName,color:qE},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:UE},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:PE},{tag:Te.invalid,color:VE},{tag:Te.strikethrough,textDecoration:"line-through"}],ZE=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},KE,t),styles:[...JE,...n]})})(),YE={background:"#ffffff",foreground:"#383a42",caret:"#000",selection:"#add6ff",selectionMatch:"#a8ac94",lineHighlight:"#99999926",gutterBackground:"#fff",gutterForeground:"#237893",gutterActiveForeground:"#0b216f",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace'},GE=[{tag:[Te.keyword,Te.operatorKeyword,Te.modifier,Te.color,Te.constant(Te.name),Te.standard(Te.name),Te.standard(Te.tagName),Te.special(Te.brace),Te.atom,Te.bool,Te.special(Te.variableName)],color:"#0000ff"},{tag:[Te.moduleKeyword,Te.controlKeyword],color:"#af00db"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName,Te.propertyName,Te.variableName,Te.labelName,Te.definition(Te.name)],color:"#0070c1"},{tag:Te.heading,fontWeight:"bold",color:"#0070c1"},{tag:[Te.typeName,Te.className,Te.tagName,Te.number,Te.changed,Te.annotation,Te.self,Te.namespace],color:"#267f99"},{tag:[Te.function(Te.variableName),Te.function(Te.propertyName)],color:"#795e26"},{tag:[Te.number],color:"#098658"},{tag:[Te.operator,Te.punctuation,Te.separator,Te.url,Te.escape,Te.regexp],color:"#383a42"},{tag:[Te.regexp],color:"#af00db"},{tag:[Te.special(Te.string),Te.processingInstruction,Te.string,Te.inserted],color:"#a31515"},{tag:[Te.angleBracket],color:"#383a42"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.meta,Te.comment],color:"#008000"},{tag:Te.link,color:"#4078f2",textDecoration:"underline"},{tag:Te.invalid,color:"#e45649"}];var QE=function(){var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},YE,t),styles:[...GE,...n]})}(),XE={background:"#1e1e1e",foreground:"#9cdcfe",caret:"#c6c6c6",selection:"#6199ff2f",selectionMatch:"#72a1ff59",lineHighlight:"#ffffff0f",gutterBackground:"#1e1e1e",gutterForeground:"#838383",gutterActiveForeground:"#fff",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace'},eD=[{tag:[Te.keyword,Te.operatorKeyword,Te.modifier,Te.color,Te.constant(Te.name),Te.standard(Te.name),Te.standard(Te.tagName),Te.special(Te.brace),Te.atom,Te.bool,Te.special(Te.variableName)],color:"#569cd6"},{tag:[Te.controlKeyword,Te.moduleKeyword],color:"#c586c0"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName,Te.propertyName,Te.variableName,Te.labelName,Te.definition(Te.name)],color:"#9cdcfe"},{tag:Te.heading,fontWeight:"bold",color:"#9cdcfe"},{tag:[Te.typeName,Te.className,Te.tagName,Te.number,Te.changed,Te.annotation,Te.self,Te.namespace],color:"#4ec9b0"},{tag:[Te.function(Te.variableName),Te.function(Te.propertyName)],color:"#dcdcaa"},{tag:[Te.number],color:"#b5cea8"},{tag:[Te.operator,Te.punctuation,Te.separator,Te.url,Te.escape,Te.regexp],color:"#d4d4d4"},{tag:[Te.regexp],color:"#d16969"},{tag:[Te.special(Te.string),Te.processingInstruction,Te.string,Te.inserted],color:"#ce9178"},{tag:[Te.angleBracket],color:"#808080"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.meta,Te.comment],color:"#6a9955"},{tag:Te.link,color:"#6a9955",textDecoration:"underline"},{tag:Te.invalid,color:"#ff0000"}];var tD=function(){var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},XE,t),styles:[...eD,...n]})}(),nD="#000",iD="#fff",sD=null,rD=null,oD=null,aD="#a8a8b1",lD=null,cD=null,hD=null,uD="#2e2e37",dD=null,fD=null,pD="#a8a8b1",mD=null,gD={background:nD,foreground:iD,caret:"#7d46fc",selection:"#7d46fc3f",selectionMatch:"#7d46fc7f",gutterBackground:nD,gutterForeground:iD,lineHighlight:"#00346eb0"},bD=[{tag:Te.keyword,color:sD,fontWeight:"bold"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:rD},{tag:[Te.propertyName],color:oD},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:aD},{tag:[Te.function(Te.variableName),Te.labelName],color:oD},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:lD},{tag:[Te.definition(Te.name),Te.separator],color:rD},{tag:[Te.className],color:hD},{tag:[Te.typeName],color:cD,fontStyle:cD},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:pD},{tag:[Te.meta,Te.comment],color:uD},{tag:Te.tagName,color:mD},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:dD},{tag:[Te.atom,Te.special(Te.variableName)],color:rD},{tag:Te.invalid,color:fD},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.operatorKeyword,Te.bool,Te.null,Te.variableName],color:lD},{tag:[Te.operator],color:"#bb9af7"},{tag:[Te.number],color:"#a8a8b1"},{tag:[Te.bracket],color:"#bb9af7"}],yD=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},gD,t),styles:[...bD,...n]})})(),vD="#fff",kD="#000",wD=null,xD=null,SD=null,CD="#6b7a88",AD=null,TD=null,ND=null,OD="#bec9d3",MD=null,ED=null,DD="#6b7a88",_D=null,ID={background:vD,foreground:kD,caret:"#004bff",selection:"#0064ff26",selectionMatch:"#0064ff4c",gutterBackground:vD,gutterForeground:kD,lineHighlight:"#0064ff0c"},BD=[{tag:Te.keyword,color:wD,fontWeight:"bold"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:xD},{tag:[Te.propertyName],color:SD},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:CD},{tag:[Te.function(Te.variableName),Te.labelName],color:SD},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:AD},{tag:[Te.definition(Te.name),Te.separator],color:xD},{tag:[Te.className],color:ND},{tag:[Te.typeName],color:TD,fontStyle:TD},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:DD},{tag:[Te.meta,Te.comment],color:OD},{tag:Te.tagName,color:_D},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:MD},{tag:[Te.atom,Te.special(Te.variableName)],color:xD},{tag:Te.invalid,color:ED},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.operatorKeyword,Te.bool,Te.null,Te.variableName],color:AD},{tag:[Te.operator],color:"#0431fa"},{tag:[Te.number],color:"#a8a8b1"},{tag:[Te.bracket],color:"#0431fa"}],PD=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},ID,t),styles:[...BD,...n]})})(),RD={background:"#fff",foreground:"#3D3D3D",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#AFAFAF",lineHighlight:"#d5e6ff69"},$D=[{tag:[Te.comment,Te.quote],color:"#707F8D"},{tag:[Te.typeName,Te.typeOperator],color:"#aa0d91"},{tag:[Te.keyword],color:"#aa0d91",fontWeight:"bold"},{tag:[Te.string,Te.meta],color:"#D23423"},{tag:[Te.name],color:"#032f62"},{tag:[Te.typeName],color:"#522BB2"},{tag:[Te.variableName],color:"#23575C"},{tag:[Te.definition(Te.variableName)],color:"#327A9E"},{tag:[Te.regexp,Te.link],color:"#0e0eff"}];var LD=function(){var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},RD,t),styles:[...$D,...n]})}(),zD={background:"#292A30",foreground:"#CECFD0",caret:"#fff",selection:"#727377",selectionMatch:"#727377",lineHighlight:"#ffffff0f"},FD=[{tag:[Te.comment,Te.quote],color:"#7F8C98"},{tag:[Te.keyword],color:"#FF7AB2",fontWeight:"bold"},{tag:[Te.string,Te.meta],color:"#FF8170"},{tag:[Te.typeName],color:"#DABAFF"},{tag:[Te.definition(Te.variableName)],color:"#6BDFFF"},{tag:[Te.name],color:"#6BAA9F"},{tag:[Te.variableName],color:"#ACF2E4"},{tag:[Te.regexp,Te.link],color:"#FF8170"}],jD=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},zD,t),styles:[...FD,...n]})})();function WD(e){switch(e.kind){case"literal":return JSON.parse(e.jsonCode);case"array":return e.values.map(WD);case"object":return Object.fromEntries(Object.values(e.keyValues).map(e=>[e.key,WD(e.value)]))}}function UD(e,t,n){switch(e.kind){case"array":return[];case"optional":return null;case"record":{const i=t[e.value];return"struct"===i.kind?n?{}:Object.fromEntries(i.fields.map(e=>[e.name,UD(e.type,t,"nested")])):"UNKNOWN"}case"primitive":switch(e.value){case"bool":return!1;case"int32":case"float32":case"float64":return 0;case"int64":case"hash64":return"0";case"timestamp":return{unix_millis:0,formatted:"1970-01-01T00:00:00Z"};case"string":case"bytes":return""}}}function VD(e){const t=function(e){const t=[];let n=0,i=0,s=!1;const r=/[ \t\r\n]*/y,o=/([[\]{}:,]|(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|false|true|null|("(((?=\\)\\(["\\/ bfnrt]|u[0-9a-fA-F]{4}))|[^"\\\0-\x1F\x7F]+)*")|$)/y;for(;;){const a=n;r.lastIndex=n,r.exec(e),n=r.lastIndex;for(let t=a;t<n;++t){const n=e[t];"\n"===n?(i=0,s=!1):s||" "!==n&&"\t"!==n||i++}o.lastIndex=n;const l=o.exec(e);if(!l){const t=/\w*/uy;t.lastIndex=n+1,t.exec(e);return{kind:"error",message:"not a token",segment:{start:n,end:t.lastIndex||n+1}}}{const e=l[0],r={segment:{start:n,end:n+e.length},jsonCode:e,indent:i};if(n=o.lastIndex,t.push(r),""!==e&&(s=!0),""===e)return{kind:"tokens",tokens:t}}}}(e);if("error"===t.kind)return{value:void 0,errors:[t],edits:[]};const n=new HD(t.tokens,e),i=n.parseValueOrSkip();return n.expectEnd(),{value:i,errors:n.errors,edits:n.edits}}class HD{constructor(e,t){this.tokens=e,this.input=t,this.tokenIndex=0,this.errors=[],this.edits=[],this.indent=""}parseValueOrSkip(){const e=this.peekToken(),t=e.jsonCode?e.jsonCode[0]:"",{indent:n}=e;switch(t){case"[":return this.parseArray();case"{":return this.parseObject();case"n":return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:"null",type:"null",indent:n};case"f":return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:"false",type:"boolean",indent:n};case"t":return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:"true",type:"boolean",indent:n};case'"':return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:e.jsonCode,type:"string",indent:n};case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:e.jsonCode,type:"number",indent:n}}this.errors.push({kind:"error",message:"expected: value",segment:this.peekToken().segment}),this.skip()}parseArray(){const e=this.nextToken(),{indent:t}=e,n=[];for(;;){if("]"===this.peekToken().jsonCode){const i=this.nextToken();return{kind:"array",firstToken:e.segment,segment:{start:e.segment.start,end:i.segment.end},values:n,indent:t}}if("}"===this.peekToken().jsonCode){this.errors.push({kind:"error",message:"expected: ']'",segment:this.peekToken().segment});const i=this.nextToken();return{kind:"array",firstToken:e.segment,segment:{start:e.segment.start,end:i.segment.end},values:n,indent:t}}if(""===this.peekToken().jsonCode)return this.expectSymbolOrSkip("]"),{kind:"array",firstToken:e.segment,segment:{start:e.segment.start,end:this.peekToken().segment.start},values:n,indent:t};const i=this.parseValueOrSkip();if(i&&n.push(i),","===this.peekToken().jsonCode){const e=this.nextToken();"]"===this.peekToken().jsonCode&&this.edits.push({segment:e.segment,replacement:""})}}}parseObject(){const e=this.nextToken(),{indent:t}=e,n={},i=[];for(;;){if("}"===this.peekToken().jsonCode){const s=this.nextToken();return{kind:"object",firstToken:e.segment,segment:{start:e.segment.start,end:s.segment.end},keyValues:n,allKeys:i,indent:t}}if("]"===this.peekToken().jsonCode){this.errors.push({kind:"error",message:"expected: ']'",segment:this.peekToken().segment});const s=this.nextToken();return{kind:"object",firstToken:e.segment,segment:{start:e.segment.start,end:s.segment.end},keyValues:n,allKeys:i,indent:t}}if(""===this.peekToken().jsonCode)return this.expectSymbolOrSkip("}"),{kind:"object",firstToken:e.segment,segment:{start:e.segment.start,end:this.peekToken().segment.start},keyValues:n,allKeys:i,indent:t};const s=this.peekToken();if(!s.jsonCode.startsWith('"')){this.errors.push({kind:"error",message:"expected: string",segment:s.segment}),this.skip(),","===this.peekToken().jsonCode&&this.nextToken();continue}const r=JSON.parse(s.jsonCode);if(i.push({key:r,keySegment:s.segment}),this.nextToken(),!this.expectSymbolOrSkip(":"))continue;n[r]&&this.errors.push({kind:"error",message:"duplicate key",segment:s.segment});const o=this.parseValueOrSkip();if(o&&(n[r]={keySegment:s.segment,key:r,value:o}),","===this.peekToken().jsonCode){const e=this.nextToken();"}"===this.peekToken().jsonCode&&this.edits.push({segment:e.segment,replacement:""})}}}expectEnd(){this.nextToken().jsonCode&&this.errors.push({kind:"error",message:"expected: end",segment:this.peekToken().segment})}nextToken(){const e=this.tokens[this.tokenIndex];{const t=this.tokenIndex<=0?void 0:this.tokens[this.tokenIndex-1],n={start:t?t.segment.end:0,end:e.segment.start},i=this.input.substring(n.start,n.end),s=this.inferWhitespaceSeparator(t?.jsonCode??"",e.jsonCode);i!==s.text&&this.edits.push({segment:n,replacement:s.text}),this.indent=s.newIndent??this.indent}return++this.tokenIndex,e}inferWhitespaceSeparator(e,t){const{indent:n}=this;if(":"===e)return{text:" "};if(","===e&&"]"!==t&&"}"!==t)return{text:`\n${n}`};if(/[0-9"}\]el]$/.test(e)&&/^[0-9"{[tfn-]/.test(t))return{text:`,\n${n}`};if("["===e&&"]"!==t||"{"===e&&"}"!==t){const e=n+qD;return{text:`\n${e}`,newIndent:e}}if("["!==e&&"]"===t||"{"!==e&&"}"===t){const e=n.replace(qD,"");return{text:`\n${e}`,newIndent:e}}return{text:""}}peekToken(){return this.tokens[this.tokenIndex]}expectSymbolOrSkip(e){return this.peekToken().jsonCode!==e?(this.errors.push({kind:"error",message:`expected: '${e}'`,segment:this.peekToken().segment}),this.skip(),!1):(this.nextToken(),!0)}skip(){for(;;){const e=this.peekToken().jsonCode;if(""===e||","===e||"]"===e||"}"===e||e.startsWith('"'))return;"["===e?this.parseArray():"{"===e?this.parseObject():this.nextToken()}}}const qD=" ";function KD(e,t){const n={};for(const e of t.records)n[e.id]=e;const i=new JD(n);i.validate(e,{kind:"root"},t.type);const s=new Map;for(const e of i.hints){const{valueContext:t}=e;t&&s.set(t.path,e)}return{errors:i.errors,hints:i.hints,rootTypeHint:i.rootTypeHint,pathToTypeHint:s}}class JD{constructor(e){this.idToRecordDef=e,this.errors=[],this.hints=[],this.typeHintStack=[]}validate(e,t,n,i){const{idToRecordDef:s,typeHintStack:r}=this;e.expectedType=n;const o=o=>{const a=function(e){function t(e){switch(e.kind){case"primitive":return e.value;case"array":return`[${t(e.value.item)}]`;case"optional":return`${t(e.value)}?`;case"record":return e.value.split(":")[1]}}function n(e){switch(e.kind){case"primitive":return null;case"array":return n(e.value.item);case"optional":return n(e.value);case"record":return e.value.split(":")[0]}}const i=t(e),s=n(e);return s?`${i} (${s})`:i}(i??n),l=GD(n,s),c=[a];if(l&&c.push(l),"array"===e.kind){const{length:t}=e.values;t&&c.push(`Length: ${t}`)}const h={segment:e.firstToken,message:1===c.length?c[0]:c,valueContext:{value:e,path:t},childHints:[],enumDefinition:o?.enumDefinition};if(r.length){r[r.length-1].childHints.push(h)}else this.rootTypeHint=h;this.hints.push(h),r.push(h)};switch(n.kind){case"array":if("array"===e.kind){o();for(const[i,s]of e.values.entries()){const{key_extractor:e,item:r}=n.value,o={kind:"array-item",index:i,key:ZD(s,e),arrayPath:t};this.validate(s,o,r)}r.pop()}else this.errors.push({kind:"error",segment:e.segment,message:"Expected: array"});break;case"optional":"literal"===e.kind&&"null"===e.jsonCode?(o(),r.pop()):this.validate(e,t,n.value,n);break;case"primitive":{const t=n.value;"timestamp"===t?this.validateTimestamp(e)&&(o(),r.pop()):!function(e,t){switch(t){case"bool":return"literal"===e.kind&&"boolean"===e.type;case"int32":return YD(e,-2147483648n,2147483647n);case"int64":return YD(e,-9223372036854775808n,9223372036854775807n);case"hash64":return YD(e,0n,18446744073709551615n);case"float32":case"float64":return function(e){if("literal"!==e.kind)return!1;return"number"===e.type||"string"===e.type&&('"NaN"'===e.jsonCode||'"Infinity"'===e.jsonCode||'"-Infinity"'===e.jsonCode)}(e);case"string":return"literal"===e.kind&&"string"===e.type;case"bytes":if("literal"!==e.kind)return!1;try{return DC("bytes").fromJsonCode(e.jsonCode),!0}catch{return!1}case"timestamp":throw new Error}}(e,t)?this.errors.push({kind:"error",segment:e.firstToken,message:`Expected: ${t}`}):(o(),r.pop());break}case"record":{const i=s[n.value];if("struct"===i.kind){const n={};if(i.fields.forEach(e=>{n[e.name]=e}),"object"===e.kind){o();for(const i of Object.values(e.keyValues)){const{key:e,value:s}=i,r=n[e];if(r){r.doc&&this.hints.push({segment:i.keySegment,message:r.doc});const n={kind:"field-value",fieldName:e,structPath:t};this.validate(s,n,r.type)}else this.errors.push({kind:"error",segment:i.keySegment,message:"Unknown field"})}r.pop()}else this.errors.push({kind:"error",segment:e.firstToken,message:"Expected: object"})}else{const n={};if(i.variants.forEach(e=>{n[e.name.toLowerCase()]=e,n[e.name.toUpperCase()]=e}),"object"===e.kind)o(),this.validateEnumObject(e,t,n),r.pop();else if("literal"===e.kind&&"string"===e.type){const t=JSON.parse(e.jsonCode),s=n[t];s&&s.type?this.errors.push({kind:"error",segment:e.segment,message:"Expected: uppercase variant name"}):"unknown"===t||"UNKNOWN"===t||s?(o({enumDefinition:i}),r.pop()):this.errors.push({kind:"error",segment:e.segment,message:"Unknown variant"})}else this.errors.push({kind:"error",segment:e.firstToken,message:"Expected: object or string"})}break}default:throw new Error(n)}}validateEnumObject(e,t,n){const i=e.keyValues.kind;if(!i)return void this.errors.push({kind:"error",segment:e.segment,message:"Missing: 'kind'"});if("literal"!==i.value.kind||"string"!==i.value.type)return void this.errors.push({kind:"error",segment:i.value.firstToken,message:"Expected: string"});const s=JSON.parse(i.value.jsonCode),r=s===s.toLowerCase(),o=s===s.toUpperCase();if(!r&&!o)return void this.errors.push({kind:"error",segment:i.value.segment,message:"Expected: lowercase or uppercase variant name"});const a=n[s];if(!a)return void this.errors.push({kind:"error",segment:i.value.segment,message:"Unknown variant"});const l=e.keyValues.value;if(!l)return void this.errors.push({kind:"error",segment:e.segment,message:"Missing: 'value'"});for(const t of e.allKeys)"kind"!==t.key&&"value"!==t.key&&this.errors.push({kind:"error",segment:t.keySegment,message:"Unexpected entry"});const c={kind:"variant-value",variantName:a.name,enumPath:t};this.validate(l.value,c,a.type)}validateTimestamp(e){if("object"!==e.kind)return this.errors.push({kind:"error",segment:e.firstToken,message:"Expected: timestamp"}),!1;const t=e.keyValues.unix_millis;if(!t)return this.errors.push({kind:"error",segment:e.firstToken,message:"Missing: 'unix_millis'"}),!0;if("literal"!==t.value.kind||"number"!==t.value.type)return this.errors.push({kind:"error",segment:t.value.firstToken,message:"Expected: number"}),!0;const n=WD(t.value);if(n<-864e13||864e13<n)return this.errors.push({kind:"error",segment:t.value.firstToken,message:"Timestamp out of range"}),!0;const i=e.keyValues.formatted;if(!i)return!0;if("literal"!==i.value.kind||"string"!==i.value.type)return this.errors.push({kind:"error",segment:i.value.firstToken,message:"Expected: string"}),!0;const s=WD(i.value);if("n/a"===s)return!0;const r=Date.parse(s);if(Number.isNaN(r))return this.errors.push({kind:"error",segment:i.value.firstToken,message:"Invalid ISO 8601 date string"}),!0;r!==n&&this.errors.push({kind:"error",segment:i.value.firstToken,message:"Does not match 'unix_millis'"});for(const t of e.allKeys)"unix_millis"!==t.key&&"formatted"!==t.key&&this.errors.push({kind:"error",segment:t.keySegment,message:"Unexpected entry"});return!0}}function ZD(e,t){if(void 0===t)return null;const n=t.split(".");let i=e;for(const e of n){if("object"!==i.kind)return null;const t=i.keyValues[e];if(!t)return null;i=t.value}switch(i.kind){case"literal":switch(i.type){case"string":case"number":case"boolean":return i.jsonCode}return null;case"object":{const e=i.keyValues.unix_millis;return e&&"literal"===e.value.kind&&"number"===e.value.type?e.value.jsonCode:null}case"array":return null}}function YD(e,t,n){if("literal"!==e.kind)return!1;let i,s;if("string"===e.type)i=JSON.parse(e.jsonCode);else{if("number"!==e.type)return!1;i=e.jsonCode}try{s=BigInt(i)}catch{return!1}return t<=s&&s<=n}function GD(e,t){switch(e.kind){case"primitive":return;case"array":return GD(e.value.item,t);case"optional":return GD(e.value,t);case"record":return t[e.value].doc}}const QD=Vt.define(),XD=wt.define({create:()=>null,update(e,t){for(const e of t.effects)if(e.is(QD))return e.value;return e}});function e_(e){return[XD,bs.fromClass(class{constructor(e){this.timeout=null,this.view=e,this.scheduleUpdate()}update(e){if(e.docChanged){const t=e.transactions.some(e=>"undo"===e.annotation(Ht.userEvent)||"redo"===e.annotation(Ht.userEvent));this.scheduleUpdate(t?"from-undo":void 0)}}scheduleUpdate(e){null!==this.timeout&&clearTimeout(this.timeout),this.timeout=window.setTimeout(()=>{this.parseJson(e),this.timeout=null},200)}parseJson(t){const n=this.view.state.doc.toString(),i=VD(n);let s;i.value&&(s=KD(i.value,e));if(!t&&i.edits.length&&i.errors.length<=0&&!(()=>{const e=this.view.state.selection.main.head;return i.edits.some(t=>t.segment.start<=e&&e<=t.segment.end)})()){const t=i.edits.map(e=>({from:e.segment.start,to:e.segment.end,insert:e.replacement})),r=this.view.state.field(XD,!1),o=t_(e,r);this.view.dispatch({changes:t,effects:QD.of({parseResult:i,validationResult:s,source:n,schema:e,recordIdToDefinition:o}),scrollIntoView:!0})}else{const t=this.view.state.field(XD,!1),r=t_(e,t);this.view.dispatch({effects:QD.of({parseResult:i,validationResult:s,source:n,schema:e,recordIdToDefinition:r})})}}destroy(){null!==this.timeout&&clearTimeout(this.timeout)}})]}function t_(e,t){if(e===t?.schema)return t.recordIdToDefinition;const n={};for(const t of e.records)n[t.id]=t;return n}function n_(e){const t={};for(const n of e.records)t[n.id]=n;function n(e,i){if(!i_(i,e.segment))return null;const{expectedType:s}=e;if(!s)return null;switch("optional"===s.kind&&s.value,e.kind){case"array":if("array"!==s.kind)return null;for(const t of e.values){if(i<t.firstToken.start)return null;const e=n(t,i);if(e)return e}return null;case"object":{if("record"!==s.kind)return null;const r=t[s.value];if("struct"===r.kind)for(const t of e.allKeys){const{keySegment:s}=t;if(i_(i,s)){const t=s_(e,r);return{from:s.start+1,to:s.end-1,options:t.map(e=>({label:e}))}}const o=e.keyValues[t.key];if(o){const e=n(o.value,i);if(e)return e}}else{const t=e.keyValues.kind;if(t&&i_(i,t.value.firstToken)&&"literal"===t.value.kind&&"string"===t.value.type){const e=r.variants.filter(e=>e.type).map(e=>({label:e.name}));return{from:t.value.firstToken.start+1,to:t.value.firstToken.end-1,options:e}}const s=e.keyValues.value;if(s){const e=n(s?.value,i);if(e)return e}}return null}case"literal":{if("record"!==s.kind)return null;const n=t[s.value];if("enum"!==n.kind)return null;const i=n.variants.filter(e=>!e.type).map(e=>({label:e.name})).concat({label:"UNKNOWN"});return{from:e.firstToken.start+1,to:e.firstToken.end-1,options:i}}}}return function(t){const i=t.pos;if(!t.view)return null;const s=i>0?t.state.doc.sliceString(i-1,i):"",r=t.explicit||'"'===s?function(e,t){const n=e.state.field(XD,!1),i=e.state.doc.toString();if(n&&n.source===i)return n;const s=VD(i);let r;s.value&&(r=KD(s.value,t));const o={parseResult:s,validationResult:r,source:i,schema:t,recordIdToDefinition:t_(t,n)};return n&&n===o||e.dispatch({effects:QD.of(o)}),o}(t.view,e):t.state.field(XD,!1);if(!r)return null;const o=r.parseResult;return o.value?n(o.value,i):null}}function i_(e,t){return e>=t.start&&e<t.end}function s_(e,t){const n=[];for(const i of t.fields)e.keyValues[i.name]||n.push(i.name);return n}function r_(e){return function(t){const n=t.state.field(XD,!1);if(!n)return[];const i=n.parseResult;if(i.errors.length)return i.errors.map(o_);if(!n.validationResult)return[];const{errors:s,hints:r}=n.validationResult;return s.map(o_).concat(r.map(t=>function(e,t){const{message:n}=e;return{from:e.segment.start,to:e.segment.end,message:"",severity:"info",renderMessage:i=>{const s=document.createElement("div");let r;if(s.className="cm-diagnostic-wrapper","string"!==n&&"string?"!==n||!e.valueContext||"literal"!==e.valueContext.value.kind||"string"!==e.valueContext.value.type)if("timestamp"!==n&&"timestamp?"!==n||!e.valueContext||"object"!==e.valueContext.value.kind||"editable"!==t){r=("string"==typeof n?[n]:n).map(e=>{const t=document.createElement("div");return t.textContent=e,t}),e.valueContext&&e.enumDefinition}else;else r=function(e,t,n,i){const s=document.createElement("div");s.textContent=t.message;const r=n.jsonCode,o=JSON.parse(r),a=document.createElement("div");a.className="cm-diagnostic-controls";const l=document.createElement("span");l.textContent="Value:";const c=document.createElement("textarea");c.className="cm-diagnostic-textarea",c.value=o,c.rows=1;const h="read-only"===i;return c.readOnly=h,c.addEventListener("keydown",e=>{"Enter"===e.key&&e.shiftKey}),a.appendChild(l),a.appendChild(c),[s,a]}(0,e,e.valueContext.value,t);for(const e of r)e.classList.add("diagnostic-row"),s.appendChild(e);return s},markClass:""}}(t,e)))}}function o_(e){return{from:e.segment.start,to:e.segment.end,message:e.message,severity:"error",renderMessage:()=>{const t=document.createElement("div");return t.className="cm-diagnostic-wrapper",t.textContent=e.message,t}}}function a_(e){const t=document.createElement("div");function n(){const n=e.state.selection.main.head,i=e.state.field(XD,!1),s=i?.validationResult,r=s?.rootTypeHint,o=[];if(r){const t=l_(n,r);if(t){const{pathToTypeHint:n}=s,i=new c_(n,e);i.appendNodesForPath(t.valueContext.path),o.push(...i.nodes),o.reverse()}}t.replaceChildren(...o)}return t.className="cm-status-bar",n(),{dom:t,update(e){e.selectionSet&&n()},top:!1}}function l_(e,t){const n=t.valueContext.value.segment;if(e<n.start||e>n.end)return;let i,s=0,r=t.childHints.length-1;for(;s<=r;){const n=Math.floor((s+r)/2),o=t.childHints[n],a=o.valueContext.value.segment;if(e<a.start)r=n-1;else{if(!(e>a.end)){i=o;break}s=n+1}}if(i){const t=l_(e,i);return void 0!==t?t:i}return t}class c_{constructor(e,t){this.pathToTypeHint=e,this.view=t,this.nodes=[]}appendNodesForPath(e){const t=this.pathToTypeHint.get(e).valueContext.value.segment.start,n=document.createElement("a");switch(n.className="cm-status-bar-link",n.addEventListener("click",e=>{e.preventDefault(),this.view.dispatch({selection:{anchor:t,head:t},scrollIntoView:!0}),this.view.focus()}),e.kind){case"root":n.append("root"),this.nodes.push(n);break;case"array-item":this.appendNodesForPath(e.arrayPath),null!=e.key?n.append(`[${e.index}|${e.key}]`):n.append(`[${e.index}]`),this.nodes.push(n);break;case"field-value":this.appendNodesForPath(e.structPath),n.append(`.${e.fieldName}`),this.nodes.push(n);break;case"variant-value":this.appendNodesForPath(e.enumPath),n.append(`.value("${e.variantName}")`),this.nodes.push(n)}}}const h_={backgroundColor:"#fffdf7",lighterBgColor:"#f3eee1",borderColor:"#d4d0c4",foregroundColor:"#111111",accentColor:"#111111",errorColor:"#232323",selectionColor:"#d9d4c7"},u_={backgroundColor:"#1a1b26",lighterBgColor:"#1f2335",borderColor:"#414868",foregroundColor:"#c0caf5",accentColor:"#7aa2f7",errorColor:"#f7768e",selectionColor:"#515c7e40"},d_={backgroundColor:"#d5d6db",lighterBgColor:"#e1e2e7",borderColor:"#adb0bb",foregroundColor:"#3760bf",accentColor:"#2e7de9",errorColor:"#f52a65",selectionColor:"#3760bf33"},f_={abcdef:wA,abyss:UA,androidstudio:qA,andromeda:pT,atomone:bT,aura:kT,"basic-dark":ST,"basic-light":TT,bbedit:MT,bespin:_T,"console-dark":BT,"console-light":RT,copilot:sN,darcula:aN,dracula:hN,"duotone-dark":gN,"duotone-light":fN,eclipse:vN,"github-dark":AN,"github-light":xN,"gruvbox-dark":ON,"gruvbox-light":EN,kimbie:ZN,material:tO,"material-dark":eO,"material-light":sO,monokai:SO,"monokai-dimmed":WO,"noctis-lilac":HO,nord:JO,okaidia:GO,quietlight:gM,red:PM,"solarized-dark":eE,"solarized-light":yE,sublime:wE,"tokyo-night":CE,"tokyo-night-day":EE,"tokyo-night-storm":NE,"tomorrow-night-blue":ZE,"vscode-dark":tD,"vscode-light":QE,white:PD,"white-dark":yD,"white-light":PD,"xcode-dark":jD,"xcode-light":LD},p_={abcdef:vA,abyss:jA,androidstudio:VA,andromeda:dT,atomone:mT,aura:yT,"basic-dark":wT,"basic-light":CT,bbedit:NT,bespin:ET,"console-dark":IT,"console-light":PT,copilot:nN,darcula:rN,dracula:lN,"duotone-dark":pN,"duotone-light":uN,eclipse:bN,"github-dark":SN,"github-light":kN,"gruvbox-dark":TN,"gruvbox-light":MN,kimbie:KN,material:YN,"material-dark":GN,"material-light":nO,monokai:wO,"monokai-dimmed":FO,"noctis-lilac":UO,nord:qO,okaidia:ZO,quietlight:pM,red:IM,"solarized-dark":QM,"solarized-light":gE,sublime:vE,"tokyo-night":xE,"tokyo-night-day":OE,"tokyo-night-storm":AE,"tomorrow-night-blue":KE,"vscode-dark":XE,"vscode-light":YE,white:ID,"white-dark":gD,"white-light":ID,"xcode-dark":zD,"xcode-light":RD};function m_(...e){for(const t of e)if(t&&"transparent"!==t)return t}function g_(e){const t=f_[e];return"white"===e?{...h_,themeExtension:t}:"tokyo-night"===e?{...u_,themeExtension:t}:"tokyo-night-day"===e?{...d_,themeExtension:t}:function(e,t){const n=m_(e.background,e.gutterBackground),i=m_(e.caret,e.foreground,e.gutterForeground),s=m_(e.selection,e.selectionMatch,e.lineHighlight);return{backgroundColor:n??"#1a1b26",lighterBgColor:m_(e.gutterBackground,e.lineHighlight,n)??"#1f2335",borderColor:m_(e.gutterBorder,e.selectionMatch,e.selection,e.foreground)??"#414868",foregroundColor:i??"#c0caf5",accentColor:m_(e.foreground,e.caret)??"#7aa2f7",errorColor:m_(e.caret,e.foreground)??"#f7768e",selectionColor:s??"#515c7e40",themeExtension:t}}(p_[e],t)}function b_({schema:e,readOnly:t,json:n,theme:i,otherExtension:s}){const r={};for(const t of e.records)r[t.id]=t;const o=n??UD(e.type,r);return void 0===i?i=g_("tokyo-night"):"string"==typeof i&&(i=g_(i)),nn.create({doc:JSON.stringify(o,null,2),extensions:[nn.readOnly.of(!0),[],Rp,nn.languageData.of(()=>[{closeBrackets:{before:",]}"}}]),Pf(),i.themeExtension??[],mh(),e_(e),mp(r_("read-only")),Zf({override:[n_(e)]}),Pp(),ll.of(a_),Uo.theme({"&":{fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:"'JetBrains Mono', monospace",overflow:"auto"},".cm-lintRange-info":{backgroundImage:"none"},".cm-lintRange-info:hover":{backgroundColor:i.selectionColor},".cm-lintRange-error":{backgroundImage:"none",borderBottom:`3px solid ${i.errorColor}`},".cm-tooltip-hover":{backgroundColor:i.lighterBgColor,border:`1px solid ${i.borderColor}`,borderRadius:"4px",padding:"8px 12px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.5)",fontSize:"14px",lineHeight:"1.4",color:i.foregroundColor},".cm-tooltip.cm-tooltip-lint":{backgroundColor:i.lighterBgColor,border:`1px solid ${i.borderColor}`,borderRadius:"4px",padding:"8px 12px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.5)",fontSize:"14px",color:i.foregroundColor},".cm-tooltip-lint .cm-diagnostic-error":{fontWeight:"bold",color:i.errorColor},".cm-status-bar":{backgroundColor:i.lighterBgColor,borderTopColor:i.borderColor,color:i.accentColor},".cm-diagnostic-textarea":{backgroundColor:i.lighterBgColor,borderColor:i.borderColor,color:i.foregroundColor},".cm-diagnostic-textarea[readonly]":{backgroundColor:i.backgroundColor},".cm-diagnostic-input":{backgroundColor:i.lighterBgColor,borderColor:i.borderColor,color:i.foregroundColor},".cm-diagnostic-button":{backgroundColor:i.lighterBgColor,borderColor:i.borderColor,color:i.foregroundColor},".cm-diagnostic-button:hover":{backgroundColor:i.borderColor},".cm-diagnostic-error-message":{color:i.errorColor},".diagnostic-row + .diagnostic-row":{borderTopColor:i.borderColor}}),Uo.baseTheme({".cm-lint-marker-info":{display:"none"},".cm-status-bar":{display:"flex",flexDirection:"row-reverse",justifyContent:"flex-end",padding:"4px 12px",borderTop:"1px solid",fontSize:"12px",height:"16px"},".cm-status-bar-link":{textDecoration:"none",cursor:"pointer"},".cm-status-bar-link:hover":{textDecoration:"underline"},".cm-status-bar-link:hover ~ .cm-status-bar-link":{textDecoration:"underline"},".cm-diagnostic-wrapper":{fontSize:"12px",lineHeight:"1.3",padding:"2px"},".cm-diagnostic-controls":{marginTop:"4px",display:"flex",gap:"6px",alignItems:"center"},".cm-diagnostic-label":{whiteSpace:"nowrap",fontWeight:"500",minWidth:"64px"},".cm-diagnostic-textarea":{flex:"1",padding:"3px 6px",border:"1px solid",borderRadius:"3px",fontSize:"12px",fontFamily:"'JetBrains Mono', monospace",resize:"none",overflow:"auto",boxSizing:"border-box"},".cm-diagnostic-textarea[readonly]":{cursor:"default"},".cm-diagnostic-input":{padding:"3px 6px",border:"1px solid",borderRadius:"3px",fontSize:"12px",fontFamily:"'JetBrains Mono', monospace",boxSizing:"border-box",width:"100%"},".cm-diagnostic-button":{padding:"3px 12px",border:"1px solid",borderRadius:"3px",fontSize:"12px",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer",boxSizing:"border-box"},".cm-diagnostic-button:active":{transform:"translateY(1px)"},".cm-diagnostic-error-message":{fontSize:"11px",marginTop:"2px",fontWeight:"500"},".cm-timestamp-field":{display:"flex",flexDirection:"column",gap:"2px",flex:"1"},".cm-tooltip-lint .cm-diagnostic":{padding:"0",borderTop:"none",borderLeft:"none"},".cm-tooltip-lint .cm-diagnostic-error":{borderLeft:"none",fontWeight:"bold"},".cm-tooltip-lint .cm-diagnostic-info":{borderLeft:"none"},".diagnostic-row + .diagnostic-row":{marginTop:"8px",paddingTop:"8px",borderTop:"1px solid"}}),s??[]]})}const y_=[PD,Uo.theme({"&":{height:"100%",fontSize:"14px"},".cm-scroller":{fontFamily:"'IBM Plex Mono', monospace"},".cm-gutters":{borderRight:"1px solid #d4d0c4",backgroundColor:"#f7f3e8",color:"#746f63"},".cm-activeLine, .cm-activeLineGutter":{backgroundColor:"#f3eee1"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"#d9d4c7"},".cm-tooltip":{border:"1px solid #232323",backgroundColor:"#fffdf7",color:"#111111"},".cm-tooltip-autocomplete ul li[aria-selected]":{backgroundColor:"#111111",color:"#fffdf7"},".cm-panels":{backgroundColor:"#f3eee1",color:"#111111"},".cm-searchMatch":{backgroundColor:"#ece7da",outline:"1px solid #232323"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#d9d4c7"},".cm-matchingBracket":{backgroundColor:"#ece7da",outline:"1px solid #232323",color:"#111111"},".cm-nonmatchingBracket":{backgroundColor:"#111111",color:"#fffdf7"},".cm-foldPlaceholder":{border:"1px solid #d4d0c4",backgroundColor:"#f3eee1",color:"#545454"},".cm-lintRange-error":{backgroundImage:"none",borderBottom:"2px solid #232323"},".cm-status-bar":{borderTop:"1px solid #d4d0c4",backgroundColor:"#f3eee1",color:"#545454"}})],v_={backgroundColor:"#fffdf7",lighterBgColor:"#f3eee1",borderColor:"#d4d0c4",foregroundColor:"#111111",accentColor:"#111111",errorColor:"#232323",selectionColor:"#d9d4c7",themeExtension:y_};function k_(e){if(""===e)return{text:e,parsed:{kind:"not-set"}};let t,n;t=/^736[Bb]6972/.test(e)?"base16":e.startsWith("c2tpc")?"base64":"json";try{if("json"===t){n={kind:"json",value:JSON.parse(e)}}else if("base16"===t){n={kind:"bytes",value:new Uint8Array(e.match(/.{1,2}/g)?.map(e=>parseInt(e,16))??[]).buffer}}else if("base64"===t){const t=atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);n={kind:"bytes",value:i.buffer}}else n={kind:"not-set"}}catch(e){n={kind:"parse-error",error:String(e)}}return{text:e,parsed:n}}function w_(e){if(""===e)return{text:e,typeDescriptor:{kind:"not-set"}};try{const t=function(e){var t,n,i;const s=e,r={};for(const e of s.records){let t;switch(e.kind){case"struct":t=new nA({},e=>Object.freeze(Object.assign({},e)),()=>({}));break;case"enum":t=new rA(e=>{if(e instanceof iA)return Object.freeze({kind:"UNKNOWN"});if("string"==typeof e)return Object.freeze({kind:e});{const t={kind:e.kind,value:e.value};return Object.freeze(t)}})}const n={definition:e,serializer:t};r[e.id]=n}function o(e){switch(e.kind){case"array":{const{item:t,key_extractor:n}=e.value;return new YC(o(t),n)}case"optional":return new GC(o(e.value));case"primitive":return DC(e.value);case"record":{const t=e.value;return r[t].serializer}}}const a=[];for(const e of Object.values(r)){const{definition:s,serializer:l}=e,{defaultValue:c}=l,{id:h,removed_numbers:u}=s,d=h.split(":"),f=d[0],p=d[1].split("."),m=p[p.length-1],g=f+":"+p.slice(0,-1).join("."),b=null===(t=r[g])||void 0===t?void 0:t.serializer,y=null!==(n=s.doc)&&void 0!==n?n:"";switch(s.kind){case"struct":{const e=[];for(const t of s.fields){const n=o(t.type);e.push(new KC(t.name,t.name,t.number,n,null!==(i=t.doc)&&void 0!==i?i:"")),c[t.name]=n.defaultValue}const t=l;a.push(()=>t.init(m,f,b,y,e,null!=u?u:[]));break}case"enum":{const e=l,t=[zC].concat(s.variants).map(e=>{var t,n;return e.type?new sA(e.name,e.number,o(e.type),null!==(t=e.doc)&&void 0!==t?t:"",l.createFn):{name:e.name,number:e.number,constant:Object.freeze({kind:e.name}),doc:null!==(n=e.doc)&&void 0!==n?n:""}});a.push(()=>e.init(m,f,b,y,t,null!=u?u:[]));break}}}return a.forEach(e=>e()),o(s.type).typeDescriptor}(JSON.parse(e));return{text:e,typeDescriptor:{kind:"ok",value:t}}}catch(t){return{text:e,typeDescriptor:{kind:"error",error:String(t)}}}}function x_(e,t){const{typeDescriptor:n}=t;if("not-set"===n.kind)return{kind:"schema-not-set"};if("error"===n.kind)return{kind:"schema-error",error:n.error};if("not-set"===e.parsed.kind)return{kind:"value-not-set"};if("parse-error"===e.parsed.kind)return{kind:"value-parse-error",error:e.parsed.error};let i,s,r;try{i=n.value.transform(e.parsed.value,"dense"),s=n.value.transform(e.parsed.value,"readable"),r="json"===e.parsed.kind?n.value.transform(e.parsed.value,"bytes"):e.parsed.value}catch(e){return{kind:"schema-value-match-error",error:String(e)}}return{kind:"ok",readableJsonEditorState:b_({json:s,schema:n.value.asJson(),readOnly:!0,theme:v_}),denseJsonEditorState:nn.create({doc:JSON.stringify(i),extensions:[$p,y_,mh()]}),base16EditorState:nn.create({doc:Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join(""),extensions:[$p,y_]}),base64EditorState:nn.create({doc:btoa(String.fromCharCode(...new Uint8Array(r))),extensions:[$p,y_]})}}var S_=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let C_=class extends Vm{constructor(){super(...arguments),this.initialState=nn.create({}),this.fillHeight=!1,this.editor={kind:"state",value:null}}render(){return Tm`<div id="container"></div>`}firstUpdated(){const e=this.renderRoot.querySelector("#container");this.editor={kind:"view",value:new Uo({state:this.state,dispatchTransactions:(e,t)=>{t.update(e),e.some(e=>e.docChanged)&&this.dispatchEvent(new CustomEvent("text-modified"))},parent:e})}}get state(){return"state"===this.editor.kind?this.editor.value??this.initialState:this.editor.value.state}set state(e){"state"===this.editor.kind?this.editor={kind:"state",value:e}:this.editor.value.setState(e)}get view(){if("view"===this.editor.kind)return this.editor.value;throw new Error("Editor view not yet initialized")}};C_.styles=Up`
44
+ function Gm(e,t){return(t,n,i)=>((e,t,n)=>(n.configurable=!0,n.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,n),n))(t,n,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}function Qm(e){return e[0].toUpperCase()+e.slice(1)}function Xm(e){const t=e.slice(1,-1).split("\\\\");for(let e=0;e<t.length;++e){const n=t[e].replace(/\\(\r\n|\n|\r)/g,"\\n").replace(/(?<=^|[^\\])"/g,'\\"');t[e]=JSON.parse(`"${n}"`)}return t.join("\\")}function eg(e,t){const n=[];for(const[i,s]of Object.entries(e)){if("removed"===s.kind||!t(s))continue;const e="import"!==s.kind&&"import-alias"!==s.kind?s.doc:void 0;n.push({name:i,doc:e})}return n}class tg{constructor(){this.expectedNamesData=[],this.expectedNameSet=new Set}collect(e){for(const t of e)t.modulePath?this.expectedNamesData.push(t):this.expectedNameSet.has(t.name)||(this.expectedNamesData.push(t),this.expectedNameSet.add(t.name))}get expectedNames(){return this.expectedNamesData}}function ng(e,t,n,i,s){const r=("field"===e.kind?e.field.doc:e.doc).pieces.filter(e=>"reference"===e.kind);if(r.length<=0)return;const o=function(e,t,n){const i=[],s=e=>{const{key:t}=e,s=[...n.get(t).recordAncestors].reverse();for(const e of s)i.push(e)},r=e=>{if(e){const t=rg(e);if(t){const{record:e}=n.get(t);i.push(e)}}};switch(e.kind){case"constant":i.push(t),r(e.type);break;case"field":{const{field:n,record:o}=e;s(o),i.push(t),r(n.type);break}case"method":i.push(t),r(e.requestType),r(e.responseType);break;case"record":s(e),i.push(t)}return i}(e,t,i);for(const e of r)ig(e,o,t,n,s)}function ig(e,t,n,i,s){const{nameParts:r}=e;if(r.length<=0)return;const o=new tg;for(const a of t){if(e.absolute&&a!==n)continue;const t=sg(r,a,n,i);if("no-match"!==t.kind)return"failed-match"===t.kind?void(t.error&&s.push(t.error)):void(e.referee=t);o.collect(t.expectedNames)}const a=r[0].token;s.push({token:a,message:"Not found",expectedNames:o.expectedNames})}function sg(e,t,n,i){let s=!1;for(let r=0;r<e.length;r++){const o=e[r],a=t.nameToDeclaration[o.token.text];if(!a){const e=eg(t.nameToDeclaration,e=>t===n||"import"!==e.kind&&"import-alias"!==e.kind);return s?{kind:"failed-match",error:{token:o.token,message:"Not found",expectedNames:e}}:{kind:"no-match",expectedNames:e}}s=!0;const l=r===e.length-1,c=()=>({kind:"failed-match",error:{token:o.token,message:"Expected to be the last name in the sequence"}});switch(a.kind){case"constant":case"method":return o.declaration=a,l?a:c();case"record":if(t=a,o.declaration=a,l)return a;break;case"field":return o.declaration=a,l?{kind:"field",field:a,record:t}:c();case"import-alias":if(l)return{kind:"failed-match",error:{token:o.token,message:"Cannot be the last name in the sequence"}};case"import":{if(t!==n)return{kind:"failed-match",error:{token:o.token,message:"Cannot refer to other module's imports"}};const{resolvedModulePath:e}=a;if(!e)return{kind:"failed-match",error:null};const s=i(e);if(!s)return{kind:"failed-match",error:null};t=s,"import"===a.kind?--r:o.declaration=a;break}case"removed":throw new TypeError}}throw new Error("Unreachable")}function rg(e){switch(e.kind){case"array":return rg(e.item);case"optional":return rg(e.other);case"record":return e.key;case"primitive":return null}}function og(e,t){switch(t){case"bool":return"false"===e||"true"===e;case"bytes":return ag(e)&&/^hex:([0-9A-Fa-f]{2})*$/.test(Xm(e));case"timestamp":{if(!ag(e))return!1;const t=Xm(e),n=Date.parse(t).valueOf();return/(Z|[+-]\d\d:\d\d)$/.test(t)&&-864e13<=n&&n<=864e13&&n===Math.round(n)}case"int32":return lg(e,BigInt(-2147483648),BigInt(2147483647));case"int64":return lg(e,BigInt("-9223372036854775808"),BigInt("9223372036854775807"));case"hash64":return lg(e,BigInt(0),BigInt("18446744073709551615"));case"float32":case"float64":if(ag(e)){const t=Xm(e);return"NaN"===t||"Infinity"===t||"-Infinity"===t}return/^[-0-9]/.test(e);case"string":return ag(e)}}function ag(e){return/^['"]/.test(e)}function lg(e,t,n){if(!/^-?[0-9]+$/.test(e))return!1;const i=BigInt(e);return t<=i&&i<=n}function cg(e,t){switch(t){case"bool":return"true"===e?1:0;case"bytes":return function(e){const t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2)t[n/2]=parseInt(e.slice(n,n+2),16);const n=Array.from(t,e=>String.fromCharCode(e)).join("");return btoa(n)}(Xm(e).substring(4));case"timestamp":{const t=Xm(e);return Math.round(new Date(t).valueOf())}case"int32":case"float32":case"float64":return ag(e)?Xm(e):Number(e);case"int64":case"hash64":return String(BigInt(e));case"string":return Xm(e)}}function hg(e,t){const n=cg(e,t);return"string"==typeof n?n:JSON.stringify(n)}function ug(e,t,n){(function(e,t){switch(t){case"lower_underscore":return/^[a-z][0-9a-z]*(_[a-z][0-9a-z]*)*$/.test(e);case"UpperCamel":return/^[A-Z][0-9A-Za-z]*$/.test(e)&&(/^[A-Z][0-9]*$/.test(e)||/[a-z]/.test(e));case"UPPER_UNDERSCORE":return/^[A-Z][0-9A-Z]*(_[A-Z][0-9A-Z]*)*$/.test(e)}})(e.text,t)||n.push({token:e,expected:t})}function dg(e,t){return new fg(e,t).parse()}class fg{constructor(e,t){this.docComment=e,this.completionMode=t,this.pieces=[],this.errors=[],this.currentText="",this.charIndex=-1;const{text:n}=e;if(n.startsWith("/// "))this.content=n.slice(4);else{if(!n.startsWith("///"))throw new Error("Expected doc comment to start with ///");this.content=n.slice(3)}this.charIndex=0}parse(){this.parseDocComment(),this.currentText.length>0&&this.pieces.push({kind:"text",text:this.currentText});const{pieces:e}=this,t=e.map(e=>{switch(e.kind){case"text":return e.text;case"reference":return e.referenceRange.text}}).join("");return{result:{text:t,pieces:this.pieces},errors:this.errors}}parseDocComment(){const e=/\[\[|\]\]|\[|\]/g;for(;this.charIndex<this.content.length;){e.lastIndex=this.charIndex;const t=e.exec(this.content);if(!t){this.currentText+=this.content.slice(this.charIndex);break}t.index>this.charIndex&&(this.currentText+=this.content.slice(this.charIndex,t.index));const n=t[0];if(this.charIndex=t.index,"[["===n)this.currentText+="[",this.charIndex+=2;else if("]]"===n)this.currentText+="]",this.charIndex+=2;else if("["===n){this.currentText.length>0&&(this.pieces.push({kind:"text",text:this.currentText}),this.currentText="");const e=this.parseReference();this.pieces.push(e)}else"]"===n&&(this.currentText+=n,this.charIndex++)}}parseReference(){const{content:e,docComment:t}=this,n=this.charIndex,i=t.text.length-e.length,s=t.position+i+n,r=e.indexOf("]",n),o=r<0?e.length:r+1,a=e.slice(n,o),l={text:a,originalText:a,position:s,line:t.line,colNumber:s-t.line.position};let c=!1;r<0&&(c=!0,this.errors.push({token:l,message:"Unterminated reference"})),this.charIndex++;const h=/[a-zA-Z][_a-zA-Z0-9]*/g,u=[];for(;this.charIndex<o;){const n=e[this.charIndex],i=t.text.length-e.length,s=t.position+i+this.charIndex,r=e=>({text:e,originalText:e,position:s,line:t.line,colNumber:s-t.line.position});if("."===n)u.push(r(".")),this.charIndex++;else if(/^[a-zA-Z]/.test(n)){h.lastIndex=this.charIndex;const t=h.exec(e)[0];u.push(r(t)),this.charIndex+=t.length}else if("]"===n)u.push(r("]")),this.charIndex++;else{const n=t.text.length-e.length,i=this.docComment.colNumber+n+this.charIndex;c=!0,this.errors.push({token:l,message:`Invalid character in reference at column ${i+1}`}),this.charIndex=o}}if(!c&&this.completionMode){const{position:e}=this.completionMode,n=s,r=t.position+i+o;if(e>=n&&e<r){const n=u.some(t=>/^[a-zA-Z]/.test(t.text)&&e>=t.position&&e<=t.position+t.text.length);if(!n){const n={text:"...",originalText:"",position:e,line:t.line,colNumber:e-t.line.position},i=u.findIndex(t=>t.position>=e);-1===i?u.push(n):u.splice(i,0,n)}}}return{kind:"reference",nameParts:c?[]:this.parseNameParts(u),absolute:"."===u[0]?.text,referee:void 0,docComment:this.docComment,referenceRange:l}}parseNameParts(e){const t=[];let n="identifier or '.'";for(const i of e){let e;if(/^[a-zA-Z]/.test(i.text)||"..."===i.text)e="identifier or '.'"===n||"identifier"===n,n="'.' or ']'",t.push({token:i,declaration:void 0});else if("."===i.text)e="identifier or '.'"===n||"'.' or ']'"===n,n="identifier";else{if("]"!==i.text)throw new Error(`Unexpected token in doc reference: ${i.text}`);e="'.' or ']'"===n}if(!e)return this.errors.push({token:i,expected:n}),[];if("]"===i.text)return t}return[]}}const pg=Object.freeze({text:"",pieces:Object.freeze([])});function mg(e,t){const{modulePath:n,sourceCode:i}=e,s=[],r=new Ig(e,t,s),o=gg(r,"module"),a=o.filter(e=>"broken-constant"===e.kind),l=o.filter(e=>"broken-method"===e.kind),c=o.filter(e=>"broken-constant"!==e.kind&&"broken-method"!==e.kind);r.expectThenNext([""]);const h={},u=new Map;for(const e of c){let t,i,r;if("import"===e.kind?(t=e.importedNames,i=$g(e.modulePath,n,s),r=e):"import-alias"===e.kind?(t=[e.name],i=$g(e.modulePath,n,s),r=e):t=[e.name],i){let e=u.get(i);e||(e=[],u.set(i,e)),e.push(r),r.resolvedModulePath=i}for(const n of t){const t=n.text;t in h?s.push({token:n,message:`Duplicate identifier '${t}'`}):h[t]=e}}const d=function(e,t,n){let i,s="no-import-seen",r=-1,o=!1;for(const t of e)"import"===t.kind||"import-alias"===t.kind?("no-import-seen"===s?(s="first-legal-import-seen",i=t.range.start):"last-legal-import-seen"===s&&(n.push({token:t.importToken,message:"Import declarations must be grouped together at the top"}),o=!0),r=Math.max(r,t.range.end)):s="last-legal-import-seen";if(void 0===i||o)return null;const a={start:i,end:r};{let e=t.tokensWithComments;e=e.slice(e.findIndex(e=>e.position>=a.start)),e=e.slice(0,e.findIndex(e=>e.position>=a.end));for(const t of e)t.text.startsWith("//")&&(n.push({token:t,message:"Comments not allowed within import block"}),o=!0)}return o?null:a}(c,e,s),f={};for(const[e,t]of u){const n=t.filter(e=>"import"===e.kind),i=t.filter(e=>"import-alias"===e.kind);if(n.length&&i.length)for(const e of n)s.push({token:e.modulePath,message:"Module already imported with an alias"});else if(i.length>=2)for(const e of i.slice(1))s.push({token:e.modulePath,message:"Module already imported with a different alias"});else if(n.length){const t=new Set;for(const e of n)for(const n of e.importedNames)t.add(n.text);f[e]={kind:"some",names:t}}else{const t=i[0].name.text;f[e]={kind:"all",alias:t}}}const p=c.filter(e=>"method"===e.kind),m=c.filter(e=>"constant"===e.kind);return{result:{kind:"module",path:n,sourceCode:i,nameToDeclaration:h,declarations:c,importBlockRange:d,records:Bg(c),pathToImportedNames:f,methods:p,brokenMethods:l,constants:m,brokenConstants:a},errors:s}}function gg(e,t){const n=[],i=e=>""===e||"module"!==t&&"}"===e,s=e=>"}"===e||";"===e;for(;!i(e.current);){const i=e.index,r=bg(e,t);if(null!==r)n.push(r),"method"!==r.kind&&"broken-method"!==r.kind||(r.inlineRequestRecord&&n.push(r.inlineRequestRecord),r.inlineResponseRecord&&n.push(r.inlineResponseRecord));else{const t=e.index===i;if(t&&(e.next(),s(e.previous)))continue;if(t||""!==e.current&&!s(e.previous)){let t=0;for(;;){const n=e.current;if(""===n)break;if(e.next(),"{"===n?++t:"}"===n&&--t,t<=0&&s(n))break}}}}return n}function bg(e,t){const n=function(e){const{moduleTokens:t}=e,n=[];for(;e.current.startsWith("///");)n.push(e.currentToken),e.next();return function(e){if(e.length<=0)return pg;const t=e.map(e=>e.text).join("\n"),n=[];for(let t=0;t<e.length;++t){const i=e[t];0!==t&&n.push({kind:"text",text:"\n"}),i.pieces.forEach(e=>n.push(e))}return{text:t,pieces:n}}(n.map(e=>t.posToDoc[e.position]??Ng))}(e);let i="enum";const s="module"===t,r=["struct","enum",s?null:"removed",s?null:Mg,s?"import":null,s?"method":null,s?"const":null],o=e.expectThenNext(r);switch(o.case){case 0:i="struct";case 1:return vg(e,i,n);case 2:return function(e,t){const n=[];let i,s="?";e:for(;;){const r="?"===s||","===s||".."===s,o=[","===s||".."===s?",":null,"?"===s||"0"===s||"1"===s?Eg:null,r?";":null,".."===s?"..":null],a=e.expectThenNext(o);switch(a.case){case 0:s="0";break;case 1:{const r=+a.token.text;if(void 0===i)s="..",n.push(r);else{s=",",r<=i&&e.errors.push({token:t,message:"Upper bound must be greater than lower bound"});for(let e=i;e<=r;++e)n.push(e);i=void 0}break}case 2:break e;case 3:s="1",i=n.pop();break;case-1:if(r)break e;return null}}const r=new Set;for(const i of n){if(r.has(i))return e.errors.push({token:t,message:`Duplicate field number ${i}`}),null;r.add(i)}return{kind:"removed",removedToken:t,numbers:n}}(e,o.token);case 3:return function(e,t,n,i){let s,r,o=-1;const a=()=>({kind:"field",name:t,number:o,doc:n,unresolvedType:s,type:void 0,isRecursive:!1,inlineRecord:r});for(;;){const n=void 0!==s||"enum"===i,l=[void 0===s&&o<0?":":null,o<0&&n?"=":null,n?";":null];switch(e.expectThenNext(l).case){case 0:{const n=wg(e,{context:"field",originalName:t});if(s=n.type,r=n.inlineRecord,void 0===s)return null;break}case 1:if(o=Cg(e),o<0)return null;break;case 2:return ug(t,s?"lower_underscore":"UPPER_UNDERSCORE",e.errors),"enum"===i&&"UNKNOWN"===t.text&&e.errors.push({token:t,message:"Cannot name field of enum: UNKNOWN"}),a();case-1:return n?a():null}}}(e,o.token,n,t);case 4:return function(e,t){const n=e.expectThenNext(["*","{",Mg]);switch(n.case){case 0:return function(e,t){if(e.expectThenNext(["as"]).case<0)return null;const n=e.expectThenNext([Mg]);if(n.case<0)return null;if(ug(n.token,"lower_underscore",e.errors),e.expectThenNext(["from"]).case<0)return null;const i=e.expectThenNext([_g]);if(i.case<0)return null;const s={start:t.position,end:e.currentToken.position+e.current.length};e.expectThenNext([";"]);const r=i.token;return{kind:"import-alias",importToken:t,name:n.token,range:s,modulePath:r}}(e,t);case 1:return Ag(e,t);case 2:return Ag(e,t,n.token);default:return null}}(e,o.token);case 5:return function(e,t){const n=e.expectThenNext([Mg]);if(n.case<0)return null;const i=n.token;if(ug(i,"UpperCamel",e.errors),e.expectThenNext(["("]).case<0)return null;const s=wg(e,{context:"method-request",originalName:i}),r=s.type;if(!r)return null;if(e.expectThenNext([")"]).case<0)return null;if(e.expectThenNext([":"]).case<0)return{kind:"broken-method",unresolvedRequestType:r,inlineRequestRecord:s.inlineRecord,unresolvedResponseType:void 0,inlineResponseRecord:void 0};const o=wg(e,{context:"method-response",originalName:i}),a=o.type;if(!a)return null;if(e.expectThenNext(["="]).case<0)return{kind:"broken-method",unresolvedRequestType:r,inlineRequestRecord:s.inlineRecord,unresolvedResponseType:a,inlineResponseRecord:o.inlineRecord};const l=Cg(e,"?");if(-2===l)return null;return e.expectThenNext([";"]),{kind:"method",name:n.token,doc:t,unresolvedRequestType:r,unresolvedResponseType:a,requestType:void 0,responseType:void 0,number:l,inlineRequestRecord:s.inlineRecord,inlineResponseRecord:o.inlineRecord}}(e,n);case 6:return function(e,t){const n=e.expectThenNext([Mg]);if(n.case<0)return null;if(ug(n.token,"UPPER_UNDERSCORE",e.errors),e.expectThenNext([":"]).case<0)return null;const i=xg(e);if(!i)return null;if(e.expectThenNext(["="]).case<0)return{kind:"broken-constant",unresolvedType:i};const s=Tg(e);if(null===s)return null;return e.expectThenNext([";"]),{kind:"constant",name:n.token,doc:t,unresolvedType:i,type:void 0,value:s,valueAsDenseJson:void 0}}(e,n);default:return null}}class yg{constructor(e,t,n,i,s,r){this.recordName=e,this.recordType=t,this.doc=n,this.stableId=i,this.inlineContext=s,this.errors=r,this.nameToDeclaration={},this.numbers=new Set,this.numbering="",this.removedNumbers=[]}addDeclaration(e){if("broken"===this.numbering)return;let t,n,i=[],s=this.numbering;const r=this.numbers.size+("enum"===this.recordType?1:0);switch(e.kind){case"field":t=e.name,n=t,s=e.number<0?"implicit":"explicit",e.number<0&&(e={...e,number:r}),i=[e.number];break;case"record":t=e.name,n=t;break;case"removed":n=e.removedToken,e.numbers.length?(s="explicit",i=e.numbers):(s="implicit",i=[r])}if(""===this.numbering?this.numbering=s:this.numbering!==s&&(this.errors.push({token:n,message:"Cannot mix implicit and explicit numbering"}),this.numbering="broken"),void 0!==t){const n=t.text;if(n in this.nameToDeclaration)return void this.errors.push({token:t,message:`Duplicate identifier '${n}'`});this.nameToDeclaration[n]=e}for(const e of i){if(this.numbers.has(e))return this.errors.push({token:n,message:`Duplicate field number ${e}`}),void(this.numbering="broken");if(0===e&&"enum"===this.recordType)return void this.errors.push({token:n,message:"Number 0 is reserved for UNKNOWN field"});this.numbers.add(e)}"removed"===e.kind&&this.removedNumbers.push(...i)}build(){const e="struct"===this.recordType;if(e)for(let e=0;e<this.numbers.size;++e)if(!this.numbers.has(e)){this.errors.push({token:this.recordName,message:`Missing field number ${e}`});break}const t=Object.values(this.nameToDeclaration),n=t.filter(e=>"field"===e.kind),i=t.filter(e=>"record"===e.kind),{recordName:s}=this;let r=`${s.line.modulePath}:${s.position}`;this.inlineContext&&(r+=`:${this.inlineContext.context}`);const o=e&&n.length?Math.max(...n.map(e=>e.number))+1:0,a=e?this.numbers.size:0;return{kind:"record",key:r,name:this.recordName,recordType:this.recordType,doc:this.doc,nameToDeclaration:this.nameToDeclaration,declarations:Object.values(this.nameToDeclaration),fields:n,nestedRecords:i,removedNumbers:this.removedNumbers.sort(),recordNumber:this.stableId,numSlots:o,numSlotsInclRemovedNumbers:a}}}function vg(e,t,n,i){let s;if(i){const{originalName:e}=i;let t=function(e,t){let n;switch(n=e.includes("_")||!/[a-z]/.test(e)?e.split("_").map(e=>e.toLowerCase()):e.split(/(?=[A-Z])/).map(e=>e.toLowerCase()),t){case"lowerCamel":return n.map((e,t)=>t?Qm(e):e).join("");case"lower_underscore":return n.join("_");case"UpperCamel":return n.map(Qm).join("");case"UPPER_UNDERSCORE":return n.map(e=>e.toUpperCase()).join("_")}}(e.text,"UpperCamel");"method-request"===i.context?t+="Request":"method-response"===i.context&&(t+="Response"),s={...e,text:t}}else{const t=e.expectThenNext([Mg]);if(t.case<0)return null;ug(t.token,"UpperCamel",e.errors),s=t.token}let r=null;if("("===e.current){if(e.next(),r=Cg(e,"?"),-2===r)return null;if(e.expectThenNext([")"]).case<0)return null}if(e.expectThenNext(["{"]).case<0)return null;const o=gg(e,t);e.expectThenNext(["}"]);const a=new yg(s,t,n,r,i,e.errors);for(const e of o)a.addDeclaration(e),"field"===e.kind&&e.inlineRecord&&a.addDeclaration(e.inlineRecord);return a.build()}const kg=new Set(["bool","int32","int64","hash64","float32","float64","timestamp","string","bytes"]);function wg(e,t){if("struct"===e.current||"enum"===e.current){const n=e.current;e.next();const i=vg(e,n,Ng,t);return{type:i?{kind:"record",nameParts:[i.name],absolute:!1}:void 0,inlineRecord:i||void 0}}return{type:xg(e),inlineRecord:void 0}}function xg(e){const t=e.expectThenNext(["[",Mg,"."]);let n;switch(t.case){case 0:n=function(e){const t=xg(e);if(void 0===t)return;let n;for(;;){const i=!n&&"record"===t.kind,s=e.expectThenNext([i?"|":null,"]"]);switch(s.case){case 0:if(n=Sg(e,s.token),null===n)return;break;case 1:return{kind:"array",item:t,key:n};default:return}}}(e);break;case 1:if(kg.has(t.token.text)){n={kind:"primitive",primitive:t.token.text};break}case 2:n=function(e,t){const n="."===t.text,i=[];if("."===t.text){const t=e.expectThenNext([Mg]);if(t.case<0)return;i.push(t.token)}else i.push(t);for(;"."===e.current;){e.next();const t=e.expectThenNext([Mg]);if(t.case<0)return;i.push(t.token)}return{kind:"record",nameParts:i,absolute:n}}(e,t.token);break;default:return}if(void 0!==n)return"?"===e.current?(e.next(),{kind:"optional",other:n}):n}function Sg(e,t){const n=[];for(;;){const t=e.expectThenNext([Mg]);if(t.case<0)return;if(n.push(t.token),"."!==e.current)break;e.next()}const i=n.map(e=>({name:e}));return{pipeToken:t,path:i,keyType:{kind:"primitive",primitive:"bool"}}}function Cg(e,t){if(t&&"lenient"===e.mode&&"?"===e.current)return e.next(),-1;const n=e.expectThenNext([Eg]);if(n.case<0)return-2;const{text:i}=n.token;return BigInt(i)<BigInt(2**32)?+i:(e.errors.push({token:n.token,message:"Value out of uint32 range"}),-2)}function Ag(e,t,n){const i=n?[n]:[];if(n)for(;","===e.current;){e.next();const t=e.expectThenNext([Mg]);if(t.case<0)return null;i.push(t.token)}else for(;;){let t=e.expectThenNext([Mg,"}"]);if(0!==t.case){if(1===t.case)break;return null}if(i.push(t.token),t=e.expectThenNext([",","}"]),1===t.case)break;if(t.case<0)return null}if(e.expectThenNext(["from"]).case<0)return null;const s=e.expectThenNext([_g]);if(s.case<0)return null;const r={start:t.position,end:e.currentToken.position+e.current.length};e.expectThenNext([";"]);return{kind:"import",importToken:t,importedNames:i,range:r,modulePath:s.token}}function Tg(e){const t=["{","{|","[","false","true","null",Dg,_g],n=e.expectThenNext(t);switch(n.case){case 0:case 1:{const t=1===n.case;return function(e,t,n){const i=n?"|}":"}",s={},r=[],o=()=>({kind:"object",token:e,entries:s,orphanNames:r,partial:n});for(;;){if(t.current===i)return t.next(),o();const e=t.expectThenNext([Mg]);if(e.case<0)return null;const n=e.token,a=e.token.text;if(t.expectThenNext([":"]).case<0){r.push(n);continue}a in s&&t.errors.push({token:e.token,message:"Duplicate field"});const l=Tg(t);if(null===l)return null;s[a]={name:n,value:l};const c=t.expectThenNext([",",i]);if(c.case<0)return null;if(c.token.text===i)return o()}}(n.token,e,t)}case 2:{const t=function(e){if("]"===e.current)return e.next(),[];const t=[];for(;;){const n=Tg(e);if(null===n)return null;t.push(n);const i=e.expectThenNext([",","]"]);if(i.case<0)return null;if("]"===i.token.text)return t;if("]"===e.current)return e.next(),t}}(e);return null===t?null:{kind:"array",token:n.token,items:t}}case 3:case 4:case 5:case 6:case 7:return{kind:"literal",token:n.token};default:return null}}const Ng=Object.freeze({text:"",pieces:Object.freeze([])});class Og{}const Mg=new class extends Og{matches(e){return/^\w/.test(e)||"..."===e}what(){return"identifier"}};const Eg=new class extends Og{matches(e){return/^[0-9]+$/.test(e)}what(){return"positive integer"}};const Dg=new class extends Og{matches(e){return/^[0-9-]/.test(e)}what(){return"number"}};const _g=new class extends Og{matches(e){return/^["']/.test(e)}what(){return"string literal"}};class Ig{constructor(e,t,n){this.moduleTokens=e,this.mode=t,this.errors=n,this.tokenIndex=0,this.tokens=e.tokens}expectThenNext(e){let t=this.tokens[this.tokenIndex];for(;t.text.startsWith("///");)this.errors.push({token:t,message:"Doc comments can only precede declarations"}),++this.tokenIndex,t=this.tokens[this.tokenIndex];for(let n=0;n<e.length;++n){const i=e[n];if(null===i)continue;if(i instanceof Og?i.matches(t.text):t.text===i)return++this.tokenIndex,{case:n,token:t}}const n=[];for(let t=0;t<e.length;++t){const i=e[t];null!==i&&n.push(i instanceof Og?i.what():`'${i}'`)}const i=1===n.length?n[0]:`one of: ${n.join(", ")}`;return this.errors.push({token:t,expected:i}),{case:-1,token:t}}get currentToken(){return this.tokens[this.tokenIndex]}get current(){return this.currentToken.text}get previous(){return this.tokens[this.tokenIndex-1].text}next(){++this.tokenIndex}get index(){return this.tokenIndex}}function Bg(e){const t=[],n=(e,i)=>{for(const s of e){if("record"!==s.kind)continue;const e=i.concat([s]),r={kind:"record-location",record:s,recordAncestors:e,modulePath:s.name.line.modulePath};n(s.declarations,e),t.push(r)}};return n(e,[]),t}function Pg(e){const t=e.match(/^(@[^/]+\/[^/]+\/)/);return t?.at(1)??""}function Rg(e){const t=e.split("/"),n=[];for(const e of t)".."===e?n.length>0&&".."!==n[n.length-1]?n.pop():n.push(".."):"."!==e&&""!==e&&n.push(e);return 0===n.length?".":n.join("/")}function $g(e,t,n){let i=Xm(e.text);if(/\\/.test(i))n.push({token:e,message:"Replace backslash with slash"});else{if(i.startsWith("./")||i.startsWith("../")){if(i.includes("/@"))return void n.push({token:e,message:"Use absolute path"});i=Rg(function(e){const t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}(t)+"/"+i)}else if(t.startsWith("@")&&!i.startsWith("@")){i=Pg(t)+i}if(i=Rg(i),!i.startsWith("../"))return i;n.push({token:e,message:"Module path must point to a file within skir-src"})}}function Lg(e,t){return/^[0-9]/.test(e.text)?(t.push({token:e,message:"Invalid number"}),!1):e.text.startsWith("_")?(t.push({token:e,message:"Identifier cannot start with _"}),!1):e.text.endsWith("_")?(t.push({token:e,message:"Identifier cannot end with _"}),!1):e.text.includes("__")?(t.push({token:e,message:"Identifier cannot contain __ sequence"}),!1):!/_[0-9]/.test(e.text)||(t.push({token:e,message:"Digit cannot follow _"}),!1)}class zg{constructor(e,t){this.lines=[];const n=this.lines;let i,s=0;const r=/\n|\r|\n\r|$/g;for(;null!==(i=r.exec(e));){const o=i[0],a=r.lastIndex-o.length,l=e.substring(s,a);if(n.push({lineNumber:n.length,line:l,position:s,modulePath:t}),s=r.lastIndex,""===o)break}}advancePosition(e){const t=this.lines;for(;t.length>=2&&e>=this.lines[1].position;)t.shift();return t[0]}}class Fg{static compile(e,t,n="strict"){return new Fg(e,t,n)}static compileForCompletion(e,t,n,i){if(!n.has(e))throw new Error(`Not found: ${e}`);return new Fg(n,i,"lenient",{modulePath:e,position:t}).modules.get(e)}constructor(e,t,n,i){this.modulePathToContent=e,this.parseMode=n,this.completionMode=i,this.moduleBundles=new Map,this.registry=new Ug,this.cache=t?new Wg(e,t.moduleBundles,t.registry):void 0;const s=i?[i.modulePath]:e.keys();for(const e of s)this.parseAndResolve(e,new Set);this.finalizationResult=this.finalize(),this.cache=void 0}parseAndResolve(e,t){const n=this.moduleBundles.get(e);if(void 0!==n)return n;const i=this.doParseAndResolve(e,t);return i&&this.moduleBundles.set(e,i),i}doParseAndResolve(e,t){const n=this.modulePathToContent.get(e);if(void 0===n)return null;let i,s;{let t;switch(t=e===this.completionMode?.modulePath?{kind:"no-cache"}:this.cache?.getModuleCacheResult(e)??{kind:"no-cache"},t.kind){case"no-cache":i=function(e,t,n){const i=[],s=[],r=new zg(e,t),o=/(\/\*([^*]|\*[^/])*(\*\/)?)|(\/\/[^\n\r]*)|(-?(0|[1-9][0-9]*)(\.[0-9]+)?\b)|\b(\w+)\b|([ \n\r\t]+)|(\.\.|\{\||\|\}|[{}[\]()*.:=;|?,])|("(\\(\n|\r|\n\r|.)|[^\\"\n\r])*"?)|('(\\(\n|\r|\n\r|.)|[^\\'\n\r])*'?)|($)/g;let a,l=0;for(;null!==(a=o.exec(e));){const t=o.lastIndex-a[0].length;if(t!==l){const n=r.advancePosition(l),i=l-n.position,o=e.substring(l,t);s.push({token:{text:o,originalText:o,position:l,line:n,colNumber:i},message:"Invalid sequence of characters"})}l=o.lastIndex;const n=r.advancePosition(t),c=t-n.position,h={text:a[0],originalText:a[0],position:t,line:n,colNumber:c};if(void 0===a[1]||a[1].endsWith("*/")||s.push({token:h,message:"Unterminated multi-line comment"}),void 0!==a[8]&&!Lg(h,s))continue;if(void 0!==a[9])continue;const u=a[11]||a[14];if(void 0!==u){if(!u.endsWith(u[0])){s.push({token:h,message:"Unterminated string literal"});continue}if(!/^["'](\\(\r\n|u[0-9A-Fa-f]{4}|["'\\/bfnrt\n\r])|[^\\])*["']$/.test(u)){s.push({token:h,message:"String literal contains invalid escape sequence"});continue}const e=Xm(u);try{encodeURIComponent(e)}catch{s.push({token:h,message:"String literal contains lone surrogates"});continue}}if(i.push(h),void 0!==a[17])break}if(void 0!==n){const{position:s}=n,r=i.find(e=>{const t=e.position,n=e.position+e.text.length;return/^\w/.test(e.text)?s>=t&&s<=n:s>t&&s<n});if(void 0===r){const n=new zg(e,t).advancePosition(s),r=s-n.position,o={text:"...",originalText:"",position:s,line:n,colNumber:r},a=i.findIndex(e=>e.position>=s);-1===a?i.push(o):i.splice(a,0,o)}}const c={};for(const e of i){if(!e.text.startsWith("///"))continue;const t=dg(e,n);c[e.position]=t.result,t.errors.forEach(e=>s.push(e))}return{result:{tokens:i.filter(e=>{return!((t=e.originalText).startsWith("/*")||t.startsWith("//")&&!t.startsWith("///"));var t}),tokensWithComments:i,posToDoc:c,sourceCode:e,modulePath:t},errors:s}}(n,e,this.completionMode);break;case"module-tokens":i=t.tokens;break;case"module-bundle":return this.registry.mergeFrom(t.bundle.registry),t.bundle}}const r=[];{const e=mg(i.result,this.parseMode);r.push(...e.errors),s=e.result}const o=new Vg(i,{result:s,errors:r});for(const n of s.declarations){if("import"!==n.kind&&"import-alias"!==n.kind)continue;const i=n.resolvedModulePath;if(void 0===i)continue;const s="Circular dependency between modules";if(t.has(e)){r.push({token:n.modulePath,message:s});continue}t.add(e);const o=this.parseAndResolve(i,t);if(t.delete(e),null===o)r.push({token:n.modulePath,message:"Module not found",expectedNames:Kg(Xm(n.modulePath.text),e,this.modulePathToContent.keys())});else if(0!==o.tokens.errors.length||0!==o.module.errors.length){const e=o.module.errors.some(e=>e.message===s);e?r.push({token:n.modulePath,message:s}):r.push({token:n.modulePath,message:"Imported module has errors",errorIsInOtherModule:!0})}else if("import"===n.kind)for(const e of n.importedNames){const t=o.module.result.nameToDeclaration[e.text];void 0===t?r.push({token:e,message:"Not found",expectedNames:eg(o.module.result.nameToDeclaration,e=>"record"===e.kind)}):"import"===t.kind?r.push({token:e,message:"Cannot reimport imported record"}):"record"!==t.kind&&r.push({token:e,message:"Not a record"})}}if(r.length&&!this.completionMode)return o;for(const t of s.records){const{key:n}=t.record;this.registry.recordMap.set(n,t),o.registry.recordMap.set(n,t);const{recordNumber:i}=t.record;null==i||e.startsWith("@")||o.registry.pushNumberRecord(i,n)}const a=new Set,l=new jg(s,this.moduleBundles,this.completionMode?this.cache?.registry.topLevelNameToRecordLocations:void 0,a,r);for(const e of s.records)this.storeResolvedFieldTypes(e,l);const c=e=>ng(e,s,e=>this.moduleBundles.get(e)?.module.result,this.recordMap,r);for(const e of s.records){const{record:t}=e;this.storeFieldRecursivity(t);for(const e of t.fields){const{type:n}=e;n&&this.validateArrayKeys(n,r),c({kind:"field",field:e,record:t})}c(t)}const h=e=>{const t=l.resolve(e,"top-level");return t&&this.validateArrayKeys(t,r),t};for(const t of s.methods){const{unresolvedRequestType:n,unresolvedResponseType:i}=t;t.requestType=h(n),t.responseType=h(i);const{number:s}=t;e.startsWith("@")||o.registry.pushNumberMethod(s,t),c(t)}for(const e of s.brokenMethods){const{unresolvedRequestType:t,unresolvedResponseType:n}=e;h(t),n&&h(n)}for(const e of s.constants){const{unresolvedType:t}=e,n=h(t);e.type=n,n&&(e.valueAsDenseJson=this.valueToDenseJson(e.value,n,r)),c(e)}for(const e of s.brokenConstants){const{unresolvedType:t}=e;h(t)}return o.registry.pushTopLevelNames(s.declarations.filter(e=>"record"===e.kind).map(t=>({name:t.name.text,doc:t.doc,modulePath:e}))),function(e,t,n){for(const i of e.declarations)if("import"===i.kind)for(const e of i.importedNames)t.has(e.text)||n.push({token:e,message:"Unused import"});else"import-alias"===i.kind&&(t.has(i.name.text)||n.push({token:i.name,message:"Unused import alias"}))}(s,a,r),this.registry.mergeFrom(o.registry),o}storeResolvedFieldTypes(e,t){for(const n of e.record.fields)void 0!==n.unresolvedType&&(n.type=t.resolve(n.unresolvedType,e))}storeFieldRecursivity(e){for(const t of e.fields){if(!t.type)continue;const n="struct"===e.recordType?["hard","via-optional","soft"]:["soft"];for(const i of n){const n=new Set;if(this.collectTypeDeps(t.type,i,n),n.has(e.key)){t.isRecursive=i;break}}}}collectTypeDeps(e,t,n){switch(e.kind){case"record":{if("via-optional"===t)return;const{key:i}=e;if(n.has(i))return;n.add(i);const s=this.recordMap.get(i)?.record;if(!s)return void console.error("collectTypeDeps: record not found",i);if("hard"===t&&"enum"===s.recordType)return;for(const e of s.fields)void 0!==e.type&&this.collectTypeDeps(e.type,t,n);break}case"array":"soft"===t&&this.collectTypeDeps(e.item,t,n);break;case"optional":switch(t){case"soft":this.collectTypeDeps(e.other,t,n);break;case"via-optional":this.collectTypeDeps(e.other,"hard",n)}}}validateArrayKeys(e,t){const n=e=>{const{key:n,item:i}=e;if(!n)return;const{path:s}=n;let r,o=i;for(let e=0;e<s.length;++e){const i=s[e],a=i.name;if("record"!==o.kind){if(0===e)t.push({token:n.pipeToken,message:"Item must have struct type"});else{const n=s[e-1].name;t.push({token:n,message:"Must have struct type"})}return}const l=this.recordMap.get(o.key)?.record;if(!l)return void console.error("validateArrayKeys: record not found",o.key);if("struct"===l.recordType){const e=l.nameToDeclaration[a.text];if("field"!==e?.kind)return void t.push({token:a,message:`Field not found in struct ${l.name.text}`,expectedNames:eg(l.nameToDeclaration,e=>"field"===e.kind)});if(i.declaration=e,!e.type)return;o=e.type}else{if("kind"!==a.text)return void t.push({token:a,expected:"'kind'",expectedNames:[{name:"kind"}]});r=o,o={kind:"primitive",primitive:"string"}}}"primitive"===o.kind?n.keyType=r||o:t.push({token:s.at(-1).name,message:"Does not have primitive type"})},i=e=>{switch(e.kind){case"array":return n(e),i(e.item);case"optional":return i(e.other)}};i(e)}valueToDenseJson(e,t,n){switch(t.kind){case"optional":return"literal"===e.kind&&"null"===e.token.text?(e.type={kind:"null"},null):this.valueToDenseJson(e,t.other,n);case"array":{if("array"!==e.kind)return void n.push({token:e.token,expected:"array"});const i=[];let s=!0;for(const r of e.items){const e=this.valueToDenseJson(r,t.item,n);void 0!==e?i.push(e):s=!1}if(!s)return;const{key:r}=t;return e.key=r,r&&function(e,t,n){const{keyType:i,path:s}=t,r=e=>{let t=e;for(const e of s){const i=e.name;if("literal"===t.kind&&"kind"===i.text)return t;if("object"!==t.kind)return;const s=t.entries[i.text];if(!s)return void n.push({token:t.token,message:`Missing entry: ${i.text}`});t=s.value}return t},o=new Map;for(const t of e){const e=r(t);if(!e)return;if("literal"!==e.kind)return;let n;const s=e.token.text;if("primitive"===i.kind){const{primitive:e}=i;if(!og(s,e))continue;n=hg(s,e)}else{if(!ag(s))continue;n=Xm(s)}o.has(n)?o.get(n).push(e):o.set(n,[e])}for(const e of o.values())if(!(e.length<=1))for(const t of e)n.push({token:t.token,message:"Duplicate key"})}(e.items,r,n),i}case"record":{const i=this.recordMap.get(t.key);if(!i)return;return"struct"===i.record.recordType?this.structValueToDenseJson(e,i.record,n):this.enumValueToDenseJson(e,i.record,n)}case"primitive":{const{token:i}=e,{primitive:s}=t;return"literal"===e.kind&&og(i.text,s)?(e.type=t,cg(i.text,t.primitive)):void n.push({token:e.token,expected:s})}}}structValueToDenseJson(e,t,n){const{token:i}=e;if("object"!==e.kind)return void n.push({token:i,expected:"object"});const s=Array(t.numSlotsInclRemovedNumbers).fill(0);let r=!0;const o=Object.values(e.entries).map(e=>e.name).concat(e.orphanNames),a=new Set(o.map(e=>e.text));for(const e of o){const i=t.nameToDeclaration[e.text];"field"===i?.kind||(n.push({token:e,message:`Field not found in struct ${t.name.text}`,expectedNames:eg(t.nameToDeclaration,e=>"field"===e.kind&&!a.has(e.name.text))}),r=!1)}let l=0;for(const o of t.fields){const{type:t}=o;if(!t){r=!1;continue}const a=e.entries[o.name.text];let c;if(a?(a.fieldDeclaration=o,c=this.valueToDenseJson(a.value,t,n)):e.partial?c=this.getDefaultJson(t):n.push({token:i,message:`Missing entry: ${o.name.text}`}),void 0===c){r=!1;continue}s[o.number]=c;("optional"===t.kind?null===c:!c||Array.isArray(c)&&!c.length||"primitive"===t.kind&&("int64"===t.primitive||"hash64"===t.primitive)&&"0"===c)||(l=Math.max(l,o.number+1))}return r?(e.record=t,s.slice(0,l)):void 0}enumValueToDenseJson(e,t,n){const{token:i}=e;if("literal"===e.kind&&ag(i.text)){const s=Xm(i.text);if("UNKNOWN"===s)return 0;const r=t.nameToDeclaration[s];return"field"!==r?.kind?void n.push({token:i,message:`Variant not found in enum ${t.name.text}`,expectedNames:[{name:"UNKNOWN"}].concat(eg(t.nameToDeclaration,e=>"field"===e.kind&&!e.type))}):r.type?void n.push({token:i,message:"Refers to a wrapper variant"}):(e.type={kind:"enum",enum:t,variant:r},r.number)}if("object"===e.kind){const{entries:s}=e,r=s.kind,o=s.value,a=Object.values(s).map(e=>e.name).concat(e.orphanNames);for(const e of a){if("kind"===e.text||"value"===e.text)continue;const t=(r?[]:[{name:"kind"}]).concat(o?[]:[{name:"value"}]);return void n.push({token:e,message:"Extraneous entry",expectedNames:t})}if(!r)return void n.push({token:i,message:"Missing entry: kind"});const l=r.value.token;if("literal"!==r.value.kind||!ag(l.text))return void n.push({token:l,expected:"string"});const c=Xm(l.text),h=t.nameToDeclaration[c];if("field"!==h?.kind)return void n.push({token:l,message:`Variant not found in enum ${t.name.text}`,expectedNames:eg(t.nameToDeclaration,e=>"field"===e.kind&&!!e.type)});if(!h.type)return void n.push({token:l,message:"Refers to a constant variant"});if(!o)return void n.push({token:i,message:"Missing entry: value"});const u=this.valueToDenseJson(o.value,h.type,n);if(void 0===u)return;return e.record=t,[h.number,u]}n.push({token:i,expected:"string or object"})}getDefaultJson(e){switch(e.kind){case"primitive":switch(e.primitive){case"bool":case"int32":case"int64":case"hash64":case"float32":case"float64":case"timestamp":return 0;case"string":case"bytes":return"";default:{const t=e.primitive;throw new TypeError(t)}}case"array":return[];case"optional":return null;case"record":switch(this.recordMap.get(e.key).record.recordType){case"struct":return[];case"enum":return 0}}}finalize(){const e=new Map;for(const[t,n]of this.moduleBundles){const{module:i,tokens:s}=n,r=s.errors.length?s.errors:i.errors;e.set(t,{result:i.result,errors:[...r]})}for(const t of this.registry.numberToMethods.values()){if(t.length<=1)continue;const n=(t,n)=>{const i=t.name.line.modulePath,s=e.get(i),r=n.name.text,o=n.name.line.modulePath;s.errors.push({token:t.name,message:`Same number as ${r} in ${o}`})};n(t[0],t[1]);for(let e=1;e<t.length;++e)n(t[e],t[0])}for(const t of this.registry.numberToRecords.values()){if(t.length<=1)continue;const n=(t,n)=>{const i=this.registry.recordMap.get(t),s=this.registry.recordMap.get(n),r=i.record.name.line.modulePath,o=e.get(r),a=s.record.name.text,l=s.modulePath;o.errors.push({token:i.record.name,message:`Same number as ${a} in ${l}`})};n(t[0],t[1]);for(let e=1;e<t.length;++e)n(t[e],t[0])}const t=[];for(const n of e.values())t.push(...n.errors);return{modules:e,errors:t}}findRecordByNumber(e){const{numberToRecords:t,recordMap:n}=this.registry,i=t.get(e);return 1===i?.length?n.get(i[0]):void 0}findMethodByNumber(e){const{numberToMethods:t}=this.registry,n=t.get(e);return 1===n?.length?n[0]:void 0}get recordMap(){return this.registry.recordMap}get errors(){return this.finalizationResult.errors}get modules(){return this.finalizationResult.modules}}class jg{constructor(e,t,n,i,s){this.module=e,this.moduleBundles=t,this.topLevelNameToRecordLocations=n,this.usedImports=i,this.errors=s}resolve(e,t){switch(e.kind){case"primitive":return e;case"array":{const n=this.resolve(e.item,t);if(!n)return;return{kind:"array",item:n,key:e.key}}case"optional":{const n=this.resolve(e.other,t);if(!n)return;return{kind:"optional",other:n}}case"record":return this.resolveRecordRef(e,t)}}resolveRecordRef(e,t){const n=e.nameParts[0],i=e=>({token:e,message:"Does not refer to a struct or an enum"}),s=(e,t)=>({token:e,message:`Cannot find name '${e.text}'`,expectedNames:t}),{errors:r,module:o,moduleBundles:a,usedImports:l}=this;let c;const h=new tg;if("top-level"!==t&&!e.absolute)for(const e of[...t.recordAncestors].reverse()){const t=e.nameToDeclaration[n.text];if(t&&"record"===t.kind){c=e;break}h.collect(eg(e.nameToDeclaration,e=>"record"===e.kind))}if(void 0===c){if(!o.nameToDeclaration[n.text])return h.collect(eg(o.nameToDeclaration,e=>"record"===e.kind||"import"===e.kind||"import-alias"===e.kind)),h.collect(this.topLevelNameToRecordLocations?.get(n.text)?.filter(e=>e.modulePath!==o.path)??[]),void r.push(s(n,h.expectedNames));c=o}let u=c;const d=[];for(let t=0;t<e.nameParts.length;++t){const n=e.nameParts[t],o=n.text;let c=u.nameToDeclaration[o];if(void 0===c)return void r.push(s(n,eg(u.nameToDeclaration,e=>"record"===e.kind||0===t&&"import-alias"===e.kind||0===t&&"import"===e.kind)));if("record"===c.kind)u=c;else{if("import"!==c.kind&&"import-alias"!==c.kind)return void this.errors.push(i(n));{const e=()=>({token:n,message:"Cannot refer to imports of imported module"});if(0!==t)return void r.push(e());l.add(o);const h=c.resolvedModulePath;if(void 0===h)return;const d=a.get(h);if(!d)return;const f=d.module.result;if("import"===c.kind){if(c=f.nameToDeclaration[o],!c)return void r.push(s(n,eg(f.nameToDeclaration,e=>"record"===e.kind)));if("record"!==c.kind)return void this.errors.push("import"===c.kind||"import-alias"===c.kind?e():i(n));u=c}else u=f}}d.push({token:n,declaration:c})}if("record"!==u.kind){const t=e.nameParts[0];return void this.errors.push(i(t))}return{kind:"record",key:u.key,recordType:u.recordType,nameParts:d,refToken:e.nameParts.at(-1)}}}class Wg{constructor(e,t,n){this.registry=n,this.modulePathToCacheResult=new Map;const i=new Set;for(const[n,s]of e){const e=t.get(n);e?.tokens.result.sourceCode===s&&i.add(n)}const s=n=>{const i=t.get(n);if(!i)return{kind:"no-cache"};{const e=this.modulePathToCacheResult.get(n);if(e)return e}let r;if(e.get(n)===i.tokens.result.sourceCode){this.modulePathToCacheResult.set(n,{kind:"module-bundle",bundle:i});r=Object.keys(i.module.result?.pathToImportedNames).every(e=>"module-bundle"===s(e).kind)?{kind:"module-bundle",bundle:i}:{kind:"module-tokens",tokens:i.tokens}}else r={kind:"no-cache"};return this.modulePathToCacheResult.set(n,r),r};for(const e of t.keys())s(e)}getModuleCacheResult(e){return this.modulePathToCacheResult.get(e)??{kind:"no-cache"}}}class Ug{constructor(){this.recordMap=new Map,this.numberToRecords=new Map,this.numberToMethods=new Map,this.topLevelNameToRecordLocations=new Map}mergeFrom(e){for(const[t,n]of e.recordMap)this.recordMap.set(t,n);for(const[t,n]of e.numberToRecords){let e=this.numberToRecords.get(t);e||(e=[],this.numberToRecords.set(t,e)),e.push(...n)}for(const[t,n]of e.numberToMethods){let e=this.numberToMethods.get(t);e||(e=[],this.numberToMethods.set(t,e)),e.push(...n)}for(const[t,n]of e.topLevelNameToRecordLocations){let e=this.topLevelNameToRecordLocations.get(t);e||(e=[],this.topLevelNameToRecordLocations.set(t,e)),e.push(...n)}}pushNumberRecord(e,t){let n=this.numberToRecords.get(e);n||(n=[],this.numberToRecords.set(e,n)),n.push(t)}pushNumberMethod(e,t){let n=this.numberToMethods.get(e);n||(n=[],this.numberToMethods.set(e,n)),n.push(t)}pushTopLevelNames(e){for(const t of e){let e=this.topLevelNameToRecordLocations.get(t.name);e||(e=[],this.topLevelNameToRecordLocations.set(t.name,e)),e.push(t)}}}class Vg{constructor(e,t){this.tokens=e,this.module=t,this.registry=new Ug}}function Hg(e){const t=e.lastIndexOf("/");return t>=0?e.slice(0,t):""}function qg(e,t){const n=""===e?[]:e.split("/"),i=""===t?[]:t.split("/");let s=0;for(;s<n.length&&s<i.length&&n[s]===i[s];)s++;const r=n.length-s,o=i.slice(s);return[...Array(r).fill(".."),...o].join("/")}function Kg(e,t,n){const i=e.startsWith("./")||e.startsWith("../");let s;if(i){const n=e.lastIndexOf("/"),i=e.slice(0,n+1),r=e.slice(n+1),o=i+"__dummy__",a=function(e,t){const n=(e+"/"+t).split("/"),i=[];for(const e of n)".."===e?i.length>0&&".."!==i[i.length-1]?i.pop():i.push(".."):"."!==e&&""!==e&&i.push(e);return i.join("/")}(Hg(t),o.startsWith("./")?o.slice(2):o);s=a.slice(0,a.length-9)+r}else s=t.startsWith("@")&&!e.startsWith("@")?Pg(t)+e:e;if(s=s.replace(/\\/g,"/"),s.startsWith("../"))return[];const r=Hg(t),o=new Set;for(const a of n){if(!a.startsWith(s))continue;if(a===t)continue;if(i&&a.startsWith("@"))continue;const n=a.slice(s.length),l=n.indexOf("/"),c=l>=0?s+n.slice(0,l+1):a;if(i){const t=c.endsWith("/");let n=qg(r,t?c.slice(0,-1):c);""===n&&(n="."),n.startsWith(".")||(n="./"+n);const i=t?n+"/":n;if(e.startsWith("../")&&"./"===i)continue;o.add(i)}else o.add(c)}return[...o].map(e=>({name:e}))}const Jg=Symbol.for("yaml.alias"),Zg=Symbol.for("yaml.document"),Yg=Symbol.for("yaml.map"),Gg=Symbol.for("yaml.pair"),Qg=Symbol.for("yaml.scalar"),Xg=Symbol.for("yaml.seq"),eb=Symbol.for("yaml.node.type"),tb=e=>!!e&&"object"==typeof e&&e[eb]===Jg,nb=e=>!!e&&"object"==typeof e&&e[eb]===Zg,ib=e=>!!e&&"object"==typeof e&&e[eb]===Yg,sb=e=>!!e&&"object"==typeof e&&e[eb]===Gg,rb=e=>!!e&&"object"==typeof e&&e[eb]===Qg,ob=e=>!!e&&"object"==typeof e&&e[eb]===Xg;function ab(e){if(e&&"object"==typeof e)switch(e[eb]){case Yg:case Xg:return!0}return!1}function lb(e){if(e&&"object"==typeof e)switch(e[eb]){case Jg:case Yg:case Qg:case Xg:return!0}return!1}const cb=e=>(rb(e)||ab(e))&&!!e.anchor,hb=Symbol("break visit"),ub=Symbol("skip children"),db=Symbol("remove node");function fb(e,t){const n=function(e){if("object"==typeof e&&(e.Collection||e.Node||e.Value))return Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e);return e}(t);if(nb(e)){pb(null,e.contents,n,Object.freeze([e]))===db&&(e.contents=null)}else pb(null,e,n,Object.freeze([]))}function pb(e,t,n,i){const s=function(e,t,n,i){return"function"==typeof n?n(e,t,i):ib(t)?n.Map?.(e,t,i):ob(t)?n.Seq?.(e,t,i):sb(t)?n.Pair?.(e,t,i):rb(t)?n.Scalar?.(e,t,i):tb(t)?n.Alias?.(e,t,i):void 0}(e,t,n,i);if(lb(s)||sb(s))return function(e,t,n){const i=t[t.length-1];if(ab(i))i.items[e]=n;else if(sb(i))"key"===e?i.key=n:i.value=n;else{if(!nb(i)){const e=tb(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${e} parent`)}i.contents=n}}(e,i,s),pb(e,s,n,i);if("symbol"!=typeof s)if(ab(t)){i=Object.freeze(i.concat(t));for(let e=0;e<t.items.length;++e){const s=pb(e,t.items[e],n,i);if("number"==typeof s)e=s-1;else{if(s===hb)return hb;s===db&&(t.items.splice(e,1),e-=1)}}}else if(sb(t)){i=Object.freeze(i.concat(t));const e=pb("key",t.key,n,i);if(e===hb)return hb;e===db&&(t.key=null);const s=pb("value",t.value,n,i);if(s===hb)return hb;s===db&&(t.value=null)}return s}fb.BREAK=hb,fb.SKIP=ub,fb.REMOVE=db;const mb={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},gb=e=>e.replace(/[!,[\]{}]/g,e=>mb[e]);class bb{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},bb.defaultYaml,e),this.tags=Object.assign({},bb.defaultTags,t)}clone(){const e=new bb(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new bb(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:bb.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},bb.defaultTags)}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:bb.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},bb.defaultTags),this.atNextDocument=!1);const n=e.trim().split(/[ \t]+/),i=n.shift();switch(i){case"%TAG":{if(2!==n.length&&(t(0,"%TAG directive should contain exactly two parts"),n.length<2))return!1;const[e,i]=n;return this.tags[e]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,1!==n.length)return t(0,"%YAML directive should contain exactly one part"),!1;const[e]=n;if("1.1"===e||"1.2"===e)return this.yaml.version=e,!0;return t(6,`Unsupported YAML version ${e}`,/^\d+\.\d+$/.test(e)),!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 n=e.slice(2,-1);return"!"===n||"!!"===n?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(">"!==e[e.length-1]&&t("Verbatim tags must end with a >"),n)}const[,n,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const s=this.tags[n];if(s)try{return s+decodeURIComponent(i)}catch(e){return t(String(e)),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+gb(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&&lb(e.contents)){const t={};fb(e.contents,(e,n)=>{lb(n)&&n.tag&&(t[n.tag]=!0)}),i=Object.keys(t)}else i=[];for(const[s,r]of n)"!!"===s&&"tag:yaml.org,2002:"===r||e&&!i.some(e=>e.startsWith(r))||t.push(`%TAG ${s} ${r}`);return t.join("\n")}}function yb(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){const t=JSON.stringify(e);throw new Error(`Anchor must not contain whitespace or control characters: ${t}`)}return!0}function vb(e){const t=new Set;return fb(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function kb(e,t){for(let n=1;;++n){const i=`${e}${n}`;if(!t.has(i))return i}}function wb(e,t,n,i){if(i&&"object"==typeof i)if(Array.isArray(i))for(let t=0,n=i.length;t<n;++t){const n=i[t],s=wb(e,i,String(t),n);void 0===s?delete i[t]:s!==n&&(i[t]=s)}else if(i instanceof Map)for(const t of Array.from(i.keys())){const n=i.get(t),s=wb(e,i,t,n);void 0===s?i.delete(t):s!==n&&i.set(t,s)}else if(i instanceof Set)for(const t of Array.from(i)){const n=wb(e,i,t,t);void 0===n?i.delete(t):n!==t&&(i.delete(t),i.add(n))}else for(const[t,n]of Object.entries(i)){const s=wb(e,i,t,n);void 0===s?delete i[t]:s!==n&&(i[t]=s)}return e.call(t,n,i)}function xb(e,t,n){if(Array.isArray(e))return e.map((e,t)=>xb(e,String(t),n));if(e&&"function"==typeof e.toJSON){if(!n||!cb(e))return e.toJSON(t,n);const i={aliasCount:0,count:1,res:void 0};n.anchors.set(e,i),n.onCreate=e=>{i.res=e,delete n.onCreate};const s=e.toJSON(t,n);return n.onCreate&&n.onCreate(s),s}return"bigint"!=typeof e||n?.keep?e:Number(e)}bb.defaultYaml={explicit:!1,version:"1.2"},bb.defaultTags={"!!":"tag:yaml.org,2002:"};class Sb{constructor(e){Object.defineProperty(this,eb,{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:s}={}){if(!nb(e))throw new TypeError("A document argument is required");const r={anchors:new Map,doc:e,keep:!0,mapAsMap:!0===t,mapKeyWarned:!1,maxAliasCount:"number"==typeof n?n:100},o=xb(this,"",r);if("function"==typeof i)for(const{count:e,res:t}of r.anchors.values())i(t,e);return"function"==typeof s?wb(s,{"":o},"",o):o}}class Cb extends Sb{constructor(e){super(Jg),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let n,i;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],fb(e,{Node:(e,t)=>{(tb(t)||cb(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));for(const e of n){if(e===this)break;e.anchor===this.source&&(i=e)}return i}toJSON(e,t){if(!t)return{source:this.source};const{anchors:n,doc:i,maxAliasCount:s}=t,r=this.resolve(i,t);if(!r){const e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(e)}let o=n.get(r);if(o||(xb(r,null,t),o=n.get(r)),void 0===o?.res){throw new ReferenceError("This should not happen: Alias anchor was not resolved?")}if(s>=0&&(o.count+=1,0===o.aliasCount&&(o.aliasCount=Ab(i,r,n)),o.count*o.aliasCount>s)){throw new ReferenceError("Excessive alias count indicates a resource exhaustion attack")}return o.res}toString(e,t,n){const i=`*${this.source}`;if(e){if(yb(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(e)}if(e.implicitKey)return`${i} `}return i}}function Ab(e,t,n){if(tb(t)){const i=t.resolve(e),s=n&&i&&n.get(i);return s?s.count*s.aliasCount:0}if(ab(t)){let i=0;for(const s of t.items){const t=Ab(e,s,n);t>i&&(i=t)}return i}if(sb(t)){const i=Ab(e,t.key,n),s=Ab(e,t.value,n);return Math.max(i,s)}return 1}const Tb=e=>!e||"function"!=typeof e&&"object"!=typeof e;class Nb extends Sb{constructor(e){super(Qg),this.value=e}toJSON(e,t){return t?.keep?this.value:xb(this.value,e,t)}toString(){return String(this.value)}}Nb.BLOCK_FOLDED="BLOCK_FOLDED",Nb.BLOCK_LITERAL="BLOCK_LITERAL",Nb.PLAIN="PLAIN",Nb.QUOTE_DOUBLE="QUOTE_DOUBLE",Nb.QUOTE_SINGLE="QUOTE_SINGLE";function Ob(e,t,n){if(nb(e)&&(e=e.contents),lb(e))return e;if(sb(e)){const t=n.schema[Yg].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||"undefined"!=typeof BigInt&&e instanceof BigInt)&&(e=e.valueOf());const{aliasDuplicateObjects:i,onAnchor:s,onTagObj:r,schema:o,sourceObjects:a}=n;let l;if(i&&e&&"object"==typeof e){if(l=a.get(e),l)return l.anchor??(l.anchor=s(e)),new Cb(l.anchor);l={anchor:null,node:null},a.set(e,l)}t?.startsWith("!!")&&(t="tag:yaml.org,2002:"+t.slice(2));let c=function(e,t,n){if(t){const e=n.filter(e=>e.tag===t),i=e.find(e=>!e.format)??e[0];if(!i)throw new Error(`Tag ${t} not found`);return i}return n.find(t=>t.identify?.(e)&&!t.format)}(e,t,o.tags);if(!c){if(e&&"function"==typeof e.toJSON&&(e=e.toJSON()),!e||"object"!=typeof e){const t=new Nb(e);return l&&(l.node=t),t}c=e instanceof Map?o[Yg]:Symbol.iterator in Object(e)?o[Xg]:o[Yg]}r&&(r(c),delete n.onTagObj);const h=c?.createNode?c.createNode(n.schema,e,n):"function"==typeof c?.nodeClass?.from?c.nodeClass.from(n.schema,e,n):new Nb(e);return t?h.tag=t:c.default||(h.tag=c.tag),l&&(l.node=h),h}function Mb(e,t,n){let i=n;for(let e=t.length-1;e>=0;--e){const n=t[e];if("number"==typeof n&&Number.isInteger(n)&&n>=0){const e=[];e[n]=i,i=e}else i=new Map([[n,i]])}return Ob(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}const Eb=e=>null==e||"object"==typeof e&&!!e[Symbol.iterator]().next().done;class Db extends Sb{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(t=>lb(t)||sb(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(Eb(e))this.add(t);else{const[n,...i]=e,s=this.get(n,!0);if(ab(s))s.addIn(i,t);else{if(void 0!==s||!this.schema)throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);this.set(n,Mb(this.schema,i,t))}}}deleteIn(e){const[t,...n]=e;if(0===n.length)return this.delete(t);const i=this.get(t,!0);if(ab(i))return i.deleteIn(n);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){const[n,...i]=e,s=this.get(n,!0);return 0===i.length?!t&&rb(s)?s.value:s:ab(s)?s.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!sb(t))return!1;const n=t.value;return null==n||e&&rb(n)&&null==n.value&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){const[t,...n]=e;if(0===n.length)return this.has(t);const i=this.get(t,!0);return!!ab(i)&&i.hasIn(n)}setIn(e,t){const[n,...i]=e;if(0===i.length)this.set(n,t);else{const e=this.get(n,!0);if(ab(e))e.setIn(i,t);else{if(void 0!==e||!this.schema)throw new Error(`Expected YAML collection at ${n}. Remaining path: ${i}`);this.set(n,Mb(this.schema,i,t))}}}}const _b=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Ib(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}const Bb=(e,t,n)=>e.endsWith("\n")?Ib(n,t):n.includes("\n")?"\n"+Ib(n,t):(e.endsWith(" ")?"":" ")+n,Pb="flow",Rb="block",$b="quoted";function Lb(e,t,n="flow",{indentAtStart:i,lineWidth:s=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!s||s<0)return e;s<r&&(r=0);const l=Math.max(1+r,1+s-t.length);if(e.length<=l)return e;const c=[],h={};let u,d,f=s-t.length;"number"==typeof i&&(i>s-Math.max(2,r)?c.push(0):f=s-i);let p=!1,m=-1,g=-1,b=-1;n===Rb&&(m=zb(e,m,t.length),-1!==m&&(f=m+l));for(let i;i=e[m+=1];){if(n===$b&&"\\"===i){switch(g=m,e[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}b=m}if("\n"===i)n===Rb&&(m=zb(e,m,t.length)),f=m+t.length+l,u=void 0;else{if(" "===i&&d&&" "!==d&&"\n"!==d&&"\t"!==d){const t=e[m+1];t&&" "!==t&&"\n"!==t&&"\t"!==t&&(u=m)}if(m>=f)if(u)c.push(u),f=u+l,u=void 0;else if(n===$b){for(;" "===d||"\t"===d;)d=i,i=e[m+=1],p=!0;const t=m>b+1?m-2:g-1;if(h[t])return e;c.push(t),h[t]=!0,f=t+l,u=void 0}else p=!0}d=i}if(p&&a&&a(),0===c.length)return e;o&&o();let y=e.slice(0,c[0]);for(let i=0;i<c.length;++i){const s=c[i],r=c[i+1]||e.length;0===s?y=`\n${t}${e.slice(0,r)}`:(n===$b&&h[s]&&(y+=`${e[s]}\\`),y+=`\n${t}${e.slice(s+1,r)}`)}return y}function zb(e,t,n){let i=t,s=t+1,r=e[s];for(;" "===r||"\t"===r;)if(t<s+n)r=e[++t];else{do{r=e[++t]}while(r&&"\n"!==r);i=t,s=t+1,r=e[s]}return i}const Fb=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),jb=e=>/^(%|---|\.\.\.)/m.test(e);function Wb(e,t){const n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;const{implicitKey:i}=t,s=t.options.doubleQuotedMinMultiLineLength,r=t.indent||(jb(e)?" ":"");let o="",a=0;for(let e=0,t=n[e];t;t=n[++e])if(" "===t&&"\\"===n[e+1]&&"n"===n[e+2]&&(o+=n.slice(a,e)+"\\ ",e+=1,a=e,t="\\"),"\\"===t)switch(n[e+1]){case"u":{o+=n.slice(a,e);const t=n.substr(e+2,4);switch(t){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:"00"===t.substr(0,2)?o+="\\x"+t.substr(2):o+=n.substr(e,6)}e+=5,a=e+1}break;case"n":if(i||'"'===n[e+2]||n.length<s)e+=1;else{for(o+=n.slice(a,e)+"\n\n";"\\"===n[e+2]&&"n"===n[e+3]&&'"'!==n[e+4];)o+="\n",e+=2;o+=r," "===n[e+2]&&(o+="\\"),e+=1,a=e+1}break;default:e+=1}return o=a?o+n.slice(a):n,i?o:Lb(o,r,$b,Fb(t,!1))}function Ub(e,t){if(!1===t.options.singleQuote||t.implicitKey&&e.includes("\n")||/[ \t]\n|\n[ \t]/.test(e))return Wb(e,t);const n=t.indent||(jb(e)?" ":""),i="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&\n${n}`)+"'";return t.implicitKey?i:Lb(i,n,Pb,Fb(t,!1))}function Vb(e,t){const{singleQuote:n}=t.options;let i;if(!1===n)i=Wb;else{const t=e.includes('"'),s=e.includes("'");i=t&&!s?Ub:s&&!t?Wb:n?Ub:Wb}return i(e,t)}let Hb;try{Hb=new RegExp("(^|(?<!\n))\n+(?!\n|$)","g")}catch{Hb=/\n+(?!\n|$)/g}function qb({comment:e,type:t,value:n},i,s,r){const{blockQuote:o,commentString:a,lineWidth:l}=i.options;if(!o||/\n[\t ]+$/.test(n))return Vb(n,i);const c=i.indent||(i.forceBlockIndent||jb(n)?" ":""),h="literal"===o||"folded"!==o&&t!==Nb.BLOCK_FOLDED&&(t===Nb.BLOCK_LITERAL||!function(e,t,n){if(!t||t<0)return!1;const i=t-n,s=e.length;if(s<=i)return!1;for(let t=0,n=0;t<s;++t)if("\n"===e[t]){if(t-n>i)return!0;if(n=t+1,s-n<=i)return!1}return!0}(n,l,c.length));if(!n)return h?"|\n":">\n";let u,d;for(d=n.length;d>0;--d){const e=n[d-1];if("\n"!==e&&"\t"!==e&&" "!==e)break}let f=n.substring(d);const p=f.indexOf("\n");-1===p?u="-":n===f||p!==f.length-1?(u="+",r&&r()):u="",f&&(n=n.slice(0,-f.length),"\n"===f[f.length-1]&&(f=f.slice(0,-1)),f=f.replace(Hb,`$&${c}`));let m,g=!1,b=-1;for(m=0;m<n.length;++m){const e=n[m];if(" "===e)g=!0;else{if("\n"!==e)break;b=m}}let y=n.substring(0,b<m?b+1:m);y&&(n=n.substring(y.length),y=y.replace(/\n+/g,`$&${c}`));let v=(g?c?"2":"1":"")+u;if(e&&(v+=" "+a(e.replace(/ ?[\r\n]+/g," ")),s&&s()),!h){const e=n.replace(/\n+/g,"\n$&").replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);let s=!1;const r=Fb(i,!0);"folded"!==o&&t!==Nb.BLOCK_FOLDED&&(r.onOverflow=()=>{s=!0});const a=Lb(`${y}${e}${f}`,c,Rb,r);if(!s)return`>${v}\n${c}${a}`}return`|${v}\n${c}${y}${n=n.replace(/\n+/g,`$&${c}`)}${f}`}function Kb(e,t,n,i){const{implicitKey:s,inFlow:r}=t,o="string"==typeof e.value?e:Object.assign({},e,{value:String(e.value)});let{type:a}=e;a!==Nb.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=Nb.QUOTE_DOUBLE);const l=e=>{switch(e){case Nb.BLOCK_FOLDED:case Nb.BLOCK_LITERAL:return s||r?Vb(o.value,t):qb(o,t,n,i);case Nb.QUOTE_DOUBLE:return Wb(o.value,t);case Nb.QUOTE_SINGLE:return Ub(o.value,t);case Nb.PLAIN:return function(e,t,n,i){const{type:s,value:r}=e,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:h}=t;if(a&&r.includes("\n")||h&&/[[\]{},]/.test(r))return Vb(r,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||h||!r.includes("\n")?Vb(r,t):qb(e,t,n,i);if(!a&&!h&&s!==Nb.PLAIN&&r.includes("\n"))return qb(e,t,n,i);if(jb(r)){if(""===l)return t.forceBlockIndent=!0,qb(e,t,n,i);if(a&&l===c)return Vb(r,t)}const u=r.replace(/\n+/g,`$&\n${l}`);if(o){const e=e=>e.default&&"tag:yaml.org,2002:str"!==e.tag&&e.test?.test(u),{compat:n,tags:i}=t.doc.schema;if(i.some(e)||n?.some(e))return Vb(r,t)}return a?u:Lb(u,l,Pb,Fb(t,!1))}(o,t,n,i);default:return null}};let c=l(a);if(null===c){const{defaultKeyType:e,defaultStringType:n}=t.options,i=s&&e||n;if(c=l(i),null===c)throw new Error(`Unsupported default string type ${i}`)}return c}function Jb(e,t){const n=Object.assign({blockQuote:!0,commentString:_b,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},e.schema.toStringOptions,t);let i;switch(n.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:"number"==typeof n.indent?" ".repeat(n.indent):" ",inFlow:i,options:n}}function Zb(e,t,n,i){if(sb(e))return e.toString(t,n,i);if(tb(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw new TypeError("Cannot stringify circular structure without alias nodes");t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let s;const r=lb(e)?e:t.doc.createNode(e,{onTagObj:e=>s=e});s??(s=function(e,t){if(t.tag){const n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,i;if(rb(t)){i=t.value;let s=e.filter(e=>e.identify?.(i));if(s.length>1){const e=s.filter(e=>e.test);e.length>0&&(s=e)}n=s.find(e=>e.format===t.format)??s.find(e=>!e.format)}else i=t,n=e.find(e=>e.nodeClass&&i instanceof e.nodeClass);if(!n)throw new Error(`Tag not resolved for ${i?.constructor?.name??(null===i?"null":typeof i)} value`);return n}(t.doc.schema.tags,r));const o=function(e,t,{anchors:n,doc:i}){if(!i.directives)return"";const s=[],r=(rb(e)||ab(e))&&e.anchor;r&&yb(r)&&(n.add(r),s.push(`&${r}`));const o=e.tag??(t.default?null:t.tag);return o&&s.push(i.directives.tagString(o)),s.join(" ")}(r,s,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);const a="function"==typeof s.stringify?s.stringify(r,t,n,i):rb(r)?Kb(r,t,n,i):r.toString(t,n,i);return o?rb(r)||"{"===a[0]||"["===a[0]?`${o} ${a}`:`${o}\n${t.indent}${a}`:a}const Yb="<<",Gb={identify:e=>e===Yb||"symbol"==typeof e&&e.description===Yb,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Nb(Symbol(Yb)),{addToJSMap:Qb}),stringify:()=>Yb};function Qb(e,t,n){if(n=e&&tb(n)?n.resolve(e.doc):n,ob(n))for(const i of n.items)Xb(e,t,i);else if(Array.isArray(n))for(const i of n)Xb(e,t,i);else Xb(e,t,n)}function Xb(e,t,n){const i=e&&tb(n)?n.resolve(e.doc):n;if(!ib(i))throw new Error("Merge sources must be maps or map aliases");const s=i.toJSON(null,e,Map);for(const[e,n]of s)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function ey(e,t,{key:n,value:i}){if(lb(n)&&n.addToJSMap)n.addToJSMap(e,t,i);else if(((e,t)=>(Gb.identify(t)||rb(t)&&(!t.type||t.type===Nb.PLAIN)&&Gb.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Gb.tag&&e.default))(e,n))Qb(e,t,i);else{const s=xb(n,"",e);if(t instanceof Map)t.set(s,xb(i,s,e));else if(t instanceof Set)t.add(s);else{const r=function(e,t,n){if(null===t)return"";if("object"!=typeof t)return String(t);if(lb(e)&&n?.doc){const t=Jb(n.doc,{});t.anchors=new Set;for(const e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;const r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+'..."'),i=n.doc.options.logLevel,s=`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`,"debug"!==i&&"warn"!==i||console.warn(s),n.mapKeyWarned=!0}return r}var i,s;return JSON.stringify(t)}(n,s,e),o=xb(i,r,e);r in t?Object.defineProperty(t,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[r]=o}}return t}function ty(e,t,n){const i=Ob(e,void 0,n),s=Ob(t,void 0,n);return new ny(i,s)}class ny{constructor(e,t=null){Object.defineProperty(this,eb,{value:Gg}),this.key=e,this.value=t}clone(e){let{key:t,value:n}=this;return lb(t)&&(t=t.clone(e)),lb(n)&&(n=n.clone(e)),new ny(t,n)}toJSON(e,t){return ey(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?function({key:e,value:t},n,i,s){const{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:h,simpleKeys:u}}=n;let d=lb(e)&&e.comment||null;if(u){if(d)throw new Error("With simple keys, key nodes cannot have comments");if(ab(e)||!lb(e)&&"object"==typeof e)throw new Error("With simple keys, collection cannot be used as a key value")}let f=!u&&(!e||d&&null==t&&!n.inFlow||ab(e)||(rb(e)?e.type===Nb.BLOCK_FOLDED||e.type===Nb.BLOCK_LITERAL:"object"==typeof e));n=Object.assign({},n,{allNullValues:!1,implicitKey:!f&&(u||!r),indent:a+l});let p,m,g,b=!1,y=!1,v=Zb(e,n,()=>b=!0,()=>y=!0);if(!f&&!n.inFlow&&v.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");f=!0}if(n.inFlow){if(r||null==t)return b&&i&&i(),""===v?"?":f?`? ${v}`:v}else if(r&&!u||null==t&&f)return v=`? ${v}`,d&&!b?v+=Bb(v,n.indent,c(d)):y&&s&&s(),v;b&&(d=null),f?(d&&(v+=Bb(v,n.indent,c(d))),v=`? ${v}\n${a}:`):(v=`${v}:`,d&&(v+=Bb(v,n.indent,c(d)))),lb(t)?(p=!!t.spaceBefore,m=t.commentBefore,g=t.comment):(p=!1,m=null,g=null,t&&"object"==typeof t&&(t=o.createNode(t))),n.implicitKey=!1,f||d||!rb(t)||(n.indentAtStart=v.length+1),y=!1,h||!(l.length>=2)||n.inFlow||f||!ob(t)||t.flow||t.tag||t.anchor||(n.indent=n.indent.substring(2));let k=!1;const w=Zb(t,n,()=>k=!0,()=>y=!0);let x=" ";if(d||p||m)x=p?"\n":"",m&&(x+=`\n${Ib(c(m),n.indent)}`),""!==w||n.inFlow?x+=`\n${n.indent}`:"\n"===x&&g&&(x="\n\n");else if(!f&&ab(t)){const e=w[0],i=w.indexOf("\n"),s=-1!==i,r=n.inFlow??t.flow??0===t.items.length;if(s||!r){let t=!1;if(s&&("&"===e||"!"===e)){let n=w.indexOf(" ");"&"===e&&-1!==n&&n<i&&"!"===w[n+1]&&(n=w.indexOf(" ",n+1)),(-1===n||i<n)&&(t=!0)}t||(x=`\n${n.indent}`)}}else""!==w&&"\n"!==w[0]||(x="");return v+=x+w,n.inFlow?k&&i&&i():g&&!k?v+=Bb(v,n.indent,c(g)):y&&s&&s(),v}(this,e,t,n):JSON.stringify(this)}}function iy(e,t,n){return(t.inFlow??e.flow?ry:sy)(e,t,n)}function sy({comment:e,items:t},n,{blockItemPrefix:i,flowChars:s,itemIndent:r,onChompKeep:o,onComment:a}){const{indent:l,options:{commentString:c}}=n,h=Object.assign({},n,{indent:r,type:null});let u=!1;const d=[];for(let e=0;e<t.length;++e){const s=t[e];let o=null;if(lb(s))!u&&s.spaceBefore&&d.push(""),oy(n,d,s.commentBefore,u),s.comment&&(o=s.comment);else if(sb(s)){const e=lb(s.key)?s.key:null;e&&(!u&&e.spaceBefore&&d.push(""),oy(n,d,e.commentBefore,u))}u=!1;let a=Zb(s,h,()=>o=null,()=>u=!0);o&&(a+=Bb(a,r,c(o))),u&&o&&(u=!1),d.push(i+a)}let f;if(0===d.length)f=s.start+s.end;else{f=d[0];for(let e=1;e<d.length;++e){const t=d[e];f+=t?`\n${l}${t}`:"\n"}}return e?(f+="\n"+Ib(c(e),l),a&&a()):u&&o&&o(),f}function ry({items:e},t,{flowChars:n,itemIndent:i}){const{indent:s,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=t;i+=r;const l=Object.assign({},t,{indent:i,inFlow:!0,type:null});let c=!1,h=0;const u=[];for(let n=0;n<e.length;++n){const s=e[n];let r=null;if(lb(s))s.spaceBefore&&u.push(""),oy(t,u,s.commentBefore,!1),s.comment&&(r=s.comment);else if(sb(s)){const e=lb(s.key)?s.key:null;e&&(e.spaceBefore&&u.push(""),oy(t,u,e.commentBefore,!1),e.comment&&(c=!0));const n=lb(s.value)?s.value:null;n?(n.comment&&(r=n.comment),n.commentBefore&&(c=!0)):null==s.value&&e?.comment&&(r=e.comment)}r&&(c=!0);let o=Zb(s,l,()=>r=null);c||(c=u.length>h||o.includes("\n")),n<e.length-1?o+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(c||(c=u.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth)),c&&(o+=",")),r&&(o+=Bb(o,i,a(r))),u.push(o),h=u.length}const{start:d,end:f}=n;if(0===u.length)return d+f;if(!c){const e=u.reduce((e,t)=>e+t.length+2,2);c=t.options.lineWidth>0&&e>t.options.lineWidth}if(c){let e=d;for(const t of u)e+=t?`\n${r}${s}${t}`:"\n";return`${e}\n${s}${f}`}return`${d}${o}${u.join(" ")}${o}${f}`}function oy({indent:e,options:{commentString:t}},n,i,s){if(i&&s&&(i=i.replace(/^\n+/,"")),i){const s=Ib(t(i),e);n.push(s.trimStart())}}function ay(e,t){const n=rb(t)?t.value:t;for(const i of e)if(sb(i)){if(i.key===t||i.key===n)return i;if(rb(i.key)&&i.key.value===n)return i}}class ly extends Db{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Yg,e),this.items=[]}static from(e,t,n){const{keepUndefined:i,replacer:s}=n,r=new this(e),o=(e,o)=>{if("function"==typeof s)o=s.call(t,e,o);else if(Array.isArray(s)&&!s.includes(e))return;(void 0!==o||i)&&r.items.push(ty(e,o,n))};if(t instanceof Map)for(const[e,n]of t)o(e,n);else if(t&&"object"==typeof t)for(const e of Object.keys(t))o(e,t[e]);return"function"==typeof e.sortMapEntries&&r.items.sort(e.sortMapEntries),r}add(e,t){let n;n=sb(e)?e:e&&"object"==typeof e&&"key"in e?new ny(e.key,e.value):new ny(e,e?.value);const i=ay(this.items,n.key),s=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${n.key} already set`);rb(i.value)&&Tb(n.value)?i.value.value=n.value:i.value=n.value}else if(s){const e=this.items.findIndex(e=>s(n,e)<0);-1===e?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){const t=ay(this.items,e);if(!t)return!1;return this.items.splice(this.items.indexOf(t),1).length>0}get(e,t){const n=ay(this.items,e),i=n?.value;return(!t&&rb(i)?i.value:i)??void 0}has(e){return!!ay(this.items,e)}set(e,t){this.add(new ny(e,t),!0)}toJSON(e,t,n){const i=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(const e of this.items)ey(t,i,e);return i}toString(e,t,n){if(!e)return JSON.stringify(this);for(const e of this.items)if(!sb(e))throw new Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),iy(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:n,onComment:t})}}const cy={collection:"map",default:!0,nodeClass:ly,tag:"tag:yaml.org,2002:map",resolve:(e,t)=>(ib(e)||t("Expected a mapping for this tag"),e),createNode:(e,t,n)=>ly.from(e,t,n)};class hy extends Db{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Xg,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=uy(e);if("number"!=typeof t)return!1;return this.items.splice(t,1).length>0}get(e,t){const n=uy(e);if("number"!=typeof n)return;const i=this.items[n];return!t&&rb(i)?i.value:i}has(e){const t=uy(e);return"number"==typeof t&&t<this.items.length}set(e,t){const n=uy(e);if("number"!=typeof n)throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[n];rb(i)&&Tb(t)?i.value=t:this.items[n]=t}toJSON(e,t){const n=[];t?.onCreate&&t.onCreate(n);let i=0;for(const e of this.items)n.push(xb(e,String(i++),t));return n}toString(e,t,n){return e?iy(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,s=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let r of t){if("function"==typeof i){const n=t instanceof Set?r:String(e++);r=i.call(t,n,r)}s.items.push(Ob(r,void 0,n))}}return s}}function uy(e){let t=rb(e)?e.value:e;return t&&"string"==typeof t&&(t=Number(t)),"number"==typeof t&&Number.isInteger(t)&&t>=0?t:null}const dy={collection:"seq",default:!0,nodeClass:hy,tag:"tag:yaml.org,2002:seq",resolve:(e,t)=>(ob(e)||t("Expected a sequence for this tag"),e),createNode:(e,t,n)=>hy.from(e,t,n)},fy={identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:(e,t,n,i)=>Kb(e,t=Object.assign({actualString:!0},t),n,i)},py={identify:e=>null==e,createNode:()=>new Nb(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Nb(null),stringify:({source:e},t)=>"string"==typeof e&&py.test.test(e)?e:t.options.nullStr},my={identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Nb("t"===e[0]||"T"===e[0]),stringify({source:e,value:t},n){if(e&&my.test.test(e)){if(t===("t"===e[0]||"T"===e[0]))return e}return t?n.options.trueStr:n.options.falseStr}};function gy({format:e,minFractionDigits:t,tag:n,value:i}){if("bigint"==typeof i)return String(i);const s="number"==typeof i?i:Number(i);if(!isFinite(s))return isNaN(s)?".nan":s<0?"-.inf":".inf";let r=Object.is(i,-0)?"-0":JSON.stringify(i);if(!e&&t&&(!n||"tag:yaml.org,2002:float"===n)&&/^\d/.test(r)){let e=r.indexOf(".");e<0&&(e=r.length,r+=".");let n=t-(r.length-e-1);for(;n-- >0;)r+="0"}return r}const by={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:gy},yy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():gy(e)}},vy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){const t=new Nb(parseFloat(e)),n=e.indexOf(".");return-1!==n&&"0"===e[e.length-1]&&(t.minFractionDigits=e.length-n-1),t},stringify:gy},ky=e=>"bigint"==typeof e||Number.isInteger(e),wy=(e,t,n,{intAsBigInt:i})=>i?BigInt(e):parseInt(e.substring(t),n);function xy(e,t,n){const{value:i}=e;return ky(i)&&i>=0?n+i.toString(t):gy(e)}const Sy={identify:e=>ky(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>wy(e,2,8,n),stringify:e=>xy(e,8,"0o")},Cy={identify:ky,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>wy(e,0,10,n),stringify:gy},Ay={identify:e=>ky(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>wy(e,2,16,n),stringify:e=>xy(e,16,"0x")},Ty=[cy,dy,fy,py,my,Sy,Cy,Ay,by,yy,vy];function Ny(e){return"bigint"==typeof e||Number.isInteger(e)}const Oy=({value:e})=>JSON.stringify(e),My=[cy,dy].concat([{identify:e=>"string"==typeof e,default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:Oy},{identify:e=>null==e,createNode:()=>new Nb(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Oy},{identify:e=>"boolean"==typeof e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>"true"===e,stringify:Oy},{identify:Ny,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>Ny(e)?e.toString():JSON.stringify(e)},{identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:Oy}],{default:!0,tag:"",test:/^/,resolve:(e,t)=>(t(`Unresolved plain scalar ${JSON.stringify(e)}`),e)}),Ey={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if("function"==typeof atob){const t=atob(e.replace(/[\n\r]/g,"")),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},i,s,r){if(!n)return"";const o=n;let a;if("function"!=typeof btoa)throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");{let e="";for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);a=btoa(e)}if(t??(t=Nb.BLOCK_LITERAL),t!==Nb.QUOTE_DOUBLE){const e=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),n=Math.ceil(a.length/e),s=new Array(n);for(let t=0,i=0;t<n;++t,i+=e)s[t]=a.substr(i,e);a=s.join(t===Nb.BLOCK_LITERAL?"\n":" ")}return Kb({comment:e,type:t,value:a},i,s,r)}};function Dy(e,t){if(ob(e))for(let n=0;n<e.items.length;++n){let i=e.items[n];if(!sb(i)){if(ib(i)){i.items.length>1&&t("Each pair must have its own sequence indicator");const e=i.items[0]||new ny(new Nb(null));if(i.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${i.commentBefore}\n${e.key.commentBefore}`:i.commentBefore),i.comment){const t=e.value??e.key;t.comment=t.comment?`${i.comment}\n${t.comment}`:i.comment}i=e}e.items[n]=sb(i)?i:new ny(i)}}else t("Expected a sequence for this tag");return e}function _y(e,t,n){const{replacer:i}=n,s=new hy(e);s.tag="tag:yaml.org,2002:pairs";let r=0;if(t&&Symbol.iterator in Object(t))for(let e of t){let o,a;if("function"==typeof i&&(e=i.call(t,String(r++),e)),Array.isArray(e)){if(2!==e.length)throw new TypeError(`Expected [key, value] tuple: ${e}`);o=e[0],a=e[1]}else if(e&&e instanceof Object){const t=Object.keys(e);if(1!==t.length)throw new TypeError(`Expected tuple with one key, not ${t.length} keys`);o=t[0],a=e[o]}else o=e;s.items.push(ty(o,a,n))}return s}const Iy={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Dy,createNode:_y};class By extends hy{constructor(){super(),this.add=ly.prototype.add.bind(this),this.delete=ly.prototype.delete.bind(this),this.get=ly.prototype.get.bind(this),this.has=ly.prototype.has.bind(this),this.set=ly.prototype.set.bind(this),this.tag=By.tag}toJSON(e,t){if(!t)return super.toJSON(e);const n=new Map;t?.onCreate&&t.onCreate(n);for(const e of this.items){let i,s;if(sb(e)?(i=xb(e.key,"",t),s=xb(e.value,i,t)):i=xb(e,"",t),n.has(i))throw new Error("Ordered maps must not include duplicate keys");n.set(i,s)}return n}static from(e,t,n){const i=_y(e,t,n),s=new this;return s.items=i.items,s}}By.tag="tag:yaml.org,2002:omap";const Py={collection:"seq",identify:e=>e instanceof Map,nodeClass:By,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){const n=Dy(e,t),i=[];for(const{key:e}of n.items)rb(e)&&(i.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):i.push(e.value));return Object.assign(new By,n)},createNode:(e,t,n)=>By.from(e,t,n)};function Ry({value:e,source:t},n){return t&&(e?$y:Ly).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}const $y={identify:e=>!0===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Nb(!0),stringify:Ry},Ly={identify:e=>!1===e,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Nb(!1),stringify:Ry},zy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>"nan"===e.slice(-3).toLowerCase()?NaN:"-"===e[0]?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:gy},Fy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,"")),stringify(e){const t=Number(e.value);return isFinite(t)?t.toExponential():gy(e)}},jy={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){const t=new Nb(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(-1!==n){const i=e.substring(n+1).replace(/_/g,"");"0"===i[i.length-1]&&(t.minFractionDigits=i.length)}return t},stringify:gy},Wy=e=>"bigint"==typeof e||Number.isInteger(e);function Uy(e,t,n,{intAsBigInt:i}){const s=e[0];if("-"!==s&&"+"!==s||(t+=1),e=e.substring(t).replace(/_/g,""),i){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}const t=BigInt(e);return"-"===s?BigInt(-1)*t:t}const r=parseInt(e,n);return"-"===s?-1*r:r}function Vy(e,t,n){const{value:i}=e;if(Wy(i)){const e=i.toString(t);return i<0?"-"+n+e.substr(1):n+e}return gy(e)}const Hy={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Uy(e,2,2,n),stringify:e=>Vy(e,2,"0b")},qy={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Uy(e,1,8,n),stringify:e=>Vy(e,8,"0")},Ky={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Uy(e,0,10,n),stringify:gy},Jy={identify:Wy,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Uy(e,2,16,n),stringify:e=>Vy(e,16,"0x")};class Zy extends ly{constructor(e){super(e),this.tag=Zy.tag}add(e){let t;t=sb(e)?e:e&&"object"==typeof e&&"key"in e&&"value"in e&&null===e.value?new ny(e.key,null):new ny(e,null);ay(this.items,t.key)||this.items.push(t)}get(e,t){const n=ay(this.items,e);return!t&&sb(n)?rb(n.key)?n.key.value:n.key:n}set(e,t){if("boolean"!=typeof t)throw new Error("Expected boolean value for set(key, value) in a YAML set, not "+typeof t);const n=ay(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new ny(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,s=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)"function"==typeof i&&(e=i.call(t,e,e)),s.items.push(ty(e,null,n));return s}}Zy.tag="tag:yaml.org,2002:set";const Yy={collection:"map",identify:e=>e instanceof Set,nodeClass:Zy,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>Zy.from(e,t,n),resolve(e,t){if(ib(e)){if(e.hasAllNullValues(!0))return Object.assign(new Zy,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function Gy(e,t){const n=e[0],i="-"===n||"+"===n?e.substring(1):e,s=e=>t?BigInt(e):Number(e),r=i.replace(/_/g,"").split(":").reduce((e,t)=>e*s(60)+s(t),s(0));return"-"===n?s(-1)*r:r}function Qy(e){let{value:t}=e,n=e=>e;if("bigint"==typeof t)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return gy(e);let i="";t<0&&(i="-",t*=n(-1));const s=n(60),r=[t%s];return t<60?r.unshift(0):(t=(t-r[0])/s,r.unshift(t%s),t>=60&&(t=(t-r[0])/s,r.unshift(t))),i+r.map(e=>String(e).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const Xy={identify:e=>"bigint"==typeof e||Number.isInteger(e),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Gy(e,n),stringify:Qy},ev={identify:e=>"number"==typeof e,default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Gy(e,!1),stringify:Qy},tv={identify:e=>e 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(e){const t=e.match(tv.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,n,i,s,r,o,a]=t.map(Number),l=t[7]?Number((t[7]+"00").substr(1,3)):0;let c=Date.UTC(n,i-1,s,r||0,o||0,a||0,l);const h=t[8];if(h&&"Z"!==h){let e=Gy(h,!1);Math.abs(e)<30&&(e*=60),c-=6e4*e}return new Date(c)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},nv=[cy,dy,fy,py,$y,Ly,Hy,qy,Ky,Jy,zy,Fy,jy,Ey,Gb,Py,Iy,Yy,Xy,ev,tv],iv=new Map([["core",Ty],["failsafe",[cy,dy,fy]],["json",My],["yaml11",nv],["yaml-1.1",nv]]),sv={binary:Ey,bool:my,float:vy,floatExp:yy,floatNaN:by,floatTime:ev,int:Cy,intHex:Ay,intOct:Sy,intTime:Xy,map:cy,merge:Gb,null:py,omap:Py,pairs:Iy,seq:dy,set:Yy,timestamp:tv},rv={"tag:yaml.org,2002:binary":Ey,"tag:yaml.org,2002:merge":Gb,"tag:yaml.org,2002:omap":Py,"tag:yaml.org,2002:pairs":Iy,"tag:yaml.org,2002:set":Yy,"tag:yaml.org,2002:timestamp":tv};function ov(e,t,n){const i=iv.get(t);if(i&&!e)return n&&!i.includes(Gb)?i.concat(Gb):i.slice();let s=i;if(!s){if(!Array.isArray(e)){const e=Array.from(iv.keys()).filter(e=>"yaml11"!==e).map(e=>JSON.stringify(e)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}s=[]}if(Array.isArray(e))for(const t of e)s=s.concat(t);else"function"==typeof e&&(s=e(s.slice()));return n&&(s=s.concat(Gb)),s.reduce((e,t)=>{const n="string"==typeof t?sv[t]:t;if(!n){const e=JSON.stringify(t),n=Object.keys(sv).map(e=>JSON.stringify(e)).join(", ");throw new Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}const av=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0;class lv{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:i,schema:s,sortMapEntries:r,toStringDefaults:o}){this.compat=Array.isArray(e)?ov(e,"compat"):e?ov(null,e):null,this.name="string"==typeof s&&s||"core",this.knownTags=i?rv:{},this.tags=ov(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,Yg,{value:cy}),Object.defineProperty(this,Qg,{value:fy}),Object.defineProperty(this,Xg,{value:dy}),this.sortMapEntries="function"==typeof r?r:!0===r?av:null}clone(){const e=Object.create(lv.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}let cv=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,eb,{value:Zg});let i=null;"function"==typeof t||Array.isArray(t)?i=t:void 0===n&&t&&(n=t,t=void 0);const s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},n);this.options=s;let{version:r}=s;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(r=this.directives.yaml.version)):this.directives=new bb({version:r}),this.setSchema(r,n),this.contents=void 0===e?null:this.createNode(e,i,n)}clone(){const t=Object.create(e.prototype,{[eb]:{value:Zg}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=lb(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){hv(this.contents)&&this.contents.add(e)}addIn(e,t){hv(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const n=vb(this);e.anchor=!t||n.has(t)?kb(t||"a",n):t}return new Cb(e.anchor)}createNode(e,t,n){let i;if("function"==typeof t)e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){const e=e=>"number"==typeof e||e instanceof String||e instanceof Number,n=t.filter(e).map(String);n.length>0&&(t=t.concat(n)),i=t}else void 0===n&&t&&(n=t,t=void 0);const{aliasDuplicateObjects:s,anchorPrefix:r,flow:o,keepUndefined:a,onTagObj:l,tag:c}=n??{},{onAnchor:h,setAnchors:u,sourceObjects:d}=function(e,t){const n=[],i=new Map;let s=null;return{onAnchor:i=>{n.push(i),s??(s=vb(e));const r=kb(t,s);return s.add(r),r},setAnchors:()=>{for(const e of n){const t=i.get(e);if("object"!=typeof t||!t.anchor||!rb(t.node)&&!ab(t.node)){const t=new Error("Failed to resolve repeated object (this should not happen)");throw t.source=e,t}t.node.anchor=t.anchor}},sourceObjects:i}}(this,r||"a"),f=Ob(e,c,{aliasDuplicateObjects:s??!0,keepUndefined:a??!1,onAnchor:h,onTagObj:l,replacer:i,schema:this.schema,sourceObjects:d});return o&&ab(f)&&(f.flow=!0),u(),f}createPair(e,t,n={}){const i=this.createNode(e,null,n),s=this.createNode(t,null,n);return new ny(i,s)}delete(e){return!!hv(this.contents)&&this.contents.delete(e)}deleteIn(e){return Eb(e)?null!=this.contents&&(this.contents=null,!0):!!hv(this.contents)&&this.contents.deleteIn(e)}get(e,t){return ab(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Eb(e)?!t&&rb(this.contents)?this.contents.value:this.contents:ab(this.contents)?this.contents.getIn(e,t):void 0}has(e){return!!ab(this.contents)&&this.contents.has(e)}hasIn(e){return Eb(e)?void 0!==this.contents:!!ab(this.contents)&&this.contents.hasIn(e)}set(e,t){null==this.contents?this.contents=Mb(this.schema,[e],t):hv(this.contents)&&this.contents.set(e,t)}setIn(e,t){Eb(e)?this.contents=t:null==this.contents?this.contents=Mb(this.schema,Array.from(e),t):hv(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){let n;switch("number"==typeof e&&(e=String(e)),e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new bb({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 bb({version:e}),n={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,n=null;break;default:{const t=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else{if(!n)throw new Error("With a null YAML version, the { schema: Schema } option is required");this.schema=new lv(Object.assign(n,t))}}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:i,onAnchor:s,reviver:r}={}){const o={anchors:new Map,doc:this,keep:!e,mapAsMap:!0===n,mapKeyWarned:!1,maxAliasCount:"number"==typeof i?i:100},a=xb(this.contents,t??"",o);if("function"==typeof s)for(const{count:e,res:t}of o.anchors.values())s(t,e);return"function"==typeof r?wb(r,{"":a},"",a):a}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 function(e,t){const n=[];let i=!0===t.directives;if(!1!==t.directives&&e.directives){const t=e.directives.toString(e);t?(n.push(t),i=!0):e.directives.docStart&&(i=!0)}i&&n.push("---");const s=Jb(e,t),{commentString:r}=s.options;if(e.commentBefore){1!==n.length&&n.unshift("");const t=r(e.commentBefore);n.unshift(Ib(t,""))}let o=!1,a=null;if(e.contents){if(lb(e.contents)){if(e.contents.spaceBefore&&i&&n.push(""),e.contents.commentBefore){const t=r(e.contents.commentBefore);n.push(Ib(t,""))}s.forceBlockIndent=!!e.comment,a=e.contents.comment}const t=a?void 0:()=>o=!0;let l=Zb(e.contents,s,()=>a=null,t);a&&(l+=Bb(l,"",r(a))),"|"!==l[0]&&">"!==l[0]||"---"!==n[n.length-1]?n.push(l):n[n.length-1]=`--- ${l}`}else n.push(Zb(e.contents,s));if(e.directives?.docEnd)if(e.comment){const t=r(e.comment);t.includes("\n")?(n.push("..."),n.push(Ib(t,""))):n.push(`... ${t}`)}else n.push("...");else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,"")),t&&(o&&!a||""===n[n.length-1]||n.push(""),n.push(Ib(r(t),"")))}return n.join("\n")+"\n"}(this,e)}};function hv(e){if(ab(e))return!0;throw new Error("Expected a YAML collection as document contents")}class uv extends Error{constructor(e,t,n,i){super(),this.name=e,this.code=n,this.message=i,this.pos=t}}class dv extends uv{constructor(e,t,n){super("YAMLParseError",e,t,n)}}class fv extends uv{constructor(e,t,n){super("YAMLWarning",e,t,n)}}const pv=(e,t)=>n=>{if(-1===n.pos[0])return;n.linePos=n.pos.map(e=>t.linePos(e));const{line:i,col:s}=n.linePos[0];n.message+=` at line ${i}, column ${s}`;let r=s-1,o=e.substring(t.lineStarts[i-1],t.lineStarts[i]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){const e=Math.min(r-39,o.length-79);o="…"+o.substring(e),r-=e-1}if(o.length>80&&(o=o.substring(0,79)+"…"),i>1&&/^ *$/.test(o.substring(0,r))){let n=e.substring(t.lineStarts[i-2],t.lineStarts[i-1]);n.length>80&&(n=n.substring(0,79)+"…\n"),o=n+o}if(/[^ ]/.test(o)){let e=1;const t=n.linePos[1];t?.line===i&&t.col>s&&(e=Math.max(1,Math.min(t.col-s,80-r)));const a=" ".repeat(r)+"^".repeat(e);n.message+=`:\n\n${o}\n${a}\n`}};function mv(e,{flow:t,indicator:n,next:i,offset:s,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,h=a,u="",d="",f=!1,p=!1,m=null,g=null,b=null,y=null,v=null,k=null,w=null;for(const s of e)switch(p&&("space"!==s.type&&"newline"!==s.type&&"comma"!==s.type&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),p=!1),m&&(c&&"comment"!==s.type&&"newline"!==s.type&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),s.type){case"space":t||"doc-start"===n&&"flow-collection"===i?.type||!s.source.includes("\t")||(m=s),h=!0;break;case"comment":{h||r(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const e=s.source.substring(1)||" ";u?u+=d+e:u=e,d="",c=!1;break}case"newline":c?u?u+=s.source:k&&"seq-item-ind"===n||(l=!0):d+=s.source,c=!0,f=!0,(g||b)&&(y=s),h=!0;break;case"anchor":g&&r(s,"MULTIPLE_ANCHORS","A node can have at most one anchor"),s.source.endsWith(":")&&r(s.offset+s.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=s,w??(w=s.offset),c=!1,h=!1,p=!0;break;case"tag":b&&r(s,"MULTIPLE_TAGS","A node can have at most one tag"),b=s,w??(w=s.offset),c=!1,h=!1,p=!0;break;case n:(g||b)&&r(s,"BAD_PROP_ORDER",`Anchors and tags must be after the ${s.source} indicator`),k&&r(s,"UNEXPECTED_TOKEN",`Unexpected ${s.source} in ${t??"collection"}`),k=s,c="seq-item-ind"===n||"explicit-key-ind"===n,h=!1;break;case"comma":if(t){v&&r(s,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),v=s,c=!1,h=!1;break}default:r(s,"UNEXPECTED_TOKEN",`Unexpected ${s.type} token`),c=!1,h=!1}const x=e[e.length-1],S=x?x.offset+x.source.length:s;return p&&i&&"space"!==i.type&&"newline"!==i.type&&"comma"!==i.type&&("scalar"!==i.type||""!==i.source)&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(c&&m.indent<=o||"block-map"===i?.type||"block-seq"===i?.type)&&r(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:v,found:k,spaceBefore:l,comment:u,hasNewline:f,anchor:g,tag:b,newlineAfterProp:y,end:S,start:w??S}}function gv(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes("\n"))return!0;if(e.end)for(const t of e.end)if("newline"===t.type)return!0;return!1;case"flow-collection":for(const t of e.items){for(const e of t.start)if("newline"===e.type)return!0;if(t.sep)for(const e of t.sep)if("newline"===e.type)return!0;if(gv(t.key)||gv(t.value))return!0}return!1;default:return!0}}function bv(e,t,n){if("flow-collection"===t?.type){const i=t.end[0];if(i.indent===e&&("]"===i.source||"}"===i.source)&&gv(t)){n(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}}function yv(e,t,n){const{uniqueKeys:i}=e.options;if(!1===i)return!1;const s="function"==typeof i?i:(e,t)=>e===t||rb(e)&&rb(t)&&e.value===t.value;return t.some(e=>s(e.key,n))}const vv="All mapping items must start at the same column";function kv(e,t,n,i){let s="";if(e){let r=!1,o="";for(const a of e){const{source:e,type:l}=a;switch(l){case"space":r=!0;break;case"comment":{n&&!r&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const t=e.substring(1)||" ";s?s+=o+t:s=t,o="";break}case"newline":s&&(o+=e),r=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${l} at node end`)}t+=e.length}}return{comment:s,offset:t}}const wv="Block collections are not allowed within flow collections",xv=e=>e&&("block-map"===e.type||"block-seq"===e.type);function Sv(e,t,n,i,s,r){const o="block-map"===n.type?function({composeNode:e,composeEmptyNode:t},n,i,s,r){const o=new(r?.nodeClass??ly)(n.schema);n.atRoot&&(n.atRoot=!1);let a=i.offset,l=null;for(const r of i.items){const{start:c,key:h,sep:u,value:d}=r,f=mv(c,{indicator:"explicit-key-ind",next:h??u?.[0],offset:a,onError:s,parentIndent:i.indent,startOnNewline:!0}),p=!f.found;if(p){if(h&&("block-seq"===h.type?s(a,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==i.indent&&s(a,"BAD_INDENT",vv)),!f.anchor&&!f.tag&&!u){l=f.end,f.comment&&(o.comment?o.comment+="\n"+f.comment:o.comment=f.comment);continue}(f.newlineAfterProp||gv(h))&&s(h??c[c.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else f.found?.indent!==i.indent&&s(a,"BAD_INDENT",vv);n.atKey=!0;const m=f.end,g=h?e(n,h,f,s):t(n,m,c,null,f,s);n.schema.compat&&bv(i.indent,h,s),n.atKey=!1,yv(n,o.items,g)&&s(m,"DUPLICATE_KEY","Map keys must be unique");const b=mv(u??[],{indicator:"map-value-ind",next:d,offset:g.range[2],onError:s,parentIndent:i.indent,startOnNewline:!h||"block-scalar"===h.type});if(a=b.end,b.found){p&&("block-map"!==d?.type||b.hasNewline||s(a,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&f.start<b.found.offset-1024&&s(g.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const l=d?e(n,d,b,s):t(n,a,u,null,b,s);n.schema.compat&&bv(i.indent,d,s),a=l.range[2];const c=new ny(g,l);n.options.keepSourceTokens&&(c.srcToken=r),o.items.push(c)}else{p&&s(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),b.comment&&(g.comment?g.comment+="\n"+b.comment:g.comment=b.comment);const e=new ny(g);n.options.keepSourceTokens&&(e.srcToken=r),o.items.push(e)}}return l&&l<a&&s(l,"IMPOSSIBLE","Map comment with trailing content"),o.range=[i.offset,a,l??a],o}(e,t,n,i,r):"block-seq"===n.type?function({composeNode:e,composeEmptyNode:t},n,i,s,r){const o=new(r?.nodeClass??hy)(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let a=i.offset,l=null;for(const{start:r,value:c}of i.items){const h=mv(r,{indicator:"seq-item-ind",next:c,offset:a,onError:s,parentIndent:i.indent,startOnNewline:!0});if(!h.found){if(!(h.anchor||h.tag||c)){l=h.end,h.comment&&(o.comment=h.comment);continue}"block-seq"===c?.type?s(h.end,"BAD_INDENT","All sequence items must start at the same column"):s(a,"MISSING_CHAR","Sequence item without - indicator")}const u=c?e(n,c,h,s):t(n,h.end,r,null,h,s);n.schema.compat&&bv(i.indent,c,s),a=u.range[2],o.items.push(u)}return o.range=[i.offset,a,l??a],o}(e,t,n,i,r):function({composeNode:e,composeEmptyNode:t},n,i,s,r){const o="{"===i.start.source,a=o?"flow map":"flow sequence",l=new(r?.nodeClass??(o?ly:hy))(n.schema);l.flow=!0;const c=n.atRoot;c&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let h=i.offset+i.start.source.length;for(let r=0;r<i.items.length;++r){const c=i.items[r],{start:u,key:d,sep:f,value:p}=c,m=mv(u,{flow:a,indicator:"explicit-key-ind",next:d??f?.[0],offset:h,onError:s,parentIndent:i.indent,startOnNewline:!1});if(!m.found){if(!(m.anchor||m.tag||f||p)){0===r&&m.comma?s(m.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):r<i.items.length-1&&s(m.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),m.comment&&(l.comment?l.comment+="\n"+m.comment:l.comment=m.comment),h=m.end;continue}!o&&n.options.strict&&gv(d)&&s(d,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(0===r)m.comma&&s(m.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(m.comma||s(m.start,"MISSING_CHAR",`Missing , between ${a} items`),m.comment){let e="";e:for(const t of u)switch(t.type){case"comma":case"space":break;case"comment":e=t.source.substring(1);break e;default:break e}if(e){let t=l.items[l.items.length-1];sb(t)&&(t=t.value??t.key),t.comment?t.comment+="\n"+e:t.comment=e,m.comment=m.comment.substring(e.length+1)}}if(o||f||m.found){n.atKey=!0;const r=m.end,g=d?e(n,d,m,s):t(n,r,u,null,m,s);xv(d)&&s(g.range,"BLOCK_IN_FLOW",wv),n.atKey=!1;const b=mv(f??[],{flow:a,indicator:"map-value-ind",next:p,offset:g.range[2],onError:s,parentIndent:i.indent,startOnNewline:!1});if(b.found){if(!o&&!m.found&&n.options.strict){if(f)for(const e of f){if(e===b.found)break;if("newline"===e.type){s(e,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}m.start<b.found.offset-1024&&s(b.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else p&&("source"in p&&":"===p.source?.[0]?s(p,"MISSING_CHAR",`Missing space after : in ${a}`):s(b.start,"MISSING_CHAR",`Missing , or : between ${a} items`));const y=p?e(n,p,b,s):b.found?t(n,b.end,f,null,b,s):null;y?xv(p)&&s(y.range,"BLOCK_IN_FLOW",wv):b.comment&&(g.comment?g.comment+="\n"+b.comment:g.comment=b.comment);const v=new ny(g,y);if(n.options.keepSourceTokens&&(v.srcToken=c),o){const e=l;yv(n,e.items,g)&&s(r,"DUPLICATE_KEY","Map keys must be unique"),e.items.push(v)}else{const e=new ly(n.schema);e.flow=!0,e.items.push(v);const t=(y??g).range;e.range=[g.range[0],t[1],t[2]],l.items.push(e)}h=y?y.range[2]:b.end}else{const i=p?e(n,p,m,s):t(n,m.end,f,null,m,s);l.items.push(i),h=i.range[2],xv(p)&&s(i.range,"BLOCK_IN_FLOW",wv)}}const u=o?"}":"]",[d,...f]=i.end;let p=h;if(d?.source===u)p=d.offset+d.source.length;else{const e=a[0].toUpperCase()+a.substring(1);s(h,c?"MISSING_CHAR":"BAD_INDENT",c?`${e} must end with a ${u}`:`${e} in block collection must be sufficiently indented and end with a ${u}`),d&&1!==d.source.length&&f.unshift(d)}if(f.length>0){const e=kv(f,p,n.options.strict,s);e.comment&&(l.comment?l.comment+="\n"+e.comment:l.comment=e.comment),l.range=[i.offset,p,e.offset]}else l.range=[i.offset,p,p];return l}(e,t,n,i,r),a=o.constructor;return"!"===s||s===a.tagName?(o.tag=a.tagName,o):(s&&(o.tag=s),o)}function Cv(e,t,n){const i=t.offset,s=function({offset:e,props:t},n,i){if("block-scalar-header"!==t[0].type)return i(t[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:s}=t[0],r=s[0];let o=0,a="",l=-1;for(let t=1;t<s.length;++t){const n=s[t];if(a||"-"!==n&&"+"!==n){const i=Number(n);!o&&i?o=i:-1===l&&(l=e+t)}else a=n}-1!==l&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${s}`);let c=!1,h="",u=s.length;for(let e=1;e<t.length;++e){const s=t[e];switch(s.type){case"space":c=!0;case"newline":u+=s.source.length;break;case"comment":if(n&&!c){i(s,"MISSING_CHAR","Comments must be separated from other tokens by white space characters")}u+=s.source.length,h=s.source.substring(1);break;case"error":i(s,"UNEXPECTED_TOKEN",s.message),u+=s.source.length;break;default:{i(s,"UNEXPECTED_TOKEN",`Unexpected token in block scalar header: ${s.type}`);const e=s.source;e&&"string"==typeof e&&(u+=e.length)}}}return{mode:r,indent:o,chomp:a,comment:h,length:u}}(t,e.options.strict,n);if(!s)return{value:"",type:null,comment:"",range:[i,i,i]};const r=">"===s.mode?Nb.BLOCK_FOLDED:Nb.BLOCK_LITERAL,o=t.source?function(e){const t=e.split(/\n( *)/),n=t[0],i=n.match(/^( *)/),s=i?.[1]?[i[1],n.slice(i[1].length)]:["",n],r=[s];for(let e=1;e<t.length;e+=2)r.push([t[e],t[e+1]]);return r}(t.source):[];let a=o.length;for(let e=o.length-1;e>=0;--e){const t=o[e][1];if(""!==t&&"\r"!==t)break;a=e}if(0===a){const e="+"===s.chomp&&o.length>0?"\n".repeat(Math.max(1,o.length-1)):"";let n=i+s.length;return t.source&&(n+=t.source.length),{value:e,type:r,comment:s.comment,range:[i,n,n]}}let l=t.indent+s.indent,c=t.offset+s.length,h=0;for(let t=0;t<a;++t){const[i,r]=o[t];if(""!==r&&"\r"!==r){if(i.length<l){const e="Block scalars with more-indented leading empty lines must use an explicit indentation indicator";n(c+i.length,"MISSING_CHAR",e)}if(0===s.indent&&(l=i.length),h=t,0===l&&!e.atRoot){n(c,"BAD_INDENT","Block scalar values in collections must be indented")}break}0===s.indent&&i.length>l&&(l=i.length),c+=i.length+r.length+1}for(let e=o.length-1;e>=a;--e)o[e][0].length>l&&(a=e+1);let u="",d="",f=!1;for(let e=0;e<h;++e)u+=o[e][0].slice(l)+"\n";for(let e=h;e<a;++e){let[t,i]=o[e];c+=t.length+i.length+1;const a="\r"===i[i.length-1];if(a&&(i=i.slice(0,-1)),i&&t.length<l){const e=`Block scalar lines must not be less indented than their ${s.indent?"explicit indentation indicator":"first line"}`;n(c-i.length-(a?2:1),"BAD_INDENT",e),t=""}r===Nb.BLOCK_LITERAL?(u+=d+t.slice(l)+i,d="\n"):t.length>l||"\t"===i[0]?(" "===d?d="\n":f||"\n"!==d||(d="\n\n"),u+=d+t.slice(l)+i,d="\n",f=!0):""===i?"\n"===d?u+="\n":d="\n":(u+=d+i,d=" ",f=!1)}switch(s.chomp){case"-":break;case"+":for(let e=a;e<o.length;++e)u+="\n"+o[e][0].slice(l);"\n"!==u[u.length-1]&&(u+="\n");break;default:u+="\n"}const p=i+s.length+t.source.length;return{value:u,type:r,comment:s.comment,range:[i,p,p]}}function Av(e,t,n){const{offset:i,type:s,source:r,end:o}=e;let a,l;const c=(e,t,s)=>n(i+e,t,s);switch(s){case"scalar":a=Nb.PLAIN,l=function(e,t){let n="";switch(e[0]){case"\t":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":n=`block scalar indicator ${e[0]}`;break;case"@":case"`":n=`reserved character ${e[0]}`}n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`);return Tv(e)}(r,c);break;case"single-quoted-scalar":a=Nb.QUOTE_SINGLE,l=function(e,t){"'"===e[e.length-1]&&1!==e.length||t(e.length,"MISSING_CHAR","Missing closing 'quote");return Tv(e.slice(1,-1)).replace(/''/g,"'")}(r,c);break;case"double-quoted-scalar":a=Nb.QUOTE_DOUBLE,l=function(e,t){let n="";for(let i=1;i<e.length-1;++i){const s=e[i];if("\r"!==s||"\n"!==e[i+1])if("\n"===s){const{fold:t,offset:s}=Nv(e,i);n+=t,i=s}else if("\\"===s){let s=e[++i];const r=Ov[s];if(r)n+=r;else if("\n"===s)for(s=e[i+1];" "===s||"\t"===s;)s=e[1+ ++i];else if("\r"===s&&"\n"===e[i+1])for(s=e[1+ ++i];" "===s||"\t"===s;)s=e[1+ ++i];else if("x"===s||"u"===s||"U"===s){const r={x:2,u:4,U:8}[s];n+=Mv(e,i+1,r,t),i+=r}else{const s=e.substr(i-1,2);t(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),n+=s}}else if(" "===s||"\t"===s){const t=i;let r=e[i+1];for(;" "===r||"\t"===r;)r=e[1+ ++i];"\n"===r||"\r"===r&&"\n"===e[i+2]||(n+=i>t?e.slice(t,i+1):s)}else n+=s}'"'===e[e.length-1]&&1!==e.length||t(e.length,"MISSING_CHAR",'Missing closing "quote');return n}(r,c);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${s}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}const h=i+r.length,u=kv(o,h,t,n);return{value:l,type:a,comment:u.comment,range:[i,h,u.offset]}}function Tv(e){let t,n;try{t=new RegExp("(.*?)(?<![ \t])[ \t]*\r?\n","sy"),n=new RegExp("[ \t]*(.*?)(?:(?<![ \t])[ \t]*)?\r?\n","sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=t.exec(e);if(!i)return e;let s=i[1],r=" ",o=t.lastIndex;for(n.lastIndex=o;i=n.exec(e);)""===i[1]?"\n"===r?s+=r:r="\n":(s+=r+i[1],r=" "),o=n.lastIndex;const a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(e),s+r+(i?.[1]??"")}function Nv(e,t){let n="",i=e[t+1];for(;!(" "!==i&&"\t"!==i&&"\n"!==i&&"\r"!==i||"\r"===i&&"\n"!==e[t+2]);)"\n"===i&&(n+="\n"),i=e[(t+=1)+1];return n||(n=" "),{fold:n,offset:t}}const Ov={0:"\0",a:"",b:"\b",e:"",f:"\f",n:"\n",r:"\r",t:"\t",v:"\v",N:"…",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\","\t":"\t"};function Mv(e,t,n,i){const s=e.substr(t,n),r=s.length===n&&/^[0-9a-fA-F]+$/.test(s)?parseInt(s,16):NaN;if(isNaN(r)){const s=e.substr(t-2,n+2);return i(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${s}`),s}return String.fromCodePoint(r)}function Ev(e,t,n,i){const{value:s,type:r,comment:o,range:a}="block-scalar"===t.type?Cv(e,t,i):Av(t,e.options.strict,i),l=n?e.directives.tagName(n.source,e=>i(n,"TAG_RESOLVE_FAILED",e)):null;let c,h;c=e.options.stringKeys&&e.atKey?e.schema[Qg]:l?function(e,t,n,i,s){if("!"===n)return e[Qg];const r=[];for(const t of e.tags)if(!t.collection&&t.tag===n){if(!t.default||!t.test)return t;r.push(t)}for(const e of r)if(e.test?.test(t))return e;const o=e.knownTags[n];if(o&&!o.collection)return e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o;return s(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,"tag:yaml.org,2002:str"!==n),e[Qg]}(e.schema,s,l,n,i):"scalar"===t.type?function({atKey:e,directives:t,schema:n},i,s,r){const o=n.tags.find(t=>(!0===t.default||e&&"key"===t.default)&&t.test?.test(i))||n[Qg];if(n.compat){const e=n.compat.find(e=>e.default&&e.test?.test(i))??n[Qg];if(o.tag!==e.tag){r(s,"TAG_RESOLVE_FAILED",`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}}return o}(e,s,t,i):e.schema[Qg];try{const r=c.resolve(s,e=>i(n??t,"TAG_RESOLVE_FAILED",e),e.options);h=rb(r)?r:new Nb(r)}catch(e){const r=e instanceof Error?e.message:String(e);i(n??t,"TAG_RESOLVE_FAILED",r),h=new Nb(s)}return h.range=a,h.source=s,r&&(h.type=r),l&&(h.tag=l),c.format&&(h.format=c.format),o&&(h.comment=o),h}function Dv(e,t,n){if(t){n??(n=t.length);for(let i=n-1;i>=0;--i){let n=t[i];switch(n.type){case"space":case"comment":case"newline":e-=n.source.length;continue}for(n=t[++i];"space"===n?.type;)e+=n.source.length,n=t[++i];break}}return e}const _v={composeNode:Iv,composeEmptyNode:Bv};function Iv(e,t,n,i){const s=e.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=n;let c,h=!0;switch(t.type){case"alias":c=function({options:e},{offset:t,source:n,end:i},s){const r=new Cb(n.substring(1));""===r.source&&s(t,"BAD_ALIAS","Alias cannot be an empty string");r.source.endsWith(":")&&s(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=t+n.length,a=kv(i,o,e.strict,s);r.range=[t,o,a.offset],a.comment&&(r.comment=a.comment);return r}(e,t,i),(a||l)&&i(t,"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=Ev(e,t,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=function(e,t,n,i,s){const r=i.tag,o=r?t.directives.tagName(r.source,e=>s(r,"TAG_RESOLVE_FAILED",e)):null;if("block-seq"===n.type){const{anchor:e,newlineAfterProp:t}=i,n=e&&r?e.offset>r.offset?e:r:e??r;n&&(!t||t.offset<n.offset)&&s(n,"MISSING_CHAR","Missing newline after block sequence props")}const a="block-map"===n.type?"map":"block-seq"===n.type?"seq":"{"===n.start.source?"map":"seq";if(!r||!o||"!"===o||o===ly.tagName&&"map"===a||o===hy.tagName&&"seq"===a)return Sv(e,t,n,s,o);let l=t.schema.tags.find(e=>e.tag===o&&e.collection===a);if(!l){const i=t.schema.knownTags[o];if(i?.collection!==a)return i?s(r,"BAD_COLLECTION_TYPE",`${i.tag} used for ${a} collection, but expects ${i.collection??"scalar"}`,!0):s(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Sv(e,t,n,s,o);t.schema.tags.push(Object.assign({},i,{default:!1})),l=i}const c=Sv(e,t,n,s,o,l),h=l.resolve?.(c,e=>s(r,"TAG_RESOLVE_FAILED",e),t.options)??c,u=lb(h)?h:new Nb(h);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}(_v,e,t,n,i),a&&(c.anchor=a.source.substring(1))}catch(e){i(t,"RESOURCE_EXHAUSTION",e instanceof Error?e.message:String(e))}break;default:i(t,"UNEXPECTED_TOKEN","error"===t.type?t.message:`Unsupported token (type: ${t.type})`),h=!1}if(c??(c=Bv(e,t.offset,void 0,null,n,i)),a&&""===c.anchor&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),s&&e.options.stringKeys&&(!rb(c)||"string"!=typeof c.value||c.tag&&"tag:yaml.org,2002:str"!==c.tag)){i(l??t,"NON_STRING_KEY","With stringKeys, all keys must be strings")}return r&&(c.spaceBefore=!0),o&&("scalar"===t.type&&""===t.source?c.comment=o:c.commentBefore=o),e.options.keepSourceTokens&&h&&(c.srcToken=t),c}function Bv(e,t,n,i,{spaceBefore:s,comment:r,anchor:o,tag:a,end:l},c){const h=Ev(e,{type:"scalar",offset:Dv(t,n,i),indent:-1,source:""},a,c);return o&&(h.anchor=o.source.substring(1),""===h.anchor&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),s&&(h.spaceBefore=!0),r&&(h.comment=r,h.range[2]=l),h}function Pv(e){if("number"==typeof e)return[e,e+1];if(Array.isArray(e))return 2===e.length?e:[e[0],e[1]];const{offset:t,source:n}=e;return[t,t+("string"==typeof n?n.length:1)]}function Rv(e){let t="",n=!1,i=!1;for(let s=0;s<e.length;++s){const r=e[s];switch(r[0]){case"#":t+=(""===t?"":i?"\n\n":"\n")+(r.substring(1)||" "),n=!0,i=!1;break;case"%":"#"!==e[s+1]?.[0]&&(s+=1),n=!1;break;default:n||(i=!0),n=!1}}return{comment:t,afterEmptyLine:i}}class $v{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,i)=>{const s=Pv(e);i?this.warnings.push(new fv(s,t,n)):this.errors.push(new dv(s,t,n))},this.directives=new bb({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:n,afterEmptyLine:i}=Rv(this.prelude);if(n){const s=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(i||e.directives.docStart||!s)e.commentBefore=n;else if(ab(s)&&!s.flow&&s.items.length>0){let e=s.items[0];sb(e)&&(e=e.key);const t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{const e=s.commentBefore;s.commentBefore=e?`${n}\n${e}`: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:Rv(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(const t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,n,i)=>{const s=Pv(e);s[0]+=t,this.onError(s,"BAD_DIRECTIVE",n,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=function(e,t,{offset:n,start:i,value:s,end:r},o){const a=Object.assign({_directives:t},e),l=new cv(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},h=mv(i,{indicator:"doc-start",next:s??r?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});h.found&&(l.directives.docStart=!0,!s||"block-map"!==s.type&&"block-seq"!==s.type||h.hasNewline||o(h.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=s?Iv(c,s,h,o):Bv(c,h.end,i,null,h,o);const u=l.contents.range[2],d=kv(r,u,!1,o);return d.comment&&(l.comment=d.comment),l.range=[n,u,d.offset],l}(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 dv(Pv(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 t="Unexpected doc-end without preceding document";this.errors.push(new dv(Pv(e),"UNEXPECTED_TOKEN",t));break}this.doc.directives.docEnd=!0;const t=kv(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new dv(Pv(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 e=Object.assign({_directives:this.directives},this.options),n=new cv(void 0,e);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}}function Lv(e){switch(e){case void 0:case" ":case"\n":case"\r":case"\t":return!0;default:return!1}}const zv=new Set("0123456789ABCDEFabcdef"),Fv=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),jv=new Set(",[]{}"),Wv=new Set(" ,[]{}\n\r\t"),Uv=e=>!e||Wv.has(e);class Vv{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("string"!=typeof e)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;)t=this.buffer[++e];return!t||"#"===t||"\n"===t||"\r"===t&&"\n"===this.buffer[e+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("\r"===t){const t=this.buffer[n+e+1];if("\n"===t||!t&&!this.atEnd)return e+n+1}return"\n"===t||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if("-"===t||"."===t){const t=this.buffer.substr(e,3);if(("---"===t||"..."===t)&&Lv(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return("number"!=typeof e||-1!==e&&e<this.pos)&&(e=this.buffer.indexOf("\n",this.pos),this.lineEndPos=e),-1===e?this.atEnd?this.buffer.substring(this.pos):null:("\r"===this.buffer[e-1]&&(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(null===e)return this.setNext("stream");if("\ufeff"===e[0]&&(yield*this.pushCount(1),e=e.substring(1)),"%"===e[0]){let t=e.length,n=e.indexOf("#");for(;-1!==n;){const i=e[n-1];if(" "===i||"\t"===i){t=n-1;break}n=e.indexOf("#",n+1)}for(;;){const n=e[t-1];if(" "!==n&&"\t"!==n)break;t-=1}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"",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 e=this.peek(3);if(("---"===e||"..."===e)&&Lv(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,"---"===e?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Lv(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)&&Lv(t)){const e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const e=this.getLine();if(null===e)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(Uv),"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(null===i)return this.setNext("flow");if(-1!==n&&n<this.indentNext&&"#"!==i[0]||0===n&&(i.startsWith("---")||i.startsWith("..."))&&Lv(i[3])){if(!(n===this.indentNext-1&&1===this.flowLevel&&("]"===i[0]||"}"===i[0])))return this.flowLevel=0,yield"",yield*this.parseLineStart()}let s=0;for(;","===i[s];)s+=(yield*this.pushCount(1)),s+=(yield*this.pushSpaces(!0)),this.flowKey=!1;switch(s+=(yield*this.pushIndicators()),i[s]){case void 0:return"flow";case"#":return yield*this.pushCount(i.length-s),"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(Uv),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const e=this.charAt(1);if(this.flowKey||Lv(e)||","===e)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(;-1!==t&&"'"===this.buffer[t+1];)t=this.buffer.indexOf("'",t+2);else for(;-1!==t;){let e=0;for(;"\\"===this.buffer[t-1-e];)e+=1;if(e%2==0)break;t=this.buffer.indexOf('"',t+1)}const n=this.buffer.substring(0,t);let i=n.indexOf("\n",this.pos);if(-1!==i){for(;-1!==i;){const e=this.continueScalar(i+1);if(-1===e)break;i=n.indexOf("\n",e)}-1!==i&&(t=i-("\r"===n[i-1]?2:1))}if(-1===t){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(e=>Lv(e)||"#"===e)}*parseBlockScalar(){let e,t=this.pos-1,n=0;e:for(let i=this.pos;e=this.buffer[i];++i)switch(e){case" ":n+=1;break;case"\n":t=i,n=0;break;case"\r":{const e=this.buffer[i+1];if(!e&&!this.atEnd)return this.setNext("block-scalar");if("\n"===e)break}default:break e}if(!e&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){-1===this.blockScalarIndent?this.indentNext=n:this.indentNext=this.blockScalarIndent+(0===this.indentNext?1:this.indentNext);do{const e=this.continueScalar(t+1);if(-1===e)break;t=this.buffer.indexOf("\n",e)}while(-1!==t);if(-1===t){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let i=t+1;for(e=this.buffer[i];" "===e;)e=this.buffer[++i];if("\t"===e){for(;"\t"===e||" "===e||"\r"===e||"\n"===e;)e=this.buffer[++i];t=i-1}else if(!this.blockScalarKeep)for(;;){let e=t-1,i=this.buffer[e];"\r"===i&&(i=this.buffer[--e]);const s=e;for(;" "===i;)i=this.buffer[--e];if(!("\n"===i&&e>=this.pos&&e+1+n>s))break;t=e}return yield"",yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t,n=this.pos-1,i=this.pos-1;for(;t=this.buffer[++i];)if(":"===t){const t=this.buffer[i+1];if(Lv(t)||e&&jv.has(t))break;n=i}else if(Lv(t)){let s=this.buffer[i+1];if("\r"===t&&("\n"===s?(i+=1,t="\n",s=this.buffer[i+1]):n=i),"#"===s||e&&jv.has(s))break;if("\n"===t){const e=this.continueScalar(i+1);if(-1===e)break;i=Math.max(i,e-2)}}else{if(e&&jv.has(t))break;n=i}return t||this.atEnd?(yield"",yield*this.pushToIndex(n+1,!0),e?"flow":"doc"):this.setNext("plain-scalar")}*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(Uv))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(Lv(t)||e&&jv.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(;!Lv(t)&&">"!==t;)t=this.buffer[++e];return yield*this.pushToIndex(">"===t?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Fv.has(t))t=this.buffer[++e];else{if("%"!==t||!zv.has(this.buffer[e+1])||!zv.has(this.buffer[e+2]))break;t=this.buffer[e+=3]}return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return"\n"===e?yield*this.pushCount(1):"\r"===e&&"\n"===this.charAt(1)?yield*this.pushCount(2):0}*pushSpaces(e){let t,n=this.pos-1;do{t=this.buffer[++n]}while(" "===t||e&&"\t"===t);const i=n-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=n),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 Hv{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){const i=t+n>>1;this.lineStarts[i]<e?t=i+1:n=i}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(0===t)return{line:0,col:e};return{line:t,col:e-this.lineStarts[t-1]+1}}}}function qv(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Kv(e){for(let t=0;t<e.length;++t)switch(e[t].type){case"space":case"comment":case"newline":break;default:return t}return-1}function Jv(e){switch(e?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Zv(e){switch(e.type){case"document":return e.start;case"block-map":{const t=e.items[e.items.length-1];return t.sep??t.start}case"block-seq":return e.items[e.items.length-1].start;default:return[]}}function Yv(e){if(0===e.length)return[];let t=e.length;e:for(;--t>=0;)switch(e[t].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;"space"===e[++t]?.type;);return e.splice(t,e.length)}function Gv(e){if("flow-seq-start"===e.start.type)for(const t of e.items)!t.sep||t.value||qv(t.start,"explicit-key-ind")||qv(t.sep,"map-value-ind")||(t.key&&(t.value=t.key),delete t.key,Jv(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}class Qv{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 Vv,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&0===this.offset&&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)return this.atScalar=!1,yield*this.step(),void(this.offset+=e.length);const t=function(e){switch(e){case"\ufeff":return"byte-order-mark";case"":return"doc-mode";case"":return"flow-error-end";case"":return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case"\n":case"\r\n":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(e[0]){case" ":case"\t":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}(e);if(t)if("scalar"===t)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 t=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:t,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("doc-end"!==this.type||"doc-end"===e?.type){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()}else{for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source})}}peek(e){return this.stack[this.stack.length-e]}*pop(e){const t=e??this.stack.pop();if(t)if(0===this.stack.length)yield t;else{const e=this.peek(1);switch("block-scalar"===t.type?t.indent="indent"in e?e.indent:0:"flow-collection"===t.type&&"document"===e.type&&(t.indent=0),"flow-collection"===t.type&&Gv(t),e.type){case"document":e.value=t;break;case"block-scalar":e.props.push(t);break;case"block-map":{const n=e.items[e.items.length-1];if(n.value)return e.items.push({start:[],key:t,sep:[]}),void(this.onKeyLine=!0);if(!n.sep)return Object.assign(n,{key:t,sep:[]}),void(this.onKeyLine=!n.explicitKey);n.value=t;break}case"block-seq":{const n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{const n=e.items[e.items.length-1];return void(!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]}))}default:yield*this.pop(),yield*this.pop(t)}if(!("document"!==e.type&&"block-map"!==e.type&&"block-seq"!==e.type||"block-map"!==t.type&&"block-seq"!==t.type)){const n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&-1===Kv(n.start)&&(0===t.indent||n.start.every(e=>"comment"!==e.type||e.indent<t.indent))&&("document"===e.type?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}else{const e="Tried to pop an empty stack";yield{type:"error",offset:this.offset,source:"",message:e}}}*stream(){switch(this.type){case"directive-line":return void(yield{type:"directive",offset:this.offset,source:this.source});case"byte-order-mark":case"space":case"comment":case"newline":return void(yield this.sourceToken);case"doc-mode":case"doc-start":{const e={type:"document",offset:this.offset,start:[]};return"doc-start"===this.type&&e.start.push(this.sourceToken),void this.stack.push(e)}}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":return void(-1!==Kv(e.start)?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken));case"anchor":case"tag":case"space":case"comment":case"newline":return void e.start.push(this.sourceToken)}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("map-value-ind"===this.type){const t=Yv(Zv(this.peek(2)));let n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];const i={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":return void e.props.push(this.sourceToken);case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+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,i=Array.isArray(n)?n[n.length-1]:void 0;"comment"===i?.type?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 n=e.items[e.items.length-2],i=n?.value?.end;if(Array.isArray(i))return Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),void e.items.pop()}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)&&"seq-item-ind"!==this.type;let s=[];if(i&&t.sep&&!t.value){const n=[];for(let i=0;i<t.sep.length;++i){const s=t.sep[i];switch(s.type){case"newline":n.push(i);break;case"space":break;case"comment":s.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(s=t.sep.splice(n[1]))}switch(this.type){case"anchor":case"tag":return void(i||t.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken));case"explicit-key-ind":return t.sep||t.explicitKey?i||t.value?(s.push(this.sourceToken),e.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}):(t.start.push(this.sourceToken),t.explicitKey=!0),void(this.onKeyLine=!0);case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(qv(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]});else if(Jv(t.key)&&!qv(t.sep,"newline")){const e=Yv(t.start),n=t.key,i=t.sep;i.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:i}]})}else s.length>0?t.sep=t.sep.concat(s,this.sourceToken):t.sep.push(this.sourceToken);else if(qv(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const e=Yv(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||i?e.items.push({start:s,key:null,sep:[this.sourceToken]}):qv(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]});return void(this.onKeyLine=!0);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const n=this.flowScalar(this.type);return void(i||t.value?(e.items.push({start:s,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0))}default:{const i=this.startBlockValue(e);if(i){if("block-seq"===i.type){if(!t.explicitKey&&t.sep&&!qv(t.sep,"newline"))return void(yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source}))}else n&&e.items.push({start:s});return void this.stack.push(i)}}}}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,i=Array.isArray(n)?n[n.length-1]:void 0;"comment"===i?.type?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 n=e.items[e.items.length-2],i=n?.value?.end;if(Array.isArray(i))return Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),void e.items.pop()}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;return void t.start.push(this.sourceToken);case"seq-item-ind":if(this.indent!==e.indent)break;return void(t.value||qv(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken))}if(this.indent>e.indent){const t=this.startBlockValue(e);if(t)return void this.stack.push(t)}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if("flow-error-end"===this.type){let e;do{yield*this.pop(),e=this.peek(1)}while("flow-collection"===e?.type)}else if(0===e.end.length){switch(this.type){case"comma":case"explicit-key-ind":return void(!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken));case"map-value-ind":return void(!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]}));case"space":case"comment":case"newline":case"anchor":case"tag":return void(!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken));case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{const n=this.flowScalar(this.type);return void(!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]}))}case"flow-map-end":case"flow-seq-end":return void e.end.push(this.sourceToken)}const n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{const t=this.peek(2);if("block-map"===t.type&&("map-value-ind"===this.type&&t.indent===e.indent||"newline"===this.type&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if("map-value-ind"===this.type&&"flow-collection"!==t.type){const n=Yv(Zv(t));Gv(e);const i=e.end.splice(1,e.end.length);i.push(this.sourceToken);const s={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]=s}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf("\n")+1;for(;0!==e;)this.onNewLine(this.offset+e),e=this.source.indexOf("\n",e)+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=Yv(Zv(e));return t.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=Yv(Zv(e));return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return"comment"===this.type&&(!(this.indent<=t)&&e.every(e=>"newline"===e.type||"space"===e.type))}*documentEnd(e){"doc-mode"!==this.type&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],"newline"===this.type&&(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],"newline"===this.type&&(yield*this.pop())}}}function Xv(e,t={}){const{lineCounter:n,prettyErrors:i}=function(e){const t=!1!==e.prettyErrors;return{lineCounter:e.lineCounter||t&&new Hv||null,prettyErrors:t}}(t),s=new Qv(n?.addNewLine),r=new $v(t);let o=null;for(const t of r.compose(s.parse(e),!0,e.length))if(o){if("silent"!==o.options.logLevel){o.errors.push(new dv(t.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}}else o=t;return i&&n&&(o.errors.forEach(pv(e,n)),o.warnings.forEach(pv(e,n))),o}function ek(e,t,n){function i(n,i){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:i,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,i);const s=o.prototype,r=Object.keys(s);for(let e=0;e<r.length;e++){const t=r[e];t in n||(n[t]=s[t].bind(n))}}const s=n?.Parent??Object;class r extends s{}function o(e){var t;const s=n?.Parent?new r:this;i(s,e),(t=s._zod).deferred??(t.deferred=[]);for(const e of s._zod.deferred)e();return s}return Object.defineProperty(r,"name",{value:e}),Object.defineProperty(o,"init",{value:i}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>!!(n?.Parent&&t instanceof n.Parent)||t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}class tk extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class nk extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}}const ik={};function sk(e){return ik}function rk(e){const t=Object.values(e).filter(e=>"number"==typeof e),n=Object.entries(e).filter(([e,n])=>-1===t.indexOf(+e)).map(([e,t])=>t);return n}function ok(e,t){return"bigint"==typeof t?t.toString():t}function ak(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function lk(e){return null==e}function ck(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const hk=Symbol("evaluating");function uk(e,t,n){let i;Object.defineProperty(e,t,{get(){if(i!==hk)return void 0===i&&(i=hk,i=n()),i},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function dk(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function fk(...e){const t={};for(const n of e){const e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function pk(e){return JSON.stringify(e)}const mk="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function gk(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}const bk=ak(()=>{if("undefined"!=typeof navigator&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{return new Function(""),!0}catch(e){return!1}});function yk(e){if(!1===gk(e))return!1;const t=e.constructor;if(void 0===t)return!0;if("function"!=typeof t)return!0;const n=t.prototype;return!1!==gk(n)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")}function vk(e){return yk(e)?{...e}:Array.isArray(e)?[...e]:e}const kk=new Set(["string","number","symbol"]);function wk(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xk(e,t,n){const i=new e._zod.constr(t??e._zod.def);return t&&!n?.parent||(i._zod.parent=e),i}function Sk(e){const t=e;if(!t)return{};if("string"==typeof t)return{error:()=>t};if(void 0!==t?.message){if(void 0!==t?.error)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,"string"==typeof t.error?{...t,error:()=>t.error}:t}function Ck(e,t=0){if(!0===e.aborted)return!0;for(let n=t;n<e.issues.length;n++)if(!0!==e.issues[n]?.continue)return!0;return!1}function Ak(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function Tk(e){return"string"==typeof e?e:e?.message}function Nk(e,t,n){const i={...e,path:e.path??[]};if(!e.message){const s=Tk(e.inst?._zod.def?.error?.(e))??Tk(t?.error?.(e))??Tk(n.customError?.(e))??Tk(n.localeError?.(e))??"Invalid input";i.message=s}return delete i.inst,delete i.continue,t?.reportInput||delete i.input,i}function Ok(e){return Array.isArray(e)?"array":"string"==typeof e?"string":"unknown"}function Mk(...e){const[t,n,i]=e;return"string"==typeof t?{message:t,code:"custom",input:n,inst:i}:{...t}}const Ek=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ok,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Dk=ek("$ZodError",Ek),_k=ek("$ZodError",Ek,{Parent:Error});const Ik=e=>(t,n,i,s)=>{const r=i?Object.assign(i,{async:!1}):{async:!1},o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise)throw new tk;if(o.issues.length){const t=new(s?.Err??e)(o.issues.map(e=>Nk(e,r,sk())));throw mk(t,s?.callee),t}return o.value},Bk=e=>async(t,n,i,s)=>{const r=i?Object.assign(i,{async:!0}):{async:!0};let o=t._zod.run({value:n,issues:[]},r);if(o instanceof Promise&&(o=await o),o.issues.length){const t=new(s?.Err??e)(o.issues.map(e=>Nk(e,r,sk())));throw mk(t,s?.callee),t}return o.value},Pk=e=>(t,n,i)=>{const s=i?{...i,async:!1}:{async:!1},r=t._zod.run({value:n,issues:[]},s);if(r instanceof Promise)throw new tk;return r.issues.length?{success:!1,error:new(e??Dk)(r.issues.map(e=>Nk(e,s,sk())))}:{success:!0,data:r.value}},Rk=Pk(_k),$k=e=>async(t,n,i)=>{const s=i?Object.assign(i,{async:!0}):{async:!0};let r=t._zod.run({value:n,issues:[]},s);return r instanceof Promise&&(r=await r),r.issues.length?{success:!1,error:new e(r.issues.map(e=>Nk(e,s,sk())))}:{success:!0,data:r.value}},Lk=$k(_k),zk=e=>(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Ik(e)(t,n,s)},Fk=e=>(t,n,i)=>Ik(e)(t,n,i),jk=e=>async(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Bk(e)(t,n,s)},Wk=e=>async(t,n,i)=>Bk(e)(t,n,i),Uk=e=>(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return Pk(e)(t,n,s)},Vk=e=>(t,n,i)=>Pk(e)(t,n,i),Hk=e=>async(t,n,i)=>{const s=i?Object.assign(i,{direction:"backward"}):{direction:"backward"};return $k(e)(t,n,s)},qk=e=>async(t,n,i)=>$k(e)(t,n,i),Kk=/^[cC][^\s-]{8,}$/,Jk=/^[0-9a-z]+$/,Zk=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Yk=/^[0-9a-vA-V]{20}$/,Gk=/^[A-Za-z0-9]{27}$/,Qk=/^[a-zA-Z0-9_-]{21}$/,Xk=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,ew=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,tw=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,nw=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;const iw=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,sw=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,rw=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,ow=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,aw=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,lw=/^[A-Za-z0-9_-]*$/,cw=/^\+[1-9]\d{6,14}$/,hw="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",uw=new RegExp(`^${hw}$`);function dw(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return"number"==typeof e.precision?-1===e.precision?`${t}`:0===e.precision?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}const fw=/^-?\d+(?:\.\d+)?$/,pw=/^[^A-Z]*$/,mw=/^[^a-z]*$/,gw=ek("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),bw=ek("$ZodCheckMaxLength",(e,t)=>{var n;gw.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!lk(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{const i=n.value;if(i.length<=t.maximum)return;const s=Ok(i);n.issues.push({origin:s,code:"too_big",maximum:t.maximum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),yw=ek("$ZodCheckMinLength",(e,t)=>{var n;gw.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!lk(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{const i=n.value;if(i.length>=t.minimum)return;const s=Ok(i);n.issues.push({origin:s,code:"too_small",minimum:t.minimum,inclusive:!0,input:i,inst:e,continue:!t.abort})}}),vw=ek("$ZodCheckLengthEquals",(e,t)=>{var n;gw.init(e,t),(n=e._zod.def).when??(n.when=e=>{const t=e.value;return!lk(t)&&void 0!==t.length}),e._zod.onattach.push(e=>{const n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{const i=n.value,s=i.length;if(s===t.length)return;const r=Ok(i),o=s>t.length;n.issues.push({origin:r,...o?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),kw=ek("$ZodCheckStringFormat",(e,t)=>{var n,i;gw.init(e,t),e._zod.onattach.push(e=>{const n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??(n.patterns=new Set),n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(i=e._zod).check??(i.check=()=>{})}),ww=ek("$ZodCheckRegex",(e,t)=>{kw.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,t.pattern.test(n.value)||n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),xw=ek("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=pw),kw.init(e,t)}),Sw=ek("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=mw),kw.init(e,t)}),Cw=ek("$ZodCheckIncludes",(e,t)=>{gw.init(e,t);const n=wk(t.includes),i=new RegExp("number"==typeof t.position?`^.{${t.position}}${n}`:n);t.pattern=i,e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(i)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Aw=ek("$ZodCheckStartsWith",(e,t)=>{gw.init(e,t);const n=new RegExp(`^${wk(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Tw=ek("$ZodCheckEndsWith",(e,t)=>{gw.init(e,t);const n=new RegExp(`.*${wk(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(e=>{const t=e._zod.bag;t.patterns??(t.patterns=new Set),t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Nw=ek("$ZodCheckOverwrite",(e,t)=>{gw.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}});class Ow{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if("function"==typeof e)return e(this,{execution:"sync"}),void e(this,{execution:"async"});const t=e.split("\n").filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),i=t.map(e=>e.slice(n)).map(e=>" ".repeat(2*this.indent)+e);for(const e of i)this.content.push(e)}compile(){const e=Function,t=this?.args,n=[...(this?.content??[""]).map(e=>` ${e}`)];return new e(...t,n.join("\n"))}}const Mw={major:4,minor:3,patch:6},Ew=ek("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Mw;const i=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&i.unshift(e);for(const t of i)for(const n of t._zod.onattach)n(e);if(0===i.length)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{const t=(e,t,n)=>{let i,s=Ck(e);for(const r of t){if(r._zod.def.when){if(!r._zod.def.when(e))continue}else if(s)continue;const t=e.issues.length,o=r._zod.check(e);if(o instanceof Promise&&!1===n?.async)throw new tk;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o;e.issues.length!==t&&(s||(s=Ck(e,t)))});else{if(e.issues.length===t)continue;s||(s=Ck(e,t))}}return i?i.then(()=>e):e},n=(n,s,r)=>{if(Ck(n))return n.aborted=!0,n;const o=t(s,i,r);if(o instanceof Promise){if(!1===r.async)throw new tk;return o.then(t=>e._zod.parse(t,r))}return e._zod.parse(o,r)};e._zod.run=(s,r)=>{if(r.skipChecks)return e._zod.parse(s,r);if("backward"===r.direction){const t=e._zod.parse({value:s.value,issues:[]},{...r,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,s,r)):n(t,s,r)}const o=e._zod.parse(s,r);if(o instanceof Promise){if(!1===r.async)throw new tk;return o.then(e=>t(e,i,r))}return t(o,i,r)}}uk(e,"~standard",()=>({validate:t=>{try{const n=Rk(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch(n){return Lk(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:"zod",version:1}))}),Dw=ek("$ZodString",(e,t)=>{var n;Ew.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??(n=e._zod.bag,new RegExp(`^${n?`[\\s\\S]{${n?.minimum??0},${n?.maximum??""}}`:"[\\s\\S]*"}$`)),e._zod.parse=(n,i)=>{if(t.coerce)try{n.value=String(n.value)}catch(i){}return"string"==typeof n.value||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),_w=ek("$ZodStringFormat",(e,t)=>{kw.init(e,t),Dw.init(e,t)}),Iw=ek("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=ew),_w.init(e,t)}),Bw=ek("$ZodUUID",(e,t)=>{if(t.version){const e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(void 0===e)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=tw(e))}else t.pattern??(t.pattern=tw());_w.init(e,t)}),Pw=ek("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=nw),_w.init(e,t)}),Rw=ek("$ZodURL",(e,t)=>{_w.init(e,t),e._zod.check=n=>{try{const i=n.value.trim(),s=new URL(i);return t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(s.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(s.protocol.endsWith(":")?s.protocol.slice(0,-1):s.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),void(t.normalize?n.value=s.href:n.value=i)}catch(i){n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),$w=ek("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),_w.init(e,t)}),Lw=ek("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Qk),_w.init(e,t)}),zw=ek("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Kk),_w.init(e,t)}),Fw=ek("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Jk),_w.init(e,t)}),jw=ek("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Zk),_w.init(e,t)}),Ww=ek("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Yk),_w.init(e,t)}),Uw=ek("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Gk),_w.init(e,t)}),Vw=ek("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=function(e){const t=dw({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const i=`${t}(?:${n.join("|")})`;return new RegExp(`^${hw}T(?:${i})$`)}(t)),_w.init(e,t)}),Hw=ek("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=uw),_w.init(e,t)}),qw=ek("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=new RegExp(`^${dw(t)}$`)),_w.init(e,t)}),Kw=ek("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Xk),_w.init(e,t)}),Jw=ek("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=iw),_w.init(e,t),e._zod.bag.format="ipv4"}),Zw=ek("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=sw),_w.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),Yw=ek("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=rw),_w.init(e,t)}),Gw=ek("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=ow),_w.init(e,t),e._zod.check=n=>{const i=n.value.split("/");try{if(2!==i.length)throw new Error;const[e,t]=i;if(!t)throw new Error;const n=Number(t);if(`${n}`!==t)throw new Error;if(n<0||n>128)throw new Error;new URL(`http://[${e}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function Qw(e){if(""===e)return!0;if(e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}const Xw=ek("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=aw),_w.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{Qw(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});const ex=ek("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=lw),_w.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{(function(e){if(!lw.test(e))return!1;const t=e.replace(/[-_]/g,e=>"-"===e?"+":"/");return Qw(t.padEnd(4*Math.ceil(t.length/4),"="))})(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),tx=ek("$ZodE164",(e,t)=>{t.pattern??(t.pattern=cw),_w.init(e,t)});const nx=ek("$ZodJWT",(e,t)=>{_w.init(e,t),e._zod.check=n=>{(function(e,t=null){try{const n=e.split(".");if(3!==n.length)return!1;const[i]=n;if(!i)return!1;const s=JSON.parse(atob(i));return!("typ"in s&&"JWT"!==s?.typ||!s.alg||t&&(!("alg"in s)||s.alg!==t))}catch{return!1}})(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),ix=ek("$ZodUnknown",(e,t)=>{Ew.init(e,t),e._zod.parse=e=>e}),sx=ek("$ZodNever",(e,t)=>{Ew.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:"never",code:"invalid_type",input:t.value,inst:e}),t)});function rx(e,t,n){e.issues.length&&t.issues.push(...Ak(n,e.issues)),t.value[n]=e.value}const ox=ek("$ZodArray",(e,t)=>{Ew.init(e,t),e._zod.parse=(n,i)=>{const s=n.value;if(!Array.isArray(s))return n.issues.push({expected:"array",code:"invalid_type",input:s,inst:e}),n;n.value=Array(s.length);const r=[];for(let e=0;e<s.length;e++){const o=s[e],a=t.element._zod.run({value:o,issues:[]},i);a instanceof Promise?r.push(a.then(t=>rx(t,n,e))):rx(a,n,e)}return r.length?Promise.all(r).then(()=>n):n}});function ax(e,t,n,i,s){if(e.issues.length){if(s&&!(n in i))return;t.issues.push(...Ak(n,e.issues))}void 0===e.value?n in i&&(t.value[n]=void 0):t.value[n]=e.value}function lx(e){const t=Object.keys(e.shape);for(const n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);const n=(i=e.shape,Object.keys(i).filter(e=>"optional"===i[e]._zod.optin&&"optional"===i[e]._zod.optout));var i;return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function cx(e,t,n,i,s,r){const o=[],a=s.keySet,l=s.catchall._zod,c=l.def.type,h="optional"===l.optout;for(const s in t){if(a.has(s))continue;if("never"===c){o.push(s);continue}const r=l.run({value:t[s],issues:[]},i);r instanceof Promise?e.push(r.then(e=>ax(e,n,s,t,h))):ax(r,n,s,t,h)}return o.length&&n.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:r}),e.length?Promise.all(e).then(()=>n):n}const hx=ek("$ZodObject",(e,t)=>{Ew.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!n?.get){const e=t.shape;Object.defineProperty(t,"shape",{get:()=>{const n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}const i=ak(()=>lx(t));uk(e._zod,"propValues",()=>{const e=t.shape,n={};for(const t in e){const i=e[t]._zod;if(i.values){n[t]??(n[t]=new Set);for(const e of i.values)n[t].add(e)}}return n});const s=gk,r=t.catchall;let o;e._zod.parse=(t,n)=>{o??(o=i.value);const a=t.value;if(!s(a))return t.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),t;t.value={};const l=[],c=o.shape;for(const e of o.keys){const i=c[e],s="optional"===i._zod.optout,r=i._zod.run({value:a[e],issues:[]},n);r instanceof Promise?l.push(r.then(n=>ax(n,t,e,a,s))):ax(r,t,e,a,s)}return r?cx(l,a,t,n,i.value,e):l.length?Promise.all(l).then(()=>t):t}}),ux=ek("$ZodObjectJIT",(e,t)=>{hx.init(e,t);const n=e._zod.parse,i=ak(()=>lx(t));let s;const r=gk,o=!ik.jitless,a=o&&bk.value,l=t.catchall;let c;e._zod.parse=(h,u)=>{c??(c=i.value);const d=h.value;return r(d)?o&&a&&!1===u?.async&&!0!==u.jitless?(s||(s=(e=>{const t=new Ow(["shape","payload","ctx"]),n=i.value,s=e=>{const t=pk(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write("const input = payload.value;");const r=Object.create(null);let o=0;for(const e of n.keys)r[e]="key_"+o++;t.write("const newResult = {};");for(const i of n.keys){const n=r[i],o=pk(i),a=e[i],l="optional"===a?._zod?.optout;t.write(`const ${n} = ${s(i)};`),l?t.write(`\n if (${n}.issues.length) {\n if (${o} in input) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `):t.write(`\n if (${n}.issues.length) {\n payload.issues = payload.issues.concat(${n}.issues.map(iss => ({\n ...iss,\n path: iss.path ? [${o}, ...iss.path] : [${o}]\n })));\n }\n \n if (${n}.value === undefined) {\n if (${o} in input) {\n newResult[${o}] = undefined;\n }\n } else {\n newResult[${o}] = ${n}.value;\n }\n \n `)}t.write("payload.value = newResult;"),t.write("return payload;");const a=t.compile();return(t,n)=>a(e,t,n)})(t.shape)),h=s(h,u),l?cx([],d,h,u,c,e):h):n(h,u):(h.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),h)}});function dx(e,t,n,i){for(const n of e)if(0===n.issues.length)return t.value=n.value,t;const s=e.filter(e=>!Ck(e));return 1===s.length?(t.value=s[0].value,s[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>Nk(e,i,sk())))}),t)}const fx=ek("$ZodUnion",(e,t)=>{Ew.init(e,t),uk(e._zod,"optin",()=>t.options.some(e=>"optional"===e._zod.optin)?"optional":void 0),uk(e._zod,"optout",()=>t.options.some(e=>"optional"===e._zod.optout)?"optional":void 0),uk(e._zod,"values",()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),uk(e._zod,"pattern",()=>{if(t.options.every(e=>e._zod.pattern)){const e=t.options.map(e=>e._zod.pattern);return new RegExp(`^(${e.map(e=>ck(e.source)).join("|")})$`)}});const n=1===t.options.length,i=t.options[0]._zod.run;e._zod.parse=(s,r)=>{if(n)return i(s,r);let o=!1;const a=[];for(const e of t.options){const t=e._zod.run({value:s.value,issues:[]},r);if(t instanceof Promise)a.push(t),o=!0;else{if(0===t.issues.length)return t;a.push(t)}}return o?Promise.all(a).then(t=>dx(t,s,e,r)):dx(a,s,e,r)}}),px=ek("$ZodIntersection",(e,t)=>{Ew.init(e,t),e._zod.parse=(e,n)=>{const i=e.value,s=t.left._zod.run({value:i,issues:[]},n),r=t.right._zod.run({value:i,issues:[]},n);return s instanceof Promise||r instanceof Promise?Promise.all([s,r]).then(([t,n])=>gx(e,t,n)):gx(e,s,r)}});function mx(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e===+t)return{valid:!0,data:e};if(yk(e)&&yk(t)){const n=Object.keys(t),i=Object.keys(e).filter(e=>-1!==n.indexOf(e)),s={...e,...t};for(const n of i){const i=mx(e[n],t[n]);if(!i.valid)return{valid:!1,mergeErrorPath:[n,...i.mergeErrorPath]};s[n]=i.data}return{valid:!0,data:s}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let i=0;i<e.length;i++){const s=mx(e[i],t[i]);if(!s.valid)return{valid:!1,mergeErrorPath:[i,...s.mergeErrorPath]};n.push(s.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function gx(e,t,n){const i=new Map;let s;for(const n of t.issues)if("unrecognized_keys"===n.code){s??(s=n);for(const e of n.keys)i.has(e)||i.set(e,{}),i.get(e).l=!0}else e.issues.push(n);for(const t of n.issues)if("unrecognized_keys"===t.code)for(const e of t.keys)i.has(e)||i.set(e,{}),i.get(e).r=!0;else e.issues.push(t);const r=[...i].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(r.length&&s&&e.issues.push({...s,keys:r}),Ck(e))return e;const o=mx(t.value,n.value);if(!o.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const bx=ek("$ZodRecord",(e,t)=>{Ew.init(e,t),e._zod.parse=(n,i)=>{const s=n.value;if(!yk(s))return n.issues.push({expected:"record",code:"invalid_type",input:s,inst:e}),n;const r=[],o=t.keyType._zod.values;if(o){n.value={};const a=new Set;for(const e of o)if("string"==typeof e||"number"==typeof e||"symbol"==typeof e){a.add("number"==typeof e?e.toString():e);const o=t.valueType._zod.run({value:s[e],issues:[]},i);o instanceof Promise?r.push(o.then(t=>{t.issues.length&&n.issues.push(...Ak(e,t.issues)),n.value[e]=t.value})):(o.issues.length&&n.issues.push(...Ak(e,o.issues)),n.value[e]=o.value)}let l;for(const e in s)a.has(e)||(l=l??[],l.push(e));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:s,inst:e,keys:l})}else{n.value={};for(const o of Reflect.ownKeys(s)){if("__proto__"===o)continue;let a=t.keyType._zod.run({value:o,issues:[]},i);if(a instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if("string"==typeof o&&fw.test(o)&&a.issues.length){const e=t.keyType._zod.run({value:Number(o),issues:[]},i);if(e instanceof Promise)throw new Error("Async schemas not supported in object keys currently");0===e.issues.length&&(a=e)}if(a.issues.length){"loose"===t.mode?n.value[o]=s[o]:n.issues.push({code:"invalid_key",origin:"record",issues:a.issues.map(e=>Nk(e,i,sk())),input:o,path:[o],inst:e});continue}const l=t.valueType._zod.run({value:s[o],issues:[]},i);l instanceof Promise?r.push(l.then(e=>{e.issues.length&&n.issues.push(...Ak(o,e.issues)),n.value[a.value]=e.value})):(l.issues.length&&n.issues.push(...Ak(o,l.issues)),n.value[a.value]=l.value)}}return r.length?Promise.all(r).then(()=>n):n}}),yx=ek("$ZodEnum",(e,t)=>{Ew.init(e,t);const n=rk(t.entries),i=new Set(n);e._zod.values=i,e._zod.pattern=new RegExp(`^(${n.filter(e=>kk.has(typeof e)).map(e=>"string"==typeof e?wk(e):e.toString()).join("|")})$`),e._zod.parse=(t,s)=>{const r=t.value;return i.has(r)||t.issues.push({code:"invalid_value",values:n,input:r,inst:e}),t}}),vx=ek("$ZodTransform",(e,t)=>{Ew.init(e,t),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new nk(e.constructor.name);const s=t.transform(n.value,n);if(i.async){return(s instanceof Promise?s:Promise.resolve(s)).then(e=>(n.value=e,n))}if(s instanceof Promise)throw new tk;return n.value=s,n}});function kx(e,t){return e.issues.length&&void 0===t?{issues:[],value:void 0}:e}const wx=ek("$ZodOptional",(e,t)=>{Ew.init(e,t),e._zod.optin="optional",e._zod.optout="optional",uk(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),uk(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ck(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if("optional"===t.innerType._zod.optin){const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(t=>kx(t,e.value)):kx(i,e.value)}return void 0===e.value?e:t.innerType._zod.run(e,n)}}),xx=ek("$ZodExactOptional",(e,t)=>{wx.init(e,t),uk(e._zod,"values",()=>t.innerType._zod.values),uk(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Sx=ek("$ZodNullable",(e,t)=>{Ew.init(e,t),uk(e._zod,"optin",()=>t.innerType._zod.optin),uk(e._zod,"optout",()=>t.innerType._zod.optout),uk(e._zod,"pattern",()=>{const e=t.innerType._zod.pattern;return e?new RegExp(`^(${ck(e.source)}|null)$`):void 0}),uk(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>null===e.value?e:t.innerType._zod.run(e,n)}),Cx=ek("$ZodDefault",(e,t)=>{Ew.init(e,t),e._zod.optin="optional",uk(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);if(void 0===e.value)return e.value=t.defaultValue,e;const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Ax(e,t)):Ax(i,t)}});function Ax(e,t){return void 0===e.value&&(e.value=t.defaultValue),e}const Tx=ek("$ZodPrefault",(e,t)=>{Ew.init(e,t),e._zod.optin="optional",uk(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>("backward"===n.direction||void 0===e.value&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Nx=ek("$ZodNonOptional",(e,t)=>{Ew.init(e,t),uk(e._zod,"values",()=>{const e=t.innerType._zod.values;return e?new Set([...e].filter(e=>void 0!==e)):void 0}),e._zod.parse=(n,i)=>{const s=t.innerType._zod.run(n,i);return s instanceof Promise?s.then(t=>Ox(t,e)):Ox(s,e)}});function Ox(e,t){return e.issues.length||void 0!==e.value||e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Mx=ek("$ZodCatch",(e,t)=>{Ew.init(e,t),uk(e._zod,"optin",()=>t.innerType._zod.optin),uk(e._zod,"optout",()=>t.innerType._zod.optout),uk(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(i=>(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>Nk(e,n,sk()))},input:e.value}),e.issues=[]),e)):(e.value=i.value,i.issues.length&&(e.value=t.catchValue({...e,error:{issues:i.issues.map(e=>Nk(e,n,sk()))},input:e.value}),e.issues=[]),e)}}),Ex=ek("$ZodPipe",(e,t)=>{Ew.init(e,t),uk(e._zod,"values",()=>t.in._zod.values),uk(e._zod,"optin",()=>t.in._zod.optin),uk(e._zod,"optout",()=>t.out._zod.optout),uk(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if("backward"===n.direction){const i=t.out._zod.run(e,n);return i instanceof Promise?i.then(e=>Dx(e,t.in,n)):Dx(i,t.in,n)}const i=t.in._zod.run(e,n);return i instanceof Promise?i.then(e=>Dx(e,t.out,n)):Dx(i,t.out,n)}});function Dx(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}const _x=ek("$ZodReadonly",(e,t)=>{Ew.init(e,t),uk(e._zod,"propValues",()=>t.innerType._zod.propValues),uk(e._zod,"values",()=>t.innerType._zod.values),uk(e._zod,"optin",()=>t.innerType?._zod?.optin),uk(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if("backward"===n.direction)return t.innerType._zod.run(e,n);const i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(Ix):Ix(i)}});function Ix(e){return e.value=Object.freeze(e.value),e}const Bx=ek("$ZodCustom",(e,t)=>{gw.init(e,t),Ew.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{const i=n.value,s=t.fn(i);if(s instanceof Promise)return s.then(t=>Px(t,n,i,e));Px(s,n,i,e)}});function Px(e,t,n,i){if(!e){const e={code:"custom",input:n,inst:i,path:[...i._zod.def.path??[]],continue:!i._zod.def.abort};i._zod.def.params&&(e.params=i._zod.def.params),t.issues.push(Mk(e))}}var Rx;class $x{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){const n=t[0];return this._map.set(e,n),n&&"object"==typeof n&&"id"in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){const t=this._map.get(e);return t&&"object"==typeof t&&"id"in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){const t=e._zod.parent;if(t){const n={...this.get(t)??{}};delete n.id;const i={...n,...this._map.get(e)};return Object.keys(i).length?i:void 0}return this._map.get(e)}has(e){return this._map.has(e)}}(Rx=globalThis).__zod_globalRegistry??(Rx.__zod_globalRegistry=new $x);const Lx=globalThis.__zod_globalRegistry;function zx(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...Sk(t)})}function Fx(e,t){return new bw({check:"max_length",...Sk(t),maximum:e})}function jx(e,t){return new yw({check:"min_length",...Sk(t),minimum:e})}function Wx(e,t){return new vw({check:"length_equals",...Sk(t),length:e})}function Ux(e){return new Nw({check:"overwrite",tx:e})}function Vx(e){const t=function(e,t){const n=new gw({check:"custom",...Sk(t)});return n._zod.check=e,n}(n=>(n.addIssue=e=>{if("string"==typeof e)n.issues.push(Mk(e,n.value,t._zod.def));else{const i=e;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),i.continue??(i.continue=!t._zod.def.abort),n.issues.push(Mk(i))}},e(n.value,n)));return t}function Hx(e){let t=e?.target??"draft-2020-12";return"draft-4"===t&&(t="draft-04"),"draft-7"===t&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??Lx,target:t,unrepresentable:e?.unrepresentable??"throw",override:e?.override??(()=>{}),io:e?.io??"output",counter:0,seen:new Map,cycles:e?.cycles??"ref",reused:e?.reused??"inline",external:e?.external??void 0}}function qx(e,t,n={path:[],schemaPath:[]}){var i;const s=e._zod.def,r=t.seen.get(e);if(r){r.count++;return n.schemaPath.includes(e)&&(r.cycle=n.path),r.schema}const o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);const a=e._zod.toJSONSchema?.();if(a)o.schema=a;else{const i={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,i);else{const n=o.schema,r=t.processors[s.type];if(!r)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${s.type}`);r(e,t,n,i)}const r=e._zod.parent;r&&(o.ref||(o.ref=r),qx(r,t,i),t.seen.get(r).isParent=!0)}const l=t.metadataRegistry.get(e);l&&Object.assign(o.schema,l),"input"===t.io&&Zx(e)&&(delete o.schema.examples,delete o.schema.default),"input"===t.io&&o.schema._prefault&&((i=o.schema).default??(i.default=o.schema._prefault)),delete o.schema._prefault;return t.seen.get(e).schema}function Kx(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=new Map;for(const t of e.seen.entries()){const n=e.metadataRegistry.get(t[0])?.id;if(n){const e=i.get(n);if(e&&e!==t[0])throw new Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);i.set(n,t[0])}}const s=t=>{if(t[1].schema.$ref)return;const i=t[1],{ref:s,defId:r}=(t=>{const i="draft-2020-12"===e.target?"$defs":"definitions";if(e.external){const n=e.external.registry.get(t[0])?.id,s=e.external.uri??(e=>e);if(n)return{ref:s(n)};const r=t[1].defId??t[1].schema.id??"schema"+e.counter++;return t[1].defId=r,{defId:r,ref:`${s("__shared")}#/${i}/${r}`}}if(t[1]===n)return{ref:"#"};const s=`#/${i}/`,r=t[1].schema.id??"__schema"+e.counter++;return{defId:r,ref:s+r}})(t);i.def={...i.schema},r&&(i.defId=r);const o=i.schema;for(const e in o)delete o[e];o.$ref=s};if("throw"===e.cycles)for(const t of e.seen.entries()){const e=t[1];if(e.cycle)throw new Error(`Cycle detected: #/${e.cycle?.join("/")}/<root>\n\nSet the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const n of e.seen.entries()){const i=n[1];if(t===n[0]){s(n);continue}if(e.external){const i=e.external.registry.get(n[0])?.id;if(t!==n[0]&&i){s(n);continue}}const r=e.metadataRegistry.get(n[0])?.id;r?s(n):(i.cycle||i.count>1&&"ref"===e.reused)&&s(n)}}function Jx(e,t){const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const i=t=>{const n=e.seen.get(t);if(null===n.ref)return;const s=n.def??n.schema,r={...s},o=n.ref;if(n.ref=null,o){i(o);const n=e.seen.get(o),a=n.schema;!a.$ref||"draft-07"!==e.target&&"draft-04"!==e.target&&"openapi-3.0"!==e.target?Object.assign(s,a):(s.allOf=s.allOf??[],s.allOf.push(a)),Object.assign(s,r);if(t._zod.parent===o)for(const e in s)"$ref"!==e&&"allOf"!==e&&(e in r||delete s[e]);if(a.$ref&&n.def)for(const e in s)"$ref"!==e&&"allOf"!==e&&e in n.def&&JSON.stringify(s[e])===JSON.stringify(n.def[e])&&delete s[e]}const a=t._zod.parent;if(a&&a!==o){i(a);const t=e.seen.get(a);if(t?.schema.$ref&&(s.$ref=t.schema.$ref,t.def))for(const e in s)"$ref"!==e&&"allOf"!==e&&e in t.def&&JSON.stringify(s[e])===JSON.stringify(t.def[e])&&delete s[e]}e.override({zodSchema:t,jsonSchema:s,path:n.path??[]})};for(const t of[...e.seen.entries()].reverse())i(t[0]);const s={};if("draft-2020-12"===e.target?s.$schema="https://json-schema.org/draft/2020-12/schema":"draft-07"===e.target?s.$schema="http://json-schema.org/draft-07/schema#":"draft-04"===e.target?s.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){const n=e.external.registry.get(t)?.id;if(!n)throw new Error("Schema is missing an `id` property");s.$id=e.external.uri(n)}Object.assign(s,n.def??n.schema);const r=e.external?.defs??{};for(const t of e.seen.entries()){const e=t[1];e.def&&e.defId&&(r[e.defId]=e.def)}e.external||Object.keys(r).length>0&&("draft-2020-12"===e.target?s.$defs=r:s.definitions=r);try{const n=JSON.parse(JSON.stringify(s));return Object.defineProperty(n,"~standard",{value:{...t["~standard"],jsonSchema:{input:Yx(t,"input",e.processors),output:Yx(t,"output",e.processors)}},enumerable:!1,writable:!1}),n}catch(e){throw new Error("Error converting schema to JSON.")}}function Zx(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const i=e._zod.def;if("transform"===i.type)return!0;if("array"===i.type)return Zx(i.element,n);if("set"===i.type)return Zx(i.valueType,n);if("lazy"===i.type)return Zx(i.getter(),n);if("promise"===i.type||"optional"===i.type||"nonoptional"===i.type||"nullable"===i.type||"readonly"===i.type||"default"===i.type||"prefault"===i.type)return Zx(i.innerType,n);if("intersection"===i.type)return Zx(i.left,n)||Zx(i.right,n);if("record"===i.type||"map"===i.type)return Zx(i.keyType,n)||Zx(i.valueType,n);if("pipe"===i.type)return Zx(i.in,n)||Zx(i.out,n);if("object"===i.type){for(const e in i.shape)if(Zx(i.shape[e],n))return!0;return!1}if("union"===i.type){for(const e of i.options)if(Zx(e,n))return!0;return!1}if("tuple"===i.type){for(const e of i.items)if(Zx(e,n))return!0;return!(!i.rest||!Zx(i.rest,n))}return!1}const Yx=(e,t,n={})=>i=>{const{libraryOptions:s,target:r}=i??{},o=Hx({...s??{},target:r,io:t,processors:n});return qx(e,o),Kx(o,e),Jx(o,e)},Gx={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Qx=(e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i);t.seen.get(e).ref=s.innerType},Xx=ek("ZodISODateTime",(e,t)=>{Vw.init(e,t),CS.init(e,t)});function eS(e){return function(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...Sk(t)})}(Xx,e)}const tS=ek("ZodISODate",(e,t)=>{Hw.init(e,t),CS.init(e,t)});function nS(e){return function(e,t){return new e({type:"string",format:"date",check:"string_format",...Sk(t)})}(tS,e)}const iS=ek("ZodISOTime",(e,t)=>{qw.init(e,t),CS.init(e,t)});function sS(e){return function(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...Sk(t)})}(iS,e)}const rS=ek("ZodISODuration",(e,t)=>{Kw.init(e,t),CS.init(e,t)});function oS(e){return function(e,t){return new e({type:"string",format:"duration",check:"string_format",...Sk(t)})}(rS,e)}const aS=ek("ZodError",(e,t)=>{Dk.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:t=>function(e,t=e=>e.message){const n={_errors:[]},i=e=>{for(const s of e.issues)if("invalid_union"===s.code&&s.errors.length)s.errors.map(e=>i({issues:e}));else if("invalid_key"===s.code)i({issues:s.issues});else if("invalid_element"===s.code)i({issues:s.issues});else if(0===s.path.length)n._errors.push(t(s));else{let e=n,i=0;for(;i<s.path.length;){const n=s.path[i];i===s.path.length-1?(e[n]=e[n]||{_errors:[]},e[n]._errors.push(t(s))):e[n]=e[n]||{_errors:[]},e=e[n],i++}}};return i(e),n}(e,t)},flatten:{value:t=>function(e,t=e=>e.message){const n={},i=[];for(const s of e.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(t(s))):i.push(t(s));return{formErrors:i,fieldErrors:n}}(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ok,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ok,2)}},isEmpty:{get:()=>0===e.issues.length}})},{Parent:Error}),lS=Ik(aS),cS=Bk(aS),hS=Pk(aS),uS=$k(aS),dS=zk(aS),fS=Fk(aS),pS=jk(aS),mS=Wk(aS),gS=Uk(aS),bS=Vk(aS),yS=Hk(aS),vS=qk(aS),kS=ek("ZodType",(e,t)=>(Ew.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Yx(e,"input"),output:Yx(e,"output")}}),e.toJSONSchema=((e,t={})=>n=>{const i=Hx({...n,processors:t});return qx(e,i),Kx(i,e),Jx(i,e)})(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.check=(...n)=>e.clone(fk(t,{checks:[...t.checks??[],...n.map(e=>"function"==typeof e?{_zod:{check:e,def:{check:"custom"},onattach:[]}}:e)]}),{parent:!0}),e.with=e.check,e.clone=(t,n)=>xk(e,t,n),e.brand=()=>e,e.register=(t,n)=>(t.add(e,n),e),e.parse=(t,n)=>lS(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>hS(e,t,n),e.parseAsync=async(t,n)=>cS(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>uS(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>dS(e,t,n),e.decode=(t,n)=>fS(e,t,n),e.encodeAsync=async(t,n)=>pS(e,t,n),e.decodeAsync=async(t,n)=>mS(e,t,n),e.safeEncode=(t,n)=>gS(e,t,n),e.safeDecode=(t,n)=>bS(e,t,n),e.safeEncodeAsync=async(t,n)=>yS(e,t,n),e.safeDecodeAsync=async(t,n)=>vS(e,t,n),e.refine=(t,n)=>e.check(function(e,t={}){return function(e,t,n){return new e({type:"custom",check:"custom",fn:t,...Sk(n)})}(fC,e,t)}(t,n)),e.superRefine=t=>e.check(Vx(t)),e.overwrite=t=>e.check(Ux(t)),e.optional=()=>nC(e),e.exactOptional=()=>new iC({type:"optional",innerType:e}),e.nullable=()=>rC(e),e.nullish=()=>nC(rC(e)),e.nonoptional=t=>function(e,t){return new lC({type:"nonoptional",innerType:e,...Sk(t)})}(e,t),e.array=()=>{return function(e,t,n){return new e({type:"array",element:t,...Sk(n)})}(JS,e,t);var t},e.or=t=>{return new YS({type:"union",options:[e,t],...Sk(n)});var n},e.and=t=>new GS({type:"intersection",left:e,right:t}),e.transform=t=>uC(e,new eC({type:"transform",transform:t})),e.default=t=>{return n=t,new oC({type:"default",innerType:e,get defaultValue(){return"function"==typeof n?n():vk(n)}});var n},e.prefault=t=>{return n=t,new aC({type:"prefault",innerType:e,get defaultValue(){return"function"==typeof n?n():vk(n)}});var n},e.catch=t=>{return new cC({type:"catch",innerType:e,catchValue:"function"==typeof(n=t)?n:()=>n});var n},e.pipe=t=>uC(e,t),e.readonly=()=>new dC({type:"readonly",innerType:e}),e.describe=t=>{const n=e.clone();return Lx.add(n,{description:t}),n},Object.defineProperty(e,"description",{get:()=>Lx.get(e)?.description,configurable:!0}),e.meta=(...t)=>{if(0===t.length)return Lx.get(e);const n=e.clone();return Lx.add(n,t[0]),n},e.isOptional=()=>e.safeParse(void 0).success,e.isNullable=()=>e.safeParse(null).success,e.apply=t=>t(e),e)),wS=ek("_ZodString",(e,t)=>{Dw.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n)=>{const i=n;i.type="string";const{minimum:s,maximum:r,format:o,patterns:a,contentEncoding:l}=e._zod.bag;if("number"==typeof s&&(i.minLength=s),"number"==typeof r&&(i.maxLength=r),o&&(i.format=Gx[o]??o,""===i.format&&delete i.format,"time"===o&&delete i.format),l&&(i.contentEncoding=l),a&&a.size>0){const e=[...a];1===e.length?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({..."draft-07"===t.target||"draft-04"===t.target||"openapi-3.0"===t.target?{type:"string"}:{},pattern:e.source}))])}})(e,t,n);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,e.regex=(...t)=>e.check(function(e,t){return new ww({check:"string_format",format:"regex",...Sk(t),pattern:e})}(...t)),e.includes=(...t)=>e.check(function(e,t){return new Cw({check:"string_format",format:"includes",...Sk(t),includes:e})}(...t)),e.startsWith=(...t)=>e.check(function(e,t){return new Aw({check:"string_format",format:"starts_with",...Sk(t),prefix:e})}(...t)),e.endsWith=(...t)=>e.check(function(e,t){return new Tw({check:"string_format",format:"ends_with",...Sk(t),suffix:e})}(...t)),e.min=(...t)=>e.check(jx(...t)),e.max=(...t)=>e.check(Fx(...t)),e.length=(...t)=>e.check(Wx(...t)),e.nonempty=(...t)=>e.check(jx(1,...t)),e.lowercase=t=>e.check(function(e){return new xw({check:"string_format",format:"lowercase",...Sk(e)})}(t)),e.uppercase=t=>e.check(function(e){return new Sw({check:"string_format",format:"uppercase",...Sk(e)})}(t)),e.trim=()=>e.check(Ux(e=>e.trim())),e.normalize=(...t)=>e.check(function(e){return Ux(t=>t.normalize(e))}(...t)),e.toLowerCase=()=>e.check(Ux(e=>e.toLowerCase())),e.toUpperCase=()=>e.check(Ux(e=>e.toUpperCase())),e.slugify=()=>e.check(Ux(e=>function(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}(e)))}),xS=ek("ZodString",(e,t)=>{Dw.init(e,t),wS.init(e,t),e.email=t=>e.check(function(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...Sk(t)})}(AS,t)),e.url=t=>e.check(function(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...Sk(t)})}(OS,t)),e.jwt=t=>e.check(function(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...Sk(t)})}(US,t)),e.emoji=t=>e.check(function(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...Sk(t)})}(MS,t)),e.guid=t=>e.check(zx(TS,t)),e.uuid=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...Sk(t)})}(NS,t)),e.uuidv4=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...Sk(t)})}(NS,t)),e.uuidv6=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...Sk(t)})}(NS,t)),e.uuidv7=t=>e.check(function(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...Sk(t)})}(NS,t)),e.nanoid=t=>e.check(function(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...Sk(t)})}(ES,t)),e.guid=t=>e.check(zx(TS,t)),e.cuid=t=>e.check(function(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...Sk(t)})}(DS,t)),e.cuid2=t=>e.check(function(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...Sk(t)})}(_S,t)),e.ulid=t=>e.check(function(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...Sk(t)})}(IS,t)),e.base64=t=>e.check(function(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...Sk(t)})}(FS,t)),e.base64url=t=>e.check(function(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...Sk(t)})}(jS,t)),e.xid=t=>e.check(function(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...Sk(t)})}(BS,t)),e.ksuid=t=>e.check(function(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...Sk(t)})}(PS,t)),e.ipv4=t=>e.check(function(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...Sk(t)})}(RS,t)),e.ipv6=t=>e.check(function(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...Sk(t)})}($S,t)),e.cidrv4=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...Sk(t)})}(LS,t)),e.cidrv6=t=>e.check(function(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...Sk(t)})}(zS,t)),e.e164=t=>e.check(function(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...Sk(t)})}(WS,t)),e.datetime=t=>e.check(eS(t)),e.date=t=>e.check(nS(t)),e.time=t=>e.check(sS(t)),e.duration=t=>e.check(oS(t))});function SS(e){return function(e,t){return new e({type:"string",...Sk(t)})}(xS,e)}const CS=ek("ZodStringFormat",(e,t)=>{_w.init(e,t),wS.init(e,t)}),AS=ek("ZodEmail",(e,t)=>{Pw.init(e,t),CS.init(e,t)}),TS=ek("ZodGUID",(e,t)=>{Iw.init(e,t),CS.init(e,t)}),NS=ek("ZodUUID",(e,t)=>{Bw.init(e,t),CS.init(e,t)}),OS=ek("ZodURL",(e,t)=>{Rw.init(e,t),CS.init(e,t)}),MS=ek("ZodEmoji",(e,t)=>{$w.init(e,t),CS.init(e,t)}),ES=ek("ZodNanoID",(e,t)=>{Lw.init(e,t),CS.init(e,t)}),DS=ek("ZodCUID",(e,t)=>{zw.init(e,t),CS.init(e,t)}),_S=ek("ZodCUID2",(e,t)=>{Fw.init(e,t),CS.init(e,t)}),IS=ek("ZodULID",(e,t)=>{jw.init(e,t),CS.init(e,t)}),BS=ek("ZodXID",(e,t)=>{Ww.init(e,t),CS.init(e,t)}),PS=ek("ZodKSUID",(e,t)=>{Uw.init(e,t),CS.init(e,t)}),RS=ek("ZodIPv4",(e,t)=>{Jw.init(e,t),CS.init(e,t)}),$S=ek("ZodIPv6",(e,t)=>{Zw.init(e,t),CS.init(e,t)}),LS=ek("ZodCIDRv4",(e,t)=>{Yw.init(e,t),CS.init(e,t)}),zS=ek("ZodCIDRv6",(e,t)=>{Gw.init(e,t),CS.init(e,t)}),FS=ek("ZodBase64",(e,t)=>{Xw.init(e,t),CS.init(e,t)}),jS=ek("ZodBase64URL",(e,t)=>{ex.init(e,t),CS.init(e,t)}),WS=ek("ZodE164",(e,t)=>{tx.init(e,t),CS.init(e,t)}),US=ek("ZodJWT",(e,t)=>{nx.init(e,t),CS.init(e,t)}),VS=ek("ZodUnknown",(e,t)=>{ix.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>{}});function HS(){return new VS({type:"unknown"})}const qS=ek("ZodNever",(e,t)=>{sx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t,n)=>{n.not={}})(0,0,t)});function KS(e){return function(e,t){return new e({type:"never",...Sk(t)})}(qS,e)}const JS=ek("ZodArray",(e,t)=>{ox.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=n,r=e._zod.def,{minimum:o,maximum:a}=e._zod.bag;"number"==typeof o&&(s.minItems=o),"number"==typeof a&&(s.maxItems=a),s.type="array",s.items=qx(r.element,t,{...i,path:[...i.path,"items"]})})(e,t,n,i),e.element=t.element,e.min=(t,n)=>e.check(jx(t,n)),e.nonempty=t=>e.check(jx(1,t)),e.max=(t,n)=>e.check(Fx(t,n)),e.length=(t,n)=>e.check(Wx(t,n)),e.unwrap=()=>e.element});const ZS=ek("ZodObject",(e,t)=>{ux.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=n,r=e._zod.def;s.type="object",s.properties={};const o=r.shape;for(const e in o)s.properties[e]=qx(o[e],t,{...i,path:[...i.path,"properties",e]});const a=new Set(Object.keys(o)),l=new Set([...a].filter(e=>{const n=r.shape[e]._zod;return"input"===t.io?void 0===n.optin:void 0===n.optout}));l.size>0&&(s.required=Array.from(l)),"never"===r.catchall?._zod.def.type?s.additionalProperties=!1:r.catchall?r.catchall&&(s.additionalProperties=qx(r.catchall,t,{...i,path:[...i.path,"additionalProperties"]})):"output"===t.io&&(s.additionalProperties=!1)})(e,t,n,i),uk(e,"shape",()=>t.shape),e.keyof=()=>function(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e;return new XS({type:"enum",entries:n,...Sk(t)})}(Object.keys(e._zod.def.shape)),e.catchall=t=>e.clone({...e._zod.def,catchall:t}),e.passthrough=()=>e.clone({...e._zod.def,catchall:HS()}),e.loose=()=>e.clone({...e._zod.def,catchall:HS()}),e.strict=()=>e.clone({...e._zod.def,catchall:KS()}),e.strip=()=>e.clone({...e._zod.def,catchall:void 0}),e.extend=t=>function(e,t){if(!yk(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const n=e._zod.def.shape;for(const e in t)if(void 0!==Object.getOwnPropertyDescriptor(n,e))throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const i=fk(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return dk(this,"shape",n),n}});return xk(e,i)}(e,t),e.safeExtend=t=>function(e,t){if(!yk(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=fk(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t};return dk(this,"shape",n),n}});return xk(e,n)}(e,t),e.merge=t=>function(e,t){const n=fk(e._zod.def,{get shape(){const n={...e._zod.def.shape,...t._zod.def.shape};return dk(this,"shape",n),n},get catchall(){return t._zod.def.catchall},checks:[]});return xk(e,n)}(e,t),e.pick=t=>function(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");return xk(e,fk(e._zod.def,{get shape(){const e={};for(const i in t){if(!(i in n.shape))throw new Error(`Unrecognized key: "${i}"`);t[i]&&(e[i]=n.shape[i])}return dk(this,"shape",e),e},checks:[]}))}(e,t),e.omit=t=>function(e,t){const n=e._zod.def,i=n.checks;if(i&&i.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const s=fk(e._zod.def,{get shape(){const i={...e._zod.def.shape};for(const e in t){if(!(e in n.shape))throw new Error(`Unrecognized key: "${e}"`);t[e]&&delete i[e]}return dk(this,"shape",i),i},checks:[]});return xk(e,s)}(e,t),e.partial=(...t)=>function(e,t,n){const i=t._zod.def.checks;if(i&&i.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const s=fk(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(n)for(const t in n){if(!(t in i))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(s[t]=e?new e({type:"optional",innerType:i[t]}):i[t])}else for(const t in i)s[t]=e?new e({type:"optional",innerType:i[t]}):i[t];return dk(this,"shape",s),s},checks:[]});return xk(t,s)}(tC,e,t[0]),e.required=(...t)=>function(e,t,n){const i=fk(t._zod.def,{get shape(){const i=t._zod.def.shape,s={...i};if(n)for(const t in n){if(!(t in s))throw new Error(`Unrecognized key: "${t}"`);n[t]&&(s[t]=new e({type:"nonoptional",innerType:i[t]}))}else for(const t in i)s[t]=new e({type:"nonoptional",innerType:i[t]});return dk(this,"shape",s),s}});return xk(t,i)}(lC,e,t[0])});const YS=ek("ZodUnion",(e,t)=>{fx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def,r=!1===s.inclusive,o=s.options.map((e,n)=>qx(e,t,{...i,path:[...i.path,r?"oneOf":"anyOf",n]}));r?n.oneOf=o:n.anyOf=o})(e,t,n,i),e.options=t.options});const GS=ek("ZodIntersection",(e,t)=>{px.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def,r=qx(s.left,t,{...i,path:[...i.path,"allOf",0]}),o=qx(s.right,t,{...i,path:[...i.path,"allOf",1]}),a=e=>"allOf"in e&&1===Object.keys(e).length,l=[...a(r)?r.allOf:[r],...a(o)?o.allOf:[o]];n.allOf=l})(e,t,n,i)});const QS=ek("ZodRecord",(e,t)=>{bx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=n,r=e._zod.def;s.type="object";const o=r.keyType,a=o._zod.bag,l=a?.patterns;if("loose"===r.mode&&l&&l.size>0){const e=qx(r.valueType,t,{...i,path:[...i.path,"patternProperties","*"]});s.patternProperties={};for(const t of l)s.patternProperties[t.source]=e}else"draft-07"!==t.target&&"draft-2020-12"!==t.target||(s.propertyNames=qx(r.keyType,t,{...i,path:[...i.path,"propertyNames"]})),s.additionalProperties=qx(r.valueType,t,{...i,path:[...i.path,"additionalProperties"]});const c=o._zod.values;if(c){const e=[...c].filter(e=>"string"==typeof e||"number"==typeof e);e.length>0&&(s.required=e)}})(e,t,n,i),e.keyType=t.keyType,e.valueType=t.valueType});const XS=ek("ZodEnum",(e,t)=>{yx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n)=>{const i=rk(e._zod.def.entries);i.every(e=>"number"==typeof e)&&(n.type="number"),i.every(e=>"string"==typeof e)&&(n.type="string"),n.enum=i})(e,0,n),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(e,i)=>{const s={};for(const i of e){if(!n.has(i))throw new Error(`Key ${i} not found in enum`);s[i]=t.entries[i]}return new XS({...t,checks:[],...Sk(i),entries:s})},e.exclude=(e,i)=>{const s={...t.entries};for(const t of e){if(!n.has(t))throw new Error(`Key ${t} not found in enum`);delete s[t]}return new XS({...t,checks:[],...Sk(i),entries:s})}});const eC=ek("ZodTransform",(e,t)=>{vx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Transforms cannot be represented in JSON Schema")})(0,e),e._zod.parse=(n,i)=>{if("backward"===i.direction)throw new nk(e.constructor.name);n.addIssue=i=>{if("string"==typeof i)n.issues.push(Mk(i,n.value,t));else{const t=i;t.fatal&&(t.continue=!1),t.code??(t.code="custom"),t.input??(t.input=n.value),t.inst??(t.inst=e),n.issues.push(Mk(t))}};const s=t.transform(n.value,n);return s instanceof Promise?s.then(e=>(n.value=e,n)):(n.value=s,n)}});const tC=ek("ZodOptional",(e,t)=>{wx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>Qx(e,t,0,i),e.unwrap=()=>e._zod.def.innerType});function nC(e){return new tC({type:"optional",innerType:e})}const iC=ek("ZodExactOptional",(e,t)=>{xx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>Qx(e,t,0,i),e.unwrap=()=>e._zod.def.innerType});const sC=ek("ZodNullable",(e,t)=>{Sx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def,r=qx(s.innerType,t,i),o=t.seen.get(e);"openapi-3.0"===t.target?(o.ref=s.innerType,n.nullable=!0):n.anyOf=[r,{type:"null"}]})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType});function rC(e){return new sC({type:"nullable",innerType:e})}const oC=ek("ZodDefault",(e,t)=>{Cx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType,n.default=JSON.parse(JSON.stringify(s.defaultValue))})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});const aC=ek("ZodPrefault",(e,t)=>{Tx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType,"input"===t.io&&(n._prefault=JSON.parse(JSON.stringify(s.defaultValue)))})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType});const lC=ek("ZodNonOptional",(e,t)=>{Nx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType})(e,t,0,i),e.unwrap=()=>e._zod.def.innerType});const cC=ek("ZodCatch",(e,t)=>{Mx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;let r;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType;try{r=s.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=r})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});const hC=ek("ZodPipe",(e,t)=>{Ex.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def,r="input"===t.io?"transform"===s.in._zod.def.type?s.out:s.in:s.out;qx(r,t,i),t.seen.get(e).ref=r})(e,t,0,i),e.in=t.in,e.out=t.out});function uC(e,t){return new hC({type:"pipe",in:e,out:t})}const dC=ek("ZodReadonly",(e,t)=>{_x.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(t,n,i)=>((e,t,n,i)=>{const s=e._zod.def;qx(s.innerType,t,i),t.seen.get(e).ref=s.innerType,n.readOnly=!0})(e,t,n,i),e.unwrap=()=>e._zod.def.innerType});const fC=ek("ZodCustom",(e,t)=>{Bx.init(e,t),kS.init(e,t),e._zod.processJSONSchema=(e,t,n)=>((e,t)=>{if("throw"===t.unrepresentable)throw new Error("Custom types cannot be represented in JSON Schema")})(0,e)});function pC(e){return`${e}`}function mC(e){return`${e}`}async function gC(e,t,n){const i=e.substring(1),s=await async function(e,t,n){const i=`https://api.github.com/repos/${e}/git/trees/${t}?recursive=1`,s=await bC(i,AC(n));if(!s.ok){if(404===s.status){const i=`https://api.github.com/repos/${e}`;return(await bC(i,AC(n))).ok?{kind:"error",message:`Version not found: https://github.com/${e}/releases/tag/${t}`}:{kind:"error",message:`Repository not found: https://github.com/${e}`}}throw new Error(`Github API request failed: ${s.status} ${s.statusText}`)}return{kind:"success",tree:await s.json()}}(i,t,n);if("error"===s.kind)return s;const r=s.tree,o={},a=r.tree.filter(e=>"blob"===e.type&&e.path.startsWith("skir-src/")&&e.path.endsWith(".skir")).map(async t=>{const s=await yC(i,t.sha,n);return{modulePath:e+t.path.substring(8),content:s}}),l=await Promise.all(a);for(const{modulePath:e,content:t}of l)o[e]=t;const c=r.tree.find(e=>"blob"===e.type&&"skir.yml"===e.path);if(!c)return{kind:"error",message:`Package ${e}@${t} is missing required skir.yml configuration file`};const h=function(e){const t=[],n=new Hv,i=Xv(e,{lineCounter:n}),s=e=>{const t=n.linePos(e);return{offset:e,lineNumber:t.line,colNumber:t.col}},r=(e,t)=>({start:s(e),end:s(t)}),o=e=>{const t=i.getIn(e,!0);if(t?.range)return r(t.range[0],t.range[1])},a=(e,n)=>{let i=e;const s=[];for(;0!==i.length;){if(o(i))break;s.push(i.at(-1)),i=i.slice(0,-1)}s.reverse();const r=s.map((e,t)=>"number"==typeof e?`[${e}]`:0===t?e:`.${String(e)}`).join(""),a=s.length?`Missing property '${r}': `:"";t.push({message:a+n,range:o(i)})};if(i.errors.length>0){for(const e of i.errors)t.push({message:e.message,range:r(e.pos[0],e.pos[1])});return{dependencies:void 0,errors:t}}const l=wC.safeParse(i.toJS());if(!l.success){for(const e of l.error.issues)a(e.path,e.message);return{dependencies:void 0,errors:t}}return{dependencies:l.data.dependencies,errors:t}}(await yC(i,c.sha,n));if(h.errors.length>0)return{kind:"error",message:h.errors.map(t=>function(e,t){const{message:n,range:i}=e,{skirConfigPath:s}=t;return[i?[pC(s),mC(i.start.lineNumber.toString()),mC(i.start.colNumber.toString())].join(":"):pC(s)," - ",(r="error",`${r}`),": ",n].join("");var r}(t,{skirConfigPath:`${e}/skir.yml`})).join("\n")};const u=h.dependencies??{};return{kind:"success",package:{packageId:e,version:t,modules:o,dependencies:u}}}async function bC(e,t,n=3){let i;for(let s=0;s<=n;s++){const r=await fetch(e,{headers:t});if(403!==r.status&&429!==r.status)return r;if(i=r,s===n)break;const o=r.headers.get("Retry-After"),a=o?1e3*parseInt(o,10):1e3*2**s;await new Promise(e=>setTimeout(e,a))}return i}async function yC(e,t,n){const i=`https://api.github.com/repos/${e}/git/blobs/${t}`,s=await bC(i,AC(n));if(!s.ok)throw new Error(`Failed to download file: ${s.status} ${s.statusText}`);const r=await s.json();return"base64"===r.encoding?function(e){const t=e.replace(/\s/g,""),n=atob(t),i=Uint8Array.from(n,e=>e.charCodeAt(0));return(new TextDecoder).decode(i)}(r.content):r.content}const vC=SS().regex(/^@[A-Za-z0-9-]+\/[A-Za-z0-9\-_.]+$/),kC=SS().regex(/^[A-Za-z0-9\-_./+]+$/),wC=function(e,t){const n={type:"object",shape:e??{},...Sk(t)};return new ZS(n)}({dependencies:(xC=vC,SC=kC,new QS({type:"record",keyType:xC,valueType:SC,...Sk(CC)})).default({})});var xC,SC,CC;function AC(e){const t={Accept:"application/vnd.github.v3+json"};return e&&(t.Authorization=`token ${e}`),t}class TC{constructor(e,t,n){this.cachedPackages=e,this.githubToken=t,this.packageDownloader=n,this.packageBundles={},this.dependencyChain=[],this.errors=[],this.allDependenciesOnDisk=!0}async run(e){for(const[t,n]of Object.entries(e))if(await this.getDependency(t,n),this.errors.length>0)return this.errors[0];const t=!(this.allDependenciesOnDisk&&Object.keys(e).length===Object.keys(this.cachedPackages).length);return{kind:"success",packages:Object.fromEntries(Object.entries(this.packageBundles).map(([e,t])=>[e,t.pkg])),changed:t}}async getDependency(e,t){this.dependencyChain.push({packageId:e,version:t});try{const n=this.packageBundles[e];if(n?.pkg.version===t)return;if(n)return void this.errors.push({kind:"error",message:[`Version conflict for package ${e}:`,`- ${NC(this.dependencyChain)}`,`- ${NC(n.dependencyChain)}`].join("\n")});let i=this.getCachedPackage(e,t);if(!i){this.allDependenciesOnDisk=!1;const n=await this.packageDownloader(e,t,this.githubToken);if("success"!==n.kind)return void this.errors.push(n);i=n.package}this.packageBundles[e]={pkg:i,dependencyChain:[...this.dependencyChain]};for(const[e,t]of Object.entries(i.dependencies))await this.getDependency(e,t)}finally{this.dependencyChain.pop()}}getCachedPackage(e,t){const n=this.cachedPackages[e];return n?.version===t?n:void 0}}function NC(e){return"main depends on "+e.map(e=>`${e.packageId}:${e.version}`).join(" which depends on ")}async function OC(e,t,n=gC){const i=function(e){const t=e.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/blob\/([^/]+)\/(.+)#L(\d+)$/);if(!t)return{kind:"error",message:`Invalid GitHub URL: ${e}`};const n=t[1],i=t[2],s=t[3],r=t[4],o=Number(t[5]);if(!r.startsWith("skir-src/")||!r.endsWith(".skir"))return{kind:"error",message:`URL must target a .skir file in skir-src: ${e}`};if(!Number.isInteger(o)||o<=0)return{kind:"error",message:`Invalid line number in URL: ${e}`};const a=`@${n}/${i}`,l=a+r.substring(8);return{kind:"success",packageId:a,version:s,modulePath:l,lineNumber:o-1}}(e);if("error"===i.kind)return i;const{packageId:s,version:r,modulePath:o,lineNumber:a}=i,l=new TC({},t,n),c=await l.run({[s]:r});if("error"===c.kind)return c;const h=new Map;for(const e of Object.values(c.packages))for(const[t,n]of Object.entries(e.modules))h.set(t,n);const u=Fg.compile(h);if(u.errors.length>0)return{kind:"error",message:u.errors[0].message||"Compilation failed"};const d=u.modules.get(o);if(!d)return{kind:"error",message:`Module not found: ${o}`};const f=d.result.records.find(e=>e.record.name.line.lineNumber===a);return f?{kind:"success",record:f.record,moduleSet:u}:{kind:"error",message:`No record found at line ${a+1} in ${o}`}}class MC{static from(e){return this.fromUnixMillis(e.getTime())}static fromUnixMillis(e){if(e<=this.MIN.unixMillis)return MC.MIN;if(e<MC.MAX.unixMillis)return new MC(Math.round(e));if(Number.isNaN(e))throw new Error("Cannot construct Timestamp from NaN");return MC.MAX}static fromUnixSeconds(e){return this.fromUnixMillis(1e3*e)}static parse(e){return this.fromUnixMillis(Date.parse(e))}static now(){return this.fromUnixMillis(Date.now())}constructor(e){this.unixMillis=e,Object.freeze(this)}get unixSeconds(){return this.unixMillis/1e3}toDate(){return new Date(this.unixMillis)}toString(){return this.toDate().toISOString()}}MC.UNIX_EPOCH=new MC(0),MC.MIN=new MC(-864e13),MC.MAX=new MC(864e13);class EC{static sliceOf(e,t=0,n){const{byteLength:i}=e;if(t<0&&(t=0),(void 0===n||n>i)&&(n=i),n<=t)return EC.EMPTY;if(e instanceof EC){if(t<=0&&i<=n)return e;{const i=e.byteOffset+t,s=n-t;return new EC(e.arrayBuffer,i,s)}}if(e instanceof ArrayBuffer)return new EC(e.slice(t,n));if(e instanceof SharedArrayBuffer){const i=e.slice(t,n),s=new ArrayBuffer(i.byteLength);return new Uint8Array(s).set(new Uint8Array(i)),new EC(s)}throw new TypeError(e)}static fromBase64(e){const t=atob(e),n=Uint8Array.from(t,e=>e.codePointAt(0));return new this(n.buffer)}static fromBase16(e){const t=new Uint8Array(e.length/2);for(let n=0;n<t.length;++n){const i=parseInt(e.substring(2*n,2*n+2),16);if(Number.isNaN(i))throw new Error("Not a valid Base64 string");t[n]=i}return new EC(t.buffer)}copyTo(e,t=0){new Uint8Array(e).set(this.uint8Array,t)}toBuffer(){return this.arrayBuffer.slice(this.byteOffset,this.byteOffset+this.byteLength)}toBase64(){const e=Array.from(this.uint8Array,e=>String.fromCodePoint(e)).join("");return btoa(e)}toBase16(){return[...this.uint8Array].map(e=>e.toString(16).padStart(2,"0")).join("")}at(e){return this.uint8Array[e<0?e+this.byteLength:e]}toString(){return`ByteString(${this.byteLength})`}constructor(e,t=0,n=e.byteLength){this.arrayBuffer=e,this.byteOffset=t,this.byteLength=n,this.uint8Array=new Uint8Array(e,t,n),Object.freeze(this)}}function DC(e){return QC[e]}EC.EMPTY=new EC(new ArrayBuffer(0));class _C{constructor(e,t){this.buffer=e,this.offset=0,this.dataView=new DataView(e),this.keepUnrecognizedValues=!!t}readUint8(){return this.dataView.getUint8(this.offset++)}}const IC=[e=>e.dataView.getUint16((e.offset+=2)-2,!0),e=>e.dataView.getUint32((e.offset+=4)-4,!0),e=>e.dataView.getBigUint64((e.offset+=8)-8,!0),e=>e.readUint8()-256,e=>e.dataView.getUint16((e.offset+=2)-2,!0)-65536,e=>e.dataView.getInt32((e.offset+=4)-4,!0),e=>e.dataView.getBigInt64((e.offset+=8)-8,!0),e=>e.dataView.getBigInt64((e.offset+=8)-8,!0),e=>e.dataView.getFloat32((e.offset+=4)-4,!0),e=>e.dataView.getFloat64((e.offset+=8)-8,!0)];function BC(e){const t=e.readUint8();return t<232?t:IC[t-232](e)}function PC(e){const t=BC(e);return"bigint"==typeof t?t:BigInt(Math.round(t))}class RC{constructor(){this.buffer=new ArrayBuffer(128),this.dataView=new DataView(this.buffer),this.offset=0,this.pieces=[],this.byteLength=0}writeUint8(e){this.reserve(1).setUint8(++this.offset-1,e)}writeUint16(e){this.reserve(2).setUint16((this.offset+=2)-2,e,!0)}writeUint32(e){this.reserve(4).setUint32((this.offset+=4)-4,e,!0)}writeInt32(e){this.reserve(4).setInt32((this.offset+=4)-4,e,!0)}writeHash64(e){this.reserve(8).setBigUint64((this.offset+=8)-8,e,!0)}writeInt64(e){this.reserve(8).setBigInt64((this.offset+=8)-8,e,!0)}writeFloat32(e){this.reserve(4).setFloat32((this.offset+=4)-4,e,!0)}writeFloat64(e){this.reserve(8).setFloat64((this.offset+=8)-8,e,!0)}putUtf8String(e){let t=this.dataView,n=0;for(;e;){const i=JC.encodeInto(e,new Uint8Array(t.buffer,this.offset));this.offset+=i.written,n+=i.written,(e=e.substring(i.read))&&(t=this.reserve(2*e.length))}return n}putBytes(e){const{buffer:t}=this,n=t.byteLength-this.offset,i=EC.sliceOf(e,0,n);i.copyTo(t,this.offset),this.offset+=i.byteLength;const s=e.byteLength-i.byteLength;if(s<=0)return;const r=EC.sliceOf(e,s);this.reserve(s),r.copyTo(t,this.offset),this.offset+=s}finalize(){return this.flush(),Object.freeze(this.pieces),Object.freeze(this),this}copyTo(e,t=0){const n=new Uint8Array(e);for(const e of this.pieces)n.set(e,t),t+=e.length}toBuffer(){const e=new ArrayBuffer(this.byteLength);return this.copyTo(e),e}reserve(e){if(this.offset<this.buffer.byteLength-e)return this.dataView;this.flush();const t=Math.max(this.byteLength,e);return this.offset=0,this.buffer=new ArrayBuffer(t),this.dataView=new DataView(this.buffer)}flush(){const{offset:e}=this;this.pieces.push(new Uint8Array(this.dataView.buffer,0,e)),this.byteLength+=e}}function $C(e,t){if(e<232)t.writeUint8(e);else if(e<65536)t.writeUint8(232),t.writeUint16(e);else{if(!(e<4294967296))throw new Error(`max length exceeded: ${e}`);t.writeUint8(233),t.writeUint32(e)}}class LC{fromJsonCode(e,t){return this.fromJson(JSON.parse(e),t)}fromBytes(e,t){const n=new _C(e,t);return n.offset=4,this.decode(n)}toJsonCode(e,t){const n="readable"===t?" ":void 0;return JSON.stringify(this.toJson(e,t),void 0,n)}toBytes(e){const t=new RC;return t.putUtf8String("skir"),this.encode(e,t),t.finalize()}isDefault(e){return!e}get typeDescriptor(){return this}asJson(){const e={};this.addRecordDefinitionsTo(e);return{type:this.typeSignature,records:Object.values(e)}}asJsonCode(){return JSON.stringify(this.asJson(),void 0," ")}transform(e,t){const n=e instanceof ArrayBuffer?this.fromBytes(e):this.fromJson(e);return"bytes"===t?this.toBytes(n).toBuffer():this.toJson(n,t)}}const zC={name:"UNKNOWN",number:0};class FC extends LC{constructor(){super(...arguments),this.kind="primitive"}get typeSignature(){return{kind:"primitive",value:this.primitive}}addRecordDefinitionsTo(e){}}const jC=new class extends FC{constructor(){super(...arguments),this.primitive="int32",this.defaultValue=0}toJson(e){return 0|e}fromJson(e){return 0|+e}encode(e,t){e<0?e>=-256?(t.writeUint8(235),t.writeUint8(e+256)):e>=-65536?(t.writeUint8(236),t.writeUint16(e+65536)):(t.writeUint8(237),t.writeInt32(e>=-2147483648?e:-2147483648)):e<232?t.writeUint8(e):e<65536?(t.writeUint8(232),t.writeUint16(e)):(t.writeUint8(233),t.writeUint32(e<=2147483647?e:2147483647))}decode(e){return 0|Number(BC(e))}};class WC extends FC{constructor(){super(...arguments),this.defaultValue=0}toJson(e){if(Number.isFinite(e))return e;if("number"==typeof e)return e.toString();throw new TypeError}fromJson(e){return+e}decode(e){return Number(BC(e))}isDefault(e){return 0===e}}class UC extends FC{constructor(){super(...arguments),this.defaultValue=BigInt(0)}fromJson(e){try{return BigInt(e)}catch(t){if("number"==typeof e)return BigInt(Math.round(e));throw t}}}const VC=BigInt("-9223372036854775808"),HC=BigInt("9223372036854775807");const qC=BigInt("18446744073709551615");class KC{constructor(e,t,n,i,s){this.name=e,this.property=t,this.number=n,this.serializer=i,this.doc=s}get type(){return this.serializer.typeDescriptor}get(e){return Reflect.get(e,this.property)}set(e,t){Reflect.set(e,this.property,t)}}const JC=new TextEncoder,ZC=new TextDecoder;class YC extends LC{constructor(e,t){super(),this.itemSerializer=e,this.keyExtractor=t,this.kind="array",this.defaultValue=hA}toJson(e,t){return e.map(e=>this.itemSerializer.toJson(e,t))}fromJson(e,t){return 0===e?hA:cA(e.map(e=>this.itemSerializer.fromJson(e,t)))}encode(e,t){const{length:n}=e;n<=3?t.writeUint8(246+n):(t.writeUint8(250),$C(n,t));const{itemSerializer:i}=this;for(let n=0;n<e.length;++n)i.encode(e[n],t)}decode(e){const t=e.readUint8();if(0===t||246===t)return hA;const n=250===t?BC(e):t-246,{itemSerializer:i}=this,s=new Array(n);for(let t=0;t<n;++t)s[t]=i.decode(e);return cA(s)}isDefault(e){return!e.length}get itemType(){return this.itemSerializer.typeDescriptor}get typeSignature(){return{kind:"array",value:{item:this.itemSerializer.typeSignature,key_extractor:this.keyExtractor}}}addRecordDefinitionsTo(e){this.itemSerializer.addRecordDefinitionsTo(e)}}class GC extends LC{constructor(e){super(),this.otherSerializer=e,this.kind="optional",this.defaultValue=null}toJson(e,t){return null!==e?this.otherSerializer.toJson(e,t):null}fromJson(e,t){return null!==e?this.otherSerializer.fromJson(e,t):null}encode(e,t){null===e?t.writeUint8(255):this.otherSerializer.encode(e,t)}decode(e){return 255===e.dataView.getUint8(e.offset)?(++e.offset,null):this.otherSerializer.decode(e)}isDefault(e){return null===e}get otherType(){return this.otherSerializer.typeDescriptor}get typeSignature(){return{kind:"optional",value:this.otherSerializer.typeSignature}}addRecordDefinitionsTo(e){this.otherSerializer.addRecordDefinitionsTo(e)}}const QC={bool:new class extends FC{constructor(){super(...arguments),this.primitive="bool",this.defaultValue=!1}toJson(e,t){return"readable"===t?!!e:e?1:0}fromJson(e){return!!e&&"0"!==e}encode(e,t){t.writeUint8(e?1:0)}decode(e){return!!BC(e)}},int32:jC,int64:new class extends UC{constructor(){super(...arguments),this.primitive="int64"}toJson(e){if(-9007199254740991<=e&&e<=9007199254740991)return Number(e);const t=BigInt(e).toString();return t.length<=18?t:e<VC?VC.toString():e<HC?t:HC.toString()}encode(e,t){e?-2147483648<=e&&e<=2147483647?jC.encode(Number(e),t):(t.writeUint8(238),t.writeInt64(e<VC?VC:e<HC?e:HC)):t.writeUint8(0)}decode(e){return PC(e)}},hash64:new class extends UC{constructor(){super(...arguments),this.primitive="hash64"}toJson(e){return e<=9007199254740991?e<=0?0:Number(e):(e=BigInt(e),qC<e?qC.toString():e.toString())}encode(e,t){e<232?t.writeUint8(e<=0?0:Number(e)):e<4294967296?e<65536?(t.writeUint8(232),t.writeUint16(Number(e))):(t.writeUint8(233),t.writeUint32(Number(e))):(t.writeUint8(234),t.writeHash64(e<=qC?e:qC))}decode(e){return PC(e)}},float32:new class extends WC{constructor(){super(...arguments),this.primitive="float32"}encode(e,t){0===e?t.writeUint8(0):(t.writeUint8(240),t.writeFloat32(e))}},float64:new class extends WC{constructor(){super(...arguments),this.primitive="float64"}encode(e,t){0===e?t.writeUint8(0):(t.writeUint8(241),t.writeFloat64(e))}},timestamp:new class extends FC{constructor(){super(...arguments),this.primitive="timestamp",this.defaultValue=MC.UNIX_EPOCH}toJson(e,t){return"readable"===t?{unix_millis:e.unixMillis,formatted:e.toDate().toISOString()}:e.unixMillis}fromJson(e){return MC.fromUnixMillis("number"==typeof e?e:"string"==typeof e?+e:e.unix_millis)}encode(e,t){const{unixMillis:n}=e;n?(t.writeUint8(239),t.writeInt64(BigInt(n))):t.writeUint8(0)}decode(e){const t=BC(e);return MC.fromUnixMillis(Number(t))}isDefault(e){return!e.unixMillis}},string:new class extends FC{constructor(){super(...arguments),this.primitive="string",this.defaultValue=""}toJson(e){if("string"==typeof e)return e;throw this.newTypeError(e)}fromJson(e){if("string"==typeof e)return e;if(0===e)return"";throw this.newTypeError(e)}encode(e,t){if(!e)return void t.writeUint8(242);t.writeUint8(243);const n=3*e.length;n<232?t.writeUint8(0):n<65536?(t.writeUint8(232),t.writeUint16(0)):(t.writeUint8(233),t.writeUint32(0));const{dataView:i,offset:s}=t,r=t.putUtf8String(e);n<232?i.setUint8(s-1,r):n<65536?i.setUint16(s-2,r,!0):i.setUint32(s-4,r,!0)}decode(e){const t=e.readUint8();if(0===t||242===t)return"";const n=BC(e);return ZC.decode(new Uint8Array(e.buffer,(e.offset+=n)-n,n))}newTypeError(e){return new TypeError("expected: string; actual: "+typeof e)}},bytes:new class extends FC{constructor(){super(...arguments),this.primitive="bytes",this.defaultValue=EC.EMPTY}toJson(e,t){return"readable"===t?"hex:"+e.toBase16():e.toBase64()}fromJson(e){if(0===e)return EC.EMPTY;const t=e;return t.startsWith("hex:")?EC.fromBase16(t.substring(4)):EC.fromBase64(t)}encode(e,t){const{byteLength:n}=e;n?(t.writeUint8(245),$C(n,t),t.putBytes(e)):t.writeUint8(244)}decode(e){const t=e.readUint8();if(0===t||244===t)return EC.EMPTY;const n=BC(e);return EC.sliceOf(e.buffer,e.offset,e.offset+=n)}isDefault(e){return!e.byteLength}}};function XC(e){const t=e.readUint8();if(!(t<232))switch(t-232){case 0:case 4:e.offset+=2;break;case 1:case 5:case 8:e.offset+=4;break;case 2:case 6:case 7:case 9:e.offset+=8;break;case 3:++e.offset;break;case 11:case 13:{const t=BC(e);e.offset+=t;break}case 15:case 19:case 20:case 21:case 22:XC(e);break;case 16:XC(e),XC(e);break;case 17:XC(e),XC(e),XC(e);break;case 18:{const t=BC(e);for(let n=0;n<t;++n)XC(e);break}}}class eA extends LC{constructor(){super(...arguments),this.token=Symbol(),this.name="",this.modulePath="",this.doc="",this.removedNumbers=new Set}init(e,t,n,i,s,r){this.name=e,this.modulePath=t,this.parentType=n,this.doc=i,this.removedNumbers=new Set(r),this.registerFieldsOrVariants(s),this.initialized=!0,aA(this)}get qualifiedName(){const{name:e,parentType:t}=this;return t?`${t.name}.${e}`:e}addRecordDefinitionsTo(e){const t=`${this.modulePath}:${this.qualifiedName}`;if(e[t])return;const n=this.makeRecordDefinition(t);this.doc&&(n.doc=this.doc),this.removedNumbers.size&&(n.removed_numbers=[...this.removedNumbers]),e[t]=n;for(const t of this.dependencies())t.addRecordDefinitionsTo(e)}}class tA{constructor(e,t,n,i){this.token=e,this.totalSlots=t,this.json=n,this.bytes=i,Object.freeze(this)}}class nA extends eA{constructor(e,t,n){super(),this.defaultValue=e,this.createFn=t,this.newMutableFn=n,this.kind="struct",this.fields=[],this.fieldMapping={},this.reversedFields=[],this.slots=[],this.recognizedSlots=0,this.zeros=[],this.initializerTemplate={}}toJson(e,t){if(e===this.defaultValue)return"readable"===t?{}:[];if("readable"===t){const{fields:n}=this,i={};for(const s of n){const{serializer:n}=s,r=e[s.property];s.serializer.isDefault(r)||(i[s.name]=n.toJson(r,t))}return i}{const{slots:n}=this;let i;const s=e["^"];if(s&&s.json&&s.token===this.token){i=this.zeros.concat(s.json);for(const n of this.fields)i[n.number]=n.serializer.toJson(e[n.property],t)}else{i=[];const s=this.getArrayLength(e);for(let r=0;r<s;++r){const s=n[r];i[r]=s?s.serializer.toJson(e[s.property],t):0}}return i}}fromJson(e,t){if(!e)return this.defaultValue;const n=Object.assign({},this.initializerTemplate);if(e instanceof Array){const{slots:i,recognizedSlots:s}=this;if(e.length>s){if(t){const t=new tA(this.token,e.length,oA(e.slice(s)));n["^"]=t}e=e.slice(0,s)}for(let s=0;s<e.length&&s<i.length;++s){const r=i[s];r&&(n[r.property]=r.serializer.fromJson(e[s],t))}return this.createFn(n)}if(e instanceof Object){const{fieldMapping:i}=this;for(const s in e){const r=i[s];r&&(n[r.property]=r.serializer.fromJson(e[s],t))}return this.createFn(n)}throw TypeError()}encode(e,t){let n,i,s;const r=e["^"];r&&r.bytes&&r.token===this.token?(n=r.totalSlots,i=this.recognizedSlots,s=r.bytes):n=i=this.getArrayLength(e),n<=3?t.writeUint8(246+n):(t.writeUint8(250),$C(n,t));const{slots:o}=this;for(let n=0;n<i;++n){const i=o[n];i?i.serializer.encode(e[i.property],t):t.writeUint8(0)}s&&t.putBytes(s)}decode(e){const t=e.readUint8();if(0===t||246===t)return this.defaultValue;const n=Object.assign({},this.initializerTemplate),i=250===t?BC(e):t-246,{slots:s,recognizedSlots:r}=this;for(let t=0;t<i&&t<r;++t){const i=s[t];i?n[i.property]=i.serializer.decode(e):XC(e)}if(i>r){const t=e.offset;for(let t=r;t<i;++t)XC(e);if(e.keepUnrecognizedValues){const s=e.offset,r=EC.sliceOf(e.buffer,t,s),o=new tA(this.token,i,void 0,r);n["^"]=o}}return this.createFn(n)}getArrayLength(e){const{reversedFields:t}=this;for(let n=0;n<t.length;++n){const i=t[n];if(!i.serializer.isDefault(e[i.property]))return i.number+1}return 0}isDefault(e){return e===this.defaultValue||!e["^"]&&this.fields.every(t=>t.serializer.isDefault(e[t.property]))}get typeSignature(){return{kind:"record",value:`${this.modulePath}:${this.qualifiedName}`}}getField(e){return this.fieldMapping[e]}newMutable(e){return this.newMutableFn(e)}registerFieldsOrVariants(e){for(const t of e){const{name:e,number:n,property:i}=t;this.fields.push(t),this.slots[n]=t,this.fieldMapping[e]=t,this.fieldMapping[i]=t,this.fieldMapping[n]=t,this.initializerTemplate[i]=this.defaultValue[t.property]}this.recognizedSlots=Math.max(this.slots.length-1,...this.removedNumbers)+1,this.zeros.push(...Array(this.recognizedSlots).fill(0)),this.reversedFields=[...this.fields].sort((e,t)=>t.number-e.number)}makeRecordDefinition(e){return{kind:"struct",id:e,doc:void 0,fields:this.fields.map(e=>({name:e.name,number:e.number,type:e.serializer.typeSignature,doc:gA(e.doc)}))}}dependencies(){return this.fields.map(e=>e.serializer)}}class iA{constructor(e,t,n){this.token=e,this.json=t,this.bytes=n,Object.freeze(this)}}class sA{constructor(e,t,n,i,s){this.name=e,this.number=t,this.serializer=n,this.doc=i,this.createFn=s}get type(){return this.serializer.typeDescriptor}get(e){return e.kind===this.name?e.value:void 0}wrap(e){return this.createFn({kind:this.name,value:e})}}class rA extends eA{constructor(e){super(),this.createFn=e,this.kind="enum",this.variants=[],this.variantMapping={},this.defaultValue=e("UNKNOWN")}toJson(e,t){const n=e["^"],i=e.kind;if("UNKNOWN"===i&&n&&n.json&&n.token===this.token)return n.json;if("UNKNOWN"===i)return"readable"===t?"UNKNOWN":0;const s=this.variantMapping[i],{serializer:r}=s;if(r){const n=e.value;return"readable"===t?{kind:s.name,value:r.toJson(n,t)}:[s.number,r.toJson(n,t)]}return"readable"===t?s.name:s.number}fromJson(e,t){const n="number"==typeof e;if(n||"string"==typeof e){const i=this.variantMapping[n?e:String(e)];return i?i.serializer?i.wrap(i.serializer.defaultValue):i.constant:!t||n&&this.removedNumbers.has(e)?this.defaultValue:this.createFn(new iA(this.token,oA(e)))}let i,s;if(e instanceof Array)i=e[0],s=e[1];else{if(!(e instanceof Object))throw TypeError();i=e.kind,s=e.value}const r=this.variantMapping[i];if(!r)return!t||"number"==typeof i&&this.removedNumbers.has(i)?this.defaultValue:this.createFn(new iA(this.token,oA(e),void 0));const{serializer:o}=r;return o?r.wrap(o.fromJson(s,t)):r.constant}encode(e,t){const n=e["^"],i=e.kind;if("UNKNOWN"===i&&n&&n.bytes&&n.token===this.token)return void t.putBytes(n.bytes);if("UNKNOWN"===i)return void t.writeUint8(0);const s=this.variantMapping[i],{number:r,serializer:o}=s;if(o){const n=e.value;r<5?t.writeUint8(250+r):(t.writeUint8(248),$C(r,t)),o.encode(n,t)}else $C(r,t)}decode(e){const t=e.offset,n=e.dataView.getUint8(t);if(n<242){const n=BC(e),i=this.variantMapping[n];if(!i){if(!e.keepUnrecognizedValues||this.removedNumbers.has(n))return this.defaultValue;{const{offset:n}=e,i=EC.sliceOf(e.buffer,t,n);return this.createFn(new iA(this.token,void 0,i))}}return i.serializer?i.wrap(i.serializer.defaultValue):i.constant}{++e.offset;const i=248===n?BC(e):n-250,s=this.variantMapping[i];if(!s){if(XC(e),!e.keepUnrecognizedValues||this.removedNumbers.has(i))return this.defaultValue;{const{offset:n}=e,i=EC.sliceOf(e.buffer,t,n);return this.createFn(new iA(this.token,void 0,i))}}const{serializer:r}=s;return r?s.wrap(r.decode(e)):(XC(e),s.constant)}}get typeSignature(){return{kind:"record",value:`${this.modulePath}:${this.qualifiedName}`}}isDefault(e){return"UNKNOWN"===e.kind&&!e["^"]}getVariant(e){return this.variantMapping[e]}registerFieldsOrVariants(e){for(const t of e){if(this.variants.push(t),this.variantMapping[t.name]=t,void 0===t.serializer){const e=t.name.toUpperCase();e!==t.name&&(this.variantMapping[e]=t);const n=t.name.toLowerCase();n!==t.name&&(this.variantMapping[n]=t)}this.variantMapping[t.number]=t}}makeRecordDefinition(e){return{kind:"enum",id:e,doc:void 0,variants:this.variants.filter(e=>e.number).map(e=>{var t;const n={name:e.name,number:e.number,doc:gA(e.doc)},i=null===(t=null==e?void 0:e.serializer)||void 0===t?void 0:t.typeSignature;return i?Object.assign(Object.assign({},n),{type:i}):n})}}dependencies(){const e=[];for(const t of this.variants)t.serializer&&e.push(t.serializer);return e}}function oA(e){return e instanceof Array?Object.freeze(e.map(oA)):e instanceof Object?Object.freeze(Object.fromEntries(Object.entries(e).map((e,t)=>[e,oA(t)]))):e}function aA(e){if(e instanceof Object&&!(e instanceof fA||e instanceof pA)&&(!(e instanceof eA)||e.initialized)&&!Object.isFrozen(e)){Object.freeze(e);for(const t of Object.values(e))aA(t)}}const lA=new WeakMap;function cA(e){return lA.has(e)||lA.set(Object.freeze(e),{}),e}const hA=cA([]),uA=Symbol();function dA(e){const t=Object.getPrototypeOf(e).constructor,{qualifiedName:n}=t.serializer;return Error(["Do not call the constructor directly; ",`instead, call ${n}.create(...)`].join(""))}class fA{constructor(e){if(e!==uA)throw dA(this)}toMutable(){return new(Object.getPrototypeOf(this).constructor.Mutable)(this)}toFrozen(){return this}toString(){return mA(this)}}class pA{constructor(e,t,n,i){if(e!==uA)throw dA(this);if(this.kind=t,this.value=n,i){if(!(i instanceof iA))throw new TypeError;this["^"]=i}Object.freeze(this)}toString(){return mA(this)}}function mA(e){return Object.getPrototypeOf(e).constructor.serializer.toJsonCode(e,"readable")}function gA(e){return e||void 0}function bA(){return bA=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)({}).hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},bA.apply(null,arguments)}Object.defineProperty(pA.prototype,"union",{get:function(){return this}});var yA=e=>{var{theme:t,settings:n={},styles:i=[]}=e,s={".cm-gutters":{}},r={};n.background&&(r.backgroundColor=n.background),n.backgroundImage&&(r.backgroundImage=n.backgroundImage),n.foreground&&(r.color=n.foreground),n.fontSize&&(r.fontSize=n.fontSize),(n.background||n.foreground)&&(s["&"]=r),n.fontFamily&&(s["&.cm-editor .cm-scroller"]={fontFamily:n.fontFamily}),n.gutterBackground&&(s[".cm-gutters"].backgroundColor=n.gutterBackground),n.gutterForeground&&(s[".cm-gutters"].color=n.gutterForeground),n.gutterBorder&&(s[".cm-gutters"].borderRightColor=n.gutterBorder),n.caret&&(s[".cm-content"]={caretColor:n.caret},s[".cm-cursor, .cm-dropCursor"]={borderLeftColor:n.caret});var o={};return n.gutterActiveForeground&&(o.color=n.gutterActiveForeground),n.lineHighlight&&(s[".cm-activeLine"]={backgroundColor:n.lineHighlight},o.backgroundColor=n.lineHighlight),s[".cm-activeLineGutter"]=o,n.selection&&(s["&.cm-focused .cm-selectionBackground, & .cm-line::selection, & .cm-selectionLayer .cm-selectionBackground, .cm-content ::selection"]={background:n.selection+" !important"}),n.selectionMatch&&(s["& .cm-selectionMatch"]={backgroundColor:n.selectionMatch}),[Uo.theme(s,{dark:"dark"===t}),Wc(Lc.define(i))]},vA={background:"#0f0f0f",foreground:"#defdef",caret:"#00FF00",selection:"#515151",selectionMatch:"#515151",gutterBackground:"#555",gutterForeground:"#FFFFFF",lineHighlight:"#0a6bcb3d"},kA=[{tag:Te.keyword,color:"darkgoldenrod",fontWeight:"bold"},{tag:Te.atom,color:"#77F"},{tag:Te.comment,color:"#7a7b7c",fontStyle:"italic"},{tag:Te.number,color:"violet"},{tag:Te.definition(Te.variableName),color:"#fffabc"},{tag:Te.variableName,color:"#abcdef"},{tag:Te.function(Te.variableName),color:"#fffabc"},{tag:Te.typeName,color:"#FFDD44"},{tag:Te.tagName,color:"#def"},{tag:Te.string,color:"#2b4"},{tag:Te.meta,color:"#C9F"},{tag:Te.bracket,color:"#8a8a8a"},{tag:Te.attributeName,color:"#DDFF00"},{tag:Te.heading,color:"aquamarine",fontWeight:"bold"},{tag:Te.link,color:"blueviolet",fontWeight:"bold"}],wA=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},vA,t),styles:[...kA,...n]})})(),xA="#000c18",SA="#6688cc",CA="#770811",AA="#770811",TA="#ddbb88",NA="#0055ff30",OA="#225588",MA="#2277ff",EA="#9966b8",DA="#22aa44",_A="#f280d0",IA="#9966b8",BA="#ddbb88",PA="#f280d0",RA="#384887",$A="#6688cc",LA="#A22D44",zA="#22aa44",FA="#225588",jA={background:xA,foreground:SA,caret:TA,selection:CA,selectionMatch:AA,gutterBackground:xA,gutterForeground:SA,lineHighlight:NA},WA=[{tag:Te.keyword,color:OA},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:MA},{tag:[Te.propertyName],color:EA},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:DA},{tag:[Te.function(Te.variableName),Te.labelName],color:EA},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:_A},{tag:[Te.definition(Te.name),Te.separator],color:MA},{tag:[Te.className],color:BA},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:PA},{tag:[Te.typeName],color:IA,fontStyle:IA},{tag:[Te.operator,Te.operatorKeyword],color:OA},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:zA},{tag:[Te.meta,Te.comment],color:RA},{tag:Te.tagName,color:FA},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:$A},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:MA},{tag:Te.invalid,color:LA},{tag:Te.strikethrough,textDecoration:"line-through"}],UA=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},jA,t),styles:[...WA,...n]})})(),VA={background:"#282b2e",foreground:"#a9b7c6",caret:"#00FF00",selection:"#4e5254",selectionMatch:"#4e5254",lineHighlight:"#7f85891f"},HA=[{tag:[Te.keyword,Te.deleted,Te.className],color:"#cc7832"},{tag:[Te.number,Te.literal,Te.derefOperator],color:"#6897bb"},{tag:[Te.link,Te.variableName],color:"#629755"},{tag:[Te.comment,Te.quote],color:"grey"},{tag:[Te.meta,Te.documentMeta],color:"#bbb529"},{tag:[Te.string,Te.propertyName,Te.attributeValue],color:"#6a8759"},{tag:[Te.heading,Te.typeName],color:"#ffc66d"},{tag:[Te.attributeName],color:"#a9b7c6"},{tag:[Te.emphasis],fontStyle:"italic"}],qA=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},VA,t),styles:[...HA,...n]})})(),KA="#23262E",JA="#D5CED9",ZA="#db45a280",YA="#db45a280",GA="#FFF",QA="#596a992e",XA="#c74ded",eT="#00e8c6",tT="#FFE66D",nT="#96E072",iT="#ee5d43",sT="#FFE66D",rT="#FFE66D",oT="#ee5d43",aT="#A0A1A7cc",lT="#ff00aa",cT=null,hT="#96E072",uT="#f92672",dT={background:KA,foreground:JA,caret:GA,selection:ZA,selectionMatch:YA,gutterBackground:KA,gutterForeground:JA,lineHighlight:QA},fT=[{tag:Te.keyword,color:XA},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:eT},{tag:[Te.propertyName],color:tT},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:nT},{tag:[Te.function(Te.variableName),Te.labelName],color:tT},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:iT},{tag:[Te.definition(Te.name),Te.separator],color:eT},{tag:[Te.className],color:rT},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:oT},{tag:[Te.typeName],color:sT,fontStyle:sT},{tag:[Te.operator],color:XA},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:hT},{tag:[Te.meta,Te.comment],color:aT},{tag:Te.tagName,color:uT},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:lT},{tag:[Te.atom,Te.special(Te.variableName)],color:eT},{tag:Te.invalid,color:cT},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.operatorKeyword,Te.bool,Te.null,Te.variableName],color:iT}],pT=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},dT,t),styles:[...fT,...n]})})(),mT={background:"#272C35",foreground:"#9d9b97",caret:"#797977",selection:"#3d4c64",selectionMatch:"#3d4c64",gutterBackground:"#272C35",gutterForeground:"#465063",gutterBorder:"transparent",lineHighlight:"#2e3f5940"},gT=[{tag:[Te.function(Te.variableName),Te.function(Te.propertyName),Te.url,Te.processingInstruction],color:"hsl(207, 82%, 66%)"},{tag:[Te.tagName,Te.heading],color:"#e06c75"},{tag:Te.comment,color:"#54636D"},{tag:[Te.propertyName],color:"hsl(220, 14%, 71%)"},{tag:[Te.attributeName,Te.number],color:"hsl( 29, 54%, 61%)"},{tag:Te.className,color:"hsl( 39, 67%, 69%)"},{tag:Te.keyword,color:"hsl(286, 60%, 67%)"},{tag:[Te.string,Te.regexp,Te.special(Te.propertyName)],color:"#98c379"}],bT=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},mT,t),styles:[...gT,...n]})})(),yT={background:"#21202e",foreground:"#edecee",caret:"#a277ff",selection:"#5a51898f",selectionMatch:"#5a51898f",gutterBackground:"#21202e",gutterForeground:"#edecee",gutterBorder:"transparent",lineHighlight:"#a394f033"},vT=[{tag:Te.keyword,color:"#a277ff"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#edecee"},{tag:[Te.propertyName],color:"#ffca85"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#61ffca"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#ffca85"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#61ffca"},{tag:[Te.definition(Te.name),Te.separator],color:"#edecee"},{tag:[Te.className],color:"#82e2ff"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#61ffca"},{tag:[Te.typeName],color:"#82e2ff"},{tag:[Te.operator,Te.operatorKeyword],color:"#a277ff"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#61ffca"},{tag:[Te.meta,Te.comment],color:"#6d6d6d"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#a277ff"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#edecee"},{tag:Te.invalid,color:"#ff6767"},{tag:Te.strikethrough,textDecoration:"line-through"}],kT=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},yT,t),styles:[...vT,...n]})})(),wT={background:"#2E3235",foreground:"#DDDDDD",caret:"#DDDDDD",selection:"#202325",selectionMatch:"#202325",gutterBackground:"#292d30",gutterForeground:"#808080",gutterBorder:"1px solid #ffffff10",lineHighlight:"#B9D2FF30"},xT=[{tag:Te.keyword,color:"#fda331"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#b5bd68"},{tag:[Te.variableName],color:"#6fb3d2"},{tag:[Te.function(Te.variableName)],color:"#fda331"},{tag:[Te.labelName],color:"#fc6d24"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#fda331"},{tag:[Te.definition(Te.name),Te.separator],color:"#cc99cc"},{tag:[Te.brace],color:"#cc99cc"},{tag:[Te.annotation],color:"#fc6d24"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#fda331"},{tag:[Te.typeName,Te.className],color:"#6fb3d2"},{tag:[Te.operator,Te.operatorKeyword],color:"#cc99cc"},{tag:[Te.tagName],color:"#fda331"},{tag:[Te.squareBracket],color:"#cc99cc"},{tag:[Te.angleBracket],color:"#cc99cc"},{tag:[Te.attributeName],color:"#6fb3d2"},{tag:[Te.regexp],color:"#fda331"},{tag:[Te.quote],color:"#DDDDDD"},{tag:[Te.string],color:"#b5bd68"},{tag:Te.link,color:"#6987AF",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#8abeb7"},{tag:[Te.meta],color:"#A54543"},{tag:[Te.comment],color:"#808080",fontStyle:"italic"},{tag:Te.monospace,color:"#DDDDDD"},{tag:Te.strong,fontWeight:"bold",color:"#fda331"},{tag:Te.emphasis,fontStyle:"italic",color:"#6fb3d2"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#DDDDDD"},{tag:Te.special(Te.heading1),fontWeight:"bold",color:"#DDDDDD"},{tag:Te.heading1,fontWeight:"bold",color:"#DDDDDD"},{tag:[Te.heading2,Te.heading3,Te.heading4],fontWeight:"bold",color:"#DDDDDD"},{tag:[Te.heading5,Te.heading6],color:"#DDDDDD"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#8abeb7"},{tag:[Te.processingInstruction,Te.inserted],color:"#8abeb7"},{tag:[Te.contentSeparator],color:"#6fb3d2"},{tag:Te.invalid,color:"#B9D2FF",borderBottom:"1px dotted #fc6d24"}],ST=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},wT,t),styles:[...xT,...n]})})(),CT={background:"#ffffff",foreground:"#2e3440",caret:"#3b4252",selection:"#eceff4",selectionMatch:"#e5e9f0",gutterBackground:"#eceff4",gutterForeground:"#2e3440",gutterBorder:"none",lineHighlight:"#02255f11"},AT=[{tag:Te.keyword,color:"#5e81ac"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#d08770"},{tag:[Te.variableName],color:"#d08770"},{tag:[Te.function(Te.variableName)],color:"#5e81ac"},{tag:[Te.labelName],color:"#81a1c1"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#5e81ac"},{tag:[Te.definition(Te.name),Te.separator],color:"#a3be8c"},{tag:[Te.brace],color:"#8fbcbb"},{tag:[Te.annotation],color:"#d30102"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#88c0d0"},{tag:[Te.typeName,Te.className],color:"#ebcb8b"},{tag:[Te.operator,Te.operatorKeyword],color:"#a3be8c"},{tag:[Te.tagName],color:"#b48ead"},{tag:[Te.squareBracket],color:"#bf616a"},{tag:[Te.angleBracket],color:"#d08770"},{tag:[Te.attributeName],color:"#ebcb8b"},{tag:[Te.regexp],color:"#5e81ac"},{tag:[Te.quote],color:"#3b4252"},{tag:[Te.string],color:"#d08770"},{tag:Te.link,color:"#8fbcbb",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#d08770"},{tag:[Te.meta],color:"#88c0d0"},{tag:[Te.comment],color:"#434c5e",fontStyle:"italic"},{tag:Te.strong,fontWeight:"bold",color:"#5e81ac"},{tag:Te.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#5e81ac"},{tag:Te.special(Te.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:Te.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[Te.heading2,Te.heading3,Te.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[Te.heading5,Te.heading6],color:"#5e81ac"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#d08770"},{tag:[Te.processingInstruction,Te.inserted],color:"#8fbcbb"},{tag:[Te.contentSeparator],color:"#ebcb8b"},{tag:Te.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}],TT=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},CT,t),styles:[...AT,...n]})})(),NT={background:"#FFFFFF",foreground:"#000000",caret:"#FBAC52",selection:"#FFD420",selectionMatch:"#FFD420",gutterBackground:"#f5f5f5",gutterForeground:"#4D4D4C",gutterBorder:"transparent",lineHighlight:"#00000012"},OT=[{tag:[Te.meta,Te.comment],color:"#804000"},{tag:[Te.keyword,Te.strong],color:"#0000FF"},{tag:[Te.number],color:"#FF0080"},{tag:[Te.string],color:"#FF0080"},{tag:[Te.variableName],color:"#006600"},{tag:[Te.escape],color:"#33CC33"},{tag:[Te.tagName],color:"#1C02FF"},{tag:[Te.heading],color:"#0C07FF"},{tag:[Te.quote],color:"#000000"},{tag:[Te.list],color:"#B90690"},{tag:[Te.documentMeta],color:"#888888"},{tag:[Te.function(Te.variableName)],color:"#0000A2"},{tag:[Te.definition(Te.typeName),Te.typeName],color:"#6D79DE"}],MT=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},NT,t),styles:[...OT,...n]})})(),ET={background:"#28211c",foreground:"#9d9b97",caret:"#797977",selection:"#4f382b",selectionMatch:"#4f382b",gutterBackground:"#28211c",gutterForeground:"#666666",lineHighlight:"#ffffff1a"},DT=[{tag:[Te.atom,Te.number,Te.link,Te.bool],color:"#9b859d"},{tag:Te.comment,color:"#937121"},{tag:[Te.keyword,Te.tagName],color:"#cf6a4c"},{tag:Te.string,color:"#f9ee98"},{tag:Te.bracket,color:"#9d9b97"},{tag:[Te.variableName],color:"#5ea6ea"},{tag:Te.definition(Te.variableName),color:"#cf7d34"},{tag:[Te.function(Te.variableName),Te.className],color:"#cf7d34"},{tag:[Te.propertyName,Te.attributeName],color:"#54be0d"}],_T=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},ET,t),styles:[...DT,...n]})})(),IT={background:"#000",foreground:"#fff",caret:"#fff",selection:"#5c6c9b",selectionMatch:"#2a3967",gutterBackground:"#000",gutterForeground:"#ada9a9",gutterActiveForeground:"#fff",lineHighlight:"#82828275"},BT=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},IT,t),styles:[...n]})})(),PT={background:"#fff",foreground:"#000",caret:"#000",selection:"#c2d2ff",selectionMatch:"#b1c1ef",gutterBackground:"#fff",gutterForeground:"#ada9a9",gutterActiveForeground:"#000",lineHighlight:"#c7c5c575"},RT=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},PT,t),styles:[...n]})})(),$T="#232a2f",LT="#939da5",zT="#204062",FT="#204062",jT="#939da5",WT="#4469832b",UT="#ba8ef7",VT="#939da5",HT="#ffea6b",qT="#5bec95",KT="#939da5",JT="#89ddff",ZT="#ffea6b",YT="#89ddff",GT="#707a84",QT="#5bec95",XT="#ff6a80",eN="#56adb7",tN="#ff6a80",nN={background:$T,foreground:LT,caret:jT,selection:zT,selectionMatch:FT,gutterBackground:$T,gutterForeground:LT,lineHighlight:WT},iN=[{tag:Te.keyword,color:UT},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:VT},{tag:[Te.propertyName],color:HT},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:qT},{tag:[Te.function(Te.variableName),Te.labelName],color:HT},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:KT},{tag:[Te.definition(Te.name),Te.separator],color:VT},{tag:[Te.className],color:ZT},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:YT},{tag:[Te.typeName],color:JT,fontStyle:JT},{tag:[Te.operator],color:UT},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:eN},{tag:[Te.meta,Te.comment],color:GT},{tag:Te.tagName,color:tN},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:QT},{tag:[Te.atom,Te.special(Te.variableName)],color:VT},{tag:Te.invalid,color:XT},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.operatorKeyword,Te.bool,Te.null,Te.variableName],color:KT}],sN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},nN,t),styles:[...iN,...n]})})(),rN={background:"#2B2B2B",foreground:"#f8f8f2",caret:"#FFFFFF",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"rgba(255, 255, 255, 0.1)",gutterForeground:"#999",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},oN=[{tag:[Te.atom,Te.number],color:"#bd93f9"},{tag:[Te.comment],color:"#61A151"},{tag:[Te.string],color:"#6A8759"},{tag:[Te.variableName,Te.operator],color:"#A9B7C6"},{tag:[Te.meta,Te.className],color:"#A9B7C6"},{tag:[Te.propertyName],color:"#FFC66D"},{tag:[Te.keyword],color:"#CC7832"},{tag:[Te.tagName],color:"#ff79c6"},{tag:[Te.typeName],color:"#ffb86c"}],aN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},rN,t),styles:[...oN,...n]})})(),lN={background:"#282a36",foreground:"#f8f8f2",caret:"#f8f8f0",selection:"rgba(255, 255, 255, 0.1)",selectionMatch:"rgba(255, 255, 255, 0.2)",gutterBackground:"#282a36",gutterForeground:"#6D8A88",gutterBorder:"transparent",lineHighlight:"rgba(255, 255, 255, 0.1)"},cN=[{tag:Te.comment,color:"#6272a4"},{tag:Te.string,color:"#f1fa8c"},{tag:Te.atom,color:"#bd93f9"},{tag:Te.meta,color:"#f8f8f2"},{tag:[Te.keyword,Te.operator,Te.tagName],color:"#ff79c6"},{tag:[Te.function(Te.propertyName),Te.propertyName],color:"#66d9ef"},{tag:[Te.definition(Te.variableName),Te.function(Te.variableName),Te.className,Te.attributeName],color:"#50fa7b"},{tag:Te.atom,color:"#bd93f9"}],hN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},lN,t),styles:[...cN,...n]})})(),uN={background:"#faf8f5",foreground:"#b29762",caret:"#93abdc",selection:"#e3dcce",selectionMatch:"#e3dcce",gutterBackground:"#faf8f5",gutterForeground:"#cdc4b1",gutterBorder:"transparent",lineHighlight:"#ddceb154"},dN=[{tag:[Te.comment,Te.bracket],color:"#b6ad9a"},{tag:[Te.atom,Te.number,Te.keyword,Te.link,Te.attributeName,Te.quote],color:"#063289"},{tag:[Te.emphasis,Te.heading,Te.tagName,Te.propertyName,Te.variableName],color:"#2d2006"},{tag:[Te.typeName,Te.url,Te.string],color:"#896724"},{tag:[Te.operator,Te.string],color:"#1659df"},{tag:[Te.propertyName],color:"#b29762"},{tag:[Te.unit,Te.punctuation],color:"#063289"}],fN=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},uN,t),styles:[...dN,...n]})})(),pN={background:"#2a2734",foreground:"#6c6783",caret:"#ffad5c",selection:"#91ff6c26",selectionMatch:"#91ff6c26",gutterBackground:"#2a2734",gutterForeground:"#545167",lineHighlight:"#36334280"},mN=[{tag:[Te.comment,Te.bracket],color:"#6c6783"},{tag:[Te.atom,Te.number,Te.keyword,Te.link,Te.attributeName,Te.quote],color:"#ffcc99"},{tag:[Te.emphasis,Te.heading,Te.tagName,Te.propertyName,Te.className,Te.variableName],color:"#eeebff"},{tag:[Te.typeName,Te.url],color:"#7a63ee"},{tag:Te.operator,color:"#ffad5c"},{tag:Te.string,color:"#ffb870"},{tag:[Te.propertyName],color:"#9a86fd"},{tag:[Te.unit,Te.punctuation],color:"#e09142"}],gN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},pN,t),styles:[...mN,...n]})})(),bN={background:"#fff",foreground:"#000",caret:"#FFFFFF",selection:"#d7d4f0",selectionMatch:"#d7d4f0",gutterBackground:"#f7f7f7",gutterForeground:"#999",lineHighlight:"#006fff1c",gutterBorder:"transparent"},yN=[{tag:[Te.comment],color:"#3F7F5F"},{tag:[Te.documentMeta],color:"#FF1717"},{tag:Te.keyword,color:"#7F0055",fontWeight:"bold"},{tag:Te.atom,color:"#00f"},{tag:Te.number,color:"#164"},{tag:Te.propertyName,color:"#164"},{tag:[Te.variableName,Te.definition(Te.variableName)],color:"#0000C0"},{tag:Te.function(Te.variableName),color:"#0000C0"},{tag:Te.string,color:"#2A00FF"},{tag:Te.operator,color:"black"},{tag:Te.tagName,color:"#170"},{tag:Te.attributeName,color:"#00c"},{tag:Te.link,color:"#219"}],vN=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},bN,t),styles:[...yN,...n]})})(),kN={background:"#fff",foreground:"#24292e",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#6e7781"},wN=[{tag:[Te.standard(Te.tagName),Te.tagName],color:"#116329"},{tag:[Te.comment,Te.bracket],color:"#6a737d"},{tag:[Te.className,Te.propertyName],color:"#6f42c1"},{tag:[Te.variableName,Te.attributeName,Te.number,Te.operator],color:"#005cc5"},{tag:[Te.keyword,Te.typeName,Te.typeOperator,Te.typeName],color:"#d73a49"},{tag:[Te.string,Te.meta,Te.regexp],color:"#032f62"},{tag:[Te.name,Te.quote],color:"#22863a"},{tag:[Te.heading,Te.strong],color:"#24292e",fontWeight:"bold"},{tag:[Te.emphasis],color:"#24292e",fontStyle:"italic"},{tag:[Te.deleted],color:"#b31d28",backgroundColor:"ffeef0"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#e36209"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#032f62"},{tag:Te.link,textDecoration:"underline"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.invalid,color:"#cb2431"}],xN=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},kN,t),styles:[...wN,...n]})})(),SN={background:"#0d1117",foreground:"#c9d1d9",caret:"#c9d1d9",selection:"#003d73",selectionMatch:"#003d73",lineHighlight:"#36334280"},CN=[{tag:[Te.standard(Te.tagName),Te.tagName],color:"#7ee787"},{tag:[Te.comment,Te.bracket],color:"#8b949e"},{tag:[Te.className,Te.propertyName],color:"#d2a8ff"},{tag:[Te.variableName,Te.attributeName,Te.number,Te.operator],color:"#79c0ff"},{tag:[Te.keyword,Te.typeName,Te.typeOperator,Te.typeName],color:"#ff7b72"},{tag:[Te.string,Te.meta,Te.regexp],color:"#a5d6ff"},{tag:[Te.name,Te.quote],color:"#7ee787"},{tag:[Te.heading,Te.strong],color:"#d2a8ff",fontWeight:"bold"},{tag:[Te.emphasis],color:"#d2a8ff",fontStyle:"italic"},{tag:[Te.deleted],color:"#ffdcd7",backgroundColor:"ffeef0"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#ffab70"},{tag:Te.link,textDecoration:"underline"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.invalid,color:"#f97583"}],AN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},SN,t),styles:[...CN,...n]})})(),TN={background:"#282828",foreground:"#ebdbb2",caret:"#ebdbb2",selection:"#b99d555c",selectionMatch:"#b99d555c",lineHighlight:"#baa1602b",gutterBackground:"#282828",gutterForeground:"#7c6f64"},NN=[{tag:Te.keyword,color:"#fb4934"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#8ec07c"},{tag:[Te.variableName],color:"#83a598"},{tag:[Te.function(Te.variableName)],color:"#b8bb26",fontStyle:"bold"},{tag:[Te.labelName],color:"#ebdbb2"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#d3869b"},{tag:[Te.definition(Te.name),Te.separator],color:"#ebdbb2"},{tag:[Te.brace],color:"#ebdbb2"},{tag:[Te.annotation],color:"#fb4934d"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#d3869b"},{tag:[Te.typeName,Te.className],color:"#fabd2f"},{tag:[Te.operator,Te.operatorKeyword],color:"#fb4934"},{tag:[Te.tagName],color:"#8ec07c",fontStyle:"bold"},{tag:[Te.squareBracket],color:"#fe8019"},{tag:[Te.angleBracket],color:"#83a598"},{tag:[Te.attributeName],color:"#8ec07c"},{tag:[Te.regexp],color:"#8ec07c"},{tag:[Te.quote],color:"#928374"},{tag:[Te.string],color:"#ebdbb2"},{tag:Te.link,color:"#a89984",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#d3869b"},{tag:[Te.meta],color:"#fabd2f"},{tag:[Te.comment],color:"#928374",fontStyle:"italic"},{tag:Te.strong,fontWeight:"bold",color:"#fe8019"},{tag:Te.emphasis,fontStyle:"italic",color:"#b8bb26"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#b8bb26"},{tag:[Te.heading1,Te.heading2],fontWeight:"bold",color:"#b8bb26"},{tag:[Te.heading3,Te.heading4],fontWeight:"bold",color:"#fabd2f"},{tag:[Te.heading5,Te.heading6],color:"#fabd2f"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#d3869b"},{tag:[Te.processingInstruction,Te.inserted],color:"#83a598"},{tag:[Te.contentSeparator],color:"#fb4934"},{tag:Te.invalid,color:"#fe8019",borderBottom:"1px dotted #fb4934d"}],ON=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},TN,t),styles:[...NN,...n]})})(),MN={background:"#fbf1c7",foreground:"#3c3836",caret:"#af3a03",selection:"#bdae9391",selectionMatch:"#bdae9391",lineHighlight:"#a37f2238",gutterBackground:"#ebdbb2",gutterForeground:"#665c54",gutterBorder:"transparent"},EN=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},MN,t),styles:[{tag:Te.keyword,color:"#9d0006"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#427b58"},{tag:[Te.variableName],color:"#076678"},{tag:[Te.function(Te.variableName)],color:"#79740e",fontStyle:"bold"},{tag:[Te.labelName],color:"#3c3836"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#8f3f71"},{tag:[Te.definition(Te.name),Te.separator],color:"#3c3836"},{tag:[Te.brace],color:"#3c3836"},{tag:[Te.annotation],color:"#9d0006"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#8f3f71"},{tag:[Te.typeName,Te.className],color:"#b57614"},{tag:[Te.operator,Te.operatorKeyword],color:"#9d0006"},{tag:[Te.tagName],color:"#427b58",fontStyle:"bold"},{tag:[Te.squareBracket],color:"#af3a03"},{tag:[Te.angleBracket],color:"#076678"},{tag:[Te.attributeName],color:"#427b58"},{tag:[Te.regexp],color:"#427b58"},{tag:[Te.quote],color:"#928374"},{tag:[Te.string],color:"#3c3836"},{tag:Te.link,color:"#7c6f64",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#8f3f71"},{tag:[Te.meta],color:"#b57614"},{tag:[Te.comment],color:"#928374",fontStyle:"italic"},{tag:Te.strong,fontWeight:"bold",color:"#af3a03"},{tag:Te.emphasis,fontStyle:"italic",color:"#79740e"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#79740e"},{tag:[Te.heading1,Te.heading2],fontWeight:"bold",color:"#79740e"},{tag:[Te.heading3,Te.heading4],fontWeight:"bold",color:"#b57614"},{tag:[Te.heading5,Te.heading6],color:"#b57614"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#8f3f71"},{tag:[Te.processingInstruction,Te.inserted],color:"#076678"},{tag:[Te.contentSeparator],color:"#9d0006"},{tag:Te.invalid,color:"#af3a03",borderBottom:"1px dotted #9d0006"},...n]})})(),DN="#221a0f",_N="#d3af86",IN="#84613daa",BN="#98676a",PN="#dc3958",RN="#7e602c",$N="#889b4a",LN="#f79a32",zN="#f06431",FN="#f06431",jN="#f79a32",WN="#a57a4c",UN="#8ab1b0",VN="#dc3958",HN="#7e602c",qN="#dc3958",KN={background:DN,foreground:_N,caret:"#d3af86",selection:IN,selectionMatch:IN,gutterBackground:DN,gutterForeground:_N,lineHighlight:"#5e452b52"},JN=[{tag:Te.keyword,color:BN},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:PN},{tag:[Te.propertyName],color:RN},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:$N},{tag:[Te.function(Te.variableName),Te.labelName],color:RN},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:LN},{tag:[Te.definition(Te.name),Te.separator],color:PN},{tag:[Te.className],color:FN},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:jN},{tag:[Te.typeName],color:zN,fontStyle:zN},{tag:[Te.operator,Te.operatorKeyword],color:BN},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:HN},{tag:[Te.meta,Te.comment],color:WN},{tag:Te.tagName,color:qN},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:UN},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:PN},{tag:Te.invalid,color:VN},{tag:Te.strikethrough,textDecoration:"line-through"}],ZN=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},KN,t),styles:[...JN,...n]})})(),YN={background:"#2e3235",foreground:"#bdbdbd",caret:"#a0a4ae",selection:"#d7d4f063",selectionMatch:"#d7d4f063",gutterBackground:"#2e3235",gutterForeground:"#999",gutterActiveForeground:"#4f5b66",lineHighlight:"#545b6130"},GN=YN,QN=[{tag:Te.keyword,color:"#cf6edf"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#56c8d8"},{tag:[Te.propertyName],color:"#facf4e"},{tag:[Te.variableName],color:"#bdbdbd"},{tag:[Te.function(Te.variableName)],color:"#56c8d8"},{tag:[Te.labelName],color:"#cf6edf"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#facf4e"},{tag:[Te.definition(Te.name),Te.separator],color:"#fa5788"},{tag:[Te.brace],color:"#cf6edf"},{tag:[Te.annotation],color:"#ff5f52"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#ffad42"},{tag:[Te.typeName,Te.className],color:"#ffad42"},{tag:[Te.operator,Te.operatorKeyword],color:"#7186f0"},{tag:[Te.tagName],color:"#99d066"},{tag:[Te.squareBracket],color:"#ff5f52"},{tag:[Te.angleBracket],color:"#606f7a"},{tag:[Te.attributeName],color:"#bdbdbd"},{tag:[Te.regexp],color:"#ff5f52"},{tag:[Te.quote],color:"#6abf69"},{tag:[Te.string],color:"#99d066"},{tag:Te.link,color:"#56c8d8",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#facf4e"},{tag:[Te.meta],color:"#707d8b"},{tag:[Te.comment],color:"#707d8b",fontStyle:"italic"},{tag:Te.monospace,color:"#bdbdbd"},{tag:Te.strong,fontWeight:"bold",color:"#ff5f52"},{tag:Te.emphasis,fontStyle:"italic",color:"#99d066"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#facf4e"},{tag:Te.heading1,fontWeight:"bold",color:"#facf4e"},{tag:[Te.heading2,Te.heading3,Te.heading4],fontWeight:"bold",color:"#facf4e"},{tag:[Te.heading5,Te.heading6],color:"#facf4e"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#56c8d8"},{tag:[Te.processingInstruction,Te.inserted],color:"#ff5f52"},{tag:[Te.contentSeparator],color:"#56c8d8"},{tag:Te.invalid,color:"#606f7a",borderBottom:"1px dotted #ff5f52"}],XN=e=>{var{theme:t="dark",settings:n={},styles:i=[]}=e||{};return yA({theme:t,settings:bA({},YN,n),styles:[...QN,...i]})},eO=XN(),tO=XN(),nO={background:"#FAFAFA",foreground:"#90A4AE",caret:"#272727",selection:"#80CBC440",selectionMatch:"#80CBC440",gutterBackground:"#FAFAFA",gutterForeground:"#90A4AE",gutterBorder:"transparent",lineHighlight:"#CCD7DA50"},iO=[{tag:Te.keyword,color:"#39ADB5"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#90A4AE"},{tag:[Te.propertyName],color:"#6182B8"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#91B859"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#6182B8"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#39ADB5"},{tag:[Te.definition(Te.name),Te.separator],color:"#90A4AE"},{tag:[Te.className],color:"#E2931D"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#F76D47"},{tag:[Te.typeName],color:"#E2931D",fontStyle:"#E2931D"},{tag:[Te.operator,Te.operatorKeyword],color:"#39ADB5"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#91B859"},{tag:[Te.meta,Te.comment],color:"#90A4AE"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#39ADB5"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#90A4AE"},{tag:Te.invalid,color:"#E5393570"},{tag:Te.strikethrough,textDecoration:"line-through"}],sO=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},nO,t),styles:[...iO,...n]})})(),rO="#272822",oO="#f8f8f2",aO="#4a4a76",lO="#F92672",cO="#FD971F",hO="#66D9EF",uO="#E6DB74",dO="#AE81FF",fO="#66D9EF",pO="#A6E22E",mO="#AE81FF",gO="#88846f",bO="#A6E22E",yO="#F44747",vO="#E6DB74",kO="#F92672",wO={background:rO,foreground:oO,caret:"#f8f8f0",selection:aO,selectionMatch:aO,gutterBackground:rO,gutterForeground:oO,lineHighlight:"#3e3d3257"},xO=[{tag:Te.keyword,color:lO},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:cO},{tag:[Te.propertyName],color:hO},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:uO},{tag:[Te.function(Te.variableName),Te.labelName],color:hO},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:dO},{tag:[Te.definition(Te.name),Te.separator],color:cO},{tag:[Te.className],color:pO},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:mO},{tag:[Te.typeName],color:fO,fontStyle:fO},{tag:[Te.operator,Te.operatorKeyword],color:lO},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:vO},{tag:[Te.meta,Te.comment],color:gO},{tag:Te.tagName,color:kO},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:bO},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:cO},{tag:Te.invalid,color:yO},{tag:Te.strikethrough,textDecoration:"line-through"}],SO=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},wO,t),styles:[...xO,...n]})})(),CO="#1e1e1e",AO="#c5c8c6",TO="#4747a1",NO="#676867",OO="#c7444a",MO="#9872A2",EO="#D08442",DO="#8080FF",_O="#9B0000",IO="#CE6700",BO="#6089B4",PO="#9A9B99",RO="#D0B344",$O="#FF0B00",LO="#D08442",zO="#6089B4",FO={background:CO,foreground:AO,caret:"#c07020",selection:TO,selectionMatch:TO,gutterBackground:CO,gutterForeground:AO,lineHighlight:"#30303078"},jO=[{tag:Te.keyword,color:NO},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:OO},{tag:[Te.propertyName],color:MO},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:EO},{tag:[Te.function(Te.variableName),Te.labelName],color:MO},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:DO},{tag:[Te.definition(Te.name),Te.separator],color:OO},{tag:[Te.className],color:IO},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:BO},{tag:[Te.typeName],color:_O,fontStyle:_O},{tag:[Te.operator,Te.operatorKeyword],color:NO},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:LO},{tag:[Te.meta,Te.comment],color:PO},{tag:Te.tagName,color:zO},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:RO},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:OO},{tag:Te.invalid,color:$O},{tag:Te.strikethrough,textDecoration:"line-through"}],WO=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},FO,t),styles:[...jO,...n]})})(),UO={background:"#f2f1f8",foreground:"#0c006b",caret:"#5c49e9",selection:"#d5d1f2",selectionMatch:"#d5d1f2",gutterBackground:"#f2f1f8",gutterForeground:"#0c006b70",lineHighlight:"#16067911"},VO=[{tag:Te.comment,color:"#9995b7"},{tag:Te.keyword,color:"#ff5792",fontWeight:"bold"},{tag:[Te.definitionKeyword,Te.modifier],color:"#ff5792"},{tag:[Te.className,Te.tagName,Te.definition(Te.typeName)],color:"#0094f0"},{tag:[Te.number,Te.bool,Te.null,Te.special(Te.brace)],color:"#5842ff"},{tag:[Te.definition(Te.propertyName),Te.function(Te.variableName)],color:"#0095a8"},{tag:Te.typeName,color:"#b3694d"},{tag:[Te.propertyName,Te.variableName],color:"#fa8900"},{tag:Te.operator,color:"#ff5792"},{tag:Te.self,color:"#e64100"},{tag:[Te.string,Te.regexp],color:"#00b368"},{tag:[Te.paren,Te.bracket],color:"#0431fa"},{tag:Te.labelName,color:"#00bdd6"},{tag:Te.attributeName,color:"#e64100"},{tag:Te.angleBracket,color:"#9995b7"}],HO=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},UO,t),styles:[...VO,...n]})})(),qO={background:"#2e3440",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#00000073",selectionMatch:"#00000073",gutterBackground:"#2e3440",gutterForeground:"#4c566a",gutterActiveForeground:"#d8dee9",lineHighlight:"#4c566a29"},KO=[{tag:Te.keyword,color:"#5e81ac"},{tag:[Te.name,Te.deleted,Te.character,Te.propertyName,Te.macroName],color:"#88c0d0"},{tag:[Te.variableName],color:"#8fbcbb"},{tag:[Te.function(Te.variableName)],color:"#8fbcbb"},{tag:[Te.labelName],color:"#81a1c1"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#5e81ac"},{tag:[Te.definition(Te.name),Te.separator],color:"#a3be8c"},{tag:[Te.brace],color:"#8fbcbb"},{tag:[Te.annotation],color:"#d30102"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#b48ead"},{tag:[Te.typeName,Te.className],color:"#ebcb8b"},{tag:[Te.operator,Te.operatorKeyword],color:"#a3be8c"},{tag:[Te.tagName],color:"#b48ead"},{tag:[Te.squareBracket],color:"#bf616a"},{tag:[Te.angleBracket],color:"#d08770"},{tag:[Te.attributeName],color:"#ebcb8b"},{tag:[Te.regexp],color:"#5e81ac"},{tag:[Te.quote],color:"#b48ead"},{tag:[Te.string],color:"#a3be8c"},{tag:Te.link,color:"#a3be8c",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[Te.url,Te.escape,Te.special(Te.string)],color:"#8fbcbb"},{tag:[Te.meta],color:"#88c0d0"},{tag:[Te.monospace],color:"#d8dee9",fontStyle:"italic"},{tag:[Te.comment],color:"#4c566a",fontStyle:"italic"},{tag:Te.strong,fontWeight:"bold",color:"#5e81ac"},{tag:Te.emphasis,fontStyle:"italic",color:"#5e81ac"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:Te.heading,fontWeight:"bold",color:"#5e81ac"},{tag:Te.special(Te.heading1),fontWeight:"bold",color:"#5e81ac"},{tag:Te.heading1,fontWeight:"bold",color:"#5e81ac"},{tag:[Te.heading2,Te.heading3,Te.heading4],fontWeight:"bold",color:"#5e81ac"},{tag:[Te.heading5,Te.heading6],color:"#5e81ac"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#d08770"},{tag:[Te.processingInstruction,Te.inserted],color:"#8fbcbb"},{tag:[Te.contentSeparator],color:"#ebcb8b"},{tag:Te.invalid,color:"#434c5e",borderBottom:"1px dotted #d30102"}],JO=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},qO,t),styles:[...KO,...n]})})(),ZO={background:"#272822",foreground:"#FFFFFF",caret:"#FFFFFF",selection:"#49483E",selectionMatch:"#49483E",gutterBackground:"#272822",gutterForeground:"#FFFFFF70",lineHighlight:"#0000003b"},YO=[{tag:[Te.comment,Te.documentMeta],color:"#8292a2"},{tag:[Te.number,Te.bool,Te.null,Te.atom],color:"#ae81ff"},{tag:[Te.attributeValue,Te.className,Te.name],color:"#e6db74"},{tag:[Te.propertyName,Te.attributeName],color:"#a6e22e"},{tag:[Te.variableName],color:"#9effff"},{tag:[Te.squareBracket],color:"#bababa"},{tag:[Te.string,Te.special(Te.brace)],color:"#e6db74"},{tag:[Te.regexp,Te.className,Te.typeName,Te.definition(Te.typeName)],color:"#66d9ef"},{tag:[Te.definition(Te.variableName),Te.definition(Te.propertyName),Te.function(Te.variableName)],color:"#fd971f"},{tag:[Te.keyword,Te.definitionKeyword,Te.modifier,Te.tagName,Te.angleBracket],color:"#f92672"}],GO=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},ZO,t),styles:[...YO,...n]})})(),QO="#F5F5F5",XO="#333333",eM="#C9D0D9",tM="#4B69C6",nM="#7A3E9D",iM="#AA3731",sM="#448C27",rM="#9C5D27",oM="#7A3E9D",aM="#AA3731",lM="#9C5D27",cM="#AAAAAA",hM="#AA3731",uM="#cd3131",dM="#4B69C6",fM="#4B69C6",pM={background:QO,foreground:XO,caret:"#54494B",selection:eM,selectionMatch:eM,gutterBackground:QO,gutterForeground:XO,gutterBorder:"transparent",lineHighlight:"#79ff002b"},mM=[{tag:Te.keyword,color:tM},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:nM},{tag:[Te.propertyName],color:iM},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:sM},{tag:[Te.function(Te.variableName),Te.labelName],color:iM},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:rM},{tag:[Te.definition(Te.name),Te.separator],color:nM},{tag:[Te.className],color:aM},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:lM},{tag:[Te.typeName],color:oM,fontStyle:oM},{tag:[Te.operator,Te.operatorKeyword],color:tM},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:dM},{tag:[Te.meta,Te.comment],color:cM},{tag:Te.tagName,color:fM},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:hM},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:nM},{tag:Te.invalid,color:uM},{tag:Te.strikethrough,textDecoration:"line-through"}],gM=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},pM,t),styles:[...mM,...n]})})(),bM="#390000",yM="#F8F8F8",vM="#750000",kM="#f12727ff",wM="#edef7dff",xM="#ffb454ff",SM="#edef7dff",CM="#ec0d1e",AM="#9df39fff",TM="#fec758ff",NM="#994646ff",OM="#e7c0c0ff",MM="#fec758ff",EM="#ffffffff",DM="#edef7dff",_M="#aa5507ff",IM={background:bM,foreground:yM,caret:"#970000",selection:vM,selectionMatch:vM,gutterBackground:bM,gutterForeground:yM,lineHighlight:"#ff000033"},BM=[{tag:Te.keyword,color:kM},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:wM},{tag:[Te.propertyName],color:xM},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:SM},{tag:[Te.function(Te.variableName),Te.labelName],color:xM},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:CM},{tag:[Te.definition(Te.name),Te.separator],color:wM},{tag:[Te.className],color:TM},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:NM},{tag:[Te.typeName],color:AM,fontStyle:AM},{tag:[Te.operator,Te.operatorKeyword],color:kM},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:DM},{tag:[Te.meta,Te.comment],color:OM},{tag:Te.tagName,color:_M},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:MM},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:wM},{tag:Te.invalid,color:EM},{tag:Te.strikethrough,textDecoration:"line-through"}],PM=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},IM,t),styles:[...BM,...n]})})(),RM="#002B36",$M="#839496",LM="#004454AA",zM="#859900",FM="#268BD2",jM="#268BD2",WM="#2AA198",UM="#CB4B16",VM="#859900",HM="#268BD2",qM="#D33682",KM="#586E75",JM="#268BD2",ZM="#DC322F",YM="#DC322F",GM="#268BD2",QM={background:RM,foreground:$M,caret:"#D30102",selection:LM,selectionMatch:LM,gutterBackground:RM,gutterForeground:$M,gutterBorder:"transparent",lineHighlight:"#00cafe11"},XM=[{tag:Te.keyword,color:zM},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:FM},{tag:[Te.propertyName],color:jM},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:WM},{tag:[Te.function(Te.variableName),Te.labelName],color:jM},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:UM},{tag:[Te.definition(Te.name),Te.separator],color:FM},{tag:[Te.className],color:HM},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:qM},{tag:[Te.typeName],color:VM,fontStyle:VM},{tag:[Te.operator,Te.operatorKeyword],color:zM},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:YM},{tag:[Te.meta,Te.comment],color:KM},{tag:Te.tagName,color:GM},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:JM},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:FM},{tag:Te.invalid,color:ZM},{tag:Te.strikethrough,textDecoration:"line-through"}],eE=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},QM,t),styles:[...XM,...n]})})(),tE="#FDF6E3",nE="#657B83",iE="#859900",sE="#268BD2",rE="#268BD2",oE="#2AA198",aE="#CB4B16",lE="#859900",cE="#268BD2",hE="#D33682",uE="#93A1A1",dE="#268BD2",fE="#DC322F",pE="#DC322F",mE="#268BD2",gE={background:tE,foreground:nE,caret:"#657B83",selection:"#EEE8D5",selectionMatch:"#EEE8D5",gutterBackground:tE,gutterForeground:nE,gutterBorder:"transparent",lineHighlight:"#3d392d11"},bE=[{tag:Te.keyword,color:iE},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:sE},{tag:[Te.propertyName],color:rE},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:oE},{tag:[Te.function(Te.variableName),Te.labelName],color:rE},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:aE},{tag:[Te.definition(Te.name),Te.separator],color:sE},{tag:[Te.className],color:cE},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:hE},{tag:[Te.typeName],color:lE,fontStyle:lE},{tag:[Te.operator,Te.operatorKeyword],color:iE},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:pE},{tag:[Te.meta,Te.comment],color:uE},{tag:Te.tagName,color:mE},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:dE},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:sE},{tag:Te.invalid,color:fE},{tag:Te.strikethrough,textDecoration:"line-through"}],yE=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},gE,t),styles:[...bE,...n]})})(),vE={background:"#303841",foreground:"#FFFFFF",caret:"#FBAC52",selection:"#4C5964",selectionMatch:"#3A546E",gutterBackground:"#303841",gutterForeground:"#FFFFFF70",lineHighlight:"#00000059"},kE=[{tag:[Te.meta,Te.comment],color:"#A2A9B5"},{tag:[Te.attributeName,Te.keyword],color:"#B78FBA"},{tag:Te.function(Te.variableName),color:"#5AB0B0"},{tag:[Te.string,Te.regexp,Te.attributeValue],color:"#99C592"},{tag:Te.operator,color:"#f47954"},{tag:[Te.tagName,Te.modifier],color:"#E35F63"},{tag:[Te.number,Te.definition(Te.tagName),Te.className,Te.definition(Te.variableName)],color:"#fbac52"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#E35F63"},{tag:Te.variableName,color:"#539ac4"},{tag:[Te.propertyName,Te.typeName],color:"#629ccd"},{tag:Te.propertyName,color:"#36b7b5"}];var wE=function(){var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},vE,t),styles:[...kE,...n]})}(),xE={background:"#1a1b26",foreground:"#787c99",caret:"#c0caf5",selection:"#515c7e40",selectionMatch:"#16161e",gutterBackground:"#1a1b26",gutterForeground:"#787c99",gutterBorder:"transparent",lineHighlight:"#474b6611"},SE=[{tag:Te.keyword,color:"#bb9af7"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#c0caf5"},{tag:[Te.propertyName],color:"#7aa2f7"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#9ece6a"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#7aa2f7"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#bb9af7"},{tag:[Te.definition(Te.name),Te.separator],color:"#c0caf5"},{tag:[Te.className],color:"#c0caf5"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#ff9e64"},{tag:[Te.typeName],color:"#0db9d7"},{tag:[Te.operator,Te.operatorKeyword],color:"#bb9af7"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#b4f9f8"},{tag:[Te.meta,Te.comment],color:"#444b6a"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#89ddff"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#c0caf5"},{tag:Te.invalid,color:"#ff5370"},{tag:Te.strikethrough,textDecoration:"line-through"}],CE=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},xE,t),styles:[...SE,...n]})})(),AE={background:"#24283b",foreground:"#7982a9",caret:"#c0caf5",selection:"#6f7bb630",selectionMatch:"#343b5f",gutterBackground:"#24283b",gutterForeground:"#7982a9",gutterBorder:"transparent",lineHighlight:"#292e427a"},TE=[{tag:Te.keyword,color:"#bb9af7"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#c0caf5"},{tag:[Te.propertyName],color:"#7aa2f7"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#9ece6a"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#7aa2f7"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#bb9af7"},{tag:[Te.definition(Te.name),Te.separator],color:"#c0caf5"},{tag:[Te.className],color:"#c0caf5"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#ff9e64"},{tag:[Te.typeName],color:"#2ac3de",fontStyle:"#2ac3de"},{tag:[Te.operator,Te.operatorKeyword],color:"#bb9af7"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#b4f9f8"},{tag:[Te.meta,Te.comment],color:"#565f89"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#89ddff"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#c0caf5"},{tag:Te.invalid,color:"#ff5370"},{tag:Te.strikethrough,textDecoration:"line-through"}],NE=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},AE,t),styles:[...TE,...n]})})(),OE={background:"#e1e2e7",foreground:"#3760bf",caret:"#3760bf",selection:"#99a7df",selectionMatch:"#99a7df",gutterBackground:"#e1e2e7",gutterForeground:"#3760bf",gutterBorder:"transparent",lineHighlight:"#5f5faf11"},ME=[{tag:Te.keyword,color:"#007197"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:"#3760bf"},{tag:[Te.propertyName],color:"#3760bf"},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:"#587539"},{tag:[Te.function(Te.variableName),Te.labelName],color:"#3760bf"},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:"#3760bf"},{tag:[Te.definition(Te.name),Te.separator],color:"#3760bf"},{tag:[Te.className],color:"#3760bf"},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:"#b15c00"},{tag:[Te.typeName],color:"#007197",fontStyle:"#007197"},{tag:[Te.operator,Te.operatorKeyword],color:"#007197"},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:"#587539"},{tag:[Te.meta,Te.comment],color:"#848cb5"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:"#b15c00"},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:"#3760bf"},{tag:Te.invalid,color:"#f52a65"},{tag:Te.strikethrough,textDecoration:"line-through"}],EE=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},OE,t),styles:[...ME,...n]})})(),DE="#002451",_E="#ffffff",IE="#003f8e",BE="#EBBBFF",PE="#FFC58F",RE="#BBDAFF",$E="#D1F1A9",LE="#FFC58F",zE="#FFEEAD",FE="#BBDAFF",jE="#FFC58F",WE="#7285B7",UE="#D1F1A9",VE="#a92049",HE="#D1F1A9",qE="#FF9DA4",KE={background:DE,foreground:_E,caret:"#ffffff",selection:IE,selectionMatch:IE,gutterBackground:DE,gutterForeground:_E,lineHighlight:"#00346e7a"},JE=[{tag:Te.keyword,color:BE},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:PE},{tag:[Te.propertyName],color:RE},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:$E},{tag:[Te.function(Te.variableName),Te.labelName],color:RE},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:LE},{tag:[Te.definition(Te.name),Te.separator],color:PE},{tag:[Te.className],color:FE},{tag:[Te.number,Te.changed,Te.annotation,Te.modifier,Te.self,Te.namespace],color:jE},{tag:[Te.typeName],color:zE,fontStyle:zE},{tag:[Te.operator,Te.operatorKeyword],color:BE},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:HE},{tag:[Te.meta,Te.comment],color:WE},{tag:Te.tagName,color:qE},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:UE},{tag:[Te.atom,Te.bool,Te.special(Te.variableName)],color:PE},{tag:Te.invalid,color:VE},{tag:Te.strikethrough,textDecoration:"line-through"}],ZE=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},KE,t),styles:[...JE,...n]})})(),YE={background:"#ffffff",foreground:"#383a42",caret:"#000",selection:"#add6ff",selectionMatch:"#a8ac94",lineHighlight:"#99999926",gutterBackground:"#fff",gutterForeground:"#237893",gutterActiveForeground:"#0b216f",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace'},GE=[{tag:[Te.keyword,Te.operatorKeyword,Te.modifier,Te.color,Te.constant(Te.name),Te.standard(Te.name),Te.standard(Te.tagName),Te.special(Te.brace),Te.atom,Te.bool,Te.special(Te.variableName)],color:"#0000ff"},{tag:[Te.moduleKeyword,Te.controlKeyword],color:"#af00db"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName,Te.propertyName,Te.variableName,Te.labelName,Te.definition(Te.name)],color:"#0070c1"},{tag:Te.heading,fontWeight:"bold",color:"#0070c1"},{tag:[Te.typeName,Te.className,Te.tagName,Te.number,Te.changed,Te.annotation,Te.self,Te.namespace],color:"#267f99"},{tag:[Te.function(Te.variableName),Te.function(Te.propertyName)],color:"#795e26"},{tag:[Te.number],color:"#098658"},{tag:[Te.operator,Te.punctuation,Te.separator,Te.url,Te.escape,Te.regexp],color:"#383a42"},{tag:[Te.regexp],color:"#af00db"},{tag:[Te.special(Te.string),Te.processingInstruction,Te.string,Te.inserted],color:"#a31515"},{tag:[Te.angleBracket],color:"#383a42"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.meta,Te.comment],color:"#008000"},{tag:Te.link,color:"#4078f2",textDecoration:"underline"},{tag:Te.invalid,color:"#e45649"}];var QE=function(){var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},YE,t),styles:[...GE,...n]})}(),XE={background:"#1e1e1e",foreground:"#9cdcfe",caret:"#c6c6c6",selection:"#6199ff2f",selectionMatch:"#72a1ff59",lineHighlight:"#ffffff0f",gutterBackground:"#1e1e1e",gutterForeground:"#838383",gutterActiveForeground:"#fff",fontFamily:'Menlo, Monaco, Consolas, "Andale Mono", "Ubuntu Mono", "Courier New", monospace'},eD=[{tag:[Te.keyword,Te.operatorKeyword,Te.modifier,Te.color,Te.constant(Te.name),Te.standard(Te.name),Te.standard(Te.tagName),Te.special(Te.brace),Te.atom,Te.bool,Te.special(Te.variableName)],color:"#569cd6"},{tag:[Te.controlKeyword,Te.moduleKeyword],color:"#c586c0"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName,Te.propertyName,Te.variableName,Te.labelName,Te.definition(Te.name)],color:"#9cdcfe"},{tag:Te.heading,fontWeight:"bold",color:"#9cdcfe"},{tag:[Te.typeName,Te.className,Te.tagName,Te.number,Te.changed,Te.annotation,Te.self,Te.namespace],color:"#4ec9b0"},{tag:[Te.function(Te.variableName),Te.function(Te.propertyName)],color:"#dcdcaa"},{tag:[Te.number],color:"#b5cea8"},{tag:[Te.operator,Te.punctuation,Te.separator,Te.url,Te.escape,Te.regexp],color:"#d4d4d4"},{tag:[Te.regexp],color:"#d16969"},{tag:[Te.special(Te.string),Te.processingInstruction,Te.string,Te.inserted],color:"#ce9178"},{tag:[Te.angleBracket],color:"#808080"},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.meta,Te.comment],color:"#6a9955"},{tag:Te.link,color:"#6a9955",textDecoration:"underline"},{tag:Te.invalid,color:"#ff0000"}];var tD=function(){var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},XE,t),styles:[...eD,...n]})}(),nD="#000",iD="#fff",sD=null,rD=null,oD=null,aD="#a8a8b1",lD=null,cD=null,hD=null,uD="#2e2e37",dD=null,fD=null,pD="#a8a8b1",mD=null,gD={background:nD,foreground:iD,caret:"#7d46fc",selection:"#7d46fc3f",selectionMatch:"#7d46fc7f",gutterBackground:nD,gutterForeground:iD,lineHighlight:"#00346eb0"},bD=[{tag:Te.keyword,color:sD,fontWeight:"bold"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:rD},{tag:[Te.propertyName],color:oD},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:aD},{tag:[Te.function(Te.variableName),Te.labelName],color:oD},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:lD},{tag:[Te.definition(Te.name),Te.separator],color:rD},{tag:[Te.className],color:hD},{tag:[Te.typeName],color:cD,fontStyle:cD},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:pD},{tag:[Te.meta,Te.comment],color:uD},{tag:Te.tagName,color:mD},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:dD},{tag:[Te.atom,Te.special(Te.variableName)],color:rD},{tag:Te.invalid,color:fD},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.operatorKeyword,Te.bool,Te.null,Te.variableName],color:lD},{tag:[Te.operator],color:"#bb9af7"},{tag:[Te.number],color:"#a8a8b1"},{tag:[Te.bracket],color:"#bb9af7"}],yD=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},gD,t),styles:[...bD,...n]})})(),vD="#fff",kD="#000",wD=null,xD=null,SD=null,CD="#6b7a88",AD=null,TD=null,ND=null,OD="#bec9d3",MD=null,ED=null,DD="#6b7a88",_D=null,ID={background:vD,foreground:kD,caret:"#004bff",selection:"#0064ff26",selectionMatch:"#0064ff4c",gutterBackground:vD,gutterForeground:kD,lineHighlight:"#0064ff0c"},BD=[{tag:Te.keyword,color:wD,fontWeight:"bold"},{tag:[Te.name,Te.deleted,Te.character,Te.macroName],color:xD},{tag:[Te.propertyName],color:SD},{tag:[Te.processingInstruction,Te.string,Te.inserted,Te.special(Te.string)],color:CD},{tag:[Te.function(Te.variableName),Te.labelName],color:SD},{tag:[Te.color,Te.constant(Te.name),Te.standard(Te.name)],color:AD},{tag:[Te.definition(Te.name),Te.separator],color:xD},{tag:[Te.className],color:ND},{tag:[Te.typeName],color:TD,fontStyle:TD},{tag:[Te.url,Te.escape,Te.regexp,Te.link],color:DD},{tag:[Te.meta,Te.comment],color:OD},{tag:Te.tagName,color:_D},{tag:Te.strong,fontWeight:"bold"},{tag:Te.emphasis,fontStyle:"italic"},{tag:Te.link,textDecoration:"underline"},{tag:Te.heading,fontWeight:"bold",color:MD},{tag:[Te.atom,Te.special(Te.variableName)],color:xD},{tag:Te.invalid,color:ED},{tag:Te.strikethrough,textDecoration:"line-through"},{tag:[Te.operatorKeyword,Te.bool,Te.null,Te.variableName],color:AD},{tag:[Te.operator],color:"#0431fa"},{tag:[Te.number],color:"#a8a8b1"},{tag:[Te.bracket],color:"#0431fa"}],PD=(()=>{var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},ID,t),styles:[...BD,...n]})})(),RD={background:"#fff",foreground:"#3D3D3D",selection:"#BBDFFF",selectionMatch:"#BBDFFF",gutterBackground:"#fff",gutterForeground:"#AFAFAF",lineHighlight:"#d5e6ff69"},$D=[{tag:[Te.comment,Te.quote],color:"#707F8D"},{tag:[Te.typeName,Te.typeOperator],color:"#aa0d91"},{tag:[Te.keyword],color:"#aa0d91",fontWeight:"bold"},{tag:[Te.string,Te.meta],color:"#D23423"},{tag:[Te.name],color:"#032f62"},{tag:[Te.typeName],color:"#522BB2"},{tag:[Te.variableName],color:"#23575C"},{tag:[Te.definition(Te.variableName)],color:"#327A9E"},{tag:[Te.regexp,Te.link],color:"#0e0eff"}];var LD=function(){var{theme:e="light",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},RD,t),styles:[...$D,...n]})}(),zD={background:"#292A30",foreground:"#CECFD0",caret:"#fff",selection:"#727377",selectionMatch:"#727377",lineHighlight:"#ffffff0f"},FD=[{tag:[Te.comment,Te.quote],color:"#7F8C98"},{tag:[Te.keyword],color:"#FF7AB2",fontWeight:"bold"},{tag:[Te.string,Te.meta],color:"#FF8170"},{tag:[Te.typeName],color:"#DABAFF"},{tag:[Te.definition(Te.variableName)],color:"#6BDFFF"},{tag:[Te.name],color:"#6BAA9F"},{tag:[Te.variableName],color:"#ACF2E4"},{tag:[Te.regexp,Te.link],color:"#FF8170"}],jD=(()=>{var{theme:e="dark",settings:t={},styles:n=[]}={};return yA({theme:e,settings:bA({},zD,t),styles:[...FD,...n]})})();function WD(e){switch(e.kind){case"literal":return JSON.parse(e.jsonCode);case"array":return e.values.map(WD);case"object":return Object.fromEntries(Object.values(e.keyValues).map(e=>[e.key,WD(e.value)]))}}function UD(e,t,n){switch(e.kind){case"array":return[];case"optional":return null;case"record":{const i=t[e.value];return"struct"===i.kind?n?{}:Object.fromEntries(i.fields.map(e=>[e.name,UD(e.type,t,"nested")])):"UNKNOWN"}case"primitive":switch(e.value){case"bool":return!1;case"int32":case"float32":case"float64":return 0;case"int64":case"hash64":return"0";case"timestamp":return{unix_millis:0,formatted:"1970-01-01T00:00:00Z"};case"string":case"bytes":return""}}}function VD(e){const t=function(e){const t=[];let n=0,i=0,s=!1;const r=/[ \t\r\n]*/y,o=/([[\]{}:,]|(-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?)|false|true|null|("(((?=\\)\\(["\\/ bfnrt]|u[0-9a-fA-F]{4}))|[^"\\\0-\x1F\x7F]+)*")|$)/y;for(;;){const a=n;r.lastIndex=n,r.exec(e),n=r.lastIndex;for(let t=a;t<n;++t){const n=e[t];"\n"===n?(i=0,s=!1):s||" "!==n&&"\t"!==n||i++}o.lastIndex=n;const l=o.exec(e);if(!l){const t=/\w*/uy;t.lastIndex=n+1,t.exec(e);return{kind:"error",message:"not a token",segment:{start:n,end:t.lastIndex||n+1}}}{const e=l[0],r={segment:{start:n,end:n+e.length},jsonCode:e,indent:i};if(n=o.lastIndex,t.push(r),""!==e&&(s=!0),""===e)return{kind:"tokens",tokens:t}}}}(e);if("error"===t.kind)return{value:void 0,errors:[t],edits:[]};const n=new HD(t.tokens,e),i=n.parseValueOrSkip();return n.expectEnd(),{value:i,errors:n.errors,edits:n.edits}}class HD{constructor(e,t){this.tokens=e,this.input=t,this.tokenIndex=0,this.errors=[],this.edits=[],this.indent=""}parseValueOrSkip(){const e=this.peekToken(),t=e.jsonCode?e.jsonCode[0]:"",{indent:n}=e;switch(t){case"[":return this.parseArray();case"{":return this.parseObject();case"n":return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:"null",type:"null",indent:n};case"f":return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:"false",type:"boolean",indent:n};case"t":return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:"true",type:"boolean",indent:n};case'"':return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:e.jsonCode,type:"string",indent:n};case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":return this.nextToken(),{kind:"literal",firstToken:e.segment,segment:e.segment,jsonCode:e.jsonCode,type:"number",indent:n}}this.errors.push({kind:"error",message:"expected: value",segment:this.peekToken().segment}),this.skip()}parseArray(){const e=this.nextToken(),{indent:t}=e,n=[];for(;;){if("]"===this.peekToken().jsonCode){const i=this.nextToken();return{kind:"array",firstToken:e.segment,segment:{start:e.segment.start,end:i.segment.end},values:n,indent:t}}if("}"===this.peekToken().jsonCode){this.errors.push({kind:"error",message:"expected: ']'",segment:this.peekToken().segment});const i=this.nextToken();return{kind:"array",firstToken:e.segment,segment:{start:e.segment.start,end:i.segment.end},values:n,indent:t}}if(""===this.peekToken().jsonCode)return this.expectSymbolOrSkip("]"),{kind:"array",firstToken:e.segment,segment:{start:e.segment.start,end:this.peekToken().segment.start},values:n,indent:t};const i=this.parseValueOrSkip();if(i&&n.push(i),","===this.peekToken().jsonCode){const e=this.nextToken();"]"===this.peekToken().jsonCode&&this.edits.push({segment:e.segment,replacement:""})}}}parseObject(){const e=this.nextToken(),{indent:t}=e,n={},i=[];for(;;){if("}"===this.peekToken().jsonCode){const s=this.nextToken();return{kind:"object",firstToken:e.segment,segment:{start:e.segment.start,end:s.segment.end},keyValues:n,allKeys:i,indent:t}}if("]"===this.peekToken().jsonCode){this.errors.push({kind:"error",message:"expected: ']'",segment:this.peekToken().segment});const s=this.nextToken();return{kind:"object",firstToken:e.segment,segment:{start:e.segment.start,end:s.segment.end},keyValues:n,allKeys:i,indent:t}}if(""===this.peekToken().jsonCode)return this.expectSymbolOrSkip("}"),{kind:"object",firstToken:e.segment,segment:{start:e.segment.start,end:this.peekToken().segment.start},keyValues:n,allKeys:i,indent:t};const s=this.peekToken();if(!s.jsonCode.startsWith('"')){this.errors.push({kind:"error",message:"expected: string",segment:s.segment}),this.skip(),","===this.peekToken().jsonCode&&this.nextToken();continue}const r=JSON.parse(s.jsonCode);if(i.push({key:r,keySegment:s.segment}),this.nextToken(),!this.expectSymbolOrSkip(":"))continue;n[r]&&this.errors.push({kind:"error",message:"duplicate key",segment:s.segment});const o=this.parseValueOrSkip();if(o&&(n[r]={keySegment:s.segment,key:r,value:o}),","===this.peekToken().jsonCode){const e=this.nextToken();"}"===this.peekToken().jsonCode&&this.edits.push({segment:e.segment,replacement:""})}}}expectEnd(){this.nextToken().jsonCode&&this.errors.push({kind:"error",message:"expected: end",segment:this.peekToken().segment})}nextToken(){const e=this.tokens[this.tokenIndex];{const t=this.tokenIndex<=0?void 0:this.tokens[this.tokenIndex-1],n={start:t?t.segment.end:0,end:e.segment.start},i=this.input.substring(n.start,n.end),s=this.inferWhitespaceSeparator(t?.jsonCode??"",e.jsonCode);i!==s.text&&this.edits.push({segment:n,replacement:s.text}),this.indent=s.newIndent??this.indent}return++this.tokenIndex,e}inferWhitespaceSeparator(e,t){const{indent:n}=this;if(":"===e)return{text:" "};if(","===e&&"]"!==t&&"}"!==t)return{text:`\n${n}`};if(/[0-9"}\]el]$/.test(e)&&/^[0-9"{[tfn-]/.test(t))return{text:`,\n${n}`};if("["===e&&"]"!==t||"{"===e&&"}"!==t){const e=n+qD;return{text:`\n${e}`,newIndent:e}}if("["!==e&&"]"===t||"{"!==e&&"}"===t){const e=n.replace(qD,"");return{text:`\n${e}`,newIndent:e}}return{text:""}}peekToken(){return this.tokens[this.tokenIndex]}expectSymbolOrSkip(e){return this.peekToken().jsonCode!==e?(this.errors.push({kind:"error",message:`expected: '${e}'`,segment:this.peekToken().segment}),this.skip(),!1):(this.nextToken(),!0)}skip(){for(;;){const e=this.peekToken().jsonCode;if(""===e||","===e||"]"===e||"}"===e||e.startsWith('"'))return;"["===e?this.parseArray():"{"===e?this.parseObject():this.nextToken()}}}const qD=" ";function KD(e,t){const n={};for(const e of t.records)n[e.id]=e;const i=new JD(n);i.validate(e,{kind:"root"},t.type);const s=new Map;for(const e of i.hints){const{valueContext:t}=e;t&&s.set(t.path,e)}return{errors:i.errors,hints:i.hints,rootTypeHint:i.rootTypeHint,pathToTypeHint:s}}class JD{constructor(e){this.idToRecordDef=e,this.errors=[],this.hints=[],this.typeHintStack=[]}validate(e,t,n,i){const{idToRecordDef:s,typeHintStack:r}=this;e.expectedType=n;const o=o=>{const a=function(e){function t(e){switch(e.kind){case"primitive":return e.value;case"array":return`[${t(e.value.item)}]`;case"optional":return`${t(e.value)}?`;case"record":return e.value.split(":")[1]}}function n(e){switch(e.kind){case"primitive":return null;case"array":return n(e.value.item);case"optional":return n(e.value);case"record":return e.value.split(":")[0]}}const i=t(e),s=n(e);return s?`${i} (${s})`:i}(i??n),l=GD(n,s),c=[a];if(l&&c.push(l),"array"===e.kind){const{length:t}=e.values;t&&c.push(`Length: ${t}`)}const h={segment:e.firstToken,message:1===c.length?c[0]:c,valueContext:{value:e,path:t},childHints:[],enumDefinition:o?.enumDefinition};if(r.length){r[r.length-1].childHints.push(h)}else this.rootTypeHint=h;this.hints.push(h),r.push(h)};switch(n.kind){case"array":if("array"===e.kind){o();for(const[i,s]of e.values.entries()){const{key_extractor:e,item:r}=n.value,o={kind:"array-item",index:i,key:ZD(s,e),arrayPath:t};this.validate(s,o,r)}r.pop()}else this.errors.push({kind:"error",segment:e.segment,message:"Expected: array"});break;case"optional":"literal"===e.kind&&"null"===e.jsonCode?(o(),r.pop()):this.validate(e,t,n.value,n);break;case"primitive":{const t=n.value;"timestamp"===t?this.validateTimestamp(e)&&(o(),r.pop()):!function(e,t){switch(t){case"bool":return"literal"===e.kind&&"boolean"===e.type;case"int32":return YD(e,-2147483648n,2147483647n);case"int64":return YD(e,-9223372036854775808n,9223372036854775807n);case"hash64":return YD(e,0n,18446744073709551615n);case"float32":case"float64":return function(e){if("literal"!==e.kind)return!1;return"number"===e.type||"string"===e.type&&('"NaN"'===e.jsonCode||'"Infinity"'===e.jsonCode||'"-Infinity"'===e.jsonCode)}(e);case"string":return"literal"===e.kind&&"string"===e.type;case"bytes":if("literal"!==e.kind)return!1;try{return DC("bytes").fromJsonCode(e.jsonCode),!0}catch{return!1}case"timestamp":throw new Error}}(e,t)?this.errors.push({kind:"error",segment:e.firstToken,message:`Expected: ${t}`}):(o(),r.pop());break}case"record":{const i=s[n.value];if("struct"===i.kind){const n={};if(i.fields.forEach(e=>{n[e.name]=e}),"object"===e.kind){o();for(const i of Object.values(e.keyValues)){const{key:e,value:s}=i,r=n[e];if(r){r.doc&&this.hints.push({segment:i.keySegment,message:r.doc});const n={kind:"field-value",fieldName:e,structPath:t};this.validate(s,n,r.type)}else this.errors.push({kind:"error",segment:i.keySegment,message:"Unknown field"})}r.pop()}else this.errors.push({kind:"error",segment:e.firstToken,message:"Expected: object"})}else{const n={};if(i.variants.forEach(e=>{n[e.name.toLowerCase()]=e,n[e.name.toUpperCase()]=e}),"object"===e.kind)o(),this.validateEnumObject(e,t,n),r.pop();else if("literal"===e.kind&&"string"===e.type){const t=JSON.parse(e.jsonCode),s=n[t];s&&s.type?this.errors.push({kind:"error",segment:e.segment,message:"Expected: constant variant"}):"unknown"===t||"UNKNOWN"===t||s?(o({enumDefinition:i}),r.pop()):this.errors.push({kind:"error",segment:e.segment,message:"Unknown variant"})}else this.errors.push({kind:"error",segment:e.firstToken,message:"Expected: object or string"})}break}default:throw new Error(n)}}validateEnumObject(e,t,n){const i=e.keyValues.kind;if(!i)return void this.errors.push({kind:"error",segment:e.segment,message:"Missing: 'kind'"});if("literal"!==i.value.kind||"string"!==i.value.type)return void this.errors.push({kind:"error",segment:i.value.firstToken,message:"Expected: string"});const s=n[JSON.parse(i.value.jsonCode)];if(!s)return void this.errors.push({kind:"error",segment:i.value.segment,message:"Unknown variant"});void 0===s.type&&this.errors.push({kind:"error",segment:i.value.segment,message:"Expected: wrapper variant"});const r=e.keyValues.value;if(!r)return void this.errors.push({kind:"error",segment:e.segment,message:"Missing: 'value'"});for(const t of e.allKeys)"kind"!==t.key&&"value"!==t.key&&this.errors.push({kind:"error",segment:t.keySegment,message:"Unexpected entry"});const o={kind:"variant-value",variantName:s.name,enumPath:t};this.validate(r.value,o,s.type)}validateTimestamp(e){if("object"!==e.kind)return this.errors.push({kind:"error",segment:e.firstToken,message:"Expected: timestamp"}),!1;const t=e.keyValues.unix_millis;if(!t)return this.errors.push({kind:"error",segment:e.firstToken,message:"Missing: 'unix_millis'"}),!0;if("literal"!==t.value.kind||"number"!==t.value.type)return this.errors.push({kind:"error",segment:t.value.firstToken,message:"Expected: number"}),!0;const n=WD(t.value);if(n<-864e13||864e13<n)return this.errors.push({kind:"error",segment:t.value.firstToken,message:"Timestamp out of range"}),!0;const i=e.keyValues.formatted;if(!i)return!0;if("literal"!==i.value.kind||"string"!==i.value.type)return this.errors.push({kind:"error",segment:i.value.firstToken,message:"Expected: string"}),!0;const s=WD(i.value);if("n/a"===s)return!0;const r=Date.parse(s);if(Number.isNaN(r))return this.errors.push({kind:"error",segment:i.value.firstToken,message:"Invalid ISO 8601 date string"}),!0;r!==n&&this.errors.push({kind:"error",segment:i.value.firstToken,message:"Does not match 'unix_millis'"});for(const t of e.allKeys)"unix_millis"!==t.key&&"formatted"!==t.key&&this.errors.push({kind:"error",segment:t.keySegment,message:"Unexpected entry"});return!0}}function ZD(e,t){if(void 0===t)return null;const n=t.split(".");let i=e;for(const e of n){if("object"!==i.kind)return null;const t=i.keyValues[e];if(!t)return null;i=t.value}switch(i.kind){case"literal":switch(i.type){case"string":case"number":case"boolean":return i.jsonCode}return null;case"object":{const e=i.keyValues.unix_millis;return e&&"literal"===e.value.kind&&"number"===e.value.type?e.value.jsonCode:null}case"array":return null}}function YD(e,t,n){if("literal"!==e.kind)return!1;let i,s;if("string"===e.type)i=JSON.parse(e.jsonCode);else{if("number"!==e.type)return!1;i=e.jsonCode}try{s=BigInt(i)}catch{return!1}return t<=s&&s<=n}function GD(e,t){switch(e.kind){case"primitive":return;case"array":return GD(e.value.item,t);case"optional":return GD(e.value,t);case"record":return t[e.value].doc}}const QD=Vt.define(),XD=wt.define({create:()=>null,update(e,t){for(const e of t.effects)if(e.is(QD))return e.value;return e}});function e_(e){return[XD,bs.fromClass(class{constructor(e){this.timeout=null,this.view=e,this.scheduleUpdate()}update(e){if(e.docChanged){const t=e.transactions.some(e=>"undo"===e.annotation(Ht.userEvent)||"redo"===e.annotation(Ht.userEvent));this.scheduleUpdate(t?"from-undo":void 0)}}scheduleUpdate(e){null!==this.timeout&&clearTimeout(this.timeout),this.timeout=window.setTimeout(()=>{this.parseJson(e),this.timeout=null},200)}parseJson(t){const n=this.view.state.doc.toString(),i=VD(n);let s;i.value&&(s=KD(i.value,e));if(!t&&i.edits.length&&i.errors.length<=0&&!(()=>{const e=this.view.state.selection.main.head;return i.edits.some(t=>t.segment.start<=e&&e<=t.segment.end)})()){const t=i.edits.map(e=>({from:e.segment.start,to:e.segment.end,insert:e.replacement})),r=this.view.state.field(XD,!1),o=t_(e,r);this.view.dispatch({changes:t,effects:QD.of({parseResult:i,validationResult:s,source:n,schema:e,recordIdToDefinition:o}),scrollIntoView:!0})}else{const t=this.view.state.field(XD,!1),r=t_(e,t);this.view.dispatch({effects:QD.of({parseResult:i,validationResult:s,source:n,schema:e,recordIdToDefinition:r})})}}destroy(){null!==this.timeout&&clearTimeout(this.timeout)}})]}function t_(e,t){if(e===t?.schema)return t.recordIdToDefinition;const n={};for(const t of e.records)n[t.id]=t;return n}function n_(e){const t={};for(const n of e.records)t[n.id]=n;function n(e,i){if(!i_(i,e.segment))return null;const{expectedType:s}=e;if(!s)return null;switch("optional"===s.kind&&s.value,e.kind){case"array":if("array"!==s.kind)return null;for(const t of e.values){if(i<t.firstToken.start)return null;const e=n(t,i);if(e)return e}return null;case"object":{if("record"!==s.kind)return null;const r=t[s.value];if("struct"===r.kind)for(const t of e.allKeys){const{keySegment:s}=t;if(i_(i,s)){const t=s_(e,r);return{from:s.start+1,to:s.end-1,options:t.map(e=>({label:e}))}}const o=e.keyValues[t.key];if(o){const e=n(o.value,i);if(e)return e}}else{const t=e.keyValues.kind;if(t&&i_(i,t.value.firstToken)&&"literal"===t.value.kind&&"string"===t.value.type){const e=r.variants.filter(e=>e.type).map(e=>({label:e.name}));return{from:t.value.firstToken.start+1,to:t.value.firstToken.end-1,options:e}}const s=e.keyValues.value;if(s){const e=n(s?.value,i);if(e)return e}}return null}case"literal":{if("record"!==s.kind)return null;const n=t[s.value];if("enum"!==n.kind)return null;const i=n.variants.filter(e=>!e.type).map(e=>({label:e.name})).concat({label:"UNKNOWN"});return{from:e.firstToken.start+1,to:e.firstToken.end-1,options:i}}}}return function(t){const i=t.pos;if(!t.view)return null;const s=i>0?t.state.doc.sliceString(i-1,i):"",r=t.explicit||'"'===s?function(e,t){const n=e.state.field(XD,!1),i=e.state.doc.toString();if(n&&n.source===i)return n;const s=VD(i);let r;s.value&&(r=KD(s.value,t));const o={parseResult:s,validationResult:r,source:i,schema:t,recordIdToDefinition:t_(t,n)};return n&&n===o||e.dispatch({effects:QD.of(o)}),o}(t.view,e):t.state.field(XD,!1);if(!r)return null;const o=r.parseResult;return o.value?n(o.value,i):null}}function i_(e,t){return e>=t.start&&e<t.end}function s_(e,t){const n=[];for(const i of t.fields)e.keyValues[i.name]||n.push(i.name);return n}function r_(e){return function(t){const n=t.state.field(XD,!1);if(!n)return[];const i=n.parseResult;if(i.errors.length)return i.errors.map(o_);if(!n.validationResult)return[];const{errors:s,hints:r}=n.validationResult;return s.map(o_).concat(r.map(t=>function(e,t){const{message:n}=e;return{from:e.segment.start,to:e.segment.end,message:"",severity:"info",renderMessage:i=>{const s=document.createElement("div");let r;if(s.className="cm-diagnostic-wrapper","string"!==n&&"string?"!==n||!e.valueContext||"literal"!==e.valueContext.value.kind||"string"!==e.valueContext.value.type)if("timestamp"!==n&&"timestamp?"!==n||!e.valueContext||"object"!==e.valueContext.value.kind||"editable"!==t){r=("string"==typeof n?[n]:n).map(e=>{const t=document.createElement("div");return t.textContent=e,t}),e.valueContext&&e.enumDefinition}else;else r=function(e,t,n,i){const s=document.createElement("div");s.textContent=t.message;const r=n.jsonCode,o=JSON.parse(r),a=document.createElement("div");a.className="cm-diagnostic-controls";const l=document.createElement("span");l.textContent="Value:";const c=document.createElement("textarea");c.className="cm-diagnostic-textarea",c.value=o,c.rows=1;const h="read-only"===i;return c.readOnly=h,c.addEventListener("keydown",e=>{"Enter"===e.key&&e.shiftKey}),a.appendChild(l),a.appendChild(c),[s,a]}(0,e,e.valueContext.value,t);for(const e of r)e.classList.add("diagnostic-row"),s.appendChild(e);return s},markClass:""}}(t,e)))}}function o_(e){return{from:e.segment.start,to:e.segment.end,message:e.message,severity:"error",renderMessage:()=>{const t=document.createElement("div");return t.className="cm-diagnostic-wrapper",t.textContent=e.message,t}}}function a_(e){const t=document.createElement("div");function n(){const n=e.state.selection.main.head,i=e.state.field(XD,!1),s=i?.validationResult,r=s?.rootTypeHint,o=[];if(r){const t=l_(n,r);if(t){const{pathToTypeHint:n}=s,i=new c_(n,e);i.appendNodesForPath(t.valueContext.path),o.push(...i.nodes),o.reverse()}}t.replaceChildren(...o)}return t.className="cm-status-bar",n(),{dom:t,update(e){e.selectionSet&&n()},top:!1}}function l_(e,t){const n=t.valueContext.value.segment;if(e<n.start||e>n.end)return;let i,s=0,r=t.childHints.length-1;for(;s<=r;){const n=Math.floor((s+r)/2),o=t.childHints[n],a=o.valueContext.value.segment;if(e<a.start)r=n-1;else{if(!(e>a.end)){i=o;break}s=n+1}}if(i){const t=l_(e,i);return void 0!==t?t:i}return t}class c_{constructor(e,t){this.pathToTypeHint=e,this.view=t,this.nodes=[]}appendNodesForPath(e){const t=this.pathToTypeHint.get(e).valueContext.value.segment.start,n=document.createElement("a");switch(n.className="cm-status-bar-link",n.addEventListener("click",e=>{e.preventDefault(),this.view.dispatch({selection:{anchor:t,head:t},scrollIntoView:!0}),this.view.focus()}),e.kind){case"root":n.append("root"),this.nodes.push(n);break;case"array-item":this.appendNodesForPath(e.arrayPath),null!=e.key?n.append(`[${e.index}|${e.key}]`):n.append(`[${e.index}]`),this.nodes.push(n);break;case"field-value":this.appendNodesForPath(e.structPath),n.append(`.${e.fieldName}`),this.nodes.push(n);break;case"variant-value":this.appendNodesForPath(e.enumPath),n.append(`.value("${e.variantName}")`),this.nodes.push(n)}}}const h_={backgroundColor:"#fffdf7",lighterBgColor:"#f3eee1",borderColor:"#d4d0c4",foregroundColor:"#111111",accentColor:"#111111",errorColor:"#232323",selectionColor:"#d9d4c7"},u_={backgroundColor:"#1a1b26",lighterBgColor:"#1f2335",borderColor:"#414868",foregroundColor:"#c0caf5",accentColor:"#7aa2f7",errorColor:"#f7768e",selectionColor:"#515c7e40"},d_={backgroundColor:"#d5d6db",lighterBgColor:"#e1e2e7",borderColor:"#adb0bb",foregroundColor:"#3760bf",accentColor:"#2e7de9",errorColor:"#f52a65",selectionColor:"#3760bf33"},f_={abcdef:wA,abyss:UA,androidstudio:qA,andromeda:pT,atomone:bT,aura:kT,"basic-dark":ST,"basic-light":TT,bbedit:MT,bespin:_T,"console-dark":BT,"console-light":RT,copilot:sN,darcula:aN,dracula:hN,"duotone-dark":gN,"duotone-light":fN,eclipse:vN,"github-dark":AN,"github-light":xN,"gruvbox-dark":ON,"gruvbox-light":EN,kimbie:ZN,material:tO,"material-dark":eO,"material-light":sO,monokai:SO,"monokai-dimmed":WO,"noctis-lilac":HO,nord:JO,okaidia:GO,quietlight:gM,red:PM,"solarized-dark":eE,"solarized-light":yE,sublime:wE,"tokyo-night":CE,"tokyo-night-day":EE,"tokyo-night-storm":NE,"tomorrow-night-blue":ZE,"vscode-dark":tD,"vscode-light":QE,white:PD,"white-dark":yD,"white-light":PD,"xcode-dark":jD,"xcode-light":LD},p_={abcdef:vA,abyss:jA,androidstudio:VA,andromeda:dT,atomone:mT,aura:yT,"basic-dark":wT,"basic-light":CT,bbedit:NT,bespin:ET,"console-dark":IT,"console-light":PT,copilot:nN,darcula:rN,dracula:lN,"duotone-dark":pN,"duotone-light":uN,eclipse:bN,"github-dark":SN,"github-light":kN,"gruvbox-dark":TN,"gruvbox-light":MN,kimbie:KN,material:YN,"material-dark":GN,"material-light":nO,monokai:wO,"monokai-dimmed":FO,"noctis-lilac":UO,nord:qO,okaidia:ZO,quietlight:pM,red:IM,"solarized-dark":QM,"solarized-light":gE,sublime:vE,"tokyo-night":xE,"tokyo-night-day":OE,"tokyo-night-storm":AE,"tomorrow-night-blue":KE,"vscode-dark":XE,"vscode-light":YE,white:ID,"white-dark":gD,"white-light":ID,"xcode-dark":zD,"xcode-light":RD};function m_(...e){for(const t of e)if(t&&"transparent"!==t)return t}function g_(e){const t=f_[e];return"white"===e?{...h_,themeExtension:t}:"tokyo-night"===e?{...u_,themeExtension:t}:"tokyo-night-day"===e?{...d_,themeExtension:t}:function(e,t){const n=m_(e.background,e.gutterBackground),i=m_(e.caret,e.foreground,e.gutterForeground),s=m_(e.selection,e.selectionMatch,e.lineHighlight);return{backgroundColor:n??"#1a1b26",lighterBgColor:m_(e.gutterBackground,e.lineHighlight,n)??"#1f2335",borderColor:m_(e.gutterBorder,e.selectionMatch,e.selection,e.foreground)??"#414868",foregroundColor:i??"#c0caf5",accentColor:m_(e.foreground,e.caret)??"#7aa2f7",errorColor:m_(e.caret,e.foreground)??"#f7768e",selectionColor:s??"#515c7e40",themeExtension:t}}(p_[e],t)}function b_({schema:e,readOnly:t,json:n,theme:i,otherExtension:s}){const r={};for(const t of e.records)r[t.id]=t;const o=n??UD(e.type,r);return void 0===i?i=g_("tokyo-night"):"string"==typeof i&&(i=g_(i)),nn.create({doc:JSON.stringify(o,null,2),extensions:[nn.readOnly.of(!0),[],Rp,nn.languageData.of(()=>[{closeBrackets:{before:",]}"}}]),Pf(),i.themeExtension??[],mh(),e_(e),mp(r_("read-only")),Zf({override:[n_(e)]}),Pp(),ll.of(a_),Uo.theme({"&":{fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:"'JetBrains Mono', monospace",overflow:"auto"},".cm-lintRange-info":{backgroundImage:"none"},".cm-lintRange-info:hover":{backgroundColor:i.selectionColor},".cm-lintRange-error":{backgroundImage:"none",borderBottom:`3px solid ${i.errorColor}`},".cm-tooltip-hover":{backgroundColor:i.lighterBgColor,border:`1px solid ${i.borderColor}`,borderRadius:"4px",padding:"8px 12px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.5)",fontSize:"14px",lineHeight:"1.4",color:i.foregroundColor},".cm-tooltip.cm-tooltip-lint":{backgroundColor:i.lighterBgColor,border:`1px solid ${i.borderColor}`,borderRadius:"4px",padding:"8px 12px",boxShadow:"0 4px 12px rgba(0, 0, 0, 0.5)",fontSize:"14px",color:i.foregroundColor},".cm-tooltip-lint .cm-diagnostic-error":{fontWeight:"bold",color:i.errorColor},".cm-status-bar":{backgroundColor:i.lighterBgColor,borderTopColor:i.borderColor,color:i.accentColor},".cm-diagnostic-textarea":{backgroundColor:i.lighterBgColor,borderColor:i.borderColor,color:i.foregroundColor},".cm-diagnostic-textarea[readonly]":{backgroundColor:i.backgroundColor},".cm-diagnostic-input":{backgroundColor:i.lighterBgColor,borderColor:i.borderColor,color:i.foregroundColor},".cm-diagnostic-button":{backgroundColor:i.lighterBgColor,borderColor:i.borderColor,color:i.foregroundColor},".cm-diagnostic-button:hover":{backgroundColor:i.borderColor},".cm-diagnostic-error-message":{color:i.errorColor},".diagnostic-row + .diagnostic-row":{borderTopColor:i.borderColor}}),Uo.baseTheme({".cm-lint-marker-info":{display:"none"},".cm-status-bar":{display:"flex",flexDirection:"row-reverse",justifyContent:"flex-end",padding:"4px 12px",borderTop:"1px solid",fontSize:"12px",height:"16px"},".cm-status-bar-link":{textDecoration:"none",cursor:"pointer"},".cm-status-bar-link:hover":{textDecoration:"underline"},".cm-status-bar-link:hover ~ .cm-status-bar-link":{textDecoration:"underline"},".cm-diagnostic-wrapper":{fontSize:"12px",lineHeight:"1.3",padding:"2px"},".cm-diagnostic-controls":{marginTop:"4px",display:"flex",gap:"6px",alignItems:"center"},".cm-diagnostic-label":{whiteSpace:"nowrap",fontWeight:"500",minWidth:"64px"},".cm-diagnostic-textarea":{flex:"1",padding:"3px 6px",border:"1px solid",borderRadius:"3px",fontSize:"12px",fontFamily:"'JetBrains Mono', monospace",resize:"none",overflow:"auto",boxSizing:"border-box"},".cm-diagnostic-textarea[readonly]":{cursor:"default"},".cm-diagnostic-input":{padding:"3px 6px",border:"1px solid",borderRadius:"3px",fontSize:"12px",fontFamily:"'JetBrains Mono', monospace",boxSizing:"border-box",width:"100%"},".cm-diagnostic-button":{padding:"3px 12px",border:"1px solid",borderRadius:"3px",fontSize:"12px",fontFamily:"'JetBrains Mono', monospace",cursor:"pointer",boxSizing:"border-box"},".cm-diagnostic-button:active":{transform:"translateY(1px)"},".cm-diagnostic-error-message":{fontSize:"11px",marginTop:"2px",fontWeight:"500"},".cm-timestamp-field":{display:"flex",flexDirection:"column",gap:"2px",flex:"1"},".cm-tooltip-lint .cm-diagnostic":{padding:"0",borderTop:"none",borderLeft:"none"},".cm-tooltip-lint .cm-diagnostic-error":{borderLeft:"none",fontWeight:"bold"},".cm-tooltip-lint .cm-diagnostic-info":{borderLeft:"none"},".diagnostic-row + .diagnostic-row":{marginTop:"8px",paddingTop:"8px",borderTop:"1px solid"}}),s??[]]})}const y_=[PD,Uo.theme({"&":{height:"100%",fontSize:"14px"},".cm-scroller":{fontFamily:"'IBM Plex Mono', monospace"},".cm-gutters":{borderRight:"1px solid #d4d0c4",backgroundColor:"#f7f3e8",color:"#746f63"},".cm-activeLine, .cm-activeLineGutter":{backgroundColor:"#f3eee1"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"#d9d4c7"},".cm-tooltip":{border:"1px solid #232323",backgroundColor:"#fffdf7",color:"#111111"},".cm-tooltip-autocomplete ul li[aria-selected]":{backgroundColor:"#111111",color:"#fffdf7"},".cm-panels":{backgroundColor:"#f3eee1",color:"#111111"},".cm-searchMatch":{backgroundColor:"#ece7da",outline:"1px solid #232323"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#d9d4c7"},".cm-matchingBracket":{backgroundColor:"#ece7da",outline:"1px solid #232323",color:"#111111"},".cm-nonmatchingBracket":{backgroundColor:"#111111",color:"#fffdf7"},".cm-foldPlaceholder":{border:"1px solid #d4d0c4",backgroundColor:"#f3eee1",color:"#545454"},".cm-lintRange-error":{backgroundImage:"none",borderBottom:"2px solid #232323"},".cm-status-bar":{borderTop:"1px solid #d4d0c4",backgroundColor:"#f3eee1",color:"#545454"}})],v_={backgroundColor:"#fffdf7",lighterBgColor:"#f3eee1",borderColor:"#d4d0c4",foregroundColor:"#111111",accentColor:"#111111",errorColor:"#232323",selectionColor:"#d9d4c7",themeExtension:y_};function k_(e){if(""===e)return{text:e,parsed:{kind:"not-set"}};let t,n;t=/^736[Bb]6972/.test(e)?"base16":e.startsWith("c2tpc")?"base64":"json";try{if("json"===t){n={kind:"json",value:JSON.parse(e)}}else if("base16"===t){n={kind:"bytes",value:new Uint8Array(e.match(/.{1,2}/g)?.map(e=>parseInt(e,16))??[]).buffer}}else if("base64"===t){const t=atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;e++)i[e]=t.charCodeAt(e);n={kind:"bytes",value:i.buffer}}else n={kind:"not-set"}}catch(e){n={kind:"parse-error",error:String(e)}}return{text:e,parsed:n}}function w_(e){if(""===e)return{text:e,typeDescriptor:{kind:"not-set"}};try{const t=function(e){var t,n,i;const s=e,r={};for(const e of s.records){let t;switch(e.kind){case"struct":t=new nA({},e=>Object.freeze(Object.assign({},e)),()=>({}));break;case"enum":t=new rA(e=>{if(e instanceof iA)return Object.freeze({kind:"UNKNOWN"});if("string"==typeof e)return Object.freeze({kind:e});{const t={kind:e.kind,value:e.value};return Object.freeze(t)}})}const n={definition:e,serializer:t};r[e.id]=n}function o(e){switch(e.kind){case"array":{const{item:t,key_extractor:n}=e.value;return new YC(o(t),n)}case"optional":return new GC(o(e.value));case"primitive":return DC(e.value);case"record":{const t=e.value;return r[t].serializer}}}const a=[];for(const e of Object.values(r)){const{definition:s,serializer:l}=e,{defaultValue:c}=l,{id:h,removed_numbers:u}=s,d=h.split(":"),f=d[0],p=d[1].split("."),m=p[p.length-1],g=f+":"+p.slice(0,-1).join("."),b=null===(t=r[g])||void 0===t?void 0:t.serializer,y=null!==(n=s.doc)&&void 0!==n?n:"";switch(s.kind){case"struct":{const e=[];for(const t of s.fields){const n=o(t.type);e.push(new KC(t.name,t.name,t.number,n,null!==(i=t.doc)&&void 0!==i?i:"")),c[t.name]=n.defaultValue}const t=l;a.push(()=>t.init(m,f,b,y,e,null!=u?u:[]));break}case"enum":{const e=l,t=[zC].concat(s.variants).map(e=>{var t,n;return e.type?new sA(e.name,e.number,o(e.type),null!==(t=e.doc)&&void 0!==t?t:"",l.createFn):{name:e.name,number:e.number,constant:Object.freeze({kind:e.name}),doc:null!==(n=e.doc)&&void 0!==n?n:""}});a.push(()=>e.init(m,f,b,y,t,null!=u?u:[]));break}}}return a.forEach(e=>e()),o(s.type).typeDescriptor}(JSON.parse(e));return{text:e,typeDescriptor:{kind:"ok",value:t}}}catch(t){return{text:e,typeDescriptor:{kind:"error",error:String(t)}}}}function x_(e,t){const{typeDescriptor:n}=t;if("not-set"===n.kind)return{kind:"schema-not-set"};if("error"===n.kind)return{kind:"schema-error",error:n.error};if("not-set"===e.parsed.kind)return{kind:"value-not-set"};if("parse-error"===e.parsed.kind)return{kind:"value-parse-error",error:e.parsed.error};let i,s,r;try{i=n.value.transform(e.parsed.value,"dense"),s=n.value.transform(e.parsed.value,"readable"),r="json"===e.parsed.kind?n.value.transform(e.parsed.value,"bytes"):e.parsed.value}catch(e){return{kind:"schema-value-match-error",error:String(e)}}return{kind:"ok",readableJsonEditorState:b_({json:s,schema:n.value.asJson(),readOnly:!0,theme:v_}),denseJsonEditorState:nn.create({doc:JSON.stringify(i),extensions:[$p,y_,mh()]}),base16EditorState:nn.create({doc:Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join(""),extensions:[$p,y_]}),base64EditorState:nn.create({doc:btoa(String.fromCharCode(...new Uint8Array(r))),extensions:[$p,y_]})}}var S_=function(e,t,n,i){var s,r=arguments.length,o=r<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,i);else for(var a=e.length-1;a>=0;a--)(s=e[a])&&(o=(r<3?s(o):r>3?s(t,n,o):s(t,n))||o);return r>3&&o&&Object.defineProperty(t,n,o),o};let C_=class extends Vm{constructor(){super(...arguments),this.initialState=nn.create({}),this.fillHeight=!1,this.editor={kind:"state",value:null}}render(){return Tm`<div id="container"></div>`}firstUpdated(){const e=this.renderRoot.querySelector("#container");this.editor={kind:"view",value:new Uo({state:this.state,dispatchTransactions:(e,t)=>{t.update(e),e.some(e=>e.docChanged)&&this.dispatchEvent(new CustomEvent("text-modified"))},parent:e})}}get state(){return"state"===this.editor.kind?this.editor.value??this.initialState:this.editor.value.state}set state(e){"state"===this.editor.kind?this.editor={kind:"state",value:e}:this.editor.value.setState(e)}get view(){if("view"===this.editor.kind)return this.editor.value;throw new Error("Editor view not yet initialized")}};C_.styles=Up`
45
45
  :host {
46
46
  display: block;
47
47
  min-height: 0;