seroval 1.0.6 → 1.0.8

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,6 +1,6 @@
1
- "use strict";var Fe=Object.defineProperty;var hr=Object.getOwnPropertyDescriptor;var yr=Object.getOwnPropertyNames;var vr=Object.prototype.hasOwnProperty;var Nr=(n,e)=>{for(var r in e)Fe(n,r,{get:e[r],enumerable:!0})},br=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of yr(e))!vr.call(n,s)&&s!==r&&Fe(n,s,{get:()=>e[s],enumerable:!(t=hr(e,s))||t.enumerable});return n};var xr=n=>br(Fe({},"__esModule",{value:!0}),n);var Zr={};Nr(Zr,{Feature:()=>A,Serializer:()=>oe,SerovalDeserializationError:()=>X,SerovalError:()=>M,SerovalMissingInstanceError:()=>g,SerovalMissingPluginError:()=>P,SerovalMissingReferenceError:()=>H,SerovalMissingReferenceForIdError:()=>q,SerovalParserError:()=>R,SerovalSerializationError:()=>Z,SerovalUnknownTypedArrayError:()=>Q,SerovalUnsupportedNodeError:()=>m,SerovalUnsupportedTypeError:()=>p,compileJSON:()=>Kr,createPlugin:()=>wr,createReference:()=>Ke,createStream:()=>C,crossSerialize:()=>Jr,crossSerializeAsync:()=>Yr,crossSerializeStream:()=>Ue,deserialize:()=>Mr,fromCrossJSON:()=>qr,fromJSON:()=>Lr,getCrossReferenceHeader:()=>We,resolvePlugins:()=>c,serialize:()=>jr,serializeAsync:()=>_r,toCrossJSON:()=>$r,toCrossJSONAsync:()=>Gr,toCrossJSONStream:()=>Hr,toJSON:()=>Ur,toJSONAsync:()=>Wr});module.exports=xr(Zr);var A=(o=>(o[o.AggregateError=1]="AggregateError",o[o.ArrowFunction=2]="ArrowFunction",o[o.ErrorPrototypeStack=4]="ErrorPrototypeStack",o[o.ObjectAssign=8]="ObjectAssign",o[o.BigIntTypedArray=16]="BigIntTypedArray",o))(A||{});function Ar(n){switch(n){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 d(n){let e="",r=0,t;for(let s=0,o=n.length;s<o;s++)t=Ar(n[s]),t&&(e+=n.slice(r,s)+t,r=s+1);return r===0?e=n:e+=n.slice(r),e}function Ir(n){switch(n){case"\\\\":return"\\";case'\\"':return'"';case"\\n":return`
3
- `;case"\\r":return"\r";case"\\b":return"\b";case"\\t":return" ";case"\\f":return"\f";case"\\x3C":return"<";case"\\u2028":return"\u2028";case"\\u2029":return"\u2029";default:return n}}function y(n){return n.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g,Ir)}var I="__SEROVAL_REFS__",G="$R",ie=`self.${G}`;function We(n){return n==null?`${ie}=${ie}||[]`:`(${ie}=${ie}||{})["${d(n)}"]=[]`}function f(n,e){if(!n)throw e}var Ve=new Map,E=new Map;function Ke(n,e){return Ve.set(e,n),E.set(n,e),e}function ae(n){return Ve.has(n)}function Er(n){return E.has(n)}function Le(n){return f(ae(n),new H(n)),Ve.get(n)}function Je(n){return f(Er(n),new q(n)),E.get(n)}typeof globalThis!="undefined"?Object.defineProperty(globalThis,I,{value:E,configurable:!0,writable:!1,enumerable:!1}):typeof window!="undefined"?Object.defineProperty(window,I,{value:E,configurable:!0,writable:!1,enumerable:!1}):typeof self!="undefined"?Object.defineProperty(self,I,{value:E,configurable:!0,writable:!1,enumerable:!1}):typeof global!="undefined"&&Object.defineProperty(global,I,{value:E,configurable:!0,writable:!1,enumerable:!1});function wr(n){return n}function Ye(n,e){for(let r=0,t=e.length;r<t;r++){let s=e[r];n.has(s)||(n.add(s),s.extends&&Ye(n,s.extends))}}function c(n){if(n){let e=new Set;return Ye(e,n),[...e]}}var $e={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"},le={[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},Ge={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},He={2:"!0",3:"!1",1:"void 0",0:"null",4:"-0",5:"1/0",6:"-1/0",7:"0/0"},qe={2:!0,3:!1,1:void 0,0:null,4:-0,5:Number.POSITIVE_INFINITY,6:Number.NEGATIVE_INFINITY,7:Number.NaN};var ue={0:"Error",1:"EvalError",2:"RangeError",3:"ReferenceError",4:"SyntaxError",5:"TypeError",6:"URIError"},Ze={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function v(n){return{t:2,i:void 0,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}}var N=v(2),b=v(3),de=v(1),ce=v(0),Xe=v(4),Qe=v(5),er=v(6),rr=v(7);function fe(n){return n instanceof EvalError?1:n instanceof RangeError?2:n instanceof ReferenceError?3:n instanceof SyntaxError?4:n instanceof TypeError?5:n instanceof URIError?6:0}function Rr(n){let e=ue[fe(n)];return n.name!==e?{name:n.name}:n.constructor.name!==e?{name:n.constructor.name}:{}}function V(n,e){let r=Rr(n),t=Object.getOwnPropertyNames(n);for(let s=0,o=t.length,i;s<o;s++)i=t[s],i!=="name"&&i!=="message"&&(i==="stack"?e&4&&(r=r||{},r[i]=n[i]):(r=r||{},r[i]=n[i]));return r}function pe(n){return Object.isFrozen(n)?3:Object.isSealed(n)?2:Object.isExtensible(n)?0:1}function me(n){switch(n){case Number.POSITIVE_INFINITY:return Qe;case Number.NEGATIVE_INFINITY:return er}return n!==n?rr:Object.is(n,-0)?Xe:{t:0,i:void 0,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 x(n){return{t:1,i:void 0,s:d(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 ge(n){return{t:3,i:void 0,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 nr(n){return{t:4,i:n,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 Se(n,e){return{t:5,i:n,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 he(n,e){return{t:6,i:n,s:void 0,l:void 0,c:d(e.source),m:e.flags,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ye(n,e){let r=new Uint8Array(e),t=r.length,s=new Array(t);for(let o=0;o<t;o++)s[o]=r[o];return{t:19,i:n,s,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 sr(n,e){return{t:17,i:n,s: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 De(n,e){return{t:18,i:n,s:d(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(n,e,r){return{t:25,i:n,s:r,l:void 0,c:d(e),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ve(n,e,r){return{t:9,i:n,s:void 0,l:e.length,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:void 0,b:void 0,o:pe(e)}}function Ne(n,e){return{t:21,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function be(n,e,r){return{t:15,i:n,s:void 0,l:e.length,c:e.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function xe(n,e,r){return{t:16,i:n,s:void 0,l:e.length,c:e.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function Ae(n,e,r){return{t:20,i:n,s:void 0,l:e.byteLength,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function Ie(n,e,r){return{t:13,i:n,s:fe(e),l:void 0,c:void 0,m:d(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ee(n,e,r){return{t:14,i:n,s:fe(e),l:void 0,c:void 0,m:d(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function we(n,e,r){return{t:7,i:n,s:void 0,l:e,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:void 0,b:void 0,o:void 0}}function B(n,e){return{t:28,i:void 0,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[n,e],f:void 0,b:void 0,o:void 0}}function j(n,e){return{t:30,i:void 0,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[n,e],f:void 0,b:void 0,o:void 0}}function _(n,e,r){return{t:31,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:e,b:void 0,o:void 0}}function Re(n,e){return{t:32,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function Pe(n,e){return{t:33,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function Ce(n,e){return{t:34,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}var{toString:Be}=Object.prototype;function Pr(n,e){return e instanceof Error?`Seroval caught an error during the ${n} process.
1
+ "use strict";var Ve=Object.defineProperty;var yr=Object.getOwnPropertyDescriptor;var vr=Object.getOwnPropertyNames;var Nr=Object.prototype.hasOwnProperty;var br=(n,e)=>{for(var r in e)Ve(n,r,{get:e[r],enumerable:!0})},xr=(n,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of vr(e))!Nr.call(n,s)&&s!==r&&Ve(n,s,{get:()=>e[s],enumerable:!(t=yr(e,s))||t.enumerable});return n};var Ar=n=>xr(Ve({},"__esModule",{value:!0}),n);var Xr={};br(Xr,{Feature:()=>I,OpaqueReference:()=>A,Serializer:()=>ie,SerovalDeserializationError:()=>Q,SerovalError:()=>U,SerovalMissingInstanceError:()=>g,SerovalMissingPluginError:()=>O,SerovalMissingReferenceError:()=>H,SerovalMissingReferenceForIdError:()=>Z,SerovalParserError:()=>P,SerovalSerializationError:()=>X,SerovalUnknownTypedArrayError:()=>ee,SerovalUnsupportedNodeError:()=>m,SerovalUnsupportedTypeError:()=>p,compileJSON:()=>Hr,createPlugin:()=>wr,createReference:()=>Le,createStream:()=>C,crossSerialize:()=>_r,crossSerializeAsync:()=>Mr,crossSerializeStream:()=>Ue,deserialize:()=>$r,fromCrossJSON:()=>Lr,fromJSON:()=>Zr,getCrossReferenceHeader:()=>Ke,resolvePlugins:()=>c,serialize:()=>Jr,serializeAsync:()=>Yr,toCrossJSON:()=>Ur,toCrossJSONAsync:()=>Wr,toCrossJSONStream:()=>Kr,toJSON:()=>Gr,toJSONAsync:()=>qr});module.exports=Ar(Xr);var I=(o=>(o[o.AggregateError=1]="AggregateError",o[o.ArrowFunction=2]="ArrowFunction",o[o.ErrorPrototypeStack=4]="ErrorPrototypeStack",o[o.ObjectAssign=8]="ObjectAssign",o[o.BigIntTypedArray=16]="BigIntTypedArray",o))(I||{});function Ir(n){switch(n){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 d(n){let e="",r=0,t;for(let s=0,o=n.length;s<o;s++)t=Ir(n[s]),t&&(e+=n.slice(r,s)+t,r=s+1);return r===0?e=n:e+=n.slice(r),e}function Rr(n){switch(n){case"\\\\":return"\\";case'\\"':return'"';case"\\n":return`
3
+ `;case"\\r":return"\r";case"\\b":return"\b";case"\\t":return" ";case"\\f":return"\f";case"\\x3C":return"<";case"\\u2028":return"\u2028";case"\\u2029":return"\u2029";default:return n}}function y(n){return n.replace(/(\\\\|\\"|\\n|\\r|\\b|\\t|\\f|\\u2028|\\u2029|\\x3C)/g,Rr)}var R="__SEROVAL_REFS__",q="$R",ae=`self.${q}`;function Ke(n){return n==null?`${ae}=${ae}||[]`:`(${ae}=${ae}||{})["${d(n)}"]=[]`}function f(n,e){if(!n)throw e}var De=new Map,E=new Map;function Le(n,e){return De.set(e,n),E.set(n,e),e}function le(n){return De.has(n)}function Er(n){return E.has(n)}function Je(n){return f(le(n),new H(n)),De.get(n)}function Ye(n){return f(Er(n),new Z(n)),E.get(n)}typeof globalThis!="undefined"?Object.defineProperty(globalThis,R,{value:E,configurable:!0,writable:!1,enumerable:!1}):typeof window!="undefined"?Object.defineProperty(window,R,{value:E,configurable:!0,writable:!1,enumerable:!1}):typeof self!="undefined"?Object.defineProperty(self,R,{value:E,configurable:!0,writable:!1,enumerable:!1}):typeof global!="undefined"&&Object.defineProperty(global,R,{value:E,configurable:!0,writable:!1,enumerable:!1});function wr(n){return n}function $e(n,e){for(let r=0,t=e.length;r<t;r++){let s=e[r];n.has(s)||(n.add(s),s.extends&&$e(n,s.extends))}}function c(n){if(n){let e=new Set;return $e(e,n),[...e]}}var Ge={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"},ue={[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},qe={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},He={2:"!0",3:"!1",1:"void 0",0:"null",4:"-0",5:"1/0",6:"-1/0",7:"0/0"},Ze={2:!0,3:!1,1:void 0,0:null,4:-0,5:Number.POSITIVE_INFINITY,6:Number.NEGATIVE_INFINITY,7:Number.NaN};var de={0:"Error",1:"EvalError",2:"RangeError",3:"ReferenceError",4:"SyntaxError",5:"TypeError",6:"URIError"},Xe={0:Error,1:EvalError,2:RangeError,3:ReferenceError,4:SyntaxError,5:TypeError,6:URIError};function v(n){return{t:2,i:void 0,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}}var N=v(2),b=v(3),ce=v(1),fe=v(0),Qe=v(4),er=v(5),rr=v(6),tr=v(7);function pe(n){return n instanceof EvalError?1:n instanceof RangeError?2:n instanceof ReferenceError?3:n instanceof SyntaxError?4:n instanceof TypeError?5:n instanceof URIError?6:0}function Pr(n){let e=de[pe(n)];return n.name!==e?{name:n.name}:n.constructor.name!==e?{name:n.constructor.name}:{}}function D(n,e){let r=Pr(n),t=Object.getOwnPropertyNames(n);for(let s=0,o=t.length,i;s<o;s++)i=t[s],i!=="name"&&i!=="message"&&(i==="stack"?e&4&&(r=r||{},r[i]=n[i]):(r=r||{},r[i]=n[i]));return r}function me(n){return Object.isFrozen(n)?3:Object.isSealed(n)?2:Object.isExtensible(n)?0:1}function ge(n){switch(n){case Number.POSITIVE_INFINITY:return er;case Number.NEGATIVE_INFINITY:return rr}return n!==n?tr:Object.is(n,-0)?Qe:{t:0,i:void 0,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 x(n){return{t:1,i:void 0,s:d(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 Se(n){return{t:3,i:void 0,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 sr(n){return{t:4,i:n,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 he(n,e){return{t:5,i:n,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 ye(n,e){return{t:6,i:n,s:void 0,l:void 0,c:d(e.source),m:e.flags,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function ve(n,e){let r=new Uint8Array(e),t=r.length,s=new Array(t);for(let o=0;o<t;o++)s[o]=r[o];return{t:19,i:n,s,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 or(n,e){return{t:17,i:n,s:ue[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 Be(n,e){return{t:18,i:n,s:d(Je(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 B(n,e,r){return{t:25,i:n,s:r,l:void 0,c:d(e),m:void 0,p:void 0,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ne(n,e,r){return{t:9,i:n,s:void 0,l:e.length,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:void 0,b:void 0,o:me(e)}}function be(n,e){return{t:21,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function xe(n,e,r){return{t:15,i:n,s:void 0,l:e.length,c:e.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function Ae(n,e,r){return{t:16,i:n,s:void 0,l:e.length,c:e.constructor.name,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function Ie(n,e,r){return{t:20,i:n,s:void 0,l:e.byteLength,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:r,b:e.byteOffset,o:void 0}}function Re(n,e,r){return{t:13,i:n,s:pe(e),l:void 0,c:void 0,m:d(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function Ee(n,e,r){return{t:14,i:n,s:pe(e),l:void 0,c:void 0,m:d(e.message),p:r,e:void 0,a:void 0,f:void 0,b:void 0,o:void 0}}function we(n,e,r){return{t:7,i:n,s:void 0,l:e,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:void 0,b:void 0,o:void 0}}function j(n,e){return{t:28,i:void 0,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[n,e],f:void 0,b:void 0,o:void 0}}function _(n,e){return{t:30,i:void 0,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[n,e],f:void 0,b:void 0,o:void 0}}function M(n,e,r){return{t:31,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:r,f:e,b:void 0,o:void 0}}function Pe(n,e){return{t:32,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function Oe(n,e){return{t:33,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}function Ce(n,e){return{t:34,i:n,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:e,b:void 0,o:void 0}}var{toString:je}=Object.prototype;function Or(n,e){return e instanceof Error?`Seroval caught an error during the ${n} process.
4
4
 
5
5
  ${e.name}
6
6
  ${e.message}
@@ -8,10 +8,10 @@ ${e.message}
8
8
  - For more information, please check the "cause" property of this error.
9
9
  - If you believe this is an error in Seroval, please submit an issue at https://github.com/lxsmnsyc/seroval/issues/new`:`Seroval caught an error during the ${n} process.
10
10
 
11
- "${Be.call(e)}"
11
+ "${je.call(e)}"
12
12
 
13
- For more information, please check the "cause" property of this error.`}var M=class extends Error{constructor(r,t){super(Pr(r,t));this.cause=t}},R=class extends M{constructor(e){super("parsing",e)}},Z=class extends M{constructor(e){super("serialization",e)}},X=class extends M{constructor(e){super("deserialization",e)}},p=class extends Error{constructor(r){super(`The value ${Be.call(r)} of type "${typeof r}" cannot be parsed/serialized.
13
+ For more information, please check the "cause" property of this error.`}var U=class extends Error{constructor(r,t){super(Or(r,t));this.cause=t}},P=class extends U{constructor(e){super("parsing",e)}},X=class extends U{constructor(e){super("serialization",e)}},Q=class extends U{constructor(e){super("deserialization",e)}},p=class extends Error{constructor(r){super(`The value ${je.call(r)} of type "${typeof r}" cannot be parsed/serialized.
14
14
 
15
15
  There are few workarounds for this problem:
16
16
  - Transform the value in a way that it can be serialized.
17
- - If the reference is present on multiple runtimes (isomorphic), you can use the Reference API to map the references.`);this.value=r}},m=class extends Error{constructor(e){super('Unsupported node type "'+e.t+'".')}},P=class extends Error{constructor(e){super('Missing plugin for tag "'+e+'".')}},g=class extends Error{constructor(e){super('Missing "'+e+'" instance.')}},H=class extends Error{constructor(r){super('Missing reference for the value "'+Be.call(r)+'" of type "'+typeof r+'"');this.value=r}},q=class extends Error{constructor(e){super('Missing reference for id "'+d(e)+'"')}},Q=class extends Error{constructor(e){super('Unknown TypedArray "'+e+'"')}};var or={},ir={};var ar={0:{},1:{},2:{},3:{},4:{}};function ee(){let n,e;return{promise:new Promise((r,t)=>{n=r,e=t}),resolve(r){n(r)},reject(r){e(r)}}}function Oe(n){return"__SEROVAL_STREAM__"in n}function C(){let n=new Set,e=[],r=!0,t=!0;function s(a){for(let l of n.keys())l.next(a)}function o(a){for(let l of n.keys())l.throw(a)}function i(a){for(let l of n.keys())l.return(a)}return{__SEROVAL_STREAM__:!0,on(a){r&&n.add(a);for(let l=0,u=e.length;l<u;l++){let h=e[l];l===u-1&&!r?t?a.return(h):a.throw(h):a.next(h)}return()=>{r&&n.delete(a)}},next(a){r&&(e.push(a),s(a))},throw(a){r&&(e.push(a),o(a),r=!1,t=!1,n.clear())},return(a){r&&(e.push(a),i(a),r=!1,t=!0,n.clear())}}}function ze(n){let e=C(),r=n[Symbol.asyncIterator]();async function t(){try{let s=await r.next();s.done?e.return(s.value):(e.next(s.value),await t())}catch(s){e.throw(s)}}return t().catch(()=>{}),e}function lr(n){return()=>{let e=[],r=[],t=0,s=-1,o=!1;function i(){for(let l=0,u=r.length;l<u;l++)r[l].resolve({done:!0,value:void 0})}n.on({next(l){let u=r.shift();u&&u.resolve({done:!1,value:l}),e.push(l)},throw(l){let u=r.shift();u&&u.reject(l),i(),s=e.length,e.push(l),o=!0},return(l){let u=r.shift();u&&u.resolve({done:!0,value:l}),i(),s=e.length,e.push(l)}});function a(){let l=t++,u=e[l];if(l!==s)return{done:!1,value:u};if(o)throw u;return{done:!0,value:u}}return{[Symbol.asyncIterator](){return this},async next(){if(s===-1){let l=t++;if(l>=e.length){let u=ee();return r.push(u),await u.promise}return{done:!1,value:e[l]}}return t>s?{done:!0,value:void 0}:a()}}}}function U(n){let e=[],r=-1,t=-1,s=n[Symbol.iterator]();for(;;)try{let o=s.next();if(e.push(o.value),o.done){t=e.length-1;break}}catch(o){r=e.length,e.push(o)}return{v:e,t:r,d:t}}function ur(n){return()=>{let e=0;return{[Symbol.iterator](){return this},next(){if(e>n.d)return{done:!0,value:void 0};let r=e++,t=n.v[r];if(r===n.t)throw t;return{done:r===n.d,value:t}}}}}async function je(n){try{return[1,await n]}catch(e){return[0,e]}}var W=class{constructor(e){this.marked=new Set;this.plugins=e.plugins,this.features=31^(e.disabledFeatures||0),this.refs=e.refs||new Map}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}getIndexedValue(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),{type:1,value:nr(r)};let t=this.refs.size;return this.refs.set(e,t),{type:0,value:t}}getReference(e){let r=this.getIndexedValue(e);return r.type===1?r:ae(e)?{type:2,value:De(r.value,e)}:r}getStrictReference(e){f(ae(e),new p(e));let r=this.getIndexedValue(e);return r.type===1?r.value:De(r.value,e)}parseFunction(e){return this.getStrictReference(e)}parseWellKnownSymbol(e){let r=this.getReference(e);return r.type!==0?r.value:(f(e in le,new p(e)),sr(r.value,e))}parseSpecialReference(e){let r=this.getIndexedValue(ar[e]);return r.type===1?r.value:{t:26,i:r.value,s: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}}parseIteratorFactory(){let e=this.getIndexedValue(or);return e.type===1?e.value:{t:27,i:e.value,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseWellKnownSymbol(Symbol.iterator),b:void 0,o:void 0}}parseAsyncIteratorFactory(){let e=this.getIndexedValue(ir);return e.type===1?e.value:{t:29,i:e.value,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(1),this.parseWellKnownSymbol(Symbol.asyncIterator)],f:void 0,b:void 0,o:void 0}}createObjectNode(e,r,t,s){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:s,e:void 0,a:void 0,f:void 0,b:void 0,o:pe(r)}}createMapNode(e,r,t,s){return{t:8,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:{k:r,v:t,s},a:void 0,f:this.parseSpecialReference(0),b:void 0,o:void 0}}createPromiseConstructorNode(e){return{t:22,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.parseSpecialReference(1),b:void 0,o:void 0}}};var O=class extends W{async parseItems(e){let r=[];for(let t=0,s=e.length;t<s;t++)t in e&&(r[t]=await this.parse(e[t]));return r}async parseArray(e,r){return ve(e,r,await this.parseItems(r))}async parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let i=0,a=r.length;i<a;i++)t.push(d(r[i][0])),s.push(await this.parse(r[i][1]));let o=Symbol.iterator;return o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(B(this.parseIteratorFactory(),await this.parse(U(e))))),o=Symbol.asyncIterator,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(j(this.parseAsyncIteratorFactory(),await this.parse(ze(e))))),o=Symbol.toStringTag,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(x(e[o]))),o=Symbol.isConcatSpreadable,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(e[o]?N:b)),{k:t,v:s,s:t.length}}async parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,await this.parseProperties(r))}async parseBoxed(e,r){return Ne(e,await this.parse(r.valueOf()))}async parseTypedArray(e,r){return be(e,r,await this.parse(r.buffer))}async parseBigIntTypedArray(e,r){return xe(e,r,await this.parse(r.buffer))}async parseDataView(e,r){return Ae(e,r,await this.parse(r.buffer))}async parseError(e,r){let t=V(r,this.features);return Ie(e,r,t?await this.parseProperties(t):void 0)}async parseAggregateError(e,r){let t=V(r,this.features);return Ee(e,r,t?await this.parseProperties(t):void 0)}async parseMap(e,r){let t=[],s=[];for(let[o,i]of r.entries())t.push(await this.parse(o)),s.push(await this.parse(i));return this.createMapNode(e,t,s,r.size)}async parseSet(e,r){let t=[];for(let s of r.keys())t.push(await this.parse(s));return we(e,r.size,t)}async parsePromise(e,r){let[t,s]=await je(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(s),b:void 0,o:void 0}}async parsePlugin(e,r){let t=this.plugins;if(t)for(let s=0,o=t.length;s<o;s++){let i=t[s];if(i.parse.async&&i.test(r))return D(e,i.tag,await i.parse.async(r,this,{id:e}))}}async parseStream(e,r){return _(e,this.parseSpecialReference(4),await new Promise((t,s)=>{let o=[],i=r.on({next:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(Re(e,l))},l=>{s(l),i()})},throw:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(Pe(e,l)),t(o),i()},l=>{s(l),i()})},return:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(Ce(e,l)),t(o),i()},l=>{s(l),i()})}})}))}async parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);if(Oe(r))return this.parseStream(e,r);let t=await this.parsePlugin(e,r);if(t)return t;let s=r.constructor;switch(s){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return Se(e,r);case RegExp:return he(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);case ArrayBuffer:return ye(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);case Map:return this.parseMap(e,r);case Set:return this.parseSet(e,r);default:break}if(s===Promise||r instanceof Promise)return this.parsePromise(e,r);let o=this.features;if(o&16)switch(s){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(o&1&&typeof AggregateError!="undefined"&&(s===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(Symbol.iterator in r||Symbol.asyncIterator in r)return this.parsePlainObject(e,r,!!s);throw new p(r)}async parse(e){try{switch(typeof e){case"boolean":return e?N:b;case"undefined":return de;case"string":return x(e);case"number":return me(e);case"bigint":return ge(e);case"object":{if(e){let r=this.getReference(e);return r.type===0?await this.parseObject(r.value,e):r.value}return ce}case"symbol":return this.parseWellKnownSymbol(e);case"function":return this.parseFunction(e);default:throw new p(e)}}catch(r){throw new R(r)}}};var K=class extends O{constructor(){super(...arguments);this.mode="vanilla"}};function dr(n){switch(n){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 Q(n)}}function cr(n,e){switch(e){case 3:return Object.freeze(n);case 1:return Object.preventExtensions(n);case 2:return Object.seal(n);default:return n}}var z=class{constructor(e){this.plugins=e.plugins,this.refs=e.refs||new Map}deserializeReference(e){return this.assignIndexedValue(e.i,Je(y(e.s)))}deserializeArray(e){let r=e.l,t=this.assignIndexedValue(e.i,new Array(r)),s;for(let o=0;o<r;o++)s=e.a[o],s&&(t[o]=this.deserialize(s));return cr(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let s=e.k,o=e.v;for(let i=0,a;i<t;i++)a=s[i],typeof a=="string"?r[y(a)]=this.deserialize(o[i]):r[this.deserialize(a)]=this.deserialize(o[i])}return r}deserializeObject(e){let r=this.assignIndexedValue(e.i,e.t===10?{}:Object.create(null));return this.deserializeProperties(e.p,r),cr(r,e.o),r}deserializeDate(e){return this.assignIndexedValue(e.i,new Date(e.s))}deserializeRegExp(e){return this.assignIndexedValue(e.i,new RegExp(y(e.c),e.m))}deserializeSet(e){let r=this.assignIndexedValue(e.i,new Set),t=e.a;for(let s=0,o=e.l;s<o;s++)r.add(this.deserialize(t[s]));return r}deserializeMap(e){let r=this.assignIndexedValue(e.i,new Map),t=e.e.k,s=e.e.v;for(let o=0,i=e.e.s;o<i;o++)r.set(this.deserialize(t[o]),this.deserialize(s[o]));return r}deserializeArrayBuffer(e){let r=new Uint8Array(e.s);return this.assignIndexedValue(e.i,r.buffer)}deserializeTypedArray(e){let r=dr(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([],y(e.m)));return this.deserializeDictionary(e,r)}deserializeError(e){let r=Ze[e.s],t=this.assignIndexedValue(e.i,new r(y(e.m)));return this.deserializeDictionary(e,t)}deserializePromise(e){let r=ee(),t=this.assignIndexedValue(e.i,r),s=this.deserialize(e.f);return e.s?r.resolve(s):r.reject(s),t.promise}deserializeBoxed(e){return this.assignIndexedValue(e.i,Object(this.deserialize(e.f)))}deserializePlugin(e){let r=this.plugins;if(r){let t=y(e.c);for(let s=0,o=r.length;s<o;s++){let i=r[s];if(i.tag===t)return this.assignIndexedValue(e.i,i.deserialize(e.s,this,{id:e.i}))}}throw new P(e.c)}deserializePromiseConstructor(e){return this.assignIndexedValue(e.i,ee()).promise}deserializePromiseResolve(e){let r=this.refs.get(e.i);f(r,new g("Promise")),r.resolve(this.deserialize(e.a[1]))}deserializePromiseReject(e){let r=this.refs.get(e.i);f(r,new g("Promise")),r.reject(this.deserialize(e.a[1]))}deserializeIteratorFactoryInstance(e){this.deserialize(e.a[0]);let r=this.deserialize(e.a[1]);return ur(r)}deserializeAsyncIteratorFactoryInstance(e){this.deserialize(e.a[0]);let r=this.deserialize(e.a[1]);return lr(r)}deserializeStreamConstructor(e){let r=this.assignIndexedValue(e.i,C()),t=e.a.length;if(t)for(let s=0;s<t;s++)this.deserialize(e.a[s]);return r}deserializeStreamNext(e){let r=this.refs.get(e.i);f(r,new g("Stream")),r.next(this.deserialize(e.f))}deserializeStreamThrow(e){let r=this.refs.get(e.i);f(r,new g("Stream")),r.throw(this.deserialize(e.f))}deserializeStreamReturn(e){let r=this.refs.get(e.i);f(r,new g("Stream")),r.return(this.deserialize(e.f))}deserializeIteratorFactory(e){this.deserialize(e.f)}deserializeAsyncIteratorFactory(e){this.deserialize(e.a[1])}deserialize(e){try{switch(e.t){case 2:return qe[e.s];case 0:return e.s;case 1:return y(e.s);case 3:return BigInt(e.s);case 4:return this.refs.get(e.i);case 18: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 19:return this.deserializeArrayBuffer(e);case 16:case 15:return this.deserializeTypedArray(e);case 20: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 Ge[e.s];case 21:return this.deserializeBoxed(e);case 25:return this.deserializePlugin(e);case 22:return this.deserializePromiseConstructor(e);case 23:return this.deserializePromiseResolve(e);case 24:return this.deserializePromiseReject(e);case 28:return this.deserializeIteratorFactoryInstance(e);case 30:return this.deserializeAsyncIteratorFactoryInstance(e);case 31:return this.deserializeStreamConstructor(e);case 32:return this.deserializeStreamNext(e);case 33:return this.deserializeStreamThrow(e);case 34:return this.deserializeStreamReturn(e);case 27:return this.deserializeIteratorFactory(e);case 29:return this.deserializeAsyncIteratorFactory(e);default:throw new m(e)}}catch(r){throw new X(r)}}};var re=class extends z{constructor(r){super(r);this.mode="vanilla";this.marked=new Set(r.markedRefs)}assignIndexedValue(r,t){return this.marked.has(r)&&this.refs.set(r,t),t}};var Or=/^[$A-Z_][0-9A-Z_$]*$/i;function _e(n){let e=n[0];return(e==="$"||e==="_"||e>="A"&&e<="Z"||e>="a"&&e<="z")&&Or.test(n)}function te(n){switch(n.t){case 0:return n.s+"="+n.v;case 2:return n.s+".set("+n.k+","+n.v+")";case 1:return n.s+".add("+n.v+")";case 3:return n.s+".delete("+n.k+")"}}function zr(n){let e=[],r=n[0];for(let t=1,s=n.length,o,i=r;t<s;t++)o=n[t],o.t===0&&o.v===i.v?r={t:0,s:o.s,k:void 0,v:te(r)}:o.t===2&&o.s===i.s?r={t:2,s:te(r),k:o.k,v:o.v}:o.t===1&&o.s===i.s?r={t:1,s:te(r),k:void 0,v:o.v}:o.t===3&&o.s===i.s?r={t:3,s:te(r),k:o.k,v:void 0}:(e.push(r),r=o),i=o;return e.push(r),e}function fr(n){if(n.length){let e="",r=zr(n);for(let t=0,s=r.length;t<s;t++)e+=te(r[t])+",";return e}}var Tr="Object.create(null)",kr="new Set",Fr="new Map",Vr="Promise.resolve",Dr="Promise.reject",Br={3:"Object.freeze",2:"Object.seal",1:"Object.preventExtensions",0:void 0},T=class{constructor(e){this.stack=[];this.flags=[];this.assignments=[];this.plugins=e.plugins,this.features=e.features,this.marked=new Set(e.markedRefs)}createFunction(e,r){return this.features&2?(e.length===1?e[0]:"("+e.join(",")+")")+"=>"+r:"function("+e.join(",")+"){return "+r+"}"}createEffectfulFunction(e,r){return this.features&2?(e.length===1?e[0]:"("+e.join(",")+")")+"=>{"+r+"}":"function("+e.join(",")+"){"+r+"}"}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(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,s=t.length;r<s;r++){let o=t[r];e+=Br[o.type]+"("+o.value+"),"}return e}resolvePatches(){let e=fr(this.assignments),r=this.resolveFlags();return e?r?e+r:e:r}createAssignment(e,r){this.assignments.push({t:0,s:e,k:void 0,v:r})}createAddAssignment(e,r){this.assignments.push({t:1,s:this.getRefParam(e),k:void 0,v:r})}createSetAssignment(e,r,t){this.assignments.push({t:2,s:this.getRefParam(e),k:r,v:t})}createDeleteAssignment(e,r){this.assignments.push({t:3,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,I+'.get("'+e.s+'")')}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,s=this.serializeArrayItem(r,t[0],0),o=s==="";for(let i=1,a=e.l,l;i<a;i++)l=this.serializeArrayItem(r,t[i],i),s+=","+l,o=l==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+s+(o?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){if(typeof r=="string"){let s=Number(r),o=s>=0&&s.toString()===r||_e(r);if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.markRef(e.i),o&&s!==s?this.createObjectAssign(e.i,r,i):this.createArrayAssign(e.i,o?r:'"'+r+'"',i),""}return(o?r:'"'+r+'"')+":"+this.serialize(t)}return"["+this.serialize(r)+"]:"+this.serialize(t)}serializeProperties(e,r){let t=r.s;if(t){let s=r.k,o=r.v;this.stack.push(e.i);let i=this.serializeProperty(e,s[0],o[0]);for(let a=1,l=i;a<t;a++)l=this.serializeProperty(e,s[a],o[a]),i+=(l&&i&&",")+l;return this.stack.pop(),"{"+i+"}"}return"{}"}serializeObject(e){return this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(e.i,this.serializeProperties(e,e.p))}serializeWithObjectAssign(e,r,t){let s=this.serializeProperties(e,r);return s!=="{}"?"Object.assign("+t+","+s+")":t}serializeStringKeyAssignment(e,r,t,s){let o=this.serialize(s),i=Number(t),a=i>=0&&i.toString()===t||_e(t);if(this.isIndexedValueInStack(s))a&&i!==i?this.createObjectAssign(e.i,t,o):this.createArrayAssign(e.i,a?t:'"'+t+'"',o);else{let l=this.assignments;this.assignments=r,a&&i!==i?this.createObjectAssign(e.i,t,o):this.createArrayAssign(e.i,a?t:'"'+t+'"',o),this.assignments=l}}serializeAssignment(e,r,t,s){if(typeof t=="string")this.serializeStringKeyAssignment(e,r,t,s);else{let o=this.stack;this.stack=[];let i=this.serialize(s);this.stack=o;let a=this.assignments;this.assignments=r,this.createArrayAssign(e.i,this.serialize(t),i),this.assignments=a}}serializeAssignments(e,r){let t=r.s;if(t){let s=[],o=r.k,i=r.v;this.stack.push(e.i);for(let a=0;a<t;a++)this.serializeAssignment(e,s,o[a],i[a]);return this.stack.pop(),fr(s)}}serializeDictionary(e,r){if(e.p)if(this.features&8)r=this.serializeWithObjectAssign(e,e.p,r);else{this.markRef(e.i);let t=this.serializeAssignments(e,e.p);if(t)return"("+this.assignIndexedValue(e.i,r)+","+t+this.getRefParam(e.i)+")"}return this.assignIndexedValue(e.i,r)}serializeNullConstructor(e){return this.pushObjectFlag(e.o,e.i),this.serializeDictionary(e,Tr)}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=kr,t=e.l,s=e.i;if(t){let o=e.a;this.stack.push(s);let i=this.serializeSetItem(s,o[0]);for(let a=1,l=i;a<t;a++)l=this.serializeSetItem(s,o[a]),i+=(l&&i&&",")+l;this.stack.pop(),i&&(r+="(["+i+"])")}return this.assignIndexedValue(s,r)}serializeMapEntry(e,r,t,s){if(this.isIndexedValueInStack(r)){let o=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let a=this.getRefParam(t.i);return this.createSetAssignment(e,o,a),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let a="("+this.serialize(t)+",["+s+","+s+"])";return this.createSetAssignment(e,o,this.getRefParam(t.i)),this.createDeleteAssignment(e,s),a}let i=this.stack;return this.stack=[],this.createSetAssignment(e,o,this.serialize(t)),this.stack=i,""}if(this.isIndexedValueInStack(t)){let o=this.getRefParam(t.i);if(this.markRef(e),r.t!==4&&r.i!=null&&this.isMarked(r.i)){let a="("+this.serialize(r)+",["+s+","+s+"])";return this.createSetAssignment(e,this.getRefParam(r.i),o),this.createDeleteAssignment(e,s),a}let i=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),o),this.stack=i,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=Fr,t=e.e.s,s=e.i,o=e.f,i=this.getRefParam(o.i);if(t){let a=e.e.k,l=e.e.v;this.stack.push(s);let u=this.serializeMapEntry(s,a[0],l[0],i);for(let h=1,ke=u;h<t;h++)ke=this.serializeMapEntry(s,a[h],l[h],i),u+=(ke&&u&&",")+ke;this.stack.pop(),u&&(r+="(["+u+"])")}return o.t===26&&(this.markRef(o.i),r="("+this.serialize(o)+","+r+")"),this.assignIndexedValue(s,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,s=t.length;if(s){r+="["+t[0];for(let o=1;o<s;o++)r+=","+t[o];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=this.serializeDictionary(e,'new AggregateError([],"'+e.m+'")');return this.stack.pop(),t}serializeError(e){return this.serializeDictionary(e,"new "+ue[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,s=e.i,o=e.s?Vr:Dr;if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);r=o+(e.s?"().then("+this.createFunction([],i)+")":"().catch("+this.createEffectfulFunction([],"throw "+i)+")")}else{this.stack.push(s);let i=this.serialize(t);this.stack.pop(),r=o+"("+i+")"}return this.assignIndexedValue(s,r)}serializeWellKnownSymbol(e){return this.assignIndexedValue(e.i,$e[e.s])}serializeBoxed(e){return this.assignIndexedValue(e.i,"Object("+this.serialize(e.f)+")")}serializePlugin(e){let r=this.plugins;if(r)for(let t=0,s=r.length;t<s;t++){let o=r[t];if(o.tag===e.c)return this.assignIndexedValue(e.i,o.serialize(e.s,this,{id:e.i}))}throw new P(e.c)}getConstructor(e){let r=this.serialize(e);return r===this.getRefParam(e.i)?r:"("+r+")"}serializePromiseConstructor(e){return this.assignIndexedValue(e.i,this.getConstructor(e.f)+"()")}serializePromiseResolve(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializePromiseReject(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializeSpecialReferenceValue(e){switch(e){case 0:return"[]";case 1:return this.createFunction(["s","f","p"],"((p=new Promise("+this.createEffectfulFunction(["a","b"],"s=a,f=b")+")).s=s,p.f=f,p)");case 2:return this.createEffectfulFunction(["p","d"],'p.s(d),p.status="success",p.value=d;delete p.s;delete p.f');case 3:return this.createEffectfulFunction(["p","d"],'p.f(d),p.status="failure",p.value=d;delete p.s;delete p.f');case 4:return this.createFunction(["b","a","s","l","p","f","e","n"],"(b=[],a=!0,s=!1,l=[],p=0,f="+this.createEffectfulFunction(["v","m","x"],"for(x=0;x<p;x++)l[x]&&l[x][m](v)")+",n="+this.createEffectfulFunction(["o","x","z","c"],'for(x=0,z=b.length;x<z;x++)(c=b[x],(!a&&x===z-1)?o[s?"return":"throw"](c):o.next(c))')+",e="+this.createFunction(["o","t"],"(a&&(l[t=p++]=o),n(o),"+this.createEffectfulFunction([],"a&&(l[t]=void 0)")+")")+",{__SEROVAL_STREAM__:!0,on:"+this.createFunction(["o"],"e(o)")+",next:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"next"))')+",throw:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)')+",return:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)')+"})");default:return""}}serializeSpecialReference(e){return this.assignIndexedValue(e.i,this.serializeSpecialReferenceValue(e.s))}serializeIteratorFactory(e){let r="",t=!1;return e.f.t!==4&&(this.markRef(e.f.i),r="("+this.serialize(e.f)+",",t=!0),r+=this.assignIndexedValue(e.i,this.createFunction(["s"],this.createFunction(["i","c","d","t"],"(i=0,t={["+this.getRefParam(e.f.i)+"]:"+this.createFunction([],"t")+",next:"+this.createEffectfulFunction([],"if(i>s.d)return{done:!0,value:void 0};if(d=s.v[c=i++],c===s.t)throw d;return{done:c===s.d,value:d}")+"})"))),t&&(r+=")"),r}serializeIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}serializeAsyncIteratorFactory(e){let r=e.a[0],t=e.a[1],s="";r.t!==4&&(this.markRef(r.i),s+="("+this.serialize(r)),t.t!==4&&(this.markRef(t.i),s+=(s?",":"(")+this.serialize(t)),s&&(s+=",");let o=this.assignIndexedValue(e.i,this.createFunction(["s"],this.createFunction(["b","c","p","d","e","t","f"],"(b=[],c=0,p=[],d=-1,e=!1,f="+this.createEffectfulFunction(["i","l"],"for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})")+",s.on({next:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.s({done:!1,value:v});b.push(v)")+",throw:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)")+",return:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)")+"}),t={["+this.getRefParam(t.i)+"]:"+this.createFunction([],"t")+",next:"+this.createEffectfulFunction(["i","t","v"],"if(d===-1){return((i=c++)>=b.length)?(p.push(t="+this.getRefParam(r.i)+"()),t):{done:!0,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}")+"})")));return s?s+o+")":o}serializeAsyncIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}serializeStreamConstructor(e){let r=this.assignIndexedValue(e.i,this.getConstructor(e.f)+"()"),t=e.a.length;if(t){let s=this.serialize(e.a[0]);for(let o=1;o<t;o++)s+=","+this.serialize(e.a[o]);return"("+r+","+s+","+this.getRefParam(e.i)+")"}return r}serializeStreamNext(e){return this.getRefParam(e.i)+".next("+this.serialize(e.f)+")"}serializeStreamThrow(e){return this.getRefParam(e.i)+".throw("+this.serialize(e.f)+")"}serializeStreamReturn(e){return this.getRefParam(e.i)+".return("+this.serialize(e.f)+")"}serialize(e){try{switch(e.t){case 2:return He[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 18: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 19:return this.serializeArrayBuffer(e);case 16:case 15:return this.serializeTypedArray(e);case 20: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.serializeWellKnownSymbol(e);case 21:return this.serializeBoxed(e);case 22:return this.serializePromiseConstructor(e);case 23:return this.serializePromiseResolve(e);case 24:return this.serializePromiseReject(e);case 25:return this.serializePlugin(e);case 26:return this.serializeSpecialReference(e);case 27:return this.serializeIteratorFactory(e);case 28:return this.serializeIteratorFactoryInstance(e);case 29:return this.serializeAsyncIteratorFactory(e);case 30:return this.serializeAsyncIteratorFactoryInstance(e);case 31:return this.serializeStreamConstructor(e);case 32:return this.serializeStreamNext(e);case 33:return this.serializeStreamThrow(e);case 34:return this.serializeStreamReturn(e);default:throw new m(e)}}catch(r){throw new Z(r)}}};var gr="hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_",pr=gr.length,Sr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",mr=Sr.length;function Me(n){let e=n%pr,r=gr[e];for(n=(n-e)/pr;n>0;)e=n%mr,r+=Sr[e],n=(n-e)/mr;return r}var k=class extends T{constructor(){super(...arguments);this.mode="vanilla";this.valid=new Map;this.vars=[]}getRefParam(r){let t=this.valid.get(r);t==null&&(t=this.valid.size,this.valid.set(r,t));let s=this.vars[t];return s==null&&(s=Me(t),this.vars[t]=s),s}assignIndexedValue(r,t){return this.isMarked(r)?this.getRefParam(r)+"="+t:t}serializePromiseConstructor(r){throw new m(r)}serializePromiseResolve(r){throw new m(r)}serializePromiseReject(r){throw new m(r)}serializeTop(r){let t=this.serialize(r);if(r.i!=null&&this.vars.length){let s=this.resolvePatches(),o=t;if(s){let i=this.getRefParam(r.i);o=t+","+s+i,t.startsWith(i+"=")||(o=i+"="+o)}return"("+this.createFunction(this.vars,"("+o+")")+")()"}return r.t===10?"("+t+")":t}};var S=class extends W{parseItems(e){let r=[];for(let t=0,s=e.length;t<s;t++)t in e&&(r[t]=this.parse(e[t]));return r}parseArray(e,r){return ve(e,r,this.parseItems(r))}parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let i=0,a=r.length;i<a;i++)t.push(d(r[i][0])),s.push(this.parse(r[i][1]));let o=Symbol.iterator;return o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(B(this.parseIteratorFactory(),this.parse(U(e))))),o=Symbol.asyncIterator,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(j(this.parseAsyncIteratorFactory(),this.parse(C())))),o=Symbol.toStringTag,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(x(e[o]))),o=Symbol.isConcatSpreadable,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(e[o]?N:b)),{k:t,v:s,s:t.length}}parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,this.parseProperties(r))}parseBoxed(e,r){return Ne(e,this.parse(r.valueOf()))}parseTypedArray(e,r){return be(e,r,this.parse(r.buffer))}parseBigIntTypedArray(e,r){return xe(e,r,this.parse(r.buffer))}parseDataView(e,r){return Ae(e,r,this.parse(r.buffer))}parseError(e,r){let t=V(r,this.features);return Ie(e,r,t?this.parseProperties(t):void 0)}parseAggregateError(e,r){let t=V(r,this.features);return Ee(e,r,t?this.parseProperties(t):void 0)}parseMap(e,r){let t=[],s=[];for(let[o,i]of r.entries())t.push(this.parse(o)),s.push(this.parse(i));return this.createMapNode(e,t,s,r.size)}parseSet(e,r){let t=[];for(let s of r.keys())t.push(this.parse(s));return we(e,r.size,t)}parsePlugin(e,r){let t=this.plugins;if(t)for(let s=0,o=t.length;s<o;s++){let i=t[s];if(i.parse.sync&&i.test(r))return D(e,i.tag,i.parse.sync(r,this,{id:e}))}}parseStream(e,r){return _(e,this.parseSpecialReference(4),[])}parsePromise(e,r){return this.createPromiseConstructorNode(e)}parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);if(Oe(r))return this.parseStream(e,r);let t=this.parsePlugin(e,r);if(t)return t;let s=r.constructor;switch(s){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return Se(e,r);case RegExp:return he(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);case ArrayBuffer:return ye(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);case Map:return this.parseMap(e,r);case Set:return this.parseSet(e,r);default:break}if(s===Promise||r instanceof Promise)return this.parsePromise(e,r);let o=this.features;if(o&16)switch(s){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(o&1&&typeof AggregateError!="undefined"&&(s===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(Symbol.iterator in r||Symbol.asyncIterator in r)return this.parsePlainObject(e,r,!!s);throw new p(r)}parse(e){try{switch(typeof e){case"boolean":return e?N:b;case"undefined":return de;case"string":return x(e);case"number":return me(e);case"bigint":return ge(e);case"object":{if(e){let r=this.getReference(e);return r.type===0?this.parseObject(r.value,e):r.value}return ce}case"symbol":return this.parseWellKnownSymbol(e);case"function":return this.parseFunction(e);default:throw new p(e)}}catch(r){throw new R(r)}}};var L=class extends S{constructor(){super(...arguments);this.mode="vanilla"}};function jr(n,e={}){let r=c(e.plugins),t=new L({plugins:r,disabledFeatures:e.disabledFeatures}),s=t.parse(n);return new k({plugins:r,features:t.features,markedRefs:t.marked}).serializeTop(s)}async function _r(n,e={}){let r=c(e.plugins),t=new K({plugins:r,disabledFeatures:e.disabledFeatures}),s=await t.parse(n);return new k({plugins:r,features:t.features,markedRefs:t.marked}).serializeTop(s)}function Mr(n){return(0,eval)(n)}function Ur(n,e={}){let r=c(e.plugins),t=new L({plugins:r,disabledFeatures:e.disabledFeatures});return{t:t.parse(n),f:t.features,m:Array.from(t.marked)}}async function Wr(n,e={}){let r=c(e.plugins),t=new K({plugins:r,disabledFeatures:e.disabledFeatures});return{t:await t.parse(n),f:t.features,m:Array.from(t.marked)}}function Kr(n,e={}){let r=c(e.plugins);return new k({plugins:r,features:n.f,markedRefs:n.m}).serializeTop(n.t)}function Lr(n,e={}){let r=c(e.plugins);return new re({plugins:r,markedRefs:n.m}).deserialize(n.t)}var J=class extends O{constructor(){super(...arguments);this.mode="cross"}};var ne=class extends z{constructor(){super(...arguments);this.mode="cross"}assignIndexedValue(r,t){return this.refs.has(r)||this.refs.set(r,t),t}};var F=class extends T{constructor(r){super(r);this.mode="cross";this.scopeId=r.scopeId}getRefParam(r){return G+"["+r+"]"}assignIndexedValue(r,t){return this.getRefParam(r)+"="+t}serializeTop(r){let t=this.serialize(r),s=r.i;if(s==null)return t;let o=this.resolvePatches(),i=this.getRefParam(s),a=this.scopeId==null?"":G,l=o?t+","+o+i:t;if(a==="")return o?"("+l+")":l;let u=this.scopeId==null?"()":"("+G+'["'+d(this.scopeId)+'"])';return"("+this.createFunction([a],l)+")"+u}};var se=class extends S{constructor(r){super(r);this.alive=!0;this.pending=0;this.initial=!0;this.buffer=[];this.onParseCallback=r.onParse,this.onErrorCallback=r.onError,this.onDoneCallback=r.onDone}onParseInternal(r,t){try{this.onParseCallback(r,t)}catch(s){this.onError(s)}}flush(){for(let r=0,t=this.buffer.length;r<t;r++)this.onParseInternal(this.buffer[r],!1)}onParse(r){this.initial?this.buffer.push(r):this.onParseInternal(r,!1)}onError(r){if(this.onErrorCallback)this.onErrorCallback(r);else throw r}onDone(){this.onDoneCallback&&this.onDoneCallback()}pushPendingState(){this.pending++}popPendingState(){--this.pending<=0&&this.onDone()}parseProperties(r){let t=Object.entries(r),s=[],o=[];for(let a=0,l=t.length;a<l;a++)s.push(d(t[a][0])),o.push(this.parse(t[a][1]));let i=Symbol.iterator;return i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(B(this.parseIteratorFactory(),this.parse(U(r))))),i=Symbol.asyncIterator,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(j(this.parseAsyncIteratorFactory(),this.parse(ze(r))))),i=Symbol.toStringTag,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(x(r[i]))),i=Symbol.isConcatSpreadable,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(r[i]?N:b)),{k:s,v:o,s:s.length}}parsePromise(r,t){return t.then(s=>{let o=this.parseWithError(s);o&&this.onParse({t:23,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(2),o],f:void 0,b:void 0,o:void 0}),this.popPendingState()},s=>{if(this.alive){let o=this.parseWithError(s);o&&this.onParse({t:24,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(3),o],f:void 0,b:void 0,o:void 0})}this.popPendingState()}),this.pushPendingState(),this.createPromiseConstructorNode(r)}parsePlugin(r,t){let s=this.plugins;if(s)for(let o=0,i=s.length;o<i;o++){let a=s[o];if(a.parse.stream&&a.test(t))return D(r,a.tag,a.parse.stream(t,this,{id:r}))}}parseStream(r,t){let s=_(r,this.parseSpecialReference(4),[]);return this.pushPendingState(),t.on({next:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(Re(r,i))}},throw:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(Pe(r,i))}this.popPendingState()},return:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(Ce(r,i))}this.popPendingState()}}),s}parseWithError(r){try{return this.parse(r)}catch(t){this.onError(t);return}}start(r){let t=this.parseWithError(r);t&&(this.onParseInternal(t,!0),this.initial=!1,this.flush(),this.pending<=0&&this.destroy())}destroy(){this.alive&&(this.onDone(),this.alive=!1)}isAlive(){return this.alive}};var Y=class extends se{constructor(){super(...arguments);this.mode="cross"}};var $=class extends S{constructor(){super(...arguments);this.mode="cross"}};function Jr(n,e={}){let r=c(e.plugins),t=new $({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}),s=t.parse(n);return new F({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}).serializeTop(s)}async function Yr(n,e={}){let r=c(e.plugins),t=new J({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}),s=await t.parse(n);return new F({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}).serializeTop(s)}function $r(n,e={}){let r=c(e.plugins);return new $({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}async function Gr(n,e={}){let r=c(e.plugins);return await new J({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}function Ue(n,e){let r=c(e.plugins),t=new Y({plugins:r,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse(s,o){let i=new F({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}),a;try{a=i.serializeTop(s)}catch(l){e.onError&&e.onError(l);return}e.onSerialize(a,o)},onError:e.onError,onDone:e.onDone});return t.start(n),()=>{t.destroy()}}function Hr(n,e){let r=c(e.plugins),t=new Y({plugins:r,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse:e.onParse,onError:e.onError,onDone:e.onDone});return t.start(n),()=>{t.destroy()}}function qr(n,e){let r=c(e.plugins);return new ne({plugins:r,refs:e.refs}).deserialize(n)}var oe=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;this.plugins=c(e.plugins)}write(e,r){this.alive&&!this.flushed&&(this.pending++,this.keys.add(e),this.cleanups.push(Ue(r,{plugins:this.plugins,scopeId:this.options.scopeId,refs:this.refs,disabledFeatures:this.options.disabledFeatures,onError:this.options.onError,onSerialize:(t,s)=>{this.alive&&this.options.onData(s?this.options.globalIdentifier+'["'+d(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}}};
17
+ - If the reference is present on multiple runtimes (isomorphic), you can use the Reference API to map the references.`);this.value=r}},m=class extends Error{constructor(e){super('Unsupported node type "'+e.t+'".')}},O=class extends Error{constructor(e){super('Missing plugin for tag "'+e+'".')}},g=class extends Error{constructor(e){super('Missing "'+e+'" instance.')}},H=class extends Error{constructor(r){super('Missing reference for the value "'+je.call(r)+'" of type "'+typeof r+'"');this.value=r}},Z=class extends Error{constructor(e){super('Missing reference for id "'+d(e)+'"')}},ee=class extends Error{constructor(e){super('Unknown TypedArray "'+e+'"')}};var A=class{constructor(e,r){this.value=e;this.replacement=r}};var ir={},ar={};var lr={0:{},1:{},2:{},3:{},4:{}};function re(){let n,e;return{promise:new Promise((r,t)=>{n=r,e=t}),resolve(r){n(r)},reject(r){e(r)}}}function ze(n){return"__SEROVAL_STREAM__"in n}function C(){let n=new Set,e=[],r=!0,t=!0;function s(a){for(let l of n.keys())l.next(a)}function o(a){for(let l of n.keys())l.throw(a)}function i(a){for(let l of n.keys())l.return(a)}return{__SEROVAL_STREAM__:!0,on(a){r&&n.add(a);for(let l=0,u=e.length;l<u;l++){let h=e[l];l===u-1&&!r?t?a.return(h):a.throw(h):a.next(h)}return()=>{r&&n.delete(a)}},next(a){r&&(e.push(a),s(a))},throw(a){r&&(e.push(a),o(a),r=!1,t=!1,n.clear())},return(a){r&&(e.push(a),i(a),r=!1,t=!0,n.clear())}}}function Te(n){let e=C(),r=n[Symbol.asyncIterator]();async function t(){try{let s=await r.next();s.done?e.return(s.value):(e.next(s.value),await t())}catch(s){e.throw(s)}}return t().catch(()=>{}),e}function ur(n){return()=>{let e=[],r=[],t=0,s=-1,o=!1;function i(){for(let l=0,u=r.length;l<u;l++)r[l].resolve({done:!0,value:void 0})}n.on({next(l){let u=r.shift();u&&u.resolve({done:!1,value:l}),e.push(l)},throw(l){let u=r.shift();u&&u.reject(l),i(),s=e.length,e.push(l),o=!0},return(l){let u=r.shift();u&&u.resolve({done:!0,value:l}),i(),s=e.length,e.push(l)}});function a(){let l=t++,u=e[l];if(l!==s)return{done:!1,value:u};if(o)throw u;return{done:!0,value:u}}return{[Symbol.asyncIterator](){return this},async next(){if(s===-1){let l=t++;if(l>=e.length){let u=re();return r.push(u),await u.promise}return{done:!1,value:e[l]}}return t>s?{done:!0,value:void 0}:a()}}}}function W(n){let e=[],r=-1,t=-1,s=n[Symbol.iterator]();for(;;)try{let o=s.next();if(e.push(o.value),o.done){t=e.length-1;break}}catch(o){r=e.length,e.push(o)}return{v:e,t:r,d:t}}function dr(n){return()=>{let e=0;return{[Symbol.iterator](){return this},next(){if(e>n.d)return{done:!0,value:void 0};let r=e++,t=n.v[r];if(r===n.t)throw t;return{done:r===n.d,value:t}}}}}async function _e(n){try{return[1,await n]}catch(e){return[0,e]}}var K=class{constructor(e){this.marked=new Set;this.plugins=e.plugins,this.features=31^(e.disabledFeatures||0),this.refs=e.refs||new Map}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(e)}getIndexedValue(e){let r=this.refs.get(e);if(r!=null)return this.markRef(r),{type:1,value:sr(r)};let t=this.refs.size;return this.refs.set(e,t),{type:0,value:t}}getReference(e){let r=this.getIndexedValue(e);return r.type===1?r:le(e)?{type:2,value:Be(r.value,e)}:r}getStrictReference(e){f(le(e),new p(e));let r=this.getIndexedValue(e);return r.type===1?r.value:Be(r.value,e)}parseFunction(e){return this.getStrictReference(e)}parseWellKnownSymbol(e){let r=this.getReference(e);return r.type!==0?r.value:(f(e in ue,new p(e)),or(r.value,e))}parseSpecialReference(e){let r=this.getIndexedValue(lr[e]);return r.type===1?r.value:{t:26,i:r.value,s: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}}parseIteratorFactory(){let e=this.getIndexedValue(ir);return e.type===1?e.value:{t:27,i:e.value,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:void 0,f:this.parseWellKnownSymbol(Symbol.iterator),b:void 0,o:void 0}}parseAsyncIteratorFactory(){let e=this.getIndexedValue(ar);return e.type===1?e.value:{t:29,i:e.value,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(1),this.parseWellKnownSymbol(Symbol.asyncIterator)],f:void 0,b:void 0,o:void 0}}createObjectNode(e,r,t,s){return{t:t?11:10,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:s,e:void 0,a:void 0,f:void 0,b:void 0,o:me(r)}}createMapNode(e,r,t,s){return{t:8,i:e,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:{k:r,v:t,s},a:void 0,f:this.parseSpecialReference(0),b:void 0,o:void 0}}createPromiseConstructorNode(e){return{t:22,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.parseSpecialReference(1),b:void 0,o:void 0}}};var z=class extends K{async parseItems(e){let r=[];for(let t=0,s=e.length;t<s;t++)t in e&&(r[t]=await this.parse(e[t]));return r}async parseArray(e,r){return Ne(e,r,await this.parseItems(r))}async parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let i=0,a=r.length;i<a;i++)t.push(d(r[i][0])),s.push(await this.parse(r[i][1]));let o=Symbol.iterator;return o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(j(this.parseIteratorFactory(),await this.parse(W(e))))),o=Symbol.asyncIterator,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(_(this.parseAsyncIteratorFactory(),await this.parse(Te(e))))),o=Symbol.toStringTag,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(x(e[o]))),o=Symbol.isConcatSpreadable,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(e[o]?N:b)),{k:t,v:s,s:t.length}}async parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,await this.parseProperties(r))}async parseBoxed(e,r){return be(e,await this.parse(r.valueOf()))}async parseTypedArray(e,r){return xe(e,r,await this.parse(r.buffer))}async parseBigIntTypedArray(e,r){return Ae(e,r,await this.parse(r.buffer))}async parseDataView(e,r){return Ie(e,r,await this.parse(r.buffer))}async parseError(e,r){let t=D(r,this.features);return Re(e,r,t?await this.parseProperties(t):void 0)}async parseAggregateError(e,r){let t=D(r,this.features);return Ee(e,r,t?await this.parseProperties(t):void 0)}async parseMap(e,r){let t=[],s=[];for(let[o,i]of r.entries())t.push(await this.parse(o)),s.push(await this.parse(i));return this.createMapNode(e,t,s,r.size)}async parseSet(e,r){let t=[];for(let s of r.keys())t.push(await this.parse(s));return we(e,r.size,t)}async parsePromise(e,r){let[t,s]=await _e(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(s),b:void 0,o:void 0}}async parsePlugin(e,r){let t=this.plugins;if(t)for(let s=0,o=t.length;s<o;s++){let i=t[s];if(i.parse.async&&i.test(r))return B(e,i.tag,await i.parse.async(r,this,{id:e}))}}async parseStream(e,r){return M(e,this.parseSpecialReference(4),await new Promise((t,s)=>{let o=[],i=r.on({next:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(Pe(e,l))},l=>{s(l),i()})},throw:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(Oe(e,l)),t(o),i()},l=>{s(l),i()})},return:a=>{this.markRef(e),this.parse(a).then(l=>{o.push(Ce(e,l)),t(o),i()},l=>{s(l),i()})}})}))}async parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);if(ze(r))return this.parseStream(e,r);let t=r.constructor;if(t===A)return this.parse(r.replacement);let s=await this.parsePlugin(e,r);if(s)return s;switch(t){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return he(e,r);case RegExp:return ye(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);case ArrayBuffer:return ve(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);case Map:return this.parseMap(e,r);case Set:return this.parseSet(e,r);default:break}if(t===Promise||r instanceof Promise)return this.parsePromise(e,r);let o=this.features;if(o&16)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(o&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(Symbol.iterator in r||Symbol.asyncIterator in r)return this.parsePlainObject(e,r,!!t);throw new p(r)}async parse(e){try{switch(typeof e){case"boolean":return e?N:b;case"undefined":return ce;case"string":return x(e);case"number":return ge(e);case"bigint":return Se(e);case"object":{if(e){let r=this.getReference(e);return r.type===0?await this.parseObject(r.value,e):r.value}return fe}case"symbol":return this.parseWellKnownSymbol(e);case"function":return this.parseFunction(e);default:throw new p(e)}}catch(r){throw new P(r)}}};var L=class extends z{constructor(){super(...arguments);this.mode="cross"}};function cr(n){switch(n){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 ee(n)}}function fr(n,e){switch(e){case 3:return Object.freeze(n);case 1:return Object.preventExtensions(n);case 2:return Object.seal(n);default:return n}}var T=class{constructor(e){this.plugins=e.plugins,this.refs=e.refs||new Map}deserializeReference(e){return this.assignIndexedValue(e.i,Ye(y(e.s)))}deserializeArray(e){let r=e.l,t=this.assignIndexedValue(e.i,new Array(r)),s;for(let o=0;o<r;o++)s=e.a[o],s&&(t[o]=this.deserialize(s));return fr(t,e.o),t}deserializeProperties(e,r){let t=e.s;if(t){let s=e.k,o=e.v;for(let i=0,a;i<t;i++)a=s[i],typeof a=="string"?r[y(a)]=this.deserialize(o[i]):r[this.deserialize(a)]=this.deserialize(o[i])}return r}deserializeObject(e){let r=this.assignIndexedValue(e.i,e.t===10?{}:Object.create(null));return this.deserializeProperties(e.p,r),fr(r,e.o),r}deserializeDate(e){return this.assignIndexedValue(e.i,new Date(e.s))}deserializeRegExp(e){return this.assignIndexedValue(e.i,new RegExp(y(e.c),e.m))}deserializeSet(e){let r=this.assignIndexedValue(e.i,new Set),t=e.a;for(let s=0,o=e.l;s<o;s++)r.add(this.deserialize(t[s]));return r}deserializeMap(e){let r=this.assignIndexedValue(e.i,new Map),t=e.e.k,s=e.e.v;for(let o=0,i=e.e.s;o<i;o++)r.set(this.deserialize(t[o]),this.deserialize(s[o]));return r}deserializeArrayBuffer(e){let r=new Uint8Array(e.s);return this.assignIndexedValue(e.i,r.buffer)}deserializeTypedArray(e){let r=cr(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([],y(e.m)));return this.deserializeDictionary(e,r)}deserializeError(e){let r=Xe[e.s],t=this.assignIndexedValue(e.i,new r(y(e.m)));return this.deserializeDictionary(e,t)}deserializePromise(e){let r=re(),t=this.assignIndexedValue(e.i,r),s=this.deserialize(e.f);return e.s?r.resolve(s):r.reject(s),t.promise}deserializeBoxed(e){return this.assignIndexedValue(e.i,Object(this.deserialize(e.f)))}deserializePlugin(e){let r=this.plugins;if(r){let t=y(e.c);for(let s=0,o=r.length;s<o;s++){let i=r[s];if(i.tag===t)return this.assignIndexedValue(e.i,i.deserialize(e.s,this,{id:e.i}))}}throw new O(e.c)}deserializePromiseConstructor(e){return this.assignIndexedValue(e.i,re()).promise}deserializePromiseResolve(e){let r=this.refs.get(e.i);f(r,new g("Promise")),r.resolve(this.deserialize(e.a[1]))}deserializePromiseReject(e){let r=this.refs.get(e.i);f(r,new g("Promise")),r.reject(this.deserialize(e.a[1]))}deserializeIteratorFactoryInstance(e){this.deserialize(e.a[0]);let r=this.deserialize(e.a[1]);return dr(r)}deserializeAsyncIteratorFactoryInstance(e){this.deserialize(e.a[0]);let r=this.deserialize(e.a[1]);return ur(r)}deserializeStreamConstructor(e){let r=this.assignIndexedValue(e.i,C()),t=e.a.length;if(t)for(let s=0;s<t;s++)this.deserialize(e.a[s]);return r}deserializeStreamNext(e){let r=this.refs.get(e.i);f(r,new g("Stream")),r.next(this.deserialize(e.f))}deserializeStreamThrow(e){let r=this.refs.get(e.i);f(r,new g("Stream")),r.throw(this.deserialize(e.f))}deserializeStreamReturn(e){let r=this.refs.get(e.i);f(r,new g("Stream")),r.return(this.deserialize(e.f))}deserializeIteratorFactory(e){this.deserialize(e.f)}deserializeAsyncIteratorFactory(e){this.deserialize(e.a[1])}deserialize(e){try{switch(e.t){case 2:return Ze[e.s];case 0:return e.s;case 1:return y(e.s);case 3:return BigInt(e.s);case 4:return this.refs.get(e.i);case 18: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 19:return this.deserializeArrayBuffer(e);case 16:case 15:return this.deserializeTypedArray(e);case 20: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 qe[e.s];case 21:return this.deserializeBoxed(e);case 25:return this.deserializePlugin(e);case 22:return this.deserializePromiseConstructor(e);case 23:return this.deserializePromiseResolve(e);case 24:return this.deserializePromiseReject(e);case 28:return this.deserializeIteratorFactoryInstance(e);case 30:return this.deserializeAsyncIteratorFactoryInstance(e);case 31:return this.deserializeStreamConstructor(e);case 32:return this.deserializeStreamNext(e);case 33:return this.deserializeStreamThrow(e);case 34:return this.deserializeStreamReturn(e);case 27:return this.deserializeIteratorFactory(e);case 29:return this.deserializeAsyncIteratorFactory(e);default:throw new m(e)}}catch(r){throw new Q(r)}}};var te=class extends T{constructor(){super(...arguments);this.mode="cross"}assignIndexedValue(r,t){return this.refs.has(r)||this.refs.set(r,t),t}};var zr=/^[$A-Z_][0-9A-Z_$]*$/i;function Me(n){let e=n[0];return(e==="$"||e==="_"||e>="A"&&e<="Z"||e>="a"&&e<="z")&&zr.test(n)}function ne(n){switch(n.t){case 0:return n.s+"="+n.v;case 2:return n.s+".set("+n.k+","+n.v+")";case 1:return n.s+".add("+n.v+")";case 3:return n.s+".delete("+n.k+")"}}function Tr(n){let e=[],r=n[0];for(let t=1,s=n.length,o,i=r;t<s;t++)o=n[t],o.t===0&&o.v===i.v?r={t:0,s:o.s,k:void 0,v:ne(r)}:o.t===2&&o.s===i.s?r={t:2,s:ne(r),k:o.k,v:o.v}:o.t===1&&o.s===i.s?r={t:1,s:ne(r),k:void 0,v:o.v}:o.t===3&&o.s===i.s?r={t:3,s:ne(r),k:o.k,v:void 0}:(e.push(r),r=o),i=o;return e.push(r),e}function pr(n){if(n.length){let e="",r=Tr(n);for(let t=0,s=r.length;t<s;t++)e+=ne(r[t])+",";return e}}var kr="Object.create(null)",Fr="new Set",Vr="new Map",Dr="Promise.resolve",Br="Promise.reject",jr={3:"Object.freeze",2:"Object.seal",1:"Object.preventExtensions",0:void 0},k=class{constructor(e){this.stack=[];this.flags=[];this.assignments=[];this.plugins=e.plugins,this.features=e.features,this.marked=new Set(e.markedRefs)}createFunction(e,r){return this.features&2?(e.length===1?e[0]:"("+e.join(",")+")")+"=>"+r:"function("+e.join(",")+"){return "+r+"}"}createEffectfulFunction(e,r){return this.features&2?(e.length===1?e[0]:"("+e.join(",")+")")+"=>{"+r+"}":"function("+e.join(",")+"){"+r+"}"}markRef(e){this.marked.add(e)}isMarked(e){return this.marked.has(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,s=t.length;r<s;r++){let o=t[r];e+=jr[o.type]+"("+o.value+"),"}return e}resolvePatches(){let e=pr(this.assignments),r=this.resolveFlags();return e?r?e+r:e:r}createAssignment(e,r){this.assignments.push({t:0,s:e,k:void 0,v:r})}createAddAssignment(e,r){this.assignments.push({t:1,s:this.getRefParam(e),k:void 0,v:r})}createSetAssignment(e,r,t){this.assignments.push({t:2,s:this.getRefParam(e),k:r,v:t})}createDeleteAssignment(e,r){this.assignments.push({t:3,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,R+'.get("'+e.s+'")')}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,s=this.serializeArrayItem(r,t[0],0),o=s==="";for(let i=1,a=e.l,l;i<a;i++)l=this.serializeArrayItem(r,t[i],i),s+=","+l,o=l==="";return this.stack.pop(),this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(r,"["+s+(o?",]":"]"))}return this.assignIndexedValue(r,"[]")}serializeProperty(e,r,t){if(typeof r=="string"){let s=Number(r),o=s>=0&&s.toString()===r||Me(r);if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);return this.markRef(e.i),o&&s!==s?this.createObjectAssign(e.i,r,i):this.createArrayAssign(e.i,o?r:'"'+r+'"',i),""}return(o?r:'"'+r+'"')+":"+this.serialize(t)}return"["+this.serialize(r)+"]:"+this.serialize(t)}serializeProperties(e,r){let t=r.s;if(t){let s=r.k,o=r.v;this.stack.push(e.i);let i=this.serializeProperty(e,s[0],o[0]);for(let a=1,l=i;a<t;a++)l=this.serializeProperty(e,s[a],o[a]),i+=(l&&i&&",")+l;return this.stack.pop(),"{"+i+"}"}return"{}"}serializeObject(e){return this.pushObjectFlag(e.o,e.i),this.assignIndexedValue(e.i,this.serializeProperties(e,e.p))}serializeWithObjectAssign(e,r,t){let s=this.serializeProperties(e,r);return s!=="{}"?"Object.assign("+t+","+s+")":t}serializeStringKeyAssignment(e,r,t,s){let o=this.serialize(s),i=Number(t),a=i>=0&&i.toString()===t||Me(t);if(this.isIndexedValueInStack(s))a&&i!==i?this.createObjectAssign(e.i,t,o):this.createArrayAssign(e.i,a?t:'"'+t+'"',o);else{let l=this.assignments;this.assignments=r,a&&i!==i?this.createObjectAssign(e.i,t,o):this.createArrayAssign(e.i,a?t:'"'+t+'"',o),this.assignments=l}}serializeAssignment(e,r,t,s){if(typeof t=="string")this.serializeStringKeyAssignment(e,r,t,s);else{let o=this.stack;this.stack=[];let i=this.serialize(s);this.stack=o;let a=this.assignments;this.assignments=r,this.createArrayAssign(e.i,this.serialize(t),i),this.assignments=a}}serializeAssignments(e,r){let t=r.s;if(t){let s=[],o=r.k,i=r.v;this.stack.push(e.i);for(let a=0;a<t;a++)this.serializeAssignment(e,s,o[a],i[a]);return this.stack.pop(),pr(s)}}serializeDictionary(e,r){if(e.p)if(this.features&8)r=this.serializeWithObjectAssign(e,e.p,r);else{this.markRef(e.i);let t=this.serializeAssignments(e,e.p);if(t)return"("+this.assignIndexedValue(e.i,r)+","+t+this.getRefParam(e.i)+")"}return this.assignIndexedValue(e.i,r)}serializeNullConstructor(e){return this.pushObjectFlag(e.o,e.i),this.serializeDictionary(e,kr)}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=Fr,t=e.l,s=e.i;if(t){let o=e.a;this.stack.push(s);let i=this.serializeSetItem(s,o[0]);for(let a=1,l=i;a<t;a++)l=this.serializeSetItem(s,o[a]),i+=(l&&i&&",")+l;this.stack.pop(),i&&(r+="(["+i+"])")}return this.assignIndexedValue(s,r)}serializeMapEntry(e,r,t,s){if(this.isIndexedValueInStack(r)){let o=this.getRefParam(r.i);if(this.markRef(e),this.isIndexedValueInStack(t)){let a=this.getRefParam(t.i);return this.createSetAssignment(e,o,a),""}if(t.t!==4&&t.i!=null&&this.isMarked(t.i)){let a="("+this.serialize(t)+",["+s+","+s+"])";return this.createSetAssignment(e,o,this.getRefParam(t.i)),this.createDeleteAssignment(e,s),a}let i=this.stack;return this.stack=[],this.createSetAssignment(e,o,this.serialize(t)),this.stack=i,""}if(this.isIndexedValueInStack(t)){let o=this.getRefParam(t.i);if(this.markRef(e),r.t!==4&&r.i!=null&&this.isMarked(r.i)){let a="("+this.serialize(r)+",["+s+","+s+"])";return this.createSetAssignment(e,this.getRefParam(r.i),o),this.createDeleteAssignment(e,s),a}let i=this.stack;return this.stack=[],this.createSetAssignment(e,this.serialize(r),o),this.stack=i,""}return"["+this.serialize(r)+","+this.serialize(t)+"]"}serializeMap(e){let r=Vr,t=e.e.s,s=e.i,o=e.f,i=this.getRefParam(o.i);if(t){let a=e.e.k,l=e.e.v;this.stack.push(s);let u=this.serializeMapEntry(s,a[0],l[0],i);for(let h=1,Fe=u;h<t;h++)Fe=this.serializeMapEntry(s,a[h],l[h],i),u+=(Fe&&u&&",")+Fe;this.stack.pop(),u&&(r+="(["+u+"])")}return o.t===26&&(this.markRef(o.i),r="("+this.serialize(o)+","+r+")"),this.assignIndexedValue(s,r)}serializeArrayBuffer(e){let r="new Uint8Array(",t=e.s,s=t.length;if(s){r+="["+t[0];for(let o=1;o<s;o++)r+=","+t[o];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=this.serializeDictionary(e,'new AggregateError([],"'+e.m+'")');return this.stack.pop(),t}serializeError(e){return this.serializeDictionary(e,"new "+de[e.s]+'("'+e.m+'")')}serializePromise(e){let r,t=e.f,s=e.i,o=e.s?Dr:Br;if(this.isIndexedValueInStack(t)){let i=this.getRefParam(t.i);r=o+(e.s?"().then("+this.createFunction([],i)+")":"().catch("+this.createEffectfulFunction([],"throw "+i)+")")}else{this.stack.push(s);let i=this.serialize(t);this.stack.pop(),r=o+"("+i+")"}return this.assignIndexedValue(s,r)}serializeWellKnownSymbol(e){return this.assignIndexedValue(e.i,Ge[e.s])}serializeBoxed(e){return this.assignIndexedValue(e.i,"Object("+this.serialize(e.f)+")")}serializePlugin(e){let r=this.plugins;if(r)for(let t=0,s=r.length;t<s;t++){let o=r[t];if(o.tag===e.c)return this.assignIndexedValue(e.i,o.serialize(e.s,this,{id:e.i}))}throw new O(e.c)}getConstructor(e){let r=this.serialize(e);return r===this.getRefParam(e.i)?r:"("+r+")"}serializePromiseConstructor(e){return this.assignIndexedValue(e.i,this.getConstructor(e.f)+"()")}serializePromiseResolve(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializePromiseReject(e){return this.getConstructor(e.a[0])+"("+this.getRefParam(e.i)+","+this.serialize(e.a[1])+")"}serializeSpecialReferenceValue(e){switch(e){case 0:return"[]";case 1:return this.createFunction(["s","f","p"],"((p=new Promise("+this.createEffectfulFunction(["a","b"],"s=a,f=b")+")).s=s,p.f=f,p)");case 2:return this.createEffectfulFunction(["p","d"],'p.s(d),p.status="success",p.value=d;delete p.s;delete p.f');case 3:return this.createEffectfulFunction(["p","d"],'p.f(d),p.status="failure",p.value=d;delete p.s;delete p.f');case 4:return this.createFunction(["b","a","s","l","p","f","e","n"],"(b=[],a=!0,s=!1,l=[],p=0,f="+this.createEffectfulFunction(["v","m","x"],"for(x=0;x<p;x++)l[x]&&l[x][m](v)")+",n="+this.createEffectfulFunction(["o","x","z","c"],'for(x=0,z=b.length;x<z;x++)(c=b[x],(!a&&x===z-1)?o[s?"return":"throw"](c):o.next(c))')+",e="+this.createFunction(["o","t"],"(a&&(l[t=p++]=o),n(o),"+this.createEffectfulFunction([],"a&&(l[t]=void 0)")+")")+",{__SEROVAL_STREAM__:!0,on:"+this.createFunction(["o"],"e(o)")+",next:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"next"))')+",throw:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"throw"),a=s=!1,l.length=0)')+",return:"+this.createEffectfulFunction(["v"],'a&&(b.push(v),f(v,"return"),a=!1,s=!0,l.length=0)')+"})");default:return""}}serializeSpecialReference(e){return this.assignIndexedValue(e.i,this.serializeSpecialReferenceValue(e.s))}serializeIteratorFactory(e){let r="",t=!1;return e.f.t!==4&&(this.markRef(e.f.i),r="("+this.serialize(e.f)+",",t=!0),r+=this.assignIndexedValue(e.i,this.createFunction(["s"],this.createFunction(["i","c","d","t"],"(i=0,t={["+this.getRefParam(e.f.i)+"]:"+this.createFunction([],"t")+",next:"+this.createEffectfulFunction([],"if(i>s.d)return{done:!0,value:void 0};if(d=s.v[c=i++],c===s.t)throw d;return{done:c===s.d,value:d}")+"})"))),t&&(r+=")"),r}serializeIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}serializeAsyncIteratorFactory(e){let r=e.a[0],t=e.a[1],s="";r.t!==4&&(this.markRef(r.i),s+="("+this.serialize(r)),t.t!==4&&(this.markRef(t.i),s+=(s?",":"(")+this.serialize(t)),s&&(s+=",");let o=this.assignIndexedValue(e.i,this.createFunction(["s"],this.createFunction(["b","c","p","d","e","t","f"],"(b=[],c=0,p=[],d=-1,e=!1,f="+this.createEffectfulFunction(["i","l"],"for(i=0,l=p.length;i<l;i++)p[i].s({done:!0,value:void 0})")+",s.on({next:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.s({done:!1,value:v});b.push(v)")+",throw:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.f(v);f(),d=b.length,e=!0,b.push(v)")+",return:"+this.createEffectfulFunction(["v","t"],"if(t=p.shift())t.s({done:!0,value:v});f(),d=b.length,b.push(v)")+"}),t={["+this.getRefParam(t.i)+"]:"+this.createFunction([],"t")+",next:"+this.createEffectfulFunction(["i","t","v"],"if(d===-1){return((i=c++)>=b.length)?(p.push(t="+this.getRefParam(r.i)+"()),t):{done:!1,value:b[i]}}if(c>d)return{done:!0,value:void 0};if(v=b[i=c++],i!==d)return{done:!1,value:v};if(e)throw v;return{done:!0,value:v}")+"})")));return s?s+o+")":o}serializeAsyncIteratorFactoryInstance(e){return this.getConstructor(e.a[0])+"("+this.serialize(e.a[1])+")"}serializeStreamConstructor(e){let r=this.assignIndexedValue(e.i,this.getConstructor(e.f)+"()"),t=e.a.length;if(t){let s=this.serialize(e.a[0]);for(let o=1;o<t;o++)s+=","+this.serialize(e.a[o]);return"("+r+","+s+","+this.getRefParam(e.i)+")"}return r}serializeStreamNext(e){return this.getRefParam(e.i)+".next("+this.serialize(e.f)+")"}serializeStreamThrow(e){return this.getRefParam(e.i)+".throw("+this.serialize(e.f)+")"}serializeStreamReturn(e){return this.getRefParam(e.i)+".return("+this.serialize(e.f)+")"}serialize(e){try{switch(e.t){case 2:return He[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 18: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 19:return this.serializeArrayBuffer(e);case 16:case 15:return this.serializeTypedArray(e);case 20: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.serializeWellKnownSymbol(e);case 21:return this.serializeBoxed(e);case 22:return this.serializePromiseConstructor(e);case 23:return this.serializePromiseResolve(e);case 24:return this.serializePromiseReject(e);case 25:return this.serializePlugin(e);case 26:return this.serializeSpecialReference(e);case 27:return this.serializeIteratorFactory(e);case 28:return this.serializeIteratorFactoryInstance(e);case 29:return this.serializeAsyncIteratorFactory(e);case 30:return this.serializeAsyncIteratorFactoryInstance(e);case 31:return this.serializeStreamConstructor(e);case 32:return this.serializeStreamNext(e);case 33:return this.serializeStreamThrow(e);case 34:return this.serializeStreamReturn(e);default:throw new m(e)}}catch(r){throw new X(r)}}};var F=class extends k{constructor(r){super(r);this.mode="cross";this.scopeId=r.scopeId}getRefParam(r){return q+"["+r+"]"}assignIndexedValue(r,t){return this.getRefParam(r)+"="+t}serializeTop(r){let t=this.serialize(r),s=r.i;if(s==null)return t;let o=this.resolvePatches(),i=this.getRefParam(s),a=this.scopeId==null?"":q,l=o?t+","+o+i:t;if(a==="")return o?"("+l+")":l;let u=this.scopeId==null?"()":"("+q+'["'+d(this.scopeId)+'"])';return"("+this.createFunction([a],l)+")"+u}};var S=class extends K{parseItems(e){let r=[];for(let t=0,s=e.length;t<s;t++)t in e&&(r[t]=this.parse(e[t]));return r}parseArray(e,r){return Ne(e,r,this.parseItems(r))}parseProperties(e){let r=Object.entries(e),t=[],s=[];for(let i=0,a=r.length;i<a;i++)t.push(d(r[i][0])),s.push(this.parse(r[i][1]));let o=Symbol.iterator;return o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(j(this.parseIteratorFactory(),this.parse(W(e))))),o=Symbol.asyncIterator,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(_(this.parseAsyncIteratorFactory(),this.parse(C())))),o=Symbol.toStringTag,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(x(e[o]))),o=Symbol.isConcatSpreadable,o in e&&(t.push(this.parseWellKnownSymbol(o)),s.push(e[o]?N:b)),{k:t,v:s,s:t.length}}parsePlainObject(e,r,t){return this.createObjectNode(e,r,t,this.parseProperties(r))}parseBoxed(e,r){return be(e,this.parse(r.valueOf()))}parseTypedArray(e,r){return xe(e,r,this.parse(r.buffer))}parseBigIntTypedArray(e,r){return Ae(e,r,this.parse(r.buffer))}parseDataView(e,r){return Ie(e,r,this.parse(r.buffer))}parseError(e,r){let t=D(r,this.features);return Re(e,r,t?this.parseProperties(t):void 0)}parseAggregateError(e,r){let t=D(r,this.features);return Ee(e,r,t?this.parseProperties(t):void 0)}parseMap(e,r){let t=[],s=[];for(let[o,i]of r.entries())t.push(this.parse(o)),s.push(this.parse(i));return this.createMapNode(e,t,s,r.size)}parseSet(e,r){let t=[];for(let s of r.keys())t.push(this.parse(s));return we(e,r.size,t)}parsePlugin(e,r){let t=this.plugins;if(t)for(let s=0,o=t.length;s<o;s++){let i=t[s];if(i.parse.sync&&i.test(r))return B(e,i.tag,i.parse.sync(r,this,{id:e}))}}parseStream(e,r){return M(e,this.parseSpecialReference(4),[])}parsePromise(e,r){return this.createPromiseConstructorNode(e)}parseObject(e,r){if(Array.isArray(r))return this.parseArray(e,r);if(ze(r))return this.parseStream(e,r);let t=r.constructor;if(t===A)return this.parse(r.replacement);let s=this.parsePlugin(e,r);if(s)return s;switch(t){case Object:return this.parsePlainObject(e,r,!1);case void 0:return this.parsePlainObject(e,r,!0);case Date:return he(e,r);case RegExp:return ye(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);case ArrayBuffer:return ve(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);case Map:return this.parseMap(e,r);case Set:return this.parseSet(e,r);default:break}if(t===Promise||r instanceof Promise)return this.parsePromise(e,r);let o=this.features;if(o&16)switch(t){case BigInt64Array:case BigUint64Array:return this.parseBigIntTypedArray(e,r);default:break}if(o&1&&typeof AggregateError!="undefined"&&(t===AggregateError||r instanceof AggregateError))return this.parseAggregateError(e,r);if(r instanceof Error)return this.parseError(e,r);if(Symbol.iterator in r||Symbol.asyncIterator in r)return this.parsePlainObject(e,r,!!t);throw new p(r)}parse(e){try{switch(typeof e){case"boolean":return e?N:b;case"undefined":return ce;case"string":return x(e);case"number":return ge(e);case"bigint":return Se(e);case"object":{if(e){let r=this.getReference(e);return r.type===0?this.parseObject(r.value,e):r.value}return fe}case"symbol":return this.parseWellKnownSymbol(e);case"function":return this.parseFunction(e);default:throw new p(e)}}catch(r){throw new P(r)}}};var se=class extends S{constructor(r){super(r);this.alive=!0;this.pending=0;this.initial=!0;this.buffer=[];this.onParseCallback=r.onParse,this.onErrorCallback=r.onError,this.onDoneCallback=r.onDone}onParseInternal(r,t){try{this.onParseCallback(r,t)}catch(s){this.onError(s)}}flush(){for(let r=0,t=this.buffer.length;r<t;r++)this.onParseInternal(this.buffer[r],!1)}onParse(r){this.initial?this.buffer.push(r):this.onParseInternal(r,!1)}onError(r){if(this.onErrorCallback)this.onErrorCallback(r);else throw r}onDone(){this.onDoneCallback&&this.onDoneCallback()}pushPendingState(){this.pending++}popPendingState(){--this.pending<=0&&this.onDone()}parseProperties(r){let t=Object.entries(r),s=[],o=[];for(let a=0,l=t.length;a<l;a++)s.push(d(t[a][0])),o.push(this.parse(t[a][1]));let i=Symbol.iterator;return i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(j(this.parseIteratorFactory(),this.parse(W(r))))),i=Symbol.asyncIterator,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(_(this.parseAsyncIteratorFactory(),this.parse(Te(r))))),i=Symbol.toStringTag,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(x(r[i]))),i=Symbol.isConcatSpreadable,i in r&&(s.push(this.parseWellKnownSymbol(i)),o.push(r[i]?N:b)),{k:s,v:o,s:s.length}}parsePromise(r,t){return t.then(s=>{let o=this.parseWithError(s);o&&this.onParse({t:23,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(2),o],f:void 0,b:void 0,o:void 0}),this.popPendingState()},s=>{if(this.alive){let o=this.parseWithError(s);o&&this.onParse({t:24,i:r,s:void 0,l:void 0,c:void 0,m:void 0,p:void 0,e:void 0,a:[this.parseSpecialReference(3),o],f:void 0,b:void 0,o:void 0})}this.popPendingState()}),this.pushPendingState(),this.createPromiseConstructorNode(r)}parsePlugin(r,t){let s=this.plugins;if(s)for(let o=0,i=s.length;o<i;o++){let a=s[o];if(a.parse.stream&&a.test(t))return B(r,a.tag,a.parse.stream(t,this,{id:r}))}}parseStream(r,t){let s=M(r,this.parseSpecialReference(4),[]);return this.pushPendingState(),t.on({next:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(Pe(r,i))}},throw:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(Oe(r,i))}this.popPendingState()},return:o=>{if(this.alive){let i=this.parseWithError(o);i&&this.onParse(Ce(r,i))}this.popPendingState()}}),s}parseWithError(r){try{return this.parse(r)}catch(t){this.onError(t);return}}start(r){let t=this.parseWithError(r);t&&(this.onParseInternal(t,!0),this.initial=!1,this.flush(),this.pending<=0&&this.destroy())}destroy(){this.alive&&(this.onDone(),this.alive=!1)}isAlive(){return this.alive}};var J=class extends se{constructor(){super(...arguments);this.mode="cross"}};var Y=class extends S{constructor(){super(...arguments);this.mode="cross"}};function _r(n,e={}){let r=c(e.plugins),t=new Y({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}),s=t.parse(n);return new F({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}).serializeTop(s)}async function Mr(n,e={}){let r=c(e.plugins),t=new L({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}),s=await t.parse(n);return new F({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}).serializeTop(s)}function Ur(n,e={}){let r=c(e.plugins);return new Y({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}async function Wr(n,e={}){let r=c(e.plugins);return await new L({plugins:r,disabledFeatures:e.disabledFeatures,refs:e.refs}).parse(n)}function Ue(n,e){let r=c(e.plugins),t=new J({plugins:r,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse(s,o){let i=new F({plugins:r,features:t.features,scopeId:e.scopeId,markedRefs:t.marked}),a;try{a=i.serializeTop(s)}catch(l){e.onError&&e.onError(l);return}e.onSerialize(a,o)},onError:e.onError,onDone:e.onDone});return t.start(n),()=>{t.destroy()}}function Kr(n,e){let r=c(e.plugins),t=new J({plugins:r,refs:e.refs,disabledFeatures:e.disabledFeatures,onParse:e.onParse,onError:e.onError,onDone:e.onDone});return t.start(n),()=>{t.destroy()}}function Lr(n,e){let r=c(e.plugins);return new te({plugins:r,refs:e.refs}).deserialize(n)}var $=class extends z{constructor(){super(...arguments);this.mode="vanilla"}};var oe=class extends T{constructor(r){super(r);this.mode="vanilla";this.marked=new Set(r.markedRefs)}assignIndexedValue(r,t){return this.marked.has(r)&&this.refs.set(r,t),t}};var Sr="hjkmoquxzABCDEFGHIJKLNPQRTUVWXYZ$_",mr=Sr.length,hr="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$_",gr=hr.length;function We(n){let e=n%mr,r=Sr[e];for(n=(n-e)/mr;n>0;)e=n%gr,r+=hr[e],n=(n-e)/gr;return r}var V=class extends k{constructor(){super(...arguments);this.mode="vanilla";this.valid=new Map;this.vars=[]}getRefParam(r){let t=this.valid.get(r);t==null&&(t=this.valid.size,this.valid.set(r,t));let s=this.vars[t];return s==null&&(s=We(t),this.vars[t]=s),s}assignIndexedValue(r,t){return this.isMarked(r)?this.getRefParam(r)+"="+t:t}serializePromiseConstructor(r){throw new m(r)}serializePromiseResolve(r){throw new m(r)}serializePromiseReject(r){throw new m(r)}serializeTop(r){let t=this.serialize(r);if(r.i!=null&&this.vars.length){let s=this.resolvePatches(),o=t;if(s){let i=this.getRefParam(r.i);o=t+","+s+i,t.startsWith(i+"=")||(o=i+"="+o)}return"("+this.createFunction(this.vars,"("+o+")")+")()"}return r.t===10?"("+t+")":t}};var G=class extends S{constructor(){super(...arguments);this.mode="vanilla"}};function Jr(n,e={}){let r=c(e.plugins),t=new G({plugins:r,disabledFeatures:e.disabledFeatures}),s=t.parse(n);return new V({plugins:r,features:t.features,markedRefs:t.marked}).serializeTop(s)}async function Yr(n,e={}){let r=c(e.plugins),t=new $({plugins:r,disabledFeatures:e.disabledFeatures}),s=await t.parse(n);return new V({plugins:r,features:t.features,markedRefs:t.marked}).serializeTop(s)}function $r(n){return(0,eval)(n)}function Gr(n,e={}){let r=c(e.plugins),t=new G({plugins:r,disabledFeatures:e.disabledFeatures});return{t:t.parse(n),f:t.features,m:Array.from(t.marked)}}async function qr(n,e={}){let r=c(e.plugins),t=new $({plugins:r,disabledFeatures:e.disabledFeatures});return{t:await t.parse(n),f:t.features,m:Array.from(t.marked)}}function Hr(n,e={}){let r=c(e.plugins);return new V({plugins:r,features:n.f,markedRefs:n.m}).serializeTop(n.t)}function Zr(n,e={}){let r=c(e.plugins);return new oe({plugins:r,markedRefs:n.m}).deserialize(n.t)}var ie=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;this.plugins=c(e.plugins)}write(e,r){this.alive&&!this.flushed&&(this.pending++,this.keys.add(e),this.cleanups.push(Ue(r,{plugins:this.plugins,scopeId:this.options.scopeId,refs:this.refs,disabledFeatures:this.options.disabledFeatures,onError:this.options.onError,onSerialize:(t,s)=>{this.alive&&this.options.onData(s?this.options.globalIdentifier+'["'+d(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}}};