seroval 0.12.2 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- var{toString:Xe}=Object.prototype,m=class extends Error{constructor(r){super('Unsupported type "'+Xe.call(r)+'"');this.value=r}};function S(a,e){if(!a)throw e}var Pe={0:"Symbol.asyncIterator",1:"Symbol.hasInstance",2:"Symbol.isConcatSpreadable",3:"Symbol.iterator",4:"Symbol.match",5:"Symbol.matchAll",6:"Symbol.replace",7:"Symbol.search",8:"Symbol.species",9:"Symbol.split",10:"Symbol.toPrimitive",11:"Symbol.toStringTag",12:"Symbol.unscopables"},ce={[Symbol.asyncIterator]:0,[Symbol.hasInstance]:1,[Symbol.isConcatSpreadable]:2,[Symbol.iterator]:3,[Symbol.match]:4,[Symbol.matchAll]:5,[Symbol.replace]:6,[Symbol.search]:7,[Symbol.species]:8,[Symbol.split]:9,[Symbol.toPrimitive]:10,[Symbol.toStringTag]:11,[Symbol.unscopables]:12},Oe={0:Symbol.asyncIterator,1:Symbol.hasInstance,2:Symbol.isConcatSpreadable,3:Symbol.iterator,4:Symbol.match,5:Symbol.matchAll,6:Symbol.replace,7:Symbol.search,8:Symbol.species,9:Symbol.split,10:Symbol.toPrimitive,11:Symbol.toStringTag,12:Symbol.unscopables},Ie={2:"!0",3:"!1",1:"void 0",0:"null",4:"-0",5:"1/0",6:"-1/0",7:"0/0"},Ce={2:!0,3:!1,1:void 0,0:null,4:-0,5:1/0,6:-1/0,7:NaN};var Z={0:"Error",1:"EvalError",2:"RangeError",3:"ReferenceError",4:"SyntaxError",5:"TypeError",6:"URIError"},ke={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError},u=Symbol("why");function R(a){return{t:2,i:void 0,s:a,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}var Q=R(2),ee=R(3),re=R(1),E=R(0),ze=R(4),Te=R(5),Be=R(6),De=R(7);function Ye(a){switch(a){case'"':return'\\"';case"\\":return"\\\\";case`
2
- `:return"\\n";case"\r":return"\\r";case"\b":return"\\b";case" ":return"\\t";case"\f":return"\\f";case"<":return"\\x3C";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:return}}function l(a){let e="",r=0,t;for(let n=0,s=a.length;n<s;n++)t=Ye(a[n]),t&&(e+=a.slice(r,n)+t,r=n+1);return r===0?e=a:e+=a.slice(r),e}function p(a){return a.replace(/\\"/g,'"').replace(/\\\\/g,"\\").replace(/\\n/g,`
3
- `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\t/g," ").replace(/\\f/g,"\f").replace(/\\x3C/g,"<").replace(/\\u2028/g,"\u2028").replace(/\\u2029/g,"\u2029")}var A="__SEROVAL_REFS__",b="_$",x="$R",pe="s",me="f",ge="P",he="Ps",ve="Pf",Se="c",be="S",H="Se",te=`self.${b}`,Je=`${te}=${te}||{${ge}:function(s,f,p){return(p=new Promise(function(a,b){s=a,f=b})).${pe}=s,p.${me}=f,p},uP:function(p){delete p.${pe};delete p.${me}},${he}:function(p,d){p.${pe}(d),p.status="success",p.value=d,this.uP(p)},${ve}:function(p,d){p.${me}(d),p.status="failure",p.value=d,this.uP(p)},uS:function(s){delete s.${Se}},${H}:function(s,t,d,c){switch(c=s.${Se},t){case 0:return c.enqueue(d);case 1:return(this.uS(s),c.error(d));case 2:return(this.uS(s),c.close())}},${be}:function(s,c){return(s=new ReadableStream({start:function(x){c=x}})).${Se}=c,s}}`;function Ze(a){return a==null?`self.${x}=self.${x}||[];`:`(${te}=${te}||{})["${l(a)}"]=[];`}var ye=new Map,w=new Map;function Qe(a,e){return ye.set(e,a),w.set(a,e),e}function P(a){return ye.has(a)}function er(a){return w.has(a)}function Ve(a){return S(P(a),new Error("Missing reference id")),ye.get(a)}function Le(a){return S(er(a),new Error("Missing reference for id:"+a)),w.get(a)}typeof globalThis!==void 0?Object.defineProperty(globalThis,A,{value:w,configurable:!0,writable:!1,enumerable:!1}):typeof window!==void 0?Object.defineProperty(window,A,{value:w,configurable:!0,writable:!1,enumerable:!1}):typeof self!==void 0?Object.defineProperty(self,A,{value:w,configurable:!0,writable:!1,enumerable:!1}):typeof global!==void 0&&Object.defineProperty(global,A,{value:w,configurable:!0,writable:!1,enumerable:!1});function ne(a){switch(a){case 1/0:return Te;case-1/0:return Be;default:return a!==a?De:Object.is(a,-0)?ze:{t:0,i:void 0,s:a,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}}function se(a){return{t:1,i:void 0,s:l(a),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ae(a){return{t:3,i:void 0,s:""+a,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ne(a){return{t:4,i:a,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function z(a,e){return{t:5,i:a,s:e.toISOString(),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:void 0,b:void 0,o:void 0}}function T(a,e){return{t:6,i:a,s:void 0,l:void 0,c:e.source,m:e.flags,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function B(a,e){let r=new Uint8Array(e),t=r.length,n=new Array(t);for(let s=0;s<t;s++)n[s]=r[s];return{t:21,i:a,s:n,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ie(a,e){return S(e in ce,new Error("Only well-known symbols are supported.")),{t:17,i:a,s:ce[e],l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Re(a,e){return{t:20,i:a,s:l(Ve(e)),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function D(a,e,r){return{t:40,i:a,s:r,l:void 0,c:l(e),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}var v=(f=>(f[f.AggregateError=1]="AggregateError",f[f.ArrayPrototypeValues=2]="ArrayPrototypeValues",f[f.ArrowFunction=4]="ArrowFunction",f[f.BigInt=8]="BigInt",f[f.ErrorPrototypeStack=16]="ErrorPrototypeStack",f[f.Map=32]="Map",f[f.MethodShorthand=64]="MethodShorthand",f[f.ObjectAssign=128]="ObjectAssign",f[f.Promise=256]="Promise",f[f.Set=512]="Set",f[f.Symbol=1024]="Symbol",f[f.TypedArray=2048]="TypedArray",f[f.BigIntTypedArray=4096]="BigIntTypedArray",f[f.WebAPI=8192]="WebAPI",f))(v||{});function oe(a,e){return{body:e,cache:a.cache,credentials:a.credentials,headers:a.headers,integrity:a.integrity,keepalive:a.keepalive,method:a.method,mode:a.mode,redirect:a.redirect,referrer:a.referrer,referrerPolicy:a.referrerPolicy}}function de(a){return{headers:a.headers,status:a.status,statusText:a.statusText}}function le(a){return{bubbles:a.bubbles,cancelable:a.cancelable,composed:a.composed}}function ue(a){return{detail:a.detail,bubbles:a.bubbles,cancelable:a.cancelable,composed:a.composed}}var V=class{constructor(e){this.marked=new Set;this.plugins=e.plugins,this.features=16383^(e.disabledFeatures||0),this.refs=e.refs||new Map}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}getReference(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),Ne(r);let t=this.refs.size;return this.refs.set(e,t),P(e)?Re(t,e):t}getStrictReference(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),Ne(r);let t=this.refs.size;return this.refs.set(e,t),Re(t,e)}isIterable(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let r=e.constructor,t=this.features;if(t&2048)switch(r){case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return!1;default:break}if((t&4104)===4104)switch(r){case BigInt64Array:case BigUint64Array:return!1;default:break}if(t&32&&r===Map||t&512&&r===Set||t&8192&&(typeof Headers!="undefined"&&r===Headers||typeof File!="undefined"&&r===File))return!1;let n=this.plugins;if(n)for(let s=0,i=n.length;s<i;s++){let o=n[s];if(o.test(e)&&o.isIterable&&o.isIterable(e))return!1}return t&1024?Symbol.iterator in e:!1}};async function Ee(a){try{return[1,await a]}catch(e){return[0,e]}}function K(a){return a instanceof EvalError?1:a instanceof RangeError?2:a instanceof ReferenceError?3:a instanceof SyntaxError?4:a instanceof TypeError?5:a instanceof URIError?6:0}function Ue(a){switch(a){case"Int8Array":return Int8Array;case"Int16Array":return Int16Array;case"Int32Array":return Int32Array;case"Uint8Array":return Uint8Array;case"Uint16Array":return Uint16Array;case"Uint32Array":return Uint32Array;case"Uint8ClampedArray":return Uint8ClampedArray;case"Float32Array":return Float32Array;case"Float64Array":return Float64Array;case"BigInt64Array":return BigInt64Array;case"BigUint64Array":return BigUint64Array;default:throw new Error(`Unknown TypedArray "${a}"`)}}var tr=/^[$A-Z_][0-9A-Z_$]*$/i;function xe(a){let e=a[0];return(e==="$"||e==="_"||e>="A"&&e<="Z"||e>="a"&&e<="z")&&tr.test(a)}function L(a){return Object.isFrozen(a)?3:Object.isSealed(a)?2:Object.isExtensible(a)?0:1}function F(a,e){let r,t=Z[K(a)];a.name!==t?r={name:a.name}:a.constructor.name!==t&&(r={name:a.constructor.name});let n=Object.getOwnPropertyNames(a);for(let s=0,i=n.length,o;s<i;s++)o=n[s],o!=="name"&&o!=="message"&&(o==="stack"?e&16&&(r=r||{},r[o]=a[o]):(r=r||{},r[o]=a[o]));return r}function U(a,e){return{t:18,i:a,s:l(e.href),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:void 0,b:void 0,o:void 0}}function M(a,e){return{t:19,i:a,s:l(e.toString()),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:void 0,b:void 0,o:void 0}}function j(a,e){return{t:39,i:a,s:l(e.message),l:void 0,c:l(e.name),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}var O=class extends V{async parseItems(e){let r=e.length,t=[],n=[];for(let s=0,i;s<r;s++)s in e&&(i=e[s],this.isIterable(i)?n[s]=i:t[s]=await this.parse(i));for(let s=0;s<r;s++)s in n&&(t[s]=await this.parse(n[s]));return t}async parseArray(e,r){return{t:9,i:e,s:void 0,l:r.length,c:void 0,m:void 0,p:void 0,e:void 0,a:await this.parseItems(r),f:void 0,b:void 0,o:L(r)}}async parseBoxed(e,r){return{t:27,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(r.valueOf()),b:void 0,o:void 0}}async parseTypedArray(e,r){return{t:15,i:e,s:void 0,l:r.length,c:r.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(r.buffer),b:r.byteOffset,o:void 0}}async parseBigIntTypedArray(e,r){return{t:16,i:e,s:void 0,l:r.length,c:r.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(r.buffer),b:r.byteOffset,o:void 0}}async parseDataView(e,r){return{t:22,i:e,s:void 0,l:r.byteLength,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(r.buffer),b:r.byteOffset,o:void 0}}async parseProperties(e){let r=Object.entries(e),t=[],n=[],s=[],i=[];for(let o=0,d=r.length,c,g;o<d;o++)c=l(r[o][0]),g=r[o][1],this.isIterable(g)?(s.push(c),i.push(g)):(t.push(c),n.push(await this.parse(g)));for(let o=0,d=s.length;o<d;o++)t.push(s[o]),n.push(await this.parse(i[o]));return this.features&1024&&Symbol.iterator in e&&(t.push(0),n.push(await this.parse(Array.from(e)))),{k:t,v:n,s:t.length}}async parsePlainObject(e,r,t){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:await this.parseProperties(r),e:void 0,a:void 0,f:void 0,b:void 0,o:L(r)}}async parseError(e,r){let t=F(r,this.features),n=t?await this.parseProperties(t):void 0;return{t:13,i:e,s:K(r),l:void 0,c:void 0,m:l(r.message),p:n,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}async parseMap(e,r){let t=[],n=[],s=[],i=[];for(let[o,d]of r.entries())this.isIterable(o)||this.isIterable(d)?(s.push(o),i.push(d)):(t.push(await this.parse(o)),n.push(await this.parse(d)));for(let o=0,d=s.length;o<d;o++)t.push(await this.parse(s[o])),n.push(await this.parse(i[o]));return{t:8,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:{k:t,v:n,s:r.size},a:void 0,f:void 0,b:void 0,o:void 0}}async parseSet(e,r){let t=[],n=[];for(let s of r.keys())this.isIterable(s)?n.push(s):t.push(await this.parse(s));for(let s=0,i=n.length;s<i;s++)t.push(await this.parse(n[s]));return{t:7,i:e,s:void 0,l:r.size,c:void 0,m:void 0,p:void 0,e:void 0,a:t,f:void 0,b:void 0,o:void 0}}async parseBlob(e,r){return{t:23,i:e,s:void 0,l:void 0,c:l(r.type),m:void 0,p:void 0,e:void 0,f:await this.parse(await r.arrayBuffer()),a:void 0,b:void 0,o:void 0}}async parseFile(e,r){return{t:24,i:e,s:void 0,l:void 0,c:l(r.type),m:l(r.name),p:void 0,e:void 0,f:await this.parse(await r.arrayBuffer()),a:void 0,b:r.lastModified,o:void 0}}async parsePlainProperties(e){let r=e.length,t=[],n=[],s=[],i=[];for(let o=0,d,c;o<r;o++)d=l(e[o][0]),c=e[o][1],this.isIterable(c)?(s.push(d),i.push(c)):(t.push(d),n.push(await this.parse(c)));for(let o=0,d=s.length;o<d;o++)t.push(s[o]),n.push(await this.parse(i[o]));return{k:t,v:n,s:r}}async parseHeaders(e,r){let t=[];return r.forEach((n,s)=>{t.push([s,n])}),{t:25,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:await this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}async parseFormData(e,r){let t=[];return r.forEach((n,s)=>{t.push([s,n])}),{t:26,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:await this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}async parseRequest(e,r){return{t:35,i:e,s:l(r.url),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:await this.parse(oe(r,r.body?await r.clone().arrayBuffer():null)),a:void 0,b:void 0,o:void 0}}async parseResponse(e,r){return{t:36,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:[r.body?await this.parse(await r.clone().arrayBuffer()):E,await this.parse(de(r))],b:void 0,o:void 0}}async parseEvent(e,r){return{t:37,i:e,s:l(r.type),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(le(r)),b:void 0,o:void 0}}async parseCustomEvent(e,r){return{t:38,i:e,s:l(r.type),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(ue(r)),b:void 0,o:void 0}}async parseAggregateError(e,r){let t=F(r,this.features),n=t?await this.parseProperties(t):void 0;return{t:14,i:e,s:void 0,l:void 0,c:void 0,m:l(r.message),p:n,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}async parsePromise(e,r){let[t,n]=await Ee(r);return{t:12,i:e,s:t,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(n),b:void 0,o:void 0}}async parsePlugin(e,r){let t=this.plugins;if(t)for(let n=0,s=t.length;n<s;n++){let i=t[n];if(i.parse.async&&i.test(r))return D(e,i.tag,await i.parse.async(r,this,{id:e}))}}async parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);let t=r.constructor;switch(t){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return z(e,r);case RegExp:return T(e,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(e,r);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(e,r);default:break}let n=this.features;if(n&256&&(t===Promise||r instanceof Promise))return this.parsePromise(e,r);if(n&2048)switch(t){case ArrayBuffer:return B(e,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(e,r);case DataView:return this.parseDataView(e,r);default:break}if((n&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(n&32&&t===Map)return this.parseMap(e,r);if(n&512&&t===Set)return this.parseSet(e,r);if(n&8192)switch(t){case(typeof URL!="undefined"?URL:u):return U(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:u):return M(e,r);case(typeof Blob!="undefined"?Blob:u):return this.parseBlob(e,r);case(typeof File!="undefined"?File:u):return this.parseFile(e,r);case(typeof Headers!="undefined"?Headers:u):return this.parseHeaders(e,r);case(typeof FormData!="undefined"?FormData:u):return this.parseFormData(e,r);case(typeof Request!="undefined"?Request:u):return this.parseRequest(e,r);case(typeof Response!="undefined"?Response:u):return this.parseResponse(e,r);case(typeof Event!="undefined"?Event:u):return this.parseEvent(e,r);case(typeof CustomEvent!="undefined"?CustomEvent:u):return this.parseCustomEvent(e,r);case(typeof DOMException!="undefined"?DOMException:u):return j(e,r);default:break}let s=await this.parsePlugin(e,r);if(s)return s;if(n&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(n&1024&&Symbol.iterator in r)return this.parsePlainObject(e,r,!!t);throw new m(r)}async parse(e){switch(e){case!0:return Q;case!1:return ee;case void 0:return re;case null:return E;default:break}switch(typeof e){case"string":return se(e);case"number":return ne(e);case"bigint":return S(this.features&8,new m(e)),ae(e);case"object":{let r=this.getReference(e);return typeof r=="number"?this.parseObject(r,e):r}case"symbol":{S(this.features&1024,new m(e));let r=this.getReference(e);return typeof r=="number"?ie(r,e):r}case"function":return S(P(e),new Error("Cannot serialize function without reference ID.")),this.getStrictReference(e);default:throw new m(e)}}};var _=class extends O{constructor(){super(...arguments);this.mode="vanilla"}};function Me(a,e){switch(e){case 3:return Object.freeze(a);case 1:return Object.preventExtensions(a);case 2:return Object.seal(a);default:return a}}function nr(){let a,e;return{resolve(r){a(r)},reject(r){e(r)},promise:new Promise((r,t)=>{a=r,e=t})}}var G=class{constructor(e){this.values=new Map;this.plugins=e.plugins,this.refs=new Set(e.markedRefs)}assignIndexedValue(e,r){return this.refs.has(e)&&this.values.set(e,r),r}deserializeReference(e){return this.assignIndexedValue(e.i,Le(p(e.s)))}deserializeArray(e){let r=e.l,t=this.assignIndexedValue(e.i,new Array(r)),n;for(let s=0;s<r;s++)n=e.a[s],n&&(t[s]=this.deserialize(n));return Me(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let n,s,i=e.k,o=e.v;for(let d=0;d<t;d++)switch(n=i[d],s=this.deserialize(o[d]),n){case 0:{let c=s;r[Symbol.iterator]=()=>c.values()}break;default:r[p(n)]=s;break}}return r}deserializeObject(e){let r=this.assignIndexedValue(e.i,e.t===10?{}:Object.create(null));return this.deserializeProperties(e.p,r),Me(r,e.o),r}deserializeDate(e){return this.assignIndexedValue(e.i,new Date(e.s))}deserializeRegExp(e){return this.assignIndexedValue(e.i,new RegExp(e.c,e.m))}deserializeSet(e){let r=this.assignIndexedValue(e.i,new Set),t=e.a;for(let n=0,s=e.l;n<s;n++)r.add(this.deserialize(t[n]));return r}deserializeMap(e){let r=this.assignIndexedValue(e.i,new Map),t=e.e.k,n=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(this.deserialize(t[s]),this.deserialize(n[s]));return r}deserializeArrayBuffer(e){let r=new Uint8Array(e.s);return this.assignIndexedValue(e.i,r.buffer)}deserializeTypedArray(e){let r=Ue(e.c),t=this.deserialize(e.f);return this.assignIndexedValue(e.i,new r(t,e.b,e.l))}deserializeDataView(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new DataView(r,e.b,e.l))}deserializeDictionary(e,r){if(e.p){let t=this.deserializeProperties(e.p,{});Object.assign(r,t)}return r}deserializeAggregateError(e){let r=this.assignIndexedValue(e.i,new AggregateError([],p(e.m)));return this.deserializeDictionary(e,r)}deserializeError(e){let r=ke[e.s],t=this.assignIndexedValue(e.i,new r(p(e.m)));return this.deserializeDictionary(e,t)}async deserializePromise(e){let r=nr(),t=this.assignIndexedValue(e.i,r.promise),n=this.deserialize(e.f);return e.s?r.resolve(n):r.reject(n),t}deserializeURL(e){return this.assignIndexedValue(e.i,new URL(p(e.s)))}deserializeURLSearchParams(e){return this.assignIndexedValue(e.i,new URLSearchParams(p(e.s)))}deserializeBlob(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new Blob([r],{type:p(e.c)}))}deserializeFile(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new File([r],p(e.m),{type:p(e.c),lastModified:e.b}))}deserializeHeaders(e){let r=this.assignIndexedValue(e.i,new Headers),t=e.e.k,n=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(p(t[s]),this.deserialize(n[s]));return r}deserializeFormData(e){let r=this.assignIndexedValue(e.i,new FormData),t=e.e.k,n=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(p(t[s]),this.deserialize(n[s]));return r}deserializeBoxed(e){return this.assignIndexedValue(e.i,Object(this.deserialize(e.f)))}deserializeRequest(e){return this.assignIndexedValue(e.i,new Request(p(e.s),this.deserialize(e.f)))}deserializeResponse(e){return this.assignIndexedValue(e.i,new Response(this.deserialize(e.a[0]),this.deserialize(e.a[1])))}deserializeEvent(e){return this.assignIndexedValue(e.i,new Event(p(e.s),this.deserialize(e.f)))}deserializeCustomEvent(e){return this.assignIndexedValue(e.i,new CustomEvent(p(e.s),this.deserialize(e.f)))}deserializeDOMException(e){return this.assignIndexedValue(e.i,new DOMException(p(e.s),p(e.c)))}deserializePlugin(e){let r=this.plugins;if(r)for(let t=0,n=r.length;t<n;t++){let s=r[t];if(s.tag===e.c)return s.deserialize(e.s,this,{id:e.i})}throw new Error('Missing plugin for tag "'+e.c+'".')}deserialize(e){switch(e.t){case 2:return Ce[e.s];case 0:return e.s;case 1:return p(e.s);case 3:return BigInt(e.s);case 4:return this.values.get(e.i);case 20:return this.deserializeReference(e);case 9:return this.deserializeArray(e);case 10:case 11:return this.deserializeObject(e);case 5:return this.deserializeDate(e);case 6:return this.deserializeRegExp(e);case 7:return this.deserializeSet(e);case 8:return this.deserializeMap(e);case 21:return this.deserializeArrayBuffer(e);case 16:case 15:return this.deserializeTypedArray(e);case 22:return this.deserializeDataView(e);case 14:return this.deserializeAggregateError(e);case 13:return this.deserializeError(e);case 12:return this.deserializePromise(e);case 17:return Oe[e.s];case 18:return this.deserializeURL(e);case 19:return this.deserializeURLSearchParams(e);case 23:return this.deserializeBlob(e);case 24:return this.deserializeFile(e);case 25:return this.deserializeHeaders(e);case 26:return this.deserializeFormData(e);case 27:return this.deserializeBoxed(e);case 35:return this.deserializeRequest(e);case 36:return this.deserializeResponse(e);case 37:return this.deserializeEvent(e);case 38:return this.deserializeCustomEvent(e);case 39:return this.deserializeDOMException(e);case 40:return this.deserializePlugin(e);default:throw new Error("invariant")}}};function W(a){switch(a.t){case"index":return a.s+"="+a.v;case"set":return a.s+".set("+a.k+","+a.v+")";case"add":return a.s+".add("+a.v+")";case"delete":return a.s+".delete("+a.k+")";default:return""}}function sr(a){let e=[],r=a[0];for(let t=1,n=a.length,s,i=r;t<n;t++)s=a[t],s.t==="index"&&s.v===i.v?r={t:"index",s:s.s,k:void 0,v:W(r)}:s.t==="set"&&s.s===i.s?r={t:"set",s:W(r),k:s.k,v:s.v}:s.t==="add"&&s.s===i.s?r={t:"add",s:W(r),k:void 0,v:s.v}:s.t==="delete"&&s.s===i.s?r={t:"delete",s:W(r),k:s.k,v:void 0}:(e.push(r),r=s),i=s;return e.push(r),e}function je(a){if(a.length){let e="",r=sr(a);for(let t=0,n=r.length;t<n;t++)e+=W(r[t])+",";return e}}var ar="Object.create(null)",ir="new Set",or="new Map",dr="Promise.resolve",lr="Promise.reject",_e="Symbol.iterator";var ur={0:"[]"},fr={3:"Object.freeze",2:"Object.seal",1:"Object.preventExtensions",0:void 0},I=class{constructor(e){this.stack=[];this.flags=[];this.assignments=[];this.specials=new Set;this.plugins=e.plugins,this.features=e.features,this.marked=new Set(e.markedRefs)}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}getSpecialReference(e){let r=this.getRefParam("_"+e);return this.specials.has(e)?r:(this.specials.add(e),r+"="+ur[e])}pushObjectFlag(e,r){e!==0&&(this.markRef(r),this.flags.push({type:e,value:this.getRefParam(r)}))}resolveFlags(){let e="";for(let r=0,t=this.flags,n=t.length;r<n;r++){let s=t[r];e+=fr[s.type]+"("+s.value+"),"}return e}resolvePatches(){let e=je(this.assignments),r=this.resolveFlags();return e?r?e+r:e:r}createAssignment(e,r){this.assignments.push({t:"index",s:e,k:void 0,v:r})}createAddAssignment(e,r){this.assignments.push({t:"add",s:this.getRefParam(e),k:void 0,v:r})}createSetAssignment(e,r,t){this.assignments.push({t:"set",s:this.getRefParam(e),k:r,v:t})}createDeleteAssignment(e,r){this.assignments.push({t:"delete",s:this.getRefParam(e),k:r,v:void 0})}createArrayAssign(e,r,t){this.createAssignment(this.getRefParam(e)+"["+r+"]",t)}createObjectAssign(e,r,t){this.createAssignment(this.getRefParam(e)+"."+r,t)}isIndexedValueInStack(e){return e.t===4&&this.stack.includes(e.i)}serializeReference(e){return this.assignIndexedValue(e.i,A+'.get("'+e.s+'")')}getIterableAccess(){return this.features&2?".values()":"["+_e+"]()"}serializeIterable(e){let r="["+_e+"]",t=this.stack;this.stack=[];let n=this.serialize(e)+this.getIterableAccess();return this.stack=t,this.features&4?n=":()=>"+n:this.features&64?n="(){return "+n+"}":n=":function(){return "+n+"}",r+n}serializeArrayItem(e,r,t){return r?this.isIndexedValueInStack(r)?(this.markRef(e),this.createArrayAssign(e,t,this.getRefParam(r.i)),""):this.serialize(r):""}serializeArray(e){let r=e.i;if(e.l){this.stack.push(r);let t=e.a,n=this.serializeArrayItem(r,t[0],0),s=n==="";for(let i=1,o=e.l,d;i<o;i++)d=this.serializeArrayItem(r,t[i],i),n+=","+d,s=d==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+n+(s?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){switch(r){case 0:return this.serializeIterable(t);default:{let n=Number(r),s=n>=0||xe(r);if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.markRef(e),s&&n!==n?this.createObjectAssign(e,r,i):this.createArrayAssign(e,s?r:'"'+r+'"',i),""}return(s?r:'"'+r+'"')+":"+this.serialize(t)}}}serializeProperties(e,r){let t=r.s;if(t){this.stack.push(e);let n=r.k,s=r.v,i=this.serializeProperty(e,n[0],s[0]);for(let o=1,d=i;o<t;o++)d=this.serializeProperty(e,n[o],s[o]),i+=(d&&i&&",")+d;return this.stack.pop(),"{"+i+"}"}return"{}"}serializeObject(e){return this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(e.i,this.serializeProperties(e.i,e.p))}serializeWithObjectAssign(e,r,t){let n=this.serializeProperties(r,e);return n!=="{}"?"Object.assign("+t+","+n+")":t}serializeAssignment(e,r,t,n){switch(t){case 0:{let s=this.stack;this.stack=[];let i=this.serialize(n)+this.getIterableAccess();this.stack=s;let o=this.assignments;this.assignments=r,this.createArrayAssign(e,this.getSpecialReference(0),this.features&4?"()=>"+i:"function(){return "+i+"}"),this.assignments=o}break;default:{let s=this.serialize(n),i=Number(t),o=i>=0||xe(t);if(this.isIndexedValueInStack(n))o&&i!==i?this.createObjectAssign(e,t,s):this.createArrayAssign(e,o?t:'"'+t+'"',s);else{let d=this.assignments;this.assignments=r,o?this.createObjectAssign(e,t,s):this.createArrayAssign(e,o?t:'"'+t+'"',s),this.assignments=d}}}}serializeAssignments(e,r){let t=r.s;if(t){this.stack.push(e);let n=[],s=r.k,i=r.v;for(let o=0;o<t;o++)this.serializeAssignment(e,n,s[o],i[o]);return this.stack.pop(),je(n)}}serializeDictionary(e,r,t){if(r)if(this.features&128)t=this.serializeWithObjectAssign(r,e,t);else{this.markRef(e);let n=this.serializeAssignments(e,r);if(n)return"("+this.assignIndexedValue(e,t)+","+n+this.getRefParam(e)+")"}return this.assignIndexedValue(e,t)}serializeNullConstructor(e){return this.pushObjectFlag(e.o,e.i),this.serializeDictionary(e.i,e.p,ar)}serializeDate(e){return this.assignIndexedValue(e.i,'new Date("'+e.s+'")')}serializeRegExp(e){return this.assignIndexedValue(e.i,"/"+e.c+"/"+e.m)}serializeSetItem(e,r){return this.isIndexedValueInStack(r)?(this.markRef(e),this.createAddAssignment(e,this.getRefParam(r.i)),""):this.serialize(r)}serializeSet(e){let r=ir,t=e.l,n=e.i;if(t){let s=e.a;this.stack.push(n);let i=this.serializeSetItem(n,s[0]);for(let o=1,d=i;o<t;o++)d=this.serializeSetItem(n,s[o]),i+=(d&&i&&",")+d;this.stack.pop(),i&&(r+="(["+i+"])")}return this.assignIndexedValue(n,r)}serializeMapEntry(e,r,t){if(this.isIndexedValueInStack(r)){let n=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.createSetAssignment(e,n,i),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let i="("+this.serialize(t)+",["+this.getSpecialReference(0)+","+this.getSpecialReference(0)+"])";return this.createSetAssignment(e,n,this.getRefParam(t.i)),this.createDeleteAssignment(e,this.getSpecialReference(0)),i}let s=this.stack;return this.stack=[],this.createSetAssignment(e,n,this.serialize(t)),this.stack=s,""}if(this.isIndexedValueInStack(t)){let n=this.getRefParam(t.i);if(this.markRef(e),r.t!==4&&r.i!=null&&this.isMarked(r.i)){let i="("+this.serialize(r)+",["+this.getSpecialReference(0)+","+this.getSpecialReference(0)+"])";return this.createSetAssignment(e,this.getRefParam(r.i),n),this.createDeleteAssignment(e,this.getSpecialReference(0)),i}let s=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),n),this.stack=s,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=or,t=e.e.s,n=e.i;if(t){let s=e.e.k,i=e.e.v;this.stack.push(n);let o=this.serializeMapEntry(n,s[0],i[0]);for(let d=1,c=o;d<t;d++)c=this.serializeMapEntry(n,s[d],i[d]),o+=(c&&o&&",")+c;this.stack.pop(),o&&(r+="(["+o+"])")}return this.assignIndexedValue(n,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,n=t.length;if(n){r+="["+t[0];for(let s=1;s<n;s++)r+=","+t[s];r+="]"}return this.assignIndexedValue(e.i,r+").buffer")}serializeTypedArray(e){return this.assignIndexedValue(e.i,"new "+e.c+"("+this.serialize(e.f)+","+e.b+","+e.l+")")}serializeDataView(e){return this.assignIndexedValue(e.i,"new DataView("+this.serialize(e.f)+","+e.b+","+e.l+")")}serializeAggregateError(e){let r=e.i;this.stack.push(r);let t='new AggregateError([],"'+e.m+'")';return this.stack.pop(),this.serializeDictionary(r,e.p,t)}serializeError(e){return this.serializeDictionary(e.i,e.p,"new "+Z[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,n=e.i,s=e.s?dr:lr;if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);this.features&4?e.s?r=s+"().then(()=>"+i+")":r=s+"().catch(()=>{throw "+i+"})":e.s?r=s+"().then(function(){return "+i+"})":r=s+"().catch(function(){throw "+i+"})"}else{this.stack.push(n);let i=this.serialize(t);this.stack.pop(),r=s+"("+i+")"}return this.assignIndexedValue(n,r)}serializeWKSymbol(e){return this.assignIndexedValue(e.i,Pe[e.s])}serializeURL(e){return this.assignIndexedValue(e.i,'new URL("'+e.s+'")')}serializeURLSearchParams(e){return this.assignIndexedValue(e.i,e.s?'new URLSearchParams("'+e.s+'")':"new URLSearchParams")}serializeBlob(e){return this.assignIndexedValue(e.i,"new Blob(["+this.serialize(e.f)+'],{type:"'+e.c+'"})')}serializeFile(e){return this.assignIndexedValue(e.i,"new File(["+this.serialize(e.f)+'],"'+e.m+'",{type:"'+e.c+'",lastModified:'+e.b+"})")}serializeHeaders(e){return this.assignIndexedValue(e.i,"new Headers("+this.serializeProperties(e.i,e.e)+")")}serializeFormDataEntry(e,r,t){return this.getRefParam(e)+'.append("'+r+'",'+this.serialize(t)+")"}serializeFormDataEntries(e,r){let t=e.e.k,n=e.e.v,s=e.i,i=this.serializeFormDataEntry(s,t[0],n[0]);for(let o=1;o<r;o++)i+=","+this.serializeFormDataEntry(s,t[o],n[o]);return i}serializeFormData(e){let r=e.e.s,t=e.i;r&&this.markRef(t);let n=this.assignIndexedValue(t,"new FormData()");if(r){let s=this.serializeFormDataEntries(e,r);return"("+n+","+(s?s+",":"")+this.getRefParam(t)+")"}return n}serializeBoxed(e){return this.assignIndexedValue(e.i,"Object("+this.serialize(e.f)+")")}serializeRequest(e){return this.assignIndexedValue(e.i,'new Request("'+e.s+'",'+this.serialize(e.f)+")")}serializeResponse(e){return this.assignIndexedValue(e.i,"new Response("+this.serialize(e.a[0])+","+this.serialize(e.a[1])+")")}serializeEvent(e){return this.assignIndexedValue(e.i,'new Event("'+e.s+'",'+this.serialize(e.f)+")")}serializeCustomEvent(e){return this.assignIndexedValue(e.i,'new CustomEvent("'+e.s+'",'+this.serialize(e.f)+")")}serializeDOMException(e){return this.assignIndexedValue(e.i,'new DOMException("'+e.s+'","'+e.c+'")')}serializePlugin(e){let r=this.plugins;if(r)for(let t=0,n=r.length;t<n;t++){let s=r[t];if(s.tag===e.c)return s.serialize(e.s,this,{id:e.i})}throw new Error('Missing plugin for tag "'+e.c+'".')}serialize(e){switch(e.t){case 2:return Ie[e.s];case 0:return""+e.s;case 1:return'"'+e.s+'"';case 3:return e.s+"n";case 4:return this.getRefParam(e.i);case 20:return this.serializeReference(e);case 9:return this.serializeArray(e);case 10:return this.serializeObject(e);case 11:return this.serializeNullConstructor(e);case 5:return this.serializeDate(e);case 6:return this.serializeRegExp(e);case 7:return this.serializeSet(e);case 8:return this.serializeMap(e);case 21:return this.serializeArrayBuffer(e);case 16:case 15:return this.serializeTypedArray(e);case 22:return this.serializeDataView(e);case 14:return this.serializeAggregateError(e);case 13:return this.serializeError(e);case 12:return this.serializePromise(e);case 17:return this.serializeWKSymbol(e);case 18:return this.serializeURL(e);case 19:return this.serializeURLSearchParams(e);case 23:return this.serializeBlob(e);case 24:return this.serializeFile(e);case 25:return this.serializeHeaders(e);case 26:return this.serializeFormData(e);case 27:return this.serializeBoxed(e);case 28:return this.serializePromiseConstructor(e);case 29:return this.serializePromiseResolve(e);case 30:return this.serializePromiseReject(e);case 31:return this.serializeReadableStreamConstructor(e);case 32:return this.serializeReadableStreamEnqueue(e);case 34:return this.serializeReadableStreamError(e);case 33:return this.serializeReadableStreamClose(e);case 35:return this.serializeRequest(e);case 36:return this.serializeResponse(e);case 37:return this.serializeEvent(e);case 38:return this.serializeCustomEvent(e);case 39:return this.serializeDOMException(e);case 40:return this.serializePlugin(e);default:throw new Error("invariant")}}};var Ke="hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_",qe=Ke.length,Ge="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",He=Ge.length;function we(a){let e=a%qe,r=Ke[e];for(a=(a-e)/qe;a>0;)e=a%He,r+=Ge[e],a=(a-e)/He;return r}var C=class extends I{constructor(){super(...arguments);this.mode="vanilla";this.valid=new Map;this.vars=[]}markRef(r){this.marked.add(r)}getRefParam(r){let t=this.valid.get(r);t==null&&(t=this.valid.size,this.valid.set(r,t));let n=this.vars[t];return n==null&&(n=we(t),this.vars[t]=n),n}assignIndexedValue(r,t){return this.isMarked(r)?this.getRefParam(r)+"="+t:t}serializePromiseConstructor(r){throw new Error('Unsupported node type "'+r.t+'".')}serializePromiseResolve(r){throw new Error('Unsupported node type "'+r.t+'".')}serializePromiseReject(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamConstructor(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamEnqueue(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamError(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamClose(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeTop(r){let t=this.serialize(r);if(r.i!=null&&this.vars.length){let n=this.resolvePatches(),s=t;if(n){let o=this.getRefParam(r.i);s=t+","+n+o,t.startsWith(o+"=")||(s=o+"="+s)}let i=this.vars.length>1?this.vars.join(","):this.vars[0];return this.features&4?(i=this.vars.length>1||this.vars.length===0?"("+i+")":i,"("+i+"=>("+s+"))()"):"(function("+i+"){return "+s+"})()"}return r.t===10?"("+t+")":t}};var y=class extends V{parseItems(e){let r=e.length,t=[],n=[];for(let s=0,i;s<r;s++)s in e&&(i=e[s],this.isIterable(i)?n[s]=i:t[s]=this.parse(i));for(let s=0;s<r;s++)s in n&&(t[s]=this.parse(n[s]));return t}parseArray(e,r){return{t:9,i:e,s:void 0,l:r.length,c:void 0,m:void 0,p:void 0,e:void 0,a:this.parseItems(r),f:void 0,b:void 0,o:L(r)}}parseProperties(e){let r=Object.entries(e),t=[],n=[],s=[],i=[];for(let o=0,d=r.length,c,g;o<d;o++)c=l(r[o][0]),g=r[o][1],this.isIterable(g)?(s.push(c),i.push(g)):(t.push(c),n.push(this.parse(g)));for(let o=0,d=s.length;o<d;o++)t.push(s[o]),n.push(this.parse(i[o]));return this.features&1024&&Symbol.iterator in e&&(t.push(0),n.push(this.parse(Array.from(e)))),{k:t,v:n,s:t.length}}parsePlainObject(e,r,t){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:this.parseProperties(r),e:void 0,a:void 0,f:void 0,b:void 0,o:L(r)}}parseBoxed(e,r){return{t:27,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(r.valueOf()),b:void 0,o:void 0}}parseTypedArray(e,r){return{t:15,i:e,s:void 0,l:r.length,c:r.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(r.buffer),b:r.byteOffset,o:void 0}}parseBigIntTypedArray(e,r){return{t:16,i:e,s:void 0,l:r.length,c:r.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(r.buffer),b:r.byteOffset,o:void 0}}parseDataView(e,r){return{t:22,i:e,s:void 0,l:r.byteLength,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(r.buffer),b:r.byteOffset,o:void 0}}parseError(e,r){let t=F(r,this.features),n=t?this.parseProperties(t):void 0;return{t:13,i:e,s:K(r),l:void 0,c:void 0,m:l(r.message),p:n,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parseMap(e,r){let t=[],n=[],s=[],i=[];for(let[o,d]of r.entries())this.isIterable(o)||this.isIterable(d)?(s.push(o),i.push(d)):(t.push(this.parse(o)),n.push(this.parse(d)));for(let o=0,d=s.length;o<d;o++)t.push(this.parse(s[o])),n.push(this.parse(i[o]));return{t:8,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:{k:t,v:n,s:r.size},a:void 0,f:void 0,b:void 0,o:void 0}}parseSet(e,r){let t=[],n=[];for(let s of r.keys())this.isIterable(s)?n.push(s):t.push(this.parse(s));for(let s=0,i=n.length;s<i;s++)t.push(this.parse(n[s]));return{t:7,i:e,s:void 0,l:r.size,c:void 0,m:void 0,p:void 0,e:void 0,a:t,f:void 0,b:void 0,o:void 0}}parsePlainProperties(e){let r=e.length,t=[],n=[],s=[],i=[];for(let o=0,d,c;o<r;o++)d=l(e[o][0]),c=e[o][1],this.isIterable(c)?(s.push(d),i.push(c)):(t.push(d),n.push(this.parse(c)));for(let o=0,d=s.length;o<d;o++)t.push(s[o]),n.push(this.parse(i[o]));return{k:t,v:n,s:r}}parseHeaders(e,r){let t=[];return r.forEach((n,s)=>{t.push([s,n])}),{t:25,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}parseFormData(e,r){let t=[];return r.forEach((n,s)=>{t.push([s,n])}),{t:26,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}parseEvent(e,r){return{t:37,i:e,s:l(r.type),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(le(r)),b:void 0,o:void 0}}parseCustomEvent(e,r){return{t:38,i:e,s:l(r.type),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(ue(r)),b:void 0,o:void 0}}parseAggregateError(e,r){let t=F(r,this.features),n=t?this.parseProperties(t):void 0;return{t:14,i:e,s:void 0,l:void 0,c:void 0,m:l(r.message),p:n,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parsePlugin(e,r){let t=this.plugins;if(t)for(let n=0,s=t.length;n<s;n++){let i=t[n];if(i.parse.sync&&i.test(r))return D(e,i.tag,i.parse.sync(r,this,{id:e}))}}parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);let t=r.constructor;switch(t){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return z(e,r);case RegExp:return T(e,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(e,r);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(e,r);default:break}let n=this.features;if(n&2048)switch(t){case ArrayBuffer:return B(e,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(e,r);case DataView:return this.parseDataView(e,r);default:break}if((n&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(n&32&&t===Map)return this.parseMap(e,r);if(n&512&&t===Set)return this.parseSet(e,r);if(n&8192)switch(t){case(typeof URL!="undefined"?URL:u):return U(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:u):return M(e,r);case(typeof Headers!="undefined"?Headers:u):return this.parseHeaders(e,r);case(typeof FormData!="undefined"?FormData:u):return this.parseFormData(e,r);case(typeof Event!="undefined"?Event:u):return this.parseEvent(e,r);case(typeof CustomEvent!="undefined"?CustomEvent:u):return this.parseCustomEvent(e,r);case(typeof DOMException!="undefined"?DOMException:u):return j(e,r);default:break}let s=this.parsePlugin(e,r);if(s)return s;if(n&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(n&1024&&Symbol.iterator in r)return this.parsePlainObject(e,r,!!t);throw new m(r)}parse(e){switch(e){case!0:return Q;case!1:return ee;case void 0:return re;case null:return E;default:break}switch(typeof e){case"string":return se(e);case"number":return ne(e);case"bigint":return S(this.features&8,new m(e)),ae(e);case"object":{let r=this.getReference(e);return typeof r=="number"?this.parseObject(r,e):r}case"symbol":{S(this.features&1024,new m(e));let r=this.getReference(e);return typeof r=="number"?ie(r,e):r}case"function":return S(P(e),new Error("Cannot serialize function without reference ID.")),this.getStrictReference(e);default:throw new m(e)}}};var q=class extends y{constructor(){super(...arguments);this.mode="vanilla"}};function We(a,e={}){let r=new q({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=r.parse(a);return new C({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}async function Gt(a,e={}){let r=new _({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=await r.parse(a);return new C({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}function Wt(a){return(0,eval)(a)}function $t(a,e={}){let r=new q({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:r.parse(a),f:r.features,m:Array.from(r.marked)}}async function Xt(a,e={}){let r=new _({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:await r.parse(a),f:r.features,m:Array.from(r.marked)}}function Yt(a,e={}){return new C({plugins:e.plugins,features:a.f,markedRefs:a.m}).serializeTop(a.t)}function Jt(a,e={}){return new G({plugins:e.plugins,markedRefs:a.m}).deserialize(a.t)}var $=class extends O{constructor(){super(...arguments);this.mode="cross"}};var k=class extends I{constructor(r){super(r);this.mode="cross";this.scopeId=r.scopeId}getRefParam(r){return typeof r=="string"?x+"."+r:x+"["+r+"]"}assignIndexedValue(r,t){return this.getRefParam(r)+"="+t}serializePromiseConstructor(r){return this.assignIndexedValue(r.i,b+"."+ge+"()")}serializePromiseResolve(r){return b+"."+he+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializePromiseReject(r){return b+"."+ve+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializeReadableStreamConstructor(r){return this.assignIndexedValue(r.i,b+"."+be+"()")}serializeReadableStreamEnqueue(r){return b+"."+H+"("+this.getRefParam(r.i)+",0,"+this.serialize(r.f)+")"}serializeReadableStreamError(r){return b+"."+H+"("+this.getRefParam(r.i)+",1,"+this.serialize(r.f)+")"}serializeReadableStreamClose(r){return b+"."+H+"("+this.getRefParam(r.i)+",2)"}serializeTop(r){let t=this.serialize(r),n=r.i;if(n==null)return t;let s=this.resolvePatches(),i=this.getRefParam(n),o=this.scopeId==null?"":x,d=s?t+","+s:t;if(o==="")return s?"("+d+i+")":d;let c=this.scopeId==null?"()":"("+x+'["'+l(this.scopeId)+'"])',g=d+(s?i:"");return this.features&4?"("+o+"=>("+g+"))"+c:"(function("+o+"){return "+g+"})"+c}};var X=class extends y{constructor(r){super(r);this.alive=!0;this.pending=0;this.onParseCallback=r.onParse,this.onErrorCallback=r.onError,this.onDoneCallback=r.onDone}onParse(r,t){this.onParseCallback(r,t)}onError(r){if(this.onErrorCallback)this.onErrorCallback(r);else throw r}onDone(){this.onDoneCallback&&this.onDoneCallback()}push(r){this.onParse(this.parse(r),!1)}pushPendingState(){this.pending++}popPendingState(){--this.pending<=0&&this.onDone()}pushReadableStreamReader(r,t){t.read().then(n=>{if(this.alive)if(n.done)this.onParse({t:33,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0},!1),this.popPendingState();else{let s=this.parseWithError(n.value);s&&(this.onParse({t:32,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:s,b:void 0,o:void 0},!1),this.pushReadableStreamReader(r,t))}},n=>{if(this.alive){let s=this.parseWithError(n);s&&(this.onParse({t:34,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState())}})}parseReadableStream(r,t){let n=t.getReader();return this.pushPendingState(),this.pushReadableStreamReader(r,n),{t:31,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parseRequest(r,t){return{t:35,i:r,s:l(t.url),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:this.parse(oe(t,t.clone().body)),a:void 0,b:void 0,o:void 0}}parseResponse(r,t){return{t:36,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:[t.body?this.parse(t.clone().body):E,this.parse(de(t))],b:void 0,o:void 0}}parsePromise(r,t){return t.then(n=>{let s=this.parseWithError(n);s&&(this.onParse({t:29,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState())},n=>{if(this.alive){let s=this.parseWithError(n);s&&(this.onParse({t:30,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState())}}),this.pushPendingState(),{t:28,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parsePlugin(r,t){let n=this.plugins;if(n)for(let s=0,i=n.length;s<i;s++){let o=n[s];if(o.parse.stream&&o.test(t))return D(r,o.tag,o.parse.stream(t,this,{id:r}))}}parseObject(r,t){if(Array.isArray(t))return this.parseArray(r,t);let n=t.constructor;switch(n){case Object:return this.parsePlainObject(r,t,!1);case void 0:return this.parsePlainObject(r,t,!0);case Date:return z(r,t);case RegExp:return T(r,t);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(r,t);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(r,t);default:break}let s=this.features;if(s&256&&(n===Promise||t instanceof Promise))return this.parsePromise(r,t);if(s&2048)switch(n){case ArrayBuffer:return B(r,t);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(r,t);case DataView:return this.parseDataView(r,t);default:break}if((s&4104)===4104)switch(n){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(r,t);default:break}if(s&32&&n===Map)return this.parseMap(r,t);if(s&512&&n===Set)return this.parseSet(r,t);if(s&8192)switch(n){case(typeof URL!="undefined"?URL:u):return U(r,t);case(typeof URLSearchParams!="undefined"?URLSearchParams:u):return M(r,t);case(typeof Headers!="undefined"?Headers:u):return this.parseHeaders(r,t);case(typeof FormData!="undefined"?FormData:u):return this.parseFormData(r,t);case(typeof ReadableStream!="undefined"?ReadableStream:u):return this.parseReadableStream(r,t);case(typeof Request!="undefined"?Request:u):return this.parseRequest(r,t);case(typeof Response!="undefined"?Response:u):return this.parseResponse(r,t);case(typeof Event!="undefined"?Event:u):return this.parseEvent(r,t);case(typeof CustomEvent!="undefined"?CustomEvent:u):return this.parseCustomEvent(r,t);case(typeof DOMException!="undefined"?DOMException:u):return j(r,t);default:break}let i=this.parsePlugin(r,t);if(i)return i;if(s&1&&typeof AggregateError!="undefined"&&(n===AggregateError||t instanceof AggregateError))return this.parseAggregateError(r,t);if(t instanceof Error)return this.parseError(r,t);if(s&1024&&Symbol.iterator in t)return this.parsePlainObject(r,t,!!n);throw new m(t)}parseWithError(r){try{return this.parse(r)}catch(t){this.onError(t);return}}start(r){let t=this.parseWithError(r);t&&(this.onParse(t,!0),this.pending<=0&&this.destroy())}destroy(){this.alive&&(this.onDone(),this.alive=!1)}isAlive(){return this.alive}};var Y=class extends X{constructor(){super(...arguments);this.mode="cross"}};var J=class extends y{constructor(){super(...arguments);this.mode="cross"}};function An(a,e={}){let r=new J({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=r.parse(a);return new k({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}).serializeTop(t)}async function wn(a,e={}){let r=new $({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=await r.parse(a);return new k({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}).serializeTop(t)}function $e(a,e){let r=new Y({refs:e.refs,disabledFeatures:e.disabledFeatures,onParse(t,n){let s=new k({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}),i;try{i=s.serializeTop(t)}catch(o){e.onError&&e.onError(o);return}e.onSerialize(i,n)},onError:e.onError,onDone:e.onDone});return r.start(a),()=>{r.destroy()}}var fe=class{constructor(e){this.options=e;this.alive=!0;this.flushed=!1;this.done=!1;this.pending=0;this.cleanups=[];this.refs=new Map;this.keys=new Set;this.ids=0}write(e,r){this.alive&&!this.flushed&&(this.pending++,this.keys.add(e),this.cleanups.push($e(r,{scopeId:this.options.scopeId,refs:this.refs,disabledFeatures:this.options.disabledFeatures,onError:this.options.onError,onSerialize:(t,n)=>{this.alive&&this.options.onData(n?this.options.globalIdentifier+'["'+l(e)+'"]='+t:t)},onDone:()=>{this.alive&&(this.pending--,this.pending<=0&&this.flushed&&!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0))}})))}getNextID(){for(;this.keys.has(""+this.ids);)this.ids++;return""+this.ids}push(e){let r=this.getNextID();return this.write(r,e),r}flush(){this.alive&&(this.flushed=!0,this.pending<=0&&!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0))}close(){if(this.alive){for(let e=0,r=this.cleanups.length;e<r;e++)this.cleanups[e]();!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0),this.alive=!1}}};function kn(a){return a}var Bn=We;export{v as Feature,Je as GLOBAL_CONTEXT_API_SCRIPT,fe as Serializer,Yt as compileJSON,kn as createPlugin,Qe as createReference,An as crossSerialize,wn as crossSerializeAsync,$e as crossSerializeStream,Bn as default,Wt as deserialize,Jt as fromJSON,Ze as getCrossReferenceHeader,We as serialize,Gt as serializeAsync,$t as toJSON,Xt as toJSONAsync};
1
+ var{toString:Ye}=Object.prototype,m=class extends Error{constructor(r){super('Unsupported type "'+Ye.call(r)+'"');this.value=r}};function S(a,e){if(!a)throw e}var we={0:"Symbol.asyncIterator",1:"Symbol.hasInstance",2:"Symbol.isConcatSpreadable",3:"Symbol.iterator",4:"Symbol.match",5:"Symbol.matchAll",6:"Symbol.replace",7:"Symbol.search",8:"Symbol.species",9:"Symbol.split",10:"Symbol.toPrimitive",11:"Symbol.toStringTag",12:"Symbol.unscopables"},ce={[Symbol.asyncIterator]:0,[Symbol.hasInstance]:1,[Symbol.isConcatSpreadable]:2,[Symbol.iterator]:3,[Symbol.match]:4,[Symbol.matchAll]:5,[Symbol.replace]:6,[Symbol.search]:7,[Symbol.species]:8,[Symbol.split]:9,[Symbol.toPrimitive]:10,[Symbol.toStringTag]:11,[Symbol.unscopables]:12},Oe={0:Symbol.asyncIterator,1:Symbol.hasInstance,2:Symbol.isConcatSpreadable,3:Symbol.iterator,4:Symbol.match,5:Symbol.matchAll,6:Symbol.replace,7:Symbol.search,8:Symbol.species,9:Symbol.split,10:Symbol.toPrimitive,11:Symbol.toStringTag,12:Symbol.unscopables},Ie={2:"!0",3:"!1",1:"void 0",0:"null",4:"-0",5:"1/0",6:"-1/0",7:"0/0"},Ce={2:!0,3:!1,1:void 0,0:null,4:-0,5:1/0,6:-1/0,7:NaN};var Z={0:"Error",1:"EvalError",2:"RangeError",3:"ReferenceError",4:"SyntaxError",5:"TypeError",6:"URIError"},ke={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError},u=Symbol("why");function R(a){return{t:2,i:void 0,s:a,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}var Q=R(2),ee=R(3),re=R(1),E=R(0),ze=R(4),Te=R(5),Be=R(6),De=R(7);function Je(a){switch(a){case'"':return'\\"';case"\\":return"\\\\";case`
2
+ `:return"\\n";case"\r":return"\\r";case"\b":return"\\b";case" ":return"\\t";case"\f":return"\\f";case"<":return"\\x3C";case"\u2028":return"\\u2028";case"\u2029":return"\\u2029";default:return}}function l(a){let e="",r=0,t;for(let n=0,s=a.length;n<s;n++)t=Je(a[n]),t&&(e+=a.slice(r,n)+t,r=n+1);return r===0?e=a:e+=a.slice(r),e}function p(a){return a.replace(/\\"/g,'"').replace(/\\\\/g,"\\").replace(/\\n/g,`
3
+ `).replace(/\\r/g,"\r").replace(/\\b/g,"\b").replace(/\\t/g," ").replace(/\\f/g,"\f").replace(/\\x3C/g,"<").replace(/\\u2028/g,"\u2028").replace(/\\u2029/g,"\u2029")}var x="__SEROVAL_REFS__",b="_$",k="$R",pe="s",me="f",ge="P",he="Ps",ve="Pf",Se="c",be="S",H="Se",Ve=`self.${b}`,Ze=`${Ve}=${Ve}||{${ge}:function(s,f,p){return(p=new Promise(function(a,b){s=a,f=b})).${pe}=s,p.${me}=f,p},uP:function(p){delete p.${pe};delete p.${me}},${he}:function(p,d){p.${pe}(d),p.status="success",p.value=d,this.uP(p)},${ve}:function(p,d){p.${me}(d),p.status="failure",p.value=d,this.uP(p)},uS:function(s){delete s.${Se}},${H}:function(s,t,d,c){switch(c=s.${Se},t){case 0:return c.enqueue(d);case 1:return(this.uS(s),c.error(d));case 2:return(this.uS(s),c.close())}},${be}:function(s,c){return(s=new ReadableStream({start:function(x){c=x}})).${Se}=c,s}}`,te=`self.${k}`;function Qe(a){return a==null?`${te}=${te}||[];`:`(${te}=${te}||{})["${l(a)}"]=[];`}var ye=new Map,A=new Map;function er(a,e){return ye.set(e,a),A.set(a,e),e}function P(a){return ye.has(a)}function rr(a){return A.has(a)}function Le(a){return S(P(a),new Error("Missing reference id")),ye.get(a)}function Fe(a){return S(rr(a),new Error("Missing reference for id:"+a)),A.get(a)}typeof globalThis!==void 0?Object.defineProperty(globalThis,x,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof window!==void 0?Object.defineProperty(window,x,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof self!==void 0?Object.defineProperty(self,x,{value:A,configurable:!0,writable:!1,enumerable:!1}):typeof global!==void 0&&Object.defineProperty(global,x,{value:A,configurable:!0,writable:!1,enumerable:!1});function ne(a){switch(a){case 1/0:return Te;case-1/0:return Be;default:return a!==a?De:Object.is(a,-0)?ze:{t:0,i:void 0,s:a,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}}function se(a){return{t:1,i:void 0,s:l(a),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ae(a){return{t:3,i:void 0,s:""+a,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ne(a){return{t:4,i:a,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function z(a,e){return{t:5,i:a,s:e.toISOString(),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:void 0,b:void 0,o:void 0}}function T(a,e){return{t:6,i:a,s:void 0,l:void 0,c:e.source,m:e.flags,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function B(a,e){let r=new Uint8Array(e),t=r.length,n=new Array(t);for(let s=0;s<t;s++)n[s]=r[s];return{t:21,i:a,s:n,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ie(a,e){return S(e in ce,new Error("Only well-known symbols are supported.")),{t:17,i:a,s:ce[e],l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Re(a,e){return{t:20,i:a,s:l(Le(e)),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function D(a,e,r){return{t:40,i:a,s:r,l:void 0,c:l(e),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}var v=(f=>(f[f.AggregateError=1]="AggregateError",f[f.ArrayPrototypeValues=2]="ArrayPrototypeValues",f[f.ArrowFunction=4]="ArrowFunction",f[f.BigInt=8]="BigInt",f[f.ErrorPrototypeStack=16]="ErrorPrototypeStack",f[f.Map=32]="Map",f[f.MethodShorthand=64]="MethodShorthand",f[f.ObjectAssign=128]="ObjectAssign",f[f.Promise=256]="Promise",f[f.Set=512]="Set",f[f.Symbol=1024]="Symbol",f[f.TypedArray=2048]="TypedArray",f[f.BigIntTypedArray=4096]="BigIntTypedArray",f[f.WebAPI=8192]="WebAPI",f))(v||{});function oe(a,e){return{body:e,cache:a.cache,credentials:a.credentials,headers:a.headers,integrity:a.integrity,keepalive:a.keepalive,method:a.method,mode:a.mode,redirect:a.redirect,referrer:a.referrer,referrerPolicy:a.referrerPolicy}}function de(a){return{headers:a.headers,status:a.status,statusText:a.statusText}}function le(a){return{bubbles:a.bubbles,cancelable:a.cancelable,composed:a.composed}}function ue(a){return{detail:a.detail,bubbles:a.bubbles,cancelable:a.cancelable,composed:a.composed}}var V=class{constructor(e){this.marked=new Set;this.plugins=e.plugins,this.features=16383^(e.disabledFeatures||0),this.refs=e.refs||new Map}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}getReference(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),Ne(r);let t=this.refs.size;return this.refs.set(e,t),P(e)?Re(t,e):t}getStrictReference(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),Ne(r);let t=this.refs.size;return this.refs.set(e,t),Re(t,e)}isIterable(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let r=e.constructor,t=this.features;if(t&2048)switch(r){case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return!1;default:break}if((t&4104)===4104)switch(r){case BigInt64Array:case BigUint64Array:return!1;default:break}if(t&32&&r===Map||t&512&&r===Set||t&8192&&(typeof Headers!="undefined"&&r===Headers||typeof File!="undefined"&&r===File))return!1;let n=this.plugins;if(n)for(let s=0,i=n.length;s<i;s++){let o=n[s];if(o.test(e)&&o.isIterable&&o.isIterable(e))return!1}return t&1024?Symbol.iterator in e:!1}};async function Ee(a){try{return[1,await a]}catch(e){return[0,e]}}function K(a){return a instanceof EvalError?1:a instanceof RangeError?2:a instanceof ReferenceError?3:a instanceof SyntaxError?4:a instanceof TypeError?5:a instanceof URIError?6:0}function Me(a){switch(a){case"Int8Array":return Int8Array;case"Int16Array":return Int16Array;case"Int32Array":return Int32Array;case"Uint8Array":return Uint8Array;case"Uint16Array":return Uint16Array;case"Uint32Array":return Uint32Array;case"Uint8ClampedArray":return Uint8ClampedArray;case"Float32Array":return Float32Array;case"Float64Array":return Float64Array;case"BigInt64Array":return BigInt64Array;case"BigUint64Array":return BigUint64Array;default:throw new Error(`Unknown TypedArray "${a}"`)}}var nr=/^[$A-Z_][0-9A-Z_$]*$/i;function xe(a){let e=a[0];return(e==="$"||e==="_"||e>="A"&&e<="Z"||e>="a"&&e<="z")&&nr.test(a)}function L(a){return Object.isFrozen(a)?3:Object.isSealed(a)?2:Object.isExtensible(a)?0:1}function F(a,e){let r,t=Z[K(a)];a.name!==t?r={name:a.name}:a.constructor.name!==t&&(r={name:a.constructor.name});let n=Object.getOwnPropertyNames(a);for(let s=0,i=n.length,o;s<i;s++)o=n[s],o!=="name"&&o!=="message"&&(o==="stack"?e&16&&(r=r||{},r[o]=a[o]):(r=r||{},r[o]=a[o]));return r}function U(a,e){return{t:18,i:a,s:l(e.href),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:void 0,b:void 0,o:void 0}}function M(a,e){return{t:19,i:a,s:l(e.toString()),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:void 0,b:void 0,o:void 0}}function j(a,e){return{t:39,i:a,s:l(e.message),l:void 0,c:l(e.name),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}var w=class extends V{async parseItems(e){let r=e.length,t=[],n=[];for(let s=0,i;s<r;s++)s in e&&(i=e[s],this.isIterable(i)?n[s]=i:t[s]=await this.parse(i));for(let s=0;s<r;s++)s in n&&(t[s]=await this.parse(n[s]));return t}async parseArray(e,r){return{t:9,i:e,s:void 0,l:r.length,c:void 0,m:void 0,p:void 0,e:void 0,a:await this.parseItems(r),f:void 0,b:void 0,o:L(r)}}async parseBoxed(e,r){return{t:27,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(r.valueOf()),b:void 0,o:void 0}}async parseTypedArray(e,r){return{t:15,i:e,s:void 0,l:r.length,c:r.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(r.buffer),b:r.byteOffset,o:void 0}}async parseBigIntTypedArray(e,r){return{t:16,i:e,s:void 0,l:r.length,c:r.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(r.buffer),b:r.byteOffset,o:void 0}}async parseDataView(e,r){return{t:22,i:e,s:void 0,l:r.byteLength,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(r.buffer),b:r.byteOffset,o:void 0}}async parseProperties(e){let r=Object.entries(e),t=[],n=[],s=[],i=[];for(let o=0,d=r.length,c,g;o<d;o++)c=l(r[o][0]),g=r[o][1],this.isIterable(g)?(s.push(c),i.push(g)):(t.push(c),n.push(await this.parse(g)));for(let o=0,d=s.length;o<d;o++)t.push(s[o]),n.push(await this.parse(i[o]));return this.features&1024&&Symbol.iterator in e&&(t.push(0),n.push(await this.parse(Array.from(e)))),{k:t,v:n,s:t.length}}async parsePlainObject(e,r,t){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:await this.parseProperties(r),e:void 0,a:void 0,f:void 0,b:void 0,o:L(r)}}async parseError(e,r){let t=F(r,this.features),n=t?await this.parseProperties(t):void 0;return{t:13,i:e,s:K(r),l:void 0,c:void 0,m:l(r.message),p:n,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}async parseMap(e,r){let t=[],n=[],s=[],i=[];for(let[o,d]of r.entries())this.isIterable(o)||this.isIterable(d)?(s.push(o),i.push(d)):(t.push(await this.parse(o)),n.push(await this.parse(d)));for(let o=0,d=s.length;o<d;o++)t.push(await this.parse(s[o])),n.push(await this.parse(i[o]));return{t:8,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:{k:t,v:n,s:r.size},a:void 0,f:void 0,b:void 0,o:void 0}}async parseSet(e,r){let t=[],n=[];for(let s of r.keys())this.isIterable(s)?n.push(s):t.push(await this.parse(s));for(let s=0,i=n.length;s<i;s++)t.push(await this.parse(n[s]));return{t:7,i:e,s:void 0,l:r.size,c:void 0,m:void 0,p:void 0,e:void 0,a:t,f:void 0,b:void 0,o:void 0}}async parseBlob(e,r){return{t:23,i:e,s:void 0,l:void 0,c:l(r.type),m:void 0,p:void 0,e:void 0,f:await this.parse(await r.arrayBuffer()),a:void 0,b:void 0,o:void 0}}async parseFile(e,r){return{t:24,i:e,s:void 0,l:void 0,c:l(r.type),m:l(r.name),p:void 0,e:void 0,f:await this.parse(await r.arrayBuffer()),a:void 0,b:r.lastModified,o:void 0}}async parsePlainProperties(e){let r=e.length,t=[],n=[],s=[],i=[];for(let o=0,d,c;o<r;o++)d=l(e[o][0]),c=e[o][1],this.isIterable(c)?(s.push(d),i.push(c)):(t.push(d),n.push(await this.parse(c)));for(let o=0,d=s.length;o<d;o++)t.push(s[o]),n.push(await this.parse(i[o]));return{k:t,v:n,s:r}}async parseHeaders(e,r){let t=[];return r.forEach((n,s)=>{t.push([s,n])}),{t:25,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:await this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}async parseFormData(e,r){let t=[];return r.forEach((n,s)=>{t.push([s,n])}),{t:26,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:await this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}async parseRequest(e,r){return{t:35,i:e,s:l(r.url),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:await this.parse(oe(r,r.body?await r.clone().arrayBuffer():null)),a:void 0,b:void 0,o:void 0}}async parseResponse(e,r){return{t:36,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:[r.body?await this.parse(await r.clone().arrayBuffer()):E,await this.parse(de(r))],b:void 0,o:void 0}}async parseEvent(e,r){return{t:37,i:e,s:l(r.type),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(le(r)),b:void 0,o:void 0}}async parseCustomEvent(e,r){return{t:38,i:e,s:l(r.type),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(ue(r)),b:void 0,o:void 0}}async parseAggregateError(e,r){let t=F(r,this.features),n=t?await this.parseProperties(t):void 0;return{t:14,i:e,s:void 0,l:void 0,c:void 0,m:l(r.message),p:n,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}async parsePromise(e,r){let[t,n]=await Ee(r);return{t:12,i:e,s:t,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:await this.parse(n),b:void 0,o:void 0}}async parsePlugin(e,r){let t=this.plugins;if(t)for(let n=0,s=t.length;n<s;n++){let i=t[n];if(i.parse.async&&i.test(r))return D(e,i.tag,await i.parse.async(r,this,{id:e}))}}async parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);let t=r.constructor;switch(t){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return z(e,r);case RegExp:return T(e,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(e,r);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(e,r);default:break}let n=this.features;if(n&256&&(t===Promise||r instanceof Promise))return this.parsePromise(e,r);if(n&2048)switch(t){case ArrayBuffer:return B(e,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(e,r);case DataView:return this.parseDataView(e,r);default:break}if((n&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(n&32&&t===Map)return this.parseMap(e,r);if(n&512&&t===Set)return this.parseSet(e,r);if(n&8192)switch(t){case(typeof URL!="undefined"?URL:u):return U(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:u):return M(e,r);case(typeof Blob!="undefined"?Blob:u):return this.parseBlob(e,r);case(typeof File!="undefined"?File:u):return this.parseFile(e,r);case(typeof Headers!="undefined"?Headers:u):return this.parseHeaders(e,r);case(typeof FormData!="undefined"?FormData:u):return this.parseFormData(e,r);case(typeof Request!="undefined"?Request:u):return this.parseRequest(e,r);case(typeof Response!="undefined"?Response:u):return this.parseResponse(e,r);case(typeof Event!="undefined"?Event:u):return this.parseEvent(e,r);case(typeof CustomEvent!="undefined"?CustomEvent:u):return this.parseCustomEvent(e,r);case(typeof DOMException!="undefined"?DOMException:u):return j(e,r);default:break}let s=await this.parsePlugin(e,r);if(s)return s;if(n&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(n&1024&&Symbol.iterator in r)return this.parsePlainObject(e,r,!!t);throw new m(r)}async parse(e){switch(e){case!0:return Q;case!1:return ee;case void 0:return re;case null:return E;default:break}switch(typeof e){case"string":return se(e);case"number":return ne(e);case"bigint":return S(this.features&8,new m(e)),ae(e);case"object":{let r=this.getReference(e);return typeof r=="number"?this.parseObject(r,e):r}case"symbol":{S(this.features&1024,new m(e));let r=this.getReference(e);return typeof r=="number"?ie(r,e):r}case"function":return S(P(e),new Error("Cannot serialize function without reference ID.")),this.getStrictReference(e);default:throw new m(e)}}};var _=class extends w{constructor(){super(...arguments);this.mode="vanilla"}};function je(a,e){switch(e){case 3:return Object.freeze(a);case 1:return Object.preventExtensions(a);case 2:return Object.seal(a);default:return a}}function sr(){let a,e;return{resolve(r){a(r)},reject(r){e(r)},promise:new Promise((r,t)=>{a=r,e=t})}}var G=class{constructor(e){this.values=new Map;this.plugins=e.plugins,this.refs=new Set(e.markedRefs)}assignIndexedValue(e,r){return this.refs.has(e)&&this.values.set(e,r),r}deserializeReference(e){return this.assignIndexedValue(e.i,Fe(p(e.s)))}deserializeArray(e){let r=e.l,t=this.assignIndexedValue(e.i,new Array(r)),n;for(let s=0;s<r;s++)n=e.a[s],n&&(t[s]=this.deserialize(n));return je(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let n,s,i=e.k,o=e.v;for(let d=0;d<t;d++)switch(n=i[d],s=this.deserialize(o[d]),n){case 0:{let c=s;r[Symbol.iterator]=()=>c.values()}break;default:r[p(n)]=s;break}}return r}deserializeObject(e){let r=this.assignIndexedValue(e.i,e.t===10?{}:Object.create(null));return this.deserializeProperties(e.p,r),je(r,e.o),r}deserializeDate(e){return this.assignIndexedValue(e.i,new Date(e.s))}deserializeRegExp(e){return this.assignIndexedValue(e.i,new RegExp(e.c,e.m))}deserializeSet(e){let r=this.assignIndexedValue(e.i,new Set),t=e.a;for(let n=0,s=e.l;n<s;n++)r.add(this.deserialize(t[n]));return r}deserializeMap(e){let r=this.assignIndexedValue(e.i,new Map),t=e.e.k,n=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(this.deserialize(t[s]),this.deserialize(n[s]));return r}deserializeArrayBuffer(e){let r=new Uint8Array(e.s);return this.assignIndexedValue(e.i,r.buffer)}deserializeTypedArray(e){let r=Me(e.c),t=this.deserialize(e.f);return this.assignIndexedValue(e.i,new r(t,e.b,e.l))}deserializeDataView(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new DataView(r,e.b,e.l))}deserializeDictionary(e,r){if(e.p){let t=this.deserializeProperties(e.p,{});Object.assign(r,t)}return r}deserializeAggregateError(e){let r=this.assignIndexedValue(e.i,new AggregateError([],p(e.m)));return this.deserializeDictionary(e,r)}deserializeError(e){let r=ke[e.s],t=this.assignIndexedValue(e.i,new r(p(e.m)));return this.deserializeDictionary(e,t)}async deserializePromise(e){let r=sr(),t=this.assignIndexedValue(e.i,r.promise),n=this.deserialize(e.f);return e.s?r.resolve(n):r.reject(n),t}deserializeURL(e){return this.assignIndexedValue(e.i,new URL(p(e.s)))}deserializeURLSearchParams(e){return this.assignIndexedValue(e.i,new URLSearchParams(p(e.s)))}deserializeBlob(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new Blob([r],{type:p(e.c)}))}deserializeFile(e){let r=this.deserialize(e.f);return this.assignIndexedValue(e.i,new File([r],p(e.m),{type:p(e.c),lastModified:e.b}))}deserializeHeaders(e){let r=this.assignIndexedValue(e.i,new Headers),t=e.e.k,n=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(p(t[s]),this.deserialize(n[s]));return r}deserializeFormData(e){let r=this.assignIndexedValue(e.i,new FormData),t=e.e.k,n=e.e.v;for(let s=0,i=e.e.s;s<i;s++)r.set(p(t[s]),this.deserialize(n[s]));return r}deserializeBoxed(e){return this.assignIndexedValue(e.i,Object(this.deserialize(e.f)))}deserializeRequest(e){return this.assignIndexedValue(e.i,new Request(p(e.s),this.deserialize(e.f)))}deserializeResponse(e){return this.assignIndexedValue(e.i,new Response(this.deserialize(e.a[0]),this.deserialize(e.a[1])))}deserializeEvent(e){return this.assignIndexedValue(e.i,new Event(p(e.s),this.deserialize(e.f)))}deserializeCustomEvent(e){return this.assignIndexedValue(e.i,new CustomEvent(p(e.s),this.deserialize(e.f)))}deserializeDOMException(e){return this.assignIndexedValue(e.i,new DOMException(p(e.s),p(e.c)))}deserializePlugin(e){let r=this.plugins;if(r)for(let t=0,n=r.length;t<n;t++){let s=r[t];if(s.tag===e.c)return s.deserialize(e.s,this,{id:e.i})}throw new Error('Missing plugin for tag "'+e.c+'".')}deserialize(e){switch(e.t){case 2:return Ce[e.s];case 0:return e.s;case 1:return p(e.s);case 3:return BigInt(e.s);case 4:return this.values.get(e.i);case 20:return this.deserializeReference(e);case 9:return this.deserializeArray(e);case 10:case 11:return this.deserializeObject(e);case 5:return this.deserializeDate(e);case 6:return this.deserializeRegExp(e);case 7:return this.deserializeSet(e);case 8:return this.deserializeMap(e);case 21:return this.deserializeArrayBuffer(e);case 16:case 15:return this.deserializeTypedArray(e);case 22:return this.deserializeDataView(e);case 14:return this.deserializeAggregateError(e);case 13:return this.deserializeError(e);case 12:return this.deserializePromise(e);case 17:return Oe[e.s];case 18:return this.deserializeURL(e);case 19:return this.deserializeURLSearchParams(e);case 23:return this.deserializeBlob(e);case 24:return this.deserializeFile(e);case 25:return this.deserializeHeaders(e);case 26:return this.deserializeFormData(e);case 27:return this.deserializeBoxed(e);case 35:return this.deserializeRequest(e);case 36:return this.deserializeResponse(e);case 37:return this.deserializeEvent(e);case 38:return this.deserializeCustomEvent(e);case 39:return this.deserializeDOMException(e);case 40:return this.deserializePlugin(e);default:throw new Error("invariant")}}};function W(a){switch(a.t){case"index":return a.s+"="+a.v;case"set":return a.s+".set("+a.k+","+a.v+")";case"add":return a.s+".add("+a.v+")";case"delete":return a.s+".delete("+a.k+")";default:return""}}function ar(a){let e=[],r=a[0];for(let t=1,n=a.length,s,i=r;t<n;t++)s=a[t],s.t==="index"&&s.v===i.v?r={t:"index",s:s.s,k:void 0,v:W(r)}:s.t==="set"&&s.s===i.s?r={t:"set",s:W(r),k:s.k,v:s.v}:s.t==="add"&&s.s===i.s?r={t:"add",s:W(r),k:void 0,v:s.v}:s.t==="delete"&&s.s===i.s?r={t:"delete",s:W(r),k:s.k,v:void 0}:(e.push(r),r=s),i=s;return e.push(r),e}function _e(a){if(a.length){let e="",r=ar(a);for(let t=0,n=r.length;t<n;t++)e+=W(r[t])+",";return e}}var ir="Object.create(null)",or="new Set",dr="new Map",lr="Promise.resolve",ur="Promise.reject",qe="Symbol.iterator";var fr={0:"[]"},cr={3:"Object.freeze",2:"Object.seal",1:"Object.preventExtensions",0:void 0},O=class{constructor(e){this.stack=[];this.flags=[];this.assignments=[];this.specials=new Set;this.plugins=e.plugins,this.features=e.features,this.marked=new Set(e.markedRefs)}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}getSpecialReference(e){let r=this.getRefParam("_"+e);return this.specials.has(e)?r:(this.specials.add(e),r+"="+fr[e])}pushObjectFlag(e,r){e!==0&&(this.markRef(r),this.flags.push({type:e,value:this.getRefParam(r)}))}resolveFlags(){let e="";for(let r=0,t=this.flags,n=t.length;r<n;r++){let s=t[r];e+=cr[s.type]+"("+s.value+"),"}return e}resolvePatches(){let e=_e(this.assignments),r=this.resolveFlags();return e?r?e+r:e:r}createAssignment(e,r){this.assignments.push({t:"index",s:e,k:void 0,v:r})}createAddAssignment(e,r){this.assignments.push({t:"add",s:this.getRefParam(e),k:void 0,v:r})}createSetAssignment(e,r,t){this.assignments.push({t:"set",s:this.getRefParam(e),k:r,v:t})}createDeleteAssignment(e,r){this.assignments.push({t:"delete",s:this.getRefParam(e),k:r,v:void 0})}createArrayAssign(e,r,t){this.createAssignment(this.getRefParam(e)+"["+r+"]",t)}createObjectAssign(e,r,t){this.createAssignment(this.getRefParam(e)+"."+r,t)}isIndexedValueInStack(e){return e.t===4&&this.stack.includes(e.i)}serializeReference(e){return this.assignIndexedValue(e.i,x+'.get("'+e.s+'")')}getIterableAccess(){return this.features&2?".values()":"["+qe+"]()"}serializeIterable(e){let r="["+qe+"]",t=this.stack;this.stack=[];let n=this.serialize(e)+this.getIterableAccess();return this.stack=t,this.features&4?n=":()=>"+n:this.features&64?n="(){return "+n+"}":n=":function(){return "+n+"}",r+n}serializeArrayItem(e,r,t){return r?this.isIndexedValueInStack(r)?(this.markRef(e),this.createArrayAssign(e,t,this.getRefParam(r.i)),""):this.serialize(r):""}serializeArray(e){let r=e.i;if(e.l){this.stack.push(r);let t=e.a,n=this.serializeArrayItem(r,t[0],0),s=n==="";for(let i=1,o=e.l,d;i<o;i++)d=this.serializeArrayItem(r,t[i],i),n+=","+d,s=d==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+n+(s?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){switch(r){case 0:return this.serializeIterable(t);default:{let n=Number(r),s=n>=0||xe(r);if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.markRef(e),s&&n!==n?this.createObjectAssign(e,r,i):this.createArrayAssign(e,s?r:'"'+r+'"',i),""}return(s?r:'"'+r+'"')+":"+this.serialize(t)}}}serializeProperties(e,r){let t=r.s;if(t){this.stack.push(e);let n=r.k,s=r.v,i=this.serializeProperty(e,n[0],s[0]);for(let o=1,d=i;o<t;o++)d=this.serializeProperty(e,n[o],s[o]),i+=(d&&i&&",")+d;return this.stack.pop(),"{"+i+"}"}return"{}"}serializeObject(e){return this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(e.i,this.serializeProperties(e.i,e.p))}serializeWithObjectAssign(e,r,t){let n=this.serializeProperties(r,e);return n!=="{}"?"Object.assign("+t+","+n+")":t}serializeAssignment(e,r,t,n){switch(t){case 0:{let s=this.stack;this.stack=[];let i=this.serialize(n)+this.getIterableAccess();this.stack=s;let o=this.assignments;this.assignments=r,this.createArrayAssign(e,this.getSpecialReference(0),this.features&4?"()=>"+i:"function(){return "+i+"}"),this.assignments=o}break;default:{let s=this.serialize(n),i=Number(t),o=i>=0||xe(t);if(this.isIndexedValueInStack(n))o&&i!==i?this.createObjectAssign(e,t,s):this.createArrayAssign(e,o?t:'"'+t+'"',s);else{let d=this.assignments;this.assignments=r,o?this.createObjectAssign(e,t,s):this.createArrayAssign(e,o?t:'"'+t+'"',s),this.assignments=d}}}}serializeAssignments(e,r){let t=r.s;if(t){this.stack.push(e);let n=[],s=r.k,i=r.v;for(let o=0;o<t;o++)this.serializeAssignment(e,n,s[o],i[o]);return this.stack.pop(),_e(n)}}serializeDictionary(e,r,t){if(r)if(this.features&128)t=this.serializeWithObjectAssign(r,e,t);else{this.markRef(e);let n=this.serializeAssignments(e,r);if(n)return"("+this.assignIndexedValue(e,t)+","+n+this.getRefParam(e)+")"}return this.assignIndexedValue(e,t)}serializeNullConstructor(e){return this.pushObjectFlag(e.o,e.i),this.serializeDictionary(e.i,e.p,ir)}serializeDate(e){return this.assignIndexedValue(e.i,'new Date("'+e.s+'")')}serializeRegExp(e){return this.assignIndexedValue(e.i,"/"+e.c+"/"+e.m)}serializeSetItem(e,r){return this.isIndexedValueInStack(r)?(this.markRef(e),this.createAddAssignment(e,this.getRefParam(r.i)),""):this.serialize(r)}serializeSet(e){let r=or,t=e.l,n=e.i;if(t){let s=e.a;this.stack.push(n);let i=this.serializeSetItem(n,s[0]);for(let o=1,d=i;o<t;o++)d=this.serializeSetItem(n,s[o]),i+=(d&&i&&",")+d;this.stack.pop(),i&&(r+="(["+i+"])")}return this.assignIndexedValue(n,r)}serializeMapEntry(e,r,t){if(this.isIndexedValueInStack(r)){let n=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.createSetAssignment(e,n,i),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let i="("+this.serialize(t)+",["+this.getSpecialReference(0)+","+this.getSpecialReference(0)+"])";return this.createSetAssignment(e,n,this.getRefParam(t.i)),this.createDeleteAssignment(e,this.getSpecialReference(0)),i}let s=this.stack;return this.stack=[],this.createSetAssignment(e,n,this.serialize(t)),this.stack=s,""}if(this.isIndexedValueInStack(t)){let n=this.getRefParam(t.i);if(this.markRef(e),r.t!==4&&r.i!=null&&this.isMarked(r.i)){let i="("+this.serialize(r)+",["+this.getSpecialReference(0)+","+this.getSpecialReference(0)+"])";return this.createSetAssignment(e,this.getRefParam(r.i),n),this.createDeleteAssignment(e,this.getSpecialReference(0)),i}let s=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),n),this.stack=s,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=dr,t=e.e.s,n=e.i;if(t){let s=e.e.k,i=e.e.v;this.stack.push(n);let o=this.serializeMapEntry(n,s[0],i[0]);for(let d=1,c=o;d<t;d++)c=this.serializeMapEntry(n,s[d],i[d]),o+=(c&&o&&",")+c;this.stack.pop(),o&&(r+="(["+o+"])")}return this.assignIndexedValue(n,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,n=t.length;if(n){r+="["+t[0];for(let s=1;s<n;s++)r+=","+t[s];r+="]"}return this.assignIndexedValue(e.i,r+").buffer")}serializeTypedArray(e){return this.assignIndexedValue(e.i,"new "+e.c+"("+this.serialize(e.f)+","+e.b+","+e.l+")")}serializeDataView(e){return this.assignIndexedValue(e.i,"new DataView("+this.serialize(e.f)+","+e.b+","+e.l+")")}serializeAggregateError(e){let r=e.i;this.stack.push(r);let t='new AggregateError([],"'+e.m+'")';return this.stack.pop(),this.serializeDictionary(r,e.p,t)}serializeError(e){return this.serializeDictionary(e.i,e.p,"new "+Z[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,n=e.i,s=e.s?lr:ur;if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);this.features&4?e.s?r=s+"().then(()=>"+i+")":r=s+"().catch(()=>{throw "+i+"})":e.s?r=s+"().then(function(){return "+i+"})":r=s+"().catch(function(){throw "+i+"})"}else{this.stack.push(n);let i=this.serialize(t);this.stack.pop(),r=s+"("+i+")"}return this.assignIndexedValue(n,r)}serializeWKSymbol(e){return this.assignIndexedValue(e.i,we[e.s])}serializeURL(e){return this.assignIndexedValue(e.i,'new URL("'+e.s+'")')}serializeURLSearchParams(e){return this.assignIndexedValue(e.i,e.s?'new URLSearchParams("'+e.s+'")':"new URLSearchParams")}serializeBlob(e){return this.assignIndexedValue(e.i,"new Blob(["+this.serialize(e.f)+'],{type:"'+e.c+'"})')}serializeFile(e){return this.assignIndexedValue(e.i,"new File(["+this.serialize(e.f)+'],"'+e.m+'",{type:"'+e.c+'",lastModified:'+e.b+"})")}serializeHeaders(e){return this.assignIndexedValue(e.i,"new Headers("+this.serializeProperties(e.i,e.e)+")")}serializeFormDataEntry(e,r,t){return this.getRefParam(e)+'.append("'+r+'",'+this.serialize(t)+")"}serializeFormDataEntries(e,r){let t=e.e.k,n=e.e.v,s=e.i,i=this.serializeFormDataEntry(s,t[0],n[0]);for(let o=1;o<r;o++)i+=","+this.serializeFormDataEntry(s,t[o],n[o]);return i}serializeFormData(e){let r=e.e.s,t=e.i;r&&this.markRef(t);let n=this.assignIndexedValue(t,"new FormData()");if(r){let s=this.serializeFormDataEntries(e,r);return"("+n+","+(s?s+",":"")+this.getRefParam(t)+")"}return n}serializeBoxed(e){return this.assignIndexedValue(e.i,"Object("+this.serialize(e.f)+")")}serializeRequest(e){return this.assignIndexedValue(e.i,'new Request("'+e.s+'",'+this.serialize(e.f)+")")}serializeResponse(e){return this.assignIndexedValue(e.i,"new Response("+this.serialize(e.a[0])+","+this.serialize(e.a[1])+")")}serializeEvent(e){return this.assignIndexedValue(e.i,'new Event("'+e.s+'",'+this.serialize(e.f)+")")}serializeCustomEvent(e){return this.assignIndexedValue(e.i,'new CustomEvent("'+e.s+'",'+this.serialize(e.f)+")")}serializeDOMException(e){return this.assignIndexedValue(e.i,'new DOMException("'+e.s+'","'+e.c+'")')}serializePlugin(e){let r=this.plugins;if(r)for(let t=0,n=r.length;t<n;t++){let s=r[t];if(s.tag===e.c)return s.serialize(e.s,this,{id:e.i})}throw new Error('Missing plugin for tag "'+e.c+'".')}serialize(e){switch(e.t){case 2:return Ie[e.s];case 0:return""+e.s;case 1:return'"'+e.s+'"';case 3:return e.s+"n";case 4:return this.getRefParam(e.i);case 20:return this.serializeReference(e);case 9:return this.serializeArray(e);case 10:return this.serializeObject(e);case 11:return this.serializeNullConstructor(e);case 5:return this.serializeDate(e);case 6:return this.serializeRegExp(e);case 7:return this.serializeSet(e);case 8:return this.serializeMap(e);case 21:return this.serializeArrayBuffer(e);case 16:case 15:return this.serializeTypedArray(e);case 22:return this.serializeDataView(e);case 14:return this.serializeAggregateError(e);case 13:return this.serializeError(e);case 12:return this.serializePromise(e);case 17:return this.serializeWKSymbol(e);case 18:return this.serializeURL(e);case 19:return this.serializeURLSearchParams(e);case 23:return this.serializeBlob(e);case 24:return this.serializeFile(e);case 25:return this.serializeHeaders(e);case 26:return this.serializeFormData(e);case 27:return this.serializeBoxed(e);case 28:return this.serializePromiseConstructor(e);case 29:return this.serializePromiseResolve(e);case 30:return this.serializePromiseReject(e);case 31:return this.serializeReadableStreamConstructor(e);case 32:return this.serializeReadableStreamEnqueue(e);case 34:return this.serializeReadableStreamError(e);case 33:return this.serializeReadableStreamClose(e);case 35:return this.serializeRequest(e);case 36:return this.serializeResponse(e);case 37:return this.serializeEvent(e);case 38:return this.serializeCustomEvent(e);case 39:return this.serializeDOMException(e);case 40:return this.serializePlugin(e);default:throw new Error("invariant")}}};var Ge="hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_",He=Ge.length,We="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",Ke=We.length;function Pe(a){let e=a%He,r=Ge[e];for(a=(a-e)/He;a>0;)e=a%Ke,r+=We[e],a=(a-e)/Ke;return r}var I=class extends O{constructor(){super(...arguments);this.mode="vanilla";this.valid=new Map;this.vars=[]}markRef(r){this.marked.add(r)}getRefParam(r){let t=this.valid.get(r);t==null&&(t=this.valid.size,this.valid.set(r,t));let n=this.vars[t];return n==null&&(n=Pe(t),this.vars[t]=n),n}assignIndexedValue(r,t){return this.isMarked(r)?this.getRefParam(r)+"="+t:t}serializePromiseConstructor(r){throw new Error('Unsupported node type "'+r.t+'".')}serializePromiseResolve(r){throw new Error('Unsupported node type "'+r.t+'".')}serializePromiseReject(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamConstructor(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamEnqueue(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamError(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeReadableStreamClose(r){throw new Error('Unsupported node type "'+r.t+'".')}serializeTop(r){let t=this.serialize(r);if(r.i!=null&&this.vars.length){let n=this.resolvePatches(),s=t;if(n){let o=this.getRefParam(r.i);s=t+","+n+o,t.startsWith(o+"=")||(s=o+"="+s)}let i=this.vars.length>1?this.vars.join(","):this.vars[0];return this.features&4?(i=this.vars.length>1||this.vars.length===0?"("+i+")":i,"("+i+"=>("+s+"))()"):"(function("+i+"){return "+s+"})()"}return r.t===10?"("+t+")":t}};var y=class extends V{parseItems(e){let r=e.length,t=[],n=[];for(let s=0,i;s<r;s++)s in e&&(i=e[s],this.isIterable(i)?n[s]=i:t[s]=this.parse(i));for(let s=0;s<r;s++)s in n&&(t[s]=this.parse(n[s]));return t}parseArray(e,r){return{t:9,i:e,s:void 0,l:r.length,c:void 0,m:void 0,p:void 0,e:void 0,a:this.parseItems(r),f:void 0,b:void 0,o:L(r)}}parseProperties(e){let r=Object.entries(e),t=[],n=[],s=[],i=[];for(let o=0,d=r.length,c,g;o<d;o++)c=l(r[o][0]),g=r[o][1],this.isIterable(g)?(s.push(c),i.push(g)):(t.push(c),n.push(this.parse(g)));for(let o=0,d=s.length;o<d;o++)t.push(s[o]),n.push(this.parse(i[o]));return this.features&1024&&Symbol.iterator in e&&(t.push(0),n.push(this.parse(Array.from(e)))),{k:t,v:n,s:t.length}}parsePlainObject(e,r,t){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:this.parseProperties(r),e:void 0,a:void 0,f:void 0,b:void 0,o:L(r)}}parseBoxed(e,r){return{t:27,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(r.valueOf()),b:void 0,o:void 0}}parseTypedArray(e,r){return{t:15,i:e,s:void 0,l:r.length,c:r.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(r.buffer),b:r.byteOffset,o:void 0}}parseBigIntTypedArray(e,r){return{t:16,i:e,s:void 0,l:r.length,c:r.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(r.buffer),b:r.byteOffset,o:void 0}}parseDataView(e,r){return{t:22,i:e,s:void 0,l:r.byteLength,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(r.buffer),b:r.byteOffset,o:void 0}}parseError(e,r){let t=F(r,this.features),n=t?this.parseProperties(t):void 0;return{t:13,i:e,s:K(r),l:void 0,c:void 0,m:l(r.message),p:n,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parseMap(e,r){let t=[],n=[],s=[],i=[];for(let[o,d]of r.entries())this.isIterable(o)||this.isIterable(d)?(s.push(o),i.push(d)):(t.push(this.parse(o)),n.push(this.parse(d)));for(let o=0,d=s.length;o<d;o++)t.push(this.parse(s[o])),n.push(this.parse(i[o]));return{t:8,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:{k:t,v:n,s:r.size},a:void 0,f:void 0,b:void 0,o:void 0}}parseSet(e,r){let t=[],n=[];for(let s of r.keys())this.isIterable(s)?n.push(s):t.push(this.parse(s));for(let s=0,i=n.length;s<i;s++)t.push(this.parse(n[s]));return{t:7,i:e,s:void 0,l:r.size,c:void 0,m:void 0,p:void 0,e:void 0,a:t,f:void 0,b:void 0,o:void 0}}parsePlainProperties(e){let r=e.length,t=[],n=[],s=[],i=[];for(let o=0,d,c;o<r;o++)d=l(e[o][0]),c=e[o][1],this.isIterable(c)?(s.push(d),i.push(c)):(t.push(d),n.push(this.parse(c)));for(let o=0,d=s.length;o<d;o++)t.push(s[o]),n.push(this.parse(i[o]));return{k:t,v:n,s:r}}parseHeaders(e,r){let t=[];return r.forEach((n,s)=>{t.push([s,n])}),{t:25,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}parseFormData(e,r){let t=[];return r.forEach((n,s)=>{t.push([s,n])}),{t:26,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:this.parsePlainProperties(t),a:void 0,f:void 0,b:void 0,o:void 0}}parseEvent(e,r){return{t:37,i:e,s:l(r.type),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(le(r)),b:void 0,o:void 0}}parseCustomEvent(e,r){return{t:38,i:e,s:l(r.type),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parse(ue(r)),b:void 0,o:void 0}}parseAggregateError(e,r){let t=F(r,this.features),n=t?this.parseProperties(t):void 0;return{t:14,i:e,s:void 0,l:void 0,c:void 0,m:l(r.message),p:n,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parsePlugin(e,r){let t=this.plugins;if(t)for(let n=0,s=t.length;n<s;n++){let i=t[n];if(i.parse.sync&&i.test(r))return D(e,i.tag,i.parse.sync(r,this,{id:e}))}}parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);let t=r.constructor;switch(t){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return z(e,r);case RegExp:return T(e,r);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(e,r);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(e,r);default:break}let n=this.features;if(n&2048)switch(t){case ArrayBuffer:return B(e,r);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(e,r);case DataView:return this.parseDataView(e,r);default:break}if((n&4104)===4104)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(n&32&&t===Map)return this.parseMap(e,r);if(n&512&&t===Set)return this.parseSet(e,r);if(n&8192)switch(t){case(typeof URL!="undefined"?URL:u):return U(e,r);case(typeof URLSearchParams!="undefined"?URLSearchParams:u):return M(e,r);case(typeof Headers!="undefined"?Headers:u):return this.parseHeaders(e,r);case(typeof FormData!="undefined"?FormData:u):return this.parseFormData(e,r);case(typeof Event!="undefined"?Event:u):return this.parseEvent(e,r);case(typeof CustomEvent!="undefined"?CustomEvent:u):return this.parseCustomEvent(e,r);case(typeof DOMException!="undefined"?DOMException:u):return j(e,r);default:break}let s=this.parsePlugin(e,r);if(s)return s;if(n&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(n&1024&&Symbol.iterator in r)return this.parsePlainObject(e,r,!!t);throw new m(r)}parse(e){switch(e){case!0:return Q;case!1:return ee;case void 0:return re;case null:return E;default:break}switch(typeof e){case"string":return se(e);case"number":return ne(e);case"bigint":return S(this.features&8,new m(e)),ae(e);case"object":{let r=this.getReference(e);return typeof r=="number"?this.parseObject(r,e):r}case"symbol":{S(this.features&1024,new m(e));let r=this.getReference(e);return typeof r=="number"?ie(r,e):r}case"function":return S(P(e),new Error("Cannot serialize function without reference ID.")),this.getStrictReference(e);default:throw new m(e)}}};var q=class extends y{constructor(){super(...arguments);this.mode="vanilla"}};function $e(a,e={}){let r=new q({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=r.parse(a);return new I({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}async function Wt(a,e={}){let r=new _({plugins:e.plugins,disabledFeatures:e.disabledFeatures}),t=await r.parse(a);return new I({plugins:e.plugins,features:r.features,markedRefs:r.marked}).serializeTop(t)}function $t(a){return(0,eval)(a)}function Xt(a,e={}){let r=new q({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:r.parse(a),f:r.features,m:Array.from(r.marked)}}async function Yt(a,e={}){let r=new _({plugins:e.plugins,disabledFeatures:e.disabledFeatures});return{t:await r.parse(a),f:r.features,m:Array.from(r.marked)}}function Jt(a,e={}){return new I({plugins:e.plugins,features:a.f,markedRefs:a.m}).serializeTop(a.t)}function Zt(a,e={}){return new G({plugins:e.plugins,markedRefs:a.m}).deserialize(a.t)}var $=class extends w{constructor(){super(...arguments);this.mode="cross"}};var C=class extends O{constructor(r){super(r);this.mode="cross";this.scopeId=r.scopeId}getRefParam(r){return typeof r=="string"?k+"."+r:k+"["+r+"]"}assignIndexedValue(r,t){return this.getRefParam(r)+"="+t}serializePromiseConstructor(r){return this.assignIndexedValue(r.i,b+"."+ge+"()")}serializePromiseResolve(r){return b+"."+he+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializePromiseReject(r){return b+"."+ve+"("+this.getRefParam(r.i)+","+this.serialize(r.f)+")"}serializeReadableStreamConstructor(r){return this.assignIndexedValue(r.i,b+"."+be+"()")}serializeReadableStreamEnqueue(r){return b+"."+H+"("+this.getRefParam(r.i)+",0,"+this.serialize(r.f)+")"}serializeReadableStreamError(r){return b+"."+H+"("+this.getRefParam(r.i)+",1,"+this.serialize(r.f)+")"}serializeReadableStreamClose(r){return b+"."+H+"("+this.getRefParam(r.i)+",2)"}serializeTop(r){let t=this.serialize(r),n=r.i;if(n==null)return t;let s=this.resolvePatches(),i=this.getRefParam(n),o=this.scopeId==null?"":k,d=s?t+","+s:t;if(o==="")return s?"("+d+i+")":d;let c=this.scopeId==null?"()":"("+k+'["'+l(this.scopeId)+'"])',g=d+(s?i:"");return this.features&4?"("+o+"=>("+g+"))"+c:"(function("+o+"){return "+g+"})"+c}};var X=class extends y{constructor(r){super(r);this.alive=!0;this.pending=0;this.onParseCallback=r.onParse,this.onErrorCallback=r.onError,this.onDoneCallback=r.onDone}onParse(r,t){this.onParseCallback(r,t)}onError(r){if(this.onErrorCallback)this.onErrorCallback(r);else throw r}onDone(){this.onDoneCallback&&this.onDoneCallback()}push(r){this.onParse(this.parse(r),!1)}pushPendingState(){this.pending++}popPendingState(){--this.pending<=0&&this.onDone()}pushReadableStreamReader(r,t){t.read().then(n=>{if(this.alive)if(n.done)this.onParse({t:33,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0},!1),this.popPendingState();else{let s=this.parseWithError(n.value);s&&(this.onParse({t:32,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:s,b:void 0,o:void 0},!1),this.pushReadableStreamReader(r,t))}},n=>{if(this.alive){let s=this.parseWithError(n);s&&(this.onParse({t:34,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState())}})}parseReadableStream(r,t){let n=t.getReader();return this.pushPendingState(),this.pushReadableStreamReader(r,n),{t:31,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parseRequest(r,t){return{t:35,i:r,s:l(t.url),l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:this.parse(oe(t,t.clone().body)),a:void 0,b:void 0,o:void 0}}parseResponse(r,t){return{t:36,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,f:void 0,a:[t.body?this.parse(t.clone().body):E,this.parse(de(t))],b:void 0,o:void 0}}parsePromise(r,t){return t.then(n=>{let s=this.parseWithError(n);s&&(this.onParse({t:29,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState())},n=>{if(this.alive){let s=this.parseWithError(n);s&&(this.onParse({t:30,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:s,b:void 0,o:void 0},!1),this.popPendingState())}}),this.pushPendingState(),{t:28,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}parsePlugin(r,t){let n=this.plugins;if(n)for(let s=0,i=n.length;s<i;s++){let o=n[s];if(o.parse.stream&&o.test(t))return D(r,o.tag,o.parse.stream(t,this,{id:r}))}}parseObject(r,t){if(Array.isArray(t))return this.parseArray(r,t);let n=t.constructor;switch(n){case Object:return this.parsePlainObject(r,t,!1);case void 0:return this.parsePlainObject(r,t,!0);case Date:return z(r,t);case RegExp:return T(r,t);case Error:case EvalError:case RangeError:case ReferenceError:case SyntaxError:case TypeError:case URIError:return this.parseError(r,t);case Number:case Boolean:case String:case BigInt:return this.parseBoxed(r,t);default:break}let s=this.features;if(s&256&&(n===Promise||t instanceof Promise))return this.parsePromise(r,t);if(s&2048)switch(n){case ArrayBuffer:return B(r,t);case Int8Array:case Int16Array:case Int32Array:case Uint8Array:case Uint16Array:case Uint32Array:case Uint8ClampedArray:case Float32Array:case Float64Array:return this.parseTypedArray(r,t);case DataView:return this.parseDataView(r,t);default:break}if((s&4104)===4104)switch(n){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(r,t);default:break}if(s&32&&n===Map)return this.parseMap(r,t);if(s&512&&n===Set)return this.parseSet(r,t);if(s&8192)switch(n){case(typeof URL!="undefined"?URL:u):return U(r,t);case(typeof URLSearchParams!="undefined"?URLSearchParams:u):return M(r,t);case(typeof Headers!="undefined"?Headers:u):return this.parseHeaders(r,t);case(typeof FormData!="undefined"?FormData:u):return this.parseFormData(r,t);case(typeof ReadableStream!="undefined"?ReadableStream:u):return this.parseReadableStream(r,t);case(typeof Request!="undefined"?Request:u):return this.parseRequest(r,t);case(typeof Response!="undefined"?Response:u):return this.parseResponse(r,t);case(typeof Event!="undefined"?Event:u):return this.parseEvent(r,t);case(typeof CustomEvent!="undefined"?CustomEvent:u):return this.parseCustomEvent(r,t);case(typeof DOMException!="undefined"?DOMException:u):return j(r,t);default:break}let i=this.parsePlugin(r,t);if(i)return i;if(s&1&&typeof AggregateError!="undefined"&&(n===AggregateError||t instanceof AggregateError))return this.parseAggregateError(r,t);if(t instanceof Error)return this.parseError(r,t);if(s&1024&&Symbol.iterator in t)return this.parsePlainObject(r,t,!!n);throw new m(t)}parseWithError(r){try{return this.parse(r)}catch(t){this.onError(t);return}}start(r){let t=this.parseWithError(r);t&&(this.onParse(t,!0),this.pending<=0&&this.destroy())}destroy(){this.alive&&(this.onDone(),this.alive=!1)}isAlive(){return this.alive}};var Y=class extends X{constructor(){super(...arguments);this.mode="cross"}};var J=class extends y{constructor(){super(...arguments);this.mode="cross"}};function Pn(a,e={}){let r=new J({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=r.parse(a);return new C({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}).serializeTop(t)}async function wn(a,e={}){let r=new $({plugins:e.plugins,disabledFeatures:e.disabledFeatures,refs:e.refs}),t=await r.parse(a);return new C({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}).serializeTop(t)}function Xe(a,e){let r=new Y({refs:e.refs,disabledFeatures:e.disabledFeatures,onParse(t,n){let s=new C({plugins:e.plugins,features:r.features,scopeId:e.scopeId,markedRefs:r.marked}),i;try{i=s.serializeTop(t)}catch(o){e.onError&&e.onError(o);return}e.onSerialize(i,n)},onError:e.onError,onDone:e.onDone});return r.start(a),()=>{r.destroy()}}var fe=class{constructor(e){this.options=e;this.alive=!0;this.flushed=!1;this.done=!1;this.pending=0;this.cleanups=[];this.refs=new Map;this.keys=new Set;this.ids=0}write(e,r){this.alive&&!this.flushed&&(this.pending++,this.keys.add(e),this.cleanups.push(Xe(r,{plugins:this.options.plugins,scopeId:this.options.scopeId,refs:this.refs,disabledFeatures:this.options.disabledFeatures,onError:this.options.onError,onSerialize:(t,n)=>{this.alive&&this.options.onData(n?this.options.globalIdentifier+'["'+l(e)+'"]='+t:t)},onDone:()=>{this.alive&&(this.pending--,this.pending<=0&&this.flushed&&!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0))}})))}getNextID(){for(;this.keys.has(""+this.ids);)this.ids++;return""+this.ids}push(e){let r=this.getNextID();return this.write(r,e),r}flush(){this.alive&&(this.flushed=!0,this.pending<=0&&!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0))}close(){if(this.alive){for(let e=0,r=this.cleanups.length;e<r;e++)this.cleanups[e]();!this.done&&this.options.onDone&&(this.options.onDone(),this.done=!0),this.alive=!1}}};function zn(a){return a}var Dn=$e;export{v as Feature,Ze as GLOBAL_CONTEXT_API_SCRIPT,fe as Serializer,Jt as compileJSON,zn as createPlugin,er as createReference,Pn as crossSerialize,wn as crossSerializeAsync,Xe as crossSerializeStream,Dn as default,$t as deserialize,Zt as fromJSON,Qe as getCrossReferenceHeader,$e as serialize,Wt as serializeAsync,Xt as toJSON,Yt as toJSONAsync};
@@ -1,4 +1,5 @@
1
- export interface SerializerOptions {
1
+ import type { PluginAccessOptions } from './plugin';
2
+ export interface SerializerOptions extends PluginAccessOptions {
2
3
  globalIdentifier: string;
3
4
  scopeId?: string;
4
5
  disabledFeatures?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"Serializer.d.ts","sourceRoot":"","sources":["../../../src/core/Serializer.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAChC,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,OAAO,UAAU;IAc3B,OAAO,CAAC,OAAO;IAbjB,OAAO,CAAC,KAAK,CAAQ;IAErB,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO,CAAC,OAAO,CAAK;IAEpB,OAAO,CAAC,QAAQ,CAAsB;IAEtC,OAAO,CAAC,IAAI,CAA8B;gBAGhC,OAAO,EAAE,iBAAiB;IAIpC,IAAI,cAAqB;IAEzB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IA+BxC,GAAG,SAAK;IAER,OAAO,CAAC,SAAS;IAOjB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAM5B,KAAK,IAAI,IAAI;IAUb,KAAK,IAAI,IAAI;CAYd"}
1
+ {"version":3,"file":"Serializer.d.ts","sourceRoot":"","sources":["../../../src/core/Serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAIpD,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC5D,gBAAgB,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,MAAM,CAAC,OAAO,OAAO,UAAU;IAc3B,OAAO,CAAC,OAAO;IAbjB,OAAO,CAAC,KAAK,CAAQ;IAErB,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO,CAAC,OAAO,CAAK;IAEpB,OAAO,CAAC,QAAQ,CAAsB;IAEtC,OAAO,CAAC,IAAI,CAA8B;gBAGhC,OAAO,EAAE,iBAAiB;IAIpC,IAAI,cAAqB;IAEzB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAgCxC,GAAG,SAAK;IAER,OAAO,CAAC,SAAS;IAOjB,IAAI,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM;IAM5B,KAAK,IAAI,IAAI;IAUb,KAAK,IAAI,IAAI;CAYd"}
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/core/keys.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,eAAO,MAAM,8BAA8B,OAAO,CAAC;AAEnD,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,eAAO,MAAM,iCAAiC,MAAM,CAAC;AAErD,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAI/C,eAAO,MAAM,yBAAyB,QAQ/B,CAAC;AAER,wBAAgB,uBAAuB,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAK3D"}
1
+ {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../../src/core/keys.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,cAAc,qBAAqB,CAAC;AAEjD,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAEvC,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAE9C,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,eAAO,MAAM,4BAA4B,MAAM,CAAC;AAEhD,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD,eAAO,MAAM,8BAA8B,OAAO,CAAC;AAEnD,eAAO,MAAM,6BAA6B,OAAO,CAAC;AAElD,eAAO,MAAM,+BAA+B,MAAM,CAAC;AAEnD,eAAO,MAAM,iCAAiC,MAAM,CAAC;AAErD,eAAO,MAAM,0BAA0B,OAAO,CAAC;AAI/C,eAAO,MAAM,yBAAyB,QAQ/B,CAAC;AAIR,wBAAgB,uBAAuB,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAK3D"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "seroval",
3
3
  "type": "module",
4
- "version": "0.12.2",
4
+ "version": "0.12.4",
5
5
  "files": [
6
6
  "dist",
7
7
  "src"
@@ -66,5 +66,5 @@
66
66
  "typesVersions": {
67
67
  "*": {}
68
68
  },
69
- "gitHead": "41c5dc532b6c4cc1c2ced46ea31879545cc67ec6"
69
+ "gitHead": "4040423d3d896c86679f5f129f8a3309752c9c7a"
70
70
  }
@@ -1,7 +1,8 @@
1
+ import type { PluginAccessOptions } from './plugin';
1
2
  import { crossSerializeStream } from './cross';
2
3
  import { serializeString } from './string';
3
4
 
4
- export interface SerializerOptions {
5
+ export interface SerializerOptions extends PluginAccessOptions {
5
6
  globalIdentifier: string;
6
7
  scopeId?: string;
7
8
  disabledFeatures?: number;
@@ -35,6 +36,7 @@ export default class Serializer {
35
36
  this.pending++;
36
37
  this.keys.add(key);
37
38
  this.cleanups.push(crossSerializeStream(value, {
39
+ plugins: this.options.plugins,
38
40
  scopeId: this.options.scopeId,
39
41
  refs: this.refs,
40
42
  disabledFeatures: this.options.disabledFeatures,
package/src/core/keys.ts CHANGED
@@ -35,9 +35,11 @@ export const GLOBAL_CONTEXT_API_SCRIPT = `${GLOBAL_CONTEXT_API_REF}=${GLOBAL_CON
35
35
  + `${GLOBAL_CONTEXT_STREAM_CONSTRUCTOR}:function(s,c){return(s=new ReadableStream({start:function(x){c=x}})).${LOCAL_CONTEXT_STREAM_CONTROLLER}=c,s}`
36
36
  + '}';
37
37
 
38
+ const GLOBAL_CONTEXT_R = `self.${GLOBAL_CONTEXT_REFERENCES}`;
39
+
38
40
  export function getCrossReferenceHeader(id?: string): string {
39
41
  if (id == null) {
40
- return `self.${GLOBAL_CONTEXT_REFERENCES}=self.${GLOBAL_CONTEXT_REFERENCES}||[];`;
42
+ return `${GLOBAL_CONTEXT_R}=${GLOBAL_CONTEXT_R}||[];`;
41
43
  }
42
- return `(${GLOBAL_CONTEXT_API_REF}=${GLOBAL_CONTEXT_API_REF}||{})["${serializeString(id)}"]=[];`;
44
+ return `(${GLOBAL_CONTEXT_R}=${GLOBAL_CONTEXT_R}||{})["${serializeString(id)}"]=[];`;
43
45
  }