23 lines
49 KiB
JavaScript
23 lines
49 KiB
JavaScript
(module=>{
|
|
"use strict";var ve=Object.defineProperty;var Ke=Object.getOwnPropertyDescriptor;var _e=Object.getOwnPropertyNames;var Ve=Object.prototype.hasOwnProperty;var Ye=(e,t)=>{for(var n in t)ve(e,n,{get:t[n],enumerable:!0})},Je=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of _e(t))!Ve.call(e,u)&&u!==n&&ve(e,u,{get:()=>t[u],enumerable:!(i=Ke(t,u))||i.enumerable});return e};var Qe=e=>Je(ve({},"__esModule",{value:!0}),e);var ne=(e,t,n)=>new Promise((i,u)=>{var l=p=>{try{s(n.next(p))}catch(b){u(b)}},f=p=>{try{s(n.throw(p))}catch(b){u(b)}},s=p=>p.done?i(p.value):Promise.resolve(p.value).then(l,f);s((n=n.apply(e,t)).next())});var we={};Ye(we,{analyzeMetafile:()=>pt,analyzeMetafileSync:()=>ht,build:()=>ut,buildSync:()=>gt,context:()=>ct,default:()=>vt,formatMessages:()=>dt,formatMessagesSync:()=>yt,initialize:()=>bt,transform:()=>ft,transformSync:()=>mt,version:()=>at});module.exports=Qe(we);function Oe(e){let t=i=>{if(i===null)n.write8(0);else if(typeof i=="boolean")n.write8(1),n.write8(+i);else if(typeof i=="number")n.write8(2),n.write32(i|0);else if(typeof i=="string")n.write8(3),n.write(Z(i));else if(i instanceof Uint8Array)n.write8(4),n.write(i);else if(i instanceof Array){n.write8(5),n.write32(i.length);for(let u of i)t(u)}else{let u=Object.keys(i);n.write8(6),n.write32(u.length);for(let l of u)n.write(Z(l)),t(i[l])}},n=new pe;return n.write32(0),n.write32(e.id<<1|+!e.isRequest),t(e.value),Re(n.buf,n.len-4,0),n.buf.subarray(0,n.len)}function ke(e){let t=()=>{switch(n.read8()){case 0:return null;case 1:return!!n.read8();case 2:return n.read32();case 3:return ie(n.read());case 4:return n.read();case 5:{let f=n.read32(),s=[];for(let p=0;p<f;p++)s.push(t());return s}case 6:{let f=n.read32(),s={};for(let p=0;p<f;p++)s[ie(n.read())]=t();return s}default:throw new Error("Invalid packet")}},n=new pe(e),i=n.read32(),u=(i&1)===0;i>>>=1;let l=t();if(n.ptr!==e.length)throw new Error("Invalid packet");return{id:i,isRequest:u,value:l}}var pe=class{constructor(t=new Uint8Array(1024)){this.buf=t;this.len=0;this.ptr=0}_write(t){if(this.len+t>this.buf.length){let n=new Uint8Array((this.len+t)*2);n.set(this.buf),this.buf=n}return this.len+=t,this.len-t}write8(t){let n=this._write(1);this.buf[n]=t}write32(t){let n=this._write(4);Re(this.buf,t,n)}write(t){let n=this._write(4+t.length);Re(this.buf,t.length,n),this.buf.set(t,n+4)}_read(t){if(this.ptr+t>this.buf.length)throw new Error("Invalid packet");return this.ptr+=t,this.ptr-t}read8(){return this.buf[this._read(1)]}read32(){return Ee(this.buf,this._read(4))}read(){let t=this.read32(),n=new Uint8Array(t),i=this._read(n.length);return n.set(this.buf.subarray(i,i+t)),n}},Z,ie,xe;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;Z=n=>e.encode(n),ie=n=>t.decode(n),xe='new TextEncoder().encode("")'}else if(typeof Buffer!="undefined")Z=e=>Buffer.from(e),ie=e=>{let{buffer:t,byteOffset:n,byteLength:i}=e;return Buffer.from(t,n,i).toString()},xe='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(Z("")instanceof Uint8Array))throw new Error(`Invariant violation: "${xe} instanceof Uint8Array" is incorrectly false
|
|
|
|
This indicates that your JavaScript environment is broken. You cannot use
|
|
esbuild in this environment because esbuild relies on this invariant. This
|
|
is not a problem with esbuild. You need to fix your environment instead.
|
|
`);function Ee(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Re(e,t,n){e[n++]=t,e[n++]=t>>8,e[n++]=t>>16,e[n++]=t>>24}var Y=JSON.stringify,$e="warning",Me="silent";function Ce(e){if(V(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var ye=()=>null,I=e=>typeof e=="boolean"?null:"a boolean",y=e=>typeof e=="string"?null:"a string",he=e=>e instanceof RegExp?null:"a RegExp object",se=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Pe=e=>typeof e=="function"?null:"a function",W=e=>Array.isArray(e)?null:"an array",ee=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",Ge=e=>typeof e=="object"&&e!==null?null:"an array or an object",Xe=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Ae=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Fe=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ze=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",et=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Te=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",tt=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function r(e,t,n,i){let u=e[n];if(t[n+""]=!0,u===void 0)return;let l=i(u);if(l!==null)throw new Error(`${Y(n)} must be ${l}`);return u}function K(e,t,n){for(let i in e)if(!(i in t))throw new Error(`Invalid option ${n}: ${Y(i)}`)}function Be(e){let t=Object.create(null),n=r(e,t,"wasmURL",tt),i=r(e,t,"wasmModule",Xe),u=r(e,t,"worker",I);return K(e,t,"in initialize() call"),{wasmURL:n,wasmModule:i,worker:u}}function Ue(e){let t;if(e!==void 0){t=Object.create(null);for(let n in e){let i=e[n];if(typeof i=="string"||i===!1)t[n]=i;else throw new Error(`Expected ${Y(n)} in mangle cache to map to either a string or false`)}}return t}function be(e,t,n,i,u){let l=r(t,n,"color",I),f=r(t,n,"logLevel",y),s=r(t,n,"logLimit",se);l!==void 0?e.push(`--color=${l}`):i&&e.push("--color=true"),e.push(`--log-level=${f||u}`),e.push(`--log-limit=${s||0}`)}function V(e,t,n){if(typeof e!="string")throw new Error(`Expected value for ${t}${n!==void 0?" "+Y(n):""} to be a string, got ${typeof e} instead`);return e}function je(e,t,n){let i=r(t,n,"legalComments",y),u=r(t,n,"sourceRoot",y),l=r(t,n,"sourcesContent",I),f=r(t,n,"target",et),s=r(t,n,"format",y),p=r(t,n,"globalName",y),b=r(t,n,"mangleProps",he),w=r(t,n,"reserveProps",he),T=r(t,n,"mangleQuoted",I),j=r(t,n,"minify",I),U=r(t,n,"minifySyntax",I),L=r(t,n,"minifyWhitespace",I),Q=r(t,n,"minifyIdentifiers",I),B=r(t,n,"lineLimit",se),z=r(t,n,"drop",W),J=r(t,n,"dropLabels",W),v=r(t,n,"charset",y),m=r(t,n,"treeShaking",I),d=r(t,n,"ignoreAnnotations",I),o=r(t,n,"jsx",y),x=r(t,n,"jsxFactory",y),$=r(t,n,"jsxFragment",y),M=r(t,n,"jsxImportSource",y),D=r(t,n,"jsxDev",I),a=r(t,n,"jsxSideEffects",I),c=r(t,n,"define",ee),h=r(t,n,"logOverride",ee),E=r(t,n,"supported",ee),C=r(t,n,"pure",W),S=r(t,n,"keepNames",I),O=r(t,n,"platform",y),A=r(t,n,"tsconfigRaw",Ze);if(i&&e.push(`--legal-comments=${i}`),u!==void 0&&e.push(`--source-root=${u}`),l!==void 0&&e.push(`--sources-content=${l}`),f&&(Array.isArray(f)?e.push(`--target=${Array.from(f).map(Ce).join(",")}`):e.push(`--target=${Ce(f)}`)),s&&e.push(`--format=${s}`),p&&e.push(`--global-name=${p}`),O&&e.push(`--platform=${O}`),A&&e.push(`--tsconfig-raw=${typeof A=="string"?A:JSON.stringify(A)}`),j&&e.push("--minify"),U&&e.push("--minify-syntax"),L&&e.push("--minify-whitespace"),Q&&e.push("--minify-identifiers"),B&&e.push(`--line-limit=${B}`),v&&e.push(`--charset=${v}`),m!==void 0&&e.push(`--tree-shaking=${m}`),d&&e.push("--ignore-annotations"),z)for(let R of z)e.push(`--drop:${V(R,"drop")}`);if(J&&e.push(`--drop-labels=${Array.from(J).map(R=>V(R,"dropLabels")).join(",")}`),b&&e.push(`--mangle-props=${b.source}`),w&&e.push(`--reserve-props=${w.source}`),T!==void 0&&e.push(`--mangle-quoted=${T}`),o&&e.push(`--jsx=${o}`),x&&e.push(`--jsx-factory=${x}`),$&&e.push(`--jsx-fragment=${$}`),M&&e.push(`--jsx-import-source=${M}`),D&&e.push("--jsx-dev"),a&&e.push("--jsx-side-effects"),c)for(let R in c){if(R.indexOf("=")>=0)throw new Error(`Invalid define: ${R}`);e.push(`--define:${R}=${V(c[R],"define",R)}`)}if(h)for(let R in h){if(R.indexOf("=")>=0)throw new Error(`Invalid log override: ${R}`);e.push(`--log-override:${R}=${V(h[R],"log override",R)}`)}if(E)for(let R in E){if(R.indexOf("=")>=0)throw new Error(`Invalid supported: ${R}`);let k=E[R];if(typeof k!="boolean")throw new Error(`Expected value for supported ${Y(R)} to be a boolean, got ${typeof k} instead`);e.push(`--supported:${R}=${k}`)}if(C)for(let R of C)e.push(`--pure:${V(R,"pure")}`);S&&e.push("--keep-names")}function nt(e,t,n,i,u){var oe;let l=[],f=[],s=Object.create(null),p=null,b=null;be(l,t,s,n,i),je(l,t,s);let w=r(t,s,"sourcemap",Fe),T=r(t,s,"bundle",I),j=r(t,s,"splitting",I),U=r(t,s,"preserveSymlinks",I),L=r(t,s,"metafile",I),Q=r(t,s,"outfile",y),B=r(t,s,"outdir",y),z=r(t,s,"outbase",y),J=r(t,s,"tsconfig",y),v=r(t,s,"resolveExtensions",W),m=r(t,s,"nodePaths",W),d=r(t,s,"mainFields",W),o=r(t,s,"conditions",W),x=r(t,s,"external",W),$=r(t,s,"packages",y),M=r(t,s,"alias",ee),D=r(t,s,"loader",ee),a=r(t,s,"outExtension",ee),c=r(t,s,"publicPath",y),h=r(t,s,"entryNames",y),E=r(t,s,"chunkNames",y),C=r(t,s,"assetNames",y),S=r(t,s,"inject",W),O=r(t,s,"banner",ee),A=r(t,s,"footer",ee),R=r(t,s,"entryPoints",Ge),k=r(t,s,"absWorkingDir",y),F=r(t,s,"stdin",ee),P=(oe=r(t,s,"write",I))!=null?oe:u,q=r(t,s,"allowOverwrite",I),_=r(t,s,"mangleCache",ee);if(s.plugins=!0,K(t,s,`in ${e}() call`),w&&l.push(`--sourcemap${w===!0?"":`=${w}`}`),T&&l.push("--bundle"),q&&l.push("--allow-overwrite"),j&&l.push("--splitting"),U&&l.push("--preserve-symlinks"),L&&l.push("--metafile"),Q&&l.push(`--outfile=${Q}`),B&&l.push(`--outdir=${B}`),z&&l.push(`--outbase=${z}`),J&&l.push(`--tsconfig=${J}`),$&&l.push(`--packages=${$}`),v){let g=[];for(let N of v){if(V(N,"resolve extension"),N.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${N}`);g.push(N)}l.push(`--resolve-extensions=${g.join(",")}`)}if(c&&l.push(`--public-path=${c}`),h&&l.push(`--entry-names=${h}`),E&&l.push(`--chunk-names=${E}`),C&&l.push(`--asset-names=${C}`),d){let g=[];for(let N of d){if(V(N,"main field"),N.indexOf(",")>=0)throw new Error(`Invalid main field: ${N}`);g.push(N)}l.push(`--main-fields=${g.join(",")}`)}if(o){let g=[];for(let N of o){if(V(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);g.push(N)}l.push(`--conditions=${g.join(",")}`)}if(x)for(let g of x)l.push(`--external:${V(g,"external")}`);if(M)for(let g in M){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);l.push(`--alias:${g}=${V(M[g],"alias",g)}`)}if(O)for(let g in O){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);l.push(`--banner:${g}=${V(O[g],"banner",g)}`)}if(A)for(let g in A){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);l.push(`--footer:${g}=${V(A[g],"footer",g)}`)}if(S)for(let g of S)l.push(`--inject:${V(g,"inject")}`);if(D)for(let g in D){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);l.push(`--loader:${g}=${V(D[g],"loader",g)}`)}if(a)for(let g in a){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);l.push(`--out-extension:${g}=${V(a[g],"out extension",g)}`)}if(R)if(Array.isArray(R))for(let g=0,N=R.length;g<N;g++){let X=R[g];if(typeof X=="object"&&X!==null){let te=Object.create(null),G=r(X,te,"in",y),ce=r(X,te,"out",y);if(K(X,te,"in entry point at index "+g),G===void 0)throw new Error('Missing property "in" for entry point at index '+g);if(ce===void 0)throw new Error('Missing property "out" for entry point at index '+g);f.push([ce,G])}else f.push(["",V(X,"entry point at index "+g)])}else for(let g in R)f.push([g,V(R[g],"entry point",g)]);if(F){let g=Object.create(null),N=r(F,g,"contents",Te),X=r(F,g,"resolveDir",y),te=r(F,g,"sourcefile",y),G=r(F,g,"loader",y);K(F,g,'in "stdin" object'),te&&l.push(`--sourcefile=${te}`),G&&l.push(`--loader=${G}`),X&&(b=X),typeof N=="string"?p=Z(N):N instanceof Uint8Array&&(p=N)}let H=[];if(m)for(let g of m)g+="",H.push(g);return{entries:f,flags:l,write:P,stdinContents:p,stdinResolveDir:b,absWorkingDir:k,nodePaths:H,mangleCache:Ue(_)}}function rt(e,t,n,i){let u=[],l=Object.create(null);be(u,t,l,n,i),je(u,t,l);let f=r(t,l,"sourcemap",Fe),s=r(t,l,"sourcefile",y),p=r(t,l,"loader",y),b=r(t,l,"banner",y),w=r(t,l,"footer",y),T=r(t,l,"mangleCache",ee);return K(t,l,`in ${e}() call`),f&&u.push(`--sourcemap=${f===!0?"external":f}`),s&&u.push(`--sourcefile=${s}`),p&&u.push(`--loader=${p}`),b&&u.push(`--banner=${b}`),w&&u.push(`--footer=${w}`),{flags:u,mangleCache:Ue(T)}}function Le(e){let t={},n={didClose:!1,reason:""},i={},u=0,l=0,f=new Uint8Array(16*1024),s=0,p=v=>{let m=s+v.length;if(m>f.length){let o=new Uint8Array(m*2);o.set(f),f=o}f.set(v,s),s+=v.length;let d=0;for(;d+4<=s;){let o=Ee(f,d);if(d+4+o>s)break;d+=4,L(f.subarray(d,d+o)),d+=o}d>0&&(f.copyWithin(0,d,s),s-=d)},b=v=>{n.didClose=!0,v&&(n.reason=": "+(v.message||v));let m="The service was stopped"+n.reason;for(let d in i)i[d](m,null);i={}},w=(v,m,d)=>{if(n.didClose)return d("The service is no longer running"+n.reason,null);let o=u++;i[o]=(x,$)=>{try{d(x,$)}finally{v&&v.unref()}},v&&v.ref(),e.writeToStdin(Oe({id:o,isRequest:!0,value:m}))},T=(v,m)=>{if(n.didClose)throw new Error("The service is no longer running"+n.reason);e.writeToStdin(Oe({id:v,isRequest:!1,value:m}))},j=(v,m)=>ne(this,null,function*(){try{if(m.command==="ping"){T(v,{});return}if(typeof m.key=="number"){let d=t[m.key];if(d){let o=d[m.command];if(o){yield o(v,m);return}}}throw new Error("Invalid command: "+m.command)}catch(d){let o=[le(d,e,null,void 0,"")];try{T(v,{errors:o})}catch(x){}}}),U=!0,L=v=>{if(U){U=!1;let d=String.fromCharCode(...v);if(d!=="0.18.17")throw new Error(`Cannot start service: Host version "0.18.17" does not match binary version ${Y(d)}`);return}let m=ke(v);if(m.isRequest)j(m.id,m.value);else{let d=i[m.id];delete i[m.id],m.value.error?d(m.value.error,{}):d(null,m.value)}};return{readFromStdout:p,afterClose:b,service:{buildOrContext:({callName:v,refs:m,options:d,isTTY:o,defaultWD:x,callback:$})=>{let M=0,D=l++,a={},c={ref(){++M===1&&m&&m.ref()},unref(){--M===0&&(delete t[D],m&&m.unref())}};t[D]=a,c.ref(),it(v,D,w,T,c,e,a,d,o,x,(h,E)=>{try{$(h,E)}finally{c.unref()}})},transform:({callName:v,refs:m,input:d,options:o,isTTY:x,fs:$,callback:M})=>{let D=qe(),a=c=>{try{if(typeof d!="string"&&!(d instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:h,mangleCache:E}=rt(v,o,x,Me),C={command:"transform",flags:h,inputFS:c!==null,input:c!==null?Z(c):typeof d=="string"?Z(d):d};E&&(C.mangleCache=E),w(m,C,(S,O)=>{if(S)return M(new Error(S),null);let A=ae(O.errors,D),R=ae(O.warnings,D),k=1,F=()=>{if(--k===0){let P={warnings:R,code:O.code,map:O.map,mangleCache:void 0,legalComments:void 0};"legalComments"in O&&(P.legalComments=O==null?void 0:O.legalComments),O.mangleCache&&(P.mangleCache=O==null?void 0:O.mangleCache),M(null,P)}};if(A.length>0)return M(fe("Transform failed",A,R),null);O.codeFS&&(k++,$.readFile(O.code,(P,q)=>{P!==null?M(P,null):(O.code=q,F())})),O.mapFS&&(k++,$.readFile(O.map,(P,q)=>{P!==null?M(P,null):(O.map=q,F())})),F()})}catch(h){let E=[];try{be(E,o,{},x,Me)}catch(S){}let C=le(h,e,D,void 0,"");w(m,{command:"error",flags:E,error:C},()=>{C.detail=D.load(C.detail),M(fe("Transform failed",[C],[]),null)})}};if((typeof d=="string"||d instanceof Uint8Array)&&d.length>1024*1024){let c=a;a=()=>$.writeFile(d,c)}a(null)},formatMessages:({callName:v,refs:m,messages:d,options:o,callback:x})=>{let $=re(d,"messages",null,"");if(!o)throw new Error(`Missing second argument in ${v}() call`);let M={},D=r(o,M,"kind",y),a=r(o,M,"color",I),c=r(o,M,"terminalWidth",se);if(K(o,M,`in ${v}() call`),D===void 0)throw new Error(`Missing "kind" in ${v}() call`);if(D!=="error"&&D!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${v}() call`);let h={command:"format-msgs",messages:$,isWarning:D==="warning"};a!==void 0&&(h.color=a),c!==void 0&&(h.terminalWidth=c),w(m,h,(E,C)=>{if(E)return x(new Error(E),null);x(null,C.messages)})},analyzeMetafile:({callName:v,refs:m,metafile:d,options:o,callback:x})=>{o===void 0&&(o={});let $={},M=r(o,$,"color",I),D=r(o,$,"verbose",I);K(o,$,`in ${v}() call`);let a={command:"analyze-metafile",metafile:d};M!==void 0&&(a.color=M),D!==void 0&&(a.verbose=D),w(m,a,(c,h)=>{if(c)return x(new Error(c),null);x(null,h.result)})}}}}function it(e,t,n,i,u,l,f,s,p,b,w){let T=qe(),j=e==="context",U=(B,z)=>{let J=[];try{be(J,s,{},p,$e)}catch(m){}let v=le(B,l,T,void 0,z);n(u,{command:"error",flags:J,error:v},()=>{v.detail=T.load(v.detail),w(fe(j?"Context failed":"Build failed",[v],[]),null)})},L;if(typeof s=="object"){let B=s.plugins;if(B!==void 0){if(!Array.isArray(B))return U(new Error('"plugins" must be an array'),"");L=B}}if(L&&L.length>0){if(l.isSync)return U(new Error("Cannot use plugins in synchronous API calls"),"");lt(t,n,i,u,l,f,s,L,T).then(B=>{if(!B.ok)return U(B.error,B.pluginName);try{Q(B.requestPlugins,B.runOnEndCallbacks,B.scheduleOnDisposeCallbacks)}catch(z){U(z,"")}},B=>U(B,""));return}try{Q(null,(B,z)=>z([],[]),()=>{})}catch(B){U(B,"")}function Q(B,z,J){let v=l.hasFS,{entries:m,flags:d,write:o,stdinContents:x,stdinResolveDir:$,absWorkingDir:M,nodePaths:D,mangleCache:a}=nt(e,s,p,$e,v);if(o&&!l.hasFS)throw new Error('The "write" option is unavailable in this environment');let c={command:"build",key:t,entries:m,flags:d,write:o,stdinContents:x,stdinResolveDir:$,absWorkingDir:M||b,nodePaths:D,context:j};B&&(c.plugins=B),a&&(c.mangleCache=a);let h=(S,O)=>{let A={errors:ae(S.errors,T),warnings:ae(S.warnings,T),outputFiles:void 0,metafile:void 0,mangleCache:void 0},R=A.errors.slice(),k=A.warnings.slice();S.outputFiles&&(A.outputFiles=S.outputFiles.map(st)),S.metafile&&(A.metafile=JSON.parse(S.metafile)),S.mangleCache&&(A.mangleCache=S.mangleCache),S.writeToStdout!==void 0&&console.log(ie(S.writeToStdout).replace(/\n$/,"")),z(A,(F,P)=>{if(R.length>0||F.length>0){let q=fe("Build failed",R.concat(F),k.concat(P));return O(q,null,F,P)}O(null,A,F,P)})},E,C;j&&(f["on-end"]=(S,O)=>new Promise(A=>{h(O,(R,k,F,P)=>{let q={errors:F,warnings:P};C&&C(R,k),E=void 0,C=void 0,i(S,q),A()})})),n(u,c,(S,O)=>{if(S)return w(new Error(S),null);if(!j)return h(O,(k,F)=>(J(),w(k,F)));if(O.errors.length>0)return w(fe("Context failed",O.errors,O.warnings),null);let A=!1,R={rebuild:()=>(E||(E=new Promise((k,F)=>{let P;C=(_,H)=>{P||(P=()=>_?F(_):k(H))};let q=()=>{n(u,{command:"rebuild",key:t},(H,oe)=>{H?F(new Error(H)):P?P():q()})};q()})),E),watch:(k={})=>new Promise((F,P)=>{if(!l.hasFS)throw new Error('Cannot use the "watch" API in this environment');K(k,{},"in watch() call"),n(u,{command:"watch",key:t},H=>{H?P(new Error(H)):F(void 0)})}),serve:(k={})=>new Promise((F,P)=>{if(!l.hasFS)throw new Error('Cannot use the "serve" API in this environment');let q={},_=r(k,q,"port",se),H=r(k,q,"host",y),oe=r(k,q,"servedir",y),g=r(k,q,"keyfile",y),N=r(k,q,"certfile",y),X=r(k,q,"fallback",y),te=r(k,q,"onRequest",Pe);K(k,q,"in serve() call");let G={command:"serve",key:t,onRequest:!!te};_!==void 0&&(G.port=_),H!==void 0&&(G.host=H),oe!==void 0&&(G.servedir=oe),g!==void 0&&(G.keyfile=g),N!==void 0&&(G.certfile=N),X!==void 0&&(G.fallback=X),n(u,G,(ce,Ie)=>{if(ce)return P(new Error(ce));te&&(f["serve-request"]=(We,ze)=>{te(ze.args),i(We,{})}),F(Ie)})}),cancel:()=>new Promise(k=>{if(A)return k();n(u,{command:"cancel",key:t},()=>{k()})}),dispose:()=>new Promise(k=>{if(A)return k();A=!0,n(u,{command:"dispose",key:t},()=>{k(),J(),u.unref()})})};u.ref(),w(null,R)})}}var lt=(e,t,n,i,u,l,f,s,p)=>ne(void 0,null,function*(){let b=[],w=[],T={},j={},U=[],L=0,Q=0,B=[],z=!1;s=[...s];for(let m of s){let d={};if(typeof m!="object")throw new Error(`Plugin at index ${Q} must be an object`);let o=r(m,d,"name",y);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${Q} is missing a name`);try{let x=r(m,d,"setup",Pe);if(typeof x!="function")throw new Error("Plugin is missing a setup function");K(m,d,`on plugin ${Y(o)}`);let $={name:o,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};Q++;let D=x({initialOptions:f,resolve:(a,c={})=>{if(!z)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof a!="string")throw new Error("The path to resolve must be a string");let h=Object.create(null),E=r(c,h,"pluginName",y),C=r(c,h,"importer",y),S=r(c,h,"namespace",y),O=r(c,h,"resolveDir",y),A=r(c,h,"kind",y),R=r(c,h,"pluginData",ye);return K(c,h,"in resolve() call"),new Promise((k,F)=>{let P={command:"resolve",path:a,key:e,pluginName:o};if(E!=null&&(P.pluginName=E),C!=null&&(P.importer=C),S!=null&&(P.namespace=S),O!=null&&(P.resolveDir=O),A!=null)P.kind=A;else throw new Error('Must specify "kind" when calling "resolve"');R!=null&&(P.pluginData=p.store(R)),t(i,P,(q,_)=>{q!==null?F(new Error(q)):k({errors:ae(_.errors,p),warnings:ae(_.warnings,p),path:_.path,external:_.external,sideEffects:_.sideEffects,namespace:_.namespace,suffix:_.suffix,pluginData:p.load(_.pluginData)})})})},onStart(a){let c='This error came from the "onStart" callback registered here:',h=ge(new Error(c),u,"onStart");b.push({name:o,callback:a,note:h}),$.onStart=!0},onEnd(a){let c='This error came from the "onEnd" callback registered here:',h=ge(new Error(c),u,"onEnd");w.push({name:o,callback:a,note:h}),$.onEnd=!0},onResolve(a,c){let h='This error came from the "onResolve" callback registered here:',E=ge(new Error(h),u,"onResolve"),C={},S=r(a,C,"filter",he),O=r(a,C,"namespace",y);if(K(a,C,`in onResolve() call for plugin ${Y(o)}`),S==null)throw new Error("onResolve() call is missing a filter");let A=L++;T[A]={name:o,callback:c,note:E},$.onResolve.push({id:A,filter:S.source,namespace:O||""})},onLoad(a,c){let h='This error came from the "onLoad" callback registered here:',E=ge(new Error(h),u,"onLoad"),C={},S=r(a,C,"filter",he),O=r(a,C,"namespace",y);if(K(a,C,`in onLoad() call for plugin ${Y(o)}`),S==null)throw new Error("onLoad() call is missing a filter");let A=L++;j[A]={name:o,callback:c,note:E},$.onLoad.push({id:A,filter:S.source,namespace:O||""})},onDispose(a){U.push(a)},esbuild:u.esbuild});D&&(yield D),B.push($)}catch(x){return{ok:!1,error:x,pluginName:o}}}l["on-start"]=(m,d)=>ne(void 0,null,function*(){let o={errors:[],warnings:[]};yield Promise.all(b.map(D=>ne(void 0,[D],function*({name:x,callback:$,note:M}){try{let a=yield $();if(a!=null){if(typeof a!="object")throw new Error(`Expected onStart() callback in plugin ${Y(x)} to return an object`);let c={},h=r(a,c,"errors",W),E=r(a,c,"warnings",W);K(a,c,`from onStart() callback in plugin ${Y(x)}`),h!=null&&o.errors.push(...re(h,"errors",p,x)),E!=null&&o.warnings.push(...re(E,"warnings",p,x))}}catch(a){o.errors.push(le(a,u,p,M&&M(),x))}}))),n(m,o)}),l["on-resolve"]=(m,d)=>ne(void 0,null,function*(){let o={},x="",$,M;for(let D of d.ids)try{({name:x,callback:$,note:M}=T[D]);let a=yield $({path:d.path,importer:d.importer,namespace:d.namespace,resolveDir:d.resolveDir,kind:d.kind,pluginData:p.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onResolve() callback in plugin ${Y(x)} to return an object`);let c={},h=r(a,c,"pluginName",y),E=r(a,c,"path",y),C=r(a,c,"namespace",y),S=r(a,c,"suffix",y),O=r(a,c,"external",I),A=r(a,c,"sideEffects",I),R=r(a,c,"pluginData",ye),k=r(a,c,"errors",W),F=r(a,c,"warnings",W),P=r(a,c,"watchFiles",W),q=r(a,c,"watchDirs",W);K(a,c,`from onResolve() callback in plugin ${Y(x)}`),o.id=D,h!=null&&(o.pluginName=h),E!=null&&(o.path=E),C!=null&&(o.namespace=C),S!=null&&(o.suffix=S),O!=null&&(o.external=O),A!=null&&(o.sideEffects=A),R!=null&&(o.pluginData=p.store(R)),k!=null&&(o.errors=re(k,"errors",p,x)),F!=null&&(o.warnings=re(F,"warnings",p,x)),P!=null&&(o.watchFiles=me(P,"watchFiles")),q!=null&&(o.watchDirs=me(q,"watchDirs"));break}}catch(a){o={id:D,errors:[le(a,u,p,M&&M(),x)]};break}n(m,o)}),l["on-load"]=(m,d)=>ne(void 0,null,function*(){let o={},x="",$,M;for(let D of d.ids)try{({name:x,callback:$,note:M}=j[D]);let a=yield $({path:d.path,namespace:d.namespace,suffix:d.suffix,pluginData:p.load(d.pluginData)});if(a!=null){if(typeof a!="object")throw new Error(`Expected onLoad() callback in plugin ${Y(x)} to return an object`);let c={},h=r(a,c,"pluginName",y),E=r(a,c,"contents",Te),C=r(a,c,"resolveDir",y),S=r(a,c,"pluginData",ye),O=r(a,c,"loader",y),A=r(a,c,"errors",W),R=r(a,c,"warnings",W),k=r(a,c,"watchFiles",W),F=r(a,c,"watchDirs",W);K(a,c,`from onLoad() callback in plugin ${Y(x)}`),o.id=D,h!=null&&(o.pluginName=h),E instanceof Uint8Array?o.contents=E:E!=null&&(o.contents=Z(E)),C!=null&&(o.resolveDir=C),S!=null&&(o.pluginData=p.store(S)),O!=null&&(o.loader=O),A!=null&&(o.errors=re(A,"errors",p,x)),R!=null&&(o.warnings=re(R,"warnings",p,x)),k!=null&&(o.watchFiles=me(k,"watchFiles")),F!=null&&(o.watchDirs=me(F,"watchDirs"));break}}catch(a){o={id:D,errors:[le(a,u,p,M&&M(),x)]};break}n(m,o)});let J=(m,d)=>d([],[]);w.length>0&&(J=(m,d)=>{ne(void 0,null,function*(){let o=[],x=[];for(let{name:$,callback:M,note:D}of w){let a,c;try{let h=yield M(m);if(h!=null){if(typeof h!="object")throw new Error(`Expected onEnd() callback in plugin ${Y($)} to return an object`);let E={},C=r(h,E,"errors",W),S=r(h,E,"warnings",W);K(h,E,`from onEnd() callback in plugin ${Y($)}`),C!=null&&(a=re(C,"errors",p,$)),S!=null&&(c=re(S,"warnings",p,$))}}catch(h){a=[le(h,u,p,D&&D(),$)]}if(a){o.push(...a);try{m.errors.push(...a)}catch(h){}}if(c){x.push(...c);try{m.warnings.push(...c)}catch(h){}}}d(o,x)})});let v=()=>{for(let m of U)setTimeout(()=>m(),0)};return z=!0,{ok:!0,requestPlugins:B,runOnEndCallbacks:J,scheduleOnDisposeCallbacks:v}});function qe(){let e=new Map,t=0;return{load(n){return e.get(n)},store(n){if(n===void 0)return-1;let i=t++;return e.set(i,n),i}}}function ge(e,t,n){let i,u=!1;return()=>{if(u)return i;u=!0;try{let l=(e.stack+"").split(`
|
|
`);l.splice(1,1);let f=Ne(t,l,n);if(f)return i={text:e.message,location:f},i}catch(l){}}}function le(e,t,n,i,u){let l="Internal error",f=null;try{l=(e&&e.message||e)+""}catch(s){}try{f=Ne(t,(e.stack+"").split(`
|
|
`),"")}catch(s){}return{id:"",pluginName:u,text:l,location:f,notes:i?[i]:[],detail:n?n.store(e):-1}}function Ne(e,t,n){let i=" at ";if(e.readFileSync&&!t[0].startsWith(i)&&t[1].startsWith(i))for(let u=1;u<t.length;u++){let l=t[u];if(l.startsWith(i))for(l=l.slice(i.length);;){let f=/^(?:new |async )?\S+ \((.*)\)$/.exec(l);if(f){l=f[1];continue}if(f=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(l),f){l=f[1];continue}if(f=/^(\S+):(\d+):(\d+)$/.exec(l),f){let s;try{s=e.readFileSync(f[1],"utf8")}catch(T){break}let p=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",b=+f[3]-1,w=p.slice(b,b+n.length)===n?n.length:0;return{file:f[1],namespace:"file",line:+f[2],column:Z(p.slice(0,b)).length,length:Z(p.slice(b,b+w)).length,lineText:p+`
|
|
`+t.slice(1).join(`
|
|
`),suggestion:""}}break}}return null}function fe(e,t,n){let i=5,u=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,i+1).map((f,s)=>{if(s===i)return`
|
|
...`;if(!f.location)return`
|
|
error: ${f.text}`;let{file:p,line:b,column:w}=f.location,T=f.pluginName?`[plugin: ${f.pluginName}] `:"";return`
|
|
${p}:${b}:${w}: ERROR: ${T}${f.text}`}).join(""),l=new Error(`${e}${u}`);return l.errors=t,l.warnings=n,l}function ae(e,t){for(let n of e)n.detail=t.load(n.detail);return e}function De(e,t){if(e==null)return null;let n={},i=r(e,n,"file",y),u=r(e,n,"namespace",y),l=r(e,n,"line",se),f=r(e,n,"column",se),s=r(e,n,"length",se),p=r(e,n,"lineText",y),b=r(e,n,"suggestion",y);return K(e,n,t),{file:i||"",namespace:u||"",line:l||0,column:f||0,length:s||0,lineText:p||"",suggestion:b||""}}function re(e,t,n,i){let u=[],l=0;for(let f of e){let s={},p=r(f,s,"id",y),b=r(f,s,"pluginName",y),w=r(f,s,"text",y),T=r(f,s,"location",Ae),j=r(f,s,"notes",W),U=r(f,s,"detail",ye),L=`in element ${l} of "${t}"`;K(f,s,L);let Q=[];if(j)for(let B of j){let z={},J=r(B,z,"text",y),v=r(B,z,"location",Ae);K(B,z,L),Q.push({text:J||"",location:De(v,L)})}u.push({id:p||"",pluginName:b||i,text:w||"",location:De(T,L),notes:Q,detail:n?n.store(U):-1}),l++}return u}function me(e,t){let n=[];for(let i of e){if(typeof i!="string")throw new Error(`${Y(t)} must be an array of strings`);n.push(i)}return n}function st({path:e,contents:t}){let n=null;return{path:e,contents:t,get text(){let i=this.contents;return(n===null||i!==t)&&(t=i,n=ie(i)),n}}}var at="0.18.17",ut=e=>de().build(e),ct=e=>de().context(e),ft=(e,t)=>de().transform(e,t),dt=(e,t)=>de().formatMessages(e,t),pt=(e,t)=>de().analyzeMetafile(e,t),gt=()=>{throw new Error('The "buildSync" API only works in node')},mt=()=>{throw new Error('The "transformSync" API only works in node')},yt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ht=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ue,Se,de=()=>{if(Se)return Se;throw ue?new Error('You need to wait for the promise returned from "initialize" to be resolved before calling this'):new Error('You need to call "initialize" before calling this')},bt=e=>{e=Be(e||{});let t=e.wasmURL,n=e.wasmModule,i=e.worker!==!1;if(!t&&!n)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ue)throw new Error('Cannot call "initialize" more than once');return ue=wt(t||"",n,i),ue.catch(()=>{ue=void 0}),ue},wt=(e,t,n)=>ne(void 0,null,function*(){let i;if(n){let b=new Blob(['onmessage=(postMessage=>{\n// Copyright 2018 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\nvar y=(r,f,m)=>new Promise((c,n)=>{var s=h=>{try{l(m.next(h))}catch(u){n(u)}},i=h=>{try{l(m.throw(h))}catch(u){n(u)}},l=h=>h.done?c(h.value):Promise.resolve(h.value).then(s,i);l((m=m.apply(r,f)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){c+=m.decode(s);const i=c.lastIndexOf(`\n`);return i!=-1&&(console.log(c.substring(0,i)),c=c.substring(i+1)),s.length},write(n,s,i,l,h,u){if(i!==0||l!==s.length||h!==null){u(r());return}const g=this.writeSync(n,s);u(null,g)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),m=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let d=0;switch(typeof t){case"object":t!==null&&(d=1);break;case"string":d=2;break;case"symbol":d=3;break;case"function":d=4;break}this.mem.setUint32(e+4,2146959360|d,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let d=0;d<o;d++)a[d]=s(t+d*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return m.decode(new DataView(this._inst.exports.mem.buffer,t,o))},g=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=h(e+32),d=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,d),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(c){return y(this,null,function*(){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=f.encode(e+"\\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const g=4096+8192;if(n>=g)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(c){const n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,m=globalThis.fs,c="";m.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let g=c.split(`\n`);g.length>1&&console.log(g.slice(0,-1).join(`\n`)),c=g[g.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},m.read=(h,u,g,e,t,o)=>{if(h!==0||g!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>m.read(h,u,g,e,t,o);return}let a=n[0],d=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+d),g),i+=d,i===a.length&&(n.shift(),i=0),o(null,d)};let l=new globalThis.Go;l.argv=["","--service=0.18.17"],tryToInstantiateModule(r,l).then(h=>{postMessage(null),l.run(h)},h=>{postMessage(h)})};function tryToInstantiateModule(r,f){return y(this,null,function*(){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const m=yield fetch(r);if(!m.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(m.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(m,f.importObject)).instance;const c=yield m.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});i=new Worker(URL.createObjectURL(b))}else{let b=(postMessage=>{
|
|
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
var y=(r,f,m)=>new Promise((c,n)=>{var s=h=>{try{l(m.next(h))}catch(u){n(u)}},i=h=>{try{l(m.throw(h))}catch(u){n(u)}},l=h=>h.done?c(h.value):Promise.resolve(h.value).then(s,i);l((m=m.apply(r,f)).next())});let onmessage,globalThis={};for(let r=self;r;r=Object.getPrototypeOf(r))for(let f of Object.getOwnPropertyNames(r))f in globalThis||Object.defineProperty(globalThis,f,{get:()=>self[f]});(()=>{const r=()=>{const c=new Error("not implemented");return c.code="ENOSYS",c};if(!globalThis.fs){let c="";globalThis.fs={constants:{O_WRONLY:-1,O_RDWR:-1,O_CREAT:-1,O_TRUNC:-1,O_APPEND:-1,O_EXCL:-1},writeSync(n,s){c+=m.decode(s);const i=c.lastIndexOf(`
|
|
`);return i!=-1&&(console.log(c.substring(0,i)),c=c.substring(i+1)),s.length},write(n,s,i,l,h,u){if(i!==0||l!==s.length||h!==null){u(r());return}const g=this.writeSync(n,s);u(null,g)},chmod(n,s,i){i(r())},chown(n,s,i,l){l(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,l){l(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,l){l(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,l){l(r())},read(n,s,i,l,h,u){u(r())},readdir(n,s){s(r())},readlink(n,s){s(r())},rename(n,s,i){i(r())},rmdir(n,s){s(r())},stat(n,s){s(r())},symlink(n,s,i){i(r())},truncate(n,s,i){i(r())},unlink(n,s){s(r())},utimes(n,s,i,l){l(r())}}}if(globalThis.process||(globalThis.process={getuid(){return-1},getgid(){return-1},geteuid(){return-1},getegid(){return-1},getgroups(){throw r()},pid:-1,ppid:-1,umask(){throw r()},cwd(){throw r()},chdir(){throw r()}}),!globalThis.crypto)throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");if(!globalThis.performance)throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");if(!globalThis.TextEncoder)throw new Error("globalThis.TextEncoder is not available, polyfill required");if(!globalThis.TextDecoder)throw new Error("globalThis.TextDecoder is not available, polyfill required");const f=new TextEncoder("utf-8"),m=new TextDecoder("utf-8");globalThis.Go=class{constructor(){this.argv=["js"],this.env={},this.exit=e=>{e!==0&&console.warn("exit code:",e)},this._exitPromise=new Promise(e=>{this._resolveExitPromise=e}),this._pendingEvent=null,this._scheduledTimeouts=new Map,this._nextCallbackTimeoutID=1;const c=(e,t)=>{this.mem.setUint32(e+0,t,!0),this.mem.setUint32(e+4,Math.floor(t/4294967296),!0)},n=e=>{const t=this.mem.getUint32(e+0,!0),o=this.mem.getInt32(e+4,!0);return t+o*4294967296},s=e=>{const t=this.mem.getFloat64(e,!0);if(t===0)return;if(!isNaN(t))return t;const o=this.mem.getUint32(e,!0);return this._values[o]},i=(e,t)=>{if(typeof t=="number"&&t!==0){if(isNaN(t)){this.mem.setUint32(e+4,2146959360,!0),this.mem.setUint32(e,0,!0);return}this.mem.setFloat64(e,t,!0);return}if(t===void 0){this.mem.setFloat64(e,0,!0);return}let a=this._ids.get(t);a===void 0&&(a=this._idPool.pop(),a===void 0&&(a=this._values.length),this._values[a]=t,this._goRefCounts[a]=0,this._ids.set(t,a)),this._goRefCounts[a]++;let d=0;switch(typeof t){case"object":t!==null&&(d=1);break;case"string":d=2;break;case"symbol":d=3;break;case"function":d=4;break}this.mem.setUint32(e+4,2146959360|d,!0),this.mem.setUint32(e,a,!0)},l=e=>{const t=n(e+0),o=n(e+8);return new Uint8Array(this._inst.exports.mem.buffer,t,o)},h=e=>{const t=n(e+0),o=n(e+8),a=new Array(o);for(let d=0;d<o;d++)a[d]=s(t+d*8);return a},u=e=>{const t=n(e+0),o=n(e+8);return m.decode(new DataView(this._inst.exports.mem.buffer,t,o))},g=Date.now()-performance.now();this.importObject={go:{"runtime.wasmExit":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);this.exited=!0,delete this._inst,delete this._values,delete this._goRefCounts,delete this._ids,delete this._idPool,this.exit(t)},"runtime.wasmWrite":e=>{e>>>=0;const t=n(e+8),o=n(e+16),a=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,a))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(g+performance.now())*1e6)},"runtime.walltime":e=>{e>>>=0;const t=new Date().getTime();c(e+8,t/1e3),this.mem.setInt32(e+16,t%1e3*1e6,!0)},"runtime.scheduleTimeoutEvent":e=>{e>>>=0;const t=this._nextCallbackTimeoutID;this._nextCallbackTimeoutID++,this._scheduledTimeouts.set(t,setTimeout(()=>{for(this._resume();this._scheduledTimeouts.has(t);)console.warn("scheduleTimeoutEvent: missed timeout event"),this._resume()},n(e+8)+1)),this.mem.setInt32(e+16,t,!0)},"runtime.clearTimeoutEvent":e=>{e>>>=0;const t=this.mem.getInt32(e+8,!0);clearTimeout(this._scheduledTimeouts.get(t)),this._scheduledTimeouts.delete(t)},"runtime.getRandomData":e=>{e>>>=0,crypto.getRandomValues(l(e+8))},"syscall/js.finalizeRef":e=>{e>>>=0;const t=this.mem.getUint32(e+8,!0);if(this._goRefCounts[t]--,this._goRefCounts[t]===0){const o=this._values[t];this._values[t]=null,this._ids.delete(o),this._idPool.push(t)}},"syscall/js.stringVal":e=>{e>>>=0,i(e+24,u(e+8))},"syscall/js.valueGet":e=>{e>>>=0;const t=Reflect.get(s(e+8),u(e+16));e=this._inst.exports.getsp()>>>0,i(e+32,t)},"syscall/js.valueSet":e=>{e>>>=0,Reflect.set(s(e+8),u(e+16),s(e+32))},"syscall/js.valueDelete":e=>{e>>>=0,Reflect.deleteProperty(s(e+8),u(e+16))},"syscall/js.valueIndex":e=>{e>>>=0,i(e+24,Reflect.get(s(e+8),n(e+16)))},"syscall/js.valueSetIndex":e=>{e>>>=0,Reflect.set(s(e+8),n(e+16),s(e+24))},"syscall/js.valueCall":e=>{e>>>=0;try{const t=s(e+8),o=Reflect.get(t,u(e+16)),a=h(e+32),d=Reflect.apply(o,t,a);e=this._inst.exports.getsp()>>>0,i(e+56,d),this.mem.setUint8(e+64,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+56,t),this.mem.setUint8(e+64,0)}},"syscall/js.valueInvoke":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueNew":e=>{e>>>=0;try{const t=s(e+8),o=h(e+16),a=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,a),this.mem.setUint8(e+48,1)}catch(t){e=this._inst.exports.getsp()>>>0,i(e+40,t),this.mem.setUint8(e+48,0)}},"syscall/js.valueLength":e=>{e>>>=0,c(e+16,parseInt(s(e+8).length))},"syscall/js.valuePrepareString":e=>{e>>>=0;const t=f.encode(String(s(e+8)));i(e+16,t),c(e+24,t.length)},"syscall/js.valueLoadString":e=>{e>>>=0;const t=s(e+8);l(e+16).set(t)},"syscall/js.valueInstanceOf":e=>{e>>>=0,this.mem.setUint8(e+24,s(e+8)instanceof s(e+16)?1:0)},"syscall/js.copyBytesToGo":e=>{e>>>=0;const t=l(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=l(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const a=o.subarray(0,t.length);t.set(a),c(e+40,a.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}run(c){return y(this,null,function*(){if(!(c instanceof WebAssembly.Instance))throw new Error("Go.run: WebAssembly.Instance expected");this._inst=c,this.mem=new DataView(this._inst.exports.mem.buffer),this._values=[NaN,0,null,!0,!1,globalThis,this],this._goRefCounts=new Array(this._values.length).fill(1/0),this._ids=new Map([[0,1],[null,2],[!0,3],[!1,4],[globalThis,5],[this,6]]),this._idPool=[],this.exited=!1;let n=4096;const s=e=>{const t=n,o=f.encode(e+"\0");return new Uint8Array(this.mem.buffer,n,o.length).set(o),n+=o.length,n%8!==0&&(n+=8-n%8),t},i=this.argv.length,l=[];this.argv.forEach(e=>{l.push(s(e))}),l.push(0),Object.keys(this.env).sort().forEach(e=>{l.push(s(`${e}=${this.env[e]}`))}),l.push(0);const u=n;l.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const g=4096+8192;if(n>=g)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),yield this._exitPromise})}_resume(){if(this.exited)throw new Error("Go program has already exited");this._inst.exports.resume(),this.exited&&this._resolveExitPromise()}_makeFuncWrapper(c){const n=this;return function(){const s={id:c,this:this,args:arguments};return n._pendingEvent=s,n._resume(),s.result}}}})(),onmessage=({data:r})=>{let f=new TextDecoder,m=globalThis.fs,c="";m.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let g=c.split(`
|
|
`);g.length>1&&console.log(g.slice(0,-1).join(`
|
|
`)),c=g[g.length-1]}else throw new Error("Bad write");return u.length};let n=[],s,i=0;onmessage=({data:h})=>{h.length>0&&(n.push(h),s&&s())},m.read=(h,u,g,e,t,o)=>{if(h!==0||g!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>m.read(h,u,g,e,t,o);return}let a=n[0],d=Math.max(0,Math.min(e,a.length-i));u.set(a.subarray(i,i+d),g),i+=d,i===a.length&&(n.shift(),i=0),o(null,d)};let l=new globalThis.Go;l.argv=["","--service=0.18.17"],tryToInstantiateModule(r,l).then(h=>{postMessage(null),l.run(h)},h=>{postMessage(h)})};function tryToInstantiateModule(r,f){return y(this,null,function*(){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const m=yield fetch(r);if(!m.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(m.headers.get("Content-Type")||""))return(yield WebAssembly.instantiateStreaming(m,f.importObject)).instance;const c=yield m.arrayBuffer();return(yield WebAssembly.instantiate(c,f.importObject)).instance})}return r=>onmessage(r);})(w=>i.onmessage({data:w}));i={onmessage:null,postMessage:w=>setTimeout(()=>b({data:w})),terminate(){}}}let u,l,f=new Promise((b,w)=>{u=b,l=w});i.onmessage=({data:b})=>{i.onmessage=({data:w})=>s(w),b?l(b):u()},i.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:s,service:p}=Le({writeToStdin(b){i.postMessage(b)},isSync:!1,hasFS:!1,esbuild:we});yield f,Se={build:b=>new Promise((w,T)=>p.buildOrContext({callName:"build",refs:null,options:b,isTTY:!1,defaultWD:"/",callback:(j,U)=>j?T(j):w(U)})),context:b=>new Promise((w,T)=>p.buildOrContext({callName:"context",refs:null,options:b,isTTY:!1,defaultWD:"/",callback:(j,U)=>j?T(j):w(U)})),transform:(b,w)=>new Promise((T,j)=>p.transform({callName:"transform",refs:null,input:b,options:w||{},isTTY:!1,fs:{readFile(U,L){L(new Error("Internal error"),null)},writeFile(U,L){L(null)}},callback:(U,L)=>U?j(U):T(L)})),formatMessages:(b,w)=>new Promise((T,j)=>p.formatMessages({callName:"formatMessages",refs:null,messages:b,options:w,callback:(U,L)=>U?j(U):T(L)})),analyzeMetafile:(b,w)=>new Promise((T,j)=>p.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof b=="string"?b:JSON.stringify(b),options:w,callback:(U,L)=>U?j(U):T(L)}))}}),vt=we;
|
|
})(typeof module==="object"?module:{set exports(x){(typeof self!=="undefined"?self:this).esbuild=x}});
|