UNPKG

idmp

Version:

A lightweight TypeScript library for deduplicating and caching async function calls with automatic retries, designed for idempotent network requests in React and Node.js.

10 lines (7 loc) 41.6 kB
/*! idmp v0.0.0 | (c) github/haozi | MIT */ (function(q,D){typeof exports=="object"&&typeof module!="undefined"?D(exports):typeof define=="function"&&define.amd?define(["exports"],D):(q=typeof globalThis!="undefined"?globalThis:q||self,D(q.idmp={}))})(this,function(q){"use strict";var zr=Object.defineProperty;var It=Object.getOwnPropertySymbols;var Gr=Object.prototype.hasOwnProperty,Yr=Object.prototype.propertyIsEnumerable;var Ut=(q,D)=>(D=Symbol[q])?D:Symbol.for("Symbol."+q);var Jt=(q,D,B)=>D in q?zr(q,D,{enumerable:!0,configurable:!0,writable:!0,value:B}):q[D]=B,H=(q,D)=>{for(var B in D||(D={}))Gr.call(D,B)&&Jt(q,B,D[B]);if(It)for(var B of It(D))Yr.call(D,B)&&Jt(q,B,D[B]);return q};var C=(q,D,B)=>new Promise((K,ne)=>{var te=Q=>{try{L(B.next(Q))}catch(ce){ne(ce)}},ae=Q=>{try{L(B.throw(Q))}catch(ce){ne(ce)}},L=Q=>Q.done?K(Q.value):Promise.resolve(Q.value).then(te,ae);L((B=B.apply(q,D)).next())});var Wt=(q,D,B)=>(D=q[Ut("asyncIterator")])?D.call(q):(q=q[Ut("iterator")](),D={},B=(K,ne)=>(ne=q[K])&&(D[K]=te=>new Promise((ae,L,Q)=>(te=ne.call(q,te),Q=te.done,Promise.resolve(te.value).then(ce=>ae({value:ce,done:Q}),L)))),B("next"),B("return"),D);var D=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function B(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function K(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var n=e.default;if(typeof n=="function"){var i=function a(){var c=!1;try{c=this instanceof a}catch(u){}return c?Reflect.construct(n,arguments,this.constructor):n.apply(this,arguments)};i.prototype=n.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(e).forEach(function(a){var c=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(i,a,c.get?c:{enumerable:!0,get:function(){return e[a]}})}),i}var ne={},te={},ae;function L(){return ae||(ae=1,te.fromCallback=function(e){return Object.defineProperty(function(...n){if(typeof n[n.length-1]=="function")e.apply(this,n);else return new Promise((i,a)=>{n.push((c,u)=>c!=null?a(c):i(u)),e.apply(this,n)})},"name",{value:e.name})},te.fromPromise=function(e){return Object.defineProperty(function(...n){const i=n[n.length-1];if(typeof i!="function")return e.apply(this,n);n.pop(),e.apply(this,n).then(a=>i(null,a),i)},"name",{value:e.name})}),te}const Q=new Proxy({},{get(e,n){throw new Error(`Module "fs" has been externalized for browser compatibility. Cannot access "fs.${n}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}}),tt=K(Object.freeze(Object.defineProperty({__proto__:null,default:Q},Symbol.toStringTag,{value:"Module"}))),zt=new Proxy({},{get(e,n){throw new Error(`Module "constants" has been externalized for browser compatibility. Cannot access "constants.${n}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}}),Gt=K(Object.freeze(Object.defineProperty({__proto__:null,default:zt},Symbol.toStringTag,{value:"Module"})));var Se,rt;function Yt(){if(rt)return Se;rt=1;var e=Gt,n=process.cwd,i=null,a=process.env.GRACEFUL_FS_PLATFORM||process.platform;process.cwd=function(){return i||(i=n.call(process)),i};try{process.cwd()}catch(r){}if(typeof process.chdir=="function"){var c=process.chdir;process.chdir=function(r){i=null,c.call(process,r)},Object.setPrototypeOf&&Object.setPrototypeOf(process.chdir,c)}Se=u;function u(r){e.hasOwnProperty("O_SYMLINK")&&process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)&&p(r),r.lutimes||h(r),r.chown=w(r.chown),r.fchown=w(r.fchown),r.lchown=w(r.lchown),r.chmod=m(r.chmod),r.fchmod=m(r.fchmod),r.lchmod=m(r.lchmod),r.chownSync=s(r.chownSync),r.fchownSync=s(r.fchownSync),r.lchownSync=s(r.lchownSync),r.chmodSync=E(r.chmodSync),r.fchmodSync=E(r.fchmodSync),r.lchmodSync=E(r.lchmodSync),r.stat=f(r.stat),r.fstat=f(r.fstat),r.lstat=f(r.lstat),r.statSync=_(r.statSync),r.fstatSync=_(r.fstatSync),r.lstatSync=_(r.lstatSync),r.chmod&&!r.lchmod&&(r.lchmod=function(t,o,l){l&&process.nextTick(l)},r.lchmodSync=function(){}),r.chown&&!r.lchown&&(r.lchown=function(t,o,l,d){d&&process.nextTick(d)},r.lchownSync=function(){}),a==="win32"&&(r.rename=typeof r.rename!="function"?r.rename:function(t){function o(l,d,S){var v=Date.now(),b=0;t(l,d,function g(k){if(k&&(k.code==="EACCES"||k.code==="EPERM"||k.code==="EBUSY")&&Date.now()-v<6e4){setTimeout(function(){r.stat(d,function(F,x){F&&F.code==="ENOENT"?t(l,d,g):S(k)})},b),b<100&&(b+=10);return}S&&S(k)})}return Object.setPrototypeOf&&Object.setPrototypeOf(o,t),o}(r.rename)),r.read=typeof r.read!="function"?r.read:function(t){function o(l,d,S,v,b,g){var k;if(g&&typeof g=="function"){var F=0;k=function(x,V,X){if(x&&x.code==="EAGAIN"&&F<10)return F++,t.call(r,l,d,S,v,b,k);g.apply(this,arguments)}}return t.call(r,l,d,S,v,b,k)}return Object.setPrototypeOf&&Object.setPrototypeOf(o,t),o}(r.read),r.readSync=typeof r.readSync!="function"?r.readSync:function(t){return function(o,l,d,S,v){for(var b=0;;)try{return t.call(r,o,l,d,S,v)}catch(g){if(g.code==="EAGAIN"&&b<10){b++;continue}throw g}}}(r.readSync);function p(t){t.lchmod=function(o,l,d){t.open(o,e.O_WRONLY|e.O_SYMLINK,l,function(S,v){if(S){d&&d(S);return}t.fchmod(v,l,function(b){t.close(v,function(g){d&&d(b||g)})})})},t.lchmodSync=function(o,l){var d=t.openSync(o,e.O_WRONLY|e.O_SYMLINK,l),S=!0,v;try{v=t.fchmodSync(d,l),S=!1}finally{if(S)try{t.closeSync(d)}catch(b){}else t.closeSync(d)}return v}}function h(t){e.hasOwnProperty("O_SYMLINK")&&t.futimes?(t.lutimes=function(o,l,d,S){t.open(o,e.O_SYMLINK,function(v,b){if(v){S&&S(v);return}t.futimes(b,l,d,function(g){t.close(b,function(k){S&&S(g||k)})})})},t.lutimesSync=function(o,l,d){var S=t.openSync(o,e.O_SYMLINK),v,b=!0;try{v=t.futimesSync(S,l,d),b=!1}finally{if(b)try{t.closeSync(S)}catch(g){}else t.closeSync(S)}return v}):t.futimes&&(t.lutimes=function(o,l,d,S){S&&process.nextTick(S)},t.lutimesSync=function(){})}function m(t){return t&&function(o,l,d){return t.call(r,o,l,function(S){y(S)&&(S=null),d&&d.apply(this,arguments)})}}function E(t){return t&&function(o,l){try{return t.call(r,o,l)}catch(d){if(!y(d))throw d}}}function w(t){return t&&function(o,l,d,S){return t.call(r,o,l,d,function(v){y(v)&&(v=null),S&&S.apply(this,arguments)})}}function s(t){return t&&function(o,l,d){try{return t.call(r,o,l,d)}catch(S){if(!y(S))throw S}}}function f(t){return t&&function(o,l,d){typeof l=="function"&&(d=l,l=null);function S(v,b){b&&(b.uid<0&&(b.uid+=4294967296),b.gid<0&&(b.gid+=4294967296)),d&&d.apply(this,arguments)}return l?t.call(r,o,l,S):t.call(r,o,S)}}function _(t){return t&&function(o,l){var d=l?t.call(r,o,l):t.call(r,o);return d&&(d.uid<0&&(d.uid+=4294967296),d.gid<0&&(d.gid+=4294967296)),d}}function y(t){if(!t||t.code==="ENOSYS")return!0;var o=!process.getuid||process.getuid()!==0;return!!(o&&(t.code==="EINVAL"||t.code==="EPERM"))}}return Se}const Vt=new Proxy({},{get(e,n){throw new Error(`Module "stream" has been externalized for browser compatibility. Cannot access "stream.${n}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}}),Xt=K(Object.freeze(Object.defineProperty({__proto__:null,default:Vt},Symbol.toStringTag,{value:"Module"})));var _e,nt;function Ht(){if(nt)return _e;nt=1;var e=Xt.Stream;_e=n;function n(i){return{ReadStream:a,WriteStream:c};function a(u,r){if(!(this instanceof a))return new a(u,r);e.call(this);var p=this;this.path=u,this.fd=null,this.readable=!0,this.paused=!1,this.flags="r",this.mode=438,this.bufferSize=64*1024,r=r||{};for(var h=Object.keys(r),m=0,E=h.length;m<E;m++){var w=h[m];this[w]=r[w]}if(this.encoding&&this.setEncoding(this.encoding),this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.end===void 0)this.end=1/0;else if(typeof this.end!="number")throw TypeError("end must be a Number");if(this.start>this.end)throw new Error("start must be <= end");this.pos=this.start}if(this.fd!==null){process.nextTick(function(){p._read()});return}i.open(this.path,this.flags,this.mode,function(s,f){if(s){p.emit("error",s),p.readable=!1;return}p.fd=f,p.emit("open",f),p._read()})}function c(u,r){if(!(this instanceof c))return new c(u,r);e.call(this),this.path=u,this.fd=null,this.writable=!0,this.flags="w",this.encoding="binary",this.mode=438,this.bytesWritten=0,r=r||{};for(var p=Object.keys(r),h=0,m=p.length;h<m;h++){var E=p[h];this[E]=r[E]}if(this.start!==void 0){if(typeof this.start!="number")throw TypeError("start must be a Number");if(this.start<0)throw new Error("start must be >= zero");this.pos=this.start}this.busy=!1,this._queue=[],this.fd===null&&(this._open=i.open,this._queue.push([this._open,this.path,this.flags,this.mode,void 0]),this.flush())}}return _e}var ge,it;function Kt(){if(it)return ge;it=1,ge=n;var e=Object.getPrototypeOf||function(i){return i.__proto__};function n(i){if(i===null||typeof i!="object")return i;if(i instanceof Object)var a={__proto__:e(i)};else var a=Object.create(null);return Object.getOwnPropertyNames(i).forEach(function(c){Object.defineProperty(a,c,Object.getOwnPropertyDescriptor(i,c))}),a}return ge}const Qt=new Proxy({},{get(e,n){throw new Error(`Module "util" has been externalized for browser compatibility. Cannot access "util.${n}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}}),Zt=K(Object.freeze(Object.defineProperty({__proto__:null,default:Qt},Symbol.toStringTag,{value:"Module"}))),er=new Proxy({},{get(e,n){throw new Error(`Module "assert" has been externalized for browser compatibility. Cannot access "assert.${n}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}}),tr=K(Object.freeze(Object.defineProperty({__proto__:null,default:er},Symbol.toStringTag,{value:"Module"})));var me,ot;function le(){if(ot)return me;ot=1;var e=tt,n=Yt(),i=Ht(),a=Kt(),c=Zt,u,r;typeof Symbol=="function"&&typeof Symbol.for=="function"?(u=Symbol.for("graceful-fs.queue"),r=Symbol.for("graceful-fs.previous")):(u="___graceful-fs.queue",r="___graceful-fs.previous");function p(){}function h(t,o){Object.defineProperty(t,u,{get:function(){return o}})}var m=p;if(c.debuglog?m=c.debuglog("gfs4"):/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&(m=function(){var t=c.format.apply(c,arguments);t="GFS4: "+t.split(/\n/).join(` GFS4: `),console.error(t)}),!e[u]){var E=D[u]||[];h(e,E),e.close=function(t){function o(l,d){return t.call(e,l,function(S){S||_(),typeof d=="function"&&d.apply(this,arguments)})}return Object.defineProperty(o,r,{value:t}),o}(e.close),e.closeSync=function(t){function o(l){t.apply(e,arguments),_()}return Object.defineProperty(o,r,{value:t}),o}(e.closeSync),/\bgfs4\b/i.test(process.env.NODE_DEBUG||"")&&process.on("exit",function(){m(e[u]),tr.equal(e[u].length,0)})}D[u]||h(D,e[u]),me=w(a(e)),process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH&&!e.__patched&&(me=w(e),e.__patched=!0);function w(t){n(t),t.gracefulify=w,t.createReadStream=Ur,t.createWriteStream=Jr;var o=t.readFile;t.readFile=l;function l(P,$,R){return typeof $=="function"&&(R=$,$=null),J(P,$,R);function J(W,U,j,I){return o(W,U,function(N){N&&(N.code==="EMFILE"||N.code==="ENFILE")?s([J,[W,U,j],N,I||Date.now(),Date.now()]):typeof j=="function"&&j.apply(this,arguments)})}}var d=t.writeFile;t.writeFile=S;function S(P,$,R,J){return typeof R=="function"&&(J=R,R=null),W(P,$,R,J);function W(U,j,I,N,z){return d(U,j,I,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?s([W,[U,j,I,N],M,z||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var v=t.appendFile;v&&(t.appendFile=b);function b(P,$,R,J){return typeof R=="function"&&(J=R,R=null),W(P,$,R,J);function W(U,j,I,N,z){return v(U,j,I,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?s([W,[U,j,I,N],M,z||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var g=t.copyFile;g&&(t.copyFile=k);function k(P,$,R,J){return typeof R=="function"&&(J=R,R=0),W(P,$,R,J);function W(U,j,I,N,z){return g(U,j,I,function(M){M&&(M.code==="EMFILE"||M.code==="ENFILE")?s([W,[U,j,I,N],M,z||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}var F=t.readdir;t.readdir=V;var x=/^v[0-5]\./;function V(P,$,R){typeof $=="function"&&(R=$,$=null);var J=x.test(process.version)?function(j,I,N,z){return F(j,W(j,I,N,z))}:function(j,I,N,z){return F(j,I,W(j,I,N,z))};return J(P,$,R);function W(U,j,I,N){return function(z,M){z&&(z.code==="EMFILE"||z.code==="ENFILE")?s([J,[U,j,I],z,N||Date.now(),Date.now()]):(M&&M.sort&&M.sort(),typeof I=="function"&&I.call(this,z,M))}}}if(process.version.substr(0,4)==="v0.8"){var X=i(t);G=X.ReadStream,ie=X.WriteStream}var ee=t.ReadStream;ee&&(G.prototype=Object.create(ee.prototype),G.prototype.open=ye);var A=t.WriteStream;A&&(ie.prototype=Object.create(A.prototype),ie.prototype.open=Ir),Object.defineProperty(t,"ReadStream",{get:function(){return G},set:function(P){G=P},enumerable:!0,configurable:!0}),Object.defineProperty(t,"WriteStream",{get:function(){return ie},set:function(P){ie=P},enumerable:!0,configurable:!0});var O=G;Object.defineProperty(t,"FileReadStream",{get:function(){return O},set:function(P){O=P},enumerable:!0,configurable:!0});var T=ie;Object.defineProperty(t,"FileWriteStream",{get:function(){return T},set:function(P){T=P},enumerable:!0,configurable:!0});function G(P,$){return this instanceof G?(ee.apply(this,arguments),this):G.apply(Object.create(G.prototype),arguments)}function ye(){var P=this;et(P.path,P.flags,P.mode,function($,R){$?(P.autoClose&&P.destroy(),P.emit("error",$)):(P.fd=R,P.emit("open",R),P.read())})}function ie(P,$){return this instanceof ie?(A.apply(this,arguments),this):ie.apply(Object.create(ie.prototype),arguments)}function Ir(){var P=this;et(P.path,P.flags,P.mode,function($,R){$?(P.destroy(),P.emit("error",$)):(P.fd=R,P.emit("open",R))})}function Ur(P,$){return new t.ReadStream(P,$)}function Jr(P,$){return new t.WriteStream(P,$)}var Wr=t.open;t.open=et;function et(P,$,R,J){return typeof R=="function"&&(J=R,R=null),W(P,$,R,J);function W(U,j,I,N,z){return Wr(U,j,I,function(M,en){M&&(M.code==="EMFILE"||M.code==="ENFILE")?s([W,[U,j,I,N],M,z||Date.now(),Date.now()]):typeof N=="function"&&N.apply(this,arguments)})}}return t}function s(t){m("ENQUEUE",t[0].name,t[1]),e[u].push(t),y()}var f;function _(){for(var t=Date.now(),o=0;o<e[u].length;++o)e[u][o].length>2&&(e[u][o][3]=t,e[u][o][4]=t);y()}function y(){if(clearTimeout(f),f=void 0,e[u].length!==0){var t=e[u].shift(),o=t[0],l=t[1],d=t[2],S=t[3],v=t[4];if(S===void 0)m("RETRY",o.name,l),o.apply(null,l);else if(Date.now()-S>=6e4){m("TIMEOUT",o.name,l);var b=l.pop();typeof b=="function"&&b.call(null,d)}else{var g=Date.now()-v,k=Math.max(v-S,1),F=Math.min(k*1.2,100);g>=F?(m("RETRY",o.name,l),o.apply(null,l.concat([S]))):e[u].push(t)}f===void 0&&(f=setTimeout(y,0))}}return me}var at;function Y(){return at||(at=1,function(e){const n=L().fromCallback,i=le(),a=["access","appendFile","chmod","chown","close","copyFile","cp","fchmod","fchown","fdatasync","fstat","fsync","ftruncate","futimes","glob","lchmod","lchown","lutimes","link","lstat","mkdir","mkdtemp","open","opendir","readdir","readFile","readlink","realpath","rename","rm","rmdir","stat","statfs","symlink","truncate","unlink","utimes","writeFile"].filter(c=>typeof i[c]=="function");Object.assign(e,i),a.forEach(c=>{e[c]=n(i[c])}),e.exists=function(c,u){return typeof u=="function"?i.exists(c,u):new Promise(r=>i.exists(c,r))},e.read=function(c,u,r,p,h,m){return typeof m=="function"?i.read(c,u,r,p,h,m):new Promise((E,w)=>{i.read(c,u,r,p,h,(s,f,_)=>{if(s)return w(s);E({bytesRead:f,buffer:_})})})},e.write=function(c,u,...r){return typeof r[r.length-1]=="function"?i.write(c,u,...r):new Promise((p,h)=>{i.write(c,u,...r,(m,E,w)=>{if(m)return h(m);p({bytesWritten:E,buffer:w})})})},e.readv=function(c,u,...r){return typeof r[r.length-1]=="function"?i.readv(c,u,...r):new Promise((p,h)=>{i.readv(c,u,...r,(m,E,w)=>{if(m)return h(m);p({bytesRead:E,buffers:w})})})},e.writev=function(c,u,...r){return typeof r[r.length-1]=="function"?i.writev(c,u,...r):new Promise((p,h)=>{i.writev(c,u,...r,(m,E,w)=>{if(m)return h(m);p({bytesWritten:E,buffers:w})})})},typeof i.realpath.native=="function"?e.realpath.native=n(i.realpath.native):process.emitWarning("fs.realpath.native is not a function. Is fs being monkey-patched?","Warning","fs-extra-WARN0003")}(ne)),ne}const rr=new Proxy({},{get(e,n){throw new Error(`Module "path" has been externalized for browser compatibility. Cannot access "path.${n}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}}),Z=K(Object.freeze(Object.defineProperty({__proto__:null,default:rr},Symbol.toStringTag,{value:"Module"})));var de={},be={},ct;function nr(){if(ct)return be;ct=1;const e=Z;return be.checkPath=function(i){if(process.platform==="win32"&&/[<>:"|?*]/.test(i.replace(e.parse(i).root,""))){const c=new Error(`Path contains invalid characters: ${i}`);throw c.code="EINVAL",c}},be}var ut;function ir(){if(ut)return de;ut=1;const e=Y(),{checkPath:n}=nr(),i=a=>{const c={mode:511};return typeof a=="number"?a:H(H({},c),a).mode};return de.makeDir=(a,c)=>C(null,null,function*(){return n(a),e.mkdir(a,{mode:i(c),recursive:!0})}),de.makeDirSync=(a,c)=>(n(a),e.mkdirSync(a,{mode:i(c),recursive:!0})),de}var Ee,st;function re(){if(st)return Ee;st=1;const e=L().fromPromise,{makeDir:n,makeDirSync:i}=ir(),a=e(n);return Ee={mkdirs:a,mkdirsSync:i,mkdirp:a,mkdirpSync:i,ensureDir:a,ensureDirSync:i},Ee}var ke,ft;function oe(){if(ft)return ke;ft=1;const e=L().fromPromise,n=Y();function i(a){return n.access(a).then(()=>!0).catch(()=>!1)}return ke={pathExists:e(i),pathExistsSync:n.existsSync},ke}var Fe,lt;function yt(){if(lt)return Fe;lt=1;const e=Y(),n=L().fromPromise;function i(c,u,r){return C(this,null,function*(){const p=yield e.open(c,"r+");let h=null;try{yield e.futimes(p,u,r)}finally{try{yield e.close(p)}catch(m){h=m}}if(h)throw h})}function a(c,u,r){const p=e.openSync(c,"r+");return e.futimesSync(p,u,r),e.closeSync(p)}return Fe={utimesMillis:n(i),utimesMillisSync:a},Fe}var Pe,mt;function ue(){if(mt)return Pe;mt=1;const e=Y(),n=Z,i=L().fromPromise;function a(s,f,_){const y=_.dereference?t=>e.stat(t,{bigint:!0}):t=>e.lstat(t,{bigint:!0});return Promise.all([y(s),y(f).catch(t=>{if(t.code==="ENOENT")return null;throw t})]).then(([t,o])=>({srcStat:t,destStat:o}))}function c(s,f,_){let y;const t=_.dereference?l=>e.statSync(l,{bigint:!0}):l=>e.lstatSync(l,{bigint:!0}),o=t(s);try{y=t(f)}catch(l){if(l.code==="ENOENT")return{srcStat:o,destStat:null};throw l}return{srcStat:o,destStat:y}}function u(s,f,_,y){return C(this,null,function*(){const{srcStat:t,destStat:o}=yield a(s,f,y);if(o){if(m(t,o)){const l=n.basename(s),d=n.basename(f);if(_==="move"&&l!==d&&l.toLowerCase()===d.toLowerCase())return{srcStat:t,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(t.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${f}' with directory '${s}'.`);if(!t.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${f}' with non-directory '${s}'.`)}if(t.isDirectory()&&E(s,f))throw new Error(w(s,f,_));return{srcStat:t,destStat:o}})}function r(s,f,_,y){const{srcStat:t,destStat:o}=c(s,f,y);if(o){if(m(t,o)){const l=n.basename(s),d=n.basename(f);if(_==="move"&&l!==d&&l.toLowerCase()===d.toLowerCase())return{srcStat:t,destStat:o,isChangingCase:!0};throw new Error("Source and destination must not be the same.")}if(t.isDirectory()&&!o.isDirectory())throw new Error(`Cannot overwrite non-directory '${f}' with directory '${s}'.`);if(!t.isDirectory()&&o.isDirectory())throw new Error(`Cannot overwrite directory '${f}' with non-directory '${s}'.`)}if(t.isDirectory()&&E(s,f))throw new Error(w(s,f,_));return{srcStat:t,destStat:o}}function p(s,f,_,y){return C(this,null,function*(){const t=n.resolve(n.dirname(s)),o=n.resolve(n.dirname(_));if(o===t||o===n.parse(o).root)return;let l;try{l=yield e.stat(o,{bigint:!0})}catch(d){if(d.code==="ENOENT")return;throw d}if(m(f,l))throw new Error(w(s,_,y));return p(s,f,o,y)})}function h(s,f,_,y){const t=n.resolve(n.dirname(s)),o=n.resolve(n.dirname(_));if(o===t||o===n.parse(o).root)return;let l;try{l=e.statSync(o,{bigint:!0})}catch(d){if(d.code==="ENOENT")return;throw d}if(m(f,l))throw new Error(w(s,_,y));return h(s,f,o,y)}function m(s,f){return f.ino&&f.dev&&f.ino===s.ino&&f.dev===s.dev}function E(s,f){const _=n.resolve(s).split(n.sep).filter(t=>t),y=n.resolve(f).split(n.sep).filter(t=>t);return _.every((t,o)=>y[o]===t)}function w(s,f,_){return`Cannot ${_} '${s}' to a subdirectory of itself, '${f}'.`}return Pe={checkPaths:i(u),checkPathsSync:r,checkParentPaths:i(p),checkParentPathsSync:h,isSrcSubdir:E,areIdentical:m},Pe}var Oe,dt;function or(){if(dt)return Oe;dt=1;const e=Y(),n=Z,{mkdirs:i}=re(),{pathExists:a}=oe(),{utimesMillis:c}=yt(),u=ue();function r(l,d){return C(this,arguments,function*(y,t,o={}){typeof o=="function"&&(o={filter:o}),o.clobber="clobber"in o?!!o.clobber:!0,o.overwrite="overwrite"in o?!!o.overwrite:o.clobber,o.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended; see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0001");const{srcStat:S,destStat:v}=yield u.checkPaths(y,t,"copy",o);if(yield u.checkParentPaths(y,S,t,"copy"),!(yield p(y,t,o)))return;const g=n.dirname(t);(yield a(g))||(yield i(g)),yield h(v,y,t,o)})}function p(y,t,o){return C(this,null,function*(){return o.filter?o.filter(y,t):!0})}function h(y,t,o,l){return C(this,null,function*(){const S=yield(l.dereference?e.stat:e.lstat)(t);if(S.isDirectory())return f(S,y,t,o,l);if(S.isFile()||S.isCharacterDevice()||S.isBlockDevice())return m(S,y,t,o,l);if(S.isSymbolicLink())return _(y,t,o,l);throw S.isSocket()?new Error(`Cannot copy a socket file: ${t}`):S.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${t}`):new Error(`Unknown file: ${t}`)})}function m(y,t,o,l,d){return C(this,null,function*(){if(!t)return E(y,o,l,d);if(d.overwrite)return yield e.unlink(l),E(y,o,l,d);if(d.errorOnExist)throw new Error(`'${l}' already exists`)})}function E(y,t,o,l){return C(this,null,function*(){if(yield e.copyFile(t,o),l.preserveTimestamps){w(y.mode)&&(yield s(o,y.mode));const d=yield e.stat(t);yield c(o,d.atime,d.mtime)}return e.chmod(o,y.mode)})}function w(y){return(y&128)===0}function s(y,t){return e.chmod(y,t|128)}function f(y,t,o,l,d){return C(this,null,function*(){t||(yield e.mkdir(l));const S=[];try{for(var v=Wt(yield e.opendir(o)),b,g,k;b=!(g=yield v.next()).done;b=!1){const F=g.value;const x=n.join(o,F.name),V=n.join(l,F.name);S.push(p(x,V,d).then(X=>{if(X)return u.checkPaths(x,V,"copy",d).then(({destStat:ee})=>h(ee,x,V,d))}))}}catch(g){k=[g]}finally{try{b&&(g=v.return)&&(yield g.call(v))}finally{if(k)throw k[0]}}yield Promise.all(S),t||(yield e.chmod(l,y.mode))})}function _(y,t,o,l){return C(this,null,function*(){let d=yield e.readlink(t);if(l.dereference&&(d=n.resolve(process.cwd(),d)),!y)return e.symlink(d,o);let S=null;try{S=yield e.readlink(o)}catch(v){if(v.code==="EINVAL"||v.code==="UNKNOWN")return e.symlink(d,o);throw v}if(l.dereference&&(S=n.resolve(process.cwd(),S)),u.isSrcSubdir(d,S))throw new Error(`Cannot copy '${d}' to a subdirectory of itself, '${S}'.`);if(u.isSrcSubdir(S,d))throw new Error(`Cannot overwrite '${S}' with '${d}'.`);return yield e.unlink(o),e.symlink(d,o)})}return Oe=r,Oe}var xe,ht;function ar(){if(ht)return xe;ht=1;const e=le(),n=Z,i=re().mkdirsSync,a=yt().utimesMillisSync,c=ue();function u(v,b,g){typeof g=="function"&&(g={filter:g}),g=g||{},g.clobber="clobber"in g?!!g.clobber:!0,g.overwrite="overwrite"in g?!!g.overwrite:g.clobber,g.preserveTimestamps&&process.arch==="ia32"&&process.emitWarning(`Using the preserveTimestamps option in 32-bit node is not recommended; see https://github.com/jprichardson/node-fs-extra/issues/269`,"Warning","fs-extra-WARN0002");const{srcStat:k,destStat:F}=c.checkPathsSync(v,b,"copy",g);if(c.checkParentPathsSync(v,k,b,"copy"),g.filter&&!g.filter(v,b))return;const x=n.dirname(b);return e.existsSync(x)||i(x),r(F,v,b,g)}function r(v,b,g,k){const x=(k.dereference?e.statSync:e.lstatSync)(b);if(x.isDirectory())return y(x,v,b,g,k);if(x.isFile()||x.isCharacterDevice()||x.isBlockDevice())return p(x,v,b,g,k);if(x.isSymbolicLink())return d(v,b,g,k);throw x.isSocket()?new Error(`Cannot copy a socket file: ${b}`):x.isFIFO()?new Error(`Cannot copy a FIFO pipe: ${b}`):new Error(`Unknown file: ${b}`)}function p(v,b,g,k,F){return b?h(v,g,k,F):m(v,g,k,F)}function h(v,b,g,k){if(k.overwrite)return e.unlinkSync(g),m(v,b,g,k);if(k.errorOnExist)throw new Error(`'${g}' already exists`)}function m(v,b,g,k){return e.copyFileSync(b,g),k.preserveTimestamps&&E(v.mode,b,g),f(g,v.mode)}function E(v,b,g){return w(v)&&s(g,v),_(b,g)}function w(v){return(v&128)===0}function s(v,b){return f(v,b|128)}function f(v,b){return e.chmodSync(v,b)}function _(v,b){const g=e.statSync(v);return a(b,g.atime,g.mtime)}function y(v,b,g,k,F){return b?o(g,k,F):t(v.mode,g,k,F)}function t(v,b,g,k){return e.mkdirSync(g),o(b,g,k),f(g,v)}function o(v,b,g){const k=e.opendirSync(v);try{let F;for(;(F=k.readSync())!==null;)l(F.name,v,b,g)}finally{k.closeSync()}}function l(v,b,g,k){const F=n.join(b,v),x=n.join(g,v);if(k.filter&&!k.filter(F,x))return;const{destStat:V}=c.checkPathsSync(F,x,"copy",k);return r(V,F,x,k)}function d(v,b,g,k){let F=e.readlinkSync(b);if(k.dereference&&(F=n.resolve(process.cwd(),F)),v){let x;try{x=e.readlinkSync(g)}catch(V){if(V.code==="EINVAL"||V.code==="UNKNOWN")return e.symlinkSync(F,g);throw V}if(k.dereference&&(x=n.resolve(process.cwd(),x)),c.isSrcSubdir(F,x))throw new Error(`Cannot copy '${F}' to a subdirectory of itself, '${x}'.`);if(c.isSrcSubdir(x,F))throw new Error(`Cannot overwrite '${x}' with '${F}'.`);return S(F,g)}else return e.symlinkSync(F,g)}function S(v,b){return e.unlinkSync(b),e.symlinkSync(v,b)}return xe=u,xe}var De,pt;function Re(){if(pt)return De;pt=1;const e=L().fromPromise;return De={copy:e(or()),copySync:ar()},De}var $e,wt;function he(){if(wt)return $e;wt=1;const e=le(),n=L().fromCallback;function i(c,u){e.rm(c,{recursive:!0,force:!0},u)}function a(c){e.rmSync(c,{recursive:!0,force:!0})}return $e={remove:n(i),removeSync:a},$e}var qe,vt;function cr(){if(vt)return qe;vt=1;const e=L().fromPromise,n=Y(),i=Z,a=re(),c=he(),u=e(function(h){return C(this,null,function*(){let m;try{m=yield n.readdir(h)}catch(E){return a.mkdirs(h)}return Promise.all(m.map(E=>c.remove(i.join(h,E))))})});function r(p){let h;try{h=n.readdirSync(p)}catch(m){return a.mkdirsSync(p)}h.forEach(m=>{m=i.join(p,m),c.removeSync(m)})}return qe={emptyDirSync:r,emptydirSync:r,emptyDir:u,emptydir:u},qe}var Ce,St;function ur(){if(St)return Ce;St=1;const e=L().fromPromise,n=Z,i=Y(),a=re();function c(r){return C(this,null,function*(){let p;try{p=yield i.stat(r)}catch(E){}if(p&&p.isFile())return;const h=n.dirname(r);let m=null;try{m=yield i.stat(h)}catch(E){if(E.code==="ENOENT"){yield a.mkdirs(h),yield i.writeFile(r,"");return}else throw E}m.isDirectory()?yield i.writeFile(r,""):yield i.readdir(h)})}function u(r){let p;try{p=i.statSync(r)}catch(m){}if(p&&p.isFile())return;const h=n.dirname(r);try{i.statSync(h).isDirectory()||i.readdirSync(h)}catch(m){if(m&&m.code==="ENOENT")a.mkdirsSync(h);else throw m}i.writeFileSync(r,"")}return Ce={createFile:e(c),createFileSync:u},Ce}var Ne,_t;function sr(){if(_t)return Ne;_t=1;const e=L().fromPromise,n=Z,i=Y(),a=re(),{pathExists:c}=oe(),{areIdentical:u}=ue();function r(h,m){return C(this,null,function*(){let E;try{E=yield i.lstat(m)}catch(_){}let w;try{w=yield i.lstat(h)}catch(_){throw _.message=_.message.replace("lstat","ensureLink"),_}if(E&&u(w,E))return;const s=n.dirname(m);(yield c(s))||(yield a.mkdirs(s)),yield i.link(h,m)})}function p(h,m){let E;try{E=i.lstatSync(m)}catch(f){}try{const f=i.lstatSync(h);if(E&&u(f,E))return}catch(f){throw f.message=f.message.replace("lstat","ensureLink"),f}const w=n.dirname(m);return i.existsSync(w)||a.mkdirsSync(w),i.linkSync(h,m)}return Ne={createLink:e(r),createLinkSync:p},Ne}var Te,gt;function fr(){if(gt)return Te;gt=1;const e=Z,n=Y(),{pathExists:i}=oe(),a=L().fromPromise;function c(r,p){return C(this,null,function*(){if(e.isAbsolute(r)){try{yield n.lstat(r)}catch(w){throw w.message=w.message.replace("lstat","ensureSymlink"),w}return{toCwd:r,toDst:r}}const h=e.dirname(p),m=e.join(h,r);if(yield i(m))return{toCwd:m,toDst:r};try{yield n.lstat(r)}catch(w){throw w.message=w.message.replace("lstat","ensureSymlink"),w}return{toCwd:r,toDst:e.relative(h,r)}})}function u(r,p){if(e.isAbsolute(r)){if(!n.existsSync(r))throw new Error("absolute srcpath does not exist");return{toCwd:r,toDst:r}}const h=e.dirname(p),m=e.join(h,r);if(n.existsSync(m))return{toCwd:m,toDst:r};if(!n.existsSync(r))throw new Error("relative srcpath does not exist");return{toCwd:r,toDst:e.relative(h,r)}}return Te={symlinkPaths:a(c),symlinkPathsSync:u},Te}var Me,bt;function lr(){if(bt)return Me;bt=1;const e=Y(),n=L().fromPromise;function i(c,u){return C(this,null,function*(){if(u)return u;let r;try{r=yield e.lstat(c)}catch(p){return"file"}return r&&r.isDirectory()?"dir":"file"})}function a(c,u){if(u)return u;let r;try{r=e.lstatSync(c)}catch(p){return"file"}return r&&r.isDirectory()?"dir":"file"}return Me={symlinkType:n(i),symlinkTypeSync:a},Me}var Le,Et;function yr(){if(Et)return Le;Et=1;const e=L().fromPromise,n=Z,i=Y(),{mkdirs:a,mkdirsSync:c}=re(),{symlinkPaths:u,symlinkPathsSync:r}=fr(),{symlinkType:p,symlinkTypeSync:h}=lr(),{pathExists:m}=oe(),{areIdentical:E}=ue();function w(f,_,y){return C(this,null,function*(){let t;try{t=yield i.lstat(_)}catch(S){}if(t&&t.isSymbolicLink()){const[S,v]=yield Promise.all([i.stat(f),i.stat(_)]);if(E(S,v))return}const o=yield u(f,_);f=o.toDst;const l=yield p(o.toCwd,y),d=n.dirname(_);return(yield m(d))||(yield a(d)),i.symlink(f,_,l)})}function s(f,_,y){let t;try{t=i.lstatSync(_)}catch(S){}if(t&&t.isSymbolicLink()){const S=i.statSync(f),v=i.statSync(_);if(E(S,v))return}const o=r(f,_);f=o.toDst,y=h(o.toCwd,y);const l=n.dirname(_);return i.existsSync(l)||c(l),i.symlinkSync(f,_,y)}return Le={createSymlink:e(w),createSymlinkSync:s},Le}var je,kt;function mr(){if(kt)return je;kt=1;const{createFile:e,createFileSync:n}=ur(),{createLink:i,createLinkSync:a}=sr(),{createSymlink:c,createSymlinkSync:u}=yr();return je={createFile:e,createFileSync:n,ensureFile:e,ensureFileSync:n,createLink:i,createLinkSync:a,ensureLink:i,ensureLinkSync:a,createSymlink:c,createSymlinkSync:u,ensureSymlink:c,ensureSymlinkSync:u},je}var Be,Ft;function Ae(){if(Ft)return Be;Ft=1;function e(i,{EOL:a=` `,finalEOL:c=!0,replacer:u=null,spaces:r}={}){const p=c?a:"";return JSON.stringify(i,u,r).replace(/\n/g,a)+p}function n(i){return Buffer.isBuffer(i)&&(i=i.toString("utf8")),i.replace(/^\uFEFF/,"")}return Be={stringify:e,stripBom:n},Be}var Ie,Pt;function dr(){if(Pt)return Ie;Pt=1;let e;try{e=le()}catch(w){e=tt}const n=L(),{stringify:i,stripBom:a}=Ae();function c(f){return C(this,arguments,function*(w,s={}){typeof s=="string"&&(s={encoding:s});const _=s.fs||e,y="throws"in s?s.throws:!0;let t=yield n.fromCallback(_.readFile)(w,s);t=a(t);let o;try{o=JSON.parse(t,s?s.reviver:null)}catch(l){if(y)throw l.message=`${w}: ${l.message}`,l;return null}return o})}const u=n.fromPromise(c);function r(w,s={}){typeof s=="string"&&(s={encoding:s});const f=s.fs||e,_="throws"in s?s.throws:!0;try{let y=f.readFileSync(w,s);return y=a(y),JSON.parse(y,s.reviver)}catch(y){if(_)throw y.message=`${w}: ${y.message}`,y;return null}}function p(_,y){return C(this,arguments,function*(w,s,f={}){const t=f.fs||e,o=i(s,f);yield n.fromCallback(t.writeFile)(w,o,f)})}const h=n.fromPromise(p);function m(w,s,f={}){const _=f.fs||e,y=i(s,f);return _.writeFileSync(w,y,f)}return Ie={readFile:u,readFileSync:r,writeFile:h,writeFileSync:m},Ie}var Ue,Ot;function hr(){if(Ot)return Ue;Ot=1;const e=dr();return Ue={readJson:e.readFile,readJsonSync:e.readFileSync,writeJson:e.writeFile,writeJsonSync:e.writeFileSync},Ue}var Je,xt;function We(){if(xt)return Je;xt=1;const e=L().fromPromise,n=Y(),i=Z,a=re(),c=oe().pathExists;function u(p,h,m="utf-8"){return C(this,null,function*(){const E=i.dirname(p);return(yield c(E))||(yield a.mkdirs(E)),n.writeFile(p,h,m)})}function r(p,...h){const m=i.dirname(p);n.existsSync(m)||a.mkdirsSync(m),n.writeFileSync(p,...h)}return Je={outputFile:e(u),outputFileSync:r},Je}var ze,Dt;function pr(){if(Dt)return ze;Dt=1;const{stringify:e}=Ae(),{outputFile:n}=We();function i(r,p){return C(this,arguments,function*(a,c,u={}){const h=e(c,u);yield n(a,h,u)})}return ze=i,ze}var Ge,Rt;function wr(){if(Rt)return Ge;Rt=1;const{stringify:e}=Ae(),{outputFileSync:n}=We();function i(a,c,u){const r=e(c,u);n(a,r,u)}return Ge=i,Ge}var Ye,$t;function vr(){if($t)return Ye;$t=1;const e=L().fromPromise,n=hr();return n.outputJson=e(pr()),n.outputJsonSync=wr(),n.outputJSON=n.outputJson,n.outputJSONSync=n.outputJsonSync,n.writeJSON=n.writeJson,n.writeJSONSync=n.writeJsonSync,n.readJSON=n.readJson,n.readJSONSync=n.readJsonSync,Ye=n,Ye}var Ve,qt;function Sr(){if(qt)return Ve;qt=1;const e=Y(),n=Z,{copy:i}=Re(),{remove:a}=he(),{mkdirp:c}=re(),{pathExists:u}=oe(),r=ue();function p(f,_){return C(this,arguments,function*(E,w,s={}){const y=s.overwrite||s.clobber||!1,{srcStat:t,isChangingCase:o=!1}=yield r.checkPaths(E,w,"move",s);yield r.checkParentPaths(E,t,w,"move");const l=n.dirname(w);return n.parse(l).root!==l&&(yield c(l)),h(E,w,y,o)})}function h(E,w,s,f){return C(this,null,function*(){if(!f){if(s)yield a(w);else if(yield u(w))throw new Error("dest already exists.")}try{yield e.rename(E,w)}catch(_){if(_.code!=="EXDEV")throw _;yield m(E,w,s)}})}function m(E,w,s){return C(this,null,function*(){return yield i(E,w,{overwrite:s,errorOnExist:!0,preserveTimestamps:!0}),a(E)})}return Ve=p,Ve}var Xe,Ct;function _r(){if(Ct)return Xe;Ct=1;const e=le(),n=Z,i=Re().copySync,a=he().removeSync,c=re().mkdirpSync,u=ue();function r(w,s,f){f=f||{};const _=f.overwrite||f.clobber||!1,{srcStat:y,isChangingCase:t=!1}=u.checkPathsSync(w,s,"move",f);return u.checkParentPathsSync(w,y,s,"move"),p(s)||c(n.dirname(s)),h(w,s,_,t)}function p(w){const s=n.dirname(w);return n.parse(s).root===s}function h(w,s,f,_){if(_)return m(w,s,f);if(f)return a(s),m(w,s,f);if(e.existsSync(s))throw new Error("dest already exists.");return m(w,s,f)}function m(w,s,f){try{e.renameSync(w,s)}catch(_){if(_.code!=="EXDEV")throw _;return E(w,s,f)}}function E(w,s,f){return i(w,s,{overwrite:f,errorOnExist:!0,preserveTimestamps:!0}),a(w)}return Xe=r,Xe}var He,Nt;function gr(){if(Nt)return He;Nt=1;const e=L().fromPromise;return He={move:e(Sr()),moveSync:_r()},He}var Ke,Tt;function br(){return Tt||(Tt=1,Ke=H(H(H(H(H(H(H(H(H(H({},Y()),Re()),cr()),mr()),vr()),re()),gr()),We()),oe()),he())),Ke}var Er=br();const se=B(Er);/*! idmp v3.4.4 | (c) github/haozi | MIT */const kr=3e3,Mt=6048e5,Fr=()=>{},Pr=e=>e<0?0:e>Mt?Mt:e,Or=e=>{const{maxRetry:n=30,maxAge:i=kr,minRetryDelay:a=50,maxRetryDelay:c=5e3,onBeforeRetry:u=Fr,signal:r}=e||{},p=Pr(i);return{maxRetry:n,maxAge:p,minRetryDelay:a,maxRetryDelay:c,onBeforeRetry:u,f:i===1/0,signal:r}},xr=new Proxy({},{get(e,n){throw new Error(`Module "node:os" has been externalized for browser compatibility. Cannot access "node:os.${n}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}}),Lt=new Proxy({},{get(e,n){throw new Error(`Module "node:path" has been externalized for browser compatibility. Cannot access "node:path.${n}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}});var pe={exports:{}},we={exports:{}};const Dr=new Proxy({},{get(e,n){throw new Error(`Module "buffer" has been externalized for browser compatibility. Cannot access "buffer.${n}" in client code. See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.`)}}),Rr=K(Object.freeze(Object.defineProperty({__proto__:null,default:Dr},Symbol.toStringTag,{value:"Module"})));/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var jt;function $r(){return jt||(jt=1,function(e,n){var i=Rr,a=i.Buffer;function c(r,p){for(var h in r)p[h]=r[h]}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=i:(c(i,n),n.Buffer=u);function u(r,p,h){return a(r,p,h)}u.prototype=Object.create(a.prototype),c(a,u),u.from=function(r,p,h){if(typeof r=="number")throw new TypeError("Argument must not be a number");return a(r,p,h)},u.alloc=function(r,p,h){if(typeof r!="number")throw new TypeError("Argument must be a number");var m=a(r);return p!==void 0?typeof h=="string"?m.fill(p,h):m.fill(p):m.fill(0),m},u.allocUnsafe=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return a(r)},u.allocUnsafeSlow=function(r){if(typeof r!="number")throw new TypeError("Argument must be a number");return i.SlowBuffer(r)}}(we,we.exports)),we.exports}var Bt;function qr(){if(Bt)return pe.exports;Bt=1;var e=65536,n=4294967295;function i(){throw new Error(`Secure random number generation is not supported by this browser. Use Chrome, Firefox or Internet Explorer 11`)}var a=$r().Buffer,c=D.crypto||D.msCrypto;c&&c.getRandomValues?pe.exports=u:pe.exports=i;function u(r,p){if(r>n)throw new RangeError("requested too many random bytes");var h=a.allocUnsafe(r);if(r>0)if(r>e)for(var m=0;m<r;m+=e)c.getRandomValues(h.slice(m,m+e));else c.getRandomValues(h);return typeof p=="function"?process.nextTick(function(){p(null,h)}):h}return pe.exports}var Qe,At;function Cr(){if(At)return Qe;At=1;var e=qr(),n=16,i=w(),a=new RegExp('(\\\\)?"@__(F|R|D|M|S|A|U|I|B|L)-'+i+'-(\\d+)__@"',"g"),c=/\{\s*\[native code\]\s*\}/g,u=/function.*?\(/,r=/.*?=>.*?/,p=/[<>\/\u2028\u2029]/g,h=["*","async"],m={"<":"\\u003C",">":"\\u003E","/":"\\u002F","\u2028":"\\u2028","\u2029":"\\u2029"};function E(f){return m[f]}function w(){for(var f=e(n),_="",y=0;y<n;++y)_+=f[y].toString(16);return _}function s(f){var _=[];for(var y in f)typeof f[y]=="function"&&_.push(y);for(var t=0;t<_.length;t++)delete f[_[t]]}return Qe=function f(_,y){y||(y={}),(typeof y=="number"||typeof y=="string")&&(y={space:y});var t=[],o=[],l=[],d=[],S=[],v=[],b=[],g=[],k=[],F=[];function x(ee,A){if(y.ignoreFunction&&s(A),!A&&A!==void 0&&A!==BigInt(0))return A;var O=this[ee],T=typeof O;if(T==="object"){if(O instanceof RegExp)return"@__R-"+i+"-"+(o.push(O)-1)+"__@";if(O instanceof Date)return"@__D-"+i+"-"+(l.push(O)-1)+"__@";if(O instanceof Map)return"@__M-"+i+"-"+(d.push(O)-1)+"__@";if(O instanceof Set)return"@__S-"+i+"-"+(S.push(O)-1)+"__@";if(O instanceof Array){var G=O.filter(function(){return!0}).length!==O.length;if(G)return"@__A-"+i+"-"+(v.push(O)-1)+"__@"}if(O instanceof URL)return"@__L-"+i+"-"+(F.push(O)-1)+"__@"}return T==="function"?"@__F-"+i+"-"+(t.push(O)-1)+"__@":T==="undefined"?"@__U-"+i+"-"+(b.push(O)-1)+"__@":T==="number"&&!isNaN(O)&&!isFinite(O)?"@__I-"+i+"-"+(g.push(O)-1)+"__@":T==="bigint"?"@__B-"+i+"-"+(k.push(O)-1)+"__@":A}function V(ee){var A=ee.toString();if(c.test(A))throw new TypeError("Serializing native function: "+ee.name);if(u.test(A)||r.test(A))return A;var O=A.indexOf("("),T=A.substr(0,O).trim().split(" ").filter(function(ye){return ye.length>0}),G=T.filter(function(ye){return h.indexOf(ye)===-1});return G.length>0?(T.indexOf("async")>-1?"async ":"")+"function"+(T.join("").indexOf("*")>-1?"*":"")+A.substr(O):A}if(y.ignoreFunction&&typeof _=="function"&&(_=void 0),_===void 0)return String(_);var X;return y.isJSON&&!y.space?X=JSON.stringify(_):X=JSON.stringify(_,y.isJSON?null:x,y.space),typeof X!="string"?String(X):(y.unsafe!==!0&&(X=X.replace(p,E)),t.length===0&&o.length===0&&l.length===0&&d.length===0&&S.length===0&&v.length===0&&b.length===0&&g.length===0&&k.length===0&&F.length===0?X:X.replace(a,function(ee,A,O,T){if(A)return ee;if(O==="D")return'new Date("'+l[T].toISOString()+'")';if(O==="R")return"new RegExp("+f(o[T].source)+', "'+o[T].flags+'")';if(O==="M")return"new Map("+f(Array.from(d[T].entries()),y)+")";if(O==="S")return"new Set("+f(Array.from(S[T].values()),y)+")";if(O==="A")return"Array.prototype.slice.call("+f(Object.assign({length:v[T].length},v[T]),y)+")";if(O==="U")return"undefined";if(O==="I")return g[T];if(O==="B")return'BigInt("'+k[T]+'")';if(O==="L")return"new URL("+f(F[T].toString(),y)+")";var G=t[T];return V(G)}))},Qe}var Nr=Cr();const Tr=B(Nr),Mr=e=>new Function(`return ${e}`)(),fe=void 0,Lr=encodeURIComponent,Ze=Lt.resolve(xr.tmpdir(),"idmp"),ve=e=>Lt.resolve(Ze,"v1/node",Lr(e)),jr=(e,n,i)=>C(null,null,function*(){if(!e)return;const a=ve(e);se.ensureFileSync(a),se.outputFileSync(a,Tr({t:Date.now(),a:i,d:n}))}),Br=e=>C(null,null,function*(){if(!e)return fe;const n=ve(e);let i;try{i=Mr(se.readFileSync(n,"utf-8"))}catch(r){}if(i===fe)return fe;const{t:a,a:c,d:u}=i;return Date.now()-a>c?(se.removeSync(n),fe):u}),Ar=(e,n="")=>{const i=(a,c,u)=>{a=`${n}_${a}`;const r=Or(u);return e(a,()=>C(null,null,function*(){const p=yield Br(a);if(p!==fe)return p;const h=yield c();return h!==fe&&jr(a,h,r.maxAge),h}),u)};return i.flush=a=>{e.flush(a),se.removeSync(ve(a))},i.flushAll=()=>{e.flushAll(),se.removeSync(Ze)},i};q.cacheDir=Ze,q.default=Ar,q.getCachePath=ve,Object.defineProperties(q,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});