var y={};y.stringify=function(a){var e=[];e.push({obj:a});for(var r="",n,s,p,u,l,f,t,h,o,d,v;n=e.pop();)if(s=n.obj,p=n.prefix||"",u=n.val||"",r+=p,u)r+=u;else if(typeof s!="object")r+=typeof s>"u"?null:JSON.stringify(s);else if(s===null)r+="null";else if(Array.isArray(s)){for(e.push({val:"]"}),l=s.length-1;l>=0;l--)f=l===0?"":",",e.push({obj:s[l],prefix:f});e.push({val:"["})}else{t=[];for(h in s)s.hasOwnProperty(h)&&t.push(h);for(e.push({val:"}"}),l=t.length-1;l>=0;l--)o=t[l],d=s[o],v=l>0?",":"",v+=JSON.stringify(o)+":",e.push({obj:d,prefix:v});e.push({val:"{"})}return r};function c(i,a,e){var r=e[e.length-1];i===r.element&&(e.pop(),r=e[e.length-1]);var n=r.element,s=r.index;if(Array.isArray(n))n.push(i);else if(s===a.length-2){var p=a.pop();n[p]=i}else a.push(i)}y.parse=function(i){for(var a=[],e=[],r=0,n,s,p,u,l,f,t,h,o;;){if(n=i[r++],n==="}"||n==="]"||typeof n>"u"){if(a.length===1)return a.pop();c(a.pop(),a,e);continue}switch(n){case" ":case"	":case`
`:case":":case",":break;case"n":r+=3,c(null,a,e);break;case"t":r+=3,c(!0,a,e);break;case"f":r+=4,c(!1,a,e);break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":for(s="",r--;;)if(p=i[r++],/[\d\.\-e\+]/.test(p))s+=p;else{r--;break}c(parseFloat(s),a,e);break;case'"':for(u="",l=void 0,f=0;t=i[r++],t!=='"'||l==="\\"&&f%2===1;)u+=t,l=t,l==="\\"?f++:f=0;c(JSON.parse('"'+u+'"'),a,e);break;case"[":h={element:[],index:a.length},a.push(h.element),e.push(h);break;case"{":o={element:{},index:a.length},a.push(o.element),e.push(o);break;default:throw new Error("unexpectedly reached end of input: "+n)}}};export{y as v};
