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

2 lines
12 KiB
JavaScript
Raw Normal View History

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