webstudio 0.299.0 → 0.301.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,194 +1,197 @@
1
- var gd=Object.defineProperty;var bd=(t,e)=>{for(var n in e)gd(t,n,{get:e[n],enumerable:!0})};var Ys;function b(t,e,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(t))return;a._zod.traits.add(t),e(a,c);let u=i.prototype,d=Object.keys(u);for(let l=0;l<d.length;l++){let f=d[l];f in a||(a[f]=u[f].bind(a))}}let o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:t});function i(a){var c;let u=n?.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let d of u._zod.deferred)d();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(t)}),Object.defineProperty(i,"name",{value:t}),i}var yy=Symbol("zod_brand"),Oe=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},vt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name="ZodEncodeError"}};(Ys=globalThis).__zod_globalConfig??(Ys.__zod_globalConfig={});var Dt=globalThis.__zod_globalConfig;function _e(t){return t&&Object.assign(Dt,t),Dt}var F={};bd(F,{BIGINT_FORMAT_RANGES:()=>ni,Class:()=>mo,NUMBER_FORMAT_RANGES:()=>_o,aborted:()=>He,allowsEval:()=>go,assert:()=>Sd,assertEqual:()=>wd,assertIs:()=>xd,assertNever:()=>Ed,assertNotEqual:()=>_d,assignProp:()=>Ye,base64ToUint8Array:()=>oi,base64urlToUint8Array:()=>jd,cached:()=>kt,captureStackTrace:()=>qn,cleanEnum:()=>Bd,cleanRegex:()=>fn,clone:()=>xe,cloneDef:()=>Dd,createTransparentProxy:()=>Td,defineLazy:()=>M,esc:()=>Gn,escapeRegex:()=>Ue,explicitlyAborted:()=>xo,extend:()=>zd,finalizeIssue:()=>me,floatSafeRemainder:()=>ho,getElementAtPath:()=>Rd,getEnumValues:()=>un,getLengthableOrigin:()=>dn,getParsedType:()=>Cd,getSizableOrigin:()=>ri,hexToUint8Array:()=>Qd,isObject:()=>gt,isPlainObject:()=>Xe,issue:()=>It,joinValues:()=>Ad,jsonStringifyReplacer:()=>Rt,merge:()=>Ld,mergeDefs:()=>je,normalizeParams:()=>I,nullish:()=>ln,numKeys:()=>Od,objectClone:()=>vd,omit:()=>$d,optionalKeys:()=>wo,parsedType:()=>Zd,partial:()=>Md,pick:()=>Nd,prefixIssues:()=>Qe,primitiveTypes:()=>ei,promiseAllObject:()=>kd,propertyKeyTypes:()=>bo,randomString:()=>Id,required:()=>Fd,safeExtend:()=>Pd,shallowClone:()=>Hs,slugify:()=>yo,stringifyPrimitive:()=>ti,uint8ArrayToBase64:()=>si,uint8ArrayToBase64url:()=>Ud,uint8ArrayToHex:()=>Vd,unwrapMessage:()=>cn});function wd(t){return t}function _d(t){return t}function xd(t){}function Ed(t){throw new Error("Unexpected value in exhaustive check")}function Sd(t){}function un(t){let e=Object.values(t).filter(r=>typeof r=="number");return Object.entries(t).filter(([r,o])=>e.indexOf(+r)===-1).map(([r,o])=>o)}function Ad(t,e="|"){return t.map(n=>ti(n)).join(e)}function Rt(t,e){return typeof e=="bigint"?e.toString():e}function kt(t){return{get value(){{let n=t();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function ln(t){return t==null}function fn(t){let e=t.startsWith("^")?1:0,n=t.endsWith("$")?t.length-1:t.length;return t.slice(e,n)}function ho(t,e){let n=t/e,r=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}var Xs=Symbol("evaluating");function M(t,e,n){let r;Object.defineProperty(t,e,{get(){if(r!==Xs)return r===void 0&&(r=Xs,r=n()),r},set(o){Object.defineProperty(t,e,{value:o})},configurable:!0})}function vd(t){return Object.create(Object.getPrototypeOf(t),Object.getOwnPropertyDescriptors(t))}function Ye(t,e,n){Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0})}function je(...t){let e={};for(let n of t){let r=Object.getOwnPropertyDescriptors(n);Object.assign(e,r)}return Object.defineProperties({},e)}function Dd(t){return je(t._zod.def)}function Rd(t,e){return e?e.reduce((n,r)=>n?.[r],t):t}function kd(t){let e=Object.keys(t),n=e.map(r=>t[r]);return Promise.all(n).then(r=>{let o={};for(let s=0;s<e.length;s++)o[e[s]]=r[s];return o})}function Id(t=10){let e="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<t;r++)n+=e[Math.floor(Math.random()*e.length)];return n}function Gn(t){return JSON.stringify(t)}function yo(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var qn="captureStackTrace"in Error?Error.captureStackTrace:(...t)=>{};function gt(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var go=kt(()=>{if(Dt.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let t=Function;return new t(""),!0}catch{return!1}});function Xe(t){if(gt(t)===!1)return!1;let e=t.constructor;if(e===void 0||typeof e!="function")return!0;let n=e.prototype;return!(gt(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Hs(t){return Xe(t)?{...t}:Array.isArray(t)?[...t]:t instanceof Map?new Map(t):t instanceof Set?new Set(t):t}function Od(t){let e=0;for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}var Cd=t=>{let e=typeof t;switch(e){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(t)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(t)?"array":t===null?"null":t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?"promise":typeof Map<"u"&&t instanceof Map?"map":typeof Set<"u"&&t instanceof Set?"set":typeof Date<"u"&&t instanceof Date?"date":typeof File<"u"&&t instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${e}`)}},bo=new Set(["string","number","symbol"]),ei=new Set(["string","number","bigint","boolean","symbol","undefined"]);function Ue(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xe(t,e,n){let r=new t._zod.constr(e??t._zod.def);return(!e||n?.parent)&&(r._zod.parent=t),r}function I(t){let e=t;if(!e)return{};if(typeof e=="string")return{error:()=>e};if(e?.message!==void 0){if(e?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");e.error=e.message}return delete e.message,typeof e.error=="string"?{...e,error:()=>e.error}:e}function Td(t){let e;return new Proxy({},{get(n,r,o){return e??(e=t()),Reflect.get(e,r,o)},set(n,r,o,s){return e??(e=t()),Reflect.set(e,r,o,s)},has(n,r){return e??(e=t()),Reflect.has(e,r)},deleteProperty(n,r){return e??(e=t()),Reflect.deleteProperty(e,r)},ownKeys(n){return e??(e=t()),Reflect.ownKeys(e)},getOwnPropertyDescriptor(n,r){return e??(e=t()),Reflect.getOwnPropertyDescriptor(e,r)},defineProperty(n,r,o){return e??(e=t()),Reflect.defineProperty(e,r,o)}})}function ti(t){return typeof t=="bigint"?t.toString()+"n":typeof t=="string"?`"${t}"`:`${t}`}function wo(t){return Object.keys(t).filter(e=>t[e]._zod.optin==="optional"&&t[e]._zod.optout==="optional")}var _o={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ni={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Nd(t,e){let n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=je(t._zod.def,{get shape(){let i={};for(let a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&(i[a]=n.shape[a])}return Ye(this,"shape",i),i},checks:[]});return xe(t,s)}function $d(t,e){let n=t._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=je(t._zod.def,{get shape(){let i={...t._zod.def.shape};for(let a in e){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);e[a]&&delete i[a]}return Ye(this,"shape",i),i},checks:[]});return xe(t,s)}function zd(t,e){if(!Xe(e))throw new Error("Invalid input to extend: expected a plain object");let n=t._zod.def.checks;if(n&&n.length>0){let s=t._zod.def.shape;for(let i in e)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=je(t._zod.def,{get shape(){let s={...t._zod.def.shape,...e};return Ye(this,"shape",s),s}});return xe(t,o)}function Pd(t,e){if(!Xe(e))throw new Error("Invalid input to safeExtend: expected a plain object");let n=je(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e};return Ye(this,"shape",r),r}});return xe(t,n)}function Ld(t,e){if(t._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=je(t._zod.def,{get shape(){let r={...t._zod.def.shape,...e._zod.def.shape};return Ye(this,"shape",r),r},get catchall(){return e._zod.def.catchall},checks:e._zod.def.checks??[]});return xe(t,n)}function Md(t,e,n){let o=e._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=je(e._zod.def,{get shape(){let a=e._zod.def.shape,c={...a};if(n)for(let u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=t?new t({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=t?new t({type:"optional",innerType:a[u]}):a[u];return Ye(this,"shape",c),c},checks:[]});return xe(e,i)}function Fd(t,e,n){let r=je(e._zod.def,{get shape(){let o=e._zod.def.shape,s={...o};if(n)for(let i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new t({type:"nonoptional",innerType:o[i]}))}else for(let i in o)s[i]=new t({type:"nonoptional",innerType:o[i]});return Ye(this,"shape",s),s}});return xe(e,r)}function He(t,e=0){if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue!==!0)return!0;return!1}function xo(t,e=0){if(t.aborted===!0)return!0;for(let n=e;n<t.issues.length;n++)if(t.issues[n]?.continue===!1)return!0;return!1}function Qe(t,e){return e.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(t),n})}function cn(t){return typeof t=="string"?t:t?.message}function me(t,e,n){let r=t.message?t.message:cn(t.inst?._zod.def?.error?.(t))??cn(e?.error?.(t))??cn(n.customError?.(t))??cn(n.localeError?.(t))??"Invalid input",{inst:o,continue:s,input:i,...a}=t;return a.path??(a.path=[]),a.message=r,e?.reportInput&&(a.input=i),a}function ri(t){return t instanceof Set?"set":t instanceof Map?"map":t instanceof File?"file":"unknown"}function dn(t){return Array.isArray(t)?"array":typeof t=="string"?"string":"unknown"}function Zd(t){let e=typeof t;switch(e){case"number":return Number.isNaN(t)?"nan":"number";case"object":{if(t===null)return"null";if(Array.isArray(t))return"array";let n=t;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return e}function It(...t){let[e,n,r]=t;return typeof e=="string"?{message:e,code:"custom",input:n,inst:r}:{...e}}function Bd(t){return Object.entries(t).filter(([e,n])=>Number.isNaN(Number.parseInt(e,10))).map(e=>e[1])}function oi(t){let e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}function si(t){let e="";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return btoa(e)}function jd(t){let e=t.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-e.length%4)%4);return oi(e+n)}function Ud(t){return si(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Qd(t){let e=t.replace(/^0x/,"");if(e.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2)n[r/2]=Number.parseInt(e.slice(r,r+2),16);return n}function Vd(t){return Array.from(t).map(e=>e.toString(16).padStart(2,"0")).join("")}var mo=class{constructor(...e){}};var ii=(t,e)=>{t.name="$ZodError",Object.defineProperty(t,"_zod",{value:t._zod,enumerable:!1}),Object.defineProperty(t,"issues",{value:e,enumerable:!1}),t.message=JSON.stringify(e,Rt,2),Object.defineProperty(t,"toString",{value:()=>t.message,enumerable:!1})},Jn=b("$ZodError",ii),Eo=b("$ZodError",ii,{Parent:Error});function ai(t,e=n=>n.message){let n={},r=[];for(let o of t.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(e(o))):r.push(e(o));return{formErrors:r,fieldErrors:n}}function ci(t,e=n=>n.message){let n={_errors:[]},r=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)n._errors.push(e(i));else{let c=n,u=0;for(;u<a.length;){let d=a[u];u===a.length-1?(c[d]=c[d]||{_errors:[]},c[d]._errors.push(e(i))):c[d]=c[d]||{_errors:[]},c=c[d],u++}}}};return r(t),n}var Kn=t=>(e,n,r,o)=>{let s=r?{...r,async:!1}:{async:!1},i=e._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new Oe;if(i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>me(c,s,_e())));throw qn(a,o?.callee),a}return i.value};var Wn=t=>async(e,n,r,o)=>{let s=r?{...r,async:!0}:{async:!0},i=e._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??t)(i.issues.map(c=>me(c,s,_e())));throw qn(a,o?.callee),a}return i.value};var pn=t=>(e,n,r)=>{let o=r?{...r,async:!1}:{async:!1},s=e._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new Oe;return s.issues.length?{success:!1,error:new(t??Jn)(s.issues.map(i=>me(i,o,_e())))}:{success:!0,data:s.value}},ui=pn(Eo),mn=t=>async(e,n,r)=>{let o=r?{...r,async:!0}:{async:!0},s=e._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new t(s.issues.map(i=>me(i,o,_e())))}:{success:!0,data:s.value}},li=mn(Eo),fi=t=>(e,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Kn(t)(e,n,o)};var di=t=>(e,n,r)=>Kn(t)(e,n,r);var pi=t=>async(e,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Wn(t)(e,n,o)};var mi=t=>async(e,n,r)=>Wn(t)(e,n,r);var hi=t=>(e,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return pn(t)(e,n,o)};var yi=t=>(e,n,r)=>pn(t)(e,n,r);var gi=t=>async(e,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return mn(t)(e,n,o)};var bi=t=>async(e,n,r)=>mn(t)(e,n,r);var wi=/^[cC][0-9a-z]{6,}$/,_i=/^[0-9a-z]+$/,xi=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Ei=/^[0-9a-vA-V]{20}$/,Si=/^[A-Za-z0-9]{27}$/,Ai=/^[a-zA-Z0-9_-]{21}$/,vi=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Di=/^([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})$/,So=t=>t?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${t}[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)$/;var Ri=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var qd="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function ki(){return new RegExp(qd,"u")}var Ii=/^(?:(?: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])$/,Oi=/^(([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}|:))$/;var Ci=/^((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])$/,Ti=/^(([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])$/,Ni=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Ao=/^[A-Za-z0-9_-]*$/;var $i=/^https?$/,zi=/^\+[1-9]\d{6,14}$/,Pi="(?:(?:\\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])))",Li=new RegExp(`^${Pi}$`);function Mi(t){let e="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof t.precision=="number"?t.precision===-1?`${e}`:t.precision===0?`${e}:[0-5]\\d`:`${e}:[0-5]\\d\\.\\d{${t.precision}}`:`${e}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Fi(t){return new RegExp(`^${Mi(t)}$`)}function Zi(t){let e=Mi({precision:t.precision}),n=["Z"];t.local&&n.push(""),t.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${e}(?:${n.join("|")})`;return new RegExp(`^${Pi}T(?:${r})$`)}var Bi=t=>{let e=t?`[\\s\\S]{${t?.minimum??0},${t?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${e}$`)};var ji=/^-?\d+$/,vo=/^-?\d+(?:\.\d+)?$/,Ui=/^(?:true|false)$/i,Qi=/^null$/i;var Vi=/^[^A-Z]*$/,Gi=/^[^a-z]*$/;var te=b("$ZodCheck",(t,e)=>{var n;t._zod??(t._zod={}),t._zod.def=e,(n=t._zod).onattach??(n.onattach=[])}),qi={number:"number",bigint:"bigint",object:"date"},Do=b("$ZodCheckLessThan",(t,e)=>{te.init(t,e);let n=qi[typeof e.value];t._zod.onattach.push(r=>{let o=r._zod.bag,s=(e.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;e.value<s&&(e.inclusive?o.maximum=e.value:o.exclusiveMaximum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value<=e.value:r.value<e.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Ro=b("$ZodCheckGreaterThan",(t,e)=>{te.init(t,e);let n=qi[typeof e.value];t._zod.onattach.push(r=>{let o=r._zod.bag,s=(e.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;e.value>s&&(e.inclusive?o.minimum=e.value:o.exclusiveMinimum=e.value)}),t._zod.check=r=>{(e.inclusive?r.value>=e.value:r.value>e.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof e.value=="object"?e.value.getTime():e.value,input:r.value,inclusive:e.inclusive,inst:t,continue:!e.abort})}}),Ji=b("$ZodCheckMultipleOf",(t,e)=>{te.init(t,e),t._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=e.value)}),t._zod.check=n=>{if(typeof n.value!=typeof e.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%e.value===BigInt(0):ho(n.value,e.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:e.value,input:n.value,inst:t,continue:!e.abort})}}),Ki=b("$ZodCheckNumberFormat",(t,e)=>{te.init(t,e),e.format=e.format||"float64";let n=e.format?.includes("int"),r=n?"int":"number",[o,s]=_o[e.format];t._zod.onattach.push(i=>{let a=i._zod.bag;a.format=e.format,a.minimum=o,a.maximum=s,n&&(a.pattern=ji)}),t._zod.check=i=>{let a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:e.format,code:"invalid_type",continue:!1,input:a,inst:t});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:t,origin:r,inclusive:!0,continue:!e.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:t,continue:!e.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:t,continue:!e.abort})}});var Wi=b("$ZodCheckMaxLength",(t,e)=>{var n;te.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!ln(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;e.maximum<o&&(r._zod.bag.maximum=e.maximum)}),t._zod.check=r=>{let o=r.value;if(o.length<=e.maximum)return;let i=dn(o);r.issues.push({origin:i,code:"too_big",maximum:e.maximum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Yi=b("$ZodCheckMinLength",(t,e)=>{var n;te.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!ln(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;e.minimum>o&&(r._zod.bag.minimum=e.minimum)}),t._zod.check=r=>{let o=r.value;if(o.length>=e.minimum)return;let i=dn(o);r.issues.push({origin:i,code:"too_small",minimum:e.minimum,inclusive:!0,input:o,inst:t,continue:!e.abort})}}),Xi=b("$ZodCheckLengthEquals",(t,e)=>{var n;te.init(t,e),(n=t._zod.def).when??(n.when=r=>{let o=r.value;return!ln(o)&&o.length!==void 0}),t._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=e.length,o.maximum=e.length,o.length=e.length}),t._zod.check=r=>{let o=r.value,s=o.length;if(s===e.length)return;let i=dn(o),a=s>e.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:e.length}:{code:"too_small",minimum:e.length},inclusive:!0,exact:!0,input:r.value,inst:t,continue:!e.abort})}}),hn=b("$ZodCheckStringFormat",(t,e)=>{var n,r;te.init(t,e),t._zod.onattach.push(o=>{let s=o._zod.bag;s.format=e.format,e.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(e.pattern))}),e.pattern?(n=t._zod).check??(n.check=o=>{e.pattern.lastIndex=0,!e.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:e.format,input:o.value,...e.pattern?{pattern:e.pattern.toString()}:{},inst:t,continue:!e.abort})}):(r=t._zod).check??(r.check=()=>{})}),Hi=b("$ZodCheckRegex",(t,e)=>{hn.init(t,e),t._zod.check=n=>{e.pattern.lastIndex=0,!e.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:e.pattern.toString(),inst:t,continue:!e.abort})}}),ea=b("$ZodCheckLowerCase",(t,e)=>{e.pattern??(e.pattern=Vi),hn.init(t,e)}),ta=b("$ZodCheckUpperCase",(t,e)=>{e.pattern??(e.pattern=Gi),hn.init(t,e)}),na=b("$ZodCheckIncludes",(t,e)=>{te.init(t,e);let n=Ue(e.includes),r=new RegExp(typeof e.position=="number"?`^.{${e.position}}${n}`:n);e.pattern=r,t._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),t._zod.check=o=>{o.value.includes(e.includes,e.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:e.includes,input:o.value,inst:t,continue:!e.abort})}}),ra=b("$ZodCheckStartsWith",(t,e)=>{te.init(t,e);let n=new RegExp(`^${Ue(e.prefix)}.*`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.startsWith(e.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:e.prefix,input:r.value,inst:t,continue:!e.abort})}}),oa=b("$ZodCheckEndsWith",(t,e)=>{te.init(t,e);let n=new RegExp(`.*${Ue(e.suffix)}$`);e.pattern??(e.pattern=n),t._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),t._zod.check=r=>{r.value.endsWith(e.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:e.suffix,input:r.value,inst:t,continue:!e.abort})}});var sa=b("$ZodCheckOverwrite",(t,e)=>{te.init(t,e),t._zod.check=n=>{n.value=e.tx(n.value)}});var Xn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),this.indent-=1}write(e){if(typeof e=="function"){e(this,{execution:"sync"}),e(this,{execution:"async"});return}let r=e.split(`
2
- `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let e=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new e(...n,o.join(`
3
- `))}};var aa={major:4,minor:4,patch:3};var U=b("$ZodType",(t,e)=>{var n;t??(t={}),t._zod.def=e,t._zod.bag=t._zod.bag||{},t._zod.version=aa;let r=[...t._zod.def.checks??[]];t._zod.traits.has("$ZodCheck")&&r.unshift(t);for(let o of r)for(let s of o._zod.onattach)s(t);if(r.length===0)(n=t._zod).deferred??(n.deferred=[]),t._zod.deferred?.push(()=>{t._zod.run=t._zod.parse});else{let o=(i,a,c)=>{let u=He(i),d;for(let l of a){if(l._zod.def.when){if(xo(i)||!l._zod.def.when(i))continue}else if(u)continue;let f=i.issues.length,p=l._zod.check(i);if(p instanceof Promise&&c?.async===!1)throw new Oe;if(d||p instanceof Promise)d=(d??Promise.resolve()).then(async()=>{await p,i.issues.length!==f&&(u||(u=He(i,f)))});else{if(i.issues.length===f)continue;u||(u=He(i,f))}}return d?d.then(()=>i):i},s=(i,a,c)=>{if(He(i))return i.aborted=!0,i;let u=o(a,r,c);if(u instanceof Promise){if(c.async===!1)throw new Oe;return u.then(d=>t._zod.parse(d,c))}return t._zod.parse(u,c)};t._zod.run=(i,a)=>{if(a.skipChecks)return t._zod.parse(i,a);if(a.direction==="backward"){let u=t._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(d=>s(d,i,a)):s(u,i,a)}let c=t._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new Oe;return c.then(u=>o(u,r,a))}return o(c,r,a)}}M(t,"~standard",()=>({validate:o=>{try{let s=ui(t,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return li(t,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),tr=b("$ZodString",(t,e)=>{U.init(t,e),t._zod.pattern=[...t?._zod.bag?.patterns??[]].pop()??Bi(t._zod.bag),t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:t}),n}}),Q=b("$ZodStringFormat",(t,e)=>{hn.init(t,e),tr.init(t,e)}),ya=b("$ZodGUID",(t,e)=>{e.pattern??(e.pattern=Di),Q.init(t,e)}),ga=b("$ZodUUID",(t,e)=>{if(e.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[e.version];if(r===void 0)throw new Error(`Invalid UUID version: "${e.version}"`);e.pattern??(e.pattern=So(r))}else e.pattern??(e.pattern=So());Q.init(t,e)}),ba=b("$ZodEmail",(t,e)=>{e.pattern??(e.pattern=Ri),Q.init(t,e)}),wa=b("$ZodURL",(t,e)=>{Q.init(t,e),t._zod.check=n=>{try{let r=n.value.trim();if(!e.normalize&&e.protocol?.source===$i.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:t,continue:!e.abort});return}let o=new URL(r);e.hostname&&(e.hostname.lastIndex=0,e.hostname.test(o.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:e.hostname.source,input:n.value,inst:t,continue:!e.abort})),e.protocol&&(e.protocol.lastIndex=0,e.protocol.test(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:e.protocol.source,input:n.value,inst:t,continue:!e.abort})),e.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:t,continue:!e.abort})}}}),_a=b("$ZodEmoji",(t,e)=>{e.pattern??(e.pattern=ki()),Q.init(t,e)}),xa=b("$ZodNanoID",(t,e)=>{e.pattern??(e.pattern=Ai),Q.init(t,e)}),Ea=b("$ZodCUID",(t,e)=>{e.pattern??(e.pattern=wi),Q.init(t,e)}),Sa=b("$ZodCUID2",(t,e)=>{e.pattern??(e.pattern=_i),Q.init(t,e)}),Aa=b("$ZodULID",(t,e)=>{e.pattern??(e.pattern=xi),Q.init(t,e)}),va=b("$ZodXID",(t,e)=>{e.pattern??(e.pattern=Ei),Q.init(t,e)}),Da=b("$ZodKSUID",(t,e)=>{e.pattern??(e.pattern=Si),Q.init(t,e)}),Ra=b("$ZodISODateTime",(t,e)=>{e.pattern??(e.pattern=Zi(e)),Q.init(t,e)}),ka=b("$ZodISODate",(t,e)=>{e.pattern??(e.pattern=Li),Q.init(t,e)}),Ia=b("$ZodISOTime",(t,e)=>{e.pattern??(e.pattern=Fi(e)),Q.init(t,e)}),Oa=b("$ZodISODuration",(t,e)=>{e.pattern??(e.pattern=vi),Q.init(t,e)}),Ca=b("$ZodIPv4",(t,e)=>{e.pattern??(e.pattern=Ii),Q.init(t,e),t._zod.bag.format="ipv4"}),Ta=b("$ZodIPv6",(t,e)=>{e.pattern??(e.pattern=Oi),Q.init(t,e),t._zod.bag.format="ipv6",t._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:t,continue:!e.abort})}}});var Na=b("$ZodCIDRv4",(t,e)=>{e.pattern??(e.pattern=Ci),Q.init(t,e)}),$a=b("$ZodCIDRv6",(t,e)=>{e.pattern??(e.pattern=Ti),Q.init(t,e),t._zod.check=n=>{let r=n.value.split("/");try{if(r.length!==2)throw new Error;let[o,s]=r;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:t,continue:!e.abort})}}});function za(t){if(t==="")return!0;if(/\s/.test(t)||t.length%4!==0)return!1;try{return atob(t),!0}catch{return!1}}var Pa=b("$ZodBase64",(t,e)=>{e.pattern??(e.pattern=Ni),Q.init(t,e),t._zod.bag.contentEncoding="base64",t._zod.check=n=>{za(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:t,continue:!e.abort})}});function Jd(t){if(!Ao.test(t))return!1;let e=t.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=e.padEnd(Math.ceil(e.length/4)*4,"=");return za(n)}var La=b("$ZodBase64URL",(t,e)=>{e.pattern??(e.pattern=Ao),Q.init(t,e),t._zod.bag.contentEncoding="base64url",t._zod.check=n=>{Jd(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:t,continue:!e.abort})}}),Ma=b("$ZodE164",(t,e)=>{e.pattern??(e.pattern=zi),Q.init(t,e)});function Kd(t,e=null){try{let n=t.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||e&&(!("alg"in o)||o.alg!==e))}catch{return!1}}var Fa=b("$ZodJWT",(t,e)=>{Q.init(t,e),t._zod.check=n=>{Kd(n.value,e.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:t,continue:!e.abort})}});var Io=b("$ZodNumber",(t,e)=>{U.init(t,e),t._zod.pattern=t._zod.bag.pattern??vo,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:t,...s?{received:s}:{}}),n}}),Za=b("$ZodNumberFormat",(t,e)=>{Ki.init(t,e),Io.init(t,e)}),Ba=b("$ZodBoolean",(t,e)=>{U.init(t,e),t._zod.pattern=Ui,t._zod.parse=(n,r)=>{if(e.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:t}),n}});var ja=b("$ZodNull",(t,e)=>{U.init(t,e),t._zod.pattern=Qi,t._zod.values=new Set([null]),t._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:t}),n}});var Ua=b("$ZodUnknown",(t,e)=>{U.init(t,e),t._zod.parse=n=>n}),Qa=b("$ZodNever",(t,e)=>{U.init(t,e),t._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:t}),n)});function ca(t,e,n){t.issues.length&&e.issues.push(...Qe(n,t.issues)),e.value[n]=t.value}var Va=b("$ZodArray",(t,e)=>{U.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:t}),n;n.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=e.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>ca(u,n,i))):ca(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function er(t,e,n,r,o,s){let i=n in r;if(t.issues.length){if(o&&s&&!i)return;e.issues.push(...Qe(n,t.issues))}if(!i&&!o){t.issues.length||e.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}t.value===void 0?i&&(e.value[n]=void 0):e.value[n]=t.value}function Ga(t){let e=Object.keys(t.shape);for(let r of e)if(!t.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);let n=wo(t.shape);return{...t,keys:e,keySet:new Set(e),numKeys:e.length,optionalKeys:new Set(n)}}function qa(t,e,n,r,o,s){let i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,d=c.optin==="optional",l=c.optout==="optional";for(let f in e){if(f==="__proto__"||a.has(f))continue;if(u==="never"){i.push(f);continue}let p=c.run({value:e[f],issues:[]},r);p instanceof Promise?t.push(p.then(y=>er(y,n,f,e,d,l))):er(p,n,f,e,d,l)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:e,inst:s}),t.length?Promise.all(t).then(()=>n):n}var Wd=b("$ZodObject",(t,e)=>{if(U.init(t,e),!Object.getOwnPropertyDescriptor(e,"shape")?.get){let a=e.shape;Object.defineProperty(e,"shape",{get:()=>{let c={...a};return Object.defineProperty(e,"shape",{value:c}),c}})}let r=kt(()=>Ga(e));M(t._zod,"propValues",()=>{let a=e.shape,c={};for(let u in a){let d=a[u]._zod;if(d.values){c[u]??(c[u]=new Set);for(let l of d.values)c[u].add(l)}}return c});let o=gt,s=e.catchall,i;t._zod.parse=(a,c)=>{i??(i=r.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:t}),a;a.value={};let d=[],l=i.shape;for(let f of i.keys){let p=l[f],y=p._zod.optin==="optional",m=p._zod.optout==="optional",h=p._zod.run({value:u[f],issues:[]},c);h instanceof Promise?d.push(h.then(g=>er(g,a,f,u,y,m))):er(h,a,f,u,y,m)}return s?qa(d,u,a,c,r.value,t):d.length?Promise.all(d).then(()=>a):a}}),Ja=b("$ZodObjectJIT",(t,e)=>{Wd.init(t,e);let n=t._zod.parse,r=kt(()=>Ga(e)),o=f=>{let p=new Xn(["shape","payload","ctx"]),y=r.value,m=S=>{let _=Gn(S);return`shape[${_}]._zod.run({ value: input[${_}], issues: [] }, ctx)`};p.write("const input = payload.value;");let h=Object.create(null),g=0;for(let S of y.keys)h[S]=`key_${g++}`;p.write("const newResult = {};");for(let S of y.keys){let _=h[S],w=Gn(S),A=f[S],D=A?._zod?.optin==="optional",E=A?._zod?.optout==="optional";p.write(`const ${_} = ${m(S)};`),D&&E?p.write(`
4
- if (${_}.issues.length) {
5
- if (${w} in input) {
6
- payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
1
+ var mm=Object.defineProperty;var wa=(e,t)=>{for(var n in t)mm(e,n,{get:t[n],enumerable:!0})};var xa;function k(e,t,n){function r(a,c){if(a._zod||Object.defineProperty(a,"_zod",{value:{def:c,constr:i,traits:new Set},enumerable:!1}),a._zod.traits.has(e))return;a._zod.traits.add(e),t(a,c);let u=i.prototype,f=Object.keys(u);for(let l=0;l<f.length;l++){let p=f[l];p in a||(a[p]=u[p].bind(a))}}let o=n?.Parent??Object;class s extends o{}Object.defineProperty(s,"name",{value:e});function i(a){var c;let u=n?.Parent?new s:this;r(u,a),(c=u._zod).deferred??(c.deferred=[]);for(let f of u._zod.deferred)f();return u}return Object.defineProperty(i,"init",{value:r}),Object.defineProperty(i,Symbol.hasInstance,{value:a=>n?.Parent&&a instanceof n.Parent?!0:a?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var Bw=Symbol("zod_brand"),He=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}},en=class extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}};(xa=globalThis).__zod_globalConfig??(xa.__zod_globalConfig={});var tn=globalThis.__zod_globalConfig;function qe(e){return e&&Object.assign(tn,e),tn}var J={};wa(J,{BIGINT_FORMAT_RANGES:()=>ka,Class:()=>ys,NUMBER_FORMAT_RANGES:()=>Es,aborted:()=>_t,allowsEval:()=>xs,assert:()=>wm,assertEqual:()=>hm,assertIs:()=>ym,assertNever:()=>bm,assertNotEqual:()=>gm,assignProp:()=>wt,base64ToUint8Array:()=>Ra,base64urlToUint8Array:()=>Fm,cached:()=>rn,captureStackTrace:()=>zr,cleanEnum:()=>Pm,cleanRegex:()=>Bn,clone:()=>Ze,cloneDef:()=>Sm,createTransparentProxy:()=>Dm,defineLazy:()=>G,esc:()=>Nr,escapeRegex:()=>ft,explicitlyAborted:()=>As,extend:()=>Tm,finalizeIssue:()=>Oe,floatSafeRemainder:()=>bs,getElementAtPath:()=>Em,getEnumValues:()=>Fn,getLengthableOrigin:()=>qn,getParsedType:()=>Rm,getSizableOrigin:()=>va,hexToUint8Array:()=>Bm,isObject:()=>Ut,isPlainObject:()=>xt,issue:()=>on,joinValues:()=>xm,jsonStringifyReplacer:()=>nn,merge:()=>Nm,mergeDefs:()=>lt,normalizeParams:()=>$,nullish:()=>Mn,numKeys:()=>vm,objectClone:()=>_m,omit:()=>Cm,optionalKeys:()=>Ss,parsedType:()=>Lm,partial:()=>zm,pick:()=>Im,prefixIssues:()=>dt,primitiveTypes:()=>Ea,promiseAllObject:()=>Am,propertyKeyTypes:()=>_s,randomString:()=>km,required:()=>$m,safeExtend:()=>Om,shallowClone:()=>Sa,slugify:()=>ws,stringifyPrimitive:()=>Aa,uint8ArrayToBase64:()=>Da,uint8ArrayToBase64url:()=>Mm,uint8ArrayToHex:()=>qm,unwrapMessage:()=>Pn});function hm(e){return e}function gm(e){return e}function ym(e){}function bm(e){throw new Error("Unexpected value in exhaustive check")}function wm(e){}function Fn(e){let t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function xm(e,t="|"){return e.map(n=>Aa(n)).join(t)}function nn(e,t){return typeof t=="bigint"?t.toString():t}function rn(e){return{get value(){{let n=e();return Object.defineProperty(this,"value",{value:n}),n}throw new Error("cached value already set")}}}function Mn(e){return e==null}function Bn(e){let t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}function bs(e,t){let n=e/t,r=Math.round(n),o=Number.EPSILON*Math.max(Math.abs(n),1);return Math.abs(n-r)<o?0:n-r}var _a=Symbol("evaluating");function G(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==_a)return r===void 0&&(r=_a,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function _m(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function wt(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function lt(...e){let t={};for(let n of e){let r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function Sm(e){return lt(e._zod.def)}function Em(e,t){return t?t.reduce((n,r)=>n?.[r],e):e}function Am(e){let t=Object.keys(e),n=t.map(r=>e[r]);return Promise.all(n).then(r=>{let o={};for(let s=0;s<t.length;s++)o[t[s]]=r[s];return o})}function km(e=10){let t="abcdefghijklmnopqrstuvwxyz",n="";for(let r=0;r<e;r++)n+=t[Math.floor(Math.random()*t.length)];return n}function Nr(e){return JSON.stringify(e)}function ws(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var zr="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Ut(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var xs=rn(()=>{if(tn.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function xt(e){if(Ut(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let n=t.prototype;return!(Ut(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Sa(e){return xt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function vm(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}var Rm=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},_s=new Set(["string","number","symbol"]),Ea=new Set(["string","number","bigint","boolean","symbol","undefined"]);function ft(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ze(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function $(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Dm(e){let t;return new Proxy({},{get(n,r,o){return t??(t=e()),Reflect.get(t,r,o)},set(n,r,o,s){return t??(t=e()),Reflect.set(t,r,o,s)},has(n,r){return t??(t=e()),Reflect.has(t,r)},deleteProperty(n,r){return t??(t=e()),Reflect.deleteProperty(t,r)},ownKeys(n){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(n,r){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,r)},defineProperty(n,r,o){return t??(t=e()),Reflect.defineProperty(t,r,o)}})}function Aa(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ss(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Es={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},ka={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function Im(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let s=lt(e._zod.def,{get shape(){let i={};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&(i[a]=n.shape[a])}return wt(this,"shape",i),i},checks:[]});return Ze(e,s)}function Cm(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let s=lt(e._zod.def,{get shape(){let i={...e._zod.def.shape};for(let a in t){if(!(a in n.shape))throw new Error(`Unrecognized key: "${a}"`);t[a]&&delete i[a]}return wt(this,"shape",i),i},checks:[]});return Ze(e,s)}function Tm(e,t){if(!xt(t))throw new Error("Invalid input to extend: expected a plain object");let n=e._zod.def.checks;if(n&&n.length>0){let s=e._zod.def.shape;for(let i in t)if(Object.getOwnPropertyDescriptor(s,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}let o=lt(e._zod.def,{get shape(){let s={...e._zod.def.shape,...t};return wt(this,"shape",s),s}});return Ze(e,o)}function Om(e,t){if(!xt(t))throw new Error("Invalid input to safeExtend: expected a plain object");let n=lt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t};return wt(this,"shape",r),r}});return Ze(e,n)}function Nm(e,t){if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let n=lt(e._zod.def,{get shape(){let r={...e._zod.def.shape,...t._zod.def.shape};return wt(this,"shape",r),r},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ze(e,n)}function zm(e,t,n){let o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");let i=lt(t._zod.def,{get shape(){let a=t._zod.def.shape,c={...a};if(n)for(let u in n){if(!(u in a))throw new Error(`Unrecognized key: "${u}"`);n[u]&&(c[u]=e?new e({type:"optional",innerType:a[u]}):a[u])}else for(let u in a)c[u]=e?new e({type:"optional",innerType:a[u]}):a[u];return wt(this,"shape",c),c},checks:[]});return Ze(t,i)}function $m(e,t,n){let r=lt(t._zod.def,{get shape(){let o=t._zod.def.shape,s={...o};if(n)for(let i in n){if(!(i in s))throw new Error(`Unrecognized key: "${i}"`);n[i]&&(s[i]=new e({type:"nonoptional",innerType:o[i]}))}else for(let i in o)s[i]=new e({type:"nonoptional",innerType:o[i]});return wt(this,"shape",s),s}});return Ze(t,r)}function _t(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function As(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function dt(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Pn(e){return typeof e=="string"?e:e?.message}function Oe(e,t,n){let r=e.message?e.message:Pn(e.inst?._zod.def?.error?.(e))??Pn(t?.error?.(e))??Pn(n.customError?.(e))??Pn(n.localeError?.(e))??"Invalid input",{inst:o,continue:s,input:i,...a}=e;return a.path??(a.path=[]),a.message=r,t?.reportInput&&(a.input=i),a}function va(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}function qn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Lm(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function on(...e){let[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}function Pm(e){return Object.entries(e).filter(([t,n])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Ra(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r<t.length;r++)n[r]=t.charCodeAt(r);return n}function Da(e){let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Fm(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),n="=".repeat((4-t.length%4)%4);return Ra(t+n)}function Mm(e){return Da(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Bm(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let n=new Uint8Array(t.length/2);for(let r=0;r<t.length;r+=2)n[r/2]=Number.parseInt(t.slice(r,r+2),16);return n}function qm(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var ys=class{constructor(...t){}};var Ia=(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,nn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},$r=k("$ZodError",Ia),ks=k("$ZodError",Ia,{Parent:Error});function Ca(e,t=n=>n.message){let n={},r=[];for(let o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function Ta(e,t=n=>n.message){let n={_errors:[]},r=(o,s=[])=>{for(let i of o.issues)if(i.code==="invalid_union"&&i.errors.length)i.errors.map(a=>r({issues:a},[...s,...i.path]));else if(i.code==="invalid_key")r({issues:i.issues},[...s,...i.path]);else if(i.code==="invalid_element")r({issues:i.issues},[...s,...i.path]);else{let a=[...s,...i.path];if(a.length===0)n._errors.push(t(i));else{let c=n,u=0;for(;u<a.length;){let f=a[u];u===a.length-1?(c[f]=c[f]||{_errors:[]},c[f]._errors.push(t(i))):c[f]=c[f]||{_errors:[]},c=c[f],u++}}}};return r(e),n}var Lr=e=>(t,n,r,o)=>{let s=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise)throw new He;if(i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>Oe(c,s,qe())));throw zr(a,o?.callee),a}return i.value};var Pr=e=>async(t,n,r,o)=>{let s=r?{...r,async:!0}:{async:!0},i=t._zod.run({value:n,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let a=new(o?.Err??e)(i.issues.map(c=>Oe(c,s,qe())));throw zr(a,o?.callee),a}return i.value};var Zn=e=>(t,n,r)=>{let o=r?{...r,async:!1}:{async:!1},s=t._zod.run({value:n,issues:[]},o);if(s instanceof Promise)throw new He;return s.issues.length?{success:!1,error:new(e??$r)(s.issues.map(i=>Oe(i,o,qe())))}:{success:!0,data:s.value}},Oa=Zn(ks),Un=e=>async(t,n,r)=>{let o=r?{...r,async:!0}:{async:!0},s=t._zod.run({value:n,issues:[]},o);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>Oe(i,o,qe())))}:{success:!0,data:s.value}},Na=Un(ks),za=e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Lr(e)(t,n,o)};var $a=e=>(t,n,r)=>Lr(e)(t,n,r);var La=e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Pr(e)(t,n,o)};var Pa=e=>async(t,n,r)=>Pr(e)(t,n,r);var Fa=e=>(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Zn(e)(t,n,o)};var Ma=e=>(t,n,r)=>Zn(e)(t,n,r);var Ba=e=>async(t,n,r)=>{let o=r?{...r,direction:"backward"}:{direction:"backward"};return Un(e)(t,n,o)};var qa=e=>async(t,n,r)=>Un(e)(t,n,r);var Za=/^[cC][0-9a-z]{6,}$/,Ua=/^[0-9a-z]+$/,ja=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Va=/^[0-9a-vA-V]{20}$/,Qa=/^[A-Za-z0-9]{27}$/,Ga=/^[a-zA-Z0-9_-]{21}$/,Ja=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;var Wa=/^([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})$/,vs=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)$/;var Ka=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;var Um="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Ha(){return new RegExp(Um,"u")}var Ya=/^(?:(?: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])$/,Xa=/^(([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}|:))$/;var ec=/^((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])$/,tc=/^(([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])$/,nc=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,Rs=/^[A-Za-z0-9_-]*$/;var rc=/^https?$/,oc=/^\+[1-9]\d{6,14}$/,sc="(?:(?:\\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])))",ic=new RegExp(`^${sc}$`);function ac(e){let t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function cc(e){return new RegExp(`^${ac(e)}$`)}function uc(e){let t=ac({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");let r=`${t}(?:${n.join("|")})`;return new RegExp(`^${sc}T(?:${r})$`)}var lc=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var fc=/^-?\d+$/,Ds=/^-?\d+(?:\.\d+)?$/,dc=/^(?:true|false)$/i,pc=/^null$/i;var mc=/^[^A-Z]*$/,hc=/^[^a-z]*$/;var de=k("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),gc={number:"number",bigint:"bigint",object:"date"},Is=k("$ZodCheckLessThan",(e,t)=>{de.init(e,t);let n=gc[typeof t.value];e._zod.onattach.push(r=>{let o=r._zod.bag,s=(t.inclusive?o.maximum:o.exclusiveMaximum)??Number.POSITIVE_INFINITY;t.value<s&&(t.inclusive?o.maximum=t.value:o.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:"too_big",maximum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Cs=k("$ZodCheckGreaterThan",(e,t)=>{de.init(e,t);let n=gc[typeof t.value];e._zod.onattach.push(r=>{let o=r._zod.bag,s=(t.inclusive?o.minimum:o.exclusiveMinimum)??Number.NEGATIVE_INFINITY;t.value>s&&(t.inclusive?o.minimum=t.value:o.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:"too_small",minimum:typeof t.value=="object"?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),yc=k("$ZodCheckMultipleOf",(e,t)=>{de.init(e,t),e._zod.onattach.push(n=>{var r;(r=n._zod.bag).multipleOf??(r.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw new Error("Cannot mix number and bigint in multiple_of check.");(typeof n.value=="bigint"?n.value%t.value===BigInt(0):bs(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:"not_multiple_of",divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),bc=k("$ZodCheckNumberFormat",(e,t)=>{de.init(e,t),t.format=t.format||"float64";let n=t.format?.includes("int"),r=n?"int":"number",[o,s]=Es[t.format];e._zod.onattach.push(i=>{let a=i._zod.bag;a.format=t.format,a.minimum=o,a.maximum=s,n&&(a.pattern=fc)}),e._zod.check=i=>{let a=i.value;if(n){if(!Number.isInteger(a)){i.issues.push({expected:r,format:t.format,code:"invalid_type",continue:!1,input:a,inst:e});return}if(!Number.isSafeInteger(a)){a>0?i.issues.push({input:a,code:"too_big",maximum:Number.MAX_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort}):i.issues.push({input:a,code:"too_small",minimum:Number.MIN_SAFE_INTEGER,note:"Integers must be within the safe integer range.",inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}a<o&&i.issues.push({origin:"number",input:a,code:"too_small",minimum:o,inclusive:!0,inst:e,continue:!t.abort}),a>s&&i.issues.push({origin:"number",input:a,code:"too_big",maximum:s,inclusive:!0,inst:e,continue:!t.abort})}});var wc=k("$ZodCheckMaxLength",(e,t)=>{var n;de.init(e,t),(n=e._zod.def).when??(n.when=r=>{let o=r.value;return!Mn(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{let o=r.value;if(o.length<=t.maximum)return;let i=qn(o);r.issues.push({origin:i,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),xc=k("$ZodCheckMinLength",(e,t)=>{var n;de.init(e,t),(n=e._zod.def).when??(n.when=r=>{let o=r.value;return!Mn(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{let o=r.value;if(o.length>=t.minimum)return;let i=qn(o);r.issues.push({origin:i,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),_c=k("$ZodCheckLengthEquals",(e,t)=>{var n;de.init(e,t),(n=e._zod.def).when??(n.when=r=>{let o=r.value;return!Mn(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{let o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{let o=r.value,s=o.length;if(s===t.length)return;let i=qn(o),a=s>t.length;r.issues.push({origin:i,...a?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),jn=k("$ZodCheckStringFormat",(e,t)=>{var n,r;de.init(e,t),e._zod.onattach.push(o=>{let s=o._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Sc=k("$ZodCheckRegex",(e,t)=>{jn.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})}}),Ec=k("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=mc),jn.init(e,t)}),Ac=k("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=hc),jn.init(e,t)}),kc=k("$ZodCheckIncludes",(e,t)=>{de.init(e,t);let n=ft(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{let s=o._zod.bag;s.patterns??(s.patterns=new Set),s.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),vc=k("$ZodCheckStartsWith",(e,t)=>{de.init(e,t);let n=new RegExp(`^${ft(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),Rc=k("$ZodCheckEndsWith",(e,t)=>{de.init(e,t);let n=new RegExp(`.*${ft(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{let o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}});var Dc=k("$ZodCheckOverwrite",(e,t)=>{de.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});var Mr=class{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}let r=t.split(`
2
+ `).filter(i=>i),o=Math.min(...r.map(i=>i.length-i.trimStart().length)),s=r.map(i=>i.slice(o)).map(i=>" ".repeat(this.indent*2)+i);for(let i of s)this.content.push(i)}compile(){let t=Function,n=this?.args,o=[...(this?.content??[""]).map(s=>` ${s}`)];return new t(...n,o.join(`
3
+ `))}};var Cc={major:4,minor:4,patch:3};var Y=k("$ZodType",(e,t)=>{var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Cc;let r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(let o of r)for(let s of o._zod.onattach)s(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let o=(i,a,c)=>{let u=_t(i),f;for(let l of a){if(l._zod.def.when){if(As(i)||!l._zod.def.when(i))continue}else if(u)continue;let p=i.issues.length,d=l._zod.check(i);if(d instanceof Promise&&c?.async===!1)throw new He;if(f||d instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await d,i.issues.length!==p&&(u||(u=_t(i,p)))});else{if(i.issues.length===p)continue;u||(u=_t(i,p))}}return f?f.then(()=>i):i},s=(i,a,c)=>{if(_t(i))return i.aborted=!0,i;let u=o(a,r,c);if(u instanceof Promise){if(c.async===!1)throw new He;return u.then(f=>e._zod.parse(f,c))}return e._zod.parse(u,c)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction==="backward"){let u=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return u instanceof Promise?u.then(f=>s(f,i,a)):s(u,i,a)}let c=e._zod.parse(i,a);if(c instanceof Promise){if(a.async===!1)throw new He;return c.then(u=>o(u,r,a))}return o(c,r,a)}}G(e,"~standard",()=>({validate:o=>{try{let s=Oa(e,o);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return Na(e,o).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Zr=k("$ZodString",(e,t)=>{Y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??lc(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value=="string"||n.issues.push({expected:"string",code:"invalid_type",input:n.value,inst:e}),n}}),X=k("$ZodStringFormat",(e,t)=>{jn.init(e,t),Zr.init(e,t)}),Mc=k("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Wa),X.init(e,t)}),Bc=k("$ZodUUID",(e,t)=>{if(t.version){let r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=vs(r))}else t.pattern??(t.pattern=vs());X.init(e,t)}),qc=k("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ka),X.init(e,t)}),Zc=k("$ZodURL",(e,t)=>{X.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===rc.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}let o=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(o.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(o.protocol.endsWith(":")?o.protocol.slice(0,-1):o.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=o.href:n.value=r;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),Uc=k("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Ha()),X.init(e,t)}),jc=k("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=Ga),X.init(e,t)}),Vc=k("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Za),X.init(e,t)}),Qc=k("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=Ua),X.init(e,t)}),Gc=k("$ZodULID",(e,t)=>{t.pattern??(t.pattern=ja),X.init(e,t)}),Jc=k("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Va),X.init(e,t)}),Wc=k("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Qa),X.init(e,t)}),Kc=k("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=uc(t)),X.init(e,t)}),Hc=k("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=ic),X.init(e,t)}),Yc=k("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=cc(t)),X.init(e,t)}),Xc=k("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Ja),X.init(e,t)}),eu=k("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Ya),X.init(e,t),e._zod.bag.format="ipv4"}),tu=k("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Xa),X.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})}}});var nu=k("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=ec),X.init(e,t)}),ru=k("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=tc),X.init(e,t),e._zod.check=n=>{let r=n.value.split("/");try{if(r.length!==2)throw new Error;let[o,s]=r;if(!s)throw new Error;let i=Number(s);if(`${i}`!==s)throw new Error;if(i<0||i>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function ou(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}var su=k("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=nc),X.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{ou(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function jm(e){if(!Rs.test(e))return!1;let t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return ou(n)}var iu=k("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=Rs),X.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{jm(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),au=k("$ZodE164",(e,t)=>{t.pattern??(t.pattern=oc),X.init(e,t)});function Vm(e,t=null){try{let n=e.split(".");if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let o=JSON.parse(atob(r));return!("typ"in o&&o?.typ!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}var cu=k("$ZodJWT",(e,t)=>{X.init(e,t),e._zod.check=n=>{Vm(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}});var Os=k("$ZodNumber",(e,t)=>{Y.init(e,t),e._zod.pattern=e._zod.bag.pattern??Ds,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let o=n.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return n;let s=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:"Infinity":void 0;return n.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...s?{received:s}:{}}),n}}),uu=k("$ZodNumberFormat",(e,t)=>{bc.init(e,t),Os.init(e,t)}),lu=k("$ZodBoolean",(e,t)=>{Y.init(e,t),e._zod.pattern=dc,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let o=n.value;return typeof o=="boolean"||n.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),n}});var fu=k("$ZodNull",(e,t)=>{Y.init(e,t),e._zod.pattern=pc,e._zod.values=new Set([null]),e._zod.parse=(n,r)=>{let o=n.value;return o===null||n.issues.push({expected:"null",code:"invalid_type",input:o,inst:e}),n}});var du=k("$ZodUnknown",(e,t)=>{Y.init(e,t),e._zod.parse=n=>n}),pu=k("$ZodNever",(e,t)=>{Y.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function Tc(e,t,n){e.issues.length&&t.issues.push(...dt(n,e.issues)),t.value[n]=e.value}var mu=k("$ZodArray",(e,t)=>{Y.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);let s=[];for(let i=0;i<o.length;i++){let a=o[i],c=t.element._zod.run({value:a,issues:[]},r);c instanceof Promise?s.push(c.then(u=>Tc(u,n,i))):Tc(c,n,i)}return s.length?Promise.all(s).then(()=>n):n}});function qr(e,t,n,r,o,s){let i=n in r;if(e.issues.length){if(o&&s&&!i)return;t.issues.push(...dt(n,e.issues))}if(!i&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?i&&(t.value[n]=void 0):t.value[n]=e.value}function hu(e){let t=Object.keys(e.shape);for(let r of t)if(!e.shape?.[r]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${r}": expected a Zod schema`);let n=Ss(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function gu(e,t,n,r,o,s){let i=[],a=o.keySet,c=o.catchall._zod,u=c.def.type,f=c.optin==="optional",l=c.optout==="optional";for(let p in t){if(p==="__proto__"||a.has(p))continue;if(u==="never"){i.push(p);continue}let d=c.run({value:t[p],issues:[]},r);d instanceof Promise?e.push(d.then(w=>qr(w,n,p,t,f,l))):qr(d,n,p,t,f,l)}return i.length&&n.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>n):n}var Qm=k("$ZodObject",(e,t)=>{if(Y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let a=t.shape;Object.defineProperty(t,"shape",{get:()=>{let c={...a};return Object.defineProperty(t,"shape",{value:c}),c}})}let r=rn(()=>hu(t));G(e._zod,"propValues",()=>{let a=t.shape,c={};for(let u in a){let f=a[u]._zod;if(f.values){c[u]??(c[u]=new Set);for(let l of f.values)c[u].add(l)}}return c});let o=Ut,s=t.catchall,i;e._zod.parse=(a,c)=>{i??(i=r.value);let u=a.value;if(!o(u))return a.issues.push({expected:"object",code:"invalid_type",input:u,inst:e}),a;a.value={};let f=[],l=i.shape;for(let p of i.keys){let d=l[p],w=d._zod.optin==="optional",h=d._zod.optout==="optional",y=d._zod.run({value:u[p],issues:[]},c);y instanceof Promise?f.push(y.then(m=>qr(m,a,p,u,w,h))):qr(y,a,p,u,w,h)}return s?gu(f,u,a,c,r.value,e):f.length?Promise.all(f).then(()=>a):a}}),yu=k("$ZodObjectJIT",(e,t)=>{Qm.init(e,t);let n=e._zod.parse,r=rn(()=>hu(t)),o=p=>{let d=new Mr(["shape","payload","ctx"]),w=r.value,h=S=>{let E=Nr(S);return`shape[${E}]._zod.run({ value: input[${E}], issues: [] }, ctx)`};d.write("const input = payload.value;");let y=Object.create(null),m=0;for(let S of w.keys)y[S]=`key_${m++}`;d.write("const newResult = {};");for(let S of w.keys){let E=y[S],_=Nr(S),x=p[S],R=x?._zod?.optin==="optional",v=x?._zod?.optout==="optional";d.write(`const ${E} = ${h(S)};`),R&&v?d.write(`
4
+ if (${E}.issues.length) {
5
+ if (${_} in input) {
6
+ payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
7
7
  ...iss,
8
- path: iss.path ? [${w}, ...iss.path] : [${w}]
8
+ path: iss.path ? [${_}, ...iss.path] : [${_}]
9
9
  })));
10
10
  }
11
11
  }
12
12
 
13
- if (${_}.value === undefined) {
14
- if (${w} in input) {
15
- newResult[${w}] = undefined;
13
+ if (${E}.value === undefined) {
14
+ if (${_} in input) {
15
+ newResult[${_}] = undefined;
16
16
  }
17
17
  } else {
18
- newResult[${w}] = ${_}.value;
18
+ newResult[${_}] = ${E}.value;
19
19
  }
20
20
 
21
- `):D?p.write(`
22
- if (${_}.issues.length) {
23
- payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
21
+ `):R?d.write(`
22
+ if (${E}.issues.length) {
23
+ payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
24
24
  ...iss,
25
- path: iss.path ? [${w}, ...iss.path] : [${w}]
25
+ path: iss.path ? [${_}, ...iss.path] : [${_}]
26
26
  })));
27
27
  }
28
28
 
29
- if (${_}.value === undefined) {
30
- if (${w} in input) {
31
- newResult[${w}] = undefined;
29
+ if (${E}.value === undefined) {
30
+ if (${_} in input) {
31
+ newResult[${_}] = undefined;
32
32
  }
33
33
  } else {
34
- newResult[${w}] = ${_}.value;
34
+ newResult[${_}] = ${E}.value;
35
35
  }
36
36
 
37
- `):p.write(`
38
- const ${_}_present = ${w} in input;
39
- if (${_}.issues.length) {
40
- payload.issues = payload.issues.concat(${_}.issues.map(iss => ({
37
+ `):d.write(`
38
+ const ${E}_present = ${_} in input;
39
+ if (${E}.issues.length) {
40
+ payload.issues = payload.issues.concat(${E}.issues.map(iss => ({
41
41
  ...iss,
42
- path: iss.path ? [${w}, ...iss.path] : [${w}]
42
+ path: iss.path ? [${_}, ...iss.path] : [${_}]
43
43
  })));
44
44
  }
45
- if (!${_}_present && !${_}.issues.length) {
45
+ if (!${E}_present && !${E}.issues.length) {
46
46
  payload.issues.push({
47
47
  code: "invalid_type",
48
48
  expected: "nonoptional",
49
49
  input: undefined,
50
- path: [${w}]
50
+ path: [${_}]
51
51
  });
52
52
  }
53
53
 
54
- if (${_}_present) {
55
- if (${_}.value === undefined) {
56
- newResult[${w}] = undefined;
54
+ if (${E}_present) {
55
+ if (${E}.value === undefined) {
56
+ newResult[${_}] = undefined;
57
57
  } else {
58
- newResult[${w}] = ${_}.value;
58
+ newResult[${_}] = ${E}.value;
59
59
  }
60
60
  }
61
61
 
62
- `)}p.write("payload.value = newResult;"),p.write("return payload;");let x=p.compile();return(S,_)=>x(f,S,_)},s,i=gt,a=!Dt.jitless,u=a&&go.value,d=e.catchall,l;t._zod.parse=(f,p)=>{l??(l=r.value);let y=f.value;return i(y)?a&&u&&p?.async===!1&&p.jitless!==!0?(s||(s=o(e.shape)),f=s(f,p),d?qa([],y,f,p,l,t):f):n(f,p):(f.issues.push({expected:"object",code:"invalid_type",input:y,inst:t}),f)}});function ua(t,e,n,r){for(let s of t)if(s.issues.length===0)return e.value=s.value,e;let o=t.filter(s=>!He(s));return o.length===1?(e.value=o[0].value,o[0]):(e.issues.push({code:"invalid_union",input:e.value,inst:n,errors:t.map(s=>s.issues.map(i=>me(i,r,_e())))}),e)}var Oo=b("$ZodUnion",(t,e)=>{U.init(t,e),M(t._zod,"optin",()=>e.options.some(r=>r._zod.optin==="optional")?"optional":void 0),M(t._zod,"optout",()=>e.options.some(r=>r._zod.optout==="optional")?"optional":void 0),M(t._zod,"values",()=>{if(e.options.every(r=>r._zod.values))return new Set(e.options.flatMap(r=>Array.from(r._zod.values)))}),M(t._zod,"pattern",()=>{if(e.options.every(r=>r._zod.pattern)){let r=e.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>fn(o.source)).join("|")})$`)}});let n=e.options.length===1?e.options[0]._zod.run:null;t._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1,i=[];for(let a of e.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>ua(a,r,t,o)):ua(i,r,t,o)}});var Ka=b("$ZodDiscriminatedUnion",(t,e)=>{e.inclusive=!1,Oo.init(t,e);let n=t._zod.parse;M(t._zod,"propValues",()=>{let o={};for(let s of e.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let r=kt(()=>{let o=e.options,s=new Map;for(let i of o){let a=i._zod.propValues?.[e.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${e.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});t._zod.parse=(o,s)=>{let i=o.value;if(!gt(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:t}),o;let a=r.value.get(i?.[e.discriminator]);return a?a._zod.run(o,s):e.unionFallback||s.direction==="backward"?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:e.discriminator,options:Array.from(r.value.keys()),input:i,path:[e.discriminator],inst:t}),o)}}),Wa=b("$ZodIntersection",(t,e)=>{U.init(t,e),t._zod.parse=(n,r)=>{let o=n.value,s=e.left._zod.run({value:o,issues:[]},r),i=e.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>la(n,c,u)):la(n,s,i)}});function ko(t,e){if(t===e)return{valid:!0,data:t};if(t instanceof Date&&e instanceof Date&&+t==+e)return{valid:!0,data:t};if(Xe(t)&&Xe(e)){let n=Object.keys(e),r=Object.keys(t).filter(s=>n.indexOf(s)!==-1),o={...t,...e};for(let s of r){let i=ko(t[s],e[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(t)&&Array.isArray(e)){if(t.length!==e.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<t.length;r++){let o=t[r],s=e[r],i=ko(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function la(t,e,n){let r=new Map,o;for(let a of e.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(let c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else t.issues.push(a);for(let a of n.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else t.issues.push(a);let s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&t.issues.push({...o,keys:s}),He(t))return t;let i=ko(e.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return t.value=i.data,t}var Ya=b("$ZodRecord",(t,e)=>{U.init(t,e),t._zod.parse=(n,r)=>{let o=n.value;if(!Xe(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:t}),n;let s=[],i=e.keyType._zod.values;if(i){n.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let d=e.keyType._zod.run({value:u,issues:[]},r);if(d instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(d.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:d.issues.map(p=>me(p,r,_e())),input:u,path:[u],inst:t});continue}let l=d.value,f=e.valueType._zod.run({value:o[u],issues:[]},r);f instanceof Promise?s.push(f.then(p=>{p.issues.length&&n.issues.push(...Qe(u,p.issues)),n.value[l]=p.value})):(f.issues.length&&n.issues.push(...Qe(u,f.issues)),n.value[l]=f.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:t,keys:c})}else{n.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,a))continue;let c=e.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&vo.test(a)&&c.issues.length){let l=e.keyType._zod.run({value:Number(a),issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");l.issues.length===0&&(c=l)}if(c.issues.length){e.mode==="loose"?n.value[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>me(l,r,_e())),input:a,path:[a],inst:t});continue}let d=e.valueType._zod.run({value:o[a],issues:[]},r);d instanceof Promise?s.push(d.then(l=>{l.issues.length&&n.issues.push(...Qe(a,l.issues)),n.value[c.value]=l.value})):(d.issues.length&&n.issues.push(...Qe(a,d.issues)),n.value[c.value]=d.value)}}return s.length?Promise.all(s).then(()=>n):n}});var Xa=b("$ZodEnum",(t,e)=>{U.init(t,e);let n=un(e.entries),r=new Set(n);t._zod.values=r,t._zod.pattern=new RegExp(`^(${n.filter(o=>bo.has(typeof o)).map(o=>typeof o=="string"?Ue(o):o.toString()).join("|")})$`),t._zod.parse=(o,s)=>{let i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:t}),o}}),Ha=b("$ZodLiteral",(t,e)=>{if(U.init(t,e),e.values.length===0)throw new Error("Cannot create literal schema with no valid values");let n=new Set(e.values);t._zod.values=n,t._zod.pattern=new RegExp(`^(${e.values.map(r=>typeof r=="string"?Ue(r):r?Ue(r.toString()):String(r)).join("|")})$`),t._zod.parse=(r,o)=>{let s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:e.values,input:s,inst:t}),r}});var ec=b("$ZodTransform",(t,e)=>{U.init(t,e),t._zod.optin="optional",t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new vt(t.constructor.name);let o=e.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n.fallback=!0,n));if(o instanceof Promise)throw new Oe;return n.value=o,n.fallback=!0,n}});function fa(t,e){return e===void 0&&(t.issues.length||t.fallback)?{issues:[],value:void 0}:t}var Co=b("$ZodOptional",(t,e)=>{U.init(t,e),t._zod.optin="optional",t._zod.optout="optional",M(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,void 0]):void 0),M(t._zod,"pattern",()=>{let n=e.innerType._zod.pattern;return n?new RegExp(`^(${fn(n.source)})?$`):void 0}),t._zod.parse=(n,r)=>{if(e.innerType._zod.optin==="optional"){let o=n.value,s=e.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>fa(i,o)):fa(s,o)}return n.value===void 0?n:e.innerType._zod.run(n,r)}}),tc=b("$ZodExactOptional",(t,e)=>{Co.init(t,e),M(t._zod,"values",()=>e.innerType._zod.values),M(t._zod,"pattern",()=>e.innerType._zod.pattern),t._zod.parse=(n,r)=>e.innerType._zod.run(n,r)}),nc=b("$ZodNullable",(t,e)=>{U.init(t,e),M(t._zod,"optin",()=>e.innerType._zod.optin),M(t._zod,"optout",()=>e.innerType._zod.optout),M(t._zod,"pattern",()=>{let n=e.innerType._zod.pattern;return n?new RegExp(`^(${fn(n.source)}|null)$`):void 0}),M(t._zod,"values",()=>e.innerType._zod.values?new Set([...e.innerType._zod.values,null]):void 0),t._zod.parse=(n,r)=>n.value===null?n:e.innerType._zod.run(n,r)}),rc=b("$ZodDefault",(t,e)=>{U.init(t,e),t._zod.optin="optional",M(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);if(n.value===void 0)return n.value=e.defaultValue,n;let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>da(s,e)):da(o,e)}});function da(t,e){return t.value===void 0&&(t.value=e.defaultValue),t}var oc=b("$ZodPrefault",(t,e)=>{U.init(t,e),t._zod.optin="optional",M(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=e.defaultValue),e.innerType._zod.run(n,r))}),sc=b("$ZodNonOptional",(t,e)=>{U.init(t,e),M(t._zod,"values",()=>{let n=e.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),t._zod.parse=(n,r)=>{let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>pa(s,t)):pa(o,t)}});function pa(t,e){return!t.issues.length&&t.value===void 0&&t.issues.push({code:"invalid_type",expected:"nonoptional",input:t.value,inst:e}),t}var ic=b("$ZodCatch",(t,e)=>{U.init(t,e),t._zod.optin="optional",M(t._zod,"optout",()=>e.innerType._zod.optout),M(t._zod,"values",()=>e.innerType._zod.values),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=e.catchValue({...n,error:{issues:s.issues.map(i=>me(i,r,_e()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=e.catchValue({...n,error:{issues:o.issues.map(s=>me(s,r,_e()))},input:n.value}),n.issues=[],n.fallback=!0),n)}});var ac=b("$ZodPipe",(t,e)=>{U.init(t,e),M(t._zod,"values",()=>e.in._zod.values),M(t._zod,"optin",()=>e.in._zod.optin),M(t._zod,"optout",()=>e.out._zod.optout),M(t._zod,"propValues",()=>e.in._zod.propValues),t._zod.parse=(n,r)=>{if(r.direction==="backward"){let s=e.out._zod.run(n,r);return s instanceof Promise?s.then(i=>Hn(i,e.in,r)):Hn(s,e.in,r)}let o=e.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Hn(s,e.out,r)):Hn(o,e.out,r)}});function Hn(t,e,n){return t.issues.length?(t.aborted=!0,t):e._zod.run({value:t.value,issues:t.issues,fallback:t.fallback},n)}var cc=b("$ZodReadonly",(t,e)=>{U.init(t,e),M(t._zod,"propValues",()=>e.innerType._zod.propValues),M(t._zod,"values",()=>e.innerType._zod.values),M(t._zod,"optin",()=>e.innerType?._zod?.optin),M(t._zod,"optout",()=>e.innerType?._zod?.optout),t._zod.parse=(n,r)=>{if(r.direction==="backward")return e.innerType._zod.run(n,r);let o=e.innerType._zod.run(n,r);return o instanceof Promise?o.then(ma):ma(o)}});function ma(t){return t.value=Object.freeze(t.value),t}var uc=b("$ZodLazy",(t,e)=>{U.init(t,e),M(t._zod,"innerType",()=>{let n=e;return n._cachedInner||(n._cachedInner=e.getter()),n._cachedInner}),M(t._zod,"pattern",()=>t._zod.innerType?._zod?.pattern),M(t._zod,"propValues",()=>t._zod.innerType?._zod?.propValues),M(t._zod,"optin",()=>t._zod.innerType?._zod?.optin??void 0),M(t._zod,"optout",()=>t._zod.innerType?._zod?.optout??void 0),t._zod.parse=(n,r)=>t._zod.innerType._zod.run(n,r)}),lc=b("$ZodCustom",(t,e)=>{te.init(t,e),U.init(t,e),t._zod.parse=(n,r)=>n,t._zod.check=n=>{let r=n.value,o=e.fn(r);if(o instanceof Promise)return o.then(s=>ha(s,n,r,t));ha(o,n,r,t)}});function ha(t,e,n,r){if(!t){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),e.issues.push(It(o))}}var fc,Ny=Symbol("ZodOutput"),$y=Symbol("ZodInput"),To=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...n){let r=n[0];return this._map.set(e,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let n=this._map.get(e);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(e),this}get(e){let n=e._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...this._map.get(e)};return Object.keys(o).length?o:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Yd(){return new To}(fc=globalThis).__zod_globalRegistry??(fc.__zod_globalRegistry=Yd());var bt=globalThis.__zod_globalRegistry;function dc(t,e){return new t({type:"string",...I(e)})}function pc(t,e){return new t({type:"string",format:"email",check:"string_format",abort:!1,...I(e)})}function No(t,e){return new t({type:"string",format:"guid",check:"string_format",abort:!1,...I(e)})}function mc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,...I(e)})}function hc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...I(e)})}function yc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...I(e)})}function gc(t,e){return new t({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...I(e)})}function bc(t,e){return new t({type:"string",format:"url",check:"string_format",abort:!1,...I(e)})}function wc(t,e){return new t({type:"string",format:"emoji",check:"string_format",abort:!1,...I(e)})}function _c(t,e){return new t({type:"string",format:"nanoid",check:"string_format",abort:!1,...I(e)})}function xc(t,e){return new t({type:"string",format:"cuid",check:"string_format",abort:!1,...I(e)})}function Ec(t,e){return new t({type:"string",format:"cuid2",check:"string_format",abort:!1,...I(e)})}function Sc(t,e){return new t({type:"string",format:"ulid",check:"string_format",abort:!1,...I(e)})}function Ac(t,e){return new t({type:"string",format:"xid",check:"string_format",abort:!1,...I(e)})}function vc(t,e){return new t({type:"string",format:"ksuid",check:"string_format",abort:!1,...I(e)})}function Dc(t,e){return new t({type:"string",format:"ipv4",check:"string_format",abort:!1,...I(e)})}function Rc(t,e){return new t({type:"string",format:"ipv6",check:"string_format",abort:!1,...I(e)})}function kc(t,e){return new t({type:"string",format:"cidrv4",check:"string_format",abort:!1,...I(e)})}function Ic(t,e){return new t({type:"string",format:"cidrv6",check:"string_format",abort:!1,...I(e)})}function Oc(t,e){return new t({type:"string",format:"base64",check:"string_format",abort:!1,...I(e)})}function Cc(t,e){return new t({type:"string",format:"base64url",check:"string_format",abort:!1,...I(e)})}function Tc(t,e){return new t({type:"string",format:"e164",check:"string_format",abort:!1,...I(e)})}function Nc(t,e){return new t({type:"string",format:"jwt",check:"string_format",abort:!1,...I(e)})}function $c(t,e){return new t({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...I(e)})}function zc(t,e){return new t({type:"string",format:"date",check:"string_format",...I(e)})}function Pc(t,e){return new t({type:"string",format:"time",check:"string_format",precision:null,...I(e)})}function Lc(t,e){return new t({type:"string",format:"duration",check:"string_format",...I(e)})}function Mc(t,e){return new t({type:"number",checks:[],...I(e)})}function Fc(t,e){return new t({type:"number",check:"number_format",abort:!1,format:"safeint",...I(e)})}function Zc(t,e){return new t({type:"boolean",...I(e)})}function Bc(t,e){return new t({type:"null",...I(e)})}function jc(t){return new t({type:"unknown"})}function Uc(t,e){return new t({type:"never",...I(e)})}function nr(t,e){return new Do({check:"less_than",...I(e),value:t,inclusive:!1})}function yn(t,e){return new Do({check:"less_than",...I(e),value:t,inclusive:!0})}function rr(t,e){return new Ro({check:"greater_than",...I(e),value:t,inclusive:!1})}function gn(t,e){return new Ro({check:"greater_than",...I(e),value:t,inclusive:!0})}function or(t,e){return new Ji({check:"multiple_of",...I(e),value:t})}function sr(t,e){return new Wi({check:"max_length",...I(e),maximum:t})}function Ot(t,e){return new Yi({check:"min_length",...I(e),minimum:t})}function ir(t,e){return new Xi({check:"length_equals",...I(e),length:t})}function $o(t,e){return new Hi({check:"string_format",format:"regex",...I(e),pattern:t})}function zo(t){return new ea({check:"string_format",format:"lowercase",...I(t)})}function Po(t){return new ta({check:"string_format",format:"uppercase",...I(t)})}function Lo(t,e){return new na({check:"string_format",format:"includes",...I(e),includes:t})}function Mo(t,e){return new ra({check:"string_format",format:"starts_with",...I(e),prefix:t})}function Fo(t,e){return new oa({check:"string_format",format:"ends_with",...I(e),suffix:t})}function et(t){return new sa({check:"overwrite",tx:t})}function Zo(t){return et(e=>e.normalize(t))}function Bo(){return et(t=>t.trim())}function jo(){return et(t=>t.toLowerCase())}function Uo(){return et(t=>t.toUpperCase())}function Qo(){return et(t=>yo(t))}function Qc(t,e,n){return new t({type:"array",element:e,...I(n)})}function Vc(t,e,n){return new t({type:"custom",check:"custom",fn:e,...I(n)})}function Gc(t,e){let n=Xd(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(It(o,r.value,n._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(It(s))}},t(r.value,r)),e);return n}function Xd(t,e){let n=new te({check:"custom",...I(e)});return n._zod.check=t,n}function Vo(t){let e=t?.target??"draft-2020-12";return e==="draft-4"&&(e="draft-04"),e==="draft-7"&&(e="draft-07"),{processors:t.processors??{},metadataRegistry:t?.metadata??bt,target:e,unrepresentable:t?.unrepresentable??"throw",override:t?.override??(()=>{}),io:t?.io??"output",counter:0,seen:new Map,cycles:t?.cycles??"ref",reused:t?.reused??"inline",external:t?.external??void 0}}function J(t,e,n={path:[],schemaPath:[]}){var r;let o=t._zod.def,s=e.seen.get(t);if(s)return s.count++,n.schemaPath.includes(t)&&(s.cycle=n.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:n.path};e.seen.set(t,i);let a=t._zod.toJSONSchema?.();if(a)i.schema=a;else{let d={...n,schemaPath:[...n.schemaPath,t],path:n.path};if(t._zod.processJSONSchema)t._zod.processJSONSchema(e,i.schema,d);else{let f=i.schema,p=e.processors[o.type];if(!p)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);p(t,e,f,d)}let l=t._zod.parent;l&&(i.ref||(i.ref=l),J(l,e,d),e.seen.get(l).isParent=!0)}let c=e.metadataRegistry.get(t);return c&&Object.assign(i.schema,c),e.io==="input"&&oe(t)&&(delete i.schema.examples,delete i.schema.default),e.io==="input"&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,e.seen.get(t).schema}function Go(t,e){let n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let i of t.seen.entries()){let a=t.metadataRegistry.get(i[0])?.id;if(a){let c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}let o=i=>{let a=t.target==="draft-2020-12"?"$defs":"definitions";if(t.external){let l=t.external.registry.get(i[0])?.id,f=t.external.uri??(y=>y);if(l)return{ref:f(l)};let p=i[1].defId??i[1].schema.id??`schema${t.counter++}`;return i[1].defId=p,{defId:p,ref:`${f("__shared")}#/${a}/${p}`}}if(i[1]===n)return{ref:"#"};let u=`#/${a}/`,d=i[1].schema.id??`__schema${t.counter++}`;return{defId:d,ref:u+d}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);let d=a.schema;for(let l in d)delete d[l];d.$ref=c};if(t.cycles==="throw")for(let i of t.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
62
+ `)}d.write("payload.value = newResult;"),d.write("return payload;");let A=d.compile();return(S,E)=>A(p,S,E)},s,i=Ut,a=!tn.jitless,u=a&&xs.value,f=t.catchall,l;e._zod.parse=(p,d)=>{l??(l=r.value);let w=p.value;return i(w)?a&&u&&d?.async===!1&&d.jitless!==!0?(s||(s=o(t.shape)),p=s(p,d),f?gu([],w,p,d,l,e):p):n(p,d):(p.issues.push({expected:"object",code:"invalid_type",input:w,inst:e}),p)}});function Oc(e,t,n,r){for(let s of e)if(s.issues.length===0)return t.value=s.value,t;let o=e.filter(s=>!_t(s));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(s=>s.issues.map(i=>Oe(i,r,qe())))}),t)}var Ns=k("$ZodUnion",(e,t)=>{Y.init(e,t),G(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),G(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),G(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),G(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){let r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>Bn(o.source)).join("|")})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let s=!1,i=[];for(let a of t.options){let c=a._zod.run({value:r.value,issues:[]},o);if(c instanceof Promise)i.push(c),s=!0;else{if(c.issues.length===0)return c;i.push(c)}}return s?Promise.all(i).then(a=>Oc(a,r,e,o)):Oc(i,r,e,o)}});var bu=k("$ZodDiscriminatedUnion",(e,t)=>{t.inclusive=!1,Ns.init(e,t);let n=e._zod.parse;G(e._zod,"propValues",()=>{let o={};for(let s of t.options){let i=s._zod.propValues;if(!i||Object.keys(i).length===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(s)}"`);for(let[a,c]of Object.entries(i)){o[a]||(o[a]=new Set);for(let u of c)o[a].add(u)}}return o});let r=rn(()=>{let o=t.options,s=new Map;for(let i of o){let a=i._zod.propValues?.[t.discriminator];if(!a||a.size===0)throw new Error(`Invalid discriminated union option at index "${t.options.indexOf(i)}"`);for(let c of a){if(s.has(c))throw new Error(`Duplicate discriminator value "${String(c)}"`);s.set(c,i)}}return s});e._zod.parse=(o,s)=>{let i=o.value;if(!Ut(i))return o.issues.push({code:"invalid_type",expected:"object",input:i,inst:e}),o;let a=r.value.get(i?.[t.discriminator]);return a?a._zod.run(o,s):t.unionFallback||s.direction==="backward"?n(o,s):(o.issues.push({code:"invalid_union",errors:[],note:"No matching discriminator",discriminator:t.discriminator,options:Array.from(r.value.keys()),input:i,path:[t.discriminator],inst:e}),o)}}),wu=k("$ZodIntersection",(e,t)=>{Y.init(e,t),e._zod.parse=(n,r)=>{let o=n.value,s=t.left._zod.run({value:o,issues:[]},r),i=t.right._zod.run({value:o,issues:[]},r);return s instanceof Promise||i instanceof Promise?Promise.all([s,i]).then(([c,u])=>Nc(n,c,u)):Nc(n,s,i)}});function Ts(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(xt(e)&&xt(t)){let n=Object.keys(t),r=Object.keys(e).filter(s=>n.indexOf(s)!==-1),o={...e,...t};for(let s of r){let i=Ts(e[s],t[s]);if(!i.valid)return{valid:!1,mergeErrorPath:[s,...i.mergeErrorPath]};o[s]=i.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let o=e[r],s=t[r],i=Ts(o,s);if(!i.valid)return{valid:!1,mergeErrorPath:[r,...i.mergeErrorPath]};n.push(i.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Nc(e,t,n){let r=new Map,o;for(let a of t.issues)if(a.code==="unrecognized_keys"){o??(o=a);for(let c of a.keys)r.has(c)||r.set(c,{}),r.get(c).l=!0}else e.issues.push(a);for(let a of n.issues)if(a.code==="unrecognized_keys")for(let c of a.keys)r.has(c)||r.set(c,{}),r.get(c).r=!0;else e.issues.push(a);let s=[...r].filter(([,a])=>a.l&&a.r).map(([a])=>a);if(s.length&&o&&e.issues.push({...o,keys:s}),_t(e))return e;let i=Ts(t.value,n.value);if(!i.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(i.mergeErrorPath)}`);return e.value=i.data,e}var xu=k("$ZodRecord",(e,t)=>{Y.init(e,t),e._zod.parse=(n,r)=>{let o=n.value;if(!xt(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;let s=[],i=t.keyType._zod.values;if(i){n.value={};let a=new Set;for(let u of i)if(typeof u=="string"||typeof u=="number"||typeof u=="symbol"){a.add(typeof u=="number"?u.toString():u);let f=t.keyType._zod.run({value:u,issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(d=>Oe(d,r,qe())),input:u,path:[u],inst:e});continue}let l=f.value,p=t.valueType._zod.run({value:o[u],issues:[]},r);p instanceof Promise?s.push(p.then(d=>{d.issues.length&&n.issues.push(...dt(u,d.issues)),n.value[l]=d.value})):(p.issues.length&&n.issues.push(...dt(u,p.issues)),n.value[l]=p.value)}let c;for(let u in o)a.has(u)||(c=c??[],c.push(u));c&&c.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:c})}else{n.value={};for(let a of Reflect.ownKeys(o)){if(a==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,a))continue;let c=t.keyType._zod.run({value:a,issues:[]},r);if(c instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof a=="string"&&Ds.test(a)&&c.issues.length){let l=t.keyType._zod.run({value:Number(a),issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");l.issues.length===0&&(c=l)}if(c.issues.length){t.mode==="loose"?n.value[a]=o[a]:n.issues.push({code:"invalid_key",origin:"record",issues:c.issues.map(l=>Oe(l,r,qe())),input:a,path:[a],inst:e});continue}let f=t.valueType._zod.run({value:o[a],issues:[]},r);f instanceof Promise?s.push(f.then(l=>{l.issues.length&&n.issues.push(...dt(a,l.issues)),n.value[c.value]=l.value})):(f.issues.length&&n.issues.push(...dt(a,f.issues)),n.value[c.value]=f.value)}}return s.length?Promise.all(s).then(()=>n):n}});var _u=k("$ZodEnum",(e,t)=>{Y.init(e,t);let n=Fn(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>_s.has(typeof o)).map(o=>typeof o=="string"?ft(o):o.toString()).join("|")})$`),e._zod.parse=(o,s)=>{let i=o.value;return r.has(i)||o.issues.push({code:"invalid_value",values:n,input:i,inst:e}),o}}),Su=k("$ZodLiteral",(e,t)=>{if(Y.init(e,t),t.values.length===0)throw new Error("Cannot create literal schema with no valid values");let n=new Set(t.values);e._zod.values=n,e._zod.pattern=new RegExp(`^(${t.values.map(r=>typeof r=="string"?ft(r):r?ft(r.toString()):String(r)).join("|")})$`),e._zod.parse=(r,o)=>{let s=r.value;return n.has(s)||r.issues.push({code:"invalid_value",values:t.values,input:s,inst:e}),r}});var Eu=k("$ZodTransform",(e,t)=>{Y.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new en(e.constructor.name);let o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(i=>(n.value=i,n.fallback=!0,n));if(o instanceof Promise)throw new He;return n.value=o,n.fallback=!0,n}});function zc(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var zs=k("$ZodOptional",(e,t)=>{Y.init(e,t),e._zod.optin="optional",e._zod.optout="optional",G(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),G(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Bn(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){let o=n.value,s=t.innerType._zod.run(n,r);return s instanceof Promise?s.then(i=>zc(i,o)):zc(s,o)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Au=k("$ZodExactOptional",(e,t)=>{zs.init(e,t),G(e._zod,"values",()=>t.innerType._zod.values),G(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),ku=k("$ZodNullable",(e,t)=>{Y.init(e,t),G(e._zod,"optin",()=>t.innerType._zod.optin),G(e._zod,"optout",()=>t.innerType._zod.optout),G(e._zod,"pattern",()=>{let n=t.innerType._zod.pattern;return n?new RegExp(`^(${Bn(n.source)}|null)$`):void 0}),G(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),vu=k("$ZodDefault",(e,t)=>{Y.init(e,t),e._zod.optin="optional",G(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>$c(s,t)):$c(o,t)}});function $c(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Ru=k("$ZodPrefault",(e,t)=>{Y.init(e,t),e._zod.optin="optional",G(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Du=k("$ZodNonOptional",(e,t)=>{Y.init(e,t),G(e._zod,"values",()=>{let n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>Lc(s,e)):Lc(o,e)}});function Lc(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}var Iu=k("$ZodCatch",(e,t)=>{Y.init(e,t),e._zod.optin="optional",G(e._zod,"optout",()=>t.innerType._zod.optout),G(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(s=>(n.value=s.value,s.issues.length&&(n.value=t.catchValue({...n,error:{issues:s.issues.map(i=>Oe(i,r,qe()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(s=>Oe(s,r,qe()))},input:n.value}),n.issues=[],n.fallback=!0),n)}});var Cu=k("$ZodPipe",(e,t)=>{Y.init(e,t),G(e._zod,"values",()=>t.in._zod.values),G(e._zod,"optin",()=>t.in._zod.optin),G(e._zod,"optout",()=>t.out._zod.optout),G(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){let s=t.out._zod.run(n,r);return s instanceof Promise?s.then(i=>Br(i,t.in,r)):Br(s,t.in,r)}let o=t.in._zod.run(n,r);return o instanceof Promise?o.then(s=>Br(s,t.out,r)):Br(o,t.out,r)}});function Br(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var Tu=k("$ZodReadonly",(e,t)=>{Y.init(e,t),G(e._zod,"propValues",()=>t.innerType._zod.propValues),G(e._zod,"values",()=>t.innerType._zod.values),G(e._zod,"optin",()=>t.innerType?._zod?.optin),G(e._zod,"optout",()=>t.innerType?._zod?.optout),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);let o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Pc):Pc(o)}});function Pc(e){return e.value=Object.freeze(e.value),e}var Ou=k("$ZodLazy",(e,t)=>{Y.init(e,t),G(e._zod,"innerType",()=>{let n=t;return n._cachedInner||(n._cachedInner=t.getter()),n._cachedInner}),G(e._zod,"pattern",()=>e._zod.innerType?._zod?.pattern),G(e._zod,"propValues",()=>e._zod.innerType?._zod?.propValues),G(e._zod,"optin",()=>e._zod.innerType?._zod?.optin??void 0),G(e._zod,"optout",()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(n,r)=>e._zod.innerType._zod.run(n,r)}),Nu=k("$ZodCustom",(e,t)=>{de.init(e,t),Y.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{let r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(s=>Fc(s,n,r,e));Fc(o,n,r,e)}});function Fc(e,t,n,r){if(!e){let o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(on(o))}}var zu,rx=Symbol("ZodOutput"),ox=Symbol("ZodInput"),$s=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){let r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){let n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){let n=t._zod.parent;if(n){let r={...this.get(n)??{}};delete r.id;let o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}};function Gm(){return new $s}(zu=globalThis).__zod_globalRegistry??(zu.__zod_globalRegistry=Gm());var jt=globalThis.__zod_globalRegistry;function $u(e,t){return new e({type:"string",...$(t)})}function Lu(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...$(t)})}function Ls(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...$(t)})}function Pu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...$(t)})}function Fu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...$(t)})}function Mu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...$(t)})}function Bu(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...$(t)})}function qu(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...$(t)})}function Zu(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...$(t)})}function Uu(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...$(t)})}function ju(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...$(t)})}function Vu(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...$(t)})}function Qu(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...$(t)})}function Gu(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...$(t)})}function Ju(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...$(t)})}function Wu(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...$(t)})}function Ku(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...$(t)})}function Hu(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...$(t)})}function Yu(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...$(t)})}function Xu(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...$(t)})}function el(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...$(t)})}function tl(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...$(t)})}function nl(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...$(t)})}function rl(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...$(t)})}function ol(e,t){return new e({type:"string",format:"date",check:"string_format",...$(t)})}function sl(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...$(t)})}function il(e,t){return new e({type:"string",format:"duration",check:"string_format",...$(t)})}function al(e,t){return new e({type:"number",checks:[],...$(t)})}function cl(e,t){return new e({type:"number",check:"number_format",abort:!1,format:"safeint",...$(t)})}function ul(e,t){return new e({type:"boolean",...$(t)})}function ll(e,t){return new e({type:"null",...$(t)})}function fl(e){return new e({type:"unknown"})}function dl(e,t){return new e({type:"never",...$(t)})}function Ur(e,t){return new Is({check:"less_than",...$(t),value:e,inclusive:!1})}function Vn(e,t){return new Is({check:"less_than",...$(t),value:e,inclusive:!0})}function jr(e,t){return new Cs({check:"greater_than",...$(t),value:e,inclusive:!1})}function Qn(e,t){return new Cs({check:"greater_than",...$(t),value:e,inclusive:!0})}function Vr(e,t){return new yc({check:"multiple_of",...$(t),value:e})}function Qr(e,t){return new wc({check:"max_length",...$(t),maximum:e})}function sn(e,t){return new xc({check:"min_length",...$(t),minimum:e})}function Gr(e,t){return new _c({check:"length_equals",...$(t),length:e})}function Ps(e,t){return new Sc({check:"string_format",format:"regex",...$(t),pattern:e})}function Fs(e){return new Ec({check:"string_format",format:"lowercase",...$(e)})}function Ms(e){return new Ac({check:"string_format",format:"uppercase",...$(e)})}function Bs(e,t){return new kc({check:"string_format",format:"includes",...$(t),includes:e})}function qs(e,t){return new vc({check:"string_format",format:"starts_with",...$(t),prefix:e})}function Zs(e,t){return new Rc({check:"string_format",format:"ends_with",...$(t),suffix:e})}function St(e){return new Dc({check:"overwrite",tx:e})}function Us(e){return St(t=>t.normalize(e))}function js(){return St(e=>e.trim())}function Vs(){return St(e=>e.toLowerCase())}function Qs(){return St(e=>e.toUpperCase())}function Gs(){return St(e=>ws(e))}function pl(e,t,n){return new e({type:"array",element:t,...$(n)})}function ml(e,t,n){return new e({type:"custom",check:"custom",fn:t,...$(n)})}function hl(e,t){let n=Jm(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(on(o,r.value,n._zod.def));else{let s=o;s.fatal&&(s.continue=!1),s.code??(s.code="custom"),s.input??(s.input=r.value),s.inst??(s.inst=n),s.continue??(s.continue=!n._zod.def.abort),r.issues.push(on(s))}},e(r.value,r)),t);return n}function Jm(e,t){let n=new de({check:"custom",...$(t)});return n._zod.check=e,n}function Js(e){let t=e?.target??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:e?.metadata??jt,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 re(e,t,n={path:[],schemaPath:[]}){var r;let o=e._zod.def,s=t.seen.get(e);if(s)return s.count++,n.schemaPath.includes(e)&&(s.cycle=n.path),s.schema;let i={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,i);let a=e._zod.toJSONSchema?.();if(a)i.schema=a;else{let f={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,i.schema,f);else{let p=i.schema,d=t.processors[o.type];if(!d)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);d(e,t,p,f)}let l=e._zod.parent;l&&(i.ref||(i.ref=l),re(l,t,f),t.seen.get(l).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(i.schema,c),t.io==="input"&&be(e)&&(delete i.schema.examples,delete i.schema.default),t.io==="input"&&"_prefault"in i.schema&&((r=i.schema).default??(r.default=i.schema._prefault)),delete i.schema._prefault,t.seen.get(e).schema}function Ws(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=new Map;for(let i of e.seen.entries()){let a=e.metadataRegistry.get(i[0])?.id;if(a){let c=r.get(a);if(c&&c!==i[0])throw new Error(`Duplicate schema id "${a}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(a,i[0])}}let o=i=>{let a=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){let l=e.external.registry.get(i[0])?.id,p=e.external.uri??(w=>w);if(l)return{ref:p(l)};let d=i[1].defId??i[1].schema.id??`schema${e.counter++}`;return i[1].defId=d,{defId:d,ref:`${p("__shared")}#/${a}/${d}`}}if(i[1]===n)return{ref:"#"};let u=`#/${a}/`,f=i[1].schema.id??`__schema${e.counter++}`;return{defId:f,ref:u+f}},s=i=>{if(i[1].schema.$ref)return;let a=i[1],{ref:c,defId:u}=o(i);a.def={...a.schema},u&&(a.defId=u);let f=a.schema;for(let l in f)delete f[l];f.$ref=c};if(e.cycles==="throw")for(let i of e.seen.entries()){let a=i[1];if(a.cycle)throw new Error(`Cycle detected: #/${a.cycle?.join("/")}/<root>
63
63
 
64
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of t.seen.entries()){let a=i[1];if(e===i[0]){s(i);continue}if(t.external){let u=t.external.registry.get(i[0])?.id;if(e!==i[0]&&u){s(i);continue}}if(t.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&t.reused==="ref"){s(i);continue}}}function qo(t,e){let n=t.seen.get(e);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=a=>{let c=t.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,d={...u},l=c.ref;if(c.ref=null,l){r(l);let p=t.seen.get(l),y=p.schema;if(y.$ref&&(t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(y)):Object.assign(u,y),Object.assign(u,d),a._zod.parent===l)for(let h in u)h==="$ref"||h==="allOf"||h in d||delete u[h];if(y.$ref&&p.def)for(let h in u)h==="$ref"||h==="allOf"||h in p.def&&JSON.stringify(u[h])===JSON.stringify(p.def[h])&&delete u[h]}let f=a._zod.parent;if(f&&f!==l){r(f);let p=t.seen.get(f);if(p?.schema.$ref&&(u.$ref=p.schema.$ref,p.def))for(let y in u)y==="$ref"||y==="allOf"||y in p.def&&JSON.stringify(u[y])===JSON.stringify(p.def[y])&&delete u[y]}t.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...t.seen.entries()].reverse())r(a[0]);let o={};if(t.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":t.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":t.target,t.external?.uri){let a=t.external.registry.get(e)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=t.external.uri(a)}Object.assign(o,n.def??n.schema);let s=t.metadataRegistry.get(e)?.id;s!==void 0&&o.id===s&&delete o.id;let i=t.external?.defs??{};for(let a of t.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}t.external||Object.keys(i).length>0&&(t.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...e["~standard"],jsonSchema:{input:bn(e,"input",t.processors),output:bn(e,"output",t.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function oe(t,e){let n=e??{seen:new Set};if(n.seen.has(t))return!1;n.seen.add(t);let r=t._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return oe(r.element,n);if(r.type==="set")return oe(r.valueType,n);if(r.type==="lazy")return oe(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return oe(r.innerType,n);if(r.type==="intersection")return oe(r.left,n)||oe(r.right,n);if(r.type==="record"||r.type==="map")return oe(r.keyType,n)||oe(r.valueType,n);if(r.type==="pipe")return t._zod.traits.has("$ZodCodec")?!0:oe(r.in,n)||oe(r.out,n);if(r.type==="object"){for(let o in r.shape)if(oe(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(oe(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(oe(o,n))return!0;return!!(r.rest&&oe(r.rest,n))}return!1}var qc=(t,e={})=>n=>{let r=Vo({...n,processors:e});return J(t,r),Go(r,t),qo(r,t)},bn=(t,e,n={})=>r=>{let{libraryOptions:o,target:s}=r??{},i=Vo({...o??{},target:s,io:e,processors:n});return J(t,i),Go(i,t),qo(i,t)};var Hd={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Jc=(t,e,n,r)=>{let o=n;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=t._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Hd[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let d=[...c];d.length===1?o.pattern=d[0].source:d.length>1&&(o.allOf=[...d.map(l=>({...e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0"?{type:"string"}:{},pattern:l.source}))])}},Kc=(t,e,n,r)=>{let o=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:d}=t._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number";let l=typeof d=="number"&&d>=(s??Number.NEGATIVE_INFINITY),f=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),p=e.target==="draft-04"||e.target==="openapi-3.0";l?p?(o.minimum=d,o.exclusiveMinimum=!0):o.exclusiveMinimum=d:typeof s=="number"&&(o.minimum=s),f?p?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof i=="number"&&(o.maximum=i),typeof c=="number"&&(o.multipleOf=c)},Wc=(t,e,n,r)=>{n.type="boolean"};var Yc=(t,e,n,r)=>{e.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"};var Xc=(t,e,n,r)=>{n.not={}};var Hc=(t,e,n,r)=>{};var eu=(t,e,n,r)=>{let o=t._zod.def,s=un(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},tu=(t,e,n,r)=>{let o=t._zod.def,s=[];for(let i of o.values)if(i===void 0){if(e.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(e.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];n.type=i===null?"null":typeof i,e.target==="draft-04"||e.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s};var nu=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var ru=(t,e,n,r)=>{if(e.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var ou=(t,e,n,r)=>{let o=n,s=t._zod.def,{minimum:i,maximum:a}=t._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=J(s.element,e,{...r,path:[...r.path,"items"]})},su=(t,e,n,r)=>{let o=n,s=t._zod.def;o.type="object",o.properties={};let i=s.shape;for(let u in i)o.properties[u]=J(i[u],e,{...r,path:[...r.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let d=s.shape[u]._zod;return e.io==="input"?d.optin===void 0:d.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=J(s.catchall,e,{...r,path:[...r.path,"additionalProperties"]})):e.io==="output"&&(o.additionalProperties=!1)},iu=(t,e,n,r)=>{let o=t._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>J(a,e,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},au=(t,e,n,r)=>{let o=t._zod.def,s=J(o.left,e,{...r,path:[...r.path,"allOf",0]}),i=J(o.right,e,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c};var cu=(t,e,n,r)=>{let o=n,s=t._zod.def;o.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let d=J(s.valueType,e,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let l of c)o.patternProperties[l.source]=d}else(e.target==="draft-07"||e.target==="draft-2020-12")&&(o.propertyNames=J(s.keyType,e,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=J(s.valueType,e,{...r,path:[...r.path,"additionalProperties"]});let u=i._zod.values;if(u){let d=[...u].filter(l=>typeof l=="string"||typeof l=="number");d.length>0&&(o.required=d)}},uu=(t,e,n,r)=>{let o=t._zod.def,s=J(o.innerType,e,r),i=e.seen.get(t);e.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},lu=(t,e,n,r)=>{let o=t._zod.def;J(o.innerType,e,r);let s=e.seen.get(t);s.ref=o.innerType},fu=(t,e,n,r)=>{let o=t._zod.def;J(o.innerType,e,r);let s=e.seen.get(t);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},du=(t,e,n,r)=>{let o=t._zod.def;J(o.innerType,e,r);let s=e.seen.get(t);s.ref=o.innerType,e.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},pu=(t,e,n,r)=>{let o=t._zod.def;J(o.innerType,e,r);let s=e.seen.get(t);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},mu=(t,e,n,r)=>{let o=t._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=e.io==="input"?s?o.out:o.in:o.out;J(i,e,r);let a=e.seen.get(t);a.ref=i},hu=(t,e,n,r)=>{let o=t._zod.def;J(o.innerType,e,r);let s=e.seen.get(t);s.ref=o.innerType,n.readOnly=!0};var Jo=(t,e,n,r)=>{let o=t._zod.def;J(o.innerType,e,r);let s=e.seen.get(t);s.ref=o.innerType},yu=(t,e,n,r)=>{let o=t._zod.innerType;J(o,e,r);let s=e.seen.get(t);s.ref=o};var ip=b("ZodISODateTime",(t,e)=>{Ra.init(t,e),q.init(t,e)});function gu(t){return $c(ip,t)}var ap=b("ZodISODate",(t,e)=>{ka.init(t,e),q.init(t,e)});function bu(t){return zc(ap,t)}var cp=b("ZodISOTime",(t,e)=>{Ia.init(t,e),q.init(t,e)});function wu(t){return Pc(cp,t)}var up=b("ZodISODuration",(t,e)=>{Oa.init(t,e),q.init(t,e)});function _u(t){return Lc(up,t)}var xu=(t,e)=>{Jn.init(t,e),t.name="ZodError",Object.defineProperties(t,{format:{value:n=>ci(t,n)},flatten:{value:n=>ai(t,n)},addIssue:{value:n=>{t.issues.push(n),t.message=JSON.stringify(t.issues,Rt,2)}},addIssues:{value:n=>{t.issues.push(...n),t.message=JSON.stringify(t.issues,Rt,2)}},isEmpty:{get(){return t.issues.length===0}}})},Eu=b("ZodError",xu),ue=b("ZodError",xu,{Parent:Error});var Su=Kn(ue),Au=Wn(ue),vu=pn(ue),Du=mn(ue),Ru=fi(ue),ku=di(ue),Iu=pi(ue),Ou=mi(ue),Cu=hi(ue),Tu=yi(ue),Nu=gi(ue),$u=bi(ue);var zu=new WeakMap;function wn(t,e,n){let r=Object.getPrototypeOf(t),o=zu.get(r);if(o||(o=new Set,zu.set(r,o)),!o.has(e)){o.add(e);for(let s in n){let i=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var V=b("ZodType",(t,e)=>(U.init(t,e),Object.assign(t["~standard"],{jsonSchema:{input:bn(t,"input"),output:bn(t,"output")}}),t.toJSONSchema=qc(t,{}),t.def=e,t.type=e.type,Object.defineProperty(t,"_def",{value:e}),t.parse=(n,r)=>Su(t,n,r,{callee:t.parse}),t.safeParse=(n,r)=>vu(t,n,r),t.parseAsync=async(n,r)=>Au(t,n,r,{callee:t.parseAsync}),t.safeParseAsync=async(n,r)=>Du(t,n,r),t.spa=t.safeParseAsync,t.encode=(n,r)=>Ru(t,n,r),t.decode=(n,r)=>ku(t,n,r),t.encodeAsync=async(n,r)=>Iu(t,n,r),t.decodeAsync=async(n,r)=>Ou(t,n,r),t.safeEncode=(n,r)=>Cu(t,n,r),t.safeDecode=(n,r)=>Tu(t,n,r),t.safeEncodeAsync=async(n,r)=>Nu(t,n,r),t.safeDecodeAsync=async(n,r)=>$u(t,n,r),wn(t,"ZodType",{check(...n){let r=this.def;return this.clone(F.mergeDefs(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return xe(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(sm(n,r))},superRefine(n,r){return this.check(im(n,r))},overwrite(n){return this.check(et(n))},optional(){return Zu(this)},exactOptional(){return Vp(this)},nullable(){return Bu(this)},nullish(){return Zu(Bu(this))},nonoptional(n){return Yp(this,n)},array(){return j(this)},or(n){return Ct([this,n])},and(n){return Zp(this,n)},transform(n){return ju(this,Up(n))},default(n){return Jp(this,n)},prefault(n){return Wp(this,n)},catch(n){return Hp(this,n)},pipe(n){return ju(this,n)},readonly(){return nm(this)},describe(n){let r=this.clone();return bt.add(r,{description:n}),r},meta(...n){if(n.length===0)return bt.get(this);let r=this.clone();return bt.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(t,"description",{get(){return bt.get(t)?.description},configurable:!0}),t)),Uu=b("_ZodString",(t,e)=>{tr.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,o,s)=>Jc(t,r,o,s);let n=t._zod.bag;t.format=n.format??null,t.minLength=n.minimum??null,t.maxLength=n.maximum??null,wn(t,"_ZodString",{regex(...r){return this.check($o(...r))},includes(...r){return this.check(Lo(...r))},startsWith(...r){return this.check(Mo(...r))},endsWith(...r){return this.check(Fo(...r))},min(...r){return this.check(Ot(...r))},max(...r){return this.check(sr(...r))},length(...r){return this.check(ir(...r))},nonempty(...r){return this.check(Ot(1,...r))},lowercase(r){return this.check(zo(r))},uppercase(r){return this.check(Po(r))},trim(){return this.check(Bo())},normalize(...r){return this.check(Zo(...r))},toLowerCase(){return this.check(jo())},toUpperCase(){return this.check(Uo())},slugify(){return this.check(Qo())}})}),pp=b("ZodString",(t,e)=>{tr.init(t,e),Uu.init(t,e),t.email=n=>t.check(pc(mp,n)),t.url=n=>t.check(bc(hp,n)),t.jwt=n=>t.check(Nc(Op,n)),t.emoji=n=>t.check(wc(yp,n)),t.guid=n=>t.check(No(Pu,n)),t.uuid=n=>t.check(mc(cr,n)),t.uuidv4=n=>t.check(hc(cr,n)),t.uuidv6=n=>t.check(yc(cr,n)),t.uuidv7=n=>t.check(gc(cr,n)),t.nanoid=n=>t.check(_c(gp,n)),t.guid=n=>t.check(No(Pu,n)),t.cuid=n=>t.check(xc(bp,n)),t.cuid2=n=>t.check(Ec(wp,n)),t.ulid=n=>t.check(Sc(_p,n)),t.base64=n=>t.check(Oc(Rp,n)),t.base64url=n=>t.check(Cc(kp,n)),t.xid=n=>t.check(Ac(xp,n)),t.ksuid=n=>t.check(vc(Ep,n)),t.ipv4=n=>t.check(Dc(Sp,n)),t.ipv6=n=>t.check(Rc(Ap,n)),t.cidrv4=n=>t.check(kc(vp,n)),t.cidrv6=n=>t.check(Ic(Dp,n)),t.e164=n=>t.check(Tc(Ip,n)),t.datetime=n=>t.check(gu(n)),t.date=n=>t.check(bu(n)),t.time=n=>t.check(wu(n)),t.duration=n=>t.check(_u(n))});function v(t){return dc(pp,t)}var q=b("ZodStringFormat",(t,e)=>{Q.init(t,e),Uu.init(t,e)}),mp=b("ZodEmail",(t,e)=>{ba.init(t,e),q.init(t,e)});var Pu=b("ZodGUID",(t,e)=>{ya.init(t,e),q.init(t,e)});var cr=b("ZodUUID",(t,e)=>{ga.init(t,e),q.init(t,e)});var hp=b("ZodURL",(t,e)=>{wa.init(t,e),q.init(t,e)});var yp=b("ZodEmoji",(t,e)=>{_a.init(t,e),q.init(t,e)});var gp=b("ZodNanoID",(t,e)=>{xa.init(t,e),q.init(t,e)});var bp=b("ZodCUID",(t,e)=>{Ea.init(t,e),q.init(t,e)});var wp=b("ZodCUID2",(t,e)=>{Sa.init(t,e),q.init(t,e)});var _p=b("ZodULID",(t,e)=>{Aa.init(t,e),q.init(t,e)});var xp=b("ZodXID",(t,e)=>{va.init(t,e),q.init(t,e)});var Ep=b("ZodKSUID",(t,e)=>{Da.init(t,e),q.init(t,e)});var Sp=b("ZodIPv4",(t,e)=>{Ca.init(t,e),q.init(t,e)});var Ap=b("ZodIPv6",(t,e)=>{Ta.init(t,e),q.init(t,e)});var vp=b("ZodCIDRv4",(t,e)=>{Na.init(t,e),q.init(t,e)});var Dp=b("ZodCIDRv6",(t,e)=>{$a.init(t,e),q.init(t,e)});var Rp=b("ZodBase64",(t,e)=>{Pa.init(t,e),q.init(t,e)});var kp=b("ZodBase64URL",(t,e)=>{La.init(t,e),q.init(t,e)});var Ip=b("ZodE164",(t,e)=>{Ma.init(t,e),q.init(t,e)});var Op=b("ZodJWT",(t,e)=>{Fa.init(t,e),q.init(t,e)});var Qu=b("ZodNumber",(t,e)=>{Io.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,o,s)=>Kc(t,r,o,s),wn(t,"ZodNumber",{gt(r,o){return this.check(rr(r,o))},gte(r,o){return this.check(gn(r,o))},min(r,o){return this.check(gn(r,o))},lt(r,o){return this.check(nr(r,o))},lte(r,o){return this.check(yn(r,o))},max(r,o){return this.check(yn(r,o))},int(r){return this.check(Lu(r))},safe(r){return this.check(Lu(r))},positive(r){return this.check(rr(0,r))},nonnegative(r){return this.check(gn(0,r))},negative(r){return this.check(nr(0,r))},nonpositive(r){return this.check(yn(0,r))},multipleOf(r,o){return this.check(or(r,o))},step(r,o){return this.check(or(r,o))},finite(){return this}});let n=t._zod.bag;t.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,t.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,t.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),t.isFinite=!0,t.format=n.format??null});function N(t){return Mc(Qu,t)}var Cp=b("ZodNumberFormat",(t,e)=>{Za.init(t,e),Qu.init(t,e)});function Lu(t){return Fc(Cp,t)}var Tp=b("ZodBoolean",(t,e)=>{Ba.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>Wc(t,n,r,o)});function Ve(t){return Zc(Tp,t)}var Np=b("ZodNull",(t,e)=>{ja.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>Yc(t,n,r,o)});function $p(t){return Bc(Np,t)}var zp=b("ZodUnknown",(t,e)=>{Ua.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>Hc(t,n,r,o)});function Mu(){return jc(zp)}var Pp=b("ZodNever",(t,e)=>{Qa.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>Xc(t,n,r,o)});function Vu(t){return Uc(Pp,t)}var Lp=b("ZodArray",(t,e)=>{Va.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>ou(t,n,r,o),t.element=e.element,wn(t,"ZodArray",{min(n,r){return this.check(Ot(n,r))},nonempty(n){return this.check(Ot(1,n))},max(n,r){return this.check(sr(n,r))},length(n,r){return this.check(ir(n,r))},unwrap(){return this.element}})});function j(t,e){return Qc(Lp,t,e)}var Gu=b("ZodObject",(t,e)=>{Ja.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>su(t,n,r,o),F.defineLazy(t,"shape",()=>e.shape),wn(t,"ZodObject",{keyof(){return ee(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Mu()})},loose(){return this.clone({...this._zod.def,catchall:Mu()})},strict(){return this.clone({...this._zod.def,catchall:Vu()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return F.extend(this,n)},safeExtend(n){return F.safeExtend(this,n)},merge(n){return F.merge(this,n)},pick(n){return F.pick(this,n)},omit(n){return F.omit(this,n)},partial(...n){return F.partial(Ju,this,n[0])},required(...n){return F.required(Ku,this,n[0])}})});function tt(t,e){let n={type:"object",shape:t??{},...F.normalizeParams(e)};return new Gu(n)}function O(t,e){return new Gu({type:"object",shape:t,catchall:Vu(),...F.normalizeParams(e)})}var qu=b("ZodUnion",(t,e)=>{Oo.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>iu(t,n,r,o),t.options=e.options});function Ct(t,e){return new qu({type:"union",options:t,...F.normalizeParams(e)})}var Mp=b("ZodDiscriminatedUnion",(t,e)=>{qu.init(t,e),Ka.init(t,e)});function Tt(t,e,n){return new Mp({type:"union",options:e,discriminator:t,...F.normalizeParams(n)})}var Fp=b("ZodIntersection",(t,e)=>{Wa.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>au(t,n,r,o)});function Zp(t,e){return new Fp({type:"intersection",left:t,right:e})}var Fu=b("ZodRecord",(t,e)=>{Ya.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>cu(t,n,r,o),t.keyType=e.keyType,t.valueType=e.valueType});function Ee(t,e,n){return!e||!e._zod?new Fu({type:"record",keyType:v(),valueType:t,...F.normalizeParams(e)}):new Fu({type:"record",keyType:t,valueType:e,...F.normalizeParams(n)})}var Ko=b("ZodEnum",(t,e)=>{Xa.init(t,e),V.init(t,e),t._zod.processJSONSchema=(r,o,s)=>eu(t,r,o,s),t.enum=e.entries,t.options=Object.values(e.entries);let n=new Set(Object.keys(e.entries));t.extract=(r,o)=>{let s={};for(let i of r)if(n.has(i))s[i]=e.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ko({...e,checks:[],...F.normalizeParams(o),entries:s})},t.exclude=(r,o)=>{let s={...e.entries};for(let i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ko({...e,checks:[],...F.normalizeParams(o),entries:s})}});function ee(t,e){let n=Array.isArray(t)?Object.fromEntries(t.map(r=>[r,r])):t;return new Ko({type:"enum",entries:n,...F.normalizeParams(e)})}var Bp=b("ZodLiteral",(t,e)=>{Ha.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>tu(t,n,r,o),t.values=new Set(e.values),Object.defineProperty(t,"value",{get(){if(e.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return e.values[0]}})});function Z(t,e){return new Bp({type:"literal",values:Array.isArray(t)?t:[t],...F.normalizeParams(e)})}var jp=b("ZodTransform",(t,e)=>{ec.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>ru(t,n,r,o),t._zod.parse=(n,r)=>{if(r.direction==="backward")throw new vt(t.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(F.issue(s,n.value,e));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=t),n.issues.push(F.issue(i))}};let o=e.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function Up(t){return new jp({type:"transform",transform:t})}var Ju=b("ZodOptional",(t,e)=>{Co.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>Jo(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function Zu(t){return new Ju({type:"optional",innerType:t})}var Qp=b("ZodExactOptional",(t,e)=>{tc.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>Jo(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function Vp(t){return new Qp({type:"optional",innerType:t})}var Gp=b("ZodNullable",(t,e)=>{nc.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>uu(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function Bu(t){return new Gp({type:"nullable",innerType:t})}var qp=b("ZodDefault",(t,e)=>{rc.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>fu(t,n,r,o),t.unwrap=()=>t._zod.def.innerType,t.removeDefault=t.unwrap});function Jp(t,e){return new qp({type:"default",innerType:t,get defaultValue(){return typeof e=="function"?e():F.shallowClone(e)}})}var Kp=b("ZodPrefault",(t,e)=>{oc.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>du(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function Wp(t,e){return new Kp({type:"prefault",innerType:t,get defaultValue(){return typeof e=="function"?e():F.shallowClone(e)}})}var Ku=b("ZodNonOptional",(t,e)=>{sc.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>lu(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function Yp(t,e){return new Ku({type:"nonoptional",innerType:t,...F.normalizeParams(e)})}var Xp=b("ZodCatch",(t,e)=>{ic.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>pu(t,n,r,o),t.unwrap=()=>t._zod.def.innerType,t.removeCatch=t.unwrap});function Hp(t,e){return new Xp({type:"catch",innerType:t,catchValue:typeof e=="function"?e:()=>e})}var em=b("ZodPipe",(t,e)=>{ac.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>mu(t,n,r,o),t.in=e.in,t.out=e.out});function ju(t,e){return new em({type:"pipe",in:t,out:e})}var tm=b("ZodReadonly",(t,e)=>{cc.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>hu(t,n,r,o),t.unwrap=()=>t._zod.def.innerType});function nm(t){return new tm({type:"readonly",innerType:t})}var rm=b("ZodLazy",(t,e)=>{uc.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>yu(t,n,r,o),t.unwrap=()=>t._zod.def.getter()});function Wo(t){return new rm({type:"lazy",getter:t})}var om=b("ZodCustom",(t,e)=>{lc.init(t,e),V.init(t,e),t._zod.processJSONSchema=(n,r,o)=>nu(t,n,r,o)});function sm(t,e={}){return Vc(om,t,e)}function im(t,e){return Gc(t,e)}function nt(t){let e=Wo(()=>Ct([v(t),N(),Ve(),$p(),j(e),Ee(v(),e)]));return e}var Wu=t=>"field"in t?[t]:("all"in t?t.all:t.any).flatMap(Wu),ur=t=>Wu(t);var Nt=(t,e)=>{if("field"in t)return e(t);let n="all"in t?t.all:t.any,r=!1;if("all"in t){for(let o of n){let s=Nt(o,e);if(s===!1)return!1;r||=s===void 0}return r?void 0:!0}for(let o of n){let s=Nt(o,e);if(s===!0)return!0;r||=s===void 0}return r?void 0:!1},Yu=t=>JSON.stringify(t),Yo=t=>{if("field"in t)return{conditions:1,depth:0};let e="all"in t?t.all:t.any,n=0,r=1;for(let o of e){let s=Yo(o);n+=s.conditions,r=Math.max(r,s.depth+1)}return{conditions:n,depth:r}},Xu=(t,e={})=>{let n=o=>{let s=j(o),i=e.maximumChildren===void 0?s:s.max(e.maximumChildren);return Ct([t,O({all:i}),O({any:i})])},r=Wo(()=>n(r));return e.maximumConditions===void 0&&e.maximumDepth===void 0?r:r.superRefine((o,s)=>{let{conditions:i,depth:a}=Yo(o);e.maximumConditions!==void 0&&i>e.maximumConditions&&s.addIssue({code:"custom",message:e.maximumConditionsMessage??"Query exceeds the condition limit"}),e.maximumDepth!==void 0&&a>e.maximumDepth&&s.addIssue({code:"custom",message:e.maximumDepthMessage??"Query exceeds the nesting limit"})})};var k={requestBytes:524288,filterCount:32,filterDepth:8,sortCount:8,outputFieldCount:256,fieldPathDepth:9,defaultResultCount:20,resultCount:1e3,resultBytes:16777216,candidateDocuments:1e3,databaseBytes:512e3,frontmatterBytes:65536,frontmatterDepth:8,frontmatterFields:256,frontmatterStringBytes:16384,jsonBytes:1048576,jsonDepth:8,jsonFields:256,jsonStringBytes:16384,indexedPropertiesBytes:65536,excerptBytes:2048,mdxDepth:100,mdxNodes:2e4,mdxProps:4e3,hydratedFileBytes:1048576,hydratedTotalBytes:2097152,hydratedFileCount:20,hydratedRangeBytes:262144,concurrentContentReads:8};function wt(t,e=new Set){if(typeof t=="number"&&isNaN(t))throw new Error("NaN is not allowed");if(typeof t=="number"&&!isFinite(t))throw new Error("Infinity is not allowed");if(t===null||typeof t!="object")return JSON.stringify(t);if(typeof t.toJSON=="function"){if(e.has(t))throw new Error("Circular reference detected");e.add(t);let r=wt(t.toJSON(),e);return e.delete(t),r}if(e.has(t))throw new Error("Circular reference detected");e.add(t);let n;if(Array.isArray(t))n=`[${t.map(o=>wt(o===void 0||typeof o=="symbol"?null:o,e)).join(",")}]`;else{let r=[];for(let o of Object.keys(t).sort())t[o]===void 0||typeof t[o]=="symbol"||r.push(`${wt(o)}:${wt(t[o],e)}`);n=`{${r.join(",")}}`}return e.delete(t),n}var am=new TextEncoder,$t=t=>am.encode(t),Ce=t=>$t(t).byteLength,se=class extends Error{constructor(){super("Byte stream exceeds the configured limit"),this.name="ByteLimitExceededError"}},cm=(t,e)=>{let n=new Uint8Array(e),r=0;for(let o of t)n.set(o,r),r+=o.byteLength;return n},zt=t=>typeof t=="string"?{async*[Symbol.asyncIterator](){yield $t(t)}}:t instanceof Uint8Array?{async*[Symbol.asyncIterator](){yield t}}:t,Hu=t=>({async*[Symbol.asyncIterator](){let e=t.getReader(),n=!1;try{for(;;){let r=await e.read();if(r.done){n=!0;return}yield r.value}}finally{if(n===!1)try{await e.cancel()}catch{}e.releaseLock()}}}),Xo=async(t,e)=>{let n=[],r=0;for await(let o of zt(t)){let s=e-r;if(s<=0)break;let i=o.subarray(0,s);if(n.push(i),r+=i.byteLength,r===e)break}return cm(n,r)},Te=async(t,e)=>{let n=await Xo(t,e+1);if(n.byteLength>e)throw new se;return n},le=t=>new TextDecoder("utf-8",{fatal:!0}).decode(t),Pt=t=>t.charCodeAt(0)===65279?t.slice(1):t;var el=t=>{for(let e=0;e<t.length;e+=1){let n=t.charCodeAt(e);if(n>=55296&&n<=56319){let r=t.charCodeAt(e+1);if(e+1>=t.length||r<56320||r>57343)throw new Error("JSON strings cannot contain lone Unicode surrogates");e+=1;continue}if(n>=56320&&n<=57343)throw new Error("JSON strings cannot contain lone Unicode surrogates")}},Ho=(t,e)=>{if(t===null||typeof t=="boolean")return t;if(typeof t=="string")return el(t),t;if(typeof t=="number"){if(Number.isFinite(t)===!1)throw new Error("JSON cannot contain non-finite numbers");return t}if(Array.isArray(t)){if(Object.getOwnPropertySymbols(t).length>0)throw new Error("JSON arrays cannot contain symbol properties");if(e.has(t))throw new Error("JSON cannot contain circular references");e.add(t);try{let n=[];for(let r=0;r<t.length;r+=1){if(Object.hasOwn(t,r)===!1)throw new Error("JSON arrays cannot be sparse");let o=t[r];if(o===void 0)throw new Error("JSON arrays cannot contain undefined values");n.push(Ho(o,e))}if(Object.keys(t).length!==t.length)throw new Error("JSON arrays cannot contain named properties");return n}finally{e.delete(t)}}if(typeof t=="object"){let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n!==null)throw new Error("JSON can contain only plain objects");if(Object.getOwnPropertySymbols(t).length>0)throw new Error("JSON objects cannot contain symbol properties");if(e.has(t))throw new Error("JSON cannot contain circular references");e.add(t);let r={};try{for(let[o,s]of Object.entries(t))el(o),s!==void 0&&Object.defineProperty(r,o,{value:Ho(s,e),enumerable:!0,configurable:!0,writable:!0})}finally{e.delete(t)}return r}throw new Error("Value cannot be represented as JSON")},rt=t=>Ho(t,new Set),fe=t=>{let e=wt(rt(t));if(e===void 0)throw new Error("Value cannot be represented as canonical JSON");return e},_n=(t,e)=>t===void 0||e===void 0?t===e:fe(t)===fe(e),Ne=(t,e)=>t<e?-1:t>e?1:0,es=async t=>{let e=typeof t=="string"?$t(t):t,n=await globalThis.crypto.subtle.digest("SHA-256",e);return Array.from(new Uint8Array(n),r=>r.toString(16).padStart(2,"0")).join("")},tl=async t=>`sha256:${await es(t)}`;var nl=Tt("type",[O({type:Z("document")}),O({type:Z("json"),path:j(v()).min(1)}),O({type:Z("markdown-body")}),O({type:Z("markdown-frontmatter")})]),ts=O({documentId:v().min(1),revision:v().min(1),representation:nl}),um=t=>{let e=nl.parse(t);return e.type==="json"?Object.freeze({...e,path:Object.freeze([...e.path])}):Object.freeze(e)},rl=t=>{let e=ts.parse(t);return Object.freeze({...e,representation:um(e.representation)})};var xn=["json","markdown","mdx"],ol=t=>typeof t=="string"&&xn.includes(t),sl=t=>{let e=t.split(";",1)[0].trim().toLowerCase();if(e==="application/json")return"json";if(e==="text/markdown")return"markdown";if(e==="text/mdx")return"mdx"};var lr=O({id:v().min(1),revision:v().min(1),contentRef:v().min(1),format:ee(xn).optional()}),fr=O({sourceId:v().min(1),referenceId:v().min(1),reference:ts});var Lt=t=>{let e=new Map;for(let n of t){let r=e.get(n.sourceId)??[];r.push(n),e.set(n.sourceId,r)}return e};var $e=class extends Error{code;documentIds;constructor({code:e,message:n,documentIds:r=[]}){super(n),this.name="DocumentGraphError",this.code=e,this.documentIds=Object.freeze([...r])}},lm=(t,e)=>Ne(t.sourceId,e.sourceId)||Ne(t.referenceId,e.referenceId),En=({nodes:t,edges:e})=>{let n=t.map(a=>Object.freeze(lr.parse(a))).sort((a,c)=>Ne(a.id,c.id)),r=new Map,o=new Map;for(let a of n){if(r.has(a.id))throw new $e({code:"DUPLICATE_NODE",message:`Document graph contains duplicate node ${a.id}`,documentIds:[a.id]});r.set(a.id,a);let c=o.get(a.contentRef);if(c!==void 0&&(c.revision!==a.revision||c.format!==a.format))throw new $e({code:"CONTENT_IDENTITY_CONFLICT",message:`Document graph content reference ${a.contentRef} has conflicting identities`,documentIds:[c.id,a.id]});o.set(a.contentRef,a)}let s=e.map(a=>{let c=fr.parse(a);return Object.freeze({...c,reference:rl(c.reference)})}).sort(lm),i=new Set;for(let a of s){if(r.get(a.sourceId)===void 0)throw new $e({code:"SOURCE_NOT_FOUND",message:`Document graph source ${a.sourceId} does not exist`,documentIds:[a.sourceId]});let u=r.get(a.reference.documentId);if(u===void 0)throw new $e({code:"TARGET_NOT_FOUND",message:`Document graph target ${a.reference.documentId} does not exist`,documentIds:[a.sourceId,a.reference.documentId]});if(u.revision!==a.reference.revision)throw new $e({code:"TARGET_REVISION_MISMATCH",message:`Document graph target ${u.id} revision does not match its reference`,documentIds:[a.sourceId,u.id]});let d=`${a.sourceId}\0${a.referenceId}`;if(i.has(d))throw new $e({code:"DUPLICATE_REFERENCE",message:`Document ${a.sourceId} contains duplicate reference ID ${a.referenceId}`,documentIds:[a.sourceId]});i.add(d)}return Object.freeze({nodes:Object.freeze(n),edges:Object.freeze(s)})},fm=t=>new Map(t.nodes.map(e=>[e.id,e]));var dr=({graph:t,rootIds:e})=>{let n=fm(t),r=Lt(t.edges),o=new Map,s=[],i=[],a=c=>{let u=n.get(c);if(u===void 0)throw new $e({code:"ROOT_NOT_FOUND",message:`Document graph root ${c} does not exist`,documentIds:[c]});let d=o.get(c);if(d!=="visited"){if(d==="visiting"){let l=s.indexOf(c),f=[...s.slice(l),c];throw new $e({code:"CYCLE",message:`Document graph contains a cycle: ${f.join(" -> ")}`,documentIds:f})}o.set(c,"visiting"),s.push(c);for(let l of r.get(c)??[])a(l.reference.documentId);s.pop(),o.set(c,"visited"),i.push(u)}};for(let c of[...new Set(e)].sort(Ne))a(c);return Object.freeze(i)};var dm=v().regex(/^sha256:[a-f0-9]{64}$/),il=O({format:Z("webstudio-document-graph"),version:Z(1),nodes:j(lr),edges:j(fr),integrity:O({algorithm:Z("sha256"),checksum:dm})});var pm=v().min(1).refine(t=>t.startsWith("/")===!1,{error:"Asset path must be relative"}).refine(t=>t.includes("\\")===!1&&t.split("/").every(e=>e.length>0&&e!==".."&&e!=="."),{error:"Asset path must be normalized and must not contain dot segments"}),ll=O({_id:v().min(1),_type:Z("asset.file"),name:v().min(1),description:v().optional(),path:pm,key:v(),folderId:v().min(1).optional(),extension:v().regex(/^[a-z0-9]*$/),mimeType:v().min(1),size:N().int().nonnegative(),createdAt:v().datetime().optional(),revision:v().min(1),contentRef:v().min(1),properties:Ee(v(),nt()),excerpt:v().optional(),metadataError:O({code:v().min(1),message:v().min(1),reason:v().min(1).optional(),line:N().int().positive().optional(),column:N().int().positive().optional()}).optional()}),rs=ll.partial().required({_id:!0}),mm=ee(["null","boolean","number","string","object","array"]),hm=tt({format:Z("webstudio-builder-asset-field-catalog"),version:Z(1),canonicalRevision:v().regex(/^sha256:[a-f0-9]{64}$/),documentCount:N().int().nonnegative(),fields:Ee(v().min(1),tt({queryPath:j(v().min(1)).min(1).max(k.fieldPathDepth).optional(),types:j(mm).min(1),occurrences:N().int().positive(),optional:Z(!0).optional(),mixed:Z(!0).optional()}))}).superRefine((t,e)=>{for(let[n,r]of Object.entries(t.fields)){let o=[...new Set(r.types)].sort();JSON.stringify(r.types)!==JSON.stringify(o)&&e.addIssue({code:"custom",path:["fields",n,"types"],message:"Observed field types must be unique and sorted"}),r.occurrences>t.documentCount&&e.addIssue({code:"custom",path:["fields",n,"occurrences"],message:"Field occurrences cannot exceed the document count"});let s=r.occurrences<t.documentCount;r.optional===!0!==s&&e.addIssue({code:"custom",path:["fields",n,"optional"],message:"Field optionality must match its occurrence count"});let i=o.length>1;r.mixed===!0!==i&&e.addIssue({code:"custom",path:["fields",n,"mixed"],message:"Mixed status must match the observed types"})}}),pr=v().regex(/^sha256:[a-f0-9]{64}$/),fl=O({fields:j(j(v().min(1)).min(1).max(k.fieldPathDepth)).min(1).max(k.outputFieldCount+1),rows:j(j(nt())).max(k.resultCount),totalCount:N().int().nonnegative().max(k.candidateDocuments),hasMore:Ve()}).superRefine(({fields:t,rows:e},n)=>{for(let[r,o]of e.entries())o.length!==t.length&&n.addIssue({code:"custom",path:["rows",r],message:"Materialized query rows must match the field count"})}),al=O({format:Z("webstudio-content-database"),version:Z(1),assetRevision:pr,documents:j(rs),documentGraph:il.optional(),contents:Ee(v().min(1),v()).optional(),assetReferences:Ee(v().min(1),j(O({start:N().int().nonnegative(),end:N().int().positive(),assetId:v().min(1),suffix:v().min(1).optional()}).refine(({start:t,end:e})=>e>t,{message:"Markdown asset reference range must not be empty"}))).optional(),assetValueReferences:Ee(v().min(1),j(O({path:j(v().min(1).or(N().int().nonnegative())).min(1),assetId:v().min(1),suffix:v().min(1).optional(),structured:Z(!0).optional()}))).optional(),fieldCatalog:hm,queries:Ee(pr,fl).optional(),database:O({maxBytes:N().int().positive(),unboundedBytes:N().int().nonnegative(),sourceDocumentCount:N().int().nonnegative(),includedDocumentCount:N().int().nonnegative().optional()}).optional(),integrity:O({algorithm:Z("sha256"),checksum:pr})}).superRefine((t,e)=>{t.documents.length>k.candidateDocuments&&e.addIssue({code:"custom",path:["documents"],message:"Asset index exceeds the document limit"}),(t.fieldCatalog.canonicalRevision!==t.assetRevision||t.fieldCatalog.documentCount!==t.documents.length)&&e.addIssue({code:"custom",path:["fieldCatalog"],message:"Asset index field catalog does not match its documents"}),t.database!==void 0&&t.database.sourceDocumentCount<t.documents.length&&e.addIssue({code:"custom",path:["database","sourceDocumentCount"],message:"Source document count cannot be smaller than the database"}),t.database?.includedDocumentCount!==void 0&&(t.database.includedDocumentCount<t.documents.length||t.database.includedDocumentCount>t.database.sourceDocumentCount)&&e.addIssue({code:"custom",path:["database","includedDocumentCount"],message:"Included document count must match the database bounds"});let n;for(let[o,s]of t.documents.entries())n!==void 0&&s._id<=n&&e.addIssue({code:"custom",path:["documents",o,"_id"],message:"Asset index documents must have unique sorted IDs"}),n=s._id;let r=new Set(t.documents.flatMap(({contentRef:o})=>o===void 0?[]:[o]));for(let o of t.documentGraph?.nodes??[])r.add(o.contentRef);for(let o of Object.keys(t.contents??{}))r.has(o)===!1&&e.addIssue({code:"custom",path:["contents",o],message:"Embedded content must belong to an indexed document"});for(let o of Object.keys(t.assetReferences??{}))r.has(o)===!1&&e.addIssue({code:"custom",path:["assetReferences",o],message:"Asset references must belong to an indexed document"})}),ym=Tt("mode",[O({mode:Z("none")}),O({mode:Z("full"),maxBytes:N().int().positive().max(k.hydratedFileBytes).optional()}),O({mode:Z("range"),offset:N().int().nonnegative(),length:N().int().positive().max(k.hydratedRangeBytes)}),O({mode:Z("markdown-body-ref"),maxBytes:N().int().positive().max(k.hydratedFileBytes).optional()})]),os={id:["string"],url:["string"],width:["number"],height:["number"],name:["string"],description:["string"],path:["string"],key:["string"],folderId:["string"],extension:["string"],mimeType:["string"],size:["number"],createdAt:["string"],revision:["string"],excerpt:["string"]},dl=Object.keys(os),pl=["url","width","height"],mr=t=>pl.includes(t),ml=dl.filter(t=>mr(t)===!1&&t!=="excerpt"),hl=ml.filter(t=>t!=="id"),yl=t=>ml.includes(t),gm=ee(dl),Sn=j(v().min(1)).min(1).max(k.fieldPathDepth).superRefine((t,e)=>{if(t[0]==="properties"){t.length<2&&e.addIssue({code:"custom",message:"A properties field path must select a property"});return}(t.length!==1||gm.safeParse(t[0]).success===!1)&&e.addIssue({code:"custom",message:"Asset query field path is unsupported"})}),ns=Ve().default(!0),bm=Tt("mode",[O({mode:Z("all"),includeMetadata:ns}),O({mode:Z("base"),includeMetadata:ns}),O({mode:Z("fields"),includeMetadata:ns,fields:j(Sn).max(k.outputFieldCount).refine(t=>new Set(t.map(Yu)).size===t.length,{error:"Selected output fields must be unique"})})]),wm={mode:"fields",includeMetadata:!1,fields:pl.map(t=>[t])},gl=["eq","ne","contains","startsWith","endsWith","gt","gte","lt","lte"],Vb=[...gl,"in","exists","isEmpty"],_m=O({field:Sn,operator:ee(gl),value:nt()}),xm=O({field:Sn,operator:Z("in"),value:j(nt()).max(k.resultCount)}),Em=O({field:Sn,operator:ee(["exists","isEmpty"]),value:Ve()}),Sm=Tt("operator",[_m,xm,Em]),Am=Xu(Sm,{maximumChildren:k.filterCount,maximumConditions:k.filterCount,maximumDepth:k.filterDepth,maximumConditionsMessage:"Asset query exceeds the filter limit",maximumDepthMessage:"Asset query exceeds the filter nesting limit"});var vm=Am,bl=t=>{let e=new Set(["eq","ne","in","exists"]);return t.some(n=>n==="string"||n==="array")&&e.add("contains"),t.includes("string")&&(e.add("startsWith"),e.add("endsWith")),t.some(n=>n==="string"||n==="number")&&(e.add("gt"),e.add("gte"),e.add("lt"),e.add("lte")),t.some(n=>n==="string"||n==="array"||n==="object")&&e.add("isEmpty"),[...e]},Dm=O({field:Sn,direction:ee(["asc","desc"])}),Rm=ee(["many","one","first","last"]),km=({output:t,content:e})=>t.includeMetadata||t.mode==="all"||t.mode==="fields"&&t.fields.length>0||e.mode!=="none",ot=O({result:Rm.default("many"),where:vm.default({all:[]}),sort:j(Dm).max(k.sortCount).default([]),limit:N().int().nonnegative().max(k.resultCount).default(k.defaultResultCount),offset:N().int().nonnegative().max(k.candidateDocuments).default(0),output:bm.default(wm),content:ym.default({mode:"none"})}).superRefine((t,e)=>{km(t)===!1&&e.addIssue({code:"custom",message:"Select at least one asset query output"}),(t.result==="first"||t.result==="last")&&t.sort.length===0&&e.addIssue({code:"custom",path:["sort"],message:"Add sorting to define which item is first."})}),wl=O({query:ot,indexRevision:v().min(1).max(255).optional()}),Im=tt({_id:v().min(1),revision:v().min(1),contentRef:v().min(1),encoding:Z("utf-8"),text:v(),range:tt({offset:N().int().nonnegative(),length:N().int().nonnegative(),total:N().int().nonnegative()}).optional()}),Om=Im.omit({_id:!0,revision:!0,contentRef:!0}),_l=ll.omit({_id:!0,_type:!0,contentRef:!0}).partial().extend({id:v().min(1),url:v().min(1).optional(),width:N().positive().optional(),height:N().positive().optional(),content:Om.optional()}).refine(t=>t.width===void 0==(t.height===void 0),{error:"Asset dimensions must include both width and height"}),Cm=O({format:Z("webstudio-content-database"),version:Z(1),revision:pr,usedBytes:N().int().nonnegative(),maxBytes:N().int().positive(),unboundedBytes:N().int().nonnegative(),includedDocumentCount:N().int().nonnegative(),omittedDocumentCount:N().int().nonnegative(),omissionReason:ee(["size","unavailable"]).optional(),truncated:Ve()}),cl=Cm.pick({usedBytes:!0,maxBytes:!0,unboundedBytes:!0,includedDocumentCount:!0,omittedDocumentCount:!0,omissionReason:!0,truncated:!0}),ss=O({items:j(_l),totalCount:N().int().nonnegative(),hasMore:Ve()}),Tm=O({item:_l.nullable(),totalCount:N().int().nonnegative()}),xl=Ct([ss,Tm]),ul=O({line:N().int().positive(),column:N().int().positive(),offset:N().int().nonnegative().optional()}),Nm=O({severity:ee(["error","warning"]),scope:ee(["query","database"]),phase:ee(["metadata","reference","source"]),code:v().min(1),message:v().min(1),assetId:v().min(1),path:v().min(1),line:N().int().positive().optional(),column:N().int().positive().optional(),reference:v().min(1).optional(),nodeType:v().min(1).optional(),reason:v().min(1).optional(),sourceRange:O({start:ul,end:ul}).optional()}),$m=O({severity:ee(["error","warning"]),code:v().min(1),path:j(v()),message:v().min(1)}),zm=O({scope:Z("query-preview"),queryIssues:j($m).optional(),queryWarnings:j(v().min(1)).optional(),query:cl,database:cl,artifacts:O({query:al,database:al}).optional(),unresolved:xl.optional(),issues:j(Nm).optional(),issueCount:N().int().nonnegative().optional(),issuesTruncated:Ve().optional()}),Gb=O({data:xl,__diagnostics__:zm}),Pm=ee(["INVALID_REQUEST","REQUEST_CANCELLED","UNAUTHORIZED","FORBIDDEN","STALE_INDEX","CONTENT_IDENTITY_REQUIRED","CONTENT_NOT_TEXT","CONTENT_DECODING_FAILED","CONTENT_LIMIT_EXCEEDED","MULTIPLE_RESULTS","INTERNAL_ERROR"]),Lm=tt({ok:Z(!1),error:tt({code:Pm,message:v().min(1),retryable:Ve(),details:Ee(v(),nt()).optional()}),meta:tt({queryHash:v().min(1).optional(),indexRevision:v().min(1).optional(),assetRevision:v().min(1).optional()}).optional()}),El=({code:t,message:e,retryable:n=!1,details:r})=>Lm.parse({ok:!1,error:{code:t,message:e,retryable:n,details:r}});var Sl=function*(t){if(t.length>0&&!t.startsWith("/")||/~(?![01])/.test(t))throw Error("Invalid JSON Pointer");let e=1,n=0;for(;n<t.length;){let r=t.indexOf("/",e);n=r===-1?t.length:r;let o=t.slice(e,n);e=n+1,yield Fm(o)}};var is=(t,e)=>e+"/"+Mm(t),Mm=t=>t.toString().replace(/~/g,"~0").replace(/\//g,"~1"),Fm=t=>t.toString().replace(/~1/g,"/").replace(/~0/g,"~");var hr=async(t,e,n)=>{if(Number.isSafeInteger(e)===!1||e<=0)throw new Error("Concurrency must be a positive safe integer");let r=0,o=new Array(t.length),s=async()=>{for(;r<t.length;){let u=r;r+=1,o[u]=await n(t[u])}},i=Array.from({length:Math.min(e,t.length)},s),c=(await Promise.allSettled(i)).find(u=>u.status==="rejected");if(c!==void 0)throw c.reason;return o};var Mt=t=>typeof t=="object"&&t!==null&&Array.isArray(t)===!1,yr=t=>{if(Mt(t)===!1)return;let e=Object.keys(t);if(!(e.length!==1||e[0]!=="$ref"))return t.$ref};var de=class extends Error{code;referenceId;constructor({code:e,message:n,referenceId:r,cause:o}){super(n,{cause:o}),this.name="JsonDocumentError",this.code=e,this.referenceId=r}},Zm=(t,e)=>{let n=yr(t);if(n!==void 0){if(typeof n!="string")throw new de({code:"INVALID_REFERENCE_MARKER",message:`JSON reference marker ${e} must contain a string $ref`,referenceId:e});return n}},Bm=t=>`#${t}`;var Al=async({source:t,maximumBytes:e=k.hydratedFileBytes})=>{let n;try{n=await Te(t,e)}catch(o){throw o instanceof se?new de({code:"CONTENT_LIMIT_EXCEEDED",message:"JSON document exceeds the byte limit",cause:o}):o}let r;try{r=Pt(le(n))}catch(o){throw new de({code:"CONTENT_DECODING_FAILED",message:"JSON document is not valid UTF-8",cause:o})}try{return rt(JSON.parse(r))}catch(o){throw new de({code:"INVALID_DOCUMENT",message:"JSON document is invalid",cause:o})}};var jm=(t,e)=>{let n=t;for(let r of e){if(Array.isArray(n)){let o=Number(r);if(Number.isSafeInteger(o)===!1||o<0||String(o)!==r||o>=n.length)return;n=n[o];continue}if(Mt(n)&&Object.hasOwn(n,r)){n=n[r];continue}return}return n},vl=({document:t,representation:e})=>{let n=rt(t);if(e.type==="document")return n;if(e.type!=="json")throw new de({code:"UNSUPPORTED_REPRESENTATION",message:`JSON documents do not support ${e.type}`});let r=jm(n,e.path);if(r===void 0)throw new de({code:"JSON_PATH_NOT_FOUND",message:"JSON document path does not exist"});return r},Um=(t,e,n)=>{Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0})},gr=({document:t,references:e,allowUnresolvedReferences:n=!1})=>{let r=rt(t),o=new Set,s=(a,c)=>{let u=Bm(c);if(Zm(a,u)!==void 0){if(e.has(u)===!1){if(n)return a;throw new de({code:"REFERENCE_NOT_FOUND",message:`Resolved JSON reference ${u} is unavailable`,referenceId:u})}o.add(u);try{return rt(e.get(u))}catch(l){throw new de({code:"INVALID_RESOLVED_VALUE",message:`Resolved JSON reference ${u} is not JSON-compatible`,referenceId:u,cause:l})}}if(Array.isArray(a))return a.map((l,f)=>s(l,is(String(f),c)));if(Mt(a)){let l={};for(let[f,p]of Object.entries(a))Um(l,f,s(p,is(f,c)));return l}return a},i=s(r,"");for(let a of[...e.keys()].sort())if(o.has(a)===!1)throw new de({code:"UNUSED_REFERENCE",message:`Resolved JSON reference ${a} has no marker`,referenceId:a});return i};var br=Symbol.for("yaml.alias"),wr=Symbol.for("yaml.document"),Se=Symbol.for("yaml.map"),as=Symbol.for("yaml.pair"),pe=Symbol.for("yaml.scalar"),Ge=Symbol.for("yaml.seq"),ie=Symbol.for("yaml.node.type"),he=t=>!!t&&typeof t=="object"&&t[ie]===br,ze=t=>!!t&&typeof t=="object"&&t[ie]===wr,ye=t=>!!t&&typeof t=="object"&&t[ie]===Se,$=t=>!!t&&typeof t=="object"&&t[ie]===as,T=t=>!!t&&typeof t=="object"&&t[ie]===pe,ge=t=>!!t&&typeof t=="object"&&t[ie]===Ge;function B(t){if(t&&typeof t=="object")switch(t[ie]){case Se:case Ge:return!0}return!1}function z(t){if(t&&typeof t=="object")switch(t[ie]){case br:case Se:case pe:case Ge:return!0}return!1}var _r=t=>(T(t)||B(t))&&!!t.anchor;var ce=Symbol("break visit"),Dl=Symbol("skip children"),Pe=Symbol("remove node");function Le(t,e){let n=Rl(e);ze(t)?Ft(null,t.contents,n,Object.freeze([t]))===Pe&&(t.contents=null):Ft(null,t,n,Object.freeze([]))}Le.BREAK=ce;Le.SKIP=Dl;Le.REMOVE=Pe;function Ft(t,e,n,r){let o=kl(t,e,n,r);if(z(o)||$(o))return Il(t,r,o),Ft(t,o,n,r);if(typeof o!="symbol"){if(B(e)){r=Object.freeze(r.concat(e));for(let s=0;s<e.items.length;++s){let i=Ft(s,e.items[s],n,r);if(typeof i=="number")s=i-1;else{if(i===ce)return ce;i===Pe&&(e.items.splice(s,1),s-=1)}}}else if($(e)){r=Object.freeze(r.concat(e));let s=Ft("key",e.key,n,r);if(s===ce)return ce;s===Pe&&(e.key=null);let i=Ft("value",e.value,n,r);if(i===ce)return ce;i===Pe&&(e.value=null)}}return o}async function xr(t,e){let n=Rl(e);ze(t)?await Zt(null,t.contents,n,Object.freeze([t]))===Pe&&(t.contents=null):await Zt(null,t,n,Object.freeze([]))}xr.BREAK=ce;xr.SKIP=Dl;xr.REMOVE=Pe;async function Zt(t,e,n,r){let o=await kl(t,e,n,r);if(z(o)||$(o))return Il(t,r,o),Zt(t,o,n,r);if(typeof o!="symbol"){if(B(e)){r=Object.freeze(r.concat(e));for(let s=0;s<e.items.length;++s){let i=await Zt(s,e.items[s],n,r);if(typeof i=="number")s=i-1;else{if(i===ce)return ce;i===Pe&&(e.items.splice(s,1),s-=1)}}}else if($(e)){r=Object.freeze(r.concat(e));let s=await Zt("key",e.key,n,r);if(s===ce)return ce;s===Pe&&(e.key=null);let i=await Zt("value",e.value,n,r);if(i===ce)return ce;i===Pe&&(e.value=null)}}return o}function Rl(t){return typeof t=="object"&&(t.Collection||t.Node||t.Value)?Object.assign({Alias:t.Node,Map:t.Node,Scalar:t.Node,Seq:t.Node},t.Value&&{Map:t.Value,Scalar:t.Value,Seq:t.Value},t.Collection&&{Map:t.Collection,Seq:t.Collection},t):t}function kl(t,e,n,r){if(typeof n=="function")return n(t,e,r);if(ye(e))return n.Map?.(t,e,r);if(ge(e))return n.Seq?.(t,e,r);if($(e))return n.Pair?.(t,e,r);if(T(e))return n.Scalar?.(t,e,r);if(he(e))return n.Alias?.(t,e,r)}function Il(t,e,n){let r=e[e.length-1];if(B(r))r.items[t]=n;else if($(r))t==="key"?r.key=n:r.value=n;else if(ze(r))r.contents=n;else{let o=he(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}var Qm={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},Vm=t=>t.replace(/[!,[\]{}]/g,e=>Qm[e]),Me=class t{constructor(e,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},t.defaultYaml,e),this.tags=Object.assign({},t.defaultTags,n)}clone(){let e=new t(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new t(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:t.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},t.defaultTags);break}return e}add(e,n){this.atNextDocument&&(this.yaml={explicit:t.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},t.defaultTags),this.atNextDocument=!1);let r=e.trim().split(/[ \t]+/),o=r.shift();switch(o){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,i]=r;return this.tags[s]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let i=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,i),!1}}default:return n(0,`Unknown directive ${o}`,!0),!1}}tagName(e,n){if(e==="!")return"!";if(e[0]!=="!")return n(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let i=e.slice(2,-1);return i==="!"||i==="!!"?(n(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&n("Verbatim tags must end with a >"),i)}let[,r,o]=e.match(/^(.*!)([^!]*)$/s);o||n(`The ${e} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(o)}catch(i){return n(String(i)),null}return r==="!"?e:(n(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[n,r]of Object.entries(this.tags))if(e.startsWith(r))return n+Vm(e.substring(r.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),o;if(e&&r.length>0&&z(e.contents)){let s={};Le(e.contents,(i,a)=>{z(a)&&a.tag&&(s[a.tag]=!0)}),o=Object.keys(s)}else o=[];for(let[s,i]of r)s==="!!"&&i==="tag:yaml.org,2002:"||(!e||o.some(a=>a.startsWith(i)))&&n.push(`%TAG ${s} ${i}`);return n.join(`
65
- `)}};Me.defaultYaml={explicit:!1,version:"1.2"};Me.defaultTags={"!!":"tag:yaml.org,2002:"};function Er(t){if(/[\x00-\x19\s,[\]{}]/.test(t)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(t)}`;throw new Error(n)}return!0}function cs(t){let e=new Set;return Le(t,{Value(n,r){r.anchor&&e.add(r.anchor)}}),e}function us(t,e){for(let n=1;;++n){let r=`${t}${n}`;if(!e.has(r))return r}}function Ol(t,e){let n=[],r=new Map,o=null;return{onAnchor:s=>{n.push(s),o??(o=cs(t));let i=us(e,o);return o.add(i),i},setAnchors:()=>{for(let s of n){let i=r.get(s);if(typeof i=="object"&&i.anchor&&(T(i.node)||B(i.node)))i.node.anchor=i.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:r}}function st(t,e,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let o=0,s=r.length;o<s;++o){let i=r[o],a=st(t,r,String(o),i);a===void 0?delete r[o]:a!==i&&(r[o]=a)}else if(r instanceof Map)for(let o of Array.from(r.keys())){let s=r.get(o),i=st(t,r,o,s);i===void 0?r.delete(o):i!==s&&r.set(o,i)}else if(r instanceof Set)for(let o of Array.from(r)){let s=st(t,r,o,o);s===void 0?r.delete(o):s!==o&&(r.delete(o),r.add(s))}else for(let[o,s]of Object.entries(r)){let i=st(t,r,o,s);i===void 0?delete r[o]:i!==s&&(r[o]=i)}return t.call(e,n,r)}function H(t,e,n){if(Array.isArray(t))return t.map((r,o)=>H(r,String(o),n));if(t&&typeof t.toJSON=="function"){if(!n||!_r(t))return t.toJSON(e,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(t,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let o=t.toJSON(e,n);return n.onCreate&&n.onCreate(o),o}return typeof t=="bigint"&&!n?.keep?Number(t):t}var it=class{constructor(e){Object.defineProperty(this,ie,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:n,maxAliasCount:r,onAnchor:o,reviver:s}={}){if(!ze(e))throw new TypeError("A document argument is required");let i={anchors:new Map,doc:e,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=H(this,"",i);if(typeof o=="function")for(let{count:c,res:u}of i.anchors.values())o(u,c);return typeof s=="function"?st(s,{"":a},"",a):a}};var qe=class extends it{constructor(e){super(br),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],Le(e,{Node:(s,i)=>{(he(i)||_r(i))&&r.push(i)}}),n&&(n.aliasResolveCache=r));let o;for(let s of r){if(s===this)break;s.anchor===this.source&&(o=s)}return o}toJSON(e,n){if(!n)return{source:this.source};let{anchors:r,doc:o,maxAliasCount:s}=n,i=this.resolve(o,n);if(!i){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(i);if(a||(H(i,null,n),a=r.get(i)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Sr(o,i,r)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(e,n,r){let o=`*${this.source}`;if(e){if(Er(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(e.implicitKey)return`${o} `}return o}};function Sr(t,e,n){if(he(e)){let r=e.resolve(t),o=n&&r&&n.get(r);return o?o.count*o.aliasCount:0}else if(B(e)){let r=0;for(let o of e.items){let s=Sr(t,o,n);s>r&&(r=s)}return r}else if($(e)){let r=Sr(t,e.key,n),o=Sr(t,e.value,n);return Math.max(r,o)}return 1}var Ar=t=>!t||typeof t!="function"&&typeof t!="object",R=class extends it{constructor(e){super(pe),this.value=e}toJSON(e,n){return n?.keep?this.value:H(this.value,e,n)}toString(){return String(this.value)}};R.BLOCK_FOLDED="BLOCK_FOLDED";R.BLOCK_LITERAL="BLOCK_LITERAL";R.PLAIN="PLAIN";R.QUOTE_DOUBLE="QUOTE_DOUBLE";R.QUOTE_SINGLE="QUOTE_SINGLE";var Gm="tag:yaml.org,2002:";function qm(t,e,n){if(e){let r=n.filter(s=>s.tag===e),o=r.find(s=>!s.format)??r[0];if(!o)throw new Error(`Tag ${e} not found`);return o}return n.find(r=>r.identify?.(t)&&!r.format)}function Je(t,e,n){if(ze(t)&&(t=t.contents),z(t))return t;if($(t)){let l=n.schema[Se].createNode?.(n.schema,null,n);return l.items.push(t),l}(t instanceof String||t instanceof Number||t instanceof Boolean||typeof BigInt<"u"&&t instanceof BigInt)&&(t=t.valueOf());let{aliasDuplicateObjects:r,onAnchor:o,onTagObj:s,schema:i,sourceObjects:a}=n,c;if(r&&t&&typeof t=="object"){if(c=a.get(t),c)return c.anchor??(c.anchor=o(t)),new qe(c.anchor);c={anchor:null,node:null},a.set(t,c)}e?.startsWith("!!")&&(e=Gm+e.slice(2));let u=qm(t,e,i.tags);if(!u){if(t&&typeof t.toJSON=="function"&&(t=t.toJSON()),!t||typeof t!="object"){let l=new R(t);return c&&(c.node=l),l}u=t instanceof Map?i[Se]:Symbol.iterator in Object(t)?i[Ge]:i[Se]}s&&(s(u),delete n.onTagObj);let d=u?.createNode?u.createNode(n.schema,t,n):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(n.schema,t,n):new R(t);return e?d.tag=e:u.default||(d.tag=u.tag),c&&(c.node=d),d}function An(t,e,n){let r=n;for(let o=e.length-1;o>=0;--o){let s=e[o];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let i=[];i[s]=r,r=i}else r=new Map([[s,r]])}return Je(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:t,sourceObjects:new Map})}var jt=t=>t==null||typeof t=="object"&&!!t[Symbol.iterator]().next().done,Bt=class extends it{constructor(e,n){super(e),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(e){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(n.schema=e),n.items=n.items.map(r=>z(r)||$(r)?r.clone(e):r),this.range&&(n.range=this.range.slice()),n}addIn(e,n){if(jt(e))this.add(n);else{let[r,...o]=e,s=this.get(r,!0);if(B(s))s.addIn(o,n);else if(s===void 0&&this.schema)this.set(r,An(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}deleteIn(e){let[n,...r]=e;if(r.length===0)return this.delete(n);let o=this.get(n,!0);if(B(o))return o.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(e,n){let[r,...o]=e,s=this.get(r,!0);return o.length===0?!n&&T(s)?s.value:s:B(s)?s.getIn(o,n):void 0}hasAllNullValues(e){return this.items.every(n=>{if(!$(n))return!1;let r=n.value;return r==null||e&&T(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(e){let[n,...r]=e;if(r.length===0)return this.has(n);let o=this.get(n,!0);return B(o)?o.hasIn(r):!1}setIn(e,n){let[r,...o]=e;if(o.length===0)this.set(r,n);else{let s=this.get(r,!0);if(B(s))s.setIn(o,n);else if(s===void 0&&this.schema)this.set(r,An(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}};var Cl=t=>t.replace(/^(?!$)(?: $)?/gm,"#");function be(t,e){return/^\n+$/.test(t)?t.substring(1):e?t.replace(/^(?! *$)/gm,e):t}var Fe=(t,e,n)=>t.endsWith(`
66
- `)?be(n,e):n.includes(`
64
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let i of e.seen.entries()){let a=i[1];if(t===i[0]){s(i);continue}if(e.external){let u=e.external.registry.get(i[0])?.id;if(t!==i[0]&&u){s(i);continue}}if(e.metadataRegistry.get(i[0])?.id){s(i);continue}if(a.cycle){s(i);continue}if(a.count>1&&e.reused==="ref"){s(i);continue}}}function Ks(e,t){let n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");let r=a=>{let c=e.seen.get(a);if(c.ref===null)return;let u=c.def??c.schema,f={...u},l=c.ref;if(c.ref=null,l){r(l);let d=e.seen.get(l),w=d.schema;if(w.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(u.allOf=u.allOf??[],u.allOf.push(w)):Object.assign(u,w),Object.assign(u,f),a._zod.parent===l)for(let y in u)y==="$ref"||y==="allOf"||y in f||delete u[y];if(w.$ref&&d.def)for(let y in u)y==="$ref"||y==="allOf"||y in d.def&&JSON.stringify(u[y])===JSON.stringify(d.def[y])&&delete u[y]}let p=a._zod.parent;if(p&&p!==l){r(p);let d=e.seen.get(p);if(d?.schema.$ref&&(u.$ref=d.schema.$ref,d.def))for(let w in u)w==="$ref"||w==="allOf"||w in d.def&&JSON.stringify(u[w])===JSON.stringify(d.def[w])&&delete u[w]}e.override({zodSchema:a,jsonSchema:u,path:c.path??[]})};for(let a of[...e.seen.entries()].reverse())r(a[0]);let o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,e.external?.uri){let a=e.external.registry.get(t)?.id;if(!a)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(a)}Object.assign(o,n.def??n.schema);let s=e.metadataRegistry.get(t)?.id;s!==void 0&&o.id===s&&delete o.id;let i=e.external?.defs??{};for(let a of e.seen.entries()){let c=a[1];c.def&&c.defId&&(c.def.id===c.defId&&delete c.def.id,i[c.defId]=c.def)}e.external||Object.keys(i).length>0&&(e.target==="draft-2020-12"?o.$defs=i:o.definitions=i);try{let a=JSON.parse(JSON.stringify(o));return Object.defineProperty(a,"~standard",{value:{...t["~standard"],jsonSchema:{input:Gn(t,"input",e.processors),output:Gn(t,"output",e.processors)}},enumerable:!1,writable:!1}),a}catch{throw new Error("Error converting schema to JSON.")}}function be(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return be(r.element,n);if(r.type==="set")return be(r.valueType,n);if(r.type==="lazy")return be(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return be(r.innerType,n);if(r.type==="intersection")return be(r.left,n)||be(r.right,n);if(r.type==="record"||r.type==="map")return be(r.keyType,n)||be(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:be(r.in,n)||be(r.out,n);if(r.type==="object"){for(let o in r.shape)if(be(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(let o of r.options)if(be(o,n))return!0;return!1}if(r.type==="tuple"){for(let o of r.items)if(be(o,n))return!0;return!!(r.rest&&be(r.rest,n))}return!1}var gl=(e,t={})=>n=>{let r=Js({...n,processors:t});return re(e,r),Ws(r,e),Ks(r,e)},Gn=(e,t,n={})=>r=>{let{libraryOptions:o,target:s}=r??{},i=Js({...o??{},target:s,io:t,processors:n});return re(e,i),Ws(i,e),Ks(i,e)};var Wm={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},yl=(e,t,n,r)=>{let o=n;o.type="string";let{minimum:s,maximum:i,format:a,patterns:c,contentEncoding:u}=e._zod.bag;if(typeof s=="number"&&(o.minLength=s),typeof i=="number"&&(o.maxLength=i),a&&(o.format=Wm[a]??a,o.format===""&&delete o.format,a==="time"&&delete o.format),u&&(o.contentEncoding=u),c&&c.size>0){let f=[...c];f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(l=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:l.source}))])}},bl=(e,t,n,r)=>{let o=n,{minimum:s,maximum:i,format:a,multipleOf:c,exclusiveMaximum:u,exclusiveMinimum:f}=e._zod.bag;typeof a=="string"&&a.includes("int")?o.type="integer":o.type="number";let l=typeof f=="number"&&f>=(s??Number.NEGATIVE_INFINITY),p=typeof u=="number"&&u<=(i??Number.POSITIVE_INFINITY),d=t.target==="draft-04"||t.target==="openapi-3.0";l?d?(o.minimum=f,o.exclusiveMinimum=!0):o.exclusiveMinimum=f:typeof s=="number"&&(o.minimum=s),p?d?(o.maximum=u,o.exclusiveMaximum=!0):o.exclusiveMaximum=u:typeof i=="number"&&(o.maximum=i),typeof c=="number"&&(o.multipleOf=c)},wl=(e,t,n,r)=>{n.type="boolean"};var xl=(e,t,n,r)=>{t.target==="openapi-3.0"?(n.type="string",n.nullable=!0,n.enum=[null]):n.type="null"};var _l=(e,t,n,r)=>{n.not={}};var Sl=(e,t,n,r)=>{};var El=(e,t,n,r)=>{let o=e._zod.def,s=Fn(o.entries);s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),n.enum=s},Al=(e,t,n,r)=>{let o=e._zod.def,s=[];for(let i of o.values)if(i===void 0){if(t.unrepresentable==="throw")throw new Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof i=="bigint"){if(t.unrepresentable==="throw")throw new Error("BigInt literals cannot be represented in JSON Schema");s.push(Number(i))}else s.push(i);if(s.length!==0)if(s.length===1){let i=s[0];n.type=i===null?"null":typeof i,t.target==="draft-04"||t.target==="openapi-3.0"?n.enum=[i]:n.const=i}else s.every(i=>typeof i=="number")&&(n.type="number"),s.every(i=>typeof i=="string")&&(n.type="string"),s.every(i=>typeof i=="boolean")&&(n.type="boolean"),s.every(i=>i===null)&&(n.type="null"),n.enum=s};var kl=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")};var vl=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")};var Rl=(e,t,n,r)=>{let o=n,s=e._zod.def,{minimum:i,maximum:a}=e._zod.bag;typeof i=="number"&&(o.minItems=i),typeof a=="number"&&(o.maxItems=a),o.type="array",o.items=re(s.element,t,{...r,path:[...r.path,"items"]})},Dl=(e,t,n,r)=>{let o=n,s=e._zod.def;o.type="object",o.properties={};let i=s.shape;for(let u in i)o.properties[u]=re(i[u],t,{...r,path:[...r.path,"properties",u]});let a=new Set(Object.keys(i)),c=new Set([...a].filter(u=>{let f=s.shape[u]._zod;return t.io==="input"?f.optin===void 0:f.optout===void 0}));c.size>0&&(o.required=Array.from(c)),s.catchall?._zod.def.type==="never"?o.additionalProperties=!1:s.catchall?s.catchall&&(o.additionalProperties=re(s.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Il=(e,t,n,r)=>{let o=e._zod.def,s=o.inclusive===!1,i=o.options.map((a,c)=>re(a,t,{...r,path:[...r.path,s?"oneOf":"anyOf",c]}));s?n.oneOf=i:n.anyOf=i},Cl=(e,t,n,r)=>{let o=e._zod.def,s=re(o.left,t,{...r,path:[...r.path,"allOf",0]}),i=re(o.right,t,{...r,path:[...r.path,"allOf",1]}),a=u=>"allOf"in u&&Object.keys(u).length===1,c=[...a(s)?s.allOf:[s],...a(i)?i.allOf:[i]];n.allOf=c};var Tl=(e,t,n,r)=>{let o=n,s=e._zod.def;o.type="object";let i=s.keyType,c=i._zod.bag?.patterns;if(s.mode==="loose"&&c&&c.size>0){let f=re(s.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(let l of c)o.patternProperties[l.source]=f}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=re(s.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=re(s.valueType,t,{...r,path:[...r.path,"additionalProperties"]});let u=i._zod.values;if(u){let f=[...u].filter(l=>typeof l=="string"||typeof l=="number");f.length>0&&(o.required=f)}},Ol=(e,t,n,r)=>{let o=e._zod.def,s=re(o.innerType,t,r),i=t.seen.get(e);t.target==="openapi-3.0"?(i.ref=o.innerType,n.nullable=!0):n.anyOf=[s,{type:"null"}]},Nl=(e,t,n,r)=>{let o=e._zod.def;re(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType},zl=(e,t,n,r)=>{let o=e._zod.def;re(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},$l=(e,t,n,r)=>{let o=e._zod.def;re(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Ll=(e,t,n,r)=>{let o=e._zod.def;re(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType;let i;try{i=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=i},Pl=(e,t,n,r)=>{let o=e._zod.def,s=o.in._zod.traits.has("$ZodTransform"),i=t.io==="input"?s?o.out:o.in:o.out;re(i,t,r);let a=t.seen.get(e);a.ref=i},Fl=(e,t,n,r)=>{let o=e._zod.def;re(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType,n.readOnly=!0};var Hs=(e,t,n,r)=>{let o=e._zod.def;re(o.innerType,t,r);let s=t.seen.get(e);s.ref=o.innerType},Ml=(e,t,n,r)=>{let o=e._zod.innerType;re(o,t,r);let s=t.seen.get(e);s.ref=o};var nh=k("ZodISODateTime",(e,t)=>{Kc.init(e,t),te.init(e,t)});function Bl(e){return rl(nh,e)}var rh=k("ZodISODate",(e,t)=>{Hc.init(e,t),te.init(e,t)});function ql(e){return ol(rh,e)}var oh=k("ZodISOTime",(e,t)=>{Yc.init(e,t),te.init(e,t)});function Zl(e){return sl(oh,e)}var sh=k("ZodISODuration",(e,t)=>{Xc.init(e,t),te.init(e,t)});function Ul(e){return il(sh,e)}var jl=(e,t)=>{$r.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>Ta(e,n)},flatten:{value:n=>Ca(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,nn,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,nn,2)}},isEmpty:{get(){return e.issues.length===0}}})},Vl=k("ZodError",jl),ke=k("ZodError",jl,{Parent:Error});var Ql=Lr(ke),Gl=Pr(ke),Jl=Zn(ke),Wl=Un(ke),Kl=za(ke),Hl=$a(ke),Yl=La(ke),Xl=Pa(ke),ef=Fa(ke),tf=Ma(ke),nf=Ba(ke),rf=qa(ke);var of=new WeakMap;function Jn(e,t,n){let r=Object.getPrototypeOf(e),o=of.get(r);if(o||(o=new Set,of.set(r,o)),!o.has(t)){o.add(t);for(let s in n){let i=n[s];Object.defineProperty(r,s,{configurable:!0,enumerable:!1,get(){let a=i.bind(this);return Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a}),a},set(a){Object.defineProperty(this,s,{configurable:!0,writable:!0,enumerable:!0,value:a})}})}}}var ee=k("ZodType",(e,t)=>(Y.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Gn(e,"input"),output:Gn(e,"output")}}),e.toJSONSchema=gl(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>Ql(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Jl(e,n,r),e.parseAsync=async(n,r)=>Gl(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>Wl(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Kl(e,n,r),e.decode=(n,r)=>Hl(e,n,r),e.encodeAsync=async(n,r)=>Yl(e,n,r),e.decodeAsync=async(n,r)=>Xl(e,n,r),e.safeEncode=(n,r)=>ef(e,n,r),e.safeDecode=(n,r)=>tf(e,n,r),e.safeEncodeAsync=async(n,r)=>nf(e,n,r),e.safeDecodeAsync=async(n,r)=>rf(e,n,r),Jn(e,"ZodType",{check(...n){let r=this.def;return this.clone(J.mergeDefs(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Ze(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(tg(n,r))},superRefine(n,r){return this.check(ng(n,r))},overwrite(n){return this.check(St(n))},optional(){return lf(this)},exactOptional(){return qh(this)},nullable(){return ff(this)},nullish(){return lf(ff(this))},nonoptional(n){return Gh(this,n)},array(){return H(this)},or(n){return an([this,n])},and(n){return Lh(this,n)},transform(n){return df(this,Mh(n))},default(n){return jh(this,n)},prefault(n){return Qh(this,n)},catch(n){return Wh(this,n)},pipe(n){return df(this,n)},readonly(){return Yh(this)},describe(n){let r=this.clone();return jt.add(r,{description:n}),r},meta(...n){if(n.length===0)return jt.get(this);let r=this.clone();return jt.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){return jt.get(e)?.description},configurable:!0}),e)),pf=k("_ZodString",(e,t)=>{Zr.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,s)=>yl(e,r,o,s);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,Jn(e,"_ZodString",{regex(...r){return this.check(Ps(...r))},includes(...r){return this.check(Bs(...r))},startsWith(...r){return this.check(qs(...r))},endsWith(...r){return this.check(Zs(...r))},min(...r){return this.check(sn(...r))},max(...r){return this.check(Qr(...r))},length(...r){return this.check(Gr(...r))},nonempty(...r){return this.check(sn(1,...r))},lowercase(r){return this.check(Fs(r))},uppercase(r){return this.check(Ms(r))},trim(){return this.check(js())},normalize(...r){return this.check(Us(...r))},toLowerCase(){return this.check(Vs())},toUpperCase(){return this.check(Qs())},slugify(){return this.check(Gs())}})}),uh=k("ZodString",(e,t)=>{Zr.init(e,t),pf.init(e,t),e.email=n=>e.check(Lu(lh,n)),e.url=n=>e.check(qu(fh,n)),e.jwt=n=>e.check(nl(vh,n)),e.emoji=n=>e.check(Zu(dh,n)),e.guid=n=>e.check(Ls(sf,n)),e.uuid=n=>e.check(Pu(Wr,n)),e.uuidv4=n=>e.check(Fu(Wr,n)),e.uuidv6=n=>e.check(Mu(Wr,n)),e.uuidv7=n=>e.check(Bu(Wr,n)),e.nanoid=n=>e.check(Uu(ph,n)),e.guid=n=>e.check(Ls(sf,n)),e.cuid=n=>e.check(ju(mh,n)),e.cuid2=n=>e.check(Vu(hh,n)),e.ulid=n=>e.check(Qu(gh,n)),e.base64=n=>e.check(Xu(Eh,n)),e.base64url=n=>e.check(el(Ah,n)),e.xid=n=>e.check(Gu(yh,n)),e.ksuid=n=>e.check(Ju(bh,n)),e.ipv4=n=>e.check(Wu(wh,n)),e.ipv6=n=>e.check(Ku(xh,n)),e.cidrv4=n=>e.check(Hu(_h,n)),e.cidrv6=n=>e.check(Yu(Sh,n)),e.e164=n=>e.check(tl(kh,n)),e.datetime=n=>e.check(Bl(n)),e.date=n=>e.check(ql(n)),e.time=n=>e.check(Zl(n)),e.duration=n=>e.check(Ul(n))});function D(e){return $u(uh,e)}var te=k("ZodStringFormat",(e,t)=>{X.init(e,t),pf.init(e,t)}),lh=k("ZodEmail",(e,t)=>{qc.init(e,t),te.init(e,t)});var sf=k("ZodGUID",(e,t)=>{Mc.init(e,t),te.init(e,t)});var Wr=k("ZodUUID",(e,t)=>{Bc.init(e,t),te.init(e,t)});var fh=k("ZodURL",(e,t)=>{Zc.init(e,t),te.init(e,t)});var dh=k("ZodEmoji",(e,t)=>{Uc.init(e,t),te.init(e,t)});var ph=k("ZodNanoID",(e,t)=>{jc.init(e,t),te.init(e,t)});var mh=k("ZodCUID",(e,t)=>{Vc.init(e,t),te.init(e,t)});var hh=k("ZodCUID2",(e,t)=>{Qc.init(e,t),te.init(e,t)});var gh=k("ZodULID",(e,t)=>{Gc.init(e,t),te.init(e,t)});var yh=k("ZodXID",(e,t)=>{Jc.init(e,t),te.init(e,t)});var bh=k("ZodKSUID",(e,t)=>{Wc.init(e,t),te.init(e,t)});var wh=k("ZodIPv4",(e,t)=>{eu.init(e,t),te.init(e,t)});var xh=k("ZodIPv6",(e,t)=>{tu.init(e,t),te.init(e,t)});var _h=k("ZodCIDRv4",(e,t)=>{nu.init(e,t),te.init(e,t)});var Sh=k("ZodCIDRv6",(e,t)=>{ru.init(e,t),te.init(e,t)});var Eh=k("ZodBase64",(e,t)=>{su.init(e,t),te.init(e,t)});var Ah=k("ZodBase64URL",(e,t)=>{iu.init(e,t),te.init(e,t)});var kh=k("ZodE164",(e,t)=>{au.init(e,t),te.init(e,t)});var vh=k("ZodJWT",(e,t)=>{cu.init(e,t),te.init(e,t)});var mf=k("ZodNumber",(e,t)=>{Os.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,s)=>bl(e,r,o,s),Jn(e,"ZodNumber",{gt(r,o){return this.check(jr(r,o))},gte(r,o){return this.check(Qn(r,o))},min(r,o){return this.check(Qn(r,o))},lt(r,o){return this.check(Ur(r,o))},lte(r,o){return this.check(Vn(r,o))},max(r,o){return this.check(Vn(r,o))},int(r){return this.check(af(r))},safe(r){return this.check(af(r))},positive(r){return this.check(jr(0,r))},nonnegative(r){return this.check(Qn(0,r))},negative(r){return this.check(Ur(0,r))},nonpositive(r){return this.check(Vn(0,r))},multipleOf(r,o){return this.check(Vr(r,o))},step(r,o){return this.check(Vr(r,o))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??Number.NEGATIVE_INFINITY,n.exclusiveMinimum??Number.NEGATIVE_INFINITY)??null,e.maxValue=Math.min(n.maximum??Number.POSITIVE_INFINITY,n.exclusiveMaximum??Number.POSITIVE_INFINITY)??null,e.isInt=(n.format??"").includes("int")||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function U(e){return al(mf,e)}var Rh=k("ZodNumberFormat",(e,t)=>{uu.init(e,t),mf.init(e,t)});function af(e){return cl(Rh,e)}var Dh=k("ZodBoolean",(e,t)=>{lu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>wl(e,n,r,o)});function pt(e){return ul(Dh,e)}var Ih=k("ZodNull",(e,t)=>{fu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>xl(e,n,r,o)});function Ch(e){return ll(Ih,e)}var Th=k("ZodUnknown",(e,t)=>{du.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Sl(e,n,r,o)});function cf(){return fl(Th)}var Oh=k("ZodNever",(e,t)=>{pu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>_l(e,n,r,o)});function hf(e){return dl(Oh,e)}var Nh=k("ZodArray",(e,t)=>{mu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Rl(e,n,r,o),e.element=t.element,Jn(e,"ZodArray",{min(n,r){return this.check(sn(n,r))},nonempty(n){return this.check(sn(1,n))},max(n,r){return this.check(Qr(n,r))},length(n,r){return this.check(Gr(n,r))},unwrap(){return this.element}})});function H(e,t){return pl(Nh,e,t)}var gf=k("ZodObject",(e,t)=>{yu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Dl(e,n,r,o),J.defineLazy(e,"shape",()=>t.shape),Jn(e,"ZodObject",{keyof(){return fe(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:cf()})},loose(){return this.clone({...this._zod.def,catchall:cf()})},strict(){return this.clone({...this._zod.def,catchall:hf()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return J.extend(this,n)},safeExtend(n){return J.safeExtend(this,n)},merge(n){return J.merge(this,n)},pick(n){return J.pick(this,n)},omit(n){return J.omit(this,n)},partial(...n){return J.partial(bf,this,n[0])},required(...n){return J.required(wf,this,n[0])}})});function Et(e,t){let n={type:"object",shape:e??{},...J.normalizeParams(t)};return new gf(n)}function L(e,t){return new gf({type:"object",shape:e,catchall:hf(),...J.normalizeParams(t)})}var yf=k("ZodUnion",(e,t)=>{Ns.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Il(e,n,r,o),e.options=t.options});function an(e,t){return new yf({type:"union",options:e,...J.normalizeParams(t)})}var zh=k("ZodDiscriminatedUnion",(e,t)=>{yf.init(e,t),bu.init(e,t)});function cn(e,t,n){return new zh({type:"union",options:t,discriminator:e,...J.normalizeParams(n)})}var $h=k("ZodIntersection",(e,t)=>{wu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Cl(e,n,r,o)});function Lh(e,t){return new $h({type:"intersection",left:e,right:t})}var uf=k("ZodRecord",(e,t)=>{xu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Tl(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function Ne(e,t,n){return!t||!t._zod?new uf({type:"record",keyType:D(),valueType:e,...J.normalizeParams(t)}):new uf({type:"record",keyType:e,valueType:t,...J.normalizeParams(n)})}var Ys=k("ZodEnum",(e,t)=>{_u.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(r,o,s)=>El(e,r,o,s),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{let s={};for(let i of r)if(n.has(i))s[i]=t.entries[i];else throw new Error(`Key ${i} not found in enum`);return new Ys({...t,checks:[],...J.normalizeParams(o),entries:s})},e.exclude=(r,o)=>{let s={...t.entries};for(let i of r)if(n.has(i))delete s[i];else throw new Error(`Key ${i} not found in enum`);return new Ys({...t,checks:[],...J.normalizeParams(o),entries:s})}});function fe(e,t){let n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Ys({type:"enum",entries:n,...J.normalizeParams(t)})}var Ph=k("ZodLiteral",(e,t)=>{Su.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Al(e,n,r,o),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw new Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function W(e,t){return new Ph({type:"literal",values:Array.isArray(e)?e:[e],...J.normalizeParams(t)})}var Fh=k("ZodTransform",(e,t)=>{Eu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>vl(e,n,r,o),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new en(e.constructor.name);n.addIssue=s=>{if(typeof s=="string")n.issues.push(J.issue(s,n.value,t));else{let i=s;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=n.value),i.inst??(i.inst=e),n.issues.push(J.issue(i))}};let o=t.transform(n.value,n);return o instanceof Promise?o.then(s=>(n.value=s,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function Mh(e){return new Fh({type:"transform",transform:e})}var bf=k("ZodOptional",(e,t)=>{zs.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function lf(e){return new bf({type:"optional",innerType:e})}var Bh=k("ZodExactOptional",(e,t)=>{Au.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hs(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function qh(e){return new Bh({type:"optional",innerType:e})}var Zh=k("ZodNullable",(e,t)=>{ku.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ol(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ff(e){return new Zh({type:"nullable",innerType:e})}var Uh=k("ZodDefault",(e,t)=>{vu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>zl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function jh(e,t){return new Uh({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():J.shallowClone(t)}})}var Vh=k("ZodPrefault",(e,t)=>{Ru.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$l(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Qh(e,t){return new Vh({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():J.shallowClone(t)}})}var wf=k("ZodNonOptional",(e,t)=>{Du.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Nl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Gh(e,t){return new wf({type:"nonoptional",innerType:e,...J.normalizeParams(t)})}var Jh=k("ZodCatch",(e,t)=>{Iu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ll(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Wh(e,t){return new Jh({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}var Kh=k("ZodPipe",(e,t)=>{Cu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Pl(e,n,r,o),e.in=t.in,e.out=t.out});function df(e,t){return new Kh({type:"pipe",in:e,out:t})}var Hh=k("ZodReadonly",(e,t)=>{Tu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Fl(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Yh(e){return new Hh({type:"readonly",innerType:e})}var Xh=k("ZodLazy",(e,t)=>{Ou.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Ml(e,n,r,o),e.unwrap=()=>e._zod.def.getter()});function Xs(e){return new Xh({type:"lazy",getter:e})}var eg=k("ZodCustom",(e,t)=>{Nu.init(e,t),ee.init(e,t),e._zod.processJSONSchema=(n,r,o)=>kl(e,n,r,o)});function tg(e,t={}){return ml(eg,e,t)}function ng(e,t){return hl(e,t)}function At(e){let t=Xs(()=>an([D(e),U(),pt(),Ch(),H(t),Ne(D(),t)]));return t}var xf=e=>"field"in e?[e]:("all"in e?e.all:e.any).flatMap(xf),Kr=e=>xf(e);var un=(e,t)=>{if("field"in e)return t(e);let n="all"in e?e.all:e.any,r=!1;if("all"in e){for(let o of n){let s=un(o,t);if(s===!1)return!1;r||=s===void 0}return r?void 0:!0}for(let o of n){let s=un(o,t);if(s===!0)return!0;r||=s===void 0}return r?void 0:!1},_f=e=>JSON.stringify(e),ei=e=>{if("field"in e)return{conditions:1,depth:0};let t="all"in e?e.all:e.any,n=0,r=1;for(let o of t){let s=ei(o);n+=s.conditions,r=Math.max(r,s.depth+1)}return{conditions:n,depth:r}},Sf=(e,t={})=>{let n=o=>{let s=H(o),i=t.maximumChildren===void 0?s:s.max(t.maximumChildren);return an([e,L({all:i}),L({any:i})])},r=Xs(()=>n(r));return t.maximumConditions===void 0&&t.maximumDepth===void 0?r:r.superRefine((o,s)=>{let{conditions:i,depth:a}=ei(o);t.maximumConditions!==void 0&&i>t.maximumConditions&&s.addIssue({code:"custom",message:t.maximumConditionsMessage??"Query exceeds the condition limit"}),t.maximumDepth!==void 0&&a>t.maximumDepth&&s.addIssue({code:"custom",message:t.maximumDepthMessage??"Query exceeds the nesting limit"})})};var N={requestBytes:524288,filterCount:32,filterDepth:8,sortCount:8,outputFieldCount:256,fieldPathDepth:9,defaultResultCount:20,resultCount:1e3,resultBytes:16777216,candidateDocuments:1e3,databaseBytes:512e3,frontmatterBytes:65536,frontmatterDepth:8,frontmatterFields:256,frontmatterStringBytes:16384,jsonBytes:1048576,jsonDepth:8,jsonFields:256,jsonStringBytes:16384,indexedPropertiesBytes:65536,excerptBytes:2048,mdxDepth:100,mdxNodes:2e4,mdxProps:4e3,hydratedFileBytes:1048576,hydratedTotalBytes:2097152,hydratedFileCount:20,hydratedRangeBytes:262144,concurrentContentReads:8};function Vt(e,t=new Set){if(typeof e=="number"&&isNaN(e))throw new Error("NaN is not allowed");if(typeof e=="number"&&!isFinite(e))throw new Error("Infinity is not allowed");if(e===null||typeof e!="object")return JSON.stringify(e);if(typeof e.toJSON=="function"){if(t.has(e))throw new Error("Circular reference detected");t.add(e);let r=Vt(e.toJSON(),t);return t.delete(e),r}if(t.has(e))throw new Error("Circular reference detected");t.add(e);let n;if(Array.isArray(e))n=`[${e.map(o=>Vt(o===void 0||typeof o=="symbol"?null:o,t)).join(",")}]`;else{let r=[];for(let o of Object.keys(e).sort())e[o]===void 0||typeof e[o]=="symbol"||r.push(`${Vt(o)}:${Vt(e[o],t)}`);n=`{${r.join(",")}}`}return t.delete(e),n}var rg=new TextEncoder,kt=e=>rg.encode(e),Ye=e=>kt(e).byteLength,we=class extends Error{constructor(){super("Byte stream exceeds the configured limit"),this.name="ByteLimitExceededError"}},og=(e,t)=>{let n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.byteLength;return n},Wn=e=>typeof e=="string"?{async*[Symbol.asyncIterator](){yield kt(e)}}:e instanceof Uint8Array?{async*[Symbol.asyncIterator](){yield e}}:e,Hr=(e,t)=>t===void 0?Wn(e):{async*[Symbol.asyncIterator](){let n=0,r=0;for await(let o of Wn(e)){if(r===t.length)return;if(n+o.byteLength<=t.offset){n+=o.byteLength;continue}let s=Math.max(0,t.offset-n),i=Math.min(o.byteLength-s,t.length-r);i>0&&(yield o.subarray(s,s+i),r+=i),n+=o.byteLength}}},Yr=e=>({async*[Symbol.asyncIterator](){let t=e.getReader(),n=!1;try{for(;;){let r=await t.read();if(r.done){n=!0;return}yield r.value}}finally{if(n===!1)try{await t.cancel()}catch{}t.releaseLock()}}}),ti=async(e,t)=>{let n=[],r=0;for await(let o of Wn(e)){let s=t-r;if(s<=0)break;let i=o.subarray(0,s);if(n.push(i),r+=i.byteLength,r===t)break}return og(n,r)},Xe=async(e,t)=>{let n=await ti(e,t+1);if(n.byteLength>t)throw new we;return n},ve=e=>new TextDecoder("utf-8",{fatal:!0}).decode(e),ln=e=>e.charCodeAt(0)===65279?e.slice(1):e;var Ef=e=>{for(let t=0;t<e.length;t+=1){let n=e.charCodeAt(t);if(n>=55296&&n<=56319){let r=e.charCodeAt(t+1);if(t+1>=e.length||r<56320||r>57343)throw new Error("JSON strings cannot contain lone Unicode surrogates");t+=1;continue}if(n>=56320&&n<=57343)throw new Error("JSON strings cannot contain lone Unicode surrogates")}},ni=(e,t)=>{if(e===null||typeof e=="boolean")return e;if(typeof e=="string")return Ef(e),e;if(typeof e=="number"){if(Number.isFinite(e)===!1)throw new Error("JSON cannot contain non-finite numbers");return e}if(Array.isArray(e)){if(Object.getOwnPropertySymbols(e).length>0)throw new Error("JSON arrays cannot contain symbol properties");if(t.has(e))throw new Error("JSON cannot contain circular references");t.add(e);try{let n=[];for(let r=0;r<e.length;r+=1){if(Object.hasOwn(e,r)===!1)throw new Error("JSON arrays cannot be sparse");let o=e[r];if(o===void 0)throw new Error("JSON arrays cannot contain undefined values");n.push(ni(o,t))}if(Object.keys(e).length!==e.length)throw new Error("JSON arrays cannot contain named properties");return n}finally{t.delete(e)}}if(typeof e=="object"){let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n!==null)throw new Error("JSON can contain only plain objects");if(Object.getOwnPropertySymbols(e).length>0)throw new Error("JSON objects cannot contain symbol properties");if(t.has(e))throw new Error("JSON cannot contain circular references");t.add(e);let r={};try{for(let[o,s]of Object.entries(e))Ef(o),s!==void 0&&Object.defineProperty(r,o,{value:ni(s,t),enumerable:!0,configurable:!0,writable:!0})}finally{t.delete(e)}return r}throw new Error("Value cannot be represented as JSON")},vt=e=>ni(e,new Set),Re=e=>{let t=Vt(vt(e));if(t===void 0)throw new Error("Value cannot be represented as canonical JSON");return t},Kn=(e,t)=>e===void 0||t===void 0?e===t:Re(e)===Re(t),et=(e,t)=>e<t?-1:e>t?1:0,ri=async e=>{let t=typeof e=="string"?kt(e):e,n=await globalThis.crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(n),r=>r.toString(16).padStart(2,"0")).join("")},Af=async e=>`sha256:${await ri(e)}`;var kf=cn("type",[L({type:W("document")}),L({type:W("json"),path:H(D()).min(1)}),L({type:W("markdown-body")}),L({type:W("markdown-frontmatter")})]),oi=L({documentId:D().min(1),revision:D().min(1),representation:kf}),sg=e=>{let t=kf.parse(e);return t.type==="json"?Object.freeze({...t,path:Object.freeze([...t.path])}):Object.freeze(t)},vf=e=>{let t=oi.parse(e);return Object.freeze({...t,representation:sg(t.representation)})};var Hn=["json","markdown","mdx"],Rf=e=>typeof e=="string"&&Hn.includes(e),Df=e=>{let t=e.split(";",1)[0].trim().toLowerCase();if(t==="application/json")return"json";if(t==="text/markdown")return"markdown";if(t==="text/mdx")return"mdx"};var Xr=L({id:D().min(1),revision:D().min(1),contentRef:D().min(1),format:fe(Hn).optional()}),eo=L({sourceId:D().min(1),referenceId:D().min(1),reference:oi});var fn=e=>{let t=new Map;for(let n of e){let r=t.get(n.sourceId)??[];r.push(n),t.set(n.sourceId,r)}return t};var tt=class extends Error{code;documentIds;constructor({code:t,message:n,documentIds:r=[]}){super(n),this.name="DocumentGraphError",this.code=t,this.documentIds=Object.freeze([...r])}},ig=(e,t)=>et(e.sourceId,t.sourceId)||et(e.referenceId,t.referenceId),Yn=({nodes:e,edges:t})=>{let n=e.map(a=>Object.freeze(Xr.parse(a))).sort((a,c)=>et(a.id,c.id)),r=new Map,o=new Map;for(let a of n){if(r.has(a.id))throw new tt({code:"DUPLICATE_NODE",message:`Document graph contains duplicate node ${a.id}`,documentIds:[a.id]});r.set(a.id,a);let c=o.get(a.contentRef);if(c!==void 0&&(c.revision!==a.revision||c.format!==a.format))throw new tt({code:"CONTENT_IDENTITY_CONFLICT",message:`Document graph content reference ${a.contentRef} has conflicting identities`,documentIds:[c.id,a.id]});o.set(a.contentRef,a)}let s=t.map(a=>{let c=eo.parse(a);return Object.freeze({...c,reference:vf(c.reference)})}).sort(ig),i=new Set;for(let a of s){if(r.get(a.sourceId)===void 0)throw new tt({code:"SOURCE_NOT_FOUND",message:`Document graph source ${a.sourceId} does not exist`,documentIds:[a.sourceId]});let u=r.get(a.reference.documentId);if(u===void 0)throw new tt({code:"TARGET_NOT_FOUND",message:`Document graph target ${a.reference.documentId} does not exist`,documentIds:[a.sourceId,a.reference.documentId]});if(u.revision!==a.reference.revision)throw new tt({code:"TARGET_REVISION_MISMATCH",message:`Document graph target ${u.id} revision does not match its reference`,documentIds:[a.sourceId,u.id]});let f=`${a.sourceId}\0${a.referenceId}`;if(i.has(f))throw new tt({code:"DUPLICATE_REFERENCE",message:`Document ${a.sourceId} contains duplicate reference ID ${a.referenceId}`,documentIds:[a.sourceId]});i.add(f)}return Object.freeze({nodes:Object.freeze(n),edges:Object.freeze(s)})},ag=e=>new Map(e.nodes.map(t=>[t.id,t]));var to=({graph:e,rootIds:t})=>{let n=ag(e),r=fn(e.edges),o=new Map,s=[],i=[],a=c=>{let u=n.get(c);if(u===void 0)throw new tt({code:"ROOT_NOT_FOUND",message:`Document graph root ${c} does not exist`,documentIds:[c]});let f=o.get(c);if(f!=="visited"){if(f==="visiting"){let l=s.indexOf(c),p=[...s.slice(l),c];throw new tt({code:"CYCLE",message:`Document graph contains a cycle: ${p.join(" -> ")}`,documentIds:p})}o.set(c,"visiting"),s.push(c);for(let l of r.get(c)??[])a(l.reference.documentId);s.pop(),o.set(c,"visited"),i.push(u)}};for(let c of[...new Set(t)].sort(et))a(c);return Object.freeze(i)};var cg=D().regex(/^sha256:[a-f0-9]{64}$/),If=L({format:W("webstudio-document-graph"),version:W(1),nodes:H(Xr),edges:H(eo),integrity:L({algorithm:W("sha256"),checksum:cg})});var ug=D().min(1).refine(e=>e.startsWith("/")===!1,{error:"Asset path must be relative"}).refine(e=>e.includes("\\")===!1&&e.split("/").every(t=>t.length>0&&t!==".."&&t!=="."),{error:"Asset path must be normalized and must not contain dot segments"}),Nf=L({_id:D().min(1),_type:W("asset.file"),name:D().min(1),description:D().optional(),path:ug,key:D(),folderId:D().min(1).optional(),extension:D().regex(/^[a-z0-9]*$/),mimeType:D().min(1),size:U().int().nonnegative(),createdAt:D().datetime().optional(),revision:D().min(1),contentRef:D().min(1),properties:Ne(D(),At()),excerpt:D().optional(),metadataError:L({code:D().min(1),message:D().min(1),reason:D().min(1).optional(),line:U().int().positive().optional(),column:U().int().positive().optional()}).optional()}),ii=Nf.partial().required({_id:!0}),lg=fe(["null","boolean","number","string","object","array"]),fg=Et({format:W("webstudio-builder-asset-field-catalog"),version:W(1),canonicalRevision:D().regex(/^sha256:[a-f0-9]{64}$/),documentCount:U().int().nonnegative(),fields:Ne(D().min(1),Et({queryPath:H(D().min(1)).min(1).max(N.fieldPathDepth).optional(),types:H(lg).min(1),occurrences:U().int().positive(),optional:W(!0).optional(),mixed:W(!0).optional()}))}).superRefine((e,t)=>{for(let[n,r]of Object.entries(e.fields)){let o=[...new Set(r.types)].sort();JSON.stringify(r.types)!==JSON.stringify(o)&&t.addIssue({code:"custom",path:["fields",n,"types"],message:"Observed field types must be unique and sorted"}),r.occurrences>e.documentCount&&t.addIssue({code:"custom",path:["fields",n,"occurrences"],message:"Field occurrences cannot exceed the document count"});let s=r.occurrences<e.documentCount;r.optional===!0!==s&&t.addIssue({code:"custom",path:["fields",n,"optional"],message:"Field optionality must match its occurrence count"});let i=o.length>1;r.mixed===!0!==i&&t.addIssue({code:"custom",path:["fields",n,"mixed"],message:"Mixed status must match the observed types"})}}),no=D().regex(/^sha256:[a-f0-9]{64}$/),zf=L({fields:H(H(D().min(1)).min(1).max(N.fieldPathDepth)).min(1).max(N.outputFieldCount+1),rows:H(H(At())).max(N.resultCount),totalCount:U().int().nonnegative().max(N.candidateDocuments),hasMore:pt()}).superRefine(({fields:e,rows:t},n)=>{for(let[r,o]of t.entries())o.length!==e.length&&n.addIssue({code:"custom",path:["rows",r],message:"Materialized query rows must match the field count"})}),Cf=L({format:W("webstudio-content-database"),version:W(1),assetRevision:no,documents:H(ii),documentGraph:If.optional(),contents:Ne(D().min(1),D()).optional(),assetPaths:Ne(D().min(1),D().min(1)).optional(),assetReferences:Ne(D().min(1),H(L({start:U().int().nonnegative(),end:U().int().positive(),assetId:D().min(1),suffix:D().min(1).optional()}).refine(({start:e,end:t})=>t>e,{message:"Markdown asset reference range must not be empty"}))).optional(),assetValueReferences:Ne(D().min(1),H(L({path:H(D().min(1).or(U().int().nonnegative())).min(1),assetId:D().min(1),suffix:D().min(1).optional(),structured:W(!0).optional()}))).optional(),fieldCatalog:fg,queries:Ne(no,zf).optional(),database:L({maxBytes:U().int().positive(),unboundedBytes:U().int().nonnegative(),sourceDocumentCount:U().int().nonnegative(),includedDocumentCount:U().int().nonnegative().optional()}).optional(),integrity:L({algorithm:W("sha256"),checksum:no})}).superRefine((e,t)=>{e.documents.length>N.candidateDocuments&&t.addIssue({code:"custom",path:["documents"],message:"Asset index exceeds the document limit"}),(e.fieldCatalog.canonicalRevision!==e.assetRevision||e.fieldCatalog.documentCount!==e.documents.length)&&t.addIssue({code:"custom",path:["fieldCatalog"],message:"Asset index field catalog does not match its documents"}),e.database!==void 0&&e.database.sourceDocumentCount<e.documents.length&&t.addIssue({code:"custom",path:["database","sourceDocumentCount"],message:"Source document count cannot be smaller than the database"}),e.database?.includedDocumentCount!==void 0&&(e.database.includedDocumentCount<e.documents.length||e.database.includedDocumentCount>e.database.sourceDocumentCount)&&t.addIssue({code:"custom",path:["database","includedDocumentCount"],message:"Included document count must match the database bounds"});let n;for(let[o,s]of e.documents.entries())n!==void 0&&s._id<=n&&t.addIssue({code:"custom",path:["documents",o,"_id"],message:"Asset index documents must have unique sorted IDs"}),n=s._id;let r=new Set(e.documents.flatMap(({contentRef:o})=>o===void 0?[]:[o]));for(let o of e.documentGraph?.nodes??[])r.add(o.contentRef);for(let o of Object.keys(e.contents??{}))r.has(o)===!1&&t.addIssue({code:"custom",path:["contents",o],message:"Embedded content must belong to an indexed document"});for(let o of Object.keys(e.assetReferences??{}))r.has(o)===!1&&t.addIssue({code:"custom",path:["assetReferences",o],message:"Asset references must belong to an indexed document"})}),dg=cn("mode",[L({mode:W("none")}),L({mode:W("full"),maxBytes:U().int().positive().max(N.hydratedFileBytes).optional()}),L({mode:W("range"),offset:U().int().nonnegative(),length:U().int().positive().max(N.hydratedRangeBytes)}),L({mode:W("markdown-body-ref"),maxBytes:U().int().positive().max(N.hydratedFileBytes).optional()})]),ai={id:["string"],url:["string"],width:["number"],height:["number"],name:["string"],description:["string"],path:["string"],key:["string"],folderId:["string"],extension:["string"],mimeType:["string"],size:["number"],createdAt:["string"],revision:["string"],excerpt:["string"]},$f=Object.keys(ai),Lf=["url","width","height"],ro=e=>Lf.includes(e),Pf=$f.filter(e=>ro(e)===!1&&e!=="excerpt"),Ff=Pf.filter(e=>e!=="id"),Mf=e=>Pf.includes(e),pg=fe($f),Xn=H(D().min(1)).min(1).max(N.fieldPathDepth).superRefine((e,t)=>{if(e[0]==="properties"){e.length<2&&t.addIssue({code:"custom",message:"A properties field path must select a property"});return}(e.length!==1||pg.safeParse(e[0]).success===!1)&&t.addIssue({code:"custom",message:"Asset query field path is unsupported"})}),si=pt().default(!0),mg=cn("mode",[L({mode:W("all"),includeMetadata:si}),L({mode:W("base"),includeMetadata:si}),L({mode:W("fields"),includeMetadata:si,fields:H(Xn).max(N.outputFieldCount).refine(e=>new Set(e.map(_f)).size===e.length,{error:"Selected output fields must be unique"})})]),hg={mode:"fields",includeMetadata:!1,fields:Lf.map(e=>[e])},Bf=["eq","ne","contains","startsWith","endsWith","gt","gte","lt","lte"],hS=[...Bf,"in","exists","isEmpty"],gg=L({field:Xn,operator:fe(Bf),value:At()}),yg=L({field:Xn,operator:W("in"),value:H(At()).max(N.resultCount)}),bg=L({field:Xn,operator:fe(["exists","isEmpty"]),value:pt()}),wg=cn("operator",[gg,yg,bg]),xg=Sf(wg,{maximumChildren:N.filterCount,maximumConditions:N.filterCount,maximumDepth:N.filterDepth,maximumConditionsMessage:"Asset query exceeds the filter limit",maximumDepthMessage:"Asset query exceeds the filter nesting limit"});var _g=xg,qf=e=>{let t=new Set(["eq","ne","in","exists"]);return e.some(n=>n==="string"||n==="array")&&t.add("contains"),e.includes("string")&&(t.add("startsWith"),t.add("endsWith")),e.some(n=>n==="string"||n==="number")&&(t.add("gt"),t.add("gte"),t.add("lt"),t.add("lte")),e.some(n=>n==="string"||n==="array"||n==="object")&&t.add("isEmpty"),[...t]},Sg=L({field:Xn,direction:fe(["asc","desc"])}),Eg=fe(["many","one","first","last"]),Ag=({output:e,content:t})=>e.includeMetadata||e.mode==="all"||e.mode==="fields"&&e.fields.length>0||t.mode!=="none",Rt=L({result:Eg.default("many"),where:_g.default({all:[]}),sort:H(Sg).max(N.sortCount).default([]),limit:U().int().nonnegative().max(N.resultCount).default(N.defaultResultCount),offset:U().int().nonnegative().max(N.candidateDocuments).default(0),output:mg.default(hg),content:dg.default({mode:"none"})}).superRefine((e,t)=>{Ag(e)===!1&&t.addIssue({code:"custom",message:"Select at least one asset query output"}),(e.result==="first"||e.result==="last")&&e.sort.length===0&&t.addIssue({code:"custom",path:["sort"],message:"Add sorting to define which item is first."})}),Zf=L({query:Rt,indexRevision:D().min(1).max(255).optional()}),kg=Et({_id:D().min(1),revision:D().min(1),contentRef:D().min(1),encoding:W("utf-8"),text:D(),range:Et({offset:U().int().nonnegative(),length:U().int().nonnegative(),total:U().int().nonnegative()}).optional()}),vg=kg.omit({_id:!0,revision:!0,contentRef:!0}),Uf=Nf.omit({_id:!0,_type:!0,contentRef:!0}).partial().extend({id:D().min(1),url:D().min(1).optional(),width:U().positive().optional(),height:U().positive().optional(),content:vg.optional()}).refine(e=>e.width===void 0==(e.height===void 0),{error:"Asset dimensions must include both width and height"}),Rg=L({format:W("webstudio-content-database"),version:W(1),revision:no,usedBytes:U().int().nonnegative(),maxBytes:U().int().positive(),unboundedBytes:U().int().nonnegative(),includedDocumentCount:U().int().nonnegative(),omittedDocumentCount:U().int().nonnegative(),omissionReason:fe(["size","unavailable"]).optional(),truncated:pt()}),Tf=Rg.pick({usedBytes:!0,maxBytes:!0,unboundedBytes:!0,includedDocumentCount:!0,omittedDocumentCount:!0,omissionReason:!0,truncated:!0}),ci=L({items:H(Uf),totalCount:U().int().nonnegative(),hasMore:pt()}),Dg=L({item:Uf.nullable(),totalCount:U().int().nonnegative()}),jf=an([ci,Dg]),Of=L({line:U().int().positive(),column:U().int().positive(),offset:U().int().nonnegative().optional()}),Ig=L({severity:fe(["error","warning"]),scope:fe(["query","database"]),phase:fe(["metadata","reference","source"]),code:D().min(1),message:D().min(1),assetId:D().min(1),path:D().min(1),line:U().int().positive().optional(),column:U().int().positive().optional(),reference:D().min(1).optional(),nodeType:D().min(1).optional(),reason:D().min(1).optional(),sourceRange:L({start:Of,end:Of}).optional()}),Cg=L({severity:fe(["error","warning"]),code:D().min(1),path:H(D()),message:D().min(1)}),Tg=L({scope:W("query-preview"),queryIssues:H(Cg).optional(),queryWarnings:H(D().min(1)).optional(),query:Tf,database:Tf,artifacts:L({query:Cf,database:Cf}).optional(),unresolved:jf.optional(),issues:H(Ig).optional(),issueCount:U().int().nonnegative().optional(),issuesTruncated:pt().optional()}),gS=L({data:jf,__diagnostics__:Tg}),Og=fe(["INVALID_REQUEST","REQUEST_CANCELLED","UNAUTHORIZED","FORBIDDEN","STALE_INDEX","CONTENT_IDENTITY_REQUIRED","CONTENT_NOT_TEXT","CONTENT_DECODING_FAILED","CONTENT_LIMIT_EXCEEDED","MULTIPLE_RESULTS","INTERNAL_ERROR"]),Ng=Et({ok:W(!1),error:Et({code:Og,message:D().min(1),retryable:pt(),details:Ne(D(),At()).optional()}),meta:Et({queryHash:D().min(1).optional(),indexRevision:D().min(1).optional(),assetRevision:D().min(1).optional()}).optional()}),Vf=({code:e,message:t,retryable:n=!1,details:r})=>Ng.parse({ok:!1,error:{code:e,message:t,retryable:n,details:r}});var Qf=function*(e){if(e.length>0&&!e.startsWith("/")||/~(?![01])/.test(e))throw Error("Invalid JSON Pointer");let t=1,n=0;for(;n<e.length;){let r=e.indexOf("/",t);n=r===-1?e.length:r;let o=e.slice(t,n);t=n+1,yield $g(o)}};var ui=(e,t)=>t+"/"+zg(e),zg=e=>e.toString().replace(/~/g,"~0").replace(/\//g,"~1"),$g=e=>e.toString().replace(/~1/g,"/").replace(/~0/g,"~");var oo=async(e,t,n)=>{if(Number.isSafeInteger(t)===!1||t<=0)throw new Error("Concurrency must be a positive safe integer");let r=0,o=new Array(e.length),s=async()=>{for(;r<e.length;){let u=r;r+=1,o[u]=await n(e[u])}},i=Array.from({length:Math.min(t,e.length)},s),c=(await Promise.allSettled(i)).find(u=>u.status==="rejected");if(c!==void 0)throw c.reason;return o},li=e=>e.reason??new DOMException("The operation was aborted","AbortError"),Gf=e=>{if(e?.aborted)throw li(e)},dn=async(e,t)=>t===void 0?await e:await new Promise((n,r)=>{let o=()=>t.removeEventListener("abort",s),s=()=>{o(),r(li(t))};t.addEventListener("abort",s,{once:!0}),Promise.resolve(e).then(i=>{o(),n(i)},i=>{o(),r(i)}),t.aborted&&s()}),so=({concurrency:e,signal:t})=>{if(Number.isSafeInteger(e)===!1||e<=0)throw new TypeError("Concurrency must be a positive safe integer");let n=0,r=[],o=async()=>{if(Gf(t),n<e){n+=1;return}await new Promise((i,a)=>{let c,u=()=>{let f=r.indexOf(c);f!==-1&&r.splice(f,1),t!==void 0&&a(li(t))};c={start:()=>{t?.removeEventListener("abort",u),i()}},r.push(c),t?.addEventListener("abort",u,{once:!0})})},s=()=>{let i=r.shift();if(i===void 0){n-=1;return}i.start()};return async i=>{await o();try{return Gf(t),await i()}finally{s()}}};var pn=e=>typeof e=="object"&&e!==null&&Array.isArray(e)===!1,io=e=>{if(pn(e)===!1)return;let t=Object.keys(e);if(!(t.length!==1||t[0]!=="$ref"))return e.$ref};var De=class extends Error{code;referenceId;constructor({code:t,message:n,referenceId:r,cause:o}){super(n,{cause:o}),this.name="JsonDocumentError",this.code=t,this.referenceId=r}},Lg=(e,t)=>{let n=io(e);if(n!==void 0){if(typeof n!="string")throw new De({code:"INVALID_REFERENCE_MARKER",message:`JSON reference marker ${t} must contain a string $ref`,referenceId:t});return n}},Pg=e=>`#${e}`;var Jf=async({source:e,maximumBytes:t=N.hydratedFileBytes})=>{let n;try{n=await Xe(e,t)}catch(o){throw o instanceof we?new De({code:"CONTENT_LIMIT_EXCEEDED",message:"JSON document exceeds the byte limit",cause:o}):o}let r;try{r=ln(ve(n))}catch(o){throw new De({code:"CONTENT_DECODING_FAILED",message:"JSON document is not valid UTF-8",cause:o})}try{return vt(JSON.parse(r))}catch(o){throw new De({code:"INVALID_DOCUMENT",message:"JSON document is invalid",cause:o})}};var Fg=(e,t)=>{let n=e;for(let r of t){if(Array.isArray(n)){let o=Number(r);if(Number.isSafeInteger(o)===!1||o<0||String(o)!==r||o>=n.length)return;n=n[o];continue}if(pn(n)&&Object.hasOwn(n,r)){n=n[r];continue}return}return n},Wf=({document:e,representation:t})=>{let n=vt(e);if(t.type==="document")return n;if(t.type!=="json")throw new De({code:"UNSUPPORTED_REPRESENTATION",message:`JSON documents do not support ${t.type}`});let r=Fg(n,t.path);if(r===void 0)throw new De({code:"JSON_PATH_NOT_FOUND",message:"JSON document path does not exist"});return r},Mg=(e,t,n)=>{Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0})},ao=({document:e,references:t,allowUnresolvedReferences:n=!1})=>{let r=vt(e),o=new Set,s=(a,c)=>{let u=Pg(c);if(Lg(a,u)!==void 0){if(t.has(u)===!1){if(n)return a;throw new De({code:"REFERENCE_NOT_FOUND",message:`Resolved JSON reference ${u} is unavailable`,referenceId:u})}o.add(u);try{return vt(t.get(u))}catch(l){throw new De({code:"INVALID_RESOLVED_VALUE",message:`Resolved JSON reference ${u} is not JSON-compatible`,referenceId:u,cause:l})}}if(Array.isArray(a))return a.map((l,p)=>s(l,ui(String(p),c)));if(pn(a)){let l={};for(let[p,d]of Object.entries(a))Mg(l,p,s(d,ui(p,c)));return l}return a},i=s(r,"");for(let a of[...t.keys()].sort())if(o.has(a)===!1)throw new De({code:"UNUSED_REFERENCE",message:`Resolved JSON reference ${a} has no marker`,referenceId:a});return i};var co=Symbol.for("yaml.alias"),uo=Symbol.for("yaml.document"),Ue=Symbol.for("yaml.map"),fi=Symbol.for("yaml.pair"),Ie=Symbol.for("yaml.scalar"),mt=Symbol.for("yaml.seq"),xe=Symbol.for("yaml.node.type"),ze=e=>!!e&&typeof e=="object"&&e[xe]===co,nt=e=>!!e&&typeof e=="object"&&e[xe]===uo,$e=e=>!!e&&typeof e=="object"&&e[xe]===Ue,j=e=>!!e&&typeof e=="object"&&e[xe]===fi,B=e=>!!e&&typeof e=="object"&&e[xe]===Ie,Le=e=>!!e&&typeof e=="object"&&e[xe]===mt;function K(e){if(e&&typeof e=="object")switch(e[xe]){case Ue:case mt:return!0}return!1}function V(e){if(e&&typeof e=="object")switch(e[xe]){case co:case Ue:case Ie:case mt:return!0}return!1}var lo=e=>(B(e)||K(e))&&!!e.anchor;var Ae=Symbol("break visit"),Kf=Symbol("skip children"),rt=Symbol("remove node");function ot(e,t){let n=Hf(t);nt(e)?mn(null,e.contents,n,Object.freeze([e]))===rt&&(e.contents=null):mn(null,e,n,Object.freeze([]))}ot.BREAK=Ae;ot.SKIP=Kf;ot.REMOVE=rt;function mn(e,t,n,r){let o=Yf(e,t,n,r);if(V(o)||j(o))return Xf(e,r,o),mn(e,o,n,r);if(typeof o!="symbol"){if(K(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let i=mn(s,t.items[s],n,r);if(typeof i=="number")s=i-1;else{if(i===Ae)return Ae;i===rt&&(t.items.splice(s,1),s-=1)}}}else if(j(t)){r=Object.freeze(r.concat(t));let s=mn("key",t.key,n,r);if(s===Ae)return Ae;s===rt&&(t.key=null);let i=mn("value",t.value,n,r);if(i===Ae)return Ae;i===rt&&(t.value=null)}}return o}async function fo(e,t){let n=Hf(t);nt(e)?await hn(null,e.contents,n,Object.freeze([e]))===rt&&(e.contents=null):await hn(null,e,n,Object.freeze([]))}fo.BREAK=Ae;fo.SKIP=Kf;fo.REMOVE=rt;async function hn(e,t,n,r){let o=await Yf(e,t,n,r);if(V(o)||j(o))return Xf(e,r,o),hn(e,o,n,r);if(typeof o!="symbol"){if(K(t)){r=Object.freeze(r.concat(t));for(let s=0;s<t.items.length;++s){let i=await hn(s,t.items[s],n,r);if(typeof i=="number")s=i-1;else{if(i===Ae)return Ae;i===rt&&(t.items.splice(s,1),s-=1)}}}else if(j(t)){r=Object.freeze(r.concat(t));let s=await hn("key",t.key,n,r);if(s===Ae)return Ae;s===rt&&(t.key=null);let i=await hn("value",t.value,n,r);if(i===Ae)return Ae;i===rt&&(t.value=null)}}return o}function Hf(e){return typeof e=="object"&&(e.Collection||e.Node||e.Value)?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):e}function Yf(e,t,n,r){if(typeof n=="function")return n(e,t,r);if($e(t))return n.Map?.(e,t,r);if(Le(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(B(t))return n.Scalar?.(e,t,r);if(ze(t))return n.Alias?.(e,t,r)}function Xf(e,t,n){let r=t[t.length-1];if(K(r))r.items[e]=n;else if(j(r))e==="key"?r.key=n:r.value=n;else if(nt(r))r.contents=n;else{let o=ze(r)?"alias":"scalar";throw new Error(`Cannot replace node with ${o} parent`)}}var Bg={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},qg=e=>e.replace(/[!,[\]{}]/g,t=>Bg[t]),st=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},e.defaultTags);break}return t}add(t,n){this.atNextDocument&&(this.yaml={explicit:e.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},e.defaultTags),this.atNextDocument=!1);let r=t.trim().split(/[ \t]+/),o=r.shift();switch(o){case"%TAG":{if(r.length!==2&&(n(0,"%TAG directive should contain exactly two parts"),r.length<2))return!1;let[s,i]=r;return this.tags[s]=i,!0}case"%YAML":{if(this.yaml.explicit=!0,r.length!==1)return n(0,"%YAML directive should contain exactly one part"),!1;let[s]=r;if(s==="1.1"||s==="1.2")return this.yaml.version=s,!0;{let i=/^\d+\.\d+$/.test(s);return n(6,`Unsupported YAML version ${s}`,i),!1}}default:return n(0,`Unknown directive ${o}`,!0),!1}}tagName(t,n){if(t==="!")return"!";if(t[0]!=="!")return n(`Not a valid tag: ${t}`),null;if(t[1]==="<"){let i=t.slice(2,-1);return i==="!"||i==="!!"?(n(`Verbatim tags aren't resolved, so ${t} is invalid.`),null):(t[t.length-1]!==">"&&n("Verbatim tags must end with a >"),i)}let[,r,o]=t.match(/^(.*!)([^!]*)$/s);o||n(`The ${t} tag has no suffix`);let s=this.tags[r];if(s)try{return s+decodeURIComponent(o)}catch(i){return n(String(i)),null}return r==="!"?t:(n(`Could not resolve tag: ${t}`),null)}tagString(t){for(let[n,r]of Object.entries(this.tags))if(t.startsWith(r))return n+qg(t.substring(r.length));return t[0]==="!"?t:`!<${t}>`}toString(t){let n=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],r=Object.entries(this.tags),o;if(t&&r.length>0&&V(t.contents)){let s={};ot(t.contents,(i,a)=>{V(a)&&a.tag&&(s[a.tag]=!0)}),o=Object.keys(s)}else o=[];for(let[s,i]of r)s==="!!"&&i==="tag:yaml.org,2002:"||(!t||o.some(a=>a.startsWith(i)))&&n.push(`%TAG ${s} ${i}`);return n.join(`
65
+ `)}};st.defaultYaml={explicit:!1,version:"1.2"};st.defaultTags={"!!":"tag:yaml.org,2002:"};function po(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let n=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw new Error(n)}return!0}function di(e){let t=new Set;return ot(e,{Value(n,r){r.anchor&&t.add(r.anchor)}}),t}function pi(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function ed(e,t){let n=[],r=new Map,o=null;return{onAnchor:s=>{n.push(s),o??(o=di(e));let i=pi(t,o);return o.add(i),i},setAnchors:()=>{for(let s of n){let i=r.get(s);if(typeof i=="object"&&i.anchor&&(B(i.node)||K(i.node)))i.node.anchor=i.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=s,a}}},sourceObjects:r}}function Dt(e,t,n,r){if(r&&typeof r=="object")if(Array.isArray(r))for(let o=0,s=r.length;o<s;++o){let i=r[o],a=Dt(e,r,String(o),i);a===void 0?delete r[o]:a!==i&&(r[o]=a)}else if(r instanceof Map)for(let o of Array.from(r.keys())){let s=r.get(o),i=Dt(e,r,o,s);i===void 0?r.delete(o):i!==s&&r.set(o,i)}else if(r instanceof Set)for(let o of Array.from(r)){let s=Dt(e,r,o,o);s===void 0?r.delete(o):s!==o&&(r.delete(o),r.add(s))}else for(let[o,s]of Object.entries(r)){let i=Dt(e,r,o,s);i===void 0?delete r[o]:i!==s&&(r[o]=i)}return e.call(t,n,r)}function le(e,t,n){if(Array.isArray(e))return e.map((r,o)=>le(r,String(o),n));if(e&&typeof e.toJSON=="function"){if(!n||!lo(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=s=>{r.res=s,delete n.onCreate};let o=e.toJSON(t,n);return n.onCreate&&n.onCreate(o),o}return typeof e=="bigint"&&!n?.keep?Number(e):e}var It=class{constructor(t){Object.defineProperty(this,xe,{value:t})}clone(){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(t.range=this.range.slice()),t}toJS(t,{mapAsMap:n,maxAliasCount:r,onAnchor:o,reviver:s}={}){if(!nt(t))throw new TypeError("A document argument is required");let i={anchors:new Map,doc:t,keep:!0,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r=="number"?r:100},a=le(this,"",i);if(typeof o=="function")for(let{count:c,res:u}of i.anchors.values())o(u,c);return typeof s=="function"?Dt(s,{"":a},"",a):a}};var ht=class extends It{constructor(t){super(co),this.source=t,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(t,n){if(n?.maxAliasCount===0)throw new ReferenceError("Alias resolution is disabled");let r;n?.aliasResolveCache?r=n.aliasResolveCache:(r=[],ot(t,{Node:(s,i)=>{(ze(i)||lo(i))&&r.push(i)}}),n&&(n.aliasResolveCache=r));let o;for(let s of r){if(s===this)break;s.anchor===this.source&&(o=s)}return o}toJSON(t,n){if(!n)return{source:this.source};let{anchors:r,doc:o,maxAliasCount:s}=n,i=this.resolve(o,n);if(!i){let c=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(c)}let a=r.get(i);if(a||(le(i,null,n),a=r.get(i)),a?.res===void 0){let c="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(c)}if(s>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=mo(o,i,r)),a.count*a.aliasCount>s)){let c="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(c)}return a.res}toString(t,n,r){let o=`*${this.source}`;if(t){if(po(this.source),t.options.verifyAliasOrder&&!t.anchors.has(this.source)){let s=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(s)}if(t.implicitKey)return`${o} `}return o}};function mo(e,t,n){if(ze(t)){let r=t.resolve(e),o=n&&r&&n.get(r);return o?o.count*o.aliasCount:0}else if(K(t)){let r=0;for(let o of t.items){let s=mo(e,o,n);s>r&&(r=s)}return r}else if(j(t)){let r=mo(e,t.key,n),o=mo(e,t.value,n);return Math.max(r,o)}return 1}var ho=e=>!e||typeof e!="function"&&typeof e!="object",T=class extends It{constructor(t){super(Ie),this.value=t}toJSON(t,n){return n?.keep?this.value:le(this.value,t,n)}toString(){return String(this.value)}};T.BLOCK_FOLDED="BLOCK_FOLDED";T.BLOCK_LITERAL="BLOCK_LITERAL";T.PLAIN="PLAIN";T.QUOTE_DOUBLE="QUOTE_DOUBLE";T.QUOTE_SINGLE="QUOTE_SINGLE";var Zg="tag:yaml.org,2002:";function Ug(e,t,n){if(t){let r=n.filter(s=>s.tag===t),o=r.find(s=>!s.format)??r[0];if(!o)throw new Error(`Tag ${t} not found`);return o}return n.find(r=>r.identify?.(e)&&!r.format)}function gt(e,t,n){if(nt(e)&&(e=e.contents),V(e))return e;if(j(e)){let l=n.schema[Ue].createNode?.(n.schema,null,n);return l.items.push(e),l}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<"u"&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:o,onTagObj:s,schema:i,sourceObjects:a}=n,c;if(r&&e&&typeof e=="object"){if(c=a.get(e),c)return c.anchor??(c.anchor=o(e)),new ht(c.anchor);c={anchor:null,node:null},a.set(e,c)}t?.startsWith("!!")&&(t=Zg+t.slice(2));let u=Ug(e,t,i.tags);if(!u){if(e&&typeof e.toJSON=="function"&&(e=e.toJSON()),!e||typeof e!="object"){let l=new T(e);return c&&(c.node=l),l}u=e instanceof Map?i[Ue]:Symbol.iterator in Object(e)?i[mt]:i[Ue]}s&&(s(u),delete n.onTagObj);let f=u?.createNode?u.createNode(n.schema,e,n):typeof u?.nodeClass?.from=="function"?u.nodeClass.from(n.schema,e,n):new T(e);return t?f.tag=t:u.default||(f.tag=u.tag),c&&(c.node=f),f}function er(e,t,n){let r=n;for(let o=t.length-1;o>=0;--o){let s=t[o];if(typeof s=="number"&&Number.isInteger(s)&&s>=0){let i=[];i[s]=r,r=i}else r=new Map([[s,r]])}return gt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:e,sourceObjects:new Map})}var yn=e=>e==null||typeof e=="object"&&!!e[Symbol.iterator]().next().done,gn=class extends It{constructor(t,n){super(t),Object.defineProperty(this,"schema",{value:n,configurable:!0,enumerable:!1,writable:!0})}clone(t){let n=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return t&&(n.schema=t),n.items=n.items.map(r=>V(r)||j(r)?r.clone(t):r),this.range&&(n.range=this.range.slice()),n}addIn(t,n){if(yn(t))this.add(n);else{let[r,...o]=t,s=this.get(r,!0);if(K(s))s.addIn(o,n);else if(s===void 0&&this.schema)this.set(r,er(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}deleteIn(t){let[n,...r]=t;if(r.length===0)return this.delete(n);let o=this.get(n,!0);if(K(o))return o.deleteIn(r);throw new Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}getIn(t,n){let[r,...o]=t,s=this.get(r,!0);return o.length===0?!n&&B(s)?s.value:s:K(s)?s.getIn(o,n):void 0}hasAllNullValues(t){return this.items.every(n=>{if(!j(n))return!1;let r=n.value;return r==null||t&&B(r)&&r.value==null&&!r.commentBefore&&!r.comment&&!r.tag})}hasIn(t){let[n,...r]=t;if(r.length===0)return this.has(n);let o=this.get(n,!0);return K(o)?o.hasIn(r):!1}setIn(t,n){let[r,...o]=t;if(o.length===0)this.set(r,n);else{let s=this.get(r,!0);if(K(s))s.setIn(o,n);else if(s===void 0&&this.schema)this.set(r,er(this.schema,o,n));else throw new Error(`Expected YAML collection at ${r}. Remaining path: ${o}`)}}};var td=e=>e.replace(/^(?!$)(?: $)?/gm,"#");function Pe(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var it=(e,t,n)=>e.endsWith(`
66
+ `)?Pe(n,t):n.includes(`
67
67
  `)?`
68
- `+be(n,e):(t.endsWith(" ")?"":" ")+n;var ls="flow",vr="block",vn="quoted";function Dn(t,e,n="flow",{indentAtStart:r,lineWidth:o=80,minContentWidth:s=20,onFold:i,onOverflow:a}={}){if(!o||o<0)return t;o<s&&(s=0);let c=Math.max(1+s,1+o-e.length);if(t.length<=c)return t;let u=[],d={},l=o-e.length;typeof r=="number"&&(r>o-Math.max(2,s)?u.push(0):l=o-r);let f,p,y=!1,m=-1,h=-1,g=-1;n===vr&&(m=Tl(t,m,e.length),m!==-1&&(l=m+c));for(let S;S=t[m+=1];){if(n===vn&&S==="\\"){switch(h=m,t[m+1]){case"x":m+=3;break;case"u":m+=5;break;case"U":m+=9;break;default:m+=1}g=m}if(S===`
69
- `)n===vr&&(m=Tl(t,m,e.length)),l=m+e.length+c,f=void 0;else{if(S===" "&&p&&p!==" "&&p!==`
70
- `&&p!==" "){let _=t[m+1];_&&_!==" "&&_!==`
71
- `&&_!==" "&&(f=m)}if(m>=l)if(f)u.push(f),l=f+c,f=void 0;else if(n===vn){for(;p===" "||p===" ";)p=S,S=t[m+=1],y=!0;let _=m>g+1?m-2:h-1;if(d[_])return t;u.push(_),d[_]=!0,l=_+c,f=void 0}else y=!0}p=S}if(y&&a&&a(),u.length===0)return t;i&&i();let x=t.slice(0,u[0]);for(let S=0;S<u.length;++S){let _=u[S],w=u[S+1]||t.length;_===0?x=`
72
- ${e}${t.slice(0,w)}`:(n===vn&&d[_]&&(x+=`${t[_]}\\`),x+=`
73
- ${e}${t.slice(_+1,w)}`)}return x}function Tl(t,e,n){let r=e,o=e+1,s=t[o];for(;s===" "||s===" ";)if(e<o+n)s=t[++e];else{do s=t[++e];while(s&&s!==`
74
- `);r=e,o=e+1,s=t[o]}return r}var Rr=(t,e)=>({indentAtStart:e?t.indent.length:t.indentAtStart,lineWidth:t.options.lineWidth,minContentWidth:t.options.minContentWidth}),kr=t=>/^(%|---|\.\.\.)/m.test(t);function Jm(t,e,n){if(!e||e<0)return!1;let r=e-n,o=t.length;if(o<=r)return!1;for(let s=0,i=0;s<o;++s)if(t[s]===`
75
- `){if(s-i>r)return!0;if(i=s+1,o-i<=r)return!1}return!0}function Rn(t,e){let n=JSON.stringify(t);if(e.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=e,o=e.options.doubleQuotedMinMultiLineLength,s=e.indent||(kr(t)?" ":""),i="",a=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(i+=n.slice(a,c)+"\\ ",c+=1,a=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{i+=n.slice(a,c);let d=n.substr(c+2,4);switch(d){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:d.substr(0,2)==="00"?i+="\\x"+d.substr(2):i+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<o)c+=1;else{for(i+=n.slice(a,c)+`
68
+ `+Pe(n,t):(e.endsWith(" ")?"":" ")+n;var mi="flow",go="block",tr="quoted";function nr(e,t,n="flow",{indentAtStart:r,lineWidth:o=80,minContentWidth:s=20,onFold:i,onOverflow:a}={}){if(!o||o<0)return e;o<s&&(s=0);let c=Math.max(1+s,1+o-t.length);if(e.length<=c)return e;let u=[],f={},l=o-t.length;typeof r=="number"&&(r>o-Math.max(2,s)?u.push(0):l=o-r);let p,d,w=!1,h=-1,y=-1,m=-1;n===go&&(h=nd(e,h,t.length),h!==-1&&(l=h+c));for(let S;S=e[h+=1];){if(n===tr&&S==="\\"){switch(y=h,e[h+1]){case"x":h+=3;break;case"u":h+=5;break;case"U":h+=9;break;default:h+=1}m=h}if(S===`
69
+ `)n===go&&(h=nd(e,h,t.length)),l=h+t.length+c,p=void 0;else{if(S===" "&&d&&d!==" "&&d!==`
70
+ `&&d!==" "){let E=e[h+1];E&&E!==" "&&E!==`
71
+ `&&E!==" "&&(p=h)}if(h>=l)if(p)u.push(p),l=p+c,p=void 0;else if(n===tr){for(;d===" "||d===" ";)d=S,S=e[h+=1],w=!0;let E=h>m+1?h-2:y-1;if(f[E])return e;u.push(E),f[E]=!0,l=E+c,p=void 0}else w=!0}d=S}if(w&&a&&a(),u.length===0)return e;i&&i();let A=e.slice(0,u[0]);for(let S=0;S<u.length;++S){let E=u[S],_=u[S+1]||e.length;E===0?A=`
72
+ ${t}${e.slice(0,_)}`:(n===tr&&f[E]&&(A+=`${e[E]}\\`),A+=`
73
+ ${t}${e.slice(E+1,_)}`)}return A}function nd(e,t,n){let r=t,o=t+1,s=e[o];for(;s===" "||s===" ";)if(t<o+n)s=e[++t];else{do s=e[++t];while(s&&s!==`
74
+ `);r=t,o=t+1,s=e[o]}return r}var bo=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),wo=e=>/^(%|---|\.\.\.)/m.test(e);function jg(e,t,n){if(!t||t<0)return!1;let r=t-n,o=e.length;if(o<=r)return!1;for(let s=0,i=0;s<o;++s)if(e[s]===`
75
+ `){if(s-i>r)return!0;if(i=s+1,o-i<=r)return!1}return!0}function rr(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,o=t.options.doubleQuotedMinMultiLineLength,s=t.indent||(wo(e)?" ":""),i="",a=0;for(let c=0,u=n[c];u;u=n[++c])if(u===" "&&n[c+1]==="\\"&&n[c+2]==="n"&&(i+=n.slice(a,c)+"\\ ",c+=1,a=c,u="\\"),u==="\\")switch(n[c+1]){case"u":{i+=n.slice(a,c);let f=n.substr(c+2,4);switch(f){case"0000":i+="\\0";break;case"0007":i+="\\a";break;case"000b":i+="\\v";break;case"001b":i+="\\e";break;case"0085":i+="\\N";break;case"00a0":i+="\\_";break;case"2028":i+="\\L";break;case"2029":i+="\\P";break;default:f.substr(0,2)==="00"?i+="\\x"+f.substr(2):i+=n.substr(c,6)}c+=5,a=c+1}break;case"n":if(r||n[c+2]==='"'||n.length<o)c+=1;else{for(i+=n.slice(a,c)+`
76
76
 
77
77
  `;n[c+2]==="\\"&&n[c+3]==="n"&&n[c+4]!=='"';)i+=`
78
- `,c+=2;i+=s,n[c+2]===" "&&(i+="\\"),c+=1,a=c+1}break;default:c+=1}return i=a?i+n.slice(a):n,r?i:Dn(i,s,vn,Rr(e,!1))}function fs(t,e){if(e.options.singleQuote===!1||e.implicitKey&&t.includes(`
79
- `)||/[ \t]\n|\n[ \t]/.test(t))return Rn(t,e);let n=e.indent||(kr(t)?" ":""),r="'"+t.replace(/'/g,"''").replace(/\n+/g,`$&
80
- ${n}`)+"'";return e.implicitKey?r:Dn(r,n,ls,Rr(e,!1))}function Ut(t,e){let{singleQuote:n}=e.options,r;if(n===!1)r=Rn;else{let o=t.includes('"'),s=t.includes("'");o&&!s?r=fs:s&&!o?r=Rn:r=n?fs:Rn}return r(t,e)}var ds;try{ds=new RegExp(`(^|(?<!
78
+ `,c+=2;i+=s,n[c+2]===" "&&(i+="\\"),c+=1,a=c+1}break;default:c+=1}return i=a?i+n.slice(a):n,r?i:nr(i,s,tr,bo(t,!1))}function hi(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
79
+ `)||/[ \t]\n|\n[ \t]/.test(e))return rr(e,t);let n=t.indent||(wo(e)?" ":""),r="'"+e.replace(/'/g,"''").replace(/\n+/g,`$&
80
+ ${n}`)+"'";return t.implicitKey?r:nr(r,n,mi,bo(t,!1))}function bn(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=rr;else{let o=e.includes('"'),s=e.includes("'");o&&!s?r=hi:s&&!o?r=rr:r=n?hi:rr}return r(e,t)}var gi;try{gi=new RegExp(`(^|(?<!
81
81
  ))
82
82
  +(?!
83
- |$)`,"g")}catch{ds=/\n+(?!\n|$)/g}function Dr({comment:t,type:e,value:n},r,o,s){let{blockQuote:i,commentString:a,lineWidth:c}=r.options;if(!i||/\n[\t ]+$/.test(n))return Ut(n,r);let u=r.indent||(r.forceBlockIndent||kr(n)?" ":""),d=i==="literal"?!0:i==="folded"||e===R.BLOCK_FOLDED?!1:e===R.BLOCK_LITERAL?!0:!Jm(n,c,u.length);if(!n)return d?`|
83
+ |$)`,"g")}catch{gi=/\n+(?!\n|$)/g}function yo({comment:e,type:t,value:n},r,o,s){let{blockQuote:i,commentString:a,lineWidth:c}=r.options;if(!i||/\n[\t ]+$/.test(n))return bn(n,r);let u=r.indent||(r.forceBlockIndent||wo(n)?" ":""),f=i==="literal"?!0:i==="folded"||t===T.BLOCK_FOLDED?!1:t===T.BLOCK_LITERAL?!0:!jg(n,c,u.length);if(!n)return f?`|
84
84
  `:`>
85
- `;let l,f;for(f=n.length;f>0;--f){let w=n[f-1];if(w!==`
86
- `&&w!==" "&&w!==" ")break}let p=n.substring(f),y=p.indexOf(`
87
- `);y===-1?l="-":n===p||y!==p.length-1?(l="+",s&&s()):l="",p&&(n=n.slice(0,-p.length),p[p.length-1]===`
88
- `&&(p=p.slice(0,-1)),p=p.replace(ds,`$&${u}`));let m=!1,h,g=-1;for(h=0;h<n.length;++h){let w=n[h];if(w===" ")m=!0;else if(w===`
89
- `)g=h;else break}let x=n.substring(0,g<h?g+1:h);x&&(n=n.substring(x.length),x=x.replace(/\n+/g,`$&${u}`));let _=(m?u?"2":"1":"")+l;if(t&&(_+=" "+a(t.replace(/ ?[\r\n]+/g," ")),o&&o()),!d){let w=n.replace(/\n+/g,`
90
- $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),A=!1,D=Rr(r,!0);i!=="folded"&&e!==R.BLOCK_FOLDED&&(D.onOverflow=()=>{A=!0});let E=Dn(`${x}${w}${p}`,u,vr,D);if(!A)return`>${_}
91
- ${u}${E}`}return n=n.replace(/\n+/g,`$&${u}`),`|${_}
92
- ${u}${x}${n}${p}`}function Km(t,e,n,r){let{type:o,value:s}=t,{actualString:i,implicitKey:a,indent:c,indentStep:u,inFlow:d}=e;if(a&&s.includes(`
93
- `)||d&&/[[\]{},]/.test(s))return Ut(s,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||d||!s.includes(`
94
- `)?Ut(s,e):Dr(t,e,n,r);if(!a&&!d&&o!==R.PLAIN&&s.includes(`
95
- `))return Dr(t,e,n,r);if(kr(s)){if(c==="")return e.forceBlockIndent=!0,Dr(t,e,n,r);if(a&&c===u)return Ut(s,e)}let l=s.replace(/\n+/g,`$&
96
- ${c}`);if(i){let f=m=>m.default&&m.tag!=="tag:yaml.org,2002:str"&&m.test?.test(l),{compat:p,tags:y}=e.doc.schema;if(y.some(f)||p?.some(f))return Ut(s,e)}return a?l:Dn(l,c,ls,Rr(e,!1))}function _t(t,e,n,r){let{implicitKey:o,inFlow:s}=e,i=typeof t.value=="string"?t:Object.assign({},t,{value:String(t.value)}),{type:a}=t;a!==R.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value)&&(a=R.QUOTE_DOUBLE);let c=d=>{switch(d){case R.BLOCK_FOLDED:case R.BLOCK_LITERAL:return o||s?Ut(i.value,e):Dr(i,e,n,r);case R.QUOTE_DOUBLE:return Rn(i.value,e);case R.QUOTE_SINGLE:return fs(i.value,e);case R.PLAIN:return Km(i,e,n,r);default:return null}},u=c(a);if(u===null){let{defaultKeyType:d,defaultStringType:l}=e.options,f=o&&d||l;if(u=c(f),u===null)throw new Error(`Unsupported default string type ${f}`)}return u}function Ir(t,e){let n=Object.assign({blockQuote:!0,commentString:Cl,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},t.schema.toStringOptions,e),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:t,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Wm(t,e){if(e.tag){let o=t.filter(s=>s.tag===e.tag);if(o.length>0)return o.find(s=>s.format===e.format)??o[0]}let n,r;if(T(e)){r=e.value;let o=t.filter(s=>s.identify?.(r));if(o.length>1){let s=o.filter(i=>i.test);s.length>0&&(o=s)}n=o.find(s=>s.format===e.format)??o.find(s=>!s.format)}else r=e,n=t.find(o=>o.nodeClass&&r instanceof o.nodeClass);if(!n){let o=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${o} value`)}return n}function Ym(t,e,{anchors:n,doc:r}){if(!r.directives)return"";let o=[],s=(T(t)||B(t))&&t.anchor;s&&Er(s)&&(n.add(s),o.push(`&${s}`));let i=t.tag??(e.default?null:e.tag);return i&&o.push(r.directives.tagString(i)),o.join(" ")}function Ke(t,e,n,r){if($(t))return t.toString(e,n,r);if(he(t)){if(e.doc.directives)return t.toString(e);if(e.resolvedAliases?.has(t))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(t):e.resolvedAliases=new Set([t]),t=t.resolve(e.doc)}let o,s=z(t)?t:e.doc.createNode(t,{onTagObj:c=>o=c});o??(o=Wm(e.doc.schema.tags,s));let i=Ym(s,o,e);i.length>0&&(e.indentAtStart=(e.indentAtStart??0)+i.length+1);let a=typeof o.stringify=="function"?o.stringify(s,e,n,r):T(s)?_t(s,e,n,r):s.toString(e,n,r);return i?T(s)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
97
- ${e.indent}${a}`:a}function Nl({key:t,value:e},n,r,o){let{allNullValues:s,doc:i,indent:a,indentStep:c,options:{commentString:u,indentSeq:d,simpleKeys:l}}=n,f=z(t)&&t.comment||null;if(l){if(f)throw new Error("With simple keys, key nodes cannot have comments");if(B(t)||!z(t)&&typeof t=="object"){let D="With simple keys, collection cannot be used as a key value";throw new Error(D)}}let p=!l&&(!t||f&&e==null&&!n.inFlow||B(t)||(T(t)?t.type===R.BLOCK_FOLDED||t.type===R.BLOCK_LITERAL:typeof t=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(l||!s),indent:a+c});let y=!1,m=!1,h=Ke(t,n,()=>y=!0,()=>m=!0);if(!p&&!n.inFlow&&h.length>1024){if(l)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(n.inFlow){if(s||e==null)return y&&r&&r(),h===""?"?":p?`? ${h}`:h}else if(s&&!l||e==null&&p)return h=`? ${h}`,f&&!y?h+=Fe(h,n.indent,u(f)):m&&o&&o(),h;y&&(f=null),p?(f&&(h+=Fe(h,n.indent,u(f))),h=`? ${h}
98
- ${a}:`):(h=`${h}:`,f&&(h+=Fe(h,n.indent,u(f))));let g,x,S;z(e)?(g=!!e.spaceBefore,x=e.commentBefore,S=e.comment):(g=!1,x=null,S=null,e&&typeof e=="object"&&(e=i.createNode(e))),n.implicitKey=!1,!p&&!f&&T(e)&&(n.indentAtStart=h.length+1),m=!1,!d&&c.length>=2&&!n.inFlow&&!p&&ge(e)&&!e.flow&&!e.tag&&!e.anchor&&(n.indent=n.indent.substring(2));let _=!1,w=Ke(e,n,()=>_=!0,()=>m=!0),A=" ";if(f||g||x){if(A=g?`
99
- `:"",x){let D=u(x);A+=`
100
- ${be(D,n.indent)}`}w===""&&!n.inFlow?A===`
101
- `&&S&&(A=`
85
+ `;let l,p;for(p=n.length;p>0;--p){let _=n[p-1];if(_!==`
86
+ `&&_!==" "&&_!==" ")break}let d=n.substring(p),w=d.indexOf(`
87
+ `);w===-1?l="-":n===d||w!==d.length-1?(l="+",s&&s()):l="",d&&(n=n.slice(0,-d.length),d[d.length-1]===`
88
+ `&&(d=d.slice(0,-1)),d=d.replace(gi,`$&${u}`));let h=!1,y,m=-1;for(y=0;y<n.length;++y){let _=n[y];if(_===" ")h=!0;else if(_===`
89
+ `)m=y;else break}let A=n.substring(0,m<y?m+1:y);A&&(n=n.substring(A.length),A=A.replace(/\n+/g,`$&${u}`));let E=(h?u?"2":"1":"")+l;if(e&&(E+=" "+a(e.replace(/ ?[\r\n]+/g," ")),o&&o()),!f){let _=n.replace(/\n+/g,`
90
+ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${u}`),x=!1,R=bo(r,!0);i!=="folded"&&t!==T.BLOCK_FOLDED&&(R.onOverflow=()=>{x=!0});let v=nr(`${A}${_}${d}`,u,go,R);if(!x)return`>${E}
91
+ ${u}${v}`}return n=n.replace(/\n+/g,`$&${u}`),`|${E}
92
+ ${u}${A}${n}${d}`}function Vg(e,t,n,r){let{type:o,value:s}=e,{actualString:i,implicitKey:a,indent:c,indentStep:u,inFlow:f}=t;if(a&&s.includes(`
93
+ `)||f&&/[[\]{},]/.test(s))return bn(s,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(s))return a||f||!s.includes(`
94
+ `)?bn(s,t):yo(e,t,n,r);if(!a&&!f&&o!==T.PLAIN&&s.includes(`
95
+ `))return yo(e,t,n,r);if(wo(s)){if(c==="")return t.forceBlockIndent=!0,yo(e,t,n,r);if(a&&c===u)return bn(s,t)}let l=s.replace(/\n+/g,`$&
96
+ ${c}`);if(i){let p=h=>h.default&&h.tag!=="tag:yaml.org,2002:str"&&h.test?.test(l),{compat:d,tags:w}=t.doc.schema;if(w.some(p)||d?.some(p))return bn(s,t)}return a?l:nr(l,c,mi,bo(t,!1))}function Qt(e,t,n,r){let{implicitKey:o,inFlow:s}=t,i=typeof e.value=="string"?e:Object.assign({},e,{value:String(e.value)}),{type:a}=e;a!==T.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(i.value)&&(a=T.QUOTE_DOUBLE);let c=f=>{switch(f){case T.BLOCK_FOLDED:case T.BLOCK_LITERAL:return o||s?bn(i.value,t):yo(i,t,n,r);case T.QUOTE_DOUBLE:return rr(i.value,t);case T.QUOTE_SINGLE:return hi(i.value,t);case T.PLAIN:return Vg(i,t,n,r);default:return null}},u=c(a);if(u===null){let{defaultKeyType:f,defaultStringType:l}=t.options,p=o&&f||l;if(u=c(p),u===null)throw new Error(`Unsupported default string type ${p}`)}return u}function xo(e,t){let n=Object.assign({blockQuote:!0,commentString:td,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),r;switch(n.collectionStyle){case"block":r=!1;break;case"flow":r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?" ":"",indent:"",indentStep:typeof n.indent=="number"?" ".repeat(n.indent):" ",inFlow:r,options:n}}function Qg(e,t){if(t.tag){let o=e.filter(s=>s.tag===t.tag);if(o.length>0)return o.find(s=>s.format===t.format)??o[0]}let n,r;if(B(t)){r=t.value;let o=e.filter(s=>s.identify?.(r));if(o.length>1){let s=o.filter(i=>i.test);s.length>0&&(o=s)}n=o.find(s=>s.format===t.format)??o.find(s=>!s.format)}else r=t,n=e.find(o=>o.nodeClass&&r instanceof o.nodeClass);if(!n){let o=r?.constructor?.name??(r===null?"null":typeof r);throw new Error(`Tag not resolved for ${o} value`)}return n}function Gg(e,t,{anchors:n,doc:r}){if(!r.directives)return"";let o=[],s=(B(e)||K(e))&&e.anchor;s&&po(s)&&(n.add(s),o.push(`&${s}`));let i=e.tag??(t.default?null:t.tag);return i&&o.push(r.directives.tagString(i)),o.join(" ")}function yt(e,t,n,r){if(j(e))return e.toString(t,n,r);if(ze(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 o,s=V(e)?e:t.doc.createNode(e,{onTagObj:c=>o=c});o??(o=Qg(t.doc.schema.tags,s));let i=Gg(s,o,t);i.length>0&&(t.indentAtStart=(t.indentAtStart??0)+i.length+1);let a=typeof o.stringify=="function"?o.stringify(s,t,n,r):B(s)?Qt(s,t,n,r):s.toString(t,n,r);return i?B(s)||a[0]==="{"||a[0]==="["?`${i} ${a}`:`${i}
97
+ ${t.indent}${a}`:a}function rd({key:e,value:t},n,r,o){let{allNullValues:s,doc:i,indent:a,indentStep:c,options:{commentString:u,indentSeq:f,simpleKeys:l}}=n,p=V(e)&&e.comment||null;if(l){if(p)throw new Error("With simple keys, key nodes cannot have comments");if(K(e)||!V(e)&&typeof e=="object"){let R="With simple keys, collection cannot be used as a key value";throw new Error(R)}}let d=!l&&(!e||p&&t==null&&!n.inFlow||K(e)||(B(e)?e.type===T.BLOCK_FOLDED||e.type===T.BLOCK_LITERAL:typeof e=="object"));n=Object.assign({},n,{allNullValues:!1,implicitKey:!d&&(l||!s),indent:a+c});let w=!1,h=!1,y=yt(e,n,()=>w=!0,()=>h=!0);if(!d&&!n.inFlow&&y.length>1024){if(l)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");d=!0}if(n.inFlow){if(s||t==null)return w&&r&&r(),y===""?"?":d?`? ${y}`:y}else if(s&&!l||t==null&&d)return y=`? ${y}`,p&&!w?y+=it(y,n.indent,u(p)):h&&o&&o(),y;w&&(p=null),d?(p&&(y+=it(y,n.indent,u(p))),y=`? ${y}
98
+ ${a}:`):(y=`${y}:`,p&&(y+=it(y,n.indent,u(p))));let m,A,S;V(t)?(m=!!t.spaceBefore,A=t.commentBefore,S=t.comment):(m=!1,A=null,S=null,t&&typeof t=="object"&&(t=i.createNode(t))),n.implicitKey=!1,!d&&!p&&B(t)&&(n.indentAtStart=y.length+1),h=!1,!f&&c.length>=2&&!n.inFlow&&!d&&Le(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let E=!1,_=yt(t,n,()=>E=!0,()=>h=!0),x=" ";if(p||m||A){if(x=m?`
99
+ `:"",A){let R=u(A);x+=`
100
+ ${Pe(R,n.indent)}`}_===""&&!n.inFlow?x===`
101
+ `&&S&&(x=`
102
102
 
103
- `):A+=`
104
- ${n.indent}`}else if(!p&&B(e)){let D=w[0],E=w.indexOf(`
105
- `),C=E!==-1,P=n.inFlow??e.flow??e.items.length===0;if(C||!P){let G=!1;if(C&&(D==="&"||D==="!")){let L=w.indexOf(" ");D==="&"&&L!==-1&&L<E&&w[L+1]==="!"&&(L=w.indexOf(" ",L+1)),(L===-1||E<L)&&(G=!0)}G||(A=`
106
- ${n.indent}`)}}else(w===""||w[0]===`
107
- `)&&(A="");return h+=A+w,n.inFlow?_&&r&&r():S&&!_?h+=Fe(h,n.indent,u(S)):m&&o&&o(),h}function ps(t,e){(t==="debug"||t==="warn")&&console.warn(e)}var Or="<<",Ae={identify:t=>t===Or||typeof t=="symbol"&&t.description===Or,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new R(Symbol(Or)),{addToJSMap:hs}),stringify:()=>Or},$l=(t,e)=>(Ae.identify(e)||T(e)&&(!e.type||e.type===R.PLAIN)&&Ae.identify(e.value))&&t?.doc.schema.tags.some(n=>n.tag===Ae.tag&&n.default);function hs(t,e,n){let r=zl(t,n);if(ge(r))for(let o of r.items)ms(t,e,o);else if(Array.isArray(r))for(let o of r)ms(t,e,o);else ms(t,e,r)}function ms(t,e,n){let r=zl(t,n);if(!ye(r))throw new Error("Merge sources must be maps or map aliases");let o=r.toJSON(null,t,Map);for(let[s,i]of o)e instanceof Map?e.has(s)||e.set(s,i):e instanceof Set?e.add(s):Object.prototype.hasOwnProperty.call(e,s)||Object.defineProperty(e,s,{value:i,writable:!0,enumerable:!0,configurable:!0});return e}function zl(t,e){return t&&he(e)?e.resolve(t.doc,t):e}function Cr(t,e,{key:n,value:r}){if(z(n)&&n.addToJSMap)n.addToJSMap(t,e,r);else if($l(t,n))hs(t,e,r);else{let o=H(n,"",t);if(e instanceof Map)e.set(o,H(r,o,t));else if(e instanceof Set)e.add(o);else{let s=Xm(n,o,t),i=H(r,s,t);s in e?Object.defineProperty(e,s,{value:i,writable:!0,enumerable:!0,configurable:!0}):e[s]=i}}return e}function Xm(t,e,n){if(e===null)return"";if(typeof e!="object")return String(e);if(z(t)&&n?.doc){let r=Ir(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let o=t.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(o);s.length>40&&(s=s.substring(0,36)+'..."'),ps(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return o}return JSON.stringify(e)}function Qt(t,e,n){let r=Je(t,void 0,n),o=Je(e,void 0,n);return new K(r,o)}var K=class t{constructor(e,n=null){Object.defineProperty(this,ie,{value:as}),this.key=e,this.value=n}clone(e){let{key:n,value:r}=this;return z(n)&&(n=n.clone(e)),z(r)&&(r=r.clone(e)),new t(n,r)}toJSON(e,n){let r=n?.mapAsMap?new Map:{};return Cr(n,r,this)}toString(e,n,r){return e?.doc?Nl(this,e,n,r):JSON.stringify(this)}};function Nr(t,e,n){return(e.inFlow??t.flow?eh:Hm)(t,e,n)}function Hm({comment:t,items:e},n,{blockItemPrefix:r,flowChars:o,itemIndent:s,onChompKeep:i,onComment:a}){let{indent:c,options:{commentString:u}}=n,d=Object.assign({},n,{indent:s,type:null}),l=!1,f=[];for(let y=0;y<e.length;++y){let m=e[y],h=null;if(z(m))!l&&m.spaceBefore&&f.push(""),Tr(n,f,m.commentBefore,l),m.comment&&(h=m.comment);else if($(m)){let x=z(m.key)?m.key:null;x&&(!l&&x.spaceBefore&&f.push(""),Tr(n,f,x.commentBefore,l))}l=!1;let g=Ke(m,d,()=>h=null,()=>l=!0);h&&(g+=Fe(g,s,u(h))),l&&h&&(l=!1),f.push(r+g)}let p;if(f.length===0)p=o.start+o.end;else{p=f[0];for(let y=1;y<f.length;++y){let m=f[y];p+=m?`
108
- ${c}${m}`:`
109
- `}}return t?(p+=`
110
- `+be(u(t),c),a&&a()):l&&i&&i(),p}function eh({items:t},e,{flowChars:n,itemIndent:r}){let{indent:o,indentStep:s,flowCollectionPadding:i,options:{commentString:a}}=e;r+=s;let c=Object.assign({},e,{indent:r,inFlow:!0,type:null}),u=!1,d=0,l=[];for(let y=0;y<t.length;++y){let m=t[y],h=null;if(z(m))m.spaceBefore&&l.push(""),Tr(e,l,m.commentBefore,!1),m.comment&&(h=m.comment);else if($(m)){let x=z(m.key)?m.key:null;x&&(x.spaceBefore&&l.push(""),Tr(e,l,x.commentBefore,!1),x.comment&&(u=!0));let S=z(m.value)?m.value:null;S?(S.comment&&(h=S.comment),S.commentBefore&&(u=!0)):m.value==null&&x?.comment&&(h=x.comment)}h&&(u=!0);let g=Ke(m,c,()=>h=null);u||(u=l.length>d||g.includes(`
111
- `)),y<t.length-1?g+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(u||(u=l.reduce((x,S)=>x+S.length+2,2)+(g.length+2)>e.options.lineWidth)),u&&(g+=",")),h&&(g+=Fe(g,r,a(h))),l.push(g),d=l.length}let{start:f,end:p}=n;if(l.length===0)return f+p;if(!u){let y=l.reduce((m,h)=>m+h.length+2,2);u=e.options.lineWidth>0&&y>e.options.lineWidth}if(u){let y=f;for(let m of l)y+=m?`
112
- ${s}${o}${m}`:`
113
- `;return`${y}
114
- ${o}${p}`}else return`${f}${i}${l.join(" ")}${i}${p}`}function Tr({indent:t,options:{commentString:e}},n,r,o){if(r&&o&&(r=r.replace(/^\n+/,"")),r){let s=be(e(r),t);n.push(s.trimStart())}}function at(t,e){let n=T(e)?e.value:e;for(let r of t)if($(r)&&(r.key===e||r.key===n||T(r.key)&&r.key.value===n))return r}var W=class extends Bt{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(Se,e),this.items=[]}static from(e,n,r){let{keepUndefined:o,replacer:s}=r,i=new this(e),a=(c,u)=>{if(typeof s=="function")u=s.call(n,c,u);else if(Array.isArray(s)&&!s.includes(c))return;(u!==void 0||o)&&i.items.push(Qt(c,u,r))};if(n instanceof Map)for(let[c,u]of n)a(c,u);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof e.sortMapEntries=="function"&&i.items.sort(e.sortMapEntries),i}add(e,n){let r;$(e)?r=e:!e||typeof e!="object"||!("key"in e)?r=new K(e,e?.value):r=new K(e.key,e.value);let o=at(this.items,r.key),s=this.schema?.sortMapEntries;if(o){if(!n)throw new Error(`Key ${r.key} already set`);T(o.value)&&Ar(r.value)?o.value.value=r.value:o.value=r.value}else if(s){let i=this.items.findIndex(a=>s(r,a)<0);i===-1?this.items.push(r):this.items.splice(i,0,r)}else this.items.push(r)}delete(e){let n=at(this.items,e);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(e,n){let o=at(this.items,e)?.value;return(!n&&T(o)?o.value:o)??void 0}has(e){return!!at(this.items,e)}set(e,n){this.add(new K(e,n),!0)}toJSON(e,n,r){let o=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(o);for(let s of this.items)Cr(n,o,s);return o}toString(e,n,r){if(!e)return JSON.stringify(this);for(let o of this.items)if(!$(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Nr(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:r,onComment:n})}};var ve={collection:"map",default:!0,nodeClass:W,tag:"tag:yaml.org,2002:map",resolve(t,e){return ye(t)||e("Expected a mapping for this tag"),t},createNode:(t,e,n)=>W.from(t,e,n)};var ne=class extends Bt{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(Ge,e),this.items=[]}add(e){this.items.push(e)}delete(e){let n=$r(e);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(e,n){let r=$r(e);if(typeof r!="number")return;let o=this.items[r];return!n&&T(o)?o.value:o}has(e){let n=$r(e);return typeof n=="number"&&n<this.items.length}set(e,n){let r=$r(e);if(typeof r!="number")throw new Error(`Expected a valid index, not ${e}.`);let o=this.items[r];T(o)&&Ar(n)?o.value=n:this.items[r]=n}toJSON(e,n){let r=[];n?.onCreate&&n.onCreate(r);let o=0;for(let s of this.items)r.push(H(s,String(o++),n));return r}toString(e,n,r){return e?Nr(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(e,n,r){let{replacer:o}=r,s=new this(e);if(n&&Symbol.iterator in Object(n)){let i=0;for(let a of n){if(typeof o=="function"){let c=n instanceof Set?a:String(i++);a=o.call(n,c,a)}s.items.push(Je(a,void 0,r))}}return s}};function $r(t){let e=T(t)?t.value:t;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}var De={collection:"seq",default:!0,nodeClass:ne,tag:"tag:yaml.org,2002:seq",resolve(t,e){return ge(t)||e("Expected a sequence for this tag"),t},createNode:(t,e,n)=>ne.from(t,e,n)};var ct={identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify(t,e,n,r){return e=Object.assign({actualString:!0},e),_t(t,e,n,r)}};var xt={identify:t=>t==null,createNode:()=>new R(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new R(null),stringify:({source:t},e)=>typeof t=="string"&&xt.test.test(t)?t:e.options.nullStr};var kn={identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:t=>new R(t[0]==="t"||t[0]==="T"),stringify({source:t,value:e},n){if(t&&kn.test.test(t)){let r=t[0]==="t"||t[0]==="T";if(e===r)return t}return e?n.options.trueStr:n.options.falseStr}};function re({format:t,minFractionDigits:e,tag:n,value:r}){if(typeof r=="bigint")return String(r);let o=typeof r=="number"?r:Number(r);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!t&&e&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let i=s.indexOf(".");i<0&&(i=s.length,s+=".");let a=e-(s.length-i-1);for(;a-- >0;)s+="0"}return s}var zr={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:re},Pr={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():re(t)}},Lr={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(t){let e=new R(parseFloat(t)),n=t.indexOf(".");return n!==-1&&t[t.length-1]==="0"&&(e.minFractionDigits=t.length-n-1),e},stringify:re};var Mr=t=>typeof t=="bigint"||Number.isInteger(t),ys=(t,e,n,{intAsBigInt:r})=>r?BigInt(t):parseInt(t.substring(e),n);function Pl(t,e,n){let{value:r}=t;return Mr(r)&&r>=0?n+r.toString(e):re(t)}var Fr={identify:t=>Mr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(t,e,n)=>ys(t,2,8,n),stringify:t=>Pl(t,8,"0o")},Zr={identify:Mr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(t,e,n)=>ys(t,0,10,n),stringify:re},Br={identify:t=>Mr(t)&&t>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(t,e,n)=>ys(t,2,16,n),stringify:t=>Pl(t,16,"0x")};var Ll=[ve,De,ct,xt,kn,Fr,Zr,Br,zr,Pr,Lr];function Ml(t){return typeof t=="bigint"||Number.isInteger(t)}var jr=({value:t})=>JSON.stringify(t),th=[{identify:t=>typeof t=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:t=>t,stringify:jr},{identify:t=>t==null,createNode:()=>new R(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:jr},{identify:t=>typeof t=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:t=>t==="true",stringify:jr},{identify:Ml,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(t,e,{intAsBigInt:n})=>n?BigInt(t):parseInt(t,10),stringify:({value:t})=>Ml(t)?t.toString():JSON.stringify(t)},{identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:t=>parseFloat(t),stringify:jr}],nh={default:!0,tag:"",test:/^/,resolve(t,e){return e(`Unresolved plain scalar ${JSON.stringify(t)}`),t}},Fl=[ve,De].concat(th,nh);var In={identify:t=>t instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(t,e){if(typeof atob=="function"){let n=atob(t.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let o=0;o<n.length;++o)r[o]=n.charCodeAt(o);return r}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),t},stringify({comment:t,type:e,value:n},r,o,s){if(!n)return"";let i=n,a;if(typeof btoa=="function"){let c="";for(let u=0;u<i.length;++u)c+=String.fromCharCode(i[u]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(e??(e=R.BLOCK_LITERAL),e!==R.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),u=Math.ceil(a.length/c),d=new Array(u);for(let l=0,f=0;l<u;++l,f+=c)d[l]=a.substr(f,c);a=d.join(e===R.BLOCK_LITERAL?`
115
- `:" ")}return _t({comment:t,type:e,value:a},r,o,s)}};function gs(t,e){if(ge(t))for(let n=0;n<t.items.length;++n){let r=t.items[n];if(!$(r)){if(ye(r)){r.items.length>1&&e("Each pair must have its own sequence indicator");let o=r.items[0]||new K(new R(null));if(r.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${r.commentBefore}
103
+ `):x+=`
104
+ ${n.indent}`}else if(!d&&K(t)){let R=_[0],v=_.indexOf(`
105
+ `),I=v!==-1,P=n.inFlow??t.flow??t.items.length===0;if(I||!P){let Q=!1;if(I&&(R==="&"||R==="!")){let O=_.indexOf(" ");R==="&"&&O!==-1&&O<v&&_[O+1]==="!"&&(O=_.indexOf(" ",O+1)),(O===-1||v<O)&&(Q=!0)}Q||(x=`
106
+ ${n.indent}`)}}else(_===""||_[0]===`
107
+ `)&&(x="");return y+=x+_,n.inFlow?E&&r&&r():S&&!E?y+=it(y,n.indent,u(S)):h&&o&&o(),y}function yi(e,t){(e==="debug"||e==="warn")&&console.warn(t)}var _o="<<",je={identify:e=>e===_o||typeof e=="symbol"&&e.description===_o,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new T(Symbol(_o)),{addToJSMap:wi}),stringify:()=>_o},od=(e,t)=>(je.identify(t)||B(t)&&(!t.type||t.type===T.PLAIN)&&je.identify(t.value))&&e?.doc.schema.tags.some(n=>n.tag===je.tag&&n.default);function wi(e,t,n){let r=sd(e,n);if(Le(r))for(let o of r.items)bi(e,t,o);else if(Array.isArray(r))for(let o of r)bi(e,t,o);else bi(e,t,r)}function bi(e,t,n){let r=sd(e,n);if(!$e(r))throw new Error("Merge sources must be maps or map aliases");let o=r.toJSON(null,e,Map);for(let[s,i]of o)t instanceof Map?t.has(s)||t.set(s,i):t instanceof Set?t.add(s):Object.prototype.hasOwnProperty.call(t,s)||Object.defineProperty(t,s,{value:i,writable:!0,enumerable:!0,configurable:!0});return t}function sd(e,t){return e&&ze(t)?t.resolve(e.doc,e):t}function So(e,t,{key:n,value:r}){if(V(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(od(e,n))wi(e,t,r);else{let o=le(n,"",e);if(t instanceof Map)t.set(o,le(r,o,e));else if(t instanceof Set)t.add(o);else{let s=Jg(n,o,e),i=le(r,s,e);s in t?Object.defineProperty(t,s,{value:i,writable:!0,enumerable:!0,configurable:!0}):t[s]=i}}return t}function Jg(e,t,n){if(t===null)return"";if(typeof t!="object")return String(t);if(V(e)&&n?.doc){let r=xo(n.doc,{});r.anchors=new Set;for(let s of n.anchors.keys())r.anchors.add(s.anchor);r.inFlow=!0,r.inStringifyKey=!0;let o=e.toString(r);if(!n.mapKeyWarned){let s=JSON.stringify(o);s.length>40&&(s=s.substring(0,36)+'..."'),yi(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${s}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return o}return JSON.stringify(t)}function wn(e,t,n){let r=gt(e,void 0,n),o=gt(t,void 0,n);return new oe(r,o)}var oe=class e{constructor(t,n=null){Object.defineProperty(this,xe,{value:fi}),this.key=t,this.value=n}clone(t){let{key:n,value:r}=this;return V(n)&&(n=n.clone(t)),V(r)&&(r=r.clone(t)),new e(n,r)}toJSON(t,n){let r=n?.mapAsMap?new Map:{};return So(n,r,this)}toString(t,n,r){return t?.doc?rd(this,t,n,r):JSON.stringify(this)}};function Ao(e,t,n){return(t.inFlow??e.flow?Kg:Wg)(e,t,n)}function Wg({comment:e,items:t},n,{blockItemPrefix:r,flowChars:o,itemIndent:s,onChompKeep:i,onComment:a}){let{indent:c,options:{commentString:u}}=n,f=Object.assign({},n,{indent:s,type:null}),l=!1,p=[];for(let w=0;w<t.length;++w){let h=t[w],y=null;if(V(h))!l&&h.spaceBefore&&p.push(""),Eo(n,p,h.commentBefore,l),h.comment&&(y=h.comment);else if(j(h)){let A=V(h.key)?h.key:null;A&&(!l&&A.spaceBefore&&p.push(""),Eo(n,p,A.commentBefore,l))}l=!1;let m=yt(h,f,()=>y=null,()=>l=!0);y&&(m+=it(m,s,u(y))),l&&y&&(l=!1),p.push(r+m)}let d;if(p.length===0)d=o.start+o.end;else{d=p[0];for(let w=1;w<p.length;++w){let h=p[w];d+=h?`
108
+ ${c}${h}`:`
109
+ `}}return e?(d+=`
110
+ `+Pe(u(e),c),a&&a()):l&&i&&i(),d}function Kg({items:e},t,{flowChars:n,itemIndent:r}){let{indent:o,indentStep:s,flowCollectionPadding:i,options:{commentString:a}}=t;r+=s;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),u=!1,f=0,l=[];for(let w=0;w<e.length;++w){let h=e[w],y=null;if(V(h))h.spaceBefore&&l.push(""),Eo(t,l,h.commentBefore,!1),h.comment&&(y=h.comment);else if(j(h)){let A=V(h.key)?h.key:null;A&&(A.spaceBefore&&l.push(""),Eo(t,l,A.commentBefore,!1),A.comment&&(u=!0));let S=V(h.value)?h.value:null;S?(S.comment&&(y=S.comment),S.commentBefore&&(u=!0)):h.value==null&&A?.comment&&(y=A.comment)}y&&(u=!0);let m=yt(h,c,()=>y=null);u||(u=l.length>f||m.includes(`
111
+ `)),w<e.length-1?m+=",":t.options.trailingComma&&(t.options.lineWidth>0&&(u||(u=l.reduce((A,S)=>A+S.length+2,2)+(m.length+2)>t.options.lineWidth)),u&&(m+=",")),y&&(m+=it(m,r,a(y))),l.push(m),f=l.length}let{start:p,end:d}=n;if(l.length===0)return p+d;if(!u){let w=l.reduce((h,y)=>h+y.length+2,2);u=t.options.lineWidth>0&&w>t.options.lineWidth}if(u){let w=p;for(let h of l)w+=h?`
112
+ ${s}${o}${h}`:`
113
+ `;return`${w}
114
+ ${o}${d}`}else return`${p}${i}${l.join(" ")}${i}${d}`}function Eo({indent:e,options:{commentString:t}},n,r,o){if(r&&o&&(r=r.replace(/^\n+/,"")),r){let s=Pe(t(r),e);n.push(s.trimStart())}}function Ct(e,t){let n=B(t)?t.value:t;for(let r of e)if(j(r)&&(r.key===t||r.key===n||B(r.key)&&r.key.value===n))return r}var se=class extends gn{static get tagName(){return"tag:yaml.org,2002:map"}constructor(t){super(Ue,t),this.items=[]}static from(t,n,r){let{keepUndefined:o,replacer:s}=r,i=new this(t),a=(c,u)=>{if(typeof s=="function")u=s.call(n,c,u);else if(Array.isArray(s)&&!s.includes(c))return;(u!==void 0||o)&&i.items.push(wn(c,u,r))};if(n instanceof Map)for(let[c,u]of n)a(c,u);else if(n&&typeof n=="object")for(let c of Object.keys(n))a(c,n[c]);return typeof t.sortMapEntries=="function"&&i.items.sort(t.sortMapEntries),i}add(t,n){let r;j(t)?r=t:!t||typeof t!="object"||!("key"in t)?r=new oe(t,t?.value):r=new oe(t.key,t.value);let o=Ct(this.items,r.key),s=this.schema?.sortMapEntries;if(o){if(!n)throw new Error(`Key ${r.key} already set`);B(o.value)&&ho(r.value)?o.value.value=r.value:o.value=r.value}else if(s){let i=this.items.findIndex(a=>s(r,a)<0);i===-1?this.items.push(r):this.items.splice(i,0,r)}else this.items.push(r)}delete(t){let n=Ct(this.items,t);return n?this.items.splice(this.items.indexOf(n),1).length>0:!1}get(t,n){let o=Ct(this.items,t)?.value;return(!n&&B(o)?o.value:o)??void 0}has(t){return!!Ct(this.items,t)}set(t,n){this.add(new oe(t,n),!0)}toJSON(t,n,r){let o=r?new r:n?.mapAsMap?new Map:{};n?.onCreate&&n.onCreate(o);for(let s of this.items)So(n,o,s);return o}toString(t,n,r){if(!t)return JSON.stringify(this);for(let o of this.items)if(!j(o))throw new Error(`Map items must all be pairs; found ${JSON.stringify(o)} instead`);return!t.allNullValues&&this.hasAllNullValues(!1)&&(t=Object.assign({},t,{allNullValues:!0})),Ao(this,t,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:t.indent||"",onChompKeep:r,onComment:n})}};var Ve={collection:"map",default:!0,nodeClass:se,tag:"tag:yaml.org,2002:map",resolve(e,t){return $e(e)||t("Expected a mapping for this tag"),e},createNode:(e,t,n)=>se.from(e,t,n)};var me=class extends gn{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(t){super(mt,t),this.items=[]}add(t){this.items.push(t)}delete(t){let n=ko(t);return typeof n!="number"?!1:this.items.splice(n,1).length>0}get(t,n){let r=ko(t);if(typeof r!="number")return;let o=this.items[r];return!n&&B(o)?o.value:o}has(t){let n=ko(t);return typeof n=="number"&&n<this.items.length}set(t,n){let r=ko(t);if(typeof r!="number")throw new Error(`Expected a valid index, not ${t}.`);let o=this.items[r];B(o)&&ho(n)?o.value=n:this.items[r]=n}toJSON(t,n){let r=[];n?.onCreate&&n.onCreate(r);let o=0;for(let s of this.items)r.push(le(s,String(o++),n));return r}toString(t,n,r){return t?Ao(this,t,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(t.indent||"")+" ",onChompKeep:r,onComment:n}):JSON.stringify(this)}static from(t,n,r){let{replacer:o}=r,s=new this(t);if(n&&Symbol.iterator in Object(n)){let i=0;for(let a of n){if(typeof o=="function"){let c=n instanceof Set?a:String(i++);a=o.call(n,c,a)}s.items.push(gt(a,void 0,r))}}return s}};function ko(e){let t=B(e)?e.value:e;return t&&typeof t=="string"&&(t=Number(t)),typeof t=="number"&&Number.isInteger(t)&&t>=0?t:null}var Qe={collection:"seq",default:!0,nodeClass:me,tag:"tag:yaml.org,2002:seq",resolve(e,t){return Le(e)||t("Expected a sequence for this tag"),e},createNode:(e,t,n)=>me.from(e,t,n)};var Tt={identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),Qt(e,t,n,r)}};var Gt={identify:e=>e==null,createNode:()=>new T(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new T(null),stringify:({source:e},t)=>typeof e=="string"&&Gt.test.test(e)?e:t.options.nullStr};var or={identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new T(e[0]==="t"||e[0]==="T"),stringify({source:e,value:t},n){if(e&&or.test.test(e)){let r=e[0]==="t"||e[0]==="T";if(t===r)return e}return t?n.options.trueStr:n.options.falseStr}};function he({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r=="bigint")return String(r);let o=typeof r=="number"?r:Number(r);if(!isFinite(o))return isNaN(o)?".nan":o<0?"-.inf":".inf";let s=Object.is(r,-0)?"-0":JSON.stringify(r);if(!e&&t&&(!n||n==="tag:yaml.org,2002:float")&&/^-?\d/.test(s)&&!s.includes("e")){let i=s.indexOf(".");i<0&&(i=s.length,s+=".");let a=t-(s.length-i-1);for(;a-- >0;)s+="0"}return s}var vo={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:he},Ro={identify:e=>typeof e=="number",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){let t=Number(e.value);return isFinite(t)?t.toExponential():he(e)}},Do={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new T(parseFloat(e)),n=e.indexOf(".");return n!==-1&&e[e.length-1]==="0"&&(t.minFractionDigits=e.length-n-1),t},stringify:he};var Io=e=>typeof e=="bigint"||Number.isInteger(e),xi=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function id(e,t,n){let{value:r}=e;return Io(r)&&r>=0?n+r.toString(t):he(e)}var Co={identify:e=>Io(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(e,t,n)=>xi(e,2,8,n),stringify:e=>id(e,8,"0o")},To={identify:Io,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>xi(e,0,10,n),stringify:he},Oo={identify:e=>Io(e)&&e>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>xi(e,2,16,n),stringify:e=>id(e,16,"0x")};var ad=[Ve,Qe,Tt,Gt,or,Co,To,Oo,vo,Ro,Do];function cd(e){return typeof e=="bigint"||Number.isInteger(e)}var No=({value:e})=>JSON.stringify(e),Hg=[{identify:e=>typeof e=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:e=>e,stringify:No},{identify:e=>e==null,createNode:()=>new T(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:No},{identify:e=>typeof e=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:e=>e==="true",stringify:No},{identify:cd,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})=>cd(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:No}],Yg={default:!0,tag:"",test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}},ud=[Ve,Qe].concat(Hg,Yg);var sr={identify:e=>e instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(e,t){if(typeof atob=="function"){let n=atob(e.replace(/[\n\r]/g,"")),r=new Uint8Array(n.length);for(let o=0;o<n.length;++o)r[o]=n.charCodeAt(o);return r}else return t("This environment does not support reading binary tags; either Buffer or atob is required"),e},stringify({comment:e,type:t,value:n},r,o,s){if(!n)return"";let i=n,a;if(typeof btoa=="function"){let c="";for(let u=0;u<i.length;++u)c+=String.fromCharCode(i[u]);a=btoa(c)}else throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");if(t??(t=T.BLOCK_LITERAL),t!==T.QUOTE_DOUBLE){let c=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),u=Math.ceil(a.length/c),f=new Array(u);for(let l=0,p=0;l<u;++l,p+=c)f[l]=a.substr(p,c);a=f.join(t===T.BLOCK_LITERAL?`
115
+ `:" ")}return Qt({comment:e,type:t,value:a},r,o,s)}};function _i(e,t){if(Le(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!j(r)){if($e(r)){r.items.length>1&&t("Each pair must have its own sequence indicator");let o=r.items[0]||new oe(new T(null));if(r.commentBefore&&(o.key.commentBefore=o.key.commentBefore?`${r.commentBefore}
116
116
  ${o.key.commentBefore}`:r.commentBefore),r.comment){let s=o.value??o.key;s.comment=s.comment?`${r.comment}
117
- ${s.comment}`:r.comment}r=o}t.items[n]=$(r)?r:new K(r)}}else e("Expected a sequence for this tag");return t}function bs(t,e,n){let{replacer:r}=n,o=new ne(t);o.tag="tag:yaml.org,2002:pairs";let s=0;if(e&&Symbol.iterator in Object(e))for(let i of e){typeof r=="function"&&(i=r.call(e,String(s++),i));let a,c;if(Array.isArray(i))if(i.length===2)a=i[0],c=i[1];else throw new TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let u=Object.keys(i);if(u.length===1)a=u[0],c=i[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=i;o.items.push(Qt(a,c,n))}return o}var On={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:gs,createNode:bs};var Vt=class t extends ne{constructor(){super(),this.add=W.prototype.add.bind(this),this.delete=W.prototype.delete.bind(this),this.get=W.prototype.get.bind(this),this.has=W.prototype.has.bind(this),this.set=W.prototype.set.bind(this),this.tag=t.tag}toJSON(e,n){if(!n)return super.toJSON(e);let r=new Map;n?.onCreate&&n.onCreate(r);for(let o of this.items){let s,i;if($(o)?(s=H(o.key,"",n),i=H(o.value,s,n)):s=H(o,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,i)}return r}static from(e,n,r){let o=bs(e,n,r),s=new this;return s.items=o.items,s}};Vt.tag="tag:yaml.org,2002:omap";var Cn={collection:"seq",identify:t=>t instanceof Map,nodeClass:Vt,default:!1,tag:"tag:yaml.org,2002:omap",resolve(t,e){let n=gs(t,e),r=[];for(let{key:o}of n.items)T(o)&&(r.includes(o.value)?e(`Ordered maps must not include duplicate keys: ${o.value}`):r.push(o.value));return Object.assign(new Vt,n)},createNode:(t,e,n)=>Vt.from(t,e,n)};function Zl({value:t,source:e},n){return e&&(t?ws:_s).test.test(e)?e:t?n.options.trueStr:n.options.falseStr}var ws={identify:t=>t===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new R(!0),stringify:Zl},_s={identify:t=>t===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new R(!1),stringify:Zl};var Bl={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:t=>t.slice(-3).toLowerCase()==="nan"?NaN:t[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:re},jl={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:t=>parseFloat(t.replace(/_/g,"")),stringify(t){let e=Number(t.value);return isFinite(e)?e.toExponential():re(t)}},Ul={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(t){let e=new R(parseFloat(t.replace(/_/g,""))),n=t.indexOf(".");if(n!==-1){let r=t.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(e.minFractionDigits=r.length)}return e},stringify:re};var Tn=t=>typeof t=="bigint"||Number.isInteger(t);function Ur(t,e,n,{intAsBigInt:r}){let o=t[0];if((o==="-"||o==="+")&&(e+=1),t=t.substring(e).replace(/_/g,""),r){switch(n){case 2:t=`0b${t}`;break;case 8:t=`0o${t}`;break;case 16:t=`0x${t}`;break}let i=BigInt(t);return o==="-"?BigInt(-1)*i:i}let s=parseInt(t,n);return o==="-"?-1*s:s}function xs(t,e,n){let{value:r}=t;if(Tn(r)){let o=r.toString(e);return r<0?"-"+n+o.substr(1):n+o}return re(t)}var Ql={identify:Tn,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(t,e,n)=>Ur(t,2,2,n),stringify:t=>xs(t,2,"0b")},Vl={identify:Tn,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(t,e,n)=>Ur(t,1,8,n),stringify:t=>xs(t,8,"0")},Gl={identify:Tn,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(t,e,n)=>Ur(t,0,10,n),stringify:re},ql={identify:Tn,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(t,e,n)=>Ur(t,2,16,n),stringify:t=>xs(t,16,"0x")};var Gt=class t extends W{constructor(e){super(e),this.tag=t.tag}add(e){let n;$(e)?n=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?n=new K(e.key,null):n=new K(e,null),at(this.items,n.key)||this.items.push(n)}get(e,n){let r=at(this.items,e);return!n&&$(r)?T(r.key)?r.key.value:r.key:r}set(e,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=at(this.items,e);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new K(e))}toJSON(e,n){return super.toJSON(e,n,Set)}toString(e,n,r){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(e,n,r){let{replacer:o}=r,s=new this(e);if(n&&Symbol.iterator in Object(n))for(let i of n)typeof o=="function"&&(i=o.call(n,i,i)),s.items.push(Qt(i,null,r));return s}};Gt.tag="tag:yaml.org,2002:set";var Nn={collection:"map",identify:t=>t instanceof Set,nodeClass:Gt,default:!1,tag:"tag:yaml.org,2002:set",createNode:(t,e,n)=>Gt.from(t,e,n),resolve(t,e){if(ye(t)){if(t.hasAllNullValues(!0))return Object.assign(new Gt,t);e("Set items must all have null values")}else e("Expected a mapping for this tag");return t}};function Es(t,e){let n=t[0],r=n==="-"||n==="+"?t.substring(1):t,o=i=>e?BigInt(i):Number(i),s=r.replace(/_/g,"").split(":").reduce((i,a)=>i*o(60)+o(a),o(0));return n==="-"?o(-1)*s:s}function Jl(t){let{value:e}=t,n=i=>i;if(typeof e=="bigint")n=i=>BigInt(i);else if(isNaN(e)||!isFinite(e))return re(t);let r="";e<0&&(r="-",e*=n(-1));let o=n(60),s=[e%o];return e<60?s.unshift(0):(e=(e-s[0])/o,s.unshift(e%o),e>=60&&(e=(e-s[0])/o,s.unshift(e))),r+s.map(i=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var Qr={identify:t=>typeof t=="bigint"||Number.isInteger(t),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(t,e,{intAsBigInt:n})=>Es(t,n),stringify:Jl},Vr={identify:t=>typeof t=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:t=>Es(t,!1),stringify:Jl},qt={identify:t=>t 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(t){let e=t.match(qt.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,o,s,i,a]=e.map(Number),c=e[7]?Number((e[7]+"00").substr(1,3)):0,u=Date.UTC(n,r-1,o,s||0,i||0,a||0,c),d=e[8];if(d&&d!=="Z"){let l=Es(d,!1);Math.abs(l)<30&&(l*=60),u-=6e4*l}return new Date(u)},stringify:({value:t})=>t?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var Ss=[ve,De,ct,xt,ws,_s,Ql,Vl,Gl,ql,Bl,jl,Ul,In,Ae,Cn,On,Nn,Qr,Vr,qt];var Kl=new Map([["core",Ll],["failsafe",[ve,De,ct]],["json",Fl],["yaml11",Ss],["yaml-1.1",Ss]]),Wl={binary:In,bool:kn,float:Lr,floatExp:Pr,floatNaN:zr,floatTime:Vr,int:Zr,intHex:Br,intOct:Fr,intTime:Qr,map:ve,merge:Ae,null:xt,omap:Cn,pairs:On,seq:De,set:Nn,timestamp:qt},Yl={"tag:yaml.org,2002:binary":In,"tag:yaml.org,2002:merge":Ae,"tag:yaml.org,2002:omap":Cn,"tag:yaml.org,2002:pairs":On,"tag:yaml.org,2002:set":Nn,"tag:yaml.org,2002:timestamp":qt};function Gr(t,e,n){let r=Kl.get(e);if(r&&!t)return n&&!r.includes(Ae)?r.concat(Ae):r.slice();let o=r;if(!o)if(Array.isArray(t))o=[];else{let s=Array.from(Kl.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${s} or define customTags array`)}if(Array.isArray(t))for(let s of t)o=o.concat(s);else typeof t=="function"&&(o=t(o.slice()));return n&&(o=o.concat(Ae)),o.reduce((s,i)=>{let a=typeof i=="string"?Wl[i]:i;if(!a){let c=JSON.stringify(i),u=Object.keys(Wl).map(d=>JSON.stringify(d)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return s.includes(a)||s.push(a),s},[])}var rh=(t,e)=>t.key<e.key?-1:t.key>e.key?1:0,$n=class t{constructor({compat:e,customTags:n,merge:r,resolveKnownTags:o,schema:s,sortMapEntries:i,toStringDefaults:a}){this.compat=Array.isArray(e)?Gr(e,"compat"):e?Gr(null,e):null,this.name=typeof s=="string"&&s||"core",this.knownTags=o?Yl:{},this.tags=Gr(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Se,{value:ve}),Object.defineProperty(this,pe,{value:ct}),Object.defineProperty(this,Ge,{value:De}),this.sortMapEntries=typeof i=="function"?i:i===!0?rh:null}clone(){let e=Object.create(t.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}};function Xl(t,e){let n=[],r=e.directives===!0;if(e.directives!==!1&&t.directives){let c=t.directives.toString(t);c?(n.push(c),r=!0):t.directives.docStart&&(r=!0)}r&&n.push("---");let o=Ir(t,e),{commentString:s}=o.options;if(t.commentBefore){n.length!==1&&n.unshift("");let c=s(t.commentBefore);n.unshift(be(c,""))}let i=!1,a=null;if(t.contents){if(z(t.contents)){if(t.contents.spaceBefore&&r&&n.push(""),t.contents.commentBefore){let d=s(t.contents.commentBefore);n.push(be(d,""))}o.forceBlockIndent=!!t.comment,a=t.contents.comment}let c=a?void 0:()=>i=!0,u=Ke(t.contents,o,()=>a=null,c);a&&(u+=Fe(u,"",s(a))),(u[0]==="|"||u[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${u}`:n.push(u)}else n.push(Ke(t.contents,o));if(t.directives?.docEnd)if(t.comment){let c=s(t.comment);c.includes(`
118
- `)?(n.push("..."),n.push(be(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=t.comment;c&&i&&(c=c.replace(/^\n+/,"")),c&&((!i||a)&&n[n.length-1]!==""&&n.push(""),n.push(be(s(c),"")))}return n.join(`
117
+ ${s.comment}`:r.comment}r=o}e.items[n]=j(r)?r:new oe(r)}}else t("Expected a sequence for this tag");return e}function Si(e,t,n){let{replacer:r}=n,o=new me(e);o.tag="tag:yaml.org,2002:pairs";let s=0;if(t&&Symbol.iterator in Object(t))for(let i of t){typeof r=="function"&&(i=r.call(t,String(s++),i));let a,c;if(Array.isArray(i))if(i.length===2)a=i[0],c=i[1];else throw new TypeError(`Expected [key, value] tuple: ${i}`);else if(i&&i instanceof Object){let u=Object.keys(i);if(u.length===1)a=u[0],c=i[a];else throw new TypeError(`Expected tuple with one key, not ${u.length} keys`)}else a=i;o.items.push(wn(a,c,n))}return o}var ir={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:_i,createNode:Si};var xn=class e extends me{constructor(){super(),this.add=se.prototype.add.bind(this),this.delete=se.prototype.delete.bind(this),this.get=se.prototype.get.bind(this),this.has=se.prototype.has.bind(this),this.set=se.prototype.set.bind(this),this.tag=e.tag}toJSON(t,n){if(!n)return super.toJSON(t);let r=new Map;n?.onCreate&&n.onCreate(r);for(let o of this.items){let s,i;if(j(o)?(s=le(o.key,"",n),i=le(o.value,s,n)):s=le(o,"",n),r.has(s))throw new Error("Ordered maps must not include duplicate keys");r.set(s,i)}return r}static from(t,n,r){let o=Si(t,n,r),s=new this;return s.items=o.items,s}};xn.tag="tag:yaml.org,2002:omap";var ar={collection:"seq",identify:e=>e instanceof Map,nodeClass:xn,default:!1,tag:"tag:yaml.org,2002:omap",resolve(e,t){let n=_i(e,t),r=[];for(let{key:o}of n.items)B(o)&&(r.includes(o.value)?t(`Ordered maps must not include duplicate keys: ${o.value}`):r.push(o.value));return Object.assign(new xn,n)},createNode:(e,t,n)=>xn.from(e,t,n)};function ld({value:e,source:t},n){return t&&(e?Ei:Ai).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var Ei={identify:e=>e===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new T(!0),stringify:ld},Ai={identify:e=>e===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new T(!1),stringify:ld};var fd={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()==="nan"?NaN:e[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:he},dd={identify:e=>typeof e=="number",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){let t=Number(e.value);return isFinite(t)?t.toExponential():he(e)}},pd={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new T(parseFloat(e.replace(/_/g,""))),n=e.indexOf(".");if(n!==-1){let r=e.substring(n+1).replace(/_/g,"");r[r.length-1]==="0"&&(t.minFractionDigits=r.length)}return t},stringify:he};var cr=e=>typeof e=="bigint"||Number.isInteger(e);function zo(e,t,n,{intAsBigInt:r}){let o=e[0];if((o==="-"||o==="+")&&(t+=1),e=e.substring(t).replace(/_/g,""),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`;break}let i=BigInt(e);return o==="-"?BigInt(-1)*i:i}let s=parseInt(e,n);return o==="-"?-1*s:s}function ki(e,t,n){let{value:r}=e;if(cr(r)){let o=r.toString(t);return r<0?"-"+n+o.substr(1):n+o}return he(e)}var md={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>zo(e,2,2,n),stringify:e=>ki(e,2,"0b")},hd={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>zo(e,1,8,n),stringify:e=>ki(e,8,"0")},gd={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>zo(e,0,10,n),stringify:he},yd={identify:cr,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>zo(e,2,16,n),stringify:e=>ki(e,16,"0x")};var _n=class e extends se{constructor(t){super(t),this.tag=e.tag}add(t){let n;j(t)?n=t:t&&typeof t=="object"&&"key"in t&&"value"in t&&t.value===null?n=new oe(t.key,null):n=new oe(t,null),Ct(this.items,n.key)||this.items.push(n)}get(t,n){let r=Ct(this.items,t);return!n&&j(r)?B(r.key)?r.key.value:r.key:r}set(t,n){if(typeof n!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof n}`);let r=Ct(this.items,t);r&&!n?this.items.splice(this.items.indexOf(r),1):!r&&n&&this.items.push(new oe(t))}toJSON(t,n){return super.toJSON(t,n,Set)}toString(t,n,r){if(!t)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},t,{allNullValues:!0}),n,r);throw new Error("Set items must all have null values")}static from(t,n,r){let{replacer:o}=r,s=new this(t);if(n&&Symbol.iterator in Object(n))for(let i of n)typeof o=="function"&&(i=o.call(n,i,i)),s.items.push(wn(i,null,r));return s}};_n.tag="tag:yaml.org,2002:set";var ur={collection:"map",identify:e=>e instanceof Set,nodeClass:_n,default:!1,tag:"tag:yaml.org,2002:set",createNode:(e,t,n)=>_n.from(e,t,n),resolve(e,t){if($e(e)){if(e.hasAllNullValues(!0))return Object.assign(new _n,e);t("Set items must all have null values")}else t("Expected a mapping for this tag");return e}};function vi(e,t){let n=e[0],r=n==="-"||n==="+"?e.substring(1):e,o=i=>t?BigInt(i):Number(i),s=r.replace(/_/g,"").split(":").reduce((i,a)=>i*o(60)+o(a),o(0));return n==="-"?o(-1)*s:s}function bd(e){let{value:t}=e,n=i=>i;if(typeof t=="bigint")n=i=>BigInt(i);else if(isNaN(t)||!isFinite(t))return he(e);let r="";t<0&&(r="-",t*=n(-1));let o=n(60),s=[t%o];return t<60?s.unshift(0):(t=(t-s[0])/o,s.unshift(t%o),t>=60&&(t=(t-s[0])/o,s.unshift(t))),r+s.map(i=>String(i).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}var $o={identify:e=>typeof e=="bigint"||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})=>vi(e,n),stringify:bd},Lo={identify:e=>typeof e=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>vi(e,!1),stringify:bd},Sn={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){let t=e.match(Sn.test);if(!t)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");let[,n,r,o,s,i,a]=t.map(Number),c=t[7]?Number((t[7]+"00").substr(1,3)):0,u=Date.UTC(n,r-1,o,s||0,i||0,a||0,c),f=t[8];if(f&&f!=="Z"){let l=vi(f,!1);Math.abs(l)<30&&(l*=60),u-=6e4*l}return new Date(u)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""};var Ri=[Ve,Qe,Tt,Gt,Ei,Ai,md,hd,gd,yd,fd,dd,pd,sr,je,ar,ir,ur,$o,Lo,Sn];var wd=new Map([["core",ad],["failsafe",[Ve,Qe,Tt]],["json",ud],["yaml11",Ri],["yaml-1.1",Ri]]),xd={binary:sr,bool:or,float:Do,floatExp:Ro,floatNaN:vo,floatTime:Lo,int:To,intHex:Oo,intOct:Co,intTime:$o,map:Ve,merge:je,null:Gt,omap:ar,pairs:ir,seq:Qe,set:ur,timestamp:Sn},_d={"tag:yaml.org,2002:binary":sr,"tag:yaml.org,2002:merge":je,"tag:yaml.org,2002:omap":ar,"tag:yaml.org,2002:pairs":ir,"tag:yaml.org,2002:set":ur,"tag:yaml.org,2002:timestamp":Sn};function Po(e,t,n){let r=wd.get(t);if(r&&!e)return n&&!r.includes(je)?r.concat(je):r.slice();let o=r;if(!o)if(Array.isArray(e))o=[];else{let s=Array.from(wd.keys()).filter(i=>i!=="yaml11").map(i=>JSON.stringify(i)).join(", ");throw new Error(`Unknown schema "${t}"; use one of ${s} or define customTags array`)}if(Array.isArray(e))for(let s of e)o=o.concat(s);else typeof e=="function"&&(o=e(o.slice()));return n&&(o=o.concat(je)),o.reduce((s,i)=>{let a=typeof i=="string"?xd[i]:i;if(!a){let c=JSON.stringify(i),u=Object.keys(xd).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${c}; use one of ${u}`)}return s.includes(a)||s.push(a),s},[])}var Xg=(e,t)=>e.key<t.key?-1:e.key>t.key?1:0,lr=class e{constructor({compat:t,customTags:n,merge:r,resolveKnownTags:o,schema:s,sortMapEntries:i,toStringDefaults:a}){this.compat=Array.isArray(t)?Po(t,"compat"):t?Po(null,t):null,this.name=typeof s=="string"&&s||"core",this.knownTags=o?_d:{},this.tags=Po(n,this.name,r),this.toStringOptions=a??null,Object.defineProperty(this,Ue,{value:Ve}),Object.defineProperty(this,Ie,{value:Tt}),Object.defineProperty(this,mt,{value:Qe}),this.sortMapEntries=typeof i=="function"?i:i===!0?Xg:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function Sd(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let c=e.directives.toString(e);c?(n.push(c),r=!0):e.directives.docStart&&(r=!0)}r&&n.push("---");let o=xo(e,t),{commentString:s}=o.options;if(e.commentBefore){n.length!==1&&n.unshift("");let c=s(e.commentBefore);n.unshift(Pe(c,""))}let i=!1,a=null;if(e.contents){if(V(e.contents)){if(e.contents.spaceBefore&&r&&n.push(""),e.contents.commentBefore){let f=s(e.contents.commentBefore);n.push(Pe(f,""))}o.forceBlockIndent=!!e.comment,a=e.contents.comment}let c=a?void 0:()=>i=!0,u=yt(e.contents,o,()=>a=null,c);a&&(u+=it(u,"",s(a))),(u[0]==="|"||u[0]===">")&&n[n.length-1]==="---"?n[n.length-1]=`--- ${u}`:n.push(u)}else n.push(yt(e.contents,o));if(e.directives?.docEnd)if(e.comment){let c=s(e.comment);c.includes(`
118
+ `)?(n.push("..."),n.push(Pe(c,""))):n.push(`... ${c}`)}else n.push("...");else{let c=e.comment;c&&i&&(c=c.replace(/^\n+/,"")),c&&((!i||a)&&n[n.length-1]!==""&&n.push(""),n.push(Pe(s(c),"")))}return n.join(`
119
119
  `)+`
120
- `}var ut=class t{constructor(e,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,ie,{value:wr});let o=null;typeof n=="function"||Array.isArray(n)?o=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:i}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(i=this.directives.yaml.version)):this.directives=new Me({version:i}),this.setSchema(i,r),this.contents=e===void 0?null:this.createNode(e,o,r)}clone(){let e=Object.create(t.prototype,{[ie]:{value:wr}});return e.commentBefore=this.commentBefore,e.comment=this.comment,e.errors=this.errors.slice(),e.warnings=this.warnings.slice(),e.options=Object.assign({},this.options),this.directives&&(e.directives=this.directives.clone()),e.schema=this.schema.clone(),e.contents=z(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Jt(this.contents)&&this.contents.add(e)}addIn(e,n){Jt(this.contents)&&this.contents.addIn(e,n)}createAlias(e,n){if(!e.anchor){let r=cs(this);e.anchor=!n||r.has(n)?us(n||"a",r):n}return new qe(e.anchor)}createNode(e,n,r){let o;if(typeof n=="function")e=n.call({"":e},"",e),o=n;else if(Array.isArray(n)){let h=x=>typeof x=="number"||x instanceof String||x instanceof Number,g=n.filter(h).map(String);g.length>0&&(n=n.concat(g)),o=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:i,flow:a,keepUndefined:c,onTagObj:u,tag:d}=r??{},{onAnchor:l,setAnchors:f,sourceObjects:p}=Ol(this,i||"a"),y={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:l,onTagObj:u,replacer:o,schema:this.schema,sourceObjects:p},m=Je(e,d,y);return a&&B(m)&&(m.flow=!0),f(),m}createPair(e,n,r={}){let o=this.createNode(e,null,r),s=this.createNode(n,null,r);return new K(o,s)}delete(e){return Jt(this.contents)?this.contents.delete(e):!1}deleteIn(e){return jt(e)?this.contents==null?!1:(this.contents=null,!0):Jt(this.contents)?this.contents.deleteIn(e):!1}get(e,n){return B(this.contents)?this.contents.get(e,n):void 0}getIn(e,n){return jt(e)?!n&&T(this.contents)?this.contents.value:this.contents:B(this.contents)?this.contents.getIn(e,n):void 0}has(e){return B(this.contents)?this.contents.has(e):!1}hasIn(e){return jt(e)?this.contents!==void 0:B(this.contents)?this.contents.hasIn(e):!1}set(e,n){this.contents==null?this.contents=An(this.schema,[e],n):Jt(this.contents)&&this.contents.set(e,n)}setIn(e,n){jt(e)?this.contents=n:this.contents==null?this.contents=An(this.schema,Array.from(e),n):Jt(this.contents)&&this.contents.setIn(e,n)}setSchema(e,n={}){typeof e=="number"&&(e=String(e));let r;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new Me({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new Me({version:e}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let o=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new $n(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:n,mapAsMap:r,maxAliasCount:o,onAnchor:s,reviver:i}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},c=H(this.contents,n??"",a);if(typeof s=="function")for(let{count:u,res:d}of a.anchors.values())s(d,u);return typeof i=="function"?st(i,{"":c},"",c):c}toJSON(e,n){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:n})}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)){let n=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Xl(this,e)}};function Jt(t){if(B(t))return!0;throw new Error("Expected a YAML collection as document contents")}var zn=class extends Error{constructor(e,n,r,o){super(),this.name=e,this.code=r,this.message=o,this.pos=n}},Re=class extends zn{constructor(e,n,r){super("YAMLParseError",e,n,r)}},Pn=class extends zn{constructor(e,n,r){super("YAMLWarning",e,n,r)}},As=(t,e)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>e.linePos(a));let{line:r,col:o}=n.linePos[0];n.message+=` at line ${r}, column ${o}`;let s=o-1,i=t.substring(e.lineStarts[r-1],e.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&i.length>80){let a=Math.min(s-39,i.length-79);i="\u2026"+i.substring(a),s-=a-1}if(i.length>80&&(i=i.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(i.substring(0,s))){let a=t.substring(e.lineStarts[r-2],e.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
120
+ `}var Ot=class e{constructor(t,n,r){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,xe,{value:uo});let o=null;typeof n=="function"||Array.isArray(n)?o=n:r===void 0&&n&&(r=n,n=void 0);let s=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},r);this.options=s;let{version:i}=s;r?._directives?(this.directives=r._directives.atDocument(),this.directives.yaml.explicit&&(i=this.directives.yaml.version)):this.directives=new st({version:i}),this.setSchema(i,r),this.contents=t===void 0?null:this.createNode(t,o,r)}clone(){let t=Object.create(e.prototype,{[xe]:{value:uo}});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=V(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(t){En(this.contents)&&this.contents.add(t)}addIn(t,n){En(this.contents)&&this.contents.addIn(t,n)}createAlias(t,n){if(!t.anchor){let r=di(this);t.anchor=!n||r.has(n)?pi(n||"a",r):n}return new ht(t.anchor)}createNode(t,n,r){let o;if(typeof n=="function")t=n.call({"":t},"",t),o=n;else if(Array.isArray(n)){let y=A=>typeof A=="number"||A instanceof String||A instanceof Number,m=n.filter(y).map(String);m.length>0&&(n=n.concat(m)),o=n}else r===void 0&&n&&(r=n,n=void 0);let{aliasDuplicateObjects:s,anchorPrefix:i,flow:a,keepUndefined:c,onTagObj:u,tag:f}=r??{},{onAnchor:l,setAnchors:p,sourceObjects:d}=ed(this,i||"a"),w={aliasDuplicateObjects:s??!0,keepUndefined:c??!1,onAnchor:l,onTagObj:u,replacer:o,schema:this.schema,sourceObjects:d},h=gt(t,f,w);return a&&K(h)&&(h.flow=!0),p(),h}createPair(t,n,r={}){let o=this.createNode(t,null,r),s=this.createNode(n,null,r);return new oe(o,s)}delete(t){return En(this.contents)?this.contents.delete(t):!1}deleteIn(t){return yn(t)?this.contents==null?!1:(this.contents=null,!0):En(this.contents)?this.contents.deleteIn(t):!1}get(t,n){return K(this.contents)?this.contents.get(t,n):void 0}getIn(t,n){return yn(t)?!n&&B(this.contents)?this.contents.value:this.contents:K(this.contents)?this.contents.getIn(t,n):void 0}has(t){return K(this.contents)?this.contents.has(t):!1}hasIn(t){return yn(t)?this.contents!==void 0:K(this.contents)?this.contents.hasIn(t):!1}set(t,n){this.contents==null?this.contents=er(this.schema,[t],n):En(this.contents)&&this.contents.set(t,n)}setIn(t,n){yn(t)?this.contents=n:this.contents==null?this.contents=er(this.schema,Array.from(t),n):En(this.contents)&&this.contents.setIn(t,n)}setSchema(t,n={}){typeof t=="number"&&(t=String(t));let r;switch(t){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new st({version:"1.1"}),r={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=t:this.directives=new st({version:t}),r={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,r=null;break;default:{let o=JSON.stringify(t);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${o}`)}}if(n.schema instanceof Object)this.schema=n.schema;else if(r)this.schema=new lr(Object.assign(r,n));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:t,jsonArg:n,mapAsMap:r,maxAliasCount:o,onAnchor:s,reviver:i}={}){let a={anchors:new Map,doc:this,keep:!t,mapAsMap:r===!0,mapKeyWarned:!1,maxAliasCount:typeof o=="number"?o:100},c=le(this.contents,n??"",a);if(typeof s=="function")for(let{count:u,res:f}of a.anchors.values())s(f,u);return typeof i=="function"?Dt(i,{"":c},"",c):c}toJSON(t,n){return this.toJS({json:!0,jsonArg:t,mapAsMap:!1,onAnchor:n})}toString(t={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in t&&(!Number.isInteger(t.indent)||Number(t.indent)<=0)){let n=JSON.stringify(t.indent);throw new Error(`"indent" option must be a positive integer, not ${n}`)}return Sd(this,t)}};function En(e){if(K(e))return!0;throw new Error("Expected a YAML collection as document contents")}var fr=class extends Error{constructor(t,n,r,o){super(),this.name=t,this.code=r,this.message=o,this.pos=n}},Ge=class extends fr{constructor(t,n,r){super("YAMLParseError",t,n,r)}},dr=class extends fr{constructor(t,n,r){super("YAMLWarning",t,n,r)}},Di=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(a=>t.linePos(a));let{line:r,col:o}=n.linePos[0];n.message+=` at line ${r}, column ${o}`;let s=o-1,i=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,"");if(s>=60&&i.length>80){let a=Math.min(s-39,i.length-79);i="\u2026"+i.substring(a),s-=a-1}if(i.length>80&&(i=i.substring(0,79)+"\u2026"),r>1&&/^ *$/.test(i.substring(0,s))){let a=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);a.length>80&&(a=a.substring(0,79)+`\u2026
121
121
  `),i=a+i}if(/[^ ]/.test(i)){let a=1,c=n.linePos[1];c?.line===r&&c.col>o&&(a=Math.max(1,Math.min(c.col-o,80-s)));let u=" ".repeat(s)+"^".repeat(a);n.message+=`:
122
122
 
123
123
  ${i}
124
124
  ${u}
125
- `}};function Ze(t,{flow:e,indicator:n,next:r,offset:o,onError:s,parentIndent:i,startOnNewline:a}){let c=!1,u=a,d=a,l="",f="",p=!1,y=!1,m=null,h=null,g=null,x=null,S=null,_=null,w=null;for(let E of t)switch(y&&(E.type!=="space"&&E.type!=="newline"&&E.type!=="comma"&&s(E.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),y=!1),m&&(u&&E.type!=="comment"&&E.type!=="newline"&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),m=null),E.type){case"space":!e&&(n!=="doc-start"||r?.type!=="flow-collection")&&E.source.includes(" ")&&(m=E),d=!0;break;case"comment":{d||s(E,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let C=E.source.substring(1)||" ";l?l+=f+C:l=C,f="",u=!1;break}case"newline":u?l?l+=E.source:(!_||n!=="seq-item-ind")&&(c=!0):f+=E.source,u=!0,p=!0,(h||g)&&(x=E),d=!0;break;case"anchor":h&&s(E,"MULTIPLE_ANCHORS","A node can have at most one anchor"),E.source.endsWith(":")&&s(E.offset+E.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),h=E,w??(w=E.offset),u=!1,d=!1,y=!0;break;case"tag":{g&&s(E,"MULTIPLE_TAGS","A node can have at most one tag"),g=E,w??(w=E.offset),u=!1,d=!1,y=!0;break}case n:(h||g)&&s(E,"BAD_PROP_ORDER",`Anchors and tags must be after the ${E.source} indicator`),_&&s(E,"UNEXPECTED_TOKEN",`Unexpected ${E.source} in ${e??"collection"}`),_=E,u=n==="seq-item-ind"||n==="explicit-key-ind",d=!1;break;case"comma":if(e){S&&s(E,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),S=E,u=!1,d=!1;break}default:s(E,"UNEXPECTED_TOKEN",`Unexpected ${E.type} token`),u=!1,d=!1}let A=t[t.length-1],D=A?A.offset+A.source.length:o;return y&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m&&(u&&m.indent<=i||r?.type==="block-map"||r?.type==="block-seq")&&s(m,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:_,spaceBefore:c,comment:l,hasNewline:p,anchor:h,tag:g,newlineAfterProp:x,end:D,start:w??D}}function lt(t){if(!t)return null;switch(t.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(t.source.includes(`
126
- `))return!0;if(t.end){for(let e of t.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of t.items){for(let n of e.start)if(n.type==="newline")return!0;if(e.sep){for(let n of e.sep)if(n.type==="newline")return!0}if(lt(e.key)||lt(e.value))return!0}return!1;default:return!0}}function Ln(t,e,n){if(e?.type==="flow-collection"){let r=e.end[0];r.indent===t&&(r.source==="]"||r.source==="}")&&lt(e)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function qr(t,e,n){let{uniqueKeys:r}=t.options;if(r===!1)return!1;let o=typeof r=="function"?r:(s,i)=>s===i||T(s)&&T(i)&&s.value===i.value;return e.some(s=>o(s.key,n))}var Hl="All mapping items must start at the same column";function ef({composeNode:t,composeEmptyNode:e},n,r,o,s){let i=s?.nodeClass??W,a=new i(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,u=null;for(let d of r.items){let{start:l,key:f,sep:p,value:y}=d,m=Ze(l,{indicator:"explicit-key-ind",next:f??p?.[0],offset:c,onError:o,parentIndent:r.indent,startOnNewline:!0}),h=!m.found;if(h){if(f&&(f.type==="block-seq"?o(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in f&&f.indent!==r.indent&&o(c,"BAD_INDENT",Hl)),!m.anchor&&!m.tag&&!p){u=m.end,m.comment&&(a.comment?a.comment+=`
127
- `+m.comment:a.comment=m.comment);continue}(m.newlineAfterProp||lt(f))&&o(f??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else m.found?.indent!==r.indent&&o(c,"BAD_INDENT",Hl);n.atKey=!0;let g=m.end,x=f?t(n,f,m,o):e(n,g,l,null,m,o);n.schema.compat&&Ln(r.indent,f,o),n.atKey=!1,qr(n,a.items,x)&&o(g,"DUPLICATE_KEY","Map keys must be unique");let S=Ze(p??[],{indicator:"map-value-ind",next:y,offset:x.range[2],onError:o,parentIndent:r.indent,startOnNewline:!f||f.type==="block-scalar"});if(c=S.end,S.found){h&&(y?.type==="block-map"&&!S.hasNewline&&o(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&m.start<S.found.offset-1024&&o(x.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let _=y?t(n,y,S,o):e(n,c,p,null,S,o);n.schema.compat&&Ln(r.indent,y,o),c=_.range[2];let w=new K(x,_);n.options.keepSourceTokens&&(w.srcToken=d),a.items.push(w)}else{h&&o(x.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(x.comment?x.comment+=`
128
- `+S.comment:x.comment=S.comment);let _=new K(x);n.options.keepSourceTokens&&(_.srcToken=d),a.items.push(_)}}return u&&u<c&&o(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,u??c],a}function tf({composeNode:t,composeEmptyNode:e},n,r,o,s){let i=s?.nodeClass??ne,a=new i(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,u=null;for(let{start:d,value:l}of r.items){let f=Ze(d,{indicator:"seq-item-ind",next:l,offset:c,onError:o,parentIndent:r.indent,startOnNewline:!0});if(!f.found)if(f.anchor||f.tag||l)l?.type==="block-seq"?o(f.end,"BAD_INDENT","All sequence items must start at the same column"):o(c,"MISSING_CHAR","Sequence item without - indicator");else{u=f.end,f.comment&&(a.comment=f.comment);continue}let p=l?t(n,l,f,o):e(n,f.end,d,null,f,o);n.schema.compat&&Ln(r.indent,l,o),c=p.range[2],a.items.push(p)}return a.range=[r.offset,c,u??c],a}function Be(t,e,n,r){let o="";if(t){let s=!1,i="";for(let a of t){let{source:c,type:u}=a;switch(u){case"space":s=!0;break;case"comment":{n&&!s&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let d=c.substring(1)||" ";o?o+=i+d:o=d,i="";break}case"newline":o&&(i+=c),s=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}e+=c.length}}return{comment:o,offset:e}}var vs="Block collections are not allowed within flow collections",Ds=t=>t&&(t.type==="block-map"||t.type==="block-seq");function nf({composeNode:t,composeEmptyNode:e},n,r,o,s){let i=r.start.source==="{",a=i?"flow map":"flow sequence",c=s?.nodeClass??(i?W:ne),u=new c(n.schema);u.flow=!0;let d=n.atRoot;d&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=r.offset+r.start.source.length;for(let h=0;h<r.items.length;++h){let g=r.items[h],{start:x,key:S,sep:_,value:w}=g,A=Ze(x,{flow:a,indicator:"explicit-key-ind",next:S??_?.[0],offset:l,onError:o,parentIndent:r.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!_&&!w){h===0&&A.comma?o(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):h<r.items.length-1&&o(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),A.comment&&(u.comment?u.comment+=`
129
- `+A.comment:u.comment=A.comment),l=A.end;continue}!i&&n.options.strict&&lt(S)&&o(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(h===0)A.comma&&o(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(A.comma||o(A.start,"MISSING_CHAR",`Missing , between ${a} items`),A.comment){let D="";e:for(let E of x)switch(E.type){case"comma":case"space":break;case"comment":D=E.source.substring(1);break e;default:break e}if(D){let E=u.items[u.items.length-1];$(E)&&(E=E.value??E.key),E.comment?E.comment+=`
130
- `+D:E.comment=D,A.comment=A.comment.substring(D.length+1)}}if(!i&&!_&&!A.found){let D=w?t(n,w,A,o):e(n,A.end,_,null,A,o);u.items.push(D),l=D.range[2],Ds(w)&&o(D.range,"BLOCK_IN_FLOW",vs)}else{n.atKey=!0;let D=A.end,E=S?t(n,S,A,o):e(n,D,x,null,A,o);Ds(S)&&o(E.range,"BLOCK_IN_FLOW",vs),n.atKey=!1;let C=Ze(_??[],{flow:a,indicator:"map-value-ind",next:w,offset:E.range[2],onError:o,parentIndent:r.indent,startOnNewline:!1});if(C.found){if(!i&&!A.found&&n.options.strict){if(_)for(let L of _){if(L===C.found)break;if(L.type==="newline"){o(L,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<C.found.offset-1024&&o(C.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source?.[0]===":"?o(w,"MISSING_CHAR",`Missing space after : in ${a}`):o(C.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let P=w?t(n,w,C,o):C.found?e(n,C.end,_,null,C,o):null;P?Ds(w)&&o(P.range,"BLOCK_IN_FLOW",vs):C.comment&&(E.comment?E.comment+=`
131
- `+C.comment:E.comment=C.comment);let G=new K(E,P);if(n.options.keepSourceTokens&&(G.srcToken=g),i){let L=u;qr(n,L.items,E)&&o(D,"DUPLICATE_KEY","Map keys must be unique"),L.items.push(G)}else{let L=new W(n.schema);L.flow=!0,L.items.push(G);let yt=(P??E).range;L.range=[E.range[0],yt[1],yt[2]],u.items.push(L)}l=P?P.range[2]:C.end}}let f=i?"}":"]",[p,...y]=r.end,m=l;if(p?.source===f)m=p.offset+p.source.length;else{let h=a[0].toUpperCase()+a.substring(1),g=d?`${h} must end with a ${f}`:`${h} in block collection must be sufficiently indented and end with a ${f}`;o(l,d?"MISSING_CHAR":"BAD_INDENT",g),p&&p.source.length!==1&&y.unshift(p)}if(y.length>0){let h=Be(y,m,n.options.strict,o);h.comment&&(u.comment?u.comment+=`
132
- `+h.comment:u.comment=h.comment),u.range=[r.offset,m,h.offset]}else u.range=[r.offset,m,m];return u}function Rs(t,e,n,r,o,s){let i=n.type==="block-map"?ef(t,e,n,r,s):n.type==="block-seq"?tf(t,e,n,r,s):nf(t,e,n,r,s),a=i.constructor;return o==="!"||o===a.tagName?(i.tag=a.tagName,i):(o&&(i.tag=o),i)}function rf(t,e,n,r,o){let s=r.tag,i=s?e.directives.tagName(s.source,f=>o(s,"TAG_RESOLVE_FAILED",f)):null;if(n.type==="block-seq"){let{anchor:f,newlineAfterProp:p}=r,y=f&&s?f.offset>s.offset?f:s:f??s;y&&(!p||p.offset<y.offset)&&o(y,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!i||i==="!"||i===W.tagName&&a==="map"||i===ne.tagName&&a==="seq")return Rs(t,e,n,o,i);let c=e.schema.tags.find(f=>f.tag===i&&f.collection===a);if(!c){let f=e.schema.knownTags[i];if(f?.collection===a)e.schema.tags.push(Object.assign({},f,{default:!1})),c=f;else return f?o(s,"BAD_COLLECTION_TYPE",`${f.tag} used for ${a} collection, but expects ${f.collection??"scalar"}`,!0):o(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0),Rs(t,e,n,o,i)}let u=Rs(t,e,n,o,i,c),d=c.resolve?.(u,f=>o(s,"TAG_RESOLVE_FAILED",f),e.options)??u,l=z(d)?d:new R(d);return l.range=u.range,l.tag=i,c?.format&&(l.format=c.format),l}function ks(t,e,n){let r=e.offset,o=oh(e,t.options.strict,n);if(!o)return{value:"",type:null,comment:"",range:[r,r,r]};let s=o.mode===">"?R.BLOCK_FOLDED:R.BLOCK_LITERAL,i=e.source?sh(e.source):[],a=i.length;for(let m=i.length-1;m>=0;--m){let h=i[m][1];if(h===""||h==="\r")a=m;else break}if(a===0){let m=o.chomp==="+"&&i.length>0?`
133
- `.repeat(Math.max(1,i.length-1)):"",h=r+o.length;return e.source&&(h+=e.source.length),{value:m,type:s,comment:o.comment,range:[r,h,h]}}let c=e.indent+o.indent,u=e.offset+o.length,d=0;for(let m=0;m<a;++m){let[h,g]=i[m];if(g===""||g==="\r")o.indent===0&&h.length>c&&(c=h.length);else{h.length<c&&n(u+h.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),o.indent===0&&(c=h.length),d=m,c===0&&!t.atRoot&&n(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=h.length+g.length+1}for(let m=i.length-1;m>=a;--m)i[m][0].length>c&&(a=m+1);let l="",f="",p=!1;for(let m=0;m<d;++m)l+=i[m][0].slice(c)+`
134
- `;for(let m=d;m<a;++m){let[h,g]=i[m];u+=h.length+g.length+1;let x=g[g.length-1]==="\r";if(x&&(g=g.slice(0,-1)),g&&h.length<c){let _=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;n(u-g.length-(x?2:1),"BAD_INDENT",_),h=""}s===R.BLOCK_LITERAL?(l+=f+h.slice(c)+g,f=`
135
- `):h.length>c||g[0]===" "?(f===" "?f=`
136
- `:!p&&f===`
137
- `&&(f=`
125
+ `}};function at(e,{flow:t,indicator:n,next:r,offset:o,onError:s,parentIndent:i,startOnNewline:a}){let c=!1,u=a,f=a,l="",p="",d=!1,w=!1,h=null,y=null,m=null,A=null,S=null,E=null,_=null;for(let v of e)switch(w&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&s(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),w=!1),h&&(u&&v.type!=="comment"&&v.type!=="newline"&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),h=null),v.type){case"space":!t&&(n!=="doc-start"||r?.type!=="flow-collection")&&v.source.includes(" ")&&(h=v),f=!0;break;case"comment":{f||s(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let I=v.source.substring(1)||" ";l?l+=p+I:l=I,p="",u=!1;break}case"newline":u?l?l+=v.source:(!E||n!=="seq-item-ind")&&(c=!0):p+=v.source,u=!0,d=!0,(y||m)&&(A=v),f=!0;break;case"anchor":y&&s(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&s(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),y=v,_??(_=v.offset),u=!1,f=!1,w=!0;break;case"tag":{m&&s(v,"MULTIPLE_TAGS","A node can have at most one tag"),m=v,_??(_=v.offset),u=!1,f=!1,w=!0;break}case n:(y||m)&&s(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),E&&s(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${t??"collection"}`),E=v,u=n==="seq-item-ind"||n==="explicit-key-ind",f=!1;break;case"comma":if(t){S&&s(v,"UNEXPECTED_TOKEN",`Unexpected , in ${t}`),S=v,u=!1,f=!1;break}default:s(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),u=!1,f=!1}let x=e[e.length-1],R=x?x.offset+x.source.length:o;return w&&r&&r.type!=="space"&&r.type!=="newline"&&r.type!=="comma"&&(r.type!=="scalar"||r.source!=="")&&s(r.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),h&&(u&&h.indent<=i||r?.type==="block-map"||r?.type==="block-seq")&&s(h,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:S,found:E,spaceBefore:c,comment:l,hasNewline:d,anchor:y,tag:m,newlineAfterProp:A,end:R,start:_??R}}function Nt(e){if(!e)return null;switch(e.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(e.source.includes(`
126
+ `))return!0;if(e.end){for(let t of e.end)if(t.type==="newline")return!0}return!1;case"flow-collection":for(let t of e.items){for(let n of t.start)if(n.type==="newline")return!0;if(t.sep){for(let n of t.sep)if(n.type==="newline")return!0}if(Nt(t.key)||Nt(t.value))return!0}return!1;default:return!0}}function pr(e,t,n){if(t?.type==="flow-collection"){let r=t.end[0];r.indent===e&&(r.source==="]"||r.source==="}")&&Nt(t)&&n(r,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function Fo(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let o=typeof r=="function"?r:(s,i)=>s===i||B(s)&&B(i)&&s.value===i.value;return t.some(s=>o(s.key,n))}var Ed="All mapping items must start at the same column";function Ad({composeNode:e,composeEmptyNode:t},n,r,o,s){let i=s?.nodeClass??se,a=new i(n.schema);n.atRoot&&(n.atRoot=!1);let c=r.offset,u=null;for(let f of r.items){let{start:l,key:p,sep:d,value:w}=f,h=at(l,{indicator:"explicit-key-ind",next:p??d?.[0],offset:c,onError:o,parentIndent:r.indent,startOnNewline:!0}),y=!h.found;if(y){if(p&&(p.type==="block-seq"?o(c,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in p&&p.indent!==r.indent&&o(c,"BAD_INDENT",Ed)),!h.anchor&&!h.tag&&!d){u=h.end,h.comment&&(a.comment?a.comment+=`
127
+ `+h.comment:a.comment=h.comment);continue}(h.newlineAfterProp||Nt(p))&&o(p??l[l.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else h.found?.indent!==r.indent&&o(c,"BAD_INDENT",Ed);n.atKey=!0;let m=h.end,A=p?e(n,p,h,o):t(n,m,l,null,h,o);n.schema.compat&&pr(r.indent,p,o),n.atKey=!1,Fo(n,a.items,A)&&o(m,"DUPLICATE_KEY","Map keys must be unique");let S=at(d??[],{indicator:"map-value-ind",next:w,offset:A.range[2],onError:o,parentIndent:r.indent,startOnNewline:!p||p.type==="block-scalar"});if(c=S.end,S.found){y&&(w?.type==="block-map"&&!S.hasNewline&&o(c,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),n.options.strict&&h.start<S.found.offset-1024&&o(A.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let E=w?e(n,w,S,o):t(n,c,d,null,S,o);n.schema.compat&&pr(r.indent,w,o),c=E.range[2];let _=new oe(A,E);n.options.keepSourceTokens&&(_.srcToken=f),a.items.push(_)}else{y&&o(A.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),S.comment&&(A.comment?A.comment+=`
128
+ `+S.comment:A.comment=S.comment);let E=new oe(A);n.options.keepSourceTokens&&(E.srcToken=f),a.items.push(E)}}return u&&u<c&&o(u,"IMPOSSIBLE","Map comment with trailing content"),a.range=[r.offset,c,u??c],a}function kd({composeNode:e,composeEmptyNode:t},n,r,o,s){let i=s?.nodeClass??me,a=new i(n.schema);n.atRoot&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let c=r.offset,u=null;for(let{start:f,value:l}of r.items){let p=at(f,{indicator:"seq-item-ind",next:l,offset:c,onError:o,parentIndent:r.indent,startOnNewline:!0});if(!p.found)if(p.anchor||p.tag||l)l?.type==="block-seq"?o(p.end,"BAD_INDENT","All sequence items must start at the same column"):o(c,"MISSING_CHAR","Sequence item without - indicator");else{u=p.end,p.comment&&(a.comment=p.comment);continue}let d=l?e(n,l,p,o):t(n,p.end,f,null,p,o);n.schema.compat&&pr(r.indent,l,o),c=d.range[2],a.items.push(d)}return a.range=[r.offset,c,u??c],a}function ct(e,t,n,r){let o="";if(e){let s=!1,i="";for(let a of e){let{source:c,type:u}=a;switch(u){case"space":s=!0;break;case"comment":{n&&!s&&r(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=c.substring(1)||" ";o?o+=i+f:o=f,i="";break}case"newline":o&&(i+=c),s=!0;break;default:r(a,"UNEXPECTED_TOKEN",`Unexpected ${u} at node end`)}t+=c.length}}return{comment:o,offset:t}}var Ii="Block collections are not allowed within flow collections",Ci=e=>e&&(e.type==="block-map"||e.type==="block-seq");function vd({composeNode:e,composeEmptyNode:t},n,r,o,s){let i=r.start.source==="{",a=i?"flow map":"flow sequence",c=s?.nodeClass??(i?se:me),u=new c(n.schema);u.flow=!0;let f=n.atRoot;f&&(n.atRoot=!1),n.atKey&&(n.atKey=!1);let l=r.offset+r.start.source.length;for(let y=0;y<r.items.length;++y){let m=r.items[y],{start:A,key:S,sep:E,value:_}=m,x=at(A,{flow:a,indicator:"explicit-key-ind",next:S??E?.[0],offset:l,onError:o,parentIndent:r.indent,startOnNewline:!1});if(!x.found){if(!x.anchor&&!x.tag&&!E&&!_){y===0&&x.comma?o(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):y<r.items.length-1&&o(x.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),x.comment&&(u.comment?u.comment+=`
129
+ `+x.comment:u.comment=x.comment),l=x.end;continue}!i&&n.options.strict&&Nt(S)&&o(S,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(y===0)x.comma&&o(x.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(x.comma||o(x.start,"MISSING_CHAR",`Missing , between ${a} items`),x.comment){let R="";e:for(let v of A)switch(v.type){case"comma":case"space":break;case"comment":R=v.source.substring(1);break e;default:break e}if(R){let v=u.items[u.items.length-1];j(v)&&(v=v.value??v.key),v.comment?v.comment+=`
130
+ `+R:v.comment=R,x.comment=x.comment.substring(R.length+1)}}if(!i&&!E&&!x.found){let R=_?e(n,_,x,o):t(n,x.end,E,null,x,o);u.items.push(R),l=R.range[2],Ci(_)&&o(R.range,"BLOCK_IN_FLOW",Ii)}else{n.atKey=!0;let R=x.end,v=S?e(n,S,x,o):t(n,R,A,null,x,o);Ci(S)&&o(v.range,"BLOCK_IN_FLOW",Ii),n.atKey=!1;let I=at(E??[],{flow:a,indicator:"map-value-ind",next:_,offset:v.range[2],onError:o,parentIndent:r.indent,startOnNewline:!1});if(I.found){if(!i&&!x.found&&n.options.strict){if(E)for(let O of E){if(O===I.found)break;if(O.type==="newline"){o(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}x.start<I.found.offset-1024&&o(I.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else _&&("source"in _&&_.source?.[0]===":"?o(_,"MISSING_CHAR",`Missing space after : in ${a}`):o(I.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let P=_?e(n,_,I,o):I.found?t(n,I.end,E,null,I,o):null;P?Ci(_)&&o(P.range,"BLOCK_IN_FLOW",Ii):I.comment&&(v.comment?v.comment+=`
131
+ `+I.comment:v.comment=I.comment);let Q=new oe(v,P);if(n.options.keepSourceTokens&&(Q.srcToken=m),i){let O=u;Fo(n,O.items,v)&&o(R,"DUPLICATE_KEY","Map keys must be unique"),O.items.push(Q)}else{let O=new se(n.schema);O.flow=!0,O.items.push(Q);let z=(P??v).range;O.range=[v.range[0],z[1],z[2]],u.items.push(O)}l=P?P.range[2]:I.end}}let p=i?"}":"]",[d,...w]=r.end,h=l;if(d?.source===p)h=d.offset+d.source.length;else{let y=a[0].toUpperCase()+a.substring(1),m=f?`${y} must end with a ${p}`:`${y} in block collection must be sufficiently indented and end with a ${p}`;o(l,f?"MISSING_CHAR":"BAD_INDENT",m),d&&d.source.length!==1&&w.unshift(d)}if(w.length>0){let y=ct(w,h,n.options.strict,o);y.comment&&(u.comment?u.comment+=`
132
+ `+y.comment:u.comment=y.comment),u.range=[r.offset,h,y.offset]}else u.range=[r.offset,h,h];return u}function Ti(e,t,n,r,o,s){let i=n.type==="block-map"?Ad(e,t,n,r,s):n.type==="block-seq"?kd(e,t,n,r,s):vd(e,t,n,r,s),a=i.constructor;return o==="!"||o===a.tagName?(i.tag=a.tagName,i):(o&&(i.tag=o),i)}function Rd(e,t,n,r,o){let s=r.tag,i=s?t.directives.tagName(s.source,p=>o(s,"TAG_RESOLVE_FAILED",p)):null;if(n.type==="block-seq"){let{anchor:p,newlineAfterProp:d}=r,w=p&&s?p.offset>s.offset?p:s:p??s;w&&(!d||d.offset<w.offset)&&o(w,"MISSING_CHAR","Missing newline after block sequence props")}let a=n.type==="block-map"?"map":n.type==="block-seq"?"seq":n.start.source==="{"?"map":"seq";if(!s||!i||i==="!"||i===se.tagName&&a==="map"||i===me.tagName&&a==="seq")return Ti(e,t,n,o,i);let c=t.schema.tags.find(p=>p.tag===i&&p.collection===a);if(!c){let p=t.schema.knownTags[i];if(p?.collection===a)t.schema.tags.push(Object.assign({},p,{default:!1})),c=p;else return p?o(s,"BAD_COLLECTION_TYPE",`${p.tag} used for ${a} collection, but expects ${p.collection??"scalar"}`,!0):o(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${i}`,!0),Ti(e,t,n,o,i)}let u=Ti(e,t,n,o,i,c),f=c.resolve?.(u,p=>o(s,"TAG_RESOLVE_FAILED",p),t.options)??u,l=V(f)?f:new T(f);return l.range=u.range,l.tag=i,c?.format&&(l.format=c.format),l}function Oi(e,t,n){let r=t.offset,o=ey(t,e.options.strict,n);if(!o)return{value:"",type:null,comment:"",range:[r,r,r]};let s=o.mode===">"?T.BLOCK_FOLDED:T.BLOCK_LITERAL,i=t.source?ty(t.source):[],a=i.length;for(let h=i.length-1;h>=0;--h){let y=i[h][1];if(y===""||y==="\r")a=h;else break}if(a===0){let h=o.chomp==="+"&&i.length>0?`
133
+ `.repeat(Math.max(1,i.length-1)):"",y=r+o.length;return t.source&&(y+=t.source.length),{value:h,type:s,comment:o.comment,range:[r,y,y]}}let c=t.indent+o.indent,u=t.offset+o.length,f=0;for(let h=0;h<a;++h){let[y,m]=i[h];if(m===""||m==="\r")o.indent===0&&y.length>c&&(c=y.length);else{y.length<c&&n(u+y.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),o.indent===0&&(c=y.length),f=h,c===0&&!e.atRoot&&n(u,"BAD_INDENT","Block scalar values in collections must be indented");break}u+=y.length+m.length+1}for(let h=i.length-1;h>=a;--h)i[h][0].length>c&&(a=h+1);let l="",p="",d=!1;for(let h=0;h<f;++h)l+=i[h][0].slice(c)+`
134
+ `;for(let h=f;h<a;++h){let[y,m]=i[h];u+=y.length+m.length+1;let A=m[m.length-1]==="\r";if(A&&(m=m.slice(0,-1)),m&&y.length<c){let E=`Block scalar lines must not be less indented than their ${o.indent?"explicit indentation indicator":"first line"}`;n(u-m.length-(A?2:1),"BAD_INDENT",E),y=""}s===T.BLOCK_LITERAL?(l+=p+y.slice(c)+m,p=`
135
+ `):y.length>c||m[0]===" "?(p===" "?p=`
136
+ `:!d&&p===`
137
+ `&&(p=`
138
138
 
139
- `),l+=f+h.slice(c)+g,f=`
140
- `,p=!0):g===""?f===`
139
+ `),l+=p+y.slice(c)+m,p=`
140
+ `,d=!0):m===""?p===`
141
141
  `?l+=`
142
- `:f=`
143
- `:(l+=f+g,f=" ",p=!1)}switch(o.chomp){case"-":break;case"+":for(let m=a;m<i.length;++m)l+=`
144
- `+i[m][0].slice(c);l[l.length-1]!==`
142
+ `:p=`
143
+ `:(l+=p+m,p=" ",d=!1)}switch(o.chomp){case"-":break;case"+":for(let h=a;h<i.length;++h)l+=`
144
+ `+i[h][0].slice(c);l[l.length-1]!==`
145
145
  `&&(l+=`
146
146
  `);break;default:l+=`
147
- `}let y=r+o.length+e.source.length;return{value:l,type:s,comment:o.comment,range:[r,y,y]}}function oh({offset:t,props:e},n,r){if(e[0].type!=="block-scalar-header")return r(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:o}=e[0],s=o[0],i=0,a="",c=-1;for(let f=1;f<o.length;++f){let p=o[f];if(!a&&(p==="-"||p==="+"))a=p;else{let y=Number(p);!i&&y?i=y:c===-1&&(c=t+f)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let u=!1,d="",l=o.length;for(let f=1;f<e.length;++f){let p=e[f];switch(p.type){case"space":u=!0;case"newline":l+=p.source.length;break;case"comment":n&&!u&&r(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),l+=p.source.length,d=p.source.substring(1);break;case"error":r(p,"UNEXPECTED_TOKEN",p.message),l+=p.source.length;break;default:{let y=`Unexpected token in block scalar header: ${p.type}`;r(p,"UNEXPECTED_TOKEN",y);let m=p.source;m&&typeof m=="string"&&(l+=m.length)}}}return{mode:s,indent:i,chomp:a,comment:d,length:l}}function sh(t){let e=t.split(/\n( *)/),n=e[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let i=1;i<e.length;i+=2)s.push([e[i],e[i+1]]);return s}function Is(t,e,n){let{offset:r,type:o,source:s,end:i}=t,a,c,u=(f,p,y)=>n(r+f,p,y);switch(o){case"scalar":a=R.PLAIN,c=ih(s,u);break;case"single-quoted-scalar":a=R.QUOTE_SINGLE,c=ah(s,u);break;case"double-quoted-scalar":a=R.QUOTE_DOUBLE,c=ch(s,u);break;default:return n(t,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let d=r+s.length,l=Be(i,d,e,n);return{value:c,type:a,comment:l.comment,range:[r,d,l.offset]}}function ih(t,e){let n="";switch(t[0]){case" ":n="a tab character";break;case",":n="flow indicator character ,";break;case"%":n="directive indicator character %";break;case"|":case">":{n=`block scalar indicator ${t[0]}`;break}case"@":case"`":{n=`reserved character ${t[0]}`;break}}return n&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),of(t)}function ah(t,e){return(t[t.length-1]!=="'"||t.length===1)&&e(t.length,"MISSING_CHAR","Missing closing 'quote"),of(t.slice(1,-1)).replace(/''/g,"'")}function of(t){let e,n;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
147
+ `}let w=r+o.length+t.source.length;return{value:l,type:s,comment:o.comment,range:[r,w,w]}}function ey({offset:e,props:t},n,r){if(t[0].type!=="block-scalar-header")return r(t[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:o}=t[0],s=o[0],i=0,a="",c=-1;for(let p=1;p<o.length;++p){let d=o[p];if(!a&&(d==="-"||d==="+"))a=d;else{let w=Number(d);!i&&w?i=w:c===-1&&(c=e+p)}}c!==-1&&r(c,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${o}`);let u=!1,f="",l=o.length;for(let p=1;p<t.length;++p){let d=t[p];switch(d.type){case"space":u=!0;case"newline":l+=d.source.length;break;case"comment":n&&!u&&r(d,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),l+=d.source.length,f=d.source.substring(1);break;case"error":r(d,"UNEXPECTED_TOKEN",d.message),l+=d.source.length;break;default:{let w=`Unexpected token in block scalar header: ${d.type}`;r(d,"UNEXPECTED_TOKEN",w);let h=d.source;h&&typeof h=="string"&&(l+=h.length)}}}return{mode:s,indent:i,chomp:a,comment:f,length:l}}function ty(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),s=[r?.[1]?[r[1],n.slice(r[1].length)]:["",n]];for(let i=1;i<t.length;i+=2)s.push([t[i],t[i+1]]);return s}function Ni(e,t,n){let{offset:r,type:o,source:s,end:i}=e,a,c,u=(p,d,w)=>n(r+p,d,w);switch(o){case"scalar":a=T.PLAIN,c=ny(s,u);break;case"single-quoted-scalar":a=T.QUOTE_SINGLE,c=ry(s,u);break;case"double-quoted-scalar":a=T.QUOTE_DOUBLE,c=oy(s,u);break;default:return n(e,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${o}`),{value:"",type:null,comment:"",range:[r,r+s.length,r+s.length]}}let f=r+s.length,l=ct(i,f,t,n);return{value:c,type:a,comment:l.comment,range:[r,f,l.offset]}}function ny(e,t){let n="";switch(e[0]){case" ":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]}`;break}}return n&&t(0,"BAD_SCALAR_START",`Plain value cannot start with ${n}`),Dd(e)}function ry(e,t){return(e[e.length-1]!=="'"||e.length===1)&&t(e.length,"MISSING_CHAR","Missing closing 'quote"),Dd(e.slice(1,-1)).replace(/''/g,"'")}function Dd(e){let t,n;try{t=new RegExp(`(.*?)(?<![ ])[ ]*\r?
148
148
  `,"sy"),n=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
149
- `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=e.exec(t);if(!r)return t;let o=r[1],s=" ",i=e.lastIndex;for(n.lastIndex=i;r=n.exec(t);)r[1]===""?s===`
149
+ `,"sy")}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let o=r[1],s=" ",i=t.lastIndex;for(n.lastIndex=i;r=n.exec(e);)r[1]===""?s===`
150
150
  `?o+=s:s=`
151
- `:(o+=s+r[1],s=" "),i=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=i,r=a.exec(t),o+s+(r?.[1]??"")}function ch(t,e){let n="";for(let r=1;r<t.length-1;++r){let o=t[r];if(!(o==="\r"&&t[r+1]===`
151
+ `:(o+=s+r[1],s=" "),i=n.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=i,r=a.exec(e),o+s+(r?.[1]??"")}function oy(e,t){let n="";for(let r=1;r<e.length-1;++r){let o=e[r];if(!(o==="\r"&&e[r+1]===`
152
152
  `))if(o===`
153
- `){let{fold:s,offset:i}=uh(t,r);n+=s,r=i}else if(o==="\\"){let s=t[++r],i=lh[s];if(i)n+=i;else if(s===`
154
- `)for(s=t[r+1];s===" "||s===" ";)s=t[++r+1];else if(s==="\r"&&t[r+1]===`
155
- `)for(s=t[++r+1];s===" "||s===" ";)s=t[++r+1];else if(s==="x"||s==="u"||s==="U"){let a=s==="x"?2:s==="u"?4:8;n+=fh(t,r+1,a,e),r+=a}else{let a=t.substr(r-1,2);e(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(o===" "||o===" "){let s=r,i=t[r+1];for(;i===" "||i===" ";)i=t[++r+1];i!==`
156
- `&&!(i==="\r"&&t[r+2]===`
157
- `)&&(n+=r>s?t.slice(s,r+1):o)}else n+=o}return(t[t.length-1]!=='"'||t.length===1)&&e(t.length,"MISSING_CHAR",'Missing closing "quote'),n}function uh(t,e){let n="",r=t[e+1];for(;(r===" "||r===" "||r===`
158
- `||r==="\r")&&!(r==="\r"&&t[e+2]!==`
153
+ `){let{fold:s,offset:i}=sy(e,r);n+=s,r=i}else if(o==="\\"){let s=e[++r],i=iy[s];if(i)n+=i;else if(s===`
154
+ `)for(s=e[r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="\r"&&e[r+1]===`
155
+ `)for(s=e[++r+1];s===" "||s===" ";)s=e[++r+1];else if(s==="x"||s==="u"||s==="U"){let a=s==="x"?2:s==="u"?4:8;n+=ay(e,r+1,a,t),r+=a}else{let a=e.substr(r-1,2);t(r-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),n+=a}}else if(o===" "||o===" "){let s=r,i=e[r+1];for(;i===" "||i===" ";)i=e[++r+1];i!==`
156
+ `&&!(i==="\r"&&e[r+2]===`
157
+ `)&&(n+=r>s?e.slice(s,r+1):o)}else n+=o}return(e[e.length-1]!=='"'||e.length===1)&&t(e.length,"MISSING_CHAR",'Missing closing "quote'),n}function sy(e,t){let n="",r=e[t+1];for(;(r===" "||r===" "||r===`
158
+ `||r==="\r")&&!(r==="\r"&&e[t+2]!==`
159
159
  `);)r===`
160
160
  `&&(n+=`
161
- `),e+=1,r=t[e+1];return n||(n=" "),{fold:n,offset:e}}var lh={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
162
- `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function fh(t,e,n,r){let o=t.substr(e,n),i=o.length===n&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;try{return String.fromCodePoint(i)}catch{let a=t.substr(e-2,n+2);return r(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function Os(t,e,n,r){let{value:o,type:s,comment:i,range:a}=e.type==="block-scalar"?ks(t,e,r):Is(e,t.options.strict,r),c=n?t.directives.tagName(n.source,l=>r(n,"TAG_RESOLVE_FAILED",l)):null,u;t.options.stringKeys&&t.atKey?u=t.schema[pe]:c?u=dh(t.schema,o,c,n,r):e.type==="scalar"?u=ph(t,o,e,r):u=t.schema[pe];let d;try{let l=u.resolve(o,f=>r(n??e,"TAG_RESOLVE_FAILED",f),t.options);d=T(l)?l:new R(l)}catch(l){let f=l instanceof Error?l.message:String(l);r(n??e,"TAG_RESOLVE_FAILED",f),d=new R(o)}return d.range=a,d.source=o,s&&(d.type=s),c&&(d.tag=c),u.format&&(d.format=u.format),i&&(d.comment=i),d}function dh(t,e,n,r,o){if(n==="!")return t[pe];let s=[];for(let a of t.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(e))return a;let i=t.knownTags[n];return i&&!i.collection?(t.tags.push(Object.assign({},i,{default:!1,test:void 0})),i):(o(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),t[pe])}function ph({atKey:t,directives:e,schema:n},r,o,s){let i=n.tags.find(a=>(a.default===!0||t&&a.default==="key")&&a.test?.test(r))||n[pe];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[pe];if(i.tag!==a.tag){let c=e.tagString(i.tag),u=e.tagString(a.tag),d=`Value may be parsed as either ${c} or ${u}`;s(o,"TAG_RESOLVE_FAILED",d,!0)}}return i}function sf(t,e,n){if(e){n??(n=e.length);for(let r=n-1;r>=0;--r){let o=e[r];switch(o.type){case"space":case"comment":case"newline":t-=o.source.length;continue}for(o=e[++r];o?.type==="space";)t+=o.source.length,o=e[++r];break}}return t}var mh={composeNode:Cs,composeEmptyNode:Jr};function Cs(t,e,n,r){let o=t.atKey,{spaceBefore:s,comment:i,anchor:a,tag:c}=n,u,d=!0;switch(e.type){case"alias":u=hh(t,e,r),(a||c)&&r(e,"ALIAS_PROPS","An alias node must not specify any properties");break;case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"block-scalar":u=Os(t,e,c,r),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=rf(mh,t,e,n,r),a&&(u.anchor=a.source.substring(1))}catch(l){let f=l instanceof Error?l.message:String(l);r(e,"RESOURCE_EXHAUSTION",f)}break;default:{let l=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;r(e,"UNEXPECTED_TOKEN",l),d=!1}}return u??(u=Jr(t,e.offset,void 0,null,n,r)),a&&u.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),o&&t.options.stringKeys&&(!T(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(c??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),i&&(e.type==="scalar"&&e.source===""?u.comment=i:u.commentBefore=i),t.options.keepSourceTokens&&d&&(u.srcToken=e),u}function Jr(t,e,n,r,{spaceBefore:o,comment:s,anchor:i,tag:a,end:c},u){let d={type:"scalar",offset:sf(e,n,r),indent:-1,source:""},l=Os(t,d,a,u);return i&&(l.anchor=i.source.substring(1),l.anchor===""&&u(i,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(l.spaceBefore=!0),s&&(l.comment=s,l.range[2]=c),l}function hh({options:t},{offset:e,source:n,end:r},o){let s=new qe(n.substring(1));s.source===""&&o(e,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&o(e+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let i=e+n.length,a=Be(r,i,t.strict,o);return s.range=[e,i,a.offset],a.comment&&(s.comment=a.comment),s}function af(t,e,{offset:n,start:r,value:o,end:s},i){let a=Object.assign({_directives:e},t),c=new ut(void 0,a),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},d=Ze(r,{indicator:"doc-start",next:o??s?.[0],offset:n,onError:i,parentIndent:0,startOnNewline:!0});d.found&&(c.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!d.hasNewline&&i(d.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=o?Cs(u,o,d,i):Jr(u,d.end,r,null,d,i);let l=c.contents.range[2],f=Be(s,l,!1,i);return f.comment&&(c.comment=f.comment),c.range=[n,l,f.offset],c}function Mn(t){if(typeof t=="number")return[t,t+1];if(Array.isArray(t))return t.length===2?t:[t[0],t[1]];let{offset:e,source:n}=t;return[e,e+(typeof n=="string"?n.length:1)]}function cf(t){let e="",n=!1,r=!1;for(let o=0;o<t.length;++o){let s=t[o];switch(s[0]){case"#":e+=(e===""?"":r?`
161
+ `),t+=1,r=e[t+1];return n||(n=" "),{fold:n,offset:t}}var iy={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
162
+ `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ay(e,t,n,r){let o=e.substr(t,n),i=o.length===n&&/^[0-9a-fA-F]+$/.test(o)?parseInt(o,16):NaN;try{return String.fromCodePoint(i)}catch{let a=e.substr(t-2,n+2);return r(t-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}}function zi(e,t,n,r){let{value:o,type:s,comment:i,range:a}=t.type==="block-scalar"?Oi(e,t,r):Ni(t,e.options.strict,r),c=n?e.directives.tagName(n.source,l=>r(n,"TAG_RESOLVE_FAILED",l)):null,u;e.options.stringKeys&&e.atKey?u=e.schema[Ie]:c?u=cy(e.schema,o,c,n,r):t.type==="scalar"?u=uy(e,o,t,r):u=e.schema[Ie];let f;try{let l=u.resolve(o,p=>r(n??t,"TAG_RESOLVE_FAILED",p),e.options);f=B(l)?l:new T(l)}catch(l){let p=l instanceof Error?l.message:String(l);r(n??t,"TAG_RESOLVE_FAILED",p),f=new T(o)}return f.range=a,f.source=o,s&&(f.type=s),c&&(f.tag=c),u.format&&(f.format=u.format),i&&(f.comment=i),f}function cy(e,t,n,r,o){if(n==="!")return e[Ie];let s=[];for(let a of e.tags)if(!a.collection&&a.tag===n)if(a.default&&a.test)s.push(a);else return a;for(let a of s)if(a.test?.test(t))return a;let i=e.knownTags[n];return i&&!i.collection?(e.tags.push(Object.assign({},i,{default:!1,test:void 0})),i):(o(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${n}`,n!=="tag:yaml.org,2002:str"),e[Ie])}function uy({atKey:e,directives:t,schema:n},r,o,s){let i=n.tags.find(a=>(a.default===!0||e&&a.default==="key")&&a.test?.test(r))||n[Ie];if(n.compat){let a=n.compat.find(c=>c.default&&c.test?.test(r))??n[Ie];if(i.tag!==a.tag){let c=t.tagString(i.tag),u=t.tagString(a.tag),f=`Value may be parsed as either ${c} or ${u}`;s(o,"TAG_RESOLVE_FAILED",f,!0)}}return i}function Id(e,t,n){if(t){n??(n=t.length);for(let r=n-1;r>=0;--r){let o=t[r];switch(o.type){case"space":case"comment":case"newline":e-=o.source.length;continue}for(o=t[++r];o?.type==="space";)e+=o.source.length,o=t[++r];break}}return e}var ly={composeNode:$i,composeEmptyNode:Mo};function $i(e,t,n,r){let o=e.atKey,{spaceBefore:s,comment:i,anchor:a,tag:c}=n,u,f=!0;switch(t.type){case"alias":u=fy(e,t,r),(a||c)&&r(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":u=zi(e,t,c,r),a&&(u.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{u=Rd(ly,e,t,n,r),a&&(u.anchor=a.source.substring(1))}catch(l){let p=l instanceof Error?l.message:String(l);r(t,"RESOURCE_EXHAUSTION",p)}break;default:{let l=t.type==="error"?t.message:`Unsupported token (type: ${t.type})`;r(t,"UNEXPECTED_TOKEN",l),f=!1}}return u??(u=Mo(e,t.offset,void 0,null,n,r)),a&&u.anchor===""&&r(a,"BAD_ALIAS","Anchor cannot be an empty string"),o&&e.options.stringKeys&&(!B(u)||typeof u.value!="string"||u.tag&&u.tag!=="tag:yaml.org,2002:str")&&r(c??t,"NON_STRING_KEY","With stringKeys, all keys must be strings"),s&&(u.spaceBefore=!0),i&&(t.type==="scalar"&&t.source===""?u.comment=i:u.commentBefore=i),e.options.keepSourceTokens&&f&&(u.srcToken=t),u}function Mo(e,t,n,r,{spaceBefore:o,comment:s,anchor:i,tag:a,end:c},u){let f={type:"scalar",offset:Id(t,n,r),indent:-1,source:""},l=zi(e,f,a,u);return i&&(l.anchor=i.source.substring(1),l.anchor===""&&u(i,"BAD_ALIAS","Anchor cannot be an empty string")),o&&(l.spaceBefore=!0),s&&(l.comment=s,l.range[2]=c),l}function fy({options:e},{offset:t,source:n,end:r},o){let s=new ht(n.substring(1));s.source===""&&o(t,"BAD_ALIAS","Alias cannot be an empty string"),s.source.endsWith(":")&&o(t+n.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let i=t+n.length,a=ct(r,i,e.strict,o);return s.range=[t,i,a.offset],a.comment&&(s.comment=a.comment),s}function Cd(e,t,{offset:n,start:r,value:o,end:s},i){let a=Object.assign({_directives:t},e),c=new Ot(void 0,a),u={atKey:!1,atRoot:!0,directives:c.directives,options:c.options,schema:c.schema},f=at(r,{indicator:"doc-start",next:o??s?.[0],offset:n,onError:i,parentIndent:0,startOnNewline:!0});f.found&&(c.directives.docStart=!0,o&&(o.type==="block-map"||o.type==="block-seq")&&!f.hasNewline&&i(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),c.contents=o?$i(u,o,f,i):Mo(u,f.end,r,null,f,i);let l=c.contents.range[2],p=ct(s,l,!1,i);return p.comment&&(c.comment=p.comment),c.range=[n,l,p.offset],c}function mr(e){if(typeof e=="number")return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n=="string"?n.length:1)]}function Td(e){let t="",n=!1,r=!1;for(let o=0;o<e.length;++o){let s=e[o];switch(s[0]){case"#":t+=(t===""?"":r?`
163
163
 
164
164
  `:`
165
- `)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":t[o+1]?.[0]!=="#"&&(o+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:e,afterEmptyLine:r}}var Fn=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,o,s)=>{let i=Mn(n);s?this.warnings.push(new Pn(i,r,o)):this.errors.push(new Re(i,r,o))},this.directives=new Me({version:e.version||"1.2"}),this.options=e}decorate(e,n){let{comment:r,afterEmptyLine:o}=cf(this.prelude);if(r){let s=e.contents;if(n)e.comment=e.comment?`${e.comment}
166
- ${r}`:r;else if(o||e.directives.docStart||!s)e.commentBefore=r;else if(B(s)&&!s.flow&&s.items.length>0){let i=s.items[0];$(i)&&(i=i.key);let a=i.commentBefore;i.commentBefore=a?`${r}
165
+ `)+(s.substring(1)||" "),n=!0,r=!1;break;case"%":e[o+1]?.[0]!=="#"&&(o+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var hr=class{constructor(t={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(n,r,o,s)=>{let i=mr(n);s?this.warnings.push(new dr(i,r,o)):this.errors.push(new Ge(i,r,o))},this.directives=new st({version:t.version||"1.2"}),this.options=t}decorate(t,n){let{comment:r,afterEmptyLine:o}=Td(this.prelude);if(r){let s=t.contents;if(n)t.comment=t.comment?`${t.comment}
166
+ ${r}`:r;else if(o||t.directives.docStart||!s)t.commentBefore=r;else if(K(s)&&!s.flow&&s.items.length>0){let i=s.items[0];j(i)&&(i=i.key);let a=i.commentBefore;i.commentBefore=a?`${r}
167
167
  ${a}`:r}else{let i=s.commentBefore;s.commentBefore=i?`${r}
168
- ${i}`:r}}if(n){for(let s=0;s<this.errors.length;++s)e.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)e.warnings.push(this.warnings[s])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:cf(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,n=!1,r=-1){for(let o of e)yield*this.next(o);yield*this.end(n,r)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(n,r,o)=>{let s=Mn(e);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,o)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let n=af(this.options,this.directives,e,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let n=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,r=new Re(Mn(e),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Re(Mn(e),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=Be(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
169
- ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Re(Mn(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let r=Object.assign({_directives:this.directives},this.options),o=new ut(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,n,n],this.decorate(o,!1),yield o}}};var Ts=Symbol("break visit"),yh=Symbol("skip children"),uf=Symbol("remove item");function Et(t,e){"type"in t&&t.type==="document"&&(t={start:t.start,value:t.value}),lf(Object.freeze([]),t,e)}Et.BREAK=Ts;Et.SKIP=yh;Et.REMOVE=uf;Et.itemAtPath=(t,e)=>{let n=t;for(let[r,o]of e){let s=n?.[r];if(s&&"items"in s)n=s.items[o];else return}return n};Et.parentCollection=(t,e)=>{let n=Et.itemAtPath(t,e.slice(0,-1)),r=e[e.length-1][0],o=n?.[r];if(o&&"items"in o)return o;throw new Error("Parent collection not found")};function lf(t,e,n){let r=n(e,t);if(typeof r=="symbol")return r;for(let o of["key","value"]){let s=e[o];if(s&&"items"in s){for(let i=0;i<s.items.length;++i){let a=lf(Object.freeze(t.concat([[o,i]])),s.items[i],n);if(typeof a=="number")i=a-1;else{if(a===Ts)return Ts;a===uf&&(s.items.splice(i,1),i-=1)}}typeof r=="function"&&o==="key"&&(r=r(e,t))}}return typeof r=="function"?r(e,t):r}var Ns="\uFEFF",$s="",zs="",Kr="";function ff(t){switch(t){case Ns:return"byte-order-mark";case $s:return"doc-mode";case zs:return"flow-error-end";case Kr:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
168
+ ${i}`:r}}if(n){for(let s=0;s<this.errors.length;++s)t.errors.push(this.errors[s]);for(let s=0;s<this.warnings.length;++s)t.warnings.push(this.warnings[s])}else t.errors=this.errors,t.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Td(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(t,n=!1,r=-1){for(let o of t)yield*this.next(o);yield*this.end(n,r)}*next(t){switch(t.type){case"directive":this.directives.add(t.source,(n,r,o)=>{let s=mr(t);s[0]+=n,this.onError(s,"BAD_DIRECTIVE",r,o)}),this.prelude.push(t.source),this.atDirectives=!0;break;case"document":{let n=Cd(this.options,this.directives,t,this.onError);this.atDirectives&&!n.directives.docStart&&this.onError(t,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(n,!1),this.doc&&(yield this.doc),this.doc=n,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(t.source);break;case"error":{let n=t.source?`${t.message}: ${JSON.stringify(t.source)}`:t.message,r=new Ge(mr(t),"UNEXPECTED_TOKEN",n);this.atDirectives||!this.doc?this.errors.push(r):this.doc.errors.push(r);break}case"doc-end":{if(!this.doc){let r="Unexpected doc-end without preceding document";this.errors.push(new Ge(mr(t),"UNEXPECTED_TOKEN",r));break}this.doc.directives.docEnd=!0;let n=ct(t.end,t.offset+t.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),n.comment){let r=this.doc.comment;this.doc.comment=r?`${r}
169
+ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.push(new Ge(mr(t),"UNEXPECTED_TOKEN",`Unsupported token ${t.type}`))}}*end(t=!1,n=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(t){let r=Object.assign({_directives:this.directives},this.options),o=new Ot(void 0,r);this.atDirectives&&this.onError(n,"MISSING_CHAR","Missing directives-end indicator line"),o.range=[0,n,n],this.decorate(o,!1),yield o}}};var Li=Symbol("break visit"),dy=Symbol("skip children"),Od=Symbol("remove item");function Jt(e,t){"type"in e&&e.type==="document"&&(e={start:e.start,value:e.value}),Nd(Object.freeze([]),e,t)}Jt.BREAK=Li;Jt.SKIP=dy;Jt.REMOVE=Od;Jt.itemAtPath=(e,t)=>{let n=e;for(let[r,o]of t){let s=n?.[r];if(s&&"items"in s)n=s.items[o];else return}return n};Jt.parentCollection=(e,t)=>{let n=Jt.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],o=n?.[r];if(o&&"items"in o)return o;throw new Error("Parent collection not found")};function Nd(e,t,n){let r=n(t,e);if(typeof r=="symbol")return r;for(let o of["key","value"]){let s=t[o];if(s&&"items"in s){for(let i=0;i<s.items.length;++i){let a=Nd(Object.freeze(e.concat([[o,i]])),s.items[i],n);if(typeof a=="number")i=a-1;else{if(a===Li)return Li;a===Od&&(s.items.splice(i,1),i-=1)}}typeof r=="function"&&o==="key"&&(r=r(t,e))}}return typeof r=="function"?r(t,e):r}var Pi="\uFEFF",Fi="",Mi="",Bo="";function zd(e){switch(e){case Pi:return"byte-order-mark";case Fi:return"doc-mode";case Mi:return"flow-error-end";case Bo:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
170
170
  `:case`\r
171
- `: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(t[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function ke(t){switch(t){case void 0:case" ":case`
172
- `:case"\r":case" ":return!0;default:return!1}}var df=new Set("0123456789ABCDEFabcdef"),bh=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Wr=new Set(",[]{}"),wh=new Set(` ,[]{}
173
- \r `),Ps=t=>!t||wh.has(t),Zn=class{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,n=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let e=this.pos,n=this.buffer[e];for(;n===" "||n===" ";)n=this.buffer[++e];return!n||n==="#"||n===`
174
- `?!0:n==="\r"?this.buffer[e+1]===`
175
- `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let n=this.buffer[e];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+e];if(n==="\r"){let o=this.buffer[r+e+1];if(o===`
176
- `||!o&&!this.atEnd)return e+r+1}return n===`
177
- `||r>=this.indentNext||!n&&!this.atEnd?e+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(e,3);if((r==="---"||r==="...")&&ke(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!="number"||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
178
- `,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]==="\r"&&(e-=1),this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case"stream":return yield*this.parseStream();case"line-start":return yield*this.parseLineStart();case"block-start":return yield*this.parseBlockStart();case"doc":return yield*this.parseDocument();case"flow":return yield*this.parseFlowCollection();case"quoted-scalar":return yield*this.parseQuotedScalar();case"block-scalar":return yield*this.parseBlockScalar();case"plain-scalar":return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext("stream");if(e[0]===Ns&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let n=e.length,r=e.indexOf("#");for(;r!==-1;){let s=e[r-1];if(s===" "||s===" "){n=r-1;break}else r=e.indexOf("#",r+1)}for(;;){let s=e[n-1];if(s===" "||s===" ")n-=1;else break}let o=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-n),yield*this.pushNewline(),"stream"}return yield $s,yield*this.parseLineStart()}*parseLineStart(){let 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");let n=this.peek(3);if((n==="---"||n==="...")&&ke(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!ke(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&ke(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(e[n]){case"#":yield*this.pushCount(e.length-n);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(Ps),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,n,r=-1;do e=yield*this.pushNewline(),e>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(e+n>0);let o=this.getLine();if(o===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&o[0]!=="#"||r===0&&(o.startsWith("---")||o.startsWith("..."))&&ke(o[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield zs,yield*this.parseLineStart();let s=0;for(;o[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),o[s]){case void 0:return"flow";case"#":return yield*this.pushCount(o.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(Ps),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let i=this.charAt(1);if(this.flowKey||ke(i)||i===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),n=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),o=r.indexOf(`
171
+ `: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" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}function Je(e){switch(e){case void 0:case" ":case`
172
+ `:case"\r":case" ":return!0;default:return!1}}var $d=new Set("0123456789ABCDEFabcdef"),my=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),qo=new Set(",[]{}"),hy=new Set(` ,[]{}
173
+ \r `),Bi=e=>!e||hy.has(e),gr=class{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(t,n=!1){if(t){if(typeof t!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+t:t,this.lineEndPos=null}this.atEnd=!n;let r=this.next??"stream";for(;r&&(n||this.hasChars(1));)r=yield*this.parseNext(r)}atLineEnd(){let t=this.pos,n=this.buffer[t];for(;n===" "||n===" ";)n=this.buffer[++t];return!n||n==="#"||n===`
174
+ `?!0:n==="\r"?this.buffer[t+1]===`
175
+ `:!1}charAt(t){return this.buffer[this.pos+t]}continueScalar(t){let n=this.buffer[t];if(this.indentNext>0){let r=0;for(;n===" ";)n=this.buffer[++r+t];if(n==="\r"){let o=this.buffer[r+t+1];if(o===`
176
+ `||!o&&!this.atEnd)return t+r+1}return n===`
177
+ `||r>=this.indentNext||!n&&!this.atEnd?t+r:-1}if(n==="-"||n==="."){let r=this.buffer.substr(t,3);if((r==="---"||r==="...")&&Je(this.buffer[t+3]))return-1}return t}getLine(){let t=this.lineEndPos;return(typeof t!="number"||t!==-1&&t<this.pos)&&(t=this.buffer.indexOf(`
178
+ `,this.pos),this.lineEndPos=t),t===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[t-1]==="\r"&&(t-=1),this.buffer.substring(this.pos,t))}hasChars(t){return this.pos+t<=this.buffer.length}setNext(t){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=t,null}peek(t){return this.buffer.substr(this.pos,t)}*parseNext(t){switch(t){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 t=this.getLine();if(t===null)return this.setNext("stream");if(t[0]===Pi&&(yield*this.pushCount(1),t=t.substring(1)),t[0]==="%"){let n=t.length,r=t.indexOf("#");for(;r!==-1;){let s=t[r-1];if(s===" "||s===" "){n=r-1;break}else r=t.indexOf("#",r+1)}for(;;){let s=t[n-1];if(s===" "||s===" ")n-=1;else break}let o=(yield*this.pushCount(n))+(yield*this.pushSpaces(!0));return yield*this.pushCount(t.length-o),this.pushNewline(),"stream"}if(this.atLineEnd()){let n=yield*this.pushSpaces(!0);return yield*this.pushCount(t.length-n),yield*this.pushNewline(),"stream"}return yield Fi,yield*this.parseLineStart()}*parseLineStart(){let t=this.charAt(0);if(!t&&!this.atEnd)return this.setNext("line-start");if(t==="-"||t==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let n=this.peek(3);if((n==="---"||n==="...")&&Je(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,n==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!Je(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[t,n]=this.peek(2);if(!n&&!this.atEnd)return this.setNext("block-start");if((t==="-"||t==="?"||t===":")&&Je(n)){let r=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=r,"block-start"}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let t=this.getLine();if(t===null)return this.setNext("doc");let n=yield*this.pushIndicators();switch(t[n]){case"#":yield*this.pushCount(t.length-n);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(Bi),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return n+=yield*this.parseBlockScalarHeader(),n+=yield*this.pushSpaces(!0),yield*this.pushCount(t.length-n),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let t,n,r=-1;do t=yield*this.pushNewline(),t>0?(n=yield*this.pushSpaces(!1),this.indentValue=r=n):n=0,n+=yield*this.pushSpaces(!0);while(t+n>0);let o=this.getLine();if(o===null)return this.setNext("flow");if((r!==-1&&r<this.indentNext&&o[0]!=="#"||r===0&&(o.startsWith("---")||o.startsWith("..."))&&Je(o[3]))&&!(r===this.indentNext-1&&this.flowLevel===1&&(o[0]==="]"||o[0]==="}")))return this.flowLevel=0,yield Mi,yield*this.parseLineStart();let s=0;for(;o[s]===",";)s+=yield*this.pushCount(1),s+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(s+=yield*this.pushIndicators(),o[s]){case void 0:return"flow";case"#":return yield*this.pushCount(o.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(Bi),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let i=this.charAt(1);if(this.flowKey||Je(i)||i===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let t=this.charAt(0),n=this.buffer.indexOf(t,this.pos+1);if(t==="'")for(;n!==-1&&this.buffer[n+1]==="'";)n=this.buffer.indexOf("'",n+2);else for(;n!==-1;){let s=0;for(;this.buffer[n-1-s]==="\\";)s+=1;if(s%2===0)break;n=this.buffer.indexOf('"',n+1)}let r=this.buffer.substring(0,n),o=r.indexOf(`
179
179
  `,this.pos);if(o!==-1){for(;o!==-1;){let s=this.continueScalar(o+1);if(s===-1)break;o=r.indexOf(`
180
- `,s)}o!==-1&&(n=o-(r[o-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let n=this.buffer[++e];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>ke(n)||n==="#")}*parseBlockScalar(){let e=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case`
181
- `:e=s,n=0;break;case"\r":{let i=this.buffer[s+1];if(!i&&!this.atEnd)return this.setNext("block-scalar");if(i===`
182
- `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(e+1);if(s===-1)break;e=this.buffer.indexOf(`
183
- `,s)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let o=e+1;for(r=this.buffer[o];r===" ";)r=this.buffer[++o];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
184
- `;)r=this.buffer[++o];e=o-1}else if(!this.blockScalarKeep)do{let s=e-1,i=this.buffer[s];i==="\r"&&(i=this.buffer[--s]);let a=s;for(;i===" ";)i=this.buffer[--s];if(i===`
185
- `&&s>=this.pos&&s+1+n>a)e=s;else break}while(!0);return yield Kr,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,n=this.pos-1,r=this.pos-1,o;for(;o=this.buffer[++r];)if(o===":"){let s=this.buffer[r+1];if(ke(s)||e&&Wr.has(s))break;n=r}else if(ke(o)){let s=this.buffer[r+1];if(o==="\r"&&(s===`
180
+ `,s)}o!==-1&&(n=o-(r[o-1]==="\r"?2:1))}if(n===-1){if(!this.atEnd)return this.setNext("quoted-scalar");n=this.buffer.length}return yield*this.pushToIndex(n+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let t=this.pos;for(;;){let n=this.buffer[++t];if(n==="+")this.blockScalarKeep=!0;else if(n>"0"&&n<="9")this.blockScalarIndent=Number(n)-1;else if(n!=="-")break}return yield*this.pushUntil(n=>Je(n)||n==="#")}*parseBlockScalar(){let t=this.pos-1,n=0,r;e:for(let s=this.pos;r=this.buffer[s];++s)switch(r){case" ":n+=1;break;case`
181
+ `:t=s,n=0;break;case"\r":{let i=this.buffer[s+1];if(!i&&!this.atEnd)return this.setNext("block-scalar");if(i===`
182
+ `)break}default:break e}if(!r&&!this.atEnd)return this.setNext("block-scalar");if(n>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=n:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let s=this.continueScalar(t+1);if(s===-1)break;t=this.buffer.indexOf(`
183
+ `,s)}while(t!==-1);if(t===-1){if(!this.atEnd)return this.setNext("block-scalar");t=this.buffer.length}}let o=t+1;for(r=this.buffer[o];r===" ";)r=this.buffer[++o];if(r===" "){for(;r===" "||r===" "||r==="\r"||r===`
184
+ `;)r=this.buffer[++o];t=o-1}else if(!this.blockScalarKeep)do{let s=t-1,i=this.buffer[s];i==="\r"&&(i=this.buffer[--s]);let a=s;for(;i===" ";)i=this.buffer[--s];if(i===`
185
+ `&&s>=this.pos&&s+1+n>a)t=s;else break}while(!0);return yield Bo,yield*this.pushToIndex(t+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let t=this.flowLevel>0,n=this.pos-1,r=this.pos-1,o;for(;o=this.buffer[++r];)if(o===":"){let s=this.buffer[r+1];if(Je(s)||t&&qo.has(s))break;n=r}else if(Je(o)){let s=this.buffer[r+1];if(o==="\r"&&(s===`
186
186
  `?(r+=1,o=`
187
- `,s=this.buffer[r+1]):n=r),s==="#"||e&&Wr.has(s))break;if(o===`
188
- `){let i=this.continueScalar(r+1);if(i===-1)break;r=Math.max(r,i-2)}}else{if(e&&Wr.has(o))break;n=r}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield Kr,yield*this.pushToIndex(n+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,n){let r=this.buffer.slice(this.pos,e);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let e=0;e:for(;;){switch(this.charAt(0)){case"!":e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue e;case"&":e+=yield*this.pushUntil(Ps),e+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(ke(r)||n&&Wr.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue e}}}break e}return e}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,n=this.buffer[e];for(;!ke(n)&&n!==">";)n=this.buffer[++e];return yield*this.pushToIndex(n===">"?e+1:e,!1)}else{let e=this.pos+1,n=this.buffer[e];for(;n;)if(bh.has(n))n=this.buffer[++e];else if(n==="%"&&df.has(this.buffer[e+1])&&df.has(this.buffer[e+2]))n=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
189
- `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
190
- `?yield*this.pushCount(2):0}*pushSpaces(e){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||e&&r===" ");let o=n-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=n),o}*pushUntil(e){let n=this.pos,r=this.buffer[n];for(;!e(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};var St=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let n=0,r=this.lineStarts.length;for(;n<r;){let s=n+r>>1;this.lineStarts[s]<e?n=s+1:r=s}if(this.lineStarts[n]===e)return{line:n+1,col:1};if(n===0)return{line:0,col:e};let o=this.lineStarts[n-1];return{line:n,col:e-o+1}}}};function ft(t,e){for(let n=0;n<t.length;++n)if(t[n].type===e)return!0;return!1}function pf(t){for(let e=0;e<t.length;++e)switch(t[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function hf(t){switch(t?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function Yr(t){switch(t.type){case"document":return t.start;case"block-map":{let e=t.items[t.items.length-1];return e.sep??e.start}case"block-seq":return t.items[t.items.length-1].start;default:return[]}}function Kt(t){if(t.length===0)return[];let e=t.length;e:for(;--e>=0;)switch(t[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;t[++e]?.type==="space";);return t.splice(e,t.length)}function Xr(t,e){if(e.length<1e5)Array.prototype.push.apply(t,e);else for(let n=0;n<e.length;++n)t.push(e[n])}function mf(t){if(t.start.type==="flow-seq-start")for(let e of t.items)e.sep&&!e.value&&!ft(e.start,"explicit-key-ind")&&!ft(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,hf(e.value)?e.value.end?Xr(e.value.end,e.sep):e.value.end=e.sep:Xr(e.start,e.sep),delete e.sep)}var Bn=class{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 Zn,this.onNewLine=e}*parse(e,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(e,n))yield*this.next(r);n||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let n=ff(e);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){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{let r=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:r,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(){let e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let n=e??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&mf(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let o=r.items[r.items.length-1];if(o.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=n;else{Object.assign(o,{key:n,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{let o=r.items[r.items.length-1];o.value?r.items.push({start:[],value:n}):o.value=n;break}case"flow-collection":{let o=r.items[r.items.length-1];!o||o.value?r.items.push({start:[],key:n,sep:[]}):o.sep?o.value=n:Object.assign(o,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let o=n.items[n.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&pf(o.start)===-1&&(n.indent===0||o.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(r.type==="document"?r.end=o.start:r.items.push({start:o.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{pf(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let n=Yr(this.peek(2)),r=Kt(n),o;e.end?(o=e.end,o.push(this.sourceToken),delete e.end):o=[this.sourceToken];let s={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
187
+ `,s=this.buffer[r+1]):n=r),s==="#"||t&&qo.has(s))break;if(o===`
188
+ `){let i=this.continueScalar(r+1);if(i===-1)break;r=Math.max(r,i-2)}}else{if(t&&qo.has(o))break;n=r}return!o&&!this.atEnd?this.setNext("plain-scalar"):(yield Bo,yield*this.pushToIndex(n+1,!0),t?"flow":"doc")}*pushCount(t){return t>0?(yield this.buffer.substr(this.pos,t),this.pos+=t,t):0}*pushToIndex(t,n){let r=this.buffer.slice(this.pos,t);return r?(yield r,this.pos+=r.length,r.length):(n&&(yield""),0)}*pushIndicators(){let t=0;e:for(;;){switch(this.charAt(0)){case"!":t+=yield*this.pushTag(),t+=yield*this.pushSpaces(!0);continue e;case"&":t+=yield*this.pushUntil(Bi),t+=yield*this.pushSpaces(!0);continue e;case"-":case"?":case":":{let n=this.flowLevel>0,r=this.charAt(1);if(Je(r)||n&&qo.has(r)){n?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,t+=yield*this.pushCount(1),t+=yield*this.pushSpaces(!0);continue e}}}break e}return t}*pushTag(){if(this.charAt(1)==="<"){let t=this.pos+2,n=this.buffer[t];for(;!Je(n)&&n!==">";)n=this.buffer[++t];return yield*this.pushToIndex(n===">"?t+1:t,!1)}else{let t=this.pos+1,n=this.buffer[t];for(;n;)if(my.has(n))n=this.buffer[++t];else if(n==="%"&&$d.has(this.buffer[t+1])&&$d.has(this.buffer[t+2]))n=this.buffer[t+=3];else break;return yield*this.pushToIndex(t,!1)}}*pushNewline(){let t=this.buffer[this.pos];return t===`
189
+ `?yield*this.pushCount(1):t==="\r"&&this.charAt(1)===`
190
+ `?yield*this.pushCount(2):0}*pushSpaces(t){let n=this.pos-1,r;do r=this.buffer[++n];while(r===" "||t&&r===" ");let o=n-this.pos;return o>0&&(yield this.buffer.substr(this.pos,o),this.pos=n),o}*pushUntil(t){let n=this.pos,r=this.buffer[n];for(;!t(r);)r=this.buffer[++n];return yield*this.pushToIndex(n,!1)}};var Wt=class{constructor(){this.lineStarts=[],this.addNewLine=t=>this.lineStarts.push(t),this.linePos=t=>{let n=0,r=this.lineStarts.length;for(;n<r;){let s=n+r>>1;this.lineStarts[s]<t?n=s+1:r=s}if(this.lineStarts[n]===t)return{line:n+1,col:1};if(n===0)return{line:0,col:t};let o=this.lineStarts[n-1];return{line:n,col:t-o+1}}}};function zt(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Ld(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 Fd(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 Zo(e){switch(e.type){case"document":return e.start;case"block-map":{let 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 An(e){if(e.length===0)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(;e[++t]?.type==="space";);return e.splice(t,e.length)}function Uo(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function Pd(e){if(e.start.type==="flow-seq-start")for(let t of e.items)t.sep&&!t.value&&!zt(t.start,"explicit-key-ind")&&!zt(t.sep,"map-value-ind")&&(t.key&&(t.value=t.key),delete t.key,Fd(t.value)?t.value.end?Uo(t.value.end,t.sep):t.value.end=t.sep:Uo(t.start,t.sep),delete t.sep)}var yr=class{constructor(t){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source="",this.type="",this.lexer=new gr,this.onNewLine=t}*parse(t,n=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let r of this.lexer.lex(t,n))yield*this.next(r);n||(yield*this.end())}*next(t){if(this.source=t,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=t.length;return}let n=zd(t);if(n)if(n==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=n,yield*this.step(),n){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+t.length);break;case"space":this.atNewLine&&t[0]===" "&&(this.indent+=t.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=t.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=t.length}else{let r=`Not a YAML token: ${t}`;yield*this.pop({type:"error",offset:this.offset,message:r,source:t}),this.offset+=t.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(){let t=this.peek(1);if(this.type==="doc-end"&&t?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!t)return yield*this.stream();switch(t.type){case"document":return yield*this.document(t);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(t);case"block-scalar":return yield*this.blockScalar(t);case"block-map":return yield*this.blockMap(t);case"block-seq":return yield*this.blockSequence(t);case"flow-collection":return yield*this.flowCollection(t);case"doc-end":return yield*this.documentEnd(t)}yield*this.pop()}peek(t){return this.stack[this.stack.length-t]}*pop(t){let n=t??this.stack.pop();if(!n)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield n;else{let r=this.peek(1);switch(n.type==="block-scalar"?n.indent="indent"in r?r.indent:0:n.type==="flow-collection"&&r.type==="document"&&(n.indent=0),n.type==="flow-collection"&&Pd(n),r.type){case"document":r.value=n;break;case"block-scalar":r.props.push(n);break;case"block-map":{let o=r.items[r.items.length-1];if(o.value){r.items.push({start:[],key:n,sep:[]}),this.onKeyLine=!0;return}else if(o.sep)o.value=n;else{Object.assign(o,{key:n,sep:[]}),this.onKeyLine=!o.explicitKey;return}break}case"block-seq":{let o=r.items[r.items.length-1];o.value?r.items.push({start:[],value:n}):o.value=n;break}case"flow-collection":{let o=r.items[r.items.length-1];!o||o.value?r.items.push({start:[],key:n,sep:[]}):o.sep?o.value=n:Object.assign(o,{key:n,sep:[]});return}default:yield*this.pop(),yield*this.pop(n)}if((r.type==="document"||r.type==="block-map"||r.type==="block-seq")&&(n.type==="block-map"||n.type==="block-seq")){let o=n.items[n.items.length-1];o&&!o.sep&&!o.value&&o.start.length>0&&Ld(o.start)===-1&&(n.indent===0||o.start.every(s=>s.type!=="comment"||s.indent<n.indent))&&(r.type==="document"?r.end=o.start:r.items.push({start:o.start}),n.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let t={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&t.start.push(this.sourceToken),this.stack.push(t);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(t){if(t.value)return yield*this.lineEnd(t);switch(this.type){case"doc-start":{Ld(t.start)!==-1?(yield*this.pop(),yield*this.step()):t.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":t.start.push(this.sourceToken);return}let n=this.startBlockValue(t);n?this.stack.push(n):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(t){if(this.type==="map-value-ind"){let n=Zo(this.peek(2)),r=An(n),o;t.end?(o=t.end,o.push(this.sourceToken),delete t.end):o=[this.sourceToken];let s={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:r,key:t,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=s}else yield*this.lineEnd(t)}*blockScalar(t){switch(this.type){case"space":case"comment":case"newline":t.props.push(this.sourceToken);return;case"scalar":if(t.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let n=this.source.indexOf(`
191
191
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
192
- `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Xr(o,n.start),o.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let r=!this.onKeyLine&&this.indent===e.indent,o=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(o&&n.sep&&!n.value){let i=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":i.push(a);break;case"space":break;case"comment":c.indent>e.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(s=n.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":o||n.value?(s.push(this.sourceToken),e.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):o||n.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}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(ft(n.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(hf(n.key)&&!ft(n.sep,"newline")){let i=Kt(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:a,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(ft(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let i=Kt(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||o?e.items.push({start:s,key:null,sep:[this.sourceToken]}):ft(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);o||n.value?(e.items.push({start:s,key:i,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(i):(Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!0);return}default:{let i=this.startBlockValue(e);if(i){if(i.type==="block-seq"){if(!n.explicitKey&&n.sep&&!ft(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&e.items.push({start:s});this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let n=e.items[e.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,e.indent)){let o=e.items[e.items.length-2]?.value?.end;if(Array.isArray(o)){Xr(o,n.start),o.push(this.sourceToken),e.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=e.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;n.value||ft(n.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>e.indent){let r=this.startBlockValue(e);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let n=e.items[e.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?e.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?e.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);!n||n.value?e.items.push({start:[],key:o,sep:[]}):n.sep?this.stack.push(o):Object.assign(n,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let r=this.startBlockValue(e);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===e.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let o=Yr(r),s=Kt(o);mf(e);let i=e.end.splice(1,e.end.length);i.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let n=this.source.indexOf(`
192
+ `,n)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else if(n.sep)n.sep.push(this.sourceToken);else{if(this.atIndentedComment(n.start,t.indent)){let o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Uo(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return}if(this.indent>=t.indent){let r=!this.onKeyLine&&this.indent===t.indent,o=r&&(n.sep||n.explicitKey)&&this.type!=="seq-item-ind",s=[];if(o&&n.sep&&!n.value){let i=[];for(let a=0;a<n.sep.length;++a){let c=n.sep[a];switch(c.type){case"newline":i.push(a);break;case"space":break;case"comment":c.indent>t.indent&&(i.length=0);break;default:i.length=0}}i.length>=2&&(s=n.sep.splice(i[1]))}switch(this.type){case"anchor":case"tag":o||n.value?(s.push(this.sourceToken),t.items.push({start:s}),this.onKeyLine=!0):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"explicit-key-ind":!n.sep&&!n.explicitKey?(n.start.push(this.sourceToken),n.explicitKey=!0):o||n.value?(s.push(this.sourceToken),t.items.push({start:s,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(n.explicitKey)if(n.sep)if(n.value)t.items.push({start:[],key:null,sep:[this.sourceToken]});else if(zt(n.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(Fd(n.key)&&!zt(n.sep,"newline")){let i=An(n.start),a=n.key,c=n.sep;c.push(this.sourceToken),delete n.key,delete n.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:a,sep:c}]})}else s.length>0?n.sep=n.sep.concat(s,this.sourceToken):n.sep.push(this.sourceToken);else if(zt(n.start,"newline"))Object.assign(n,{key:null,sep:[this.sourceToken]});else{let i=An(n.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else n.sep?n.value||o?t.items.push({start:s,key:null,sep:[this.sourceToken]}):zt(n.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);o||n.value?(t.items.push({start:s,key:i,sep:[]}),this.onKeyLine=!0):n.sep?this.stack.push(i):(Object.assign(n,{key:i,sep:[]}),this.onKeyLine=!0);return}default:{let i=this.startBlockValue(t);if(i){if(i.type==="block-seq"){if(!n.explicitKey&&n.sep&&!zt(n.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else r&&t.items.push({start:s});this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(t){let n=t.items[t.items.length-1];switch(this.type){case"newline":if(n.value){let r="end"in n.value?n.value.end:void 0;(Array.isArray(r)?r[r.length-1]:void 0)?.type==="comment"?r?.push(this.sourceToken):t.items.push({start:[this.sourceToken]})}else n.start.push(this.sourceToken);return;case"space":case"comment":if(n.value)t.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(n.start,t.indent)){let o=t.items[t.items.length-2]?.value?.end;if(Array.isArray(o)){Uo(o,n.start),o.push(this.sourceToken),t.items.pop();return}}n.start.push(this.sourceToken)}return;case"anchor":case"tag":if(n.value||this.indent<=t.indent)break;n.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==t.indent)break;n.value||zt(n.start,"seq-item-ind")?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return}if(this.indent>t.indent){let r=this.startBlockValue(t);if(r){this.stack.push(r);return}}yield*this.pop(),yield*this.step()}*flowCollection(t){let n=t.items[t.items.length-1];if(this.type==="flow-error-end"){let r;do yield*this.pop(),r=this.peek(1);while(r?.type==="flow-collection")}else if(t.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!n||n.sep?t.items.push({start:[this.sourceToken]}):n.start.push(this.sourceToken);return;case"map-value-ind":!n||n.value?t.items.push({start:[],key:null,sep:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):Object.assign(n,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!n||n.value?t.items.push({start:[this.sourceToken]}):n.sep?n.sep.push(this.sourceToken):n.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);!n||n.value?t.items.push({start:[],key:o,sep:[]}):n.sep?this.stack.push(o):Object.assign(n,{key:o,sep:[]});return}case"flow-map-end":case"flow-seq-end":t.end.push(this.sourceToken);return}let r=this.startBlockValue(t);r?this.stack.push(r):(yield*this.pop(),yield*this.step())}else{let r=this.peek(2);if(r.type==="block-map"&&(this.type==="map-value-ind"&&r.indent===t.indent||this.type==="newline"&&!r.items[r.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&r.type!=="flow-collection"){let o=Zo(r),s=An(o);Pd(t);let i=t.end.splice(1,t.end.length);i.push(this.sourceToken);let a={type:"block-map",offset:t.offset,indent:t.indent,items:[{start:s,key:t,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(t)}}flowScalar(t){if(this.onNewLine){let n=this.source.indexOf(`
193
193
  `)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
194
- `,n)+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;let n=Yr(e),r=Kt(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Yr(e),r=Kt(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,n){return this.type!=="comment"||this.indent<=n?!1:e.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function _h(t){let e=t.prettyErrors!==!1;return{lineCounter:t.lineCounter||e&&new St||null,prettyErrors:e}}function Ls(t,e={}){let{lineCounter:n,prettyErrors:r}=_h(e),o=new Bn(n?.addNewLine),s=new Fn(e),i=null;for(let a of s.compose(o.parse(t),!0,t.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new Re(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(i.errors.forEach(As(t,n)),i.warnings.forEach(As(t,n))),i}var Ie=class extends Error{code;constructor(e){super(`Structured data failed validation: ${e}`),this.name="StructuredDataError",this.code=e}},gf=t=>Ce(JSON.stringify(t)),yf=t=>{if(typeof t!="object"||t===null||Array.isArray(t))return!1;let e=Object.getPrototypeOf(t);return e===Object.prototype||e===null},bf=(t,e)=>{if(yf(t)===!1)throw new Ie("INVALID");let n=0,r=(s,i)=>{if(i>e.depth)throw new Ie("DEPTH_EXCEEDED");if(typeof s=="string"){if(Ce(s)>e.stringBytes)throw new Ie("STRING_BYTES_EXCEEDED");return s}if(s===null||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s)&&(Number.isInteger(s)===!1||Number.isSafeInteger(s)))return s;if(Array.isArray(s))return s.map(a=>{if(n+=1,n>e.fields)throw new Ie("FIELDS_EXCEEDED");return r(a,i+1)});if(yf(s)){let a=Object.create(null);for(let[c,u]of Object.entries(s)){if(n+=1,n>e.fields)throw new Ie("FIELDS_EXCEEDED");a[c]=r(u,i+1)}return a}throw new Ie("INVALID")},o=r(t,1);if(gf(o)>e.serializedBytes)throw new Ie("SERIALIZED_BYTES_EXCEEDED");return o};var Y=class extends Error{code;line;column;constructor(e,n,r,o){super(n,{cause:o}),this.name="MarkdownMetadataError",this.code=e,this.line=r?.line,this.column=r?.column}};var Wt=new Uint8Array([239,187,191]),wf=Wt.byteLength+10,Sh=(t,e,n=0)=>t.byteLength-n<e.byteLength?!1:e.every((r,o)=>t[n+o]===r),jn=(t,e)=>{let n=0;if(Sh(t,Wt))n=Wt.byteLength;else if(t.byteLength<Wt.byteLength&&Wt.slice(0,t.byteLength).every((s,i)=>s===t[i]))return e?null:void 0;if(t.byteLength<n+4)return e?null:void 0;if(t[n]!==45||t[n+1]!==45||t[n+2]!==45)return null;let r=n+3;if(t[r]===10)r+=1;else if(t[r]===13){if(t.byteLength===r+1)return e?null:void 0;if(t[r+1]!==10)return null;r+=2}else return null;let o=r;for(let s=r;s<=t.byteLength;s+=1){let i=s===t.byteLength;if(i===!1&&t[s]!==10)continue;if(i&&e===!1)return;let a=s;if(a>o&&t[a-1]===13&&(a-=1),a-o===3&&(t[o]===45&&t[o+1]===45&&t[o+2]===45||t[o]===46&&t[o+1]===46&&t[o+2]===46))return{yamlStart:r,yamlEnd:o,blockEnd:i?s:s+1};o=s+1}};var Ah={bytes:k.frontmatterBytes,depth:k.frontmatterDepth,fields:k.frontmatterFields,stringBytes:k.frontmatterStringBytes,serializedBytes:k.indexedPropertiesBytes},_f=t=>{try{return le(t)}catch{throw new Y("FRONTMATTER_DECODING_FAILED","Markdown frontmatter is not valid UTF-8")}},vh=t=>t.code==="DEPTH_EXCEEDED"?new Y("FRONTMATTER_DEPTH_EXCEEDED","Markdown frontmatter exceeds the nesting limit"):t.code==="FIELDS_EXCEEDED"?new Y("FRONTMATTER_FIELDS_EXCEEDED","Markdown frontmatter exceeds the field limit"):t.code==="STRING_BYTES_EXCEEDED"?new Y("FRONTMATTER_STRING_BYTES_EXCEEDED","Markdown frontmatter contains a string that exceeds the byte limit"):t.code==="SERIALIZED_BYTES_EXCEEDED"?new Y("FRONTMATTER_BYTES_EXCEEDED","Markdown frontmatter properties exceed the indexed byte limit"):new Y("FRONTMATTER_INVALID","Markdown frontmatter must contain a JSON-compatible object"),xf=(t,e)=>{let n=new St,r=Ls(t,{schema:"core",uniqueKeys:!0,lineCounter:n});if(r.errors.length>0){let s=r.errors[0],i=n.linePos(s.pos[0]);throw new Y("FRONTMATTER_INVALID",`Markdown frontmatter contains invalid YAML: ${s.message}`,{line:i.line+1,column:i.col},s)}let o;try{o=r.toJS({maxAliasCount:0})}catch{throw new Y("FRONTMATTER_INVALID","Markdown frontmatter contains unsupported YAML aliases")}if(o===null)return{};try{return bf(o,e)}catch(s){throw s instanceof Ie?vh(s):s}};var Ef=async(t,e={})=>{let n={...Ah,...e},r=n.bytes+wf,o=new Uint8Array(r),s=0;for await(let c of zt(t)){let u=0;for(;u<c.byteLength;){let d=r-s;if(d<=0)break;let l=Math.max(0,6-s),f=Math.min(c.byteLength-u,l);if(l===0){let m=c.subarray(u,Math.min(c.byteLength,u+d)),h=m.indexOf(10);f=h===-1?m.byteLength:h+1}o.set(c.subarray(u,u+f),s),s+=f,u+=f;let p=o.subarray(0,s),y=jn(p,!1);if(y===null)return{properties:{},frontmatterBytes:0,consumedBytes:p.length};if(y!==void 0){let m=y.yamlEnd-y.yamlStart;if(m>n.bytes)throw new Y("FRONTMATTER_BYTES_EXCEEDED","Markdown frontmatter exceeds the byte limit");let h=_f(p.subarray(y.yamlStart,y.yamlEnd));return{properties:xf(h,n),frontmatterBytes:m,consumedBytes:y.blockEnd}}}if(s>=r)break}let i=o.subarray(0,s),a=jn(i,!0);if(a===null)return{properties:{},frontmatterBytes:0,consumedBytes:i.length};if(a!==void 0){let c=a.yamlEnd-a.yamlStart;if(c<=n.bytes){let u=_f(i.subarray(a.yamlStart,a.yamlEnd));return{properties:xf(u,n),frontmatterBytes:c,consumedBytes:a.blockEnd}}}throw new Y("FRONTMATTER_BYTES_EXCEEDED","Markdown frontmatter is not closed within the byte limit")};var Hr=async(t,e=k.hydratedFileBytes)=>{if(Number.isInteger(e)===!1||e<=0||e>k.hydratedFileBytes)throw new Y("MARKDOWN_BODY_BYTES_EXCEEDED","Markdown body byte limit is outside the supported range");let n;try{n=await Te(t,e)}catch(a){throw a instanceof se?new Y("MARKDOWN_BODY_BYTES_EXCEEDED","Markdown content exceeds the byte limit"):a}let r;try{r=le(n)}catch{throw new Y("MARKDOWN_BODY_DECODING_FAILED","Markdown content is not valid UTF-8")}let s=jn(n,!0)?.blockEnd??0,i;try{i=s===0?Pt(r):le(n.subarray(s))}catch{throw new Y("MARKDOWN_BODY_DECODING_FAILED","Markdown content is not valid UTF-8")}return{body:i,bodyBytes:Ce(i),sourceBytes:n.byteLength}};var dt=class extends Error{code;referenceId;constructor({code:e,message:n,referenceId:r,cause:o}){super(n,{cause:o}),this.name="MarkdownDocumentError",this.code=e,this.referenceId=r}},Dh=O({source:v(),body:v(),frontmatter:Ee(v(),nt())}),to=t=>{let e;try{e=Dh.parse(t)}catch(n){throw new dt({code:"INVALID_DOCUMENT",message:"Markdown document is invalid",cause:n})}return Object.freeze({source:e.source,body:e.body,frontmatter:rt(e.frontmatter)})},eo="#frontmatter",Rh=t=>`${eo}${t.slice(1)}`,kh=t=>{if(t!==eo&&t.startsWith(`${eo}/`)===!1)throw new dt({code:"UNUSED_REFERENCE",message:`Resolved Markdown reference ${t} is outside frontmatter`,referenceId:t});return`#${t.slice(eo.length)}`},Ih=t=>{let e=t.referenceId===void 0?void 0:Rh(t.referenceId),n="INVALID_DOCUMENT";throw(t.code==="INVALID_REFERENCE_MARKER"||t.code==="INVALID_REFERENCE"||t.code==="REFERENCE_NOT_FOUND"||t.code==="INVALID_RESOLVED_VALUE"||t.code==="UNUSED_REFERENCE")&&(n=t.code),new dt({code:n,message:t.message,referenceId:e,cause:t})},Sf=async({source:t,maximumBytes:e=k.hydratedFileBytes})=>{let n;try{n=await Te(t,e)}catch(i){throw i instanceof se?new dt({code:"CONTENT_LIMIT_EXCEEDED",message:"Markdown document exceeds the byte limit",cause:i}):i}let r;try{r=Pt(le(n))}catch(i){throw new dt({code:"CONTENT_DECODING_FAILED",message:"Markdown document is not valid UTF-8",cause:i})}let[o,s]=await Promise.all([Hr(n,e),Ef(n).catch(i=>{if(i instanceof Y)return{properties:{},frontmatterBytes:0,consumedBytes:0};throw i})]);return to({source:r,body:o.body,frontmatter:s.properties})};var Af=({document:t,references:e,allowUnresolvedReferences:n=!1})=>{let r=to(t),o=new Map;for(let[i,a]of e)o.set(kh(i),a);let s;try{s=gr({document:r.frontmatter,references:o,allowUnresolvedReferences:n})}catch(i){throw i instanceof de&&Ih(i),i}return to({...r,frontmatter:s})},vf=({document:t,representation:e})=>{let n=to(t);if(e.type==="document")return n.source;if(e.type==="markdown-body")return n.body;if(e.type==="markdown-frontmatter")return n.frontmatter;throw new dt({code:"UNSUPPORTED_REPRESENTATION",message:`Markdown documents do not support ${e.type}`})};var Df=t=>{let e=encodeURIComponent(t);return e==="."?"%2E":e===".."?"%2E%2E":e};var Rf=t=>t.split("/").map(e=>{try{return Df(decodeURIComponent(e))}catch{return Df(e)}}).join("/");var kf=t=>Object.fromEntries(Object.entries(t??{}).map(([e,n])=>[e,n.url]));var no=(t,e)=>{if(e===void 0||e.length===0)return t;let n=new URL("https://content.webstudio.invalid/__assets__/"),r=new URL(t,n),o=new URL(e,n);for(let[a,c]of o.searchParams)r.searchParams.append(a,c);if(o.hash!==""&&(r.hash=o.hash),t.startsWith("//"))return`//${r.host}${r.pathname}${r.search}${r.hash}`;if(t.startsWith("/"))return`${r.pathname}${r.search}${r.hash}`;let s=!1;try{new URL(t),s=!0}catch{}return s?r.href:`${r.pathname.startsWith(n.pathname)?r.pathname.slice(n.pathname.length):r.pathname}${r.search}${r.hash}`},Ms=({value:t,path:e,replacement:n})=>{let[r,...o]=e;if(r===void 0)return n;if(typeof t!="object"||t===null||Object.hasOwn(t,r)===!1)return t;if(Array.isArray(t)){if(typeof r!="number")return t;let s=[...t];return s[r]=Ms({value:t[r],path:o,replacement:n}),s}return typeof r!="string"?t:{...t,[r]:Ms({value:t[r],path:o,replacement:n})}},Oh=({reference:t,runtimeAsset:e})=>{let{url:n,contentRef:r,...o}=e;return{...o,id:t.assetId,src:no(n,t.suffix)}},pt=({value:t,references:e,runtimeAssets:n={},assetUrls:r})=>{let o=t;for(let s of e??[]){let i=r?.[s.assetId],a=n[s.assetId]??(i===void 0?void 0:{url:i});a!==void 0&&(o=Ms({value:o,path:s.path,replacement:s.structured===!0?Oh({reference:s,runtimeAsset:a}):no(a.url,s.suffix)}))}return o};var oo=t=>{let e=t.format==="json"?t.value:t.value.frontmatter;return Mt(e)?e:void 0},Fs=({document:t,references:e,runtimeAssets:n})=>{let r=oo(t);if(r===void 0||e===void 0)return t;let o=pt({value:{properties:r},references:e,runtimeAssets:n}).properties;return t.format==="json"?Object.freeze({...t,value:o}):Object.freeze({...t,value:Object.freeze({...t.value,frontmatter:o})})},ro=t=>Object.freeze(t),If=async({format:t,source:e,maximumBytes:n=k.hydratedFileBytes})=>ro(t==="json"?{format:t,value:await Al({source:e,maximumBytes:n})}:{format:t,value:await Sf({source:e,maximumBytes:n})});var Of=({document:t,references:e,allowUnresolvedReferences:n})=>t.format==="json"?ro({format:t.format,value:gr({document:t.value,references:e,allowUnresolvedReferences:n})}):ro({format:t.format,value:Af({document:t.value,references:e,allowUnresolvedReferences:n})}),Cf=({document:t,representation:e})=>t.format==="json"?vl({document:t.value,representation:e}):vf({document:t.value,representation:e});var so=class extends Error{code;documentId;expectedRevision;actualRevision;expectedFormat;actualFormat;constructor({code:e,documentId:n,expectedRevision:r,actualRevision:o,expectedFormat:s,actualFormat:i}){super(`Document ${n} source ${e==="REVISION_MISMATCH"?"revision":"format"} does not match its graph`),this.name="DocumentSourceError",this.code=e,this.documentId=n,this.expectedRevision=r,this.actualRevision=o,this.expectedFormat=s,this.actualFormat=i}},Yt=({node:t,source:e})=>{if(e.revision!==t.revision)throw new so({code:"REVISION_MISMATCH",documentId:t.id,expectedRevision:t.revision,actualRevision:e.revision});if(t.format!==void 0&&e.format!==t.format)throw new so({code:"FORMAT_MISMATCH",documentId:t.id,expectedFormat:t.format,actualFormat:e.format});return e};var Xt=t=>{if(typeof t=="object"&&t!==null){let e=Reflect.get(t,"code");if(typeof e=="string"&&e.length>0)return e;let n=Reflect.get(t,"name");if(typeof n=="string"&&n.length>0)return n}return"UNKNOWN"},ae=(t,e)=>{try{t?.(e)}catch{}},Tf=({load:t,onEvent:e})=>async(n,r)=>{let o={documentId:n.id,revision:n.revision};ae(e,{type:"document-fetch-started",...o});try{let s=await t(n,r);return ae(e,{type:"document-fetch-completed",...o}),s}catch(s){throw ae(e,{type:"document-fetch-failed",...o,errorCode:Xt(s)}),s}};var Ch=O({format:ee(xn),revision:v().min(1)}),Ht=class extends Error{code;documentId;status;constructor({code:e,message:n,documentId:r,status:o,cause:s}){super(n,{cause:s}),this.name="HttpDocumentLoaderError",this.code=e,this.documentId=r,this.status=o}},Nf=({fetch:t,getRequest:e,getMetadata:n,onEvent:r})=>Tf({load:async(s,{signal:i})=>{let a;try{a=await t(e(s),{signal:i})}catch(d){throw new Ht({code:"REQUEST_FAILED",message:`Document ${s.id} request failed`,documentId:s.id,cause:d})}if(a.ok===!1)throw new Ht({code:"HTTP_STATUS",message:`Document ${s.id} request returned status ${a.status}`,documentId:s.id,status:a.status});let c;try{c=Ch.parse(n({node:s,response:a}))}catch(d){throw new Ht({code:"INVALID_METADATA",message:`Document ${s.id} response metadata is invalid`,documentId:s.id,cause:d})}let u=a.body;if(u===null)throw new Ht({code:"BODY_MISSING",message:`Document ${s.id} response body is unavailable`,documentId:s.id});return Object.freeze({...c,source:Hu(u)})},onEvent:r});var en=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,zf=new Set,Zs=typeof process=="object"&&process?process:{},Pf=(t,e,n,r)=>{typeof Zs.emitWarning=="function"?Zs.emitWarning(t,e,n,r):console.error(`[${n}] ${e}: ${t}`)},io=globalThis.AbortController,$f=globalThis.AbortSignal;if(typeof io>"u"){$f=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(r,o){this._onabort.push(o)}},io=class{constructor(){e()}signal=new $f;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let o of this.signal._onabort)o(r);this.signal.onabort?.(r)}}};let t=Zs.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",e=()=>{t&&(t=!1,Pf("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",e))}}var Th=t=>!zf.has(t),Iv=Symbol("type"),mt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Lf=t=>mt(t)?t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?tn:null:null,tn=class extends Array{constructor(e){super(e),this.fill(0)}},Bs=class t{heap;length;static#c=!1;static create(e){let n=Lf(e);if(!n)return[];t.#c=!0;let r=new t(e,n);return t.#c=!1,r}constructor(e,n){if(!t.#c)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}},nn=class t{#c;#f;#h;#y;#O;#C;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#g;#r;#n;#e;#u;#d;#a;#s;#b;#i;#w;#_;#p;#x;#D;#l;static unsafeExposeInternals(e){return{starts:e.#_,ttls:e.#p,sizes:e.#w,keyMap:e.#r,keyList:e.#n,valList:e.#e,next:e.#u,prev:e.#d,get head(){return e.#a},get tail(){return e.#s},free:e.#b,isBackgroundFetch:n=>e.#t(n),backgroundFetch:(n,r,o,s)=>e.#$(n,r,o,s),moveToTail:n=>e.#I(n),indexes:n=>e.#E(n),rindexes:n=>e.#S(n),isStale:n=>e.#m(n)}}get max(){return this.#c}get maxSize(){return this.#f}get calculatedSize(){return this.#g}get size(){return this.#o}get fetchMethod(){return this.#O}get memoMethod(){return this.#C}get dispose(){return this.#h}get disposeAfter(){return this.#y}constructor(e){let{max:n=0,ttl:r,ttlResolution:o=1,ttlAutopurge:s,updateAgeOnGet:i,updateAgeOnHas:a,allowStale:c,dispose:u,disposeAfter:d,noDisposeOnSet:l,noUpdateTTL:f,maxSize:p=0,maxEntrySize:y=0,sizeCalculation:m,fetchMethod:h,memoMethod:g,noDeleteOnFetchRejection:x,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:_,allowStaleOnFetchAbort:w,ignoreFetchAbort:A}=e;if(n!==0&&!mt(n))throw new TypeError("max option must be a nonnegative integer");let D=n?Lf(n):Array;if(!D)throw new Error("invalid max value: "+n);if(this.#c=n,this.#f=p,this.maxEntrySize=y||this.#f,this.sizeCalculation=m,this.sizeCalculation){if(!this.#f&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(g!==void 0&&typeof g!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#C=g,h!==void 0&&typeof h!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#O=h,this.#D=!!h,this.#r=new Map,this.#n=new Array(n).fill(void 0),this.#e=new Array(n).fill(void 0),this.#u=new D(n),this.#d=new D(n),this.#a=0,this.#s=0,this.#b=Bs.create(n),this.#o=0,this.#g=0,typeof u=="function"&&(this.#h=u),typeof d=="function"?(this.#y=d,this.#i=[]):(this.#y=void 0,this.#i=void 0),this.#x=!!this.#h,this.#l=!!this.#y,this.noDisposeOnSet=!!l,this.noUpdateTTL=!!f,this.noDeleteOnFetchRejection=!!x,this.allowStaleOnFetchRejection=!!_,this.allowStaleOnFetchAbort=!!w,this.ignoreFetchAbort=!!A,this.maxEntrySize!==0){if(this.#f!==0&&!mt(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!mt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#B()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!a,this.ttlResolution=mt(o)||o===0?o:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!mt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#z()}if(this.#c===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#c&&!this.#f){let E="LRU_CACHE_UNBOUNDED";Th(E)&&(zf.add(E),Pf("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",E,t))}}getRemainingTTL(e){return this.#r.has(e)?1/0:0}#z(){let e=new tn(this.#c),n=new tn(this.#c);this.#p=e,this.#_=n,this.#P=(s,i,a=en.now())=>{if(n[s]=i!==0?a:0,e[s]=i,i!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#m(s)&&this.#A(this.#n[s],"expire")},i+1);c.unref&&c.unref()}},this.#R=s=>{n[s]=e[s]!==0?en.now():0},this.#v=(s,i)=>{if(e[i]){let a=e[i],c=n[i];if(!a||!c)return;s.ttl=a,s.start=c,s.now=r||o();let u=s.now-c;s.remainingTTL=a-u}};let r=0,o=()=>{let s=en.now();if(this.ttlResolution>0){r=s;let i=setTimeout(()=>r=0,this.ttlResolution);i.unref&&i.unref()}return s};this.getRemainingTTL=s=>{let i=this.#r.get(s);if(i===void 0)return 0;let a=e[i],c=n[i];if(!a||!c)return 1/0;let u=(r||o())-c;return a-u},this.#m=s=>{let i=n[s],a=e[s];return!!a&&!!i&&(r||o())-i>a}}#R=()=>{};#v=()=>{};#P=()=>{};#m=()=>!1;#B(){let e=new tn(this.#c);this.#g=0,this.#w=e,this.#k=n=>{this.#g-=e[n],e[n]=0},this.#L=(n,r,o,s)=>{if(this.#t(r))return 0;if(!mt(o))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(o=s(r,n),!mt(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o},this.#T=(n,r,o)=>{if(e[n]=r,this.#f){let s=this.#f-e[n];for(;this.#g>s;)this.#N(!0)}this.#g+=e[n],o&&(o.entrySize=r,o.totalCalculatedSize=this.#g)}}#k=e=>{};#T=(e,n,r)=>{};#L=(e,n,r,o)=>{if(r||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#E({allowStale:e=this.allowStale}={}){if(this.#o)for(let n=this.#s;!(!this.#M(n)||((e||!this.#m(n))&&(yield n),n===this.#a));)n=this.#d[n]}*#S({allowStale:e=this.allowStale}={}){if(this.#o)for(let n=this.#a;!(!this.#M(n)||((e||!this.#m(n))&&(yield n),n===this.#s));)n=this.#u[n]}#M(e){return e!==void 0&&this.#r.get(this.#n[e])===e}*entries(){for(let e of this.#E())this.#e[e]!==void 0&&this.#n[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#n[e],this.#e[e]])}*rentries(){for(let e of this.#S())this.#e[e]!==void 0&&this.#n[e]!==void 0&&!this.#t(this.#e[e])&&(yield[this.#n[e],this.#e[e]])}*keys(){for(let e of this.#E()){let n=this.#n[e];n!==void 0&&!this.#t(this.#e[e])&&(yield n)}}*rkeys(){for(let e of this.#S()){let n=this.#n[e];n!==void 0&&!this.#t(this.#e[e])&&(yield n)}}*values(){for(let e of this.#E())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}*rvalues(){for(let e of this.#S())this.#e[e]!==void 0&&!this.#t(this.#e[e])&&(yield this.#e[e])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,n={}){for(let r of this.#E()){let o=this.#e[r],s=this.#t(o)?o.__staleWhileFetching:o;if(s!==void 0&&e(s,this.#n[r],this))return this.get(this.#n[r],n)}}forEach(e,n=this){for(let r of this.#E()){let o=this.#e[r],s=this.#t(o)?o.__staleWhileFetching:o;s!==void 0&&e.call(n,s,this.#n[r],this)}}rforEach(e,n=this){for(let r of this.#S()){let o=this.#e[r],s=this.#t(o)?o.__staleWhileFetching:o;s!==void 0&&e.call(n,s,this.#n[r],this)}}purgeStale(){let e=!1;for(let n of this.#S({allowStale:!0}))this.#m(n)&&(this.#A(this.#n[n],"expire"),e=!0);return e}info(e){let n=this.#r.get(e);if(n===void 0)return;let r=this.#e[n],o=this.#t(r)?r.__staleWhileFetching:r;if(o===void 0)return;let s={value:o};if(this.#p&&this.#_){let i=this.#p[n],a=this.#_[n];if(i&&a){let c=i-(en.now()-a);s.ttl=c,s.start=Date.now()}}return this.#w&&(s.size=this.#w[n]),s}dump(){let e=[];for(let n of this.#E({allowStale:!0})){let r=this.#n[n],o=this.#e[n],s=this.#t(o)?o.__staleWhileFetching:o;if(s===void 0||r===void 0)continue;let i={value:s};if(this.#p&&this.#_){i.ttl=this.#p[n];let a=en.now()-this.#_[n];i.start=Math.floor(Date.now()-a)}this.#w&&(i.size=this.#w[n]),e.unshift([r,i])}return e}load(e){this.clear();for(let[n,r]of e){if(r.start){let o=Date.now()-r.start;r.start=en.now()-o}this.set(n,r.value,r)}}set(e,n,r={}){if(n===void 0)return this.delete(e),this;let{ttl:o=this.ttl,start:s,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,d=this.#L(e,n,r.size||0,a);if(this.maxEntrySize&&d>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#A(e,"set"),this;let l=this.#o===0?void 0:this.#r.get(e);if(l===void 0)l=this.#o===0?this.#s:this.#b.length!==0?this.#b.pop():this.#o===this.#c?this.#N(!1):this.#o,this.#n[l]=e,this.#e[l]=n,this.#r.set(e,l),this.#u[this.#s]=l,this.#d[l]=this.#s,this.#s=l,this.#o++,this.#T(l,d,c),c&&(c.set="add"),u=!1;else{this.#I(l);let f=this.#e[l];if(n!==f){if(this.#D&&this.#t(f)){f.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:p}=f;p!==void 0&&!i&&(this.#x&&this.#h?.(p,e,"set"),this.#l&&this.#i?.push([p,e,"set"]))}else i||(this.#x&&this.#h?.(f,e,"set"),this.#l&&this.#i?.push([f,e,"set"]));if(this.#k(l),this.#T(l,d,c),this.#e[l]=n,c){c.set="replace";let p=f&&this.#t(f)?f.__staleWhileFetching:f;p!==void 0&&(c.oldValue=p)}}else c&&(c.set="update")}if(o!==0&&!this.#p&&this.#z(),this.#p&&(u||this.#P(l,o,s),c&&this.#v(c,l)),!i&&this.#l&&this.#i){let f=this.#i,p;for(;p=f?.shift();)this.#y?.(...p)}return this}pop(){try{for(;this.#o;){let e=this.#e[this.#a];if(this.#N(!0),this.#t(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(e!==void 0)return e}}finally{if(this.#l&&this.#i){let e=this.#i,n;for(;n=e?.shift();)this.#y?.(...n)}}}#N(e){let n=this.#a,r=this.#n[n],o=this.#e[n];return this.#D&&this.#t(o)?o.__abortController.abort(new Error("evicted")):(this.#x||this.#l)&&(this.#x&&this.#h?.(o,r,"evict"),this.#l&&this.#i?.push([o,r,"evict"])),this.#k(n),e&&(this.#n[n]=void 0,this.#e[n]=void 0,this.#b.push(n)),this.#o===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#u[n],this.#r.delete(r),this.#o--,n}has(e,n={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:o}=n,s=this.#r.get(e);if(s!==void 0){let i=this.#e[s];if(this.#t(i)&&i.__staleWhileFetching===void 0)return!1;if(this.#m(s))o&&(o.has="stale",this.#v(o,s));else return r&&this.#R(s),o&&(o.has="hit",this.#v(o,s)),!0}else o&&(o.has="miss");return!1}peek(e,n={}){let{allowStale:r=this.allowStale}=n,o=this.#r.get(e);if(o===void 0||!r&&this.#m(o))return;let s=this.#e[o];return this.#t(s)?s.__staleWhileFetching:s}#$(e,n,r,o){let s=n===void 0?void 0:this.#e[n];if(this.#t(s))return s;let i=new io,{signal:a}=r;a?.addEventListener("abort",()=>i.abort(a.reason),{signal:i.signal});let c={signal:i.signal,options:r,context:o},u=(m,h=!1)=>{let{aborted:g}=i.signal,x=r.ignoreFetchAbort&&m!==void 0;if(r.status&&(g&&!h?(r.status.fetchAborted=!0,r.status.fetchError=i.signal.reason,x&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),g&&!x&&!h)return l(i.signal.reason);let S=p;return this.#e[n]===p&&(m===void 0?S.__staleWhileFetching?this.#e[n]=S.__staleWhileFetching:this.#A(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,m,c.options))),m},d=m=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=m),l(m)),l=m=>{let{aborted:h}=i.signal,g=h&&r.allowStaleOnFetchAbort,x=g||r.allowStaleOnFetchRejection,S=x||r.noDeleteOnFetchRejection,_=p;if(this.#e[n]===p&&(!S||_.__staleWhileFetching===void 0?this.#A(e,"fetch"):g||(this.#e[n]=_.__staleWhileFetching)),x)return r.status&&_.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),_.__staleWhileFetching;if(_.__returned===_)throw m},f=(m,h)=>{let g=this.#O?.(e,s,c);g&&g instanceof Promise&&g.then(x=>m(x===void 0?void 0:x),h),i.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(m(void 0),r.allowStaleOnFetchAbort&&(m=x=>u(x,!0)))})};r.status&&(r.status.fetchDispatched=!0);let p=new Promise(f).then(u,d),y=Object.assign(p,{__abortController:i,__staleWhileFetching:s,__returned:void 0});return n===void 0?(this.set(e,y,{...c.options,status:void 0}),n=this.#r.get(e)):this.#e[n]=y,y}#t(e){if(!this.#D)return!1;let n=e;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof io}async fetch(e,n={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:d=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:y=this.allowStaleOnFetchAbort,context:m,forceRefresh:h=!1,status:g,signal:x}=n;if(!this.#D)return g&&(g.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:s,status:g});let S={allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:s,ttl:i,noDisposeOnSet:a,size:c,sizeCalculation:u,noUpdateTTL:d,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:y,ignoreFetchAbort:p,status:g,signal:x},_=this.#r.get(e);if(_===void 0){g&&(g.fetch="miss");let w=this.#$(e,_,S,m);return w.__returned=w}else{let w=this.#e[_];if(this.#t(w)){let P=r&&w.__staleWhileFetching!==void 0;return g&&(g.fetch="inflight",P&&(g.returnedStale=!0)),P?w.__staleWhileFetching:w.__returned=w}let A=this.#m(_);if(!h&&!A)return g&&(g.fetch="hit"),this.#I(_),o&&this.#R(_),g&&this.#v(g,_),w;let D=this.#$(e,_,S,m),C=D.__staleWhileFetching!==void 0&&r;return g&&(g.fetch=A?"stale":"refresh",C&&A&&(g.returnedStale=!0)),C?D.__staleWhileFetching:D.__returned=D}}async forceFetch(e,n={}){let r=await this.fetch(e,n);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(e,n={}){let r=this.#C;if(!r)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:s,...i}=n,a=this.get(e,i);if(!s&&a!==void 0)return a;let c=r(e,a,{options:i,context:o});return this.set(e,c,i),c}get(e,n={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:i}=n,a=this.#r.get(e);if(a!==void 0){let c=this.#e[a],u=this.#t(c);return i&&this.#v(i,a),this.#m(a)?(i&&(i.get="stale"),u?(i&&r&&c.__staleWhileFetching!==void 0&&(i.returnedStale=!0),r?c.__staleWhileFetching:void 0):(s||this.#A(e,"expire"),i&&r&&(i.returnedStale=!0),r?c:void 0)):(i&&(i.get="hit"),u?c.__staleWhileFetching:(this.#I(a),o&&this.#R(a),c))}else i&&(i.get="miss")}#F(e,n){this.#d[n]=e,this.#u[e]=n}#I(e){e!==this.#s&&(e===this.#a?this.#a=this.#u[e]:this.#F(this.#d[e],this.#u[e]),this.#F(this.#s,e),this.#s=e)}delete(e){return this.#A(e,"delete")}#A(e,n){let r=!1;if(this.#o!==0){let o=this.#r.get(e);if(o!==void 0)if(r=!0,this.#o===1)this.#Z(n);else{this.#k(o);let s=this.#e[o];if(this.#t(s)?s.__abortController.abort(new Error("deleted")):(this.#x||this.#l)&&(this.#x&&this.#h?.(s,e,n),this.#l&&this.#i?.push([s,e,n])),this.#r.delete(e),this.#n[o]=void 0,this.#e[o]=void 0,o===this.#s)this.#s=this.#d[o];else if(o===this.#a)this.#a=this.#u[o];else{let i=this.#d[o];this.#u[i]=this.#u[o];let a=this.#u[o];this.#d[a]=this.#d[o]}this.#o--,this.#b.push(o)}}if(this.#l&&this.#i?.length){let o=this.#i,s;for(;s=o?.shift();)this.#y?.(...s)}return r}clear(){return this.#Z("delete")}#Z(e){for(let n of this.#S({allowStale:!0})){let r=this.#e[n];if(this.#t(r))r.__abortController.abort(new Error("deleted"));else{let o=this.#n[n];this.#x&&this.#h?.(r,o,e),this.#l&&this.#i?.push([r,o,e])}}if(this.#r.clear(),this.#e.fill(void 0),this.#n.fill(void 0),this.#p&&this.#_&&(this.#p.fill(0),this.#_.fill(0)),this.#w&&this.#w.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#g=0,this.#o=0,this.#l&&this.#i){let n=this.#i,r;for(;r=n?.shift();)this.#y?.(...r)}}};var js=({maximumBytes:t=k.hydratedTotalBytes*4}={})=>{if(Number.isSafeInteger(t)===!1||t<=0)throw new TypeError("Document source cache byte limit must be positive");return new nn({maxSize:t,sizeCalculation:e=>Math.max(1,e.bytes.byteLength)})},Un=class extends Error{code="CONTENT_LIMIT_EXCEEDED";documentId;contentByteLimit;constructor({message:e,documentId:n,contentByteLimit:r,cause:o}){super(e,{cause:o}),this.name="CachedDocumentLoaderError",this.documentId=n,this.contentByteLimit=r}},ao=({contentRef:t,revision:e,format:n})=>fe([t,e,n??null]),Nh=t=>{if(typeof t!="object"||t===null)return!1;let e=t;return ol(e.format)&&typeof e.revision=="string"&&e.revision.length>0&&e.bytes instanceof Uint8Array},Mf=t=>Object.freeze({format:t.format,revision:t.revision,source:t.bytes}),Ff=({load:t,cache:e,maximumBytes:n=k.hydratedFileBytes,onEvent:r})=>{let o=new Map;return async(s,i)=>{let a=ao(s),c=o.get(a)??new Map;o.set(a,c);let u=c.get(i.signal);if(u!==void 0)return await u;let d=(async()=>{let l;try{l=await e.get(a)}catch(m){ae(r,{type:"document-cache-read-failed",documentId:s.id,revision:s.revision,errorCode:Xt(m)})}if(Nh(l)&&l.revision===s.revision&&l.bytes.byteLength<=n&&(s.format===void 0||l.format===s.format))return ae(r,{type:"document-cache-hit",documentId:s.id,revision:s.revision}),Mf(l);ae(r,{type:"document-cache-miss",documentId:s.id,revision:s.revision});let f=Yt({node:s,source:await t(s,i)}),p;try{p=await Te(f.source,n)}catch(m){throw m instanceof se?new Un({message:`Document ${s.id} exceeds the cache byte limit`,documentId:s.id,contentByteLimit:n,cause:m}):m}let y=Object.freeze({format:f.format,revision:f.revision,bytes:p});try{await e.set(a,y),ae(r,{type:"document-cache-stored",documentId:s.id,revision:s.revision})}catch(m){ae(r,{type:"document-cache-write-failed",documentId:s.id,revision:s.revision,errorCode:Xt(m)})}return Mf(y)})();c.set(i.signal,d);try{return await d}finally{c.delete(i.signal),c.size===0&&o.delete(a)}}};var We=class extends Error{code;documentId;referenceId;constructor({code:e,message:n,documentId:r,referenceId:o,cause:s}){super(n,{cause:s}),this.name="DocumentGraphResolutionError",this.code=e,this.documentId=r,this.referenceId=o}},co=t=>{if(t?.aborted)throw new We({code:"REQUEST_CANCELLED",message:"Document graph resolution was cancelled",cause:t.reason})},Zf=async({graph:t,rootIds:e,concurrency:n,signal:r,load:o,select:s,assemble:i})=>{co(r);let a=dr({graph:t,rootIds:e}),c=new Map(a.map(p=>[p.id,p])),u=new Map,d=new Map;for(let p of a){let y=d.get(p.contentRef);y===void 0?d.set(p.contentRef,{representative:p,nodes:[p]}):y.nodes.push(p)}await hr([...d.values()],n,async p=>{co(r);let y=p.representative;try{let m=await o(y,{signal:r});for(let h of p.nodes)u.set(h.id,m)}catch(m){throw r?.aborted&&co(r),new We({code:"DOCUMENT_LOAD_FAILED",message:`Document ${y.id} could not be loaded`,documentId:y.id,cause:m})}});let l=Lt(t.edges),f=new Map;for(let p of a){co(r);let y=new Map;for(let h of l.get(p.id)??[]){let g=c.get(h.reference.documentId);if(g===void 0||f.has(h.reference.documentId)===!1)throw new We({code:"DOCUMENT_ASSEMBLY_FAILED",message:`Document ${p.id} dependency ${h.reference.documentId} is unavailable`,documentId:p.id,referenceId:h.referenceId});let x=f.get(h.reference.documentId),S;if(s===void 0){if(h.reference.representation.type!=="document")throw new We({code:"REPRESENTATION_SELECTOR_REQUIRED",message:`Document ${p.id} reference ${h.referenceId} requires a representation selector`,documentId:p.id,referenceId:h.referenceId});S=x}else try{S=await s({reference:h.reference,value:x,sourceNode:p,targetNode:g})}catch(_){throw new We({code:"DOCUMENT_SELECTION_FAILED",message:`Document ${p.id} reference ${h.referenceId} could not be selected`,documentId:p.id,referenceId:h.referenceId,cause:_})}y.set(h.referenceId,S)}if(u.has(p.id)===!1)throw new We({code:"DOCUMENT_ASSEMBLY_FAILED",message:`Document ${p.id} source is unavailable`,documentId:p.id});let m=u.get(p.id);try{f.set(p.id,await i({node:p,source:m,references:y}))}catch(h){throw new We({code:"DOCUMENT_ASSEMBLY_FAILED",message:`Document ${p.id} could not be assembled`,documentId:p.id,cause:h})}}return Object.freeze({roots:Object.freeze(e.map(p=>f.get(p))),values:f})};var At=class extends Error{code;documentId;documentCount;documentLimit;contentByteLimit;totalBytes;totalByteLimit;constructor({code:e,message:n,documentId:r,documentCount:o,documentLimit:s,contentByteLimit:i,totalBytes:a,totalByteLimit:c,cause:u}){super(n,{cause:u}),this.name="DocumentResolutionLimitError",this.code=e,this.documentId=r,this.documentCount=o,this.documentLimit=s,this.contentByteLimit=i,this.totalBytes=a,this.totalByteLimit=c}},$h=(t,e)=>{let n=0,r=[],o=async()=>{if(e?.throwIfAborted(),n<t){n+=1;return}await new Promise((i,a)=>{let c,u=()=>{let d=r.indexOf(c);d!==-1&&r.splice(d,1);try{e?.throwIfAborted()}catch(l){a(l)}};c={start:()=>{e?.removeEventListener("abort",u),i()}},r.push(c),e?.addEventListener("abort",u,{once:!0})})},s=()=>{let i=r.shift();if(i===void 0){n-=1;return}i.start()};return async i=>{await o();try{return await i()}finally{s()}}},zh=async({graph:t,rootIds:e,concurrency:n,maximumBytes:r,maximumTotalBytes:o=k.hydratedTotalBytes,maximumDocuments:s=k.hydratedFileCount,signal:i,onEvent:a,allowUnresolvedReferences:c=!1,transformDocument:u,load:d})=>{let l=dr({graph:t,rootIds:e}).length,f={rootCount:e.length,documentCount:l};ae(a,{type:"resolution-started",...f});try{if(l>s)throw new At({code:"DOCUMENT_COUNT_EXCEEDED",message:"Document graph resolution exceeds the document limit",documentCount:l,documentLimit:s});let p=0,y=Promise.resolve(),m=await Zf({graph:t,rootIds:e,concurrency:n,signal:i,load:async(h,g)=>{let x=y,S=()=>{};y=new Promise(w=>{S=w});let _;try{_={status:"fulfilled",value:await d(h,g)}}catch(w){_={status:"rejected",reason:w}}await x;try{if(_.status==="rejected")throw _.reason;if(_.value.byteLength>r)throw new At({code:"CONTENT_LIMIT_EXCEEDED",message:`Document ${h.id} exceeds the byte limit`,documentId:h.id,contentByteLimit:r,cause:new se});let w=p+_.value.byteLength;if(w>o)throw new At({code:"TOTAL_BYTES_EXCEEDED",message:"Document graph resolution exceeds the total byte limit",documentId:h.id,totalBytes:w,totalByteLimit:o});return p=w,await _.value.parse()}finally{S()}},select:({reference:h,value:g})=>Cf({document:g,representation:h.representation}),assemble:({node:h,source:g,references:x})=>{let S=Of({document:g,references:x,allowUnresolvedReferences:c});return u?.({node:h,document:S})??S}});return ae(a,{type:"resolution-completed",...f}),m}catch(p){throw ae(a,{type:"resolution-failed",...f,errorCode:Xt(p)}),p}},Bf=({load:t,concurrency:e,signal:n,maximumDocumentBytes:r=k.hydratedFileBytes,maximumCacheBytes:o=k.hydratedTotalBytes*4})=>{if(Number.isSafeInteger(e)===!1||e<=0)throw new TypeError("Document resolution concurrency must be positive");if(Number.isSafeInteger(r)===!1||r<=0)throw new TypeError("Document resolution byte limit must be positive");if(Number.isSafeInteger(o)===!1||o<=0)throw new TypeError("Document resolution cache byte limit must be positive");let s=new nn({maxSize:o,sizeCalculation:({byteLength:f})=>Math.max(1,f)}),i=new Map,a=$h(e,n),c=f=>{if(f!==void 0&&f!==n)throw new TypeError("Document resolution session signal does not match");n?.throwIfAborted()},u=async f=>(c(),n===void 0?await f:await new Promise((p,y)=>{let m=()=>n.removeEventListener("abort",h),h=()=>{m();try{n.throwIfAborted()}catch(g){y(g)}};n.addEventListener("abort",h,{once:!0}),f.then(g=>{m(),p(g)},g=>{m(),y(g)}),n.aborted&&h()})),d=async(f,p)=>{c(p.signal);let y=ao(f),m=s.get(y);if(m!==void 0)return m;let h=i.get(y);if(h!==void 0)return await u(h);let g=a(async()=>{c(p.signal);let x=Yt({node:f,source:await t(f,{signal:n})});c(p.signal);let S=await Xo(x.source,r+1);c(p.signal);let _,w=Object.freeze({format:x.format,revision:x.revision,bytes:S,byteLength:S.byteLength,parse:()=>(_??=If({format:x.format,source:S,maximumBytes:r}),_)});return w.byteLength<=o&&s.set(y,w),w});i.set(y,g);try{return await u(g)}finally{i.delete(y)}};return Object.freeze({getCached:f=>{c();let p=s.get(ao(f));if(!(p===void 0||p.byteLength>r))return Object.freeze({format:p.format,revision:p.revision,source:p.bytes.slice()})},resolve:async f=>await zh({...f,concurrency:e,maximumBytes:r,signal:n,load:d})})};var jf=t=>{if(t.output.mode==="all")return"all";let e=[];for(let{field:n}of ur(t.where))n[0]==="properties"&&e.push(n);for(let{field:n}of t.sort)n[0]==="properties"&&e.push(n);if(t.output.mode==="fields")for(let n of t.output.fields)n[0]==="properties"&&e.push(n);return e},Uf=t=>{let e;if(t==="#frontmatter")e="";else if(t.startsWith("#frontmatter/"))e=t.slice(12);else if(t==="#")e="";else if(t.startsWith("#/"))e=t.slice(1);else return;try{return["properties",...Sl(e)]}catch{return}},Qf=(t,e)=>{let n=Math.min(t.length,e.length);for(let r=0;r<n;r+=1)if(t[r]!==e[r])return!1;return!0},Vf=({queryPaths:t,referenceId:e})=>{let n=Uf(e);return n!==void 0&&(t==="all"||t.some(r=>Qf(r,n)))},Gf=({graph:t,sourceId:e,field:n})=>n[0]!=="properties"?!1:t.edges.some(r=>{if(r.sourceId!==e)return!1;let o=Uf(r.referenceId);return o!==void 0&&Qf(n,o)}),qf=({graph:t,query:e})=>{let n=jf(e),r=new Set;for(let o of t.edges)Vf({queryPaths:n,referenceId:o.referenceId})&&r.add(o.sourceId);return[...r]},Jf=({graph:t,query:e,rootIds:n})=>{let r=jf(e),o=new Set(n),s=new Map(t.nodes.map(l=>[l.id,l])),i=Lt(t.edges),a=new Set(n),c=new Set,u=new Set,d=l=>{if(a.add(l),!u.has(l)){u.add(l);for(let f of i.get(l)??[])c.add(f),d(f.reference.documentId)}};for(let l of t.edges)o.has(l.sourceId)&&Vf({queryPaths:r,referenceId:l.referenceId})&&(c.add(l),d(l.reference.documentId));return En({nodes:[...a].map(l=>{let f=s.get(l);if(f===void 0)throw new Error(`Document graph query root ${l} does not exist`);return f}),edges:[...c]})};var Kf=({artifact:t})=>{if(t.documentGraph===void 0)return;let e=new Map(t.documents.map(s=>[s._id,s])),n=new Map(t.documentGraph.nodes.map(s=>[s.id,s])),r=new Map;for(let{sourceId:s}of t.documentGraph.edges){if(n.has(s))continue;let i=e.get(s);if(i?.properties===void 0)throw new Error(`Runtime document graph source ${s} is unavailable`);r.set(s,i),n.set(s,{id:s,revision:s,contentRef:s,format:"json"})}return{graph:En({nodes:[...n.values()],edges:t.documentGraph.edges.map(({sourceId:s,referenceId:i,documentId:a,representation:c})=>{let u=n.get(a);if(u===void 0)throw new Error(`Runtime document graph target ${a} is unavailable`);return{sourceId:s,referenceId:i,reference:{documentId:a,revision:u.revision,representation:c}}})}),inlineDocuments:r}};var Wf=({markdown:t,references:e,assetUrls:n})=>{let r=t.length,o=t;for(let s of[...e].sort((i,a)=>a.start-i.start)){if(s.start<0||s.end<=s.start||s.end>t.length||s.end>r)throw new Error("Markdown asset reference range is invalid");r=s.start;let i=n[s.assetId];if(i===void 0)continue;let a=no(i,s.suffix);o=`${o.slice(0,s.start)}${a}${o.slice(s.end)}`}return o};var X=class extends Error{code;details;constructor({code:e,message:n,details:r}){super(n),this.name="AssetResourceHydrationError",this.code=e,this.details=r}},Ph=t=>{if(t===null)return[];let e=Array.isArray(t)?t:[t],n=new Map;for(let r of e){if(typeof r!="object"||r===null||!("_id"in r)||typeof r._id!="string"||!("revision"in r)||typeof r.revision!="string"||!("contentRef"in r)||typeof r.contentRef!="string")throw new X({code:"CONTENT_IDENTITY_REQUIRED",message:"Hydrated query results must retain _id, revision, and contentRef"});let o=n.get(r._id);if(o!==void 0&&(o.revision!==r.revision||o.contentRef!==r.contentRef))throw new X({code:"CONTENT_IDENTITY_REQUIRED",message:"A selected asset ID has conflicting content identity",details:{assetId:r._id}});n.set(r._id,{_id:r._id,revision:r.revision,contentRef:r.contentRef})}return Array.from(n.values())},Lh=t=>typeof t.mimeType=="string"&&(t.mimeType.startsWith("text/")||["application/json","application/javascript","application/xml","image/svg+xml"].includes(t.mimeType)),Mh=async({read:t,contentRef:e,range:n,maximumBytes:r})=>{if(r===0)return new Uint8Array;let o=await t(e,n);try{return await Te(o.data,r)}catch(s){throw s instanceof se?new X({code:"CONTENT_LIMIT_EXCEEDED",message:"Asset storage returned more content than requested"}):s}},Fh=t=>{try{return le(t)}catch{throw new X({code:"CONTENT_DECODING_FAILED",message:"Selected asset content is not valid UTF-8"})}},Zh=(t,e)=>{if(e.mode==="range")return Math.max(0,Math.min(e.length,t.size-e.offset));let n=e.maxBytes??k.hydratedFileBytes;if(t.size>n)throw new X({code:"CONTENT_LIMIT_EXCEEDED",message:"Selected asset exceeds the per-file content limit",details:{assetId:t._id,assetBytes:t.size,fileByteLimit:n}});return t.size},Yf=t=>{let e=t.flatMap(({reason:s,document:i})=>{if(typeof i.path!="string")return[];let a=s instanceof X?s.code:"CONTENT_READ_FAILED",c=s instanceof Error&&s.message!==""?s.message:"Selected asset content could not be read";return[{severity:"error",scope:"query",phase:"source",code:a,message:c,assetId:i._id,path:i.path}]});if(e.length!==t.length)throw t[0].reason;if(t.length===1){let s=t[0].reason,i=e[0];throw i===void 0?s:new X({code:s instanceof X?s.code:"INVALID_REQUEST",message:i.message,details:{...s instanceof X?s.details:{},diagnostics:e}})}let n=new Set(e.map(({code:s})=>s)),r=e[0]?.code,o=n.size===1&&(r==="CONTENT_IDENTITY_REQUIRED"||r==="CONTENT_NOT_TEXT"||r==="CONTENT_DECODING_FAILED"||r==="CONTENT_LIMIT_EXCEEDED")?r:"INVALID_REQUEST";throw new X({code:o,message:`${e.length} selected asset content errors found`,details:{diagnostics:e}})},Xf=async({result:t,documents:e,options:n,read:r,assetReferences:o,assetUrls:s})=>{if(n.mode==="none")return{content:{},hydratedFileCount:0,hydratedBytes:0};let i=Ph(t);if(i.length>k.hydratedFileCount)throw new X({code:"CONTENT_LIMIT_EXCEEDED",message:"Too many selected assets requested content hydration",details:{fileCount:i.length,fileCountLimit:k.hydratedFileCount}});let a=new Map(e.map(m=>[m._id,m])),c=i.map(m=>{let h=a.get(m._id);try{if(h===void 0||h.revision!==m.revision||h.contentRef!==m.contentRef||typeof h.size!="number"||typeof h.mimeType!="string")throw new X({code:"CONTENT_IDENTITY_REQUIRED",message:"Selected asset content identity is stale or unavailable",details:{assetId:m._id}});let g={...h,size:h.size,mimeType:h.mimeType};if(Lh(g)===!1)throw new X({code:"CONTENT_NOT_TEXT",message:"Selected binary asset cannot be embedded as text",details:{assetId:m._id,mimeType:g.mimeType}});return{status:"fulfilled",value:{identity:m,document:g,readLength:Zh(g,n)}}}catch(g){return{status:"rejected",reason:g,document:h??{_id:m._id}}}}),u=c.flatMap(m=>m.status==="rejected"?[m]:[]);u.length>0&&Yf(u);let d=c.flatMap(m=>m.status==="fulfilled"?[m.value]:[]),l=d.reduce((m,h)=>m+h.readLength,0);if(l>k.hydratedTotalBytes)throw new X({code:"CONTENT_LIMIT_EXCEEDED",message:"Selected assets exceed the total hydrated-content limit",details:{totalReadBytes:l,totalByteLimit:k.hydratedTotalBytes}});let f=await hr(d,k.concurrentContentReads,async m=>{try{let h=n.mode==="range"?{offset:n.offset,length:m.readLength}:m.readLength===0?void 0:{offset:0,length:m.readLength},g=await Mh({read:r,contentRef:m.identity.contentRef,range:h,maximumBytes:m.readLength});if(g.byteLength!==m.readLength)throw new X({code:"CONTENT_IDENTITY_REQUIRED",message:"Selected asset bytes do not match canonical metadata",details:{assetId:m.identity._id}});let x;if(n.mode==="markdown-body-ref")try{x=(await Hr(g,m.readLength||1)).body;let _=o?.[m.identity.contentRef];_!==void 0&&s!==void 0&&(x=Wf({markdown:x,references:_,assetUrls:s}))}catch{throw new X({code:"CONTENT_DECODING_FAILED",message:"Selected Markdown body could not be decoded",details:{assetId:m.identity._id}})}else x=Fh(g);let S=Ce(x);return{status:"fulfilled",value:{id:m.identity._id,returnedBytes:S,content:{...m.identity,encoding:"utf-8",text:x,...n.mode==="range"?{range:{offset:n.offset,length:g.byteLength,total:m.document.size}}:{}}}}}catch(h){return{status:"rejected",reason:h,document:m.document}}}),p=f.flatMap(m=>m.status==="rejected"?[m]:[]);p.length>0&&Yf(p);let y=f.flatMap(m=>m.status==="fulfilled"?[m.value]:[]);return{content:Object.fromEntries(y.map(({id:m,content:h})=>[m,h])),hydratedFileCount:d.length,hydratedBytes:y.reduce((m,{returnedBytes:h})=>m+h,0)}};var hD=v().datetime({offset:!0}).transform(t=>new Date(t).toISOString());var Bh=/^[A-Za-z_][A-Za-z0-9_]*$/,Hf=(t,e)=>Bh.test(e)?`${t}.${e}`:`${t}[${JSON.stringify(e)}]`;var ed=({document:t,includes:e})=>{let n={};for(let r of hl){let o=t[r];o!==void 0&&e(r)&&(n[r]=o)}return n},ht=Symbol("missing property selection"),Us=(t,e)=>{if(e.some(r=>r.length===0)||typeof yr(t)=="string")return t;if(Array.isArray(t)){let r=e.filter(([s])=>s==="*").map(s=>s.slice(1));if(r.length===0)return ht;let o=t.map(s=>Us(s,r));return o.some(s=>s!==ht)?o.map(s=>s===ht?null:s):ht}if(typeof t!="object"||t===null)return ht;let n={};for(let[r,o]of Object.entries(t)){let s=e.filter(([a])=>a===r).map(a=>a.slice(1));if(s.length===0)continue;let i=Us(o,s);i!==ht&&(n[r]=i)}return Object.keys(n).length===0?ht:n},td=({properties:t,fields:e})=>{let n=e.filter(([o])=>o==="properties").map(o=>o.slice(1)),r=Us(t,n);return r===ht?{}:r};var we=class extends Error{code;issues;details;constructor(e,n){super(e,n),this.name="AssetQueryExecutionError",this.code=n?.code??"INVALID_REQUEST",this.issues=n?.issues,this.details=n?.details}},Qn=class extends we{code="MULTIPLE_RESULTS";matchedCount;constructor(e){super(`Expected at most one asset, but the query matched ${e}.`),this.matchedCount=e,this.name="AssetQueryMultipleResultsError"}},on=class extends Error{constructor(){super("The requested asset index revision is stale"),this.name="AssetIndexRevisionError"}},Qs=t=>{if(t[0]!=="properties")return t[0];let e="properties";for(let n of t.slice(1))e=Hf(e,n);return e},nd=({filter:t,fieldTypes:e})=>bl(e).includes(t.operator),rd=(t,e)=>t!==void 0&&Object.hasOwn(t.fields,e)?t.fields[e]:void 0,jh=t=>{if(t===null)return"null";if(Array.isArray(t))return"array";if(typeof t=="object")return"object";if(typeof t=="boolean")return"boolean";if(typeof t=="number")return"number";if(typeof t=="string")return"string"},Uh=({operator:t,fieldTypes:e})=>{if(!(t==="contains"&&e.includes("array"))){if(t==="startsWith"||t==="endsWith"||t==="contains")return["string"];if(t==="gt"||t==="gte"||t==="lt"||t==="lte")return e.filter(n=>n==="string"||n==="number");if(t==="eq"||t==="ne"||t==="in")return e}},od=({filter:t,fieldTypes:e,path:n})=>{let r=Uh({operator:t.operator,fieldTypes:e});return r===void 0?[]:(t.operator==="in"?t.value:[t.value]).flatMap((s,i)=>r.some(a=>a===jh(s))?[]:[t.operator==="in"?[...n,"value",String(i)]:[...n,"value"]])},Gs=(t,e=["query","where"])=>"field"in t?[{filter:t,path:e}]:"all"in t?t.all.flatMap((n,r)=>Gs(n,[...e,"all",String(r)])):t.any.flatMap((n,r)=>Gs(n,[...e,"any",String(r)])),Qh=({query:t,catalog:e})=>{let n=ot.safeParse(t);if(n.success===!1)return{success:!1,issues:n.error.issues.map(u=>({severity:"error",code:u.code,path:["query",...u.path.map(String)],message:u.message}))};let r=n.data,o=new Map,s=[],i=[],a=(u,d,l)=>{s.push(l),i.push({severity:"warning",code:u,path:d,message:l})};for(let{filter:u,path:d}of Gs(r.where)){let l=Qs(u.field);if(o.set(l,u.field),u.field[0]==="properties"){let f=rd(e,l);if(e!==void 0&&f===void 0)a("UNOBSERVED_FIELD",[...d,"field"],`Asset field ${l} is not currently observed`);else if(f!==void 0&&nd({filter:u,fieldTypes:f.types})===!1)a("INCOMPATIBLE_OBSERVED_TYPES",[...d,"operator"],`Operator ${u.operator} is not compatible with the currently observed types of ${l}`);else if(f!==void 0)for(let p of od({filter:u,fieldTypes:f.types,path:d}))a("INCOMPATIBLE_OBSERVED_VALUE",p,`Filter value is not compatible with the currently observed types of ${l}`)}else{let f=os[u.field[0]];if(nd({filter:u,fieldTypes:f})===!1)i.push({severity:"error",code:"INCOMPATIBLE_OPERATOR",path:[...d,"operator"],message:`Operator ${u.operator} is incompatible with ${l}`});else for(let p of od({filter:u,fieldTypes:f,path:d}))i.push({severity:"error",code:"INCOMPATIBLE_VALUE",path:p,message:`Filter value is incompatible with ${l}`})}}for(let[u,d]of r.sort.entries()){let l=Qs(d.field);if(o.set(l,d.field),d.field[0]==="properties"){let f=rd(e,l);e!==void 0&&f===void 0?a("UNOBSERVED_FIELD",["query","sort",String(u),"field"],`Asset field ${l} is not currently observed`):f!==void 0&&f.types.some(p=>p==="object"||p==="array")&&a("STRUCTURED_SORT_ORDER",["query","sort",String(u),"field"],`Asset field ${l} currently includes structured values that use deterministic JSON sort order`)}}if(r.output.mode==="fields")for(let u of r.output.fields){let d=Qs(u);o.set(d,u)}let c=[...new Map(i.map(u=>[JSON.stringify([u.code,u.path,u.message]),u])).values()];return{success:c.some(({severity:u})=>u==="error")===!1,query:r,referencedFieldPaths:[...o.values()],warnings:[...new Set(s)],issues:c}},Vh=({query:t,catalog:e})=>{let n=Qh({query:t,catalog:e});if(n.success===!1){let r=n.issues.filter(({severity:o})=>o==="error");throw new we(r.length===1?r[0].message:`${r.length} invalid query operations found`,{issues:n.issues})}return{query:n.query,referencedFieldPaths:n.referencedFieldPaths,warnings:n.warnings,warningIssues:n.issues}},qs=(t,e,n)=>{let r=e[0]==="id"?t._id:mr(e[0])?n?.[e[0]]:t[e[0]];for(let o of e.slice(1)){if(typeof r!="object"||r===null||Object.hasOwn(r,o)===!1)return;r=r[o]}return r},Gh=t=>typeof t=="string"||Array.isArray(t)?t.length===0:typeof t=="object"&&t!==null&&Object.keys(t).length===0,qh=(t,e)=>{if(typeof t=="number"&&typeof e=="number")return t-e;if(typeof t=="string"&&typeof e=="string")return Ne(t,e)},sd=(t,e)=>{if(t.field.length!==1||t.field[0]!=="path"||typeof e!="string")return[e];let n=Rf(e);return n===e?[e]:[e,n]},Js=(t,e,n)=>{let r=qs(t,e.field,n);if(e.operator==="exists")return r!=null===e.value;if(e.operator==="isEmpty")return Gh(r)===e.value;let o=sd(e,e.value);if(e.operator==="eq")return o.some(i=>_n(r,i));if(e.operator==="ne")return o.every(i=>_n(r,i)===!1);if(e.operator==="in")return e.value.some(i=>sd(e,i).some(a=>_n(r,a)));if(e.operator==="contains")return typeof r=="string"?o.some(i=>typeof i=="string"&&r.includes(i)):Array.isArray(r)&&r.some(i=>_n(i,e.value));if(e.operator==="startsWith")return typeof r=="string"&&o.some(i=>typeof i=="string"&&r.startsWith(i));if(e.operator==="endsWith")return typeof r=="string"&&o.some(i=>typeof i=="string"&&r.endsWith(i));let s=qh(r,o[o.length-1]);return s===void 0?!1:e.operator==="gt"?s>0:e.operator==="gte"?s>=0:e.operator==="lt"?s<0:s<=0},Jh=({document:t,where:e,runtimeAsset:n,filterKeys:r,filterResults:o})=>Nt(e,s=>{let i=r.get(s)??fe(s),a=o.get(i);if(a!==void 0)return a;let c=Js(t,s,n);return o.set(i,c),c})===!0,Kh=({document:t,content:e})=>{if(e.mode!=="markdown-body-ref")return!0;let n=t.mimeType===void 0?void 0:sl(t.mimeType);return n==="markdown"||n==="mdx"?!0:t.extension==="md"||t.extension==="mdx"},Wh=(t,e)=>{let n=t==null,r=e==null;return n||r?n===r?0:n?1:-1:typeof t=="number"&&typeof e=="number"?t-e:(typeof t=="string"||typeof t=="boolean")&&(typeof e=="string"||typeof e=="boolean")?Ne(String(t),String(e)):Ne(fe(t),fe(e))},Yh=({left:t,right:e,sort:n,runtimeAssets:r})=>{for(let o of n){let s=Wh(qs(t,o.field,r?.[t._id]),qs(e,o.field,r?.[e._id]));if(s!==0)return o.direction==="asc"?s:-s}return Ne(t._id,e._id)};var Xh=(t,e)=>{if(t.properties===void 0)return;if(e.mode==="all")return Object.keys(t.properties).length===0?void 0:t.properties;if(e.mode!=="fields"||e.fields.some(r=>r[0]==="properties")===!1)return;let n=td({properties:t.properties,fields:e.fields});return Object.keys(n).length===0?void 0:n},rn=(t,e)=>t.includeMetadata&&yl(e)||t.mode==="fields"&&t.fields.some(n=>n.length===1&&n[0]===e),Hh=t=>t.mode==="all"||t.mode==="fields"&&t.fields.some(e=>e.length===1&&e[0]==="excerpt"),ey=(t,e,n)=>{if(rn(e,"url")&&n===void 0)throw new we(`Asset URL is unavailable for ${t._id}`,{details:{assetId:t._id}});let r=Xh(t,e),o=n?.width!==void 0&&n.height!==void 0;return{...n!==void 0&&rn(e,"url")?{url:n.url}:{},...o&&rn(e,"width")?{width:n.width}:{},...o&&rn(e,"height")?{height:n.height}:{},...ed({document:t,includes:s=>rn(e,s)}),...r===void 0?{}:{properties:r},...t.excerpt===void 0||Hh(e)===!1?{}:{excerpt:t.excerpt},...t.metadataError===void 0||e.includeMetadata===!1?{}:{metadataError:t.metadataError}}},Ks=t=>{let e=Ce(fe(t));if(e>k.resultBytes)throw new we("Asset query result exceeds the byte limit",{code:"CONTENT_LIMIT_EXCEEDED",details:{resultBytes:e,resultByteLimit:k.resultBytes}})},uo=(t,e,n)=>{t[e]={status:"rejected",reason:n}},ty=({inputs:t,catalog:e,results:n})=>{let r=new Map,o=new Map,s=[];for(let[i,a]of t.entries()){let c;try{c=Vh({query:a,catalog:e}).query}catch(l){uo(n,i,l);continue}for(let l of ur(c.where))o.set(l,fe(l));let u=fe(c.sort),d=r.get(u);d===void 0&&(d={sort:c.sort,documents:new Set,sorted:[]},r.set(u,d)),s.push({index:i,query:c,matches:new Map,sortGroup:d})}return{filterKeys:o,preparedQueries:s,sortGroups:r}},id=({preparedQueries:t,results:e,createReason:n})=>{for(let{index:r}of t)uo(e,r,n())},Vs=t=>t.map(e=>{if(e===void 0)throw new Error("Asset query result was not settled");return e}),ny=({preparedQueries:t,documents:e,filterKeys:n,sortGroups:r,results:o,runtimeAssets:s})=>{for(let i of e){let a=s?.[i._id],c=new Map;for(let u of t){if(o[u.index]!==void 0)continue;let{query:d}=u;try{if(Kh({document:i,content:d.content})===!1||Jh({document:i,where:d.where,runtimeAsset:a,filterKeys:n,filterResults:c})===!1)continue;let l=ey(i,d.output,a);if(d.content.mode==="none"&&Object.keys(l).length===0&&d.output.mode!=="all"&&rn(d.output,"id")===!1)continue;let f={document:i,item:{id:i._id,...l}};u.matches.set(i,f),u.sortGroup.documents.add(i)}catch(l){uo(o,u.index,l)}}}for(let i of r.values())i.sorted=[...i.documents].sort((a,c)=>Yh({left:a,right:c,sort:i.sort,runtimeAssets:s}))},ry=async({preparedQueries:t,results:e,read:n,assetReferences:r,assetUrls:o})=>{await Promise.all(t.map(async s=>{if(e[s.index]!==void 0)return;let{query:i}=s;try{let a=s.sortGroup.sorted.flatMap(p=>{let y=s.matches.get(p);return y===void 0?[]:[y]}),c=i.result??"many";if(c==="one"&&a.length>1)throw new Qn(a.length);let u=c==="many"?a.slice(i.offset,i.offset+i.limit):c==="last"?a.slice(-1):a.slice(0,1),d=u.map(({document:p})=>p),l=u.map(({item:p})=>p);if(i.content.mode!=="none"){let p=i.content;if(n===void 0)throw new we("Asset content reader is unavailable");let y=await Xf({result:d,documents:d,options:p,read:n,assetReferences:r,assetUrls:r===void 0?void 0:o});l=d.map((m,h)=>{let g=y.content[m._id];if(g===void 0)throw new we("Selected asset content could not be read");return{...l[h],content:{encoding:g.encoding,text:g.text,...g.range===void 0?{}:{range:g.range}}}})}let f=c==="many"?{items:l,totalCount:a.length,hasMore:i.offset+u.length<a.length}:{item:l[0]??null,totalCount:a.length};Ks(f),e[s.index]={status:"fulfilled",value:f}}catch(a){uo(e,s.index,a)}}))},ad=async({queries:t,catalog:e,documents:n,read:r,runtimeAssets:o,assetReferences:s,assetValueReferences:i})=>{let a=Array.from({length:t.length}),{filterKeys:c,preparedQueries:u,sortGroups:d}=ty({inputs:t,catalog:e,results:a});if(n.length>k.candidateDocuments)return id({preparedQueries:u,results:a,createReason:()=>new we("Asset query document limit was exceeded",{code:"CONTENT_LIMIT_EXCEEDED",details:{documentCount:n.length,documentLimit:k.candidateDocuments}})}),Vs(a);let l;try{l=n.map(p=>pt({value:p,references:i?.[p._id],runtimeAssets:o??{}}))}catch(p){return id({preparedQueries:u,results:a,createReason:()=>p}),Vs(a)}ny({preparedQueries:u,documents:l,filterKeys:c,sortGroups:d,results:a,runtimeAssets:o});let f=kf(o);return await ry({preparedQueries:u,results:a,read:r,assetReferences:s,assetUrls:f}),Vs(a)};var oy=async t=>await tl(fe(ot.parse(t)));var sy=({item:t,field:e,value:n})=>{let r=t;for(let[o,s]of e.entries()){if(o===e.length-1){Object.defineProperty(r,s,{value:n,enumerable:!0,configurable:!0,writable:!0});return}let i=Object.hasOwn(r,s)?r[s]:void 0;if(typeof i=="object"&&i!==null){r=i;continue}let a={};Object.defineProperty(r,s,{value:a,enumerable:!0,configurable:!0,writable:!0}),r=a}},iy=t=>ss.parse({items:t.rows.map(e=>{let n={};for(let[r,o]of t.fields.entries())sy({item:n,field:o,value:e[r]});return n}),totalCount:t.totalCount,hasMore:t.hasMore}),cd=async({queries:t,query:e,assetValueReferences:n,runtimeAssets:r={}})=>{if(t===void 0)return;let o=t[await oy(ot.parse(e))];if(o===void 0)return;let s=iy(o),i={...s,items:s.items.map(a=>pt({value:a,references:n?.[a.id],runtimeAssets:r}))};return Ks(i),i};var ay=(t,e)=>e===void 0?zt(t):{async*[Symbol.asyncIterator](){let n=0,r=0;for await(let o of zt(t)){if(r===e.length)return;if(n+o.byteLength<=e.offset){n+=o.byteLength;continue}let s=Math.max(0,e.offset-n),i=Math.min(o.byteLength-s,e.length-r);i>0&&(yield o.subarray(s,s+i),r+=i),n+=o.byteLength}}},cy=({graph:t,load:e,getCached:n,readFallback:r,signal:o})=>{let s=new Map(t.nodes.map(i=>[i.contentRef,i]));return async(i,a)=>{let c=s.get(i);if(c===void 0){if(r!==void 0)return await r(i,a);throw new Error(`Document content reference ${i} is unavailable`)}let u=Yt({node:c,source:n(c)??await e(c,{signal:o})});return{data:ay(u.source,a),...a===void 0?{}:{contentLength:a.length}}}},uy=({artifact:t,revision:e,catalog:n,documentGraph:r,inlineDocuments:o,readContent:s})=>{let i=new Map(t.documents.map(w=>[w._id,w])),a=w=>{if(w.indexRevision!==void 0&&w.indexRevision!==e)throw new on},c=w=>async(A,D)=>{let E=t.contents?.[A];if(E===void 0){let G=w??s;if(G===void 0)throw new Error("Content is not embedded in this database");return await G(A,D)}let C=$t(E),P=D===void 0?C:C.slice(D.offset,D.offset+D.length);return{data:async function*(){yield P}(),contentLength:P.byteLength}},u=w=>{if(w.status==="rejected")throw w.reason;return w.value},d=async({requests:w,queryContentReader:A,runtimeAssets:D,documents:E=t.documents})=>await ad({queries:w.map(({query:C})=>C),catalog:n,documents:E,read:c(A),runtimeAssets:D,assetReferences:t.assetReferences,assetValueReferences:t.assetValueReferences}),l=async({request:w,...A})=>u((await d({...A,requests:[w]}))[0]),f=async({requests:w,queryContentReader:A,runtimeAssets:D})=>{let E=Array.from({length:w.length}),C=[];for(let[P,G]of w.entries()){try{a(G);let L=await cd({queries:t.queries,query:G.query,assetValueReferences:t.assetValueReferences,runtimeAssets:D});if(L!==void 0){E[P]={status:"fulfilled",value:L};continue}}catch(L){E[P]={status:"rejected",reason:L};continue}C.push(P)}if(C.length>0){let P=await d({requests:C.map(G=>w[G]),queryContentReader:A,runtimeAssets:D});for(let[G,L]of C.entries())E[L]=P[G]}return E.map(P=>{if(P===void 0)throw new Error("Content database query was not settled");return P})},p=async(w,A,D)=>u((await f({requests:[w],queryContentReader:A,runtimeAssets:D}))[0]),y=async(...w)=>await p(...w),m=w=>async(A,D)=>{let E=o?.get(A.id);return E!==void 0?{format:"json",revision:A.revision,source:JSON.stringify(E.properties)}:await w(A,D)},h=({graph:w,query:A,runtimeAssets:D})=>qf({graph:w,query:A}).filter(E=>{let C=i.get(E),P=C===void 0?void 0:pt({value:C,references:t.assetValueReferences?.[E],runtimeAssets:D??{}});return P===void 0?!1:Nt(A.where,G=>{if(!Gf({graph:w,sourceId:E,field:G.field}))return Js(P,G,D?.[E])})!==!1}),g=({rootIds:w,roots:A})=>{let D=new Map(w.flatMap((E,C)=>{let P=oo(A[C]);return P===void 0?[]:[[E,P]]}));return t.documents.map(E=>{let C=D.get(E._id);return C===void 0?E:rs.parse({...E,properties:C})})},x=async({request:w,graph:A,resolutionSession:D,contentReader:E,runtimeAssets:C,onEvent:P})=>{a(w);let G=ot.parse(w.query),L=h({graph:A,query:G,runtimeAssets:C});if(L.length===0)return await p(w,E,C);let yt=Jf({graph:A,query:G,rootIds:L});ae(P,{type:"roots-selected",rootCount:L.length});let lo=await D.resolve({graph:yt,rootIds:L,onEvent:P,allowUnresolvedReferences:!0,transformDocument:({node:hd,document:yd})=>Fs({document:yd,references:t.assetValueReferences?.[hd.id],runtimeAssets:C})}),fo=g({rootIds:L,roots:lo.roots});return await l({request:w,queryContentReader:E,runtimeAssets:C,documents:fo})},S=async({requests:w,load:A,resolutionSession:D,readContent:E,runtimeAssets:C,signal:P,onEvent:G})=>{if(r===void 0)return await f({requests:w,queryContentReader:E,runtimeAssets:C});let L=m(A),yt=D??Bf({load:L,concurrency:k.concurrentContentReads,signal:P}),lo=cy({graph:r,load:L,getCached:yt.getCached,readFallback:E??s,signal:P});return await Promise.allSettled(w.map(fo=>x({request:fo,graph:r,resolutionSession:yt,contentReader:lo,runtimeAssets:C,onEvent:G})))};return{query:y,queryManyWithDocumentGraph:S,queryWithDocumentGraph:async({request:w,...A})=>u((await S({...A,requests:[w]}))[0])}};var Ws=({artifact:t,readContent:e})=>{let n=Kf({artifact:t});return uy({artifact:t,revision:t.revision,documentGraph:n?.graph,inlineDocuments:n?.inlineDocuments,readContent:e})};var sn=class extends Error{constructor(e,n){super(e,n),this.name="AssetQueryRequestError"}},Vn=class extends Error{},ly=async(t,e)=>{if(Number.isSafeInteger(e)===!1||e<0)throw new TypeError("Request byte limit must be a non-negative integer");let n=Number(t.headers.get("content-length"));if(Number.isFinite(n)&&n>e)throw new Vn("Request exceeds the byte limit");let r=t.body?.getReader(),o=[],s=0;if(r!==void 0)for(;;){let{done:c,value:u}=await r.read();if(c)break;if(s+=u.byteLength,s>e){try{await r.cancel()}catch{}throw new Vn("Request exceeds the byte limit")}o.push(u)}let i=new Uint8Array(s),a=0;for(let c of o)i.set(c,a),a+=c.byteLength;return i},ud=async t=>{let e;try{e=await ly(t,k.requestBytes)}catch(n){throw n instanceof Vn?new sn("Asset query request exceeds the byte limit",{cause:n}):n}try{return wl.parse(JSON.parse(le(e)))}catch(n){throw new sn("Asset query request is invalid",{cause:n})}};var ld=t=>{if(!(t instanceof sn))return;let e=t.message,n=new Set,r=t.cause;for(;r instanceof Error&&n.has(r)===!1;){if(r instanceof Eu)return{code:"INVALID_REQUEST",message:t.message,retryable:!1,status:400,details:{issues:r.issues.map(o=>({code:o.code,path:o.path.map(String),message:o.message}))}};e=r.message,n.add(r),r=r.cause}return{code:"INVALID_REQUEST",message:e,retryable:!1,status:400}},fd=t=>{if(t instanceof on)return{code:"STALE_INDEX",message:t.message,retryable:!1,status:409};if(t instanceof Qn)return{code:t.code,message:t.message,retryable:!1,details:{matchedCount:t.matchedCount},status:409};if(t instanceof we){let r={...t.details,...t.issues===void 0?{}:{issues:t.issues.map(o=>({...o,path:[...o.path]}))}};return{code:t.code,message:t.message,retryable:!1,...Object.keys(r).length===0?{}:{details:r},status:400}}if(t instanceof X)return{code:t.code,message:t.message,retryable:!1,details:t.details,status:400};let e=new Set,n=t;for(;n!==void 0&&e.has(n)===!1;){if(n instanceof At){let r={};for(let[o,s]of Object.entries({assetId:n.documentId,documentCount:n.documentCount,documentLimit:n.documentLimit,contentByteLimit:n.contentByteLimit,totalBytes:n.totalBytes,totalByteLimit:n.totalByteLimit}))s!==void 0&&(r[o]=s);return{code:"CONTENT_LIMIT_EXCEEDED",message:n.message,retryable:!1,details:r,status:400}}if(n instanceof Un)return{code:"CONTENT_LIMIT_EXCEEDED",message:n.message,retryable:!1,details:{assetId:n.documentId,contentByteLimit:n.contentByteLimit},status:400};e.add(n),n=n instanceof Error?n.cause:void 0}};var fy="/$resources/assets",dd=(t,e=200)=>new Response(JSON.stringify(t),{status:e,headers:{"content-type":"application/json; charset=utf-8"}}),an=({code:t,message:e,status:n,retryable:r=!1,details:o})=>dd(El({code:t,message:e,retryable:r,details:o}),n),dy=(t,e,n)=>typeof t=="string"||t instanceof URL?new Request(new URL(t,e),n):new Request(t,n),py=async({deploymentId:t,artifact:e,request:n})=>{let r=await n.clone().text(),o=n.headers.get("cache-control"),s=await es(JSON.stringify([t,e.revision,r,o])),i=new URL(n.url);return i.searchParams.set("ws-asset-resource",s),new Request(i,{method:"GET"})},fR=({deploymentId:t,artifact:e,runtimeAssets:n,cache:r,baseUrl:o,fetchDocument:s=globalThis.fetch,onDocumentGraphEvent:i})=>{pd({artifact:e,runtimeAssets:n});let a=js();return md({deploymentId:t,artifact:e,runtimeAssets:n,cache:r,baseUrl:o,database:Ws({artifact:e}),fetchDocument:s,documentCache:a,onDocumentGraphEvent:i})},my=({baseUrl:t,runtimeAssets:e,fetchDocument:n,cache:r,onEvent:o})=>Ff({cache:r,onEvent:o,load:Nf({fetch:n,getRequest:s=>{let i=e[s.id];if(i===void 0)throw new Error(`Published document URL is unavailable for ${s.id}`);return new URL(i.url,t)},getMetadata:({node:s})=>({format:s.format,revision:s.revision}),onEvent:o})}),pd=({artifact:t,runtimeAssets:e})=>{let n=[t.assetReferences,t.assetValueReferences].flatMap(s=>Object.values(s??{}).flat()).map(({assetId:s})=>s).find(s=>e[s]===void 0);if(n!==void 0)throw new Error(`Published referenced asset URL is unavailable for ${n}`);let r=t.documentGraph?.nodes.find(({id:s})=>e[s]===void 0)?.id;if(r!==void 0)throw new Error(`Published document URL is unavailable for ${r}`);let o=t.documentGraph?.nodes.find(({id:s,contentRef:i})=>e[s]?.contentRef!==i)?.id;if(o!==void 0)throw new Error(`Published document identity does not match graph node ${o}`)},md=({deploymentId:t,artifact:e,runtimeAssets:n,cache:r,baseUrl:o,database:s,fetchDocument:i,documentCache:a,onDocumentGraphEvent:c})=>{let u=new URL(o).origin,d=my({baseUrl:o,runtimeAssets:n,fetchDocument:i,cache:a,onEvent:c});return async(l,f)=>{let p=dy(l,o,f),y=new URL(p.url);if(y.origin!==u||y.pathname!==fy||p.method.toUpperCase()!=="POST")return;let m;try{m=await ud(p.clone())}catch(g){let x=ld(g);return an(x!==void 0?x:{code:"INVALID_REQUEST",message:"Asset resource request is invalid",status:400})}let h=r===void 0||p.headers.has("cache-control")===!1?void 0:await py({deploymentId:t,artifact:e,request:p});if(h!==void 0&&r!==void 0){let g=await r.match(h).catch(()=>{});if(g!==void 0)return new Response(g.body,g)}try{if(p.signal.aborted)return an({code:"REQUEST_CANCELLED",message:"Published asset query was cancelled",status:499});let g=dd(await s.queryWithDocumentGraph({request:m,load:d,runtimeAssets:n,signal:p.signal,onEvent:c}));return h!==void 0&&r!==void 0&&p.signal.aborted===!1&&(g.headers.set("cache-control",p.headers.get("cache-control")),await r.put(h,g.clone()).catch(()=>{})),g}catch(g){if(p.signal.aborted)return an({code:"REQUEST_CANCELLED",message:"Published asset query was cancelled",status:499});let x=fd(g);return an(x!==void 0?x:{code:"INTERNAL_ERROR",message:"Published asset query failed",status:500,retryable:!0})}}},dR=({deploymentId:t,artifact:e,runtimeAssets:n,onDocumentGraphEvent:r=void 0})=>{let o=globalThis.caches,s,i=()=>(s??=o.open(`webstudio-assets-${t}`),s),a=o===void 0?void 0:{match:async d=>(await i()).match(d),put:async(d,l)=>(await i()).put(d,l)};pd({artifact:e,runtimeAssets:n});let c=Ws({artifact:e}),u=js();return async({request:d,fallback:l})=>{let f=new URL(d.url).origin,p=md({deploymentId:t,artifact:e,runtimeAssets:n,cache:a,baseUrl:f,database:c,fetchDocument:l,documentCache:u,onDocumentGraphEvent:r});return async(y,m)=>await p(y,m)??l(y,m)}};export{dR as createGeneratedAssetResourceRuntime,fR as createPublishedAssetResourceFetch};
194
+ `,n)+1}return{type:t,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(t){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;let n=Zo(t),r=An(n);return r.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let n=Zo(t),r=An(n);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(t,n){return this.type!=="comment"||this.indent<=n?!1:t.every(r=>r.type==="newline"||r.type==="space")}*documentEnd(t){this.type!=="doc-mode"&&(t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(t){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;case"space":case"comment":default:t.end?t.end.push(this.sourceToken):t.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};function gy(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Wt||null,prettyErrors:t}}function qi(e,t={}){let{lineCounter:n,prettyErrors:r}=gy(t),o=new yr(n?.addNewLine),s=new hr(t),i=null;for(let a of s.compose(o.parse(e),!0,e.length))if(!i)i=a;else if(i.options.logLevel!=="silent"){i.errors.push(new Ge(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return r&&n&&(i.errors.forEach(Di(e,n)),i.warnings.forEach(Di(e,n))),i}var We=class extends Error{code;constructor(t){super(`Structured data failed validation: ${t}`),this.name="StructuredDataError",this.code=t}},Bd=e=>Ye(JSON.stringify(e)),Md=e=>{if(typeof e!="object"||e===null||Array.isArray(e))return!1;let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null},qd=(e,t)=>{if(Md(e)===!1)throw new We("INVALID");let n=0,r=(s,i)=>{if(i>t.depth)throw new We("DEPTH_EXCEEDED");if(typeof s=="string"){if(Ye(s)>t.stringBytes)throw new We("STRING_BYTES_EXCEEDED");return s}if(s===null||typeof s=="boolean"||typeof s=="number"&&Number.isFinite(s)&&(Number.isInteger(s)===!1||Number.isSafeInteger(s)))return s;if(Array.isArray(s))return s.map(a=>{if(n+=1,n>t.fields)throw new We("FIELDS_EXCEEDED");return r(a,i+1)});if(Md(s)){let a=Object.create(null);for(let[c,u]of Object.entries(s)){if(n+=1,n>t.fields)throw new We("FIELDS_EXCEEDED");a[c]=r(u,i+1)}return a}throw new We("INVALID")},o=r(e,1);if(Bd(o)>t.serializedBytes)throw new We("SERIALIZED_BYTES_EXCEEDED");return o};var ae=class extends Error{code;line;column;constructor(t,n,r,o){super(n,{cause:o}),this.name="MarkdownMetadataError",this.code=t,this.line=r?.line,this.column=r?.column}};var kn=new Uint8Array([239,187,191]),Zd=kn.byteLength+10,wy=(e,t,n=0)=>e.byteLength-n<t.byteLength?!1:t.every((r,o)=>e[n+o]===r),br=(e,t)=>{let n=0;if(wy(e,kn))n=kn.byteLength;else if(e.byteLength<kn.byteLength&&kn.slice(0,e.byteLength).every((s,i)=>s===e[i]))return t?null:void 0;if(e.byteLength<n+4)return t?null:void 0;if(e[n]!==45||e[n+1]!==45||e[n+2]!==45)return null;let r=n+3;if(e[r]===10)r+=1;else if(e[r]===13){if(e.byteLength===r+1)return t?null:void 0;if(e[r+1]!==10)return null;r+=2}else return null;let o=r;for(let s=r;s<=e.byteLength;s+=1){let i=s===e.byteLength;if(i===!1&&e[s]!==10)continue;if(i&&t===!1)return;let a=s;if(a>o&&e[a-1]===13&&(a-=1),a-o===3&&(e[o]===45&&e[o+1]===45&&e[o+2]===45||e[o]===46&&e[o+1]===46&&e[o+2]===46))return{yamlStart:r,yamlEnd:o,blockEnd:i?s:s+1};o=s+1}};var xy={bytes:N.frontmatterBytes,depth:N.frontmatterDepth,fields:N.frontmatterFields,stringBytes:N.frontmatterStringBytes,serializedBytes:N.indexedPropertiesBytes},Ud=e=>{try{return ve(e)}catch{throw new ae("FRONTMATTER_DECODING_FAILED","Markdown frontmatter is not valid UTF-8")}},_y=e=>e.code==="DEPTH_EXCEEDED"?new ae("FRONTMATTER_DEPTH_EXCEEDED","Markdown frontmatter exceeds the nesting limit"):e.code==="FIELDS_EXCEEDED"?new ae("FRONTMATTER_FIELDS_EXCEEDED","Markdown frontmatter exceeds the field limit"):e.code==="STRING_BYTES_EXCEEDED"?new ae("FRONTMATTER_STRING_BYTES_EXCEEDED","Markdown frontmatter contains a string that exceeds the byte limit"):e.code==="SERIALIZED_BYTES_EXCEEDED"?new ae("FRONTMATTER_BYTES_EXCEEDED","Markdown frontmatter properties exceed the indexed byte limit"):new ae("FRONTMATTER_INVALID","Markdown frontmatter must contain a JSON-compatible object"),jd=(e,t)=>{let n=new Wt,r=qi(e,{schema:"core",uniqueKeys:!0,lineCounter:n});if(r.errors.length>0){let s=r.errors[0],i=n.linePos(s.pos[0]);throw new ae("FRONTMATTER_INVALID",`Markdown frontmatter contains invalid YAML: ${s.message}`,{line:i.line+1,column:i.col},s)}let o;try{o=r.toJS({maxAliasCount:0})}catch{throw new ae("FRONTMATTER_INVALID","Markdown frontmatter contains unsupported YAML aliases")}if(o===null)return{};try{return qd(o,t)}catch(s){throw s instanceof We?_y(s):s}};var Vd=async(e,t={})=>{let n={...xy,...t},r=n.bytes+Zd,o=new Uint8Array(r),s=0;for await(let c of Wn(e)){let u=0;for(;u<c.byteLength;){let f=r-s;if(f<=0)break;let l=Math.max(0,6-s),p=Math.min(c.byteLength-u,l);if(l===0){let h=c.subarray(u,Math.min(c.byteLength,u+f)),y=h.indexOf(10);p=y===-1?h.byteLength:y+1}o.set(c.subarray(u,u+p),s),s+=p,u+=p;let d=o.subarray(0,s),w=br(d,!1);if(w===null)return{properties:{},frontmatterBytes:0,consumedBytes:d.length};if(w!==void 0){let h=w.yamlEnd-w.yamlStart;if(h>n.bytes)throw new ae("FRONTMATTER_BYTES_EXCEEDED","Markdown frontmatter exceeds the byte limit");let y=Ud(d.subarray(w.yamlStart,w.yamlEnd));return{properties:jd(y,n),frontmatterBytes:h,consumedBytes:w.blockEnd}}}if(s>=r)break}let i=o.subarray(0,s),a=br(i,!0);if(a===null)return{properties:{},frontmatterBytes:0,consumedBytes:i.length};if(a!==void 0){let c=a.yamlEnd-a.yamlStart;if(c<=n.bytes){let u=Ud(i.subarray(a.yamlStart,a.yamlEnd));return{properties:jd(u,n),frontmatterBytes:c,consumedBytes:a.blockEnd}}}throw new ae("FRONTMATTER_BYTES_EXCEEDED","Markdown frontmatter is not closed within the byte limit")};var jo=async(e,t=N.hydratedFileBytes)=>{if(Number.isInteger(t)===!1||t<=0||t>N.hydratedFileBytes)throw new ae("MARKDOWN_BODY_BYTES_EXCEEDED","Markdown body byte limit is outside the supported range");let n;try{n=await Xe(e,t)}catch(a){throw a instanceof we?new ae("MARKDOWN_BODY_BYTES_EXCEEDED","Markdown content exceeds the byte limit"):a}let r;try{r=ve(n)}catch{throw new ae("MARKDOWN_BODY_DECODING_FAILED","Markdown content is not valid UTF-8")}let s=br(n,!0)?.blockEnd??0,i;try{i=s===0?ln(r):ve(n.subarray(s))}catch{throw new ae("MARKDOWN_BODY_DECODING_FAILED","Markdown content is not valid UTF-8")}return{body:i,bodyBytes:Ye(i),sourceBytes:n.byteLength}};var $t=class extends Error{code;referenceId;constructor({code:t,message:n,referenceId:r,cause:o}){super(n,{cause:o}),this.name="MarkdownDocumentError",this.code=t,this.referenceId=r}},Sy=L({source:D(),body:D(),frontmatter:Ne(D(),At())}),Qo=e=>{let t;try{t=Sy.parse(e)}catch(n){throw new $t({code:"INVALID_DOCUMENT",message:"Markdown document is invalid",cause:n})}return Object.freeze({source:t.source,body:t.body,frontmatter:vt(t.frontmatter)})},Vo="#frontmatter",Ey=e=>`${Vo}${e.slice(1)}`,Ay=e=>{if(e!==Vo&&e.startsWith(`${Vo}/`)===!1)throw new $t({code:"UNUSED_REFERENCE",message:`Resolved Markdown reference ${e} is outside frontmatter`,referenceId:e});return`#${e.slice(Vo.length)}`},ky=e=>{let t=e.referenceId===void 0?void 0:Ey(e.referenceId),n="INVALID_DOCUMENT";throw(e.code==="INVALID_REFERENCE_MARKER"||e.code==="INVALID_REFERENCE"||e.code==="REFERENCE_NOT_FOUND"||e.code==="INVALID_RESOLVED_VALUE"||e.code==="UNUSED_REFERENCE")&&(n=e.code),new $t({code:n,message:e.message,referenceId:t,cause:e})},Qd=async({source:e,maximumBytes:t=N.hydratedFileBytes})=>{let n;try{n=await Xe(e,t)}catch(i){throw i instanceof we?new $t({code:"CONTENT_LIMIT_EXCEEDED",message:"Markdown document exceeds the byte limit",cause:i}):i}let r;try{r=ln(ve(n))}catch(i){throw new $t({code:"CONTENT_DECODING_FAILED",message:"Markdown document is not valid UTF-8",cause:i})}let[o,s]=await Promise.all([jo(n,t),Vd(n).catch(i=>{if(i instanceof ae)return{properties:{},frontmatterBytes:0,consumedBytes:0};throw i})]);return Qo({source:r,body:o.body,frontmatter:s.properties})};var Gd=({document:e,references:t,allowUnresolvedReferences:n=!1})=>{let r=Qo(e),o=new Map;for(let[i,a]of t)o.set(Ay(i),a);let s;try{s=ao({document:r.frontmatter,references:o,allowUnresolvedReferences:n})}catch(i){throw i instanceof De&&ky(i),i}return Qo({...r,frontmatter:s})},Jd=({document:e,representation:t})=>{let n=Qo(e);if(t.type==="document")return n.source;if(t.type==="markdown-body")return n.body;if(t.type==="markdown-frontmatter")return n.frontmatter;throw new $t({code:"UNSUPPORTED_REPRESENTATION",message:`Markdown documents do not support ${t.type}`})};var Go=e=>{let t=encodeURIComponent(e);return t==="."?"%2E":t===".."?"%2E%2E":t};var Wd=e=>e.split("/").map(t=>{try{return Go(decodeURIComponent(t))}catch{return Go(t)}}).join("/");var Jo=e=>{let t=new Set,n=new Map;for(let{id:r,path:o}of e){if(n.has(o)){t.add(o),n.delete(o);continue}t.has(o)===!1&&n.set(o,r)}return n},Kd=({sourcePath:e,url:t,allowRootRelative:n=!1})=>{if(t.length===0||t.startsWith("#")||t.startsWith("?")||n===!1&&t.startsWith("/"))return;let r="https://content.webstudio.invalid",o="__webstudio_asset_source_";for(;e.includes(o)||t.includes(o);)o=`_${o}`;let s=e.split("/"),i=new Map(s.map((f,l)=>[`${o}${l}__`,f])),a=Array.from(i.keys()).join("/"),c;try{c=new URL(t,new URL(a,`${r}/`))}catch{return}if(c.origin!==r)return;let u=[];for(let f of c.pathname.slice(1).split("/")){let l;try{l=decodeURIComponent(f)}catch{return}if(l==="")continue;let p=i.get(l);if(p!==void 0){u.push(p);continue}if(l.includes("/"))return;u.push(Go(l))}return u.join("/")},vy=e=>{let n=Kd({sourcePath:"document",url:e,allowRootRelative:!0})?.split("/");if(!(n?.length!==2||n[0]!=="assets"))return n[1]},Hd=(e,t)=>{let n=new Set(e.values()),r=Jo(Array.from(e,([o,s])=>({id:s,path:o.slice(o.lastIndexOf("/")+1)})));return o=>{let s=Kd({sourcePath:t,url:o});return(s===void 0?void 0:e.get(s))??r.get(vy(o)??"")??(n.has(o)?o:void 0)}};var Ry=e=>{let t;try{t=new URL(e,"https://content.webstudio.invalid/")}catch{return}let n=`${t.search}${t.hash}`;return n===""?void 0:n},Yd=({sourcePath:e,assetIdsByPath:t})=>{let n=Hd(t,e);return r=>{let o=n(r);if(o===void 0)return;let s=Ry(r);return{assetId:o,...s===void 0?{}:{suffix:s}}}};var Xd=e=>Object.fromEntries(Object.entries(e??{}).map(([t,n])=>[t,n.url]));var Wo=(e,t)=>{if(t===void 0||t.length===0)return e;let n=new URL("https://content.webstudio.invalid/__assets__/"),r=new URL(e,n),o=new URL(t,n);for(let[a,c]of o.searchParams)r.searchParams.append(a,c);if(o.hash!==""&&(r.hash=o.hash),e.startsWith("//"))return`//${r.host}${r.pathname}${r.search}${r.hash}`;if(e.startsWith("/"))return`${r.pathname}${r.search}${r.hash}`;let s=!1;try{new URL(e),s=!0}catch{}return s?r.href:`${r.pathname.startsWith(n.pathname)?r.pathname.slice(n.pathname.length):r.pathname}${r.search}${r.hash}`},Zi=({value:e,path:t,replacement:n})=>{let[r,...o]=t;if(r===void 0)return n;if(typeof e!="object"||e===null||Object.hasOwn(e,r)===!1)return e;if(Array.isArray(e)){if(typeof r!="number")return e;let s=[...e];return s[r]=Zi({value:e[r],path:o,replacement:n}),s}return typeof r!="string"?e:{...e,[r]:Zi({value:e[r],path:o,replacement:n})}},Dy=({reference:e,runtimeAsset:t})=>{let{url:n,contentRef:r,...o}=t;return{...o,id:e.assetId,src:Wo(n,e.suffix)}},Lt=({value:e,references:t,runtimeAssets:n={},assetUrls:r})=>{let o=e;for(let s of t??[]){let i=r?.[s.assetId],a=n[s.assetId]??(i===void 0?void 0:{url:i});a!==void 0&&(o=Zi({value:o,path:s.path,replacement:s.structured===!0?Dy({reference:s,runtimeAsset:a}):Wo(a.url,s.suffix)}))}return o};var Ho=e=>{let t=e.format==="json"?e.value:e.value.frontmatter;return pn(t)?t:void 0},Ui=({document:e,references:t,runtimeAssets:n})=>{let r=Ho(e);if(r===void 0||t===void 0)return e;let o=Lt({value:{properties:r},references:t,runtimeAssets:n}).properties;return e.format==="json"?Object.freeze({...e,value:o}):Object.freeze({...e,value:Object.freeze({...e.value,frontmatter:o})})},Ko=e=>Object.freeze(e),ep=async({format:e,source:t,maximumBytes:n=N.hydratedFileBytes})=>Ko(e==="json"?{format:e,value:await Jf({source:t,maximumBytes:n})}:{format:e,value:await Qd({source:t,maximumBytes:n})});var tp=({document:e,references:t,allowUnresolvedReferences:n})=>e.format==="json"?Ko({format:e.format,value:ao({document:e.value,references:t,allowUnresolvedReferences:n})}):Ko({format:e.format,value:Gd({document:e.value,references:t,allowUnresolvedReferences:n})}),np=({document:e,representation:t})=>e.format==="json"?Wf({document:e.value,representation:t}):Jd({document:e.value,representation:t});var Yo=class extends Error{code;documentId;expectedRevision;actualRevision;expectedFormat;actualFormat;constructor({code:t,documentId:n,expectedRevision:r,actualRevision:o,expectedFormat:s,actualFormat:i}){super(`Document ${n} source ${t==="REVISION_MISMATCH"?"revision":"format"} does not match its graph`),this.name="DocumentSourceError",this.code=t,this.documentId=n,this.expectedRevision=r,this.actualRevision=o,this.expectedFormat=s,this.actualFormat=i}},vn=({node:e,source:t})=>{if(t.revision!==e.revision)throw new Yo({code:"REVISION_MISMATCH",documentId:e.id,expectedRevision:e.revision,actualRevision:t.revision});if(e.format!==void 0&&t.format!==e.format)throw new Yo({code:"FORMAT_MISMATCH",documentId:e.id,expectedFormat:e.format,actualFormat:t.format});return t};var Rn=e=>{if(typeof e=="object"&&e!==null){let t=Reflect.get(e,"code");if(typeof t=="string"&&t.length>0)return t;let n=Reflect.get(e,"name");if(typeof n=="string"&&n.length>0)return n}return"UNKNOWN"},_e=(e,t)=>{try{e?.(t)}catch{}},rp=({load:e,onEvent:t})=>async(n,r)=>{let o={documentId:n.id,revision:n.revision};_e(t,{type:"document-fetch-started",...o});try{let s=await e(n,r);return _e(t,{type:"document-fetch-completed",...o}),s}catch(s){throw _e(t,{type:"document-fetch-failed",...o,errorCode:Rn(s)}),s}};var Iy=L({format:fe(Hn),revision:D().min(1)}),Dn=class extends Error{code;documentId;status;constructor({code:t,message:n,documentId:r,status:o,cause:s}){super(n,{cause:s}),this.name="HttpDocumentLoaderError",this.code=t,this.documentId=r,this.status=o}},op=({fetch:e,getRequest:t,getMetadata:n,onEvent:r})=>rp({load:async(s,{signal:i})=>{let a;try{a=await e(t(s),{signal:i})}catch(f){throw new Dn({code:"REQUEST_FAILED",message:`Document ${s.id} request failed`,documentId:s.id,cause:f})}if(a.ok===!1)throw new Dn({code:"HTTP_STATUS",message:`Document ${s.id} request returned status ${a.status}`,documentId:s.id,status:a.status});let c;try{c=Iy.parse(n({node:s,response:a}))}catch(f){throw new Dn({code:"INVALID_METADATA",message:`Document ${s.id} response metadata is invalid`,documentId:s.id,cause:f})}let u=a.body;if(u===null)throw new Dn({code:"BODY_MISSING",message:`Document ${s.id} response body is unavailable`,documentId:s.id});return Object.freeze({...c,source:Yr(u)})},onEvent:r});var In=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,ip=new Set,ji=typeof process=="object"&&process?process:{},ap=(e,t,n,r)=>{typeof ji.emitWarning=="function"?ji.emitWarning(e,t,n,r):console.error(`[${n}] ${t}: ${e}`)},Xo=globalThis.AbortController,sp=globalThis.AbortSignal;if(typeof Xo>"u"){sp=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(r,o){this._onabort.push(o)}},Xo=class{constructor(){t()}signal=new sp;abort(r){if(!this.signal.aborted){this.signal.reason=r,this.signal.aborted=!0;for(let o of this.signal._onabort)o(r);this.signal.onabort?.(r)}}};let e=ji.env?.LRU_CACHE_IGNORE_AC_WARNING!=="1",t=()=>{e&&(e=!1,ap("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}var Cy=e=>!ip.has(e),rI=Symbol("type"),Pt=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),cp=e=>Pt(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?Cn:null:null,Cn=class extends Array{constructor(t){super(t),this.fill(0)}},Vi=class e{heap;length;static#c=!1;static create(t){let n=cp(t);if(!n)return[];e.#c=!0;let r=new e(t,n);return e.#c=!1,r}constructor(t,n){if(!e.#c)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new n(t),this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}},Tn=class e{#c;#f;#h;#g;#C;#T;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#o;#y;#r;#n;#e;#u;#d;#a;#s;#b;#i;#w;#x;#p;#_;#v;#l;static unsafeExposeInternals(t){return{starts:t.#x,ttls:t.#p,sizes:t.#w,keyMap:t.#r,keyList:t.#n,valList:t.#e,next:t.#u,prev:t.#d,get head(){return t.#a},get tail(){return t.#s},free:t.#b,isBackgroundFetch:n=>t.#t(n),backgroundFetch:(n,r,o,s)=>t.#z(n,r,o,s),moveToTail:n=>t.#I(n),indexes:n=>t.#S(n),rindexes:n=>t.#E(n),isStale:n=>t.#m(n)}}get max(){return this.#c}get maxSize(){return this.#f}get calculatedSize(){return this.#y}get size(){return this.#o}get fetchMethod(){return this.#C}get memoMethod(){return this.#T}get dispose(){return this.#h}get disposeAfter(){return this.#g}constructor(t){let{max:n=0,ttl:r,ttlResolution:o=1,ttlAutopurge:s,updateAgeOnGet:i,updateAgeOnHas:a,allowStale:c,dispose:u,disposeAfter:f,noDisposeOnSet:l,noUpdateTTL:p,maxSize:d=0,maxEntrySize:w=0,sizeCalculation:h,fetchMethod:y,memoMethod:m,noDeleteOnFetchRejection:A,noDeleteOnStaleGet:S,allowStaleOnFetchRejection:E,allowStaleOnFetchAbort:_,ignoreFetchAbort:x}=t;if(n!==0&&!Pt(n))throw new TypeError("max option must be a nonnegative integer");let R=n?cp(n):Array;if(!R)throw new Error("invalid max value: "+n);if(this.#c=n,this.#f=d,this.maxEntrySize=w||this.#f,this.sizeCalculation=h,this.sizeCalculation){if(!this.#f&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if(typeof this.sizeCalculation!="function")throw new TypeError("sizeCalculation set to non-function")}if(m!==void 0&&typeof m!="function")throw new TypeError("memoMethod must be a function if defined");if(this.#T=m,y!==void 0&&typeof y!="function")throw new TypeError("fetchMethod must be a function if specified");if(this.#C=y,this.#v=!!y,this.#r=new Map,this.#n=new Array(n).fill(void 0),this.#e=new Array(n).fill(void 0),this.#u=new R(n),this.#d=new R(n),this.#a=0,this.#s=0,this.#b=Vi.create(n),this.#o=0,this.#y=0,typeof u=="function"&&(this.#h=u),typeof f=="function"?(this.#g=f,this.#i=[]):(this.#g=void 0,this.#i=void 0),this.#_=!!this.#h,this.#l=!!this.#g,this.noDisposeOnSet=!!l,this.noUpdateTTL=!!p,this.noDeleteOnFetchRejection=!!A,this.allowStaleOnFetchRejection=!!E,this.allowStaleOnFetchAbort=!!_,this.ignoreFetchAbort=!!x,this.maxEntrySize!==0){if(this.#f!==0&&!Pt(this.#f))throw new TypeError("maxSize must be a positive integer if specified");if(!Pt(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#q()}if(this.allowStale=!!c,this.noDeleteOnStaleGet=!!S,this.updateAgeOnGet=!!i,this.updateAgeOnHas=!!a,this.ttlResolution=Pt(o)||o===0?o:1,this.ttlAutopurge=!!s,this.ttl=r||0,this.ttl){if(!Pt(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#$()}if(this.#c===0&&this.ttl===0&&this.#f===0)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#c&&!this.#f){let v="LRU_CACHE_UNBOUNDED";Cy(v)&&(ip.add(v),ap("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",v,e))}}getRemainingTTL(t){return this.#r.has(t)?1/0:0}#$(){let t=new Cn(this.#c),n=new Cn(this.#c);this.#p=t,this.#x=n,this.#L=(s,i,a=In.now())=>{if(n[s]=i!==0?a:0,t[s]=i,i!==0&&this.ttlAutopurge){let c=setTimeout(()=>{this.#m(s)&&this.#A(this.#n[s],"expire")},i+1);c.unref&&c.unref()}},this.#R=s=>{n[s]=t[s]!==0?In.now():0},this.#k=(s,i)=>{if(t[i]){let a=t[i],c=n[i];if(!a||!c)return;s.ttl=a,s.start=c,s.now=r||o();let u=s.now-c;s.remainingTTL=a-u}};let r=0,o=()=>{let s=In.now();if(this.ttlResolution>0){r=s;let i=setTimeout(()=>r=0,this.ttlResolution);i.unref&&i.unref()}return s};this.getRemainingTTL=s=>{let i=this.#r.get(s);if(i===void 0)return 0;let a=t[i],c=n[i];if(!a||!c)return 1/0;let u=(r||o())-c;return a-u},this.#m=s=>{let i=n[s],a=t[s];return!!a&&!!i&&(r||o())-i>a}}#R=()=>{};#k=()=>{};#L=()=>{};#m=()=>!1;#q(){let t=new Cn(this.#c);this.#y=0,this.#w=t,this.#D=n=>{this.#y-=t[n],t[n]=0},this.#P=(n,r,o,s)=>{if(this.#t(r))return 0;if(!Pt(o))if(s){if(typeof s!="function")throw new TypeError("sizeCalculation must be a function");if(o=s(r,n),!Pt(o))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}else throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");return o},this.#O=(n,r,o)=>{if(t[n]=r,this.#f){let s=this.#f-t[n];for(;this.#y>s;)this.#N(!0)}this.#y+=t[n],o&&(o.entrySize=r,o.totalCalculatedSize=this.#y)}}#D=t=>{};#O=(t,n,r)=>{};#P=(t,n,r,o)=>{if(r||o)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#S({allowStale:t=this.allowStale}={}){if(this.#o)for(let n=this.#s;!(!this.#F(n)||((t||!this.#m(n))&&(yield n),n===this.#a));)n=this.#d[n]}*#E({allowStale:t=this.allowStale}={}){if(this.#o)for(let n=this.#a;!(!this.#F(n)||((t||!this.#m(n))&&(yield n),n===this.#s));)n=this.#u[n]}#F(t){return t!==void 0&&this.#r.get(this.#n[t])===t}*entries(){for(let t of this.#S())this.#e[t]!==void 0&&this.#n[t]!==void 0&&!this.#t(this.#e[t])&&(yield[this.#n[t],this.#e[t]])}*rentries(){for(let t of this.#E())this.#e[t]!==void 0&&this.#n[t]!==void 0&&!this.#t(this.#e[t])&&(yield[this.#n[t],this.#e[t]])}*keys(){for(let t of this.#S()){let n=this.#n[t];n!==void 0&&!this.#t(this.#e[t])&&(yield n)}}*rkeys(){for(let t of this.#E()){let n=this.#n[t];n!==void 0&&!this.#t(this.#e[t])&&(yield n)}}*values(){for(let t of this.#S())this.#e[t]!==void 0&&!this.#t(this.#e[t])&&(yield this.#e[t])}*rvalues(){for(let t of this.#E())this.#e[t]!==void 0&&!this.#t(this.#e[t])&&(yield this.#e[t])}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(t,n={}){for(let r of this.#S()){let o=this.#e[r],s=this.#t(o)?o.__staleWhileFetching:o;if(s!==void 0&&t(s,this.#n[r],this))return this.get(this.#n[r],n)}}forEach(t,n=this){for(let r of this.#S()){let o=this.#e[r],s=this.#t(o)?o.__staleWhileFetching:o;s!==void 0&&t.call(n,s,this.#n[r],this)}}rforEach(t,n=this){for(let r of this.#E()){let o=this.#e[r],s=this.#t(o)?o.__staleWhileFetching:o;s!==void 0&&t.call(n,s,this.#n[r],this)}}purgeStale(){let t=!1;for(let n of this.#E({allowStale:!0}))this.#m(n)&&(this.#A(this.#n[n],"expire"),t=!0);return t}info(t){let n=this.#r.get(t);if(n===void 0)return;let r=this.#e[n],o=this.#t(r)?r.__staleWhileFetching:r;if(o===void 0)return;let s={value:o};if(this.#p&&this.#x){let i=this.#p[n],a=this.#x[n];if(i&&a){let c=i-(In.now()-a);s.ttl=c,s.start=Date.now()}}return this.#w&&(s.size=this.#w[n]),s}dump(){let t=[];for(let n of this.#S({allowStale:!0})){let r=this.#n[n],o=this.#e[n],s=this.#t(o)?o.__staleWhileFetching:o;if(s===void 0||r===void 0)continue;let i={value:s};if(this.#p&&this.#x){i.ttl=this.#p[n];let a=In.now()-this.#x[n];i.start=Math.floor(Date.now()-a)}this.#w&&(i.size=this.#w[n]),t.unshift([r,i])}return t}load(t){this.clear();for(let[n,r]of t){if(r.start){let o=Date.now()-r.start;r.start=In.now()-o}this.set(n,r.value,r)}}set(t,n,r={}){if(n===void 0)return this.delete(t),this;let{ttl:o=this.ttl,start:s,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:c}=r,{noUpdateTTL:u=this.noUpdateTTL}=r,f=this.#P(t,n,r.size||0,a);if(this.maxEntrySize&&f>this.maxEntrySize)return c&&(c.set="miss",c.maxEntrySizeExceeded=!0),this.#A(t,"set"),this;let l=this.#o===0?void 0:this.#r.get(t);if(l===void 0)l=this.#o===0?this.#s:this.#b.length!==0?this.#b.pop():this.#o===this.#c?this.#N(!1):this.#o,this.#n[l]=t,this.#e[l]=n,this.#r.set(t,l),this.#u[this.#s]=l,this.#d[l]=this.#s,this.#s=l,this.#o++,this.#O(l,f,c),c&&(c.set="add"),u=!1;else{this.#I(l);let p=this.#e[l];if(n!==p){if(this.#v&&this.#t(p)){p.__abortController.abort(new Error("replaced"));let{__staleWhileFetching:d}=p;d!==void 0&&!i&&(this.#_&&this.#h?.(d,t,"set"),this.#l&&this.#i?.push([d,t,"set"]))}else i||(this.#_&&this.#h?.(p,t,"set"),this.#l&&this.#i?.push([p,t,"set"]));if(this.#D(l),this.#O(l,f,c),this.#e[l]=n,c){c.set="replace";let d=p&&this.#t(p)?p.__staleWhileFetching:p;d!==void 0&&(c.oldValue=d)}}else c&&(c.set="update")}if(o!==0&&!this.#p&&this.#$(),this.#p&&(u||this.#L(l,o,s),c&&this.#k(c,l)),!i&&this.#l&&this.#i){let p=this.#i,d;for(;d=p?.shift();)this.#g?.(...d)}return this}pop(){try{for(;this.#o;){let t=this.#e[this.#a];if(this.#N(!0),this.#t(t)){if(t.__staleWhileFetching)return t.__staleWhileFetching}else if(t!==void 0)return t}}finally{if(this.#l&&this.#i){let t=this.#i,n;for(;n=t?.shift();)this.#g?.(...n)}}}#N(t){let n=this.#a,r=this.#n[n],o=this.#e[n];return this.#v&&this.#t(o)?o.__abortController.abort(new Error("evicted")):(this.#_||this.#l)&&(this.#_&&this.#h?.(o,r,"evict"),this.#l&&this.#i?.push([o,r,"evict"])),this.#D(n),t&&(this.#n[n]=void 0,this.#e[n]=void 0,this.#b.push(n)),this.#o===1?(this.#a=this.#s=0,this.#b.length=0):this.#a=this.#u[n],this.#r.delete(r),this.#o--,n}has(t,n={}){let{updateAgeOnHas:r=this.updateAgeOnHas,status:o}=n,s=this.#r.get(t);if(s!==void 0){let i=this.#e[s];if(this.#t(i)&&i.__staleWhileFetching===void 0)return!1;if(this.#m(s))o&&(o.has="stale",this.#k(o,s));else return r&&this.#R(s),o&&(o.has="hit",this.#k(o,s)),!0}else o&&(o.has="miss");return!1}peek(t,n={}){let{allowStale:r=this.allowStale}=n,o=this.#r.get(t);if(o===void 0||!r&&this.#m(o))return;let s=this.#e[o];return this.#t(s)?s.__staleWhileFetching:s}#z(t,n,r,o){let s=n===void 0?void 0:this.#e[n];if(this.#t(s))return s;let i=new Xo,{signal:a}=r;a?.addEventListener("abort",()=>i.abort(a.reason),{signal:i.signal});let c={signal:i.signal,options:r,context:o},u=(h,y=!1)=>{let{aborted:m}=i.signal,A=r.ignoreFetchAbort&&h!==void 0;if(r.status&&(m&&!y?(r.status.fetchAborted=!0,r.status.fetchError=i.signal.reason,A&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),m&&!A&&!y)return l(i.signal.reason);let S=d;return this.#e[n]===d&&(h===void 0?S.__staleWhileFetching?this.#e[n]=S.__staleWhileFetching:this.#A(t,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(t,h,c.options))),h},f=h=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=h),l(h)),l=h=>{let{aborted:y}=i.signal,m=y&&r.allowStaleOnFetchAbort,A=m||r.allowStaleOnFetchRejection,S=A||r.noDeleteOnFetchRejection,E=d;if(this.#e[n]===d&&(!S||E.__staleWhileFetching===void 0?this.#A(t,"fetch"):m||(this.#e[n]=E.__staleWhileFetching)),A)return r.status&&E.__staleWhileFetching!==void 0&&(r.status.returnedStale=!0),E.__staleWhileFetching;if(E.__returned===E)throw h},p=(h,y)=>{let m=this.#C?.(t,s,c);m&&m instanceof Promise&&m.then(A=>h(A===void 0?void 0:A),y),i.signal.addEventListener("abort",()=>{(!r.ignoreFetchAbort||r.allowStaleOnFetchAbort)&&(h(void 0),r.allowStaleOnFetchAbort&&(h=A=>u(A,!0)))})};r.status&&(r.status.fetchDispatched=!0);let d=new Promise(p).then(u,f),w=Object.assign(d,{__abortController:i,__staleWhileFetching:s,__returned:void 0});return n===void 0?(this.set(t,w,{...c.options,status:void 0}),n=this.#r.get(t)):this.#e[n]=w,w}#t(t){if(!this.#v)return!1;let n=t;return!!n&&n instanceof Promise&&n.hasOwnProperty("__staleWhileFetching")&&n.__abortController instanceof Xo}async fetch(t,n={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:c=0,sizeCalculation:u=this.sizeCalculation,noUpdateTTL:f=this.noUpdateTTL,noDeleteOnFetchRejection:l=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:p=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:w=this.allowStaleOnFetchAbort,context:h,forceRefresh:y=!1,status:m,signal:A}=n;if(!this.#v)return m&&(m.fetch="get"),this.get(t,{allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:s,status:m});let S={allowStale:r,updateAgeOnGet:o,noDeleteOnStaleGet:s,ttl:i,noDisposeOnSet:a,size:c,sizeCalculation:u,noUpdateTTL:f,noDeleteOnFetchRejection:l,allowStaleOnFetchRejection:p,allowStaleOnFetchAbort:w,ignoreFetchAbort:d,status:m,signal:A},E=this.#r.get(t);if(E===void 0){m&&(m.fetch="miss");let _=this.#z(t,E,S,h);return _.__returned=_}else{let _=this.#e[E];if(this.#t(_)){let P=r&&_.__staleWhileFetching!==void 0;return m&&(m.fetch="inflight",P&&(m.returnedStale=!0)),P?_.__staleWhileFetching:_.__returned=_}let x=this.#m(E);if(!y&&!x)return m&&(m.fetch="hit"),this.#I(E),o&&this.#R(E),m&&this.#k(m,E),_;let R=this.#z(t,E,S,h),I=R.__staleWhileFetching!==void 0&&r;return m&&(m.fetch=x?"stale":"refresh",I&&x&&(m.returnedStale=!0)),I?R.__staleWhileFetching:R.__returned=R}}async forceFetch(t,n={}){let r=await this.fetch(t,n);if(r===void 0)throw new Error("fetch() returned undefined");return r}memo(t,n={}){let r=this.#T;if(!r)throw new Error("no memoMethod provided to constructor");let{context:o,forceRefresh:s,...i}=n,a=this.get(t,i);if(!s&&a!==void 0)return a;let c=r(t,a,{options:i,context:o});return this.set(t,c,i),c}get(t,n={}){let{allowStale:r=this.allowStale,updateAgeOnGet:o=this.updateAgeOnGet,noDeleteOnStaleGet:s=this.noDeleteOnStaleGet,status:i}=n,a=this.#r.get(t);if(a!==void 0){let c=this.#e[a],u=this.#t(c);return i&&this.#k(i,a),this.#m(a)?(i&&(i.get="stale"),u?(i&&r&&c.__staleWhileFetching!==void 0&&(i.returnedStale=!0),r?c.__staleWhileFetching:void 0):(s||this.#A(t,"expire"),i&&r&&(i.returnedStale=!0),r?c:void 0)):(i&&(i.get="hit"),u?c.__staleWhileFetching:(this.#I(a),o&&this.#R(a),c))}else i&&(i.get="miss")}#M(t,n){this.#d[n]=t,this.#u[t]=n}#I(t){t!==this.#s&&(t===this.#a?this.#a=this.#u[t]:this.#M(this.#d[t],this.#u[t]),this.#M(this.#s,t),this.#s=t)}delete(t){return this.#A(t,"delete")}#A(t,n){let r=!1;if(this.#o!==0){let o=this.#r.get(t);if(o!==void 0)if(r=!0,this.#o===1)this.#B(n);else{this.#D(o);let s=this.#e[o];if(this.#t(s)?s.__abortController.abort(new Error("deleted")):(this.#_||this.#l)&&(this.#_&&this.#h?.(s,t,n),this.#l&&this.#i?.push([s,t,n])),this.#r.delete(t),this.#n[o]=void 0,this.#e[o]=void 0,o===this.#s)this.#s=this.#d[o];else if(o===this.#a)this.#a=this.#u[o];else{let i=this.#d[o];this.#u[i]=this.#u[o];let a=this.#u[o];this.#d[a]=this.#d[o]}this.#o--,this.#b.push(o)}}if(this.#l&&this.#i?.length){let o=this.#i,s;for(;s=o?.shift();)this.#g?.(...s)}return r}clear(){return this.#B("delete")}#B(t){for(let n of this.#E({allowStale:!0})){let r=this.#e[n];if(this.#t(r))r.__abortController.abort(new Error("deleted"));else{let o=this.#n[n];this.#_&&this.#h?.(r,o,t),this.#l&&this.#i?.push([r,o,t])}}if(this.#r.clear(),this.#e.fill(void 0),this.#n.fill(void 0),this.#p&&this.#x&&(this.#p.fill(0),this.#x.fill(0)),this.#w&&this.#w.fill(0),this.#a=0,this.#s=0,this.#b.length=0,this.#y=0,this.#o=0,this.#l&&this.#i){let n=this.#i,r;for(;r=n?.shift();)this.#g?.(...r)}}};var Qi=({maximumBytes:e=N.hydratedTotalBytes*4}={})=>{if(Number.isSafeInteger(e)===!1||e<=0)throw new TypeError("Document source cache byte limit must be positive");return new Tn({maxSize:e,sizeCalculation:t=>Math.max(1,t.bytes.byteLength)})},wr=class extends Error{code="CONTENT_LIMIT_EXCEEDED";documentId;contentByteLimit;constructor({message:t,documentId:n,contentByteLimit:r,cause:o}){super(t,{cause:o}),this.name="CachedDocumentLoaderError",this.documentId=n,this.contentByteLimit=r}},es=({contentRef:e,revision:t,format:n})=>Re([e,t,n??null]),Ty=e=>{if(typeof e!="object"||e===null)return!1;let t=e;return Rf(t.format)&&typeof t.revision=="string"&&t.revision.length>0&&t.bytes instanceof Uint8Array},up=e=>Object.freeze({format:e.format,revision:e.revision,source:e.bytes}),lp=({load:e,cache:t,maximumBytes:n=N.hydratedFileBytes,onEvent:r})=>{let o=new Map;return async(s,i)=>{let a=es(s),c=o.get(a)??new Map;o.set(a,c);let u=c.get(i.signal);if(u!==void 0)return await u;let f=(async()=>{let l;try{l=await t.get(a)}catch(h){_e(r,{type:"document-cache-read-failed",documentId:s.id,revision:s.revision,errorCode:Rn(h)})}if(Ty(l)&&l.revision===s.revision&&l.bytes.byteLength<=n&&(s.format===void 0||l.format===s.format))return _e(r,{type:"document-cache-hit",documentId:s.id,revision:s.revision}),up(l);_e(r,{type:"document-cache-miss",documentId:s.id,revision:s.revision});let p=vn({node:s,source:await e(s,i)}),d;try{d=await Xe(p.source,n)}catch(h){throw h instanceof we?new wr({message:`Document ${s.id} exceeds the cache byte limit`,documentId:s.id,contentByteLimit:n,cause:h}):h}let w=Object.freeze({format:p.format,revision:p.revision,bytes:d});try{await t.set(a,w),_e(r,{type:"document-cache-stored",documentId:s.id,revision:s.revision})}catch(h){_e(r,{type:"document-cache-write-failed",documentId:s.id,revision:s.revision,errorCode:Rn(h)})}return up(w)})();c.set(i.signal,f);try{return await f}finally{c.delete(i.signal),c.size===0&&o.delete(a)}}};var Ce=class extends Error{code;resourceIds;constructor({code:t,message:n,resourceIds:r=[],cause:o}){super(n,{cause:o}),this.name="ResourceResolutionError",this.code=t,this.resourceIds=Object.freeze([...r])}},xr=e=>{if(e?.aborted)throw new Ce({code:"REQUEST_CANCELLED",message:"Resource resolution was cancelled",cause:e.reason})},Oy=({resourcesById:e,rootIds:t})=>{let n=new Map,r=[],o=[],s=(i,a)=>{let c=e.get(i);if(c===void 0)throw new Ce({code:a===void 0?"ROOT_NOT_FOUND":"DEPENDENCY_NOT_FOUND",message:a===void 0?`Resource graph root ${i} does not exist`:`Resource ${a} dependency ${i} does not exist`,resourceIds:a===void 0?[i]:[a,i]});let u=n.get(i);if(u!=="visited"){if(u==="visiting"){let f=r.indexOf(i),l=[...r.slice(f),i];throw new Ce({code:"CYCLE",message:`Resource graph contains a cycle: ${l.join(" -> ")}`,resourceIds:l})}n.set(i,"visiting"),r.push(i);for(let f of c.dependencies)s(f,c.id);r.pop(),n.set(i,"visited"),o.push(c)}};for(let i of new Set(t))s(i);return o},fp=async({resources:e,rootIds:t,concurrency:n,signal:r})=>{if(Number.isSafeInteger(n)===!1||n<=0)throw new TypeError("Resource resolution concurrency must be positive");xr(r);let o=new Map;for(let l of e){if(o.has(l.id))throw new Ce({code:"DUPLICATE_RESOURCE",message:`Resource graph contains duplicate resource ${l.id}`,resourceIds:[l.id]});o.set(l.id,l)}let s=Oy({resourcesById:o,rootIds:t}),i=so({concurrency:n,signal:r}),a=new Map,c=new Map,u=l=>{let p=c.get(l);if(p!==void 0)return p;let d=o.get(l),w=(async()=>{let h=new Map,y;try{y=await Promise.all(d.dependencies.map(u))}catch(m){throw m instanceof Ce&&m.code==="RESOLUTION_FAILED"?new Ce({code:m.code,message:`Resource dependency path ${[d.id,...m.resourceIds].join(" -> ")} could not be resolved`,resourceIds:[d.id,...m.resourceIds],cause:m.cause}):m}for(let[m,A]of d.dependencies.entries())h.set(A,y[m]);xr(r);try{return await i(async()=>{xr(r);let m=await dn(d.resolve({documents:h,signal:r}),r);return xr(r),m})}catch(m){throw r?.aborted&&xr(r),m instanceof Ce?m:new Ce({code:"RESOLUTION_FAILED",message:`Resource ${d.id} could not be resolved`,resourceIds:[d.id],cause:m})}})();return c.set(l,w),w},f=await Promise.all(t.map(u));for(let l of s){let p=await c.get(l.id);a.set(l.id,p)}return Object.freeze({roots:Object.freeze(f),documents:a})};var Fe=class extends Error{code;documentId;referenceId;constructor({code:t,message:n,documentId:r,referenceId:o,cause:s}){super(n,{cause:s}),this.name="DocumentGraphResolutionError",this.code=t,this.documentId=r,this.referenceId=o}},ts=e=>{if(e?.aborted)throw new Fe({code:"REQUEST_CANCELLED",message:"Document graph resolution was cancelled",cause:e.reason})},dp=async({graph:e,rootIds:t,concurrency:n,signal:r,load:o,select:s,assemble:i})=>{ts(r);let a=to({graph:e,rootIds:t}),c=new Map(a.map(d=>[d.id,d])),u=new Map,f=new Map;for(let d of a){let w=f.get(d.contentRef);w===void 0?f.set(d.contentRef,{representative:d,nodes:[d]}):w.nodes.push(d)}await oo([...f.values()],n,async d=>{ts(r);let w=d.representative;try{let h=await dn(o(w,{signal:r}),r);for(let y of d.nodes)u.set(y.id,h)}catch(h){throw r?.aborted&&ts(r),new Fe({code:"DOCUMENT_LOAD_FAILED",message:`Document ${w.id} could not be loaded`,documentId:w.id,cause:h})}});let l=fn(e.edges),p=a.map(d=>({id:d.id,dependencies:(l.get(d.id)??[]).map(w=>w.reference.documentId),resolve:async({documents:w})=>{ts(r);let h=new Map;for(let m of l.get(d.id)??[]){let A=c.get(m.reference.documentId);if(A===void 0||w.has(m.reference.documentId)===!1)throw new Fe({code:"DOCUMENT_ASSEMBLY_FAILED",message:`Document ${d.id} dependency ${m.reference.documentId} is unavailable`,documentId:d.id,referenceId:m.referenceId});let S=w.get(m.reference.documentId),E;if(s===void 0){if(m.reference.representation.type!=="document")throw new Fe({code:"REPRESENTATION_SELECTOR_REQUIRED",message:`Document ${d.id} reference ${m.referenceId} requires a representation selector`,documentId:d.id,referenceId:m.referenceId});E=S}else try{E=await s({reference:m.reference,value:S,sourceNode:d,targetNode:A})}catch(_){throw new Fe({code:"DOCUMENT_SELECTION_FAILED",message:`Document ${d.id} reference ${m.referenceId} could not be selected`,documentId:d.id,referenceId:m.referenceId,cause:_})}h.set(m.referenceId,E)}if(u.has(d.id)===!1)throw new Fe({code:"DOCUMENT_ASSEMBLY_FAILED",message:`Document ${d.id} source is unavailable`,documentId:d.id});let y=u.get(d.id);try{return await i({node:d,source:y,references:h})}catch(m){throw m instanceof Fe?m:new Fe({code:"DOCUMENT_ASSEMBLY_FAILED",message:`Document ${d.id} could not be assembled`,documentId:d.id,cause:m})}}}));try{let d=await fp({resources:p,rootIds:t,concurrency:1,signal:r});return Object.freeze({roots:d.roots,values:d.documents})}catch(d){throw d instanceof Ce&&d.cause instanceof Fe?d.cause:d instanceof Ce&&d.code==="REQUEST_CANCELLED"?new Fe({code:"REQUEST_CANCELLED",message:"Document graph resolution was cancelled",cause:d.cause}):d}};var Kt=class extends Error{code;documentId;documentCount;documentLimit;contentByteLimit;totalBytes;totalByteLimit;constructor({code:t,message:n,documentId:r,documentCount:o,documentLimit:s,contentByteLimit:i,totalBytes:a,totalByteLimit:c,cause:u}){super(n,{cause:u}),this.name="DocumentResolutionLimitError",this.code=t,this.documentId=r,this.documentCount=o,this.documentLimit=s,this.contentByteLimit=i,this.totalBytes=a,this.totalByteLimit=c}},Ny=async({graph:e,rootIds:t,concurrency:n,maximumBytes:r,maximumTotalBytes:o=N.hydratedTotalBytes,maximumDocuments:s=N.hydratedFileCount,signal:i,onEvent:a,allowUnresolvedReferences:c=!1,transformDocument:u,load:f})=>{let l=to({graph:e,rootIds:t}).length,p={rootCount:t.length,documentCount:l};_e(a,{type:"resolution-started",...p});try{if(l>s)throw new Kt({code:"DOCUMENT_COUNT_EXCEEDED",message:"Document graph resolution exceeds the document limit",documentCount:l,documentLimit:s});let d=0,w=Promise.resolve(),h=await dp({graph:e,rootIds:t,concurrency:n,signal:i,load:async(y,m)=>{let A=w,S=()=>{};w=new Promise(_=>{S=_});let E;try{E={status:"fulfilled",value:await f(y,m)}}catch(_){E={status:"rejected",reason:_}}await A;try{if(E.status==="rejected")throw E.reason;if(E.value.byteLength>r)throw new Kt({code:"CONTENT_LIMIT_EXCEEDED",message:`Document ${y.id} exceeds the byte limit`,documentId:y.id,contentByteLimit:r,cause:new we});let _=d+E.value.byteLength;if(_>o)throw new Kt({code:"TOTAL_BYTES_EXCEEDED",message:"Document graph resolution exceeds the total byte limit",documentId:y.id,totalBytes:_,totalByteLimit:o});return d=_,await E.value.parse()}finally{S()}},select:({reference:y,value:m})=>np({document:m,representation:y.representation}),assemble:({node:y,source:m,references:A})=>{let S=tp({document:m,references:A,allowUnresolvedReferences:c});return u?.({node:y,document:S})??S}});return _e(a,{type:"resolution-completed",...p}),h}catch(d){throw _e(a,{type:"resolution-failed",...p,errorCode:Rn(d)}),d}},pp=({load:e,concurrency:t,signal:n,maximumDocumentBytes:r=N.hydratedFileBytes,maximumCacheBytes:o=N.hydratedTotalBytes*4})=>{if(Number.isSafeInteger(t)===!1||t<=0)throw new TypeError("Document resolution concurrency must be positive");if(Number.isSafeInteger(r)===!1||r<=0)throw new TypeError("Document resolution byte limit must be positive");if(Number.isSafeInteger(o)===!1||o<=0)throw new TypeError("Document resolution cache byte limit must be positive");let s=new Tn({maxSize:o,sizeCalculation:({byteLength:p})=>Math.max(1,p)}),i=new Map,a=so({concurrency:t,signal:n}),c=p=>{if(p!==void 0&&p!==n)throw new TypeError("Document resolution session signal does not match");n?.throwIfAborted()},u=async p=>(c(),await dn(p,n)),f=async(p,d)=>{c(d.signal);let w=es(p),h=s.get(w);if(h!==void 0)return h;let y=i.get(w);if(y!==void 0)return await u(y);let m=a(async()=>{c(d.signal);let A=vn({node:p,source:await e(p,{signal:n})});c(d.signal);let S=await ti(A.source,r+1);c(d.signal);let E,_=Object.freeze({format:A.format,revision:A.revision,bytes:S,byteLength:S.byteLength,parse:()=>(E??=ep({format:A.format,source:S,maximumBytes:r}),E)});return _.byteLength<=o&&s.set(w,_),_});i.set(w,m);try{return await u(m)}finally{i.delete(w)}};return Object.freeze({getCached:p=>{c();let d=s.get(es(p));if(!(d===void 0||d.byteLength>r))return Object.freeze({format:d.format,revision:d.revision,source:d.bytes.slice()})},resolve:async p=>await Ny({...p,concurrency:t,maximumBytes:r,signal:n,load:f})})};var mp=e=>{if(e.output.mode==="all")return"all";let t=[];for(let{field:n}of Kr(e.where))n[0]==="properties"&&t.push(n);for(let{field:n}of e.sort)n[0]==="properties"&&t.push(n);if(e.output.mode==="fields")for(let n of e.output.fields)n[0]==="properties"&&t.push(n);return t},hp=e=>{let t;if(e==="#frontmatter")t="";else if(e.startsWith("#frontmatter/"))t=e.slice(12);else if(e==="#")t="";else if(e.startsWith("#/"))t=e.slice(1);else return;try{return["properties",...Qf(t)]}catch{return}},gp=(e,t)=>{let n=Math.min(e.length,t.length);for(let r=0;r<n;r+=1)if(e[r]!==t[r])return!1;return!0},yp=({queryPaths:e,referenceId:t})=>{let n=hp(t);return n!==void 0&&(e==="all"||e.some(r=>gp(r,n)))},bp=({graph:e,sourceId:t,field:n})=>n[0]!=="properties"?!1:e.edges.some(r=>{if(r.sourceId!==t)return!1;let o=hp(r.referenceId);return o!==void 0&&gp(n,o)}),wp=({graph:e,query:t})=>{let n=mp(t),r=new Set;for(let o of e.edges)yp({queryPaths:n,referenceId:o.referenceId})&&r.add(o.sourceId);return[...r]},xp=({graph:e,query:t,rootIds:n})=>{let r=mp(t),o=new Set(n),s=new Map(e.nodes.map(l=>[l.id,l])),i=fn(e.edges),a=new Set(n),c=new Set,u=new Set,f=l=>{if(a.add(l),!u.has(l)){u.add(l);for(let p of i.get(l)??[])c.add(p),f(p.reference.documentId)}};for(let l of e.edges)o.has(l.sourceId)&&yp({queryPaths:r,referenceId:l.referenceId})&&(c.add(l),f(l.reference.documentId));return Yn({nodes:[...a].map(l=>{let p=s.get(l);if(p===void 0)throw new Error(`Document graph query root ${l} does not exist`);return p}),edges:[...c]})};var _p=({artifact:e})=>{if(e.documentGraph===void 0)return;let t=new Map(e.documents.map(s=>[s._id,s])),n=new Map(e.documentGraph.nodes.map(s=>[s.id,s])),r=new Map;for(let{sourceId:s}of e.documentGraph.edges){if(n.has(s))continue;let i=t.get(s);if(i?.properties===void 0)throw new Error(`Runtime document graph source ${s} is unavailable`);r.set(s,i),n.set(s,{id:s,revision:s,contentRef:s,format:"json"})}return{graph:Yn({nodes:[...n.values()],edges:e.documentGraph.edges.map(({sourceId:s,referenceId:i,documentId:a,representation:c})=>{let u=n.get(a);if(u===void 0)throw new Error(`Runtime document graph target ${a} is unavailable`);return{sourceId:s,referenceId:i,reference:{documentId:a,revision:u.revision,representation:c}}})}),inlineDocuments:r}};var Gi={AElig:"\xC6",AMP:"&",Aacute:"\xC1",Abreve:"\u0102",Acirc:"\xC2",Acy:"\u0410",Afr:"\u{1D504}",Agrave:"\xC0",Alpha:"\u0391",Amacr:"\u0100",And:"\u2A53",Aogon:"\u0104",Aopf:"\u{1D538}",ApplyFunction:"\u2061",Aring:"\xC5",Ascr:"\u{1D49C}",Assign:"\u2254",Atilde:"\xC3",Auml:"\xC4",Backslash:"\u2216",Barv:"\u2AE7",Barwed:"\u2306",Bcy:"\u0411",Because:"\u2235",Bernoullis:"\u212C",Beta:"\u0392",Bfr:"\u{1D505}",Bopf:"\u{1D539}",Breve:"\u02D8",Bscr:"\u212C",Bumpeq:"\u224E",CHcy:"\u0427",COPY:"\xA9",Cacute:"\u0106",Cap:"\u22D2",CapitalDifferentialD:"\u2145",Cayleys:"\u212D",Ccaron:"\u010C",Ccedil:"\xC7",Ccirc:"\u0108",Cconint:"\u2230",Cdot:"\u010A",Cedilla:"\xB8",CenterDot:"\xB7",Cfr:"\u212D",Chi:"\u03A7",CircleDot:"\u2299",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",Colon:"\u2237",Colone:"\u2A74",Congruent:"\u2261",Conint:"\u222F",ContourIntegral:"\u222E",Copf:"\u2102",Coproduct:"\u2210",CounterClockwiseContourIntegral:"\u2233",Cross:"\u2A2F",Cscr:"\u{1D49E}",Cup:"\u22D3",CupCap:"\u224D",DD:"\u2145",DDotrahd:"\u2911",DJcy:"\u0402",DScy:"\u0405",DZcy:"\u040F",Dagger:"\u2021",Darr:"\u21A1",Dashv:"\u2AE4",Dcaron:"\u010E",Dcy:"\u0414",Del:"\u2207",Delta:"\u0394",Dfr:"\u{1D507}",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",Diamond:"\u22C4",DifferentialD:"\u2146",Dopf:"\u{1D53B}",Dot:"\xA8",DotDot:"\u20DC",DotEqual:"\u2250",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",Downarrow:"\u21D3",Dscr:"\u{1D49F}",Dstrok:"\u0110",ENG:"\u014A",ETH:"\xD0",Eacute:"\xC9",Ecaron:"\u011A",Ecirc:"\xCA",Ecy:"\u042D",Edot:"\u0116",Efr:"\u{1D508}",Egrave:"\xC8",Element:"\u2208",Emacr:"\u0112",EmptySmallSquare:"\u25FB",EmptyVerySmallSquare:"\u25AB",Eogon:"\u0118",Eopf:"\u{1D53C}",Epsilon:"\u0395",Equal:"\u2A75",EqualTilde:"\u2242",Equilibrium:"\u21CC",Escr:"\u2130",Esim:"\u2A73",Eta:"\u0397",Euml:"\xCB",Exists:"\u2203",ExponentialE:"\u2147",Fcy:"\u0424",Ffr:"\u{1D509}",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",Fopf:"\u{1D53D}",ForAll:"\u2200",Fouriertrf:"\u2131",Fscr:"\u2131",GJcy:"\u0403",GT:">",Gamma:"\u0393",Gammad:"\u03DC",Gbreve:"\u011E",Gcedil:"\u0122",Gcirc:"\u011C",Gcy:"\u0413",Gdot:"\u0120",Gfr:"\u{1D50A}",Gg:"\u22D9",Gopf:"\u{1D53E}",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",Gt:"\u226B",HARDcy:"\u042A",Hacek:"\u02C7",Hat:"^",Hcirc:"\u0124",Hfr:"\u210C",HilbertSpace:"\u210B",Hopf:"\u210D",HorizontalLine:"\u2500",Hscr:"\u210B",Hstrok:"\u0126",HumpDownHump:"\u224E",HumpEqual:"\u224F",IEcy:"\u0415",IJlig:"\u0132",IOcy:"\u0401",Iacute:"\xCD",Icirc:"\xCE",Icy:"\u0418",Idot:"\u0130",Ifr:"\u2111",Igrave:"\xCC",Im:"\u2111",Imacr:"\u012A",ImaginaryI:"\u2148",Implies:"\u21D2",Int:"\u222C",Integral:"\u222B",Intersection:"\u22C2",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",Iogon:"\u012E",Iopf:"\u{1D540}",Iota:"\u0399",Iscr:"\u2110",Itilde:"\u0128",Iukcy:"\u0406",Iuml:"\xCF",Jcirc:"\u0134",Jcy:"\u0419",Jfr:"\u{1D50D}",Jopf:"\u{1D541}",Jscr:"\u{1D4A5}",Jsercy:"\u0408",Jukcy:"\u0404",KHcy:"\u0425",KJcy:"\u040C",Kappa:"\u039A",Kcedil:"\u0136",Kcy:"\u041A",Kfr:"\u{1D50E}",Kopf:"\u{1D542}",Kscr:"\u{1D4A6}",LJcy:"\u0409",LT:"<",Lacute:"\u0139",Lambda:"\u039B",Lang:"\u27EA",Laplacetrf:"\u2112",Larr:"\u219E",Lcaron:"\u013D",Lcedil:"\u013B",Lcy:"\u041B",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",LeftRightArrow:"\u2194",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",Leftarrow:"\u21D0",Leftrightarrow:"\u21D4",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",LessLess:"\u2AA1",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",Lfr:"\u{1D50F}",Ll:"\u22D8",Lleftarrow:"\u21DA",Lmidot:"\u013F",LongLeftArrow:"\u27F5",LongLeftRightArrow:"\u27F7",LongRightArrow:"\u27F6",Longleftarrow:"\u27F8",Longleftrightarrow:"\u27FA",Longrightarrow:"\u27F9",Lopf:"\u{1D543}",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",Lscr:"\u2112",Lsh:"\u21B0",Lstrok:"\u0141",Lt:"\u226A",Map:"\u2905",Mcy:"\u041C",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",MinusPlus:"\u2213",Mopf:"\u{1D544}",Mscr:"\u2133",Mu:"\u039C",NJcy:"\u040A",Nacute:"\u0143",Ncaron:"\u0147",Ncedil:"\u0145",Ncy:"\u041D",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
195
+ `,Nfr:"\u{1D511}",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",Not:"\u2AEC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",Nscr:"\u{1D4A9}",Ntilde:"\xD1",Nu:"\u039D",OElig:"\u0152",Oacute:"\xD3",Ocirc:"\xD4",Ocy:"\u041E",Odblac:"\u0150",Ofr:"\u{1D512}",Ograve:"\xD2",Omacr:"\u014C",Omega:"\u03A9",Omicron:"\u039F",Oopf:"\u{1D546}",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",Or:"\u2A54",Oscr:"\u{1D4AA}",Oslash:"\xD8",Otilde:"\xD5",Otimes:"\u2A37",Ouml:"\xD6",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",PartialD:"\u2202",Pcy:"\u041F",Pfr:"\u{1D513}",Phi:"\u03A6",Pi:"\u03A0",PlusMinus:"\xB1",Poincareplane:"\u210C",Popf:"\u2119",Pr:"\u2ABB",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",Prime:"\u2033",Product:"\u220F",Proportion:"\u2237",Proportional:"\u221D",Pscr:"\u{1D4AB}",Psi:"\u03A8",QUOT:'"',Qfr:"\u{1D514}",Qopf:"\u211A",Qscr:"\u{1D4AC}",RBarr:"\u2910",REG:"\xAE",Racute:"\u0154",Rang:"\u27EB",Rarr:"\u21A0",Rarrtl:"\u2916",Rcaron:"\u0158",Rcedil:"\u0156",Rcy:"\u0420",Re:"\u211C",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",Rfr:"\u211C",Rho:"\u03A1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",Rightarrow:"\u21D2",Ropf:"\u211D",RoundImplies:"\u2970",Rrightarrow:"\u21DB",Rscr:"\u211B",Rsh:"\u21B1",RuleDelayed:"\u29F4",SHCHcy:"\u0429",SHcy:"\u0428",SOFTcy:"\u042C",Sacute:"\u015A",Sc:"\u2ABC",Scaron:"\u0160",Scedil:"\u015E",Scirc:"\u015C",Scy:"\u0421",Sfr:"\u{1D516}",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",Sigma:"\u03A3",SmallCircle:"\u2218",Sopf:"\u{1D54A}",Sqrt:"\u221A",Square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",Sscr:"\u{1D4AE}",Star:"\u22C6",Sub:"\u22D0",Subset:"\u22D0",SubsetEqual:"\u2286",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",SuchThat:"\u220B",Sum:"\u2211",Sup:"\u22D1",Superset:"\u2283",SupersetEqual:"\u2287",Supset:"\u22D1",THORN:"\xDE",TRADE:"\u2122",TSHcy:"\u040B",TScy:"\u0426",Tab:" ",Tau:"\u03A4",Tcaron:"\u0164",Tcedil:"\u0162",Tcy:"\u0422",Tfr:"\u{1D517}",Therefore:"\u2234",Theta:"\u0398",ThickSpace:"\u205F\u200A",ThinSpace:"\u2009",Tilde:"\u223C",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",Topf:"\u{1D54B}",TripleDot:"\u20DB",Tscr:"\u{1D4AF}",Tstrok:"\u0166",Uacute:"\xDA",Uarr:"\u219F",Uarrocir:"\u2949",Ubrcy:"\u040E",Ubreve:"\u016C",Ucirc:"\xDB",Ucy:"\u0423",Udblac:"\u0170",Ufr:"\u{1D518}",Ugrave:"\xD9",Umacr:"\u016A",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",Uopf:"\u{1D54C}",UpArrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",UpEquilibrium:"\u296E",UpTee:"\u22A5",UpTeeArrow:"\u21A5",Uparrow:"\u21D1",Updownarrow:"\u21D5",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",Upsilon:"\u03A5",Uring:"\u016E",Uscr:"\u{1D4B0}",Utilde:"\u0168",Uuml:"\xDC",VDash:"\u22AB",Vbar:"\u2AEB",Vcy:"\u0412",Vdash:"\u22A9",Vdashl:"\u2AE6",Vee:"\u22C1",Verbar:"\u2016",Vert:"\u2016",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",Vopf:"\u{1D54D}",Vscr:"\u{1D4B1}",Vvdash:"\u22AA",Wcirc:"\u0174",Wedge:"\u22C0",Wfr:"\u{1D51A}",Wopf:"\u{1D54E}",Wscr:"\u{1D4B2}",Xfr:"\u{1D51B}",Xi:"\u039E",Xopf:"\u{1D54F}",Xscr:"\u{1D4B3}",YAcy:"\u042F",YIcy:"\u0407",YUcy:"\u042E",Yacute:"\xDD",Ycirc:"\u0176",Ycy:"\u042B",Yfr:"\u{1D51C}",Yopf:"\u{1D550}",Yscr:"\u{1D4B4}",Yuml:"\u0178",ZHcy:"\u0416",Zacute:"\u0179",Zcaron:"\u017D",Zcy:"\u0417",Zdot:"\u017B",ZeroWidthSpace:"\u200B",Zeta:"\u0396",Zfr:"\u2128",Zopf:"\u2124",Zscr:"\u{1D4B5}",aacute:"\xE1",abreve:"\u0103",ac:"\u223E",acE:"\u223E\u0333",acd:"\u223F",acirc:"\xE2",acute:"\xB4",acy:"\u0430",aelig:"\xE6",af:"\u2061",afr:"\u{1D51E}",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",alpha:"\u03B1",amacr:"\u0101",amalg:"\u2A3F",amp:"&",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",aogon:"\u0105",aopf:"\u{1D552}",ap:"\u2248",apE:"\u2A70",apacir:"\u2A6F",ape:"\u224A",apid:"\u224B",apos:"'",approx:"\u2248",approxeq:"\u224A",aring:"\xE5",ascr:"\u{1D4B6}",ast:"*",asymp:"\u2248",asympeq:"\u224D",atilde:"\xE3",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",bNot:"\u2AED",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",barvee:"\u22BD",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",beta:"\u03B2",beth:"\u2136",between:"\u226C",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bnot:"\u2310",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxDL:"\u2557",boxDR:"\u2554",boxDl:"\u2556",boxDr:"\u2553",boxH:"\u2550",boxHD:"\u2566",boxHU:"\u2569",boxHd:"\u2564",boxHu:"\u2567",boxUL:"\u255D",boxUR:"\u255A",boxUl:"\u255C",boxUr:"\u2559",boxV:"\u2551",boxVH:"\u256C",boxVL:"\u2563",boxVR:"\u2560",boxVh:"\u256B",boxVl:"\u2562",boxVr:"\u255F",boxbox:"\u29C9",boxdL:"\u2555",boxdR:"\u2552",boxdl:"\u2510",boxdr:"\u250C",boxh:"\u2500",boxhD:"\u2565",boxhU:"\u2568",boxhd:"\u252C",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxuL:"\u255B",boxuR:"\u2558",boxul:"\u2518",boxur:"\u2514",boxv:"\u2502",boxvH:"\u256A",boxvL:"\u2561",boxvR:"\u255E",boxvh:"\u253C",boxvl:"\u2524",boxvr:"\u251C",bprime:"\u2035",breve:"\u02D8",brvbar:"\xA6",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",bumpeq:"\u224F",cacute:"\u0107",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",ccaps:"\u2A4D",ccaron:"\u010D",ccedil:"\xE7",ccirc:"\u0109",ccups:"\u2A4C",ccupssm:"\u2A50",cdot:"\u010B",cedil:"\xB8",cemptyv:"\u29B2",cent:"\xA2",centerdot:"\xB7",cfr:"\u{1D520}",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",chi:"\u03C7",cir:"\u25CB",cirE:"\u29C3",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledR:"\xAE",circledS:"\u24C8",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",clubs:"\u2663",clubsuit:"\u2663",colon:":",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",conint:"\u222E",copf:"\u{1D554}",coprod:"\u2210",copy:"\xA9",copysr:"\u2117",crarr:"\u21B5",cross:"\u2717",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",cup:"\u222A",cupbrcap:"\u2A48",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",dArr:"\u21D3",dHar:"\u2965",dagger:"\u2020",daleth:"\u2138",darr:"\u2193",dash:"\u2010",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",dcaron:"\u010F",dcy:"\u0434",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",ddotseq:"\u2A77",deg:"\xB0",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",dfr:"\u{1D521}",dharl:"\u21C3",dharr:"\u21C2",diam:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",dopf:"\u{1D555}",dot:"\u02D9",doteq:"\u2250",doteqdot:"\u2251",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",downarrow:"\u2193",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",dscr:"\u{1D4B9}",dscy:"\u0455",dsol:"\u29F6",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",dzcy:"\u045F",dzigrarr:"\u27FF",eDDot:"\u2A77",eDot:"\u2251",eacute:"\xE9",easter:"\u2A6E",ecaron:"\u011B",ecir:"\u2256",ecirc:"\xEA",ecolon:"\u2255",ecy:"\u044D",edot:"\u0117",ee:"\u2147",efDot:"\u2252",efr:"\u{1D522}",eg:"\u2A9A",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",emptyv:"\u2205",emsp13:"\u2004",emsp14:"\u2005",emsp:"\u2003",eng:"\u014B",ensp:"\u2002",eogon:"\u0119",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",equals:"=",equest:"\u225F",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erDot:"\u2253",erarr:"\u2971",escr:"\u212F",esdot:"\u2250",esim:"\u2242",eta:"\u03B7",eth:"\xF0",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",expectation:"\u2130",exponentiale:"\u2147",fallingdotseq:"\u2252",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",ffr:"\u{1D523}",filig:"\uFB01",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",fopf:"\u{1D557}",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",fscr:"\u{1D4BB}",gE:"\u2267",gEl:"\u2A8C",gacute:"\u01F5",gamma:"\u03B3",gammad:"\u03DD",gap:"\u2A86",gbreve:"\u011F",gcirc:"\u011D",gcy:"\u0433",gdot:"\u0121",ge:"\u2265",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",gfr:"\u{1D524}",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",gjcy:"\u0453",gl:"\u2277",glE:"\u2A92",gla:"\u2AA5",glj:"\u2AA4",gnE:"\u2269",gnap:"\u2A8A",gnapprox:"\u2A8A",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",gopf:"\u{1D558}",grave:"`",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",hArr:"\u21D4",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",hardcy:"\u044A",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",hbar:"\u210F",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",hfr:"\u{1D525}",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",hopf:"\u{1D559}",horbar:"\u2015",hscr:"\u{1D4BD}",hslash:"\u210F",hstrok:"\u0127",hybull:"\u2043",hyphen:"\u2010",iacute:"\xED",ic:"\u2063",icirc:"\xEE",icy:"\u0438",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",ifr:"\u{1D526}",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",ijlig:"\u0133",imacr:"\u012B",image:"\u2111",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",int:"\u222B",intcal:"\u22BA",integers:"\u2124",intercal:"\u22BA",intlarhk:"\u2A17",intprod:"\u2A3C",iocy:"\u0451",iogon:"\u012F",iopf:"\u{1D55A}",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",iscr:"\u{1D4BE}",isin:"\u2208",isinE:"\u22F9",isindot:"\u22F5",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",itilde:"\u0129",iukcy:"\u0456",iuml:"\xEF",jcirc:"\u0135",jcy:"\u0439",jfr:"\u{1D527}",jmath:"\u0237",jopf:"\u{1D55B}",jscr:"\u{1D4BF}",jsercy:"\u0458",jukcy:"\u0454",kappa:"\u03BA",kappav:"\u03F0",kcedil:"\u0137",kcy:"\u043A",kfr:"\u{1D528}",kgreen:"\u0138",khcy:"\u0445",kjcy:"\u045C",kopf:"\u{1D55C}",kscr:"\u{1D4C0}",lAarr:"\u21DA",lArr:"\u21D0",lAtail:"\u291B",lBarr:"\u290E",lE:"\u2266",lEg:"\u2A8B",lHar:"\u2962",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",lambda:"\u03BB",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",laquo:"\xAB",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",lcaron:"\u013E",lcedil:"\u013C",lceil:"\u2308",lcub:"{",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",le:"\u2264",leftarrow:"\u2190",leftarrowtail:"\u21A2",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",leftthreetimes:"\u22CB",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",lessgtr:"\u2276",lesssim:"\u2272",lfisht:"\u297C",lfloor:"\u230A",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",ljcy:"\u0459",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",llhard:"\u296B",lltri:"\u25FA",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnE:"\u2268",lnap:"\u2A89",lnapprox:"\u2A89",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",longleftarrow:"\u27F5",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",lscr:"\u{1D4C1}",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",lstrok:"\u0142",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltrPar:"\u2996",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",mDDot:"\u223A",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",mcy:"\u043C",mdash:"\u2014",measuredangle:"\u2221",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",mopf:"\u{1D55E}",mp:"\u2213",mscr:"\u{1D4C2}",mstpos:"\u223E",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nGg:"\u22D9\u0338",nGt:"\u226B\u20D2",nGtv:"\u226B\u0338",nLeftarrow:"\u21CD",nLeftrightarrow:"\u21CE",nLl:"\u22D8\u0338",nLt:"\u226A\u20D2",nLtv:"\u226A\u0338",nRightarrow:"\u21CF",nVDash:"\u22AF",nVdash:"\u22AE",nabla:"\u2207",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",ncaron:"\u0148",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",neArr:"\u21D7",nearhk:"\u2924",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",nexist:"\u2204",nexists:"\u2204",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",ngsim:"\u2275",ngt:"\u226F",ngtr:"\u226F",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",njcy:"\u045A",nlArr:"\u21CD",nlE:"\u2266\u0338",nlarr:"\u219A",nldr:"\u2025",nle:"\u2270",nleftarrow:"\u219A",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nlsim:"\u2274",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nmid:"\u2224",nopf:"\u{1D55F}",not:"\xAC",notin:"\u2209",notinE:"\u22F9\u0338",notindot:"\u22F5\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvDash:"\u22AD",nvHarr:"\u2904",nvap:"\u224D\u20D2",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwArr:"\u21D6",nwarhk:"\u2923",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",oS:"\u24C8",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",ocirc:"\xF4",ocy:"\u043E",odash:"\u229D",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",oelig:"\u0153",ofcir:"\u29BF",ofr:"\u{1D52C}",ogon:"\u02DB",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",omacr:"\u014D",omega:"\u03C9",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",oopf:"\u{1D560}",opar:"\u29B7",operp:"\u29B9",oplus:"\u2295",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oscr:"\u2134",oslash:"\xF8",osol:"\u2298",otilde:"\xF5",otimes:"\u2297",otimesas:"\u2A36",ouml:"\xF6",ovbar:"\u233D",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",pfr:"\u{1D52D}",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",pointint:"\u2A15",popf:"\u{1D561}",pound:"\xA3",pr:"\u227A",prE:"\u2AB3",prap:"\u2AB7",prcue:"\u227C",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",prime:"\u2032",primes:"\u2119",prnE:"\u2AB5",prnap:"\u2AB9",prnsim:"\u22E8",prod:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",pscr:"\u{1D4C5}",psi:"\u03C8",puncsp:"\u2008",qfr:"\u{1D52E}",qint:"\u2A0C",qopf:"\u{1D562}",qprime:"\u2057",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",quot:'"',rAarr:"\u21DB",rArr:"\u21D2",rAtail:"\u291C",rBarr:"\u290F",rHar:"\u2964",race:"\u223D\u0331",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",rarrtl:"\u21A3",rarrw:"\u219D",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",rcaron:"\u0159",rcedil:"\u0157",rceil:"\u2309",rcub:"}",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",reg:"\xAE",rfisht:"\u297D",rfloor:"\u230B",rfr:"\u{1D52F}",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",rho:"\u03C1",rhov:"\u03F1",rightarrow:"\u2192",rightarrowtail:"\u21A3",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",rightthreetimes:"\u22CC",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",rsaquo:"\u203A",rscr:"\u{1D4C7}",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",ruluhar:"\u2968",rx:"\u211E",sacute:"\u015B",sbquo:"\u201A",sc:"\u227B",scE:"\u2AB4",scap:"\u2AB8",scaron:"\u0161",sccue:"\u227D",sce:"\u2AB0",scedil:"\u015F",scirc:"\u015D",scnE:"\u2AB6",scnap:"\u2ABA",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",seArr:"\u21D8",searhk:"\u2925",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",shchcy:"\u0449",shcy:"\u0448",shortmid:"\u2223",shortparallel:"\u2225",shy:"\xAD",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",square:"\u25A1",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",sub:"\u2282",subE:"\u2AC5",subdot:"\u2ABD",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",sum:"\u2211",sung:"\u266A",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",sup:"\u2283",supE:"\u2AC6",supdot:"\u2ABE",supdsub:"\u2AD8",supe:"\u2287",supedot:"\u2AC4",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swArr:"\u21D9",swarhk:"\u2926",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",target:"\u2316",tau:"\u03C4",tbrk:"\u23B4",tcaron:"\u0165",tcedil:"\u0163",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",tfr:"\u{1D531}",there4:"\u2234",therefore:"\u2234",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",thinsp:"\u2009",thkap:"\u2248",thksim:"\u223C",thorn:"\xFE",tilde:"\u02DC",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",tscr:"\u{1D4C9}",tscy:"\u0446",tshcy:"\u045B",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",uArr:"\u21D1",uHar:"\u2963",uacute:"\xFA",uarr:"\u2191",ubrcy:"\u045E",ubreve:"\u016D",ucirc:"\xFB",ucy:"\u0443",udarr:"\u21C5",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",ufr:"\u{1D532}",ugrave:"\xF9",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",umacr:"\u016B",uml:"\xA8",uogon:"\u0173",uopf:"\u{1D566}",uparrow:"\u2191",updownarrow:"\u2195",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",upsi:"\u03C5",upsih:"\u03D2",upsilon:"\u03C5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",uring:"\u016F",urtri:"\u25F9",uscr:"\u{1D4CA}",utdot:"\u22F0",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",uuml:"\xFC",uwangle:"\u29A7",vArr:"\u21D5",vBar:"\u2AE8",vBarv:"\u2AE9",vDash:"\u22A8",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",vcy:"\u0432",vdash:"\u22A2",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",verbar:"|",vert:"|",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",vzigzag:"\u299A",wcirc:"\u0175",wedbar:"\u2A5F",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",wfr:"\u{1D534}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",yacute:"\xFD",yacy:"\u044F",ycirc:"\u0177",ycy:"\u044B",yen:"\xA5",yfr:"\u{1D536}",yicy:"\u0457",yopf:"\u{1D56A}",yscr:"\u{1D4CE}",yucy:"\u044E",yuml:"\xFF",zacute:"\u017A",zcaron:"\u017E",zcy:"\u0437",zdot:"\u017C",zeetrf:"\u2128",zeta:"\u03B6",zfr:"\u{1D537}",zhcy:"\u0436",zigrarr:"\u21DD",zopf:"\u{1D56B}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"};var zy={}.hasOwnProperty;function ns(e){return zy.call(Gi,e)?Gi[e]:!1}function pe(e,t,n,r){let o=e.length,s=0,i;if(t<0?t=-t>o?0:o+t:t=t>o?o:t,n=n>0?n:0,r.length<1e4)i=Array.from(r),i.unshift(t,n),e.splice(...i);else for(n&&e.splice(t,n);s<r.length;)i=r.slice(s,s+1e4),i.unshift(t,0),e.splice(...i),s+=1e4,t+=1e4}function Se(e,t){return e.length>0?(pe(e,e.length,0,t),e):t}var Sp={}.hasOwnProperty;function Ep(e){let t={},n=-1;for(;++n<e.length;)$y(t,e[n]);return t}function $y(e,t){let n;for(n in t){let o=(Sp.call(e,n)?e[n]:void 0)||(e[n]={}),s=t[n],i;if(s)for(i in s){Sp.call(o,i)||(o[i]=[]);let a=s[i];Ly(o[i],Array.isArray(a)?a:a?[a]:[])}}}function Ly(e,t){let n=-1,r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);pe(e,0,0,r)}function Ap(e,t){let n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function _r(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var Te=Ft(/[A-Za-z]/),Ee=Ft(/[\dA-Za-z]/),kp=Ft(/[#-'*+\--9=?A-Z^-~]/);function Sr(e){return e!==null&&(e<32||e===127)}var Er=Ft(/\d/),vp=Ft(/[\dA-Fa-f]/),Rp=Ft(/[!-/:-@[-`{-~]/);function C(e){return e!==null&&e<-2}function ie(e){return e!==null&&(e<0||e===32)}function F(e){return e===-2||e===-1||e===32}var Dp=Ft(/\p{P}|\p{S}/u),Ip=Ft(/\s/);function Ft(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function M(e,t,n,r){let o=r?r-1:Number.POSITIVE_INFINITY,s=0;return i;function i(c){return F(c)?(e.enter(n),a(c)):t(c)}function a(c){return F(c)&&s++<o?(e.consume(c),a):(e.exit(n),t(c))}}var Cp={tokenize:Py};function Py(e){let t=e.attempt(this.parser.constructs.contentInitial,r,o),n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),M(e,t,"linePrefix")}function o(a){return e.enter("paragraph"),s(a)}function s(a){let c=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=c),n=c,i(a)}function i(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return C(a)?(e.consume(a),e.exit("chunkText"),s):(e.consume(a),i)}}var Op={tokenize:Fy},Tp={tokenize:My};function Fy(e){let t=this,n=[],r=0,o,s,i;return a;function a(S){if(r<n.length){let E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,c,u)(S)}return u(S)}function c(S){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,o&&A();let E=t.events.length,_=E,x;for(;_--;)if(t.events[_][0]==="exit"&&t.events[_][1].type==="chunkFlow"){x=t.events[_][1].end;break}m(r);let R=E;for(;R<t.events.length;)t.events[R][1].end={...x},R++;return pe(t.events,_+1,0,t.events.slice(E)),t.events.length=R,u(S)}return a(S)}function u(S){if(r===n.length){if(!o)return p(S);if(o.currentConstruct&&o.currentConstruct.concrete)return w(S);t.interrupt=!!(o.currentConstruct&&!o._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Tp,f,l)(S)}function f(S){return o&&A(),m(r),p(S)}function l(S){return t.parser.lazy[t.now().line]=r!==n.length,i=t.now().offset,w(S)}function p(S){return t.containerState={},e.attempt(Tp,d,w)(S)}function d(S){return r++,n.push([t.currentConstruct,t.containerState]),p(S)}function w(S){if(S===null){o&&A(),m(0),e.consume(S);return}return o=o||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:o,contentType:"flow",previous:s}),h(S)}function h(S){if(S===null){y(e.exit("chunkFlow"),!0),m(0),e.consume(S);return}return C(S)?(e.consume(S),y(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(S),h)}function y(S,E){let _=t.sliceStream(S);if(E&&_.push(null),S.previous=s,s&&(s.next=S),s=S,o.defineSkip(S.start),o.write(_),t.parser.lazy[S.start.line]){let x=o.events.length;for(;x--;)if(o.events[x][1].start.offset<i&&(!o.events[x][1].end||o.events[x][1].end.offset>i))return;let R=t.events.length,v=R,I,P;for(;v--;)if(t.events[v][0]==="exit"&&t.events[v][1].type==="chunkFlow"){if(I){P=t.events[v][1].end;break}I=!0}for(m(r),x=R;x<t.events.length;)t.events[x][1].end={...P},x++;pe(t.events,v+1,0,t.events.slice(R)),t.events.length=x}}function m(S){let E=n.length;for(;E-- >S;){let _=n[E];t.containerState=_[1],_[0].exit.call(t,e)}n.length=S}function A(){o.write([null]),s=void 0,o=void 0,t.containerState._closeFlow=void 0}}function My(e,t,n){return M(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Ji(e){if(e===null||ie(e)||Ip(e))return 1;if(Dp(e))return 2}function On(e,t,n){let r=[],o=-1;for(;++o<e.length;){let s=e[o].resolveAll;s&&!r.includes(s)&&(t=s(t,n),r.push(s))}return t}var Ar={name:"attention",resolveAll:By,tokenize:qy};function By(e,t){let n=-1,r,o,s,i,a,c,u,f;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let l={...e[r][1].end},p={...e[n][1].start};Np(l,-c),Np(p,c),i={type:c>1?"strongSequence":"emphasisSequence",start:l,end:{...e[r][1].end}},a={type:c>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:p},s={type:c>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},o={type:c>1?"strong":"emphasis",start:{...i.start},end:{...a.end}},e[r][1].end={...i.start},e[n][1].start={...a.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=Se(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=Se(u,[["enter",o,t],["enter",i,t],["exit",i,t],["enter",s,t]]),u=Se(u,On(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=Se(u,[["exit",s,t],["enter",a,t],["exit",a,t],["exit",o,t]]),e[n][1].end.offset-e[n][1].start.offset?(f=2,u=Se(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):f=0,pe(e,r-1,n-r+3,u),n=r+u.length-f-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function qy(e,t){let n=this.parser.constructs.attentionMarkers.null,r=this.previous,o=Ji(r),s;return i;function i(c){return s=c,e.enter("attentionSequence"),a(c)}function a(c){if(c===s)return e.consume(c),a;let u=e.exit("attentionSequence"),f=Ji(c),l=!f||f===2&&o||n.includes(c),p=!o||o===2&&f||n.includes(r);return u._open=!!(s===42?l:l&&(o||!p)),u._close=!!(s===42?p:p&&(f||!l)),t(c)}}function Np(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Wi={name:"autolink",tokenize:Zy};function Zy(e,t,n){let r=0;return o;function o(d){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),s}function s(d){return Te(d)?(e.consume(d),i):d===64?n(d):u(d)}function i(d){return d===43||d===45||d===46||Ee(d)?(r=1,a(d)):u(d)}function a(d){return d===58?(e.consume(d),r=0,c):(d===43||d===45||d===46||Ee(d))&&r++<32?(e.consume(d),a):(r=0,u(d))}function c(d){return d===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):d===null||d===32||d===60||Sr(d)?n(d):(e.consume(d),c)}function u(d){return d===64?(e.consume(d),f):kp(d)?(e.consume(d),u):n(d)}function f(d){return Ee(d)?l(d):n(d)}function l(d){return d===46?(e.consume(d),r=0,f):d===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(d),e.exit("autolinkMarker"),e.exit("autolink"),t):p(d)}function p(d){if((d===45||Ee(d))&&r++<63){let w=d===45?p:l;return e.consume(d),w}return n(d)}}var Mt={partial:!0,tokenize:Uy};function Uy(e,t,n){return r;function r(s){return F(s)?M(e,o,"linePrefix")(s):o(s)}function o(s){return s===null||C(s)?t(s):n(s)}}var rs={continuation:{tokenize:Vy},exit:Qy,name:"blockQuote",tokenize:jy};function jy(e,t,n){let r=this;return o;function o(i){if(i===62){let a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(i),e.exit("blockQuoteMarker"),s}return n(i)}function s(i){return F(i)?(e.enter("blockQuotePrefixWhitespace"),e.consume(i),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(i))}}function Vy(e,t,n){let r=this;return o;function o(i){return F(i)?M(e,s,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(i):s(i)}function s(i){return e.attempt(rs,t,n)(i)}}function Qy(e){e.exit("blockQuote")}var os={name:"characterEscape",tokenize:Gy};function Gy(e,t,n){return r;function r(s){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(s),e.exit("escapeMarker"),o}function o(s){return Rp(s)?(e.enter("characterEscapeValue"),e.consume(s),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(s)}}var ss={name:"characterReference",tokenize:Jy};function Jy(e,t,n){let r=this,o=0,s,i;return a;function a(l){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),c}function c(l){return l===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(l),e.exit("characterReferenceMarkerNumeric"),u):(e.enter("characterReferenceValue"),s=31,i=Ee,f(l))}function u(l){return l===88||l===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(l),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),s=6,i=vp,f):(e.enter("characterReferenceValue"),s=7,i=Er,f(l))}function f(l){if(l===59&&o){let p=e.exit("characterReferenceValue");return i===Ee&&!ns(r.sliceSerialize(p))?n(l):(e.enter("characterReferenceMarker"),e.consume(l),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return i(l)&&o++<s?(e.consume(l),f):n(l)}}var zp={partial:!0,tokenize:Ky},is={concrete:!0,name:"codeFenced",tokenize:Wy};function Wy(e,t,n){let r=this,o={partial:!0,tokenize:_},s=0,i=0,a;return c;function c(x){return u(x)}function u(x){let R=r.events[r.events.length-1];return s=R&&R[1].type==="linePrefix"?R[2].sliceSerialize(R[1],!0).length:0,a=x,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),f(x)}function f(x){return x===a?(i++,e.consume(x),f):i<3?n(x):(e.exit("codeFencedFenceSequence"),F(x)?M(e,l,"whitespace")(x):l(x))}function l(x){return x===null||C(x)?(e.exit("codeFencedFence"),r.interrupt?t(x):e.check(zp,h,E)(x)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),p(x))}function p(x){return x===null||C(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),l(x)):F(x)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),M(e,d,"whitespace")(x)):x===96&&x===a?n(x):(e.consume(x),p)}function d(x){return x===null||C(x)?l(x):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),w(x))}function w(x){return x===null||C(x)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),l(x)):x===96&&x===a?n(x):(e.consume(x),w)}function h(x){return e.attempt(o,E,y)(x)}function y(x){return e.enter("lineEnding"),e.consume(x),e.exit("lineEnding"),m}function m(x){return s>0&&F(x)?M(e,A,"linePrefix",s+1)(x):A(x)}function A(x){return x===null||C(x)?e.check(zp,h,E)(x):(e.enter("codeFlowValue"),S(x))}function S(x){return x===null||C(x)?(e.exit("codeFlowValue"),A(x)):(e.consume(x),S)}function E(x){return e.exit("codeFenced"),t(x)}function _(x,R,v){let I=0;return P;function P(q){return x.enter("lineEnding"),x.consume(q),x.exit("lineEnding"),Q}function Q(q){return x.enter("codeFencedFence"),F(q)?M(x,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):O(q)}function O(q){return q===a?(x.enter("codeFencedFenceSequence"),z(q)):v(q)}function z(q){return q===a?(I++,x.consume(q),z):I>=i?(x.exit("codeFencedFenceSequence"),F(q)?M(x,Z,"whitespace")(q):Z(q)):v(q)}function Z(q){return q===null||C(q)?(x.exit("codeFencedFence"),R(q)):v(q)}}}function Ky(e,t,n){let r=this;return o;function o(i){return i===null?n(i):(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}var kr={name:"codeIndented",tokenize:Yy},Hy={partial:!0,tokenize:Xy};function Yy(e,t,n){let r=this;return o;function o(u){return e.enter("codeIndented"),M(e,s,"linePrefix",5)(u)}function s(u){let f=r.events[r.events.length-1];return f&&f[1].type==="linePrefix"&&f[2].sliceSerialize(f[1],!0).length>=4?i(u):n(u)}function i(u){return u===null?c(u):C(u)?e.attempt(Hy,i,c)(u):(e.enter("codeFlowValue"),a(u))}function a(u){return u===null||C(u)?(e.exit("codeFlowValue"),i(u)):(e.consume(u),a)}function c(u){return e.exit("codeIndented"),t(u)}}function Xy(e,t,n){let r=this;return o;function o(i){return r.parser.lazy[r.now().line]?n(i):C(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),o):M(e,s,"linePrefix",5)(i)}function s(i){let a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):C(i)?o(i):n(i)}}var Ki={name:"codeText",previous:tb,resolve:eb,tokenize:nb};function eb(e){let t=e.length-4,n=3,r,o;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)o===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(o=r):(r===t||e[r][1].type==="lineEnding")&&(e[o][1].type="codeTextData",r!==o+2&&(e[o][1].end=e[r-1][1].end,e.splice(o+2,r-o-2),t-=r-o-2,r=o+2),o=void 0);return e}function tb(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function nb(e,t,n){let r=this,o=0,s,i;return a;function a(p){return e.enter("codeText"),e.enter("codeTextSequence"),c(p)}function c(p){return p===96?(e.consume(p),o++,c):(e.exit("codeTextSequence"),u(p))}function u(p){return p===null?n(p):p===32?(e.enter("space"),e.consume(p),e.exit("space"),u):p===96?(i=e.enter("codeTextSequence"),s=0,l(p)):C(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("codeTextData"),f(p))}function f(p){return p===null||p===32||p===96||C(p)?(e.exit("codeTextData"),u(p)):(e.consume(p),f)}function l(p){return p===96?(e.consume(p),s++,l):s===o?(e.exit("codeTextSequence"),e.exit("codeText"),t(p)):(i.type="codeTextData",f(p))}}var as=class{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){let r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){let o=n||0;this.setCursor(Math.trunc(t));let s=this.right.splice(this.right.length-o,Number.POSITIVE_INFINITY);return r&&vr(this.left,r),s.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),vr(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),vr(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){let n=this.left.splice(t,Number.POSITIVE_INFINITY);vr(this.right,n.reverse())}else{let n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);vr(this.left,n.reverse())}}};function vr(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function cs(e){let t={},n=-1,r,o,s,i,a,c,u,f=new as(e);for(;++n<f.length;){for(;n in t;)n=t[n];if(r=f.get(n),n&&r[1].type==="chunkFlow"&&f.get(n-1)[1].type==="listItemPrefix"&&(c=r[1]._tokenizer.events,s=0,s<c.length&&c[s][1].type==="lineEndingBlank"&&(s+=2),s<c.length&&c[s][1].type==="content"))for(;++s<c.length&&c[s][1].type!=="content";)c[s][1].type==="chunkText"&&(c[s][1]._isInFirstContentOfListItem=!0,s++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,rb(f,n)),n=t[n],u=!0);else if(r[1]._container){for(s=n,o=void 0;s--;)if(i=f.get(s),i[1].type==="lineEnding"||i[1].type==="lineEndingBlank")i[0]==="enter"&&(o&&(f.get(o)[1].type="lineEndingBlank"),i[1].type="lineEnding",o=s);else if(!(i[1].type==="linePrefix"||i[1].type==="listItemIndent"))break;o&&(r[1].end={...f.get(o)[1].start},a=f.slice(o,n),a.unshift(r),f.splice(o,n-o+1,a))}}return pe(e,0,Number.POSITIVE_INFINITY,f.slice(0)),!u}function rb(e,t){let n=e.get(t)[1],r=e.get(t)[2],o=t-1,s=[],i=n._tokenizer;i||(i=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(i._contentTypeTextTrailing=!0));let a=i.events,c=[],u={},f,l,p=-1,d=n,w=0,h=0,y=[h];for(;d;){for(;e.get(++o)[1]!==d;);s.push(o),d._tokenizer||(f=r.sliceStream(d),d.next||f.push(null),l&&i.defineSkip(d.start),d._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=!0),i.write(f),d._isInFirstContentOfListItem&&(i._gfmTasklistFirstContentOfListItem=void 0)),l=d,d=d.next}for(d=n;++p<a.length;)a[p][0]==="exit"&&a[p-1][0]==="enter"&&a[p][1].type===a[p-1][1].type&&a[p][1].start.line!==a[p][1].end.line&&(h=p+1,y.push(h),d._tokenizer=void 0,d.previous=void 0,d=d.next);for(i.events=[],d?(d._tokenizer=void 0,d.previous=void 0):y.pop(),p=y.length;p--;){let m=a.slice(y[p],y[p+1]),A=s.pop();c.push([A,A+m.length-1]),e.splice(A,2,m)}for(c.reverse(),p=-1;++p<c.length;)u[w+c[p][0]]=w+c[p][1],w+=c[p][1]-c[p][0]-1;return u}var Hi={resolve:sb,tokenize:ib},ob={partial:!0,tokenize:ab};function sb(e){return cs(e),e}function ib(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),o(a)}function o(a){return a===null?s(a):C(a)?e.check(ob,i,s)(a):(e.consume(a),o)}function s(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function i(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,o}}function ab(e,t,n){let r=this;return o;function o(i){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),M(e,s,"linePrefix")}function s(i){if(i===null||C(i))return n(i);let a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(i):e.interrupt(r.parser.constructs.flow,n,t)(i)}}function us(e,t,n,r,o,s,i,a,c){let u=c||Number.POSITIVE_INFINITY,f=0;return l;function l(m){return m===60?(e.enter(r),e.enter(o),e.enter(s),e.consume(m),e.exit(s),p):m===null||m===32||m===41||Sr(m)?n(m):(e.enter(r),e.enter(i),e.enter(a),e.enter("chunkString",{contentType:"string"}),h(m))}function p(m){return m===62?(e.enter(s),e.consume(m),e.exit(s),e.exit(o),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),d(m))}function d(m){return m===62?(e.exit("chunkString"),e.exit(a),p(m)):m===null||m===60||C(m)?n(m):(e.consume(m),m===92?w:d)}function w(m){return m===60||m===62||m===92?(e.consume(m),d):d(m)}function h(m){return!f&&(m===null||m===41||ie(m))?(e.exit("chunkString"),e.exit(a),e.exit(i),e.exit(r),t(m)):f<u&&m===40?(e.consume(m),f++,h):m===41?(e.consume(m),f--,h):m===null||m===32||m===40||Sr(m)?n(m):(e.consume(m),m===92?y:h)}function y(m){return m===40||m===41||m===92?(e.consume(m),h):h(m)}}function ls(e,t,n,r,o,s){let i=this,a=0,c;return u;function u(d){return e.enter(r),e.enter(o),e.consume(d),e.exit(o),e.enter(s),f}function f(d){return a>999||d===null||d===91||d===93&&!c||d===94&&!a&&"_hiddenFootnoteSupport"in i.parser.constructs?n(d):d===93?(e.exit(s),e.enter(o),e.consume(d),e.exit(o),e.exit(r),t):C(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),f):(e.enter("chunkString",{contentType:"string"}),l(d))}function l(d){return d===null||d===91||d===93||C(d)||a++>999?(e.exit("chunkString"),f(d)):(e.consume(d),c||(c=!F(d)),d===92?p:l)}function p(d){return d===91||d===92||d===93?(e.consume(d),a++,l):l(d)}}function fs(e,t,n,r,o,s){let i;return a;function a(p){return p===34||p===39||p===40?(e.enter(r),e.enter(o),e.consume(p),e.exit(o),i=p===40?41:p,c):n(p)}function c(p){return p===i?(e.enter(o),e.consume(p),e.exit(o),e.exit(r),t):(e.enter(s),u(p))}function u(p){return p===i?(e.exit(s),c(i)):p===null?n(p):C(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),M(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===i||p===null||C(p)?(e.exit("chunkString"),u(p)):(e.consume(p),p===92?l:f)}function l(p){return p===i||p===92?(e.consume(p),f):f(p)}}function Ht(e,t){let n;return r;function r(o){return C(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),n=!0,r):F(o)?M(e,r,n?"linePrefix":"lineSuffix")(o):t(o)}}var Yi={name:"definition",tokenize:ub},cb={partial:!0,tokenize:lb};function ub(e,t,n){let r=this,o;return s;function s(d){return e.enter("definition"),i(d)}function i(d){return ls.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(d)}function a(d){return o=_r(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),d===58?(e.enter("definitionMarker"),e.consume(d),e.exit("definitionMarker"),c):n(d)}function c(d){return ie(d)?Ht(e,u)(d):u(d)}function u(d){return us(e,f,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(d)}function f(d){return e.attempt(cb,l,l)(d)}function l(d){return F(d)?M(e,p,"whitespace")(d):p(d)}function p(d){return d===null||C(d)?(e.exit("definition"),r.parser.defined.push(o),t(d)):n(d)}}function lb(e,t,n){return r;function r(a){return ie(a)?Ht(e,o)(a):n(a)}function o(a){return fs(e,s,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function s(a){return F(a)?M(e,i,"whitespace")(a):i(a)}function i(a){return a===null||C(a)?t(a):n(a)}}var Xi={name:"hardBreakEscape",tokenize:fb};function fb(e,t,n){return r;function r(s){return e.enter("hardBreakEscape"),e.consume(s),o}function o(s){return C(s)?(e.exit("hardBreakEscape"),t(s)):n(s)}}var ea={name:"headingAtx",resolve:db,tokenize:pb};function db(e,t){let n=e.length-2,r=3,o,s;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},s={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},pe(e,r,n-r+1,[["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t]])),e}function pb(e,t,n){let r=0;return o;function o(f){return e.enter("atxHeading"),s(f)}function s(f){return e.enter("atxHeadingSequence"),i(f)}function i(f){return f===35&&r++<6?(e.consume(f),i):f===null||ie(f)?(e.exit("atxHeadingSequence"),a(f)):n(f)}function a(f){return f===35?(e.enter("atxHeadingSequence"),c(f)):f===null||C(f)?(e.exit("atxHeading"),t(f)):F(f)?M(e,a,"whitespace")(f):(e.enter("atxHeadingText"),u(f))}function c(f){return f===35?(e.consume(f),c):(e.exit("atxHeadingSequence"),a(f))}function u(f){return f===null||f===35||ie(f)?(e.exit("atxHeadingText"),a(f)):(e.consume(f),u)}}var $p=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ta=["pre","script","style","textarea"];var na={concrete:!0,name:"htmlFlow",resolveTo:gb,tokenize:yb},mb={partial:!0,tokenize:wb},hb={partial:!0,tokenize:bb};function gb(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function yb(e,t,n){let r=this,o,s,i,a,c;return u;function u(b){return f(b)}function f(b){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(b),l}function l(b){return b===33?(e.consume(b),p):b===47?(e.consume(b),s=!0,h):b===63?(e.consume(b),o=3,r.interrupt?t:g):Te(b)?(e.consume(b),i=String.fromCharCode(b),y):n(b)}function p(b){return b===45?(e.consume(b),o=2,d):b===91?(e.consume(b),o=5,a=0,w):Te(b)?(e.consume(b),o=4,r.interrupt?t:g):n(b)}function d(b){return b===45?(e.consume(b),r.interrupt?t:g):n(b)}function w(b){let Be="CDATA[";return b===Be.charCodeAt(a++)?(e.consume(b),a===Be.length?r.interrupt?t:O:w):n(b)}function h(b){return Te(b)?(e.consume(b),i=String.fromCharCode(b),y):n(b)}function y(b){if(b===null||b===47||b===62||ie(b)){let Be=b===47,Cr=i.toLowerCase();return!Be&&!s&&ta.includes(Cr)?(o=1,r.interrupt?t(b):O(b)):$p.includes(i.toLowerCase())?(o=6,Be?(e.consume(b),m):r.interrupt?t(b):O(b)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(b):s?A(b):S(b))}return b===45||Ee(b)?(e.consume(b),i+=String.fromCharCode(b),y):n(b)}function m(b){return b===62?(e.consume(b),r.interrupt?t:O):n(b)}function A(b){return F(b)?(e.consume(b),A):P(b)}function S(b){return b===47?(e.consume(b),P):b===58||b===95||Te(b)?(e.consume(b),E):F(b)?(e.consume(b),S):P(b)}function E(b){return b===45||b===46||b===58||b===95||Ee(b)?(e.consume(b),E):_(b)}function _(b){return b===61?(e.consume(b),x):F(b)?(e.consume(b),_):S(b)}function x(b){return b===null||b===60||b===61||b===62||b===96?n(b):b===34||b===39?(e.consume(b),c=b,R):F(b)?(e.consume(b),x):v(b)}function R(b){return b===c?(e.consume(b),c=null,I):b===null||C(b)?n(b):(e.consume(b),R)}function v(b){return b===null||b===34||b===39||b===47||b===60||b===61||b===62||b===96||ie(b)?_(b):(e.consume(b),v)}function I(b){return b===47||b===62||F(b)?S(b):n(b)}function P(b){return b===62?(e.consume(b),Q):n(b)}function Q(b){return b===null||C(b)?O(b):F(b)?(e.consume(b),Q):n(b)}function O(b){return b===45&&o===2?(e.consume(b),ne):b===60&&o===1?(e.consume(b),ue):b===62&&o===4?(e.consume(b),Ke):b===63&&o===3?(e.consume(b),g):b===93&&o===5?(e.consume(b),bt):C(b)&&(o===6||o===7)?(e.exit("htmlFlowData"),e.check(mb,qt,z)(b)):b===null||C(b)?(e.exit("htmlFlowData"),z(b)):(e.consume(b),O)}function z(b){return e.check(hb,Z,qt)(b)}function Z(b){return e.enter("lineEnding"),e.consume(b),e.exit("lineEnding"),q}function q(b){return b===null||C(b)?z(b):(e.enter("htmlFlowData"),O(b))}function ne(b){return b===45?(e.consume(b),g):O(b)}function ue(b){return b===47?(e.consume(b),i="",ut):O(b)}function ut(b){if(b===62){let Be=i.toLowerCase();return ta.includes(Be)?(e.consume(b),Ke):O(b)}return Te(b)&&i.length<8?(e.consume(b),i+=String.fromCharCode(b),ut):O(b)}function bt(b){return b===93?(e.consume(b),g):O(b)}function g(b){return b===62?(e.consume(b),Ke):b===45&&o===2?(e.consume(b),g):O(b)}function Ke(b){return b===null||C(b)?(e.exit("htmlFlowData"),qt(b)):(e.consume(b),Ke)}function qt(b){return e.exit("htmlFlow"),t(b)}}function bb(e,t,n){let r=this;return o;function o(i){return C(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),s):n(i)}function s(i){return r.parser.lazy[r.now().line]?n(i):t(i)}}function wb(e,t,n){return r;function r(o){return e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),e.attempt(Mt,t,n)}}var ra={name:"htmlText",tokenize:xb};function xb(e,t,n){let r=this,o,s,i;return a;function a(g){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(g),c}function c(g){return g===33?(e.consume(g),u):g===47?(e.consume(g),_):g===63?(e.consume(g),S):Te(g)?(e.consume(g),v):n(g)}function u(g){return g===45?(e.consume(g),f):g===91?(e.consume(g),s=0,w):Te(g)?(e.consume(g),A):n(g)}function f(g){return g===45?(e.consume(g),d):n(g)}function l(g){return g===null?n(g):g===45?(e.consume(g),p):C(g)?(i=l,ue(g)):(e.consume(g),l)}function p(g){return g===45?(e.consume(g),d):l(g)}function d(g){return g===62?ne(g):g===45?p(g):l(g)}function w(g){let Ke="CDATA[";return g===Ke.charCodeAt(s++)?(e.consume(g),s===Ke.length?h:w):n(g)}function h(g){return g===null?n(g):g===93?(e.consume(g),y):C(g)?(i=h,ue(g)):(e.consume(g),h)}function y(g){return g===93?(e.consume(g),m):h(g)}function m(g){return g===62?ne(g):g===93?(e.consume(g),m):h(g)}function A(g){return g===null||g===62?ne(g):C(g)?(i=A,ue(g)):(e.consume(g),A)}function S(g){return g===null?n(g):g===63?(e.consume(g),E):C(g)?(i=S,ue(g)):(e.consume(g),S)}function E(g){return g===62?ne(g):S(g)}function _(g){return Te(g)?(e.consume(g),x):n(g)}function x(g){return g===45||Ee(g)?(e.consume(g),x):R(g)}function R(g){return C(g)?(i=R,ue(g)):F(g)?(e.consume(g),R):ne(g)}function v(g){return g===45||Ee(g)?(e.consume(g),v):g===47||g===62||ie(g)?I(g):n(g)}function I(g){return g===47?(e.consume(g),ne):g===58||g===95||Te(g)?(e.consume(g),P):C(g)?(i=I,ue(g)):F(g)?(e.consume(g),I):ne(g)}function P(g){return g===45||g===46||g===58||g===95||Ee(g)?(e.consume(g),P):Q(g)}function Q(g){return g===61?(e.consume(g),O):C(g)?(i=Q,ue(g)):F(g)?(e.consume(g),Q):I(g)}function O(g){return g===null||g===60||g===61||g===62||g===96?n(g):g===34||g===39?(e.consume(g),o=g,z):C(g)?(i=O,ue(g)):F(g)?(e.consume(g),O):(e.consume(g),Z)}function z(g){return g===o?(e.consume(g),o=void 0,q):g===null?n(g):C(g)?(i=z,ue(g)):(e.consume(g),z)}function Z(g){return g===null||g===34||g===39||g===60||g===61||g===96?n(g):g===47||g===62||ie(g)?I(g):(e.consume(g),Z)}function q(g){return g===47||g===62||ie(g)?I(g):n(g)}function ne(g){return g===62?(e.consume(g),e.exit("htmlTextData"),e.exit("htmlText"),t):n(g)}function ue(g){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(g),e.exit("lineEnding"),ut}function ut(g){return F(g)?M(e,bt,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(g):bt(g)}function bt(g){return e.enter("htmlTextData"),i(g)}}var Yt={name:"labelEnd",resolveAll:Ab,resolveTo:kb,tokenize:vb},_b={tokenize:Rb},Sb={tokenize:Db},Eb={tokenize:Ib};function Ab(e){let t=-1,n=[];for(;++t<e.length;){let r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){let o=r.type==="labelImage"?4:2;r.type="data",t+=o}}return e.length!==n.length&&pe(e,0,e.length,n),e}function kb(e,t){let n=e.length,r=0,o,s,i,a;for(;n--;)if(o=e[n][1],s){if(o.type==="link"||o.type==="labelLink"&&o._inactive)break;e[n][0]==="enter"&&o.type==="labelLink"&&(o._inactive=!0)}else if(i){if(e[n][0]==="enter"&&(o.type==="labelImage"||o.type==="labelLink")&&!o._balanced&&(s=n,o.type!=="labelLink")){r=2;break}}else o.type==="labelEnd"&&(i=n);let c={type:e[s][1].type==="labelLink"?"link":"image",start:{...e[s][1].start},end:{...e[e.length-1][1].end}},u={type:"label",start:{...e[s][1].start},end:{...e[i][1].end}},f={type:"labelText",start:{...e[s+r+2][1].end},end:{...e[i-2][1].start}};return a=[["enter",c,t],["enter",u,t]],a=Se(a,e.slice(s+1,s+r+3)),a=Se(a,[["enter",f,t]]),a=Se(a,On(t.parser.constructs.insideSpan.null,e.slice(s+r+4,i-3),t)),a=Se(a,[["exit",f,t],e[i-2],e[i-1],["exit",u,t]]),a=Se(a,e.slice(i+1)),a=Se(a,[["exit",c,t]]),pe(e,s,e.length,a),e}function vb(e,t,n){let r=this,o=r.events.length,s,i;for(;o--;)if((r.events[o][1].type==="labelImage"||r.events[o][1].type==="labelLink")&&!r.events[o][1]._balanced){s=r.events[o][1];break}return a;function a(p){return s?s._inactive?l(p):(i=r.parser.defined.includes(_r(r.sliceSerialize({start:s.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(p),e.exit("labelMarker"),e.exit("labelEnd"),c):n(p)}function c(p){return p===40?e.attempt(_b,f,i?f:l)(p):p===91?e.attempt(Sb,f,i?u:l)(p):i?f(p):l(p)}function u(p){return e.attempt(Eb,f,l)(p)}function f(p){return t(p)}function l(p){return s._balanced=!0,n(p)}}function Rb(e,t,n){return r;function r(l){return e.enter("resource"),e.enter("resourceMarker"),e.consume(l),e.exit("resourceMarker"),o}function o(l){return ie(l)?Ht(e,s)(l):s(l)}function s(l){return l===41?f(l):us(e,i,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(l)}function i(l){return ie(l)?Ht(e,c)(l):f(l)}function a(l){return n(l)}function c(l){return l===34||l===39||l===40?fs(e,u,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(l):f(l)}function u(l){return ie(l)?Ht(e,f)(l):f(l)}function f(l){return l===41?(e.enter("resourceMarker"),e.consume(l),e.exit("resourceMarker"),e.exit("resource"),t):n(l)}}function Db(e,t,n){let r=this;return o;function o(a){return ls.call(r,e,s,i,"reference","referenceMarker","referenceString")(a)}function s(a){return r.parser.defined.includes(_r(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function i(a){return n(a)}}function Ib(e,t,n){return r;function r(s){return e.enter("reference"),e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),o}function o(s){return s===93?(e.enter("referenceMarker"),e.consume(s),e.exit("referenceMarker"),e.exit("reference"),t):n(s)}}var oa={name:"labelStartImage",resolveAll:Yt.resolveAll,tokenize:Cb};function Cb(e,t,n){let r=this;return o;function o(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),s}function s(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),i):n(a)}function i(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}var sa={name:"labelStartLink",resolveAll:Yt.resolveAll,tokenize:Tb};function Tb(e,t,n){let r=this;return o;function o(i){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(i),e.exit("labelMarker"),e.exit("labelLink"),s}function s(i){return i===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(i):t(i)}}var Rr={name:"lineEnding",tokenize:Ob};function Ob(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),M(e,t,"linePrefix")}}var Xt={name:"thematicBreak",tokenize:Nb};function Nb(e,t,n){let r=0,o;return s;function s(u){return e.enter("thematicBreak"),i(u)}function i(u){return o=u,a(u)}function a(u){return u===o?(e.enter("thematicBreakSequence"),c(u)):r>=3&&(u===null||C(u))?(e.exit("thematicBreak"),t(u)):n(u)}function c(u){return u===o?(e.consume(u),r++,c):(e.exit("thematicBreakSequence"),F(u)?M(e,a,"whitespace")(u):a(u))}}var ge={continuation:{tokenize:Pb},exit:Mb,name:"list",tokenize:Lb},zb={partial:!0,tokenize:Bb},$b={partial:!0,tokenize:Fb};function Lb(e,t,n){let r=this,o=r.events[r.events.length-1],s=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,i=0;return a;function a(d){let w=r.containerState.type||(d===42||d===43||d===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!r.containerState.marker||d===r.containerState.marker:Er(d)){if(r.containerState.type||(r.containerState.type=w,e.enter(w,{_container:!0})),w==="listUnordered")return e.enter("listItemPrefix"),d===42||d===45?e.check(Xt,n,u)(d):u(d);if(!r.interrupt||d===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),c(d)}return n(d)}function c(d){return Er(d)&&++i<10?(e.consume(d),c):(!r.interrupt||i<2)&&(r.containerState.marker?d===r.containerState.marker:d===41||d===46)?(e.exit("listItemValue"),u(d)):n(d)}function u(d){return e.enter("listItemMarker"),e.consume(d),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||d,e.check(Mt,r.interrupt?n:f,e.attempt(zb,p,l))}function f(d){return r.containerState.initialBlankLine=!0,s++,p(d)}function l(d){return F(d)?(e.enter("listItemPrefixWhitespace"),e.consume(d),e.exit("listItemPrefixWhitespace"),p):n(d)}function p(d){return r.containerState.size=s+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(d)}}function Pb(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(Mt,o,s);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,M(e,t,"listItemIndent",r.containerState.size+1)(a)}function s(a){return r.containerState.furtherBlankLines||!F(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,i(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt($b,t,i)(a))}function i(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,M(e,e.attempt(ge,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function Fb(e,t,n){let r=this;return M(e,o,"listItemIndent",r.containerState.size+1);function o(s){let i=r.events[r.events.length-1];return i&&i[1].type==="listItemIndent"&&i[2].sliceSerialize(i[1],!0).length===r.containerState.size?t(s):n(s)}}function Mb(e){e.exit(this.containerState.type)}function Bb(e,t,n){let r=this;return M(e,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function o(s){let i=r.events[r.events.length-1];return!F(s)&&i&&i[1].type==="listItemPrefixWhitespace"?t(s):n(s)}}var ds={name:"setextUnderline",resolveTo:qb,tokenize:Zb};function qb(e,t){let n=e.length,r,o,s;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(o=n)}else e[n][1].type==="content"&&e.splice(n,1),!s&&e[n][1].type==="definition"&&(s=n);let i={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[o][1].type="setextHeadingText",s?(e.splice(o,0,["enter",i,t]),e.splice(s+1,0,["exit",e[r][1],t]),e[r][1].end={...e[s][1].end}):e[r][1]=i,e.push(["exit",i,t]),e}function Zb(e,t,n){let r=this,o;return s;function s(u){let f=r.events.length,l;for(;f--;)if(r.events[f][1].type!=="lineEnding"&&r.events[f][1].type!=="linePrefix"&&r.events[f][1].type!=="content"){l=r.events[f][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||l)?(e.enter("setextHeadingLine"),o=u,i(u)):n(u)}function i(u){return e.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===o?(e.consume(u),a):(e.exit("setextHeadingLineSequence"),F(u)?M(e,c,"lineSuffix")(u):c(u))}function c(u){return u===null||C(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}var Lp={tokenize:Ub};function Ub(e){let t=this,n=e.attempt(Mt,r,e.attempt(this.parser.constructs.flowInitial,o,M(e,e.attempt(this.parser.constructs.flow,o,e.attempt(Hi,o)),"linePrefix")));return n;function r(s){if(s===null){e.consume(s);return}return e.enter("lineEndingBlank"),e.consume(s),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function o(s){if(s===null){e.consume(s);return}return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),t.currentConstruct=void 0,n}}var Pp={resolveAll:qp()},Fp=Bp("string"),Mp=Bp("text");function Bp(e){return{resolveAll:qp(e==="text"?jb:void 0),tokenize:t};function t(n){let r=this,o=this.parser.constructs[e],s=n.attempt(o,i,a);return i;function i(f){return u(f)?s(f):a(f)}function a(f){if(f===null){n.consume(f);return}return n.enter("data"),n.consume(f),c}function c(f){return u(f)?(n.exit("data"),s(f)):(n.consume(f),c)}function u(f){if(f===null)return!0;let l=o[f],p=-1;if(l)for(;++p<l.length;){let d=l[p];if(!d.previous||d.previous.call(r,r.previous))return!0}return!1}}}function qp(e){return t;function t(n,r){let o=-1,s;for(;++o<=n.length;)s===void 0?n[o]&&n[o][1].type==="data"&&(s=o,o++):(!n[o]||n[o][1].type!=="data")&&(o!==s+2&&(n[s][1].end=n[o-1][1].end,n.splice(s+2,o-s-2),o=s+2),s=void 0);return e?e(n,r):n}}function jb(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){let r=e[n-1][1],o=t.sliceStream(r),s=o.length,i=-1,a=0,c;for(;s--;){let u=o[s];if(typeof u=="string"){for(i=u.length;u.charCodeAt(i-1)===32;)a++,i--;if(i)break;i=-1}else if(u===-2)c=!0,a++;else if(u!==-1){s++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){let u={type:n===e.length||c||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:s?i:r.start._bufferIndex+i,_index:r.start._index+s,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...u.start},r.start.offset===r.end.offset?Object.assign(r,u):(e.splice(n,0,["enter",u,t],["exit",u,t]),n+=2)}n++}return e}var ia={};wa(ia,{attentionMarkers:()=>Yb,contentInitial:()=>Qb,disable:()=>Xb,document:()=>Vb,flow:()=>Jb,flowInitial:()=>Gb,insideSpan:()=>Hb,string:()=>Wb,text:()=>Kb});var Vb={42:ge,43:ge,45:ge,48:ge,49:ge,50:ge,51:ge,52:ge,53:ge,54:ge,55:ge,56:ge,57:ge,62:rs},Qb={91:Yi},Gb={[-2]:kr,[-1]:kr,32:kr},Jb={35:ea,42:Xt,45:[ds,Xt],60:na,61:ds,95:Xt,96:is,126:is},Wb={38:ss,92:os},Kb={[-5]:Rr,[-4]:Rr,[-3]:Rr,33:oa,38:ss,42:Ar,60:[Wi,ra],91:sa,92:[Xi,os],93:Yt,95:Ar,96:Ki},Hb={null:[Ar,Pp]},Yb={null:[42,95]},Xb={null:[]};function Zp(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},o={},s=[],i=[],a=[],c=!0,u={attempt:I(R),check:I(v),consume:E,enter:_,exit:x,interrupt:I(v,{interrupt:!0})},f={code:null,containerState:{},defineSkip:m,events:[],now:y,parser:e,previous:null,sliceSerialize:w,sliceStream:h,write:d},l=t.tokenize.call(f,u),p;return t.resolveAll&&s.push(t),f;function d(z){return i=Se(i,z),A(),i[i.length-1]!==null?[]:(P(t,0),f.events=On(s,f.events,f),f.events)}function w(z,Z){return tw(h(z),Z)}function h(z){return ew(i,z)}function y(){let{_bufferIndex:z,_index:Z,line:q,column:ne,offset:ue}=r;return{_bufferIndex:z,_index:Z,line:q,column:ne,offset:ue}}function m(z){o[z.line]=z.column,O()}function A(){let z;for(;r._index<i.length;){let Z=i[r._index];if(typeof Z=="string")for(z=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===z&&r._bufferIndex<Z.length;)S(Z.charCodeAt(r._bufferIndex));else S(Z)}}function S(z){c=void 0,p=z,l=l(z)}function E(z){C(z)?(r.line++,r.column=1,r.offset+=z===-3?2:1,O()):z!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===i[r._index].length&&(r._bufferIndex=-1,r._index++)),f.previous=z,c=!0}function _(z,Z){let q=Z||{};return q.type=z,q.start=y(),f.events.push(["enter",q,f]),a.push(q),q}function x(z){let Z=a.pop();return Z.end=y(),f.events.push(["exit",Z,f]),Z}function R(z,Z){P(z,Z.from)}function v(z,Z){Z.restore()}function I(z,Z){return q;function q(ne,ue,ut){let bt,g,Ke,qt;return Array.isArray(ne)?Be(ne):"tokenize"in ne?Be([ne]):b(ne);function b(ye){return hs;function hs(Zt){let Tr=Zt!==null&&ye[Zt],Or=Zt!==null&&ye.null,pm=[...Array.isArray(Tr)?Tr:Tr?[Tr]:[],...Array.isArray(Or)?Or:Or?[Or]:[]];return Be(pm)(Zt)}}function Be(ye){return bt=ye,g=0,ye.length===0?ut:Cr(ye[g])}function Cr(ye){return hs;function hs(Zt){return qt=Q(),Ke=ye,ye.partial||(f.currentConstruct=ye),ye.name&&f.parser.constructs.disable.null.includes(ye.name)?ba(Zt):ye.tokenize.call(Z?Object.assign(Object.create(f),Z):f,u,dm,ba)(Zt)}}function dm(ye){return c=!0,z(Ke,qt),ue}function ba(ye){return c=!0,qt.restore(),++g<bt.length?Cr(bt[g]):ut}}}function P(z,Z){z.resolveAll&&!s.includes(z)&&s.push(z),z.resolve&&pe(f.events,Z,f.events.length-Z,z.resolve(f.events.slice(Z),f)),z.resolveTo&&(f.events=z.resolveTo(f.events,f))}function Q(){let z=y(),Z=f.previous,q=f.currentConstruct,ne=f.events.length,ue=Array.from(a);return{from:ne,restore:ut};function ut(){r=z,f.previous=Z,f.currentConstruct=q,f.events.length=ne,a=ue,O()}}function O(){r.line in o&&r.column<2&&(r.column=o[r.line],r.offset+=o[r.line]-1)}}function ew(e,t){let n=t.start._index,r=t.start._bufferIndex,o=t.end._index,s=t.end._bufferIndex,i;if(n===o)i=[e[n].slice(r,s)];else{if(i=e.slice(n,o),r>-1){let a=i[0];typeof a=="string"?i[0]=a.slice(r):i.shift()}s>0&&i.push(e[o].slice(0,s))}return i}function tw(e,t){let n=-1,r=[],o;for(;++n<e.length;){let s=e[n],i;if(typeof s=="string")i=s;else switch(s){case-5:{i="\r";break}case-4:{i=`
196
+ `;break}case-3:{i=`\r
197
+ `;break}case-2:{i=t?" ":" ";break}case-1:{if(!t&&o)continue;i=" ";break}default:i=String.fromCharCode(s)}o=s===-2,r.push(i)}return r.join("")}function aa(e){let r={constructs:Ep([ia,...(e||{}).extensions||[]]),content:o(Cp),defined:[],document:o(Op),flow:o(Lp),lazy:{},string:o(Fp),text:o(Mp)};return r;function o(s){return i;function i(a){return Zp(r,s,a)}}}function ca(e){for(;!cs(e););return e}var Up=/[\0\t\n\r]/g;function ua(){let e=1,t="",n=!0,r;return o;function o(s,i,a){let c=[],u,f,l,p,d;for(s=t+(typeof s=="string"?s.toString():new TextDecoder(i||void 0).decode(s)),l=0,t="",n&&(s.charCodeAt(0)===65279&&l++,n=void 0);l<s.length;){if(Up.lastIndex=l,u=Up.exec(s),p=u&&u.index!==void 0?u.index:s.length,d=s.charCodeAt(p),!u){t=s.slice(l);break}if(d===10&&l===p&&r)c.push(-3),r=void 0;else switch(r&&(c.push(-5),r=void 0),l<p&&(c.push(s.slice(l,p)),e+=p-l),d){case 0:{c.push(65533),e++;break}case 9:{for(f=Math.ceil(e/4)*4,c.push(-2);e++<f;)c.push(-1);break}case 10:{c.push(-4),e=1;break}default:r=!0,e=1}l=p+1}return a&&(r&&c.push(-5),t&&c.push(t),c.push(null)),c}}var nw=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function jp(e){return e.replace(nw,rw)}function rw(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){let o=n.charCodeAt(1),s=o===120||o===88;return Ap(n.slice(s?2:1),s?16:10)}return ns(n)||e}var Vp=({markdown:e,references:t,assetUrls:n})=>{let r=e.length,o=e;for(let s of[...t].sort((i,a)=>a.start-i.start)){if(s.start<0||s.end<=s.start||s.end>e.length||s.end>r)throw new Error("Markdown asset reference range is invalid");r=s.start;let i=n[s.assetId];if(i===void 0)continue;let a=Wo(i,s.suffix);o=`${o.slice(0,s.start)}${a}${o.slice(s.end)}`}return o};var ow=e=>{let t=ca(aa().document().write(ua()(e,void 0,!0))),n=[];for(let[r,o]of t){if(r!=="enter"||o.type!=="resourceDestinationString"&&o.type!=="definitionDestinationString")continue;let s=e.slice(o.start.offset,o.end.offset);n.push({start:o.start.offset,end:o.end.offset,url:jp(s)})}return n},Qp=({markdown:e,sourcePath:t,assetIdsByPath:n})=>{let r=Yd({assetIdsByPath:n,sourcePath:t});return ow(e).flatMap(({start:o,end:s,url:i})=>{let a=r(i);return a===void 0?[]:[{start:o,end:s,...a}]})};var ce=class extends Error{code;details;constructor({code:t,message:n,details:r}){super(n),this.name="AssetResourceHydrationError",this.code=t,this.details=r}},sw=e=>{if(e===null)return[];let t=Array.isArray(e)?e:[e],n=new Map;for(let r of t){if(typeof r!="object"||r===null||!("_id"in r)||typeof r._id!="string"||!("revision"in r)||typeof r.revision!="string"||!("contentRef"in r)||typeof r.contentRef!="string")throw new ce({code:"CONTENT_IDENTITY_REQUIRED",message:"Hydrated query results must retain _id, revision, and contentRef"});let o=n.get(r._id);if(o!==void 0&&(o.revision!==r.revision||o.contentRef!==r.contentRef))throw new ce({code:"CONTENT_IDENTITY_REQUIRED",message:"A selected asset ID has conflicting content identity",details:{assetId:r._id}});n.set(r._id,{_id:r._id,revision:r.revision,contentRef:r.contentRef})}return Array.from(n.values())},iw=e=>typeof e.mimeType=="string"&&(e.mimeType.startsWith("text/")||["application/json","application/javascript","application/xml","image/svg+xml"].includes(e.mimeType)),aw=async({read:e,contentRef:t,range:n,maximumBytes:r})=>{if(r===0)return new Uint8Array;let o=await e(t,n);try{return await Xe(o.data,r)}catch(s){throw s instanceof we?new ce({code:"CONTENT_LIMIT_EXCEEDED",message:"Asset storage returned more content than requested"}):s}},cw=e=>{try{return ve(e)}catch{throw new ce({code:"CONTENT_DECODING_FAILED",message:"Selected asset content is not valid UTF-8"})}},uw=(e,t)=>{if(t.mode==="range")return Math.max(0,Math.min(t.length,e.size-t.offset));let n=t.maxBytes??N.hydratedFileBytes;if(e.size>n)throw new ce({code:"CONTENT_LIMIT_EXCEEDED",message:"Selected asset exceeds the per-file content limit",details:{assetId:e._id,assetBytes:e.size,fileByteLimit:n}});return e.size},Gp=e=>{let t=e.flatMap(({reason:s,document:i})=>{if(typeof i.path!="string")return[];let a=s instanceof ce?s.code:"CONTENT_READ_FAILED",c=s instanceof Error&&s.message!==""?s.message:"Selected asset content could not be read";return[{severity:"error",scope:"query",phase:"source",code:a,message:c,assetId:i._id,path:i.path}]});if(t.length!==e.length)throw e[0].reason;if(e.length===1){let s=e[0].reason,i=t[0];throw i===void 0?s:new ce({code:s instanceof ce?s.code:"INVALID_REQUEST",message:i.message,details:{...s instanceof ce?s.details:{},diagnostics:t}})}let n=new Set(t.map(({code:s})=>s)),r=t[0]?.code,o=n.size===1&&(r==="CONTENT_IDENTITY_REQUIRED"||r==="CONTENT_NOT_TEXT"||r==="CONTENT_DECODING_FAILED"||r==="CONTENT_LIMIT_EXCEEDED")?r:"INVALID_REQUEST";throw new ce({code:o,message:`${t.length} selected asset content errors found`,details:{diagnostics:t}})},Jp=async({result:e,documents:t,options:n,read:r,assetReferences:o,assetUrls:s,assetPaths:i})=>{if(n.mode==="none")return{content:{},hydratedFileCount:0,hydratedBytes:0};let a=sw(e);if(a.length>N.hydratedFileCount)throw new ce({code:"CONTENT_LIMIT_EXCEEDED",message:"Too many selected assets requested content hydration",details:{fileCount:a.length,fileCountLimit:N.hydratedFileCount}});let c=new Map(t.map(m=>[m._id,m])),u=a.map(m=>{let A=c.get(m._id);try{if(A===void 0||A.revision!==m.revision||A.contentRef!==m.contentRef||typeof A.size!="number"||typeof A.mimeType!="string")throw new ce({code:"CONTENT_IDENTITY_REQUIRED",message:"Selected asset content identity is stale or unavailable",details:{assetId:m._id}});let S={...A,size:A.size,mimeType:A.mimeType};if(iw(S)===!1)throw new ce({code:"CONTENT_NOT_TEXT",message:"Selected binary asset cannot be embedded as text",details:{assetId:m._id,mimeType:S.mimeType}});return{status:"fulfilled",value:{identity:m,document:S,readLength:uw(S,n)}}}catch(S){return{status:"rejected",reason:S,document:A??{_id:m._id}}}}),f=u.flatMap(m=>m.status==="rejected"?[m]:[]);f.length>0&&Gp(f);let l=u.flatMap(m=>m.status==="fulfilled"?[m.value]:[]),p=l.reduce((m,A)=>m+A.readLength,0);if(p>N.hydratedTotalBytes)throw new ce({code:"CONTENT_LIMIT_EXCEEDED",message:"Selected assets exceed the total hydrated-content limit",details:{totalReadBytes:p,totalByteLimit:N.hydratedTotalBytes}});let d=i===void 0?void 0:Jo(Object.entries(i).map(([m,A])=>({id:m,path:A}))),w=await oo(l,N.concurrentContentReads,async m=>{try{let A=n.mode==="range"?{offset:n.offset,length:m.readLength}:m.readLength===0?void 0:{offset:0,length:m.readLength},S=await aw({read:r,contentRef:m.identity.contentRef,range:A,maximumBytes:m.readLength});if(S.byteLength!==m.readLength)throw new ce({code:"CONTENT_IDENTITY_REQUIRED",message:"Selected asset bytes do not match canonical metadata",details:{assetId:m.identity._id}});let E;if(n.mode==="markdown-body-ref")try{E=(await jo(S,m.readLength||1)).body;let x=d===void 0||m.document.path===void 0?o?.[m.identity.contentRef]:Qp({markdown:E,sourcePath:m.document.path,assetIdsByPath:d});x!==void 0&&s!==void 0&&(E=Vp({markdown:E,references:x,assetUrls:s}))}catch{throw new ce({code:"CONTENT_DECODING_FAILED",message:"Selected Markdown body could not be decoded",details:{assetId:m.identity._id}})}else E=cw(S);let _=Ye(E);return{status:"fulfilled",value:{id:m.identity._id,returnedBytes:_,content:{...m.identity,encoding:"utf-8",text:E,...n.mode==="range"?{range:{offset:n.offset,length:S.byteLength,total:m.document.size}}:{}}}}}catch(A){return{status:"rejected",reason:A,document:m.document}}}),h=w.flatMap(m=>m.status==="rejected"?[m]:[]);h.length>0&&Gp(h);let y=w.flatMap(m=>m.status==="fulfilled"?[m.value]:[]);return{content:Object.fromEntries(y.map(({id:m,content:A})=>[m,A])),hydratedFileCount:l.length,hydratedBytes:y.reduce((m,{returnedBytes:A})=>m+A,0)}};var tO=D().datetime({offset:!0}).transform(e=>new Date(e).toISOString());var lw=/^[A-Za-z_][A-Za-z0-9_]*$/,Wp=(e,t)=>lw.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`;var Kp=({document:e,includes:t})=>{let n={};for(let r of Ff){let o=e[r];o!==void 0&&t(r)&&(n[r]=o)}return n},Bt=Symbol("missing property selection"),la=(e,t)=>{if(t.some(r=>r.length===0)||typeof io(e)=="string")return e;if(Array.isArray(e)){let r=t.filter(([s])=>s==="*").map(s=>s.slice(1));if(r.length===0)return Bt;let o=e.map(s=>la(s,r));return o.some(s=>s!==Bt)?o.map(s=>s===Bt?null:s):Bt}if(typeof e!="object"||e===null)return Bt;let n={};for(let[r,o]of Object.entries(e)){let s=t.filter(([a])=>a===r).map(a=>a.slice(1));if(s.length===0)continue;let i=la(o,s);i!==Bt&&(n[r]=i)}return Object.keys(n).length===0?Bt:n},Hp=({properties:e,fields:t})=>{let n=t.filter(([o])=>o==="properties").map(o=>o.slice(1)),r=la(e,n);return r===Bt?{}:r};var Me=class extends Error{code;issues;details;constructor(t,n){super(t,n),this.name="AssetQueryExecutionError",this.code=n?.code??"INVALID_REQUEST",this.issues=n?.issues,this.details=n?.details}},Dr=class extends Me{code="MULTIPLE_RESULTS";matchedCount;constructor(t){super(`Expected at most one asset, but the query matched ${t}.`),this.matchedCount=t,this.name="AssetQueryMultipleResultsError"}},zn=class extends Error{constructor(){super("The requested asset index revision is stale"),this.name="AssetIndexRevisionError"}},fa=e=>{if(e[0]!=="properties")return e[0];let t="properties";for(let n of e.slice(1))t=Wp(t,n);return t},Yp=({filter:e,fieldTypes:t})=>qf(t).includes(e.operator),Xp=(e,t)=>e!==void 0&&Object.hasOwn(e.fields,t)?e.fields[t]:void 0,fw=e=>{if(e===null)return"null";if(Array.isArray(e))return"array";if(typeof e=="object")return"object";if(typeof e=="boolean")return"boolean";if(typeof e=="number")return"number";if(typeof e=="string")return"string"},dw=({operator:e,fieldTypes:t})=>{if(!(e==="contains"&&t.includes("array"))){if(e==="startsWith"||e==="endsWith"||e==="contains")return["string"];if(e==="gt"||e==="gte"||e==="lt"||e==="lte")return t.filter(n=>n==="string"||n==="number");if(e==="eq"||e==="ne"||e==="in")return t}},em=({filter:e,fieldTypes:t,path:n})=>{let r=dw({operator:e.operator,fieldTypes:t});return r===void 0?[]:(e.operator==="in"?e.value:[e.value]).flatMap((s,i)=>r.some(a=>a===fw(s))?[]:[e.operator==="in"?[...n,"value",String(i)]:[...n,"value"]])},pa=(e,t=["query","where"])=>"field"in e?[{filter:e,path:t}]:"all"in e?e.all.flatMap((n,r)=>pa(n,[...t,"all",String(r)])):e.any.flatMap((n,r)=>pa(n,[...t,"any",String(r)])),pw=({query:e,catalog:t})=>{let n=Rt.safeParse(e);if(n.success===!1)return{success:!1,issues:n.error.issues.map(u=>({severity:"error",code:u.code,path:["query",...u.path.map(String)],message:u.message}))};let r=n.data,o=new Map,s=[],i=[],a=(u,f,l)=>{s.push(l),i.push({severity:"warning",code:u,path:f,message:l})};for(let{filter:u,path:f}of pa(r.where)){let l=fa(u.field);if(o.set(l,u.field),u.field[0]==="properties"){let p=Xp(t,l);if(t!==void 0&&p===void 0)a("UNOBSERVED_FIELD",[...f,"field"],`Asset field ${l} is not currently observed`);else if(p!==void 0&&Yp({filter:u,fieldTypes:p.types})===!1)a("INCOMPATIBLE_OBSERVED_TYPES",[...f,"operator"],`Operator ${u.operator} is not compatible with the currently observed types of ${l}`);else if(p!==void 0)for(let d of em({filter:u,fieldTypes:p.types,path:f}))a("INCOMPATIBLE_OBSERVED_VALUE",d,`Filter value is not compatible with the currently observed types of ${l}`)}else{let p=ai[u.field[0]];if(Yp({filter:u,fieldTypes:p})===!1)i.push({severity:"error",code:"INCOMPATIBLE_OPERATOR",path:[...f,"operator"],message:`Operator ${u.operator} is incompatible with ${l}`});else for(let d of em({filter:u,fieldTypes:p,path:f}))i.push({severity:"error",code:"INCOMPATIBLE_VALUE",path:d,message:`Filter value is incompatible with ${l}`})}}for(let[u,f]of r.sort.entries()){let l=fa(f.field);if(o.set(l,f.field),f.field[0]==="properties"){let p=Xp(t,l);t!==void 0&&p===void 0?a("UNOBSERVED_FIELD",["query","sort",String(u),"field"],`Asset field ${l} is not currently observed`):p!==void 0&&p.types.some(d=>d==="object"||d==="array")&&a("STRUCTURED_SORT_ORDER",["query","sort",String(u),"field"],`Asset field ${l} currently includes structured values that use deterministic JSON sort order`)}}if(r.output.mode==="fields")for(let u of r.output.fields){let f=fa(u);o.set(f,u)}let c=[...new Map(i.map(u=>[JSON.stringify([u.code,u.path,u.message]),u])).values()];return{success:c.some(({severity:u})=>u==="error")===!1,query:r,referencedFieldPaths:[...o.values()],warnings:[...new Set(s)],issues:c}},mw=({query:e,catalog:t})=>{let n=pw({query:e,catalog:t});if(n.success===!1){let r=n.issues.filter(({severity:o})=>o==="error");throw new Me(r.length===1?r[0].message:`${r.length} invalid query operations found`,{issues:n.issues})}return{query:n.query,referencedFieldPaths:n.referencedFieldPaths,warnings:n.warnings,warningIssues:n.issues}},ma=(e,t,n)=>{let r=t[0]==="id"?e._id:ro(t[0])?n?.[t[0]]:e[t[0]];for(let o of t.slice(1)){if(typeof r!="object"||r===null||Object.hasOwn(r,o)===!1)return;r=r[o]}return r},hw=e=>typeof e=="string"||Array.isArray(e)?e.length===0:typeof e=="object"&&e!==null&&Object.keys(e).length===0,gw=(e,t)=>{if(typeof e=="number"&&typeof t=="number")return e-t;if(typeof e=="string"&&typeof t=="string")return et(e,t)},tm=(e,t)=>{if(e.field.length!==1||e.field[0]!=="path"||typeof t!="string")return[t];let n=Wd(t);return n===t?[t]:[t,n]},ha=(e,t,n)=>{let r=ma(e,t.field,n);if(t.operator==="exists")return r!=null===t.value;if(t.operator==="isEmpty")return hw(r)===t.value;let o=tm(t,t.value);if(t.operator==="eq")return o.some(i=>Kn(r,i));if(t.operator==="ne")return o.every(i=>Kn(r,i)===!1);if(t.operator==="in")return t.value.some(i=>tm(t,i).some(a=>Kn(r,a)));if(t.operator==="contains")return typeof r=="string"?o.some(i=>typeof i=="string"&&r.includes(i)):Array.isArray(r)&&r.some(i=>Kn(i,t.value));if(t.operator==="startsWith")return typeof r=="string"&&o.some(i=>typeof i=="string"&&r.startsWith(i));if(t.operator==="endsWith")return typeof r=="string"&&o.some(i=>typeof i=="string"&&r.endsWith(i));let s=gw(r,o[o.length-1]);return s===void 0?!1:t.operator==="gt"?s>0:t.operator==="gte"?s>=0:t.operator==="lt"?s<0:s<=0},yw=({document:e,where:t,runtimeAsset:n,filterKeys:r,filterResults:o})=>un(t,s=>{let i=r.get(s)??Re(s),a=o.get(i);if(a!==void 0)return a;let c=ha(e,s,n);return o.set(i,c),c})===!0,bw=({document:e,content:t})=>{if(t.mode!=="markdown-body-ref")return!0;let n=e.mimeType===void 0?void 0:Df(e.mimeType);return n==="markdown"||n==="mdx"?!0:e.extension==="md"||e.extension==="mdx"},ww=(e,t)=>{let n=e==null,r=t==null;return n||r?n===r?0:n?1:-1:typeof e=="number"&&typeof t=="number"?e-t:(typeof e=="string"||typeof e=="boolean")&&(typeof t=="string"||typeof t=="boolean")?et(String(e),String(t)):et(Re(e),Re(t))},xw=({left:e,right:t,sort:n,runtimeAssets:r})=>{for(let o of n){let s=ww(ma(e,o.field,r?.[e._id]),ma(t,o.field,r?.[t._id]));if(s!==0)return o.direction==="asc"?s:-s}return et(e._id,t._id)};var _w=(e,t)=>{if(e.properties===void 0)return;if(t.mode==="all")return Object.keys(e.properties).length===0?void 0:e.properties;if(t.mode!=="fields"||t.fields.some(r=>r[0]==="properties")===!1)return;let n=Hp({properties:e.properties,fields:t.fields});return Object.keys(n).length===0?void 0:n},Nn=(e,t)=>e.includeMetadata&&Mf(t)||e.mode==="fields"&&e.fields.some(n=>n.length===1&&n[0]===t),Sw=e=>e.mode==="all"||e.mode==="fields"&&e.fields.some(t=>t.length===1&&t[0]==="excerpt"),Ew=(e,t,n)=>{if(Nn(t,"url")&&n===void 0)throw new Me(`Asset URL is unavailable for ${e._id}`,{details:{assetId:e._id}});let r=_w(e,t),o=n?.width!==void 0&&n.height!==void 0;return{...n!==void 0&&Nn(t,"url")?{url:n.url}:{},...o&&Nn(t,"width")?{width:n.width}:{},...o&&Nn(t,"height")?{height:n.height}:{},...Kp({document:e,includes:s=>Nn(t,s)}),...r===void 0?{}:{properties:r},...e.excerpt===void 0||Sw(t)===!1?{}:{excerpt:e.excerpt},...e.metadataError===void 0||t.includeMetadata===!1?{}:{metadataError:e.metadataError}}},ga=e=>{let t=Ye(Re(e));if(t>N.resultBytes)throw new Me("Asset query result exceeds the byte limit",{code:"CONTENT_LIMIT_EXCEEDED",details:{resultBytes:t,resultByteLimit:N.resultBytes}})},ps=(e,t,n)=>{e[t]={status:"rejected",reason:n}},Aw=({inputs:e,catalog:t,results:n})=>{let r=new Map,o=new Map,s=[];for(let[i,a]of e.entries()){let c;try{c=mw({query:a,catalog:t}).query}catch(l){ps(n,i,l);continue}for(let l of Kr(c.where))o.set(l,Re(l));let u=Re(c.sort),f=r.get(u);f===void 0&&(f={sort:c.sort,documents:new Set,sorted:[]},r.set(u,f)),s.push({index:i,query:c,matches:new Map,sortGroup:f})}return{filterKeys:o,preparedQueries:s,sortGroups:r}},nm=({preparedQueries:e,results:t,createReason:n})=>{for(let{index:r}of e)ps(t,r,n())},da=e=>e.map(t=>{if(t===void 0)throw new Error("Asset query result was not settled");return t}),kw=({preparedQueries:e,documents:t,filterKeys:n,sortGroups:r,results:o,runtimeAssets:s})=>{for(let i of t){let a=s?.[i._id],c=new Map;for(let u of e){if(o[u.index]!==void 0)continue;let{query:f}=u;try{if(bw({document:i,content:f.content})===!1||yw({document:i,where:f.where,runtimeAsset:a,filterKeys:n,filterResults:c})===!1)continue;let l=Ew(i,f.output,a);if(f.content.mode==="none"&&Object.keys(l).length===0&&f.output.mode!=="all"&&Nn(f.output,"id")===!1)continue;let p={document:i,item:{id:i._id,...l}};u.matches.set(i,p),u.sortGroup.documents.add(i)}catch(l){ps(o,u.index,l)}}}for(let i of r.values())i.sorted=[...i.documents].sort((a,c)=>xw({left:a,right:c,sort:i.sort,runtimeAssets:s}))},vw=async({preparedQueries:e,results:t,read:n,assetReferences:r,assetUrls:o,assetPaths:s})=>{await Promise.all(e.map(async i=>{if(t[i.index]!==void 0)return;let{query:a}=i;try{let c=i.sortGroup.sorted.flatMap(w=>{let h=i.matches.get(w);return h===void 0?[]:[h]}),u=a.result??"many";if(u==="one"&&c.length>1)throw new Dr(c.length);let f=u==="many"?c.slice(a.offset,a.offset+a.limit):u==="last"?c.slice(-1):c.slice(0,1),l=f.map(({document:w})=>w),p=f.map(({item:w})=>w);if(a.content.mode!=="none"){let w=a.content;if(n===void 0)throw new Me("Asset content reader is unavailable");let h=await Jp({result:l,documents:l,options:w,read:n,assetReferences:r,assetUrls:o,assetPaths:s});p=l.map((y,m)=>{let A=h.content[y._id];if(A===void 0)throw new Me("Selected asset content could not be read");return{...p[m],content:{encoding:A.encoding,text:A.text,...A.range===void 0?{}:{range:A.range}}}})}let d=u==="many"?{items:p,totalCount:c.length,hasMore:a.offset+f.length<c.length}:{item:p[0]??null,totalCount:c.length};ga(d),t[i.index]={status:"fulfilled",value:d}}catch(c){ps(t,i.index,c)}}))},rm=async({queries:e,catalog:t,documents:n,read:r,runtimeAssets:o,assetReferences:s,assetValueReferences:i,assetPaths:a})=>{let c=Array.from({length:e.length}),{filterKeys:u,preparedQueries:f,sortGroups:l}=Aw({inputs:e,catalog:t,results:c});if(n.length>N.candidateDocuments)return nm({preparedQueries:f,results:c,createReason:()=>new Me("Asset query document limit was exceeded",{code:"CONTENT_LIMIT_EXCEEDED",details:{documentCount:n.length,documentLimit:N.candidateDocuments}})}),da(c);let p;try{p=n.map(w=>Lt({value:w,references:i?.[w._id],runtimeAssets:o??{}}))}catch(w){return nm({preparedQueries:f,results:c,createReason:()=>w}),da(c)}kw({preparedQueries:f,documents:p,filterKeys:u,sortGroups:l,results:c,runtimeAssets:o});let d=Xd(o);return await vw({preparedQueries:f,results:c,read:r,assetReferences:s,assetUrls:d,assetPaths:a}),da(c)};var Rw=async e=>await Af(Re(Rt.parse(e)));var Dw=({item:e,field:t,value:n})=>{let r=e;for(let[o,s]of t.entries()){if(o===t.length-1){Object.defineProperty(r,s,{value:n,enumerable:!0,configurable:!0,writable:!0});return}let i=Object.hasOwn(r,s)?r[s]:void 0;if(typeof i=="object"&&i!==null){r=i;continue}let a={};Object.defineProperty(r,s,{value:a,enumerable:!0,configurable:!0,writable:!0}),r=a}},Iw=e=>ci.parse({items:e.rows.map(t=>{let n={};for(let[r,o]of e.fields.entries())Dw({item:n,field:o,value:t[r]});return n}),totalCount:e.totalCount,hasMore:e.hasMore}),om=async({queries:e,query:t,assetValueReferences:n,runtimeAssets:r={}})=>{if(e===void 0)return;let o=e[await Rw(Rt.parse(t))];if(o===void 0)return;let s=Iw(o),i={...s,items:s.items.map(a=>Lt({value:a,references:n?.[a.id],runtimeAssets:r}))};return ga(i),i};var Cw=({graph:e,load:t,getCached:n,readFallback:r,signal:o})=>{let s=new Map(e.nodes.map(i=>[i.contentRef,i]));return async(i,a)=>{let c=s.get(i);if(c===void 0){if(r!==void 0)return await r(i,a);throw new Error(`Document content reference ${i} is unavailable`)}let u=vn({node:c,source:n(c)??await t(c,{signal:o})});return{data:Hr(u.source,a),...a===void 0?{}:{contentLength:a.length}}}},Tw=({artifact:e,revision:t,catalog:n,documentGraph:r,inlineDocuments:o,readContent:s})=>{let i=new Map(e.documents.map(_=>[_._id,_])),a=_=>{if(_.indexRevision!==void 0&&_.indexRevision!==t)throw new zn},c=_=>async(x,R)=>{let v=e.contents?.[x];if(v===void 0){let Q=_??s;if(Q===void 0)throw new Error("Content is not embedded in this database");return await Q(x,R)}let I=kt(v),P=R===void 0?I:I.slice(R.offset,R.offset+R.length);return{data:async function*(){yield P}(),contentLength:P.byteLength}},u=_=>{if(_.status==="rejected")throw _.reason;return _.value},f=async({requests:_,queryContentReader:x,runtimeAssets:R,documents:v=e.documents})=>await rm({queries:_.map(({query:I})=>I),catalog:n,documents:v,read:c(x),runtimeAssets:R,assetReferences:e.assetReferences,assetPaths:e.assetPaths,assetValueReferences:e.assetValueReferences}),l=async({request:_,...x})=>u((await f({...x,requests:[_]}))[0]),p=async({requests:_,queryContentReader:x,runtimeAssets:R})=>{let v=Array.from({length:_.length}),I=[];for(let[P,Q]of _.entries()){try{a(Q);let O=await om({queries:e.queries,query:Q.query,assetValueReferences:e.assetValueReferences,runtimeAssets:R});if(O!==void 0){v[P]={status:"fulfilled",value:O};continue}}catch(O){v[P]={status:"rejected",reason:O};continue}I.push(P)}if(I.length>0){let P=await f({requests:I.map(Q=>_[Q]),queryContentReader:x,runtimeAssets:R});for(let[Q,O]of I.entries())v[O]=P[Q]}return v.map(P=>{if(P===void 0)throw new Error("Content database query was not settled");return P})},d=async(_,x,R)=>u((await p({requests:[_],queryContentReader:x,runtimeAssets:R}))[0]),w=async(..._)=>await d(..._),h=_=>async(x,R)=>{let v=o?.get(x.id);return v!==void 0?{format:"json",revision:x.revision,source:JSON.stringify(v.properties)}:await _(x,R)},y=({graph:_,query:x,runtimeAssets:R})=>wp({graph:_,query:x}).filter(v=>{let I=i.get(v),P=I===void 0?void 0:Lt({value:I,references:e.assetValueReferences?.[v],runtimeAssets:R??{}});return P===void 0?!1:un(x.where,Q=>{if(!bp({graph:_,sourceId:v,field:Q.field}))return ha(P,Q,R?.[v])})!==!1}),m=({rootIds:_,roots:x})=>{let R=new Map(_.flatMap((v,I)=>{let P=Ho(x[I]);return P===void 0?[]:[[v,P]]}));return e.documents.map(v=>{let I=R.get(v._id);return I===void 0?v:ii.parse({...v,properties:I})})},A=async({request:_,graph:x,resolutionSession:R,contentReader:v,runtimeAssets:I,onEvent:P})=>{a(_);let Q=Rt.parse(_.query),O=y({graph:x,query:Q,runtimeAssets:I});if(O.length===0)return await d(_,v,I);let z=xp({graph:x,query:Q,rootIds:O});_e(P,{type:"roots-selected",rootCount:O.length});let Z=await R.resolve({graph:z,rootIds:O,onEvent:P,allowUnresolvedReferences:!0,transformDocument:({node:ne,document:ue})=>Ui({document:ue,references:e.assetValueReferences?.[ne.id],runtimeAssets:I})}),q=m({rootIds:O,roots:Z.roots});return await l({request:_,queryContentReader:v,runtimeAssets:I,documents:q})},S=async({requests:_,load:x,resolutionSession:R,readContent:v,runtimeAssets:I,signal:P,onEvent:Q})=>{if(r===void 0)return await p({requests:_,queryContentReader:v,runtimeAssets:I});let O=h(x),z=R??pp({load:O,concurrency:N.concurrentContentReads,signal:P}),Z=Cw({graph:r,load:O,getCached:z.getCached,readFallback:v??s,signal:P});return await Promise.allSettled(_.map(q=>A({request:q,graph:r,resolutionSession:z,contentReader:Z,runtimeAssets:I,onEvent:Q})))};return{query:w,queryManyWithDocumentGraph:S,queryWithDocumentGraph:async({request:_,...x})=>u((await S({...x,requests:[_]}))[0])}};var ya=({artifact:e,readContent:t})=>{let n=_p({artifact:e});return Tw({artifact:e,revision:e.revision,documentGraph:n?.graph,inlineDocuments:n?.inlineDocuments,readContent:t})};var $n=class extends Error{constructor(t,n){super(t,n),this.name="AssetQueryRequestError"}},Ir=class extends Error{},Ow=async(e,t)=>{if(Number.isSafeInteger(t)===!1||t<0)throw new TypeError("Request byte limit must be a non-negative integer");let n=Number(e.headers.get("content-length"));if(Number.isFinite(n)&&n>t)throw new Ir("Request exceeds the byte limit");let r=e.body?.getReader(),o=[],s=0;if(r!==void 0)for(;;){let{done:c,value:u}=await r.read();if(c)break;if(s+=u.byteLength,s>t){try{await r.cancel()}catch{}throw new Ir("Request exceeds the byte limit")}o.push(u)}let i=new Uint8Array(s),a=0;for(let c of o)i.set(c,a),a+=c.byteLength;return i},sm=async e=>{let t;try{t=await Ow(e,N.requestBytes)}catch(n){throw n instanceof Ir?new $n("Asset query request exceeds the byte limit",{cause:n}):n}try{return Zf.parse(JSON.parse(ve(t)))}catch(n){throw new $n("Asset query request is invalid",{cause:n})}};var im=e=>{if(!(e instanceof $n))return;let t=e.message,n=new Set,r=e.cause;for(;r instanceof Error&&n.has(r)===!1;){if(r instanceof Vl)return{code:"INVALID_REQUEST",message:e.message,retryable:!1,status:400,details:{issues:r.issues.map(o=>({code:o.code,path:o.path.map(String),message:o.message}))}};t=r.message,n.add(r),r=r.cause}return{code:"INVALID_REQUEST",message:t,retryable:!1,status:400}},am=e=>{if(e instanceof zn)return{code:"STALE_INDEX",message:e.message,retryable:!1,status:409};if(e instanceof Dr)return{code:e.code,message:e.message,retryable:!1,details:{matchedCount:e.matchedCount},status:409};if(e instanceof Me){let r={...e.details,...e.issues===void 0?{}:{issues:e.issues.map(o=>({...o,path:[...o.path]}))}};return{code:e.code,message:e.message,retryable:!1,...Object.keys(r).length===0?{}:{details:r},status:400}}if(e instanceof ce)return{code:e.code,message:e.message,retryable:!1,details:e.details,status:400};let t=new Set,n=e;for(;n!==void 0&&t.has(n)===!1;){if(n instanceof Kt){let r={};for(let[o,s]of Object.entries({assetId:n.documentId,documentCount:n.documentCount,documentLimit:n.documentLimit,contentByteLimit:n.contentByteLimit,totalBytes:n.totalBytes,totalByteLimit:n.totalByteLimit}))s!==void 0&&(r[o]=s);return{code:"CONTENT_LIMIT_EXCEEDED",message:n.message,retryable:!1,details:r,status:400}}if(n instanceof wr)return{code:"CONTENT_LIMIT_EXCEEDED",message:n.message,retryable:!1,details:{assetId:n.documentId,contentByteLimit:n.contentByteLimit},status:400};t.add(n),n=n instanceof Error?n.cause:void 0}};var Nw="/$resources/assets",zw="WEBSTUDIO_AUTOMATION_TOKEN",ms=e=>typeof e=="object"&&e!==null?e:void 0,$w=e=>{let t=ms(e),n=ms(t?.cloudflare),r=[t,ms(t?.env),ms(n?.env)];for(let o of r){let s=o?.[zw];if(typeof s=="string"&&s.length>0)return s}},cm=(e,t=200)=>new Response(JSON.stringify(e),{status:t,headers:{"content-type":"application/json; charset=utf-8"}}),Ln=({code:e,message:t,status:n,retryable:r=!1,details:o})=>cm(Vf({code:e,message:t,retryable:r,details:o}),n),Lw=(e,t,n)=>typeof e=="string"||e instanceof URL?new Request(new URL(e,t),n):new Request(e,n),Pw=async({deploymentId:e,artifact:t,request:n})=>{let r=await n.clone().text(),o=n.headers.get("cache-control"),s=await ri(JSON.stringify([e,t.revision,r,o])),i=new URL(n.url);return i.searchParams.set("ws-asset-resource",s),new Request(i,{method:"GET"})},YO=({deploymentId:e,artifact:t,runtimeAssets:n,cache:r,baseUrl:o,automationToken:s,fetchDocument:i=globalThis.fetch,onDocumentGraphEvent:a})=>{lm({artifact:t,runtimeAssets:n});let c=Qi();return fm({deploymentId:e,artifact:t,runtimeAssets:n,cache:r,baseUrl:o,automationToken:s,database:ya({artifact:t}),fetchDocument:i,documentCache:c,onDocumentGraphEvent:a})},um=({assetId:e,baseUrl:t,runtimeAssets:n,automationToken:r,authorization:o})=>{let s=n[e];if(s===void 0)throw new Error(`Published document URL is unavailable for ${e}`);let i=new Request(new URL(s.url,t));return i.headers.delete("referer"),r!==void 0&&i.headers.set("x-webstudio-automation",r),o!==void 0&&/^Basic\s/i.test(o)&&new URL(i.url).origin===new URL(t).origin?(i.headers.set("authorization",o),new Request(i,{redirect:"manual"})):i},Fw=({baseUrl:e,runtimeAssets:t,embeddedContents:n,automationToken:r,authorization:o,fetchDocument:s,cache:i,onEvent:a})=>{let c=op({fetch:s,getRequest:u=>um({assetId:u.id,baseUrl:e,runtimeAssets:t,automationToken:r,authorization:o}),getMetadata:({node:u})=>({format:u.format,revision:u.revision}),onEvent:a});return lp({cache:i,onEvent:a,load:async(u,f)=>{let l=u.format,p=l===void 0?void 0:n?.[u.contentRef];return p!==void 0&&l!==void 0?{format:l,revision:u.revision,source:kt(p)}:await c(u,f)}})},lm=({artifact:e,runtimeAssets:t})=>{let n=[e.assetReferences,e.assetValueReferences].flatMap(s=>Object.values(s??{}).flat()).map(({assetId:s})=>s).find(s=>t[s]===void 0);if(n!==void 0)throw new Error(`Published referenced asset URL is unavailable for ${n}`);let r=e.documentGraph?.nodes.find(({id:s})=>t[s]===void 0)?.id;if(r!==void 0)throw new Error(`Published document URL is unavailable for ${r}`);let o=e.documentGraph?.nodes.find(({id:s,contentRef:i})=>t[s]?.contentRef!==i)?.id;if(o!==void 0)throw new Error(`Published document identity does not match graph node ${o}`)},fm=({deploymentId:e,artifact:t,runtimeAssets:n,cache:r,baseUrl:o,automationToken:s,authorization:i,database:a,fetchDocument:c,documentCache:u,onDocumentGraphEvent:f})=>{let l=new URL(o).origin,p=new Map(t.documents.map(w=>[w.contentRef,w])),d=Fw({baseUrl:o,runtimeAssets:n,embeddedContents:t.contents,automationToken:s,authorization:i,fetchDocument:c,cache:u,onEvent:f});return async(w,h)=>{let y=Lw(w,o,h),m=new URL(y.url);if(m.origin!==l||m.pathname!==Nw||y.method.toUpperCase()!=="POST")return;let A;try{A=await sm(y.clone())}catch(E){let _=im(E);return Ln(_!==void 0?_:{code:"INVALID_REQUEST",message:"Asset resource request is invalid",status:400})}let S=r===void 0||y.headers.has("cache-control")===!1?void 0:await Pw({deploymentId:e,artifact:t,request:y});if(S!==void 0&&r!==void 0){let E=await r.match(S).catch(()=>{});if(E!==void 0)return new Response(E.body,E)}try{if(y.signal.aborted)return Ln({code:"REQUEST_CANCELLED",message:"Published asset query was cancelled",status:499});let E=cm(await a.queryWithDocumentGraph({request:A,load:d,readContent:async(_,x)=>{let R=p.get(_);if(R===void 0)throw new Error(`Published content reference is unavailable: ${_}`);let v=await c(um({assetId:R._id,baseUrl:o,runtimeAssets:n,automationToken:s,authorization:i}),{signal:y.signal});if(!v.ok||v.body===null)throw new Error(`Document ${R._id} request returned status ${v.status} or no body`);return{data:Hr(Yr(v.body),x)}},runtimeAssets:n,signal:y.signal,onEvent:f}));return S!==void 0&&r!==void 0&&y.signal.aborted===!1&&(E.headers.set("cache-control",y.headers.get("cache-control")),await r.put(S,E.clone()).catch(()=>{})),E}catch(E){if(y.signal.aborted)return Ln({code:"REQUEST_CANCELLED",message:"Published asset query was cancelled",status:499});let _=am(E);return Ln(_!==void 0?_:{code:"INTERNAL_ERROR",message:"Published asset query failed",status:500,retryable:!0})}}},XO=({deploymentId:e,artifact:t,runtimeAssets:n,onDocumentGraphEvent:r=void 0})=>{let o=globalThis.caches,s,i=()=>(s??=o.open(`webstudio-assets-${e}`),s),a=o===void 0?void 0:{match:async f=>(await i()).match(f),put:async(f,l)=>(await i()).put(f,l)};lm({artifact:t,runtimeAssets:n});let c=ya({artifact:t}),u=Qi();return async({request:f,context:l,fallback:p})=>{let d=new URL(f.url).origin,w=fm({deploymentId:e,artifact:t,runtimeAssets:n,cache:a,baseUrl:d,automationToken:$w(l),authorization:f.headers.get("authorization")??void 0,database:c,fetchDocument:p,documentCache:u,onDocumentGraphEvent:r});return async(h,y)=>await w(h,y)??p(h,y)}};export{XO as createGeneratedAssetResourceRuntime,YO as createPublishedAssetResourceFetch};