ff-request-dist/dist/ff-request.umd.cjs

2 lines
12 KiB
JavaScript
Raw Normal View History

2024-05-25 22:42:00 +08:00
(function(p,w){typeof exports=="object"&&typeof module<"u"?w(exports):typeof define=="function"&&define.amd?define(["exports"],w):(p=typeof globalThis<"u"?globalThis:p||self,w(p["ff-request"]={}))})(this,function(p){"use strict";var ye=Object.defineProperty;var be=(p,w,A)=>w in p?ye(p,w,{enumerable:!0,configurable:!0,writable:!0,value:A}):p[w]=A;var _=(p,w,A)=>(be(p,typeof w!="symbol"?w+"":w,A),A),ue=(p,w,A)=>{if(!w.has(p))throw TypeError("Cannot "+A)};var h=(p,w,A)=>(ue(p,w,"read from private field"),A?A.call(p):w.get(p)),N=(p,w,A)=>{if(w.has(p))throw TypeError("Cannot add the same private member more than once");w instanceof WeakSet?w.add(p):w.set(p,A)},D=(p,w,A,Y)=>(ue(p,w,"write to private field"),Y?Y.call(p,A):w.set(p,A),A);var G,B,J,q,Q,W,L,X,Z,H,K,k,I,$;function w(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function A(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<t.length;i++){var u=t.charAt(i),y=u.charCodeAt(0);if(e[y]!==255)throw new TypeError(u+" is ambiguous");e[y]=i}var c=t.length,m=t.charAt(0),V=Math.log(c)/Math.log(256),z=Math.log(256)/Math.log(c);function F(a){if(a instanceof Uint8Array||(ArrayBuffer.isView(a)?a=new Uint8Array(a.buffer,a.byteOffset,a.byteLength):Array.isArray(a)&&(a=Uint8Array.from(a))),!(a instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(a.length===0)return"";for(var o=0,n=0,g=0,f=a.length;g!==f&&a[g]===0;)g++,o++;for(var l=(f-g)*z+1>>>0,d=new Uint8Array(l);g!==f;){for(var P=a[g],T=0,b=l-1;(P!==0||T<n)&&b!==-1;b--,T++)P+=256*d[b]>>>0,d[b]=P%c>>>0,P=P/c>>>0;if(P!==0)throw new Error("Non-zero carry");n=T,g++}for(var s=l-n;s!==l&&d[s]===0;)s++;for(var E=m.repeat(o);s<l;++s)E+=t.charAt(d[s]);return E}function M(a){if(typeof a!="string")throw new TypeError("Expected String");if(a.length===0)return new Uint8Array;for(var o=0,n=0,g=0;a[o]===m;)n++,o++;for(var f=(a.length-o)*V+1>>>0,l=new Uint8Array(f);a[o];){var d=e[a.charCodeAt(o)];if(d===255)return;for(var P=0,T=f-1;(d!==0||P<g)&&T!==-1;T--,P++)d+=c*l[T]>>>0,l[T]=d%256>>>0,d=d/256>>>0;if(d!==0)throw new Error("Non-zero carry");g=P,o++}for(var b=f-g;b!==f&&l[b]===0;)b++;for(var s=new Uint8Array(n+(f-b)),E=n;b!==f;)s[E++]=l[b++];return s}function v(a){var o=M(a);if(o)return o;throw new Error("Non-base"+c+" character")}return{encode:F,decodeUnsafe:M,decode:v}}var Y=A;const ce=w(Y);var ne={};(function(t){(function(e){e([],function(){var r=-1,i=-2,u=-3,y=-4,c=-5,m=function(o,n){n=n||{};var g=n.verbose||!1;g&&console.log("Normalize the JSON Object"),o=typeof o=="string"?this.JSON.parse(o):o,g&&console.log("Creating a empty dictionary");var f={strings:[],integers:[],floats:[]};g&&console.log("Creating the AST");var l=function b(s){g&&console.log("Calling recursiveAstBuilder with "+this.JSON.stringify(s));var E=typeof s;if(s===null)return{type:"null",index:u};if(typeof s>"u")return{type:"undefined",index:c};if(s instanceof Array){var U=["@"];for(var S in s)s.hasOwnProperty(S)&&U.push(b(s[S]));return U}if(E==="object"){var U=["$"];for(var j in s)s.hasOwnProperty(j)&&(U.push(b(j)),U.push(b(s[j])));return U}if(s==="")return{type:"empty",index:y};if(E==="string"){var C=a.call(f.strings,s);return C==-1&&(f.strings.push(z(s)),C=f.strings.length-1),{type:"strings",index:C}}if(E==="number"&&s%1===0){var C=a.call(f.integers,s);return C==-1&&(f.integers.push(M(s)),C=f.integers.length-1),{type:"integers",index:C}}if(E==="number"){var C=a.call(f.floats,s);return C==-1&&(f.floats.push(s),C=f.floats.length-1),{type:"floats",index:C}}if(E==="boolean")return{type:"boolean",index:s?r:i};throw new Error("Unexpected argument of type "+typeof s)}(o),d=f.strings.length,P=f.integers.length;f.floats.length,g&&console.log("Parsing the dictionary");var T=f.strings.join("|");return T+="^"+f.integers.join("|"),T+="^"+f.floats.join("|"),g&&console.log("Parsing the structure"),T+="^"+function b(s){if(g&&console.log("Calling a recursiveParser with "+this.JSON.stringify(s)),s instanceof Array){var E=s.shift();for(var U in s)s.hasOw