lesca-node-bunnycdn 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.cjs CHANGED
@@ -19,4 +19,4 @@ https://github.com/browserify/crypto-browserify`)},cryptoBrowserify.constants={D
19
19
  `+oe.prev+oe.base;return Oe+ie.call(re,","+Oe)+`
20
20
  `+oe.prev}function pe(re,oe){var Oe=A(re),ce=[];if(Oe){ce.length=re.length;for(var we=0;we<re.length;we++)ce[we]=Pe(re,we)?oe(re[we],re):""}var Ce=typeof e=="function"?e(re):[],qe;if(n){qe={};for(var Te=0;Te<Ce.length;Te++)qe["$"+Ce[Te]]=Ce[Te]}for(var je in re)Pe(re,je)&&(Oe&&String(Number(je))===je&&je<re.length||n&&qe["$"+je]instanceof Symbol||(X.call(/[^\w$]/,je)?ce.push(oe(je,re)+": "+oe(re[je],re)):ce.push(je+": "+oe(re[je],re))));if(typeof e=="function")for(var Be=0;Be<Ce.length;Be++)s.call(re,Ce[Be])&&ce.push("["+oe(Ce[Be])+"]: "+oe(re[Ce[Be]],re));return ce}return objectInspect}var sideChannelList,hasRequiredSideChannelList;function requireSideChannelList(){if(hasRequiredSideChannelList)return sideChannelList;hasRequiredSideChannelList=1;var g=requireObjectInspect(),_=requireType(),S=function(v,y,m){for(var d=v,b;(b=d.next)!=null;d=b)if(b.key===y)return d.next=b.next,m||(b.next=v.next,v.next=b),b},p=function(v,y){if(v){var m=S(v,y);return m&&m.value}},E=function(v,y,m){var d=S(v,y);d?d.value=m:v.next={key:y,next:v.next,value:m}},a=function(v,y){return v?!!S(v,y):!1},w=function(v,y){if(v)return S(v,y,!0)};return sideChannelList=function(){var y,m={assert:function(d){if(!m.has(d))throw new _("Side channel does not contain "+g(d))},delete:function(d){var b=y&&y.next,x=w(y,d);return x&&b&&b===x&&(y=void 0),!!x},get:function(d){return p(y,d)},has:function(d){return a(y,d)},set:function(d,b){y||(y={next:void 0}),E(y,d,b)}};return m},sideChannelList}var sideChannelMap,hasRequiredSideChannelMap;function requireSideChannelMap(){if(hasRequiredSideChannelMap)return sideChannelMap;hasRequiredSideChannelMap=1;var g=requireGetIntrinsic(),_=requireCallBound(),S=requireObjectInspect(),p=requireType(),E=g("%Map%",!0),a=_("Map.prototype.get",!0),w=_("Map.prototype.set",!0),v=_("Map.prototype.has",!0),y=_("Map.prototype.delete",!0),m=_("Map.prototype.size",!0);return sideChannelMap=!!E&&function(){var b,x={assert:function(R){if(!x.has(R))throw new p("Side channel does not contain "+S(R))},delete:function(R){if(b){var q=y(b,R);return m(b)===0&&(b=void 0),q}return!1},get:function(R){if(b)return a(b,R)},has:function(R){return b?v(b,R):!1},set:function(R,q){b||(b=new E),w(b,R,q)}};return x},sideChannelMap}var sideChannelWeakmap,hasRequiredSideChannelWeakmap;function requireSideChannelWeakmap(){if(hasRequiredSideChannelWeakmap)return sideChannelWeakmap;hasRequiredSideChannelWeakmap=1;var g=requireGetIntrinsic(),_=requireCallBound(),S=requireObjectInspect(),p=requireSideChannelMap(),E=requireType(),a=g("%WeakMap%",!0),w=_("WeakMap.prototype.get",!0),v=_("WeakMap.prototype.set",!0),y=_("WeakMap.prototype.has",!0),m=_("WeakMap.prototype.delete",!0);return sideChannelWeakmap=a?function(){var b,x,R={assert:function(q){if(!R.has(q))throw new E("Side channel does not contain "+S(q))},delete:function(q){if(a&&q&&(typeof q=="object"||typeof q=="function")){if(b)return m(b,q)}else if(p&&x)return x.delete(q);return!1},get:function(q){return a&&q&&(typeof q=="object"||typeof q=="function")&&b?w(b,q):x&&x.get(q)},has:function(q){return a&&q&&(typeof q=="object"||typeof q=="function")&&b?y(b,q):!!x&&x.has(q)},set:function(q,B){a&&q&&(typeof q=="object"||typeof q=="function")?(b||(b=new a),v(b,q,B)):p&&(x||(x=p()),x.set(q,B))}};return R}:p,sideChannelWeakmap}var sideChannel,hasRequiredSideChannel;function requireSideChannel(){if(hasRequiredSideChannel)return sideChannel;hasRequiredSideChannel=1;var g=requireType(),_=requireObjectInspect(),S=requireSideChannelList(),p=requireSideChannelMap(),E=requireSideChannelWeakmap(),a=E||p||S;return sideChannel=function(){var v,y={assert:function(m){if(!y.has(m))throw new g("Side channel does not contain "+_(m))},delete:function(m){return!!v&&v.delete(m)},get:function(m){return v&&v.get(m)},has:function(m){return!!v&&v.has(m)},set:function(m,d){v||(v=a()),v.set(m,d)}};return y},sideChannel}var formats,hasRequiredFormats;function requireFormats(){if(hasRequiredFormats)return formats;hasRequiredFormats=1;var g=String.prototype.replace,_=/%20/g,S={RFC1738:"RFC1738",RFC3986:"RFC3986"};return formats={default:S.RFC3986,formatters:{RFC1738:function(p){return g.call(p,_,"+")},RFC3986:function(p){return String(p)}},RFC1738:S.RFC1738,RFC3986:S.RFC3986},formats}var utils,hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1;var g=requireFormats(),_=requireSideChannel(),S=Object.prototype.hasOwnProperty,p=Array.isArray,E=_(),a=function(te,ie){return E.set(te,ie),te},w=function(te){return E.has(te)},v=function(te){return E.get(te)},y=function(te,ie){E.set(te,ie)},m=(function(){for(var X=[],te=0;te<256;++te)X.push("%"+((te<16?"0":"")+te.toString(16)).toUpperCase());return X})(),d=function(te){for(;te.length>1;){var ie=te.pop(),ee=ie.obj[ie.prop];if(p(ee)){for(var ue=[],c=0;c<ee.length;++c)typeof ee[c]<"u"&&ue.push(ee[c]);ie.obj[ie.prop]=ue}}},b=function(te,ie){for(var ee=ie&&ie.plainObjects?{__proto__:null}:{},ue=0;ue<te.length;++ue)typeof te[ue]<"u"&&(ee[ue]=te[ue]);return ee},x=function X(te,ie,ee){if(!ie)return te;if(typeof ie!="object"&&typeof ie!="function"){if(p(te))te.push(ie);else if(te&&typeof te=="object")if(w(te)){var ue=v(te)+1;te[ue]=ie,y(te,ue)}else(ee&&(ee.plainObjects||ee.allowPrototypes)||!S.call(Object.prototype,ie))&&(te[ie]=!0);else return[te,ie];return te}if(!te||typeof te!="object"){if(w(ie)){for(var c=Object.keys(ie),e=ee&&ee.plainObjects?{__proto__:null,0:te}:{0:te},t=0;t<c.length;t++){var n=parseInt(c[t],10);e[n+1]=ie[c[t]]}return a(e,v(ie)+1)}return[te].concat(ie)}var f=te;return p(te)&&!p(ie)&&(f=b(te,ee)),p(te)&&p(ie)?(ie.forEach(function(s,u){if(S.call(te,u)){var l=te[u];l&&typeof l=="object"&&s&&typeof s=="object"?te[u]=X(l,s,ee):te.push(s)}else te[u]=s}),te):Object.keys(ie).reduce(function(s,u){var l=ie[u];return S.call(s,u)?s[u]=X(s[u],l,ee):s[u]=l,s},f)},R=function(te,ie){return Object.keys(ie).reduce(function(ee,ue){return ee[ue]=ie[ue],ee},te)},q=function(X,te,ie){var ee=X.replace(/\+/g," ");if(ie==="iso-8859-1")return ee.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(ee)}catch{return ee}},B=1024,$=function(te,ie,ee,ue,c){if(te.length===0)return te;var e=te;if(typeof te=="symbol"?e=Symbol.prototype.toString.call(te):typeof te!="string"&&(e=String(te)),ee==="iso-8859-1")return escape(e).replace(/%u[0-9a-f]{4}/gi,function(o){return"%26%23"+parseInt(o.slice(2),16)+"%3B"});for(var t="",n=0;n<e.length;n+=B){for(var f=e.length>=B?e.slice(n,n+B):e,s=[],u=0;u<f.length;++u){var l=f.charCodeAt(u);if(l===45||l===46||l===95||l===126||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||c===g.RFC1738&&(l===40||l===41)){s[s.length]=f.charAt(u);continue}if(l<128){s[s.length]=m[l];continue}if(l<2048){s[s.length]=m[192|l>>6]+m[128|l&63];continue}if(l<55296||l>=57344){s[s.length]=m[224|l>>12]+m[128|l>>6&63]+m[128|l&63];continue}u+=1,l=65536+((l&1023)<<10|f.charCodeAt(u)&1023),s[s.length]=m[240|l>>18]+m[128|l>>12&63]+m[128|l>>6&63]+m[128|l&63]}t+=s.join("")}return t},k=function(te){for(var ie=[{obj:{o:te},prop:"o"}],ee=[],ue=0;ue<ie.length;++ue)for(var c=ie[ue],e=c.obj[c.prop],t=Object.keys(e),n=0;n<t.length;++n){var f=t[n],s=e[f];typeof s=="object"&&s!==null&&ee.indexOf(s)===-1&&(ie.push({obj:e,prop:f}),ee.push(s))}return d(ie),te},I=function(te){return Object.prototype.toString.call(te)==="[object RegExp]"},L=function(te){return!te||typeof te!="object"?!1:!!(te.constructor&&te.constructor.isBuffer&&te.constructor.isBuffer(te))},D=function(te,ie,ee,ue){if(w(te)){var c=v(te)+1;return te[c]=ie,y(te,c),te}var e=[].concat(te,ie);return e.length>ee?a(b(e,{plainObjects:ue}),e.length-1):e},G=function(te,ie){if(p(te)){for(var ee=[],ue=0;ue<te.length;ue+=1)ee.push(ie(te[ue]));return ee}return ie(te)};return utils={arrayToObject:b,assign:R,combine:D,compact:k,decode:q,encode:$,isBuffer:L,isOverflow:w,isRegExp:I,maybeMap:G,merge:x},utils}var stringify_1,hasRequiredStringify;function requireStringify(){if(hasRequiredStringify)return stringify_1;hasRequiredStringify=1;var g=requireSideChannel(),_=requireUtils(),S=requireFormats(),p=Object.prototype.hasOwnProperty,E={brackets:function($){return $+"[]"},comma:"comma",indices:function($,k){return $+"["+k+"]"},repeat:function($){return $}},a=Array.isArray,w=Array.prototype.push,v=function(B,$){w.apply(B,a($)?$:[$])},y=Date.prototype.toISOString,m=S.default,d={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:"indices",charset:"utf-8",charsetSentinel:!1,commaRoundTrip:!1,delimiter:"&",encode:!0,encodeDotInKeys:!1,encoder:_.encode,encodeValuesOnly:!1,filter:void 0,format:m,formatter:S.formatters[m],indices:!1,serializeDate:function($){return y.call($)},skipNulls:!1,strictNullHandling:!1},b=function($){return typeof $=="string"||typeof $=="number"||typeof $=="boolean"||typeof $=="symbol"||typeof $=="bigint"},x={},R=function B($,k,I,L,D,G,X,te,ie,ee,ue,c,e,t,n,f,s,u){for(var l=$,o=u,r=0,h=!1;(o=o.get(x))!==void 0&&!h;){var M=o.get($);if(r+=1,typeof M<"u"){if(M===r)throw new RangeError("Cyclic object value");h=!0}typeof o.get(x)>"u"&&(r=0)}if(typeof ee=="function"?l=ee(k,l):l instanceof Date?l=e(l):I==="comma"&&a(l)&&(l=_.maybeMap(l,function(le){return le instanceof Date?e(le):le})),l===null){if(G)return ie&&!f?ie(k,d.encoder,s,"key",t):k;l=""}if(b(l)||_.isBuffer(l)){if(ie){var T=f?k:ie(k,d.encoder,s,"key",t);return[n(T)+"="+n(ie(l,d.encoder,s,"value",t))]}return[n(k)+"="+n(String(l))]}var N=[];if(typeof l>"u")return N;var Q;if(I==="comma"&&a(l))f&&ie&&(l=_.maybeMap(l,ie)),Q=[{value:l.length>0?l.join(",")||null:void 0}];else if(a(ee))Q=ee;else{var K=Object.keys(l);Q=ue?K.sort(ue):K}var A=te?String(k).replace(/\./g,"%2E"):String(k),O=L&&a(l)&&l.length===1?A+"[]":A;if(D&&a(l)&&l.length===0)return O+"[]";for(var W=0;W<Q.length;++W){var J=Q[W],Z=typeof J=="object"&&J&&typeof J.value<"u"?J.value:l[J];if(!(X&&Z===null)){var j=c&&te?String(J).replace(/\./g,"%2E"):String(J),ne=a(l)?typeof I=="function"?I(O,j):O:O+(c?"."+j:"["+j+"]");u.set($,r);var Re=g();Re.set(x,u),v(N,B(Z,ne,I,L,D,G,X,te,I==="comma"&&f&&a(l)?null:ie,ee,ue,c,e,t,n,f,s,Re))}}return N},q=function($){if(!$)return d;if(typeof $.allowEmptyArrays<"u"&&typeof $.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof $.encodeDotInKeys<"u"&&typeof $.encodeDotInKeys!="boolean")throw new TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if($.encoder!==null&&typeof $.encoder<"u"&&typeof $.encoder!="function")throw new TypeError("Encoder has to be a function.");var k=$.charset||d.charset;if(typeof $.charset<"u"&&$.charset!=="utf-8"&&$.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var I=S.default;if(typeof $.format<"u"){if(!p.call(S.formatters,$.format))throw new TypeError("Unknown format option provided.");I=$.format}var L=S.formatters[I],D=d.filter;(typeof $.filter=="function"||a($.filter))&&(D=$.filter);var G;if($.arrayFormat in E?G=$.arrayFormat:"indices"in $?G=$.indices?"indices":"repeat":G=d.arrayFormat,"commaRoundTrip"in $&&typeof $.commaRoundTrip!="boolean")throw new TypeError("`commaRoundTrip` must be a boolean, or absent");var X=typeof $.allowDots>"u"?$.encodeDotInKeys===!0?!0:d.allowDots:!!$.allowDots;return{addQueryPrefix:typeof $.addQueryPrefix=="boolean"?$.addQueryPrefix:d.addQueryPrefix,allowDots:X,allowEmptyArrays:typeof $.allowEmptyArrays=="boolean"?!!$.allowEmptyArrays:d.allowEmptyArrays,arrayFormat:G,charset:k,charsetSentinel:typeof $.charsetSentinel=="boolean"?$.charsetSentinel:d.charsetSentinel,commaRoundTrip:!!$.commaRoundTrip,delimiter:typeof $.delimiter>"u"?d.delimiter:$.delimiter,encode:typeof $.encode=="boolean"?$.encode:d.encode,encodeDotInKeys:typeof $.encodeDotInKeys=="boolean"?$.encodeDotInKeys:d.encodeDotInKeys,encoder:typeof $.encoder=="function"?$.encoder:d.encoder,encodeValuesOnly:typeof $.encodeValuesOnly=="boolean"?$.encodeValuesOnly:d.encodeValuesOnly,filter:D,format:I,formatter:L,serializeDate:typeof $.serializeDate=="function"?$.serializeDate:d.serializeDate,skipNulls:typeof $.skipNulls=="boolean"?$.skipNulls:d.skipNulls,sort:typeof $.sort=="function"?$.sort:null,strictNullHandling:typeof $.strictNullHandling=="boolean"?$.strictNullHandling:d.strictNullHandling}};return stringify_1=function(B,$){var k=B,I=q($),L,D;typeof I.filter=="function"?(D=I.filter,k=D("",k)):a(I.filter)&&(D=I.filter,L=D);var G=[];if(typeof k!="object"||k===null)return"";var X=E[I.arrayFormat],te=X==="comma"&&I.commaRoundTrip;L||(L=Object.keys(k)),I.sort&&L.sort(I.sort);for(var ie=g(),ee=0;ee<L.length;++ee){var ue=L[ee],c=k[ue];I.skipNulls&&c===null||v(G,R(c,ue,X,te,I.allowEmptyArrays,I.strictNullHandling,I.skipNulls,I.encodeDotInKeys,I.encode?I.encoder:null,I.filter,I.sort,I.allowDots,I.serializeDate,I.format,I.formatter,I.encodeValuesOnly,I.charset,ie))}var e=G.join(I.delimiter),t=I.addQueryPrefix===!0?"?":"";return I.charsetSentinel&&(I.charset==="iso-8859-1"?t+="utf8=%26%2310003%3B&":t+="utf8=%E2%9C%93&"),e.length>0?t+e:""},stringify_1}var parse$1,hasRequiredParse;function requireParse(){if(hasRequiredParse)return parse$1;hasRequiredParse=1;var g=requireUtils(),_=Object.prototype.hasOwnProperty,S=Array.isArray,p={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:g.decode,delimiter:"&",depth:5,duplicates:"combine",ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictNullHandling:!1,throwOnLimitExceeded:!1},E=function(R){return R.replace(/&#(\d+);/g,function(q,B){return String.fromCharCode(parseInt(B,10))})},a=function(R,q,B){if(R&&typeof R=="string"&&q.comma&&R.indexOf(",")>-1)return R.split(",");if(q.throwOnLimitExceeded&&B>=q.arrayLimit)throw new RangeError("Array limit exceeded. Only "+q.arrayLimit+" element"+(q.arrayLimit===1?"":"s")+" allowed in an array.");return R},w="utf8=%26%2310003%3B",v="utf8=%E2%9C%93",y=function(q,B){var $={__proto__:null},k=B.ignoreQueryPrefix?q.replace(/^\?/,""):q;k=k.replace(/%5B/gi,"[").replace(/%5D/gi,"]");var I=B.parameterLimit===1/0?void 0:B.parameterLimit,L=k.split(B.delimiter,B.throwOnLimitExceeded?I+1:I);if(B.throwOnLimitExceeded&&L.length>I)throw new RangeError("Parameter limit exceeded. Only "+I+" parameter"+(I===1?"":"s")+" allowed.");var D=-1,G,X=B.charset;if(B.charsetSentinel)for(G=0;G<L.length;++G)L[G].indexOf("utf8=")===0&&(L[G]===v?X="utf-8":L[G]===w&&(X="iso-8859-1"),D=G,G=L.length);for(G=0;G<L.length;++G)if(G!==D){var te=L[G],ie=te.indexOf("]="),ee=ie===-1?te.indexOf("="):ie+1,ue,c;if(ee===-1?(ue=B.decoder(te,p.decoder,X,"key"),c=B.strictNullHandling?null:""):(ue=B.decoder(te.slice(0,ee),p.decoder,X,"key"),ue!==null&&(c=g.maybeMap(a(te.slice(ee+1),B,S($[ue])?$[ue].length:0),function(t){return B.decoder(t,p.decoder,X,"value")}))),c&&B.interpretNumericEntities&&X==="iso-8859-1"&&(c=E(String(c))),te.indexOf("[]=")>-1&&(c=S(c)?[c]:c),ue!==null){var e=_.call($,ue);e&&B.duplicates==="combine"?$[ue]=g.combine($[ue],c,B.arrayLimit,B.plainObjects):(!e||B.duplicates==="last")&&($[ue]=c)}}return $},m=function(R,q,B,$){var k=0;if(R.length>0&&R[R.length-1]==="[]"){var I=R.slice(0,-1).join("");k=Array.isArray(q)&&q[I]?q[I].length:0}for(var L=$?q:a(q,B,k),D=R.length-1;D>=0;--D){var G,X=R[D];if(X==="[]"&&B.parseArrays)g.isOverflow(L)?G=L:G=B.allowEmptyArrays&&(L===""||B.strictNullHandling&&L===null)?[]:g.combine([],L,B.arrayLimit,B.plainObjects);else{G=B.plainObjects?{__proto__:null}:{};var te=X.charAt(0)==="["&&X.charAt(X.length-1)==="]"?X.slice(1,-1):X,ie=B.decodeDotInKeys?te.replace(/%2E/g,"."):te,ee=parseInt(ie,10);!B.parseArrays&&ie===""?G={0:L}:!isNaN(ee)&&X!==ie&&String(ee)===ie&&ee>=0&&B.parseArrays&&ee<=B.arrayLimit?(G=[],G[ee]=L):ie!=="__proto__"&&(G[ie]=L)}L=G}return L},d=function(q,B){var $=B.allowDots?q.replace(/\.([^.[]+)/g,"[$1]"):q;if(B.depth<=0)return!B.plainObjects&&_.call(Object.prototype,$)&&!B.allowPrototypes?void 0:[$];var k=/(\[[^[\]]*])/,I=/(\[[^[\]]*])/g,L=k.exec($),D=L?$.slice(0,L.index):$,G=[];if(D){if(!B.plainObjects&&_.call(Object.prototype,D)&&!B.allowPrototypes)return;G.push(D)}for(var X=0;(L=I.exec($))!==null&&X<B.depth;){X+=1;var te=L[1].slice(1,-1);if(!B.plainObjects&&_.call(Object.prototype,te)&&!B.allowPrototypes)return;G.push(L[1])}if(L){if(B.strictDepth===!0)throw new RangeError("Input depth exceeded depth option of "+B.depth+" and strictDepth is true");G.push("["+$.slice(L.index)+"]")}return G},b=function(q,B,$,k){if(q){var I=d(q,$);if(I)return m(I,B,$,k)}},x=function(q){if(!q)return p;if(typeof q.allowEmptyArrays<"u"&&typeof q.allowEmptyArrays!="boolean")throw new TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(typeof q.decodeDotInKeys<"u"&&typeof q.decodeDotInKeys!="boolean")throw new TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(q.decoder!==null&&typeof q.decoder<"u"&&typeof q.decoder!="function")throw new TypeError("Decoder has to be a function.");if(typeof q.charset<"u"&&q.charset!=="utf-8"&&q.charset!=="iso-8859-1")throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");if(typeof q.throwOnLimitExceeded<"u"&&typeof q.throwOnLimitExceeded!="boolean")throw new TypeError("`throwOnLimitExceeded` option must be a boolean");var B=typeof q.charset>"u"?p.charset:q.charset,$=typeof q.duplicates>"u"?p.duplicates:q.duplicates;if($!=="combine"&&$!=="first"&&$!=="last")throw new TypeError("The duplicates option must be either combine, first, or last");var k=typeof q.allowDots>"u"?q.decodeDotInKeys===!0?!0:p.allowDots:!!q.allowDots;return{allowDots:k,allowEmptyArrays:typeof q.allowEmptyArrays=="boolean"?!!q.allowEmptyArrays:p.allowEmptyArrays,allowPrototypes:typeof q.allowPrototypes=="boolean"?q.allowPrototypes:p.allowPrototypes,allowSparse:typeof q.allowSparse=="boolean"?q.allowSparse:p.allowSparse,arrayLimit:typeof q.arrayLimit=="number"?q.arrayLimit:p.arrayLimit,charset:B,charsetSentinel:typeof q.charsetSentinel=="boolean"?q.charsetSentinel:p.charsetSentinel,comma:typeof q.comma=="boolean"?q.comma:p.comma,decodeDotInKeys:typeof q.decodeDotInKeys=="boolean"?q.decodeDotInKeys:p.decodeDotInKeys,decoder:typeof q.decoder=="function"?q.decoder:p.decoder,delimiter:typeof q.delimiter=="string"||g.isRegExp(q.delimiter)?q.delimiter:p.delimiter,depth:typeof q.depth=="number"||q.depth===!1?+q.depth:p.depth,duplicates:$,ignoreQueryPrefix:q.ignoreQueryPrefix===!0,interpretNumericEntities:typeof q.interpretNumericEntities=="boolean"?q.interpretNumericEntities:p.interpretNumericEntities,parameterLimit:typeof q.parameterLimit=="number"?q.parameterLimit:p.parameterLimit,parseArrays:q.parseArrays!==!1,plainObjects:typeof q.plainObjects=="boolean"?q.plainObjects:p.plainObjects,strictDepth:typeof q.strictDepth=="boolean"?!!q.strictDepth:p.strictDepth,strictNullHandling:typeof q.strictNullHandling=="boolean"?q.strictNullHandling:p.strictNullHandling,throwOnLimitExceeded:typeof q.throwOnLimitExceeded=="boolean"?q.throwOnLimitExceeded:!1}};return parse$1=function(R,q){var B=x(q);if(R===""||R===null||typeof R>"u")return B.plainObjects?{__proto__:null}:{};for(var $=typeof R=="string"?y(R,B):R,k=B.plainObjects?{__proto__:null}:{},I=Object.keys($),L=0;L<I.length;++L){var D=I[L],G=b(D,$[D],B,typeof R=="string");k=g.merge(k,G,B)}return B.allowSparse===!0?k:g.compact(k)},parse$1}var lib,hasRequiredLib;function requireLib(){if(hasRequiredLib)return lib;hasRequiredLib=1;var g=requireStringify(),_=requireParse(),S=requireFormats();return lib={formats:S,parse:_,stringify:g},lib}var libExports=requireLib();const require$$1$1=getDefaultExportFromCjs$1(libExports);var punycode=require$$0$1;function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,delims=["<",">",'"',"`"," ","\r",`
