isomorfeus-asset-manager 0.15.11 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,20 @@
1
- var Fe=Object.defineProperty;var Ne=(t,e)=>{for(var r in e)Fe(t,r,{get:e[r],enumerable:!0})};var ge={};Ne(ge,{analyzeMetafile:()=>lt,analyzeMetafileSync:()=>at,build:()=>et,buildSync:()=>it,default:()=>ct,formatMessages:()=>nt,formatMessagesSync:()=>ot,initialize:()=>ut,serve:()=>tt,transform:()=>rt,transformSync:()=>st,version:()=>Ze});function ye(t){let e=s=>{if(s===null)r.write8(0);else if(typeof s=="boolean")r.write8(1),r.write8(+s);else if(typeof s=="number")r.write8(2),r.write32(s|0);else if(typeof s=="string")r.write8(3),r.write(H(s));else if(s instanceof Uint8Array)r.write8(4),r.write(s);else if(s instanceof Array){r.write8(5),r.write32(s.length);for(let a of s)e(a)}else{let a=Object.keys(s);r.write8(6),r.write32(a.length);for(let l of a)r.write(H(l)),e(s[l])}},r=new oe;return r.write32(0),r.write32(t.id<<1|+!t.isRequest),e(t.value),me(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function xe(t){let e=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return ee(r.read());case 4:return r.read();case 5:{let f=r.read32(),o=[];for(let g=0;g<f;g++)o.push(e());return o}case 6:{let f=r.read32(),o={};for(let g=0;g<f;g++)o[ee(r.read())]=e();return o}default:throw new Error("Invalid packet")}},r=new oe(t),s=r.read32(),a=(s&1)===0;s>>>=1;let l=e();if(r.ptr!==t.length)throw new Error("Invalid packet");return{id:s,isRequest:a,value:l}}var oe=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 r=new Uint8Array((this.len+e)*2);r.set(this.buf),this.buf=r}return this.len+=e,this.len-e}write8(e){let r=this._write(1);this.buf[r]=e}write32(e){let r=this._write(4);me(this.buf,e,r)}write(e){let r=this._write(4+e.length);me(this.buf,e.length,r),this.buf.set(e,r+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 he(this.buf,this._read(4))}read(){let e=this.read32(),r=new Uint8Array(e),s=this._read(r.length);return r.set(this.buf.subarray(s,s+e)),r}},H,ee;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let t=new TextEncoder,e=new TextDecoder;H=r=>t.encode(r),ee=r=>e.decode(r)}else if(typeof Buffer!="undefined")H=t=>{let e=Buffer.from(t);return e instanceof Uint8Array||(e=new Uint8Array(e)),e},ee=t=>{let{buffer:e,byteOffset:r,byteLength:s}=t;return Buffer.from(e,r,s).toString()};else throw new Error("No UTF-8 codec found");function he(t,e){return t[e++]|t[e++]<<8|t[e++]<<16|t[e++]<<24}function me(t,e,r){t[r++]=e,t[r++]=e>>8,t[r++]=e>>16,t[r++]=e>>24}var Se="warning",Ee="silent";function ke(t){if(t+="",t.indexOf(",")>=0)throw new Error(`Invalid target: ${t}`);return t}var fe=()=>null,F=t=>typeof t=="boolean"?null:"a boolean",We=t=>typeof t=="boolean"||typeof t=="object"&&!Array.isArray(t)?null:"a boolean or an object",h=t=>typeof t=="string"?null:"a string",ce=t=>t instanceof RegExp?null:"a RegExp object",ne=t=>typeof t=="number"&&t===(t|0)?null:"an integer",be=t=>typeof t=="function"?null:"a function",q=t=>Array.isArray(t)?null:"an array",G=t=>typeof t=="object"&&t!==null&&!Array.isArray(t)?null:"an object",qe=t=>t instanceof WebAssembly.Module?null:"a WebAssembly.Module",Ie=t=>typeof t=="object"&&t!==null?null:"an array or an object",$e=t=>typeof t=="object"&&!Array.isArray(t)?null:"an object or null",Ae=t=>typeof t=="string"||typeof t=="boolean"?null:"a string or a boolean",ze=t=>typeof t=="string"||typeof t=="object"&&t!==null&&!Array.isArray(t)?null:"a string or an object",Ke=t=>typeof t=="string"||Array.isArray(t)?null:"a string or an array",Ce=t=>typeof t=="string"||t instanceof Uint8Array?null:"a string or a Uint8Array",_e=t=>typeof t=="string"||t instanceof URL?null:"a string or a URL";function n(t,e,r,s){let a=t[r];if(e[r+""]=!0,a===void 0)return;let l=s(a);if(l!==null)throw new Error(`"${r}" must be ${l}`);return a}function z(t,e,r){for(let s in t)if(!(s in e))throw new Error(`Invalid option ${r}: "${s}"`)}function De(t){let e=Object.create(null),r=n(t,e,"wasmURL",_e),s=n(t,e,"wasmModule",qe),a=n(t,e,"worker",F);return z(t,e,"in initialize() call"),{wasmURL:r,wasmModule:s,worker:a}}function Pe(t){let e;if(t!==void 0){e=Object.create(null);for(let r of Object.keys(t)){let s=t[r];if(typeof s=="string"||s===!1)e[r]=s;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return e}function de(t,e,r,s,a){let l=n(e,r,"color",F),f=n(e,r,"logLevel",h),o=n(e,r,"logLimit",ne);l!==void 0?t.push(`--color=${l}`):s&&t.push("--color=true"),t.push(`--log-level=${f||a}`),t.push(`--log-limit=${o||0}`)}function Ue(t,e,r){let s=n(e,r,"legalComments",h),a=n(e,r,"sourceRoot",h),l=n(e,r,"sourcesContent",F),f=n(e,r,"target",Ke),o=n(e,r,"format",h),g=n(e,r,"globalName",h),b=n(e,r,"mangleProps",ce),v=n(e,r,"reserveProps",ce),C=n(e,r,"mangleQuoted",F),B=n(e,r,"minify",F),k=n(e,r,"minifySyntax",F),P=n(e,r,"minifyWhitespace",F),I=n(e,r,"minifyIdentifiers",F),L=n(e,r,"drop",q),V=n(e,r,"charset",h),R=n(e,r,"treeShaking",F),d=n(e,r,"ignoreAnnotations",F),i=n(e,r,"jsx",h),u=n(e,r,"jsxFactory",h),y=n(e,r,"jsxFragment",h),E=n(e,r,"jsxImportSource",h),S=n(e,r,"jsxDev",F),c=n(e,r,"jsxSideEffects",F),p=n(e,r,"define",G),w=n(e,r,"logOverride",G),$=n(e,r,"supported",G),x=n(e,r,"pure",q),D=n(e,r,"keepNames",F),M=n(e,r,"platform",h);if(s&&t.push(`--legal-comments=${s}`),a!==void 0&&t.push(`--source-root=${a}`),l!==void 0&&t.push(`--sources-content=${l}`),f&&(Array.isArray(f)?t.push(`--target=${Array.from(f).map(ke).join(",")}`):t.push(`--target=${ke(f)}`)),o&&t.push(`--format=${o}`),g&&t.push(`--global-name=${g}`),M&&t.push(`--platform=${M}`),B&&t.push("--minify"),k&&t.push("--minify-syntax"),P&&t.push("--minify-whitespace"),I&&t.push("--minify-identifiers"),V&&t.push(`--charset=${V}`),R!==void 0&&t.push(`--tree-shaking=${R}`),d&&t.push("--ignore-annotations"),L)for(let O of L)t.push(`--drop:${O}`);if(b&&t.push(`--mangle-props=${b.source}`),v&&t.push(`--reserve-props=${v.source}`),C!==void 0&&t.push(`--mangle-quoted=${C}`),i&&t.push(`--jsx=${i}`),u&&t.push(`--jsx-factory=${u}`),y&&t.push(`--jsx-fragment=${y}`),E&&t.push(`--jsx-import-source=${E}`),S&&t.push("--jsx-dev"),c&&t.push("--jsx-side-effects"),p)for(let O in p){if(O.indexOf("=")>=0)throw new Error(`Invalid define: ${O}`);t.push(`--define:${O}=${p[O]}`)}if(w)for(let O in w){if(O.indexOf("=")>=0)throw new Error(`Invalid log override: ${O}`);t.push(`--log-override:${O}=${w[O]}`)}if($)for(let O in $){if(O.indexOf("=")>=0)throw new Error(`Invalid supported: ${O}`);t.push(`--supported:${O}=${$[O]}`)}if(x)for(let O of x)t.push(`--pure:${O}`);D&&t.push("--keep-names")}function Ve(t,e,r,s,a){var J;let l=[],f=[],o=Object.create(null),g=null,b=null,v=null;de(l,e,o,r,s),Ue(l,e,o);let C=n(e,o,"sourcemap",Ae),B=n(e,o,"bundle",F),k=n(e,o,"watch",We),P=n(e,o,"splitting",F),I=n(e,o,"preserveSymlinks",F),L=n(e,o,"metafile",F),V=n(e,o,"outfile",h),R=n(e,o,"outdir",h),d=n(e,o,"outbase",h),i=n(e,o,"tsconfig",h),u=n(e,o,"resolveExtensions",q),y=n(e,o,"nodePaths",q),E=n(e,o,"mainFields",q),S=n(e,o,"conditions",q),c=n(e,o,"external",q),p=n(e,o,"alias",G),w=n(e,o,"loader",G),$=n(e,o,"outExtension",G),x=n(e,o,"publicPath",h),D=n(e,o,"entryNames",h),M=n(e,o,"chunkNames",h),O=n(e,o,"assetNames",h),U=n(e,o,"inject",q),W=n(e,o,"banner",G),K=n(e,o,"footer",G),N=n(e,o,"entryPoints",Ie),T=n(e,o,"absWorkingDir",h),A=n(e,o,"stdin",G),_=(J=n(e,o,"write",F))!=null?J:a,Y=n(e,o,"allowOverwrite",F),Z=n(e,o,"incremental",F)===!0,se=n(e,o,"mangleCache",G);if(o.plugins=!0,z(e,o,`in ${t}() call`),C&&l.push(`--sourcemap${C===!0?"":`=${C}`}`),B&&l.push("--bundle"),Y&&l.push("--allow-overwrite"),k)if(l.push("--watch"),typeof k=="boolean")v={};else{let m=Object.create(null),j=n(k,m,"onRebuild",be);z(k,m,`on "watch" in ${t}() call`),v={onRebuild:j}}if(P&&l.push("--splitting"),I&&l.push("--preserve-symlinks"),L&&l.push("--metafile"),V&&l.push(`--outfile=${V}`),R&&l.push(`--outdir=${R}`),d&&l.push(`--outbase=${d}`),i&&l.push(`--tsconfig=${i}`),u){let m=[];for(let j of u){if(j+="",j.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${j}`);m.push(j)}l.push(`--resolve-extensions=${m.join(",")}`)}if(x&&l.push(`--public-path=${x}`),D&&l.push(`--entry-names=${D}`),M&&l.push(`--chunk-names=${M}`),O&&l.push(`--asset-names=${O}`),E){let m=[];for(let j of E){if(j+="",j.indexOf(",")>=0)throw new Error(`Invalid main field: ${j}`);m.push(j)}l.push(`--main-fields=${m.join(",")}`)}if(S){let m=[];for(let j of S){if(j+="",j.indexOf(",")>=0)throw new Error(`Invalid condition: ${j}`);m.push(j)}l.push(`--conditions=${m.join(",")}`)}if(c)for(let m of c)l.push(`--external:${m}`);if(p)for(let m in p){if(m.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${m}`);l.push(`--alias:${m}=${p[m]}`)}if(W)for(let m in W){if(m.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${m}`);l.push(`--banner:${m}=${W[m]}`)}if(K)for(let m in K){if(m.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${m}`);l.push(`--footer:${m}=${K[m]}`)}if(U)for(let m of U)l.push(`--inject:${m}`);if(w)for(let m in w){if(m.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${m}`);l.push(`--loader:${m}=${w[m]}`)}if($)for(let m in $){if(m.indexOf("=")>=0)throw new Error(`Invalid out extension: ${m}`);l.push(`--out-extension:${m}=${$[m]}`)}if(N)if(Array.isArray(N))for(let m of N)f.push(["",m+""]);else for(let[m,j]of Object.entries(N))f.push([m+"",j+""]);if(A){let m=Object.create(null),j=n(A,m,"contents",Ce),ve=n(A,m,"resolveDir",h),Re=n(A,m,"sourcefile",h),Oe=n(A,m,"loader",h);z(A,m,'in "stdin" object'),Re&&l.push(`--sourcefile=${Re}`),Oe&&l.push(`--loader=${Oe}`),ve&&(b=ve+""),typeof j=="string"?g=H(j):j instanceof Uint8Array&&(g=j)}let Q=[];if(y)for(let m of y)m+="",Q.push(m);return{entries:f,flags:l,write:_,stdinContents:g,stdinResolveDir:b,absWorkingDir:T,incremental:Z,nodePaths:Q,watch:v,mangleCache:Pe(se)}}function Je(t,e,r,s){let a=[],l=Object.create(null);de(a,e,l,r,s),Ue(a,e,l);let f=n(e,l,"sourcemap",Ae),o=n(e,l,"tsconfigRaw",ze),g=n(e,l,"sourcefile",h),b=n(e,l,"loader",h),v=n(e,l,"banner",h),C=n(e,l,"footer",h),B=n(e,l,"mangleCache",G);return z(e,l,`in ${t}() call`),f&&a.push(`--sourcemap=${f===!0?"external":f}`),o&&a.push(`--tsconfig-raw=${typeof o=="string"?o:JSON.stringify(o)}`),g&&a.push(`--sourcefile=${g}`),b&&a.push(`--loader=${b}`),v&&a.push(`--banner=${v}`),C&&a.push(`--footer=${C}`),{flags:a,mangleCache:Pe(B)}}function Be(t){let e={},r={didClose:!1,reason:""},s={},a=0,l=0,f=new Uint8Array(16*1024),o=0,g=d=>{let i=o+d.length;if(i>f.length){let y=new Uint8Array(i*2);y.set(f),f=y}f.set(d,o),o+=d.length;let u=0;for(;u+4<=o;){let y=he(f,u);if(u+4+y>o)break;u+=4,P(f.subarray(u,u+y)),u+=y}u>0&&(f.copyWithin(0,u,o),o-=u)},b=d=>{r.didClose=!0,d&&(r.reason=": "+(d.message||d));let i="The service was stopped"+r.reason;for(let u in s)s[u](i,null);s={}},v=(d,i,u)=>{if(r.didClose)return u("The service is no longer running"+r.reason,null);let y=a++;s[y]=(E,S)=>{try{u(E,S)}finally{d&&d.unref()}},d&&d.ref(),t.writeToStdin(ye({id:y,isRequest:!0,value:i}))},C=(d,i)=>{if(r.didClose)throw new Error("The service is no longer running"+r.reason);t.writeToStdin(ye({id:d,isRequest:!1,value:i}))},B=async(d,i)=>{try{if(i.command==="ping"){C(d,{});return}if(typeof i.key=="number"){let u=e[i.key];if(u){let y=u[i.command];if(y){await y(d,i);return}}}throw new Error("Invalid command: "+i.command)}catch(u){C(d,{errors:[le(u,t,null,void 0,"")]})}},k=!0,P=d=>{if(k){k=!1;let u=String.fromCharCode(...d);if(u!=="0.15.18")throw new Error(`Cannot start service: Host version "0.15.18" does not match binary version ${JSON.stringify(u)}`);return}let i=xe(d);if(i.isRequest)B(i.id,i.value);else{let u=s[i.id];delete s[i.id],i.value.error?u(i.value.error,{}):u(null,i.value)}};return{readFromStdout:g,afterClose:b,service:{buildOrServe:({callName:d,refs:i,serveOptions:u,options:y,isTTY:E,defaultWD:S,callback:c})=>{let p=0,w=l++,$={},x={ref(){++p===1&&i&&i.ref()},unref(){--p===0&&(delete e[w],i&&i.unref())}};e[w]=$,x.ref(),Ye(d,w,v,C,x,t,$,y,u,E,S,r,(D,M)=>{try{c(D,M)}finally{x.unref()}})},transform:({callName:d,refs:i,input:u,options:y,isTTY:E,fs:S,callback:c})=>{let p=Te(),w=$=>{try{if(typeof u!="string"&&!(u instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:x,mangleCache:D}=Je(d,y,E,Ee),M={command:"transform",flags:x,inputFS:$!==null,input:$!==null?H($):typeof u=="string"?H(u):u};D&&(M.mangleCache=D),v(i,M,(O,U)=>{if(O)return c(new Error(O),null);let W=X(U.errors,p),K=X(U.warnings,p),N=1,T=()=>{if(--N===0){let A={warnings:K,code:U.code,map:U.map};U.mangleCache&&(A.mangleCache=U==null?void 0:U.mangleCache),c(null,A)}};if(W.length>0)return c(re("Transform failed",W,K),null);U.codeFS&&(N++,S.readFile(U.code,(A,_)=>{A!==null?c(A,null):(U.code=_,T())})),U.mapFS&&(N++,S.readFile(U.map,(A,_)=>{A!==null?c(A,null):(U.map=_,T())})),T()})}catch(x){let D=[];try{de(D,y,{},E,Ee)}catch(O){}let M=le(x,t,p,void 0,"");v(i,{command:"error",flags:D,error:M},()=>{M.detail=p.load(M.detail),c(re("Transform failed",[M],[]),null)})}};if((typeof u=="string"||u instanceof Uint8Array)&&u.length>1024*1024){let $=w;w=()=>S.writeFile(u,$)}w(null)},formatMessages:({callName:d,refs:i,messages:u,options:y,callback:E})=>{let S=te(u,"messages",null,"");if(!y)throw new Error(`Missing second argument in ${d}() call`);let c={},p=n(y,c,"kind",h),w=n(y,c,"color",F),$=n(y,c,"terminalWidth",ne);if(z(y,c,`in ${d}() call`),p===void 0)throw new Error(`Missing "kind" in ${d}() call`);if(p!=="error"&&p!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${d}() call`);let x={command:"format-msgs",messages:S,isWarning:p==="warning"};w!==void 0&&(x.color=w),$!==void 0&&(x.terminalWidth=$),v(i,x,(D,M)=>{if(D)return E(new Error(D),null);E(null,M.messages)})},analyzeMetafile:({callName:d,refs:i,metafile:u,options:y,callback:E})=>{y===void 0&&(y={});let S={},c=n(y,S,"color",F),p=n(y,S,"verbose",F);z(y,S,`in ${d}() call`);let w={command:"analyze-metafile",metafile:u};c!==void 0&&(w.color=c),p!==void 0&&(w.verbose=p),v(i,w,($,x)=>{if($)return E(new Error($),null);E(null,x.result)})}}}}function Ye(t,e,r,s,a,l,f,o,g,b,v,C,B){let k=Te(),P=(R,d,i,u)=>{let y=[];try{de(y,o,{},b,Se)}catch(S){}let E=le(R,l,k,i,d);r(a,{command:"error",flags:y,error:E},()=>{E.detail=k.load(E.detail),u(E)})},I=(R,d)=>{P(R,d,void 0,i=>{B(re("Build failed",[i],[]),null)})},L;if(typeof o=="object"){let R=o.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');L=R}}if(L&&L.length>0){if(l.isSync){I(new Error("Cannot use plugins in synchronous API calls"),"");return}He(e,r,s,a,l,f,o,L,k).then(R=>{if(!R.ok){I(R.error,R.pluginName);return}try{V(R.requestPlugins,R.runOnEndCallbacks)}catch(d){I(d,"")}},R=>I(R,""));return}try{V(null,(R,d,i)=>i())}catch(R){I(R,"")}function V(R,d){let i=!l.isWriteUnavailable,{entries:u,flags:y,write:E,stdinContents:S,stdinResolveDir:c,absWorkingDir:p,incremental:w,nodePaths:$,watch:x,mangleCache:D}=Ve(t,o,b,Se,i),M={command:"build",key:e,entries:u,flags:y,write:E,stdinContents:S,stdinResolveDir:c,absWorkingDir:p||v,incremental:w,nodePaths:$};R&&(M.plugins=R),D&&(M.mangleCache=D);let O=g&&Qe(e,r,s,a,f,g,M),U,W,K=(T,A)=>{T.outputFiles&&(A.outputFiles=T.outputFiles.map(Ge)),T.metafile&&(A.metafile=JSON.parse(T.metafile)),T.mangleCache&&(A.mangleCache=T.mangleCache),T.writeToStdout!==void 0&&console.log(ee(T.writeToStdout).replace(/\n$/,""))},N=(T,A)=>{let _={errors:X(T.errors,k),warnings:X(T.warnings,k)};K(T,_),d(_,P,()=>{if(_.errors.length>0)return A(re("Build failed",_.errors,_.warnings),null);if(T.rebuild){if(!U){let Y=!1;U=()=>new Promise((Z,se)=>{if(Y||C.didClose)throw new Error("Cannot rebuild");r(a,{command:"rebuild",key:e},(Q,J)=>{if(Q)return A(re("Build failed",[{id:"",pluginName:"",text:Q,location:null,notes:[],detail:void 0}],[]),null);N(J,(m,j)=>{m?se(m):Z(j)})})}),a.ref(),U.dispose=()=>{Y||(Y=!0,r(a,{command:"rebuild-dispose",key:e},()=>{}),a.unref())}}_.rebuild=U}if(T.watch){if(!W){let Y=!1;a.ref(),W=()=>{Y||(Y=!0,delete f["watch-rebuild"],r(a,{command:"watch-stop",key:e},()=>{}),a.unref())},x&&(f["watch-rebuild"]=(Z,se)=>{try{let Q=se.args,J={errors:X(Q.errors,k),warnings:X(Q.warnings,k)};K(Q,J),d(J,P,()=>{if(J.errors.length>0){x.onRebuild&&x.onRebuild(re("Build failed",J.errors,J.warnings),null);return}J.stop=W,x.onRebuild&&x.onRebuild(null,J)})}catch(Q){console.error(Q)}s(Z,{})})}_.stop=W}A(null,_)})};if(E&&l.isWriteUnavailable)throw new Error('The "write" option is unavailable in this environment');if(w&&l.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(x&&l.isSync)throw new Error('Cannot use "watch" with a synchronous build');r(a,M,(T,A)=>{if(T)return B(new Error(T),null);if(O){let _=A,Y=!1;a.ref();let Z={port:_.port,host:_.host,wait:O.wait,stop(){Y||(Y=!0,O.stop(),a.unref())}};return a.ref(),O.wait.then(a.unref,a.unref),B(null,Z)}return N(A,B)})}}var Qe=(t,e,r,s,a,l,f)=>{let o={},g=n(l,o,"port",ne),b=n(l,o,"host",h),v=n(l,o,"servedir",h),C=n(l,o,"onRequest",be),B=new Promise((k,P)=>{a["serve-wait"]=(I,L)=>{L.error!==null?P(new Error(L.error)):k(),r(I,{})}});return f.serve={},z(l,o,"in serve() call"),g!==void 0&&(f.serve.port=g),b!==void 0&&(f.serve.host=b),v!==void 0&&(f.serve.servedir=v),a["serve-request"]=(k,P)=>{C&&C(P.args),r(k,{})},{wait:B,stop(){e(s,{command:"serve-stop",key:t},()=>{})}}},He=async(t,e,r,s,a,l,f,o,g)=>{let b=[],v=[],C={},B={},k=0,P=0,I=[],L=!1;o=[...o];for(let R of o){let d={};if(typeof R!="object")throw new Error(`Plugin at index ${P} must be an object`);let i=n(R,d,"name",h);if(typeof i!="string"||i==="")throw new Error(`Plugin at index ${P} is missing a name`);try{let u=n(R,d,"setup",be);if(typeof u!="function")throw new Error("Plugin is missing a setup function");z(R,d,`on plugin ${JSON.stringify(i)}`);let y={name:i,onResolve:[],onLoad:[]};P++;let S=u({initialOptions:f,resolve:(c,p={})=>{if(!L)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof c!="string")throw new Error("The path to resolve must be a string");let w=Object.create(null),$=n(p,w,"pluginName",h),x=n(p,w,"importer",h),D=n(p,w,"namespace",h),M=n(p,w,"resolveDir",h),O=n(p,w,"kind",h),U=n(p,w,"pluginData",fe);return z(p,w,"in resolve() call"),new Promise((W,K)=>{let N={command:"resolve",path:c,key:t,pluginName:i};$!=null&&(N.pluginName=$),x!=null&&(N.importer=x),D!=null&&(N.namespace=D),M!=null&&(N.resolveDir=M),O!=null&&(N.kind=O),U!=null&&(N.pluginData=g.store(U)),e(s,N,(T,A)=>{T!==null?K(new Error(T)):W({errors:X(A.errors,g),warnings:X(A.warnings,g),path:A.path,external:A.external,sideEffects:A.sideEffects,namespace:A.namespace,suffix:A.suffix,pluginData:g.load(A.pluginData)})})})},onStart(c){let p='This error came from the "onStart" callback registered here:',w=ae(new Error(p),a,"onStart");b.push({name:i,callback:c,note:w})},onEnd(c){let p='This error came from the "onEnd" callback registered here:',w=ae(new Error(p),a,"onEnd");v.push({name:i,callback:c,note:w})},onResolve(c,p){let w='This error came from the "onResolve" callback registered here:',$=ae(new Error(w),a,"onResolve"),x={},D=n(c,x,"filter",ce),M=n(c,x,"namespace",h);if(z(c,x,`in onResolve() call for plugin ${JSON.stringify(i)}`),D==null)throw new Error("onResolve() call is missing a filter");let O=k++;C[O]={name:i,callback:p,note:$},y.onResolve.push({id:O,filter:D.source,namespace:M||""})},onLoad(c,p){let w='This error came from the "onLoad" callback registered here:',$=ae(new Error(w),a,"onLoad"),x={},D=n(c,x,"filter",ce),M=n(c,x,"namespace",h);if(z(c,x,`in onLoad() call for plugin ${JSON.stringify(i)}`),D==null)throw new Error("onLoad() call is missing a filter");let O=k++;B[O]={name:i,callback:p,note:$},y.onLoad.push({id:O,filter:D.source,namespace:M||""})},esbuild:a.esbuild});S&&await S,I.push(y)}catch(u){return{ok:!1,error:u,pluginName:i}}}l["on-start"]=async(R,d)=>{let i={errors:[],warnings:[]};await Promise.all(b.map(async({name:u,callback:y,note:E})=>{try{let S=await y();if(S!=null){if(typeof S!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(u)} to return an object`);let c={},p=n(S,c,"errors",q),w=n(S,c,"warnings",q);z(S,c,`from onStart() callback in plugin ${JSON.stringify(u)}`),p!=null&&i.errors.push(...te(p,"errors",g,u)),w!=null&&i.warnings.push(...te(w,"warnings",g,u))}}catch(S){i.errors.push(le(S,a,g,E&&E(),u))}})),r(R,i)},l["on-resolve"]=async(R,d)=>{let i={},u="",y,E;for(let S of d.ids)try{({name:u,callback:y,note:E}=C[S]);let c=await y({path:d.path,importer:d.importer,namespace:d.namespace,resolveDir:d.resolveDir,kind:d.kind,pluginData:g.load(d.pluginData)});if(c!=null){if(typeof c!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(u)} to return an object`);let p={},w=n(c,p,"pluginName",h),$=n(c,p,"path",h),x=n(c,p,"namespace",h),D=n(c,p,"suffix",h),M=n(c,p,"external",F),O=n(c,p,"sideEffects",F),U=n(c,p,"pluginData",fe),W=n(c,p,"errors",q),K=n(c,p,"warnings",q),N=n(c,p,"watchFiles",q),T=n(c,p,"watchDirs",q);z(c,p,`from onResolve() callback in plugin ${JSON.stringify(u)}`),i.id=S,w!=null&&(i.pluginName=w),$!=null&&(i.path=$),x!=null&&(i.namespace=x),D!=null&&(i.suffix=D),M!=null&&(i.external=M),O!=null&&(i.sideEffects=O),U!=null&&(i.pluginData=g.store(U)),W!=null&&(i.errors=te(W,"errors",g,u)),K!=null&&(i.warnings=te(K,"warnings",g,u)),N!=null&&(i.watchFiles=ue(N,"watchFiles")),T!=null&&(i.watchDirs=ue(T,"watchDirs"));break}}catch(c){i={id:S,errors:[le(c,a,g,E&&E(),u)]};break}r(R,i)},l["on-load"]=async(R,d)=>{let i={},u="",y,E;for(let S of d.ids)try{({name:u,callback:y,note:E}=B[S]);let c=await y({path:d.path,namespace:d.namespace,suffix:d.suffix,pluginData:g.load(d.pluginData)});if(c!=null){if(typeof c!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(u)} to return an object`);let p={},w=n(c,p,"pluginName",h),$=n(c,p,"contents",Ce),x=n(c,p,"resolveDir",h),D=n(c,p,"pluginData",fe),M=n(c,p,"loader",h),O=n(c,p,"errors",q),U=n(c,p,"warnings",q),W=n(c,p,"watchFiles",q),K=n(c,p,"watchDirs",q);z(c,p,`from onLoad() callback in plugin ${JSON.stringify(u)}`),i.id=S,w!=null&&(i.pluginName=w),$ instanceof Uint8Array?i.contents=$:$!=null&&(i.contents=H($)),x!=null&&(i.resolveDir=x),D!=null&&(i.pluginData=g.store(D)),M!=null&&(i.loader=M),O!=null&&(i.errors=te(O,"errors",g,u)),U!=null&&(i.warnings=te(U,"warnings",g,u)),W!=null&&(i.watchFiles=ue(W,"watchFiles")),K!=null&&(i.watchDirs=ue(K,"watchDirs"));break}}catch(c){i={id:S,errors:[le(c,a,g,E&&E(),u)]};break}r(R,i)};let V=(R,d,i)=>i();return v.length>0&&(V=(R,d,i)=>{(async()=>{for(let{name:u,callback:y,note:E}of v)try{await y(R)}catch(S){R.errors.push(await new Promise(c=>d(S,u,E&&E(),c)))}})().then(i)}),L=!0,{ok:!0,requestPlugins:I,runOnEndCallbacks:V}};function Te(){let t=new Map,e=0;return{load(r){return t.get(r)},store(r){if(r===void 0)return-1;let s=e++;return t.set(s,r),s}}}function ae(t,e,r){let s,a=!1;return()=>{if(a)return s;a=!0;try{let l=(t.stack+"").split(`
2
- `);l.splice(1,1);let f=je(e,l,r);if(f)return s={text:t.message,location:f},s}catch(l){}}}function le(t,e,r,s,a){let l="Internal error",f=null;try{l=(t&&t.message||t)+""}catch(o){}try{f=je(e,(t.stack+"").split(`
3
- `),"")}catch(o){}return{id:"",pluginName:a,text:l,location:f,notes:s?[s]:[],detail:r?r.store(t):-1}}function je(t,e,r){let s=" at ";if(t.readFileSync&&!e[0].startsWith(s)&&e[1].startsWith(s))for(let a=1;a<e.length;a++){let l=e[a];if(!!l.startsWith(s))for(l=l.slice(s.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 o;try{o=t.readFileSync(f[1],"utf8")}catch(C){break}let g=o.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",b=+f[3]-1,v=g.slice(b,b+r.length)===r?r.length:0;return{file:f[1],namespace:"file",line:+f[2],column:H(g.slice(0,b)).length,length:H(g.slice(b,b+v)).length,lineText:g+`
4
- `+e.slice(1).join(`
5
- `),suggestion:""}}break}}return null}function re(t,e,r){let s=5,a=e.length<1?"":` with ${e.length} error${e.length<2?"":"s"}:`+e.slice(0,s+1).map((f,o)=>{if(o===s)return`
1
+ var Ie=Object.defineProperty;var We=(e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:!0})};var ye={};We(ye,{analyzeMetafile:()=>st,analyzeMetafileSync:()=>ct,build:()=>nt,buildSync:()=>at,default:()=>gt,formatMessages:()=>ot,formatMessagesSync:()=>ft,initialize:()=>dt,serve:()=>lt,transform:()=>it,transformSync:()=>ut,version:()=>rt});function we(e){let t=o=>{if(o===null)r.write8(0);else if(typeof o=="boolean")r.write8(1),r.write8(+o);else if(typeof o=="number")r.write8(2),r.write32(o|0);else if(typeof o=="string")r.write8(3),r.write(H(o));else if(o instanceof Uint8Array)r.write8(4),r.write(o);else if(o instanceof Array){r.write8(5),r.write32(o.length);for(let a of o)t(a)}else{let a=Object.keys(o);r.write8(6),r.write32(a.length);for(let l of a)r.write(H(l)),t(o[l])}},r=new ue;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),be(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function $e(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return re(r.read());case 4:return r.read();case 5:{let f=r.read32(),s=[];for(let m=0;m<f;m++)s.push(t());return s}case 6:{let f=r.read32(),s={};for(let m=0;m<f;m++)s[re(r.read())]=t();return s}default:throw new Error("Invalid packet")}},r=new ue(e),o=r.read32(),a=(o&1)===0;o>>>=1;let l=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:a,value:l}}var ue=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 r=new Uint8Array((this.len+t)*2);r.set(this.buf),this.buf=r}return this.len+=t,this.len-t}write8(t){let r=this._write(1);this.buf[r]=t}write32(t){let r=this._write(4);be(this.buf,t,r)}write(t){let r=this._write(4+t.length);be(this.buf,t.length,r),this.buf.set(t,r+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 ve(this.buf,this._read(4))}read(){let t=this.read32(),r=new Uint8Array(t),o=this._read(r.length);return r.set(this.buf.subarray(o,o+t)),r}},H,re,he;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;H=r=>e.encode(r),re=r=>t.decode(r),he='new TextEncoder().encode("")'}else if(typeof Buffer!="undefined")H=e=>Buffer.from(e),re=e=>{let{buffer:t,byteOffset:r,byteLength:o}=e;return Buffer.from(t,r,o).toString()},he='Buffer.from("")';else throw new Error("No UTF-8 codec found");if(!(H("")instanceof Uint8Array))throw new Error(`Invariant violation: "${he} 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 ve(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function be(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var J=JSON.stringify,ke="warning",Me="silent";function Ae(e){if(V(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var de=()=>null,F=e=>typeof e=="boolean"?null:"a boolean",ze=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",h=e=>typeof e=="string"?null:"a string",pe=e=>e instanceof RegExp?null:"a RegExp object",ie=e=>typeof e=="number"&&e===(e|0)?null:"an integer",Re=e=>typeof e=="function"?null:"a function",W=e=>Array.isArray(e)?null:"an array",Z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",Ke=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",_e=e=>typeof e=="object"&&e!==null?null:"an array or an object",Ce=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Pe=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ve=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Ye=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",Je=e=>typeof e=="string"||e instanceof URL?null:"a string or a URL";function n(e,t,r,o){let a=e[r];if(t[r+""]=!0,a===void 0)return;let l=o(a);if(l!==null)throw new Error(`${J(r)} must be ${l}`);return a}function z(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: ${J(o)}`)}function Be(e){let t=Object.create(null),r=n(e,t,"wasmURL",Je),o=n(e,t,"wasmModule",Ke),a=n(e,t,"worker",F);return z(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:a}}function Ue(e){let t;if(e!==void 0){t=Object.create(null);for(let r in e){let o=e[r];if(typeof o=="string"||o===!1)t[r]=o;else throw new Error(`Expected ${J(r)} in mangle cache to map to either a string or false`)}}return t}function ge(e,t,r,o,a){let l=n(t,r,"color",F),f=n(t,r,"logLevel",h),s=n(t,r,"logLimit",ie);l!==void 0?e.push(`--color=${l}`):o&&e.push("--color=true"),e.push(`--log-level=${f||a}`),e.push(`--log-limit=${s||0}`)}function V(e,t,r){if(typeof e!="string")throw new Error(`Expected value for ${t}${r!==void 0?" "+J(r):""} to be a string, got ${typeof e} instead`);return e}function Fe(e,t,r){let o=n(t,r,"legalComments",h),a=n(t,r,"sourceRoot",h),l=n(t,r,"sourcesContent",F),f=n(t,r,"target",Ye),s=n(t,r,"format",h),m=n(t,r,"globalName",h),b=n(t,r,"mangleProps",pe),R=n(t,r,"reserveProps",pe),D=n(t,r,"mangleQuoted",F),B=n(t,r,"minify",F),$=n(t,r,"minifySyntax",F),T=n(t,r,"minifyWhitespace",F),q=n(t,r,"minifyIdentifiers",F),L=n(t,r,"drop",W),Y=n(t,r,"charset",h),x=n(t,r,"treeShaking",F),d=n(t,r,"ignoreAnnotations",F),i=n(t,r,"jsx",h),u=n(t,r,"jsxFactory",h),y=n(t,r,"jsxFragment",h),E=n(t,r,"jsxImportSource",h),S=n(t,r,"jsxDev",F),c=n(t,r,"jsxSideEffects",F),p=n(t,r,"define",Z),w=n(t,r,"logOverride",Z),k=n(t,r,"supported",Z),O=n(t,r,"pure",W),P=n(t,r,"keepNames",F),M=n(t,r,"platform",h);if(o&&e.push(`--legal-comments=${o}`),a!==void 0&&e.push(`--source-root=${a}`),l!==void 0&&e.push(`--sources-content=${l}`),f&&(Array.isArray(f)?e.push(`--target=${Array.from(f).map(Ae).join(",")}`):e.push(`--target=${Ae(f)}`)),s&&e.push(`--format=${s}`),m&&e.push(`--global-name=${m}`),M&&e.push(`--platform=${M}`),B&&e.push("--minify"),$&&e.push("--minify-syntax"),T&&e.push("--minify-whitespace"),q&&e.push("--minify-identifiers"),Y&&e.push(`--charset=${Y}`),x!==void 0&&e.push(`--tree-shaking=${x}`),d&&e.push("--ignore-annotations"),L)for(let v of L)e.push(`--drop:${V(v,"drop")}`);if(b&&e.push(`--mangle-props=${b.source}`),R&&e.push(`--reserve-props=${R.source}`),D!==void 0&&e.push(`--mangle-quoted=${D}`),i&&e.push(`--jsx=${i}`),u&&e.push(`--jsx-factory=${u}`),y&&e.push(`--jsx-fragment=${y}`),E&&e.push(`--jsx-import-source=${E}`),S&&e.push("--jsx-dev"),c&&e.push("--jsx-side-effects"),p)for(let v in p){if(v.indexOf("=")>=0)throw new Error(`Invalid define: ${v}`);e.push(`--define:${v}=${V(p[v],"define",v)}`)}if(w)for(let v in w){if(v.indexOf("=")>=0)throw new Error(`Invalid log override: ${v}`);e.push(`--log-override:${v}=${V(w[v],"log override",v)}`)}if(k)for(let v in k){if(v.indexOf("=")>=0)throw new Error(`Invalid supported: ${v}`);let A=k[v];if(typeof A!="boolean")throw new Error(`Expected value for supported ${J(v)} to be a boolean, got ${typeof A} instead`);e.push(`--supported:${v}=${A}`)}if(O)for(let v of O)e.push(`--pure:${V(v,"pure")}`);P&&e.push("--keep-names")}function Qe(e,t,r,o,a){var Q;let l=[],f=[],s=Object.create(null),m=null,b=null,R=null;ge(l,t,s,r,o),Fe(l,t,s);let D=n(t,s,"sourcemap",Pe),B=n(t,s,"bundle",F),$=n(t,s,"watch",ze),T=n(t,s,"splitting",F),q=n(t,s,"preserveSymlinks",F),L=n(t,s,"metafile",F),Y=n(t,s,"outfile",h),x=n(t,s,"outdir",h),d=n(t,s,"outbase",h),i=n(t,s,"tsconfig",h),u=n(t,s,"resolveExtensions",W),y=n(t,s,"nodePaths",W),E=n(t,s,"mainFields",W),S=n(t,s,"conditions",W),c=n(t,s,"external",W),p=n(t,s,"alias",Z),w=n(t,s,"loader",Z),k=n(t,s,"outExtension",Z),O=n(t,s,"publicPath",h),P=n(t,s,"entryNames",h),M=n(t,s,"chunkNames",h),v=n(t,s,"assetNames",h),A=n(t,s,"inject",W),I=n(t,s,"banner",Z),K=n(t,s,"footer",Z),j=n(t,s,"entryPoints",_e),U=n(t,s,"absWorkingDir",h),C=n(t,s,"stdin",Z),_=(Q=n(t,s,"write",F))!=null?Q:a,G=n(t,s,"allowOverwrite",F),te=n(t,s,"incremental",F)===!0,ae=n(t,s,"mangleCache",Z);if(s.plugins=!0,z(t,s,`in ${e}() call`),D&&l.push(`--sourcemap${D===!0?"":`=${D}`}`),B&&l.push("--bundle"),G&&l.push("--allow-overwrite"),$)if(l.push("--watch"),typeof $=="boolean")R={};else{let g=Object.create(null),N=n($,g,"onRebuild",Re);z($,g,`on "watch" in ${e}() call`),R={onRebuild:N}}if(T&&l.push("--splitting"),q&&l.push("--preserve-symlinks"),L&&l.push("--metafile"),Y&&l.push(`--outfile=${Y}`),x&&l.push(`--outdir=${x}`),d&&l.push(`--outbase=${d}`),i&&l.push(`--tsconfig=${i}`),u){let g=[];for(let N of u){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(O&&l.push(`--public-path=${O}`),P&&l.push(`--entry-names=${P}`),M&&l.push(`--chunk-names=${M}`),v&&l.push(`--asset-names=${v}`),E){let g=[];for(let N of E){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(S){let g=[];for(let N of S){if(V(N,"condition"),N.indexOf(",")>=0)throw new Error(`Invalid condition: ${N}`);g.push(N)}l.push(`--conditions=${g.join(",")}`)}if(c)for(let g of c)l.push(`--external:${V(g,"external")}`);if(p)for(let g in p){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);l.push(`--alias:${g}=${V(p[g],"alias",g)}`)}if(I)for(let g in I){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);l.push(`--banner:${g}=${V(I[g],"banner",g)}`)}if(K)for(let g in K){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);l.push(`--footer:${g}=${V(K[g],"footer",g)}`)}if(A)for(let g of A)l.push(`--inject:${V(g,"inject")}`);if(w)for(let g in w){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);l.push(`--loader:${g}=${V(w[g],"loader",g)}`)}if(k)for(let g in k){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);l.push(`--out-extension:${g}=${V(k[g],"out extension",g)}`)}if(j)if(Array.isArray(j))for(let g of j)f.push(["",V(g,"entry point")]);else for(let g in j)f.push([g,V(j[g],"entry point",g)]);if(C){let g=Object.create(null),N=n(C,g,"contents",Te),Oe=n(C,g,"resolveDir",h),Se=n(C,g,"sourcefile",h),Ee=n(C,g,"loader",h);z(C,g,'in "stdin" object'),Se&&l.push(`--sourcefile=${Se}`),Ee&&l.push(`--loader=${Ee}`),Oe&&(b=Oe),typeof N=="string"?m=H(N):N instanceof Uint8Array&&(m=N)}let X=[];if(y)for(let g of y)g+="",X.push(g);return{entries:f,flags:l,write:_,stdinContents:m,stdinResolveDir:b,absWorkingDir:U,incremental:te,nodePaths:X,watch:R,mangleCache:Ue(ae)}}function He(e,t,r,o){let a=[],l=Object.create(null);ge(a,t,l,r,o),Fe(a,t,l);let f=n(t,l,"sourcemap",Pe),s=n(t,l,"tsconfigRaw",Ve),m=n(t,l,"sourcefile",h),b=n(t,l,"loader",h),R=n(t,l,"banner",h),D=n(t,l,"footer",h),B=n(t,l,"mangleCache",Z);return z(t,l,`in ${e}() call`),f&&a.push(`--sourcemap=${f===!0?"external":f}`),s&&a.push(`--tsconfig-raw=${typeof s=="string"?s:JSON.stringify(s)}`),m&&a.push(`--sourcefile=${m}`),b&&a.push(`--loader=${b}`),R&&a.push(`--banner=${R}`),D&&a.push(`--footer=${D}`),{flags:a,mangleCache:Ue(B)}}function je(e){let t={},r={didClose:!1,reason:""},o={},a=0,l=0,f=new Uint8Array(16*1024),s=0,m=d=>{let i=s+d.length;if(i>f.length){let y=new Uint8Array(i*2);y.set(f),f=y}f.set(d,s),s+=d.length;let u=0;for(;u+4<=s;){let y=ve(f,u);if(u+4+y>s)break;u+=4,T(f.subarray(u,u+y)),u+=y}u>0&&(f.copyWithin(0,u,s),s-=u)},b=d=>{r.didClose=!0,d&&(r.reason=": "+(d.message||d));let i="The service was stopped"+r.reason;for(let u in o)o[u](i,null);o={}},R=(d,i,u)=>{if(r.didClose)return u("The service is no longer running"+r.reason,null);let y=a++;o[y]=(E,S)=>{try{u(E,S)}finally{d&&d.unref()}},d&&d.ref(),e.writeToStdin(we({id:y,isRequest:!0,value:i}))},D=(d,i)=>{if(r.didClose)throw new Error("The service is no longer running"+r.reason);e.writeToStdin(we({id:d,isRequest:!1,value:i}))},B=async(d,i)=>{try{if(i.command==="ping"){D(d,{});return}if(typeof i.key=="number"){let u=t[i.key];if(u){let y=u[i.command];if(y){await y(d,i);return}}}throw new Error("Invalid command: "+i.command)}catch(u){D(d,{errors:[oe(u,e,null,void 0,"")]})}},$=!0,T=d=>{if($){$=!1;let u=String.fromCharCode(...d);if(u!=="0.16.1")throw new Error(`Cannot start service: Host version "0.16.1" does not match binary version ${J(u)}`);return}let i=$e(d);if(i.isRequest)B(i.id,i.value);else{let u=o[i.id];delete o[i.id],i.value.error?u(i.value.error,{}):u(null,i.value)}};return{readFromStdout:m,afterClose:b,service:{buildOrServe:({callName:d,refs:i,serveOptions:u,options:y,isTTY:E,defaultWD:S,callback:c})=>{let p=0,w=l++,k={},O={ref(){++p===1&&i&&i.ref()},unref(){--p===0&&(delete t[w],i&&i.unref())}};t[w]=k,O.ref(),Ge(d,w,R,D,O,e,k,y,u,E,S,r,(P,M)=>{try{c(P,M)}finally{O.unref()}})},transform:({callName:d,refs:i,input:u,options:y,isTTY:E,fs:S,callback:c})=>{let p=Ne(),w=k=>{try{if(typeof u!="string"&&!(u instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:O,mangleCache:P}=He(d,y,E,Me),M={command:"transform",flags:O,inputFS:k!==null,input:k!==null?H(k):typeof u=="string"?H(u):u};P&&(M.mangleCache=P),R(i,M,(v,A)=>{if(v)return c(new Error(v),null);let I=ee(A.errors,p),K=ee(A.warnings,p),j=1,U=()=>{if(--j===0){let C={warnings:K,code:A.code,map:A.map};A.mangleCache&&(C.mangleCache=A==null?void 0:A.mangleCache),c(null,C)}};if(I.length>0)return c(le("Transform failed",I,K),null);A.codeFS&&(j++,S.readFile(A.code,(C,_)=>{C!==null?c(C,null):(A.code=_,U())})),A.mapFS&&(j++,S.readFile(A.map,(C,_)=>{C!==null?c(C,null):(A.map=_,U())})),U()})}catch(O){let P=[];try{ge(P,y,{},E,Me)}catch(v){}let M=oe(O,e,p,void 0,"");R(i,{command:"error",flags:P,error:M},()=>{M.detail=p.load(M.detail),c(le("Transform failed",[M],[]),null)})}};if((typeof u=="string"||u instanceof Uint8Array)&&u.length>1024*1024){let k=w;w=()=>S.writeFile(u,k)}w(null)},formatMessages:({callName:d,refs:i,messages:u,options:y,callback:E})=>{let S=ne(u,"messages",null,"");if(!y)throw new Error(`Missing second argument in ${d}() call`);let c={},p=n(y,c,"kind",h),w=n(y,c,"color",F),k=n(y,c,"terminalWidth",ie);if(z(y,c,`in ${d}() call`),p===void 0)throw new Error(`Missing "kind" in ${d}() call`);if(p!=="error"&&p!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${d}() call`);let O={command:"format-msgs",messages:S,isWarning:p==="warning"};w!==void 0&&(O.color=w),k!==void 0&&(O.terminalWidth=k),R(i,O,(P,M)=>{if(P)return E(new Error(P),null);E(null,M.messages)})},analyzeMetafile:({callName:d,refs:i,metafile:u,options:y,callback:E})=>{y===void 0&&(y={});let S={},c=n(y,S,"color",F),p=n(y,S,"verbose",F);z(y,S,`in ${d}() call`);let w={command:"analyze-metafile",metafile:u};c!==void 0&&(w.color=c),p!==void 0&&(w.verbose=p),R(i,w,(k,O)=>{if(k)return E(new Error(k),null);E(null,O.result)})}}}}function Ge(e,t,r,o,a,l,f,s,m,b,R,D,B){let $=Ne(),T=(x,d,i,u)=>{let y=[];try{ge(y,s,{},b,ke)}catch(S){}let E=oe(x,l,$,i,d);r(a,{command:"error",flags:y,error:E},()=>{E.detail=$.load(E.detail),u(E)})},q=(x,d)=>{T(x,d,void 0,i=>{B(le("Build failed",[i],[]),null)})},L;if(typeof s=="object"){let x=s.plugins;if(x!==void 0){if(!Array.isArray(x))throw new Error('"plugins" must be an array');L=x}}if(L&&L.length>0){if(l.isSync){q(new Error("Cannot use plugins in synchronous API calls"),"");return}Ze(t,r,o,a,l,f,s,L,$).then(x=>{if(!x.ok){q(x.error,x.pluginName);return}try{Y(x.requestPlugins,x.runOnEndCallbacks)}catch(d){q(d,"")}},x=>q(x,""));return}try{Y(null,(x,d,i)=>i())}catch(x){q(x,"")}function Y(x,d){let i=!l.isWriteUnavailable,{entries:u,flags:y,write:E,stdinContents:S,stdinResolveDir:c,absWorkingDir:p,incremental:w,nodePaths:k,watch:O,mangleCache:P}=Qe(e,s,b,ke,i),M={command:"build",key:t,entries:u,flags:y,write:E,stdinContents:S,stdinResolveDir:c,absWorkingDir:p||R,incremental:w,nodePaths:k};x&&(M.plugins=x),P&&(M.mangleCache=P);let v=m&&Xe(t,r,o,a,f,m,M),A,I,K=(U,C)=>{U.outputFiles&&(C.outputFiles=U.outputFiles.map(et)),U.metafile&&(C.metafile=JSON.parse(U.metafile)),U.mangleCache&&(C.mangleCache=U.mangleCache),U.writeToStdout!==void 0&&console.log(re(U.writeToStdout).replace(/\n$/,""))},j=(U,C)=>{let _={errors:ee(U.errors,$),warnings:ee(U.warnings,$)};K(U,_),d(_,T,()=>{if(_.errors.length>0)return C(le("Build failed",_.errors,_.warnings),null);if(U.rebuild){if(!A){let G=!1;A=()=>new Promise((te,ae)=>{if(G||D.didClose)throw new Error("Cannot rebuild");r(a,{command:"rebuild",key:t},(X,Q)=>{if(X)return C(le("Build failed",[{id:"",pluginName:"",text:X,location:null,notes:[],detail:void 0}],[]),null);j(Q,(g,N)=>{g?ae(g):te(N)})})}),a.ref(),A.dispose=()=>{G||(G=!0,r(a,{command:"rebuild-dispose",key:t},()=>{}),a.unref())}}_.rebuild=A}if(U.watch){if(!I){let G=!1;a.ref(),I=()=>{G||(G=!0,delete f["watch-rebuild"],r(a,{command:"watch-stop",key:t},()=>{}),a.unref())},O&&(f["watch-rebuild"]=(te,ae)=>{try{let X=ae.args,Q={errors:ee(X.errors,$),warnings:ee(X.warnings,$)};K(X,Q),d(Q,T,()=>{if(Q.errors.length>0){O.onRebuild&&O.onRebuild(le("Build failed",Q.errors,Q.warnings),null);return}Q.stop=I,O.onRebuild&&O.onRebuild(null,Q)})}catch(X){console.error(X)}o(te,{})})}_.stop=I}C(null,_)})};if(E&&l.isWriteUnavailable)throw new Error('The "write" option is unavailable in this environment');if(w&&l.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(O&&l.isSync)throw new Error('Cannot use "watch" with a synchronous build');r(a,M,(U,C)=>{if(U)return B(new Error(U),null);if(v){let _=C,G=!1;a.ref();let te={port:_.port,host:_.host,wait:v.wait,stop(){G||(G=!0,v.stop(),a.unref())}};return a.ref(),v.wait.then(a.unref,a.unref),B(null,te)}return j(C,B)})}}var Xe=(e,t,r,o,a,l,f)=>{let s={},m=n(l,s,"port",ie),b=n(l,s,"host",h),R=n(l,s,"servedir",h),D=n(l,s,"onRequest",Re),B=new Promise(($,T)=>{a["serve-wait"]=(q,L)=>{L.error!==null?T(new Error(L.error)):$(),r(q,{})}});return f.serve={},z(l,s,"in serve() call"),m!==void 0&&(f.serve.port=m),b!==void 0&&(f.serve.host=b),R!==void 0&&(f.serve.servedir=R),a["serve-request"]=($,T)=>{D&&D(T.args),r($,{})},{wait:B,stop(){t(o,{command:"serve-stop",key:e},()=>{})}}},Ze=async(e,t,r,o,a,l,f,s,m)=>{let b=[],R=[],D={},B={},$=0,T=0,q=[],L=!1;s=[...s];for(let x of s){let d={};if(typeof x!="object")throw new Error(`Plugin at index ${T} must be an object`);let i=n(x,d,"name",h);if(typeof i!="string"||i==="")throw new Error(`Plugin at index ${T} is missing a name`);try{let u=n(x,d,"setup",Re);if(typeof u!="function")throw new Error("Plugin is missing a setup function");z(x,d,`on plugin ${J(i)}`);let y={name:i,onResolve:[],onLoad:[]};T++;let S=u({initialOptions:f,resolve:(c,p={})=>{if(!L)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof c!="string")throw new Error("The path to resolve must be a string");let w=Object.create(null),k=n(p,w,"pluginName",h),O=n(p,w,"importer",h),P=n(p,w,"namespace",h),M=n(p,w,"resolveDir",h),v=n(p,w,"kind",h),A=n(p,w,"pluginData",de);return z(p,w,"in resolve() call"),new Promise((I,K)=>{let j={command:"resolve",path:c,key:e,pluginName:i};if(k!=null&&(j.pluginName=k),O!=null&&(j.importer=O),P!=null&&(j.namespace=P),M!=null&&(j.resolveDir=M),v!=null)j.kind=v;else throw new Error('Must specify "kind" when calling "resolve"');A!=null&&(j.pluginData=m.store(A)),t(o,j,(U,C)=>{U!==null?K(new Error(U)):I({errors:ee(C.errors,m),warnings:ee(C.warnings,m),path:C.path,external:C.external,sideEffects:C.sideEffects,namespace:C.namespace,suffix:C.suffix,pluginData:m.load(C.pluginData)})})})},onStart(c){let p='This error came from the "onStart" callback registered here:',w=fe(new Error(p),a,"onStart");b.push({name:i,callback:c,note:w})},onEnd(c){let p='This error came from the "onEnd" callback registered here:',w=fe(new Error(p),a,"onEnd");R.push({name:i,callback:c,note:w})},onResolve(c,p){let w='This error came from the "onResolve" callback registered here:',k=fe(new Error(w),a,"onResolve"),O={},P=n(c,O,"filter",pe),M=n(c,O,"namespace",h);if(z(c,O,`in onResolve() call for plugin ${J(i)}`),P==null)throw new Error("onResolve() call is missing a filter");let v=$++;D[v]={name:i,callback:p,note:k},y.onResolve.push({id:v,filter:P.source,namespace:M||""})},onLoad(c,p){let w='This error came from the "onLoad" callback registered here:',k=fe(new Error(w),a,"onLoad"),O={},P=n(c,O,"filter",pe),M=n(c,O,"namespace",h);if(z(c,O,`in onLoad() call for plugin ${J(i)}`),P==null)throw new Error("onLoad() call is missing a filter");let v=$++;B[v]={name:i,callback:p,note:k},y.onLoad.push({id:v,filter:P.source,namespace:M||""})},esbuild:a.esbuild});S&&await S,q.push(y)}catch(u){return{ok:!1,error:u,pluginName:i}}}l["on-start"]=async(x,d)=>{let i={errors:[],warnings:[]};await Promise.all(b.map(async({name:u,callback:y,note:E})=>{try{let S=await y();if(S!=null){if(typeof S!="object")throw new Error(`Expected onStart() callback in plugin ${J(u)} to return an object`);let c={},p=n(S,c,"errors",W),w=n(S,c,"warnings",W);z(S,c,`from onStart() callback in plugin ${J(u)}`),p!=null&&i.errors.push(...ne(p,"errors",m,u)),w!=null&&i.warnings.push(...ne(w,"warnings",m,u))}}catch(S){i.errors.push(oe(S,a,m,E&&E(),u))}})),r(x,i)},l["on-resolve"]=async(x,d)=>{let i={},u="",y,E;for(let S of d.ids)try{({name:u,callback:y,note:E}=D[S]);let c=await y({path:d.path,importer:d.importer,namespace:d.namespace,resolveDir:d.resolveDir,kind:d.kind,pluginData:m.load(d.pluginData)});if(c!=null){if(typeof c!="object")throw new Error(`Expected onResolve() callback in plugin ${J(u)} to return an object`);let p={},w=n(c,p,"pluginName",h),k=n(c,p,"path",h),O=n(c,p,"namespace",h),P=n(c,p,"suffix",h),M=n(c,p,"external",F),v=n(c,p,"sideEffects",F),A=n(c,p,"pluginData",de),I=n(c,p,"errors",W),K=n(c,p,"warnings",W),j=n(c,p,"watchFiles",W),U=n(c,p,"watchDirs",W);z(c,p,`from onResolve() callback in plugin ${J(u)}`),i.id=S,w!=null&&(i.pluginName=w),k!=null&&(i.path=k),O!=null&&(i.namespace=O),P!=null&&(i.suffix=P),M!=null&&(i.external=M),v!=null&&(i.sideEffects=v),A!=null&&(i.pluginData=m.store(A)),I!=null&&(i.errors=ne(I,"errors",m,u)),K!=null&&(i.warnings=ne(K,"warnings",m,u)),j!=null&&(i.watchFiles=ce(j,"watchFiles")),U!=null&&(i.watchDirs=ce(U,"watchDirs"));break}}catch(c){i={id:S,errors:[oe(c,a,m,E&&E(),u)]};break}r(x,i)},l["on-load"]=async(x,d)=>{let i={},u="",y,E;for(let S of d.ids)try{({name:u,callback:y,note:E}=B[S]);let c=await y({path:d.path,namespace:d.namespace,suffix:d.suffix,pluginData:m.load(d.pluginData)});if(c!=null){if(typeof c!="object")throw new Error(`Expected onLoad() callback in plugin ${J(u)} to return an object`);let p={},w=n(c,p,"pluginName",h),k=n(c,p,"contents",Te),O=n(c,p,"resolveDir",h),P=n(c,p,"pluginData",de),M=n(c,p,"loader",h),v=n(c,p,"errors",W),A=n(c,p,"warnings",W),I=n(c,p,"watchFiles",W),K=n(c,p,"watchDirs",W);z(c,p,`from onLoad() callback in plugin ${J(u)}`),i.id=S,w!=null&&(i.pluginName=w),k instanceof Uint8Array?i.contents=k:k!=null&&(i.contents=H(k)),O!=null&&(i.resolveDir=O),P!=null&&(i.pluginData=m.store(P)),M!=null&&(i.loader=M),v!=null&&(i.errors=ne(v,"errors",m,u)),A!=null&&(i.warnings=ne(A,"warnings",m,u)),I!=null&&(i.watchFiles=ce(I,"watchFiles")),K!=null&&(i.watchDirs=ce(K,"watchDirs"));break}}catch(c){i={id:S,errors:[oe(c,a,m,E&&E(),u)]};break}r(x,i)};let Y=(x,d,i)=>i();return R.length>0&&(Y=(x,d,i)=>{(async()=>{for(let{name:u,callback:y,note:E}of R)try{await y(x)}catch(S){x.errors.push(await new Promise(c=>d(S,u,E&&E(),c)))}})().then(i)}),L=!0,{ok:!0,requestPlugins:q,runOnEndCallbacks:Y}};function Ne(){let e=new Map,t=0;return{load(r){return e.get(r)},store(r){if(r===void 0)return-1;let o=t++;return e.set(o,r),o}}}function fe(e,t,r){let o,a=!1;return()=>{if(a)return o;a=!0;try{let l=(e.stack+"").split(`
7
+ `);l.splice(1,1);let f=Le(t,l,r);if(f)return o={text:e.message,location:f},o}catch(l){}}}function oe(e,t,r,o,a){let l="Internal error",f=null;try{l=(e&&e.message||e)+""}catch(s){}try{f=Le(t,(e.stack+"").split(`
8
+ `),"")}catch(s){}return{id:"",pluginName:a,text:l,location:f,notes:o?[o]:[],detail:r?r.store(e):-1}}function Le(e,t,r){let o=" at ";if(e.readFileSync&&!t[0].startsWith(o)&&t[1].startsWith(o))for(let a=1;a<t.length;a++){let l=t[a];if(!!l.startsWith(o))for(l=l.slice(o.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(D){break}let m=s.split(/\r\n|\r|\n|\u2028|\u2029/)[+f[2]-1]||"",b=+f[3]-1,R=m.slice(b,b+r.length)===r?r.length:0;return{file:f[1],namespace:"file",line:+f[2],column:H(m.slice(0,b)).length,length:H(m.slice(b,b+R)).length,lineText:m+`
9
+ `+t.slice(1).join(`
10
+ `),suggestion:""}}break}}return null}function le(e,t,r){let o=5,a=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,o+1).map((f,s)=>{if(s===o)return`
6
11
  ...`;if(!f.location)return`
7
- error: ${f.text}`;let{file:g,line:b,column:v}=f.location,C=f.pluginName?`[plugin: ${f.pluginName}] `:"";return`
8
- ${g}:${b}:${v}: ERROR: ${C}${f.text}`}).join(""),l=new Error(`${t}${a}`);return l.errors=e,l.warnings=r,l}function X(t,e){for(let r of t)r.detail=e.load(r.detail);return t}function Me(t,e){if(t==null)return null;let r={},s=n(t,r,"file",h),a=n(t,r,"namespace",h),l=n(t,r,"line",ne),f=n(t,r,"column",ne),o=n(t,r,"length",ne),g=n(t,r,"lineText",h),b=n(t,r,"suggestion",h);return z(t,r,e),{file:s||"",namespace:a||"",line:l||0,column:f||0,length:o||0,lineText:g||"",suggestion:b||""}}function te(t,e,r,s){let a=[],l=0;for(let f of t){let o={},g=n(f,o,"id",h),b=n(f,o,"pluginName",h),v=n(f,o,"text",h),C=n(f,o,"location",$e),B=n(f,o,"notes",q),k=n(f,o,"detail",fe),P=`in element ${l} of "${e}"`;z(f,o,P);let I=[];if(B)for(let L of B){let V={},R=n(L,V,"text",h),d=n(L,V,"location",$e);z(L,V,P),I.push({text:R||"",location:Me(d,P)})}a.push({id:g||"",pluginName:b||s,text:v||"",location:Me(C,P),notes:I,detail:r?r.store(k):-1}),l++}return a}function ue(t,e){let r=[];for(let s of t){if(typeof s!="string")throw new Error(`${JSON.stringify(e)} must be an array of strings`);r.push(s)}return r}function Ge({path:t,contents:e}){let r=null;return{path:t,contents:e,get text(){let s=this.contents;return(r===null||s!==e)&&(e=s,r=ee(s)),r}}}var Ze="0.15.18",et=t=>pe().build(t),tt=()=>{throw new Error('The "serve" API only works in node')},rt=(t,e)=>pe().transform(t,e),nt=(t,e)=>pe().formatMessages(t,e),lt=(t,e)=>pe().analyzeMetafile(t,e),it=()=>{throw new Error('The "buildSync" API only works in node')},st=()=>{throw new Error('The "transformSync" API only works in node')},ot=()=>{throw new Error('The "formatMessagesSync" API only works in node')},at=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ie,we,pe=()=>{if(we)return we;throw ie?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')},ut=t=>{t=De(t||{});let e=t.wasmURL,r=t.wasmModule,s=t.worker!==!1;if(!e&&!r)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(ie)throw new Error('Cannot call "initialize" more than once');return ie=ft(e||"",r,s),ie.catch(()=>{ie=void 0}),ie},ft=async(t,e,r)=>{let s;if(r){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.\nlet 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+=g.decode(s);const i=c.lastIndexOf(`\n`);return i!=-1&&(console.log(c.substr(0,i)),c=c.substr(i+1)),s.length},write(n,s,i,a,h,u){if(i!==0||a!==s.length||h!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,a){a(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,a){a(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,a){a(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,a){a(r())},read(n,s,i,a,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,a){a(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"),g=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 l=this._ids.get(t);l===void 0&&(l=this._idPool.pop(),l===void 0&&(l=this._values.length),this._values[l]=t,this._goRefCounts[l]=0,this._ids.set(t,l)),this._goRefCounts[l]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,l,!0)},a=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),l=new Array(o);for(let m=0;m<o;m++)l[m]=s(t+m*8);return l},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=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),l=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,l))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(d+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(a(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)),l=h(e+32),m=Reflect.apply(o,t,l);e=this._inst.exports.getsp()>>>0,i(e+56,m),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),l=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),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),l=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),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);a(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=a(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=a(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(c){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,a=[];this.argv.forEach(e=>{a.push(s(e))}),a.push(0),Object.keys(this.env).sort().forEach(e=>{a.push(s(`${e}=${this.env[e]}`))}),a.push(0);const u=n;a.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),await 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,g=globalThis.fs,c="";g.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let d=c.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),c=d[d.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())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.15.18"],tryToInstantiateModule(r,a).then(h=>{postMessage(null),a.run(h)},h=>{postMessage(h)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const g=await fetch(r);if(!g.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(g.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(g,f.importObject)).instance;const c=await g.arrayBuffer();return(await WebAssembly.instantiate(c,f.importObject)).instance}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});s=new Worker(URL.createObjectURL(b))}else{let b=(postMessage=>{
12
+ error: ${f.text}`;let{file:m,line:b,column:R}=f.location,D=f.pluginName?`[plugin: ${f.pluginName}] `:"";return`
13
+ ${m}:${b}:${R}: ERROR: ${D}${f.text}`}).join(""),l=new Error(`${e}${a}`);return l.errors=t,l.warnings=r,l}function ee(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function De(e,t){if(e==null)return null;let r={},o=n(e,r,"file",h),a=n(e,r,"namespace",h),l=n(e,r,"line",ie),f=n(e,r,"column",ie),s=n(e,r,"length",ie),m=n(e,r,"lineText",h),b=n(e,r,"suggestion",h);return z(e,r,t),{file:o||"",namespace:a||"",line:l||0,column:f||0,length:s||0,lineText:m||"",suggestion:b||""}}function ne(e,t,r,o){let a=[],l=0;for(let f of e){let s={},m=n(f,s,"id",h),b=n(f,s,"pluginName",h),R=n(f,s,"text",h),D=n(f,s,"location",Ce),B=n(f,s,"notes",W),$=n(f,s,"detail",de),T=`in element ${l} of "${t}"`;z(f,s,T);let q=[];if(B)for(let L of B){let Y={},x=n(L,Y,"text",h),d=n(L,Y,"location",Ce);z(L,Y,T),q.push({text:x||"",location:De(d,T)})}a.push({id:m||"",pluginName:b||o,text:R||"",location:De(D,T),notes:q,detail:r?r.store($):-1}),l++}return a}function ce(e,t){let r=[];for(let o of e){if(typeof o!="string")throw new Error(`${J(t)} must be an array of strings`);r.push(o)}return r}function et({path:e,contents:t}){let r=null;return{path:e,contents:t,get text(){let o=this.contents;return(r===null||o!==t)&&(t=o,r=re(o)),r}}}var rt="0.16.1",nt=e=>me().build(e),lt=()=>{throw new Error('The "serve" API only works in node')},it=(e,t)=>me().transform(e,t),ot=(e,t)=>me().formatMessages(e,t),st=(e,t)=>me().analyzeMetafile(e,t),at=()=>{throw new Error('The "buildSync" API only works in node')},ut=()=>{throw new Error('The "transformSync" API only works in node')},ft=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ct=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},se,xe,me=()=>{if(xe)return xe;throw se?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')},dt=e=>{e=Be(e||{});let t=e.wasmURL,r=e.wasmModule,o=e.worker!==!1;if(!t&&!r)throw new Error('Must provide either the "wasmURL" option or the "wasmModule" option');if(se)throw new Error('Cannot call "initialize" more than once');return se=pt(t||"",r,o),se.catch(()=>{se=void 0}),se},pt=async(e,t,r)=>{let o;if(r){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.\nlet 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+=g.decode(s);const i=c.lastIndexOf(`\n`);return i!=-1&&(console.log(c.substr(0,i)),c=c.substr(i+1)),s.length},write(n,s,i,a,h,u){if(i!==0||a!==s.length||h!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,a){a(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,a){a(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,a){a(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,a){a(r())},read(n,s,i,a,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,a){a(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"),g=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 l=this._ids.get(t);l===void 0&&(l=this._idPool.pop(),l===void 0&&(l=this._values.length),this._values[l]=t,this._goRefCounts[l]=0,this._ids.set(t,l)),this._goRefCounts[l]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,l,!0)},a=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),l=new Array(o);for(let m=0;m<o;m++)l[m]=s(t+m*8);return l},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=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),l=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,l))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(d+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(a(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)),l=h(e+32),m=Reflect.apply(o,t,l);e=this._inst.exports.getsp()>>>0,i(e+56,m),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),l=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),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),l=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),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);a(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=a(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=a(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(c){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,a=[];this.argv.forEach(e=>{a.push(s(e))}),a.push(0),Object.keys(this.env).sort().forEach(e=>{a.push(s(`${e}=${this.env[e]}`))}),a.push(0);const u=n;a.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),await 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,g=globalThis.fs,c="";g.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let d=c.split(`\n`);d.length>1&&console.log(d.slice(0,-1).join(`\n`)),c=d[d.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())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.16.1"],tryToInstantiateModule(r,a).then(h=>{postMessage(null),a.run(h)},h=>{postMessage(h)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const g=await fetch(r);if(!g.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\\/wasm($|;)/i.test(g.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(g,f.importObject)).instance;const c=await g.arrayBuffer();return(await WebAssembly.instantiate(c,f.importObject)).instance}return r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});o=new Worker(URL.createObjectURL(b))}else{let b=(postMessage=>{
9
14
  // Copyright 2018 The Go Authors. All rights reserved.
10
15
  // Use of this source code is governed by a BSD-style
11
16
  // license that can be found in the LICENSE file.
12
17
  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+=g.decode(s);const i=c.lastIndexOf(`
13
18
  `);return i!=-1&&(console.log(c.substr(0,i)),c=c.substr(i+1)),s.length},write(n,s,i,a,h,u){if(i!==0||a!==s.length||h!==null){u(r());return}const d=this.writeSync(n,s);u(null,d)},chmod(n,s,i){i(r())},chown(n,s,i,a){a(r())},close(n,s){s(r())},fchmod(n,s,i){i(r())},fchown(n,s,i,a){a(r())},fstat(n,s){s(r())},fsync(n,s){s(null)},ftruncate(n,s,i){i(r())},lchown(n,s,i,a){a(r())},link(n,s,i){i(r())},lstat(n,s){s(r())},mkdir(n,s,i){i(r())},open(n,s,i,a){a(r())},read(n,s,i,a,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,a){a(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"),g=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 l=this._ids.get(t);l===void 0&&(l=this._idPool.pop(),l===void 0&&(l=this._values.length),this._values[l]=t,this._goRefCounts[l]=0,this._ids.set(t,l)),this._goRefCounts[l]++;let m=0;switch(typeof t){case"object":t!==null&&(m=1);break;case"string":m=2;break;case"symbol":m=3;break;case"function":m=4;break}this.mem.setUint32(e+4,2146959360|m,!0),this.mem.setUint32(e,l,!0)},a=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),l=new Array(o);for(let m=0;m<o;m++)l[m]=s(t+m*8);return l},u=e=>{const t=n(e+0),o=n(e+8);return g.decode(new DataView(this._inst.exports.mem.buffer,t,o))},d=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),l=this.mem.getInt32(e+24,!0);globalThis.fs.writeSync(t,new Uint8Array(this._inst.exports.mem.buffer,o,l))},"runtime.resetMemoryDataView":e=>{e>>>=0,this.mem=new DataView(this._inst.exports.mem.buffer)},"runtime.nanotime1":e=>{e>>>=0,c(e+8,(d+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(a(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)),l=h(e+32),m=Reflect.apply(o,t,l);e=this._inst.exports.getsp()>>>0,i(e+56,m),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),l=Reflect.apply(t,void 0,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),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),l=Reflect.construct(t,o);e=this._inst.exports.getsp()>>>0,i(e+40,l),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);a(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=a(e+8),o=s(e+32);if(!(o instanceof Uint8Array||o instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},"syscall/js.copyBytesToJS":e=>{e>>>=0;const t=s(e+8),o=a(e+16);if(!(t instanceof Uint8Array||t instanceof Uint8ClampedArray)){this.mem.setUint8(e+48,0);return}const l=o.subarray(0,t.length);t.set(l),c(e+40,l.length),this.mem.setUint8(e+48,1)},debug:e=>{console.log(e)}}}}async run(c){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,a=[];this.argv.forEach(e=>{a.push(s(e))}),a.push(0),Object.keys(this.env).sort().forEach(e=>{a.push(s(`${e}=${this.env[e]}`))}),a.push(0);const u=n;a.forEach(e=>{this.mem.setUint32(n,e,!0),this.mem.setUint32(n+4,0,!0),n+=8});const d=4096+8192;if(n>=d)throw new Error("total length of command line and environment variables exceeds limit");this._inst.exports.run(i,u),this.exited&&this._resolveExitPromise(),await 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,g=globalThis.fs,c="";g.writeSync=(h,u)=>{if(h===1)postMessage(u);else if(h===2){c+=f.decode(u);let d=c.split(`
14
19
  `);d.length>1&&console.log(d.slice(0,-1).join(`
15
- `)),c=d[d.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())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.15.18"],tryToInstantiateModule(r,a).then(h=>{postMessage(null),a.run(h)},h=>{postMessage(h)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const g=await fetch(r);if(!g.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(g.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(g,f.importObject)).instance;const c=await g.arrayBuffer();return(await WebAssembly.instantiate(c,f.importObject)).instance}return r=>onmessage(r);})(v=>s.onmessage({data:v}));s={onmessage:null,postMessage:v=>setTimeout(()=>b({data:v})),terminate(){}}}let a,l,f=new Promise((b,v)=>{a=b,l=v});s.onmessage=({data:b})=>{s.onmessage=({data:v})=>o(v),b?l(b):a()},s.postMessage(e||new URL(t,location.href).toString());let{readFromStdout:o,service:g}=Be({writeToStdin(b){s.postMessage(b)},isSync:!1,isWriteUnavailable:!0,esbuild:ge});await f,we={build:b=>new Promise((v,C)=>g.buildOrServe({callName:"build",refs:null,serveOptions:null,options:b,isTTY:!1,defaultWD:"/",callback:(B,k)=>B?C(B):v(k)})),transform:(b,v)=>new Promise((C,B)=>g.transform({callName:"transform",refs:null,input:b,options:v||{},isTTY:!1,fs:{readFile(k,P){P(new Error("Internal error"),null)},writeFile(k,P){P(null)}},callback:(k,P)=>k?B(k):C(P)})),formatMessages:(b,v)=>new Promise((C,B)=>g.formatMessages({callName:"formatMessages",refs:null,messages:b,options:v,callback:(k,P)=>k?B(k):C(P)})),analyzeMetafile:(b,v)=>new Promise((C,B)=>g.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof b=="string"?b:JSON.stringify(b),options:v,callback:(k,P)=>k?B(k):C(P)}))}},ct=ge;export{lt as analyzeMetafile,at as analyzeMetafileSync,et as build,it as buildSync,ct as default,nt as formatMessages,ot as formatMessagesSync,ut as initialize,tt as serve,rt as transform,st as transformSync,Ze as version};
20
+ `)),c=d[d.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())},g.read=(h,u,d,e,t,o)=>{if(h!==0||d!==0||e!==u.length||t!==null)throw new Error("Bad read");if(n.length===0){s=()=>g.read(h,u,d,e,t,o);return}let l=n[0],m=Math.max(0,Math.min(e,l.length-i));u.set(l.subarray(i,i+m),d),i+=m,i===l.length&&(n.shift(),i=0),o(null,m)};let a=new globalThis.Go;a.argv=["","--service=0.16.1"],tryToInstantiateModule(r,a).then(h=>{postMessage(null),a.run(h)},h=>{postMessage(h)})};async function tryToInstantiateModule(r,f){if(r instanceof WebAssembly.Module)return WebAssembly.instantiate(r,f.importObject);const g=await fetch(r);if(!g.ok)throw new Error(`Failed to download ${JSON.stringify(r)}`);if("instantiateStreaming"in WebAssembly&&/^application\/wasm($|;)/i.test(g.headers.get("Content-Type")||""))return(await WebAssembly.instantiateStreaming(g,f.importObject)).instance;const c=await g.arrayBuffer();return(await WebAssembly.instantiate(c,f.importObject)).instance}return r=>onmessage(r);})(R=>o.onmessage({data:R}));o={onmessage:null,postMessage:R=>setTimeout(()=>b({data:R})),terminate(){}}}let a,l,f=new Promise((b,R)=>{a=b,l=R});o.onmessage=({data:b})=>{o.onmessage=({data:R})=>s(R),b?l(b):a()},o.postMessage(t||new URL(e,location.href).toString());let{readFromStdout:s,service:m}=je({writeToStdin(b){o.postMessage(b)},isSync:!1,isWriteUnavailable:!0,esbuild:ye});await f,xe={build:b=>new Promise((R,D)=>m.buildOrServe({callName:"build",refs:null,serveOptions:null,options:b,isTTY:!1,defaultWD:"/",callback:(B,$)=>B?D(B):R($)})),transform:(b,R)=>new Promise((D,B)=>m.transform({callName:"transform",refs:null,input:b,options:R||{},isTTY:!1,fs:{readFile($,T){T(new Error("Internal error"),null)},writeFile($,T){T(null)}},callback:($,T)=>$?B($):D(T)})),formatMessages:(b,R)=>new Promise((D,B)=>m.formatMessages({callName:"formatMessages",refs:null,messages:b,options:R,callback:($,T)=>$?B($):D(T)})),analyzeMetafile:(b,R)=>new Promise((D,B)=>m.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof b=="string"?b:JSON.stringify(b),options:R,callback:($,T)=>$?B($):D(T)}))}},gt=ye;export{st as analyzeMetafile,ct as analyzeMetafileSync,nt as build,at as buildSync,gt as default,ot as formatMessages,ft as formatMessagesSync,dt as initialize,lt as serve,it as transform,ut as transformSync,rt as version};
@@ -193,8 +193,8 @@ export interface OutputFile {
193
193
  path: string;
194
194
  /** "text" as bytes */
195
195
  contents: Uint8Array;
196
- /** "contents" as text */
197
- text: string;
196
+ /** "contents" as text (changes automatically with "contents") */
197
+ get text(): string;
198
198
  }
199
199
 
200
200
  export interface BuildInvalidate {