isomorfeus-asset-manager 0.15.1 → 0.15.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,15 +1,15 @@
1
- var Ie=Object.defineProperty,nt=Object.defineProperties;var lt=Object.getOwnPropertyDescriptors;var We=Object.getOwnPropertySymbols;var it=Object.prototype.hasOwnProperty,st=Object.prototype.propertyIsEnumerable;var qe=(e,t,r)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,De=(e,t)=>{for(var r in t||(t={}))it.call(t,r)&&qe(e,r,t[r]);if(We)for(var r of We(t))st.call(t,r)&&qe(e,r,t[r]);return e},Be=(e,t)=>nt(e,lt(t));var ot=(e,t)=>{for(var r in t)Ie(e,r,{get:t[r],enumerable:!0})};var Pe={};ot(Pe,{analyzeMetafile:()=>xt,analyzeMetafileSync:()=>$t,build:()=>wt,buildSync:()=>St,default:()=>Ct,formatMessages:()=>Ot,formatMessagesSync:()=>kt,initialize:()=>Mt,serve:()=>vt,transform:()=>Rt,transformSync:()=>Et,version:()=>bt});function Ne(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(ne(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 d of o)t(d)}else{let d=Object.keys(o);r.write8(6),r.write32(d.length);for(let s of d)r.write(ne(s)),t(o[s])}},r=new Se;return r.write32(0),r.write32(e.id<<1|+!e.isRequest),t(e.value),Fe(r.buf,r.len-4,0),r.buf.subarray(0,r.len)}function ze(e){let t=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return ye(r.read());case 4:return r.read();case 5:{let c=r.read32(),l=[];for(let b=0;b<c;b++)l.push(t());return l}case 6:{let c=r.read32(),l={};for(let b=0;b<c;b++)l[ye(r.read())]=t();return l}default:throw new Error("Invalid packet")}},r=new Se(e),o=r.read32(),d=(o&1)===0;o>>>=1;let s=t();if(r.ptr!==e.length)throw new Error("Invalid packet");return{id:o,isRequest:d,value:s}}var Se=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);Fe(this.buf,t,r)}write(t){let r=this._write(4+t.length);Fe(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 Ue(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}},ne,ye;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let e=new TextEncoder,t=new TextDecoder;ne=r=>e.encode(r),ye=r=>t.decode(r)}else if(typeof Buffer!="undefined")ne=e=>{let t=Buffer.from(e);return t instanceof Uint8Array||(t=new Uint8Array(t)),t},ye=e=>{let{buffer:t,byteOffset:r,byteLength:o}=e;return Buffer.from(t,r,o).toString()};else throw new Error("No UTF-8 codec found");function Ue(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function Fe(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}function Ke(e){if(e+="",e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var $e=()=>null,q=e=>typeof e=="boolean"?null:"a boolean",ut=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",g=e=>typeof e=="string"?null:"a string",Me=e=>e instanceof RegExp?null:"a RegExp object",Re=e=>typeof e=="number"&&e===(e|0)?null:"an integer",je=e=>typeof e=="function"?null:"a function",V=e=>Array.isArray(e)?null:"an array",se=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",ft=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",ct=e=>typeof e=="object"&&e!==null?null:"an array or an object",_e=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Ye=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",dt=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",pt=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Qe=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array";function n(e,t,r,o){let d=e[r];if(t[r+""]=!0,d===void 0)return;let s=o(d);if(s!==null)throw new Error(`"${r}" must be ${s}`);return d}function Y(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: "${o}"`)}function He(e){let t=Object.create(null),r=n(e,t,"wasmURL",g),o=n(e,t,"wasmModule",ft),d=n(e,t,"worker",q);return Y(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:d}}function Ge(e){let t;if(e!==void 0){t=Object.create(null);for(let r of Object.keys(e)){let o=e[r];if(typeof o=="string"||o===!1)t[r]=o;else throw new Error(`Expected ${JSON.stringify(r)} in mangle cache to map to either a string or false`)}}return t}function Ae(e,t,r,o,d){let s=n(t,r,"color",q),c=n(t,r,"logLevel",g),l=n(t,r,"logLimit",Re);s!==void 0?e.push(`--color=${s}`):o&&e.push("--color=true"),e.push(`--log-level=${c||d}`),e.push(`--log-limit=${l||0}`)}function Xe(e,t,r){let o=n(t,r,"legalComments",g),d=n(t,r,"sourceRoot",g),s=n(t,r,"sourcesContent",q),c=n(t,r,"target",pt),l=n(t,r,"format",g),b=n(t,r,"globalName",g),O=n(t,r,"mangleProps",Me),N=n(t,r,"reserveProps",Me),A=n(t,r,"mangleQuoted",q),k=n(t,r,"minify",q),z=n(t,r,"minifySyntax",q),le=n(t,r,"minifyWhitespace",q),oe=n(t,r,"minifyIdentifiers",q),ie=n(t,r,"drop",V),te=n(t,r,"charset",g),ae=n(t,r,"treeShaking",q),ue=n(t,r,"ignoreAnnotations",q),ce=n(t,r,"jsx",g),ge=n(t,r,"jsxFactory",g),de=n(t,r,"jsxFragment",g),be=n(t,r,"jsxImportSource",g),xe=n(t,r,"jsxDev",q),me=n(t,r,"define",se),p=n(t,r,"logOverride",se),u=n(t,r,"supported",se),a=n(t,r,"pure",V),f=n(t,r,"keepNames",q),C=n(t,r,"platform",g);if(o&&e.push(`--legal-comments=${o}`),d!==void 0&&e.push(`--source-root=${d}`),s!==void 0&&e.push(`--sources-content=${s}`),c&&(Array.isArray(c)?e.push(`--target=${Array.from(c).map(Ke).join(",")}`):e.push(`--target=${Ke(c)}`)),l&&e.push(`--format=${l}`),b&&e.push(`--global-name=${b}`),C&&e.push(`--platform=${C}`),k&&e.push("--minify"),z&&e.push("--minify-syntax"),le&&e.push("--minify-whitespace"),oe&&e.push("--minify-identifiers"),te&&e.push(`--charset=${te}`),ae!==void 0&&e.push(`--tree-shaking=${ae}`),ue&&e.push("--ignore-annotations"),ie)for(let w of ie)e.push(`--drop:${w}`);if(O&&e.push(`--mangle-props=${O.source}`),N&&e.push(`--reserve-props=${N.source}`),A!==void 0&&e.push(`--mangle-quoted=${A}`),ce&&e.push(`--jsx=${ce}`),ge&&e.push(`--jsx-factory=${ge}`),de&&e.push(`--jsx-fragment=${de}`),be&&e.push(`--jsx-import-source=${be}`),xe&&e.push("--jsx-dev"),me)for(let w in me){if(w.indexOf("=")>=0)throw new Error(`Invalid define: ${w}`);e.push(`--define:${w}=${me[w]}`)}if(p)for(let w in p){if(w.indexOf("=")>=0)throw new Error(`Invalid log override: ${w}`);e.push(`--log-override:${w}=${p[w]}`)}if(u)for(let w in u){if(w.indexOf("=")>=0)throw new Error(`Invalid supported: ${w}`);e.push(`--supported:${w}=${u[w]}`)}if(a)for(let w of a)e.push(`--pure:${w}`);f&&e.push("--keep-names")}function gt(e,t,r,o,d){var h;let s=[],c=[],l=Object.create(null),b=null,O=null,N=null;Ae(s,t,l,r,o),Xe(s,t,l);let A=n(t,l,"sourcemap",Ye),k=n(t,l,"bundle",q),z=n(t,l,"watch",ut),le=n(t,l,"splitting",q),oe=n(t,l,"preserveSymlinks",q),ie=n(t,l,"metafile",q),te=n(t,l,"outfile",g),ae=n(t,l,"outdir",g),ue=n(t,l,"outbase",g),ce=n(t,l,"tsconfig",g),ge=n(t,l,"resolveExtensions",V),de=n(t,l,"nodePaths",V),be=n(t,l,"mainFields",V),xe=n(t,l,"conditions",V),me=n(t,l,"external",V),p=n(t,l,"loader",se),u=n(t,l,"outExtension",se),a=n(t,l,"publicPath",g),f=n(t,l,"entryNames",g),C=n(t,l,"chunkNames",g),w=n(t,l,"assetNames",g),$=n(t,l,"inject",V),x=n(t,l,"banner",se),P=n(t,l,"footer",se),E=n(t,l,"entryPoints",ct),R=n(t,l,"absWorkingDir",g),M=n(t,l,"stdin",se),D=(h=n(t,l,"write",q))!=null?h:d,B=n(t,l,"allowOverwrite",q),W=n(t,l,"incremental",q)===!0,ee=n(t,l,"mangleCache",se);if(l.plugins=!0,Y(t,l,`in ${e}() call`),A&&s.push(`--sourcemap${A===!0?"":`=${A}`}`),k&&s.push("--bundle"),B&&s.push("--allow-overwrite"),z)if(s.push("--watch"),typeof z=="boolean")N={};else{let i=Object.create(null),y=n(z,i,"onRebuild",je);Y(z,i,`on "watch" in ${e}() call`),N={onRebuild:y}}if(le&&s.push("--splitting"),oe&&s.push("--preserve-symlinks"),ie&&s.push("--metafile"),te&&s.push(`--outfile=${te}`),ae&&s.push(`--outdir=${ae}`),ue&&s.push(`--outbase=${ue}`),ce&&s.push(`--tsconfig=${ce}`),ge){let i=[];for(let y of ge){if(y+="",y.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${y}`);i.push(y)}s.push(`--resolve-extensions=${i.join(",")}`)}if(a&&s.push(`--public-path=${a}`),f&&s.push(`--entry-names=${f}`),C&&s.push(`--chunk-names=${C}`),w&&s.push(`--asset-names=${w}`),be){let i=[];for(let y of be){if(y+="",y.indexOf(",")>=0)throw new Error(`Invalid main field: ${y}`);i.push(y)}s.push(`--main-fields=${i.join(",")}`)}if(xe){let i=[];for(let y of xe){if(y+="",y.indexOf(",")>=0)throw new Error(`Invalid condition: ${y}`);i.push(y)}s.push(`--conditions=${i.join(",")}`)}if(me)for(let i of me)s.push(`--external:${i}`);if(x)for(let i in x){if(i.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${i}`);s.push(`--banner:${i}=${x[i]}`)}if(P)for(let i in P){if(i.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${i}`);s.push(`--footer:${i}=${P[i]}`)}if($)for(let i of $)s.push(`--inject:${i}`);if(p)for(let i in p){if(i.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${i}`);s.push(`--loader:${i}=${p[i]}`)}if(u)for(let i in u){if(i.indexOf("=")>=0)throw new Error(`Invalid out extension: ${i}`);s.push(`--out-extension:${i}=${u[i]}`)}if(E)if(Array.isArray(E))for(let i of E)c.push(["",i+""]);else for(let[i,y]of Object.entries(E))c.push([i+"",y+""]);if(M){let i=Object.create(null),y=n(M,i,"contents",Qe),j=n(M,i,"resolveDir",g),L=n(M,i,"sourcefile",g),v=n(M,i,"loader",g);Y(M,i,'in "stdin" object'),L&&s.push(`--sourcefile=${L}`),v&&s.push(`--loader=${v}`),j&&(O=j+""),typeof y=="string"?b=ne(y):y instanceof Uint8Array&&(b=y)}let S=[];if(de)for(let i of de)i+="",S.push(i);return{entries:c,flags:s,write:D,stdinContents:b,stdinResolveDir:O,absWorkingDir:R,incremental:W,nodePaths:S,watch:N,mangleCache:Ge(ee)}}function mt(e,t,r,o){let d=[],s=Object.create(null);Ae(d,t,s,r,o),Xe(d,t,s);let c=n(t,s,"sourcemap",Ye),l=n(t,s,"tsconfigRaw",dt),b=n(t,s,"sourcefile",g),O=n(t,s,"loader",g),N=n(t,s,"banner",g),A=n(t,s,"footer",g),k=n(t,s,"mangleCache",se);return Y(t,s,`in ${e}() call`),c&&d.push(`--sourcemap=${c===!0?"external":c}`),l&&d.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),b&&d.push(`--sourcefile=${b}`),O&&d.push(`--loader=${O}`),N&&d.push(`--banner=${N}`),A&&d.push(`--footer=${A}`),{flags:d,mangleCache:Ge(k)}}function Ze(e){let t=new Map,r=new Map,o=new Map,d=new Map,s=null,c=0,l=0,b=new Uint8Array(16*1024),O=0,N=p=>{let u=O+p.length;if(u>b.length){let f=new Uint8Array(u*2);f.set(b),b=f}b.set(p,O),O+=p.length;let a=0;for(;a+4<=O;){let f=Ue(b,a);if(a+4+f>O)break;a+=4,ie(b.subarray(a,a+f)),a+=f}a>0&&(b.copyWithin(0,a,O),O-=a)},A=p=>{s={reason:p?": "+(p.message||p):""};let u="The service was stopped"+s.reason;for(let a of t.values())a(u,null);t.clear();for(let a of d.values())a.onWait(u);d.clear();for(let a of o.values())try{a(new Error(u),null)}catch(f){console.error(f)}o.clear()},k=(p,u,a)=>{if(s)return a("The service is no longer running"+s.reason,null);let f=c++;t.set(f,(C,w)=>{try{a(C,w)}finally{p&&p.unref()}}),p&&p.ref(),e.writeToStdin(Ne({id:f,isRequest:!0,value:u}))},z=(p,u)=>{if(s)throw new Error("The service is no longer running"+s.reason);e.writeToStdin(Ne({id:p,isRequest:!1,value:u}))},le=async(p,u)=>{try{switch(u.command){case"ping":{z(p,{});break}case"on-start":{let a=r.get(u.key);a?z(p,await a(u)):z(p,{});break}case"on-resolve":{let a=r.get(u.key);a?z(p,await a(u)):z(p,{});break}case"on-load":{let a=r.get(u.key);a?z(p,await a(u)):z(p,{});break}case"serve-request":{let a=d.get(u.key);a&&a.onRequest&&a.onRequest(u.args),z(p,{});break}case"serve-wait":{let a=d.get(u.key);a&&a.onWait(u.error),z(p,{});break}case"watch-rebuild":{let a=o.get(u.key);try{a&&a(null,u.args)}catch(f){console.error(f)}z(p,{});break}default:throw new Error("Invalid command: "+u.command)}}catch(a){z(p,{errors:[we(a,e,null,void 0,"")]})}},oe=!0,ie=p=>{if(oe){oe=!1;let a=String.fromCharCode(...p);if(a!=="0.15.4")throw new Error(`Cannot start service: Host version "0.15.4" does not match binary version ${JSON.stringify(a)}`);return}let u=ze(p);if(u.isRequest)le(u.id,u.value);else{let a=t.get(u.id);t.delete(u.id),u.value.error?a(u.value.error,{}):a(null,u.value)}},te=async(p,u,a,f,C)=>{let w=[],$=[],x={},P={},E=0,R=0,M=[],D=!1;u=[...u];for(let S of u){let h={};if(typeof S!="object")throw new Error(`Plugin at index ${R} must be an object`);let i=n(S,h,"name",g);if(typeof i!="string"||i==="")throw new Error(`Plugin at index ${R} is missing a name`);try{let y=n(S,h,"setup",je);if(typeof y!="function")throw new Error("Plugin is missing a setup function");Y(S,h,`on plugin ${JSON.stringify(i)}`);let j={name:i,onResolve:[],onLoad:[]};R++;let v=y({initialOptions:p,resolve:(m,F={})=>{if(!D)throw new Error('Cannot call "resolve" before plugin setup has completed');if(typeof m!="string")throw new Error("The path to resolve must be a string");let T=Object.create(null),Q=n(F,T,"pluginName",g),I=n(F,T,"importer",g),_=n(F,T,"namespace",g),X=n(F,T,"resolveDir",g),H=n(F,T,"kind",g),U=n(F,T,"pluginData",$e);return Y(F,T,"in resolve() call"),new Promise((J,G)=>{let K={command:"resolve",path:m,key:a,pluginName:i};Q!=null&&(K.pluginName=Q),I!=null&&(K.importer=I),_!=null&&(K.namespace=_),X!=null&&(K.resolveDir=X),H!=null&&(K.kind=H),U!=null&&(K.pluginData=f.store(U)),k(C,K,(fe,Z)=>{fe!==null?G(new Error(fe)):J({errors:pe(Z.errors,f),warnings:pe(Z.warnings,f),path:Z.path,external:Z.external,sideEffects:Z.sideEffects,namespace:Z.namespace,suffix:Z.suffix,pluginData:f.load(Z.pluginData)})})})},onStart(m){let F='This error came from the "onStart" callback registered here:',T=Ee(new Error(F),e,"onStart");w.push({name:i,callback:m,note:T})},onEnd(m){let F='This error came from the "onEnd" callback registered here:',T=Ee(new Error(F),e,"onEnd");$.push({name:i,callback:m,note:T})},onResolve(m,F){let T='This error came from the "onResolve" callback registered here:',Q=Ee(new Error(T),e,"onResolve"),I={},_=n(m,I,"filter",Me),X=n(m,I,"namespace",g);if(Y(m,I,`in onResolve() call for plugin ${JSON.stringify(i)}`),_==null)throw new Error("onResolve() call is missing a filter");let H=E++;x[H]={name:i,callback:F,note:Q},j.onResolve.push({id:H,filter:_.source,namespace:X||""})},onLoad(m,F){let T='This error came from the "onLoad" callback registered here:',Q=Ee(new Error(T),e,"onLoad"),I={},_=n(m,I,"filter",Me),X=n(m,I,"namespace",g);if(Y(m,I,`in onLoad() call for plugin ${JSON.stringify(i)}`),_==null)throw new Error("onLoad() call is missing a filter");let H=E++;P[H]={name:i,callback:F,note:Q},j.onLoad.push({id:H,filter:_.source,namespace:X||""})},esbuild:e.esbuild});v&&await v,M.push(j)}catch(y){return{ok:!1,error:y,pluginName:i}}}let B=async S=>{switch(S.command){case"on-start":{let h={errors:[],warnings:[]};return await Promise.all(w.map(async({name:i,callback:y,note:j})=>{try{let L=await y();if(L!=null){if(typeof L!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(i)} to return an object`);let v={},m=n(L,v,"errors",V),F=n(L,v,"warnings",V);Y(L,v,`from onStart() callback in plugin ${JSON.stringify(i)}`),m!=null&&h.errors.push(...he(m,"errors",f,i)),F!=null&&h.warnings.push(...he(F,"warnings",f,i))}}catch(L){h.errors.push(we(L,e,f,j&&j(),i))}})),h}case"on-resolve":{let h={},i="",y,j;for(let L of S.ids)try{({name:i,callback:y,note:j}=x[L]);let v=await y({path:S.path,importer:S.importer,namespace:S.namespace,resolveDir:S.resolveDir,kind:S.kind,pluginData:f.load(S.pluginData)});if(v!=null){if(typeof v!="object")throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(i)} to return an object`);let m={},F=n(v,m,"pluginName",g),T=n(v,m,"path",g),Q=n(v,m,"namespace",g),I=n(v,m,"suffix",g),_=n(v,m,"external",q),X=n(v,m,"sideEffects",q),H=n(v,m,"pluginData",$e),U=n(v,m,"errors",V),J=n(v,m,"warnings",V),G=n(v,m,"watchFiles",V),K=n(v,m,"watchDirs",V);Y(v,m,`from onResolve() callback in plugin ${JSON.stringify(i)}`),h.id=L,F!=null&&(h.pluginName=F),T!=null&&(h.path=T),Q!=null&&(h.namespace=Q),I!=null&&(h.suffix=I),_!=null&&(h.external=_),X!=null&&(h.sideEffects=X),H!=null&&(h.pluginData=f.store(H)),U!=null&&(h.errors=he(U,"errors",f,i)),J!=null&&(h.warnings=he(J,"warnings",f,i)),G!=null&&(h.watchFiles=ke(G,"watchFiles")),K!=null&&(h.watchDirs=ke(K,"watchDirs"));break}}catch(v){return{id:L,errors:[we(v,e,f,j&&j(),i)]}}return h}case"on-load":{let h={},i="",y,j;for(let L of S.ids)try{({name:i,callback:y,note:j}=P[L]);let v=await y({path:S.path,namespace:S.namespace,suffix:S.suffix,pluginData:f.load(S.pluginData)});if(v!=null){if(typeof v!="object")throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(i)} to return an object`);let m={},F=n(v,m,"pluginName",g),T=n(v,m,"contents",Qe),Q=n(v,m,"resolveDir",g),I=n(v,m,"pluginData",$e),_=n(v,m,"loader",g),X=n(v,m,"errors",V),H=n(v,m,"warnings",V),U=n(v,m,"watchFiles",V),J=n(v,m,"watchDirs",V);Y(v,m,`from onLoad() callback in plugin ${JSON.stringify(i)}`),h.id=L,F!=null&&(h.pluginName=F),T instanceof Uint8Array?h.contents=T:T!=null&&(h.contents=ne(T)),Q!=null&&(h.resolveDir=Q),I!=null&&(h.pluginData=f.store(I)),_!=null&&(h.loader=_),X!=null&&(h.errors=he(X,"errors",f,i)),H!=null&&(h.warnings=he(H,"warnings",f,i)),U!=null&&(h.watchFiles=ke(U,"watchFiles")),J!=null&&(h.watchDirs=ke(J,"watchDirs"));break}}catch(v){return{id:L,errors:[we(v,e,f,j&&j(),i)]}}return h}default:throw new Error("Invalid command: "+S.command)}},W=(S,h,i)=>i();$.length>0&&(W=(S,h,i)=>{(async()=>{for(let{name:y,callback:j,note:L}of $)try{await j(S)}catch(v){S.errors.push(await new Promise(m=>h(v,y,L&&L(),m)))}})().then(i)}),D=!0;let ee=0;return{ok:!0,requestPlugins:M,runOnEndCallbacks:W,pluginRefs:{ref(){++ee===1&&r.set(a,B)},unref(){--ee===0&&r.delete(a)}}}},ae=(p,u,a,f)=>{let C={},w=n(u,C,"port",Re),$=n(u,C,"host",g),x=n(u,C,"servedir",g),P=n(u,C,"onRequest",je),E,R=new Promise((M,D)=>{E=B=>{d.delete(f),B!==null?D(new Error(B)):M()}});return a.serve={},Y(u,C,"in serve() call"),w!==void 0&&(a.serve.port=w),$!==void 0&&(a.serve.host=$),x!==void 0&&(a.serve.servedir=x),d.set(f,{onRequest:P,onWait:E}),{wait:R,stop(){k(p,{command:"serve-stop",key:f},()=>{})}}},ue="warning",ce="silent",ge=p=>{let u=l++,a=Ve(),f,{refs:C,options:w,isTTY:$,callback:x}=p;if(typeof w=="object"){let R=w.plugins;if(R!==void 0){if(!Array.isArray(R))throw new Error('"plugins" must be an array');f=R}}let P=(R,M,D,B)=>{let W=[];try{Ae(W,w,{},$,ue)}catch(S){}let ee=we(R,e,a,D,M);k(C,{command:"error",flags:W,error:ee},()=>{ee.detail=a.load(ee.detail),B(ee)})},E=(R,M)=>{P(R,M,void 0,D=>{x(ve("Build failed",[D],[]),null)})};if(f&&f.length>0){if(e.isSync)return E(new Error("Cannot use plugins in synchronous API calls"),"");te(w,f,u,a,C).then(R=>{if(!R.ok)E(R.error,R.pluginName);else try{de(Be(De({},p),{key:u,details:a,logPluginError:P,requestPlugins:R.requestPlugins,runOnEndCallbacks:R.runOnEndCallbacks,pluginRefs:R.pluginRefs}))}catch(M){E(M,"")}},R=>E(R,""))}else try{de(Be(De({},p),{key:u,details:a,logPluginError:P,requestPlugins:null,runOnEndCallbacks:(R,M,D)=>D(),pluginRefs:null}))}catch(R){E(R,"")}},de=({callName:p,refs:u,serveOptions:a,options:f,isTTY:C,defaultWD:w,callback:$,key:x,details:P,logPluginError:E,requestPlugins:R,runOnEndCallbacks:M,pluginRefs:D})=>{let B={ref(){D&&D.ref(),u&&u.ref()},unref(){D&&D.unref(),u&&u.unref()}},W=!e.isWriteUnavailable,{entries:ee,flags:S,write:h,stdinContents:i,stdinResolveDir:y,absWorkingDir:j,incremental:L,nodePaths:v,watch:m,mangleCache:F}=gt(p,f,C,ue,W),T={command:"build",key:x,entries:ee,flags:S,write:h,stdinContents:i,stdinResolveDir:y,absWorkingDir:j||w,incremental:L,nodePaths:v};R&&(T.plugins=R),F&&(T.mangleCache=F);let Q=a&&ae(B,a,T,x),I,_,X=(U,J)=>{U.outputFiles&&(J.outputFiles=U.outputFiles.map(yt)),U.metafile&&(J.metafile=JSON.parse(U.metafile)),U.mangleCache&&(J.mangleCache=U.mangleCache),U.writeToStdout!==void 0&&console.log(ye(U.writeToStdout).replace(/\n$/,""))},H=(U,J)=>{let G={errors:pe(U.errors,P),warnings:pe(U.warnings,P)};X(U,G),M(G,E,()=>{if(G.errors.length>0)return J(ve("Build failed",G.errors,G.warnings),null);if(U.rebuild){if(!I){let K=!1;I=()=>new Promise((fe,Z)=>{if(K||s)throw new Error("Cannot rebuild");k(B,{command:"rebuild",key:x},(re,tt)=>{if(re)return J(ve("Build failed",[{id:"",pluginName:"",text:re,location:null,notes:[],detail:void 0}],[]),null);H(tt,(Te,rt)=>{Te?Z(Te):fe(rt)})})}),B.ref(),I.dispose=()=>{K||(K=!0,k(B,{command:"rebuild-dispose",key:x},()=>{}),B.unref())}}G.rebuild=I}if(U.watch){if(!_){let K=!1;B.ref(),_=()=>{K||(K=!0,o.delete(x),k(B,{command:"watch-stop",key:x},()=>{}),B.unref())},m&&o.set(x,(fe,Z)=>{if(fe){m.onRebuild&&m.onRebuild(fe,null);return}let re={errors:pe(Z.errors,P),warnings:pe(Z.warnings,P)};X(Z,re),M(re,E,()=>{if(re.errors.length>0){m.onRebuild&&m.onRebuild(ve("Build failed",re.errors,re.warnings),null);return}Z.rebuildID!==void 0&&(re.rebuild=I),re.stop=_,m.onRebuild&&m.onRebuild(null,re)})})}G.stop=_}J(null,G)})};if(h&&e.isWriteUnavailable)throw new Error('The "write" option is unavailable in this environment');if(L&&e.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(m&&e.isSync)throw new Error('Cannot use "watch" with a synchronous build');k(B,T,(U,J)=>{if(U)return $(new Error(U),null);if(Q){let G=J,K=!1;B.ref();let fe={port:G.port,host:G.host,wait:Q.wait,stop(){K||(K=!0,Q.stop(),B.unref())}};return B.ref(),Q.wait.then(B.unref,B.unref),$(null,fe)}return H(J,$)})};return{readFromStdout:N,afterClose:A,service:{buildOrServe:ge,transform:({callName:p,refs:u,input:a,options:f,isTTY:C,fs:w,callback:$})=>{let x=Ve(),P=E=>{try{if(typeof a!="string"&&!(a instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:R,mangleCache:M}=mt(p,f,C,ce),D={command:"transform",flags:R,inputFS:E!==null,input:E!==null?ne(E):typeof a=="string"?ne(a):a};M&&(D.mangleCache=M),k(u,D,(B,W)=>{if(B)return $(new Error(B),null);let ee=pe(W.errors,x),S=pe(W.warnings,x),h=1,i=()=>{if(--h===0){let y={warnings:S,code:W.code,map:W.map};W.mangleCache&&(y.mangleCache=W==null?void 0:W.mangleCache),$(null,y)}};if(ee.length>0)return $(ve("Transform failed",ee,S),null);W.codeFS&&(h++,w.readFile(W.code,(y,j)=>{y!==null?$(y,null):(W.code=j,i())})),W.mapFS&&(h++,w.readFile(W.map,(y,j)=>{y!==null?$(y,null):(W.map=j,i())})),i()})}catch(R){let M=[];try{Ae(M,f,{},C,ce)}catch(B){}let D=we(R,e,x,void 0,"");k(u,{command:"error",flags:M,error:D},()=>{D.detail=x.load(D.detail),$(ve("Transform failed",[D],[]),null)})}};if((typeof a=="string"||a instanceof Uint8Array)&&a.length>1024*1024){let E=P;P=()=>w.writeFile(a,E)}P(null)},formatMessages:({callName:p,refs:u,messages:a,options:f,callback:C})=>{let w=he(a,"messages",null,"");if(!f)throw new Error(`Missing second argument in ${p}() call`);let $={},x=n(f,$,"kind",g),P=n(f,$,"color",q),E=n(f,$,"terminalWidth",Re);if(Y(f,$,`in ${p}() call`),x===void 0)throw new Error(`Missing "kind" in ${p}() call`);if(x!=="error"&&x!=="warning")throw new Error(`Expected "kind" to be "error" or "warning" in ${p}() call`);let R={command:"format-msgs",messages:w,isWarning:x==="warning"};P!==void 0&&(R.color=P),E!==void 0&&(R.terminalWidth=E),k(u,R,(M,D)=>{if(M)return C(new Error(M),null);C(null,D.messages)})},analyzeMetafile:({callName:p,refs:u,metafile:a,options:f,callback:C})=>{f===void 0&&(f={});let w={},$=n(f,w,"color",q),x=n(f,w,"verbose",q);Y(f,w,`in ${p}() call`);let P={command:"analyze-metafile",metafile:a};$!==void 0&&(P.color=$),x!==void 0&&(P.verbose=x),k(u,P,(E,R)=>{if(E)return C(new Error(E),null);C(null,R.result)})}}}}function Ve(){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 Ee(e,t,r){let o,d=!1;return()=>{if(d)return o;d=!0;try{let s=(e.stack+"").split(`
2
- `);s.splice(1,1);let c=et(t,s,r);if(c)return o={text:e.message,location:c},o}catch(s){}}}function we(e,t,r,o,d){let s="Internal error",c=null;try{s=(e&&e.message||e)+""}catch(l){}try{c=et(t,(e.stack+"").split(`
3
- `),"")}catch(l){}return{id:"",pluginName:d,text:s,location:c,notes:o?[o]:[],detail:r?r.store(e):-1}}function et(e,t,r){let o=" at ";if(e.readFileSync&&!t[0].startsWith(o)&&t[1].startsWith(o))for(let d=1;d<t.length;d++){let s=t[d];if(!!s.startsWith(o))for(s=s.slice(o.length);;){let c=/^(?:new |async )?\S+ \((.*)\)$/.exec(s);if(c){s=c[1];continue}if(c=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(s),c){s=c[1];continue}if(c=/^(\S+):(\d+):(\d+)$/.exec(s),c){let l;try{l=e.readFileSync(c[1],"utf8")}catch(A){break}let b=l.split(/\r\n|\r|\n|\u2028|\u2029/)[+c[2]-1]||"",O=+c[3]-1,N=b.slice(O,O+r.length)===r?r.length:0;return{file:c[1],namespace:"file",line:+c[2],column:ne(b.slice(0,O)).length,length:ne(b.slice(O,O+N)).length,lineText:b+`
4
- `+t.slice(1).join(`
5
- `),suggestion:""}}break}}return null}function ve(e,t,r){let o=5,d=t.length<1?"":` with ${t.length} error${t.length<2?"":"s"}:`+t.slice(0,o+1).map((c,l)=>{if(l===o)return`
6
- ...`;if(!c.location)return`
7
- error: ${c.text}`;let{file:b,line:O,column:N}=c.location,A=c.pluginName?`[plugin: ${c.pluginName}] `:"";return`
8
- ${b}:${O}:${N}: ERROR: ${A}${c.text}`}).join(""),s=new Error(`${e}${d}`);return s.errors=t,s.warnings=r,s}function pe(e,t){for(let r of e)r.detail=t.load(r.detail);return e}function Je(e,t){if(e==null)return null;let r={},o=n(e,r,"file",g),d=n(e,r,"namespace",g),s=n(e,r,"line",Re),c=n(e,r,"column",Re),l=n(e,r,"length",Re),b=n(e,r,"lineText",g),O=n(e,r,"suggestion",g);return Y(e,r,t),{file:o||"",namespace:d||"",line:s||0,column:c||0,length:l||0,lineText:b||"",suggestion:O||""}}function he(e,t,r,o){let d=[],s=0;for(let c of e){let l={},b=n(c,l,"id",g),O=n(c,l,"pluginName",g),N=n(c,l,"text",g),A=n(c,l,"location",_e),k=n(c,l,"notes",V),z=n(c,l,"detail",$e),le=`in element ${s} of "${t}"`;Y(c,l,le);let oe=[];if(k)for(let ie of k){let te={},ae=n(ie,te,"text",g),ue=n(ie,te,"location",_e);Y(ie,te,le),oe.push({text:ae||"",location:Je(ue,le)})}d.push({id:b||"",pluginName:O||o,text:N||"",location:Je(A,le),notes:oe,detail:r?r.store(z):-1}),s++}return d}function ke(e,t){let r=[];for(let o of e){if(typeof o!="string")throw new Error(`${JSON.stringify(t)} must be an array of strings`);r.push(o)}return r}function yt({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=ye(o)),r}}}var bt="0.15.4",wt=e=>Ce().build(e),vt=()=>{throw new Error('The "serve" API only works in node')},Rt=(e,t)=>Ce().transform(e,t),Ot=(e,t)=>Ce().formatMessages(e,t),xt=(e,t)=>Ce().analyzeMetafile(e,t),St=()=>{throw new Error('The "buildSync" API only works in node')},Et=()=>{throw new Error('The "transformSync" API only works in node')},kt=()=>{throw new Error('The "formatMessagesSync" API only works in node')},$t=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},Oe,Le,Ce=()=>{if(Le)return Le;throw Oe?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')},Mt=e=>{e=He(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(Oe)throw new Error('Cannot call "initialize" more than once');return Oe=At(t||"",r,o),Oe.catch(()=>{Oe=void 0}),Oe},At=async(e,t,r)=>{let o;if(t)o=t;else{let l=await fetch(e);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(e)}`);o=await l.arrayBuffer()}let d;if(r){let l=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]});return(()=>{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.4"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,a.importObject).then(h=>a.run(h)):WebAssembly.instantiate(r,a.importObject).then(({instance:h})=>a.run(h))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});d=new Worker(URL.createObjectURL(l))}else{let l=(postMessage=>{
1
+ var Ue=Object.defineProperty;var Ne=(t,e)=>{for(var r in e)Ue(t,r,{get:e[r],enumerable:!0})};var ge={};Ne(ge,{analyzeMetafile:()=>rt,analyzeMetafileSync:()=>ot,build:()=>Xe,buildSync:()=>nt,default:()=>ut,formatMessages:()=>tt,formatMessagesSync:()=>it,initialize:()=>st,serve:()=>Ze,transform:()=>et,transformSync:()=>lt,version:()=>Ge});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(Q(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 i of a)r.write(Q(i)),e(s[i])}},r=new se;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 Oe(t){let e=()=>{switch(r.read8()){case 0:return null;case 1:return!!r.read8();case 2:return r.read32();case 3:return Z(r.read());case 4:return r.read();case 5:{let u=r.read32(),l=[];for(let g=0;g<u;g++)l.push(e());return l}case 6:{let u=r.read32(),l={};for(let g=0;g<u;g++)l[Z(r.read())]=e();return l}default:throw new Error("Invalid packet")}},r=new se(t),s=r.read32(),a=(s&1)===0;s>>>=1;let i=e();if(r.ptr!==t.length)throw new Error("Invalid packet");return{id:s,isRequest:a,value:i}}var se=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}},Q,Z;if(typeof TextEncoder!="undefined"&&typeof TextDecoder!="undefined"){let t=new TextEncoder,e=new TextDecoder;Q=r=>t.encode(r),Z=r=>e.decode(r)}else if(typeof Buffer!="undefined")Q=t=>{let e=Buffer.from(t);return e instanceof Uint8Array||(e=new Uint8Array(e)),e},Z=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 xe="warning",Se="silent";function Ee(t){if(t+="",t.indexOf(",")>=0)throw new Error(`Invalid target: ${t}`);return t}var fe=()=>null,U=t=>typeof t=="boolean"?null:"a boolean",Le=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",H=t=>typeof t=="object"&&t!==null&&!Array.isArray(t)?null:"an object",We=t=>t instanceof WebAssembly.Module?null:"a WebAssembly.Module",qe=t=>typeof t=="object"&&t!==null?null:"an array or an object",ke=t=>typeof t=="object"&&!Array.isArray(t)?null:"an object or null",Me=t=>typeof t=="string"||typeof t=="boolean"?null:"a string or a boolean",Ie=t=>typeof t=="string"||typeof t=="object"&&t!==null&&!Array.isArray(t)?null:"a string or an object",ze=t=>typeof t=="string"||Array.isArray(t)?null:"a string or an array",Ae=t=>typeof t=="string"||t instanceof Uint8Array?null:"a string or a Uint8Array";function n(t,e,r,s){let a=t[r];if(e[r+""]=!0,a===void 0)return;let i=s(a);if(i!==null)throw new Error(`"${r}" must be ${i}`);return a}function K(t,e,r){for(let s in t)if(!(s in e))throw new Error(`Invalid option ${r}: "${s}"`)}function Ce(t){let e=Object.create(null),r=n(t,e,"wasmURL",h),s=n(t,e,"wasmModule",We),a=n(t,e,"worker",U);return K(t,e,"in initialize() call"),{wasmURL:r,wasmModule:s,worker:a}}function De(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 i=n(e,r,"color",U),u=n(e,r,"logLevel",h),l=n(e,r,"logLimit",ne);i!==void 0?t.push(`--color=${i}`):s&&t.push("--color=true"),t.push(`--log-level=${u||a}`),t.push(`--log-limit=${l||0}`)}function Be(t,e,r){let s=n(e,r,"legalComments",h),a=n(e,r,"sourceRoot",h),i=n(e,r,"sourcesContent",U),u=n(e,r,"target",ze),l=n(e,r,"format",h),g=n(e,r,"globalName",h),S=n(e,r,"mangleProps",ce),E=n(e,r,"reserveProps",ce),k=n(e,r,"mangleQuoted",U),B=n(e,r,"minify",U),F=n(e,r,"minifySyntax",U),N=n(e,r,"minifyWhitespace",U),I=n(e,r,"minifyIdentifiers",U),j=n(e,r,"drop",q),V=n(e,r,"charset",h),w=n(e,r,"treeShaking",U),d=n(e,r,"ignoreAnnotations",U),o=n(e,r,"jsx",h),f=n(e,r,"jsxFactory",h),y=n(e,r,"jsxFragment",h),x=n(e,r,"jsxImportSource",h),O=n(e,r,"jsxDev",U),c=n(e,r,"jsxSideEffects",U),p=n(e,r,"define",H),b=n(e,r,"logOverride",H),$=n(e,r,"supported",H),R=n(e,r,"pure",q),C=n(e,r,"keepNames",U),M=n(e,r,"platform",h);if(s&&t.push(`--legal-comments=${s}`),a!==void 0&&t.push(`--source-root=${a}`),i!==void 0&&t.push(`--sources-content=${i}`),u&&(Array.isArray(u)?t.push(`--target=${Array.from(u).map(Ee).join(",")}`):t.push(`--target=${Ee(u)}`)),l&&t.push(`--format=${l}`),g&&t.push(`--global-name=${g}`),M&&t.push(`--platform=${M}`),B&&t.push("--minify"),F&&t.push("--minify-syntax"),N&&t.push("--minify-whitespace"),I&&t.push("--minify-identifiers"),V&&t.push(`--charset=${V}`),w!==void 0&&t.push(`--tree-shaking=${w}`),d&&t.push("--ignore-annotations"),j)for(let v of j)t.push(`--drop:${v}`);if(S&&t.push(`--mangle-props=${S.source}`),E&&t.push(`--reserve-props=${E.source}`),k!==void 0&&t.push(`--mangle-quoted=${k}`),o&&t.push(`--jsx=${o}`),f&&t.push(`--jsx-factory=${f}`),y&&t.push(`--jsx-fragment=${y}`),x&&t.push(`--jsx-import-source=${x}`),O&&t.push("--jsx-dev"),c&&t.push("--jsx-side-effects"),p)for(let v in p){if(v.indexOf("=")>=0)throw new Error(`Invalid define: ${v}`);t.push(`--define:${v}=${p[v]}`)}if(b)for(let v in b){if(v.indexOf("=")>=0)throw new Error(`Invalid log override: ${v}`);t.push(`--log-override:${v}=${b[v]}`)}if($)for(let v in $){if(v.indexOf("=")>=0)throw new Error(`Invalid supported: ${v}`);t.push(`--supported:${v}=${$[v]}`)}if(R)for(let v of R)t.push(`--pure:${v}`);C&&t.push("--keep-names")}function Ke(t,e,r,s,a){var Y;let i=[],u=[],l=Object.create(null),g=null,S=null,E=null;de(i,e,l,r,s),Be(i,e,l);let k=n(e,l,"sourcemap",Me),B=n(e,l,"bundle",U),F=n(e,l,"watch",Le),N=n(e,l,"splitting",U),I=n(e,l,"preserveSymlinks",U),j=n(e,l,"metafile",U),V=n(e,l,"outfile",h),w=n(e,l,"outdir",h),d=n(e,l,"outbase",h),o=n(e,l,"tsconfig",h),f=n(e,l,"resolveExtensions",q),y=n(e,l,"nodePaths",q),x=n(e,l,"mainFields",q),O=n(e,l,"conditions",q),c=n(e,l,"external",q),p=n(e,l,"loader",H),b=n(e,l,"outExtension",H),$=n(e,l,"publicPath",h),R=n(e,l,"entryNames",h),C=n(e,l,"chunkNames",h),M=n(e,l,"assetNames",h),v=n(e,l,"inject",q),D=n(e,l,"banner",H),L=n(e,l,"footer",H),z=n(e,l,"entryPoints",qe),W=n(e,l,"absWorkingDir",h),A=n(e,l,"stdin",H),P=(Y=n(e,l,"write",U))!=null?Y:a,_=n(e,l,"allowOverwrite",U),J=n(e,l,"incremental",U)===!0,X=n(e,l,"mangleCache",H);if(l.plugins=!0,K(e,l,`in ${t}() call`),k&&i.push(`--sourcemap${k===!0?"":`=${k}`}`),B&&i.push("--bundle"),_&&i.push("--allow-overwrite"),F)if(i.push("--watch"),typeof F=="boolean")E={};else{let m=Object.create(null),T=n(F,m,"onRebuild",be);K(F,m,`on "watch" in ${t}() call`),E={onRebuild:T}}if(N&&i.push("--splitting"),I&&i.push("--preserve-symlinks"),j&&i.push("--metafile"),V&&i.push(`--outfile=${V}`),w&&i.push(`--outdir=${w}`),d&&i.push(`--outbase=${d}`),o&&i.push(`--tsconfig=${o}`),f){let m=[];for(let T of f){if(T+="",T.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${T}`);m.push(T)}i.push(`--resolve-extensions=${m.join(",")}`)}if($&&i.push(`--public-path=${$}`),R&&i.push(`--entry-names=${R}`),C&&i.push(`--chunk-names=${C}`),M&&i.push(`--asset-names=${M}`),x){let m=[];for(let T of x){if(T+="",T.indexOf(",")>=0)throw new Error(`Invalid main field: ${T}`);m.push(T)}i.push(`--main-fields=${m.join(",")}`)}if(O){let m=[];for(let T of O){if(T+="",T.indexOf(",")>=0)throw new Error(`Invalid condition: ${T}`);m.push(T)}i.push(`--conditions=${m.join(",")}`)}if(c)for(let m of c)i.push(`--external:${m}`);if(D)for(let m in D){if(m.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${m}`);i.push(`--banner:${m}=${D[m]}`)}if(L)for(let m in L){if(m.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${m}`);i.push(`--footer:${m}=${L[m]}`)}if(v)for(let m of v)i.push(`--inject:${m}`);if(p)for(let m in p){if(m.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${m}`);i.push(`--loader:${m}=${p[m]}`)}if(b)for(let m in b){if(m.indexOf("=")>=0)throw new Error(`Invalid out extension: ${m}`);i.push(`--out-extension:${m}=${b[m]}`)}if(z)if(Array.isArray(z))for(let m of z)u.push(["",m+""]);else for(let[m,T]of Object.entries(z))u.push([m+"",T+""]);if(A){let m=Object.create(null),T=n(A,m,"contents",Ae),oe=n(A,m,"resolveDir",h),ve=n(A,m,"sourcefile",h),Re=n(A,m,"loader",h);K(A,m,'in "stdin" object'),ve&&i.push(`--sourcefile=${ve}`),Re&&i.push(`--loader=${Re}`),oe&&(S=oe+""),typeof T=="string"?g=Q(T):T instanceof Uint8Array&&(g=T)}let te=[];if(y)for(let m of y)m+="",te.push(m);return{entries:u,flags:i,write:P,stdinContents:g,stdinResolveDir:S,absWorkingDir:W,incremental:J,nodePaths:te,watch:E,mangleCache:De(X)}}function _e(t,e,r,s){let a=[],i=Object.create(null);de(a,e,i,r,s),Be(a,e,i);let u=n(e,i,"sourcemap",Me),l=n(e,i,"tsconfigRaw",Ie),g=n(e,i,"sourcefile",h),S=n(e,i,"loader",h),E=n(e,i,"banner",h),k=n(e,i,"footer",h),B=n(e,i,"mangleCache",H);return K(e,i,`in ${t}() call`),u&&a.push(`--sourcemap=${u===!0?"external":u}`),l&&a.push(`--tsconfig-raw=${typeof l=="string"?l:JSON.stringify(l)}`),g&&a.push(`--sourcefile=${g}`),S&&a.push(`--loader=${S}`),E&&a.push(`--banner=${E}`),k&&a.push(`--footer=${k}`),{flags:a,mangleCache:De(B)}}function Pe(t){let e={},r={didClose:!1,reason:""},s={},a=0,i=0,u=new Uint8Array(16*1024),l=0,g=d=>{let o=l+d.length;if(o>u.length){let y=new Uint8Array(o*2);y.set(u),u=y}u.set(d,l),l+=d.length;let f=0;for(;f+4<=l;){let y=he(u,f);if(f+4+y>l)break;f+=4,N(u.subarray(f,f+y)),f+=y}f>0&&(u.copyWithin(0,f,l),l-=f)},S=d=>{r.didClose=!0,d&&(r.reason=": "+(d.message||d));let o="The service was stopped"+r.reason;for(let f in s)s[f](o,null);s={}},E=(d,o,f)=>{if(r.didClose)return f("The service is no longer running"+r.reason,null);let y=a++;s[y]=(x,O)=>{try{f(x,O)}finally{d&&d.unref()}},d&&d.ref(),t.writeToStdin(ye({id:y,isRequest:!0,value:o}))},k=(d,o)=>{if(r.didClose)throw new Error("The service is no longer running"+r.reason);t.writeToStdin(ye({id:d,isRequest:!1,value:o}))},B=async(d,o)=>{try{if(o.command==="ping"){k(d,{});return}if(typeof o.key=="number"){let f=e[o.key];if(f){let y=f[o.command];if(y){await y(d,o);return}}}throw new Error("Invalid command: "+o.command)}catch(f){k(d,{errors:[le(f,t,null,void 0,"")]})}},F=!0,N=d=>{if(F){F=!1;let f=String.fromCharCode(...d);if(f!=="0.15.8")throw new Error(`Cannot start service: Host version "0.15.8" does not match binary version ${JSON.stringify(f)}`);return}let o=Oe(d);if(o.isRequest)B(o.id,o.value);else{let f=s[o.id];delete s[o.id],o.value.error?f(o.value.error,{}):f(null,o.value)}};return{readFromStdout:g,afterClose:S,service:{buildOrServe:({callName:d,refs:o,serveOptions:f,options:y,isTTY:x,defaultWD:O,callback:c})=>{let p=0,b=i++,$={},R={ref(){++p===1&&o&&o.ref()},unref(){--p===0&&(delete e[b],o&&o.unref())}};e[b]=$,R.ref(),Ve(d,b,E,k,R,t,$,y,f,x,O,r,(C,M)=>{try{c(C,M)}finally{R.unref()}})},transform:({callName:d,refs:o,input:f,options:y,isTTY:x,fs:O,callback:c})=>{let p=Te(),b=$=>{try{if(typeof f!="string"&&!(f instanceof Uint8Array))throw new Error('The input to "transform" must be a string or a Uint8Array');let{flags:R,mangleCache:C}=_e(d,y,x,Se),M={command:"transform",flags:R,inputFS:$!==null,input:$!==null?Q($):typeof f=="string"?Q(f):f};C&&(M.mangleCache=C),E(o,M,(v,D)=>{if(v)return c(new Error(v),null);let L=G(D.errors,p),z=G(D.warnings,p),W=1,A=()=>{if(--W===0){let P={warnings:z,code:D.code,map:D.map};D.mangleCache&&(P.mangleCache=D==null?void 0:D.mangleCache),c(null,P)}};if(L.length>0)return c(re("Transform failed",L,z),null);D.codeFS&&(W++,O.readFile(D.code,(P,_)=>{P!==null?c(P,null):(D.code=_,A())})),D.mapFS&&(W++,O.readFile(D.map,(P,_)=>{P!==null?c(P,null):(D.map=_,A())})),A()})}catch(R){let C=[];try{de(C,y,{},x,Se)}catch(v){}let M=le(R,t,p,void 0,"");E(o,{command:"error",flags:C,error:M},()=>{M.detail=p.load(M.detail),c(re("Transform failed",[M],[]),null)})}};if((typeof f=="string"||f instanceof Uint8Array)&&f.length>1024*1024){let $=b;b=()=>O.writeFile(f,$)}b(null)},formatMessages:({callName:d,refs:o,messages:f,options:y,callback:x})=>{let O=ee(f,"messages",null,"");if(!y)throw new Error(`Missing second argument in ${d}() call`);let c={},p=n(y,c,"kind",h),b=n(y,c,"color",U),$=n(y,c,"terminalWidth",ne);if(K(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 R={command:"format-msgs",messages:O,isWarning:p==="warning"};b!==void 0&&(R.color=b),$!==void 0&&(R.terminalWidth=$),E(o,R,(C,M)=>{if(C)return x(new Error(C),null);x(null,M.messages)})},analyzeMetafile:({callName:d,refs:o,metafile:f,options:y,callback:x})=>{y===void 0&&(y={});let O={},c=n(y,O,"color",U),p=n(y,O,"verbose",U);K(y,O,`in ${d}() call`);let b={command:"analyze-metafile",metafile:f};c!==void 0&&(b.color=c),p!==void 0&&(b.verbose=p),E(o,b,($,R)=>{if($)return x(new Error($),null);x(null,R.result)})}}}}function Ve(t,e,r,s,a,i,u,l,g,S,E,k,B){let F=Te(),N=(w,d,o,f)=>{let y=[];try{de(y,l,{},S,xe)}catch(O){}let x=le(w,i,F,o,d);r(a,{command:"error",flags:y,error:x},()=>{x.detail=F.load(x.detail),f(x)})},I=(w,d)=>{N(w,d,void 0,o=>{B(re("Build failed",[o],[]),null)})},j;if(typeof l=="object"){let w=l.plugins;if(w!==void 0){if(!Array.isArray(w))throw new Error('"plugins" must be an array');j=w}}if(j&&j.length>0){if(i.isSync){I(new Error("Cannot use plugins in synchronous API calls"),"");return}Ye(e,r,s,a,i,u,l,j,F).then(w=>{if(!w.ok){I(w.error,w.pluginName);return}try{V(w.requestPlugins,w.runOnEndCallbacks)}catch(d){I(d,"")}},w=>I(w,""));return}try{V(null,(w,d,o)=>o())}catch(w){I(w,"")}function V(w,d){let o=!i.isWriteUnavailable,{entries:f,flags:y,write:x,stdinContents:O,stdinResolveDir:c,absWorkingDir:p,incremental:b,nodePaths:$,watch:R,mangleCache:C}=Ke(t,l,S,xe,o),M={command:"build",key:e,entries:f,flags:y,write:x,stdinContents:O,stdinResolveDir:c,absWorkingDir:p||E,incremental:b,nodePaths:$};w&&(M.plugins=w),C&&(M.mangleCache=C);let v=g&&Je(e,r,s,a,u,g,M),D,L,z=(A,P)=>{A.outputFiles&&(P.outputFiles=A.outputFiles.map(Qe)),A.metafile&&(P.metafile=JSON.parse(A.metafile)),A.mangleCache&&(P.mangleCache=A.mangleCache),A.writeToStdout!==void 0&&console.log(Z(A.writeToStdout).replace(/\n$/,""))},W=(A,P)=>{let _={errors:G(A.errors,F),warnings:G(A.warnings,F)};z(A,_),d(_,N,()=>{if(_.errors.length>0)return P(re("Build failed",_.errors,_.warnings),null);if(A.rebuild){if(!D){let J=!1;D=()=>new Promise((X,te)=>{if(J||k.didClose)throw new Error("Cannot rebuild");r(a,{command:"rebuild",key:e},(Y,m)=>{if(Y)return P(re("Build failed",[{id:"",pluginName:"",text:Y,location:null,notes:[],detail:void 0}],[]),null);W(m,(T,oe)=>{T?te(T):X(oe)})})}),a.ref(),D.dispose=()=>{J||(J=!0,r(a,{command:"rebuild-dispose",key:e},()=>{}),a.unref())}}_.rebuild=D}if(A.watch){if(!L){let J=!1;a.ref(),L=()=>{J||(J=!0,delete u["watch-rebuild"],r(a,{command:"watch-stop",key:e},()=>{}),a.unref())},R&&(u["watch-rebuild"]=(X,te)=>{try{let Y=te.args,m={errors:G(Y.errors,F),warnings:G(Y.warnings,F)};z(Y,m),d(m,N,()=>{if(m.errors.length>0){R.onRebuild&&R.onRebuild(re("Build failed",m.errors,m.warnings),null);return}m.stop=L,R.onRebuild&&R.onRebuild(null,m)})}catch(Y){console.error(Y)}s(X,{})})}_.stop=L}P(null,_)})};if(x&&i.isWriteUnavailable)throw new Error('The "write" option is unavailable in this environment');if(b&&i.isSync)throw new Error('Cannot use "incremental" with a synchronous build');if(R&&i.isSync)throw new Error('Cannot use "watch" with a synchronous build');r(a,M,(A,P)=>{if(A)return B(new Error(A),null);if(v){let _=P,J=!1;a.ref();let X={port:_.port,host:_.host,wait:v.wait,stop(){J||(J=!0,v.stop(),a.unref())}};return a.ref(),v.wait.then(a.unref,a.unref),B(null,X)}return W(P,B)})}}var Je=(t,e,r,s,a,i,u)=>{let l={},g=n(i,l,"port",ne),S=n(i,l,"host",h),E=n(i,l,"servedir",h),k=n(i,l,"onRequest",be),B=new Promise((F,N)=>{a["serve-wait"]=(I,j)=>{j.error!==null?N(new Error(j.error)):F(),r(I,{})}});return u.serve={},K(i,l,"in serve() call"),g!==void 0&&(u.serve.port=g),S!==void 0&&(u.serve.host=S),E!==void 0&&(u.serve.servedir=E),a["serve-request"]=(F,N)=>{k&&k(N.args),r(F,{})},{wait:B,stop(){e(s,{command:"serve-stop",key:t},()=>{})}}},Ye=async(t,e,r,s,a,i,u,l,g)=>{let S=[],E=[],k={},B={},F=0,N=0,I=[],j=!1;l=[...l];for(let w of l){let d={};if(typeof w!="object")throw new Error(`Plugin at index ${N} must be an object`);let o=n(w,d,"name",h);if(typeof o!="string"||o==="")throw new Error(`Plugin at index ${N} is missing a name`);try{let f=n(w,d,"setup",be);if(typeof f!="function")throw new Error("Plugin is missing a setup function");K(w,d,`on plugin ${JSON.stringify(o)}`);let y={name:o,onResolve:[],onLoad:[]};N++;let O=f({initialOptions:u,resolve:(c,p={})=>{if(!j)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 b=Object.create(null),$=n(p,b,"pluginName",h),R=n(p,b,"importer",h),C=n(p,b,"namespace",h),M=n(p,b,"resolveDir",h),v=n(p,b,"kind",h),D=n(p,b,"pluginData",fe);return K(p,b,"in resolve() call"),new Promise((L,z)=>{let W={command:"resolve",path:c,key:t,pluginName:o};$!=null&&(W.pluginName=$),R!=null&&(W.importer=R),C!=null&&(W.namespace=C),M!=null&&(W.resolveDir=M),v!=null&&(W.kind=v),D!=null&&(W.pluginData=g.store(D)),e(s,W,(A,P)=>{A!==null?z(new Error(A)):L({errors:G(P.errors,g),warnings:G(P.warnings,g),path:P.path,external:P.external,sideEffects:P.sideEffects,namespace:P.namespace,suffix:P.suffix,pluginData:g.load(P.pluginData)})})})},onStart(c){let p='This error came from the "onStart" callback registered here:',b=ae(new Error(p),a,"onStart");S.push({name:o,callback:c,note:b})},onEnd(c){let p='This error came from the "onEnd" callback registered here:',b=ae(new Error(p),a,"onEnd");E.push({name:o,callback:c,note:b})},onResolve(c,p){let b='This error came from the "onResolve" callback registered here:',$=ae(new Error(b),a,"onResolve"),R={},C=n(c,R,"filter",ce),M=n(c,R,"namespace",h);if(K(c,R,`in onResolve() call for plugin ${JSON.stringify(o)}`),C==null)throw new Error("onResolve() call is missing a filter");let v=F++;k[v]={name:o,callback:p,note:$},y.onResolve.push({id:v,filter:C.source,namespace:M||""})},onLoad(c,p){let b='This error came from the "onLoad" callback registered here:',$=ae(new Error(b),a,"onLoad"),R={},C=n(c,R,"filter",ce),M=n(c,R,"namespace",h);if(K(c,R,`in onLoad() call for plugin ${JSON.stringify(o)}`),C==null)throw new Error("onLoad() call is missing a filter");let v=F++;B[v]={name:o,callback:p,note:$},y.onLoad.push({id:v,filter:C.source,namespace:M||""})},esbuild:a.esbuild});O&&await O,I.push(y)}catch(f){return{ok:!1,error:f,pluginName:o}}}i["on-start"]=async(w,d)=>{let o={errors:[],warnings:[]};await Promise.all(S.map(async({name:f,callback:y,note:x})=>{try{let O=await y();if(O!=null){if(typeof O!="object")throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(f)} to return an object`);let c={},p=n(O,c,"errors",q),b=n(O,c,"warnings",q);K(O,c,`from onStart() callback in plugin ${JSON.stringify(f)}`),p!=null&&o.errors.push(...ee(p,"errors",g,f)),b!=null&&o.warnings.push(...ee(b,"warnings",g,f))}}catch(O){o.errors.push(le(O,a,g,x&&x(),f))}})),r(w,o)},i["on-resolve"]=async(w,d)=>{let o={},f="",y,x;for(let O of d.ids)try{({name:f,callback:y,note:x}=k[O]);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(f)} to return an object`);let p={},b=n(c,p,"pluginName",h),$=n(c,p,"path",h),R=n(c,p,"namespace",h),C=n(c,p,"suffix",h),M=n(c,p,"external",U),v=n(c,p,"sideEffects",U),D=n(c,p,"pluginData",fe),L=n(c,p,"errors",q),z=n(c,p,"warnings",q),W=n(c,p,"watchFiles",q),A=n(c,p,"watchDirs",q);K(c,p,`from onResolve() callback in plugin ${JSON.stringify(f)}`),o.id=O,b!=null&&(o.pluginName=b),$!=null&&(o.path=$),R!=null&&(o.namespace=R),C!=null&&(o.suffix=C),M!=null&&(o.external=M),v!=null&&(o.sideEffects=v),D!=null&&(o.pluginData=g.store(D)),L!=null&&(o.errors=ee(L,"errors",g,f)),z!=null&&(o.warnings=ee(z,"warnings",g,f)),W!=null&&(o.watchFiles=ue(W,"watchFiles")),A!=null&&(o.watchDirs=ue(A,"watchDirs"));break}}catch(c){o={id:O,errors:[le(c,a,g,x&&x(),f)]};break}r(w,o)},i["on-load"]=async(w,d)=>{let o={},f="",y,x;for(let O of d.ids)try{({name:f,callback:y,note:x}=B[O]);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(f)} to return an object`);let p={},b=n(c,p,"pluginName",h),$=n(c,p,"contents",Ae),R=n(c,p,"resolveDir",h),C=n(c,p,"pluginData",fe),M=n(c,p,"loader",h),v=n(c,p,"errors",q),D=n(c,p,"warnings",q),L=n(c,p,"watchFiles",q),z=n(c,p,"watchDirs",q);K(c,p,`from onLoad() callback in plugin ${JSON.stringify(f)}`),o.id=O,b!=null&&(o.pluginName=b),$ instanceof Uint8Array?o.contents=$:$!=null&&(o.contents=Q($)),R!=null&&(o.resolveDir=R),C!=null&&(o.pluginData=g.store(C)),M!=null&&(o.loader=M),v!=null&&(o.errors=ee(v,"errors",g,f)),D!=null&&(o.warnings=ee(D,"warnings",g,f)),L!=null&&(o.watchFiles=ue(L,"watchFiles")),z!=null&&(o.watchDirs=ue(z,"watchDirs"));break}}catch(c){o={id:O,errors:[le(c,a,g,x&&x(),f)]};break}r(w,o)};let V=(w,d,o)=>o();return E.length>0&&(V=(w,d,o)=>{(async()=>{for(let{name:f,callback:y,note:x}of E)try{await y(w)}catch(O){w.errors.push(await new Promise(c=>d(O,f,x&&x(),c)))}})().then(o)}),j=!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 i=(t.stack+"").split(`
2
+ `);i.splice(1,1);let u=Fe(e,i,r);if(u)return s={text:t.message,location:u},s}catch(i){}}}function le(t,e,r,s,a){let i="Internal error",u=null;try{i=(t&&t.message||t)+""}catch(l){}try{u=Fe(e,(t.stack+"").split(`
3
+ `),"")}catch(l){}return{id:"",pluginName:a,text:i,location:u,notes:s?[s]:[],detail:r?r.store(t):-1}}function Fe(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 i=e[a];if(!!i.startsWith(s))for(i=i.slice(s.length);;){let u=/^(?:new |async )?\S+ \((.*)\)$/.exec(i);if(u){i=u[1];continue}if(u=/^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(i),u){i=u[1];continue}if(u=/^(\S+):(\d+):(\d+)$/.exec(i),u){let l;try{l=t.readFileSync(u[1],"utf8")}catch(k){break}let g=l.split(/\r\n|\r|\n|\u2028|\u2029/)[+u[2]-1]||"",S=+u[3]-1,E=g.slice(S,S+r.length)===r?r.length:0;return{file:u[1],namespace:"file",line:+u[2],column:Q(g.slice(0,S)).length,length:Q(g.slice(S,S+E)).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((u,l)=>{if(l===s)return`
6
+ ...`;if(!u.location)return`
7
+ error: ${u.text}`;let{file:g,line:S,column:E}=u.location,k=u.pluginName?`[plugin: ${u.pluginName}] `:"";return`
8
+ ${g}:${S}:${E}: ERROR: ${k}${u.text}`}).join(""),i=new Error(`${t}${a}`);return i.errors=e,i.warnings=r,i}function G(t,e){for(let r of t)r.detail=e.load(r.detail);return t}function $e(t,e){if(t==null)return null;let r={},s=n(t,r,"file",h),a=n(t,r,"namespace",h),i=n(t,r,"line",ne),u=n(t,r,"column",ne),l=n(t,r,"length",ne),g=n(t,r,"lineText",h),S=n(t,r,"suggestion",h);return K(t,r,e),{file:s||"",namespace:a||"",line:i||0,column:u||0,length:l||0,lineText:g||"",suggestion:S||""}}function ee(t,e,r,s){let a=[],i=0;for(let u of t){let l={},g=n(u,l,"id",h),S=n(u,l,"pluginName",h),E=n(u,l,"text",h),k=n(u,l,"location",ke),B=n(u,l,"notes",q),F=n(u,l,"detail",fe),N=`in element ${i} of "${e}"`;K(u,l,N);let I=[];if(B)for(let j of B){let V={},w=n(j,V,"text",h),d=n(j,V,"location",ke);K(j,V,N),I.push({text:w||"",location:$e(d,N)})}a.push({id:g||"",pluginName:S||s,text:E||"",location:$e(k,N),notes:I,detail:r?r.store(F):-1}),i++}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 Qe({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=Z(s)),r}}}var Ge="0.15.8",Xe=t=>pe().build(t),Ze=()=>{throw new Error('The "serve" API only works in node')},et=(t,e)=>pe().transform(t,e),tt=(t,e)=>pe().formatMessages(t,e),rt=(t,e)=>pe().analyzeMetafile(t,e),nt=()=>{throw new Error('The "buildSync" API only works in node')},lt=()=>{throw new Error('The "transformSync" API only works in node')},it=()=>{throw new Error('The "formatMessagesSync" API only works in node')},ot=()=>{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')},st=t=>{t=Ce(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=at(e||"",r,s),ie.catch(()=>{ie=void 0}),ie},at=async(t,e,r)=>{let s;if(e)s=e;else{let l=await fetch(t);if(!l.ok)throw new Error(`Failed to download ${JSON.stringify(t)}`);s=await l.arrayBuffer()}let a;if(r){let l=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]});return(()=>{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.8"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,a.importObject).then(h=>a.run(h)):WebAssembly.instantiate(r,a.importObject).then(({instance:h})=>a.run(h))},r=>onmessage(r);})(postMessage)'],{type:"text/javascript"});a=new Worker(URL.createObjectURL(l))}else{let l=(postMessage=>{
9
9
  // Copyright 2018 The Go Authors. All rights reserved.
10
10
  // Use of this source code is governed by a BSD-style
11
11
  // license that can be found in the LICENSE file.
12
12
  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]});return(()=>{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
13
  `);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
