"use strict";var t=require("bignumber.js");const r=/(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])/,e=/(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)/;function n(n){const o={strict:!1,storeAsString:!1,alwaysParseAsBig:!1,useNativeBigInt:!1,protoAction:"error",constructorAction:"error"};if(null!=n){if(!0===n.strict&&(o.strict=!0),!0===n.storeAsString&&(o.storeAsString=!0),o.alwaysParseAsBig=!0===n.alwaysParseAsBig&&n.alwaysParseAsBig,o.useNativeBigInt=!0===n.useNativeBigInt&&n.useNativeBigInt,void 0!==n.constructorAction){if("error"!==n.constructorAction&&"ignore"!==n.constructorAction&&"preserve"!==n.constructorAction)throw new Error(`Incorrect value for constructorAction option, must be "error", "ignore" or undefined but passed ${n.constructorAction}`);o.constructorAction=n.constructorAction}if(void 0!==n.protoAction){if("error"!==n.protoAction&&"ignore"!==n.protoAction&&"preserve"!==n.protoAction)throw new Error(`Incorrect value for protoAction option, must be "error", "ignore" or undefined but passed ${n.protoAction}`);o.protoAction=n.protoAction}}let i,s;const u={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};let c;const f=t=>{throw{name:"SyntaxError",message:t,at:i,text:c}},a=t=>(t&&t!==s&&f(`Expected '${t}' instead of '${s}'`),s=c.charAt(i),i+=1,s),l=()=>{let r,e="";for("-"===s&&(e="-",a("-"));s>="0"&&s<="9";)e+=s,a();if("."===s)for(e+=".";a()&&s>="0"&&s<="9";)e+=s;if("e"===s||"E"===s)for(e+=s,a(),"-"!==s&&"+"!==s||(e+=s,a());s>="0"&&s<="9";)e+=s,a();if(r=+e,Number.isFinite(r))return e.length>15?o.storeAsString?e:o.useNativeBigInt?BigInt(e):new t(e):o.alwaysParseAsBig?o.useNativeBigInt?BigInt(r):new t(r):r;f("Bad number")};function p(){let t,r,e,n="";if('"'===s){let o=i;for(;a();){if('"'===s)return i-1>o&&(n+=c.substring(o,i-1)),a(),n;if("\\"===s){if(i-1>o&&(n+=c.substring(o,i-1)),a(),"u"===s){for(e=0,r=0;r<4&&(t=Number.parseInt(a(),16),Number.isFinite(t));r+=1)e=16*e+t;n+=String.fromCharCode(e)}else{if("string"!=typeof u[s])break;n+=u[s]}o=i}}}f("Bad string")}const g=()=>{for(;s&&s<=" ";)a()},b=()=>{switch(s){case"t":return a("t"),a("r"),a("u"),a("e"),!0;case"f":return a("f"),a("a"),a("l"),a("s"),a("e"),!1;case"n":return a("n"),a("u"),a("l"),a("l"),null}f(`Unexpected '${s}'`)};function A(){switch(g(),s){case"{":return y();case"[":return function(){const t=[];if("["===s){if(a("["),g(),"]"===s)return a("]"),t;for(;s;){if(t.push(A()),g(),"]"===s)return a("]"),t;a(","),g()}}f("Bad array")}();case'"':return p();case"-":return l();default:return s>="0"&&s<="9"?l():b()}}const y=()=>{let t;const n=Object.create(null);if("{"===s){if(a("{"),g(),"}"===s)return a("}"),n;for(;s;){const i=p();if(void 0!==i){if(t=i,g(),a(":"),!0===o.strict&&Object.hasOwnProperty.call(n,t)&&f(`Duplicate key "${t}"`),!0===r.test(t)?"error"===o.protoAction?f("Object contains forbidden prototype property"):"ignore"===o.protoAction?A():n[t]=A():!0===e.test(t)?"error"===o.constructorAction?f("Object contains forbidden constructor property"):"ignore"===o.constructorAction?A():n[t]=A():n[t]=A(),g(),"}"===s)return a("}"),n;a(","),g()}else f("Bad object key")}}f("Bad object")};return(t,r)=>{c=`${t}`,i=0,s=" ";const e=A();return g(),s&&f("Syntax error"),"function"==typeof r?function t(e,n){let o;const i=e[n];if(i&&"object"==typeof i)for(const r in i)o=t(i,r),void 0!==o?i[r]=o:delete i[r];return r.call(e,n,i)}({"":e},""):e}}const o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;let i,s;const u={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};let c;function f(t){return o.lastIndex=0,o.test(t)?`"${t.replace(o,(t=>{const r=u[t];return"string"==typeof r?r:`\\u${`0000${t.charCodeAt(0).toString(16)}`.slice(-4)}`}))}"`:`"${t}"`}function a(r,e){let n,o,u,l;const p=i;let g,b=e[r];const A=null!=b&&(b instanceof t||t.isBigNumber(b));switch(b&&"object"==typeof b&&"function"==typeof b.toJSON&&(b=b.toJSON(r)),"function"==typeof c&&(b=c.call(e,r,b)),typeof b){case"string":return A?b:f(b);case"number":return Number.isFinite(b)?String(b):"null";case"boolean":case"bigint":return String(b);case"object":if(!b)return"null";if(i+=s,g=[],"[object Array]"===Object.prototype.toString.apply(b)){for(l=b.length,n=0;n