1 line
9.1 KiB
JavaScript
1 line
9.1 KiB
JavaScript
|
|
(function(){"use strict";var e={879:function(e,t){const{hasOwnProperty:n}=Object.prototype;const r=configure();r.configure=configure;r.stringify=r;r.default=r;t.stringify=r;t.configure=configure;e.exports=r;const i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function strEscape(e){if(e.length<5e3&&!i.test(e)){return`"${e}"`}return JSON.stringify(e)}function sort(e,t){if(e.length>200||t){return e.sort(t)}for(let t=1;t<e.length;t++){const n=e[t];let r=t;while(r!==0&&e[r-1]>n){e[r]=e[r-1];r--}e[r]=n}return e}const f=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function isTypedArrayWithEntries(e){return f.call(e)!==undefined&&e.length!==0}function stringifyTypedArray(e,t,n){if(e.length<n){n=e.length}const r=t===","?"":" ";let i=`"0":${r}${e[0]}`;for(let f=1;f<n;f++){i+=`${t}"${f}":${r}${e[f]}`}return i}function getCircularValueOption(e){if(n.call(e,"circularValue")){const t=e.circularValue;if(typeof t==="string"){return`"${t}"`}if(t==null){return t}if(t===Error||t===TypeError){return{toString(){throw new TypeError("Converting circular structure to JSON")}}}throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined')}return'"[Circular]"'}function getDeterministicOption(e){let t;if(n.call(e,"deterministic")){t=e.deterministic;if(typeof t!=="boolean"&&typeof t!=="function"){throw new TypeError('The "deterministic" argument must be of type boolean or comparator function')}}return t===undefined?true:t}function getBooleanOption(e,t){let r;if(n.call(e,t)){r=e[t];if(typeof r!=="boolean"){throw new TypeError(`The "${t}" argument must be of type boolean`)}}return r===undefined?true:r}function getPositiveIntegerOption(e,t){let r;if(n.call(e,t)){r=e[t];if(typeof r!=="number"){throw new TypeError(`The "${t}" argument must be of type number`)}if(!Number.isInteger(r)){throw new TypeError(`The "${t}" argument must be an integer`)}if(r<1){throw new RangeError(`The "${t}" argument must be >= 1`)}}return r===undefined?Infinity:r}function getItemCount(e){if(e===1){return"1 item"}return`${e} items`}function getUniqueReplacerSet(e){const t=new Set;for(const n of e){if(typeof n==="string"||typeof n==="number"){t.add(String(n))}}return t}function getStrictOption(e){if(n.call(e,"strict")){const t=e.strict;if(typeof t!=="boolean"){throw new TypeError('The "strict" argument must be of type boolean')}if(t){return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;if(typeof e!=="function")t+=` (${e.toString()})`;throw new Error(t)}}}}function configure(e){e={...e};const t=getStrictOption(e);if(t){if(e.bigint===undefined){e.bigint=false}if(!("circularValue"in e)){e.circularValue=Error}}const n=getCircularValueOption(e);const r=getBooleanOption(e,"bigint");const i=getDeterministicOption(e);const f=typeof i==="function"?i:undefined;const u=getPositiveIntegerOption(e,"maximumDepth");const o=getPositiveIntegerOption(e,"maximumBreadth");function stringifyFnReplacer(e,s,l,c,a,g){let p=s[e];if(typeof p==="object"&&p!==null&&typeof p.toJSON==="function"){p=p.toJSON(e)}p=c.call(s,e,p);switch(typeof p){case"string":return strEscape(p);case"object":{if(p===null){return"null"}if(l.indexOf(p)!==-1){return n}let e="";let t=",";const r=g;if(Array.isArray(p)){if(p.length===0){return"[]"}if(u<l.length+1){return'"[Array]"'}l.push(p);if(a!==""){g+=a;e+=`\n${g}`;t=`,\n${g}`}const n=Math.min(p.length,o);let i=0;for(;i<n-1;i++){const n=stringifyFnReplacer(String(i),p,l,c,a,g);e+=n!==undefined?n:"null";e+=t}const f=stringifyFnReplacer(String(i),p,l,c,a,g);e+=f!==undefined?f:"null";if(p.length-1>o){const n=p.length-o-1;e+=`${t}"... ${getItemCount(n)} not stringified"`}if(a!==""){e+=`\n${r}`}l.pop();return`[${e}]`}let s=Object.keys(p);const y=s.length;if(y===0){return"{}"}if(u<l.length+1){return'"[Object]"'}let d="";let h="";if(a!==""){g+=a;t=`,\n${g}`;d=" "}const $=Math.min(y,o);if(i&&!isTypedArrayWithEntries(p)){s=sort(s,f)}l.push(p);for(let n=0;n<$;n++){const r=s[n];const i=stringifyFnReplacer(r,p,l,c,a,g);if(i!==undefined){e+=`${h}${strE
|