@goodfellow-cms/broker 0.7.0 → 0.9.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-HEL-uoaX.js → content-repository-setup-CzHqy87S.js} +2 -2
- package/site/assets/dist-BgSqMIdW.js +2 -0
- package/site/assets/dist-CoI2plUt.js +6 -0
- package/site/assets/dist-pDBJlXWC.js +21 -0
- package/site/assets/index-DFJqtIl9.js +234 -0
- package/site/assets/{index-BQoQNxGe.css → index-fBFd9gqV.css} +1 -1
- package/site/assets/preload-helper-CEqbogAV.js +1 -0
- package/site/assets/{setup-host-DQm73dc_.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-DAzQ31j6.js +0 -5
- package/site/assets/dist-Dkr_h4iS.js +0 -2
- package/site/assets/dist-Dob4V5zY.js +0 -6
- package/site/assets/index-BL-VYiot.js +0 -234
- package/site/assets/preload-helper-khBccGFq.js +0 -1
- package/site/assets/store-BtVaZcVF.js +0 -1
|
@@ -1,234 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-Dkr_h4iS.js","./store-BtVaZcVF.js","./setup-host-DQm73dc_.js","./git-eGyMXUIu.js","./scheduled-builds-BPfDaBYt.js","./dist-DAzQ31j6.js","./content-repository-setup-HEL-uoaX.js","./preload-helper-khBccGFq.js","./dist-Dob4V5zY.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{d as e,f as t,i as n,l as r,m as i,o as a,p as o,s,u as c}from"./store-BtVaZcVF.js";import{t as l}from"./preload-helper-khBccGFq.js";function u(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}}var d=/^[ \t]*admin:[ \t]*\{[^\n]*\},?[ \t]*\n/m;function f(e){let t=d.exec(e)?.[0],n=t&&/url:\s*"([^"\\]+)"/.exec(t)?.[1];if(t&&n)return{url:n,.../checked:\s*true/.test(t)&&{checked:!0}}}function p(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)}var m={site:1,menus:1,page:1,layout:1,collection:1,entry:1,updates:1,redirects:1,media:1,theme:1,storage:1,permissions:1},h={site:[],menus:[],page:[],layout:[],collection:[],entry:[],updates:[],redirects:[],media:[],theme:[],storage:[],permissions:[]},g=class extends Error{name=`MigrationError`};function _(e,t,n={}){let r=n.registry??h,i=n.currentVersion??m[e],a=t.version;if(typeof a!=`number`||!Number.isInteger(a)||a<1)throw new g(`is missing its "version" number.`);if(a>i)throw new g(`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 g(`can't be upgraded from version ${t}: no migration exists.`);o={...n.up(o),version:t+1}}return o}function v(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 y(e,t=`|`){return e.map(e=>Ce(e)).join(t)}function ee(e,t){return typeof t==`bigint`?t.toString():t}var te=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 ne(e){return new te(e)}function re(e){return e==null}function ie(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function ae(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function oe(e){let t=Object.getOwnPropertyDescriptor(e,`shape`);return t?.get?t.get.raw:t?.value}function se(e){return oe(e._zod.def)??e._zod.def.shape}function ce(e,t,n){Object.defineProperty(e,t,{get(){let e=n();return ae(this,t,e),e},enumerable:!0,configurable:!0})}function le(e,t,n){t in e?ae(e,t,n):e[t]=n}function ue(e,t,n,r){let i=se(t);for(let a of n){let n=Object.getOwnPropertyDescriptor(i,a);n.enumerable&&(n.get?ce(e,a,()=>{let e=t._zod.def.shape[a];return r?r(e,a):e}):le(e,a,r?r(n.value,a):n.value))}}function de(e,t){for(let n of Reflect.ownKeys(t)){let r=Object.getOwnPropertyDescriptor(t,n);r.enumerable&&(r.get?ce(e,n,()=>t[n]):le(e,n,r.value))}}function fe(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function pe(e){return JSON.stringify(e)}function me(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var he=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function ge(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var _e=ne(()=>{if(ft.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function ve(e){if(ge(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return ge(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function ye(e){return ve(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var be=new Set([`string`,`number`,`symbol`]);function xe(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Se(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function b(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 Ce(e){return typeof e==`bigint`?e.toString()+`n`:typeof e==`string`?`"${e}"`:`${e}`}function we(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout===`optional`)}var Te={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ee={int64:[BigInt(`-9223372036854775808`),BigInt(`9223372036854775807`)],uint64:[BigInt(0),BigInt(`18446744073709551615`)]};function De(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 ue(i,e,Oe(e,t)),Se(e,fe(n,{shape:i,checks:[]}))}function Oe(e,t){let n=se(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 ke(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(Oe(e,t)),a={};return ue(a,e,Reflect.ownKeys(se(e)).filter(e=>!i.has(e))),Se(e,fe(n,{shape:a,checks:[]}))}function Ae(e,t){if(!ve(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=se(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 Se(e,fe(e._zod.def,{shape:je(e,t)}))}function je(e,t){let n={};return ue(n,e,Reflect.ownKeys(se(e))),de(n,t),n}function Me(e,t){if(!ve(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return Se(e,fe(e._zod.def,{shape:je(e,t)}))}function Ne(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 ue(n,e,Reflect.ownKeys(se(e))),ue(n,t,Reflect.ownKeys(se(t))),Se(e,fe(e._zod.def,{shape:n,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function Pe(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(Oe(t,n)):void 0,o={};return ue(o,t,Reflect.ownKeys(se(t)),e&&((t,n)=>a&&!a.has(n)?t:new e({type:`optional`,innerType:t}))),Se(t,fe(t._zod.def,{shape:o,checks:[]}))}function Fe(e,t,n){let r=n?new Set(Oe(t,n)):void 0,i={};return ue(i,t,Reflect.ownKeys(se(t)),(t,n)=>r&&!r.has(n)?t:new e({type:`nonoptional`,innerType:t})),Se(t,fe(t._zod.def,{shape:i}))}function Ie(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 Le(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 Re(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function ze(e){return typeof e==`string`?e:e?.message}function Be(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 Ve(e,t,n){var r;for(let i=t;i<e.length;i++)(r=e[i]).schema??(r.schema=n)}function He(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:ze(e.inst?._zod.def?.error?.(e))??ze(a?.(e))??ze(t?.error?.(e))??ze(n.customError?.(e))??ze(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 Ue=/[\uD800-\uDBFF]/;function We(e){let t=e.length;if(!Ue.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 Ge(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function Ke(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 Je(e,t){for(let n in t){let r=Object.getOwnPropertyDescriptor(t,n);r.get?Object.defineProperty(e,n,{...r,enumerable:!1}):Qe(e,n,r.value)}}function Ye(e,t,n,r=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:r,value:n}),n}function Xe(e,t,n){return Ye(e,t,n,!1)}function Ze(e,t){for(let n in e){let r=e[n];Object.defineProperty(t,n,{configurable:!0,enumerable:!0,get(){return Ye(this,n,r(this))},set(e){Ye(this,n,e)}})}return t}function Qe(e,t,n){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?n:Ye(this,t,n.bind(this))},set(e){Ye(this,t,e)}})}function $e(e,t){let n=Object.getPrototypeOf(e);return t in n?void 0:n}var et,tt=!1,nt={configurable:!0,get(){tt=!0}};function x(e,t,n){let r=Object.getPrototypeOf(e._zod);if(t in r&&et!==e._zod){et=void 0;return}et=e._zod,Object.defineProperty(r,t,{configurable:!0,get(){Object.defineProperty(this,t,nt);let e=tt;tt=!1;try{let r=n(this);return tt?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:r}),tt||=e,r}catch(n){throw delete this[t],tt||=e,n}},set(e){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:e})}})}function rt(e,t,n,r){let i=$e(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 it=`~constantCatch`;function at(e){let t=()=>e;return t[it]=!0,t}var ot,st={value:void 0,enumerable:!1},ct=`captureStackTrace`in Error?Error:null;function lt(e){let t=ct;if(t){let n=t.stackTraceLimit;if(typeof n==`number`){try{t.stackTraceLimit=0}catch{return ct=null,new e}try{return new e}finally{t.stackTraceLimit=n}}}return new e}function S(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){st.value=new a(r);try{Object.defineProperty(n,"_zod",st)}finally{st.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),Je(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?lt(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 ut=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},dt=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ot=globalThis).__zod_globalConfig??(ot.__zod_globalConfig={});var ft=globalThis.__zod_globalConfig;function pt(e){return e&&Object.assign(ft,e),ft}function mt(){let e=this._zod;return e.message??=JSON.stringify(e.def,ee,2),e.message}function ht(e){this._zod.message=e}var gt={get:mt,set:ht,enumerable:!0,configurable:!0},_t={value:void 0,enumerable:!1},vt=new WeakSet([Object.prototype,Error.prototype]),yt=(e,t)=>{e.name=`$ZodError`,_t.value=t,Object.defineProperty(e,"issues",_t),_t.value=void 0,Object.defineProperty(e,"message",gt);let n=Object.getPrototypeOf(e);vt.has(n)||(vt.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})}}))},bt=S(`$ZodError`,yt);S(`$ZodError`,yt,void 0,{Parent:Error});function xt(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 St(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?xt(n,i.path[0],()=>[]).push(t(i)):r.push(t(i));return{formErrors:r,fieldErrors:n}}function Ct(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 wt(e,t){return{callee:t?.callee??e,Err:t?.Err}}var Tt=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 ut;if(s.issues.length){let n=new((a?.Err)??e)(s.issues.map(e=>He(e,o,pt())));throw he(n,a?.callee??t),n}return s.value};return t},Et=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=>He(e,o,pt())));throw he(n,a?.callee??t),n}return s.value};return t},Dt=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 ut;return a.issues.length?Ot(e,a.issues,i):{success:!0,data:a.value}};function Ot(e,t,n){let r;return{success:!1,get error(){return r||(r=new e(t.map(e=>He(e,n,pt()))),t=void 0,n=void 0),r},set error(e){r=e,t=void 0,n=void 0}}}var kt=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?Ot(e,a.issues,i):{success:!0,data:a.value}},At=Symbol.for(`zod.compile.invalid`),jt=Symbol.for(`zod.compile.fallback`),Mt=((e,t,n)=>{let r=e._zod.bag.validator;if(r!==void 0){if(r(t)!==At)return!0;if(r.definite===!0&&n===void 0)return!1}return Nt(e,t,n)});function Nt(e,t,n){let r=n?{...n,async:!1,abortEarly:!0}:{async:!1,abortEarly:!0},i=e._zod.bag.fallbackRun,a;if(i?(r[jt]=!0,a=i({value:t,issues:[]},r)):a=e._zod.run({value:t,issues:[]},r),a instanceof Promise)throw new ut;return a.issues.length===0}var Pt=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},Ft=e=>{let t=Tt(e),n=(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return t(e,r,o,wt(n,a))};return n},It=e=>{let t=Tt(e),n=(e,r,i,a)=>t(e,r,i,wt(n,a));return n},Lt=e=>{let t=Et(e),n=async(e,r,i,a)=>{let o=i?{...i,direction:`backward`}:{direction:`backward`};return await t(e,r,o,wt(n,a))};return n},Rt=e=>{let t=Et(e),n=async(e,r,i,a)=>await t(e,r,i,wt(n,a));return n},zt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Dt(e)(t,n,i)},Bt=e=>(t,n,r)=>Dt(e)(t,n,r),Vt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return kt(e)(t,n,i)},Ht=e=>async(t,n,r)=>kt(e)(t,n,r),Ut=/^[cC][0-9a-z]{6,}$/,Wt=/^[0-9a-z]+$/,Gt=/^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$/,Kt=/^[0-9a-vA-V]{20}$/,qt=/^[A-Za-z0-9]{27}$/,Jt=/^[a-zA-Z0-9_-]{21}$/;function Yt(e){return RegExp(`^[a-zA-Z0-9_-]{${e}}$`)}var Xt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zt=/^([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})$/,Qt=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)$/,$t=/^(?:[A-Za-z0-9_'+\-]+\.)*[A-Za-z0-9_'+\-]*[A-Za-z0-9_+-]@(?:[A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,en=`^(?=[\\s\\S]*[\\p{Extended_Pictographic}\\p{Regional_Indicator}\\u20E3])[\\p{Extended_Pictographic}\\p{Emoji_Component}]+$`;function tn(){return new RegExp(en,`u`)}var nn=/^(?:(?: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])$/,rn=/^(([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}|:))$/,an=/^((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])$/,on=/^(([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])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cn=/^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2,3})?$/,ln=/^https?$/,un=/^\+[1-9]\d{6,14}$/,dn=`(?:(?:\\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 fn(e){return RegExp(`^${e}$`)}var pn=fn(dn);function mn(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 hn(e){return RegExp(`^${mn(e)}$`)}function gn(e){let t=[`Z`];e.offset&&t.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let n=`${mn({precision:e.precision,seconds:!0})}(?:${t.join(`|`)})`,r=e.local?`${n}|${mn({precision:e.precision})}`:n;return RegExp(`^${dn}T(?:${r})$`)}var _n=/^[\s\S]{0,}$/,vn=/^-?\d+$/,yn=/^-?\d+(?:\.\d+)?$/,bn=/^(?:true|false)$/i,xn=/^[^A-Z]*$/,Sn=/^[^a-z]*$/,Cn=S(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),wn=e=>{let t=e.value;return!re(t)&&t.length!==void 0},Tn=S(`$ZodCheckMaxLength`,(e,t)=>{var n;Cn.init(e,t),(n=e._zod.def).when??(n.when=wn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>t.maximum?We(r):i)<=t.maximum)return;let a=Ge(r);n.issues.push({origin:a,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),En=S(`$ZodCheckMinLength`,(e,t)=>{var n;Cn.init(e,t),(n=e._zod.def).when??(n.when=wn),e._zod.check=n=>{let r=n.value,i=r.length;if((typeof r==`string`&&i>=t.minimum&&i<t.minimum*2?We(r):i)>=t.minimum)return;let a=Ge(r);n.issues.push({origin:a,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Dn=S(`$ZodCheckLengthEquals`,(e,t)=>{var n;Cn.init(e,t),(n=e._zod.def).when??(n.when=wn),e._zod.check=n=>{let r=n.value,i=r.length,a=typeof r==`string`&&i>=t.length&&i<=t.length*2?We(r):i;if(a===t.length)return;let o=Ge(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})}}),On=S(`$ZodCheckStringFormat`,(e,t)=>{var n,r;Cn.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=()=>{})}),kn=S(`$ZodCheckRegex`,(e,t)=>{On.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})}}),An=S(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=xn,On.init(e,t)}),jn=S(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Sn,On.init(e,t)}),Mn=S(`$ZodCheckIncludes`,(e,t)=>{Cn.init(e,t);let n=xe(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})}}),Nn=S(`$ZodCheckStartsWith`,(e,t)=>{Cn.init(e,t);let n=RegExp(`^${xe(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})}}),Pn=S(`$ZodCheckEndsWith`,(e,t)=>{Cn.init(e,t);let n=RegExp(`.*${xe(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})}}),Fn=S(`$ZodCheckOverwrite`,(e,t)=>{Cn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),In=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))}},Ln={major:4,minor:6,patch:6},C=S(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ln;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=Ie(t),a;for(let o of n){if(o._zod.def.when){if(Le(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 ut;if(a||s instanceof Promise)a=(a??Promise.resolve()).then(async()=>{await s,t.issues.length!==n&&(Ve(t.issues,n,e),i||=Ie(t,n))});else{if(t.issues.length===n)continue;Ve(t.issues,n,e),i||=Ie(t,n)}}return a?a.then(()=>t):t},n=(n,r,a)=>{if(Ie(n))return n.aborted=!0,n;let o=t(r,i,a);if(o instanceof Promise){if(a.async===!1)throw new ut;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 ut;return o.then(e=>t(e,i,a))}return t(o,i,a)}}},{get"~standard"(){return Xe(this,`~standard`,Bn(this))},set"~standard"(e){Ye(this,`~standard`,e)}}),Rn=(e,t)=>e.issues.length?{issues:e.issues.map(e=>He(e,t,pt()))}:{value:e.value};async function zn(e,t){let n={async:!0};return Rn(await e._zod.run({value:t,issues:[]},n),n)}function Bn(e){return{validate:t=>{let n={async:!1};try{let r=e._zod.run({value:t,issues:[]},n);if(!(r instanceof Promise))return Rn(r,n)}catch{}return zn(e,t)},vendor:`zod`,version:1}}var Vn=S(`$ZodString`,(e,t)=>{C.init(e,t),e._zod.pattern=t.pattern??_n,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}}),w=S(`$ZodStringFormat`,(e,t)=>{On.init(e,t),Vn.init(e,t)}),Hn=S(`$ZodGUID`,(e,t)=>{t.pattern??=Zt,w.init(e,t)}),Un=S(`$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??=Qt(e)}else t.pattern??=Qt();w.init(e,t)}),Wn=S(`$ZodEmail`,(e,t)=>{t.pattern??=$t,w.init(e,t)});function Gn(e){try{return typeof URL<`u`&&typeof URL.canParse==`function`?URL.canParse(e):(new URL(e),!0)}catch{return!1}}function Kn(e,t){return!(`normalize`in t)&&!(`hostname`in t)&&!(`protocol`in t)?Gn(e)||2:qn(e,t)}function qn(e,t){if(!t.normalize&&t.protocol?.source===ln.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 Jn=/[\t\n\r]/g;function Yn(e){return e.replace(Jn,``)}function Xn(e,t){return t.lastIndex=0,t.test(e.hostname)}function Zn(e,t){return t.lastIndex=0,t.test(e.protocol.endsWith(`:`)?e.protocol.slice(0,-1):e.protocol)}var Qn=S(`$ZodURL`,(e,t)=>{w.init(e,t),e._zod.check=n=>{try{let r=n.value.trim(),i=Kn(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=Yn(r);return}t.hostname&&!Xn(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&&!Zn(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:Yn(r);return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),$n=S(`$ZodEmoji`,(e,t)=>{t.pattern??=tn(),w.init(e,t)}),er=S(`$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?Jt:Yt(t.length),w.init(e,t)}),tr=S(`$ZodCUID`,(e,t)=>{t.pattern??=Ut,w.init(e,t)}),nr=S(`$ZodCUID2`,(e,t)=>{t.pattern??=Wt,w.init(e,t)}),rr=S(`$ZodULID`,(e,t)=>{t.pattern??=Gt,w.init(e,t)}),ir=S(`$ZodXID`,(e,t)=>{t.pattern??=Kt,w.init(e,t)}),ar=S(`$ZodKSUID`,(e,t)=>{t.pattern??=qt,w.init(e,t)}),or=S(`$ZodISODateTime`,(e,t)=>{t.pattern??=gn(t),w.init(e,t)}),sr=S(`$ZodISODate`,(e,t)=>{t.pattern??=pn,w.init(e,t)}),cr=S(`$ZodISOTime`,(e,t)=>{t.pattern??=hn(t),w.init(e,t)}),lr=S(`$ZodISODuration`,(e,t)=>{t.pattern??=Xt,w.init(e,t)}),ur=S(`$ZodIPv4`,(e,t)=>{t.pattern??=nn,w.init(e,t)}),dr=/^[0-9a-fA-F:.]+$/;function fr(e){return dr.test(e)?Gn(`http://[${e}]`):!1}var pr=S(`$ZodIPv6`,(e,t)=>{t.pattern??=rn,w.init(e,t),e._zod.check=n=>{fr(n.value)||n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}),mr=S(`$ZodCIDRv4`,(e,t)=>{t.pattern??=an,w.init(e,t)});function hr(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:fr(n)}var gr=S(`$ZodCIDRv6`,(e,t)=>{t.pattern??=on,w.init(e,t),e._zod.check=n=>{hr(n.value)||n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}});function _r(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var vr=/^[0-9a-zA-Z+/]*={0,2}$/,yr=S(`$ZodBase64`,(e,t)=>{t.pattern??=vr,w.init(e,t),e._zod.check=n=>{_r(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}}),br=/^[A-Za-z0-9_-]*$/;function xr(e){if(!br.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return _r(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var Sr=S(`$ZodBase64URL`,(e,t)=>{t.pattern??=br,w.init(e,t),e._zod.check=n=>{xr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),Cr=S(`$ZodE164`,(e,t)=>{t.pattern??=un,w.init(e,t)});function wr(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 Tr=S(`$ZodJWT`,(e,t)=>{w.init(e,t),e._zod.check=n=>{wr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),Er=S(`$ZodBoolean`,(e,t)=>{C.init(e,t),e._zod.pattern=bn,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}}),Dr=S(`$ZodUnknown`,(e,t)=>{C.init(e,t),e._zod.parse=e=>e}),Or=S(`$ZodNever`,(e,t)=>{C.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)});function kr(e,t){let n=Be(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 Be(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,Ve(n.issues,t,e),n}}return i(n,a)}}var Ar=e=>Array.isArray(e)?e.length:-1;function jr(e,t,n){e.issues.length&&t.issues.push(...Re(n,e.issues)),t.value[n]=e.value}var Mr=S(`$ZodArray`,(e,t)=>{C.init(e,t);let n=ft.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=>jr(t,r,e)));else if(jr(c,r,e),s&&c.issues.length!==0&&Ie(c))break}return o.length?Promise.all(o).then(()=>r):r},kr(e,Ar)});function Nr(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(...Re(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 Pr=[];function Fr(e){let t=Object.keys(e.shape),n=Object.getOwnPropertySymbols(e.shape),r=n.length?n:Pr,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=we(e.shape);return{...e,allKeys:i,symbolKeys:r,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(a)}}function Ir(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(Ie(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=>Nr(e,n,i,t,d,f))):Nr(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 Lr=S(`$ZodObject`,(e,t)=>{C.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=ne(()=>Fr(t));x(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)||ae(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=ge,o=t.catchall,s,c=ft.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(Ie(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=>Nr(n,t,e,r,a,o))):Nr(s,t,e,r,a,o)}return o?Ir(l,r,t,n,i.value,e,d===!0):l.length?Promise.all(l).then(()=>t):t}}),Rr=S(`$ZodObjectJIT`,(e,t)=>{Lr.init(e,t);let n=e._zod.parse,r=ne(()=>Fr(t)),i=ft.memoizer,a=t=>{let n=r.value,a=n.symbolKeys,o=new In([`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)}]`:pe(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=ge,c=!ft.jitless,l=c&&_e.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?Ir([],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=>!Ie(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=>He(e,r,pt())))}),t)}var Br=S(`$ZodUnion`,(e,t)=>{C.init(e,t),x(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),x(e,`optout`,e=>e.def.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),x(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)))}),x(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=>ie(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)}}),Vr=S(`$ZodIntersection`,(e,t)=>{C.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])=>Ur(e,t,n)):Ur(e,i,a)}});function Hr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(ve(e)&&ve(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=Hr(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=Hr(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 Ur(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=Hr(t.value,n.value);if(!c.valid){if(Ie(e))return e;throw Error(`Unmergable intersection. Error path: ${JSON.stringify(c.mergeErrorPath)}`)}return e.value=c.data,e}var Wr=S(`$ZodRecord`,(e,t)=>{C.init(e,t);let n=ft.memoizer;n?.attach(e),e._zod.parse=(r,i)=>{let a=r.value;if(!ve(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=>He(e,i,pt())),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(...Re(n,e.issues)),r.value[l]=e.value})):(u.issues.length&&r.issues.push(...Re(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`&&yn.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=>He(e,i,pt())),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(...Re(n,e.issues)),r.value[u]=e.value})):(d.issues.length&&r.issues.push(...Re(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}}),Gr=S(`$ZodEnum`,(e,t)=>{C.init(e,t);let n=v(t.entries),r=new Set(n);e._zod.values=r,x(e,`pattern`,e=>{let t=v(e.def.entries).filter(e=>be.has(typeof e));return RegExp(t.length?`^(${t.map(e=>xe(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}}),Kr=S(`$ZodLiteral`,(e,t)=>{C.init(e,t);let n=new Set(t.values);e._zod.values=n,x(e,`pattern`,e=>{let t=e.def.values;return RegExp(t.length?`^(${t.map(e=>typeof e==`string`?xe(e):e?xe(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}}),qr=S(`$ZodTransform`,(e,t)=>{C.init(e,t),e._zod.optin=`optional`,ft.memoizer?.guard(e),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new dt(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 ut;return n.value=i,n}});function Jr(e,t){return e.value=t.issues.length?void 0:t.value,e}var Yr=S(`$ZodOptional`,(e,t)=>{C.init(e,t),x(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),e._zod.optout=`optional`,x(e,`values`,e=>{let t=e.def.innerType._zod.values;return t?new Set([...t,void 0]):void 0}),x(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ie(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=>Jr(e,t)):Jr(e,r)}return t.innerType._zod.run(e,n)}}),Xr=S(`$ZodExactOptional`,(e,t)=>{Yr.init(e,t),x(e,`values`,e=>e.def.innerType._zod.values),x(e,`pattern`,e=>e.def.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Zr=S(`$ZodNullable`,(e,t)=>{C.init(e,t),x(e,`optin`,e=>e.def.innerType._zod.optin),x(e,`optout`,e=>e.def.innerType._zod.optout),x(e,`pattern`,e=>{let t=e.def.innerType._zod.pattern;return t?RegExp(`^(${ie(t.source)}|null)$`):void 0}),x(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)}),Qr=S(`$ZodDefault`,(e,t)=>{C.init(e,t),e._zod.optin=`defaulted`,x(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=>$r(e,t)):$r(r,t)}});function $r(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var ei=S(`$ZodPrefault`,(e,t)=>{C.init(e,t),e._zod.optin=`defaulted`,x(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))}),ti=S(`$ZodNonOptional`,(e,t)=>{C.init(e,t),x(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=>ni(t,e)):ni(i,e)}});function ni(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 ri(e,t,n,r){return t.issues.length?(e.value=n.catchValue({...t,value:e.value,error:{issues:t.issues.map(e=>He(e,r,pt()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var ii=S(`$ZodCatch`,(e,t)=>{C.init(e,t),x(e,`optin`,e=>e.def.innerType._zod.optin===`defaulted`?`defaulted`:`optional`),x(e,`optout`,e=>e.def.innerType._zod.optout),x(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=>ri(e,r,t,n)):ri(e,r,t,n)}}),ai=S(`$ZodPipe`,(e,t)=>{C.init(e,t),x(e,`values`,e=>e.def.in._zod.values),x(e,`optin`,e=>e.def.in._zod.optin),x(e,`optout`,e=>e.def.out._zod.optout),x(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=>oi(e,t.in,n)):oi(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>oi(e,t.out,n)):oi(r,t.out,n)}});function oi(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 si=S(`$ZodReadonly`,(e,t)=>{C.init(e,t),x(e,`propValues`,e=>e.def.innerType._zod.propValues),x(e,`values`,e=>e.def.innerType._zod.values),x(e,`optin`,e=>e.def.innerType?._zod?.optin),x(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(ci):ci(r)}});function ci(e){return e.memo||(e.value=Object.freeze(e.value)),e}var li=S(`$ZodCustom`,(e,t)=>{Cn.init(e,t),C.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=>ui(t,n,r,e));ui(i,n,r,e)}});function ui(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 di=class extends Error{constructor(){super(`Cannot parse a reference cycle that closes through a transform`),this.name=`ZodCyclicError`}},fi=`~memo`,pi=[];function mi(e){return typeof e==`object`&&!!e}function hi(e){return e.map(e=>e.path?{...e,path:e.path.slice()}:{...e})}var gi=new WeakMap,_i=0,vi=1,yi=2;function bi(e,t,n){let r=gi.get(e);if(r!==void 0)return r?yi:_i;if(t.has(e))return yi;t.add(e);let i=_i,a=e=>{if(i!==yi&&e?._zod){let r=bi(e,t,n);r>i&&(i=r)}},o=(e,r)=>{let i=_i;for(let a of Reflect.ownKeys(e)){let o=Object.getOwnPropertyDescriptor(e,a);if(r&&!o.enumerable)continue;let s=o.get?vi:o.value?._zod?bi(o.value,t,n):_i;s>i&&(i=s)}return i},s=e=>{e>i&&(i=e)},c=e._zod.def;switch(c.type){case`object`:{let e=oe(c);s(e?o(e,!0):vi),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?bi(r,t,!1):vi);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),xi(e,i)}function xi(e,t){return t!==vi&&gi.set(e,t===yi),t}function Si(e,t){let n=e.buckets.get(t);return n||(n=new WeakMap,e.buckets.set(t,n)),n}var Ci,wi=[],Ti={alloc(e,t,n){let r=Ci;if(!r)return n;Ci=void 0;let i={value:n,issues:null};return r.set(t.value,i),wi.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`&&Di(n,e.value))throw new di;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=bi(e,new Set,!1);if(i===_i)return e._zod.parse=t,e._zod.run===o&&(e._zod.run=t),t(s,c);i===yi||r?n=!0:r=!0}let l=s.value;if(!mi(l))return t(s,c);let u=c[fi];u||(u={buckets:new WeakMap,backEdges:void 0},c[fi]=u);let d;i===c?d=a:(d=Si(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(...hi(f.issues)):(s.memo=!0,u.backEdges??(u.backEdges=new WeakSet),u.backEdges.add(f.value)),s;Ci=d;let p=wi.length,m=t(s,c);Ci=void 0;let h=wi.length>p?wi.pop():void 0;return m instanceof Promise?m.then(e=>(h&&(h.issues=e.issues.length?hi(e.issues):pi),e)):(h&&(h.issues=m.issues.length?hi(m.issues):pi),m)};e._zod.parse=o,e._zod.run===t&&(e._zod.run=o)})}};function Ei(){return Ti}function Di(e,t){let n=e[fi]?.backEdges;return n!==void 0&&mi(t)&&n.has(t)}var Oi=()=>{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(Ke(e.input),e.input)}`;case`invalid_value`:return e.values.length===1?`Invalid input: expected ${Ce(e.values[0])}`:`Invalid option: expected one of ${y(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`:``}: ${y(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 ki(){return{localeError:Oi()}}var Ai,ji=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 Mi(){return new ji}(Ai=globalThis).__zod_globalRegistry??(Ai.__zod_globalRegistry=Mi());var Ni=globalThis.__zod_globalRegistry;function Pi(e){return e.checks&&=[...e.checks],e}function Fi(e,t){return new e(Pi({type:`string`,...b(t)}))}function Ii(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...b(t)})}function Li(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...b(t)})}function Ri(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...b(t)})}function zi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...b(t)})}function Bi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...b(t)})}function Vi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...b(t)})}function Hi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...b(t)})}function Ui(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...b(t)})}function Wi(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...b(t)})}function Gi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...b(t)})}function Ki(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...b(t)})}function qi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...b(t)})}function Ji(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...b(t)})}function Yi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...b(t)})}function Xi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...b(t)})}function Zi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...b(t)})}function Qi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...b(t)})}function $i(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...b(t)})}function ea(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...b(t)})}function ta(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...b(t)})}function na(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...b(t)})}function ra(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...b(t)})}function ia(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...b(t)})}function aa(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...b(t)})}function oa(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...b(t)})}function sa(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...b(t)})}function ca(e,t){return new e({type:`boolean`,...b(t)})}function la(e){return new e({type:`unknown`})}function ua(e,t){return new e({type:`never`,...b(t)})}function da(e,t){return new Tn({check:`max_length`,...b(t),maximum:e})}function fa(e,t){return new En({check:`min_length`,...b(t),minimum:e})}function pa(e,t){return new Dn({check:`length_equals`,...b(t),length:e})}function ma(e,t){return new kn({check:`string_format`,format:`regex`,...b(t),pattern:e})}function ha(e){return new An({check:`string_format`,format:`lowercase`,...b(e)})}function ga(e){return new jn({check:`string_format`,format:`uppercase`,...b(e)})}function _a(e,t){return new Mn({check:`string_format`,format:`includes`,...b(t),includes:e})}function va(e,t){return new Nn({check:`string_format`,format:`starts_with`,...b(t),prefix:e})}function ya(e,t){return new Pn({check:`string_format`,format:`ends_with`,...b(t),suffix:e})}function ba(e){return new Fn({check:`overwrite`,tx:e})}function xa(e){return ba(t=>t.normalize(e))}function Sa(){return ba(e=>e.trim())}function Ca(){return ba(e=>e.toLowerCase())}function wa(){return ba(e=>e.toUpperCase())}function Ta(){return ba(e=>me(e))}function Ea(e,t,n){return new e({type:`array`,element:t,...b(n)})}function Da(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...b(n)})}function Oa(e,t){let n=ka(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 ka(e,t){let n=new Cn({check:`custom`,...b(t)});return n._zod.check=e,n}function Aa(e,...t){for(let n of t)for(let t of Reflect.ownKeys(n))Object.prototype.propertyIsEnumerable.call(n,t)&&ae(e,t,n[t]);return e}function ja(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??Ni,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 Ma(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 T(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,T(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Aa(o.schema,c),t.io===`input`&&E(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 Na(e){return e.replace(/~/g,`~0`).replace(/\//g,`~1`)}function Pa(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}/${Na(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+Na(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 Fa(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;Fa(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 Ia=new Set([`type`,`properties`,`required`,`additionalProperties`]),La=[`oneOf`,`anyOf`];function Ra(e){let t=e.additionalProperties;return t===void 0||t===!1||typeof t!=`object`||!t?null:Object.keys(t).length?t:null}function za(e){let t=[];for(let n of e){if(typeof n!=`object`||n.type!==`object`)return null;for(let e in n)if(!Ia.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]??Ra(n);t!=null&&(e.some(e=>JSON.stringify(e)===JSON.stringify(t))||e.push(t))}ae(n,r,e.length===1?e[0]:za(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=Ra(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 Ba(e){let t=e.allOf;if(!Array.isArray(t)||t.length<2)return;for(let t of Ia)if(t in e)return;let n=t.filter(e=>La.some(t=>Array.isArray(e[t]))),r=null;if(!n.length)r=za(t);else{let e=n[0],i=La.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=>za([...a,e]));if(o.some(e=>!e))return;r={[i]:o}}r&&(delete e.allOf,Aa(e,r))}function Va(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)):Aa(i,s),Aa(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())Fa(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)??[])Ba(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)}Aa(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,ae(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:Ua(t,`input`,e.processors),output:Ua(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function E(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 E(r.element,n);if(r.type===`set`)return E(r.valueType,n);if(r.type===`lazy`)return E(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 E(r.innerType,n);if(r.type===`intersection`)return E(r.left,n)||E(r.right,n);if(r.type===`record`||r.type===`map`)return E(r.keyType,n)||E(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:E(r.in,n)||E(r.out,n);if(r.type===`object`){for(let e in r.shape)if(E(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(E(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(E(e,n))return!0;return!!(r.rest&&E(r.rest,n))}return!1}var Ha=(e,t={})=>n=>{let r=ja({...n,processors:t});return T(e,r),Pa(r,e),Va(r,e)},Ua=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ja({...i??{},target:a,io:t,processors:n});return T(e,o),Pa(o,e),Va(o,e)},Wa=(e,t,n)=>{(e[t]===void 0||n>e[t])&&(e[t]=n)},Ga=(e,t,n)=>{(e[t]===void 0||n<e[t])&&(e[t]=n)},Ka=(e,t)=>{Wa(e,`minimum`,t),Ga(e,`maximum`,t)},qa=(e,t)=>{e.multipleOf??=[],e.multipleOf.includes(t)||e.multipleOf.push(t)},Ja=(e,t)=>{e.patterns??=new Set,e.patterns.add(t)},Ya=(e,t)=>{e.mime=e.mime?e.mime.filter(e=>t.includes(e)):[...t]},Xa=(e,t)=>{e.format=t,t.includes(`int`)&&(e.isInt=!0)},Za=(e,t)=>Wa(e,`minimum`,t.minimum),Qa=(e,t)=>Ga(e,`maximum`,t.maximum),$a=e=>(t,n)=>{Xa(t,n.format);let[r,i]=e[n.format];Wa(t,`minimum`,r),Ga(t,`maximum`,i)},eo={greater_than:(e,t)=>Wa(e,t.inclusive?`minimum`:`exclusiveMinimum`,t.value),less_than:(e,t)=>Ga(e,t.inclusive?`maximum`:`exclusiveMaximum`,t.value),multiple_of:(e,t)=>qa(e,t.value),number_format:$a(Te),bigint_format:$a(Ee),min_length:Za,max_length:Qa,length_equals:(e,t)=>Ka(e,t.length),min_size:Za,max_size:Qa,size_equals:(e,t)=>Ka(e,t.size),string_format:(e,t)=>{Xa(e,t.format),t.pattern&&Ja(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)=>Ya(e,t.mime)};function to(e){let t={},n=e._zod.def,r=e._zod.traits.has(`$ZodCheck`)?[e,...n.checks??[]]:n.checks??[];for(let e of r)eo[e._zod.def.check]?.(t,e._zod.def);let i=e._zod.bag;i.minimum!==void 0&&Wa(t,`minimum`,i.minimum),i.exclusiveMinimum!==void 0&&Wa(t,`exclusiveMinimum`,i.exclusiveMinimum),i.maximum!==void 0&&Ga(t,`maximum`,i.maximum),i.exclusiveMaximum!==void 0&&Ga(t,`exclusiveMaximum`,i.exclusiveMaximum),i.multipleOf!==void 0&&qa(t,i.multipleOf),i.format!==void 0&&(t.format??=i.format,i.format.includes(`int`)&&(t.isInt=!0)),i.mime&&Ya(t,i.mime);for(let e of i.patterns??[])Ja(t,e);return t}var no={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ro=new Map([[vr,sn],[br,cn]]),io=e=>ro.get(e)??e,ao=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l,laxFormat:u}=to(e);if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=no[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(io);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)=>{n.type=`boolean`},so=(e,t,n,r)=>{n.not={}},co=(e,t,n,r)=>{let i=e._zod.def,a=v(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},lo=(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(Ma(e,t,n,r,"Literal `undefined` cannot be represented in JSON Schema"))return}else if(typeof o==`bigint`){if(Ma(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}},uo=(e,t,n,r)=>{Ma(e,t,n,r,`Custom types cannot be represented in JSON Schema`)},fo=(e,t,n,r)=>{Ma(e,t,n,r,`Transforms cannot be represented in JSON Schema`)},po=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=to(e);typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=T(a.element,t,{...r,path:[...r.path,`items`]})};function mo(e){let t=e._zod.def;return t.type===`pipe`&&t.in._zod.traits.has(`$ZodTransform`)?mo(t.out):t.type===`catch`?mo(t.innerType):e._zod.optin}var ho=(e,t,n,r)=>{let i=n,a=e._zod.def,o=a.shape;if(Object.getOwnPropertySymbols(o).length&&Ma(e,t,i,r,`Symbol keys cannot be represented in JSON Schema`))return;i.type=`object`,i.properties={};for(let e in o)ae(i.properties,e,T(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`?mo(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=T(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},go=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>T(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},_o=(e,t,n,r)=>{let i=e._zod.def,a=T(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=T(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 vo(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=vo(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=>vo(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`)?yn:vn).source),p):p}var yo=new WeakMap;function bo(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 yo.get(e)??[]){let i=e.seen.get(r),a=(i?.def??i?.schema)?.propertyNames;if(!a||a===!0||n.has(a))continue;let o=vo(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 xo=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=to(o).patterns;if(a.mode===`loose`&&s&&s.size>0){let e=T(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)ae(i.patternProperties,io(t).source,e)}else{if(t.target===`draft-07`||t.target===`draft-2020-12`){i.propertyNames=T(a.keyType,t,{...r,path:[...r.path,`propertyNames`]});let n=yo.get(t);n||(n=[],yo.set(t,n),t.deferred.push(()=>bo(t))),n.push(e)}i.additionalProperties=T(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]})}let c=o._zod.values,l=t.io===`input`&&mo(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))}},So=(e,t,n,r)=>{let i=e._zod.def,a=T(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`}]},Co=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},wo=Symbol();function To(e,t,n,r,i){let a=!1,o=JSON.stringify(e,(e,t)=>typeof t==`bigint`?(a=!0,null):t);return a?(Ma(t,n,r,i,`BigInt defaults cannot be represented in JSON Schema`),wo):JSON.parse(o)}var Eo=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o=To(i.defaultValue,e,t,n,r);o!==wo&&(n.default=o)},Do=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);if(a.ref=i.innerType,t.io!==`input`)return;let o=To(i.defaultValue,e,t,n,r);o!==wo&&(n._prefault=o)},Oo=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{Ma(e,t,n,r,`Dynamic catch values are not supported in JSON Schema`);return}n.default=o},ko=(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;T(o,t,r);let s=t.seen.get(e);s.ref=o},Ao=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},jo=(e,t,n,r)=>{let i=e._zod.def;T(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Mo=new WeakSet([Object.prototype,Error.prototype]);function No(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 Po=S(`ZodError`,(e,t)=>{bt.init(e,t),e.name=`ZodError`;let n=Object.getPrototypeOf(e);Mo.has(n)||(Mo.add(n),No(n,`format`,e=>t=>Ct(e,t)),No(n,`flatten`,e=>t=>St(e,t)),No(n,`addIssue`,e=>t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,ee,2)}),No(n,`addIssues`,e=>t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,ee,2)}),Object.defineProperty(n,"isEmpty",{configurable:!0,enumerable:!1,get(){return this.issues.length===0}}))},void 0,{Parent:Error}),Fo=Tt(Po),Io=Et(Po),Lo=Dt(Po),Ro=kt(Po),zo=Ft(Po),Bo=It(Po),Vo=Lt(Po),Ho=Rt(Po),Uo=zt(Po),Wo=Bt(Po),Go=Vt(Po),Ko=Ht(Po);function qo(){ft.localeError||pt(ki())}function Jo(){ft.memoizer||pt({memoizer:Ei()})}var D=S(`ZodType`,(e,t)=>(qo(),C.init(e,t),e.def=t,e.type=t.type,e),{check(...e){let t=this.def;return this.clone(fe(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 Se(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(cc(e,t))},superRefine(e,t){return this.check(lc(e,t))},overwrite(e){return this.check(ba(e))},optional(){return Ws(this)},exactOptional(){return Ks(this)},nullable(){return Js(this)},nullish(){return Ws(Js(this))},nonoptional(e){return ec(this,e)},array(){return A(this)},or(e){return js([this,e])},and(e){return Ns(this,e)},transform(e){return ic(this,Hs(e))},default(e){return Xs(this,e)},prefault(e){return Qs(this,e)},catch(e){return nc(this,e)},pipe(e){return ic(this,e)},readonly(){return oc(this)},describe(e){let t=this.clone();return Ni.add(t,{description:e}),t},meta(...e){if(e.length===0)return Ni.get(this);let t=this.clone();return Ni.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 Xe(this,`~standard`,{...Bn(this),jsonSchema:{input:Ua(this,`input`),output:Ua(this,`output`)}})},set"~standard"(e){Ye(this,`~standard`,e)},parse:function e(t,n){return Fo(this,t,n,{callee:e})},parseAsync:async function e(t,n){return await Io(this,t,n,{callee:e})},safeParse(e,t){return Lo(this,e,t)},async safeParseAsync(e,t){return Ro(this,e,t)},get spa(){return this?.safeParseAsync},set spa(e){Ye(this,`spa`,e)},validate(e,t){return Mt(this,e,t)},validateAsync(e,t){return Pt(this,e,t)},encode:function e(t,n){return zo(this,t,n,{callee:e})},decode:function e(t,n){return Bo(this,t,n,{callee:e})},encodeAsync:async function e(t,n){return await Vo(this,t,n,{callee:e})},decodeAsync:async function e(t,n){return await Ho(this,t,n,{callee:e})},safeEncode(e,t){return Uo(this,e,t)},safeDecode(e,t){return Wo(this,e,t)},async safeEncodeAsync(e,t){return Go(this,e,t)},async safeDecodeAsync(e,t){return Ko(this,e,t)},toJSONSchema(e){return Ha(this,{})(e)},get description(){return Ni.get(this)?.description},get _def(){return this._zod.def}}),Yo=S(`_ZodString`,(e,t)=>{Vn.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ao(e,t,n,r)},Ze({format:e=>to(e).format??null,minLength:e=>to(e).minimum??null,maxLength:e=>to(e).maximum??null},{regex(...e){return this.check(ma(...e))},includes(...e){return this.check(_a(...e))},startsWith(...e){return this.check(va(...e))},endsWith(...e){return this.check(ya(...e))},min(...e){return this.check(fa(...e))},max(...e){return this.check(da(...e))},length(...e){return this.check(pa(...e))},nonempty(...e){return this.check(fa(1,...e))},lowercase(e){return this.check(ha(e))},uppercase(e){return this.check(ga(e))},trim(){return this.check(Sa())},normalize(...e){return this.check(xa(...e))},toLowerCase(){return this.check(Ca())},toUpperCase(){return this.check(wa())},slugify(){return this.check(Ta())}})),Xo=S(`ZodString`,(e,t)=>{Vn.init(e,t),Yo.init(e,t)},{email(e){return this.check(Ii(ts,e))},url(e){return this.check(Hi(is,e))},jwt(e){return this.check(ra(bs,e))},emoji(e){return this.check(Ui(os,e))},guid(e){return this.check(Li(ns,e))},uuid(e){return this.check(Ri(rs,e))},uuidv4(e){return this.check(zi(rs,e))},uuidv6(e){return this.check(Bi(rs,e))},uuidv7(e){return this.check(Vi(rs,e))},nanoid(e){return this.check(Wi(ss,e))},cuid(e){return this.check(Gi(cs,e))},cuid2(e){return this.check(Ki(ls,e))},ulid(e){return this.check(qi(us,e))},base64(e){return this.check(ea(_s,e))},base64url(e){return this.check(ta(vs,e))},xid(e){return this.check(Ji(ds,e))},ksuid(e){return this.check(Yi(fs,e))},ipv4(e){return this.check(Xi(ps,e))},ipv6(e){return this.check(Zi(ms,e))},cidrv4(e){return this.check(Qi(hs,e))},cidrv6(e){return this.check($i(gs,e))},e164(e){return this.check(na(ys,e))},datetime(e){return this.check(ia(Zo,e))},date(e){return this.check(aa(Qo,e))},time(e){return this.check(oa($o,e))},duration(e){return this.check(sa(es,e))}});function O(e){return Fi(Xo,e)}var k=S(`ZodStringFormat`,(e,t)=>{w.init(e,t),Yo.init(e,t)}),Zo=S(`ZodISODateTime`,(e,t)=>{or.init(e,t),k.init(e,t)}),Qo=S(`ZodISODate`,(e,t)=>{sr.init(e,t),k.init(e,t)}),$o=S(`ZodISOTime`,(e,t)=>{cr.init(e,t),k.init(e,t)}),es=S(`ZodISODuration`,(e,t)=>{lr.init(e,t),k.init(e,t)}),ts=S(`ZodEmail`,(e,t)=>{Wn.init(e,t),k.init(e,t)}),ns=S(`ZodGUID`,(e,t)=>{Hn.init(e,t),k.init(e,t)}),rs=S(`ZodUUID`,(e,t)=>{Un.init(e,t),k.init(e,t)}),is=S(`ZodURL`,(e,t)=>{Qn.init(e,t),k.init(e,t)});function as(e){return Hi(is,e)}var os=S(`ZodEmoji`,(e,t)=>{$n.init(e,t),k.init(e,t)}),ss=S(`ZodNanoID`,(e,t)=>{er.init(e,t),k.init(e,t)}),cs=S(`ZodCUID`,(e,t)=>{tr.init(e,t),k.init(e,t)}),ls=S(`ZodCUID2`,(e,t)=>{nr.init(e,t),k.init(e,t)}),us=S(`ZodULID`,(e,t)=>{rr.init(e,t),k.init(e,t)}),ds=S(`ZodXID`,(e,t)=>{ir.init(e,t),k.init(e,t)}),fs=S(`ZodKSUID`,(e,t)=>{ar.init(e,t),k.init(e,t)}),ps=S(`ZodIPv4`,(e,t)=>{ur.init(e,t),k.init(e,t)}),ms=S(`ZodIPv6`,(e,t)=>{pr.init(e,t),k.init(e,t)}),hs=S(`ZodCIDRv4`,(e,t)=>{mr.init(e,t),k.init(e,t)}),gs=S(`ZodCIDRv6`,(e,t)=>{gr.init(e,t),k.init(e,t)}),_s=S(`ZodBase64`,(e,t)=>{yr.init(e,t),k.init(e,t)}),vs=S(`ZodBase64URL`,(e,t)=>{Sr.init(e,t),k.init(e,t)}),ys=S(`ZodE164`,(e,t)=>{Cr.init(e,t),k.init(e,t)}),bs=S(`ZodJWT`,(e,t)=>{Tr.init(e,t),k.init(e,t)}),xs=S(`ZodBoolean`,(e,t)=>{Er.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>oo(e,t,n,r)});function Ss(e){return ca(xs,e)}var Cs=S(`ZodUnknown`,(e,t)=>{Dr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function ws(){return la(Cs)}var Ts=S(`ZodNever`,(e,t)=>{Or.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>so(e,t,n,r)});function Es(e){return ua(Ts,e)}var Ds=S(`ZodArray`,(e,t)=>{Jo(),Mr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>po(e,t,n,r),e.element=t.element},{min(e,t){return this.check(fa(e,t))},nonempty(e){return this.check(fa(1,e))},max(e,t){return this.check(da(e,t))},length(e,t){return this.check(pa(e,t))},unwrap(){return this.element}});function A(e,t){return Ea(Ds,e,t)}var Os=S(`ZodObject`,(e,t)=>{Jo(),Rr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ho(e,t,n,r),rt(e,`shape`,e=>e._zod.def.shape,!1)},{keyof(){return Rs(Object.keys(this._zod.def.shape))},catchall(e){return this.clone(fe(this._zod.def,{catchall:e}))},passthrough(){return this.clone(fe(this._zod.def,{catchall:ws()}))},loose(){return this.clone(fe(this._zod.def,{catchall:ws()}))},strict(){return this.clone(fe(this._zod.def,{catchall:Es()}))},strip(){return this.clone(fe(this._zod.def,{catchall:void 0}))},extend(e){return Ae(this,e)},safeExtend(e){return Me(this,e)},merge(e){return Ne(this,e)},pick(e){return De(this,e)},omit(e){return ke(this,e)},partial(...e){return Pe(Us,this,e[0])},exactPartial(...e){return Pe(Gs,this,e[0],`exactPartial`)},required(...e){return Fe($s,this,e[0])}});function j(e,t){return new Os({type:`object`,shape:e??{},...b(t)})}function ks(e,t){return new Os({type:`object`,shape:e,catchall:ws(),...b(t)})}var As=S(`ZodUnion`,(e,t)=>{Br.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>go(e,t,n,r),e.options=t.options});function js(e,t){return new As({type:`union`,options:e,...b(t)})}var Ms=S(`ZodIntersection`,(e,t)=>{Vr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_o(e,t,n,r)});function Ns(e,t){return new Ms({type:`intersection`,left:e,right:t})}var Ps=S(`ZodRecord`,(e,t)=>{Jo(),Wr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xo(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function Fs(e,t,n){return!t||!t._zod?new Ps({type:`record`,keyType:O(),valueType:e,...b(t)}):new Ps({type:`record`,keyType:e,valueType:t,...b(n)})}function Is(e,t,n){return new Ps({type:`record`,keyType:e,valueType:t,...b(n),partial:!0})}var Ls=S(`ZodEnum`,(e,t)=>{Gr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>co(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 Ls({...t,checks:[],...b(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 Ls({...t,checks:[],...b(r),entries:i})}});function Rs(e,t){return new Ls({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...b(t)})}var zs=S(`ZodLiteral`,(e,t)=>{Kr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>lo(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 Bs(e,t){return new zs({type:`literal`,values:Array.isArray(e)?e:[e],...b(t)})}var Vs=S(`ZodTransform`,(e,t)=>{Jo(),qr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fo(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new dt(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 Hs(e){return new Vs({type:`transform`,transform:e})}var Us=S(`ZodOptional`,(e,t)=>{Yr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ws(e){return new Us({type:`optional`,innerType:e})}var Gs=S(`ZodExactOptional`,(e,t)=>{Xr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>jo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ks(e){return new Gs({type:`optional`,innerType:e})}var qs=S(`ZodNullable`,(e,t)=>{Zr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>So(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Js(e){return new qs({type:`nullable`,innerType:e})}var Ys=S(`ZodDefault`,(e,t)=>{Qr.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Eo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function Xs(e,t){return new Ys({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():ye(t)}})}var Zs=S(`ZodPrefault`,(e,t)=>{ei.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Do(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Qs(e,t){return new Zs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():ye(t)}})}var $s=S(`ZodNonOptional`,(e,t)=>{ti.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Co(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ec(e,t){return new $s({type:`nonoptional`,innerType:e,...b(t)})}var tc=S(`ZodCatch`,(e,t)=>{ii.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oo(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function nc(e,t){return new tc({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:at(t)})}var rc=S(`ZodPipe`,(e,t)=>{ai.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ko(e,t,n,r),e.in=t.in,e.out=t.out});function ic(e,t){return new rc({type:`pipe`,in:e,out:t})}var ac=S(`ZodReadonly`,(e,t)=>{si.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ao(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function oc(e){return new ac({type:`readonly`,innerType:e})}var sc=S(`ZodCustom`,(e,t)=>{li.init(e,t),D.init(e,t),e._zod.processJSONSchema=(t,n,r)=>uo(e,t,n,r)});function cc(e,t={}){return Da(sc,e,t)}function lc(e,t){return Oa(e,t)}var uc=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}},dc=/([PDWHMTS]{1,1})/,fc=[`weeks`,`days`,`hours`,`minutes`,`seconds`,`isNegative`],pc=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(dc))!==-1;){let e=t[n],a=t.slice(0,Math.max(0,n));t=t.slice(n+1),i+=mc(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=R(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=R(t/3600),t-=this.hours*3600,this.minutes=R(t/60),t-=this.minutes*60,this.seconds=t,this}fromData(e){for(let t of fc)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 mc(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(Dc(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:M.fromDateTimeString(r[0],n)},a=r[1];return pc.isValueString(a)?i.duration=pc.fromString(a):i.end=M.fromDateTimeString(a,n),new e(i)}static fromData(t){return new e(t)}static fromJSON(t,n,r){function i(e,t){return r?M.fromString(e,t):M.fromDateTimeString(e,t)}return pc.isValueString(t[1])?e.fromData({start:i(t[0],n),duration:pc.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 M))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 M))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 pc))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()}},M=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:I(t.slice(0,4)),month:I(t.slice(5,7)),day:I(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=P.utcTimezone:n&&(i=n.getParameter(`tzid`),n.parent&&(n.parent.name===`standard`||n.parent.name===`daylight`?r=P.localTimezone:i&&(r=n.parent.getTimeZoneByID(i))));let a={year:I(t.slice(0,4)),month:I(t.slice(5,7)),day:I(t.slice(8,10)),hour:I(t.slice(11,13)),minute:I(t.slice(14,16)),second:I(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=P.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=P.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=P.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=Tc.get(e.timezone);this.zone=t||P.localTimezone}return e&&`zone`in e&&(this.zone=e.zone),this.zone||=P.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+R((a+1)*26/10)+R(o/4);return s+=R(o/100)*6+R(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=R(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 pc.fromSeconds(t-n)}subtractDateTz(e){let t=this.toUnixTime(),n=e.toUnixTime();return pc.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&&P.convert_time(t,this.zone,e),t.zone=e,t}utcOffset(){return this.zone==P.localTimezone||this.zone==P.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+`-`+L(this.month)+`-`+L(this.day);return this.isDate||(e+=`T`+L(this.hour)+`:`+L(this.minute)+`:`+L(this.second),this.zone===P.utcTimezone&&(e+=`Z`)),e}toJSDate(){return this.zone==P.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=R(u/60),h.second<0&&(h.second+=60,o--),d=h.minute+r+o,h.minute=d%60,s=R(d/60),h.minute<0&&(h.minute+=60,s--),f=h.hour+n+s,h.hour=f%24,c=R(f/24),h.hour<0&&(h.hour+=24,c--)),h.month>12?l=R((h.month-1)/12):h.month<1&&(l=R(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=P.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}},gc=/[^ \t]/,_c=`:`,vc=`;`,yc=`=`,bc=`unknown`,xc=`text`,Sc={"^'":`"`,"^n":`
|
|
57
|
-
`,"^^":`^`};function N(e){let t={},n=t.component=[];if(t.stack=[n],N._eachLine(e,function(e,n){N._handleContentLine(n,t)}),t.stack.length>1)throw new Cc(`invalid ical body. component began but did not end`);return t=null,n.length==1?n[0]:n}N.property=function(e,t){let n={component:[[],[]],designSet:t||H.defaultSet};return N._handleContentLine(e,n),n.component[1][0]},N.component=function(e){return N(e)};var Cc=class extends Error{name=this.constructor.name};N.ParserError=Cc,N._handleContentLine=function(e,t){let n=e.indexOf(_c),r=e.indexOf(vc),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=N._parseParameters(e.slice(Math.max(0,r)),0,t.designSet),l[2]==-1)throw new Cc(`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(_c))!==-1)s=e.slice(Math.max(0,i+a+1));else throw new Cc(`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 Cc(`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:bc,delete c.value;let g;d&&f?(s=N._parseMultiValue(s,f,u,[],d,t.designSet,f),g=[h,c,u,s]):d?(g=[h,c,u],N._parseMultiValue(s,d,u,g,null,t.designSet,!1)):f?(s=N._parseMultiValue(s,f,u,[],null,t.designSet,f),g=[h,c,u,s]):(s=N._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)},N._parseValue=function(e,t,n,r){return t in n.value&&`fromICAL`in n.value[t]?n.value[t].fromICAL(e,r):e},N._parseParameters=function(e,t,n){let r=t,i=0,a=yc,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 Cc(`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:xc,c in n.param&&(f=n.param[c].multiValue,n.param[c].multiValueSeparateDQuote&&(p=N._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 Cc(`invalid line (no matching double quote) "`+e+`"`);l=e.slice(u,i),r=e.indexOf(vc,i);let t=e.indexOf(_c,i);(r===-1||t!==-1&&r>t)&&(i=!1)}else{u=i+1;let t=e.indexOf(vc,u),n=e.indexOf(_c,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=N._rfc6868Escape(l),u+=t-l.length,f){let e=p||f;l=N._parseMultiValue(l,e,d,[],null,n)}else l=N._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]},N._rfc6868Escape=function(e){return e.replace(/\^['n^]/g,function(e){return Sc[e]})},N._parseMultiValue=function(e,t,n,r,i,a,o){let s=0,c=0,l;if(t.length===0)return e;for(;(s=kc(e,t,c))!==-1;)l=e.slice(c,s),l=i?N._parseMultiValue(l,i,n,[],null,a,o):N._parseValue(l,n,a,o),r.push(l),c=s+t.length;return l=e.slice(c),l=i?N._parseMultiValue(l,i,n,[],null,a,o):N._parseValue(l,n,a,o),r.push(l),r.length==1?r[0]:r},N._eachLine=function(e,t){let n=e.length,r=e.search(gc),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 wc=[`tzid`,`location`,`tznames`,`latitude`,`longitude`],P=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 M.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 Fl)this.component=e;else{if(e&&`component`in e){if(typeof e.component==`string`){let t=N(e.component);this.component=new Fl(t)}else this.component=e.component instanceof Fl?e.component:null}for(let t of wc)e&&t in e&&(this[t]=e[t])}return this.component instanceof Fl&&!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=jc(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=jc(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=Ac(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=M.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}},F=null,Tc={get count(){return F===null?0:Object.keys(F).length},reset:function(){F=Object.create(null);let e=P.utcTimezone;F.Z=e,F.UTC=e,F.GMT=e},_hard_reset:function(){F=null},has:function(e){return F!==null&&!!F[e]},get:function(e){return F===null&&this.reset(),F[e]},register:function(e,t){if(F===null&&this.reset(),typeof e==`string`&&t instanceof P&&([e,t]=[t,e]),t||(e instanceof P?t=e.tzid:e.name===`vtimezone`&&(e=new P(e),t=e.tzid)),!t)throw TypeError(`Neither a timezone nor a name was passed`);if(e instanceof P)F[t]=e;else throw TypeError(`timezone must be ICAL.Timezone or ICAL.Component`)},remove:function(e){return F===null?null:delete F[e]}};function Ec(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]&&Tc.has(t)&&e.addSubcomponent(Tc.get(t).component);return e}function Dc(e){return typeof e==`number`&&isNaN(e)}function I(e){let t=parseInt(e,10);if(Dc(t))throw Error(`Could not extract integer from "`+e+`"`);return t}function Oc(e,t){if(e!==void 0)return e instanceof t?e:new t(e)}function kc(e,t,n){for(;(n=e.indexOf(t,n))!==-1;)if(n>0&&e[n-1]===`\\`)n+=1;else return n;return-1}function Ac(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 jc(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?jc(e[r],!0):e[r]);return n}{let n={};for(let[r,i]of Object.entries(e))n[r]=t?jc(i,!0):i;return n}}function Mc(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<zl.foldLength+1?r+=e>65535?2:1:(t+=zl.newLineChar+` `+n.slice(0,Math.max(0,r)),n=n.slice(Math.max(0,r)),r=i=0)}return t.slice(zl.newLineChar.length+1)}function L(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 R(e){return e<0?Math.ceil(e):Math.floor(e)}function Nc(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 Pc=Object.freeze({__proto__:null,binsearchInsert:Ac,clone:jc,extend:Nc,foldline:Mc,formatClassType:Oc,isStrictlyNaN:Dc,pad2:L,strictParseInt:I,trunc:R,unescapedIndexOf:kc,updateTimezones:Ec}),Fc=class e{static fromString(t){let n={};return n.factor=t[0]===`+`?1:-1,n.hours=I(t.slice(1,3)),n.minutes=I(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=R(t/3600),t-=this.hours*3600,this.minutes=R(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?`+`:`-`)+L(this.hours)+`:`+L(this.minutes)}},Ic=class e extends M{static fromDateAndOrTimeString(t,n){function r(e,t,n){return e?I(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`?P.utcTimezone:c&&c[3]==`:`?Fc.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 Fc?this.zone.toSeconds():M.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?L(e)+(s||c?`-`:``):s||c?`--`:``)+(s?L(t):``)+(c?`-`+L(n):``),p=(l?L(r):`-`)+(l&&u?`:`:``)+(u?L(i):``)+(!l&&!u?`-`:``)+(u&&d?`:`:``)+(d?L(a):``),m;switch(m=this.zone===P.utcTimezone?`Z`:this.zone instanceof Fc?this.zone.toString():this.zone===P.localTimezone?``:this.zone instanceof P?Fc.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}},Lc=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=Oc(e.rule,Wc),!this.rule)throw Error(`iterator requires a (ICAL.Recur) rule`);if(this.dtstart=Oc(e.dtstart,M),!this.dtstart)throw Error(`iterator requires a (ICAL.Time) dtstart`);if(this.by_data=e.by_data?e.by_data:jc(this.rule.parts,!0),e.occurrence_number&&(this.occurrence_number=e.occurrence_number),this.days=e.days||[],e.last&&(this.last=Oc(e.last,M)),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 Rc)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=[Wc.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 Rc}if(this.rule.freq==`MONTHLY`){if(this.has_by_data(`BYDAY`)){let e=null,t=this.last.clone(),n=M.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=M.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 Rc}}}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=M.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=M.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=M.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=M.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=M.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 M;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=M.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&&!M.isLeapYear(this.last.year))return 0;e<1&&(e+=1,t+=1);let n=M.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=Wc.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=M.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=R(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=R(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 M;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=M.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=M.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=M.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=M.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=M.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=M.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=M.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=M.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=M.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`,Wc.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}},Rc=class extends Error{constructor(){super(`Recurrence rule has no valid occurrences`)}},zc=/^(SU|MO|TU|WE|TH|FR|SA)$/,Bc=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,Vc={SU:M.SUNDAY,MO:M.MONDAY,TU:M.TUESDAY,WE:M.WEDNESDAY,TH:M.THURSDAY,FR:M.FRIDAY,SA:M.SATURDAY},Hc=Object.fromEntries(Object.entries(Vc).map(e=>e.reverse())),Uc=[`SECONDLY`,`MINUTELY`,`HOURLY`,`DAILY`,`WEEKLY`,`MONTHLY`,`YEARLY`],Wc=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 qc){let e=c.split(`,`),t=new Set;for(let n of e)t.add(qc[a](n));e=[...t],n[s]=e.length==1?e[0]:e}else a in Kc?Kc[a](c,n,t):n[o]=c}return n}static icalDayToNumericDay(e,t){let n=t||M.SUNDAY;return(Vc[e]-n+7)%7+1}static numericDayToIcalDay(e,t){let n=e+(t||M.SUNDAY)-M.SUNDAY;return n>7&&(n-=7),Hc[n]}constructor(e){this.wrappedJSObject=this,this.parts={},e&&typeof e==`object`&&this.fromData(e)}parts=null;interval=1;wkst=M.MONDAY;until=null;count=null;freq=null;icalclass=`icalrecur`;icaltype=`recur`;iterator(e){return new Lc({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 qc?Array.isArray(t[e])?this.parts[n]=t[e]:this.parts[n]=[t[e]]:this[e]=t[e]}this.interval&&typeof this.interval!=`number`&&Kc.INTERVAL(this.interval,this),this.wkst&&typeof this.wkst!=`number`&&(this.wkst=e.icalDayToNumericDay(this.wkst)),this.until&&!(this.until instanceof M)&&(this.until=M.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()]=jc(n);return this.until&&(t.until=this.until.toString()),`wkst`in this&&this.wkst!==M.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!==M.DEFAULT_WEEK_START&&(t+=`;WKST=`+e.numericDayToIcalDay(this.wkst)),t}};function Gc(e,t,n,r){let i=r;if(r[0]===`+`&&(i=r.slice(1)),i=I(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 Kc={FREQ:function(e,t,n){if(Uc.indexOf(e)!==-1)t.freq=e;else throw Error(`invalid frequency "`+e+`" expected: "`+Uc.join(`, `)+`"`)},COUNT:function(e,t,n){t.count=I(e)},INTERVAL:function(e,t,n){t.interval=I(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=M.fromString(t.until))},WKST:function(e,t,n){if(zc.test(e))t.wkst=Wc.icalDayToNumericDay(e);else throw Error(`invalid WKST value "`+e+`"`)}},qc={BYSECOND:Gc.bind(void 0,`BYSECOND`,0,60),BYMINUTE:Gc.bind(void 0,`BYMINUTE`,0,59),BYHOUR:Gc.bind(void 0,`BYHOUR`,0,23),BYDAY:function(e){if(Bc.test(e))return e;throw Error(`invalid BYDAY value "`+e+`"`)},BYMONTHDAY:Gc.bind(void 0,`BYMONTHDAY`,-31,31),BYYEARDAY:Gc.bind(void 0,`BYYEARDAY`,-366,366),BYWEEKNO:Gc.bind(void 0,`BYWEEKNO`,-53,53),BYMONTH:Gc.bind(void 0,`BYMONTH`,1,12),BYSETPOS:Gc.bind(void 0,`BYSETPOS`,-366,366)},Jc=/\\\\|\\;|\\,|\\[Nn]/g,Yc=/\\|;|,|\n/g,Xc=/\\\\|\\,|\\[Nn]/g,Zc=/\\|,|\n/g;function Qc(e,t){return{matches:/.*/,fromICAL:function(t,n){return cl(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 z={defaultType:`text`},$c={defaultType:`text`,multiValue:`,`},el={defaultType:`text`,structuredValue:`;`},tl={defaultType:`integer`},nl={defaultType:`date-time`,allowedTypes:[`date-time`,`date`]},rl={defaultType:`date-time`},B={defaultType:`uri`},il={defaultType:`utc-offset`},al={defaultType:`recur`},ol={defaultType:`date-and-or-time`,allowedTypes:[`date-time`,`date`,`text`]};function sl(e){switch(e){case`\\\\`:return`\\`;case`\\;`:return`;`;case`\\,`:return`,`;case`\\n`:case`\\N`:return`
|
|
60
|
-
`;default:return e}}function cl(e,t,n){return e.indexOf(`\\`)===-1?e:(n&&(t=RegExp(t.source+`|\\\\`+n,t.flags)),e.replace(t,sl))}var ll={categories:$c,url:B,version:z,uid:z},ul={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 Dc(t)?0:t},toICAL:function(e){return String(e)}},integer:{fromICAL:function(e){let t=parseInt(e);return Dc(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 Fc.fromString(e)},undecorate:function(e){return e.toString()}}},dl={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=Nc(ul,{text:Qc(Jc,Yc),uri:{},binary:{decorate:function(e){return uc.fromString(e)},undecorate:function(e){return e.toString()}},"cal-address":{},date:{decorate:function(e,t){return H.strict?M.fromDateString(e,t):M.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?M.fromDateTimeString(e,t):M.fromString(e,t)},undecorate:function(e){return e.toString()}},duration:{decorate:function(e){return pc.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]),pc.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]),pc.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 Wc._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=Wc.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 Wc.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}}}),fl=Nc(ll,{action:z,attach:{defaultType:`uri`},attendee:{defaultType:`cal-address`},calscale:z,class:z,comment:z,completed:rl,contact:z,created:rl,description:z,dtend:nl,dtstamp:rl,dtstart:nl,due:nl,duration:{defaultType:`duration`},exdate:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`],multiValue:`,`},exrule:al,freebusy:{defaultType:`period`,multiValue:`,`},geo:{defaultType:`float`,structuredValue:`;`},"last-modified":rl,location:z,method:z,organizer:{defaultType:`cal-address`},"percent-complete":tl,priority:tl,prodid:z,"related-to":z,repeat:tl,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":nl,resources:$c,"request-status":el,rrule:al,sequence:tl,status:z,summary:z,transp:z,trigger:{defaultType:`duration`,allowedTypes:[`duration`,`date-time`]},tzoffsetfrom:il,tzoffsetto:il,tzurl:B,tzid:z,tzname:z}),pl=Nc(ul,{text:Qc(Xc,Zc),uri:Qc(Xc,Zc),date:{decorate:function(e){return Ic.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 Ic.fromDateAndOrTimeString(`T`+e,`time`)},undecorate:function(e){return e.toString()},fromICAL:function(e){let t=pl.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=pl.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 Ic.fromDateAndOrTimeString(e,`date-time`)},undecorate:function(e){return e.toString()},fromICAL:function(e){return pl[`date-and-or-time`].fromICAL(e)},toICAL:function(e){return pl[`date-and-or-time`].toICAL(e)}},"date-and-or-time":{decorate:function(e){return Ic.fromDateAndOrTimeString(e,`date-and-or-time`)},undecorate:function(e){return e.toString()},fromICAL:function(e){let t=e.split(`T`);return(t[0]?pl.date.fromICAL(t[0]):``)+(t[1]?`T`+pl.time.fromICAL(t[1]):``)},toICAL:function(e){let t=e.split(`T`);return pl.date.toICAL(t[0])+(t[1]?`T`+pl.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(``)}}}),ml={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}},hl=Nc(ll,{adr:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},anniversary:ol,bday:ol,caladruri:B,caluri:B,clientpidmap:el,email:z,fburl:B,fn:z,gender:el,geo:B,impp:B,key:B,kind:z,lang:{defaultType:`language-tag`},logo:B,member:B,n:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},nickname:$c,note:z,org:{defaultType:`text`,structuredValue:`;`},photo:B,related:B,rev:{defaultType:`timestamp`},role:z,sound:B,source:B,tel:{defaultType:`uri`,allowedTypes:[`uri`,`text`]},title:z,tz:{defaultType:`text`,allowedTypes:[`text`,`utc-offset`,`uri`]},xml:z}),gl=Nc(ul,{binary:V.binary,date:pl.date,"date-time":pl[`date-time`],"phone-number":pl[`phone-number`],uri:V.uri,text:pl.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 Fc.fromString(e)},undecorate:function(e){return e.toString()}}}),_l={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}},vl=Nc(ll,{fn:z,n:{defaultType:`text`,structuredValue:`;`,multiValue:`,`},nickname:$c,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:z,tel:{defaultType:`phone-number`},email:z,mailer:z,tz:{defaultType:`utc-offset`,allowedTypes:[`utc-offset`,`text`]},geo:{defaultType:`float`,structuredValue:`;`},title:z,role:z,logo:{defaultType:`binary`,allowedTypes:[`binary`,`uri`]},agent:{defaultType:`vcard`,allowedTypes:[`vcard`,`text`,`uri`]},org:el,note:$c,prodid:z,rev:{defaultType:`date-time`,allowedTypes:[`date-time`,`date`],detectType:function(e){return e.indexOf(`T`)===-1?`date`:`date-time`}},"sort-string":z,sound:{defaultType:`binary`,allowedTypes:[`binary`,`uri`]},class:z,key:{defaultType:`binary`,allowedTypes:[`binary`,`text`]}}),yl={name:`ical`,value:V,param:dl,property:fl,propertyGroups:!1},bl={name:`vcard4`,value:pl,param:ml,property:hl,propertyGroups:!0},xl={name:`vcard3`,value:gl,param:_l,property:vl,propertyGroups:!0},H={strict:!0,defaultSet:yl,defaultType:`unknown`,components:{vcard:bl,vcard3:xl,vevent:yl,vtodo:yl,vjournal:yl,valarm:yl,vtimezone:yl,daylight:yl,standard:yl},icalendar:yl,vcard:bl,vcard3:xl,getDesignSet:function(e){return e&&e in H.components?H.components[e]:H.defaultSet}},Sl=`\r
|
|
61
|
-
`,Cl=`unknown`,wl={'"':`^'`,"\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])+Sl;return r}U.component=function(e,t){let n=e[0].toUpperCase(),r=`BEGIN:`+n+Sl,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)+Sl;let c=e[2]||[],l=0,u=c.length;for(;l<u;l++)r+=U.component(c[l],t)+Sl;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===Cl&&(f=!0)):c===Cl&&(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:Mc(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 wl[e]})};var Tl=0,El=1,Dl=2,Ol=3,kl=class e{static fromString(t,n){return new e(N.property(t,n))}constructor(e,t){this._parent=t||null,typeof e==`string`?(this.jCal=[e,{},H.defaultType],this.jCal[Dl]=this.getDefaultType()):this.jCal=e,this._updateType()}get type(){return this.jCal[Dl]}get name(){return this.jCal[Tl]}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[Dl]=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<=Ol+e?null:this.isDecorated?(this._values||=[],this._values[e]=this._decorate(this.jCal[Ol+e])):this.jCal[Ol+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[Ol+t]=this._undecorate(e),this._values[t]=e):(this.jCal[Ol+t]=e,this._values[t]=this._decorate(e))}getParameter(e){if(e in this.jCal[El])return this.jCal[El][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[El][e]=t}removeParameter(e){delete this.jCal[El][e]}getDefaultType(){let e=this.jCal[Tl],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[Dl]=e,this._updateType()}getFirstValue(){return this._hydrateValue(0)}getValues(){let e=this.jCal.length-Ol;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[Ol+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[Ol]=e}toJSON(){return this.jCal}toICALString(){return U.property(this.jCal,this._designSet,!0)}},Al=0,jl=1,Ml=2,Nl=0,Pl=3,Fl=class e{static fromString(t){return new e(N.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[Al]}get _designSet(){let e=this.parent&&this.parent._designSet;if(!e&&this.name==`vcard`){let e=this.jCal[jl]?.[0];if(e&&e[Nl]==`version`&&e[Pl]==`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[Ml][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 kl(this.jCal[jl][e],this);return this._hydratedPropertyCount++,this._properties[e]=t}getFirstSubcomponent(e){if(e){let t=0,n=this.jCal[Ml],r=n.length;for(;t<r;t++)if(n[t][Al]===e)return this._hydrateComponent(t)}else if(this.jCal[Ml].length)return this._hydrateComponent(0);return null}getAllSubcomponents(e){let t=this.jCal[Ml].length,n=0;if(e){let r=this.jCal[Ml],i=[];for(;n<t;n++)e===r[n][Al]&&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[jl],n=t.length,r=0;for(;r<n;r++)if(t[r][Al]===e)return!0;return!1}getFirstProperty(e){if(e){let t=0,n=this.jCal[jl],r=n.length;for(;t<r;t++)if(n[t][Al]===e)return this._hydrateProperty(t)}else if(this.jCal[jl].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[jl].length,n=0;if(e){let r=this.jCal[jl],i=[];for(;n<t;n++)e===r[n][Al]&&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][Al]===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][Al]===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[Ml].push(e.jCal);return this._components[t-1]=e,this._hydratedComponentCount++,e.parent=this,e}removeSubcomponent(e){let t=this._removeObject(Ml,`_components`,e);return t&&this._hydratedComponentCount--,t}removeAllSubcomponents(e){let t=this._removeAllObjects(Ml,`_components`,e);return this._hydratedComponentCount=0,t}addProperty(e){if(!(e instanceof kl))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[jl].push(e.jCal);return this._properties[t-1]=e,this._hydratedPropertyCount++,e.parent=this,e}addPropertyWithValue(e,t){let n=new kl(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(jl,`_properties`,e);return t&&this._hydratedPropertyCount--,t}removeAllProperties(e){let t=this._removeAllObjects(jl,`_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 P({component:n,tzid:e});return this._timezoneCache.set(e,t),t}return null}},Il=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=Oc(e.dtstart,M);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=Oc(e.last,M)||t.clone(),!e.ruleIterators)throw Error(`.ruleIterators or .component must be given`);this.ruleIterators=e.ruleIterators.map(function(e){return Oc(e,Lc)}),this.ruleDateInc=e.ruleDateInc,this.exDateInc=e.exDateInc,e.ruleDates&&(this.ruleDates=e.ruleDates.map(e=>Oc(e,M)),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.exDates&&(this.exDates=e.exDates.map(e=>Oc(e,M)),this.exDate=this.exDates[this.exDateInc]),e.complete!==void 0&&(this.complete=e.complete)}}_compare_special(e,t){return!e.isDate&&t.isDate?new M({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=Ac(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=Ac(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=Ac(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}},Ll=class e{constructor(e,t){e instanceof Fl||(t=e,e=null),this.component=e||new Fl(`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 Fl&&(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=Ac(this.rangeExceptions,e,Rl);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=Ac(this.rangeExceptions,[t],Rl);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(P.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 Il({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 kl(e),this.component.addProperty(n)),t.zone===P.localTimezone||t.zone===P.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 Rl(e,t){return e[0]>t[0]?1:t[0]>e[0]?-1:0}var zl={foldLength:75,debug:!1,newLineChar:`\r
|
|
63
|
-
`,Binary:uc,Component:Fl,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=N(e)),e instanceof Fl||(e=new Fl(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 P({tzid:e,component:i}))}break;case`vevent`:this.parseEvent&&this.onevent(new Ll(i));break;default:continue}this.oncomplete()}},Duration:pc,Event:Ll,Period:hc,Property:kl,Recur:Wc,RecurExpansion:Il,RecurIterator:Lc,Time:M,Timezone:P,TimezoneService:Tc,UtcOffset:Fc,VCardTime:Ic,parse:N,stringify:U,design:H,helpers:Pc},Bl=[`mo`,`tu`,`we`,`th`,`fr`,`sa`,`su`],Vl=/^(\d{4})-(\d{2})-(\d{2})$/,Hl=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/;function Ul(e){let t=Hl.exec(e)??Vl.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 Wl(e){return Vl.test(e)}function Gl(e){return!!e&&typeof e==`object`&&typeof e.start==`string`}function Kl(e){if(!Gl(e))return`must have a start date`;let{start:t,end:n,repeat:r}=e,i=Ul(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=Ul(n);if(e===void 0||Wl(n)!==Wl(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=>!Bl.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&&(!Vl.test(r.until)||Ul(r.until)===void 0))return`must stop repeating on a date written as YYYY-MM-DD`;if(r.skip!==void 0&&(!Array.isArray(r.skip)||r.skip.some(e=>!Vl.test(e)||Ul(e)===void 0)))return`must skip dates written as YYYY-MM-DD`}}var ql=[`background`,`foreground`,`primary`,`primaryForeground`,`secondary`,`secondaryForeground`,`muted`,`mutedForeground`,`accent`,`accentForeground`,`border`],Jl=O().regex(/^[#a-zA-Z0-9(),.%\s/+-]{1,100}$/,`must be a CSS color, such as #1e3a8a or rgb(30 58 138)`),Yl=O().regex(/^[a-zA-Z0-9 ]{1,60}$/,`must be a font name, such as Inter or Cinzel Decorative`),Xl=O().regex(/^[a-z0-9-]{1,60}$/,`must be a code theme's name, such as github-light`),Zl=[`sans-serif`,`serif`,`display`,`handwriting`,`monospace`],Ql=O().regex(/^\d*\.?\d+(px|rem|em)?$/,`must be a size, such as 0.5rem or 8px`),$l=O().regex(/^gf-[a-z0-9]+(?:-[a-z0-9]+)*$/,`must be a part's name, such as gf-card-title`),eu=O().max(1e3).regex(/^[^<>\p{Cc}]*$/u,`must be CSS classes, such as rounded-xl shadow-sm`),tu=j({colors:Is(Rs(ql),Jl).default({}),darkMode:Ss().optional(),darkColors:Is(Rs(ql),Jl).optional(),fonts:j({heading:Yl.optional(),body:Yl.optional(),headingCategory:Rs(Zl).optional(),bodyCategory:Rs(Zl).optional()}).default({}),radius:Ql.optional(),code:j({light:Xl.optional(),dark:Xl.optional(),background:Rs([`theme`,`site`]).optional()}).optional(),parts:Fs($l,eu).optional()}),nu=O().regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/,`must be a language's code, such as es or pt-BR`),ru=j({title:O().optional(),description:O().optional(),titleTemplate:O().optional()}),iu=j({version:Bs(1),title:O().default(`My site`),description:O().default(``),url:as({protocol:/^https?$/}).optional(),noIndex:Ss().optional(),language:O().default(`en`),languageName:O().optional(),languages:A(j({code:nu,name:O().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:Fs(O(),ru).optional(),favicon:O().optional(),logo:j({src:O(),alt:O().default(``),darkSrc:O().optional()}).optional(),titleTemplate:O().default(`%s`),socialImage:O().optional(),externalLinksInNewTab:Ss().optional(),timeZone:O().optional(),contact:j({address:O().optional(),phone:O().optional(),email:O().optional()}).optional(),forms:j({service:Rs([`web3forms`,`formspree`,`other`]).default(`web3forms`),accessKey:O().optional(),address:O().optional(),captcha:Ss().optional()}).optional(),theme:tu.default({colors:{},fonts:{}})}),au=j({label:O(),href:O()}),ou=au.extend({children:A(au).optional()}),su=j({version:Bs(1),menus:Fs(O(),A(ou)).default({}),languages:Fs(O(),Fs(O(),A(ou))).optional()});j({version:Bs(1),automatic:Ss().default(!0),skip:A(O()).default([])});var cu=ks({type:O().min(1),props:ks({id:O().min(1)})}),lu=ks({root:ks({props:Fs(O(),ws()).optional()}).default({}),content:A(cu).default([])}),uu=O().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=>Ul(e)!==void 0,`must be a date and time that exists`),du={showFrom:uu.optional(),hideAfter:uu.optional()},fu={translationOf:O().optional(),translatedFrom:O().optional()};function pu(e,t){e.showFrom&&e.hideAfter&&e.hideAfter<=e.showFrom&&t.addIssue({code:`custom`,path:[`hideAfter`],message:`must be after showFrom`})}var mu=j({version:Bs(1),...du,...fu,data:lu}).superRefine(pu);j({version:Bs(1),data:lu});var hu=[`text`,`textarea`,`richtext`,`number`,`date`,`event`,`link`,`image`,`select`,`tags`],gu=O().regex(/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,`must use lowercase letters, numbers and hyphens, starting with a letter`),_u=j({value:O().min(1),label:O()}),vu=j({name:gu,label:O().min(1),type:Rs(hu),required:Ss().optional(),hint:O().optional(),options:A(_u).optional()}),yu=`title`,bu=j({version:Bs(1),name:O().min(1),entryName:O().min(1),path:O().optional(),languagePaths:Fs(O(),O()).optional(),fields:A(vu).min(1),sort:j({field:gu,order:Rs([`asc`,`desc`])}).optional(),markdown:j({body:gu}).optional(),calendar:j({when:gu,place:gu.optional(),summary:gu.optional()}).optional(),template:lu.default({root:{},content:[]})}).superRefine((e,t)=>{let n=new Set;if(e.fields.forEach((e,r)=>{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.fields.find(e=>e.name===`title`)?.type!==`text`&&t.addIssue({code:`custom`,path:[`fields`],message:`must include a text field named "${yu}"`}),e.path!==void 0){let n=o(e.path);n&&t.addIssue({code:`custom`,path:[`path`],message:n})}for(let[n,r]of Object.entries(e.languagePaths??{})){let e=o(r);e&&t.addIssue({code:`custom`,path:[`languagePaths`,n],message:e})}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`}))}),xu=j({version:Bs(1),...du,inLanguage:nu.optional(),...fu,fields:Fs(O(),ws()).default({})}).superRefine(pu),Su=/^\d{4}-\d{2}-\d{2}$/;function Cu(e){return typeof e==`string`&&Su.test(e)&&!Number.isNaN(Date.parse(`${e}T00:00:00Z`))}function wu(e,t){let n=[];for(let r of e){let e=t[r.name];if(e!=null)switch(r.type){case`number`:(typeof e!=`number`||!Number.isFinite(e))&&n.push(`${r.name} must be a number`);break;case`date`:e!==``&&!Cu(e)&&n.push(`${r.name} must be a date written as YYYY-MM-DD`);break;case`event`:{let t=Kl(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}var Tu=[`version`,`type`,`id`];function Eu(e,t){let n=Tu.indexOf(e),r=Tu.indexOf(t);return n!==-1||r!==-1?(n===-1?1/0:n)-(r===-1?1/0:r):e<t?-1:+(e>t)}function Du(e){if(Array.isArray(e))return e.map(Du);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort(Eu)){let r=e[n];r!==void 0&&(t[n]=Du(r))}return t}return e}function Ou(e){return`${JSON.stringify(Du(e),null,2)}\n`}function ku(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Au=ku();function ju(e){Au=e}var Mu={exec:()=>null};function Nu(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 Pu=((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:Nu(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Nu(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Nu(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Nu(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Nu(e=>RegExp(`^ {0,${e}}(?:</?(?:${Yu})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:Nu(e=>RegExp(`^ {0,${e}}>`))},Fu=/^(?:[ \t]*(?:\n|$))+/,Iu=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Lu=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ru=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,zu=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Bu=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Vu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Hu=W(Vu).replace(/bull/g,Bu).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(),Uu=W(Vu).replace(/bull/g,Bu).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(),Wu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,Gu=/^[^\n]+/,Ku=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,qu=W(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,Ku).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Ju=W(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Bu).getRegex(),Yu=`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`,Xu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Zu=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`,Xu).replace(`tag`,Yu).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Qu=e=>W(Wu).replace(`hr`,Ru).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`,Yu).getRegex(),$u=Qu(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ed=Qu(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),td={blockquote:W(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ed).getRegex(),code:Iu,def:qu,fences:Lu,heading:zu,hr:Ru,html:Zu,lheading:Hu,list:Ju,newline:Fu,paragraph:$u,table:Mu,text:Gu},nd=W(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Ru).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`,Yu).getRegex(),rd={...td,lheading:Uu,table:nd,paragraph:W(Wu).replace(`hr`,Ru).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,nd).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`,Yu).getRegex()},id={...td,html:W(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,Xu).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:Mu,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:W(Wu).replace(`hr`,Ru).replace(`heading`,` *#{1,6} *[^
|
|
64
|
-
]`).replace(`lheading`,Hu).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},ad=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,od=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,sd=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,cd=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ld=/[\p{P}\p{S}]/u,ud=/[\s\p{P}\p{S}]/u,dd=/[^\s\p{P}\p{S}]/u,fd=W(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,ud).getRegex(),pd=/[\p{Pi}\p{Ps}"']/u,md=/(?!~)[\p{P}\p{S}]/u,hd=/(?!~)[\s\p{P}\p{S}]/u,gd=/(?:[^\s\p{P}\p{S}]|~)/u,_d=W(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,Pu?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),vd=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,yd=W(vd,`u`).replace(/punct/g,ld).getRegex(),bd=W(vd,`u`).replace(/punct/g,md).getRegex(),xd=W(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,pd).replace(/punct/g,ld).getRegex(),Sd=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Cd=W(Sd,`gu`).replace(/notPunctSpace/g,dd).replace(/punctSpace/g,ud).replace(/punct/g,ld).getRegex(),wd=W(Sd,`gu`).replace(/notPunctSpace/g,gd).replace(/punctSpace/g,hd).replace(/punct/g,md).getRegex(),Td=W(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,dd).replace(/punctSpace/g,ud).replace(/punct/g,ld).getRegex(),Ed=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,dd).replace(/punctSpace/g,ud).replace(/punct/g,ld).getRegex(),Dd=W(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,dd).replace(/punctSpace/g,ud).replace(/punct/g,ld).getRegex(),Od=W(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,ld).getRegex(),kd=W(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,dd).replace(/punctSpace/g,ud).replace(/punct/g,ld).getRegex(),Ad=W(/\\(punct)/,`gu`).replace(/punct/g,ld).getRegex(),jd=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(),Md=W(Xu).replace(`(?:-->|$)`,`-->`).getRegex(),Nd=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`,Md).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Pd=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,Fd=W(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Pd).getRegex(),Id=W(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,Fd).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Ld=W(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Fd).replace(`ref`,Ku).getRegex(),Rd=W(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ku).getRegex(),zd=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Bd=W(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Pd).getRegex(),Vd=W(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,W(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Bd).replace(`ref`,zd).getRegex()).replace(`nolink`,W(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,zd).getRegex()).getRegex(),Hd=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ud=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(),Wd={_backpedal:Mu,anyPunctuation:Ad,autolink:jd,blockSkip:_d,br:sd,code:od,del:Mu,delLDelim:Mu,delRDelim:Mu,emStrongLDelim:yd,emStrongRDelimAst:Cd,emStrongRDelimUnd:Ed,escape:ad,link:Id,nolink:Rd,punctuation:fd,reflink:Ld,reflinkSearch:Vd,tag:Nd,text:cd,url:Mu},Gd={...Wd,emStrongLDelim:xd,emStrongRDelimAst:Td,emStrongRDelimUnd:Dd,link:W(/^!?\[(label)\]\((.*?)\)/).replace(`label`,Fd).getRegex(),reflink:W(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,Fd).getRegex()},Kd={...Wd,emStrongRDelimAst:wd,emStrongLDelim:bd,delLDelim:Od,delRDelim:kd,url:W(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Ud).replace(`protocol`,Hd).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`,Hd).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},qd={...Kd,br:W(sd).replace(`{2,}`,`*`).getRegex(),text:W(Kd.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},Jd={normal:td,gfm:rd,pedantic:id},Yd={normal:Wd,gfm:Kd,breaks:qd,pedantic:Gd},Xd={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Zd=e=>Xd[e];function Qd(e,t){if(t){if(G.escapeTest.test(e))return e.replace(G.escapeReplace,Zd)}else if(G.escapeTestNoEncode.test(e))return e.replace(G.escapeReplaceNoEncode,Zd);return e}function $d(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 ef(e){try{e=encodeURI(e).replace(G.percentDecode,`%`)}catch{return null}return e}function tf(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 nf(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 rf(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 af(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function of(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 sf(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 cf(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 lf(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 uf(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 df=class{options;rules;lexer;constructor(e){this.options=e||Au}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]:rf(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=lf(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=nf(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:nf(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:nf(t[0],`
|
|
70
|
-
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=nf(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?sf(c,l):c.replace(this.rules.other.leadingSpaceTab,e=>sf(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=rf(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])&&of(t[2],`()`)!==-1)return;let e=af(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:nf(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=tf(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:nf(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(tf(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:nf(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&&uf(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=nf(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=of(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)),cf(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&&uf(e,n[1],r,this.rules))return;let i=t[af((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 cf(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]:$d(t[0]),escaped:e}}}},ff=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Au,this.options.tokenizer=this.options.tokenizer||new df,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:Jd.normal,inline:Yd.normal};this.options.pedantic?(t.block=Jd.pedantic,t.inline=Yd.pedantic):this.options.gfm&&(t.block=Jd.gfm,t.inline=this.options.breaks?Yd.breaks:Yd.gfm),this.tokenizer.rules=t}static get rules(){return{block:Jd,inline:Yd}}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,af(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,af(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)}},pf=class{options;parser;constructor(e){this.options=e||Au}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-`+Qd(r)+`">`+(n?i:Qd(i,!0))+`</code></pre>
|
|
112
|
-
`:`<pre><code>`+(n?i:Qd(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>${Qd(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?Qd(n,!0):this.parser.parseInline(r),o=ef(e);if(o===null)return a;e=Qd(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+Qd(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=ef(e);if(i===null)return Qd(n);e=i;let a=`<img src="${Qd(e)}" alt="${Qd(n)}"`;return t&&(a+=` title="${Qd(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:Qd(e.text)}},mf=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}},hf=class e{options;renderer;textRenderer;constructor(e){this.options=e||Au,this.options.renderer=this.options.renderer||new pf,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new mf}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}},gf=class{options;block;constructor(e){this.options=e||Au}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?ff.lex:ff.lexInline}provideParser(e=this.block){return e?hf.parse:hf.parseInline}},_f=new class{defaults=ku();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=hf;Renderer=pf;TextRenderer=mf;Lexer=ff;Tokenizer=df;Hooks=gf;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 pf(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 df(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 gf;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]=gf.passThroughHooks.has(n)?e=>{if(this.defaults.async&&gf.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 ff.lex(e,t??this.defaults)}parser(e,t){return hf.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?ff.lex:ff.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?hf.parse:hf.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?ff.lex:ff.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?hf.parse:hf.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>`+Qd(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function K(e,t){return _f.parse(e,t)}K.options=K.setOptions=function(e){return _f.setOptions(e),K.defaults=_f.defaults,ju(K.defaults),K},K.getDefaults=ku,K.defaults=Au;function vf(...e){return _f.use(...e),K.defaults=_f.defaults,ju(K.defaults),K}K.use=vf,K.walkTokens=function(e,t){return _f.walkTokens(e,t)},K.parseInline=_f.parseInline,K.Parser=hf,K.parser=hf.parse,K.Renderer=pf,K.TextRenderer=mf,K.Lexer=ff,K.lexer=ff.lex,K.Tokenizer=df,K.Hooks=gf,K.parse=K,K.options,K.setOptions,K.walkTokens,K.parseInline,hf.parse,ff.lex;var yf=Symbol.for(`yaml.alias`),bf=Symbol.for(`yaml.document`),xf=Symbol.for(`yaml.map`),Sf=Symbol.for(`yaml.pair`),Cf=Symbol.for(`yaml.scalar`),wf=Symbol.for(`yaml.seq`),Tf=Symbol.for(`yaml.node.type`),Ef=e=>!!e&&typeof e==`object`&&e[Tf]===yf,Df=e=>!!e&&typeof e==`object`&&e[Tf]===bf,Of=e=>!!e&&typeof e==`object`&&e[Tf]===xf,q=e=>!!e&&typeof e==`object`&&e[Tf]===Sf,J=e=>!!e&&typeof e==`object`&&e[Tf]===Cf,kf=e=>!!e&&typeof e==`object`&&e[Tf]===wf;function Y(e){if(e&&typeof e==`object`)switch(e[Tf]){case xf:case wf:return!0}return!1}function X(e){if(e&&typeof e==`object`)switch(e[Tf]){case yf:case xf:case Cf:case wf:return!0}return!1}var Af=e=>(J(e)||Y(e))&&!!e.anchor,jf=Symbol(`break visit`),Mf=Symbol(`skip children`),Nf=Symbol(`remove node`);function Pf(e,t){let n=If(t);Df(e)?Ff(null,e.contents,n,Object.freeze([e]))===Nf&&(e.contents=null):Ff(null,e,n,Object.freeze([]))}Pf.BREAK=jf,Pf.SKIP=Mf,Pf.REMOVE=Nf;function Ff(e,t,n,r){let i=Lf(e,t,n,r);if(X(i)||q(i))return Rf(e,r,i),Ff(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=Ff(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===jf)return jf;else i===Nf&&(t.items.splice(e,1),--e)}}else if(q(t)){r=Object.freeze(r.concat(t));let e=Ff(`key`,t.key,n,r);if(e===jf)return jf;e===Nf&&(t.key=null);let i=Ff(`value`,t.value,n,r);if(i===jf)return jf;i===Nf&&(t.value=null)}}return i}function If(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 Lf(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Of(t))return n.Map?.(e,t,r);if(kf(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(Ef(t))return n.Alias?.(e,t,r)}function Rf(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(Df(r))r.contents=n;else{let e=Ef(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var zf={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Bf=e=>e.replace(/[!,[\]{}]/g,e=>zf[e]),Vf=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+Bf(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={};Pf(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
|
-
`)}};Vf.defaultYaml={explicit:!1,version:`1.2`},Vf.defaultTags={"!!":`tag:yaml.org,2002:`};function Hf(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 Uf(e){let t=new Set;return Pf(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function Wf(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Gf(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=Uf(e);let a=Wf(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 Kf(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=Kf(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=Kf(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=Kf(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=Kf(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function qf(e,t,n){if(Array.isArray(e))return e.map((e,t)=>qf(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Af(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 Jf=class{constructor(e){Object.defineProperty(this,Tf,{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(!Df(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=qf(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Kf(i,{"":o},``,o):o}},Yf=class extends Jf{constructor(e){super(yf),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=[],Pf(e,{Node:(e,t)=>{(Ef(t)||Af(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||=(qf(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=Xf(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(Hf(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 Xf(e,t,n){if(Ef(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=Xf(e,i,n);t>r&&(r=t)}return r}if(q(t)){let r=Xf(e,t.key,n),i=Xf(e,t.value,n);return Math.max(r,i)}return 1}var Zf=e=>!e||typeof e!=`function`&&typeof e!=`object`,Z=class extends Jf{constructor(e){super(Cf),this.value=e}toJSON(e,t){return t?.keep?this.value:qf(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 Qf=`tag:yaml.org,2002:`;function $f(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 ep(e,t,n){if(Df(e)&&(e=e.contents),X(e))return e;if(q(e)){let t=n.schema[xf].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 Yf(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Qf+t.slice(2));let l=$f(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[xf]:Symbol.iterator in Object(e)?o[wf]:o[xf]}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 tp(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 ep(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var np=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,rp=class extends Jf{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(np(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,tp(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,tp(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},ip=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function ap(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var op=(e,t,n)=>e.endsWith(`
|
|
131
|
-
`)?ap(n,t):n.includes(`
|
|
132
|
-
`)?`
|
|
133
|
-
`+ap(n,t):(e.endsWith(` `)?``:` `)+n,sp=`flow`,cp=`block`,lp=`quoted`;function up(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=dp(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=dp(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 dp(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 fp=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),pp=e=>/^(%|---|\.\.\.)/m.test(e);function mp(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 hp(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(pp(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:up(o,a,lp,fp(t,!1))}function gp(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
142
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return hp(e,t);let n=t.indent||(pp(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:up(r,n,sp,fp(t,!1))}function _p(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=hp;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?gp:i&&!t?hp:n?gp:hp}return r(e,t)}var vp;try{vp=RegExp(`(^|(?<!
|
|
143
|
-
))
|
|
144
|
-
+(?!
|
|
145
|
-
|$)`,`g`)}catch{vp=/\n+(?!\n|$)/g}function yp({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 _p(n,r);let l=r.indent||(r.forceBlockIndent||pp(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===Z.BLOCK_FOLDED?!1:t===Z.BLOCK_LITERAL||!mp(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(vp,`$&${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=fp(r,!0);o!==`folded`&&t!==Z.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=up(`${v}${e}${p}`,l,cp,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function bp(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 _p(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
154
|
-
`)?_p(a,t):yp(e,t,n,r);if(!s&&!u&&i!==Z.PLAIN&&a.includes(`
|
|
155
|
-
`))return yp(e,t,n,r);if(pp(a)){if(c===``)return t.forceBlockIndent=!0,yp(e,t,n,r);if(s&&c===l)return _p(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 _p(a,t)}return s?d:up(d,c,sp,fp(t,!1))}function xp(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?_p(o.value,t):yp(o,t,n,r);case Z.QUOTE_DOUBLE:return hp(o.value,t);case Z.QUOTE_SINGLE:return gp(o.value,t);case Z.PLAIN:return bp(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 Sp(e,t){let n=Object.assign({blockQuote:!0,commentString:ip,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 Cp(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 wp(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(J(e)||Y(e))&&e.anchor;a&&Hf(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 Tp(e,t,n,r){if(q(e))return e.toString(t,n,r);if(Ef(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??=Cp(t.doc.schema.tags,a);let o=wp(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)?xp(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 Ep({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=Tp(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+=op(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=op(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=op(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&&kf(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let ee=!1,te=Tp(t,n,()=>ee=!0,()=>h=!0),ne=` `;if(f||_||v){if(ne=_?`
|
|
156
|
-
`:``,v){let e=l(v);ne+=`\n${ap(e,n.indent)}`}te===``&&!n.inFlow?ne===`
|
|
157
|
-
`&&y&&(ne=`
|
|
158
|
-
|
|
159
|
-
`):ne+=`\n${n.indent}`}else if(!p&&Y(t)){let e=te[0],r=te.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=te.indexOf(` `);e===`&`&&n!==-1&&n<r&&te[n+1]===`!`&&(n=te.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(ne=`\n${n.indent}`)}}else(te===``||te[0]===`
|
|
161
|
-
`)&&(ne=``);return g+=ne+te,n.inFlow?ee&&r&&r():y&&!ee?g+=op(g,n.indent,l(y)):h&&i&&i(),g}function Dp(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Op=`<<`,kp={identify:e=>e===Op||typeof e==`symbol`&&e.description===Op,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new Z(Symbol(Op)),{addToJSMap:jp}),stringify:()=>Op},Ap=(e,t)=>(kp.identify(t)||J(t)&&(!t.type||t.type===Z.PLAIN)&&kp.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===kp.tag&&e.default);function jp(e,t,n){let r=Np(e,n);if(kf(r))for(let n of r.items)Mp(e,t,n);else if(Array.isArray(r))for(let n of r)Mp(e,t,n);else Mp(e,t,r)}function Mp(e,t,n){let r=Np(e,n);if(!Of(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 Np(e,t){return e&&Ef(t)?t.resolve(e.doc,e):t}function Pp(e,t,{key:n,value:r}){if(X(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(Ap(e,n))jp(e,t,r);else{let i=qf(n,``,e);if(t instanceof Map)t.set(i,qf(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Fp(n,i,e),o=qf(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Fp(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(X(e)&&n?.doc){let t=Sp(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)+`..."`),Dp(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 Ip(e,t,n){return new Lp(ep(e,void 0,n),ep(t,void 0,n))}var Lp=class e{constructor(e,t=null){Object.defineProperty(this,Tf,{value:Sf}),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 Pp(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?Ep(this,e,t,n):JSON.stringify(this)}};function Rp(e,t,n){return(t.inFlow??e.flow?Bp:zp)(e,t,n)}function zp({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(``),Vp(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(``),Vp(n,f,e.commentBefore,d))}d=!1;let s=Tp(i,u,()=>o=null,()=>d=!0);o&&(s+=op(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
|
-
`+ap(l(e),c),s&&s()):d&&o&&o(),p}function Bp({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(``),Vp(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(``),Vp(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=Tp(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+=op(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 Vp({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=ap(t(r),e);n.push(i.trimStart())}}function Hp(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 Up=class extends rp{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(xf,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(Ip(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 Lp(e,e?.value):new Lp(e.key,e.value);let r=Hp(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);J(r.value)&&Zf(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=Hp(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Hp(this.items,e)?.value;return(!t&&J(n)?n.value:n)??void 0}has(e){return!!Hp(this.items,e)}set(e,t){this.add(new Lp(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)Pp(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})),Rp(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},Wp={collection:`map`,default:!0,nodeClass:Up,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Of(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Up.from(e,t,n)},Gp=class extends rp{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(wf,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Kp(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Kp(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&J(r)?r.value:r}has(e){let t=Kp(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Kp(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];J(r)&&Zf(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(qf(e,String(r++),t));return n}toString(e,t,n){return e?Rp(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(ep(a,void 0,n))}}return i}};function Kp(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 qp={collection:`seq`,default:!0,nodeClass:Gp,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return kf(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Gp.from(e,t,n)},Jp={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),xp(e,t,n,r)}},Yp={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`&&Yp.test.test(e)?e:t.options.nullStr},Xp={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&&Xp.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function Zp({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 Qp={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:Zp},$p={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():Zp(e)}},em={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:Zp},tm=e=>typeof e==`bigint`||Number.isInteger(e),nm=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function rm(e,t,n){let{value:r}=e;return tm(r)&&r>=0?n+r.toString(t):Zp(e)}var im={identify:e=>tm(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>nm(e,2,8,n),stringify:e=>rm(e,8,`0o`)},am={identify:tm,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>nm(e,0,10,n),stringify:Zp},om={identify:e=>tm(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>nm(e,2,16,n),stringify:e=>rm(e,16,`0x`)},sm=[Wp,qp,Jp,Yp,Xp,im,am,om,Qp,$p,em];function cm(e){return typeof e==`bigint`||Number.isInteger(e)}var lm=({value:e})=>JSON.stringify(e),um=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:lm},{identify:e=>e==null,createNode:()=>new Z(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:lm},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:lm},{identify:cm,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})=>cm(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:lm}],dm=[Wp,qp].concat(um,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),fm={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 xp({comment:e,type:t,value:s},r,i,a)}};function pm(e,t){if(kf(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!q(r)){if(Of(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new Lp(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 Lp(r)}}else t(`Expected a sequence for this tag`);return e}function mm(e,t,n){let{replacer:r}=n,i=new Gp(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(Ip(o,s,n))}return i}var hm={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:pm,createNode:mm},gm=class e extends Gp{constructor(){super(),this.add=Up.prototype.add.bind(this),this.delete=Up.prototype.delete.bind(this),this.get=Up.prototype.get.bind(this),this.has=Up.prototype.has.bind(this),this.set=Up.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=qf(e.key,``,t),i=qf(e.value,r,t)):r=qf(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=mm(e,t,n),i=new this;return i.items=r.items,i}};gm.tag=`tag:yaml.org,2002:omap`;var _m={collection:`seq`,identify:e=>e instanceof Map,nodeClass:gm,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=pm(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 gm,n)},createNode:(e,t,n)=>gm.from(e,t,n)};function vm({value:e,source:t},n){return t&&(e?ym:bm).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var ym={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:vm},bm={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:vm},xm={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:Zp},Sm={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():Zp(e)}},Cm={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:Zp},wm=e=>typeof e==`bigint`||Number.isInteger(e);function Tm(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 Em(e,t,n){let{value:r}=e;if(wm(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return Zp(e)}var Dm={identify:wm,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>Tm(e,2,2,n),stringify:e=>Em(e,2,`0b`)},Om={identify:wm,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>Tm(e,1,8,n),stringify:e=>Em(e,8,`0`)},km={identify:wm,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>Tm(e,0,10,n),stringify:Zp},Am={identify:wm,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>Tm(e,2,16,n),stringify:e=>Em(e,16,`0x`)},jm=class e extends Up{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 Lp(e.key,null):new Lp(e,null),Hp(this.items,t.key)||this.items.push(t)}get(e,t){let n=Hp(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=Hp(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new Lp(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(Ip(e,null,n));return i}};jm.tag=`tag:yaml.org,2002:set`;var Mm={collection:`map`,identify:e=>e instanceof Set,nodeClass:jm,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>jm.from(e,t,n),resolve(e,t){if(Of(e)){if(e.hasAllNullValues(!0))return Object.assign(new jm,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Nm(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 Pm(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return Zp(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 Fm={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})=>Nm(e,n),stringify:Pm},Im={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=>Nm(e,!1),stringify:Pm},Lm={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(Lm.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=Nm(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$/,``)??``},Rm=[Wp,qp,Jp,Yp,ym,bm,Dm,Om,km,Am,xm,Sm,Cm,fm,kp,_m,hm,Mm,Fm,Im,Lm],zm=new Map([[`core`,sm],[`failsafe`,[Wp,qp,Jp]],[`json`,dm],[`yaml11`,Rm],[`yaml-1.1`,Rm]]),Bm={binary:fm,bool:Xp,float:em,floatExp:$p,floatNaN:Qp,floatTime:Im,int:am,intHex:om,intOct:im,intTime:Fm,map:Wp,merge:kp,null:Yp,omap:_m,pairs:hm,seq:qp,set:Mm,timestamp:Lm},Vm={"tag:yaml.org,2002:binary":fm,"tag:yaml.org,2002:merge":kp,"tag:yaml.org,2002:omap":_m,"tag:yaml.org,2002:pairs":hm,"tag:yaml.org,2002:set":Mm,"tag:yaml.org,2002:timestamp":Lm};function Hm(e,t,n){let r=zm.get(t);if(r&&!e)return n&&!r.includes(kp)?r.concat(kp):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(zm.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(kp)),i.reduce((e,t)=>{let n=typeof t==`string`?Bm[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(Bm).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 Um=(e,t)=>e.key<t.key?-1:+(e.key>t.key),Wm=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?Hm(e,`compat`):e?Hm(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?Vm:{},this.tags=Hm(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,xf,{value:Wp}),Object.defineProperty(this,Cf,{value:Jp}),Object.defineProperty(this,wf,{value:qp}),this.sortMapEntries=typeof a==`function`?a:a===!0?Um:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function Gm(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=Sp(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(ap(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(ap(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Tp(e.contents,i,()=>s=null,t);s&&(c+=op(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Tp(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
|
|
167
|
-
`)?(n.push(`...`),n.push(ap(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(ap(a(t),``)))}return n.join(`
|
|
168
|
-
`)+`
|
|
169
|
-
`}var Km=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,Tf,{value:bf});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 Vf({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[Tf]:{value:bf}});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){qm(this.contents)&&this.contents.add(e)}addIn(e,t){qm(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Uf(this);e.anchor=!t||n.has(t)?Wf(t||`a`,n):t}return new Yf(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}=Gf(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=ep(e,l,p);return o&&Y(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new Lp(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return qm(this.contents)?this.contents.delete(e):!1}deleteIn(e){return np(e)?this.contents!=null&&(this.contents=null,!0):qm(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 np(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 np(e)?this.contents!==void 0:Y(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=tp(this.schema,[e],t):qm(this.contents)&&this.contents.set(e,t)}setIn(e,t){np(e)?this.contents=t:this.contents==null?this.contents=tp(this.schema,Array.from(e),t):qm(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 Vf({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 Vf({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 Wm(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=qf(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`?Kf(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 Gm(this,e)}};function qm(e){if(Y(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var Jm=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},Ym=class extends Jm{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},Xm=class extends Jm{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},Zm=(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 Qm(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,te=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,te??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,te??=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 ne=e[e.length-1],re=ne?ne.offset+ne.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:re,start:te??re}}function $m(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($m(t.key)||$m(t.value))return!0}return!1;default:return!0}}function eh(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&$m(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function th(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 nh=`All mapping items must start at the same column`;function rh({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Up)(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=Qm(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`,nh)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
|
172
|
-
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||$m(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`,nh);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&eh(r.indent,u,i),n.atKey=!1,th(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=Qm(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&&eh(r.indent,f,i),s=c.range[2];let l=new Lp(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 Lp(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 ih({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Gp)(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=Qm(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&&eh(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function ah(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 oh=`Block collections are not allowed within flow collections`,sh=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function ch({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?Up:Gp))(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=Qm(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&&$m(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],sh(m)&&i(r.range,`BLOCK_IN_FLOW`,oh)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);sh(f)&&i(g.range,`BLOCK_IN_FLOW`,oh),n.atKey=!1;let _=Qm(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?sh(m)&&i(v.range,`BLOCK_IN_FLOW`,oh):_.comment&&(g.comment?g.comment+=`
|
|
176
|
-
`+_.comment:g.comment=_.comment);let y=new Lp(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;th(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new Up(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=ah(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 lh(e,t,n,r,i,a){let o=n.type===`block-map`?rh(e,t,n,r,a):n.type===`block-seq`?ih(e,t,n,r,a):ch(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function uh(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===Up.tagName&&s===`map`||o===Gp.tagName&&s===`seq`)return lh(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),lh(e,t,n,i,o)}let l=lh(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 dh(e,t,n){let r=t.offset,i=fh(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?ph(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 fh({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 ph(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 mh(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=hh(a,l);break;case`single-quoted-scalar`:s=Z.QUOTE_SINGLE,c=gh(a,l);break;case`double-quoted-scalar`:s=Z.QUOTE_DOUBLE,c=vh(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=ah(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function hh(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}`),_h(e)}function gh(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),_h(e.slice(1,-1)).replace(/''/g,`'`)}function _h(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 vh(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}=yh(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=bh[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+=xh(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 yh(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 bh={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
|
205
|
-
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function xh(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 Sh(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?dh(e,t,r):mh(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[Cf]:c?Ch(e.schema,i,c,n,r):t.type===`scalar`?wh(e,i,t,r):e.schema[Cf];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 Ch(e,t,n,r,i){if(n===`!`)return e[Cf];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[Cf])}function wh({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[Cf];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[Cf];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 Th(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 Eh={composeNode:Dh,composeEmptyNode:Oh};function Dh(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=kh(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=Sh(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=uh(Eh,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??=Oh(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 Oh(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Sh(e,{type:`scalar`,offset:Th(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 kh({options:e},{offset:t,source:n,end:r},i){let a=new Yf(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=ah(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Ah(e,t,{offset:n,start:r,value:i,end:a},o){let s=new Km(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=Qm(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?Dh(c,i,l,o):Oh(c,l.end,r,null,l,o);let u=s.contents.range[2],d=ah(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function jh(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 Mh(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 Nh=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=jh(e);r?this.warnings.push(new Xm(i,t,n)):this.errors.push(new Ym(i,t,n))},this.directives=new Vf({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Mh(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:Mh(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=jh(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Ah(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 Ym(jh(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 Ym(jh(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=ah(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 Ym(jh(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 Km(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}}},Ph=Symbol(`break visit`),Fh=Symbol(`skip children`),Ih=Symbol(`remove item`);function Lh(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Rh(Object.freeze([]),e,t)}Lh.BREAK=Ph,Lh.SKIP=Fh,Lh.REMOVE=Ih,Lh.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},Lh.parentCollection=(e,t)=>{let n=Lh.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 Rh(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=Rh(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===Ph)return Ph;else r===Ih&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function zh(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 Bh(e){switch(e){case void 0:case` `:case`
|
|
211
|
-
`:case`\r`:case` `:return!0;default:return!1}}var Vh=new Set(`0123456789ABCDEFabcdef`),Hh=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),Uh=new Set(`,[]{}`),Wh=new Set(` ,[]{}
|
|
212
|
-
\r `),Gh=e=>!e||Wh.has(e),Kh=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===`...`)&&Bh(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===`...`)&&Bh(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&&!Bh(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===`:`)&&Bh(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(Gh),`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(`...`))&&Bh(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(Gh),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||Bh(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=>Bh(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(Bh(r)||e&&Uh.has(r))break;t=n}else if(Bh(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&&Uh.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&&Uh.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(Gh),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(Bh(n)||t&&Uh.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(;!Bh(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(Hh.has(t))t=this.buffer[++e];else if(t===`%`&&Vh.has(this.buffer[e+1])&&Vh.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)}},qh=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 Jh(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Yh(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 Xh(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 Zh(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 Qh(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 $h(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 eg(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!Jh(t.start,`explicit-key-ind`)&&!Jh(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,Xh(t.value)?t.value.end?$h(t.value.end,t.sep):t.value.end=t.sep:$h(t.start,t.sep),delete t.sep)}var tg=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 Kh,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=zh(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`&&eg(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&&Yh(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`:Yh(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=Qh(Zh(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)){$h(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(Jh(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=Qh(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(Jh(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(Xh(t.key)&&!Jh(t.sep,`newline`)){let e=Qh(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]}):Jh(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&&!Jh(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)){$h(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||Jh(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=Qh(Zh(t));eg(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=Qh(Zh(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=Qh(Zh(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 ng(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new qh||null,prettyErrors:t}}function rg(e,t={}){let{lineCounter:n,prettyErrors:r}=ng(t),i=new tg(n?.addNewLine),a=new Nh(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 Ym(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(Zm(e,n)),o.warnings.forEach(Zm(e,n))),o}function ig(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=rg(e,n);if(!i)return null;if(i.warnings.forEach(e=>Dp(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 ag=/^---\r?\n([\s\S]*?)\r?\n?---[ \t]*(?:\r?\n|$)/;function og(e,t){let n=ag.exec(e);if(!n)throw Error(`must start with front matter: a line "---", the fields, then another "---".`);let r;try{r=ig(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 sg(e){return e===`/`||/^(\/[a-z0-9]+(?:-[a-z0-9]+)*)+$/.test(e)}var cg=j({pages:A(O().refine(sg,`must be a page's address, such as /news`)).optional(),collections:A(O().min(1)).optional(),media:Ss().optional(),layout:Ss().optional(),menus:Ss().optional(),languages:A(O().min(1)).optional()}),lg=j({version:Bs(1),people:Fs(O().min(1),cg).default({}),reviewers:A(O().min(1)).optional()});function ug(e,t){return e.toLowerCase()===t.toLowerCase()}function dg(e,t){if(e&&t)return Object.entries(e.people).find(([e])=>ug(e,t))?.[1]}function fg(e,t){return(e??[]).some(e=>e===`/`||t===e||t.startsWith(`${e}/`))}function pg(e,t){return!e.languages||e.languages.includes(t)}function mg(e,t,n){if(!t)return!0;if(!pg(t,zg(e.settings,n.path)))return!1;let r=n.content?.translationOf;return fg(t.pages,n.path)||r!==void 0&&fg(t.pages,r)}function hg(e,t){return!e||(e.collections??[]).includes(t)}function gg(e,t,n){return!t||hg(t,n.collection)&&pg(t,Bg(e.settings,n))}function _g(e){return!e||e.media===!0}function vg(e,t,n){return!t||t.layout===!0&&pg(t,n??Fg(e.settings))}function yg(e,t,n){return!t||t.menus===!0&&pg(t,n??Fg(e.settings))}function bg(e){return`content`in e?e.content:void 0}function xg(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 Sg(e,t){return t===`content/layout/header.json`||t===`content/layout/footer.json`?Fg(e.settings):/^content\/layout\/(?:header|footer)\.([a-z]{2,3}(?:-[A-Za-z0-9]+)*)\.json$/.exec(t)?.[1]}function Cg(e,t){let n=su.safeParse(xg(t));if(!n.success)return;let r=n.data,i=(e,t)=>Ou(e??{})===Ou(t??{}),a=[];i(r.menus,e.menus)||a.push(Fg(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 wg(e){if(!e.startsWith(`content/collections/`))return;let[t,n,...r]=e.slice(a.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 Tg(e,t,n){let r=bg(n);if(!e||r===void 0)return;let i=Pg(e.settings,t,r);return i.ok?{content:i.value}:void 0}function Eg(e,t,n){if(!t)return[];let r=[];for(let a of n){let{path:n}=a;if(n.startsWith(`content/pages/`)&&n.endsWith(`.json`)){let o;try{o=i(n)}catch{r.push({path:n,kind:`other`});continue}let s=e.pages.find(e=>e.file===n),c=xg(bg(a));(!s||mg(e,t,s))&&(`delete`in a||mg(e,t,{path:o,content:{translationOf:typeof c?.translationOf==`string`?c.translationOf:void 0}}))||r.push({path:n,kind:`page`,address:o});continue}let o=wg(n);if(o){let i=e.collections.find(e=>e.id===o.collection),s=i?.entries.find(e=>e.file===n),c=Tg(i,n,a);(!hg(t,o.collection)||s&&!gg(e,t,s)||c&&!gg(e,t,{collection:o.collection,content:c.content}))&&r.push({path:n,kind:`entry`,...o});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 s=Sg(e,n);if(s!==void 0){vg(e,t,s)||r.push({path:n,kind:`layout`});continue}if(n===`content/menus.json`){(`delete`in a?void 0:Cg(e,bg(a)))?.every(n=>yg(e,t,n))!==!0&&r.push({path:n,kind:`menus`});continue}r.push({path:n,kind:`other`})}return r}async function Dg(t){let n=await t.read(e);if(n===void 0)return;let r=jg(`permissions`,lg,e,n);if(!r.ok)return;let{people:i,reviewers:a}=r.value;return{people:i,...a&&{reviewers:a}}}async function Og(e,n){let r=new Map;for(let{path:e}of n){let t=wg(e);t&&r.set(t.collection,(r.get(t.collection)??new Set).add(e))}let o=[...r.keys()].map(e=>`${a}/${e}/${s}`),l=n.map(e=>e.path).filter(e=>e.startsWith(`content/pages/`)&&e.endsWith(`.json`)),u=await kg(e,[t,...n.some(e=>e.path===`content/menus.json`)?[c]:[],...l,...o,...[...r.values()].flatMap(e=>[...e])]),d=e=>e.ok?e.value:void 0,f=u.get(t),p=f!==void 0&&d(jg(`site`,iu,`content/site.json`,f))||iu.parse({version:1}),m=l.flatMap(e=>{let t=u.get(e),n=t===void 0?void 0:d(jg(`page`,mu,e,t));return n?[{path:i(e),file:e,content:n}]:[]}),h=[...r].flatMap(([e,t])=>{let n=`${a}/${e}/${s}`,r=u.get(n),i=r===void 0?void 0:d(jg(`collection`,bu,n,r));return i?[{id:e,file:n,settings:i,entries:[...t].flatMap(t=>{let n=u.get(t),r=n===void 0?void 0:d(Pg(i,t,n)),a=wg(t)?.slug;return r&&a?[{collection:e,slug:a,file:t,content:r}]:[]})}]:[]}),g=u.get(c),_=g===void 0?void 0:d(jg(`menus`,su,c,g));return{settings:p,pages:m,collections:h,menus:_?.menus??{},..._?.languages&&{languageMenus:_.languages}}}async function kg(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 Ag(e){return e.issues.map(e=>e.path.length?`${e.path.join(`.`)} ${e.message}`:e.message).join(`; `)}function jg(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.`}}:Mg(e,t,n,i)}function Mg(e,t,n,r){let i;try{i=_(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:Ag(a.error)}}}function Ng(e,t,n){let r;try{r=og(t,n)}catch(t){return{ok:!1,problem:{file:e,message:t.message}}}return Mg(`entry`,xu,e,r)}function Pg(e,t,n){let r=e.markdown?Ng(t,n,e.markdown.body):jg(`entry`,xu,t,n);if(!r.ok)return r;let i=wu(e.fields,r.value.fields);return i.length>0?{ok:!1,problem:{file:t,message:i.map(e=>`fields.${e}`).join(`; `)}}:r}function Fg(e){return e.mainLanguage??e.language}function Ig(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 Lg(e){return`/${e.toLowerCase()}`}function Rg(e){let t=Fg(e);return[{code:t,name:e.languageName||Ig(t),prefix:``,main:!0},...(e.languages??[]).filter(e=>e.code.toLowerCase()!==t.toLowerCase()).map(e=>({code:e.code,name:e.name||Ig(e.code),prefix:Lg(e.code),main:!1}))]}function zg(e,t){for(let n of Rg(e))if(!n.main&&(t===n.prefix||t.startsWith(`${n.prefix}/`)))return n.code;return Fg(e)}function Bg(e,t){return t.content.inLanguage??Fg(e)}var Vg=`goodfellow:broker-connect`;function Hg(e){return e.startsWith(`.github/`)||e===`.gitlab-ci.yml`||e.startsWith(`.gitlab/`)}function Ug(e,t){let r={refused:[],confirm:[]};for(let i of e){let{path:e}=i;if(Hg(e)||e.startsWith(`/`)||e.split(`/`).includes(`..`))r.refused.push(e);else if(e.startsWith(`content/code/`))r.confirm.push({path:e,kind:`custom-code`});else if(!n(e))r.confirm.push({path:e,kind:`code`});else if(e===`content/site.json`&&`content`in i){let n;try{n=JSON.parse(i.content).url}catch{n=void 0}(n??void 0)!==(t??void 0)&&r.confirm.push({path:e,kind:`site-address`})}}return r}var Wg=class extends Error{problem;name=`BrokerRefusedError`;constructor(e,t){super(t),this.problem=e}},Gg=[`revision`,`read`,`readBytes`,`list`,`readFiles`,`fileSizes`,`write`,`changedPaths`],Kg={methods:[`read`,`readBytes`,`list`]},qg={name:`draft`,data:[`name`],methods:[`changes`,`paths`,`publish`,`submitForReview`,`discard`],objects:{store:{methods:Gg}}},Jg={data:[`user`,`contentOnly`],methods:[...Gg,`deployStatus`,`history`,`readAt`,`repositoryVisibility`,`signOut`],sync:{filesAt:Kg},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:qg,open:qg}},scheduledBuilds:{methods:[`timing`,`sync`]},tasks:{methods:[`supported`,`secretsPlace`,`run`]}}};function Yg(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 Xg(e){return e instanceof Error?{__error:Yg(e)}:e}function Zg(e,t,n={}){let r=new Map([[0,{target:t,shape:Jg,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]=Xg(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,Jg,``,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 Wg(`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 Wg(`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:Yg(t),state:o()})}},e.postMessage({type:`state`,state:o()}),()=>{e.onmessage=null,r.clear()}}var Qg=j(Object.fromEntries([`connect`,`files`,`secrets`,`read`,`write`].map(e=>[e,A(O()).optional()]))).strict(),$g=j({version:Bs(1),title:O().trim().min(1),description:O().optional(),permissions:Qg.default({}),blocks:A(O()).optional(),admin:Ss().optional(),screens:A(j({id:O(),title:O()}).strict()).optional(),build:A(j({id:O(),title:O().optional()}).strict()).optional(),tasks:A(j({id:O(),title:O().optional()}).strict()).optional(),server:Ss().optional(),mediaStorage:Ss().optional(),editor:j({title:O().trim().min(1),kinds:A(Rs([`page`,`header`,`footer`,`template`])).optional()}).strict().optional()}).strict(),e_=j({release:O(),installed:O(),goodfellow:O().optional(),manifest:$g}),t_=j({version:Bs(1),plugins:Fs(O(),e_)}),n_={version:1,plugins:{}};function r_(e){return e===void 0?n_:t_.parse(JSON.parse(e))}var i_={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 a_(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 o_=`https://api.anthropic.com`,s_=10485760,c_=[`content-type`,`accept`,`anthropic-version`,`anthropic-beta`];function l_(e,t,n){return e===`anthropic`?t===`POST`&&n===`v1/messages`:t===`POST`&&n===`chat/completions`||t===`GET`&&n===`models`}function u_(e,t){return Response.json({error:{message:t}},{status:e,headers:{"cache-control":`no-store`}})}function d_(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 u_(404,`This site has no key for that service.`);if(!l_(a,e.method,r))return u_(404,`The AI assistant doesn't use that.`);let s=typeof o==`string`?o:o.key,c=a===`anthropic`?o_:typeof o==`object`?o.baseUrl:i_[a].baseUrl??``;if(!c)return u_(404,`This site has no address for that service.`);let l=e.method===`GET`?void 0:await e.arrayBuffer();if(l&&l.byteLength>s_)return u_(413,`That request is too large.`);let u=new Headers;for(let t of c_){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=`${p(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 u_(502,`The AI service couldn't be reached.`)}if(!f.ok){let e=a_(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 f_=new Set([`write`,`draft.store.write`]);async function p_(e,t){let n=e.find(e=>e.path===r);if(n&&`content`in n)try{let e=r_(n.content).plugins,i=r_(await t?.(r)).plugins,a=Object.entries(e).filter(([e,t])=>JSON.stringify(i[e])!==JSON.stringify(t)).map(([e,t])=>({name:e,...t})),o=Object.keys(i).filter(t=>!e[t]);return a.length+o.length>0?{kind:`plugins`,installed:a,removed:o}:void 0}catch{return}}async function m_(e,t,n){let r=Ug(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 p_(e,n),o=[...a?[a]:[],...[...i].map(([e,t])=>({kind:e,paths:t}))];return o.length>0?{action:`ask`,questions:o}:{action:`allow`}}async function h_(e,t){if(!e)return;let n=dg(await Dg(e),e.user.login);if(!n)return;let r=Eg(await Og(e,t),n,t);return r.length>0?{action:`refuse`,paths:r.map(e=>e.path),reason:`limits`}:void 0}function g_(e){let t=e?.read;return typeof t==`function`?n=>t.call(e,n):void 0}function __(e){if(typeof e==`string`)return e;let t=e?.login;return typeof t==`string`?t:``}async function v_(e,t,n){let{path:r,args:i,target:a}=e;if(f_.has(r)){let e=i[0]??[];if(r===`write`){let t=await h_(n,e);if(t)return t}return m_(e,t,g_(a))}if(r===`draft.publish`){let e=await a.changes();return await h_(n,e)??m_(e,t)}return r===`updates.start`?{action:`ask`,questions:[{kind:`update`,release:String(i[0])}]}:r===`editors.invite`||r===`editors.setRole`?{action:`ask`,questions:[{kind:`editors`,who:__(i[0]),role:String(i[1])}]}:r===`editors.letEditorsPublish`?{action:`ask`,questions:[{kind:`editors`,who:``}]}:{action:`allow`}}var y_={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.`,signedInAs:`Signed in as {name}`,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}.`,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.`,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}.`,declined:`You chose not to publish 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`,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 y_[e].replace(/\{(\w+)\}/g,(e,n)=>t[n]??e)}var b_=`goodfellow:broker:route`,x_=`goodfellow:broker:ai`,S_=`goodfellow.config.tsx`,C_=Object.keys(i_).filter(e=>e!==`custom`&&e!==`manual`&&(e===`anthropic`||i_[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 w_(e){return e instanceof Error?e.message:String(e)}function T_(e){let{repo:t,project:n}=e.options;return typeof t==`string`?t:typeof n==`string`?n:e.package}function E_(){for(let e of[sessionStorage,localStorage])try{let t=e.getItem(x_);if(t)return JSON.parse(t)}catch{}return{}}function D_(e,t){O_(),(t?localStorage:sessionStorage).setItem(x_,JSON.stringify(e))}function O_(){sessionStorage.removeItem(x_),localStorage.removeItem(x_)}async function k_(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(S_,t).catch(()=>void 0),o=a?f(a):void 0;return{url:`${(o?.checked?u(o):void 0)??r.origin}${r.pathname}admin/`,siteUrl:n.url}}async function A_({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||T_(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(b_,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:w_(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:w_(e)}),s.disabled=!1}};if(t.append($(`h1`,{},Q(`signInTitle`,{site:T_(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:w_(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 k_(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?w_(t.error):``})));return}let n=new URL(t.url).origin,i=sessionStorage.getItem(b_)??``,a=$(`iframe`,{class:`broker-frame`,title:Q(`adminFrame`),src:`${t.url}${i.startsWith(`#`)?i:``}`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads allow-modals`,allow:`clipboard-write`}),o=()=>{window.removeEventListener(`message`,d),u?.(),e.signOut(),O_(),sessionStorage.removeItem(b_),f()},s=$(`button`,{type:`button`},Q(`aiKeys`));s.addEventListener(`click`,()=>y(()=>a.contentWindow?.location.replace(a.src)));let l=$(`button`,{type:`button`},Q(`signOut`));l.addEventListener(`click`,o),r($(`header`,{class:`broker-bar`},$(`span`,{},Q(`signedInAs`,{name:e.user.name||e.user.login})),s,l),a);let u,d=r=>{if(r.source!==a.contentWindow||r.origin!==n||r.data?.type!==`goodfellow:broker-ready`)return;u?.();let i=new MessageChannel,s=new MessageChannel;u=Zg(i.port1,e,{async check(n){let r=await v_(n,t.siteUrl,e);if(r.action===`refuse`){let e=r.paths.join(`, `);throw r.reason===`limits`?new Wg(`limits`,Q(`refusedLimits`,{paths:e})):new Wg(`workflow`,Q(`refusedWorkflow`,{paths:e}))}if(r.action===`ask`&&!await _(r.questions))throw new Wg(`declined`,Q(`declined`))},extra:{signOut:o,"ownerAccess.requestToken":()=>v(e)}}),s.port1.onmessage=e=>void m(s.port1,e.data);let l={hostName:c.name,redirectAddressesListed:c.canRedirect&&c.redirectAddressesListed===!0,aiServices:Object.keys(E_())};a.contentWindow?.postMessage({type:Vg,account:l},n,[i.port2,s.port2])};window.addEventListener(`message`,d)}async function m(e,t){if(t?.type===`route`&&typeof t.hash==`string`){sessionStorage.setItem(b_,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 d_(E_()).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))))}for(let e of r.removed)t.push($(`p`,{},Q(`confirmPluginRemove`,{name:e})))}else if(r.kind===`editors`)t.push($(`p`,{},r.who?Q(`confirmEditors`,{who:r.who,role:r.role?` (${r.role})`:``}):Q(`confirmEditorsPublish`)));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 h(Q(`confirmTitle`),t,[{label:Q(`cancel`),value:!1},{label:Q(n?`confirmPublish`:`confirmAllow`),value:!0,primary:!0}])}async function v(e){let t=e.ownerAccess;if(!t)throw new Wg(`not-here`,`This site's host has no owner token.`);let n=$(`input`,{type:`password`,id:`broker-owner-token`,autocomplete:`off`}),r=$(`p`,{class:`broker-error`,role:`alert`});for(;;){if(!await h(Q(`ownerTitle`),[$(`p`,{},Q(`ownerIntro`)),$(`p`,{},$(`a`,{href:t.tokenLink.url,target:`_blank`,rel:`noreferrer`},Q(`ownerCreate`))),$(`label`,{for:`broker-owner-token`},Q(`ownerLabel`)),n,r],[{label:Q(`cancel`),value:!1},{label:Q(`ownerUse`),value:!0,primary:!0}]))throw new Wg(`declined`,Q(`declined`));try{await t.applyToken(n.value.trim());return}catch(e){r.textContent=Q(`signInError`,{message:w_(e)})}}}async function y(e){let t=E_(),n=new Map,r=C_.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}`},i_[e].name),r)}),i=$(`input`,{type:`checkbox`,id:`broker-ai-remember`});if(i.checked=localStorage.getItem(x_)!==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());D_(a,i.checked),e()}}await A_({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":()=>l(()=>import(`./dist-Dkr_h4iS.js`),__vite__mapDeps([0,1,2,3,4]),import.meta.url),"@goodfellow-cms/github":()=>l(()=>import(`./dist-DAzQ31j6.js`),__vite__mapDeps([5,1,2,6,3,7]),import.meta.url),"@goodfellow-cms/gitlab":()=>l(()=>import(`./dist-Dob4V5zY.js`),__vite__mapDeps([8,1,2,6,3,4]),import.meta.url)}});
|