21
21
  `," "],unwise=["{","}","|","\\","^","`"].concat(delims),autoEscape=["'"].concat(unwise),nonHostChars=["%","/","?",";","#"].concat(autoEscape),hostEndingChars=["/","?","#"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,"javascript:":!0},hostlessProtocol={javascript:!0,"javascript:":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},querystring=require$$1$1;function urlParse(g,_,S){if(g&&typeof g=="object"&&g instanceof Url)return g;var p=new Url;return p.parse(g,_,S),p}Url.prototype.parse=function(g,_,S){if(typeof g!="string")throw new TypeError("Parameter 'url' must be a string, not "+typeof g);var p=g.indexOf("?"),E=p!==-1&&p<g.indexOf("#")?"?":"#",a=g.split(E),w=/\\/g;a[0]=a[0].replace(w,"/"),g=a.join(E);var v=g;if(v=v.trim(),!S&&g.split("#").length===1){var y=simplePathPattern.exec(v);if(y)return this.path=v,this.href=v,this.pathname=y[1],y[2]?(this.search=y[2],_?this.query=querystring.parse(this.search.substr(1)):this.query=this.search.substr(1)):_&&(this.search="",this.query={}),this}var m=protocolPattern.exec(v);if(m){m=m[0];var d=m.toLowerCase();this.protocol=d,v=v.substr(m.length)}if(S||m||v.match(/^\/\/[^@/]+@[^@/]+/)){var b=v.substr(0,2)==="//";b&&!(m&&hostlessProtocol[m])&&(v=v.substr(2),this.slashes=!0)}if(!hostlessProtocol[m]&&(b||m&&!slashedProtocol[m])){for(var x=-1,R=0;R<hostEndingChars.length;R++){var q=v.indexOf(hostEndingChars[R]);q!==-1&&(x===-1||q<x)&&(x=q)}var B,$;x===-1?$=v.lastIndexOf("@"):$=v.lastIndexOf("@",x),$!==-1&&(B=v.slice(0,$),v=v.slice($+1),this.auth=decodeURIComponent(B)),x=-1;for(var R=0;R<nonHostChars.length;R++){var q=v.indexOf(nonHostChars[R]);q!==-1&&(x===-1||q<x)&&(x=q)}x===-1&&(x=v.length),this.host=v.slice(0,x),v=v.slice(x),this.parseHost(),this.hostname=this.hostname||"";var k=this.hostname[0]==="["&&this.hostname[this.hostname.length-1]==="]";if(!k)for(var I=this.hostname.split(/\./),R=0,L=I.length;R<L;R++){var D=I[R];if(D&&!D.match(hostnamePartPattern)){for(var G="",X=0,te=D.length;X<te;X++)D.charCodeAt(X)>127?G+="x":G+=D[X];if(!G.match(hostnamePartPattern)){var ie=I.slice(0,R),ee=I.slice(R+1),ue=D.match(hostnamePartStart);ue&&(ie.push(ue[1]),ee.unshift(ue[2])),ee.length&&(v="/"+ee.join(".")+v),this.hostname=ie.join(".");break}}}this.hostname.length>hostnameMaxLen?this.hostname="":this.hostname=this.hostname.toLowerCase(),k||(this.hostname=punycode.toASCII(this.hostname));var c=this.port?":"+this.port:"",e=this.hostname||"";this.host=e+c,this.href+=this.host,k&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),v[0]!=="/"&&(v="/"+v))}if(!unsafeProtocol[d])for(var R=0,L=autoEscape.length;R<L;R++){var t=autoEscape[R];if(v.indexOf(t)!==-1){var n=encodeURIComponent(t);n===t&&(n=escape(t)),v=v.split(t).join(n)}}var f=v.indexOf("#");f!==-1&&(this.hash=v.substr(f),v=v.slice(0,f));var s=v.indexOf("?");if(s!==-1?(this.search=v.substr(s),this.query=v.substr(s+1),_&&(this.query=querystring.parse(this.query)),v=v.slice(0,s)):_&&(this.search="",this.query={}),v&&(this.pathname=v),slashedProtocol[d]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var c=this.pathname||"",u=this.search||"";this.path=c+u}return this.href=this.format(),this};function urlFormat(g){return typeof g=="string"&&(g=urlParse(g)),g instanceof Url?g.format():Url.prototype.format.call(g)}Url.prototype.format=function(){var g=this.auth||"";g&&(g=encodeURIComponent(g),g=g.replace(/%3A/i,":"),g+="@");var _=this.protocol||"",S=this.pathname||"",p=this.hash||"",E=!1,a="";this.host?E=g+this.host:this.hostname&&(E=g+(this.hostname.indexOf(":")===-1?this.hostname:"["+this.hostname+"]"),this.port&&(E+=":"+this.port)),this.query&&typeof this.query=="object"&&Object.keys(this.query).length&&(a=querystring.stringify(this.query,{arrayFormat:"repeat",addQueryPrefix:!1}));var w=this.search||a&&"?"+a||"";return _&&_.substr(-1)!==":"&&(_+=":"),this.slashes||(!_||slashedProtocol[_])&&E!==!1?(E="//"+(E||""),S&&S.charAt(0)!=="/"&&(S="/"+S)):E||(E=""),p&&p.charAt(0)!=="#"&&(p="#"+p),w&&w.charAt(0)!=="?"&&(w="?"+w),S=S.replace(/[?#]/g,function(v){return encodeURIComponent(v)}),w=w.replace("#","%23"),_+E+S+w+p};function urlResolve(g,_){return urlParse(g,!1,!0).resolve(_)}Url.prototype.resolve=function(g){return this.resolveObject(urlParse(g,!1,!0)).format()};function urlResolveObject(g,_){return g?urlParse(g,!1,!0).resolveObject(_):_}Url.prototype.resolveObject=function(g){if(typeof g=="string"){var _=new Url;_.parse(g,!1,!0),g=_}for(var S=new Url,p=Object.keys(this),E=0;E<p.length;E++){var a=p[E];S[a]=this[a]}if(S.hash=g.hash,g.href==="")return S.href=S.format(),S;if(g.slashes&&!g.protocol){for(var w=Object.keys(g),v=0;v<w.length;v++){var y=w[v];y!=="protocol"&&(S[y]=g[y])}return slashedProtocol[S.protocol]&&S.hostname&&!S.pathname&&(S.pathname="/",S.path=S.pathname),S.href=S.format(),S}if(g.protocol&&g.protocol!==S.protocol){if(!slashedProtocol[g.protocol]){for(var m=Object.keys(g),d=0;d<m.length;d++){var b=m[d];S[b]=g[b]}return S.href=S.format(),S}if(S.protocol=g.protocol,!g.host&&!hostlessProtocol[g.protocol]){for(var L=(g.pathname||"").split("/");L.length&&!(g.host=L.shift()););g.host||(g.host=""),g.hostname||(g.hostname=""),L[0]!==""&&L.unshift(""),L.length<2&&L.unshift(""),S.pathname=L.join("/")}else S.pathname=g.pathname;if(S.search=g.search,S.query=g.query,S.host=g.host||"",S.auth=g.auth,S.hostname=g.hostname||g.host,S.port=g.port,S.pathname||S.search){var x=S.pathname||"",R=S.search||"";S.path=x+R}return S.slashes=S.slashes||g.slashes,S.href=S.format(),S}var q=S.pathname&&S.pathname.charAt(0)==="/",B=g.host||g.pathname&&g.pathname.charAt(0)==="/",$=B||q||S.host&&g.pathname,k=$,I=S.pathname&&S.pathname.split("/")||[],L=g.pathname&&g.pathname.split("/")||[],D=S.protocol&&!slashedProtocol[S.protocol];if(D&&(S.hostname="",S.port=null,S.host&&(I[0]===""?I[0]=S.host:I.unshift(S.host)),S.host="",g.protocol&&(g.hostname=null,g.port=null,g.host&&(L[0]===""?L[0]=g.host:L.unshift(g.host)),g.host=null),$=$&&(L[0]===""||I[0]==="")),B)S.host=g.host||g.host===""?g.host:S.host,S.hostname=g.hostname||g.hostname===""?g.hostname:S.hostname,S.search=g.search,S.query=g.query,I=L;else if(L.length)I||(I=[]),I.pop(),I=I.concat(L),S.search=g.search,S.query=g.query;else if(g.search!=null){if(D){S.host=I.shift(),S.hostname=S.host;var G=S.host&&S.host.indexOf("@")>0?S.host.split("@"):!1;G&&(S.auth=G.shift(),S.hostname=G.shift(),S.host=S.hostname)}return S.search=g.search,S.query=g.query,(S.pathname!==null||S.search!==null)&&(S.path=(S.pathname?S.pathname:"")+(S.search?S.search:"")),S.href=S.format(),S}if(!I.length)return S.pathname=null,S.search?S.path="/"+S.search:S.path=null,S.href=S.format(),S;for(var X=I.slice(-1)[0],te=(S.host||g.host||I.length>1)&&(X==="."||X==="..")||X==="",ie=0,ee=I.length;ee>=0;ee--)X=I[ee],X==="."?I.splice(ee,1):X===".."?(I.splice(ee,1),ie++):ie&&(I.splice(ee,1),ie--);if(!$&&!k)for(;ie--;ie)I.unshift("..");$&&I[0]!==""&&(!I[0]||I[0].charAt(0)!=="/")&&I.unshift(""),te&&I.join("/").substr(-1)!=="/"&&I.push("");var ue=I[0]===""||I[0]&&I[0].charAt(0)==="/";if(D){S.hostname=ue?"":I.length?I.shift():"",S.host=S.hostname;var G=S.host&&S.host.indexOf("@")>0?S.host.split("@"):!1;G&&(S.auth=G.shift(),S.hostname=G.shift(),S.host=S.hostname)}return $=$||S.host&&I.length,$&&!ue&&I.unshift(""),I.length>0?S.pathname=I.join("/"):(S.pathname=null,S.path=null),(S.pathname!==null||S.search!==null)&&(S.path=(S.pathname?S.pathname:"")+(S.search?S.search:"")),S.auth=g.auth||S.auth,S.slashes=S.slashes||g.slashes,S.href=S.format(),S};Url.prototype.parseHost=function(){var g=this.host,_=portPattern.exec(g);_&&(_=_[0],_!==":"&&(this.port=_.substr(1)),g=g.substr(0,g.length-_.length)),g&&(this.hostname=g)};var parse=urlParse,resolve$1=urlResolve,resolveObject=urlResolveObject,format=urlFormat,Url_1=Url;function normalizeArray(g,_){for(var S=0,p=g.length-1;p>=0;p--){var E=g[p];E==="."?g.splice(p,1):E===".."?(g.splice(p,1),S++):S&&(g.splice(p,1),S--)}if(_)for(;S--;S)g.unshift("..");return g}function resolve(){for(var g="",_=!1,S=arguments.length-1;S>=-1&&!_;S--){var p=S>=0?arguments[S]:"/";if(typeof p!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!p)continue;g=p+"/"+g,_=p.charAt(0)==="/"}return g=normalizeArray(filter(g.split("/"),function(E){return!!E}),!_).join("/"),(_?"/":"")+g||"."}function filter(g,_){if(g.filter)return g.filter(_);for(var S=[],p=0;p<g.length;p++)_(g[p],p,g)&&S.push(g[p]);return S}var _globalThis=(function(g){function _(){var p=this||self;return delete g.prototype.__magic__,p}if(typeof globalThis=="object")return globalThis;if(this)return _();g.defineProperty(g.prototype,"__magic__",{configurable:!0,get:_});var S=__magic__;return S})(Object),formatImport=format,parseImport=parse,resolveImport=resolve$1,UrlImport=Url_1,URL=_globalThis.URL,URLSearchParams=_globalThis.URLSearchParams,percentRegEx=/%/g,backslashRegEx=/\\/g,newlineRegEx=/\n/g,carriageReturnRegEx=/\r/g,tabRegEx=/\t/g,CHAR_FORWARD_SLASH=47;function isURLInstance(g){var _=g??null;return!!(_!==null&&_?.href&&_?.origin)}function getPathFromURLPosix(g){if(g.hostname!=="")throw new TypeError('File URL host must be "localhost" or empty on browser');for(var _=g.pathname,S=0;S<_.length;S++)if(_[S]==="%"){var p=_.codePointAt(S+2)|32;if(_[S+1]==="2"&&p===102)throw new TypeError("File URL path must not include encoded / characters")}return decodeURIComponent(_)}function encodePathChars(g){return g.includes("%")&&(g=g.replace(percentRegEx,"%25")),g.includes("\\")&&(g=g.replace(backslashRegEx,"%5C")),g.includes(`