14
  `);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.4"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,a.importObject).then(h=>a.run(h)):WebAssembly.instantiate(r,a.importObject).then(({instance:h})=>a.run(h))},r=>onmessage(r);})(b=>d.onmessage({data:b}));d={onmessage:null,postMessage:b=>setTimeout(()=>l({data:b})),terminate(){}}}d.postMessage(o),d.onmessage=({data:l})=>s(l);let{readFromStdout:s,service:c}=Ze({writeToStdin(l){d.postMessage(l)},isSync:!1,isWriteUnavailable:!0,esbuild:Pe});Le={build:l=>new Promise((b,O)=>c.buildOrServe({callName:"build",refs:null,serveOptions:null,options:l,isTTY:!1,defaultWD:"/",callback:(N,A)=>N?O(N):b(A)})),transform:(l,b)=>new Promise((O,N)=>c.transform({callName:"transform",refs:null,input:l,options:b||{},isTTY:!1,fs:{readFile(A,k){k(new Error("Internal error"),null)},writeFile(A,k){k(null)}},callback:(A,k)=>A?N(A):O(k)})),formatMessages:(l,b)=>new Promise((O,N)=>c.formatMessages({callName:"formatMessages",refs:null,messages:l,options:b,callback:(A,k)=>A?N(A):O(k)})),analyzeMetafile:(l,b)=>new Promise((O,N)=>c.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof l=="string"?l:JSON.stringify(l),options:b,callback:(A,k)=>A?N(A):O(k)}))}},Ct=Pe;export{xt as analyzeMetafile,$t as analyzeMetafileSync,wt as build,St as buildSync,Ct as default,Ot as formatMessages,kt as formatMessagesSync,Mt as initialize,vt as serve,Rt as transform,Et as transformSync,bt as version};
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.8"],r instanceof WebAssembly.Module?WebAssembly.instantiate(r,a.importObject).then(h=>a.run(h)):WebAssembly.instantiate(r,a.importObject).then(({instance:h})=>a.run(h))},r=>onmessage(r);})(g=>a.onmessage({data:g}));a={onmessage:null,postMessage:g=>setTimeout(()=>l({data:g})),terminate(){}}}a.postMessage(s),a.onmessage=({data:l})=>i(l);let{readFromStdout:i,service:u}=Pe({writeToStdin(l){a.postMessage(l)},isSync:!1,isWriteUnavailable:!0,esbuild:ge});we={build:l=>new Promise((g,S)=>u.buildOrServe({callName:"build",refs:null,serveOptions:null,options:l,isTTY:!1,defaultWD:"/",callback:(E,k)=>E?S(E):g(k)})),transform:(l,g)=>new Promise((S,E)=>u.transform({callName:"transform",refs:null,input:l,options:g||{},isTTY:!1,fs:{readFile(k,B){B(new Error("Internal error"),null)},writeFile(k,B){B(null)}},callback:(k,B)=>k?E(k):S(B)})),formatMessages:(l,g)=>new Promise((S,E)=>u.formatMessages({callName:"formatMessages",refs:null,messages:l,options:g,callback:(k,B)=>k?E(k):S(B)})),analyzeMetafile:(l,g)=>new Promise((S,E)=>u.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof l=="string"?l:JSON.stringify(l),options:g,callback:(k,B)=>k?E(k):S(B)}))}},ut=ge;export{rt as analyzeMetafile,ot as analyzeMetafileSync,Xe as build,nt as buildSync,ut as default,tt as formatMessages,it as formatMessagesSync,st as initialize,Ze as serve,et as transform,lt as transformSync,Ge as version};
@@ -61,6 +61,8 @@ interface CommonOptions {
61
61
  jsxImportSource?: string;
62
62
  /** Documentation: https://esbuild.github.io/api/#jsx-development */
63
63
  jsxDev?: boolean;
64
+ /** Documentation: https://esbuild.github.io/api/#jsx-side-effects */
65
+ jsxSideEffects?: boolean;
64
66
 
65
67
  /** Documentation: https://esbuild.github.io/api/#define */
66
68
  define?: { [key: string]: string };