@easbot/utils 0.1.7 → 0.1.11

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.
@@ -0,0 +1,66 @@
1
+ 'use strict';var chunkPQC2BFS2_cjs=require('./chunk-PQC2BFS2.cjs');var fr=chunkPQC2BFS2_cjs.b((hr,gt)=>{chunkPQC2BFS2_cjs.j();var qe=Object.defineProperty,vt=Object.getOwnPropertyDescriptor,xt=Object.getOwnPropertyNames,kt=Object.prototype.hasOwnProperty,$t=(e,t)=>{for(var r in t)qe(e,r,{get:t[r],enumerable:true});},St=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of xt(t))!kt.call(e,o)&&o!==r&&qe(e,o,{get:()=>t[o],enumerable:!(n=vt(t,o))||n.enumerable});return e},Et=e=>St(qe({},"__esModule",{value:true}),e),Pe={};$t(Pe,{analyzeMetafile:()=>rr,analyzeMetafileSync:()=>ar,build:()=>Xt,buildSync:()=>nr,context:()=>Zt,default:()=>cr,formatMessages:()=>tr,formatMessagesSync:()=>lr,initialize:()=>sr,stop:()=>or,transform:()=>er,transformSync:()=>ir,version:()=>Gt});gt.exports=Et(Pe);function Ve(e){let t=n=>{if(n===null)r.write8(0);else if(typeof n=="boolean")r.write8(1),r.write8(+n);else if(typeof n=="number")r.write8(2),r.write32(n|0);else if(typeof n=="string")r.write8(3),r.write(ie(n));else if(n instanceof Uint8Array)r.write8(4),r.write(n);else if(n instanceof Array){r.write8(5),r.write32(n.length);for(let o of n)t(o);}else {let o=Object.keys(n);r.write8(6),r.write32(o.length);for(let s of o)r.write(ie(s)),t(n[s]);}},r=new rt;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Ue(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function At(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return !!r.read8();case 2:return r.read32();case 3:return we(r.read());case 4:return r.read();case 5:{let a=r.read32(),d=[];for(let i=0;i<a;i++)d.push(t());return d}case 6:{let a=r.read32(),d={};for(let i=0;i<a;i++)d[we(r.read())]=t();return d}default:throw new Error("Invalid packet")}},r=new rt(e),n=r.read32(),o=(n&1)===0;n>>>=1;let s=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return {id:n,isRequest:o,value:s}}var rt=class{constructor(e=new Uint8Array(1024)){this.buf=e,this.len=0,this.ptr=0;}_write(e){if(this.len+e>this.buf.length){let t=new Uint8Array((this.len+e)*2);t.set(this.buf),this.buf=t;}return this.len+=e,this.len-e}write8(e){let t=this._write(1);this.buf[t]=e;}write32(e){let t=this._write(4);Ue(this.buf,e,t);}write(e){let t=this._write(4+e.length);Ue(this.buf,e.length,t),this.buf.set(e,t+4);}_read(e){if(this.ptr+e>this.buf.length)throw new Error("Invalid packet");return this.ptr+=e,this.ptr-e}read8(){return this.buf[this._read(1)]}read32(){return nt(this.buf,this._read(4))}read(){let e=this.read32(),t=new Uint8Array(e),r=this._read(t.length);return t.set(this.buf.subarray(r,r+e)),t}},ie,we,Re;if(typeof TextEncoder<"u"&&typeof TextDecoder<"u"){let e=new TextEncoder,t=new TextDecoder;ie=r=>e.encode(r),we=r=>t.decode(r),Re='new TextEncoder().encode("")';}else if(typeof Buffer<"u")ie=e=>Buffer.from(e),we=e=>{let{buffer:t,byteOffset:r,byteLength:n}=e;return Buffer.from(t,r,n).toString()},Re='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(ie("")instanceof Uint8Array))throw new Error(`Invariant violation: "${Re} instanceof Uint8Array" is incorrectly false
2
+
3
+ This indicates that your JavaScript environment is broken. You cannot use
4
+ esbuild in this environment because esbuild relies on this invariant. This
5
+ is not a problem with esbuild. You need to fix your environment instead.
6
+ `);function nt(e,t){return (e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24)>>>0}function Ue(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24;}var ue=String.fromCharCode;function re(e,t,r){let n=e[t],o=1,s=0;for(let a=0;a<t;a++)e[a]===10?(o++,s=0):s++;throw new SyntaxError(r||(t===e.length?"Unexpected end of input while parsing JSON":n>=32&&n<=126?`Unexpected character ${ue(n)} in JSON at position ${t} (line ${o}, column ${s})`:`Unexpected byte 0x${n.toString(16)} in JSON at position ${t} (line ${o}, column ${s})`))}function Pt(e){if(!(e instanceof Uint8Array))throw new Error("JSON input must be a Uint8Array");let t=[],r=[],n=[],o=e.length,s=null,a=0,d,i=0;for(;i<o;){let c=e[i++];if(c<=32)continue;let u;switch(a===2&&s===null&&c!==34&&c!==125&&re(e,--i),c){case 116:{(e[i++]!==114||e[i++]!==117||e[i++]!==101)&&re(e,--i),u=true;break}case 102:{(e[i++]!==97||e[i++]!==108||e[i++]!==115||e[i++]!==101)&&re(e,--i),u=false;break}case 110:{(e[i++]!==117||e[i++]!==108||e[i++]!==108)&&re(e,--i),u=null;break}case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:{let y=i;for(u=ue(c),c=e[i];;){switch(c){case 43:case 45:case 46:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:case 101:case 69:{u+=ue(c),c=e[++i];continue}}break}u=+u,isNaN(u)&&re(e,--y,"Invalid number");break}case 34:{for(u="";i>=o&&re(e,o),c=e[i++],c!==34;)if(c===92)switch(e[i++]){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
7
+ `;break;case 114:u+="\r";break;case 116:u+=" ";break;case 117:{let y=0;for(let B=0;B<4;B++)c=e[i++],y<<=4,c>=48&&c<=57?y|=c-48:c>=97&&c<=102?y|=c+-87:c>=65&&c<=70?y|=c+-55:re(e,--i);u+=ue(y);break}default:re(e,--i);break}else if(c<=127)u+=ue(c);else if((c&224)===192)u+=ue((c&31)<<6|e[i++]&63);else if((c&240)===224)u+=ue((c&15)<<12|(e[i++]&63)<<6|e[i++]&63);else if((c&248)==240){let y=(c&7)<<18|(e[i++]&63)<<12|(e[i++]&63)<<6|e[i++]&63;y>65535&&(y-=65536,u+=ue(y>>10&1023|55296),y=56320|y&1023),u+=ue(y);}u[0];break}case 91:{u=[],t.push(s),r.push(d),n.push(a),s=null,d=u,a=1;continue}case 123:{u={},t.push(s),r.push(d),n.push(a),s=null,d=u,a=2;continue}case 93:{a!==1&&re(e,--i),u=d,s=t.pop(),d=r.pop(),a=n.pop();break}case 125:{a!==2&&re(e,--i),u=d,s=t.pop(),d=r.pop(),a=n.pop();break}default:re(e,--i);}for(c=e[i];c<=32;)c=e[++i];switch(a){case 0:{if(i===o)return u;break}case 1:{if(d.push(u),c===44){i++;continue}if(c===93)continue;break}case 2:{if(s===null){if(s=u,c===58){i++;continue}}else {if(d[s]=u,s=null,c===44){i++;continue}if(c===125)continue}break}}break}re(e,i);}var V=JSON.stringify,Ye="warning",He="silent";function xe(e,t){let r=[];for(let n of e){if(G(n,t),n.indexOf(",")>=0)throw new Error(`Invalid ${t}: ${n}`);r.push(n);}return r.join(",")}var Me=()=>null,U=e=>typeof e=="boolean"?null:"a boolean",b=e=>typeof e=="string"?null:"a string",De=e=>e instanceof RegExp?null:"a RegExp object",me=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Ot=e=>typeof e=="number"&&e===(e|0)&&e>=0&&e<=65535?null:"a valid port number",it=e=>typeof e=="function"?null:"a function",ce=e=>Array.isArray(e)?null:"an array",X=e=>Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"an array of strings",Z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",jt=e=>typeof e=="object"&&e!==null?null:"an array or an object",Ct=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Ke=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",lt=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Mt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",at=e=>typeof e=="string"||Array.isArray(e)&&e.every(t=>typeof t=="string")?null:"a string or an array of strings",ot=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Dt=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function l(e,t,r,n){let o=e[r];if(t[r+""]=true,o===void 0)return;let s=n(o);if(s!==null)throw new Error(`${V(r)} must be ${s}`);return o}function J(e,t,r){for(let n in e)if(!(n in t))throw new Error(`Invalid option ${r}: ${V(n)}`)}function Lt(e){let t=Object.create(null),r=l(e,t,"wasmURL",Dt),n=l(e,t,"wasmModule",Ct),o=l(e,t,"worker",U);return J(e,t,"in initialize() call"),{wasmURL:r,wasmModule:n,worker:o}}function st(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let n=e[r];if(typeof n=="string"||n===false)t[r]=n;else throw new Error(`Expected ${V(r)} in mangle cache to map to either a string or false`)}}return t}function Be(e,t,r,n,o){let s=l(t,r,"color",U),a=l(t,r,"logLevel",b),d=l(t,r,"logLimit",me);s!==void 0?e.push(`--color=${s}`):n&&e.push("--color=true"),e.push(`--log-level=${a||o}`),e.push(`--log-limit=${d||0}`);}function G(e,t,r){if(typeof e!="string")throw new Error(`Expected value for ${t}${r!==void 0?" "+V(r):""} to be a string, got ${typeof e} instead`);return e}function ut(e,t,r){let n=l(t,r,"legalComments",b),o=l(t,r,"sourceRoot",b),s=l(t,r,"sourcesContent",U),a=l(t,r,"target",at),d=l(t,r,"format",b),i=l(t,r,"globalName",b),c=l(t,r,"mangleProps",De),u=l(t,r,"reserveProps",De),y=l(t,r,"mangleQuoted",U),B=l(t,r,"minify",U),_=l(t,r,"minifySyntax",U),N=l(t,r,"minifyWhitespace",U),I=l(t,r,"minifyIdentifiers",U),L=l(t,r,"lineLimit",me),W=l(t,r,"drop",X),z=l(t,r,"dropLabels",X),k=l(t,r,"charset",b),w=l(t,r,"treeShaking",U),p=l(t,r,"ignoreAnnotations",U),f=l(t,r,"jsx",b),$=l(t,r,"jsxFactory",b),E=l(t,r,"jsxFragment",b),C=l(t,r,"jsxImportSource",b),A=l(t,r,"jsxDev",U),h=l(t,r,"jsxSideEffects",U),m=l(t,r,"define",Z),x=l(t,r,"logOverride",Z),O=l(t,r,"supported",Z),M=l(t,r,"pure",X),P=l(t,r,"keepNames",U),S=l(t,r,"platform",b),j=l(t,r,"tsconfigRaw",Mt),R=l(t,r,"absPaths",X);if(n&&e.push(`--legal-comments=${n}`),o!==void 0&&e.push(`--source-root=${o}`),s!==void 0&&e.push(`--sources-content=${s}`),a&&e.push(`--target=${xe(Array.isArray(a)?a:[a],"target")}`),d&&e.push(`--format=${d}`),i&&e.push(`--global-name=${i}`),S&&e.push(`--platform=${S}`),j&&e.push(`--tsconfig-raw=${typeof j=="string"?j:JSON.stringify(j)}`),B&&e.push("--minify"),_&&e.push("--minify-syntax"),N&&e.push("--minify-whitespace"),I&&e.push("--minify-identifiers"),L&&e.push(`--line-limit=${L}`),k&&e.push(`--charset=${k}`),w!==void 0&&e.push(`--tree-shaking=${w}`),p&&e.push("--ignore-annotations"),W)for(let g of W)e.push(`--drop:${G(g,"drop")}`);if(z&&e.push(`--drop-labels=${xe(z,"drop label")}`),R&&e.push(`--abs-paths=${xe(R,"abs paths")}`),c&&e.push(`--mangle-props=${Le(c)}`),u&&e.push(`--reserve-props=${Le(u)}`),y!==void 0&&e.push(`--mangle-quoted=${y}`),f&&e.push(`--jsx=${f}`),$&&e.push(`--jsx-factory=${$}`),E&&e.push(`--jsx-fragment=${E}`),C&&e.push(`--jsx-import-source=${C}`),A&&e.push("--jsx-dev"),h&&e.push("--jsx-side-effects"),m)for(let g in m){if(g.indexOf("=")>=0)throw new Error(`Invalid define: ${g}`);e.push(`--define:${g}=${G(m[g],"define",g)}`);}if(x)for(let g in x){if(g.indexOf("=")>=0)throw new Error(`Invalid log override: ${g}`);e.push(`--log-override:${g}=${G(x[g],"log override",g)}`);}if(O)for(let g in O){if(g.indexOf("=")>=0)throw new Error(`Invalid supported: ${g}`);let F=O[g];if(typeof F!="boolean")throw new Error(`Expected value for supported ${V(g)} to be a boolean, got ${typeof F} instead`);e.push(`--supported:${g}=${F}`);}if(M)for(let g of M)e.push(`--pure:${G(g,"pure")}`);P&&e.push("--keep-names");}function Tt(e,t,r,n,o){var s;let a=[],d=[],i=Object.create(null),c=null,u=null;Be(a,t,i,r,n),ut(a,t,i);let y=l(t,i,"sourcemap",lt),B=l(t,i,"bundle",U),_=l(t,i,"splitting",U),N=l(t,i,"preserveSymlinks",U),I=l(t,i,"metafile",U),L=l(t,i,"outfile",b),W=l(t,i,"outdir",b),z=l(t,i,"outbase",b),k=l(t,i,"tsconfig",b),w=l(t,i,"resolveExtensions",X),p=l(t,i,"nodePaths",X),f=l(t,i,"mainFields",X),$=l(t,i,"conditions",X),E=l(t,i,"external",X),C=l(t,i,"packages",b),A=l(t,i,"alias",Z),h=l(t,i,"loader",Z),m=l(t,i,"outExtension",Z),x=l(t,i,"publicPath",b),O=l(t,i,"entryNames",b),M=l(t,i,"chunkNames",b),P=l(t,i,"assetNames",b),S=l(t,i,"inject",X),j=l(t,i,"banner",Z),R=l(t,i,"footer",Z),g=l(t,i,"entryPoints",jt),F=l(t,i,"absWorkingDir",b),T=l(t,i,"stdin",Z),D=(s=l(t,i,"write",U))!=null?s:o,Q=l(t,i,"allowOverwrite",U),q=l(t,i,"mangleCache",Z);if(i.plugins=true,J(t,i,`in ${e}() call`),y&&a.push(`--sourcemap${y===true?"":`=${y}`}`),B&&a.push("--bundle"),Q&&a.push("--allow-overwrite"),_&&a.push("--splitting"),N&&a.push("--preserve-symlinks"),I&&a.push("--metafile"),L&&a.push(`--outfile=${L}`),W&&a.push(`--outdir=${W}`),z&&a.push(`--outbase=${z}`),k&&a.push(`--tsconfig=${k}`),C&&a.push(`--packages=${C}`),w&&a.push(`--resolve-extensions=${xe(w,"resolve extension")}`),x&&a.push(`--public-path=${x}`),O&&a.push(`--entry-names=${O}`),M&&a.push(`--chunk-names=${M}`),P&&a.push(`--asset-names=${P}`),f&&a.push(`--main-fields=${xe(f,"main field")}`),$&&a.push(`--conditions=${xe($,"condition")}`),E)for(let v of E)a.push(`--external:${G(v,"external")}`);if(A)for(let v in A){if(v.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${v}`);a.push(`--alias:${v}=${G(A[v],"alias",v)}`);}if(j)for(let v in j){if(v.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${v}`);a.push(`--banner:${v}=${G(j[v],"banner",v)}`);}if(R)for(let v in R){if(v.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${v}`);a.push(`--footer:${v}=${G(R[v],"footer",v)}`);}if(S)for(let v of S)a.push(`--inject:${G(v,"inject")}`);if(h)for(let v in h){if(v.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${v}`);a.push(`--loader:${v}=${G(h[v],"loader",v)}`);}if(m)for(let v in m){if(v.indexOf("=")>=0)throw new Error(`Invalid out extension: ${v}`);a.push(`--out-extension:${v}=${G(m[v],"out extension",v)}`);}if(g)if(Array.isArray(g))for(let v=0,oe=g.length;v<oe;v++){let ee=g[v];if(typeof ee=="object"&&ee!==null){let le=Object.create(null),se=l(ee,le,"in",b),te=l(ee,le,"out",b);if(J(ee,le,"in entry point at index "+v),se===void 0)throw new Error('Missing property "in" for entry point at index '+v);if(te===void 0)throw new Error('Missing property "out" for entry point at index '+v);d.push([te,se]);}else d.push(["",G(ee,"entry point at index "+v)]);}else for(let v in g)d.push([v,G(g[v],"entry point",v)]);if(T){let v=Object.create(null),oe=l(T,v,"contents",ot),ee=l(T,v,"resolveDir",b),le=l(T,v,"sourcefile",b),se=l(T,v,"loader",b);J(T,v,'in "stdin" object'),le&&a.push(`--sourcefile=${le}`),se&&a.push(`--loader=${se}`),ee&&(u=ee),typeof oe=="string"?c=ie(oe):oe instanceof Uint8Array&&(c=oe);}let ae=[];if(p)for(let v of p)v+="",ae.push(v);return {entries:d,flags:a,write:D,stdinContents:c,stdinResolveDir:u,absWorkingDir:F,nodePaths:ae,mangleCache:st(q)}}function Ft(e,t,r,n){let o=[],s=Object.create(null);Be(o,t,s,r,n),ut(o,t,s);let a=l(t,s,"sourcemap",lt),d=l(t,s,"sourcefile",b),i=l(t,s,"loader",b),c=l(t,s,"banner",b),u=l(t,s,"footer",b),y=l(t,s,"mangleCache",Z);return J(t,s,`in ${e}() call`),a&&o.push(`--sourcemap=${a===true?"external":a}`),d&&o.push(`--sourcefile=${d}`),i&&o.push(`--loader=${i}`),c&&o.push(`--banner=${c}`),u&&o.push(`--footer=${u}`),{flags:o,mangleCache:st(y)}}function ct(e){let t={},r={didClose:false,reason:""},n={},o=0,s=0,a=new Uint8Array(16*1024),d=0,i=k=>{let w=d+k.length;if(w>a.length){let f=new Uint8Array(w*2);f.set(a),a=f;}a.set(k,d),d+=k.length;let p=0;for(;p+4<=d;){let f=nt(a,p);if(p+4+f>d)break;p+=4,N(a.subarray(p,p+f)),p+=f;}p>0&&(a.copyWithin(0,p,d),d-=p);},c=k=>{r.didClose=true,k&&(r.reason=": "+(k.message||k));let w="The service was stopped"+r.reason;for(let p in n)n[p](w,null);n={};},u=(k,w,p)=>{if(r.didClose)return p("The service is no longer running"+r.reason,null);let f=o++;n[f]=($,E)=>{try{p($,E);}finally{k&&k.unref();}},k&&k.ref(),e.writeToStdin(Ve({id:f,isRequest:true,value:w}));},y=(k,w)=>{if(r.didClose)throw new Error("The service is no longer running"+r.reason);e.writeToStdin(Ve({id:k,isRequest:false,value:w}));},B=async(k,w)=>{try{if(w.command==="ping"){y(k,{});return}if(typeof w.key=="number"){let p=t[w.key];if(!p)return;let f=p[w.command];if(f){await f(k,w);return}}throw new Error("Invalid command: "+w.command)}catch(p){let f=[he(p,e,null,void 0,"")];try{y(k,{errors:f});}catch{}}},_=true,N=k=>{if(_){_=false;let p=String.fromCharCode(...k);if(p!=="0.27.4")throw new Error(`Cannot start service: Host version "0.27.4" does not match binary version ${V(p)}`);return}let w=At(k);if(w.isRequest)B(w.id,w.value);else {let p=n[w.id];delete n[w.id],w.value.error?p(w.value.error,{}):p(null,w.value);}};return {readFromStdout:i,afterClose:c,service:{buildOrContext:({callName:k,refs:w,options:p,isTTY:f,defaultWD:$,callback:E})=>{let C=0,A=s++,h={},m={ref(){++C===1&&w&&w.ref();},unref(){--C===0&&(delete t[A],w&&w.unref());}};t[A]=h,m.ref(),_t(k,A,u,y,m,e,h,p,f,$,(x,O)=>{try{E(x,O);}finally{m.unref();}});},transform:({callName:k,refs:w,input:p,options:f,isTTY:$,fs:E,callback:C})=>{let A=ft(),h=m=>{try{if(typeof p!="string"&&!(p instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:x,mangleCache:O}=Ft(k,f,$,He),M={command:"transform",flags:x,inputFS:m!==null,input:m!==null?ie(m):typeof p=="string"?ie(p):p};O&&(M.mangleCache=O),u(w,M,(P,S)=>{if(P)return C(new Error(P),null);let j=ke(S.errors,A),R=ke(S.warnings,A),g=1,F=()=>{if(--g===0){let T={warnings:R,code:S.code,map:S.map,mangleCache:void 0,legalComments:void 0};"legalComments"in S&&(T.legalComments=S?.legalComments),S.mangleCache&&(T.mangleCache=S?.mangleCache),C(null,T);}};if(j.length>0)return C(Ee("Transform failed",j,R),null);S.codeFS&&(g++,E.readFile(S.code,(T,D)=>{T!==null?C(T,null):(S.code=D,F());})),S.mapFS&&(g++,E.readFile(S.map,(T,D)=>{T!==null?C(T,null):(S.map=D,F());})),F();});}catch(x){let O=[];try{Be(O,f,{},$,He);}catch{}let M=he(x,e,A,void 0,"");u(w,{command:"error",flags:O,error:M},()=>{M.detail=A.load(M.detail),C(Ee("Transform failed",[M],[]),null);});}};if((typeof p=="string"||p instanceof Uint8Array)&&p.length>1024*1024){let m=h;h=()=>E.writeFile(p,m);}h(null);},formatMessages:({callName:k,refs:w,messages:p,options:f,callback:$})=>{if(!f)throw new Error(`Missing second argument in ${k}() call`);let E={},C=l(f,E,"kind",b),A=l(f,E,"color",U),h=l(f,E,"terminalWidth",me);if(J(f,E,`in ${k}() call`),C===void 0)throw new Error(`Missing "kind" in ${k}() call`);if(C!=="error"&&C!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${k}() call`);let m={command:"format-msgs",messages:fe(p,"messages",null,"",h),isWarning:C==="warning"};A!==void 0&&(m.color=A),h!==void 0&&(m.terminalWidth=h),u(w,m,(x,O)=>{if(x)return $(new Error(x),null);$(null,O.messages);});},analyzeMetafile:({callName:k,refs:w,metafile:p,options:f,callback:$})=>{f===void 0&&(f={});let E={},C=l(f,E,"color",U),A=l(f,E,"verbose",U);J(f,E,`in ${k}() call`);let h={command:"analyze-metafile",metafile:p};C!==void 0&&(h.color=C),A!==void 0&&(h.verbose=A),u(w,h,(m,x)=>{if(m)return $(new Error(m),null);$(null,x.result);});}}}}function _t(e,t,r,n,o,s,a,d,i,c,u){let y=ft(),B=e==="context",_=(L,W)=>{let z=[];try{Be(z,d,{},i,Ye);}catch{}let k=he(L,s,y,void 0,W);r(o,{command:"error",flags:z,error:k},()=>{k.detail=y.load(k.detail),u(Ee(B?"Context failed":"Build failed",[k],[]),null);});},N;if(typeof d=="object"){let L=d.plugins;if(L!==void 0){if(!Array.isArray(L))return _(new Error('"plugins" must be an array'),"");N=L;}}if(N&&N.length>0){if(s.isSync)return _(new Error("Cannot use plugins in synchronous API calls"),"");Bt(t,r,n,o,s,a,d,N,y).then(L=>{if(!L.ok)return _(L.error,L.pluginName);try{I(L.requestPlugins,L.runOnEndCallbacks,L.scheduleOnDisposeCallbacks);}catch(W){_(W,"");}},L=>_(L,""));return}try{I(null,(L,W)=>W([],[]),()=>{});}catch(L){_(L,"");}function I(L,W,z){let k=s.hasFS,{entries:w,flags:p,write:f,stdinContents:$,stdinResolveDir:E,absWorkingDir:C,nodePaths:A,mangleCache:h}=Tt(e,d,i,Ye,k);if(f&&!s.hasFS)throw new Error('The "write" option is unavailable in this environment');let m={command:"build",key:t,entries:w,flags:p,write:f,stdinContents:$,stdinResolveDir:E,absWorkingDir:C||c,nodePaths:A,context:B};L&&(m.plugins=L),h&&(m.mangleCache=h);let x=(P,S)=>{let j={errors:ke(P.errors,y),warnings:ke(P.warnings,y),outputFiles:void 0,metafile:void 0,mangleCache:void 0},R=j.errors.slice(),g=j.warnings.slice();P.outputFiles&&(j.outputFiles=P.outputFiles.map(It)),P.metafile&&(j.metafile=Rt(P.metafile)),P.mangleCache&&(j.mangleCache=P.mangleCache),P.writeToStdout!==void 0&&console.log(we(P.writeToStdout).replace(/\n$/,"")),W(j,(F,T)=>{if(R.length>0||F.length>0){let D=Ee("Build failed",R.concat(F),g.concat(T));return S(D,null,F,T)}S(null,j,F,T);});},O,M;B&&(a["on-end"]=(P,S)=>new Promise(j=>{x(S,(R,g,F,T)=>{let D={errors:F,warnings:T};M&&M(R,g),O=void 0,M=void 0,n(P,D),j();});})),r(o,m,(P,S)=>{if(P)return u(new Error(P),null);if(!B)return x(S,(g,F)=>(z(),u(g,F)));if(S.errors.length>0)return u(Ee("Context failed",S.errors,S.warnings),null);let j=false,R={rebuild:()=>(O||(O=new Promise((g,F)=>{let T;M=(Q,q)=>{T||(T=()=>Q?F(Q):g(q));};let D=()=>{r(o,{command:"rebuild",key:t},(q,ae)=>{q?F(new Error(q)):T?T():D();});};D();})),O),watch:(g={})=>new Promise((F,T)=>{if(!s.hasFS)throw new Error('Cannot use the "watch" API in this environment');let D={},Q=l(g,D,"delay",me);J(g,D,"in watch() call");let q={command:"watch",key:t};Q&&(q.delay=Q),r(o,q,ae=>{ae?T(new Error(ae)):F(void 0);});}),serve:(g={})=>new Promise((F,T)=>{if(!s.hasFS)throw new Error('Cannot use the "serve" API in this environment');let D={},Q=l(g,D,"port",Ot),q=l(g,D,"host",b),ae=l(g,D,"servedir",b),v=l(g,D,"keyfile",b),oe=l(g,D,"certfile",b),ee=l(g,D,"fallback",b),le=l(g,D,"cors",Z),se=l(g,D,"onRequest",it);J(g,D,"in serve() call");let te={command:"serve",key:t,onRequest:!!se};if(Q!==void 0&&(te.port=Q),q!==void 0&&(te.host=q),ae!==void 0&&(te.servedir=ae),v!==void 0&&(te.keyfile=v),oe!==void 0&&(te.certfile=oe),ee!==void 0&&(te.fallback=ee),le){let $e={},be=l(le,$e,"origin",at);J(le,$e,'on "cors" object'),Array.isArray(be)?te.corsOrigin=be:be!==void 0&&(te.corsOrigin=[be]);}r(o,te,($e,be)=>{if($e)return T(new Error($e));se&&(a["serve-request"]=(wt,yt)=>{se(yt.args),n(wt,{});}),F(be);});}),cancel:()=>new Promise(g=>{if(j)return g();r(o,{command:"cancel",key:t},()=>{g();});}),dispose:()=>new Promise(g=>{if(j)return g();j=true,r(o,{command:"dispose",key:t},()=>{g(),z(),o.unref();});})};o.ref(),u(null,R);});}}var Bt=async(e,t,r,n,o,s,a,d,i)=>{let c=[],u=[],y={},B={},_=[],N=0,I=0,L=[],W=false;d=[...d];for(let w of d){let p={};if(typeof w!="object")throw new Error(`Plugin at index ${I} must be an object`);let f=l(w,p,"name",b);if(typeof f!="string"||f==="")throw new Error(`Plugin at index ${I} is missing a name`);try{let $=l(w,p,"setup",it);if(typeof $!="function")throw new Error("Plugin is missing a setup function");J(w,p,`on plugin ${V(f)}`);let E={name:f,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};I++;let A=$({initialOptions:a,resolve:(h,m={})=>{if(!W)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof h!="string")throw new Error("The path to resolve must be a string");let x=Object.create(null),O=l(m,x,"pluginName",b),M=l(m,x,"importer",b),P=l(m,x,"namespace",b),S=l(m,x,"resolveDir",b),j=l(m,x,"kind",b),R=l(m,x,"pluginData",Me),g=l(m,x,"with",Z);return J(m,x,"in resolve() call"),new Promise((F,T)=>{let D={command:"resolve",path:h,key:e,pluginName:f};if(O!=null&&(D.pluginName=O),M!=null&&(D.importer=M),P!=null&&(D.namespace=P),S!=null&&(D.resolveDir=S),j!=null)D.kind=j;else throw new Error('Must specify "kind" when calling "resolve"');R!=null&&(D.pluginData=i.store(R)),g!=null&&(D.with=Nt(g,"with")),t(n,D,(Q,q)=>{Q!==null?T(new Error(Q)):F({errors:ke(q.errors,i),warnings:ke(q.warnings,i),path:q.path,external:q.external,sideEffects:q.sideEffects,namespace:q.namespace,suffix:q.suffix,pluginData:i.load(q.pluginData)});});})},onStart(h){let m='This error came from the "onStart" callback registered here:',x=je(new Error(m),o,"onStart");c.push({name:f,callback:h,note:x}),E.onStart=!0;},onEnd(h){let m='This error came from the "onEnd" callback registered here:',x=je(new Error(m),o,"onEnd");u.push({name:f,callback:h,note:x}),E.onEnd=!0;},onResolve(h,m){let x='This error came from the "onResolve" callback registered here:',O=je(new Error(x),o,"onResolve"),M={},P=l(h,M,"filter",De),S=l(h,M,"namespace",b);if(J(h,M,`in onResolve() call for plugin ${V(f)}`),P==null)throw new Error("onResolve() call is missing a filter");let j=N++;y[j]={name:f,callback:m,note:O},E.onResolve.push({id:j,filter:Le(P),namespace:S||""});},onLoad(h,m){let x='This error came from the "onLoad" callback registered here:',O=je(new Error(x),o,"onLoad"),M={},P=l(h,M,"filter",De),S=l(h,M,"namespace",b);if(J(h,M,`in onLoad() call for plugin ${V(f)}`),P==null)throw new Error("onLoad() call is missing a filter");let j=N++;B[j]={name:f,callback:m,note:O},E.onLoad.push({id:j,filter:Le(P),namespace:S||""});},onDispose(h){_.push(h);},esbuild:o.esbuild});A&&await A,L.push(E);}catch($){return {ok:false,error:$,pluginName:f}}}s["on-start"]=async(w,p)=>{i.clear();let f={errors:[],warnings:[]};await Promise.all(c.map(async({name:$,callback:E,note:C})=>{try{let A=await E();if(A!=null){if(typeof A!="object")throw new Error(`Expected onStart() callback in plugin ${V($)} to return an object`);let h={},m=l(A,h,"errors",ce),x=l(A,h,"warnings",ce);J(A,h,`from onStart() callback in plugin ${V($)}`),m!=null&&f.errors.push(...fe(m,"errors",i,$,void 0)),x!=null&&f.warnings.push(...fe(x,"warnings",i,$,void 0));}}catch(A){f.errors.push(he(A,o,i,C&&C(),$));}})),r(w,f);},s["on-resolve"]=async(w,p)=>{let f={},$="",E,C;for(let A of p.ids)try{({name:$,callback:E,note:C}=y[A]);let h=await E({path:p.path,importer:p.importer,namespace:p.namespace,resolveDir:p.resolveDir,kind:p.kind,pluginData:i.load(p.pluginData),with:p.with});if(h!=null){if(typeof h!="object")throw new Error(`Expected onResolve() callback in plugin ${V($)} to return an object`);let m={},x=l(h,m,"pluginName",b),O=l(h,m,"path",b),M=l(h,m,"namespace",b),P=l(h,m,"suffix",b),S=l(h,m,"external",U),j=l(h,m,"sideEffects",U),R=l(h,m,"pluginData",Me),g=l(h,m,"errors",ce),F=l(h,m,"warnings",ce),T=l(h,m,"watchFiles",X),D=l(h,m,"watchDirs",X);J(h,m,`from onResolve() callback in plugin ${V($)}`),f.id=A,x!=null&&(f.pluginName=x),O!=null&&(f.path=O),M!=null&&(f.namespace=M),P!=null&&(f.suffix=P),S!=null&&(f.external=S),j!=null&&(f.sideEffects=j),R!=null&&(f.pluginData=i.store(R)),g!=null&&(f.errors=fe(g,"errors",i,$,void 0)),F!=null&&(f.warnings=fe(F,"warnings",i,$,void 0)),T!=null&&(f.watchFiles=Ce(T,"watchFiles")),D!=null&&(f.watchDirs=Ce(D,"watchDirs"));break}}catch(h){f={id:A,errors:[he(h,o,i,C&&C(),$)]};break}r(w,f);},s["on-load"]=async(w,p)=>{let f={},$="",E,C;for(let A of p.ids)try{({name:$,callback:E,note:C}=B[A]);let h=await E({path:p.path,namespace:p.namespace,suffix:p.suffix,pluginData:i.load(p.pluginData),with:p.with});if(h!=null){if(typeof h!="object")throw new Error(`Expected onLoad() callback in plugin ${V($)} to return an object`);let m={},x=l(h,m,"pluginName",b),O=l(h,m,"contents",ot),M=l(h,m,"resolveDir",b),P=l(h,m,"pluginData",Me),S=l(h,m,"loader",b),j=l(h,m,"errors",ce),R=l(h,m,"warnings",ce),g=l(h,m,"watchFiles",X),F=l(h,m,"watchDirs",X);J(h,m,`from onLoad() callback in plugin ${V($)}`),f.id=A,x!=null&&(f.pluginName=x),O instanceof Uint8Array?f.contents=O:O!=null&&(f.contents=ie(O)),M!=null&&(f.resolveDir=M),P!=null&&(f.pluginData=i.store(P)),S!=null&&(f.loader=S),j!=null&&(f.errors=fe(j,"errors",i,$,void 0)),R!=null&&(f.warnings=fe(R,"warnings",i,$,void 0)),g!=null&&(f.watchFiles=Ce(g,"watchFiles")),F!=null&&(f.watchDirs=Ce(F,"watchDirs"));break}}catch(h){f={id:A,errors:[he(h,o,i,C&&C(),$)]};break}r(w,f);};let z=(w,p)=>p([],[]);u.length>0&&(z=(w,p)=>{(async()=>{let f=[],$=[];for(let{name:E,callback:C,note:A}of u){let h,m;try{let x=await C(w);if(x!=null){if(typeof x!="object")throw new Error(`Expected onEnd() callback in plugin ${V(E)} to return an object`);let O={},M=l(x,O,"errors",ce),P=l(x,O,"warnings",ce);J(x,O,`from onEnd() callback in plugin ${V(E)}`),M!=null&&(h=fe(M,"errors",i,E,void 0)),P!=null&&(m=fe(P,"warnings",i,E,void 0));}}catch(x){h=[he(x,o,i,A&&A(),E)];}if(h){f.push(...h);try{w.errors.push(...h);}catch{}}if(m){$.push(...m);try{w.warnings.push(...m);}catch{}}}p(f,$);})();});let k=()=>{for(let w of _)setTimeout(()=>w(),0);};return W=true,{ok:true,requestPlugins:L,runOnEndCallbacks:z,scheduleOnDisposeCallbacks:k}};function ft(){let e=new Map,t=0;return {clear(){e.clear();},load(r){return e.get(r)},store(r){if(r===void 0)return -1;let n=t++;return e.set(n,r),n}}}function je(e,t,r){let n,o=false;return ()=>{if(o)return n;o=true;try{let s=(e.stack+"").split(`
8
+ `);s.splice(1,1);let a=dt(t,s,r);if(a)return n={text:e.message,location:a},n}catch{}}}function he(e,t,r,n,o){let s="Internal error",a=null;try{s=(e&&e.message||e)+"";}catch{}try{a=dt(t,(e.stack+"").split(`
9
+ `),"");}catch{}return {id:"",pluginName:o,text:s,location:a,notes:n?[n]:[],detail:r?r.store(e):-1}}function dt(e,t,r){let n=" at ";if(e.readFileSync&&!t[0].startsWith(n)&&t[1].startsWith(n))for(let o=1;o<t.length;o++){let s=t[o];if(s.startsWith(n))for(s=s.slice(n.length);;){let a=/^(?:new |async )?\S+ \((.*)\)$/.exec(s);if(a){s=a[1];continue}if(a=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(s),a){s=a[1];continue}if(a=/^(\S+):(\d+):(\d+)$/.exec(s),a){let d;try{d=e.readFileSync(a[1],"utf8");}catch{break}let i=d.split(/\r\n|\r|\n|\u2028|\u2029/)[+a[2]-1]||"",c=+a[3]-1,u=i.slice(c,c+r.length)===r?r.length:0;return {file:a[1],namespace:"file",line:+a[2],column:ie(i.slice(0,c)).length,length:ie(i.slice(c,c+u)).length,lineText:i+`
10
+ `+t.slice(1).join(`
11
+ `),suggestion:""}}break}}return null}function Ee(e,t,r){let n=5;e+=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,n+1).map((s,a)=>{if(a===n)return `
12
+ ...`;if(!s.location)return `
13
+ error: ${s.text}`;let{file:d,line:i,column:c}=s.location,u=s.pluginName?`[plugin: ${s.pluginName}] `:"";return `
14
+ ${d}:${i}:${c}: ERROR: ${u}${s.text}`}).join("");let o=new Error(e);for(let[s,a]of [["errors",t],["warnings",r]])Object.defineProperty(o,s,{configurable:true,enumerable:true,get:()=>a,set:d=>Object.defineProperty(o,s,{configurable:true,enumerable:true,value:d})});return o}function ke(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Qe(e,t,r){if(e==null)return null;let n={},o=l(e,n,"file",b),s=l(e,n,"namespace",b),a=l(e,n,"line",me),d=l(e,n,"column",me),i=l(e,n,"length",me),c=l(e,n,"lineText",b),u=l(e,n,"suggestion",b);if(J(e,n,t),c){let y=c.slice(0,(d&&d>0?d:0)+(i&&i>0?i:0)+(r&&r>0?r:80));!/[\x7F-\uFFFF]/.test(y)&&!/\n/.test(c)&&(c=y);}return {file:o||"",namespace:s||"",line:a||0,column:d||0,length:i||0,lineText:c||"",suggestion:u||""}}function fe(e,t,r,n,o){let s=[],a=0;for(let d of e){let i={},c=l(d,i,"id",b),u=l(d,i,"pluginName",b),y=l(d,i,"text",b),B=l(d,i,"location",Ke),_=l(d,i,"notes",ce),N=l(d,i,"detail",Me),I=`in element ${a} of "${t}"`;J(d,i,I);let L=[];if(_)for(let W of _){let z={},k=l(W,z,"text",b),w=l(W,z,"location",Ke);J(W,z,I),L.push({text:k||"",location:Qe(w,I,o)});}s.push({id:c||"",pluginName:u||n,text:y||"",location:Qe(B,I,o),notes:L,detail:r?r.store(N):-1}),a++;}return s}function Ce(e,t){let r=[];for(let n of e){if(typeof n!="string")throw new Error(`${V(t)} must be an array of strings`);r.push(n);}return r}function Nt(e,t){let r=Object.create(null);for(let n in e){let o=e[n];if(typeof o!="string")throw new Error(`key ${V(n)} in object ${V(t)} must be a string`);r[n]=o;}return r}function It({path:e,contents:t,hash:r}){let n=null;return {path:e,contents:t,hash:r,get text(){let o=this.contents;return (n===null||o!==t)&&(t=o,n=we(o)),n}}}function Le(e){let t=e.source;return e.flags&&(t=`(?${e.flags})${t}`),t}function Rt(e){let t;try{t=we(e);}catch{return Pt(e)}return JSON.parse(t)}var de=chunkPQC2BFS2_cjs.a("fs"),Ge=chunkPQC2BFS2_cjs.a("os"),ne=chunkPQC2BFS2_cjs.a("path"),ve=process.env.ESBUILD_BINARY_PATH||ve,Ut=e=>!!e&&e!=="/usr/bin/esbuild",Xe="@esbuild/darwin-arm64",Ze="@esbuild/darwin-x64",Te={"win32 arm64 LE":"@esbuild/win32-arm64","win32 ia32 LE":"@esbuild/win32-ia32","win32 x64 LE":"@esbuild/win32-x64"},Fe={"aix ppc64 BE":"@esbuild/aix-ppc64","android arm64 LE":"@esbuild/android-arm64","darwin arm64 LE":"@esbuild/darwin-arm64","darwin x64 LE":"@esbuild/darwin-x64","freebsd arm64 LE":"@esbuild/freebsd-arm64","freebsd x64 LE":"@esbuild/freebsd-x64","linux arm LE":"@esbuild/linux-arm","linux arm64 LE":"@esbuild/linux-arm64","linux ia32 LE":"@esbuild/linux-ia32","linux mips64el LE":"@esbuild/linux-mips64el","linux ppc64 LE":"@esbuild/linux-ppc64","linux riscv64 LE":"@esbuild/linux-riscv64","linux s390x BE":"@esbuild/linux-s390x","linux x64 LE":"@esbuild/linux-x64","linux loong64 LE":"@esbuild/linux-loong64","netbsd arm64 LE":"@esbuild/netbsd-arm64","netbsd x64 LE":"@esbuild/netbsd-x64","openbsd arm64 LE":"@esbuild/openbsd-arm64","openbsd x64 LE":"@esbuild/openbsd-x64","sunos x64 LE":"@esbuild/sunos-x64"},et={"android arm LE":"@esbuild/android-arm","android x64 LE":"@esbuild/android-x64","openharmony arm64 LE":"@esbuild/openharmony-arm64"};function Wt(){let e,t,r=false,n=`${process.platform} ${Ge.arch()} ${Ge.endianness()}`;if(n in Te)e=Te[n],t="esbuild.exe";else if(n in Fe)e=Fe[n],t="bin/esbuild";else if(n in et)e=et[n],t="bin/esbuild",r=true;else throw new Error(`Unsupported platform: ${n}`);return {pkg:e,subpath:t,isWASM:r}}function zt(){let e=chunkPQC2BFS2_cjs.a.resolve("esbuild"),t=ne.dirname(ne.dirname(ne.dirname(e)));if(ne.basename(t)==="node_modules"){for(let r in Fe)try{let n=Fe[r];if(de.existsSync(ne.join(t,n)))return n}catch{}for(let r in Te)try{let n=Te[r];if(de.existsSync(ne.join(t,n)))return n}catch{}}return null}function qt(e,t){let r=ne.dirname(chunkPQC2BFS2_cjs.a.resolve("esbuild"));return ne.join(r,`downloaded-${e.replace("/","-")}-${ne.basename(t)}`)}function Jt(){if(Ut(ve))if(!de.existsSync(ve))console.warn(`[esbuild] Ignoring bad configuration: ESBUILD_BINARY_PATH=${ve}`);else return {binPath:ve,isWASM:false};let{pkg:e,subpath:t,isWASM:r}=Wt(),n;try{n=chunkPQC2BFS2_cjs.a.resolve(`${e}/${t}`);}catch(o){if(n=qt(e,t),!de.existsSync(n)){try{chunkPQC2BFS2_cjs.a.resolve(e);}catch{let s=zt();if(s){let a=`
15
+ Specifically the "${s}" package is present but this platform
16
+ needs the "${e}" package instead. People often get into this
17
+ situation by installing esbuild on Windows or macOS and copying "node_modules"
18
+ into a Docker image that runs Linux, or by copying "node_modules" between
19
+ Windows and WSL environments.
20
+
21
+ If you are installing with npm, you can try not copying the "node_modules"
22
+ directory when you copy the files over, and running "npm ci" or "npm install"
23
+ on the destination platform after the copy. Or you could consider using yarn
24
+ instead of npm which has built-in support for installing a package on multiple
25
+ platforms simultaneously.
26
+
27
+ If you are installing with yarn, you can try listing both this platform and the
28
+ other platform in your ".yarnrc.yml" file using the "supportedArchitectures"
29
+ feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
30
+ Keep in mind that this means multiple copies of esbuild will be present.
31
+ `;throw (e===Ze&&s===Xe||e===Xe&&s===Ze)&&(a=`
32
+ Specifically the "${s}" package is present but this platform
33
+ needs the "${e}" package instead. People often get into this
34
+ situation by installing esbuild with npm running inside of Rosetta 2 and then
35
+ trying to use it with node running outside of Rosetta 2, or vice versa (Rosetta
36
+ 2 is Apple's on-the-fly x86_64-to-arm64 translation service).
37
+
38
+ If you are installing with npm, you can try ensuring that both npm and node are
39
+ not running under Rosetta 2 and then reinstalling esbuild. This likely involves
40
+ changing how you installed npm and/or node. For example, installing node with
41
+ the universal installer here should work: https://nodejs.org/en/download/. Or
42
+ you could consider using yarn instead of npm which has built-in support for
43
+ installing a package on multiple platforms simultaneously.
44
+
45
+ If you are installing with yarn, you can try listing both "arm64" and "x64"
46
+ in your ".yarnrc.yml" file using the "supportedArchitectures" feature:
47
+ https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures
48
+ Keep in mind that this means multiple copies of esbuild will be present.
49
+ `),new Error(`
50
+ You installed esbuild for another platform than the one you're currently using.
51
+ This won't work because esbuild is written with native code and needs to
52
+ install a platform-specific binary executable.
53
+ ${a}
54
+ Another alternative is to use the "esbuild-wasm" package instead, which works
55
+ the same way on all platforms. But it comes with a heavy performance cost and
56
+ can sometimes be 10x slower than the "esbuild" package, so you may also not
57
+ want to do that.
58
+ `)}throw new Error(`The package "${e}" could not be found, and is needed by esbuild.
59
+
60
+ If you are installing esbuild with npm, make sure that you don't specify the
61
+ "--no-optional" or "--omit=optional" flags. The "optionalDependencies" feature
62
+ of "package.json" is used by esbuild to install the correct binary executable
63
+ for your current platform.`)}throw o}}if(/\.zip\//.test(n)){let o;try{o=chunkPQC2BFS2_cjs.a("pnpapi");}catch{}if(o){let s=o.getPackageInformation(o.topLevel).packageLocation,a=ne.join(s,"node_modules",".cache","esbuild",`pnpapi-${e.replace("/","-")}-0.27.4-${ne.basename(t)}`);return de.existsSync(a)||(de.mkdirSync(ne.dirname(a),{recursive:true}),de.copyFileSync(n,a),de.chmodSync(a,493)),{binPath:a,isWASM:r}}}return {binPath:n,isWASM:r}}var ht=chunkPQC2BFS2_cjs.a("child_process"),Vt=chunkPQC2BFS2_cjs.a("crypto"),We=chunkPQC2BFS2_cjs.a("path"),pe=chunkPQC2BFS2_cjs.a("fs"),Yt=chunkPQC2BFS2_cjs.a("os"),Ht=chunkPQC2BFS2_cjs.a("tty"),H;if(process.env.ESBUILD_WORKER_THREADS!=="0"){try{H=chunkPQC2BFS2_cjs.a("worker_threads");}catch{}let[e,t]=process.versions.node.split(".");(+e<12||+e==12&&+t<17||+e==13&&+t<13)&&(H=void 0);}var tt,Oe=((tt=H?.workerData)==null?void 0:tt.esbuildVersion)==="0.27.4",mt=()=>{if(!ve&&(We.basename(__filename)!=="main.js"||We.basename(__dirname)!=="lib"))throw new Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle.
64
+
65
+ More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`);{let{binPath:e,isWASM:t}=Jt();return t?["node",[e]]:[e,[]]}},Ae=()=>Ht.isatty(2),Kt={readFile(e,t){try{let r=pe.readFileSync(e,"utf8");try{pe.unlinkSync(e);}catch{}t(null,r);}catch(r){t(r,null);}},writeFile(e,t){try{let r=pt();pe.writeFileSync(r,e),t(r);}catch{t(null);}}},Qt={readFile(e,t){try{pe.readFile(e,"utf8",(r,n)=>{try{pe.unlink(e,()=>t(r,n));}catch{t(r,n);}});}catch(r){t(r,null);}},writeFile(e,t){try{let r=pt();pe.writeFile(r,e,n=>t(n!==null?null:r));}catch{t(null);}}},Gt="0.27.4",Xt=e=>ye().build(e),Zt=e=>ye().context(e),er=(e,t)=>ye().transform(e,t),tr=(e,t)=>ye().formatMessages(e,t),rr=(e,t)=>ye().analyzeMetafile(e,t),nr=e=>{if(H&&!Oe)return K||(K=Ie(H)),K.buildSync(e);let t;return Ne(r=>r.buildOrContext({callName:"buildSync",refs:null,options:e,isTTY:Ae(),defaultWD:ge,callback:(n,o)=>{if(n)throw n;t=o;}})),t},ir=(e,t)=>{if(H&&!Oe)return K||(K=Ie(H)),K.transformSync(e,t);let r;return Ne(n=>n.transform({callName:"transformSync",refs:null,input:e,options:t||{},isTTY:Ae(),fs:Kt,callback:(o,s)=>{if(o)throw o;r=s;}})),r},lr=(e,t)=>{if(H&&!Oe)return K||(K=Ie(H)),K.formatMessagesSync(e,t);let r;return Ne(n=>n.formatMessages({callName:"formatMessagesSync",refs:null,messages:e,options:t,callback:(o,s)=>{if(o)throw o;r=s;}})),r},ar=(e,t)=>{if(H&&!Oe)return K||(K=Ie(H)),K.analyzeMetafileSync(e,t);let r;return Ne(n=>n.analyzeMetafile({callName:"analyzeMetafileSync",refs:null,metafile:typeof e=="string"?e:JSON.stringify(e),options:t,callback:(o,s)=>{if(o)throw o;r=s;}})),r},or=()=>(_e&&_e(),K&&K.stop(),Promise.resolve()),ze=false,sr=e=>{if(e=Lt(e||{}),e.wasmURL)throw new Error('The "wasmURL" option only works in the browser');if(e.wasmModule)throw new Error('The "wasmModule" option only works in the browser');if(e.worker)throw new Error('The "worker" option only works in the browser');if(ze)throw new Error('Cannot call "initialize" more than once');return ye(),ze=true,Promise.resolve()},ge=process.cwd(),Se,_e,ye=()=>{if(Se)return Se;let[e,t]=mt(),r=ht.spawn(e,t.concat("--service=0.27.4","--ping"),{windowsHide:true,stdio:["pipe","pipe","inherit"],cwd:ge}),{readFromStdout:n,afterClose:o,service:s}=ct({writeToStdin(u){r.stdin.write(u,y=>{y&&o(y);});},readFileSync:pe.readFileSync,isSync:false,hasFS:true,esbuild:Pe});r.stdin.on("error",o),r.on("error",o);let a=r.stdin,d=r.stdout;d.on("data",n),d.on("end",o),_e=()=>{a.destroy(),d.destroy(),r.kill(),ze=false,Se=void 0,_e=void 0;};let i=0;r.unref(),a.unref&&a.unref(),d.unref&&d.unref();let c={ref(){++i===1&&r.ref();},unref(){--i===0&&r.unref();}};return Se={build:u=>new Promise((y,B)=>{s.buildOrContext({callName:"build",refs:c,options:u,isTTY:Ae(),defaultWD:ge,callback:(_,N)=>_?B(_):y(N)});}),context:u=>new Promise((y,B)=>s.buildOrContext({callName:"context",refs:c,options:u,isTTY:Ae(),defaultWD:ge,callback:(_,N)=>_?B(_):y(N)})),transform:(u,y)=>new Promise((B,_)=>s.transform({callName:"transform",refs:c,input:u,options:y||{},isTTY:Ae(),fs:Qt,callback:(N,I)=>N?_(N):B(I)})),formatMessages:(u,y)=>new Promise((B,_)=>s.formatMessages({callName:"formatMessages",refs:c,messages:u,options:y,callback:(N,I)=>N?_(N):B(I)})),analyzeMetafile:(u,y)=>new Promise((B,_)=>s.analyzeMetafile({callName:"analyzeMetafile",refs:c,metafile:typeof u=="string"?u:JSON.stringify(u),options:y,callback:(N,I)=>N?_(N):B(I)}))},Se},Ne=e=>{let[t,r]=mt(),n=new Uint8Array,{readFromStdout:o,afterClose:s,service:a}=ct({writeToStdin(i){if(n.length!==0)throw new Error("Must run at most one command");n=i;},isSync:true,hasFS:true,esbuild:Pe});e(a);let d=ht.execFileSync(t,r.concat("--service=0.27.4"),{cwd:ge,windowsHide:true,input:n,maxBuffer:+process.env.ESBUILD_MAX_BUFFER||16*1024*1024});o(d),s(null);},pt=()=>We.join(Yt.tmpdir(),`esbuild-${Vt.randomBytes(32).toString("hex")}`),K=null,Ie=e=>{let{port1:t,port2:r}=new e.MessageChannel,n=new e.Worker(__filename,{workerData:{workerPort:r,defaultWD:ge,esbuildVersion:"0.27.4"},transferList:[r],execArgv:[]}),o=0,s=c=>{let u=new Error(`Build failed with 1 error:
66
+ error: ${c}`),y=[{id:"",pluginName:"",text:c,location:null,notes:[],detail:void 0}];return u.errors=y,u.warnings=[],u},a=c=>{if(!c)return;let u=c.plugins;if(u&&u.length>0)throw s("Cannot use plugins in synchronous API calls")},d=(c,u)=>{for(let y in u)c[y]=u[y];},i=(c,u)=>{let y=o++,B=new SharedArrayBuffer(8),_=new Int32Array(B),N={sharedBuffer:B,id:y,command:c,args:u};n.postMessage(N);let I=Atomics.wait(_,0,0);if(I!=="ok"&&I!=="not-equal")throw new Error("Internal error: Atomics.wait() failed: "+I);let{message:{id:L,resolve:W,reject:z,properties:k}}=e.receiveMessageOnPort(t);if(y!==L)throw new Error(`Internal error: Expected id ${y} but got id ${L}`);if(z)throw d(z,k),z;return W};return n.unref(),{buildSync(c){return a(c),i("build",[c])},transformSync(c,u){return i("transform",[c,u])},formatMessagesSync(c,u){return i("formatMessages",[c,u])},analyzeMetafileSync(c,u){return i("analyzeMetafile",[c,u])},stop(){n.terminate(),K=null;}}},ur=()=>{let e=H.workerData.workerPort,t=H.parentPort,r=n=>{let o={};if(n&&typeof n=="object")for(let s in n)o[s]=n[s];return o};try{let n=ye();ge=H.workerData.defaultWD,t.on("message",o=>{(async()=>{let{sharedBuffer:s,id:a,command:d,args:i}=o,c=new Int32Array(s);try{switch(d){case "build":e.postMessage({id:a,resolve:await n.build(i[0])});break;case "transform":e.postMessage({id:a,resolve:await n.transform(i[0],i[1])});break;case "formatMessages":e.postMessage({id:a,resolve:await n.formatMessages(i[0],i[1])});break;case "analyzeMetafile":e.postMessage({id:a,resolve:await n.analyzeMetafile(i[0],i[1])});break;default:throw new Error(`Invalid command: ${d}`)}}catch(u){e.postMessage({id:a,reject:u,properties:r(u)});}Atomics.add(c,0,1),Atomics.notify(c,0,1/0);})();});}catch(n){t.on("message",o=>{let{sharedBuffer:s,id:a}=o,d=new Int32Array(s);e.postMessage({id:a,reject:n,properties:r(n)}),Atomics.add(d,0,1),Atomics.notify(d,0,1/0);});}};Oe&&ur();var cr=Pe;});var mainBW4T3DHC = fr();module.exports=mainBW4T3DHC;