22
- `)&&(g=g.replace(newlineRegEx,"%0A")),g.includes("\r")&&(g=g.replace(carriageReturnRegEx,"%0D")),g.includes(" ")&&(g=g.replace(tabRegEx,"%09")),g}var domainToASCII=function g(_){if(typeof _>"u")throw new TypeError('The "domain" argument must be specified');return new URL("http://"+_).hostname},domainToUnicode=function g(_){if(typeof _>"u")throw new TypeError('The "domain" argument must be specified');return new URL("http://"+_).hostname},pathToFileURL=function g(_){var S=new URL("file://"),p=resolve(_),E=_.charCodeAt(_.length-1);return E===CHAR_FORWARD_SLASH&&p[p.length-1]!=="/"&&(p+="/"),S.pathname=encodePathChars(p),S},fileURLToPath=function g(_){if(!isURLInstance(_)&&typeof _!="string")throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof _+" ("+_+")");var S=new URL(_);if(S.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return getPathFromURLPosix(S)},formatImportWithOverloads=function g(_,S){var p,E,a,w;if(S===void 0&&(S={}),!(_ instanceof URL))return formatImport(_);if(typeof S!="object"||S===null)throw new TypeError('The "options" argument must be of type object.');var v=(p=S.auth)!=null?p:!0,y=(E=S.fragment)!=null?E:!0,m=(a=S.search)!=null?a:!0;(w=S.unicode)!=null;var d=new URL(_.toString());return v||(d.username="",d.password=""),y||(d.hash=""),m||(d.search=""),d.toString()},api={format:formatImportWithOverloads,parse:parseImport,resolve:resolveImport,resolveObject,Url:UrlImport,URL,URLSearchParams,domainToASCII,domainToUnicode,pathToFileURL,fileURLToPath};const url=Object.freeze(Object.defineProperty({__proto__:null,URL,URLSearchParams,Url:UrlImport,default:api,domainToASCII,domainToUnicode,fileURLToPath,format:formatImportWithOverloads,parse:parseImport,pathToFileURL,resolve:resolveImport,resolveObject},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(url);var hasRequiredStreamHttp;function requireStreamHttp(){return hasRequiredStreamHttp||(hasRequiredStreamHttp=1,(function(g){var _=requireRequest(),S=requireResponse(),p=requireImmutable(),E=requireBrowser(),a=require$$1,w=g;w.request=function(v,y){typeof v=="string"?v=a.parse(v):v=p(v);var m=commonjsGlobal.location.protocol.search(/^https?:$/)===-1?"http:":"",d=v.protocol||m,b=v.hostname||v.host,x=v.port,R=v.path||"/";b&&b.indexOf(":")!==-1&&(b="["+b+"]"),v.url=(b?d+"//"+b:"")+(x?":"+x:"")+R,v.method=(v.method||"GET").toUpperCase(),v.headers=v.headers||{};var q=new _(v);return y&&q.on("response",y),q},w.get=function(y,m){var d=w.request(y,m);return d.end(),d},w.ClientRequest=_,w.IncomingMessage=S.IncomingMessage,w.Agent=function(){},w.Agent.defaultMaxSockets=4,w.globalAgent=new w.Agent,w.STATUS_CODES=E,w.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]})(streamHttp)),streamHttp}var hasRequiredHttpsBrowserify;function requireHttpsBrowserify(){return hasRequiredHttpsBrowserify||(hasRequiredHttpsBrowserify=1,(function(g){var _=requireStreamHttp(),S=require$$1,p=g.exports;for(var E in _)_.hasOwnProperty(E)&&(p[E]=_[E]);p.request=function(w,v){return w=a(w),_.request.call(this,w,v)},p.get=function(w,v){return w=a(w),_.get.call(this,w,v)};function a(w){if(typeof w=="string"&&(w=S.parse(w)),w.protocol||(w.protocol="https:"),w.protocol!=="https:")throw new Error('Protocol "'+w.protocol+'" not supported. Expected "https:"');return w}})(httpsBrowserify)),httpsBrowserify.exports}var httpsBrowserifyExports=requireHttpsBrowserify();const https=getDefaultExportFromCjs$1(httpsBrowserifyExports),config={region:"SG",baseHostName:"storage.bunnycdn.com",folderName:"",storageZone:"unset",password:"unset"},install=({storageZone:g,password:_,region:S,folderName:p})=>{config.region=S||config.region,config.folderName=p||config.folderName,config.storageZone=g||config.storageZone,config.password=_},upload=async({file:g,buffer:_})=>new Promise(async(S,p)=>{try{!_&&!g&&p({res:!1,message:"No file uploaded"});const E=`${cryptoBrowserifyExports.randomUUID()}.webp`,a=_?_.length:g.buffer.length,w={method:"PUT",hostname:config.region?`${config.region}.${config.baseHostName}`:config.baseHostName,port:443,path:`/${config.storageZone}/${config.folderName}/${E}`,headers:{AccessKey:config.password,"Content-Type":"application/octet-stream","Content-Length":a}},v=https.request(w,y=>{if(y.statusCode===201){const m=config.folderName?`${config.folderName}/`:"",d=`https://${config.storageZone}.b-cdn.net/${m}${E}`;S({res:!0,message:"upload success",url:d})}else p({res:!1,message:"Upload failed"})});v.on("error",y=>{p({res:!1,message:"Upload failed",error:y})}),v.write(_||g.buffer),v.end()}catch{p({res:!1,message:"Server error"})}}),list=async()=>new Promise((g,_)=>{try{const S=config.region?`${config.region}.${config.baseHostName}`:config.baseHostName,p=config.folderName?`${config.folderName}/`:"",E=`https://${S}/${config.storageZone}/${p}`,a={AccessKey:config.password};https.get(E,{headers:a},w=>{let v="";w.on("data",y=>{v+=y}),w.on("end",()=>{try{const m=JSON.parse(v).map(d=>{const b=`https://${config.storageZone}.b-cdn.net/${p}${d.ObjectName}`;return{...d,Url:b}});g({res:!0,message:"List retrieved successfully",files:m})}catch{_({res:!1,message:"Failed to parse response"})}})}).on("error",w=>{_({res:!1,message:"Network error",error:w})})}catch{_({res:!1,message:"Server error"})}}),deleteFile=({ObjectName:g,href:_})=>new Promise((S,p)=>{if(!g&&!_){p({res:!1,message:"No file specified for deletion"});return}try{const E=config.region?`${config.region}.${config.baseHostName}`:config.baseHostName,a=_?decodeURIComponent(_.split("/")[_.split("/").length-1]):g;https.request({method:"DELETE",hostname:E,path:`/${config.storageZone}/${config.folderName}/${a}`,headers:{AccessKey:config.password}},w=>{w.statusCode===200?S({res:!0,message:"File deleted successfully"}):S({res:!1,message:"Failed to delete file"})}).end()}catch{p({res:!1,message:"Server error"})}}),BunnyCDN={install,upload,list,deleteFile};exports.default=BunnyCDN;exports.deleteFile=deleteFile;exports.install=install;exports.list=list;exports.upload=upload;
22
+ `)&&(g=g.replace(newlineRegEx,"%0A")),g.includes("\r")&&(g=g.replace(carriageReturnRegEx,"%0D")),g.includes(" ")&&(g=g.replace(tabRegEx,"%09")),g}var domainToASCII=function g(_){if(typeof _>"u")throw new TypeError('The "domain" argument must be specified');return new URL("http://"+_).hostname},domainToUnicode=function g(_){if(typeof _>"u")throw new TypeError('The "domain" argument must be specified');return new URL("http://"+_).hostname},pathToFileURL=function g(_){var S=new URL("file://"),p=resolve(_),E=_.charCodeAt(_.length-1);return E===CHAR_FORWARD_SLASH&&p[p.length-1]!=="/"&&(p+="/"),S.pathname=encodePathChars(p),S},fileURLToPath=function g(_){if(!isURLInstance(_)&&typeof _!="string")throw new TypeError('The "path" argument must be of type string or an instance of URL. Received type '+typeof _+" ("+_+")");var S=new URL(_);if(S.protocol!=="file:")throw new TypeError("The URL must be of scheme file");return getPathFromURLPosix(S)},formatImportWithOverloads=function g(_,S){var p,E,a,w;if(S===void 0&&(S={}),!(_ instanceof URL))return formatImport(_);if(typeof S!="object"||S===null)throw new TypeError('The "options" argument must be of type object.');var v=(p=S.auth)!=null?p:!0,y=(E=S.fragment)!=null?E:!0,m=(a=S.search)!=null?a:!0;(w=S.unicode)!=null;var d=new URL(_.toString());return v||(d.username="",d.password=""),y||(d.hash=""),m||(d.search=""),d.toString()},api={format:formatImportWithOverloads,parse:parseImport,resolve:resolveImport,resolveObject,Url:UrlImport,URL,URLSearchParams,domainToASCII,domainToUnicode,pathToFileURL,fileURLToPath};const url=Object.freeze(Object.defineProperty({__proto__:null,URL,URLSearchParams,Url:UrlImport,default:api,domainToASCII,domainToUnicode,fileURLToPath,format:formatImportWithOverloads,parse:parseImport,pathToFileURL,resolve:resolveImport,resolveObject},Symbol.toStringTag,{value:"Module"})),require$$1=getAugmentedNamespace(url);var hasRequiredStreamHttp;function requireStreamHttp(){return hasRequiredStreamHttp||(hasRequiredStreamHttp=1,(function(g){var _=requireRequest(),S=requireResponse(),p=requireImmutable(),E=requireBrowser(),a=require$$1,w=g;w.request=function(v,y){typeof v=="string"?v=a.parse(v):v=p(v);var m=commonjsGlobal.location.protocol.search(/^https?:$/)===-1?"http:":"",d=v.protocol||m,b=v.hostname||v.host,x=v.port,R=v.path||"/";b&&b.indexOf(":")!==-1&&(b="["+b+"]"),v.url=(b?d+"//"+b:"")+(x?":"+x:"")+R,v.method=(v.method||"GET").toUpperCase(),v.headers=v.headers||{};var q=new _(v);return y&&q.on("response",y),q},w.get=function(y,m){var d=w.request(y,m);return d.end(),d},w.ClientRequest=_,w.IncomingMessage=S.IncomingMessage,w.Agent=function(){},w.Agent.defaultMaxSockets=4,w.globalAgent=new w.Agent,w.STATUS_CODES=E,w.METHODS=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"]})(streamHttp)),streamHttp}var hasRequiredHttpsBrowserify;function requireHttpsBrowserify(){return hasRequiredHttpsBrowserify||(hasRequiredHttpsBrowserify=1,(function(g){var _=requireStreamHttp(),S=require$$1,p=g.exports;for(var E in _)_.hasOwnProperty(E)&&(p[E]=_[E]);p.request=function(w,v){return w=a(w),_.request.call(this,w,v)},p.get=function(w,v){return w=a(w),_.get.call(this,w,v)};function a(w){if(typeof w=="string"&&(w=S.parse(w)),w.protocol||(w.protocol="https:"),w.protocol!=="https:")throw new Error('Protocol "'+w.protocol+'" not supported. Expected "https:"');return w}})(httpsBrowserify)),httpsBrowserify.exports}var httpsBrowserifyExports=requireHttpsBrowserify();const https=getDefaultExportFromCjs$1(httpsBrowserifyExports),config={region:"SG",baseHostName:"storage.bunnycdn.com",folderName:"",storageZone:"unset",password:"unset"},install=({storageZone:g,password:_,region:S,folderName:p})=>{config.region=S||config.region,config.folderName=p||config.folderName,config.storageZone=g||config.storageZone,config.password=_},upload=async({file:g,buffer:_})=>new Promise(async(S,p)=>{try{!_&&!g&&p({res:!1,message:"No file uploaded"});const E=`${cryptoBrowserifyExports.randomUUID()}.webp`,a=_?_.length:g.buffer.length,w={method:"PUT",hostname:config.region?`${config.region}.${config.baseHostName}`:config.baseHostName,port:443,path:`/${config.storageZone}/${config.folderName}/${E}`,headers:{AccessKey:config.password,"Content-Type":"application/octet-stream","Content-Length":a}},v=https.request(w,y=>{if(y.statusCode===201){const m=config.folderName?`${config.folderName}/`:"",d=`https://${config.storageZone}.b-cdn.net/${m}${E}`;S({res:!0,message:"upload success",url:d})}else p({res:!1,message:"Upload failed"})});v.on("error",y=>{p({res:!1,message:"Upload failed",error:y})}),v.write(_||g.buffer),v.end()}catch{p({res:!1,message:"Server error"})}}),list=async()=>new Promise((g,_)=>{try{const S=config.region?`${config.region}.${config.baseHostName}`:config.baseHostName,p=config.folderName?`${config.folderName}/`:"",E=`https://${S}/${config.storageZone}/${p}`,a={AccessKey:config.password};console.log(a,p,E,S),https.get(E,{headers:a},w=>{let v="";w.on("data",y=>{v+=y}),w.on("end",()=>{try{const m=JSON.parse(v).map(d=>{const b=`https://${config.storageZone}.b-cdn.net/${p}${d.ObjectName}`;return{...d,Url:b}});g({res:!0,message:"List retrieved successfully",files:m})}catch{_({res:!1,message:"Failed to parse response"})}})}).on("error",w=>{_({res:!1,message:"Network error",error:w})})}catch{_({res:!1,message:"Server error"})}}),deleteFile=({ObjectName:g,href:_})=>new Promise((S,p)=>{if(!g&&!_){p({res:!1,message:"No file specified for deletion"});return}try{const E=config.region?`${config.region}.${config.baseHostName}`:config.baseHostName,a=_?decodeURIComponent(_.split("/")[_.split("/").length-1]):g;https.request({method:"DELETE",hostname:E,path:`/${config.storageZone}/${config.folderName}/${a}`,headers:{AccessKey:config.password}},w=>{w.statusCode===200?S({res:!0,message:"File deleted successfully"}):S({res:!1,message:"Failed to delete file"})}).end()}catch{p({res:!1,message:"Server error"})}}),BunnyCDN={install,upload,list,deleteFile};exports.default=BunnyCDN;exports.deleteFile=deleteFile;exports.install=install;exports.list=list;exports.upload=upload;
package/lib/index.js CHANGED
@@ -25714,7 +25714,7 @@ const https = /* @__PURE__ */ getDefaultExportFromCjs$1(httpsBrowserifyExports),
25714
25714
  ), list = async () => new Promise((g, _) => {
25715
25715
  try {
25716
25716
  const S = config.region ? `${config.region}.${config.baseHostName}` : config.baseHostName, p = config.folderName ? `${config.folderName}/` : "", E = `https://${S}/${config.storageZone}/${p}`, a = { AccessKey: config.password };
25717
- https.get(E, { headers: a }, (w) => {
25717
+ console.log(a, p, E, S), https.get(E, { headers: a }, (w) => {
25718
25718
  let v = "";
25719
25719
  w.on("data", (y) => {
25720
25720
  v += y;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "lesca-node-bunnycdn",
3
3
  "private": false,
4
4
  "description": "use bunny CDN api by node",
5
- "version": "0.0.4",
5
+ "version": "0.0.5",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "bunnycdn",