webstudio 0.305.0 → 0.306.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli.js +6717 -1804
- package/lib/content-runtime.js +2 -2
- package/package.json +23 -23
- package/templates/cloudflare/package.json +1 -1
- package/templates/defaults/app/route-templates/html.tsx +79 -13
- package/templates/defaults/app/route-templates/text.tsx +2 -2
- package/templates/defaults/app/route-templates/xml.tsx +2 -2
- package/templates/defaults/package.json +8 -8
- package/templates/react-router/app/route-templates/html.tsx +80 -14
- package/templates/react-router/app/route-templates/text.tsx +2 -2
- package/templates/react-router/app/route-templates/xml.tsx +2 -2
- package/templates/react-router/package.json +8 -8
- package/templates/react-router/vite.config.ts +15 -1
- package/templates/react-router-cloudflare/package.json +1 -1
- package/templates/ssg/app/route-templates/dynamic/+onBeforePrerenderStart.ts.template +1 -0
- package/templates/ssg/app/route-templates/{html → shared}/+data.ts +2 -2
- package/templates/ssg/app/route-templates/text/+config.ts +5 -0
- package/templates/ssg/app/route-templates/text/+onRenderHtml.ts +5 -0
- package/templates/ssg/app/route-templates/text/+route.ts.template +1 -0
- package/templates/ssg/package.json +10 -10
package/lib/content-runtime.js
CHANGED
|
@@ -61,7 +61,7 @@ var mm=Object.defineProperty;var wa=(e,t)=>{for(var n in t)mm(e,n,{get:t[n],enum
|
|
|
61
61
|
|
|
62
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 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(`
|
|
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,documentGraphDocuments:2e3,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
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
66
|
`)?Pe(n,t):n.includes(`
|
|
67
67
|
`)?`
|
|
@@ -191,7 +191,7 @@ ${n.comment}`:n.comment}this.doc.range[2]=n.offset;break}default:this.errors.pus
|
|
|
191
191
|
`)+1;for(;n!==0;)this.onNewLine(this.offset+n),n=this.source.indexOf(`
|
|
192
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: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:`
|
|
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.documentGraphDocuments,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
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
196
|
`;break}case-3:{i=`\r
|
|
197
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};
|