@goodfellow-cms/broker 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -7
- package/site/assets/{content-repository-setup-0zqQHkZ9.js → content-repository-setup-CzHqy87S.js} +1 -1
- package/site/assets/{dist-C2zb_90U.js → dist-BgSqMIdW.js} +1 -1
- package/site/assets/dist-D1ZOk-UP.js +6 -0
- package/site/assets/dist-pDBJlXWC.js +21 -0
- package/site/assets/index-BXiri33U.js +234 -0
- package/site/assets/{index-DrAt6GVO.css → index-fBFd9gqV.css} +1 -1
- package/site/assets/preload-helper-CEqbogAV.js +1 -0
- package/site/assets/{setup-host-BAQmd0y1.js → setup-host-D55O8ui4.js} +1 -1
- package/site/assets/store-BxUMMiN8.js +1 -0
- package/site/files.json +9 -9
- package/site/index.html +4 -4
- package/site/assets/dist-86wrqcsN.js +0 -6
- package/site/assets/dist-DJGm2ktT.js +0 -21
- package/site/assets/index-C1mWwm_b.js +0 -234
- package/site/assets/preload-helper-9CpHFPb-.js +0 -1
- package/site/assets/store-BJ3bMnko.js +0 -1
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-BgSqMIdW.js","./store-BxUMMiN8.js","./setup-host-D55O8ui4.js","./git-eGyMXUIu.js","./scheduled-builds-BPfDaBYt.js","./dist-pDBJlXWC.js","./preload-helper-CEqbogAV.js","./content-repository-setup-CzHqy87S.js","./dist-D1ZOk-UP.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,n as t,r as n,s as r,t as i}from"./preload-helper-CEqbogAV.js";import{d as a,f as o,g as s,h as c,i as l,l as u,m as d,o as f,p,s as m,u as h}from"./store-BxUMMiN8.js";function g(e){if(e)try{let t=new URL(e.url),n=t.hostname===`localhost`||t.hostname===`127.0.0.1`;return(t.protocol===`https:`||t.protocol===`http:`&&n)&&t.pathname===`/`&&!t.search&&!t.hash?t.origin:void 0}catch{return}}[`s`,`S`].flatMap(e=>[`v`,`V`].flatMap(t=>[`g`,`G`].map(n=>`${e}${t}${n}`)));var _=/^[ \t]*admin:[ \t]*\{[^\n]*\},?[ \t]*\n/m;function v(e){let t=_.exec(e)?.[0],n=t&&/url:\s*"([^"\\]+)"/.exec(t)?.[1];if(t&&n)return{url:n,.../checked:\s*true/.test(t)&&{checked:!0}}}var y={site:1,menus:1,page:1,layout:1,collection:1,entry:1,updates:1,redirects:1,media:1,theme:1,storage:1,permissions:1,"admin-text":1,"synced-block":1},ee={site:[],menus:[],page:[],layout:[],collection:[],entry:[],updates:[],redirects:[],media:[],theme:[],storage:[],permissions:[],"admin-text":[],"synced-block":[]},b=class extends Error{name=`MigrationError`};function te(e,t,n={}){let r=n.registry??ee,i=n.currentVersion??y[e],a=t.version;if(typeof a!=`number`||!Number.isInteger(a)||a<1)throw new b(`is missing its "version" number.`);if(a>i)throw new b(`was saved by a newer version of Goodfellow (file version ${a}, this version reads up to ${i}). Update Goodfellow to use it.`);let o=t;for(let t=a;t<i;t++){let n=r[e].find(e=>e.from===t);if(!n)throw new b(`can't be upgraded from version ${t}: no migration exists.`);o={...n.up(o),version:t+1}}return o}function ne(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function re(e,t=`|`){return e.map(e=>Oe(e)).join(t)}function ie(e,t){return typeof t==`bigint`?t.toString():t}var ae=class{constructor(e){this._getter=e,this._value=void 0}get value(){let e=this._getter;return e!==void 0&&(this._value=e(),this._getter=void 0),this._value}};function oe(e){return new ae(e)}function se(e){return e==null}function ce(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function le(e,t){let n=e/t,r=Math.round(n),i=4*2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}function ue(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function de(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function fe(e){return de(e._zod.def)??e._zod.def.shape}function pe(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ue(this,t,e),e},enumerable:!0,configurable:!0})}function me(e,t,n){t in e?ue(e,t,n):e[t]=n}function he(e,t,n,r){let i=fe(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?pe(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):me(e,a,r?r(n.value,a):n.value))}}function ge(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?pe(e,n,()=>t[n]):me(e,n,r.value))}}function _e(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function ve(e){return JSON.stringify(e)}function ye(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var be=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function xe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Se=oe(()=>{if(_t.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function Ce(e){if(xe(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return xe(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function we(e){return Ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var Te=new Set([`string`,`number`,`symbol`]);function Ee(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function De(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function x(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function Oe(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function ke(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Ae={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},je={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function Me(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);let i={};return he(i,e,Ne(e,t)),De(e,_e(n,{shape:i,checks:[]}))}function Ne(e,t){let n=fe(e),r=[];for(let e of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(n,e)?.enumerable)throw Error(`Unrecognized key: "${String(e)}"`);t[e]&&r.push(e)}return r}function Pe(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);let i=new Set(Ne(e,t)),a={};return he(a,e,Reflect.ownKeys(fe(e)).filter(e=>!i.has(e))),De(e,_e(n,{shape:a,checks:[]}))}function Fe(e,t){if(!Ce(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=fe(e);for(let e of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return De(e,_e(e._zod.def,{shape:Ie(e,t)}))}function Ie(e,t){let n={};return he(n,e,Reflect.ownKeys(fe(e))),ge(n,t),n}function Le(e,t){if(!Ce(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return De(e,_e(e._zod.def,{shape:Ie(e,t)}))}function Re(e,t){if(!t?._zod?.def)throw Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);let n={};return he(n,e,Reflect.ownKeys(fe(e))),he(n,t,Reflect.ownKeys(fe(t))),De(e,_e(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function ze(e,t,n,r=`partial`){let i=t._zod.def.checks;if(i&&i.length>0)throw Error(`.${r}() cannot be used on object schemas containing refinements`);let a=n?new Set(Ne(t,n)):void 0,o={};return he(o,t,Reflect.ownKeys(fe(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),De(t,_e(t._zod.def,{shape:o,checks:[]}))}function Be(e,t,n){let r=n?new Set(Ne(t,n)):void 0,i={};return he(i,t,Reflect.ownKeys(fe(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),De(t,_e(t._zod.def,{shape:i}))}function Ve(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function He(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function Ue(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function We(e){return typeof e==`string`?e:e?.message}function Ge(e){let t=[];for(let n of e??[]){let e=n._zod.def;if(!/_(length|size)$|_equals$/.test(e.check))break;let r=e.maximum??e.length??e.size;r>=0&&t.push([r,n])}return t}function Ke(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function qe(e,t,n){var r;let i=e.inst?._zod?.traits;i?.has(`$ZodType`)&&(i.has(`$ZodCheck`)?(r=e).schema??(r.schema=e.inst):e.schema=e.inst);let a=e.schema===e.inst?void 0:e.schema?._zod.def?.error,o=e.message?e.message:We(e.inst?._zod.def?.error?.(e))??We(a?.(e))??We(t?.error?.(e))??We(n.customError?.(e))??We(n.localeError?.(e))??`Invalid input`,s={};for(let t of Object.keys(e))t!==`inst`&&t!==`schema`&&t!==`continue`&&t!==`input`&&t!==`__proto__`&&(s[t]=e[t]);return s.path??=[],s.message=o,t?.reportInput&&(s.input=e.input),s}var Je=/[\uD800-\uDBFF]/;function Ye(e){let t=e.length;if(!Je.test(e))return t;let n=t;for(let r=0;r<t-1;r++)(e.charCodeAt(r)&64512)==55296&&(e.charCodeAt(r+1)&64512)==56320&&(n--,r++);return n}function Xe(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ze(e){let t=typeof e;switch(t){case`number`:return Number.isNaN(e)?`nan`:`number`;case`object`:{if(e===null)return`null`;if(Array.isArray(e))return`array`;let t=e;if(t&&Object.getPrototypeOf(t)!==Object.prototype&&`constructor`in t&&t.constructor)return t.constructor.name}}return t}function Qe(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}function $e(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):rt(e,n,r.value)}}function et(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function tt(e,t,n){return et(e,t,n,!1)}function nt(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return et(this,n,r(this))},set(e){et(this,n,e)}})}return t}function rt(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:et(this,t,n.bind(this))},set(e){et(this,t,e)}})}function it(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var at,ot=!1,st={configurable:!0,get(){ot=!0}};function S(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&at!==e._zod){at=void 0;return}at=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,st);let e=ot;ot=!1;try{let r=n(this);return ot?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),ot||=e,r}catch(n){throw delete this[t],ot||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function ct(e,t,n,r){let i=it(e,t);i&&Object.defineProperty(i,t,{configurable:!0,get(){let e={configurable:!0,writable:!0,enumerable:r,value:void 0};return Object.defineProperty(this,t,e),e.value=n(this),Object.defineProperty(this,t,e),e.value},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:r,value:e})}})}var lt=`~constantCatch`;function ut(e){let t=()=>e;return t[lt]=!0,t}var dt,ft={value:void 0,enumerable:!1},pt=`captureStackTrace`in Error?Error:null;function mt(e){let t=pt;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return pt=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function C(e,t,n,r){let i={};function a(e){this.def=e,this.constr=d,this.traits=new Set}a.prototype=i;let o=n,s=o&&new WeakSet;function c(n,r){if(!n._zod){ft.value=new a(r);try{Object.defineProperty(n,"_zod",ft)}finally{ft.value=void 0}}else if(n._zod.traits.has(e))return;if(n._zod.traits.add(e),t(n,r),s){let e=Object.getPrototypeOf(n),t=n._zod.constr.prototype,r=e;for(;r&&r!==t;)r=Object.getPrototypeOf(r);let i=r??e;s.has(i)||(s.add(i),$e(i,o))}let i=d.prototype;for(let e in i)Object.prototype.hasOwnProperty.call(i,e)&&(e in n||(n[e]=i[e].bind(n)))}let l=r?.Parent??Object;class u extends l{}Object.defineProperty(u,"name",{value:e});function d(e){let t=r?.Parent?mt(u):this;c(t,e);let n=t._zod.deferred;if(n){for(let e of n)e();t._zod.deferred=void 0}let i=globalThis.__zod_globalConfig?.postProcessor;return i&&i(t),t}return Object.defineProperty(d,"init",{value:c}),Object.defineProperty(d,Symbol.hasInstance,{value:t=>r?.Parent&&t instanceof r.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(d,"name",{value:e}),d}var ht=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},gt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(dt=globalThis).__zod_globalConfig??(dt.__zod_globalConfig={});var _t=globalThis.__zod_globalConfig;function vt(e){return e&&Object.assign(_t,e),_t}function yt(){let e=this._zod;return e.message??=JSON.stringify(e.def,ie,2),e.message}function bt(e){this._zod.message=e}var xt={get:yt,set:bt,enumerable:!0,configurable:!0},St={value:void 0,enumerable:!1},Ct=new WeakSet([Object.prototype,Error.prototype]),wt=(e,t)=>{e.name=`$ZodError`,St.value=t,Object.defineProperty(e,"issues",St),St.value=void 0,Object.defineProperty(e,"message",xt);let n=Object.getPrototypeOf(e);Ct.has(n)||(Ct.add(n),Object.defineProperty(n,"toString",{configurable:!0,enumerable:!1,get(){let e=()=>this.message;return Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,"toString",{value:e,configurable:!0,writable:!0})}}))},Tt=C(`$ZodError`,wt);C(`$ZodError`,wt,void 0,{Parent:Error});function Et(e,t,n){return Object.prototype.hasOwnProperty.call(e,t)||(t===`__proto__`?Object.defineProperty(e,t,{value:n(),writable:!0,enumerable:!0,configurable:!0}):e[t]=n()),e[t]}function Dt(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?Et(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ot(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i],o=i===e.length-1;if(n===`_errors`){o&&r._errors.push(t(a)),i++;continue}Object.prototype.hasOwnProperty.call(r,n)||Object.defineProperty(r,n,{value:{_errors:[]},enumerable:!0,writable:!0,configurable:!0});let s=r[n];o&&s._errors.push(t(a)),r=s,i++}}}};return r(e),n}function kt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var At=e=>{let t=(n,r,i,a)=>{let o=i?{...i,async:!1}:{async:!1},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise)throw new ht;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>qe(e,o,vt())));throw be(n,a?.callee??t),n}return s.value};return t},jt=e=>{let t=async(n,r,i,a)=>{let o=i?{...i,async:!0}:{async:!0},s=n._zod.run({value:r,issues:[]},o);if(s instanceof Promise&&(s=await s),s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>qe(e,o,vt())));throw be(n,a?.callee??t),n}return s.value};return t},Mt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new ht;return a.issues.length?Nt(e,a.issues,i):{success:!0,data:a.value}};function Nt(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>qe(e,n,vt()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var Pt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?Nt(e,a.issues,i):{success:!0,data:a.value}},Ft=Symbol.for(`zod.compile.invalid`),It=Symbol.for(`zod.compile.fallback`),Lt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==Ft)return!0;if(r.definite===!0&&n===void 0)return!1}return Rt(e,t,n)});function Rt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[It]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new ht;return a.issues.length===0}var zt=async(e,t,n)=>{let r=n?{...n,async:!0,abortEarly:!0}:{async:!0,abortEarly:!0},i=e._zod.run({value:t,issues:[]},r);return i instanceof Promise&&(i=await i),i.issues.length===0},Bt=e=>{let t=At(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,kt(n,a))};return n},Vt=e=>{let t=At(e),n=(e,r,i,a)=>t(e,r,i,kt(n,a));return n},Ht=e=>{let t=jt(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,kt(n,a))};return n},Ut=e=>{let t=jt(e),n=async(e,r,i,a)=>await t(e,r,i,kt(n,a));return n},Wt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mt(e)(t,n,i)},Gt=e=>(t,n,r)=>Mt(e)(t,n,r),Kt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Pt(e)(t,n,i)},qt=e=>async(t,n,r)=>Pt(e)(t,n,r),Jt=/^[cC][0-9a-z]{6,}$/,Yt=/^[0-9a-z]+$/,Xt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Zt=/^[0-9a-vA-V]{20}$/,Qt=/^[A-Za-z0-9]{27}$/,$t=/^[a-zA-Z0-9_-]{21}$/;function en(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var tn=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,nn=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,rn=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,an=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,on=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function sn(){return new RegExp(on,`u`)}var cn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ln=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,un=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,dn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,pn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,mn=/^https?$/,hn=/^\+[1-9]\d{6,14}$/,gn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`;function _n(e){return RegExp(`^${e}$`)}var vn=_n(gn);function yn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:e.seconds?`${t}:[0-5]\\d(?:\\.\\d+)?`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function bn(e){return RegExp(`^${yn(e)}$`)}function xn(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${yn({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${yn({precision:e.precision})}`:n;return RegExp(`^${gn}T(?:${r})$`)}var Sn=/^[\s\S]{0,}$/,Cn=/^-?\d+$/,wn=/^-?\d+(?:\.\d+)?$/,Tn=/^(?:true|false)$/i,En=/^[^A-Z]*$/,Dn=/^[^a-z]*$/,On=C(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),kn=e=>{let t=e.value;return!se(t)&&t.length!==void 0},An={number:`number`,bigint:`bigint`,object:`date`},jn=C(`$ZodCheckLessThan`,(e,t)=>{On.init(e,t);let n=An[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:An[typeof r.value]??n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Mn=C(`$ZodCheckGreaterThan`,(e,t)=>{On.init(e,t);let n=An[typeof t.value];e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:An[typeof r.value]??n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Nn=C(`$ZodCheckMultipleOf`,(e,t)=>{On.init(e,t),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?t.value!==BigInt(0)&&n.value%t.value===BigInt(0):le(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),Pn=C(`$ZodCheckNumberFormat`,(e,t)=>{On.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=Ae[t.format];e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),Fn=C(`$ZodCheckMaxLength`,(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=kn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?Ye(r):i)<=t.maximum)return;let a=Xe(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),In=C(`$ZodCheckMinLength`,(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=kn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?Ye(r):i)>=t.minimum)return;let a=Xe(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Ln=C(`$ZodCheckLengthEquals`,(e,t)=>{var n;On.init(e,t),(n=e._zod.def).when??(n.when=kn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?Ye(r):i;if(a===t.length)return;let o=Xe(r),s=a>t.length;n.issues.push({origin:o,...s?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Rn=C(`$ZodCheckStringFormat`,(e,t)=>{var n,r;On.init(e,t),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),zn=C(`$ZodCheckRegex`,(e,t)=>{Rn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Bn=C(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=En,Rn.init(e,t)}),Vn=C(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Dn,Rn.init(e,t)}),Hn=C(`$ZodCheckIncludes`,(e,t)=>{On.init(e,t);let n=Ee(t.includes);t.pattern=new RegExp(typeof t.position==`number`?`^.{${t.position},}${n}`:n),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Un=C(`$ZodCheckStartsWith`,(e,t)=>{On.init(e,t);let n=RegExp(`^${Ee(t.prefix)}.*`);t.pattern??=n,e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),Wn=C(`$ZodCheckEndsWith`,(e,t)=>{On.init(e,t);let n=RegExp(`.*${Ee(t.suffix)}$`);t.pattern??=n,e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Gn=C(`$ZodCheckOverwrite`,(e,t)=>{On.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Kn=class{constructor(e=[],t={}){this.content=[],this.indent=0,this.args=e,this.closed=t}indented(e){this.indent+=1;try{e(this)}finally{--this.indent}}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
|
|
3
|
+
`).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.content??[``];return new e(...Object.keys(this.closed),`return function (${this.args.join(`, `)}) {\n${t.join(`
|
|
4
|
+
`)}\n};`)(...Object.values(this.closed))}},qn={major:4,minor:6,patch:6},w=C(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=qn;let r=e._zod.def.checks,i=e._zod.traits.has(`$ZodCheck`)?[e,...r??[]]:r?.length?[...r]:[];for(let t of i)for(let n of t._zod.onattach)n(e);if(i.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(t,n,r)=>{if(t.memo)return t;let i=Ve(t),a;for(let o of n){if(o._zod.def.when){if(He(t)||!o._zod.def.when(t))continue}else if(i)continue;let n=t.issues.length,s=o._zod.check(t);if(s instanceof Promise&&r?.async===!1)throw new ht;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ke(t.issues,n,e),i||=Ve(t,n))});else{if(t.issues.length===n)continue;Ke(t.issues,n,e),i||=Ve(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Ve(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new ht;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(r,a)=>{if(a.skipChecks)return e._zod.parse(r,a);if(a.direction===`backward`){let t=e._zod.parse({value:r.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,r,a)):n(t,r,a)}let o=e._zod.parse(r,a);if(o instanceof Promise){if(a.async===!1)throw new ht;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return tt(this,`~standard`,Xn(this))},set"~standard"(e){et(this,`~standard`,e)}}),Jn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>qe(e,t,vt()))}:{value:e.value};async function Yn(e,t){let n={async:!0};return Jn(await e._zod.run({value:t,issues:[]},n),n)}function Xn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Jn(r,n)}catch{}return Yn(e,t)},vendor:`zod`,version:1}}var Zn=C(`$ZodString`,(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??Sn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),T=C(`$ZodStringFormat`,(e,t)=>{Rn.init(e,t),Zn.init(e,t)}),Qn=C(`$ZodGUID`,(e,t)=>{t.pattern??=nn,T.init(e,t)}),$n=C(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=rn(e)}else t.pattern??=rn();T.init(e,t)}),er=C(`$ZodEmail`,(e,t)=>{t.pattern??=an,T.init(e,t)});function tr(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function nr(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?tr(e)||2:rr(e,t)}function rr(e,t){if(!t.normalize&&t.protocol?.source===mn.source&&!/^https?:\/\//i.test(e))return 1;try{if(typeof URL<`u`){let t=URL;if(typeof t.parse==`function`)return t.parse(e)??2}return new URL(e)}catch{return 2}}var ir=/[\t\n\r]/g;function ar(e){return e.replace(ir,``)}function or(e,t){return t.lastIndex=0,t.test(e.hostname)}function sr(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var cr=C(`$ZodURL`,(e,t)=>{T.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=nr(r,t);if(i===1){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}if(i===2){n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort});return}if(i===!0){n.value=ar(r);return}t.hostname&&!or(i,t.hostname)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort}),t.protocol&&!sr(i,t.protocol)&&n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort}),n.value=t.normalize?i.href:ar(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),lr=C(`$ZodEmoji`,(e,t)=>{t.pattern??=sn(),T.init(e,t)}),ur=C(`$ZodNanoID`,(e,t)=>{if(t.length!==void 0&&(!Number.isInteger(t.length)||t.length<1))throw Error(`Invalid nanoid length: ${t.length}`);t.pattern??=t.length===void 0?$t:en(t.length),T.init(e,t)}),dr=C(`$ZodCUID`,(e,t)=>{t.pattern??=Jt,T.init(e,t)}),fr=C(`$ZodCUID2`,(e,t)=>{t.pattern??=Yt,T.init(e,t)}),pr=C(`$ZodULID`,(e,t)=>{t.pattern??=Xt,T.init(e,t)}),mr=C(`$ZodXID`,(e,t)=>{t.pattern??=Zt,T.init(e,t)}),hr=C(`$ZodKSUID`,(e,t)=>{t.pattern??=Qt,T.init(e,t)}),gr=C(`$ZodISODateTime`,(e,t)=>{t.pattern??=xn(t),T.init(e,t)}),_r=C(`$ZodISODate`,(e,t)=>{t.pattern??=vn,T.init(e,t)}),vr=C(`$ZodISOTime`,(e,t)=>{t.pattern??=bn(t),T.init(e,t)}),yr=C(`$ZodISODuration`,(e,t)=>{t.pattern??=tn,T.init(e,t)}),br=C(`$ZodIPv4`,(e,t)=>{t.pattern??=cn,T.init(e,t)}),xr=/^[0-9a-fA-F:.]+$/;function Sr(e){return xr.test(e)?tr(`http://[${e}]`):!1}var Cr=C(`$ZodIPv6`,(e,t)=>{t.pattern??=ln,T.init(e,t),e._zod.check=n=>{Sr(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),wr=C(`$ZodCIDRv4`,(e,t)=>{t.pattern??=un,T.init(e,t)});function Tr(e){let t=e.split(`/`);if(t.length!==2)return!1;let[n,r]=t;if(!r)return!1;let i=Number(r);return`${i}`!==r||i<0||i>128?!1:Sr(n)}var Er=C(`$ZodCIDRv6`,(e,t)=>{t.pattern??=dn,T.init(e,t),e._zod.check=n=>{Tr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function Dr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var Or=/^[0-9a-zA-Z+/]*={0,2}$/,kr=C(`$ZodBase64`,(e,t)=>{t.pattern??=Or,T.init(e,t),e._zod.check=n=>{Dr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),Ar=/^[A-Za-z0-9_-]*$/;function jr(e){if(!Ar.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return Dr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Mr=C(`$ZodBase64URL`,(e,t)=>{t.pattern??=Ar,T.init(e,t),e._zod.check=n=>{jr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Nr=C(`$ZodE164`,(e,t)=>{t.pattern??=hn,T.init(e,t)});function Pr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var Fr=C(`$ZodJWT`,(e,t)=>{T.init(e,t),e._zod.check=n=>{Pr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Ir=C(`$ZodNumber`,(e,t)=>{w.init(e,t),e._zod.pattern=wn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:String(i):void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),Lr=C(`$ZodNumberFormat`,(e,t)=>{Pn.init(e,t),Ir.init(e,t)}),Rr=C(`$ZodBoolean`,(e,t)=>{w.init(e,t),e._zod.pattern=Tn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),zr=C(`$ZodUnknown`,(e,t)=>{w.init(e,t),e._zod.parse=e=>e}),Br=C(`$ZodNever`,(e,t)=>{w.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function Vr(e,t){let n=Ge(e._zod.def.checks);if(!n.length)return;let r=Math.min(...n.map(e=>e[0])),i=e._zod.parse;e._zod.parse=(n,a)=>{let o=t(n.value);if(o>r&&!a?.skipChecks&&a?.direction!==`backward`){for(let[t,r]of Ge(e._zod.def.checks))if(o>t&&r._zod.def.when(n)){let t=n.issues.length;return r._zod.check(n),n.issues[t].continue=!1,Ke(n.issues,t,e),n}}return i(n,a)}}var Hr=e=>Array.isArray(e)?e.length:-1;function Ur(e,t,n){e.issues.length&&t.issues.push(...Ue(n,e.issues)),t.value[n]=e.value}var Wr=C(`$ZodArray`,(e,t)=>{w.init(e,t);let n=_t.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Array.isArray(a))return r.issues.push({expected:`array`,code:`invalid_type`,input:a,inst:e}),r;r.value=n?n.alloc(e,r,Array(a.length),i):Array(a.length);let o=[],s=i?.abortEarly;for(let e=0;e<a.length;e++){let n=a[e],c=t.element._zod.run({value:n,issues:[]},i);if(c instanceof Promise)o.push(c.then(t=>Ur(t,r,e)));else if(Ur(c,r,e),s&&c.issues.length!==0&&Ve(c))break}return o.length?Promise.all(o).then(()=>r):r},Vr(e,Hr)});function Gr(e,t,n,r,i,a){let o=n in r,s=a===`optional`;if(o||!s||i!==`optional`){if(e.issues.length){if(i!==void 0&&s&&!o)return;t.issues.push(...Ue(n,e.issues))}if(!o&&i===void 0){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?(o||i===`defaulted`&&!s)&&(t.value[n]=void 0):t.value[n]=e.value}}var Kr=[];function qr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Kr,i=r.length?[...t,...r]:t;for(let t of i)if(!e.shape?.[t]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);let a=ke(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Jr(e,t,n,r,i,a,o){let s=[],c=i.keySet,l=i.catchall._zod,u=l.def.type,d=l.optin,f=l.optout,p=0;for(let i in t){if(o&&n.issues.length!==p){if(Ve(n,p))break;p=n.issues.length}if(c.has(i))continue;if(i===`__proto__`){u===`never`&&s.push(i);continue}if(u===`never`){s.push(i);continue}let a=l.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Gr(e,n,i,t,d,f))):Gr(a,n,i,t,d,f)}return s.length&&n.issues.push({code:`unrecognized_keys`,keys:s,input:t,inst:a,continue:!0}),e.length?Promise.all(e).then(()=>n):n}var Yr=C(`$ZodObject`,(e,t)=>{w.init(e,t);let n=Object.getOwnPropertyDescriptor(t,`shape`),r=n?.get?n.get.raw:t.shape??{};if(r){let e=()=>{let n={...r};return Object.defineProperty(t,"shape",{value:n}),e.raw=n,n};e.raw=r,Object.defineProperty(t,"shape",{get:e})}let i=oe(()=>qr(t));S(e,`propValues`,e=>{let t=e.def.shape,n={};for(let e in t){let r=t[e]._zod;if(r.values){Object.prototype.hasOwnProperty.call(n,e)||ue(n,e,new Set);for(let t of r.values)n[e].add(t);r.optin!==void 0&&n[e].add(void 0)}}return n});let a=xe,o=t.catchall,s,c=_t.memoizer;c?.attach(e),e._zod.parse=(t,n)=>{s??=i.value;let r=t.value;if(!a(r))return t.issues.push({expected:`object`,code:`invalid_type`,input:r,inst:e}),t;t.value=c?c.alloc(e,t,{},n):{};let l=[],u=s.shape,d=n?.abortEarly,f=t.issues.length;for(let e of s.allKeys){if(d&&t.issues.length!==f){if(Ve(t,f))break;f=t.issues.length}if(e===`__proto__`)continue;let i=u[e],a=i._zod.optin,o=i._zod.optout,s=i._zod.run({value:r[e],issues:[]},n);s instanceof Promise?l.push(s.then(n=>Gr(n,t,e,r,a,o))):Gr(s,t,e,r,a,o)}return o?Jr(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Xr=C(`$ZodObjectJIT`,(e,t)=>{Yr.init(e,t);let n=e._zod.parse,r=oe(()=>qr(t)),i=_t.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new Kn([`payload`,`ctx`],{shape:t,inst:e,memo:i,syms:a}),s=e=>`shape[${e}]._zod.run({ value: input[${e}], issues: [] }, ctx)`,c=(e,t)=>`
|
|
5
|
+
let ${e}_ab = false;
|
|
6
|
+
for (let i = 0; i < ${e}.issues.length; i++) {
|
|
7
|
+
const iss = ${e}.issues[i];
|
|
8
|
+
iss.path = iss.path ? [${t}, ...iss.path] : [${t}];
|
|
9
|
+
payload.issues.push(iss);
|
|
10
|
+
if (iss.continue !== true) ${e}_ab = true;
|
|
11
|
+
}
|
|
12
|
+
if (${e}_ab && ctx && ctx.abortEarly) {
|
|
13
|
+
payload.value = newResult;
|
|
14
|
+
return payload;
|
|
15
|
+
}`;o.write(`const input = payload.value;`);let l=Object.create(null),u=0;for(let e of n.allKeys)l[e]=`key_${u++}`;o.write(i?`const newResult = memo.alloc(inst, payload, {}, ctx);`:`const newResult = {};`);for(let e of n.allKeys){if(e===`__proto__`)continue;let n=l[e],r=typeof e==`symbol`?`syms[${a.indexOf(e)}]`:ve(e),i=`${r} in input`,u=t[e],d=u?._zod?.optin,f=d!==void 0,p=u?._zod?.optout===`optional`;if(o.write(`const ${n} = ${s(r)};`),f&&p){let e=d===`optional`?`${n}_present`:`${n}.value !== undefined || ${n}_present`;o.write(`
|
|
16
|
+
const ${n}_present = ${i};
|
|
17
|
+
if (!${n}.issues.length || ${n}_present) {
|
|
18
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (${e}) {
|
|
22
|
+
newResult[${r}] = ${n}.value;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
`)}else f?(o.write(`
|
|
27
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
28
|
+
}
|
|
29
|
+
`),d===`defaulted`?o.write(`newResult[${r}] = ${n}.value;`):o.write(`
|
|
30
|
+
if (${n}.value !== undefined || ${i}) {
|
|
31
|
+
newResult[${r}] = ${n}.value;
|
|
32
|
+
}
|
|
33
|
+
`)):o.write(`
|
|
34
|
+
const ${n}_present = ${i};
|
|
35
|
+
if (${n}.issues.length) {${c(n,r)}
|
|
36
|
+
}
|
|
37
|
+
if (!${n}_present && !${n}.issues.length) {
|
|
38
|
+
payload.issues.push({
|
|
39
|
+
code: "invalid_type",
|
|
40
|
+
expected: "nonoptional",
|
|
41
|
+
input: undefined,
|
|
42
|
+
path: [${r}]
|
|
43
|
+
});
|
|
44
|
+
if (ctx && ctx.abortEarly) {
|
|
45
|
+
payload.value = newResult;
|
|
46
|
+
return payload;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (${n}_present) {
|
|
51
|
+
newResult[${r}] = ${n}.value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
`)}return o.write(`payload.value = newResult;`),o.write(`return payload;`),o.compile()},o,s=xe,c=!_t.jitless,l=c&&Se.value,u=t.catchall,d;e._zod.parse=(i,f)=>{d??=r.value;let p=i.value;return s(p)?c&&l&&f?.async===!1&&f.jitless!==!0?(o||=a(t.shape),i=o(i,f),u?Jr([],p,i,f,d,e,f?.abortEarly===!0):i):n(i,f):(i.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),i)}});function Zr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Ve(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>qe(e,r,vt())))}),t)}var Qr=C(`$ZodUnion`,(e,t)=>{w.init(e,t),S(e,`optin`,e=>e.def.options.some(e=>e._zod.optin===`defaulted`)?`defaulted`:e.def.options.some(e=>e._zod.optin!==void 0)?`optional`:void 0),S(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),S(e,`values`,e=>{if(e.def.options.every(e=>e._zod.values))return new Set(e.def.options.flatMap(e=>Array.from(e._zod.values)))}),S(e,`pattern`,e=>{if(e.def.options.every(e=>e._zod.pattern)){let t=e.def.options.map(e=>e._zod.pattern);return RegExp(`^(${t.map(e=>ce(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Zr(t,r,e,i)):Zr(o,r,e,i)}});function $r(e){let t=new Map;for(let n of e.options){let r=n._zod.propValues?.[e.discriminator];if(!r||r.size===0)throw Error(`Invalid discriminated union option at index "${e.options.indexOf(n)}"`);for(let e of r)if(t.has(e)){if(e!==void 0)throw Error(`Duplicate discriminator value "${String(e)}"`);t.set(e,null)}else t.set(e,n)}return t}var ei=C(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Qr.init(e,t);let n=e._zod.parse;S(e,`propValues`,e=>{let t={},n=0;for(let r of e.def.options){let i=r._zod.propValues;if(!i||Object.keys(i).length===0)throw Error(`Invalid discriminated union option at index "${e.def.options.indexOf(r)}"`);i[e.def.discriminator]?.has(void 0)&&n++;for(let[e,n]of Object.entries(i)){Object.prototype.hasOwnProperty.call(t,e)||ue(t,e,new Set);for(let r of n)t[e].add(r)}}return!e.def.unionFallback&&n>1&&t[e.def.discriminator]?.delete(void 0),t}),t.options.forEach((e,n)=>{let r=de(e._zod.def);if(r&&!Object.prototype.hasOwnProperty.call(r,t.discriminator))throw Error(`Invalid discriminated union option at index "${n}"`)});let r=oe(()=>$r(t));e._zod.parse=(i,a)=>{let o=i.value;if(!xe(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=o?.[t.discriminator],c=r.value.get(s);return c&&(s!==void 0||a.direction!==`backward`)?c._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()).filter(e=>r.value.get(e)!==null),input:o,path:[t.discriminator],inst:e}),i)}}),ti=C(`$ZodIntersection`,(e,t)=>{w.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>ri(e,t,n)):ri(e,i,a)}});function ni(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Ce(e)&&Ce(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};Object.prototype.hasOwnProperty.call(i,`__proto__`)&&delete i.__proto__;for(let n of r){if(n===`__proto__`)continue;let r=ni(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}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 i=e[r],a=t[r],o=ni(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function ri(e,t,n){let r=new Map,i,a=new Map,o=(e,t)=>{let n;if(e.code===`unrecognized_keys`&&!e.path?.length)i??=e,n=e.keys;else if(e.code===`invalid_key`&&e.origin===`record`&&e.path?.length===1){let t=String(e.path[0]);a.has(t)||a.set(t,e),n=[t]}else return!1;for(let e of n)r.has(e)||r.set(e,{}),r.get(e)[t]=!0;return!0};for(let n of t.issues)o(n,`l`)||e.issues.push(n);for(let t of n.issues)o(t,`r`)||e.issues.push(t);let s=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(s.length){let t=i?s.filter(e=>i.keys.includes(e)):[];t.length&&e.issues.push({...i,keys:t});for(let n of s)!t.includes(n)&&a.has(n)&&e.issues.push(a.get(n))}let c=ni(t.value,n.value);if(!c.valid){if(Ve(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var ii=C(`$ZodRecord`,(e,t)=>{w.init(e,t);let n=_t.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!Ce(a))return r.issues.push({expected:`record`,code:`invalid_type`,input:a,inst:e}),r;let o=[],s=t.keyType._zod.values;if(s&&!t.partial){r.value=n?n.alloc(e,r,{},i):{};let c=new Set;for(let n of s)if(typeof n==`string`||typeof n==`number`||typeof n==`symbol`){if(c.add(typeof n==`number`?n.toString():n),n===`__proto__`)continue;let s=t.keyType._zod.run({value:n,issues:[]},i);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(s.issues.length){r.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>qe(e,i,vt())),input:n,path:[n],inst:e});continue}let l=s.value;if(l===`__proto__`)continue;let u=t.valueType._zod.run({value:a[n],issues:[]},i);u instanceof Promise?o.push(u.then(e=>{e.issues.length&&r.issues.push(...Ue(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Ue(n,u.issues)),r.value[l]=u.value)}let l;for(let e in a)if(!c.has(e)){if(t.mode===`loose`){if(e===`__proto__`)continue;r.value[e]=a[e]}else l??=[],l.push(e)}l&&l.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:l,continue:!0})}else{r.value=n?n.alloc(e,r,{},i):{};let c;for(let n of Reflect.ownKeys(a)){if(n===`__proto__`||!Object.prototype.propertyIsEnumerable.call(a,n))continue;let l=t.keyType._zod.run({value:n,issues:[]},i);if(l instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof n==`string`&&wn.test(n)&&l.issues.length){let e=t.keyType._zod.run({value:Number(n),issues:[]},i);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(l=e)}if(l.issues.length){t.mode===`loose`?r.value[n]=a[n]:s?(c??=[],c.push(n)):r.issues.push({code:`invalid_key`,origin:`record`,issues:l.issues.map(e=>qe(e,i,vt())),input:n,path:[n],inst:e});continue}let u=l.value;if(u===`__proto__`)continue;let d=t.valueType._zod.run({value:a[n],issues:[]},i);d instanceof Promise?o.push(d.then(e=>{e.issues.length&&r.issues.push(...Ue(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Ue(n,d.issues)),r.value[u]=d.value)}c&&c.length>0&&r.issues.push({code:`unrecognized_keys`,input:a,inst:e,keys:c,continue:!0})}return o.length?Promise.all(o).then(()=>r):r}}),ai=C(`$ZodEnum`,(e,t)=>{w.init(e,t);let n=ne(t.entries),r=new Set(n);e._zod.values=r,S(e,`pattern`,e=>{let t=ne(e.def.entries).filter(e=>Te.has(typeof e));return RegExp(t.length?`^(${t.map(e=>Ee(e.toString())).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),oi=C(`$ZodLiteral`,(e,t)=>{w.init(e,t);let n=new Set(t.values);e._zod.values=n,S(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?Ee(e):e?Ee(e.toString()):String(e)).join(`|`)})$`:`^[^\\s\\S]$`)}),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),si=C(`$ZodTransform`,(e,t)=>{w.init(e,t),e._zod.optin=`optional`,_t.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new gt(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n));if(i instanceof Promise)throw new ht;return n.value=i,n}});function ci(e,t){return e.value=t.issues.length?void 0:t.value,e}var li=C(`$ZodOptional`,(e,t)=>{w.init(e,t),S(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,S(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),S(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ce(t.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(e.value===void 0){if(t.innerType._zod.optin!==`defaulted`)return e;let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(t=>ci(e,t)):ci(e,r)}return t.innerType._zod.run(e,n)}}),ui=C(`$ZodExactOptional`,(e,t)=>{li.init(e,t),S(e,`values`,e=>e.def.innerType._zod.values),S(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),di=C(`$ZodNullable`,(e,t)=>{w.init(e,t),S(e,`optin`,e=>e.def.innerType._zod.optin),S(e,`optout`,e=>e.def.innerType._zod.optout),S(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ce(t.source)}|null)$`):void 0}),S(e,`values`,e=>e.def.innerType._zod.values?new Set([...e.def.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),fi=C(`$ZodDefault`,(e,t)=>{w.init(e,t),e._zod.optin=`defaulted`,S(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>pi(e,t)):pi(r,t)}});function pi(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var mi=C(`$ZodPrefault`,(e,t)=>{w.init(e,t),e._zod.optin=`defaulted`,S(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),hi=C(`$ZodNonOptional`,(e,t)=>{w.init(e,t),S(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>gi(t,e)):gi(i,e)}});function gi(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}function _i(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>qe(e,r,vt()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var vi=C(`$ZodCatch`,(e,t)=>{w.init(e,t),S(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),S(e,`optout`,e=>e.def.innerType._zod.optout),S(e,`values`,e=>e.def.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run({value:e.value,issues:[]},n);return r instanceof Promise?r.then(r=>_i(e,r,t,n)):_i(e,r,t,n)}}),yi=C(`$ZodPipe`,(e,t)=>{w.init(e,t),S(e,`values`,e=>e.def.in._zod.values),S(e,`optin`,e=>e.def.in._zod.optin),S(e,`optout`,e=>e.def.out._zod.optout),S(e,`propValues`,e=>e.def.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>bi(e,t.in,n)):bi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>bi(e,t.out,n)):bi(r,t.out,n)}});function bi(e,t,n){return e.issues.some(e=>e.code!==`unrecognized_keys`)?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues},n)}var xi=C(`$ZodReadonly`,(e,t)=>{w.init(e,t),S(e,`propValues`,e=>e.def.innerType._zod.propValues),S(e,`values`,e=>e.def.innerType._zod.values),S(e,`optin`,e=>e.def.innerType?._zod?.optin),S(e,`optout`,e=>e.def.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Si):Si(r)}});function Si(e){return e.memo||(e.value=Object.freeze(e.value)),e}var Ci=C(`$ZodCustom`,(e,t)=>{On.init(e,t),w.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>wi(t,n,r,e));wi(i,n,r,e)}});function wi(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Qe(e))}}var Ti=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},Ei=`~memo`,Di=[];function Oi(e){return typeof e==`object`&&!!e}function ki(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var Ai=new WeakMap,ji=0,Mi=1,Ni=2;function Pi(e,t,n){let r=Ai.get(e);if(r!==void 0)return r?Ni:ji;if(t.has(e))return Ni;t.add(e);let i=ji,a=e=>{if(i!==Ni&&e?._zod){let r=Pi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=ji;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?Mi:o.value?._zod?Pi(o.value,t,n):ji;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=de(c);s(e?o(e,!0):Mi),a(c.catchall);break}case`array`:a(c.element);break;case`tuple`:for(let e of c.items)a(e);a(c.rest);break;case`record`:case`map`:a(c.keyType),a(c.valueType);break;case`set`:a(c.valueType);break;case`union`:for(let e of c.options)a(e);break;case`intersection`:a(c.left),a(c.right);break;case`optional`:case`nullable`:case`default`:case`prefault`:case`catch`:case`readonly`:case`nonoptional`:case`promise`:case`success`:a(c.innerType);break;case`pipe`:a(c.in),a(c.out);break;case`function`:a(c.input),a(c.output);break;case`lazy`:{let r=c._cachedInner??(n?e._zod.innerType:void 0);s(r?Pi(r,t,!1):Mi);break}case`template_literal`:case`string`:case`number`:case`int`:case`boolean`:case`bigint`:case`symbol`:case`undefined`:case`null`:case`void`:case`never`:case`any`:case`unknown`:case`date`:case`nan`:case`enum`:case`literal`:case`file`:case`transform`:case`custom`:break;default:for(let e in c){let t=Object.getOwnPropertyDescriptor(c,e);if(!t||t.get)continue;let n=t.value;if(n&&typeof n==`object`){if(n._zod)a(n);else if(Array.isArray(n))for(let e of n)a(e)}}}return t.delete(e),Fi(e,i)}function Fi(e,t){return t!==Mi&&Ai.set(e,t===Ni),t}function Ii(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Li,Ri=[],zi={alloc(e,t,n){let r=Li;if(!r)return n;Li=void 0;let i={value:n,issues:null};return r.set(t.value,i),Ri.push(i),n},guard(e){var t;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,n=(e,n)=>{if(n.direction!==`backward`&&Vi(n,e.value))throw new Ti;return t(e,n)};e._zod.parse=n,e._zod.run===t&&(e._zod.run=n)})},attach(e){var t;let n,r=!1,i,a;(t=e._zod).deferred??(t.deferred=[]),e._zod.deferred.push(()=>{let t=e._zod.parse,o=(s,c)=>{if(n===void 0){let i=Pi(e,new Set,!1);if(i===ji)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===Ni||r?n=!0:r=!0}let l=s.value;if(!Oi(l))return t(s,c);let u=c[Ei];u||(u={buckets:new WeakMap,backEdges:void 0},c[Ei]=u);let d;i===c?d=a:(d=Ii(u,e),i=c,a=d);let f=d.get(l);if(f)return s.value=f.value,f.issues?f.issues.length&&s.issues.push(...ki(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Li=d;let p=Ri.length,m=t(s,c);Li=void 0;let h=Ri.length>p?Ri.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?ki(e.issues):Di),e)):(h&&(h.issues=m.issues.length?ki(m.issues):Di),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Bi(){return zi}function Vi(e,t){let n=e[Ei]?.backEdges;return n!==void 0&&Oi(t)&&n.has(t)}var Hi=()=>{let e={string:{unit:`characters`,verb:`to have`},file:{unit:`bytes`,verb:`to have`},array:{unit:`items`,verb:`to have`},set:{unit:`items`,verb:`to have`},map:{unit:`entries`,verb:`to have`}};function t(t){return e[t]??null}let n={regex:`input`,email:`email address`,url:`URL`,emoji:`emoji`,uuid:`UUID`,uuidv4:`UUIDv4`,uuidv6:`UUIDv6`,nanoid:`nanoid`,guid:`GUID`,cuid:`cuid`,cuid2:`cuid2`,ulid:`ULID`,xid:`XID`,ksuid:`KSUID`,datetime:`ISO datetime`,date:`ISO date`,time:`ISO time`,duration:`ISO duration`,ipv4:`IPv4 address`,ipv6:`IPv6 address`,mac:`MAC address`,cidrv4:`IPv4 range`,cidrv6:`IPv6 range`,base64:`base64-encoded string`,base64url:`base64url-encoded string`,json_string:`JSON string`,e164:`E.164 number`,currency_code:`currency code`,credit_card:`credit card number`,iban:`IBAN`,jwt:`JWT`,template_literal:`input`},r={nan:`NaN`};function i(e,t){return e===`number`&&typeof t==`number`&&!Number.isFinite(t)?String(t):r[e]??e}return e=>{switch(e.code){case`invalid_type`:return`Invalid input: expected ${i(e.expected)}, received ${i(Ze(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Oe(e.values[0])}`:`Invalid option: expected one of ${re(e.values,`|`)}`;case`too_big`:{let n=e.exact?`exactly `:e.inclusive?`<=`:`<`,r=t(e.origin);return r?`Too big: expected ${e.origin??`value`} to have ${n}${e.maximum.toString()} ${r.unit??`elements`}`:`Too big: expected ${e.origin??`value`} to be ${n}${e.maximum.toString()}`}case`too_small`:{let n=e.exact?`exactly `:e.inclusive?`>=`:`>`,r=t(e.origin);return r?`Too small: expected ${e.origin} to have ${n}${e.minimum.toString()} ${r.unit}`:`Too small: expected ${e.origin} to be ${n}${e.minimum.toString()}`}case`invalid_format`:{let t=e;return t.format===`starts_with`?`Invalid string: must start with "${t.prefix}"`:t.format===`ends_with`?`Invalid string: must end with "${t.suffix}"`:t.format===`includes`?`Invalid string: must include "${t.includes}"`:t.format===`regex`?`Invalid string: must match pattern ${t.pattern}`:`Invalid ${n[t.format]??e.format}`}case`not_multiple_of`:return`Invalid number: must be a multiple of ${e.divisor}`;case`unrecognized_keys`:return`Unrecognized key${e.keys.length>1?`s`:``}: ${re(e.keys,`, `)}`;case`invalid_key`:return`Invalid key in ${e.origin}`;case`invalid_union`:return e.options&&Array.isArray(e.options)&&e.options.length>0?`Invalid discriminator value. Expected ${e.options.map(e=>`'${e}'`).join(` | `)}`:e.inclusive===!1?`Invalid input: more than one option matched`:`Invalid input`;case`invalid_element`:return`Invalid value in ${e.origin}`;default:return`Invalid input`}}};function Ui(){return{localeError:Hi()}}var Wi,Gi=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Ki(){return new Gi}(Wi=globalThis).__zod_globalRegistry??(Wi.__zod_globalRegistry=Ki());var qi=globalThis.__zod_globalRegistry;function Ji(e){return e.checks&&=[...e.checks],e}function Yi(e,t){return new e(Ji({type:`string`,...x(t)}))}function Xi(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...x(t)})}function Zi(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...x(t)})}function Qi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...x(t)})}function $i(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...x(t)})}function ea(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...x(t)})}function ta(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...x(t)})}function na(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...x(t)})}function ra(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...x(t)})}function ia(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...x(t)})}function aa(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...x(t)})}function oa(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...x(t)})}function sa(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...x(t)})}function ca(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...x(t)})}function la(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...x(t)})}function ua(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...x(t)})}function da(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...x(t)})}function fa(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...x(t)})}function pa(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...x(t)})}function ma(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...x(t)})}function ha(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...x(t)})}function ga(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...x(t)})}function _a(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...x(t)})}function va(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...x(t)})}function ya(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...x(t)})}function ba(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...x(t)})}function xa(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...x(t)})}function Sa(e,t){return new e(Ji({type:`number`,checks:[],...x(t)}))}function Ca(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...x(t)})}function wa(e,t){return new e({type:`boolean`,...x(t)})}function Ta(e){return new e({type:`unknown`})}function Ea(e,t){return new e({type:`never`,...x(t)})}function Da(e,t){return new jn({check:`less_than`,...x(t),value:e,inclusive:!1})}function Oa(e,t){return new jn({check:`less_than`,...x(t),value:e,inclusive:!0})}function ka(e,t){return new Mn({check:`greater_than`,...x(t),value:e,inclusive:!1})}function Aa(e,t){return new Mn({check:`greater_than`,...x(t),value:e,inclusive:!0})}function ja(e,t){return new Nn({check:`multiple_of`,...x(t),value:e})}function Ma(e,t){return new Fn({check:`max_length`,...x(t),maximum:e})}function Na(e,t){return new In({check:`min_length`,...x(t),minimum:e})}function Pa(e,t){return new Ln({check:`length_equals`,...x(t),length:e})}function Fa(e,t){return new zn({check:`string_format`,format:`regex`,...x(t),pattern:e})}function Ia(e){return new Bn({check:`string_format`,format:`lowercase`,...x(e)})}function La(e){return new Vn({check:`string_format`,format:`uppercase`,...x(e)})}function Ra(e,t){return new Hn({check:`string_format`,format:`includes`,...x(t),includes:e})}function za(e,t){return new Un({check:`string_format`,format:`starts_with`,...x(t),prefix:e})}function Ba(e,t){return new Wn({check:`string_format`,format:`ends_with`,...x(t),suffix:e})}function Va(e){return new Gn({check:`overwrite`,tx:e})}function Ha(e){return Va(t=>t.normalize(e))}function Ua(){return Va(e=>e.trim())}function Wa(){return Va(e=>e.toLowerCase())}function Ga(){return Va(e=>e.toUpperCase())}function Ka(){return Va(e=>ye(e))}function qa(e,t,n){return new e({type:`array`,element:t,...x(n)})}function Ja(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...x(n)})}function Ya(e,t){let n=Xa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Qe(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,`input`in r||(r.input=t.value),r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Qe(r))}},e(t.value,t)),t);return n}function Xa(e,t){let n=new On({check:`custom`,...x(t)});return n._zod.check=e,n}function Za(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&ue(e,t,n[t]);return e}function Qa(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??qi,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,sharedDefsExtractedFor:void 0,sharedEmitDoneFor:void 0,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,intersections:[],deferred:[],external:e?.external??void 0}}function $a(e,t,n,r,i){let a=typeof t.unrepresentable==`function`?t.unrepresentable({zodSchema:e,path:r.path,message:i}):t.unrepresentable;if(a===`any`)return!1;if(a===void 0||a===`throw`)throw Error(i);return Object.assign(n,a),!0}function E(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o),t.sharedDefsExtractedFor=void 0,t.sharedEmitDoneFor=void 0;let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,E(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Za(o.schema,c),t.io===`input`&&D(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function eo(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function to(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);if(e.external&&e.sharedDefsExtractedFor===e.external)return;let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${eo(a)}`}}let i=`#/${r}/`;if(t[1]===n&&!t[1].schema.id)return{ref:`#`};let a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+eo(a)}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
|
|
55
|
+
|
|
56
|
+
Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}r.count>1&&e.reused===`ref`&&a(n)}e.external&&(e.sharedDefsExtractedFor=e.external)}function no(e){let t=e.anyOf;if(!Array.isArray(t)||t.length===0||e.type!==void 0)return;let n=[];for(let e of t){if(!e||typeof e!=`object`)return;no(e);let t=Object.keys(e);if(t.length!==1||t[0]!==`type`)return;let r=e.type;for(let e of Array.isArray(r)?r:[r]){if(typeof e!=`string`)return;n.includes(e)||n.push(e)}}delete e.anyOf,e.type=n.length===1?n[0]:n}var ro=new Set([`type`,`properties`,`required`,`additionalProperties`]),io=[`oneOf`,`anyOf`];function ao(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function oo(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!ro.has(e))return null;t.push(n)}let n={},r=new Set;for(let e of t){for(let r in e.properties){if(Object.prototype.hasOwnProperty.call(n,r))continue;let e=[];for(let n of t){let t=n.properties?.[r]??ao(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}ue(n,r,e.length===1?e[0]:oo(e)??{allOf:e})}for(let t of e.required??[])r.add(t)}let i={type:`object`,properties:n};if(r.size&&(i.required=[...r]),t.every(e=>e.additionalProperties===!1))i.additionalProperties=!1;else{let e=[];for(let n of t){let t=ao(n);t&&!e.some(e=>JSON.stringify(e)===JSON.stringify(t))&&e.push(t)}e.length===1?i.additionalProperties=e[0]:e.length>1&&(i.additionalProperties={allOf:e})}return i}function so(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of ro)if(t in e)return;let n=t.filter(e=>io.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=oo(t);else{let e=n[0],i=io.find(t=>Array.isArray(e[t]));if(Object.keys(e).length!==1)return;let a=t.filter(t=>t!==e),o=e[i].map(e=>oo([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Za(e,r))}function co(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Za(i,s),Za(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};if(!e.external||e.sharedEmitDoneFor!==e.external){for(let t of[...e.seen.entries()].reverse())r(t[0]);if(e.target!==`openapi-3.0`)for(let t of e.seen.entries())no(t[1].def??t[1].schema);for(let t of e.deferred)t();if(e.intersections.length){let t=new Map;for(let n of e.seen.values())for(let e of[n.schema,n.def]){let n=e?.allOf;if(!Array.isArray(n))continue;let r=t.get(n);r?r.push(e):t.set(n,[e])}for(let n of e.intersections)for(let e of t.get(n)??[])so(e)}}let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Za(i,n.defId?n.schema:n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};if(!e.external||e.sharedEmitDoneFor!==e.external)for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,ue(o,e.defId,e.def))}e.external&&(e.sharedEmitDoneFor=e.external),e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:uo(t,`input`,e.processors),output:uo(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function D(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 D(r.element,n);if(r.type===`set`)return D(r.valueType,n);if(r.type===`lazy`)return D(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`||r.type===`catch`)return D(r.innerType,n);if(r.type===`intersection`)return D(r.left,n)||D(r.right,n);if(r.type===`record`||r.type===`map`)return D(r.keyType,n)||D(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:D(r.in,n)||D(r.out,n);if(r.type===`object`){for(let e in r.shape)if(D(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(D(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(D(e,n))return!0;return!!(r.rest&&D(r.rest,n))}return!1}var lo=(e,t={})=>n=>{let r=Qa({...n,processors:t});return E(e,r),to(r,e),co(r,e)},uo=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=Qa({...i??{},target:a,io:t,processors:n});return E(e,o),to(o,e),co(o,e)},fo=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},po=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},mo=(e,t)=>{fo(e,`minimum`,t),po(e,`maximum`,t)},ho=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},go=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},_o=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},vo=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},yo=(e,t)=>fo(e,`minimum`,t.minimum),bo=(e,t)=>po(e,`maximum`,t.maximum),xo=e=>(t,n)=>{vo(t,n.format);let[r,i]=e[n.format];fo(t,`minimum`,r),po(t,`maximum`,i)},So={greater_than:(e,t)=>fo(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>po(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>ho(e,t.value),number_format:xo(Ae),bigint_format:xo(je),min_length:yo,max_length:bo,length_equals:(e,t)=>mo(e,t.length),min_size:yo,max_size:bo,size_equals:(e,t)=>mo(e,t.size),string_format:(e,t)=>{vo(e,t.format),t.pattern&&go(e,t.pattern),(t.format===`base64`||t.format===`base64url`)&&(e.contentEncoding=t.format),(t.local||t.precision===-1)&&(e.laxFormat=!0)},mime_type:(e,t)=>_o(e,t.mime)};function Co(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)So[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&fo(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&fo(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&po(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&po(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&ho(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&_o(t,i.mime);for(let e of i.patterns??[])go(t,e);return t}var wo={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},To=new Map([[Or,fn],[Ar,pn]]),Eo=e=>To.get(e)??e,Do=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=Co(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=wo[s]??s,i.format===``&&delete i.format,(s===`time`||u)&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c].map(Eo);e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Oo=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,multipleOf:s,exclusiveMaximum:c,exclusiveMinimum:l,isInt:u}=Co(e);i.type=u?`integer`:`number`;let d=typeof l==`number`&&l>=(a??-1/0),f=typeof c==`number`&&c<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;if(d?p?(i.minimum=l,i.exclusiveMinimum=!0):i.exclusiveMinimum=l:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=c,i.exclusiveMaximum=!0):i.exclusiveMaximum=c:typeof o==`number`&&(i.maximum=o),s){let n=new Set;for(let a of s)Number.isFinite(a)&&a!==0?n.add(Math.abs(a)):$a(e,t,i,r,`A multipleOf divisor of ${a} cannot be represented in JSON Schema`);let[a,...o]=n;a!==void 0&&(i.multipleOf=a),o.length&&(i.allOf=[...i.allOf??[],...o.map(e=>({multipleOf:e}))])}},ko=(e,t,n,r)=>{n.type=`boolean`},Ao=(e,t,n,r)=>{n.not={}},jo=(e,t,n,r)=>{let i=e._zod.def,a=ne(i.entries);if(a.length===0){n.not={};return}a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},Mo=(e,t,n,r)=>{let i=e._zod.def;if(i.values.length===0){n.not={};return}let a=[];for(let o of i.values)if(o===void 0){if($a(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if($a(e,t,n,r,`BigInt literals cannot be represented in JSON Schema`))return;a.push(Number(o))}else a.push(o);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},No=(e,t,n,r)=>{$a(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},Po=(e,t,n,r)=>{$a(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},Fo=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=Co(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=E(a.element,t,{...r,path:[...r.path,`items`]})};function Io(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?Io(t.out):t.type===`catch`?Io(t.innerType):e._zod.optin}var Lo=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&$a(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)ue(i.properties,e,E(o[e],t,{...r,path:[...r.path,`properties`,e]}));let s=[];for(let e of Object.keys(o)){let n=a.shape[e];(t.io===`input`?Io(n)===void 0:n._zod.optout===void 0)&&s.push(e)}s.length>0&&(i.required=s),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=E(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Ro=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>E(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},zo=(e,t,n,r)=>{let i=e._zod.def,a=E(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=E(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1,c=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]];n.allOf=c,t.intersections.push(c)};function Bo(e,t,n){if(t.$ref){if(n.has(t))return t;n.add(t);let r=e.get(t)?.def;if(!r)return t;let i=Bo(e,r,n);return i===r?t:i}for(let r of[`anyOf`,`oneOf`]){let i=t[r];if(!Array.isArray(i))continue;let a=i.map(t=>Bo(e,t,n));a.some((e,t)=>e!==i[t])&&(t={...t,[r]:a})}let r=Array.isArray(t.type)?t.type:[t.type],i=!r.includes(`string`)&&r.some(e=>e===`number`||e===`integer`),a=t.enum??(t.const===void 0?void 0:[t.const]);if(!i&&!a?.some(e=>typeof e==`number`))return t;let{minimum:o,maximum:s,exclusiveMinimum:c,exclusiveMaximum:l,multipleOf:u,format:d,id:f,...p}=t;return p.enum?p.enum=p.enum.map(e=>typeof e==`number`?String(e):e):typeof p.const==`number`&&(p.const=String(p.const)),i?(p.type=`string`,a||(p.pattern=(r.includes(`number`)?wn:Cn).source),p):p}var Vo=new WeakMap;function Ho(e){let t=new Map;for(let n of e.seen.values())n.def&&!t.has(n.schema)&&t.set(n.schema,n);let n=new Map;for(let r of Vo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=Bo(t,a,new Set);o!==a&&n.set(a,o)}if(n.size)for(let t of e.seen.values())for(let e of[t.schema,t.def]){let t=e&&n.get(e.propertyNames);t&&(e.propertyNames=t)}}var Uo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=Co(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=E(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)ue(i.patternProperties,Eo(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=E(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=Vo.get(t);n||(n=[],Vo.set(t,n),t.deferred.push(()=>Ho(t))),n.push(e)}i.additionalProperties=E(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&Io(a.valueType)!==void 0;if(c&&!a.partial&&!l){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e.map(String))}},Wo=(e,t,n,r)=>{let i=e._zod.def,a=E(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Go=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ko=Symbol();function qo(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?($a(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),Ko):JSON.parse(o)}var Jo=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=qo(i.defaultValue,e,t,n,r);o!==Ko&&(n.default=o)},Yo=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=qo(i.defaultValue,e,t,n,r);o!==Ko&&(n._prefault=o)},Xo=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{$a(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},Zo=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;E(o,t,r);let s=t.seen.get(e);s.ref=o},Qo=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},$o=(e,t,n,r)=>{let i=e._zod.def;E(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},es=new WeakSet([Object.prototype,Error.prototype]);function ts(e,t,n){Object.defineProperty(e,t,{configurable:!0,enumerable:!1,get(){let e=n(this);return Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0}),e},set(e){Object.defineProperty(this,t,{value:e,configurable:!0,writable:!0})}})}var ns=C(`ZodError`,(e,t)=>{Tt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);es.has(n)||(es.add(n),ts(n,`format`,e=>t=>Ot(e,t)),ts(n,`flatten`,e=>t=>Dt(e,t)),ts(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ie,2)}),ts(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ie,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),rs=At(ns),is=jt(ns),as=Mt(ns),os=Pt(ns),ss=Bt(ns),cs=Vt(ns),ls=Ht(ns),us=Ut(ns),ds=Wt(ns),fs=Gt(ns),ps=Kt(ns),ms=qt(ns);function hs(){_t.localeError||vt(Ui())}function gs(){_t.memoizer||vt({memoizer:Bi()})}var O=C(`ZodType`,(e,t)=>(hs(),w.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(_e(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return De(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Fc(e,t))},superRefine(e,t){return this.check(Ic(e,t))},overwrite(e){return this.check(Va(e))},optional(){return _c(this)},exactOptional(){return yc(this)},nullable(){return xc(this)},nullish(){return _c(xc(this))},nonoptional(e){return Dc(this,e)},array(){return j(this)},or(e){return rc([this,e])},and(e){return sc(this,e)},transform(e){return jc(this,hc(e))},default(e){return Cc(this,e)},prefault(e){return Tc(this,e)},catch(e){return kc(this,e)},pipe(e){return jc(this,e)},readonly(){return Nc(this)},describe(e){let t=this.clone();return qi.add(t,{description:e}),t},meta(...e){if(e.length===0)return qi.get(this);let t=this.clone();return qi.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e,...t){return t.length===0?e(this):e(this,...t)},get"~standard"(){return tt(this,`~standard`,{...Xn(this),jsonSchema:{input:uo(this,`input`),output:uo(this,`output`)}})},set"~standard"(e){et(this,`~standard`,e)},parse:function e(t,n){return rs(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await is(this,t,n,{callee:e})},safeParse(e,t){return as(this,e,t)},async safeParseAsync(e,t){return os(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){et(this,`spa`,e)},validate(e,t){return Lt(this,e,t)},validateAsync(e,t){return zt(this,e,t)},encode:function e(t,n){return ss(this,t,n,{callee:e})},decode:function e(t,n){return cs(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await ls(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await us(this,t,n,{callee:e})},safeEncode(e,t){return ds(this,e,t)},safeDecode(e,t){return fs(this,e,t)},async safeEncodeAsync(e,t){return ps(this,e,t)},async safeDecodeAsync(e,t){return ms(this,e,t)},toJSONSchema(e){return lo(this,{})(e)},get description(){return qi.get(this)?.description},get _def(){return this._zod.def}}),_s=C(`_ZodString`,(e,t)=>{Zn.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r)},nt({format:e=>Co(e).format??null,minLength:e=>Co(e).minimum??null,maxLength:e=>Co(e).maximum??null},{regex(...e){return this.check(Fa(...e))},includes(...e){return this.check(Ra(...e))},startsWith(...e){return this.check(za(...e))},endsWith(...e){return this.check(Ba(...e))},min(...e){return this.check(Na(...e))},max(...e){return this.check(Ma(...e))},length(...e){return this.check(Pa(...e))},nonempty(...e){return this.check(Na(1,...e))},lowercase(e){return this.check(Ia(e))},uppercase(e){return this.check(La(e))},trim(){return this.check(Ua())},normalize(...e){return this.check(Ha(...e))},toLowerCase(){return this.check(Wa())},toUpperCase(){return this.check(Ga())},slugify(){return this.check(Ka())}})),vs=C(`ZodString`,(e,t)=>{Zn.init(e,t),_s.init(e,t)},{email(e){return this.check(Xi(Cs,e))},url(e){return this.check(na(Es,e))},jwt(e){return this.check(_a(Hs,e))},emoji(e){return this.check(ra(Os,e))},guid(e){return this.check(Zi(ws,e))},uuid(e){return this.check(Qi(Ts,e))},uuidv4(e){return this.check($i(Ts,e))},uuidv6(e){return this.check(ea(Ts,e))},uuidv7(e){return this.check(ta(Ts,e))},nanoid(e){return this.check(ia(ks,e))},cuid(e){return this.check(aa(As,e))},cuid2(e){return this.check(oa(js,e))},ulid(e){return this.check(sa(Ms,e))},base64(e){return this.check(ma(zs,e))},base64url(e){return this.check(ha(Bs,e))},xid(e){return this.check(ca(Ns,e))},ksuid(e){return this.check(la(Ps,e))},ipv4(e){return this.check(ua(Fs,e))},ipv6(e){return this.check(da(Is,e))},cidrv4(e){return this.check(fa(Ls,e))},cidrv6(e){return this.check(pa(Rs,e))},e164(e){return this.check(ga(Vs,e))},datetime(e){return this.check(va(ys,e))},date(e){return this.check(ya(bs,e))},time(e){return this.check(ba(xs,e))},duration(e){return this.check(xa(Ss,e))}});function k(e){return Yi(vs,e)}var A=C(`ZodStringFormat`,(e,t)=>{T.init(e,t),_s.init(e,t)}),ys=C(`ZodISODateTime`,(e,t)=>{gr.init(e,t),A.init(e,t)}),bs=C(`ZodISODate`,(e,t)=>{_r.init(e,t),A.init(e,t)}),xs=C(`ZodISOTime`,(e,t)=>{vr.init(e,t),A.init(e,t)}),Ss=C(`ZodISODuration`,(e,t)=>{yr.init(e,t),A.init(e,t)}),Cs=C(`ZodEmail`,(e,t)=>{er.init(e,t),A.init(e,t)}),ws=C(`ZodGUID`,(e,t)=>{Qn.init(e,t),A.init(e,t)}),Ts=C(`ZodUUID`,(e,t)=>{$n.init(e,t),A.init(e,t)}),Es=C(`ZodURL`,(e,t)=>{cr.init(e,t),A.init(e,t)});function Ds(e){return na(Es,e)}var Os=C(`ZodEmoji`,(e,t)=>{lr.init(e,t),A.init(e,t)}),ks=C(`ZodNanoID`,(e,t)=>{ur.init(e,t),A.init(e,t)}),As=C(`ZodCUID`,(e,t)=>{dr.init(e,t),A.init(e,t)}),js=C(`ZodCUID2`,(e,t)=>{fr.init(e,t),A.init(e,t)}),Ms=C(`ZodULID`,(e,t)=>{pr.init(e,t),A.init(e,t)}),Ns=C(`ZodXID`,(e,t)=>{mr.init(e,t),A.init(e,t)}),Ps=C(`ZodKSUID`,(e,t)=>{hr.init(e,t),A.init(e,t)}),Fs=C(`ZodIPv4`,(e,t)=>{br.init(e,t),A.init(e,t)}),Is=C(`ZodIPv6`,(e,t)=>{Cr.init(e,t),A.init(e,t)}),Ls=C(`ZodCIDRv4`,(e,t)=>{wr.init(e,t),A.init(e,t)}),Rs=C(`ZodCIDRv6`,(e,t)=>{Er.init(e,t),A.init(e,t)}),zs=C(`ZodBase64`,(e,t)=>{kr.init(e,t),A.init(e,t)}),Bs=C(`ZodBase64URL`,(e,t)=>{Mr.init(e,t),A.init(e,t)}),Vs=C(`ZodE164`,(e,t)=>{Nr.init(e,t),A.init(e,t)}),Hs=C(`ZodJWT`,(e,t)=>{Fr.init(e,t),A.init(e,t)}),Us=C(`ZodNumber`,(e,t)=>{Ir.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.isFinite=!0},nt({minValue:e=>{let{minimum:t,exclusiveMinimum:n}=Co(e);return Math.max(t??-1/0,n??-1/0)},maxValue:e=>{let{maximum:t,exclusiveMaximum:n}=Co(e);return Math.min(t??1/0,n??1/0)},isInt:e=>{let{isInt:t,multipleOf:n}=Co(e);return!!t||!!n?.some(Number.isSafeInteger)},format:e=>Co(e).format??null},{gt(e,t){return this.check(ka(e,t))},gte(e,t){return this.check(Aa(e,t))},min(e,t){return this.check(Aa(e,t))},lt(e,t){return this.check(Da(e,t))},lte(e,t){return this.check(Oa(e,t))},max(e,t){return this.check(Oa(e,t))},int(e){return this.check(Ks(e))},safe(e){return this.check(Ks(e))},positive(e){return this.check(ka(0,e))},nonnegative(e){return this.check(Aa(0,e))},negative(e){return this.check(Da(0,e))},nonpositive(e){return this.check(Oa(0,e))},multipleOf(e,t){return this.check(ja(e,t))},step(e,t){return this.check(ja(e,t))},finite(){return this}}));function Ws(e){return Sa(Us,e)}var Gs=C(`ZodNumberFormat`,(e,t)=>{Lr.init(e,t),Us.init(e,t)});function Ks(e){return Ca(Gs,e)}var qs=C(`ZodBoolean`,(e,t)=>{Rr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r)});function Js(e){return wa(qs,e)}var Ys=C(`ZodUnknown`,(e,t)=>{zr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Xs(){return Ta(Ys)}var Zs=C(`ZodNever`,(e,t)=>{Br.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r)});function Qs(e){return Ea(Zs,e)}var $s=C(`ZodArray`,(e,t)=>{gs(),Wr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fo(e,t,n,r),e.element=t.element},{min(e,t){return this.check(Na(e,t))},nonempty(e){return this.check(Na(1,e))},max(e,t){return this.check(Ma(e,t))},length(e,t){return this.check(Pa(e,t))},unwrap(){return this.element}});function j(e,t){return qa($s,e,t)}var ec=C(`ZodObject`,(e,t)=>{gs(),Xr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Lo(e,t,n,r),ct(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return fc(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(_e(this._zod.def,{catchall:e}))},passthrough(){return this.clone(_e(this._zod.def,{catchall:Xs()}))},loose(){return this.clone(_e(this._zod.def,{catchall:Xs()}))},strict(){return this.clone(_e(this._zod.def,{catchall:Qs()}))},strip(){return this.clone(_e(this._zod.def,{catchall:void 0}))},extend(e){return Fe(this,e)},safeExtend(e){return Le(this,e)},merge(e){return Re(this,e)},pick(e){return Me(this,e)},omit(e){return Pe(this,e)},partial(...e){return ze(gc,this,e[0])},exactPartial(...e){return ze(vc,this,e[0],`exactPartial`)},required(...e){return Be(Ec,this,e[0])}});function M(e,t){return new ec({type:`object`,shape:e??{},...x(t)})}function tc(e,t){return new ec({type:`object`,shape:e,catchall:Xs(),...x(t)})}var nc=C(`ZodUnion`,(e,t)=>{Qr.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ro(e,t,n,r),e.options=t.options});function rc(e,t){return new nc({type:`union`,options:e,...x(t)})}var ic=C(`ZodDiscriminatedUnion`,(e,t)=>{nc.init(e,t),ei.init(e,t)});function ac(e,t,n){return new ic({type:`union`,options:t,discriminator:e,...x(n)})}var oc=C(`ZodIntersection`,(e,t)=>{ti.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>zo(e,t,n,r)});function sc(e,t){return new oc({type:`intersection`,left:e,right:t})}var cc=C(`ZodRecord`,(e,t)=>{gs(),ii.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Uo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function lc(e,t,n){return!t||!t._zod?new cc({type:`record`,keyType:k(),valueType:e,...x(t)}):new cc({type:`record`,keyType:e,valueType:t,...x(n)})}function uc(e,t,n){return new cc({type:`record`,keyType:e,valueType:t,...x(n),partial:!0})}var dc=C(`ZodEnum`,(e,t)=>{ai.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.enum=t.entries,e.options=[...e._zod.values];let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new dc({...t,checks:[],...x(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new dc({...t,checks:[],...x(r),entries:i})}});function fc(e,t){return new dc({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...x(t)})}var pc=C(`ZodLiteral`,(e,t)=>{oi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Mo(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function N(e,t){return new pc({type:`literal`,values:Array.isArray(e)?e:[e],...x(t)})}var mc=C(`ZodTransform`,(e,t)=>{gs(),si.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Po(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new gt(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Qe(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,`input`in t||(t.input=n.value),t.inst??=e,n.issues.push(Qe(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n)):(n.value=i,n)}});function hc(e){return new mc({type:`transform`,transform:e})}var gc=C(`ZodOptional`,(e,t)=>{li.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _c(e){return new gc({type:`optional`,innerType:e})}var vc=C(`ZodExactOptional`,(e,t)=>{ui.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>$o(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function yc(e){return new vc({type:`optional`,innerType:e})}var bc=C(`ZodNullable`,(e,t)=>{di.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function xc(e){return new bc({type:`nullable`,innerType:e})}var Sc=C(`ZodDefault`,(e,t)=>{fi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Cc(e,t){return new Sc({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}var wc=C(`ZodPrefault`,(e,t)=>{mi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Yo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Tc(e,t){return new wc({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():we(t)}})}var Ec=C(`ZodNonOptional`,(e,t)=>{hi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Go(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Dc(e,t){return new Ec({type:`nonoptional`,innerType:e,...x(t)})}var Oc=C(`ZodCatch`,(e,t)=>{vi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Xo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function kc(e,t){return new Oc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:ut(t)})}var Ac=C(`ZodPipe`,(e,t)=>{yi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Zo(e,t,n,r),e.in=t.in,e.out=t.out});function jc(e,t){return new Ac({type:`pipe`,in:e,out:t})}var Mc=C(`ZodReadonly`,(e,t)=>{xi.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Qo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Nc(e){return new Mc({type:`readonly`,innerType:e})}var Pc=C(`ZodCustom`,(e,t)=>{Ci.init(e,t),O.init(e,t),e._zod.processJSONSchema=(t,n,r)=>No(e,t,n,r)});function Fc(e,t={}){return Ja(Pc,e,t)}function Ic(e,t){return Ya(e,t)}var Lc=class e{static fromString(t){return new e(t)}constructor(e){this.value=e}icaltype=`binary`;decodeValue(){return this._b64_decode(this.value)}setEncodedValue(e){this.value=this._b64_encode(e)}_b64_encode(e){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,n,r,i,a,o,s,c,l,u=0,d=0,f=``,p=[];if(!e)return e;do n=e.charCodeAt(u++),r=e.charCodeAt(u++),i=e.charCodeAt(u++),l=n<<16|r<<8|i,a=l>>18&63,o=l>>12&63,s=l>>6&63,c=l&63,p[d++]=t.charAt(a)+t.charAt(o)+t.charAt(s)+t.charAt(c);while(u<e.length);f=p.join(``);let m=e.length%3;return(m?f.slice(0,m-3):f)+`===`.slice(m||3)}_b64_decode(e){let t=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,n,r,i,a,o,s,c,l,u=0,d=0,f=``,p=[];if(!e)return e;e+=``;do a=t.indexOf(e.charAt(u++)),o=t.indexOf(e.charAt(u++)),s=t.indexOf(e.charAt(u++)),c=t.indexOf(e.charAt(u++)),l=a<<18|o<<12|s<<6|c,n=l>>16&255,r=l>>8&255,i=l&255,s==64?p[d++]=String.fromCharCode(n):c==64?p[d++]=String.fromCharCode(n,r):p[d++]=String.fromCharCode(n,r,i);while(u<e.length);return f=p.join(``),f}toString(){return this.value}},Rc=/([PDWHMTS]{1,1})/,zc=[`weeks`,`days`,`hours`,`minutes`,`seconds`,`isNegative`],Bc=class e{static fromSeconds(t){return new e().fromSeconds(t)}static isValueString(e){return e[0]===`P`||e[1]===`P`}static fromString(t){let n=0,r=Object.create(null),i=0;for(;(n=t.search(Rc))!==-1;){let e=t[n],a=t.slice(0,Math.max(0,n));t=t.slice(n+1),i+=Vc(e,a,r)}if(i<2)throw Error(`invalid duration value: Not enough duration components in "`+t+`"`);return new e(r)}static fromData(t){return new e(t)}constructor(e){this.wrappedJSObject=this,this.fromData(e)}weeks=0;days=0;hours=0;minutes=0;seconds=0;isNegative=!1;icalclass=`icalduration`;icaltype=`duration`;clone(){return e.fromData(this)}toSeconds(){let e=this.seconds+60*this.minutes+3600*this.hours+86400*this.days+604800*this.weeks;return this.isNegative?-e:e}fromSeconds(e){let t=Math.abs(e);return this.isNegative=e<0,this.days=z(t/86400),this.days%7==0?(this.weeks=this.days/7,this.days=0):this.weeks=0,t-=(this.days+7*this.weeks)*86400,this.hours=z(t/3600),t-=this.hours*3600,this.minutes=z(t/60),t-=this.minutes*60,this.seconds=t,this}fromData(e){for(let t of zc)this[t]=e&&t in e?e[t]:0}reset(){this.isNegative=!1,this.weeks=0,this.days=0,this.hours=0,this.minutes=0,this.seconds=0}compare(e){let t=this.toSeconds(),n=e.toSeconds();return(t>n)-(t<n)}normalize(){this.fromSeconds(this.toSeconds())}toString(){if(this.toSeconds()==0)return`PT0S`;{let e=``;this.isNegative&&(e+=`-`),e+=`P`;let t=!1;return this.weeks?this.days||this.hours||this.minutes||this.seconds?e+=this.weeks*7+this.days+`D`:(e+=this.weeks+`W`,t=!0):this.days&&(e+=this.days+`D`),t||(this.hours||this.minutes||this.seconds)&&(e+=`T`,this.hours&&(e+=this.hours+`H`),this.minutes&&(e+=this.minutes+`M`),this.seconds&&(e+=this.seconds+`S`)),e}}toICALString(){return this.toString()}};function Vc(e,t,n){let r;switch(e){case`P`:n.isNegative=!!(t&&t===`-`);break;case`D`:r=`days`;break;case`W`:r=`weeks`;break;case`H`:r=`hours`;break;case`M`:r=`minutes`;break;case`S`:r=`seconds`;break;default:return 0}if(r){if(!t&&t!==0)throw Error(`invalid duration value: Missing number before "`+e+`"`);let i=parseInt(t,10);if(el(i))throw Error(`invalid duration value: Invalid number "`+t+`" before "`+e+`"`);n[r]=i}return 1}var Hc=class e{static fromString(t,n){let r=t.split(`/`);if(r.length!==2)throw Error(`Invalid string value: "`+t+`" must contain a "/" char.`);let i={start:P.fromDateTimeString(r[0],n)},a=r[1];return Bc.isValueString(a)?i.duration=Bc.fromString(a):i.end=P.fromDateTimeString(a,n),new e(i)}static fromData(t){return new e(t)}static fromJSON(t,n,r){function i(e,t){return r?P.fromString(e,t):P.fromDateTimeString(e,t)}return Bc.isValueString(t[1])?e.fromData({start:i(t[0],n),duration:Bc.fromString(t[1])}):e.fromData({start:i(t[0],n),end:i(t[1],n)})}constructor(e){if(this.wrappedJSObject=this,e&&`start`in e){if(e.start&&!(e.start instanceof P))throw TypeError(`.start must be an instance of ICAL.Time`);this.start=e.start}if(e&&e.end&&e.duration)throw Error(`cannot accept both end and duration`);if(e&&`end`in e){if(e.end&&!(e.end instanceof P))throw TypeError(`.end must be an instance of ICAL.Time`);this.end=e.end}if(e&&`duration`in e){if(e.duration&&!(e.duration instanceof Bc))throw TypeError(`.duration must be an instance of ICAL.Duration`);this.duration=e.duration}}start=null;end=null;duration=null;icalclass=`icalperiod`;icaltype=`period`;clone(){return e.fromData({start:this.start?this.start.clone():null,end:this.end?this.end.clone():null,duration:this.duration?this.duration.clone():null})}getDuration(){return this.duration?this.duration:this.end.subtractDate(this.start)}getEnd(){if(this.end)return this.end;{let e=this.start.clone();return e.addDuration(this.duration),e}}compare(e){return e.compare(this.start)<0?1:e.compare(this.getEnd())>0?-1:0}toString(){return this.start+`/`+(this.end||this.duration)}toJSON(){return[this.start.toString(),(this.end||this.duration).toString()]}toICALString(){return this.start.toICALString()+`/`+(this.end||this.duration).toICALString()}},P=class e{static _dowCache={};static _wnCache={};static daysInMonth(t,n){let r=[0,31,28,31,30,31,30,31,31,30,31,30,31],i=30;return t<1||t>12?i:(i=r[t],t==2&&(i+=e.isLeapYear(n)),i)}static isLeapYear(e){return e<=1752?e%4==0:e%4==0&&e%100!=0||e%400==0}static fromDayOfYear(t,n){let r=n,i=t,a=new e;a.auto_normalize=!1;let o=+!!e.isLeapYear(r);if(i<1)return r--,o=+!!e.isLeapYear(r),i+=e.daysInYearPassedMonth[o][12],e.fromDayOfYear(i,r);if(i>e.daysInYearPassedMonth[o][12])return o=+!!e.isLeapYear(r),i-=e.daysInYearPassedMonth[o][12],r++,e.fromDayOfYear(i,r);a.year=r,a.isDate=!0;for(let t=11;t>=0;t--)if(i>e.daysInYearPassedMonth[o][t]){a.month=t+1,a.day=i-e.daysInYearPassedMonth[o][t];break}return a.auto_normalize=!0,a}static fromStringv2(t){return new e({year:parseInt(t.slice(0,4),10),month:parseInt(t.slice(5,7),10),day:parseInt(t.slice(8,10),10),isDate:!0})}static fromDateString(t){return new e({year:R(t.slice(0,4)),month:R(t.slice(5,7)),day:R(t.slice(8,10)),isDate:!0})}static fromDateTimeString(t,n){if(t.length<19)throw Error(`invalid date-time value: "`+t+`"`);let r,i;t.slice(-1)===`Z`?r=I.utcTimezone:n&&(i=n.getParameter(`tzid`),n.parent&&(n.parent.name===`standard`||n.parent.name===`daylight`?r=I.localTimezone:i&&(r=n.parent.getTimeZoneByID(i))));let a={year:R(t.slice(0,4)),month:R(t.slice(5,7)),day:R(t.slice(8,10)),hour:R(t.slice(11,13)),minute:R(t.slice(14,16)),second:R(t.slice(17,19))};return i&&!r&&(a.timezone=i),new e(a,r)}static fromString(t,n){return t.length>10?e.fromDateTimeString(t,n):e.fromDateString(t)}static fromJSDate(t,n){return new e().fromJSDate(t,n)}static fromData=function(t,n){return new e().fromData(t,n)};static now(){return e.fromJSDate(new Date,!1)}static weekOneStarts(t,n){let r=e.fromData({year:t,month:1,day:1,isDate:!0}),i=r.dayOfWeek(),a=n||e.DEFAULT_WEEK_START;return i>e.THURSDAY&&(r.day+=7),a>e.THURSDAY&&(r.day-=7),r.day-=i-a,r}static getDominicalLetter(t){let n=`GFEDCBA`,r=(t+(t/4|0)+(t/400|0)-(t/100|0)-1)%7;return e.isLeapYear(t)?n[(r+6)%7]+n[r]:n[r]}static#e=null;static get epochTime(){return this.#e||=e.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:`Z`}),this.#e}static _cmp_attr(e,t,n){return e[n]>t[n]?1:e[n]<t[n]?-1:0}static daysInYearPassedMonth=[[0,31,59,90,120,151,181,212,243,273,304,334,365],[0,31,60,91,121,152,182,213,244,274,305,335,366]];static SUNDAY=1;static MONDAY=2;static TUESDAY=3;static WEDNESDAY=4;static THURSDAY=5;static FRIDAY=6;static SATURDAY=7;static DEFAULT_WEEK_START=2;constructor(e,t){this.wrappedJSObject=this,this._time=Object.create(null),this._time.year=0,this._time.month=1,this._time.day=1,this._time.hour=0,this._time.minute=0,this._time.second=0,this._time.isDate=!1,this.fromData(e,t)}icalclass=`icaltime`;_cachedUnixTime=null;get icaltype(){return this.isDate?`date`:`date-time`}zone=null;_pendingNormalization=!1;get year(){return this._getTimeAttr(`year`)}set year(e){this._setTimeAttr(`year`,e)}get month(){return this._getTimeAttr(`month`)}set month(e){this._setTimeAttr(`month`,e)}get day(){return this._getTimeAttr(`day`)}set day(e){this._setTimeAttr(`day`,e)}get hour(){return this._getTimeAttr(`hour`)}set hour(e){this._setTimeAttr(`hour`,e)}get minute(){return this._getTimeAttr(`minute`)}set minute(e){this._setTimeAttr(`minute`,e)}get second(){return this._getTimeAttr(`second`)}set second(e){this._setTimeAttr(`second`,e)}get isDate(){return this._getTimeAttr(`isDate`)}set isDate(e){this._setTimeAttr(`isDate`,e)}_getTimeAttr(e){return this._pendingNormalization&&=(this._normalize(),!1),this._time[e]}_setTimeAttr(e,t){e===`isDate`&&t&&!this._time.isDate&&this.adjust(0,0,0,0),this._cachedUnixTime=null,this._pendingNormalization=!0,this._time[e]=t}clone(){return new e(this._time,this.zone)}reset(){this.fromData(e.epochTime),this.zone=I.utcTimezone}resetTo(e,t,n,r,i,a,o){this.fromData({year:e,month:t,day:n,hour:r,minute:i,second:a,zone:o})}fromJSDate(e,t){return e?t?(this.zone=I.utcTimezone,this.year=e.getUTCFullYear(),this.month=e.getUTCMonth()+1,this.day=e.getUTCDate(),this.hour=e.getUTCHours(),this.minute=e.getUTCMinutes(),this.second=e.getUTCSeconds()):(this.zone=I.localTimezone,this.year=e.getFullYear(),this.month=e.getMonth()+1,this.day=e.getDate(),this.hour=e.getHours(),this.minute=e.getMinutes(),this.second=e.getSeconds()):this.reset(),this._cachedUnixTime=null,this}fromData(e,t){if(e)for(let[t,n]of Object.entries(e))t!==`icaltype`&&(this[t]=n);if(t&&(this.zone=t),e&&!(`isDate`in e)?this.isDate=!(`hour`in e):e&&`isDate`in e&&(this.isDate=e.isDate),e&&`timezone`in e){let t=Qc.get(e.timezone);this.zone=t||I.localTimezone}return e&&`zone`in e&&(this.zone=e.zone),this.zone||=I.localTimezone,this._cachedUnixTime=null,this}dayOfWeek(t){let n=t||e.SUNDAY,r=(this.year<<12)+(this.month<<8)+(this.day<<3)+n;if(r in e._dowCache)return e._dowCache[r];let i=this.day,a=this.month+(this.month<3?12:0),o=this.year-+(this.month<3),s=i+o+z((a+1)*26/10)+z(o/4);return s+=z(o/100)*6+z(o/400),s=(s+7-n)%7+1,e._dowCache[r]=s,s}dayOfYear(){let t=+!!e.isLeapYear(this.year);return e.daysInYearPassedMonth[t][this.month-1]+this.day}startOfWeek(t){let n=t||e.SUNDAY,r=this.clone();return r.day-=(this.dayOfWeek()+7-n)%7,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r}endOfWeek(t){let n=t||e.SUNDAY,r=this.clone();return r.day+=(7-this.dayOfWeek()+n-e.SUNDAY)%7,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r}startOfMonth(){let e=this.clone();return e.day=1,e.isDate=!0,e.hour=0,e.minute=0,e.second=0,e}endOfMonth(){let t=this.clone();return t.day=e.daysInMonth(t.month,t.year),t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t}startOfYear(){let e=this.clone();return e.day=1,e.month=1,e.isDate=!0,e.hour=0,e.minute=0,e.second=0,e}endOfYear(){let e=this.clone();return e.day=31,e.month=12,e.isDate=!0,e.hour=0,e.minute=0,e.second=0,e}startDoyWeek(t){let n=t||e.SUNDAY,r=this.dayOfWeek()-n;return r<0&&(r+=7),this.dayOfYear()-r}getDominicalLetter(){return e.getDominicalLetter(this.year)}nthWeekDay(t,n){let r=e.daysInMonth(this.month,this.year),i,a=n,o=0,s=this.clone();if(a>=0){s.day=1,a!=0&&a--,o=s.day;let e=t-s.dayOfWeek();e<0&&(e+=7),o+=e,o-=t,i=t}else{s.day=r;let e=s.dayOfWeek();a++,i=e-t,i<0&&(i+=7),i=r-i}return i+=a*7,o+i}isNthWeekDay(e,t){let n=this.dayOfWeek();return t===0&&n===e||this.nthWeekDay(e,t)===this.day}weekNumber(t){let n=(this.year<<12)+(this.month<<8)+(this.day<<3)+t;if(n in e._wnCache)return e._wnCache[n];let r,i=this.clone();i.isDate=!0;let a=this.year;i.month==12&&i.day>25?(r=e.weekOneStarts(a+1,t),i.compare(r)<0?r=e.weekOneStarts(a,t):a++):(r=e.weekOneStarts(a,t),i.compare(r)<0&&(r=e.weekOneStarts(--a,t)));let o=z(i.subtractDate(r).toSeconds()/86400/7)+1;return e._wnCache[n]=o,o}addDuration(e){let t=e.isNegative?-1:1,n=this.second,r=this.minute,i=this.hour,a=this.day;n+=t*e.seconds,r+=t*e.minutes,i+=t*e.hours,a+=t*e.days,a+=t*7*e.weeks,this.second=n,this.minute=r,this.hour=i,this.day=a,this._cachedUnixTime=null}subtractDate(e){let t=this.toUnixTime()+this.utcOffset(),n=e.toUnixTime()+e.utcOffset();return Bc.fromSeconds(t-n)}subtractDateTz(e){let t=this.toUnixTime(),n=e.toUnixTime();return Bc.fromSeconds(t-n)}compare(e){if(e instanceof Hc)return-1*e.compare(this);{let t=this.toUnixTime(),n=e.toUnixTime();return t>n?1:n>t?-1:0}}compareDateOnlyTz(t,n){let r=this.convertToZone(n),i=t.convertToZone(n),a=0;return(a=e._cmp_attr(r,i,`year`))!=0||(a=e._cmp_attr(r,i,`month`))!=0||(a=e._cmp_attr(r,i,`day`)),a}convertToZone(e){let t=this.clone(),n=this.zone.tzid==e.tzid;return!this.isDate&&!n&&I.convert_time(t,this.zone,e),t.zone=e,t}utcOffset(){return this.zone==I.localTimezone||this.zone==I.utcTimezone?0:this.zone.utcOffset(this)}toICALString(){let e=this.toString();return e.length>10?H.icalendar.value[`date-time`].toICAL(e):H.icalendar.value.date.toICAL(e)}toString(){let e=this.year+`-`+ol(this.month)+`-`+ol(this.day);return this.isDate||(e+=`T`+ol(this.hour)+`:`+ol(this.minute)+`:`+ol(this.second),this.zone===I.utcTimezone&&(e+=`Z`)),e}toJSDate(){return this.zone==I.localTimezone?this.isDate?new Date(this.year,this.month-1,this.day):new Date(this.year,this.month-1,this.day,this.hour,this.minute,this.second,0):new Date(this.toUnixTime()*1e3)}_normalize(){return this._time.isDate&&(this._time.hour=0,this._time.minute=0,this._time.second=0),this.adjust(0,0,0,0),this}adjust(t,n,r,i,a){let o,s,c=0,l=0,u,d,f,p,m,h=a||this._time;if(h.isDate||(u=h.second+i,h.second=u%60,o=z(u/60),h.second<0&&(h.second+=60,o--),d=h.minute+r+o,h.minute=d%60,s=z(d/60),h.minute<0&&(h.minute+=60,s--),f=h.hour+n+s,h.hour=f%24,c=z(f/24),h.hour<0&&(h.hour+=24,c--)),h.month>12?l=z((h.month-1)/12):h.month<1&&(l=z(h.month/12)-1),h.year+=l,h.month-=12*l,p=h.day+t+c,p>0)for(;m=e.daysInMonth(h.month,h.year),!(p<=m);)h.month++,h.month>12&&(h.year++,h.month=1),p-=m;else for(;p<=0;)h.month==1?(h.year--,h.month=12):h.month--,p+=e.daysInMonth(h.month,h.year);return h.day=p,this._cachedUnixTime=null,this}fromUnixTime(e){this.zone=I.utcTimezone;let t=new Date(e*1e3);this.year=t.getUTCFullYear(),this.month=t.getUTCMonth()+1,this.day=t.getUTCDate(),this._time.isDate?(this.hour=0,this.minute=0,this.second=0):(this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds()),this._cachedUnixTime=null}toUnixTime(){if(this._cachedUnixTime!==null)return this._cachedUnixTime;let e=this.utcOffset(),t=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second-e);return this._cachedUnixTime=t/1e3,this._cachedUnixTime}toJSON(){let e=[`year`,`month`,`day`,`hour`,`minute`,`second`,`isDate`],t=Object.create(null),n=0,r=e.length,i;for(;n<r;n++)i=e[n],t[i]=this[i];return this.zone&&(t.timezone=this.zone.tzid),t}},Uc=/[^ \t]/,Wc=`:`,Gc=`;`,Kc=`=`,qc=`unknown`,Jc=`text`,Yc={"^'":`"`,"^n":`
|
|
57
|
+
`,"^^":`^`};function F(e){let t={},n=t.component=[];if(t.stack=[n],F._eachLine(e,function(e,n){F._handleContentLine(n,t)}),t.stack.length>1)throw new Xc(`invalid ical body. component began but did not end`);return t=null,n.length==1?n[0]:n}F.property=function(e,t){let n={component:[[],[]],designSet:t||H.defaultSet};return F._handleContentLine(e,n),n.component[1][0]},F.component=function(e){return F(e)};var Xc=class extends Error{name=this.constructor.name};F.ParserError=Xc,F._handleContentLine=function(e,t){let n=e.indexOf(Wc),r=e.indexOf(Gc),i,a,o,s,c={};r!==-1&&n!==-1&&r>n&&(r=-1);let l;if(r!==-1){if(o=e.slice(0,Math.max(0,r)).toLowerCase(),l=F._parseParameters(e.slice(Math.max(0,r)),0,t.designSet),l[2]==-1)throw new Xc(`Invalid parameters in '`+e+`'`);c=l[0];let n;if(n=typeof l[1]==`string`?l[1].length:l[1].reduce((e,t)=>e+t.length,0),i=n+l[2]+r,(a=e.slice(Math.max(0,i)).indexOf(Wc))!==-1)s=e.slice(Math.max(0,i+a+1));else throw new Xc(`Missing parameter value in '`+e+`'`)}else if(n!==-1){if(o=e.slice(0,Math.max(0,n)).toLowerCase(),s=e.slice(Math.max(0,n+1)),o===`begin`){let e=[s.toLowerCase(),[],[]];t.stack.length===1?t.component.push(e):t.component[2].push(e),t.stack.push(t.component),t.component=e,t.designSet||=H.getDesignSet(t.component[0]);return}if(o===`end`){t.component=t.stack.pop();return}}else throw new Xc(`invalid line (no token ";" or ":") "`+e+`"`);let u,d=!1,f=!1,p,m,h;t.designSet.propertyGroups&&o.indexOf(`.`)!==-1?(m=o.split(`.`),c.group=m[0],h=m[1]):h=o,h in t.designSet.property&&(p=t.designSet.property[h],`multiValue`in p&&(d=p.multiValue),`structuredValue`in p&&(f=p.structuredValue),s&&`detectType`in p&&(u=p.detectType(s))),u||=`value`in c?c.value.toLowerCase():p?p.defaultType:qc,delete c.value;let g;d&&f?(s=F._parseMultiValue(s,f,u,[],d,t.designSet,f),g=[h,c,u,s]):d?(g=[h,c,u],F._parseMultiValue(s,d,u,g,null,t.designSet,!1)):f?(s=F._parseMultiValue(s,f,u,[],null,t.designSet,f),g=[h,c,u,s]):(s=F._parseValue(s,u,t.designSet,!1),g=[h,c,u,s]),t.component[0]===`vcard`&&t.component[1].length===0&&(o!==`version`||s!==`4.0`)&&(t.designSet=H.getDesignSet(`vcard3`)),t.component[1].push(g)},F._parseValue=function(e,t,n,r){return t in n.value&&`fromICAL`in n.value[t]?n.value[t].fromICAL(e,r):e},F._parseParameters=function(e,t,n){let r=t,i=0,a=Kc,o={},s,c,l,u=-1,d,f,p;for(;i!==!1&&(i=e.indexOf(a,i+1))!==-1;){if(s=e.slice(r+1,i),s.length==0)throw new Xc(`Empty parameter name in '`+e+`'`);if(c=s.toLowerCase(),p=!1,f=!1,d=c in n.param&&n.param[c].valueType?n.param[c].valueType:Jc,c in n.param&&(f=n.param[c].multiValue,n.param[c].multiValueSeparateDQuote&&(p=F._rfc6868Escape(`"`+f+`"`))),e[i+1]===`"`){if(u=i+2,i=e.indexOf(`"`,u),f&&i!=-1){let t=!0;for(;t;)e[i+1]==f&&e[i+2]==`"`?i=e.indexOf(`"`,i+3):t=!1}if(i===-1)throw new Xc(`invalid line (no matching double quote) "`+e+`"`);l=e.slice(u,i),r=e.indexOf(Gc,i);let t=e.indexOf(Wc,i);(r===-1||t!==-1&&r>t)&&(i=!1)}else{u=i+1;let t=e.indexOf(Gc,u),n=e.indexOf(Wc,u);n!==-1&&t>n?(t=n,i=!1):t===-1?(t=n===-1?e.length:n,i=!1):(r=t,i=t),l=e.slice(u,t)}let t=l.length;if(l=F._rfc6868Escape(l),u+=t-l.length,f){let e=p||f;l=F._parseMultiValue(l,e,d,[],null,n)}else l=F._parseValue(l,d,n);f&&c in o?Array.isArray(o[c])?o[c].push(l):o[c]=[o[c],l]:o[c]=l}return[o,l,u]},F._rfc6868Escape=function(e){return e.replace(/\^['n^]/g,function(e){return Yc[e]})},F._parseMultiValue=function(e,t,n,r,i,a,o){let s=0,c=0,l;if(t.length===0)return e;for(;(s=nl(e,t,c))!==-1;)l=e.slice(c,s),l=i?F._parseMultiValue(l,i,n,[],null,a,o):F._parseValue(l,n,a,o),r.push(l),c=s+t.length;return l=e.slice(c),l=i?F._parseMultiValue(l,i,n,[],null,a,o):F._parseValue(l,n,a,o),r.push(l),r.length==1?r[0]:r},F._eachLine=function(e,t){let n=e.length,r=e.search(Uc),i=r,a,o,s;do i=e.indexOf(`
|
|
58
|
+
`,r)+1,s=i>1&&e[i-2]===`\r`?2:1,i===0&&(i=n,s=0),o=e[r],o===` `||o===` `?a+=e.slice(r+1,i-s):(a&&t(null,a),a=e.slice(r,i-s)),r=i;while(i!==n);a=a.trim(),a.length&&t(null,a)};var Zc=[`tzid`,`location`,`tznames`,`latitude`,`longitude`],I=class e{static _compare_change_fn(e,t){return e.year<t.year?-1:e.year>t.year?1:e.month<t.month?-1:e.month>t.month?1:e.day<t.day?-1:e.day>t.day?1:e.hour<t.hour?-1:e.hour>t.hour?1:e.minute<t.minute?-1:e.minute>t.minute?1:e.second<t.second?-1:+(e.second>t.second)}static convert_time(t,n,r){if(t.isDate||n.tzid==r.tzid||n==e.localTimezone||r==e.localTimezone)return t.zone=r,t;let i=n.utcOffset(t);return t.adjust(0,0,0,-i),i=r.utcOffset(t),t.adjust(0,0,0,i),null}static fromData(t){return new e().fromData(t)}static#e=null;static get utcTimezone(){return this.#e||=e.fromData({tzid:`UTC`}),this.#e}static#t=null;static get localTimezone(){return this.#t||=e.fromData({tzid:`floating`}),this.#t}static adjust_change(e,t,n,r,i){return P.prototype.adjust.call(e,t,n,r,i,e)}static _minimumExpansionYear=-1;static EXTRA_COVERAGE=5;constructor(e){this.wrappedJSObject=this,this.fromData(e)}tzid=``;location=``;tznames=``;latitude=0;longitude=0;component=null;expandedUntilYear=0;icalclass=`icaltimezone`;fromData(e){if(this.expandedUntilYear=0,this.changes=[],e instanceof uu)this.component=e;else{if(e&&`component`in e){if(typeof e.component==`string`){let t=F(e.component);this.component=new uu(t)}else this.component=e.component instanceof uu?e.component:null}for(let t of Zc)e&&t in e&&(this[t]=e[t])}return this.component instanceof uu&&!this.tzid&&(this.tzid=this.component.getFirstPropertyValue(`tzid`)),this}utcOffset(t){if(this==e.utcTimezone||this==e.localTimezone||(this._ensureCoverage(t.year),!this.changes.length))return 0;let n={year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second},r=this._findNearbyChange(n),i=-1,a=1;for(;;){let t=il(this.changes[r],!0);if(t.utcOffset<t.prevUtcOffset?e.adjust_change(t,0,0,0,t.utcOffset):e.adjust_change(t,0,0,0,t.prevUtcOffset),e._compare_change_fn(n,t)>=0?i=r:a=-1,a==-1&&i!=-1)break;if(r+=a,r<0)return 0;if(r>=this.changes.length)break}let o=this.changes[i];if(o.utcOffset-o.prevUtcOffset<0&&i>0){let t=il(o,!0);if(e.adjust_change(t,0,0,0,t.prevUtcOffset),e._compare_change_fn(n,t)<0){let e=this.changes[i-1];o.is_daylight!=0&&e.is_daylight==0&&(o=e)}}return o.utcOffset}_findNearbyChange(t){let n=rl(this.changes,t,e._compare_change_fn);return n>=this.changes.length?this.changes.length-1:n}_ensureCoverage(t){if(e._minimumExpansionYear==-1){let t=P.now();e._minimumExpansionYear=t.year}let n=t;if(n<e._minimumExpansionYear&&(n=e._minimumExpansionYear),n+=e.EXTRA_COVERAGE,!this.changes.length||this.expandedUntilYear<t){let t=this.component.getAllSubcomponents(),r=t.length,i=0;for(;i<r;i++)this._expandComponent(t[i],n,this.changes);this.changes.sort(e._compare_change_fn),this.expandedUntilYear=n}}_expandComponent(t,n,r){if(!t.hasProperty(`dtstart`)||!t.hasProperty(`tzoffsetto`)||!t.hasProperty(`tzoffsetfrom`))return null;let i=t.getFirstProperty(`dtstart`).getFirstValue(),a;function o(e){return e.factor*(e.hours*3600+e.minutes*60)}function s(){let e={};return e.is_daylight=t.name==`daylight`,e.utcOffset=o(t.getFirstProperty(`tzoffsetto`).getFirstValue()),e.prevUtcOffset=o(t.getFirstProperty(`tzoffsetfrom`).getFirstValue()),e}if(!t.hasProperty(`rrule`)&&!t.hasProperty(`rdate`))a=s(),a.year=i.year,a.month=i.month,a.day=i.day,a.hour=i.hour,a.minute=i.minute,a.second=i.second,e.adjust_change(a,0,0,0,-a.prevUtcOffset),r.push(a);else{let o=t.getAllProperties(`rdate`);for(let t of o){let n=t.getFirstValue();a=s(),a.year=n.year,a.month=n.month,a.day=n.day,n.isDate?(a.hour=i.hour,a.minute=i.minute,a.second=i.second,i.zone!=e.utcTimezone&&e.adjust_change(a,0,0,0,-a.prevUtcOffset)):(a.hour=n.hour,a.minute=n.minute,a.second=n.second,n.zone!=e.utcTimezone&&e.adjust_change(a,0,0,0,-a.prevUtcOffset)),r.push(a)}let c=t.getFirstProperty(`rrule`);if(c){c=c.getFirstValue(),a=s(),c.until&&c.until.zone==e.utcTimezone&&(c.until.adjust(0,0,0,a.prevUtcOffset),c.until.zone=e.localTimezone);let t=c.iterator(i),o;for(;(o=t.next())&&(a=s(),!(o.year>n||!o));)a.year=o.year,a.month=o.month,a.day=o.day,a.hour=o.hour,a.minute=o.minute,a.second=o.second,a.isDate=o.isDate,e.adjust_change(a,0,0,0,-a.prevUtcOffset),r.push(a)}}return r}toString(){return this.tznames?this.tznames:this.tzid}},L=null,Qc={get count(){return L===null?0:Object.keys(L).length},reset:function(){L=Object.create(null);let e=I.utcTimezone;L.Z=e,L.UTC=e,L.GMT=e},_hard_reset:function(){L=null},has:function(e){return L!==null&&!!L[e]},get:function(e){return L===null&&this.reset(),L[e]},register:function(e,t){if(L===null&&this.reset(),typeof e==`string`&&t instanceof I&&([e,t]=[t,e]),t||(e instanceof I?t=e.tzid:e.name===`vtimezone`&&(e=new I(e),t=e.tzid)),!t)throw TypeError(`Neither a timezone nor a name was passed`);if(e instanceof I)L[t]=e;else throw TypeError(`timezone must be ICAL.Timezone or ICAL.Component`)},remove:function(e){return L===null?null:delete L[e]}};function $c(e){let t,n,r,i,a;if(!e||e.name!==`vcalendar`)return e;for(t=e.getAllSubcomponents(),n=[],r={},a=0;a<t.length;a++)if(t[a].name===`vtimezone`){let e=t[a].getFirstProperty(`tzid`).getFirstValue();r[e]=t[a]}else n=n.concat(t[a].getAllProperties());for(i={},a=0;a<n.length;a++){let e=n[a].getParameter(`tzid`);e&&(i[e]=!0)}for(let[t,n]of Object.entries(r))i[t]||e.removeSubcomponent(n);for(let t of Object.keys(i))!r[t]&&Qc.has(t)&&e.addSubcomponent(Qc.get(t).component);return e}function el(e){return typeof e==`number`&&isNaN(e)}function R(e){let t=parseInt(e,10);if(el(t))throw Error(`Could not extract integer from "`+e+`"`);return t}function tl(e,t){if(e!==void 0)return e instanceof t?e:new t(e)}function nl(e,t,n){for(;(n=e.indexOf(t,n))!==-1;)if(n>0&&e[n-1]===`\\`)n+=1;else return n;return-1}function rl(e,t,n){if(!e.length)return 0;let r=0,i=e.length-1,a,o;for(;r<=i;)if(a=r+Math.floor((i-r)/2),o=n(t,e[a]),o<0)i=a-1;else if(o>0)r=a+1;else break;return o<0?a:o>0?a+1:a}function il(e,t){if(!e||typeof e!=`object`)return e;if(e instanceof Date)return new Date(e.getTime());if(`clone`in e)return e.clone();if(Array.isArray(e)){let n=[];for(let r=0;r<e.length;r++)n.push(t?il(e[r],!0):e[r]);return n}{let n={};for(let[r,i]of Object.entries(e))n[r]=t?il(i,!0):i;return n}}function al(e){let t=``,n=e||``,r=0,i=0;for(;n.length;){let e=n.codePointAt(r);e<128?++i:i+=e<2048?2:e<65536?3:4,i<mu.foldLength+1?r+=e>65535?2:1:(t+=mu.newLineChar+` `+n.slice(0,Math.max(0,r)),n=n.slice(Math.max(0,r)),r=i=0)}return t.slice(mu.newLineChar.length+1)}function ol(e){switch(typeof e!=`string`&&(typeof e==`number`&&(e=parseInt(e)),e=String(e)),e.length){case 0:return`00`;case 1:return`0`+e;default:return e}}function z(e){return e<0?Math.ceil(e):Math.floor(e)}function sl(e,t){for(let n in e){let r=Object.getOwnPropertyDescriptor(e,n);r&&!Object.getOwnPropertyDescriptor(t,n)&&Object.defineProperty(t,n,r)}return t}var cl=Object.freeze({__proto__:null,binsearchInsert:rl,clone:il,extend:sl,foldline:al,formatClassType:tl,isStrictlyNaN:el,pad2:ol,strictParseInt:R,trunc:z,unescapedIndexOf:nl,updateTimezones:$c}),ll=class e{static fromString(t){let n={};return n.factor=t[0]===`+`?1:-1,n.hours=R(t.slice(1,3)),n.minutes=R(t.slice(4,6)),new e(n)}static fromSeconds(t){let n=new e;return n.fromSeconds(t),n}constructor(e){this.fromData(e)}hours=0;minutes=0;factor=1;icaltype=`utc-offset`;clone(){return e.fromSeconds(this.toSeconds())}fromData(e){if(e)for(let[t,n]of Object.entries(e))this[t]=n;this._normalize()}fromSeconds(e){let t=Math.abs(e);return this.factor=e<0?-1:1,this.hours=z(t/3600),t-=this.hours*3600,this.minutes=z(t/60),this}toSeconds(){return this.factor*(60*this.minutes+3600*this.hours)}compare(e){let t=this.toSeconds(),n=e.toSeconds();return(t>n)-(n>t)}_normalize(){let e=this.toSeconds(),t=this.factor;for(;e<-43200;)e+=97200;for(;e>50400;)e-=97200;this.fromSeconds(e),e==0&&(this.factor=t)}toICALString(){return H.icalendar.value[`utc-offset`].toICAL(this.toString())}toString(){return(this.factor==1?`+`:`-`)+ol(this.hours)+`:`+ol(this.minutes)}},ul=class e extends P{static fromDateAndOrTimeString(t,n){function r(e,t,n){return e?R(e.slice(t,t+n)):null}let i=t.split(`T`),a=i[0],o=i[1],s=o?H.vcard.value.time._splitZone(o):[],c=s[0],l=s[1],u=a?a.length:0,d=l?l.length:0,f=a&&a[0]==`-`&&a[1]==`-`,p=l&&l[0]==`-`,m={year:f?null:r(a,0,4),month:f&&(u==4||u==7)?r(a,2,2):u==7||u==10?r(a,5,2):null,day:u==5?r(a,3,2):u==7&&f?r(a,5,2):u==10?r(a,8,2):null,hour:p?null:r(l,0,2),minute:p&&d==3?r(l,1,2):d>4?p?r(l,1,2):r(l,3,2):null,second:d==4?r(l,2,2):d==6?r(l,4,2):d==8?r(l,6,2):null};return c=c==`Z`?I.utcTimezone:c&&c[3]==`:`?ll.fromString(c):null,new e(m,c,n)}constructor(e,t,n){super(e,t),this.icaltype=n||`date-and-or-time`}icalclass=`vcardtime`;icaltype=`date-and-or-time`;clone(){return new e(this._time,this.zone,this.icaltype)}_normalize(){return this}utcOffset(){return this.zone instanceof ll?this.zone.toSeconds():P.prototype.utcOffset.apply(this,arguments)}toICALString(){return H.vcard.value[this.icaltype].toICAL(this.toString())}toString(){let e=this.year,t=this.month,n=this.day,r=this.hour,i=this.minute,a=this.second,o=e!==null,s=t!==null,c=n!==null,l=r!==null,u=i!==null,d=a!==null,f=(o?ol(e)+(s||c?`-`:``):s||c?`--`:``)+(s?ol(t):``)+(c?`-`+ol(n):``),p=(l?ol(r):`-`)+(l&&u?`:`:``)+(u?ol(i):``)+(!l&&!u?`-`:``)+(u&&d?`:`:``)+(d?ol(a):``),m;switch(m=this.zone===I.utcTimezone?`Z`:this.zone instanceof ll?this.zone.toString():this.zone===I.localTimezone?``:this.zone instanceof I?ll.fromSeconds(this.zone.utcOffset(this)).toString():``,this.icaltype){case`time`:return p+m;case`date-and-or-time`:case`date-time`:return f+(p==`--`?``:`T`+p+m);case`date`:return f}return null}},dl=class e{static _indexMap={BYSECOND:0,BYMINUTE:1,BYHOUR:2,BYDAY:3,BYMONTHDAY:4,BYYEARDAY:5,BYWEEKNO:6,BYMONTH:7,BYSETPOS:8};static _expandMap={SECONDLY:[1,1,1,1,1,1,1,1],MINUTELY:[2,1,1,1,1,1,1,1],HOURLY:[2,2,1,1,1,1,1,1],DAILY:[2,2,2,1,1,1,1,1],WEEKLY:[2,2,2,2,3,3,1,1],MONTHLY:[2,2,2,2,2,3,3,1],YEARLY:[2,2,2,2,2,2,2,2]};static UNKNOWN=0;static CONTRACT=1;static EXPAND=2;static ILLEGAL=3;constructor(e){this.fromData(e)}completed=!1;rule=null;dtstart=null;last=null;occurrence_number=0;by_indices=null;initialized=!1;by_data=null;days=null;days_index=0;fromData(e){if(this.rule=tl(e.rule,vl),!this.rule)throw Error(`iterator requires a (ICAL.Recur) rule`);if(this.dtstart=tl(e.dtstart,P),!this.dtstart)throw Error(`iterator requires a (ICAL.Time) dtstart`);if(this.by_data=e.by_data?e.by_data:il(this.rule.parts,!0),e.occurrence_number&&(this.occurrence_number=e.occurrence_number),this.days=e.days||[],e.last&&(this.last=tl(e.last,P)),this.by_indices=e.by_indices,this.by_indices||={BYSECOND:0,BYMINUTE:0,BYHOUR:0,BYDAY:0,BYMONTH:0,BYWEEKNO:0,BYMONTHDAY:0},this.initialized=e.initialized||!1,!this.initialized)try{this.init()}catch(e){if(e instanceof fl)this.completed=!0;else throw e}}init(){this.initialized=!0,this.last=this.dtstart.clone();let e=this.by_data;if(`BYDAY`in e&&this.sort_byday_rules(e.BYDAY),`BYYEARDAY`in e&&(`BYMONTH`in e||`BYWEEKNO`in e||`BYMONTHDAY`in e))throw Error(`Invalid BYYEARDAY rule`);if(`BYWEEKNO`in e&&`BYMONTHDAY`in e)throw Error(`BYWEEKNO does not fit to BYMONTHDAY`);if(this.rule.freq==`MONTHLY`&&(`BYYEARDAY`in e||`BYWEEKNO`in e))throw Error(`For MONTHLY recurrences neither BYYEARDAY nor BYWEEKNO may appear`);if(this.rule.freq==`WEEKLY`&&(`BYYEARDAY`in e||`BYMONTHDAY`in e))throw Error(`For WEEKLY recurrences neither BYMONTHDAY nor BYYEARDAY may appear`);if(this.rule.freq!=`YEARLY`&&`BYYEARDAY`in e)throw Error(`BYYEARDAY may only appear in YEARLY rules`);if(this.last.second=this.setup_defaults(`BYSECOND`,`SECONDLY`,this.dtstart.second),this.last.minute=this.setup_defaults(`BYMINUTE`,`MINUTELY`,this.dtstart.minute),this.last.hour=this.setup_defaults(`BYHOUR`,`HOURLY`,this.dtstart.hour),this.last.day=this.setup_defaults(`BYMONTHDAY`,`DAILY`,this.dtstart.day),this.last.month=this.setup_defaults(`BYMONTH`,`MONTHLY`,this.dtstart.month),this.rule.freq==`WEEKLY`){if(`BYDAY`in e){let[,t]=this.ruleDayOfWeek(e.BYDAY[0],this.rule.wkst),n=t-this.last.dayOfWeek(this.rule.wkst);(this.last.dayOfWeek(this.rule.wkst)<t&&n>=0||n<0)&&(this.last.day+=n)}else e.BYDAY=[vl.numericDayToIcalDay(this.dtstart.dayOfWeek())]}if(this.rule.freq==`YEARLY`){let e=this.rule.until?this.rule.until.year:2e4;for(;this.last.year<=e&&(this.expand_year_days(this.last.year),!(this.days.length>0));)this.increment_year(this.rule.interval);if(this.days.length==0||!this._nextByYearDay()&&!this.next_year()&&!this.next_year()&&!this.next_year())throw new fl}if(this.rule.freq==`MONTHLY`){if(this.has_by_data(`BYDAY`)){let e=null,t=this.last.clone(),n=P.daysInMonth(this.last.month,this.last.year);for(let r of this.by_data.BYDAY){this.last=t.clone();let[i,a]=this.ruleDayOfWeek(r),o=this.last.nthWeekDay(a,i);if(i>=6||i<=-6)throw Error(`Malformed values in BYDAY part`);if(o>n||o<=0){if(e&&e.month==t.month)continue;for(;o>n||o<=0;)this.increment_month(),n=P.daysInMonth(this.last.month,this.last.year),o=this.last.nthWeekDay(a,i)}this.last.day=o,(!e||this.last.compare(e)<0)&&(e=this.last.clone())}if(this.last=e.clone(),this.has_by_data(`BYMONTHDAY`)&&this._byDayAndMonthDay(!0),this.last.day>n||this.last.day==0)throw Error(`Malformed values in BYDAY part`)}else if(this.has_by_data(`BYMONTHDAY`)){this.last.day=1;let e=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY).filter(e=>e>=this.last.day);if(e.length)this.last.day=e[0],this.by_data.BYMONTHDAY=e;else if(!this.next_month()&&!this.next_month()&&!this.next_month())throw new fl}}}next(e=!1){let t=this.last?this.last.clone():null;if((this.rule.count&&this.occurrence_number>=this.rule.count||this.rule.until&&this.last.compare(this.rule.until)>0)&&(this.completed=!0),this.completed)return null;if(this.occurrence_number==0&&this.last.compare(this.dtstart)>=0)return this.occurrence_number++,this.last;let n,r=0;do switch(n=1,this.rule.freq){case`SECONDLY`:this.next_second();break;case`MINUTELY`:this.next_minute();break;case`HOURLY`:this.next_hour();break;case`DAILY`:this.next_day();break;case`WEEKLY`:this.next_week();break;case`MONTHLY`:if(n=this.next_month(),n)r=0;else if(++r==336)return this.completed=!0,null;break;case`YEARLY`:if(n=this.next_year(),n)r=0;else if(++r==28)return this.completed=!0,null;break;default:return null}while(!this.check_contracting_rules()||this.last.compare(this.dtstart)<0||!n);if(this.last.compare(t)==0){if(e)throw Error(`Same occurrence found twice, protecting you from death by recursion`);this.next(!0)}return this.rule.until&&this.last.compare(this.rule.until)>0?(this.completed=!0,null):(this.occurrence_number++,this.last)}next_second(){return this.next_generic(`BYSECOND`,`SECONDLY`,`second`,`minute`)}increment_second(e){return this.increment_generic(e,`second`,60,`minute`)}next_minute(){return this.next_generic(`BYMINUTE`,`MINUTELY`,`minute`,`hour`,`next_second`)}increment_minute(e){return this.increment_generic(e,`minute`,60,`hour`)}next_hour(){return this.next_generic(`BYHOUR`,`HOURLY`,`hour`,`monthday`,`next_minute`)}increment_hour(e){this.increment_generic(e,`hour`,24,`monthday`)}next_day(){let e=this.rule.freq==`DAILY`;return this.next_hour()==0||(e?this.increment_monthday(this.rule.interval):this.increment_monthday(1)),0}next_week(){let e=0;if(this.next_weekday_by_week()==0)return e;if(this.has_by_data(`BYWEEKNO`)){this.by_indices.BYWEEKNO++,this.by_indices.BYWEEKNO==this.by_data.BYWEEKNO.length&&(this.by_indices.BYWEEKNO=0,e=1),this.last.month=1,this.last.day=1;let t=this.by_data.BYWEEKNO[this.by_indices.BYWEEKNO];this.last.day+=7*t,e&&this.increment_year(1)}else this.increment_monthday(7*this.rule.interval);return e}normalizeByMonthDayRules(e,t,n){let r=P.daysInMonth(t,e),i=[],a=0,o=n.length,s;for(;a<o;a++){if(s=parseInt(n[a],10),isNaN(s))throw Error(`Invalid BYMONTHDAY value`);if(!(Math.abs(s)>r)){if(s<0)s=r+(s+1);else if(s===0)continue;i.indexOf(s)===-1&&i.push(s)}}return i.sort(function(e,t){return e-t})}_byDayAndMonthDay(e){let t,n=this.by_data.BYDAY,r,i=0,a,o=n.length,s=0,c,l=this,u=this.last.day;function d(){for(c=P.daysInMonth(l.last.month,l.last.year),t=l.normalizeByMonthDayRules(l.last.year,l.last.month,l.by_data.BYMONTHDAY),a=t.length;t[i]<=u&&!(e&&t[i]==u)&&i<a-1;)i++}function f(){u=0,l.increment_month(),i=0,d()}d(),e&&--u;let p=48;for(;!s&&p;){if(p--,r=u+1,r>c){f();continue}let e=t[i++];if(e>=r)u=e;else{f();continue}for(let e=0;e<o;e++){let t=this.ruleDayOfWeek(n[e]),r=t[0],i=t[1];if(this.last.day=u,this.last.isNthWeekDay(i,r)){s=1;break}}if(!s&&i===a){f();continue}}if(p<=0)throw Error(`Malformed values in BYDAY combined with BYMONTHDAY parts`);return s}next_month(){let e=1;if(this.next_hour()==0)return e;if(this.has_by_data(`BYDAY`)&&this.has_by_data(`BYMONTHDAY`))e=this._byDayAndMonthDay();else if(this.has_by_data(`BYDAY`)){let t=P.daysInMonth(this.last.month,this.last.year),n=0,r=0;if(this.has_by_data(`BYSETPOS`)){let e=this.last.day;for(let i=1;i<=t;i++)this.last.day=i,this.is_day_in_byday(this.last)&&(r++,i<=e&&n++);this.last.day=e}e=0;let i;for(i=this.last.day+1;i<=t;i++)if(this.last.day=i,this.is_day_in_byday(this.last)&&(!this.has_by_data(`BYSETPOS`)||this.check_set_position(++n)||this.check_set_position(n-r-1))){e=1;break}i>t&&(this.last.day=1,this.increment_month(),this.is_day_in_byday(this.last)?(!this.has_by_data(`BYSETPOS`)||this.check_set_position(1))&&(e=1):e=0)}else if(this.has_by_data(`BYMONTHDAY`)){if(this.by_indices.BYMONTHDAY++,this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length&&(this.by_indices.BYMONTHDAY=0,this.increment_month(),this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length))return 0;let t=P.daysInMonth(this.last.month,this.last.year),n=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY];n<0&&(n=t+n+1),n>t?(this.last.day=1,e=this.is_day_in_byday(this.last)):this.last.day=n}else{this.increment_month();let t=P.daysInMonth(this.last.month,this.last.year);this.by_data.BYMONTHDAY[0]>t?e=0:this.last.day=this.by_data.BYMONTHDAY[0]}return e}next_weekday_by_week(){let e=0;if(this.next_hour()==0)return e;if(!this.has_by_data(`BYDAY`))return 1;for(;;){let t=new P;this.by_indices.BYDAY++,this.by_indices.BYDAY==Object.keys(this.by_data.BYDAY).length&&(this.by_indices.BYDAY=0,e=1);let n=this.by_data.BYDAY[this.by_indices.BYDAY],r=this.ruleDayOfWeek(n)[1];r-=this.rule.wkst,r<0&&(r+=7),t.year=this.last.year,t.month=this.last.month,t.day=this.last.day;let i=t.startDoyWeek(this.rule.wkst);if(r+i<1&&!e)continue;let a=P.fromDayOfYear(i+r,this.last.year);return this.last.year=a.year,this.last.month=a.month,this.last.day=a.day,e}}next_year(){return this.next_hour()==0||(this.days.length==0||++this.days_index==this.days.length)&&(this.days_index=0,this.increment_year(this.rule.interval),this.has_by_data(`BYMONTHDAY`)&&(this.by_data.BYMONTHDAY=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY)),this.expand_year_days(this.last.year),this.days.length==0)?0:this._nextByYearDay()}_nextByYearDay(){let e=this.days[this.days_index],t=this.last.year;if(Math.abs(e)==366&&!P.isLeapYear(this.last.year))return 0;e<1&&(e+=1,t+=1);let n=P.fromDayOfYear(e,t);return this.last.day=n.day,this.last.month=n.month,1}ruleDayOfWeek(e,t){let n=e.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);if(n){let r=parseInt(n[1]||0,10);return e=vl.icalDayToNumericDay(n[2],t),[r,e]}return[0,0]}next_generic(e,t,n,r,i){let a=e in this.by_data,o=this.rule.freq==t,s=0;if(i&&this[i]()==0)return s;if(a){this.by_indices[e]++;let t=this.by_data[e];this.by_indices[e]==t.length&&(this.by_indices[e]=0,s=1),this.last[n]=t[this.by_indices[e]]}else o&&this[`increment_`+n](this.rule.interval);return a&&s&&o&&this[`increment_`+r](1),s}increment_monthday(e){for(let t=0;t<e;t++){let e=P.daysInMonth(this.last.month,this.last.year);this.last.day++,this.last.day>e&&(this.last.day-=e,this.increment_month())}}increment_month(){if(this.last.day=1,this.has_by_data(`BYMONTH`))this.by_indices.BYMONTH++,this.by_indices.BYMONTH==this.by_data.BYMONTH.length&&(this.by_indices.BYMONTH=0,this.increment_year(1)),this.last.month=this.by_data.BYMONTH[this.by_indices.BYMONTH];else{this.rule.freq==`MONTHLY`?this.last.month+=this.rule.interval:this.last.month++,this.last.month--;let e=z(this.last.month/12);this.last.month%=12,this.last.month++,e!=0&&this.increment_year(e)}this.has_by_data(`BYMONTHDAY`)&&(this.by_data.BYMONTHDAY=this.normalizeByMonthDayRules(this.last.year,this.last.month,this.rule.parts.BYMONTHDAY))}increment_year(e){this.last.day=1,this.last.year+=e}increment_generic(e,t,n,r){this.last[t]+=e;let i=z(this.last[t]/n);this.last[t]%=n,i!=0&&this[`increment_`+r](i)}has_by_data(e){return e in this.rule.parts}expand_year_days(e){let t=new P;this.days=[];let n={};for(let e of[`BYDAY`,`BYWEEKNO`,`BYMONTHDAY`,`BYMONTH`,`BYYEARDAY`])e in this.rule.parts&&(n[e]=this.rule.parts[e]);if(`BYMONTH`in n&&`BYWEEKNO`in n){let r=1,i={};t.year=e,t.isDate=!0;for(let n=0;n<this.by_data.BYMONTH.length;n++){let r=this.by_data.BYMONTH[n];t.month=r,t.day=1;let a=t.weekNumber(this.rule.wkst);t.day=P.daysInMonth(r,e);let o=t.weekNumber(this.rule.wkst);for(n=a;n<o;n++)i[n]=1}for(let e=0;e<this.by_data.BYWEEKNO.length&&r;e++)this.by_data.BYWEEKNO[e]<52?r&=i[e]:r=0;r?delete n.BYMONTH:delete n.BYWEEKNO}let r=Object.keys(n).length;if(r==0){let e=this.dtstart.clone();e.year=this.last.year,this.days.push(e.dayOfYear())}else if(r==1&&`BYMONTH`in n)for(let t of this.by_data.BYMONTH){let n=this.dtstart.clone();n.year=e,n.month=t,n.isDate=!0,this.days.push(n.dayOfYear())}else if(r==1&&`BYMONTHDAY`in n)for(let t of this.by_data.BYMONTHDAY){let n=this.dtstart.clone();if(t<0){let r=P.daysInMonth(n.month,e);t=t+r+1}n.day=t,n.year=e,n.isDate=!0,this.days.push(n.dayOfYear())}else if(r==2&&`BYMONTHDAY`in n&&`BYMONTH`in n)for(let n of this.by_data.BYMONTH){let r=P.daysInMonth(n,e);for(let i of this.by_data.BYMONTHDAY)i<0&&(i=i+r+1),t.day=i,t.month=n,t.year=e,t.isDate=!0,this.days.push(t.dayOfYear())}else if(!(r==1&&`BYWEEKNO`in n)&&!(r==2&&`BYWEEKNO`in n&&`BYMONTHDAY`in n)){if(r==1&&`BYDAY`in n)this.days=this.days.concat(this.expand_by_day(e));else if(r==2&&`BYDAY`in n&&`BYMONTH`in n){for(let n of this.by_data.BYMONTH){let r=P.daysInMonth(n,e);t.year=e,t.month=n,t.day=1,t.isDate=!0;let i=t.dayOfWeek(),a=t.dayOfYear()-1;t.day=r;let o=t.dayOfWeek();if(this.has_by_data(`BYSETPOS`)){let e=[];for(let n=1;n<=r;n++)t.day=n,this.is_day_in_byday(t)&&e.push(n);for(let t=0;t<e.length;t++)(this.check_set_position(t+1)||this.check_set_position(t-e.length))&&this.days.push(a+e[t])}else for(let e of this.by_data.BYDAY){let t=this.ruleDayOfWeek(e),n=t[0],s=t[1],c,l=(s+7-i)%7+1,u=r-(o+7-s)%7;if(n==0)for(let e=l;e<=r;e+=7)this.days.push(a+e);else n>0?(c=l+(n-1)*7,c<=r&&this.days.push(a+c)):(c=u+(n+1)*7,c>0&&this.days.push(a+c))}}this.days.sort(function(e,t){return e-t})}else if(r==2&&`BYDAY`in n&&`BYMONTHDAY`in n){let t=this.expand_by_day(e);for(let n of t){let t=P.fromDayOfYear(n,e);this.by_data.BYMONTHDAY.indexOf(t.day)>=0&&this.days.push(n)}}else if(r==3&&`BYDAY`in n&&`BYMONTHDAY`in n&&`BYMONTH`in n){let t=this.expand_by_day(e);for(let n of t){let t=P.fromDayOfYear(n,e);this.by_data.BYMONTH.indexOf(t.month)>=0&&this.by_data.BYMONTHDAY.indexOf(t.day)>=0&&this.days.push(n)}}else if(r==2&&`BYDAY`in n&&`BYWEEKNO`in n){let t=this.expand_by_day(e);for(let n of t){let t=P.fromDayOfYear(n,e).weekNumber(this.rule.wkst);this.by_data.BYWEEKNO.indexOf(t)&&this.days.push(n)}}else if(!(r==3&&`BYDAY`in n&&`BYWEEKNO`in n&&`BYMONTHDAY`in n)){if(r==1&&`BYYEARDAY`in n)this.days=this.days.concat(this.by_data.BYYEARDAY);else if(r==2&&`BYYEARDAY`in n&&`BYDAY`in n){let t=P.isLeapYear(e)?366:365,n=new Set(this.expand_by_day(e));for(let e of this.by_data.BYYEARDAY)e<0&&(e+=t+1),n.has(e)&&this.days.push(e)}else this.days=[]}}let i=P.isLeapYear(e)?366:365;return this.days.sort((e,t)=>(e<0&&(e+=i+1),t<0&&(t+=i+1),e-t)),0}expand_by_day(e){let t=[],n=this.last.clone();n.year=e,n.month=1,n.day=1,n.isDate=!0;let r=n.dayOfWeek();n.month=12,n.day=31,n.isDate=!0;let i=n.dayOfWeek(),a=n.dayOfYear();for(let e of this.by_data.BYDAY){let n=this.ruleDayOfWeek(e),o=n[0],s=n[1];if(o==0){let e=(s+7-r)%7+1;for(let n=e;n<=a;n+=7)t.push(n)}else if(o>0){let e;e=s>=r?s-r+1:s-r+8,t.push(e+(o-1)*7)}else{let e;o=-o,e=s<=i?a-i+s:a-i+s-7,t.push(e-(o-1)*7)}}return t}is_day_in_byday(e){if(this.by_data.BYDAY)for(let t of this.by_data.BYDAY){let n=this.ruleDayOfWeek(t),r=n[0],i=n[1],a=e.dayOfWeek();if(r==0&&i==a||e.nthWeekDay(i,r)==e.day)return 1}return 0}check_set_position(e){return this.has_by_data(`BYSETPOS`)?this.by_data.BYSETPOS.indexOf(e)!==-1:!1}sort_byday_rules(e){for(let t=0;t<e.length;t++)for(let n=0;n<t;n++)if(this.ruleDayOfWeek(e[n],this.rule.wkst)[1]>this.ruleDayOfWeek(e[t],this.rule.wkst)[1]){let r=e[t];e[t]=e[n],e[n]=r}}check_contract_restriction(t,n){let r=e._indexMap[t],i=e._expandMap[this.rule.freq][r],a=!1;if(t in this.by_data&&i==e.CONTRACT){let e=this.by_data[t];for(let t of e)if(t==n){a=!0;break}}else a=!0;return a}check_contracting_rules(){let e=this.last.dayOfWeek(),t=this.last.weekNumber(this.rule.wkst),n=this.last.dayOfYear();return this.check_contract_restriction(`BYSECOND`,this.last.second)&&this.check_contract_restriction(`BYMINUTE`,this.last.minute)&&this.check_contract_restriction(`BYHOUR`,this.last.hour)&&this.check_contract_restriction(`BYDAY`,vl.numericDayToIcalDay(e))&&this.check_contract_restriction(`BYWEEKNO`,t)&&this.check_contract_restriction(`BYMONTHDAY`,this.last.day)&&this.check_contract_restriction(`BYMONTH`,this.last.month)&&this.check_contract_restriction(`BYYEARDAY`,n)}setup_defaults(t,n,r){let i=e._indexMap[t];return e._expandMap[this.rule.freq][i]!=e.CONTRACT&&(t in this.by_data||(this.by_data[t]=[r]),this.rule.freq!=n)?this.by_data[t][0]:r}toJSON(){let e=Object.create(null);return e.initialized=this.initialized,e.rule=this.rule.toJSON(),e.dtstart=this.dtstart.toJSON(),e.by_data=this.by_data,e.days=this.days,e.last=this.last.toJSON(),e.by_indices=this.by_indices,e.occurrence_number=this.occurrence_number,e}},fl=class extends Error{constructor(){super(`Recurrence rule has no valid occurrences`)}},pl=/^(SU|MO|TU|WE|TH|FR|SA)$/,ml=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,hl={SU:P.SUNDAY,MO:P.MONDAY,TU:P.TUESDAY,WE:P.WEDNESDAY,TH:P.THURSDAY,FR:P.FRIDAY,SA:P.SATURDAY},gl=Object.fromEntries(Object.entries(hl).map(e=>e.reverse())),_l=[`SECONDLY`,`MINUTELY`,`HOURLY`,`DAILY`,`WEEKLY`,`MONTHLY`,`YEARLY`],vl=class e{static fromString(t){let n=this._stringToData(t,!1);return new e(n)}static fromData(t){return new e(t)}static _stringToData(e,t){let n=Object.create(null),r=e.split(`;`),i=r.length;for(let e=0;e<i;e++){let i=r[e].split(`=`),a=i[0].toUpperCase(),o=i[0].toLowerCase(),s=t?o:a,c=i[1];if(a in xl){let e=c.split(`,`),t=new Set;for(let n of e)t.add(xl[a](n));e=[...t],n[s]=e.length==1?e[0]:e}else a in bl?bl[a](c,n,t):n[o]=c}return n}static icalDayToNumericDay(e,t){let n=t||P.SUNDAY;return(hl[e]-n+7)%7+1}static numericDayToIcalDay(e,t){let n=e+(t||P.SUNDAY)-P.SUNDAY;return n>7&&(n-=7),gl[n]}constructor(e){this.wrappedJSObject=this,this.parts={},e&&typeof e==`object`&&this.fromData(e)}parts=null;interval=1;wkst=P.MONDAY;until=null;count=null;freq=null;icalclass=`icalrecur`;icaltype=`recur`;iterator(e){return new dl({rule:this,dtstart:e})}clone(){return new e(this.toJSON())}isFinite(){return!!(this.count||this.until)}isByCount(){return!(!this.count||this.until)}addComponent(e,t){let n=e.toUpperCase();n in this.parts?this.parts[n].push(t):this.parts[n]=[t]}setComponent(e,t){this.parts[e.toUpperCase()]=t.slice()}getComponent(e){let t=e.toUpperCase();return t in this.parts?this.parts[t].slice():[]}getNextOccurrence(e,t){let n=this.iterator(e),r;do r=n.next();while(r&&r.compare(t)<=0);return r&&t.zone&&(r.zone=t.zone),r}fromData(t){for(let e in t){let n=e.toUpperCase();n in xl?Array.isArray(t[e])?this.parts[n]=t[e]:this.parts[n]=[t[e]]:this[e]=t[e]}this.interval&&typeof this.interval!=`number`&&bl.INTERVAL(this.interval,this),this.wkst&&typeof this.wkst!=`number`&&(this.wkst=e.icalDayToNumericDay(this.wkst)),this.until&&!(this.until instanceof P)&&(this.until=P.fromString(this.until))}toJSON(){let t=Object.create(null);t.freq=this.freq,this.count&&(t.count=this.count),this.interval>1&&(t.interval=this.interval);for(let[e,n]of Object.entries(this.parts))Array.isArray(n)&&n.length==1?t[e.toLowerCase()]=n[0]:t[e.toLowerCase()]=il(n);return this.until&&(t.until=this.until.toString()),`wkst`in this&&this.wkst!==P.DEFAULT_WEEK_START&&(t.wkst=e.numericDayToIcalDay(this.wkst)),t}toString(){let t=`FREQ=`+this.freq;this.count&&(t+=`;COUNT=`+this.count),this.interval>1&&(t+=`;INTERVAL=`+this.interval);for(let[e,n]of Object.entries(this.parts))t+=`;`+e+`=`+n;return this.until&&(t+=`;UNTIL=`+this.until.toICALString()),`wkst`in this&&this.wkst!==P.DEFAULT_WEEK_START&&(t+=`;WKST=`+e.numericDayToIcalDay(this.wkst)),t}};function yl(e,t,n,r){let i=r;if(r[0]===`+`&&(i=r.slice(1)),i=R(i),t!==void 0&&r<t)throw Error(e+`: invalid value "`+r+`" must be > `+t);if(n!==void 0&&r>n)throw Error(e+`: invalid value "`+r+`" must be < `+t);return i}var bl={FREQ:function(e,t,n){if(_l.indexOf(e)!==-1)t.freq=e;else throw Error(`invalid frequency "`+e+`" expected: "`+_l.join(`, `)+`"`)},COUNT:function(e,t,n){t.count=R(e)},INTERVAL:function(e,t,n){t.interval=R(e),t.interval<1&&(t.interval=1)},UNTIL:function(e,t,n){t.until=e.length>10?H.icalendar.value[`date-time`].fromICAL(e):H.icalendar.value.date.fromICAL(e),n||(t.until=P.fromString(t.until))},WKST:function(e,t,n){if(pl.test(e))t.wkst=vl.icalDayToNumericDay(e);else throw Error(`invalid WKST value "`+e+`"`)}},xl={BYSECOND:yl.bind(void 0,`BYSECOND`,0,60),BYMINUTE:yl.bind(void 0,`BYMINUTE`,0,59),BYHOUR:yl.bind(void 0,`BYHOUR`,0,23),BYDAY:function(e){if(ml.test(e))return e;throw Error(`invalid BYDAY value "`+e+`"`)},BYMONTHDAY:yl.bind(void 0,`BYMONTHDAY`,-31,31),BYYEARDAY:yl.bind(void 0,`BYYEARDAY`,-366,366),BYWEEKNO:yl.bind(void 0,`BYWEEKNO`,-53,53),BYMONTH:yl.bind(void 0,`BYMONTH`,1,12),BYSETPOS:yl.bind(void 0,`BYSETPOS`,-366,366)},Sl=/\\\\|\\;|\\,|\\[Nn]/g,Cl=/\\|;|,|\n/g,wl=/\\\\|\\,|\\[Nn]/g,Tl=/\\|,|\n/g;function El(e,t){return{matches:/.*/,fromICAL:function(t,n){return Ll(t,e,n)},toICAL:function(e,n){let r=t;return n&&(r=RegExp(r.source+`|`+n,r.flags)),e.replace(r,function(e){switch(e){case`\\`:return`\\\\`;case`;`:return`\\;`;case`,`:return`\\,`;case`
|
|
59
|
+
`:return`\\n`;default:return e}})}}}var B={defaultType:`text`},Dl={defaultType:`text`,multiValue:`,`},Ol={defaultType:`text`,structuredValue:`;`},kl={defaultType:`integer`},Al={defaultType:`date-time`,allowedTypes:[`date-time`,`date`]},jl={defaultType:`date-time`},Ml={defaultType:`uri`},Nl={defaultType:`utc-offset`},Pl={defaultType:`recur`},Fl={defaultType:`date-and-or-time`,allowedTypes:[`date-time`,`date`,`text`]};function Il(e){switch(e){case`\\\\`:return`\\`;case`\\;`:return`;`;case`\\,`:return`,`;case`\\n`:case`\\N`:return`
|
|
60
|
+
`;default:return e}}function Ll(e,t,n){return e.indexOf(`\\`)===-1?e:(n&&(t=RegExp(t.source+`|\\\\`+n,t.flags)),e.replace(t,Il))}var Rl={categories:Dl,url:Ml,version:B,uid:B},zl={boolean:{values:[`TRUE`,`FALSE`],fromICAL:function(e){switch(e){case`TRUE`:return!0;case`FALSE`:return!1;default:return!1}},toICAL:function(e){return e?`TRUE`:`FALSE`}},float:{matches:/^[+-]?\d+\.\d+$/,fromICAL:function(e){let t=parseFloat(e);return el(t)?0:t},toICAL:function(e){return String(e)}},integer:{fromICAL:function(e){let t=parseInt(e);return el(t)?0:t},toICAL:function(e){return String(e)}},"utc-offset":{toICAL:function(e){return e.length<7?e.slice(0,3)+e.slice(4,6):e.slice(0,3)+e.slice(4,6)+e.slice(7,9)},fromICAL:function(e){return e.length<6?e.slice(0,3)+`:`+e.slice(3,5):e.slice(0,3)+`:`+e.slice(3,5)+`:`+e.slice(5,7)},decorate:function(e){return ll.fromString(e)},undecorate:function(e){return e.toString()}}},Bl={cutype:{values:[`INDIVIDUAL`,`GROUP`,`RESOURCE`,`ROOM`,`UNKNOWN`],allowXName:!0,allowIanaToken:!0},"delegated-from":{valueType:`cal-address`,multiValue:`,`,multiValueSeparateDQuote:!0},"delegated-to":{valueType:`cal-address`,multiValue:`,`,multiValueSeparateDQuote:!0},encoding:{values:[`8BIT`,`BASE64`]},fbtype:{values:[`FREE`,`BUSY`,`BUSY-UNAVAILABLE`,`BUSY-TENTATIVE`],allowXName:!0,allowIanaToken:!0},member:{valueType:`cal-address`,multiValue:`,`,multiValueSeparateDQuote:!0},partstat:{values:[`NEEDS-ACTION`,`ACCEPTED`,`DECLINED`,`TENTATIVE`,`DELEGATED`,`COMPLETED`,`IN-PROCESS`],allowXName:!0,allowIanaToken:!0},range:{values:[`THISANDFUTURE`]},related:{values:[`START`,`END`]},reltype:{values:[`PARENT`,`CHILD`,`SIBLING`],allowXName:!0,allowIanaToken:!0},role:{values:[`REQ-PARTICIPANT`,`CHAIR`,`OPT-PARTICIPANT`,`NON-PARTICIPANT`],allowXName:!0,allowIanaToken:!0},rsvp:{values:[`TRUE`,`FALSE`]},"sent-by":{valueType:`cal-address`},tzid:{matches:/^\//},value:{values:[`binary`,`boolean`,`cal-address`,`date`,`date-time`,`duration`,`float`,`integer`,`period`,`recur`,`text`,`time`,`uri`,`utc-offset`],allowXName:!0,allowIanaToken:!0}},V=sl(zl,{text:El(Sl,Cl),uri:{},binary:{decorate:function(e){return Lc.fromString(e)},undecorate:function(e){return e.toString()}},"cal-address":{},date:{decorate:function(e,t){return H.strict?P.fromDateString(e,t):P.fromString(e,t)},undecorate:function(e){return e.toString()},fromICAL:function(e){return!H.strict&&e.length>=15?V[`date-time`].fromICAL(e):e.slice(0,4)+`-`+e.slice(4,6)+`-`+e.slice(6,8)},toICAL:function(e){let t=e.length;return t==10?e.slice(0,4)+e.slice(5,7)+e.slice(8,10):t>=19?V[`date-time`].toICAL(e):e}},"date-time":{fromICAL:function(e){if(!H.strict&&e.length==8)return V.date.fromICAL(e);{let t=e.slice(0,4)+`-`+e.slice(4,6)+`-`+e.slice(6,8)+`T`+e.slice(9,11)+`:`+e.slice(11,13)+`:`+e.slice(13,15);return e[15]&&e[15]===`Z`&&(t+=`Z`),t}},toICAL:function(e){let t=e.length;if(t==10&&!H.strict)return V.date.toICAL(e);if(t>=19){let t=e.slice(0,4)+e.slice(5,7)+e.slice(8,13)+e.slice(14,16)+e.slice(17,19);return e[19]&&e[19]===`Z`&&(t+=`Z`),t}return e},decorate:function(e,t){return H.strict?P.fromDateTimeString(e,t):P.fromString(e,t)},undecorate:function(e){return e.toString()}},duration:{decorate:function(e){return Bc.fromString(e)},undecorate:function(e){return e.toString()}},period:{fromICAL:function(e){let t=e.split(`/`);return t[0]=V[`date-time`].fromICAL(t[0]),Bc.isValueString(t[1])||(t[1]=V[`date-time`].fromICAL(t[1])),t},toICAL:function(e){return e=e.slice(),!H.strict&&e[0].length==10?e[0]=V.date.toICAL(e[0]):e[0]=V[`date-time`].toICAL(e[0]),Bc.isValueString(e[1])||(!H.strict&&e[1].length==10?e[1]=V.date.toICAL(e[1]):e[1]=V[`date-time`].toICAL(e[1])),e.join(`/`)},decorate:function(e,t){return Hc.fromJSON(e,t,!H.strict)},undecorate:function(e){return e.toJSON()}},recur:{fromICAL:function(e){return vl._stringToData(e,!0)},toICAL:function(e){let t=``;for(let[n,r]of Object.entries(e))n==`until`?r=r.length>10?V[`date-time`].toICAL(r):V.date.toICAL(r):n==`wkst`?typeof r==`number`&&(r=vl.numericDayToIcalDay(r)):Array.isArray(r)&&(r=r.join(`,`)),t+=n.toUpperCase()+`=`+r+`;`;return t.slice(0,Math.max(0,t.length-1))},decorate:function(e){return vl.fromData(e)},undecorate:function(e){return e.toJSON()}},time:{fromICAL:function(e){if(e.length<6)return e;let t=e.slice(0,2)+`:`+e.slice(2,4)+`:`+e.slice(4,6);return e[6]===`Z`&&(t+=`Z`),t},toICAL:function(e){if(e.length<8)return e;let t=e.slice(0,2)+e.slice(3,5)+e.slice(6,8);return e[8]===`Z`&&(t+=`Z`),t}}}),Vl=sl(Rl,{action:B,attach:{defaultType:`uri`},attendee:{defaultType:`cal-address`},calscale:B,class:B,comment:B,completed:jl,contact:B,created:jl,description:B,dtend:Al,dtstamp:jl,dtstart:Al,due:Al,duration:{defaultType:`duration`},exdate:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`],multiValue:`,`},exrule:Pl,freebusy:{defaultType:`period`,multiValue:`,`},geo:{defaultType:`float`,structuredValue:`;`},"last-modified":jl,location:B,method:B,organizer:{defaultType:`cal-address`},"percent-complete":kl,priority:kl,prodid:B,"related-to":B,repeat:kl,rdate:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`,`period`],multiValue:`,`,detectType:function(e){return e.indexOf(`/`)===-1?e.indexOf(`T`)===-1?`date`:`date-time`:`period`}},"recurrence-id":Al,resources:Dl,"request-status":Ol,rrule:Pl,sequence:kl,status:B,summary:B,transp:B,trigger:{defaultType:`duration`,allowedTypes:[`duration`,`date-time`]},tzoffsetfrom:Nl,tzoffsetto:Nl,tzurl:Ml,tzid:B,tzname:B}),Hl=sl(zl,{text:El(wl,Tl),uri:El(wl,Tl),date:{decorate:function(e){return ul.fromDateAndOrTimeString(e,`date`)},undecorate:function(e){return e.toString()},fromICAL:function(e){return e.length==8?V.date.fromICAL(e):e[0]==`-`&&e.length==6?e.slice(0,4)+`-`+e.slice(4):e},toICAL:function(e){return e.length==10?V.date.toICAL(e):e[0]==`-`&&e.length==7?e.slice(0,4)+e.slice(5):e}},time:{decorate:function(e){return ul.fromDateAndOrTimeString(`T`+e,`time`)},undecorate:function(e){return e.toString()},fromICAL:function(e){let t=Hl.time._splitZone(e,!0),n=t[0],r=t[1];return r.length==6?r=r.slice(0,2)+`:`+r.slice(2,4)+`:`+r.slice(4,6):r.length==4&&r[0]!=`-`?r=r.slice(0,2)+`:`+r.slice(2,4):r.length==5&&(r=r.slice(0,3)+`:`+r.slice(3,5)),n.length==5&&(n[0]==`-`||n[0]==`+`)&&(n=n.slice(0,3)+`:`+n.slice(3)),r+n},toICAL:function(e){let t=Hl.time._splitZone(e),n=t[0],r=t[1];return r.length==8?r=r.slice(0,2)+r.slice(3,5)+r.slice(6,8):r.length==5&&r[0]!=`-`?r=r.slice(0,2)+r.slice(3,5):r.length==6&&(r=r.slice(0,3)+r.slice(4,6)),n.length==6&&(n[0]==`-`||n[0]==`+`)&&(n=n.slice(0,3)+n.slice(4)),r+n},_splitZone:function(e,t){let n=e.length-1,r=e.length-(t?5:6),i=e[r],a,o;return e[n]==`Z`?(a=e[n],o=e.slice(0,Math.max(0,n))):e.length>6&&(i==`-`||i==`+`)?(a=e.slice(r),o=e.slice(0,Math.max(0,r))):(a=``,o=e),[a,o]}},"date-time":{decorate:function(e){return ul.fromDateAndOrTimeString(e,`date-time`)},undecorate:function(e){return e.toString()},fromICAL:function(e){return Hl[`date-and-or-time`].fromICAL(e)},toICAL:function(e){return Hl[`date-and-or-time`].toICAL(e)}},"date-and-or-time":{decorate:function(e){return ul.fromDateAndOrTimeString(e,`date-and-or-time`)},undecorate:function(e){return e.toString()},fromICAL:function(e){let t=e.split(`T`);return(t[0]?Hl.date.fromICAL(t[0]):``)+(t[1]?`T`+Hl.time.fromICAL(t[1]):``)},toICAL:function(e){let t=e.split(`T`);return Hl.date.toICAL(t[0])+(t[1]?`T`+Hl.time.toICAL(t[1]):``)}},timestamp:V[`date-time`],"language-tag":{matches:/^[a-zA-Z0-9-]+$/},"phone-number":{fromICAL:function(e){return Array.from(e).filter(function(e){return e===`\\`?void 0:e}).join(``)},toICAL:function(e){return Array.from(e).map(function(e){return e===`,`||e===`;`?`\\`+e:e}).join(``)}}}),Ul={type:{valueType:`text`,multiValue:`,`},value:{values:[`text`,`uri`,`date`,`time`,`date-time`,`date-and-or-time`,`timestamp`,`boolean`,`integer`,`float`,`utc-offset`,`language-tag`],allowXName:!0,allowIanaToken:!0}},Wl=sl(Rl,{adr:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},anniversary:Fl,bday:Fl,caladruri:Ml,caluri:Ml,clientpidmap:Ol,email:B,fburl:Ml,fn:B,gender:Ol,geo:Ml,impp:Ml,key:Ml,kind:B,lang:{defaultType:`language-tag`},logo:Ml,member:Ml,n:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},nickname:Dl,note:B,org:{defaultType:`text`,structuredValue:`;`},photo:Ml,related:Ml,rev:{defaultType:`timestamp`},role:B,sound:Ml,source:Ml,tel:{defaultType:`uri`,allowedTypes:[`uri`,`text`]},title:B,tz:{defaultType:`text`,allowedTypes:[`text`,`utc-offset`,`uri`]},xml:B}),Gl=sl(zl,{binary:V.binary,date:Hl.date,"date-time":Hl[`date-time`],"phone-number":Hl[`phone-number`],uri:V.uri,text:Hl.text,time:V.time,vcard:V.text,"utc-offset":{toICAL:function(e){return e.slice(0,7)},fromICAL:function(e){return e.slice(0,7)},decorate:function(e){return ll.fromString(e)},undecorate:function(e){return e.toString()}}}),Kl={type:{valueType:`text`,multiValue:`,`},value:{values:[`text`,`uri`,`date`,`date-time`,`phone-number`,`time`,`boolean`,`integer`,`float`,`utc-offset`,`vcard`,`binary`],allowXName:!0,allowIanaToken:!0}},ql=sl(Rl,{fn:B,n:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},nickname:Dl,photo:{defaultType:`binary`,allowedTypes:[`binary`,`uri`]},bday:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`],detectType:function(e){return e.indexOf(`T`)===-1?`date`:`date-time`}},adr:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},label:B,tel:{defaultType:`phone-number`},email:B,mailer:B,tz:{defaultType:`utc-offset`,allowedTypes:[`utc-offset`,`text`]},geo:{defaultType:`float`,structuredValue:`;`},title:B,role:B,logo:{defaultType:`binary`,allowedTypes:[`binary`,`uri`]},agent:{defaultType:`vcard`,allowedTypes:[`vcard`,`text`,`uri`]},org:Ol,note:Dl,prodid:B,rev:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`],detectType:function(e){return e.indexOf(`T`)===-1?`date`:`date-time`}},"sort-string":B,sound:{defaultType:`binary`,allowedTypes:[`binary`,`uri`]},class:B,key:{defaultType:`binary`,allowedTypes:[`binary`,`text`]}}),Jl={name:`ical`,value:V,param:Bl,property:Vl,propertyGroups:!1},Yl={name:`vcard4`,value:Hl,param:Ul,property:Wl,propertyGroups:!0},Xl={name:`vcard3`,value:Gl,param:Kl,property:ql,propertyGroups:!0},H={strict:!0,defaultSet:Jl,defaultType:`unknown`,components:{vcard:Yl,vcard3:Xl,vevent:Jl,vtodo:Jl,vjournal:Jl,valarm:Jl,vtimezone:Jl,daylight:Jl,standard:Jl},icalendar:Jl,vcard:Yl,vcard3:Xl,getDesignSet:function(e){return e&&e in H.components?H.components[e]:H.defaultSet}},Zl=`\r
|
|
61
|
+
`,Ql=`unknown`,$l={'"':`^'`,"\n":`^n`,"^":`^^`};function U(e){typeof e[0]==`string`&&(e=[e]);let t=0,n=e.length,r=``;for(;t<n;t++)r+=U.component(e[t])+Zl;return r}U.component=function(e,t){let n=e[0].toUpperCase(),r=`BEGIN:`+n+Zl,i=e[1],a=0,o=i.length,s=e[0];for(s===`vcard`&&e[1].length>0&&(e[1][0][0]!==`version`||e[1][0][3]!==`4.0`)&&(s=`vcard3`),t||=H.getDesignSet(s);a<o;a++)r+=U.property(i[a],t)+Zl;let c=e[2]||[],l=0,u=c.length;for(;l<u;l++)r+=U.component(c[l],t)+Zl;return r+=`END:`+n,r},U.property=function(e,t,n){let r=e[0].toUpperCase(),i=e[0],a=e[1];t||=H.defaultSet;let o=a.group,s;s=t.propertyGroups&&o?o.toUpperCase()+`.`+r:r;for(let[e,n]of Object.entries(a)){if(t.propertyGroups&&e==`group`)continue;let r=t.param[e],i=r&&r.multiValue;i&&Array.isArray(n)?(n=n.map(function(e){return e=U._rfc6868Unescape(e),e=U.paramPropertyValue(e,r.multiValueSeparateDQuote),e}),n=U.multiValue(n,i,`unknown`,null,t)):(n=U._rfc6868Unescape(n),n=U.paramPropertyValue(n)),s+=`;`+e.toUpperCase()+`=`+n}if(e.length===3)return s+`:`;let c=e[2],l,u=!1,d=!1,f=!1;return i in t.property?(l=t.property[i],`multiValue`in l&&(u=l.multiValue),`structuredValue`in l&&Array.isArray(e[3])&&(d=l.structuredValue),`defaultType`in l?c===l.defaultType&&(f=!0):c===Ql&&(f=!0)):c===Ql&&(f=!0),f||(s+=`;VALUE=`+c.toUpperCase()),s+=`:`,s+=u&&d?U.multiValue(e[3],d,c,u,t,d):u?U.multiValue(e.slice(3),u,c,null,t,!1):d?U.multiValue(e[3],d,c,null,t,d):U.value(e[3],c,t,!1),n?s:al(s)},U.paramPropertyValue=function(e,t){return!t&&e.indexOf(`,`)===-1&&e.indexOf(`:`)===-1&&e.indexOf(`;`)===-1?e:`"`+e+`"`},U.multiValue=function(e,t,n,r,i,a){let o=``,s=e.length,c=0;for(;c<s;c++)r&&Array.isArray(e[c])?o+=U.multiValue(e[c],r,n,null,i,a):o+=U.value(e[c],n,i,a),c!==s-1&&(o+=t);return o},U.value=function(e,t,n,r){return t in n.value&&`toICAL`in n.value[t]?n.value[t].toICAL(e,r):e},U._rfc6868Unescape=function(e){return e.replace(/[\n^"]/g,function(e){return $l[e]})};var eu=0,tu=1,nu=2,ru=3,iu=class e{static fromString(t,n){return new e(F.property(t,n))}constructor(e,t){this._parent=t||null,typeof e==`string`?(this.jCal=[e,{},H.defaultType],this.jCal[nu]=this.getDefaultType()):this.jCal=e,this._updateType()}get type(){return this.jCal[nu]}get name(){return this.jCal[eu]}get parent(){return this._parent}set parent(e){let t=!this._parent||e&&e._designSet!=this._parent._designSet;this._parent=e,this.type==H.defaultType&&t&&(this.jCal[nu]=this.getDefaultType(),this._updateType())}get _designSet(){return this.parent?this.parent._designSet:H.defaultSet}_updateType(){let e=this._designSet;this.type in e.value&&(this.isDecorated=`decorate`in e.value[this.type],this.name in e.property&&(this.isMultiValue=`multiValue`in e.property[this.name],this.isStructuredValue=`structuredValue`in e.property[this.name]))}_hydrateValue(e){return this._values&&this._values[e]?this._values[e]:this.jCal.length<=ru+e?null:this.isDecorated?(this._values||=[],this._values[e]=this._decorate(this.jCal[ru+e])):this.jCal[ru+e]}_decorate(e){return this._designSet.value[this.type].decorate(e,this)}_undecorate(e){return this._designSet.value[this.type].undecorate(e,this)}_setDecoratedValue(e,t){this._values||=[],typeof e==`object`&&`icaltype`in e?(this.jCal[ru+t]=this._undecorate(e),this._values[t]=e):(this.jCal[ru+t]=e,this._values[t]=this._decorate(e))}getParameter(e){if(e in this.jCal[tu])return this.jCal[tu][e]}getFirstParameter(e){let t=this.getParameter(e);return Array.isArray(t)?t[0]:t}setParameter(e,t){let n=e.toLowerCase();typeof t==`string`&&n in this._designSet.param&&`multiValue`in this._designSet.param[n]&&(t=[t]),this.jCal[tu][e]=t}removeParameter(e){delete this.jCal[tu][e]}getDefaultType(){let e=this.jCal[eu],t=this._designSet;if(e in t.property){let n=t.property[e];if(`defaultType`in n)return n.defaultType}return H.defaultType}resetType(e){this.removeAllValues(),this.jCal[nu]=e,this._updateType()}getFirstValue(){return this._hydrateValue(0)}getValues(){let e=this.jCal.length-ru;if(e<1)return[];let t=0,n=[];for(;t<e;t++)n[t]=this._hydrateValue(t);return n}removeAllValues(){this._values&&(this._values.length=0),this.jCal.length=3}setValues(e){if(!this.isMultiValue)throw Error(this.name+`: does not not support mulitValue.
|
|
62
|
+
override isMultiValue`);let t=e.length,n=0;if(this.removeAllValues(),t>0&&typeof e[0]==`object`&&`icaltype`in e[0]&&this.resetType(e[0].icaltype),this.isDecorated)for(;n<t;n++)this._setDecoratedValue(e[n],n);else for(;n<t;n++)this.jCal[ru+n]=e[n]}setValue(e){this.removeAllValues(),typeof e==`object`&&`icaltype`in e&&this.resetType(e.icaltype),this.isDecorated?this._setDecoratedValue(e,0):this.jCal[ru]=e}toJSON(){return this.jCal}toICALString(){return U.property(this.jCal,this._designSet,!0)}},au=0,ou=1,su=2,cu=0,lu=3,uu=class e{static fromString(t){return new e(F.component(t))}constructor(e,t){typeof e==`string`&&(e=[e,[],[]]),this.jCal=e,this.parent=t||null,!this.parent&&this.name===`vcalendar`&&(this._timezoneCache=new Map)}_hydratedPropertyCount=0;_hydratedComponentCount=0;_timezoneCache=null;_components=null;_properties=null;get name(){return this.jCal[au]}get _designSet(){let e=this.parent&&this.parent._designSet;if(!e&&this.name==`vcard`){let e=this.jCal[ou]?.[0];if(e&&e[cu]==`version`&&e[lu]==`3.0`)return H.getDesignSet(`vcard3`)}return e||H.getDesignSet(this.name)}_hydrateComponent(t){if(this._components||(this._components=[],this._hydratedComponentCount=0),this._components[t])return this._components[t];let n=new e(this.jCal[su][t],this);return this._hydratedComponentCount++,this._components[t]=n}_hydrateProperty(e){if(this._properties||(this._properties=[],this._hydratedPropertyCount=0),this._properties[e])return this._properties[e];let t=new iu(this.jCal[ou][e],this);return this._hydratedPropertyCount++,this._properties[e]=t}getFirstSubcomponent(e){if(e){let t=0,n=this.jCal[su],r=n.length;for(;t<r;t++)if(n[t][au]===e)return this._hydrateComponent(t)}else if(this.jCal[su].length)return this._hydrateComponent(0);return null}getAllSubcomponents(e){let t=this.jCal[su].length,n=0;if(e){let r=this.jCal[su],i=[];for(;n<t;n++)e===r[n][au]&&i.push(this._hydrateComponent(n));return i}if(!this._components||this._hydratedComponentCount!==t)for(;n<t;n++)this._hydrateComponent(n);return this._components||[]}hasProperty(e){let t=this.jCal[ou],n=t.length,r=0;for(;r<n;r++)if(t[r][au]===e)return!0;return!1}getFirstProperty(e){if(e){let t=0,n=this.jCal[ou],r=n.length;for(;t<r;t++)if(n[t][au]===e)return this._hydrateProperty(t)}else if(this.jCal[ou].length)return this._hydrateProperty(0);return null}getFirstPropertyValue(e){let t=this.getFirstProperty(e);return t?t.getFirstValue():null}getAllProperties(e){let t=this.jCal[ou].length,n=0;if(e){let r=this.jCal[ou],i=[];for(;n<t;n++)e===r[n][au]&&i.push(this._hydrateProperty(n));return i}if(!this._properties||this._hydratedPropertyCount!==t)for(;n<t;n++)this._hydrateProperty(n);return this._properties||[]}_removeObjectByIndex(e,t,n){if(t||=[],t[n]){let e=t[n];`parent`in e&&(e.parent=null)}t.splice(n,1),this.jCal[e].splice(n,1)}_removeObject(e,t,n){let r=0,i=this.jCal[e],a=i.length,o=this[t];if(typeof n==`string`){for(;r<a;r++)if(i[r][au]===n)return this._removeObjectByIndex(e,o,r),!0}else if(o){for(;r<a;r++)if(o[r]&&o[r]===n)return this._removeObjectByIndex(e,o,r),!0}return!1}_removeAllObjects(e,t,n){let r=this[t],i=this.jCal[e],a=i.length-1;for(;a>=0;a--)(!n||i[a][au]===n)&&this._removeObjectByIndex(e,r,a)}addSubcomponent(e){this._components||(this._components=[],this._hydratedComponentCount=0),e.parent&&e.parent.removeSubcomponent(e);let t=this.jCal[su].push(e.jCal);return this._components[t-1]=e,this._hydratedComponentCount++,e.parent=this,e}removeSubcomponent(e){let t=this._removeObject(su,`_components`,e);return t&&this._hydratedComponentCount--,t}removeAllSubcomponents(e){let t=this._removeAllObjects(su,`_components`,e);return this._hydratedComponentCount=0,t}addProperty(e){if(!(e instanceof iu))throw TypeError(`must be instance of ICAL.Property`);this._properties||(this._properties=[],this._hydratedPropertyCount=0),e.parent&&e.parent.removeProperty(e);let t=this.jCal[ou].push(e.jCal);return this._properties[t-1]=e,this._hydratedPropertyCount++,e.parent=this,e}addPropertyWithValue(e,t){let n=new iu(e);return n.setValue(t),this.addProperty(n),n}updatePropertyWithValue(e,t){let n=this.getFirstProperty(e);return n?n.setValue(t):n=this.addPropertyWithValue(e,t),n}removeProperty(e){let t=this._removeObject(ou,`_properties`,e);return t&&this._hydratedPropertyCount--,t}removeAllProperties(e){let t=this._removeAllObjects(ou,`_properties`,e);return this._hydratedPropertyCount=0,t}toJSON(){return this.jCal}toString(){return U.component(this.jCal,this._designSet)}getTimeZoneByID(e){if(this.parent)return this.parent.getTimeZoneByID(e);if(!this._timezoneCache)return null;if(this._timezoneCache.has(e))return this._timezoneCache.get(e);let t=this.getAllSubcomponents(`vtimezone`);for(let n of t)if(n.getFirstProperty(`tzid`).getFirstValue()===e){let t=new I({component:n,tzid:e});return this._timezoneCache.set(e,t),t}return null}},du=class{constructor(e){this.ruleDates=[],this.exDates=[],this.fromData(e)}complete=!1;ruleIterators=null;ruleDates=null;exDates=null;ruleDateInc=0;exDateInc=0;exDate=null;ruleDate=null;dtstart=null;last=null;fromData(e){let t=tl(e.dtstart,P);if(t)this.dtstart=t;else throw Error(`.dtstart (ICAL.Time) must be given`);if(e.component)this._init(e.component);else{if(this.last=tl(e.last,P)||t.clone(),!e.ruleIterators)throw Error(`.ruleIterators or .component must be given`);this.ruleIterators=e.ruleIterators.map(function(e){return tl(e,dl)}),this.ruleDateInc=e.ruleDateInc,this.exDateInc=e.exDateInc,e.ruleDates&&(this.ruleDates=e.ruleDates.map(e=>tl(e,P)),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.exDates&&(this.exDates=e.exDates.map(e=>tl(e,P)),this.exDate=this.exDates[this.exDateInc]),e.complete!==void 0&&(this.complete=e.complete)}}_compare_special(e,t){return!e.isDate&&t.isDate?new P({year:e.year,month:e.month,day:e.day}).compare(t):e.compare(t)}next(){let e,t,n,r=0;for(;;){if(r++>500)throw Error(`max tries have occurred, rule may be impossible to fulfill.`);if(t=this.ruleDate,e=this._nextRecurrenceIter(this.last),!t&&!e){this.complete=!0;break}if((!t||e&&t.compare(e.last)>0)&&(t=e.last.clone(),e.next()),this.ruleDate===t&&this._nextRuleDay(),this.last=t,this.exDate&&(n=this._compare_special(this.last,this.exDate),n>0&&this._nextExDay(),n===0)){this._nextExDay();continue}return this.last}}toJSON(){function e(e){return e.toJSON()}let t=Object.create(null);return t.ruleIterators=this.ruleIterators.map(e),this.ruleDates&&(t.ruleDates=this.ruleDates.map(e)),this.exDates&&(t.exDates=this.exDates.map(e)),t.ruleDateInc=this.ruleDateInc,t.exDateInc=this.exDateInc,t.last=this.last.toJSON(),t.dtstart=this.dtstart.toJSON(),t.complete=this.complete,t}_extractDates(e,t){let n=[],r=e.getAllProperties(t);for(let e=0,t=r.length;e<t;e++)for(let t of r[e].getValues()){let e=rl(n,t,(e,t)=>e.compare(t));n.splice(e,0,t)}return n}_init(e){if(this.ruleIterators=[],this.last=this.dtstart.clone(),!e.hasProperty(`rdate`)&&!e.hasProperty(`rrule`)&&!e.hasProperty(`recurrence-id`)){this.ruleDate=this.last.clone(),this.complete=!0;return}if(e.hasProperty(`rdate`)&&(this.ruleDates=this._extractDates(e,`rdate`),this.ruleDates[0]&&this.ruleDates[0].compare(this.dtstart)<0?(this.ruleDateInc=0,this.last=this.ruleDates[0].clone()):this.ruleDateInc=rl(this.ruleDates,this.last,(e,t)=>e.compare(t)),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.hasProperty(`rrule`)){let t=e.getAllProperties(`rrule`),n=0,r=t.length,i,a;for(;n<r;n++)i=t[n].getFirstValue(),a=i.iterator(this.dtstart),this.ruleIterators.push(a),a.next()}e.hasProperty(`exdate`)&&(this.exDates=this._extractDates(e,`exdate`),this.exDateInc=rl(this.exDates,this.last,this._compare_special),this.exDate=this.exDates[this.exDateInc])}_nextExDay(){this.exDate=this.exDates[++this.exDateInc]}_nextRuleDay(){this.ruleDate=this.ruleDates[++this.ruleDateInc]}_nextRecurrenceIter(){let e=this.ruleIterators;if(e.length===0)return null;let t=e.length,n,r,i=0,a;for(;i<t;i++){if(n=e[i],r=n.last,n.completed){t--,i!==0&&i--,e.splice(i,1);continue}(!a||a.last.compare(r)>0)&&(a=n)}return a}},fu=class e{constructor(e,t){e instanceof uu||(t=e,e=null),this.component=e||new uu(`vevent`),this._rangeExceptionCache=Object.create(null),this.exceptions=Object.create(null),this.rangeExceptions=[],t&&t.strictExceptions&&(this.strictExceptions=t.strictExceptions),t&&t.exceptions?t.exceptions.forEach(this.relateException,this):this.component.parent&&!this.isRecurrenceException()&&this.component.parent.getAllSubcomponents(`vevent`).forEach(function(e){e.hasProperty(`recurrence-id`)&&this.relateException(e)},this)}static THISANDFUTURE=`THISANDFUTURE`;exceptions=null;strictExceptions=!1;relateException(t){if(this.isRecurrenceException())throw Error(`cannot relate exception to exceptions`);if(t instanceof uu&&(t=new e(t)),this.strictExceptions&&t.uid!==this.uid)throw Error(`attempted to relate unrelated exception`);let n=t.recurrenceId.toString();if(this.exceptions[n]=t,t.modifiesFuture()){let e=[t.recurrenceId.toUnixTime(),n],r=rl(this.rangeExceptions,e,pu);this.rangeExceptions.splice(r,0,e)}}modifiesFuture(){return this.component.hasProperty(`recurrence-id`)?this.component.getFirstProperty(`recurrence-id`).getParameter(`range`)===e.THISANDFUTURE:!1}findRangeException(e){if(!this.rangeExceptions.length)return null;let t=e.toUnixTime(),n=rl(this.rangeExceptions,[t],pu);if(--n,n<0)return null;let r=this.rangeExceptions[n];return t<r[0]?null:r[1]}getOccurrenceDetails(e){let t=e.toString(),n=e.convertToZone(I.utcTimezone).toString(),r,i={recurrenceId:e};if(t in this.exceptions)r=i.item=this.exceptions[t],i.startDate=r.startDate,i.endDate=r.endDate,i.item=r;else if(n in this.exceptions)r=this.exceptions[n],i.startDate=r.startDate,i.endDate=r.endDate,i.item=r;else{let t=this.findRangeException(e),n;if(t){let r=this.exceptions[t];i.item=r;let a=this._rangeExceptionCache[t];if(!a){let e=r.recurrenceId.clone(),n=r.startDate.clone();e.zone=n.zone,a=n.subtractDate(e),this._rangeExceptionCache[t]=a}let o=e.clone();o.zone=r.startDate.zone,o.addDuration(a),n=o.clone(),n.addDuration(r.duration),i.startDate=o,i.endDate=n}else n=e.clone(),n.addDuration(this.duration),i.endDate=n,i.startDate=e,i.item=this}return i}iterator(e){return new du({component:this.component,dtstart:e||this.startDate})}isRecurring(){let e=this.component;return e.hasProperty(`rrule`)||e.hasProperty(`rdate`)}isRecurrenceException(){return this.component.hasProperty(`recurrence-id`)}getRecurrenceTypes(){let e=this.component.getAllProperties(`rrule`),t=0,n=e.length,r=Object.create(null);for(;t<n;t++){let n=e[t].getFirstValue();r[n.freq]=!0}return r}get uid(){return this._firstProp(`uid`)}set uid(e){this._setProp(`uid`,e)}get startDate(){return this._firstProp(`dtstart`)}set startDate(e){this._setTime(`dtstart`,e)}get endDate(){let e=this._firstProp(`dtend`);if(!e){let t=this._firstProp(`duration`);e=this.startDate.clone(),t?e.addDuration(t):e.isDate&&(e.day+=1)}return e}set endDate(e){this.component.hasProperty(`duration`)&&this.component.removeProperty(`duration`),this._setTime(`dtend`,e)}get duration(){return this._firstProp(`duration`)||this.endDate.subtractDateTz(this.startDate)}set duration(e){this.component.hasProperty(`dtend`)&&this.component.removeProperty(`dtend`),this._setProp(`duration`,e)}get location(){return this._firstProp(`location`)}set location(e){this._setProp(`location`,e)}get attendees(){return this.component.getAllProperties(`attendee`)}get summary(){return this._firstProp(`summary`)}set summary(e){this._setProp(`summary`,e)}get description(){return this._firstProp(`description`)}set description(e){this._setProp(`description`,e)}get color(){return this._firstProp(`color`)}set color(e){this._setProp(`color`,e)}get organizer(){return this._firstProp(`organizer`)}set organizer(e){this._setProp(`organizer`,e)}get sequence(){return this._firstProp(`sequence`)}set sequence(e){this._setProp(`sequence`,e)}get recurrenceId(){return this._firstProp(`recurrence-id`)}set recurrenceId(e){this._setTime(`recurrence-id`,e)}_setTime(e,t){let n=this.component.getFirstProperty(e);n||(n=new iu(e),this.component.addProperty(n)),t.zone===I.localTimezone||t.zone===I.utcTimezone?n.removeParameter(`tzid`):n.setParameter(`tzid`,t.zone.tzid),n.setValue(t)}_setProp(e,t){this.component.updatePropertyWithValue(e,t)}_firstProp(e){return this.component.getFirstPropertyValue(e)}toString(){return this.component.toString()}};function pu(e,t){return e[0]>t[0]?1:t[0]>e[0]?-1:0}var mu={foldLength:75,debug:!1,newLineChar:`\r
|
|
63
|
+
`,Binary:Lc,Component:uu,ComponentParser:class{constructor(e){e===void 0&&(e={});for(let[t,n]of Object.entries(e))this[t]=n}parseEvent=!0;parseTimezone=!0;oncomplete=function(){};onerror=function(e){};ontimezone=function(e){};onevent=function(e){};process(e){typeof e==`string`&&(e=F(e)),e instanceof uu||(e=new uu(e));let t=e.getAllSubcomponents(),n=0,r=t.length,i;for(;n<r;n++)switch(i=t[n],i.name){case`vtimezone`:if(this.parseTimezone){let e=i.getFirstPropertyValue(`tzid`);e&&this.ontimezone(new I({tzid:e,component:i}))}break;case`vevent`:this.parseEvent&&this.onevent(new fu(i));break;default:continue}this.oncomplete()}},Duration:Bc,Event:fu,Period:Hc,Property:iu,Recur:vl,RecurExpansion:du,RecurIterator:dl,Time:P,Timezone:I,TimezoneService:Qc,UtcOffset:ll,VCardTime:ul,parse:F,stringify:U,design:H,helpers:cl},hu=[`mo`,`tu`,`we`,`th`,`fr`,`sa`,`su`],gu=/^(\d{4})-(\d{2})-(\d{2})$/,_u=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;function vu(e){let t=_u.exec(e)??gu.exec(e);if(!t)return;let[,n,r,i,a=`0`,o=`0`]=t.map(e=>e??`0`),s=Date.UTC(Number(n),Number(r)-1,Number(i),Number(a),Number(o)),c=new Date(s);if(c.getUTCDate()===Number(i)&&c.getUTCMonth()===Number(r)-1&&!(Number(a)>23||Number(o)>59))return s}function yu(e){return gu.test(e)}function bu(e){return!!e&&typeof e==`object`&&typeof e.start==`string`}function xu(e){if(!bu(e))return`must have a start date`;let{start:t,end:n,repeat:r}=e,i=vu(t);if(i===void 0)return`must start on a date written as YYYY-MM-DD, or YYYY-MM-DDTHH:MM with a time`;if(n!==void 0){let e=vu(n);if(e===void 0||yu(n)!==yu(t))return`must end on a date, or a date and time, written the same way as its start`;if(e<i)return`must end after it starts`}if(r!==void 0){if(!r||typeof r!=`object`||![`day`,`week`,`month`,`year`].includes(r.every))return`must repeat every day, week, month or year`;if(r.interval!==void 0&&(!Number.isInteger(r.interval)||r.interval<1))return`must repeat every 1 or more days, weeks, months or years`;if(r.days!==void 0&&(!Array.isArray(r.days)||r.days.some(e=>!hu.includes(e))))return`must repeat on days of the week written as mo, tu, we, th, fr, sa or su`;if(r.on!==void 0&&![`date`,`weekday`,`last`].includes(r.on))return`must repeat monthly on its date, its weekday or the last such weekday`;if(r.until!==void 0&&(!gu.test(r.until)||vu(r.until)===void 0))return`must stop repeating on a date written as YYYY-MM-DD`;if(r.until!==void 0&&r.until<t.slice(0,10))return`must stop repeating on or after the day it starts`;if(r.skip!==void 0&&(!Array.isArray(r.skip)||r.skip.some(e=>!gu.test(e)||vu(e)===void 0)))return`must skip dates written as YYYY-MM-DD`}}`${h}`;var Su=/^\/media\/fonts\/[a-z0-9][a-z0-9-]{0,99}\.woff2$/;function Cu(e){let t=e.split(`.`);if(t.length!==4||!t.every(e=>/^\d{1,3}$/.test(e)))return;let n=t.map(Number);return n.every(e=>e<=255)?n:void 0}function wu(e){let t=/^\[::ffff:(\d+\.\d+\.\d+\.\d+)\]$/.exec(e);if(t?.[1])return Cu(t[1]);let n=/^\[::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})\]$/.exec(e);if(!n?.[1]||!n[2])return;let r=Number.parseInt(n[1],16),i=Number.parseInt(n[2],16);return[r>>8,r&255,i>>8,i&255]}function Tu(e){return e.toLowerCase().replace(/\.+$/,``)}function Eu(e){let t=Tu(e);if(t===`localhost`||t.endsWith(`.localhost`)||t===`[::1]`||t===`[::]`)return!0;let n=Cu(t)??wu(t);return n!==void 0&&(n[0]===127||n.every(e=>e===0))}function Du(e){if(Eu(e))return!0;let t=Tu(e),n=Cu(t)??wu(t);if(n){let[e=0,t=0]=n;return e===0||e===10||e===172&&t>=16&&t<=31||e===192&&t===168||e===169&&t===254||e===100&&t>=64&&t<=127}return/^\[f[cd][0-9a-f]{0,2}:/.test(t)||/^\[fe[89ab][0-9a-f]?:/.test(t)}var Ou=[`statistics`,`needed`],ku=/^(?=.{1,253}(?:\/|$))[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)+(?:\/[\w.~-]+)*$/i,Au=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ju(e){if(typeof e!=`string`)return;let t=e.trim().startsWith(`//`)?`https:${e.trim()}`:e.trim();try{let e=new URL(t);return e.protocol!==`https:`||e.username||e.password||Du(e.hostname)?void 0:e.href}catch{return}}var Mu=[`background`,`foreground`,`primary`,`primaryForeground`,`secondary`,`secondaryForeground`,`muted`,`mutedForeground`,`accent`,`accentForeground`,`border`],Nu=k().regex(/^[#a-zA-Z0-9(),.%\s/+-]{1,100}$/,`must be a CSS color, such as #1e3a8a or rgb(30 58 138)`).regex(/^\s*(#[0-9a-fA-F]{3,8}|(rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark)\([^()]*(\([^()]*\)[^()]*)*\)|[a-zA-Z]+)\s*$/,`must be a CSS color, such as #1e3a8a or rgb(30 58 138)`),Pu=k().regex(/^[a-zA-Z0-9 ]{1,60}$/,`must be a font name, such as Inter or Cinzel Decorative`),Fu=k().regex(/^[a-z0-9-]{1,60}$/,`must be a code theme's name, such as github-light`),Iu=[`sans-serif`,`serif`,`display`,`handwriting`,`monospace`],Lu=M({src:k().regex(Su,`must be a font in the media library's fonts folder`),weight:Ws().int().min(1).max(1e3),weightTo:Ws().int().min(1).max(1e3).optional(),style:fc([`normal`,`italic`]).optional()}).refine(e=>e.weightTo===void 0||e.weightTo>e.weight,{message:`a variable font's weights must go from lighter to heavier`,path:[`weightTo`]}),Ru=j(M({family:Pu,category:fc(Iu).optional(),files:j(Lu).min(1).max(18)})).max(8).refine(e=>new Set(e.map(e=>e.family.toLowerCase())).size===e.length,{message:`each font's name can be used once`}),zu=k().regex(/^\d*\.?\d+(px|rem|em)?$/,`must be a size, such as 0.5rem or 8px`),Bu=k().regex(/^gf-[a-z0-9]+(?:-[a-z0-9]+)*$/,`must be a part's name, such as gf-card-title`),Vu=k().max(1e3).regex(/^[^<>\p{Cc}]*$/u,`must be CSS classes, such as rounded-xl shadow-sm`),Hu=M({colors:uc(fc(Mu),Nu).default({}),darkMode:Js().optional(),darkColors:uc(fc(Mu),Nu).optional(),fonts:M({heading:Pu.optional(),body:Pu.optional(),headingCategory:fc(Iu).optional(),bodyCategory:fc(Iu).optional(),custom:Ru.optional()}).default({}),radius:zu.optional(),code:M({light:Fu.optional(),dark:Fu.optional(),background:fc([`theme`,`site`]).optional()}).optional(),parts:lc(Bu,Vu).optional()}),Uu=k().regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/,`must be a language's code, such as es or pt-BR`),Wu={message:k(),accept:k(),decline:k(),held:k(),show:k(),policyLabel:k(),choose:k(),save:k(),content:k(),statistics:k(),marketing:k()},Gu={message:`This site shows videos, forms and other content from other sites, which can set cookies and see that you visited. Is that all right with you?`,accept:`Allow`,decline:`No, thanks`,held:`This comes from {site}, which can set cookies.`,show:`Allow and show it`,policyLabel:`Privacy`,choose:`Choose`,save:`Save my choices`,content:`Videos, maps, forms and other content from other sites`,statistics:`Statistics that count visits, to improve the site`,marketing:`Advertising`},Ku={es:{message:`Este sitio muestra vídeos, formularios y otros contenidos de otros sitios, que pueden guardar cookies y saber que lo has visitado. ¿Te parece bien?`,accept:`Permitir`,decline:`No, gracias`,held:`Esto viene de {site}, que puede guardar cookies.`,show:`Permitir y mostrarlo`,policyLabel:`Privacidad`,choose:`Elegir`,save:`Guardar mis elecciones`,content:`Vídeos, mapas, formularios y otros contenidos de otros sitios`,statistics:`Estadísticas que cuentan las visitas, para mejorar el sitio`,marketing:`Publicidad`}};function qu(e){let t=e?.toLowerCase().split(`-`)[0];return t&&Ku[t]||Gu}function Ju(e,t,n){let r=qu(t),i=qu(n);if(r===i)return e;let a=Object.keys(Gu);return{...e,...Object.fromEntries(a.filter(t=>e[t]===i[t]).map(e=>[e,r[e]]))}}var Yu=fc([`needed`,`content`,`statistics`,`marketing`]).default(`content`),Xu=M({message:Wu.message.default(Gu.message),accept:Wu.accept.default(Gu.accept),decline:Wu.decline.default(Gu.decline),held:Wu.held.default(Gu.held),show:Wu.show.default(Gu.show),policy:k().optional(),policyLabel:Wu.policyLabel.default(Gu.policyLabel),choose:Wu.choose.default(Gu.choose),save:Wu.save.default(Gu.save),content:Wu.content.default(Gu.content),statistics:Wu.statistics.default(Gu.statistics),marketing:Wu.marketing.default(Gu.marketing),days:Ws().int().min(1).max(395).default(180),code:M({head:Yu,body:Yu}).default({head:`content`,body:`content`})}),Zu=M({title:k().optional(),description:k().optional(),titleTemplate:k().optional(),consent:M(Wu).partial().optional()}),Qu=k().refine(e=>ju(e)===e,`must be an https:// address`),$u=fc(Ou).optional(),ed=M({version:N(1),title:k().default(`My site`),description:k().default(``),url:Ds({protocol:/^https?$/}).optional(),noIndex:Js().optional(),trailingSlash:Js().optional(),noAiTraining:Js().optional(),language:k().default(`en`),languageName:k().optional(),languages:j(M({code:Uu,name:k().optional()})).optional().superRefine((e,t)=>{let n=new Set;(e??[]).forEach((e,r)=>{let i=e.code.toLowerCase();n.has(i)&&t.addIssue({code:`custom`,path:[r,`code`],message:`is listed twice`}),n.add(i)})}),translations:lc(k(),Zu).optional(),favicon:k().optional(),logo:M({src:k(),alt:k().default(``),darkSrc:k().optional()}).optional(),titleTemplate:k().default(`%s`),socialImage:k().optional(),externalLinksInNewTab:Js().optional(),timeZone:k().refine(e=>{try{return new Intl.DateTimeFormat(`en`,{timeZone:e}),!0}catch{return!1}},{message:`isn't a time zone: it should be one such as Europe/London or America/New_York`}).optional(),contact:M({address:k().optional(),phone:k().optional(),email:k().optional()}).optional(),forms:M({service:fc([`web3forms`,`formspree`,`other`]).default(`web3forms`),accessKey:k().optional(),address:k().optional(),captcha:Js().optional()}).optional(),comments:rc([M({repo:k().regex(n),repoId:k().regex(t),category:k(),categoryId:k().regex(t)}),M({disqus:k().regex(e)}),M({garrul:k().refine(e=>r(e)===e)})]).optional(),stats:ac(`service`,[M({service:N(`plausible`),domain:k().regex(ku),script:Qu,purpose:$u}),M({service:N(`umami`),website:k().regex(Au),script:Qu,purpose:$u}),M({service:N(`goatcounter`),endpoint:Qu,script:Qu.optional(),purpose:$u})]).optional(),consent:Xu.optional(),theme:Hu.default({colors:{},fonts:{}})}).transform(e=>e.consent?{...e,consent:Ju(e.consent,e.language)}:e),td=M({label:k(),href:k()}),nd=td.extend({children:j(td).optional()}),rd=M({version:N(1),menus:lc(k(),j(nd)).default({}),languages:lc(k(),lc(k(),j(nd))).optional()});M({version:N(1),automatic:Js().default(!0),skip:j(k()).default([])});var id=tc({type:k().min(1),props:tc({id:k().min(1)})}),ad=tc({root:tc({props:lc(k(),Xs()).optional()}).default({}),content:j(id).default([])}),od=k().regex(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}$/,`must be a date and time written as YYYY-MM-DDTHH:MM`).refine(e=>vu(e)!==void 0,`must be a date and time that exists`),sd={showFrom:od.optional(),hideAfter:od.optional()},cd={translationOf:k().optional(),translatedFrom:k().optional()};function ld(e,t){e.showFrom&&e.hideAfter&&e.hideAfter<=e.showFrom&&t.addIssue({code:`custom`,path:[`hideAfter`],message:`must be after showFrom`})}var ud=M({version:N(1),...sd,...cd,data:ad}).superRefine(ld);M({version:N(1),data:ad}),M({version:N(1),title:k().trim().min(1).max(200),data:ad});var dd=[`text`,`textarea`,`richtext`,`number`,`date`,`event`,`link`,`image`,`select`,`tags`,`yesno`,`item`,`images`,`file`,`group`],fd=[`text`,`textarea`,`number`,`date`,`link`,`image`,`yesno`],pd=k().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,`must use lowercase letters, numbers and hyphens, starting with a letter`),md=M({value:k().min(1),label:k()}),hd=M({name:pd,label:k().min(1),type:fc(fd)}),gd=M({name:pd,label:k().min(1),type:fc(dd),required:Js().optional(),hint:k().optional(),options:j(md).optional(),collection:k().optional(),multiple:Js().optional(),fields:j(hd).max(10).optional()}),_d=`title`,vd=M({version:N(1),name:k().min(1),entryName:k().min(1),path:k().optional(),languagePaths:lc(k(),k()).optional(),fields:j(gd).min(1),sort:M({field:pd,order:fc([`asc`,`desc`])}).optional(),markdown:M({body:pd}).optional(),calendar:M({when:pd,place:pd.optional(),summary:pd.optional()}).optional(),template:ad.default({root:{},content:[]})}).superRefine((e,t)=>{let n=new Set;if(e.fields.forEach((e,r)=>{if(n.has(e.name)&&t.addIssue({code:`custom`,path:[`fields`,r,`name`],message:`is used by more than one field`}),n.add(e.name),(e.type===`select`||e.type===`tags`)&&!e.options?.length&&t.addIssue({code:`custom`,path:[`fields`,r,`options`],message:`must list at least one choice`}),e.type===`item`&&!e.collection&&t.addIssue({code:`custom`,path:[`fields`,r,`collection`],message:`must name a collection`}),e.type===`group`){let n=e.fields??[];n.length===0&&t.addIssue({code:`custom`,path:[`fields`,r,`fields`],message:`must list at least one field`});let i=new Set;n.forEach((e,n)=>{i.has(e.name)&&t.addIssue({code:`custom`,path:[`fields`,r,`fields`,n,`name`],message:`is used by more than one field`}),i.add(e.name)})}}),e.fields.find(e=>e.name===`title`)?.type!==`text`&&t.addIssue({code:`custom`,path:[`fields`],message:`must include a text field named "${_d}"`}),e.path!==void 0){let n=c(e.path);n&&t.addIssue({code:`custom`,path:[`path`],message:n})}for(let[n,r]of Object.entries(e.languagePaths??{})){let e=`/${n.toLowerCase()}/`,i=c(r)??(r.startsWith(e)?void 0:`must start with "${e}", the language's own address.`);i&&t.addIssue({code:`custom`,path:[`languagePaths`,n],message:i})}if(e.sort&&!n.has(e.sort.field)&&t.addIssue({code:`custom`,path:[`sort`,`field`],message:`must be one of the collection's fields`}),e.calendar){let n=t=>e.fields.find(e=>e.name===t)?.type;n(e.calendar.when)!==`event`&&t.addIssue({code:`custom`,path:[`calendar`,`when`],message:`must be one of the collection's date and time fields`}),e.calendar.place!==void 0&&![`text`,`textarea`].includes(n(e.calendar.place)??``)&&t.addIssue({code:`custom`,path:[`calendar`,`place`],message:`must be one of the collection's text fields`}),e.calendar.summary!==void 0&&![`text`,`textarea`,`richtext`].includes(n(e.calendar.summary)??``)&&t.addIssue({code:`custom`,path:[`calendar`,`summary`],message:`must be one of the collection's text fields`})}e.markdown&&(e.fields.find(t=>t.name===e.markdown?.body)?.type!==`richtext`&&t.addIssue({code:`custom`,path:[`markdown`,`body`],message:`must be one of the collection's formatted-text fields`}),n.has(`version`)&&t.addIssue({code:`custom`,path:[`fields`],message:`can't include a field named "version" when entries are Markdown files`}))}),yd=M({version:N(1),...sd,inLanguage:Uu.optional(),...cd,fields:lc(k(),Xs()).default({})}).superRefine(ld),bd=/^\d{4}-\d{2}-\d{2}$/;function xd(e){return typeof e==`string`&&bd.test(e)&&vu(e)!==void 0}function Sd(e,t){let n=[];for(let r of e){let e=t[r.name];if(e!=null)switch(r.type){case`yesno`:typeof e!=`boolean`&&n.push(`${r.name} must be true or false`);break;case`item`:`multiple`in r&&r.multiple?Cd(e)||n.push(`${r.name} must be a list of item names`):typeof e!=`string`&&n.push(`${r.name} must be an item's name`);break;case`images`:Cd(e)||n.push(`${r.name} must be a list of image addresses`);break;case`group`:{let t=`fields`in r?r.fields??[]:[];if(!Array.isArray(e)||e.length>200){n.push(`${r.name} must be a list of at most 200 rows`);break}e.forEach((e,i)=>{if(typeof e!=`object`||!e||Array.isArray(e)){n.push(`${r.name}'s row ${i+1} must be a set of values`);return}for(let a of Sd(t,e))n.push(`${r.name}'s row ${i+1}: ${a}`)});break}case`number`:(typeof e!=`number`||!Number.isFinite(e))&&n.push(`${r.name} must be a number`);break;case`date`:e!==``&&!xd(e)&&n.push(`${r.name} must be a date written as YYYY-MM-DD`);break;case`event`:{let t=xu(e);t&&n.push(`${r.name} ${t}`);break}case`select`:e!==``&&!r.options?.some(t=>t.value===e)&&n.push(`${r.name} must be one of: ${r.options?.map(e=>e.value).join(`, `)}`);break;case`tags`:(!Array.isArray(e)||e.some(e=>typeof e!=`string`||!r.options?.some(t=>t.value===e)))&&n.push(`${r.name} must be a list of: ${r.options?.map(e=>e.value).join(`, `)}`);break;default:typeof e!=`string`&&n.push(`${r.name} must be text`)}}return n}function Cd(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}var wd=[`version`,`type`,`id`];function Td(e,t){let n=wd.indexOf(e),r=wd.indexOf(t);return n!==-1||r!==-1?(n===-1?1/0:n)-(r===-1?1/0:r):e<t?-1:+(e>t)}function Ed(e){if(Array.isArray(e))return e.map(Ed);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort(Td)){let r=e[n];r!==void 0&&(t[n]=Ed(r))}return t}return e}function Dd(e){return`${JSON.stringify(Ed(e),null,2)}\n`}function Od(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var kd=Od();function Ad(e){kd=e}var jd={exec:()=>null};function Md(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function W(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(G.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var Nd=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),G={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Md(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Md(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Md(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Md(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Md(e=>RegExp(`^ {0,${e}}(?:</?(?:${Jd})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:Md(e=>RegExp(`^ {0,${e}}>`))},Pd=/^(?:[ \t]*(?:\n|$))+/,Fd=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Id=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ld=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Rd=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,zd=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Bd=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Vd=W(Bd).replace(/bull/g,zd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),Hd=W(Bd).replace(/bull/g,zd).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ud=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Wd=/^[^\n]+/,Gd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,Kd=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Gd).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),qd=W(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,zd).getRegex(),Jd=`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|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,Yd=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Xd=W(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,Yd).replace(`tag`,Jd).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Zd=e=>W(Ud).replace(`hr`,Ld).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Jd).getRegex(),Qd=Zd(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),$d=Zd(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),ef={blockquote:W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,$d).getRegex(),code:Fd,def:Kd,fences:Id,heading:Rd,hr:Ld,html:Xd,lheading:Vd,list:qd,newline:Pd,paragraph:Qd,table:jd,text:Wd},tf=W(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ld).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Jd).getRegex(),nf={...ef,lheading:Hd,table:tf,paragraph:W(Ud).replace(`hr`,Ld).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,tf).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,Jd).getRegex()},rf={...ef,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Yd).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:jd,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Ud).replace(`hr`,Ld).replace(`heading`,` *#{1,6} *[^
|
|
64
|
+
]`).replace(`lheading`,Vd).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},af=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,of=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,sf=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,cf=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,lf=/[\p{P}\p{S}]/u,uf=/[\s\p{P}\p{S}]/u,df=/[^\s\p{P}\p{S}]/u,ff=W(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,uf).getRegex(),pf=/[\p{Pi}\p{Ps}"']/u,mf=/(?!~)[\p{P}\p{S}]/u,hf=/(?!~)[\s\p{P}\p{S}]/u,gf=/(?:[^\s\p{P}\p{S}]|~)/u,_f=W(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Nd?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),vf=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,yf=W(vf,`u`).replace(/punct/g,lf).getRegex(),bf=W(vf,`u`).replace(/punct/g,mf).getRegex(),xf=W(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,pf).replace(/punct/g,lf).getRegex(),Sf=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Cf=W(Sf,`gu`).replace(/notPunctSpace/g,df).replace(/punctSpace/g,uf).replace(/punct/g,lf).getRegex(),wf=W(Sf,`gu`).replace(/notPunctSpace/g,gf).replace(/punctSpace/g,hf).replace(/punct/g,mf).getRegex(),Tf=W(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,df).replace(/punctSpace/g,uf).replace(/punct/g,lf).getRegex(),Ef=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,df).replace(/punctSpace/g,uf).replace(/punct/g,lf).getRegex(),Df=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,df).replace(/punctSpace/g,uf).replace(/punct/g,lf).getRegex(),Of=W(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,lf).getRegex(),kf=W(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,df).replace(/punctSpace/g,uf).replace(/punct/g,lf).getRegex(),Af=W(/\\(punct)/,`gu`).replace(/punct/g,lf).getRegex(),jf=W(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Mf=W(Yd).replace(`(?:-->|$)`,`-->`).getRegex(),Nf=W(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Mf).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pf=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Ff=W(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Pf).getRegex(),If=W(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,Ff).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Lf=W(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Ff).replace(`ref`,Gd).getRegex(),Rf=W(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Gd).getRegex(),zf=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Bf=W(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Pf).getRegex(),Vf=W(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,W(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Bf).replace(`ref`,zf).getRegex()).replace(`nolink`,W(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,zf).getRegex()).getRegex(),Hf=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Uf=W(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),Wf={_backpedal:jd,anyPunctuation:Af,autolink:jf,blockSkip:_f,br:sf,code:of,del:jd,delLDelim:jd,delRDelim:jd,emStrongLDelim:yf,emStrongRDelimAst:Cf,emStrongRDelimUnd:Ef,escape:af,link:If,nolink:Rf,punctuation:ff,reflink:Lf,reflinkSearch:Vf,tag:Nf,text:cf,url:jd},Gf={...Wf,emStrongLDelim:xf,emStrongRDelimAst:Tf,emStrongRDelimUnd:Df,link:W(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Ff).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Ff).getRegex()},Kf={...Wf,emStrongRDelimAst:wf,emStrongLDelim:bf,delLDelim:Of,delRDelim:kf,url:W(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Uf).replace(`protocol`,Hf).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:W(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,Hf).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},qf={...Kf,br:W(sf).replace(`{2,}`,`*`).getRegex(),text:W(Kf.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Jf={normal:ef,gfm:nf,pedantic:rf},Yf={normal:Wf,gfm:Kf,breaks:qf,pedantic:Gf},Xf={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Zf=e=>Xf[e];function Qf(e,t){if(t){if(G.escapeTest.test(e))return e.replace(G.escapeReplace,Zf)}else if(G.escapeTestNoEncode.test(e))return e.replace(G.escapeReplaceNoEncode,Zf);return e}function $f(e){return e.replace(G.numericCharacterReference,(e,t,n)=>{let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:String.fromCodePoint(r)})}function ep(e){try{e=encodeURI(e).replace(G.percentDecode,`%`)}catch{return null}return e}function tp(e,t){let n=e.replace(G.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(G.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(G.slashPipe,`|`);return n}function np(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function rp(e){let t=e.split(`
|
|
65
|
+
`),n=t.length-1;for(;n>=0&&G.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
66
|
+
`)}function ip(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function ap(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function op(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function sp(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function cp(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
67
|
+
`).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
|
|
68
|
+
`)}function lp(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var up=class{options;rules;lexer;constructor(e){this.options=e||kd}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:rp(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=cp(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=np(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:np(t[0],`
|
|
69
|
+
`),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:np(t[0],`
|
|
70
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=np(t[0],`
|
|
71
|
+
`).split(`
|
|
72
|
+
`),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
|
|
73
|
+
`),c=s.replace(this.rules.other.blockquoteSetextReplace,`
|
|
74
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
75
|
+
${s}`:s,r=r?`${r}
|
|
76
|
+
${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
77
|
+
`),o=t.raw+`
|
|
78
|
+
`+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
|
|
79
|
+
`).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
|
|
80
|
+
${d.join(`
|
|
81
|
+
`)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
82
|
+
`+e.join(`
|
|
83
|
+
`),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
|
|
84
|
+
`);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=t[2].split(`
|
|
85
|
+
`,1)[0],l=t[1].length,u=this.options.pedantic?op(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>op(e,l)),d=e.split(`
|
|
86
|
+
`,1)[0],f=!u.trim(),p=0;if(this.options.pedantic?(p=2,s=u.trimStart()):f?p=l+1:(p=u.search(this.rules.other.nonSpaceChar),p=p>4?1:p,s=u.slice(p),p+=l),f&&this.rules.other.blankLine.test(d)&&(r+=d+`
|
|
87
|
+
`,e=e.substring(d.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(p),n=this.rules.other.hrRegex(p),i=this.rules.other.fencesBeginRegex(p),a=this.rules.other.headingBeginRegex(p),o=this.rules.other.htmlBeginRegex(p),c=this.rules.other.blockquoteBeginRegex(p);for(;e;){let l=e.split(`
|
|
88
|
+
`,1)[0],m;if(d=l,this.options.pedantic?(d=d.replace(this.rules.other.listReplaceNesting,` `),m=d):m=d.replace(this.rules.other.leadingSpaceTab,e=>e.replace(this.rules.other.tabCharGlobal,` `)),i.test(d)||a.test(d)||o.test(d)||c.test(d)||t.test(d)||n.test(d))break;if(m.search(this.rules.other.nonSpaceChar)>=p||!d.trim())s+=`
|
|
89
|
+
`+m.slice(p);else{if(f||u.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(u)||a.test(u)||n.test(u))break;s+=`
|
|
90
|
+
`+d}f=!d.trim(),r+=l+`
|
|
91
|
+
`,e=e.substring(l.length+1),u=m.slice(p)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=rp(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&ap(t[2],`()`)!==-1)return;let e=ip(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:np(t[0],`
|
|
92
|
+
`),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=tp(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
93
|
+
`):[],a={type:`table`,raw:np(t[0],`
|
|
94
|
+
`),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(tp(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:np(t[0],`
|
|
95
|
+
`),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
96
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&lp(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=np(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=ap(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),sp(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&lp(e,n[1],r,this.rules))return;let i=t[ip((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return sp(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:$f(t[0]),escaped:e}}}},dp=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||kd,this.options.tokenizer=this.options.tokenizer||new up,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:G,block:Jf.normal,inline:Yf.normal};this.options.pedantic?(t.block=Jf.pedantic,t.inline=Yf.pedantic):this.options.gfm&&(t.block=Jf.gfm,t.inline=this.options.breaks?Yf.breaks:Yf.gfm),this.tokenizer.rules=t}static get rules(){return{block:Jf,inline:Yf}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(G.carriageReturn,`
|
|
97
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(G.tabCharGlobal,` `).replace(G.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
|
|
98
|
+
`:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
99
|
+
`)?``:`
|
|
100
|
+
`)+i.raw,n.text+=`
|
|
101
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
102
|
+
`)?``:`
|
|
103
|
+
`)+i.raw,n.text+=`
|
|
104
|
+
`+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
|
|
105
|
+
`)?``:`
|
|
106
|
+
`)+i.raw,r.text+=`
|
|
107
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
|
|
108
|
+
`)?``:`
|
|
109
|
+
`)+i.raw,n.text+=`
|
|
110
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,ip(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,ip(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},fp=class{options;parser;constructor(e){this.options=e||kd}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(G.notSpaceStart)?.[0],i=e?e.replace(G.endingNewline,``)+`
|
|
111
|
+
`:``;return r?`<pre><code class="language-`+Qf(r)+`">`+(n?i:Qf(i,!0))+`</code></pre>
|
|
112
|
+
`:`<pre><code>`+(n?i:Qf(i,!0))+`</code></pre>
|
|
113
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
114
|
+
${this.parser.parse(e)}</blockquote>
|
|
115
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
116
|
+
`}hr(e){return`<hr>
|
|
117
|
+
`}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
|
|
118
|
+
`+r+`</`+i+`>
|
|
119
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
120
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
121
|
+
`}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
|
|
122
|
+
<thead>
|
|
123
|
+
`+t+`</thead>
|
|
124
|
+
`+r+`</table>
|
|
125
|
+
`}tablerow({text:e}){return`<tr>
|
|
126
|
+
${e}</tr>
|
|
127
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
128
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Qf(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?Qf(n,!0):this.parser.parseInline(r),o=ep(e);if(o===null)return a;e=Qf(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+Qf(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=ep(e);if(i===null)return Qf(n);e=i;let a=`<img src="${Qf(e)}" alt="${Qf(n)}"`;return t&&(a+=` title="${Qf(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Qf(e.text)}},pp=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},mp=class e{options;renderer;textRenderer;constructor(e){this.options=e||kd,this.options.renderer=this.options.renderer||new fp,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new pp}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},hp=class{options;block;constructor(e){this.options=e||kd}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?dp.lex:dp.lexInline}provideParser(e=this.block){return e?mp.parse:mp.parseInline}},gp=new class{defaults=Od();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=mp;Renderer=fp;TextRenderer=pp;Lexer=dp;Tokenizer=up;Hooks=hp;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new fp(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new up(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new hp;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=hp.passThroughHooks.has(n)?e=>{if(this.defaults.async&&hp.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return dp.lex(e,t??this.defaults)}parser(e,t){return mp.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?dp.lex:dp.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?mp.parse:mp.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?dp.lex:dp.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?mp.parse:mp.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
|
|
129
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+Qf(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function K(e,t){return gp.parse(e,t)}K.options=K.setOptions=function(e){return gp.setOptions(e),K.defaults=gp.defaults,Ad(K.defaults),K},K.getDefaults=Od,K.defaults=kd;function _p(...e){return gp.use(...e),K.defaults=gp.defaults,Ad(K.defaults),K}K.use=_p,K.walkTokens=function(e,t){return gp.walkTokens(e,t)},K.parseInline=gp.parseInline,K.Parser=mp,K.parser=mp.parse,K.Renderer=fp,K.TextRenderer=pp,K.Lexer=dp,K.lexer=dp.lex,K.Tokenizer=up,K.Hooks=hp,K.parse=K,K.options,K.setOptions,K.walkTokens,K.parseInline,mp.parse,dp.lex;var vp=Symbol.for(`yaml.alias`),yp=Symbol.for(`yaml.document`),bp=Symbol.for(`yaml.map`),xp=Symbol.for(`yaml.pair`),Sp=Symbol.for(`yaml.scalar`),Cp=Symbol.for(`yaml.seq`),wp=Symbol.for(`yaml.node.type`),Tp=e=>!!e&&typeof e==`object`&&e[wp]===vp,Ep=e=>!!e&&typeof e==`object`&&e[wp]===yp,Dp=e=>!!e&&typeof e==`object`&&e[wp]===bp,q=e=>!!e&&typeof e==`object`&&e[wp]===xp,J=e=>!!e&&typeof e==`object`&&e[wp]===Sp,Op=e=>!!e&&typeof e==`object`&&e[wp]===Cp;function Y(e){if(e&&typeof e==`object`)switch(e[wp]){case bp:case Cp:return!0}return!1}function X(e){if(e&&typeof e==`object`)switch(e[wp]){case vp:case bp:case Sp:case Cp:return!0}return!1}var kp=e=>(J(e)||Y(e))&&!!e.anchor,Ap=Symbol(`break visit`),jp=Symbol(`skip children`),Mp=Symbol(`remove node`);function Np(e,t){let n=Fp(t);Ep(e)?Pp(null,e.contents,n,Object.freeze([e]))===Mp&&(e.contents=null):Pp(null,e,n,Object.freeze([]))}Np.BREAK=Ap,Np.SKIP=jp,Np.REMOVE=Mp;function Pp(e,t,n,r){let i=Ip(e,t,n,r);if(X(i)||q(i))return Lp(e,r,i),Pp(e,i,n,r);if(typeof i!=`symbol`){if(Y(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=Pp(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===Ap)return Ap;else i===Mp&&(t.items.splice(e,1),--e)}}else if(q(t)){r=Object.freeze(r.concat(t));let e=Pp(`key`,t.key,n,r);if(e===Ap)return Ap;e===Mp&&(t.key=null);let i=Pp(`value`,t.value,n,r);if(i===Ap)return Ap;i===Mp&&(t.value=null)}}return i}function Fp(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 Ip(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Dp(t))return n.Map?.(e,t,r);if(Op(t))return n.Seq?.(e,t,r);if(q(t))return n.Pair?.(e,t,r);if(J(t))return n.Scalar?.(e,t,r);if(Tp(t))return n.Alias?.(e,t,r)}function Lp(e,t,n){let r=t[t.length-1];if(Y(r))r.items[e]=n;else if(q(r))e===`key`?r.key=n:r.value=n;else if(Ep(r))r.contents=n;else{let e=Tp(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var Rp={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},zp=e=>e.replace(/[!,[\]{}]/g,e=>Rp[e]),Bp=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)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e===`!`)return`!`;if(e[0]!==`!`)return t(`Not a valid tag: ${e}`),null;if(e[1]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+zp(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&X(e.contents)){let t={};Np(e.contents,(e,n)=>{X(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)(i!==`!!`||a!==`tag:yaml.org,2002:`)&&(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
130
|
+
`)}};Bp.defaultYaml={explicit:!1,version:`1.2`},Bp.defaultTags={"!!":`tag:yaml.org,2002:`};function Vp(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function Hp(e){let t=new Set;return Np(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function Up(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Wp(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Hp(e);let a=Up(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(J(t.node)||Y(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function Gp(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=Gp(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=Gp(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=Gp(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=Gp(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function Kp(e,t,n){if(Array.isArray(e))return e.map((e,t)=>Kp(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!kp(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var qp=class{constructor(e){Object.defineProperty(this,wp,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Ep(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=Kp(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Gp(i,{"":o},``,o):o}},Jp=class extends qp{constructor(e){super(vp),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Np(e,{Node:(e,t)=>{(Tp(t)||kp(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(Kp(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=Yp(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(Vp(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function Yp(e,t,n){if(Tp(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(Y(t)){let r=0;for(let i of t.items){let t=Yp(e,i,n);t>r&&(r=t)}return r}if(q(t)){let r=Yp(e,t.key,n),i=Yp(e,t.value,n);return Math.max(r,i)}return 1}var Xp=e=>!e||typeof e!=`function`&&typeof e!=`object`,Z=class extends qp{constructor(e){super(Sp),this.value=e}toJSON(e,t){return t?.keep?this.value:Kp(this.value,e,t)}toString(){return String(this.value)}};Z.BLOCK_FOLDED=`BLOCK_FOLDED`,Z.BLOCK_LITERAL=`BLOCK_LITERAL`,Z.PLAIN=`PLAIN`,Z.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Z.QUOTE_SINGLE=`QUOTE_SINGLE`;var Zp=`tag:yaml.org,2002:`;function Qp(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function $p(e,t,n){if(Ep(e)&&(e=e.contents),X(e))return e;if(q(e)){let t=n.schema[bp].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new Jp(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Zp+t.slice(2));let l=Qp(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new Z(e);return c&&(c.node=t),t}l=e instanceof Map?o[bp]:Symbol.iterator in Object(e)?o[Cp]:o[bp]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new Z(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function em(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return $p(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var tm=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,nm=class extends qp{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>X(t)||q(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(tm(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(Y(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,em(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(Y(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&J(i)?i.value:i:Y(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!q(t))return!1;let n=t.value;return n==null||e&&J(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return Y(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(Y(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,em(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},rm=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function im(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var am=(e,t,n)=>e.endsWith(`
|
|
131
|
+
`)?im(n,t):n.includes(`
|
|
132
|
+
`)?`
|
|
133
|
+
`+im(n,t):(e.endsWith(` `)?``:` `)+n,om=`flow`,sm=`block`,cm=`quoted`;function lm(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=um(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
134
|
+
`)n===`block`&&(h=um(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
135
|
+
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
136
|
+
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function um(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
137
|
+
`);r=t,i=t+1,a=e[i]}return r}var dm=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),fm=e=>/^(%|---|\.\.\.)/m.test(e);function pm(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
138
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function mm(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(fm(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){case`0000`:o+=`\\0`;break;case`0007`:o+=`\\a`;break;case`000b`:o+=`\\v`;break;case`001b`:o+=`\\e`;break;case`0085`:o+=`\\N`;break;case`00a0`:o+=`\\_`;break;case`2028`:o+=`\\L`;break;case`2029`:o+=`\\P`;break;default:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
139
|
+
|
|
140
|
+
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
141
|
+
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:lm(o,a,cm,dm(t,!1))}function hm(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
142
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return mm(e,t);let n=t.indent||(fm(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:lm(r,n,om,dm(t,!1))}function gm(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=mm;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?hm:i&&!t?mm:n?hm:mm}return r(e,t)}var _m;try{_m=RegExp(`(^|(?<!
|
|
143
|
+
))
|
|
144
|
+
+(?!
|
|
145
|
+
|$)`,`g`)}catch{_m=/\n+(?!\n|$)/g}function vm({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return gm(n,r);let l=r.indent||(r.forceBlockIndent||fm(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===Z.BLOCK_FOLDED?!1:t===Z.BLOCK_LITERAL||!pm(n,c,l.length);if(!n)return u?`|
|
|
146
|
+
`:`>
|
|
147
|
+
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
148
|
+
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
149
|
+
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
150
|
+
`&&(p=p.slice(0,-1)),p.replace(_m,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
151
|
+
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
152
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=dm(r,!0);o!==`folded`&&t!==Z.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=lm(`${v}${e}${p}`,l,sm,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function ym(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
153
|
+
`)||u&&/[[\]{},]/.test(a))return gm(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
154
|
+
`)?gm(a,t):vm(e,t,n,r);if(!s&&!u&&i!==Z.PLAIN&&a.includes(`
|
|
155
|
+
`))return vm(e,t,n,r);if(fm(a)){if(c===``)return t.forceBlockIndent=!0,vm(e,t,n,r);if(s&&c===l)return gm(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return gm(a,t)}return s?d:lm(d,c,om,dm(t,!1))}function bm(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==Z.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=Z.QUOTE_DOUBLE);let c=e=>{switch(e){case Z.BLOCK_FOLDED:case Z.BLOCK_LITERAL:return i||a?gm(o.value,t):vm(o,t,n,r);case Z.QUOTE_DOUBLE:return mm(o.value,t);case Z.QUOTE_SINGLE:return hm(o.value,t);case Z.PLAIN:return ym(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function xm(e,t){let n=Object.assign({blockQuote:!0,commentString:rm,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Sm(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(J(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Cm(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(J(e)||Y(e))&&e.anchor;a&&Vp(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function wm(e,t,n,r){if(q(e))return e.toString(t,n,r);if(Tp(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=X(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Sm(t.doc.schema.tags,a);let o=Cm(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):J(a)?bm(a,t,n,r):a.toString(t,n,r);return o?J(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function Tm({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=X(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(Y(e)||!X(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||Y(e)||(J(e)?e.type===Z.BLOCK_FOLDED||e.type===Z.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=wm(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=am(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=am(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=am(g,n.indent,l(f))));let _,v,y;X(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&J(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&Op(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let ee=!1,b=wm(t,n,()=>ee=!0,()=>h=!0),te=` `;if(f||_||v){if(te=_?`
|
|
156
|
+
`:``,v){let e=l(v);te+=`\n${im(e,n.indent)}`}b===``&&!n.inFlow?te===`
|
|
157
|
+
`&&y&&(te=`
|
|
158
|
+
|
|
159
|
+
`):te+=`\n${n.indent}`}else if(!p&&Y(t)){let e=b[0],r=b.indexOf(`
|
|
160
|
+
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=b.indexOf(` `);e===`&`&&n!==-1&&n<r&&b[n+1]===`!`&&(n=b.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(te=`\n${n.indent}`)}}else(b===``||b[0]===`
|
|
161
|
+
`)&&(te=``);return g+=te+b,n.inFlow?ee&&r&&r():y&&!ee?g+=am(g,n.indent,l(y)):h&&i&&i(),g}function Em(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Dm=`<<`,Om={identify:e=>e===Dm||typeof e==`symbol`&&e.description===Dm,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new Z(Symbol(Dm)),{addToJSMap:Am}),stringify:()=>Dm},km=(e,t)=>(Om.identify(t)||J(t)&&(!t.type||t.type===Z.PLAIN)&&Om.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===Om.tag&&e.default);function Am(e,t,n){let r=Mm(e,n);if(Op(r))for(let n of r.items)jm(e,t,n);else if(Array.isArray(r))for(let n of r)jm(e,t,n);else jm(e,t,r)}function jm(e,t,n){let r=Mm(e,n);if(!Dp(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Mm(e,t){return e&&Tp(t)?t.resolve(e.doc,e):t}function Nm(e,t,{key:n,value:r}){if(X(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(km(e,n))Am(e,t,r);else{let i=Kp(n,``,e);if(t instanceof Map)t.set(i,Kp(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Pm(n,i,e),o=Kp(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Pm(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(X(e)&&n?.doc){let t=xm(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Em(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Fm(e,t,n){return new Im($p(e,void 0,n),$p(t,void 0,n))}var Im=class e{constructor(e,t=null){Object.defineProperty(this,wp,{value:xp}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return X(n)&&(n=n.clone(t)),X(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Nm(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Tm(this,e,t,n):JSON.stringify(this)}};function Lm(e,t,n){return(t.inFlow??e.flow?zm:Rm)(e,t,n)}function Rm({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(X(i))!d&&i.spaceBefore&&f.push(``),Bm(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(q(i)){let e=X(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Bm(n,f,e.commentBefore,d))}d=!1;let s=wm(i,u,()=>o=null,()=>d=!0);o&&(s+=am(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
162
|
+
`}}return e?(p+=`
|
|
163
|
+
`+im(l(e),c),s&&s()):d&&o&&o(),p}function zm({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(X(i))i.spaceBefore&&d.push(``),Bm(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(q(i)){let e=X(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Bm(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=X(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=wm(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
164
|
+
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=am(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
165
|
+
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Bm({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=im(t(r),e);n.push(i.trimStart())}}function Vm(e,t){let n=J(t)?t.value:t;for(let r of e)if(q(r)&&(r.key===t||r.key===n||J(r.key)&&r.key.value===n))return r}var Hm=class extends nm{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(bp,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Fm(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=q(e)?e:!e||typeof e!=`object`||!(`key`in e)?new Im(e,e?.value):new Im(e.key,e.value);let r=Vm(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);J(r.value)&&Xp(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=Vm(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Vm(this.items,e)?.value;return(!t&&J(n)?n.value:n)??void 0}has(e){return!!Vm(this.items,e)}set(e,t){this.add(new Im(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Nm(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!q(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Lm(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},Um={collection:`map`,default:!0,nodeClass:Hm,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Dp(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Hm.from(e,t,n)},Wm=class extends nm{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Cp,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Gm(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Gm(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&J(r)?r.value:r}has(e){let t=Gm(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Gm(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];J(r)&&Xp(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(Kp(e,String(r++),t));return n}toString(e,t,n){return e?Lm(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push($p(a,void 0,n))}}return i}};function Gm(e){let t=J(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Km={collection:`seq`,default:!0,nodeClass:Wm,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return Op(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Wm.from(e,t,n)},qm={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),bm(e,t,n,r)}},Jm={identify:e=>e==null,createNode:()=>new Z(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Z(null),stringify:({source:e},t)=>typeof e==`string`&&Jm.test.test(e)?e:t.options.nullStr},Ym={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Z(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&Ym.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Xm({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var Zm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:Xm},Qm={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Xm(e)}},$m={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new Z(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:Xm},eh=e=>typeof e==`bigint`||Number.isInteger(e),th=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function nh(e,t,n){let{value:r}=e;return eh(r)&&r>=0?n+r.toString(t):Xm(e)}var rh={identify:e=>eh(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>th(e,2,8,n),stringify:e=>nh(e,8,`0o`)},ih={identify:eh,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>th(e,0,10,n),stringify:Xm},ah={identify:e=>eh(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>th(e,2,16,n),stringify:e=>nh(e,16,`0x`)},oh=[Um,Km,qm,Jm,Ym,rh,ih,ah,Zm,Qm,$m];function sh(e){return typeof e==`bigint`||Number.isInteger(e)}var ch=({value:e})=>JSON.stringify(e),lh=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:ch},{identify:e=>e==null,createNode:()=>new Z(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:ch},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:ch},{identify:sh,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>sh(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:ch}],uh=[Um,Km].concat(lh,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),dh={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=Z.BLOCK_LITERAL,t!==Z.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===Z.BLOCK_LITERAL?`
|
|
166
|
+
`:` `)}return bm({comment:e,type:t,value:s},r,i,a)}};function fh(e,t){if(Op(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!q(r)){if(Dp(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new Im(new Z(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=q(r)?r:new Im(r)}}else t(`Expected a sequence for this tag`);return e}function ph(e,t,n){let{replacer:r}=n,i=new Wm(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Fm(o,s,n))}return i}var mh={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:fh,createNode:ph},hh=class e extends Wm{constructor(){super(),this.add=Hm.prototype.add.bind(this),this.delete=Hm.prototype.delete.bind(this),this.get=Hm.prototype.get.bind(this),this.has=Hm.prototype.has.bind(this),this.set=Hm.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(q(e)?(r=Kp(e.key,``,t),i=Kp(e.value,r,t)):r=Kp(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=ph(e,t,n),i=new this;return i.items=r.items,i}};hh.tag=`tag:yaml.org,2002:omap`;var gh={collection:`seq`,identify:e=>e instanceof Map,nodeClass:hh,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=fh(e,t),r=[];for(let{key:e}of n.items)J(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new hh,n)},createNode:(e,t,n)=>hh.from(e,t,n)};function _h({value:e,source:t},n){return t&&(e?vh:yh).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var vh={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new Z(!0),stringify:_h},yh={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new Z(!1),stringify:_h},bh={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:Xm},xh={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():Xm(e)}},Sh={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new Z(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:Xm},Ch=e=>typeof e==`bigint`||Number.isInteger(e);function wh(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function Th(e,t,n){let{value:r}=e;if(Ch(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Xm(e)}var Eh={identify:Ch,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>wh(e,2,2,n),stringify:e=>Th(e,2,`0b`)},Dh={identify:Ch,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>wh(e,1,8,n),stringify:e=>Th(e,8,`0`)},Oh={identify:Ch,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>wh(e,0,10,n),stringify:Xm},kh={identify:Ch,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>wh(e,2,16,n),stringify:e=>Th(e,16,`0x`)},Ah=class e extends Hm{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=q(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new Im(e.key,null):new Im(e,null),Vm(this.items,t.key)||this.items.push(t)}get(e,t){let n=Vm(this.items,e);return!t&&q(n)?J(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=Vm(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Im(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Fm(e,null,n));return i}};Ah.tag=`tag:yaml.org,2002:set`;var jh={collection:`map`,identify:e=>e instanceof Set,nodeClass:Ah,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>Ah.from(e,t,n),resolve(e,t){if(Dp(e)){if(e.hasAllNullValues(!0))return Object.assign(new Ah,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Mh(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function Nh(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return Xm(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var Ph={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Mh(e,n),stringify:Nh},Fh={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Mh(e,!1),stringify:Nh},Ih={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(Ih.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=Mh(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},Lh=[Um,Km,qm,Jm,vh,yh,Eh,Dh,Oh,kh,bh,xh,Sh,dh,Om,gh,mh,jh,Ph,Fh,Ih],Rh=new Map([[`core`,oh],[`failsafe`,[Um,Km,qm]],[`json`,uh],[`yaml11`,Lh],[`yaml-1.1`,Lh]]),zh={binary:dh,bool:Ym,float:$m,floatExp:Qm,floatNaN:Zm,floatTime:Fh,int:ih,intHex:ah,intOct:rh,intTime:Ph,map:Um,merge:Om,null:Jm,omap:gh,pairs:mh,seq:Km,set:jh,timestamp:Ih},Bh={"tag:yaml.org,2002:binary":dh,"tag:yaml.org,2002:merge":Om,"tag:yaml.org,2002:omap":gh,"tag:yaml.org,2002:pairs":mh,"tag:yaml.org,2002:set":jh,"tag:yaml.org,2002:timestamp":Ih};function Vh(e,t,n){let r=Rh.get(t);if(r&&!e)return n&&!r.includes(Om)?r.concat(Om):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(Rh.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(Om)),i.reduce((e,t)=>{let n=typeof t==`string`?zh[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(zh).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var Hh=(e,t)=>e.key<t.key?-1:+(e.key>t.key),Uh=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?Vh(e,`compat`):e?Vh(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?Bh:{},this.tags=Vh(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,bp,{value:Um}),Object.defineProperty(this,Sp,{value:qm}),Object.defineProperty(this,Cp,{value:Km}),this.sortMapEntries=typeof a==`function`?a:a===!0?Hh:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function Wh(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=xm(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(im(t,``))}let o=!1,s=null;if(e.contents){if(X(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(im(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=wm(e.contents,i,()=>s=null,t);s&&(c+=am(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(wm(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
|
|
167
|
+
`)?(n.push(`...`),n.push(im(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(im(a(t),``)))}return n.join(`
|
|
168
|
+
`)+`
|
|
169
|
+
`}var Gh=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,wp,{value:yp});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new Bp({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[wp]:{value:yp}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=X(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){Kh(this.contents)&&this.contents.add(e)}addIn(e,t){Kh(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Hp(this);e.anchor=!t||n.has(t)?Up(t||`a`,n):t}return new Jp(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=Wp(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=$p(e,l,p);return o&&Y(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new Im(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return Kh(this.contents)?this.contents.delete(e):!1}deleteIn(e){return tm(e)?this.contents!=null&&(this.contents=null,!0):Kh(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return Y(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return tm(e)?!t&&J(this.contents)?this.contents.value:this.contents:Y(this.contents)?this.contents.getIn(e,t):void 0}has(e){return Y(this.contents)?this.contents.has(e):!1}hasIn(e){return tm(e)?this.contents!==void 0:Y(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=em(this.schema,[e],t):Kh(this.contents)&&this.contents.set(e,t)}setIn(e,t){tm(e)?this.contents=t:this.contents==null?this.contents=em(this.schema,Array.from(e),t):Kh(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new Bp({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new Bp({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Uh(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=Kp(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?Gp(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return Wh(this,e)}};function Kh(e){if(Y(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var qh=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},Jh=class extends qh{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Yh=class extends qh{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},Xh=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
|
|
170
|
+
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function Zh(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,ee=null,b=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!ee||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,b??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,b??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),ee&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),ee=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let te=e[e.length-1],ne=te?te.offset+te.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:ee,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:ne,start:b??ne}}function Qh(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
|
|
171
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(Qh(t.key)||Qh(t.value))return!0}return!1;default:return!0}}function $h(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&Qh(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function eg(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||J(e)&&J(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var tg=`All mapping items must start at the same column`;function ng({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Hm)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=Zh(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,tg)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
|
172
|
+
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||Qh(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,tg);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&$h(r.indent,u,i),n.atKey=!1,eg(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=Zh(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&$h(r.indent,f,i),s=c.range[2];let l=new Im(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
|
|
173
|
+
`+_.comment:g.comment=_.comment);let e=new Im(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function rg({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Wm)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=Zh(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&$h(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function ig(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var ag=`Block collections are not allowed within flow collections`,og=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function sg({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?Hm:Wm))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=Zh(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
|
|
174
|
+
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&Qh(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];q(t)&&(t=t.value??t.key),t.comment?t.comment+=`
|
|
175
|
+
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],og(m)&&i(r.range,`BLOCK_IN_FLOW`,ag)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);og(f)&&i(g.range,`BLOCK_IN_FLOW`,ag),n.atKey=!1;let _=Zh(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?og(m)&&i(v.range,`BLOCK_IN_FLOW`,ag):_.comment&&(g.comment?g.comment+=`
|
|
176
|
+
`+_.comment:g.comment=_.comment);let y=new Im(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;eg(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new Hm(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=ig(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
|
|
177
|
+
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function cg(e,t,n,r,i,a){let o=n.type===`block-map`?ng(e,t,n,r,a):n.type===`block-seq`?rg(e,t,n,r,a):sg(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function lg(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===Hm.tagName&&s===`map`||o===Wm.tagName&&s===`seq`)return cg(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),cg(e,t,n,i,o)}let l=cg(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=X(u)?u:new Z(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function ug(e,t,n){let r=t.offset,i=dg(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?Z.BLOCK_FOLDED:Z.BLOCK_LITERAL,o=t.source?fg(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
|
|
178
|
+
`.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
|
|
179
|
+
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===Z.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
|
|
180
|
+
`):t.length>c||r[0]===` `?(f===` `?f=`
|
|
181
|
+
`:!p&&f===`
|
|
182
|
+
`&&(f=`
|
|
183
|
+
|
|
184
|
+
`),d+=f+t.slice(c)+r,f=`
|
|
185
|
+
`,p=!0):r===``?f===`
|
|
186
|
+
`?d+=`
|
|
187
|
+
`:f=`
|
|
188
|
+
`:(d+=f+r,f=` `,p=!1)}switch(i.chomp){case`-`:break;case`+`:for(let e=s;e<o.length;++e)d+=`
|
|
189
|
+
`+o[e][0].slice(c);d[d.length-1]!==`
|
|
190
|
+
`&&(d+=`
|
|
191
|
+
`);break;default:d+=`
|
|
192
|
+
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function dg({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function fg(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function pg(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=Z.PLAIN,c=mg(a,l);break;case`single-quoted-scalar`:s=Z.QUOTE_SINGLE,c=hg(a,l);break;case`double-quoted-scalar`:s=Z.QUOTE_DOUBLE,c=_g(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=ig(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function mg(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),gg(e)}function hg(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),gg(e.slice(1,-1)).replace(/''/g,`'`)}function gg(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
|
|
193
|
+
`?a+=o:o=`
|
|
194
|
+
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function _g(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
|
|
195
|
+
`){if(i===`
|
|
196
|
+
`){let{fold:t,offset:i}=vg(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=yg[i];if(a)n+=a;else if(i===`
|
|
197
|
+
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
|
|
198
|
+
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=bg(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
|
|
199
|
+
`&&(a!==`\r`||e[r+2]!==`
|
|
200
|
+
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function vg(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
|
|
201
|
+
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
|
|
202
|
+
`);)r===`
|
|
203
|
+
`&&(n+=`
|
|
204
|
+
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var yg={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
|
205
|
+
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function bg(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function xg(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?ug(e,t,r):pg(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[Sp]:c?Sg(e.schema,i,c,n,r):t.type===`scalar`?Cg(e,i,t,r):e.schema[Sp];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=J(a)?a:new Z(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new Z(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Sg(e,t,n,r,i){if(n===`!`)return e[Sp];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[Sp])}function Cg({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[Sp];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Sp];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function wg(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var Tg={composeNode:Eg,composeEmptyNode:Dg};function Eg(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Og(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=xg(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=lg(Tg,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Dg(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!J(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Dg(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=xg(e,{type:`scalar`,offset:wg(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Og({options:e},{offset:t,source:n,end:r},i){let a=new Jp(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=ig(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function kg(e,t,{offset:n,start:r,value:i,end:a},o){let s=new Gh(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=Zh(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Eg(c,i,l,o):Dg(c,l.end,r,null,l,o);let u=s.contents.range[2],d=ig(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Ag(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function jg(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
|
|
206
|
+
|
|
207
|
+
`:`
|
|
208
|
+
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Mg=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Ag(e);r?this.warnings.push(new Yh(i,t,n)):this.errors.push(new Jh(i,t,n))},this.directives=new Bp({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=jg(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(Y(i)&&!i.flow&&i.items.length>0){let e=i.items[0];q(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:jg(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Ag(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=kg(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new Jh(Ag(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new Jh(Ag(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=ig(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Jh(Ag(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new Gh(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},Ng=Symbol(`break visit`),Pg=Symbol(`skip children`),Fg=Symbol(`remove item`);function Ig(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Lg(Object.freeze([]),e,t)}Ig.BREAK=Ng,Ig.SKIP=Pg,Ig.REMOVE=Fg,Ig.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Ig.parentCollection=(e,t)=>{let n=Ig.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Lg(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Lg(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Ng)return Ng;else r===Fg&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function Rg(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
|
|
209
|
+
`:case`\r
|
|
210
|
+
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function zg(e){switch(e){case void 0:case` `:case`
|
|
211
|
+
`:case`\r`:case` `:return!0;default:return!1}}var Bg=new Set(`0123456789ABCDEFabcdef`),Vg=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),Hg=new Set(`,[]{}`),Ug=new Set(` ,[]{}
|
|
212
|
+
\r `),Wg=e=>!e||Ug.has(e),Gg=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
|
|
213
|
+
`||t===`\r`&&this.buffer[e+1]===`
|
|
214
|
+
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
|
|
215
|
+
`||!t&&!this.atEnd)return e+n+1}return t===`
|
|
216
|
+
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&zg(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
217
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,this.buffer.substring(this.pos,e))}hasChars(e){return this.pos+e<=this.buffer.length}setNext(e){return this.buffer=this.buffer.substring(this.pos),this.pos=0,this.lineEndPos=null,this.next=e,null}peek(e){return this.buffer.substr(this.pos,e)}*parseNext(e){switch(e){case`stream`:return yield*this.parseStream();case`line-start`:return yield*this.parseLineStart();case`block-start`:return yield*this.parseBlockStart();case`doc`:return yield*this.parseDocument();case`flow`:return yield*this.parseFlowCollection();case`quoted-scalar`:return yield*this.parseQuotedScalar();case`block-scalar`:return yield*this.parseBlockScalar();case`plain-scalar`:return yield*this.parsePlainScalar()}}*parseStream(){let e=this.getLine();if(e===null)return this.setNext(`stream`);if(e[0]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&zg(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!zg(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&zg(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(Wg),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&zg(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(Wg),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||zg(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
|
|
218
|
+
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
|
|
219
|
+
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>zg(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
|
|
220
|
+
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
|
|
221
|
+
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
|
|
222
|
+
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
|
|
223
|
+
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
|
|
224
|
+
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(zg(r)||e&&Hg.has(r))break;t=n}else if(zg(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
|
|
225
|
+
`?(n+=1,r=`
|
|
226
|
+
`,i=this.buffer[n+1]):t=n),i===`#`||e&&Hg.has(i))break;if(r===`
|
|
227
|
+
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&Hg.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(Wg),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(zg(n)||t&&Hg.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!zg(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Vg.has(t))t=this.buffer[++e];else if(t===`%`&&Bg.has(this.buffer[e+1])&&Bg.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
228
|
+
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
|
|
229
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},Kg=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function qg(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Jg(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function Yg(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function Xg(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function Zg(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function Qg(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function $g(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!qg(t.start,`explicit-key-ind`)&&!qg(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,Yg(t.value)?t.value.end?Qg(t.value.end,t.sep):t.value.end=t.sep:Qg(t.start,t.sep),delete t.sep)}var e_=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new Gg,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Rg(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else if(t===`scalar`)this.atNewLine=!1,this.atScalar=!0,this.type=`scalar`;else{switch(this.type=t,yield*this.step(),t){case`newline`:this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case`space`:this.atNewLine&&e[0]===` `&&(this.indent+=e.length);break;case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:this.atNewLine&&(this.indent+=e.length);break;case`doc-mode`:case`flow-error-end`:return;default:this.atNewLine=!1}this.offset+=e.length}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&$g(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Jg(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:Jg(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=Zg(Xg(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
|
|
230
|
+
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
231
|
+
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Qg(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(qg(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Zg(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(qg(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if(Yg(t.key)&&!qg(t.sep,`newline`)){let e=Zg(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):qg(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!qg(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Qg(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||qg(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=Zg(Xg(t));$g(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
232
|
+
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
233
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=Zg(Xg(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=Zg(Xg(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.type===`space`)}*documentEnd(e){this.type!==`doc-mode`&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case`comma`:case`doc-start`:case`doc-end`:case`flow-seq-end`:case`flow-map-end`:case`map-value-ind`:yield*this.pop(),yield*this.step();break;case`newline`:this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type===`newline`&&(yield*this.pop())}}};function t_(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Kg||null,prettyErrors:t}}function n_(e,t={}){let{lineCounter:n,prettyErrors:r}=t_(t),i=new e_(n?.addNewLine),a=new Mg(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new Jh(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(Xh(e,n)),o.warnings.forEach(Xh(e,n))),o}function r_(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=n_(e,n);if(!i)return null;if(i.warnings.forEach(e=>Em(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}var i_=/^---\r?\n(?:([\s\S]*?)\r?\n)?---[ \t]*(?:\r?\n|$)/;function a_(e,t){let n=i_.exec(e);if(!n)throw Error(`must start with front matter: a line "---", the fields, then another "---".`);let r;try{r=r_(n[1]??``)??{}}catch(e){throw Error(`has front matter that isn't valid YAML (${e.message.split(`
|
|
234
|
+
`)[0]}).`)}if(typeof r!=`object`||!r||Array.isArray(r))throw Error("must have front matter that lists fields, such as `title: My page`.");let{version:i,showFrom:a,hideAfter:o,inLanguage:s,translationOf:c,translatedFrom:l,...u}=r,d=e.slice(n[0].length).replace(/^\r?\n/,``).trimEnd();return{version:i,...a!==void 0&&{showFrom:a},...o!==void 0&&{hideAfter:o},...s!==void 0&&{inLanguage:s},...c!==void 0&&{translationOf:c},...l!==void 0&&{translatedFrom:l},fields:{...u,[t]:d}}}function o_(e){return e===`/`||/^(\/[a-z0-9]+(?:-[a-z0-9]+)*)+$/.test(e)}var s_=M({pages:j(k().refine(o_,`must be a page's address, such as /news`)).optional(),collections:j(k().min(1)).optional(),media:Js().optional(),layout:Js().optional(),menus:Js().optional(),languages:j(k().min(1)).optional()}),c_=M({version:N(1),people:lc(k().min(1),s_).default({}),reviewers:j(k().min(1)).optional()});function l_(e,t){return e.toLowerCase()===t.toLowerCase()}function u_(e,t){if(e&&t)return Object.entries(e.people).find(([e])=>l_(e,t))?.[1]}function d_(e,t){return(e??[]).some(e=>e===`/`||t===e||t.startsWith(`${e}/`))}function f_(e,t){return!e.languages||e.languages.includes(t)}function p_(e,t,n){if(!t)return!0;if(!f_(t,z_(e.settings,n.path)))return!1;let r=n.content?.translationOf;return d_(t.pages,n.path)||r!==void 0&&d_(t.pages,r)}function m_(e,t){return!e||(e.collections??[]).includes(t)}function h_(e,t,n){return!t||m_(t,n.collection)&&f_(t,B_(e.settings,n))}function g_(e){return!e||e.media===!0}function __(e,t,n){return!t||t.layout===!0&&f_(t,n??F_(e.settings))}function v_(e,t,n){return!t||t.menus===!0&&f_(t,n??F_(e.settings))}function y_(e){return`content`in e?e.content:void 0}function b_(e){if(e!==void 0)try{let t=JSON.parse(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:void 0}catch{return}}function x_(e,t){if(t===`content/layout/header.json`||t===`content/layout/footer.json`)return F_(e.settings);let n=/^content\/layout\/(?:header|footer)\.([a-z]{2,3}(?:-[A-Za-z0-9]+)*)\.json$/.exec(t);if(n)return n[1];let r=/^content\/synced-blocks\/[a-z0-9-]+(?:\.([a-z]{2,3}(?:-[A-Za-z0-9]+)*))?\.json$/.exec(t);return r?r[1]??F_(e.settings):void 0}function S_(e,t){let n=rd.safeParse(b_(t));if(!n.success)return;let r=n.data,i=(e,t)=>Dd(e??{})===Dd(t??{}),a=[];i(r.menus,e.menus)||a.push(F_(e.settings));let o=r.languages??{},s=e.languageMenus??{};for(let e of new Set([...Object.keys(o),...Object.keys(s)]))i(o[e],s[e])||a.push(e);return a}function C_(e){if(!e.startsWith(`content/collections/`))return;let[t,n,...r]=e.slice(f.length+1).split(`/`);if(!t||!n||r.length>0||n===`_collection.json`)return;let i=/^(.+)\.(?:json|md)$/.exec(n)?.[1];return i?{collection:t,slug:i}:void 0}function w_(e,t,n){let r=y_(n);if(!e||r===void 0)return;let i=P_(e.settings,t,r);return i.ok?{content:i.value}:void 0}function T_(e,t,n){if(!t)return[];let r=[];for(let i of n){let{path:n}=i;if(n.startsWith(`content/pages/`)&&n.endsWith(`.json`)){let a;try{a=s(n)}catch{r.push({path:n,kind:`other`});continue}let o=e.pages.find(e=>e.file===n),c=b_(y_(i));(!o||p_(e,t,o))&&(`delete`in i||p_(e,t,{path:a,content:{translationOf:typeof c?.translationOf==`string`?c.translationOf:void 0}}))||r.push({path:n,kind:`page`,address:a});continue}let a=C_(n);if(a){let o=e.collections.find(e=>e.id===a.collection),s=o?.entries.find(e=>e.file===n),c=w_(o,n,i);(!m_(t,a.collection)||s&&!h_(e,t,s)||c&&!h_(e,t,{collection:a.collection,content:c.content}))&&r.push({path:n,kind:`entry`,...a});continue}if(n.startsWith(`public/media/`)||n===`content/media.json`||n===`content/media-storage.json`){g_(t)||r.push({path:n,kind:`media`});continue}let o=x_(e,n);if(o!==void 0){__(e,t,o)||r.push({path:n,kind:`layout`});continue}if(n===`content/menus.json`){(`delete`in i?void 0:S_(e,y_(i)))?.every(n=>v_(e,t,n))!==!0&&r.push({path:n,kind:`menus`});continue}r.push({path:n,kind:`other`})}return r}async function E_(e){let t=await e.read(o);if(t===void 0)return;let n=j_(`permissions`,c_,o,t);if(!n.ok)return;let{people:r,reviewers:i}=n.value;return{people:r,...i&&{reviewers:i}}}async function D_(e,t){let n=new Map;for(let{path:e}of t){let t=C_(e);t&&n.set(t.collection,(n.get(t.collection)??new Set).add(e))}let r=[...n.keys()].map(e=>`${f}/${e}/${m}`),i=t.map(e=>e.path).filter(e=>e.startsWith(`content/pages/`)&&e.endsWith(`.json`)),o=await k_(e,[p,...t.some(e=>e.path===`content/menus.json`)?[a]:[],...i,...r,...[...n.values()].flatMap(e=>[...e])]),c=e=>e.ok?e.value:void 0,l=o.get(p),u=l!==void 0&&c(j_(`site`,ed,`content/site.json`,l))||ed.parse({version:1}),d=i.flatMap(e=>{let t=o.get(e),n=t===void 0?void 0:c(j_(`page`,ud,e,t));return n?[{path:s(e),file:e,content:n}]:[]}),h=[...n].flatMap(([e,t])=>{let n=`${f}/${e}/${m}`,r=o.get(n),i=r===void 0?void 0:c(j_(`collection`,vd,n,r));return i?[{id:e,file:n,settings:i,entries:[...t].flatMap(t=>{let n=o.get(t),r=n===void 0?void 0:c(P_(i,t,n)),a=C_(t)?.slug;return r&&a?[{collection:e,slug:a,file:t,content:r}]:[]})}]:[]}),g=o.get(a),_=g===void 0?void 0:c(j_(`menus`,rd,a,g));return{settings:u,pages:d,collections:h,menus:_?.menus??{},..._?.languages&&{languageMenus:_.languages}}}function O_(e,t,{start:n=!0,end:r=!0}={}){let i=0,a=e.length;for(;n&&i<a&&t.includes(e.charAt(i));)i++;for(;r&&a>i&&t.includes(e.charAt(a-1));)a--;return e.slice(i,a)}async function k_(e,t){if(e.readFiles)return e.readFiles(t);let n=await Promise.all(t.map(async t=>[t,await e.read(t)]));return new Map(n.filter(e=>e[1]!==void 0))}function A_(e){return e.issues.map(e=>e.path.length?`${e.path.join(`.`)} ${e.message}`:e.message).join(`; `)}function j_(e,t,n,r){let i;try{i=JSON.parse(r)}catch(e){return{ok:!1,problem:{file:n,message:`isn't valid JSON (${e.message}).`}}}return typeof i!=`object`||!i||Array.isArray(i)?{ok:!1,problem:{file:n,message:`must contain a JSON object.`}}:M_(e,t,n,i)}function M_(e,t,n,r){let i;try{i=te(e,r)}catch(e){return{ok:!1,problem:{file:n,message:e.message}}}let a=t.safeParse(i);return a.success?{ok:!0,value:a.data}:{ok:!1,problem:{file:n,message:A_(a.error)}}}function N_(e,t,n){let r;try{r=a_(t,n)}catch(t){return{ok:!1,problem:{file:e,message:t.message}}}return M_(`entry`,yd,e,r)}function P_(e,t,n){let r=e.markdown?N_(t,n,e.markdown.body):j_(`entry`,yd,t,n);if(!r.ok)return r;let i=Sd(e.fields,r.value.fields);return i.length>0?{ok:!1,problem:{file:t,message:i.map(e=>`fields.${e}`).join(`; `)}}:r}function F_(e){return e.mainLanguage??e.language}function I_(e){try{let t=new Intl.DisplayNames([e],{type:`language`}).of(e);if(t&&t!==e)return t.charAt(0).toLocaleUpperCase(e)+t.slice(1)}catch{}return e}function L_(e){return`/${e.toLowerCase()}`}function R_(e){let t=F_(e);return[{code:t,name:e.languageName||I_(t),prefix:``,main:!0},...(e.languages??[]).filter(e=>e.code.toLowerCase()!==t.toLowerCase()).map(e=>({code:e.code,name:e.name||I_(e.code),prefix:L_(e.code),main:!1}))]}function z_(e,t){for(let n of R_(e))if(!n.main&&(t===n.prefix||t.startsWith(`${n.prefix}/`)))return n.code;return F_(e)}function B_(e,t){return t.content.inLanguage??F_(e)}var V_=`goodfellow:broker-connect`;function H_(e){return e.startsWith(`.github/`)||e===`.gitlab-ci.yml`||e.startsWith(`.gitlab/`)||e===`bitbucket-pipelines.yml`}function U_(e,t){let n={refused:[],confirm:[]};for(let r of e){let{path:e}=r;if(H_(e)||e.startsWith(`/`)||e.split(`/`).includes(`..`))n.refused.push(e);else if(e.startsWith(`content/code/`))n.confirm.push({path:e,kind:`custom-code`});else if(!l(e))n.confirm.push({path:e,kind:`code`});else if(e===`content/site.json`){let i=`content`in r?r.content:`bytes`in r?new TextDecoder(`utf-8`,{fatal:!1}).decode(r.bytes):void 0,a;try{a=i===void 0?void 0:JSON.parse(i).url}catch{a=void 0}(a??void 0)!==(t??void 0)&&n.confirm.push({path:e,kind:`site-address`})}}return n}var W_=class extends Error{problem;name=`BrokerRefusedError`;constructor(e,t){super(t),this.problem=e}},G_=[`revision`,`read`,`readBytes`,`list`,`readFiles`,`fileSizes`,`write`,`changedPaths`],K_={methods:[`read`,`readBytes`,`list`]},q_={name:`draft`,data:[`name`],methods:[`changes`,`paths`,`publish`,`submitForReview`,`discard`],objects:{store:{methods:G_}}},J_={data:[`user`,`contentOnly`],methods:[...G_,`deployStatus`,`history`,`readAt`,`repositoryVisibility`,`signOut`],sync:{filesAt:K_},objects:{pages:{data:[`severalDomains`],methods:[`site`,`connect`,`records`,`status`,`secure`,`disconnect`]},editors:{data:[`invitesByEmail`,`membersOnly`],methods:[`list`,`invite`,`setRole`,`remove`,`letEditorsPublish`]},ownerAccess:{data:[`tokenLink`,`active`,`problem`],methods:[`forget`,`startRedirect`,`requestToken`]},updates:{methods:[`setup`,`enable`,`lastRun`,`start`,`rebuild`],objects:{code:{data:[`repo`,`webUrl`],methods:[`read`,`history`,`readAt`]},nightly:{methods:[`supported`,`get`,`set`]}}},drafts:{methods:[`create`,`open`,`list`,`reviews`],returns:{create:q_,open:q_}},scheduledBuilds:{methods:[`timing`,`sync`]},tasks:{methods:[`supported`,`secretsPlace`,`run`]},comments:{methods:[`create`,`find`,`threads`,`hide`,`show`,`remove`,`lock`,`unlock`],objects:{access:{data:[`tokenLink`,`active`],methods:[`forget`,`requestToken`]}}}}};function Y_(e){if(!(e instanceof Error))return{name:`Error`,message:String(e),fields:{}};let t={};for(let[n,r]of Object.entries(e))[`string`,`number`,`boolean`].includes(typeof r)&&(t[n]=r);return{name:e.name,message:e.message,fields:t}}function X_(e){return e instanceof Error?{__error:Y_(e)}:e}function Z_(e,t,n={}){let r=new Map([[0,{target:t,shape:J_,prefix:``}]]),i=1;function a(e,t,r,i){let o=e,s={};for(let e of t.data??[])o[e]!==void 0&&(s[e]=X_(o[e]));let c=(t.methods??[]).filter(e=>typeof o[e]==`function`||n.extra?.[`${r}${e}`]!==void 0);for(let e of Object.keys(t.sync??{}))typeof o[e]==`function`&&c.push(e);let l={};for(let[e,n]of Object.entries(t.objects??{})){let t=o[e];typeof t==`object`&&t&&(l[e]=a(t,n,`${r}${e}.`,i))}return{handle:i,data:s,methods:c,objects:l}}let o=()=>a(t,J_,``,0);function s(e,t){let n=r.get(e);if(!n)return;let i=n.target,a=n.shape,o=n.prefix;for(let e of t.slice(0,-1))if(a=a?.objects?.[e],i=i?.[e],o+=`${e}.`,!a||typeof i!=`object`||!i)return;let s=t.at(-1)??``;if((a?.methods?.includes(s)||Object.hasOwn(a?.sync??{},s))&&a)return{target:i,shape:a,method:s,name:`${o}${s}`}}async function c(e){let t=s(e.handle,e.path);if(!t)throw new W_(`not-here`,`The broker doesn't offer that.`);let{target:o,shape:c,method:l,name:u}=t,d=Array.isArray(e.args)?e.args:[],f=n.extra?.[u];if(c.sync?.[l]){let t=c.sync[l],[r,i]=e.then??[``,[]];if(!t.methods?.includes(r))throw new W_(`not-here`,`The broker doesn't offer that.`);await n.check?.({path:`${u}.${r}`,args:[...d,...i],target:o});let a=o[l].apply(o,d);return a[r].apply(a,i)}await n.check?.({path:u,args:d,target:o});let p=f?await f(...d):await o[l].apply(o,d),m=c.returns?.[l];if(m&&typeof p==`object`&&p){let e=i++,t=`${m.name??u}.`;return r.set(e,{target:p,shape:m,prefix:t}),{__object:a(p,m,t,e)}}return p}return e.onmessage=async t=>{let n=t.data;if(n?.type===`call`&&Array.isArray(n.path))try{let t=await c(n);e.postMessage({type:`answer`,id:n.id,ok:!0,value:t,state:o()})}catch(t){e.postMessage({type:`answer`,id:n.id,ok:!1,error:Y_(t),state:o()})}},e.postMessage({type:`state`,state:o()}),()=>{e.onmessage=null,r.clear()}}var Q_=M({repository:k().min(1),workflow:k().min(1)}),$_=Q_.extend({from:k().min(1)}),ev=k().regex(/^(?!.*\.\.)[A-Za-z0-9_-][A-Za-z0-9_./-]*$/,`must be a file in the theme's package, such as theme.css`);M({version:N(1),title:k().trim().min(1).max(80),description:k().max(500).optional(),theme:Hu.refine(e=>e.fonts.custom===void 0,{message:`a theme's fonts must be Google Fonts`,path:[`fonts`,`custom`]}).default({colors:{},fonts:{}}),css:ev.optional(),header:ev.optional(),footer:ev.optional(),image:ev.optional()});var tv=k().regex(/^[0-9a-f]{64}$/),nv=M({version:N(1),name:k(),release:k(),title:k(),goodfellow:k().optional(),theme:Hu.default({colors:{},fonts:{}}),css:tv.optional(),header:tv.optional(),footer:tv.optional(),provenance:Q_.optional(),early:$_.optional()}),rv=M(Object.fromEntries([`connect`,`files`,`secrets`,`read`,`write`].map(e=>[e,j(k()).optional()]))).strict(),iv=M({version:N(1),title:k().trim().min(1),description:k().optional(),permissions:rv.default({}),blocks:j(k()).optional(),admin:Js().optional(),screens:j(M({id:k(),title:k()}).strict()).optional(),build:j(M({id:k(),title:k().optional()}).strict()).optional(),tasks:j(M({id:k(),title:k().optional()}).strict()).optional(),server:Js().optional(),mediaStorage:Js().optional(),editor:M({title:k().trim().min(1),kinds:j(fc([`page`,`header`,`footer`,`template`])).optional()}).strict().optional()}).strict(),av=M({release:k(),installed:k(),goodfellow:k().optional(),manifest:iv,provenance:Q_.optional(),early:$_.optional()}),ov=M({version:N(1),plugins:lc(k(),av)}),sv={version:1,plugins:{}};function cv(e){return e===void 0?sv:ov.parse(JSON.parse(e))}var lv={anthropic:{name:`Claude`,keyUrl:`https://platform.claude.com/settings/keys`,needsKey:!0,models:[`claude-opus-5-5`,`claude-sonnet-5-5`,`claude-haiku-4-5`]},openai:{name:`OpenAI`,keyUrl:`https://platform.openai.com/api-keys`,needsKey:!0,baseUrl:`https://api.openai.com/v1`,structured:`json_schema`},gemini:{name:`Google Gemini`,keyUrl:`https://aistudio.google.com/apikey`,needsKey:!0,baseUrl:`https://generativelanguage.googleapis.com/v1beta/openai`,structured:`json_schema`},groq:{name:`Groq`,keyUrl:`https://console.groq.com/keys`,needsKey:!0,baseUrl:`https://api.groq.com/openai/v1`,structured:`json_object`},mistral:{name:`Mistral`,keyUrl:`https://console.mistral.ai/api-keys`,needsKey:!0,baseUrl:`https://api.mistral.ai/v1`,structured:`json_schema`},openrouter:{name:`OpenRouter`,keyUrl:`https://openrouter.ai/settings/keys`,needsKey:!0,baseUrl:`https://openrouter.ai/api/v1`,structured:`json_schema`},ovhcloud:{name:`OVHcloud AI Endpoints`,needsKey:!1,baseUrl:`https://oai.endpoints.kepler.ai.cloud.ovh.net/v1`,structured:`json_object`,models:[`gpt-oss-120b`]},custom:{name:`OpenAI-compatible`,needsKey:!1,structured:`json_object`},manual:{name:`Chat app`,needsKey:!1}};function uv(e,t){let n=t?e.split(t).join(`[key]`):e;return n=n.replace(/\b(sk|gsk|AIza)[-_A-Za-z0-9]{12,}/g,`[key]`),n}var dv=`https://api.anthropic.com`,fv=10485760,pv=[`content-type`,`accept`,`anthropic-version`,`anthropic-beta`];function mv(e,t,n){return e===`anthropic`?t===`POST`&&n===`v1/messages`:t===`POST`&&n===`chat/completions`||t===`GET`&&n===`models`}function hv(e,t){return Response.json({error:{message:t}},{status:e,headers:{"cache-control":`no-store`}})}function gv(e,t={}){let n=t.fetch??((e,t)=>fetch(e,t)),r=Object.entries(e).flatMap(([e,t])=>t&&(typeof t==`string`||t.baseUrl)?[[e,t]]:[]),i=new Map(r);async function a(e,t,r){let a=t,o=i.get(a);if(!o)return hv(404,`This site has no key for that service.`);if(!mv(a,e.method,r))return hv(404,`The AI assistant doesn't use that.`);let s=typeof o==`string`?o:o.key,c=a===`anthropic`?dv:typeof o==`object`?o.baseUrl:lv[a].baseUrl??``;if(!c)return hv(404,`This site has no address for that service.`);let l=e.method===`GET`?void 0:await e.arrayBuffer();if(l&&l.byteLength>fv)return hv(413,`That request is too large.`);let u=new Headers;for(let t of pv){let n=e.headers.get(t);n&&u.set(t,n)}s&&(a===`anthropic`?u.set(`x-api-key`,s):u.set(`authorization`,`Bearer ${s}`));let d=`${O_(c,`/`,{start:!1})}/${r}${new URL(e.url).search}`,f;try{f=await n(d,{method:e.method,headers:u,body:l,signal:e.signal})}catch(e){if(e.name===`AbortError`)throw e;return hv(502,`The AI service couldn't be reached.`)}if(!f.ok){let e=uv(await f.text().catch(()=>``),s);return new Response(e,{status:f.status,headers:{"content-type":f.headers.get(`content-type`)??`text/plain`,"cache-control":`no-store`}})}return new Response(f.body,{status:f.status,headers:{"content-type":f.headers.get(`content-type`)??`application/json`,"cache-control":`no-store`}})}return{services:[...i.keys()],forward:a}}var _v=new Set([`write`,`draft.store.write`]),vv=[`revision`,`read`,`readBytes`,`list`,`readFiles`,`fileSizes`,`changedPaths`],yv=new Set([...vv,`deployStatus`,`history`,`readAt`,`repositoryVisibility`,`signOut`,`filesAt.read`,`filesAt.readBytes`,`filesAt.list`,`pages.site`,`pages.records`,`pages.status`,`editors.list`,`ownerAccess.forget`,`ownerAccess.startRedirect`,`ownerAccess.requestToken`,`updates.lastRun`,`updates.rebuild`,`updates.code.read`,`updates.code.history`,`updates.code.readAt`,`updates.nightly.supported`,`updates.nightly.get`,`updates.nightly.set`,`drafts.create`,`drafts.open`,`drafts.list`,`drafts.reviews`,`draft.changes`,`draft.paths`,`draft.submitForReview`,...vv.map(e=>`draft.store.${e}`),`scheduledBuilds.timing`,`scheduledBuilds.sync`,`tasks.supported`,`tasks.secretsPlace`,`comments.find`,`comments.threads`,`comments.hide`,`comments.show`,`comments.lock`,`comments.unlock`,`comments.access.forget`,`comments.access.requestToken`]),bv={"pages.connect":`connect`,"pages.secure":`secure`,"pages.disconnect":`disconnect`};async function xv(e,t){let n=e.find(e=>e.path===u);if(n&&`content`in n)try{let e=cv(n.content).plugins,r=cv(await t?.(u)).plugins,i=Object.entries(e).filter(([e,t])=>JSON.stringify(r[e])!==JSON.stringify(t)).map(([e,t])=>({name:e,...t})),a=Object.keys(r).filter(t=>!e[t]);return i.length+a.length>0?{kind:`plugins`,installed:i,removed:a}:void 0}catch{return}}function Sv(e){let t=e.find(e=>e.path===d);if(t&&`content`in t)try{let e=nv.safeParse(JSON.parse(t.content)),n=e.success?e.data.early:void 0;return e.success&&n?{kind:`theme-early`,name:e.data.name,release:e.data.release,...n}:void 0}catch{return}}async function Cv(e,t,n){let r=U_(e,t);if(r.refused.length>0)return{action:`refuse`,paths:r.refused,reason:`workflow`};let i=new Map;for(let{path:e,kind:t}of r.confirm)i.set(t,[...i.get(t)??[],e]);let a=await xv(e,n),o=Sv(e),s=[...a?[a]:[],...o?[o]:[],...[...i].map(([e,t])=>({kind:e,paths:t}))];return s.length>0?{action:`ask`,questions:s}:{action:`allow`}}async function wv(e,t){if(!e)return;let n=u_(await E_(e),e.user.login);if(!n)return;let r=T_(await D_(e,t),n,t);return r.length>0?{action:`refuse`,paths:r.map(e=>e.path),reason:`limits`}:void 0}function Tv(e){let t=e?.read;return typeof t==`function`?n=>t.call(e,n):void 0}function Ev(e){if(typeof e==`string`)return e;let{login:t,email:n}=e??{};return typeof t==`string`?t:typeof n==`string`?n:``}function Dv(e){return typeof e==`string`?e:``}async function Ov(e,t,n){let{path:r,args:i,target:a}=e;if(_v.has(r)){let e=i[0]??[];if(r===`write`){let t=await wv(n,e);if(t)return t}return Cv(e,t,Tv(a))}if(r===`draft.publish`){let e=await a.changes();return await wv(n,e)??Cv(e,t)}if(r===`updates.start`)return{action:`ask`,questions:[{kind:`update`,release:String(i[0])}]};if(r===`editors.invite`||r===`editors.setRole`)return{action:`ask`,questions:[{kind:`editors`,who:Ev(i[0]),role:String(i[1])}]};if(r===`editors.letEditorsPublish`)return{action:`ask`,questions:[{kind:`editors`,who:``}]};if(r===`editors.remove`)return{action:`ask`,questions:[{kind:`editors-remove`,who:Ev(i[0])}]};let o=bv[r];if(o)return{action:`ask`,questions:[{kind:`domain`,change:o,domain:Dv(i[0])}]};if(r===`tasks.run`){let e=i[0]??{};return{action:`ask`,questions:[{kind:`task`,plugin:Dv(e.plugin),task:Dv(e.task)}]}}if(r===`updates.setup`||r===`updates.enable`)return{action:`ask`,questions:[{kind:`updates-setup`}]};if(r===`draft.discard`){let e=a?.name;return{action:`ask`,questions:[{kind:`discard-draft`,name:Dv(e)}]}}return r===`comments.create`?{action:`ask`,questions:[{kind:`comments-create`,name:Dv(i[0])}]}:r===`comments.remove`?{action:`ask`,questions:[{kind:`comments-delete`}]}:yv.has(r)?{action:`allow`}:{action:`refuse`,paths:[r],reason:`unknown`}}var kv={title:`Sign in`,loading:`Loading…`,framed:`This page can't be shown inside another page. Open it on its own.`,noConfig:`This sign-in page isn't set up yet: it needs a broker.json beside it, naming the site it signs in to. See the token broker page in Goodfellow's documentation.`,signInTitle:`Sign in to edit {site}`,signInIntro:`This page keeps your sign-in and AI keys where the site's pages can't reach them, and shows the admin panel from here.`,signInRedirect:`Sign in with {host}`,signInToken:`Or sign in with an access token`,tokenLabel:`Access token`,remember:`Stay signed in on this device`,signInButton:`Sign in`,signingIn:`Signing in…`,signInError:`That didn't work: {message}`,noSiteAddress:`The site has no address yet, so there's no admin panel to show. Set its address in Site Settings first, or ask its owner to.`,badSiteAddress:`The site's address, {address}, isn't one this page can show the admin panel from.`,sameOrigin:`The admin panel is at this page's own address, {address}, where it could read your sign-in. Give the sign-in page an address of its own.`,pinnedElsewhere:`The site's settings say its admin panel is at {address}, but this sign-in page only shows it from {pinned}, as its broker.json says. If you moved the site, change broker.json's admin to the new address.`,movedTitle:`The admin panel has moved`,moved:`Last time, this page showed the admin panel from {pinned}. The site's settings now say it's at {address}. Only go on if you or another owner changed the site's address: anyone who can edit the site can change its settings, and the page at that address would act as you.`,movedGoOn:`Go on to {address}`,signedInAs:`Signed in as {name}`,showing:`Showing {address}`,aiKeys:`AI keys`,signOut:`Sign out`,adminFrame:`Admin panel`,confirmTitle:`Publish this?`,confirmIntro:`The admin panel asked to publish changes that need you to say so here, where nothing it runs can say so for you:`,confirmCode:`The site's code, which runs when the site is built:`,confirmCustomCode:`Code that runs on the site's pages:`,confirmSiteAddress:`A new Site address, which is where this page shows the admin panel from. Only publish it if you changed it yourself:`,confirmUpdate:`Installing Goodfellow {release}, which changes the site's packages.`,confirmPlugin:`Installing the plugin {title} ({name} {release}), whose code is included when the site is built and runs on its pages. It asks to:`,confirmPluginRemove:`Removing the plugin {name}.`,confirmThemeEarly:`Updating the theme {name} to {release}.`,confirmEarly:`This installs {release} before it's three days old, skipping the wait that protects against harmful releases, since it says it was built by {repository} ({workflow}), as {from} was. The site's build checks that before it uses it.`,pluginConnect:`Reach these addresses from the admin panel: {list}`,pluginFiles:`Read and publish these files: {list}`,pluginSecrets:`Get these secrets when the site is built: {list}`,pluginRead:`Read these parts of the site when it's built: {list}`,pluginWrite:`Write these parts of the built site: {list}`,pluginBlocks:`Add these blocks: {list}`,pluginAdmin:`Run in the admin panel, in a frame of its own`,pluginBuild:`Run steps when the site is built`,pluginServer:`Answer requests on the site's server, with everything the server can do`,pluginEditor:`Offer its own page editor, {title}, which is given what's edited in it`,pluginNothing:`Nothing more`,confirmEditors:`Giving {who} access to edit the site{role}.`,confirmEditorsPublish:`Letting the site's editors publish to it.`,confirmAskTitle:`Allow this?`,confirmAskIntro:`The admin panel asked to do something that needs you to say so here, where nothing it runs can say so for you:`,confirmEditorsRemove:`Taking away {who}'s access to the site.`,confirmDomainConnect:`Connecting the domain {domain} to the site.`,confirmDomainSecure:`Turning on HTTPS for {domain}, and serving the site from it.`,confirmDomainDisconnect:`Removing the domain {domain} from the site.`,confirmTask:`Running the plugin {plugin}'s task {task} with the secrets it was given. Allowing it lets it run again while this page is open.`,confirmUpdatesSetup:`Changing the site's settings on its host so it can install updates by itself.`,confirmDiscardDraft:`Throwing away the draft {name}, which can't be undone.`,confirmCommentsCreate:`Making a public repository, {name}, for visitors' comments, beside the site's.`,confirmCommentsDelete:`Deleting a visitor's comment, which can't be undone.`,confirmPublish:`Publish`,confirmAllow:`Allow`,cancel:`Cancel`,refusedLimits:`An owner has limited what you can change on this site, and this publish changes things outside it: {paths}. Submit it for review instead.`,refusedWorkflow:`The token broker never changes the site's workflows, which run with its secrets: {paths}.`,refusedUnknown:`The token broker doesn't make this call for the admin panel: {paths}.`,declined:`You chose not to do this.`,ownerTitle:`Owner token`,ownerIntro:`Create a token that can manage the site, then paste it here. This page keeps it for as long as it's open, and the admin panel never sees it.`,ownerCreate:`Create a token`,ownerLabel:`Owner token`,ownerUse:`Use this token`,commentsTitle:`GitHub token for comments`,commentsLabel:`GitHub token`,commentsIntro:`Create a GitHub token that can manage the comments' repository, then paste it here. This page keeps it for as long as it's open, and the admin panel never sees it.`,aiTitle:`AI keys`,aiIntro:`The AI assistant asks these services through this page, with your keys, so the admin panel never sees them. Leave a service empty to not use it.`,aiRemember:`Remember these keys on this device`,aiSave:`Save`};function Q(e,t={}){return kv[e].replace(/\{(\w+)\}/g,(e,n)=>t[n]??e)}var Av=`goodfellow:broker:route`,jv=`goodfellow:broker:shown`,Mv=`goodfellow:broker:ai`,Nv=`goodfellow.config.tsx`,Pv=Object.keys(lv).filter(e=>e!==`custom`&&e!==`manual`&&(e===`anthropic`||lv[e].baseUrl));function $(e,t={},...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t))r.setAttribute(e,n);return r.append(...n),r}function Fv(e){return JSON.stringify([e.plugin,e.task])}function Iv(e){return e instanceof Error?e.message:String(e)}function Lv(e){let{repo:t,project:n}=e.options;return typeof t==`string`?t:typeof n==`string`?n:e.package}function Rv(){for(let e of[sessionStorage,localStorage])try{let t=e.getItem(Mv);if(t)return JSON.parse(t)}catch{}return{}}function zv(e,t){Uv(),(t?localStorage:sessionStorage).setItem(Mv,JSON.stringify(e))}function Bv(e){try{let t=JSON.parse(localStorage.getItem(jv)??`{}`)[e];return typeof t==`string`?t:void 0}catch{return}}function Vv(e,t){try{let n=JSON.parse(localStorage.getItem(jv)??`{}`);localStorage.setItem(jv,JSON.stringify({...n,[e]:t}))}catch{}}function Hv(e){if(typeof e.admin==`string`)try{return new URL(e.admin).origin}catch{return`null`}}function Uv(){sessionStorage.removeItem(Mv),localStorage.removeItem(Mv)}async function Wv(e){let t=await e.revision(),n=JSON.parse(await e.read(`content/site.json`)??`{}`);if(typeof n.url!=`string`||!n.url)return{problem:`noSiteAddress`};let r;try{r=new URL(n.url.replace(/\/?$/,`/`))}catch{return{problem:`badSiteAddress`}}let i=r.hostname===`localhost`||r.hostname===`127.0.0.1`;if(r.protocol!==`https:`&&!(r.protocol===`http:`&&i))return{problem:`badSiteAddress`};let a=await e.readAt(Nv,t).catch(()=>void 0),o=a?v(a):void 0;return{url:`${(o?.checked?g(o):void 0)??r.origin}${r.pathname}admin/`,siteUrl:n.url}}async function Gv({root:e,config:t,hosts:n}){document.title=Q(`title`);let r=(...t)=>e.replaceChildren(...t);if(window.top!==window){r($(`p`,{class:`broker-note`},Q(`framed`)));return}let i=new URLSearchParams(location.search).get(`site`),a=t?.sites.find(e=>!i||Lv(e)===i)??t?.sites[0],o=a&&Object.hasOwn(n,a.package)?n[a.package]:void 0,s=o&&(await o())[a?.export??``];if(!a||typeof s!=`function`){r($(`p`,{class:`broker-note`},Q(`noConfig`)));return}let c=s(a.options),l=()=>{location.hash&&sessionStorage.setItem(Av,location.hash)};l(),window.addEventListener(`hashchange`,l),r($(`p`,{class:`broker-note`},Q(`loading`)));let u=null,d;try{u=await c.restore()}catch(e){d=e}u?await p(u):f(d);function f(e){let t=$(`form`,{class:`broker-sign-in`}),n=$(`input`,{type:`checkbox`,id:`broker-remember`}),i=$(`input`,{type:`password`,id:`broker-token`,autocomplete:`off`}),o=$(`p`,{class:`broker-error`,role:`alert`});e!==void 0&&(o.textContent=Q(`signInError`,{message:Iv(e)}));let s=$(`button`,{type:`submit`},Q(`signInButton`)),l=async e=>{s.disabled=!0,o.textContent=Q(`signingIn`);try{await p(await e())}catch(e){o.textContent=Q(`signInError`,{message:Iv(e)}),s.disabled=!1}};if(t.append($(`h1`,{},Q(`signInTitle`,{site:Lv(a)})),$(`p`,{},Q(`signInIntro`)),o),c.canRedirect){let e=$(`button`,{type:`button`,class:`broker-primary`},Q(`signInRedirect`,{host:c.name}));e.addEventListener(`click`,()=>void c.startRedirect(n.checked).catch(e=>{o.textContent=Q(`signInError`,{message:Iv(e)})})),t.append($(`div`,{},e))}if(c.tokenLinks){let e=$(`ul`,{});for(let t of c.tokenLinks)e.append($(`li`,{},$(`a`,{href:t.url,target:`_blank`,rel:`noreferrer`},t.url)));t.append($(`h2`,{},Q(`signInToken`)),e,$(`label`,{for:`broker-token`},Q(`tokenLabel`)),i,$(`label`,{class:`broker-check`},n,` ${Q(`remember`)}`),$(`div`,{},s))}t.addEventListener(`submit`,e=>{e.preventDefault(),i.value.trim()&&l(()=>c.signInWithToken(i.value.trim(),n.checked))}),r(t)}async function p(e){let t=await Wv(e).catch(e=>({problem:`signInError`,error:e}));if(`problem`in t){r($(`p`,{class:`broker-note`,role:`alert`},Q(t.problem,{address:``,message:`error`in t?Iv(t.error):``})));return}let n=new URL(t.url).origin;if(n===location.origin){r($(`p`,{class:`broker-note`,role:`alert`},Q(`sameOrigin`,{address:n})));return}let i=Lv(a),o=Hv(a);if(o!==void 0&&o!==n){r($(`p`,{class:`broker-note`,role:`alert`},Q(`pinnedElsewhere`,{address:n,pinned:o})));return}let s=Bv(i);if(o===void 0&&s!==void 0&&s!==n){let t=$(`button`,{type:`button`,class:`broker-primary`},Q(`movedGoOn`,{address:n})),a=$(`button`,{type:`button`},Q(`signOut`));t.addEventListener(`click`,()=>{Vv(i,n),p(e)}),a.addEventListener(`click`,()=>{e.signOut(),Uv(),sessionStorage.removeItem(Av),f()}),r($(`div`,{class:`broker-sign-in`,role:`alertdialog`,"aria-labelledby":`broker-moved`},$(`h1`,{id:`broker-moved`},Q(`movedTitle`)),$(`p`,{},Q(`moved`,{address:n,pinned:s})),$(`div`,{},t,` `,a)));return}Vv(i,n);let l=sessionStorage.getItem(Av)??``,u=$(`iframe`,{class:`broker-frame`,title:Q(`adminFrame`),src:`${t.url}${l.startsWith(`#`)?l:``}`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads allow-modals`,allow:`clipboard-write`}),d=()=>{window.removeEventListener(`message`,ne),ee?.(),e.signOut(),Uv(),sessionStorage.removeItem(Av),f()},h=$(`button`,{type:`button`},Q(`aiKeys`));h.addEventListener(`click`,()=>b(()=>u.contentWindow?.location.replace(u.src)));let g=$(`button`,{type:`button`},Q(`signOut`));g.addEventListener(`click`,d),r($(`header`,{class:`broker-bar`},$(`span`,{},Q(`signedInAs`,{name:e.user.name||e.user.login})),$(`span`,{class:`broker-origin`},Q(`showing`,{address:n})),h,g),u);let ee,te=new Set,ne=r=>{if(r.source!==u.contentWindow||r.origin!==n||r.data?.type!==`goodfellow:broker-ready`)return;ee?.();let i=new MessageChannel,a=new MessageChannel;ee=Z_(i.port1,e,{async check(n){let r=await Ov(n,t.siteUrl,e);if(r.action===`refuse`){let e=r.paths.join(`, `);throw r.reason===`limits`?new W_(`limits`,Q(`refusedLimits`,{paths:e})):r.reason===`unknown`?new W_(`not-here`,Q(`refusedUnknown`,{paths:e})):new W_(`workflow`,Q(`refusedWorkflow`,{paths:e}))}if(r.action!==`ask`)return;let i=r.questions.filter(e=>e.kind!==`task`||!te.has(Fv(e)));if(i.length!==0){if(!await _(i))throw new W_(`declined`,Q(`declined`));for(let e of i)e.kind===`task`&&te.add(Fv(e))}},extra:{signOut:d,"ownerAccess.requestToken":()=>v(e),"comments.access.requestToken":()=>y(e)}}),a.port1.onmessage=e=>void m(a.port1,e.data);let o={hostName:c.name,redirectAddressesListed:c.canRedirect&&c.redirectAddressesListed===!0,aiServices:Object.keys(Rv())};u.contentWindow?.postMessage({type:V_,account:o},n,[i.port2,a.port2])};window.addEventListener(`message`,ne)}async function m(e,t){if(t?.type===`route`&&typeof t.hash==`string`){sessionStorage.setItem(Av,t.hash);return}if(t?.type!==`ai`)return;let[n=``,...r]=t.path.split(`?`)[0]?.split(`/`)??[],i=t.path.includes(`?`)?t.path.slice(t.path.indexOf(`?`)):``,a=new Request(`https://broker.invalid/${r.join(`/`)}${i}`,{method:t.method,headers:t.headers,...t.body&&t.method!==`GET`&&{body:t.body}}),o=await gv(Rv()).forward(a,n,r.join(`/`)),s=await o.arrayBuffer(),c={type:`ai`,id:t.id,status:o.status,headers:[...o.headers.entries()],body:s};e.postMessage(c,[s])}function h(e,t,n){return new Promise(r=>{let i=$(`dialog`,{class:`broker-dialog`},$(`h2`,{},e),...t),a=$(`div`,{class:`broker-actions`});for(let e of n){let t=$(`button`,{type:`button`,...e.primary&&{class:`broker-primary`}},e.label);t.addEventListener(`click`,()=>i.close(e.value?`yes`:`no`)),a.append(t)}i.append(a),i.addEventListener(`close`,()=>{i.remove(),r(i.returnValue===`yes`)}),document.body.append(i),i.showModal()})}function g(e){let{permissions:t}=e,n=(e,t)=>e?.length?[Q(t,{list:e.join(`, `)})]:[],r=[...n(t.connect,`pluginConnect`),...n(t.files,`pluginFiles`),...n(t.secrets,`pluginSecrets`),...n(t.read,`pluginRead`),...n(t.write,`pluginWrite`),...n(e.blocks,`pluginBlocks`),...e.admin?[Q(`pluginAdmin`)]:[],...e.build?.length?[Q(`pluginBuild`)]:[],...e.server?[Q(`pluginServer`)]:[],...e.editor?[Q(`pluginEditor`,{title:e.editor.title})]:[]];return r.length>0?r:[Q(`pluginNothing`)]}function _(e){let t=[$(`p`,{},Q(`confirmIntro`))],n=!1;for(let r of e)if(r.kind===`update`)t.push($(`p`,{},Q(`confirmUpdate`,{release:r.release})));else if(r.kind===`plugins`){n=!0;for(let e of r.installed){let{manifest:n}=e;t.push($(`p`,{},Q(`confirmPlugin`,{title:n.title,name:e.name,release:e.release})),$(`ul`,{},...g(n).map(e=>$(`li`,{},e)))),e.early&&t.push($(`p`,{class:`broker-warning`},Q(`confirmEarly`,{release:e.release,from:e.early.from,repository:e.early.repository,workflow:e.early.workflow})))}for(let e of r.removed)t.push($(`p`,{},Q(`confirmPluginRemove`,{name:e})))}else if(r.kind===`theme-early`)n=!0,t.push($(`p`,{},Q(`confirmThemeEarly`,{name:r.name,release:r.release})),$(`p`,{class:`broker-warning`},Q(`confirmEarly`,{release:r.release,from:r.from,repository:r.repository,workflow:r.workflow})));else if(r.kind===`editors`)t.push($(`p`,{},r.who?Q(`confirmEditors`,{who:r.who,role:r.role?` (${r.role})`:``}):Q(`confirmEditorsPublish`)));else if(r.kind===`editors-remove`)t.push($(`p`,{},Q(`confirmEditorsRemove`,{who:r.who})));else if(r.kind===`domain`){let e=r.change===`connect`?`confirmDomainConnect`:r.change===`secure`?`confirmDomainSecure`:`confirmDomainDisconnect`;t.push($(`p`,{},Q(e,{domain:r.domain})))}else if(r.kind===`task`)t.push($(`p`,{},Q(`confirmTask`,{plugin:r.plugin,task:r.task})));else if(r.kind===`updates-setup`)t.push($(`p`,{},Q(`confirmUpdatesSetup`)));else if(r.kind===`discard-draft`)t.push($(`p`,{},Q(`confirmDiscardDraft`,{name:r.name})));else if(r.kind===`comments-create`)t.push($(`p`,{},Q(`confirmCommentsCreate`,{name:r.name})));else if(r.kind===`comments-delete`)t.push($(`p`,{},Q(`confirmCommentsDelete`)));else{n=!0;let e=r.kind===`code`?`confirmCode`:r.kind===`custom-code`?`confirmCustomCode`:`confirmSiteAddress`;t.push($(`p`,{},Q(e)),$(`ul`,{},...r.paths.map(e=>$(`li`,{},$(`code`,{},e)))))}return n||(t[0]=$(`p`,{},Q(`confirmAskIntro`))),h(Q(n?`confirmTitle`:`confirmAskTitle`),t,[{label:Q(`cancel`),value:!1},{label:Q(n?`confirmPublish`:`confirmAllow`),value:!0,primary:!0}])}function v(e){let t=e.ownerAccess;if(!t)throw new W_(`not-here`,`This site's host has no owner token.`);return ee(t,Q(`ownerTitle`),Q(`ownerIntro`),Q(`ownerLabel`))}function y(e){let t=e.comments?.access;if(!t)throw new W_(`not-here`,`This site's host has no comments.`);return ee(t,Q(`commentsTitle`),Q(`commentsIntro`),Q(`commentsLabel`))}async function ee(e,t,n,r){let i=$(`input`,{type:`password`,id:`broker-owner-token`,autocomplete:`off`}),a=$(`p`,{class:`broker-error`,role:`alert`});for(;;){if(!await h(t,[$(`p`,{},n),$(`p`,{},$(`a`,{href:e.tokenLink.url,target:`_blank`,rel:`noreferrer`},Q(`ownerCreate`))),$(`label`,{for:`broker-owner-token`},r),i,a],[{label:Q(`cancel`),value:!1},{label:Q(`ownerUse`),value:!0,primary:!0}]))throw new W_(`declined`,Q(`declined`));try{await e.applyToken(i.value.trim());return}catch(e){a.textContent=Q(`signInError`,{message:Iv(e)})}}}async function b(e){let t=Rv(),n=new Map,r=Pv.map(e=>{let r=$(`input`,{type:`password`,id:`broker-ai-${e}`,autocomplete:`off`}),i=t[e];return typeof i==`string`&&(r.value=i),n.set(e,r),$(`div`,{},$(`label`,{for:`broker-ai-${e}`},lv[e].name),r)}),i=$(`input`,{type:`checkbox`,id:`broker-ai-remember`});if(i.checked=localStorage.getItem(Mv)!==null,!await h(Q(`aiTitle`),[$(`p`,{},Q(`aiIntro`)),...r,$(`label`,{class:`broker-check`},i,` ${Q(`aiRemember`)}`)],[{label:Q(`cancel`),value:!1},{label:Q(`aiSave`),value:!0,primary:!0}]))return;let a={};for(let[e,t]of n)t.value.trim()&&(a[e]=t.value.trim());zv(a,i.checked),e()}}await Gv({root:document.getElementById(`broker`),config:await fetch(`./broker.json`,{cache:`no-store`}).then(e=>e.ok?e.json():void 0).catch(()=>void 0),hosts:{"@goodfellow-cms/bitbucket":()=>i(()=>import(`./dist-BgSqMIdW.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url),"@goodfellow-cms/github":()=>i(()=>import(`./dist-pDBJlXWC.js`),__vite__mapDeps([5,6,1,2,7,3]),import.meta.url),"@goodfellow-cms/gitlab":()=>i(()=>import(`./dist-D1ZOk-UP.js`),__vite__mapDeps([8,1,2,7,3,4]),import.meta.url)}});
|