var StructuredJSON=function(e){"use strict";const r="object"==typeof self?self:globalThis,t=(e,t)=>{switch(e){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+e)}return new r[e](t)},n=e=>((e,n)=>{const s=(r,t)=>(e.set(t,r),r),c=a=>{if(e.has(a))return e.get(a);const[o,u]=n[a];switch(o){case 0:case-1:return s(u,a);case 1:{const e=s([],a);for(const r of u)e.push(c(r));return e}case 2:{const e=s({},a);for(const[r,t]of u)e[c(r)]=c(t);return e}case 3:return s(new Date(u),a);case 4:{const{source:e,flags:r}=u;return s(new RegExp(e,r),a)}case 5:{const e=s(new Map,a);for(const[r,t]of u)e.set(c(r),c(t));return e}case 6:{const e=s(new Set,a);for(const r of u)e.add(c(r));return e}case 7:{const{name:e,message:n}=u;return s("function"==typeof r[e]?t(e,n):new Error(n),a)}case 8:return s(BigInt(u),a);case"BigInt":return s(Object(BigInt(u)),a);case"ArrayBuffer":return s(new Uint8Array(u).buffer,u);case"DataView":{const{buffer:e}=new Uint8Array(u);return s(new DataView(e),u)}}return s(t(o,u),a)};return c})(new Map,e)(0),s="",{toString:c}={},{keys:a}=Object,o=e=>{const r=typeof e;if("object"!==r||!e)return[0,r];const t=c.call(e).slice(8,-1);switch(t){case"Array":return[1,s];case"Object":return[2,s];case"Date":return[3,s];case"RegExp":return[4,s];case"Map":return[5,s];case"Set":return[6,s];case"DataView":return[1,t]}return t.includes("Array")?[1,t]:e instanceof Error?[7,e.name||"Error"]:[2,t]},u=([e,r])=>0===e&&("function"===r||"symbol"===r),i=(e,{json:r,lossy:t}={})=>{const n=[];return((e,r,t,n)=>{const c=(e,r)=>{const s=n.push(e)-1;return t.set(r,s),s},i=n=>{if(t.has(n))return t.get(n);let[f,l]=o(n);switch(f){case 0:{let r=n;switch(l){case"bigint":f=8,r=n.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);r=null;break;case"undefined":return c([-1],n)}return c([f,r],n)}case 1:{if(l){let e=n;return"DataView"===l?e=new Uint8Array(n.buffer):"ArrayBuffer"===l&&(e=new Uint8Array(n)),c([l,[...e]],n)}const e=[],r=c([f,e],n);for(const r of n)e.push(i(r));return r}case 2:{if(l)switch(l){case"BigInt":return c([l,n.toString()],n);case"Boolean":case"Number":case"String":return c([l,n.valueOf()],n)}if(r&&"toJSON"in n)return i(n.toJSON());const t=[],s=c([f,t],n);for(const r of a(n))!e&&u(o(n[r]))||t.push([i(r),i(n[r])]);return s}case 3:return c([f,isNaN(n.getTime())?s:n.toISOString()],n);case 4:{const{source:e,flags:r}=n;return c([f,{source:e,flags:r}],n)}case 5:{const r=[],t=c([f,r],n);for(const[t,s]of n)(e||!u(o(t))&&!u(o(s)))&&r.push([i(t),i(s)]);return t}case 6:{const r=[],t=c([f,r],n);for(const t of n)!e&&u(o(t))||r.push(i(t));return t}}const{message:w}=n;return c([f,{name:l,message:w}],n)};return i})(!(r||t),!!r,new Map,n)(e),n},{parse:f,stringify:l}=JSON,w={json:!0,lossy:!0};return e.parse=e=>n(f(e)),e.stringify=e=>l(i(e,w)),e}({});
