isomorfeus-asset-manager 0.16.2 → 0.16.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,18 +3,18 @@ var We=Object.defineProperty;var qe=(e,t)=>{for(var r in t)We(e,r,{get:t[r],enum
3
3
  This indicates that your JavaScript environment is broken. You cannot use
4
4
  esbuild in this environment because esbuild relies on this invariant. This
5
5
  is not a problem with esbuild. You need to fix your environment instead.
6
- `);function Re(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function we(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var J=JSON.stringify,Me="warning",Ce="silent";function Ae(e){if(V(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var pe=()=>null,F=e=>typeof e=="boolean"?null:"a boolean",Ke=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",h=e=>typeof e=="string"?null:"a string",ge=e=>e instanceof RegExp?null:"a RegExp object",oe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",xe=e=>typeof e=="function"?null:"a function",W=e=>Array.isArray(e)?null:"an array",X=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",_e=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Ve=e=>typeof e=="object"&&e!==null?null:"an array or an object",De=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Te=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ye=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Je=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Be=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Qe=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 K(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: ${J(o)}`)}function Ue(e){let t=Object.create(null),r=n(e,t,"wasmURL",Qe),o=n(e,t,"wasmModule",_e),a=n(e,t,"worker",F);return K(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:a}}function Fe(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 me(e,t,r,o,a){let l=n(t,r,"color",F),f=n(t,r,"logLevel",h),s=n(t,r,"logLimit",oe);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 je(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",Je),s=n(t,r,"format",h),m=n(t,r,"globalName",h),b=n(t,r,"mangleProps",ge),R=n(t,r,"reserveProps",ge),A=n(t,r,"mangleQuoted",F),U=n(t,r,"minify",F),k=n(t,r,"minifySyntax",F),T=n(t,r,"minifyWhitespace",F),q=n(t,r,"minifyIdentifiers",F),I=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",X),w=n(t,r,"logOverride",X),$=n(t,r,"supported",X),O=n(t,r,"pure",W),D=n(t,r,"keepNames",F),C=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}`),C&&e.push(`--platform=${C}`),U&&e.push("--minify"),k&&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"),I)for(let v of I)e.push(`--drop:${V(v,"drop")}`);if(b&&e.push(`--mangle-props=${b.source}`),R&&e.push(`--reserve-props=${R.source}`),A!==void 0&&e.push(`--mangle-quoted=${A}`),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($)for(let v in $){if(v.indexOf("=")>=0)throw new Error(`Invalid supported: ${v}`);let M=$[v];if(typeof M!="boolean")throw new Error(`Expected value for supported ${J(v)} to be a boolean, got ${typeof M} instead`);e.push(`--supported:${v}=${M}`)}if(O)for(let v of O)e.push(`--pure:${V(v,"pure")}`);D&&e.push("--keep-names")}function He(e,t,r,o,a){var le;let l=[],f=[],s=Object.create(null),m=null,b=null,R=null;me(l,t,s,r,o),je(l,t,s);let A=n(t,s,"sourcemap",Te),U=n(t,s,"bundle",F),k=n(t,s,"watch",Ke),T=n(t,s,"splitting",F),q=n(t,s,"preserveSymlinks",F),I=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,"packages",h),w=n(t,s,"alias",X),$=n(t,s,"loader",X),O=n(t,s,"outExtension",X),D=n(t,s,"publicPath",h),C=n(t,s,"entryNames",h),v=n(t,s,"chunkNames",h),M=n(t,s,"assetNames",h),z=n(t,s,"inject",W),_=n(t,s,"banner",X),N=n(t,s,"footer",X),P=n(t,s,"entryPoints",Ve),B=n(t,s,"absWorkingDir",h),j=n(t,s,"stdin",X),G=(le=n(t,s,"write",F))!=null?le:a,te=n(t,s,"allowOverwrite",F),ue=n(t,s,"incremental",F)===!0,Z=n(t,s,"mangleCache",X);if(s.plugins=!0,K(t,s,`in ${e}() call`),A&&l.push(`--sourcemap${A===!0?"":`=${A}`}`),U&&l.push("--bundle"),te&&l.push("--allow-overwrite"),k)if(l.push("--watch"),typeof k=="boolean")R={};else{let g=Object.create(null),L=n(k,g,"onRebuild",xe);K(k,g,`on "watch" in ${e}() call`),R={onRebuild:L}}if(T&&l.push("--splitting"),q&&l.push("--preserve-symlinks"),I&&l.push("--metafile"),Y&&l.push(`--outfile=${Y}`),x&&l.push(`--outdir=${x}`),d&&l.push(`--outbase=${d}`),i&&l.push(`--tsconfig=${i}`),p&&l.push(`--packages=${p}`),u){let g=[];for(let L of u){if(V(L,"resolve extension"),L.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${L}`);g.push(L)}l.push(`--resolve-extensions=${g.join(",")}`)}if(D&&l.push(`--public-path=${D}`),C&&l.push(`--entry-names=${C}`),v&&l.push(`--chunk-names=${v}`),M&&l.push(`--asset-names=${M}`),E){let g=[];for(let L of E){if(V(L,"main field"),L.indexOf(",")>=0)throw new Error(`Invalid main field: ${L}`);g.push(L)}l.push(`--main-fields=${g.join(",")}`)}if(S){let g=[];for(let L of S){if(V(L,"condition"),L.indexOf(",")>=0)throw new Error(`Invalid condition: ${L}`);g.push(L)}l.push(`--conditions=${g.join(",")}`)}if(c)for(let g of c)l.push(`--external:${V(g,"external")}`);if(w)for(let g in w){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);l.push(`--alias:${g}=${V(w[g],"alias",g)}`)}if(_)for(let g in _){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);l.push(`--banner:${g}=${V(_[g],"banner",g)}`)}if(N)for(let g in N){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);l.push(`--footer:${g}=${V(N[g],"footer",g)}`)}if(z)for(let g of z)l.push(`--inject:${V(g,"inject")}`);if($)for(let g in $){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);l.push(`--loader:${g}=${V($[g],"loader",g)}`)}if(O)for(let g in O){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);l.push(`--out-extension:${g}=${V(O[g],"out extension",g)}`)}if(P)if(Array.isArray(P))for(let g of P)f.push(["",V(g,"entry point")]);else for(let g in P)f.push([g,V(P[g],"entry point",g)]);if(j){let g=Object.create(null),L=n(j,g,"contents",Be),Se=n(j,g,"resolveDir",h),Ee=n(j,g,"sourcefile",h),ke=n(j,g,"loader",h);K(j,g,'in "stdin" object'),Ee&&l.push(`--sourcefile=${Ee}`),ke&&l.push(`--loader=${ke}`),Se&&(b=Se),typeof L=="string"?m=H(L):L instanceof Uint8Array&&(m=L)}let Q=[];if(y)for(let g of y)g+="",Q.push(g);return{entries:f,flags:l,write:G,stdinContents:m,stdinResolveDir:b,absWorkingDir:B,incremental:ue,nodePaths:Q,watch:R,mangleCache:Fe(Z)}}function Ge(e,t,r,o){let a=[],l=Object.create(null);me(a,t,l,r,o),je(a,t,l);let f=n(t,l,"sourcemap",Te),s=n(t,l,"tsconfigRaw",Ye),m=n(t,l,"sourcefile",h),b=n(t,l,"loader",h),R=n(t,l,"banner",h),A=n(t,l,"footer",h),U=n(t,l,"mangleCache",X);return K(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}`),A&&a.push(`--footer=${A}`),{flags:a,mangleCache:Fe(U)}}function Ne(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=Re(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(ve({id:y,isRequest:!0,value:i}))},A=(d,i)=>{if(r.didClose)throw new Error("The service is no longer running"+r.reason);e.writeToStdin(ve({id:d,isRequest:!1,value:i}))},U=async(d,i)=>{try{if(i.command==="ping"){A(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){A(d,{errors:[se(u,e,null,void 0,"")]})}},k=!0,T=d=>{if(k){k=!1;let u=String.fromCharCode(...d);if(u!=="0.16.10")throw new Error(`Cannot start service: Host version "0.16.10" does not match binary version ${J(u)}`);return}let i=$e(d);if(i.isRequest)U(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++,$={},O={ref(){++p===1&&i&&i.ref()},unref(){--p===0&&(delete t[w],i&&i.unref())}};t[w]=$,O.ref(),Xe(d,w,R,A,O,e,$,y,u,E,S,r,(D,C)=>{try{c(D,C)}finally{O.unref()}})},transform:({callName:d,refs:i,input:u,options:y,isTTY:E,fs:S,callback:c})=>{let p=Le(),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:O,mangleCache:D}=Ge(d,y,E,Ce),C={command:"transform",flags:O,inputFS:$!==null,input:$!==null?H($):typeof u=="string"?H(u):u};D&&(C.mangleCache=D),R(i,C,(v,M)=>{if(v)return c(new Error(v),null);let z=ee(M.errors,p),_=ee(M.warnings,p),N=1,P=()=>{if(--N===0){let B={warnings:_,code:M.code,map:M.map};"legalComments"in M&&(B.legalComments=M==null?void 0:M.legalComments),M.mangleCache&&(B.mangleCache=M==null?void 0:M.mangleCache),c(null,B)}};if(z.length>0)return c(ie("Transform failed",z,_),null);M.codeFS&&(N++,S.readFile(M.code,(B,j)=>{B!==null?c(B,null):(M.code=j,P())})),M.mapFS&&(N++,S.readFile(M.map,(B,j)=>{B!==null?c(B,null):(M.map=j,P())})),P()})}catch(O){let D=[];try{me(D,y,{},E,Ce)}catch(v){}let C=se(O,e,p,void 0,"");R(i,{command:"error",flags:D,error:C},()=>{C.detail=p.load(C.detail),c(ie("Transform failed",[C],[]),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=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),$=n(y,c,"terminalWidth",oe);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 O={command:"format-msgs",messages:S,isWarning:p==="warning"};w!==void 0&&(O.color=w),$!==void 0&&(O.terminalWidth=$),R(i,O,(D,C)=>{if(D)return E(new Error(D),null);E(null,C.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);K(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,($,O)=>{if($)return E(new Error($),null);E(null,O.result)})}}}}function Xe(e,t,r,o,a,l,f,s,m,b,R,A,U){let k=Le(),T=(x,d,i,u)=>{let y=[];try{me(y,s,{},b,Me)}catch(S){}let E=se(x,l,k,i,d);r(a,{command:"error",flags:y,error:E},()=>{E.detail=k.load(E.detail),u(E)})},q=(x,d)=>{T(x,d,void 0,i=>{U(ie("Build failed",[i],[]),null)})},I;if(typeof s=="object"){let x=s.plugins;if(x!==void 0){if(!Array.isArray(x))throw new Error('"plugins" must be an array');I=x}}if(I&&I.length>0){if(l.isSync){q(new Error("Cannot use plugins in synchronous API calls"),"");return}et(t,r,o,a,l,f,s,I,k).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:$,watch:O,mangleCache:D}=He(e,s,b,Me,i),C={command:"build",key:t,entries:u,flags:y,write:E,stdinContents:S,stdinResolveDir:c,absWorkingDir:p||R,incremental:w,nodePaths:$};x&&(C.plugins=x),D&&(C.mangleCache=D);let v=m&&Ze(t,r,o,a,f,m,C),M,z,_=(P,B)=>{P.outputFiles&&(B.outputFiles=P.outputFiles.map(tt)),P.metafile&&(B.metafile=JSON.parse(P.metafile)),P.mangleCache&&(B.mangleCache=P.mangleCache),P.writeToStdout!==void 0&&console.log(re(P.writeToStdout).replace(/\n$/,""))},N=(P,B)=>{let j={errors:ee(P.errors,k),warnings:ee(P.warnings,k)};_(P,j),d(j,T,()=>{if(j.errors.length>0)return B(ie("Build failed",j.errors,j.warnings),null);if(P.rebuild){if(!M){let G=!1;M=()=>new Promise((te,ue)=>{if(G||A.didClose)throw new Error("Cannot rebuild");r(a,{command:"rebuild",key:t},(Z,Q)=>{if(Z)return B(ie("Build failed",[{id:"",pluginName:"",text:Z,location:null,notes:[],detail:void 0}],[]),null);N(Q,(le,g)=>{le?ue(le):te(g)})})}),a.ref(),M.dispose=()=>{G||(G=!0,r(a,{command:"rebuild-dispose",key:t},()=>{}),a.unref())}}j.rebuild=M}if(P.watch){if(!z){let G=!1;a.ref(),z=()=>{G||(G=!0,delete f["watch-rebuild"],r(a,{command:"watch-stop",key:t},()=>{}),a.unref())},O&&(f["watch-rebuild"]=(te,ue)=>{try{let Z=ue.args,Q={errors:ee(Z.errors,k),warnings:ee(Z.warnings,k)};_(Z,Q),d(Q,T,()=>{if(Q.errors.length>0){O.onRebuild&&O.onRebuild(ie("Build failed",Q.errors,Q.warnings),null);return}Q.stop=z,O.onRebuild&&O.onRebuild(null,Q)})}catch(Z){console.error(Z)}o(te,{})})}j.stop=z}B(null,j)})};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,C,(P,B)=>{if(P)return U(new Error(P),null);if(v){let j=B,G=!1;a.ref();let te={port:j.port,host:j.host,wait:v.wait,stop(){G||(G=!0,v.stop(),a.unref())}};return a.ref(),v.wait.then(a.unref,a.unref),U(null,te)}return N(B,U)})}}var Ze=(e,t,r,o,a,l,f)=>{let s={},m=n(l,s,"port",oe),b=n(l,s,"host",h),R=n(l,s,"servedir",h),A=n(l,s,"onRequest",xe),U=new Promise((k,T)=>{a["serve-wait"]=(q,I)=>{I.error!==null?T(new Error(I.error)):k(),r(q,{})}});return f.serve={},K(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"]=(k,T)=>{A&&A(T.args),r(k,{})},{wait:U,stop(){t(o,{command:"serve-stop",key:e},()=>{})}}},et=async(e,t,r,o,a,l,f,s,m)=>{let b=[],R=[],A={},U={},k=0,T=0,q=[],I=!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",xe);if(typeof u!="function")throw new Error("Plugin is missing a setup function");K(x,d,`on plugin ${J(i)}`);let y={name:i,onResolve:[],onLoad:[]};T++;let S=u({initialOptions:f,resolve:(c,p={})=>{if(!I)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),O=n(p,w,"importer",h),D=n(p,w,"namespace",h),C=n(p,w,"resolveDir",h),v=n(p,w,"kind",h),M=n(p,w,"pluginData",pe);return K(p,w,"in resolve() call"),new Promise((z,_)=>{let N={command:"resolve",path:c,key:e,pluginName:i};if($!=null&&(N.pluginName=$),O!=null&&(N.importer=O),D!=null&&(N.namespace=D),C!=null&&(N.resolveDir=C),v!=null)N.kind=v;else throw new Error('Must specify "kind" when calling "resolve"');M!=null&&(N.pluginData=m.store(M)),t(o,N,(P,B)=>{P!==null?_(new Error(P)):z({errors:ee(B.errors,m),warnings:ee(B.warnings,m),path:B.path,external:B.external,sideEffects:B.sideEffects,namespace:B.namespace,suffix:B.suffix,pluginData:m.load(B.pluginData)})})})},onStart(c){let p='This error came from the "onStart" callback registered here:',w=ce(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=ce(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:',$=ce(new Error(w),a,"onResolve"),O={},D=n(c,O,"filter",ge),C=n(c,O,"namespace",h);if(K(c,O,`in onResolve() call for plugin ${J(i)}`),D==null)throw new Error("onResolve() call is missing a filter");let v=k++;A[v]={name:i,callback:p,note:$},y.onResolve.push({id:v,filter:D.source,namespace:C||""})},onLoad(c,p){let w='This error came from the "onLoad" callback registered here:',$=ce(new Error(w),a,"onLoad"),O={},D=n(c,O,"filter",ge),C=n(c,O,"namespace",h);if(K(c,O,`in onLoad() call for plugin ${J(i)}`),D==null)throw new Error("onLoad() call is missing a filter");let v=k++;U[v]={name:i,callback:p,note:$},y.onLoad.push({id:v,filter:D.source,namespace:C||""})},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);K(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(se(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}=A[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),$=n(c,p,"path",h),O=n(c,p,"namespace",h),D=n(c,p,"suffix",h),C=n(c,p,"external",F),v=n(c,p,"sideEffects",F),M=n(c,p,"pluginData",pe),z=n(c,p,"errors",W),_=n(c,p,"warnings",W),N=n(c,p,"watchFiles",W),P=n(c,p,"watchDirs",W);K(c,p,`from onResolve() callback in plugin ${J(u)}`),i.id=S,w!=null&&(i.pluginName=w),$!=null&&(i.path=$),O!=null&&(i.namespace=O),D!=null&&(i.suffix=D),C!=null&&(i.external=C),v!=null&&(i.sideEffects=v),M!=null&&(i.pluginData=m.store(M)),z!=null&&(i.errors=ne(z,"errors",m,u)),_!=null&&(i.warnings=ne(_,"warnings",m,u)),N!=null&&(i.watchFiles=de(N,"watchFiles")),P!=null&&(i.watchDirs=de(P,"watchDirs"));break}}catch(c){i={id:S,errors:[se(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}=U[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),$=n(c,p,"contents",Be),O=n(c,p,"resolveDir",h),D=n(c,p,"pluginData",pe),C=n(c,p,"loader",h),v=n(c,p,"errors",W),M=n(c,p,"warnings",W),z=n(c,p,"watchFiles",W),_=n(c,p,"watchDirs",W);K(c,p,`from onLoad() callback in plugin ${J(u)}`),i.id=S,w!=null&&(i.pluginName=w),$ instanceof Uint8Array?i.contents=$:$!=null&&(i.contents=H($)),O!=null&&(i.resolveDir=O),D!=null&&(i.pluginData=m.store(D)),C!=null&&(i.loader=C),v!=null&&(i.errors=ne(v,"errors",m,u)),M!=null&&(i.warnings=ne(M,"warnings",m,u)),z!=null&&(i.watchFiles=de(z,"watchFiles")),_!=null&&(i.watchDirs=de(_,"watchDirs"));break}}catch(c){i={id:S,errors:[se(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)}),I=!0,{ok:!0,requestPlugins:q,runOnEndCallbacks:Y}};function Le(){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 ce(e,t,r){let o,a=!1;return()=>{if(a)return o;a=!0;try{let l=(e.stack+"").split(`
6
+ `);function Re(e,t){return e[t++]|e[t++]<<8|e[t++]<<16|e[t++]<<24}function we(e,t,r){e[r++]=t,e[r++]=t>>8,e[r++]=t>>16,e[r++]=t>>24}var J=JSON.stringify,Me="warning",Ce="silent";function Ae(e){if(V(e,"target"),e.indexOf(",")>=0)throw new Error(`Invalid target: ${e}`);return e}var pe=()=>null,F=e=>typeof e=="boolean"?null:"a boolean",Ke=e=>typeof e=="boolean"||typeof e=="object"&&!Array.isArray(e)?null:"a boolean or an object",h=e=>typeof e=="string"?null:"a string",ge=e=>e instanceof RegExp?null:"a RegExp object",oe=e=>typeof e=="number"&&e===(e|0)?null:"an integer",xe=e=>typeof e=="function"?null:"a function",W=e=>Array.isArray(e)?null:"an array",X=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"an object",_e=e=>e instanceof WebAssembly.Module?null:"a WebAssembly.Module",Ve=e=>typeof e=="object"&&e!==null?null:"an array or an object",De=e=>typeof e=="object"&&!Array.isArray(e)?null:"an object or null",Te=e=>typeof e=="string"||typeof e=="boolean"?null:"a string or a boolean",Ye=e=>typeof e=="string"||typeof e=="object"&&e!==null&&!Array.isArray(e)?null:"a string or an object",Je=e=>typeof e=="string"||Array.isArray(e)?null:"a string or an array",Be=e=>typeof e=="string"||e instanceof Uint8Array?null:"a string or a Uint8Array",Qe=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 K(e,t,r){for(let o in e)if(!(o in t))throw new Error(`Invalid option ${r}: ${J(o)}`)}function Ue(e){let t=Object.create(null),r=n(e,t,"wasmURL",Qe),o=n(e,t,"wasmModule",_e),a=n(e,t,"worker",F);return K(e,t,"in initialize() call"),{wasmURL:r,wasmModule:o,worker:a}}function Fe(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 me(e,t,r,o,a){let l=n(t,r,"color",F),f=n(t,r,"logLevel",h),s=n(t,r,"logLimit",oe);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 je(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",Je),s=n(t,r,"format",h),m=n(t,r,"globalName",h),b=n(t,r,"mangleProps",ge),R=n(t,r,"reserveProps",ge),A=n(t,r,"mangleQuoted",F),U=n(t,r,"minify",F),k=n(t,r,"minifySyntax",F),T=n(t,r,"minifyWhitespace",F),q=n(t,r,"minifyIdentifiers",F),I=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",X),w=n(t,r,"logOverride",X),$=n(t,r,"supported",X),O=n(t,r,"pure",W),D=n(t,r,"keepNames",F),C=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}`),C&&e.push(`--platform=${C}`),U&&e.push("--minify"),k&&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"),I)for(let v of I)e.push(`--drop:${V(v,"drop")}`);if(b&&e.push(`--mangle-props=${b.source}`),R&&e.push(`--reserve-props=${R.source}`),A!==void 0&&e.push(`--mangle-quoted=${A}`),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($)for(let v in $){if(v.indexOf("=")>=0)throw new Error(`Invalid supported: ${v}`);let M=$[v];if(typeof M!="boolean")throw new Error(`Expected value for supported ${J(v)} to be a boolean, got ${typeof M} instead`);e.push(`--supported:${v}=${M}`)}if(O)for(let v of O)e.push(`--pure:${V(v,"pure")}`);D&&e.push("--keep-names")}function He(e,t,r,o,a){var le;let l=[],f=[],s=Object.create(null),m=null,b=null,R=null;me(l,t,s,r,o),je(l,t,s);let A=n(t,s,"sourcemap",Te),U=n(t,s,"bundle",F),k=n(t,s,"watch",Ke),T=n(t,s,"splitting",F),q=n(t,s,"preserveSymlinks",F),I=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,"packages",h),w=n(t,s,"alias",X),$=n(t,s,"loader",X),O=n(t,s,"outExtension",X),D=n(t,s,"publicPath",h),C=n(t,s,"entryNames",h),v=n(t,s,"chunkNames",h),M=n(t,s,"assetNames",h),z=n(t,s,"inject",W),_=n(t,s,"banner",X),N=n(t,s,"footer",X),P=n(t,s,"entryPoints",Ve),B=n(t,s,"absWorkingDir",h),j=n(t,s,"stdin",X),G=(le=n(t,s,"write",F))!=null?le:a,te=n(t,s,"allowOverwrite",F),ue=n(t,s,"incremental",F)===!0,Z=n(t,s,"mangleCache",X);if(s.plugins=!0,K(t,s,`in ${e}() call`),A&&l.push(`--sourcemap${A===!0?"":`=${A}`}`),U&&l.push("--bundle"),te&&l.push("--allow-overwrite"),k)if(l.push("--watch"),typeof k=="boolean")R={};else{let g=Object.create(null),L=n(k,g,"onRebuild",xe);K(k,g,`on "watch" in ${e}() call`),R={onRebuild:L}}if(T&&l.push("--splitting"),q&&l.push("--preserve-symlinks"),I&&l.push("--metafile"),Y&&l.push(`--outfile=${Y}`),x&&l.push(`--outdir=${x}`),d&&l.push(`--outbase=${d}`),i&&l.push(`--tsconfig=${i}`),p&&l.push(`--packages=${p}`),u){let g=[];for(let L of u){if(V(L,"resolve extension"),L.indexOf(",")>=0)throw new Error(`Invalid resolve extension: ${L}`);g.push(L)}l.push(`--resolve-extensions=${g.join(",")}`)}if(D&&l.push(`--public-path=${D}`),C&&l.push(`--entry-names=${C}`),v&&l.push(`--chunk-names=${v}`),M&&l.push(`--asset-names=${M}`),E){let g=[];for(let L of E){if(V(L,"main field"),L.indexOf(",")>=0)throw new Error(`Invalid main field: ${L}`);g.push(L)}l.push(`--main-fields=${g.join(",")}`)}if(S){let g=[];for(let L of S){if(V(L,"condition"),L.indexOf(",")>=0)throw new Error(`Invalid condition: ${L}`);g.push(L)}l.push(`--conditions=${g.join(",")}`)}if(c)for(let g of c)l.push(`--external:${V(g,"external")}`);if(w)for(let g in w){if(g.indexOf("=")>=0)throw new Error(`Invalid package name in alias: ${g}`);l.push(`--alias:${g}=${V(w[g],"alias",g)}`)}if(_)for(let g in _){if(g.indexOf("=")>=0)throw new Error(`Invalid banner file type: ${g}`);l.push(`--banner:${g}=${V(_[g],"banner",g)}`)}if(N)for(let g in N){if(g.indexOf("=")>=0)throw new Error(`Invalid footer file type: ${g}`);l.push(`--footer:${g}=${V(N[g],"footer",g)}`)}if(z)for(let g of z)l.push(`--inject:${V(g,"inject")}`);if($)for(let g in $){if(g.indexOf("=")>=0)throw new Error(`Invalid loader extension: ${g}`);l.push(`--loader:${g}=${V($[g],"loader",g)}`)}if(O)for(let g in O){if(g.indexOf("=")>=0)throw new Error(`Invalid out extension: ${g}`);l.push(`--out-extension:${g}=${V(O[g],"out extension",g)}`)}if(P)if(Array.isArray(P))for(let g of P)f.push(["",V(g,"entry point")]);else for(let g in P)f.push([g,V(P[g],"entry point",g)]);if(j){let g=Object.create(null),L=n(j,g,"contents",Be),Se=n(j,g,"resolveDir",h),Ee=n(j,g,"sourcefile",h),ke=n(j,g,"loader",h);K(j,g,'in "stdin" object'),Ee&&l.push(`--sourcefile=${Ee}`),ke&&l.push(`--loader=${ke}`),Se&&(b=Se),typeof L=="string"?m=H(L):L instanceof Uint8Array&&(m=L)}let Q=[];if(y)for(let g of y)g+="",Q.push(g);return{entries:f,flags:l,write:G,stdinContents:m,stdinResolveDir:b,absWorkingDir:B,incremental:ue,nodePaths:Q,watch:R,mangleCache:Fe(Z)}}function Ge(e,t,r,o){let a=[],l=Object.create(null);me(a,t,l,r,o),je(a,t,l);let f=n(t,l,"sourcemap",Te),s=n(t,l,"tsconfigRaw",Ye),m=n(t,l,"sourcefile",h),b=n(t,l,"loader",h),R=n(t,l,"banner",h),A=n(t,l,"footer",h),U=n(t,l,"mangleCache",X);return K(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}`),A&&a.push(`--footer=${A}`),{flags:a,mangleCache:Fe(U)}}function Ne(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=Re(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(ve({id:y,isRequest:!0,value:i}))},A=(d,i)=>{if(r.didClose)throw new Error("The service is no longer running"+r.reason);e.writeToStdin(ve({id:d,isRequest:!1,value:i}))},U=async(d,i)=>{try{if(i.command==="ping"){A(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){A(d,{errors:[se(u,e,null,void 0,"")]})}},k=!0,T=d=>{if(k){k=!1;let u=String.fromCharCode(...d);if(u!=="0.16.17")throw new Error(`Cannot start service: Host version "0.16.17" does not match binary version ${J(u)}`);return}let i=$e(d);if(i.isRequest)U(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++,$={},O={ref(){++p===1&&i&&i.ref()},unref(){--p===0&&(delete t[w],i&&i.unref())}};t[w]=$,O.ref(),Xe(d,w,R,A,O,e,$,y,u,E,S,r,(D,C)=>{try{c(D,C)}finally{O.unref()}})},transform:({callName:d,refs:i,input:u,options:y,isTTY:E,fs:S,callback:c})=>{let p=Le(),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:O,mangleCache:D}=Ge(d,y,E,Ce),C={command:"transform",flags:O,inputFS:$!==null,input:$!==null?H($):typeof u=="string"?H(u):u};D&&(C.mangleCache=D),R(i,C,(v,M)=>{if(v)return c(new Error(v),null);let z=ee(M.errors,p),_=ee(M.warnings,p),N=1,P=()=>{if(--N===0){let B={warnings:_,code:M.code,map:M.map};"legalComments"in M&&(B.legalComments=M==null?void 0:M.legalComments),M.mangleCache&&(B.mangleCache=M==null?void 0:M.mangleCache),c(null,B)}};if(z.length>0)return c(ie("Transform failed",z,_),null);M.codeFS&&(N++,S.readFile(M.code,(B,j)=>{B!==null?c(B,null):(M.code=j,P())})),M.mapFS&&(N++,S.readFile(M.map,(B,j)=>{B!==null?c(B,null):(M.map=j,P())})),P()})}catch(O){let D=[];try{me(D,y,{},E,Ce)}catch(v){}let C=se(O,e,p,void 0,"");R(i,{command:"error",flags:D,error:C},()=>{C.detail=p.load(C.detail),c(ie("Transform failed",[C],[]),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=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),$=n(y,c,"terminalWidth",oe);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 O={command:"format-msgs",messages:S,isWarning:p==="warning"};w!==void 0&&(O.color=w),$!==void 0&&(O.terminalWidth=$),R(i,O,(D,C)=>{if(D)return E(new Error(D),null);E(null,C.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);K(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,($,O)=>{if($)return E(new Error($),null);E(null,O.result)})}}}}function Xe(e,t,r,o,a,l,f,s,m,b,R,A,U){let k=Le(),T=(x,d,i,u)=>{let y=[];try{me(y,s,{},b,Me)}catch(S){}let E=se(x,l,k,i,d);r(a,{command:"error",flags:y,error:E},()=>{E.detail=k.load(E.detail),u(E)})},q=(x,d)=>{T(x,d,void 0,i=>{U(ie("Build failed",[i],[]),null)})},I;if(typeof s=="object"){let x=s.plugins;if(x!==void 0){if(!Array.isArray(x))throw new Error('"plugins" must be an array');I=x}}if(I&&I.length>0){if(l.isSync){q(new Error("Cannot use plugins in synchronous API calls"),"");return}et(t,r,o,a,l,f,s,I,k).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:$,watch:O,mangleCache:D}=He(e,s,b,Me,i),C={command:"build",key:t,entries:u,flags:y,write:E,stdinContents:S,stdinResolveDir:c,absWorkingDir:p||R,incremental:w,nodePaths:$};x&&(C.plugins=x),D&&(C.mangleCache=D);let v=m&&Ze(t,r,o,a,f,m,C),M,z,_=(P,B)=>{P.outputFiles&&(B.outputFiles=P.outputFiles.map(tt)),P.metafile&&(B.metafile=JSON.parse(P.metafile)),P.mangleCache&&(B.mangleCache=P.mangleCache),P.writeToStdout!==void 0&&console.log(re(P.writeToStdout).replace(/\n$/,""))},N=(P,B)=>{let j={errors:ee(P.errors,k),warnings:ee(P.warnings,k)};_(P,j),d(j,T,()=>{if(j.errors.length>0)return B(ie("Build failed",j.errors,j.warnings),null);if(P.rebuild){if(!M){let G=!1;M=()=>new Promise((te,ue)=>{if(G||A.didClose)throw new Error("Cannot rebuild");r(a,{command:"rebuild",key:t},(Z,Q)=>{if(Z)return B(ie("Build failed",[{id:"",pluginName:"",text:Z,location:null,notes:[],detail:void 0}],[]),null);N(Q,(le,g)=>{le?ue(le):te(g)})})}),a.ref(),M.dispose=()=>{G||(G=!0,r(a,{command:"rebuild-dispose",key:t},()=>{}),a.unref())}}j.rebuild=M}if(P.watch){if(!z){let G=!1;a.ref(),z=()=>{G||(G=!0,delete f["watch-rebuild"],r(a,{command:"watch-stop",key:t},()=>{}),a.unref())},O&&(f["watch-rebuild"]=(te,ue)=>{try{let Z=ue.args,Q={errors:ee(Z.errors,k),warnings:ee(Z.warnings,k)};_(Z,Q),d(Q,T,()=>{if(Q.errors.length>0){O.onRebuild&&O.onRebuild(ie("Build failed",Q.errors,Q.warnings),null);return}Q.stop=z,O.onRebuild&&O.onRebuild(null,Q)})}catch(Z){console.error(Z)}o(te,{})})}j.stop=z}B(null,j)})};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,C,(P,B)=>{if(P)return U(new Error(P),null);if(v){let j=B,G=!1;a.ref();let te={port:j.port,host:j.host,wait:v.wait,stop(){G||(G=!0,v.stop(),a.unref())}};return a.ref(),v.wait.then(a.unref,a.unref),U(null,te)}return N(B,U)})}}var Ze=(e,t,r,o,a,l,f)=>{let s={},m=n(l,s,"port",oe),b=n(l,s,"host",h),R=n(l,s,"servedir",h),A=n(l,s,"onRequest",xe),U=new Promise((k,T)=>{a["serve-wait"]=(q,I)=>{I.error!==null?T(new Error(I.error)):k(),r(q,{})}});return f.serve={},K(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"]=(k,T)=>{A&&A(T.args),r(k,{})},{wait:U,stop(){t(o,{command:"serve-stop",key:e},()=>{})}}},et=async(e,t,r,o,a,l,f,s,m)=>{let b=[],R=[],A={},U={},k=0,T=0,q=[],I=!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",xe);if(typeof u!="function")throw new Error("Plugin is missing a setup function");K(x,d,`on plugin ${J(i)}`);let y={name:i,onStart:!1,onEnd:!1,onResolve:[],onLoad:[]};T++;let S=u({initialOptions:f,resolve:(c,p={})=>{if(!I)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),O=n(p,w,"importer",h),D=n(p,w,"namespace",h),C=n(p,w,"resolveDir",h),v=n(p,w,"kind",h),M=n(p,w,"pluginData",pe);return K(p,w,"in resolve() call"),new Promise((z,_)=>{let N={command:"resolve",path:c,key:e,pluginName:i};if($!=null&&(N.pluginName=$),O!=null&&(N.importer=O),D!=null&&(N.namespace=D),C!=null&&(N.resolveDir=C),v!=null)N.kind=v;else throw new Error('Must specify "kind" when calling "resolve"');M!=null&&(N.pluginData=m.store(M)),t(o,N,(P,B)=>{P!==null?_(new Error(P)):z({errors:ee(B.errors,m),warnings:ee(B.warnings,m),path:B.path,external:B.external,sideEffects:B.sideEffects,namespace:B.namespace,suffix:B.suffix,pluginData:m.load(B.pluginData)})})})},onStart(c){let p='This error came from the "onStart" callback registered here:',w=ce(new Error(p),a,"onStart");b.push({name:i,callback:c,note:w}),y.onStart=!0},onEnd(c){let p='This error came from the "onEnd" callback registered here:',w=ce(new Error(p),a,"onEnd");R.push({name:i,callback:c,note:w}),y.onEnd=!0},onResolve(c,p){let w='This error came from the "onResolve" callback registered here:',$=ce(new Error(w),a,"onResolve"),O={},D=n(c,O,"filter",ge),C=n(c,O,"namespace",h);if(K(c,O,`in onResolve() call for plugin ${J(i)}`),D==null)throw new Error("onResolve() call is missing a filter");let v=k++;A[v]={name:i,callback:p,note:$},y.onResolve.push({id:v,filter:D.source,namespace:C||""})},onLoad(c,p){let w='This error came from the "onLoad" callback registered here:',$=ce(new Error(w),a,"onLoad"),O={},D=n(c,O,"filter",ge),C=n(c,O,"namespace",h);if(K(c,O,`in onLoad() call for plugin ${J(i)}`),D==null)throw new Error("onLoad() call is missing a filter");let v=k++;U[v]={name:i,callback:p,note:$},y.onLoad.push({id:v,filter:D.source,namespace:C||""})},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);K(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(se(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}=A[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),$=n(c,p,"path",h),O=n(c,p,"namespace",h),D=n(c,p,"suffix",h),C=n(c,p,"external",F),v=n(c,p,"sideEffects",F),M=n(c,p,"pluginData",pe),z=n(c,p,"errors",W),_=n(c,p,"warnings",W),N=n(c,p,"watchFiles",W),P=n(c,p,"watchDirs",W);K(c,p,`from onResolve() callback in plugin ${J(u)}`),i.id=S,w!=null&&(i.pluginName=w),$!=null&&(i.path=$),O!=null&&(i.namespace=O),D!=null&&(i.suffix=D),C!=null&&(i.external=C),v!=null&&(i.sideEffects=v),M!=null&&(i.pluginData=m.store(M)),z!=null&&(i.errors=ne(z,"errors",m,u)),_!=null&&(i.warnings=ne(_,"warnings",m,u)),N!=null&&(i.watchFiles=de(N,"watchFiles")),P!=null&&(i.watchDirs=de(P,"watchDirs"));break}}catch(c){i={id:S,errors:[se(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}=U[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),$=n(c,p,"contents",Be),O=n(c,p,"resolveDir",h),D=n(c,p,"pluginData",pe),C=n(c,p,"loader",h),v=n(c,p,"errors",W),M=n(c,p,"warnings",W),z=n(c,p,"watchFiles",W),_=n(c,p,"watchDirs",W);K(c,p,`from onLoad() callback in plugin ${J(u)}`),i.id=S,w!=null&&(i.pluginName=w),$ instanceof Uint8Array?i.contents=$:$!=null&&(i.contents=H($)),O!=null&&(i.resolveDir=O),D!=null&&(i.pluginData=m.store(D)),C!=null&&(i.loader=C),v!=null&&(i.errors=ne(v,"errors",m,u)),M!=null&&(i.warnings=ne(M,"warnings",m,u)),z!=null&&(i.watchFiles=de(z,"watchFiles")),_!=null&&(i.watchDirs=de(_,"watchDirs"));break}}catch(c){i={id:S,errors:[se(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)}),I=!0,{ok:!0,requestPlugins:q,runOnEndCallbacks:Y}};function Le(){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 ce(e,t,r){let o,a=!1;return()=>{if(a)return o;a=!0;try{let l=(e.stack+"").split(`
7
7
  `);l.splice(1,1);let f=Ie(t,l,r);if(f)return o={text:e.message,location:f},o}catch(l){}}}function se(e,t,r,o,a){let l="Internal error",f=null;try{l=(e&&e.message||e)+""}catch(s){}try{f=Ie(t,(e.stack+"").split(`
8
8
  `),"")}catch(s){}return{id:"",pluginName:a,text:l,location:f,notes:o?[o]:[],detail:r?r.store(e):-1}}function Ie(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(A){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
9
  `+t.slice(1).join(`
10
10
  `),suggestion:""}}break}}return null}function ie(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`
11
11
  ...`;if(!f.location)return`
12
12
  error: ${f.text}`;let{file:m,line:b,column:R}=f.location,A=f.pluginName?`[plugin: ${f.pluginName}] `:"";return`
13
- ${m}:${b}:${R}: ERROR: ${A}${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 Pe(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",oe),f=n(e,r,"column",oe),s=n(e,r,"length",oe),m=n(e,r,"lineText",h),b=n(e,r,"suggestion",h);return K(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),A=n(f,s,"location",De),U=n(f,s,"notes",W),k=n(f,s,"detail",pe),T=`in element ${l} of "${t}"`;K(f,s,T);let q=[];if(U)for(let I of U){let Y={},x=n(I,Y,"text",h),d=n(I,Y,"location",De);K(I,Y,T),q.push({text:x||"",location:Pe(d,T)})}a.push({id:m||"",pluginName:b||o,text:R||"",location:Pe(A,T),notes:q,detail:r?r.store(k):-1}),l++}return a}function de(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 tt({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 nt="0.16.10",lt=e=>ye().build(e),it=()=>{throw new Error('The "serve" API only works in node')},ot=(e,t)=>ye().transform(e,t),st=(e,t)=>ye().formatMessages(e,t),at=(e,t)=>ye().analyzeMetafile(e,t),ut=()=>{throw new Error('The "buildSync" API only works in node')},ft=()=>{throw new Error('The "transformSync" API only works in node')},ct=()=>{throw new Error('The "formatMessagesSync" API only works in node')},dt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ae,Oe,ye=()=>{if(Oe)return Oe;throw ae?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')},pt=e=>{e=Ue(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(ae)throw new Error('Cannot call "initialize" more than once');return ae=gt(t||"",r,o),ae.catch(()=>{ae=void 0}),ae},gt=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.10"],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=>{
13
+ ${m}:${b}:${R}: ERROR: ${A}${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 Pe(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",oe),f=n(e,r,"column",oe),s=n(e,r,"length",oe),m=n(e,r,"lineText",h),b=n(e,r,"suggestion",h);return K(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),A=n(f,s,"location",De),U=n(f,s,"notes",W),k=n(f,s,"detail",pe),T=`in element ${l} of "${t}"`;K(f,s,T);let q=[];if(U)for(let I of U){let Y={},x=n(I,Y,"text",h),d=n(I,Y,"location",De);K(I,Y,T),q.push({text:x||"",location:Pe(d,T)})}a.push({id:m||"",pluginName:b||o,text:R||"",location:Pe(A,T),notes:q,detail:r?r.store(k):-1}),l++}return a}function de(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 tt({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 nt="0.16.17",lt=e=>ye().build(e),it=()=>{throw new Error('The "serve" API only works in node')},ot=(e,t)=>ye().transform(e,t),st=(e,t)=>ye().formatMessages(e,t),at=(e,t)=>ye().analyzeMetafile(e,t),ut=()=>{throw new Error('The "buildSync" API only works in node')},ft=()=>{throw new Error('The "transformSync" API only works in node')},ct=()=>{throw new Error('The "formatMessagesSync" API only works in node')},dt=()=>{throw new Error('The "analyzeMetafileSync" API only works in node')},ae,Oe,ye=()=>{if(Oe)return Oe;throw ae?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')},pt=e=>{e=Ue(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(ae)throw new Error('Cannot call "initialize" more than once');return ae=gt(t||"",r,o),ae.catch(()=>{ae=void 0}),ae},gt=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.17"],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=>{
14
14
  // Copyright 2018 The Go Authors. All rights reserved.
15
15
  // Use of this source code is governed by a BSD-style
16
16
  // license that can be found in the LICENSE file.
17
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(`
18
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(`
19
19
  `);d.length>1&&console.log(d.slice(0,-1).join(`
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.10"],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}=Ne({writeToStdin(b){o.postMessage(b)},isSync:!1,isWriteUnavailable:!0,esbuild:he});await f,Oe={build:b=>new Promise((R,A)=>m.buildOrServe({callName:"build",refs:null,serveOptions:null,options:b,isTTY:!1,defaultWD:"/",callback:(U,k)=>U?A(U):R(k)})),transform:(b,R)=>new Promise((A,U)=>m.transform({callName:"transform",refs:null,input:b,options:R||{},isTTY:!1,fs:{readFile(k,T){T(new Error("Internal error"),null)},writeFile(k,T){T(null)}},callback:(k,T)=>k?U(k):A(T)})),formatMessages:(b,R)=>new Promise((A,U)=>m.formatMessages({callName:"formatMessages",refs:null,messages:b,options:R,callback:(k,T)=>k?U(k):A(T)})),analyzeMetafile:(b,R)=>new Promise((A,U)=>m.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof b=="string"?b:JSON.stringify(b),options:R,callback:(k,T)=>k?U(k):A(T)}))}},mt=he;export{at as analyzeMetafile,dt as analyzeMetafileSync,lt as build,ut as buildSync,mt as default,st as formatMessages,ct as formatMessagesSync,pt as initialize,it as serve,ot as transform,ft as transformSync,nt 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.17"],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}=Ne({writeToStdin(b){o.postMessage(b)},isSync:!1,isWriteUnavailable:!0,esbuild:he});await f,Oe={build:b=>new Promise((R,A)=>m.buildOrServe({callName:"build",refs:null,serveOptions:null,options:b,isTTY:!1,defaultWD:"/",callback:(U,k)=>U?A(U):R(k)})),transform:(b,R)=>new Promise((A,U)=>m.transform({callName:"transform",refs:null,input:b,options:R||{},isTTY:!1,fs:{readFile(k,T){T(new Error("Internal error"),null)},writeFile(k,T){T(null)}},callback:(k,T)=>k?U(k):A(T)})),formatMessages:(b,R)=>new Promise((A,U)=>m.formatMessages({callName:"formatMessages",refs:null,messages:b,options:R,callback:(k,T)=>k?U(k):A(T)})),analyzeMetafile:(b,R)=>new Promise((A,U)=>m.analyzeMetafile({callName:"analyzeMetafile",refs:null,metafile:typeof b=="string"?b:JSON.stringify(b),options:R,callback:(k,T)=>k?U(k):A(T)}))}},mt=he;export{at as analyzeMetafile,dt as analyzeMetafileSync,lt as build,ut as buildSync,mt as default,st as formatMessages,ct as formatMessagesSync,pt as initialize,it as serve,ot as transform,ft as transformSync,nt as version};
@@ -196,7 +196,7 @@ export interface OutputFile {
196
196
  /** "text" as bytes */
197
197
  contents: Uint8Array;
198
198
  /** "contents" as text (changes automatically with "contents") */
199
- get text(): string;
199
+ readonly text: string;
200
200
  }
201
201
 
202
202
  export interface BuildInvalidate {
@@ -442,7 +442,9 @@ export interface Metafile {
442
442
  path: string
443
443
  kind: ImportKind
444
444
  external?: boolean
445
+ original?: string
445
446
  }[]
447
+ format?: 'cjs' | 'esm'
446
448
  }
447
449
  }
448
450
  outputs: {
@@ -750,8 +750,8 @@ function createChannel(streamIn) {
750
750
  if (isFirstPacket) {
751
751
  isFirstPacket = false;
752
752
  let binaryVersion = String.fromCharCode(...bytes);
753
- if (binaryVersion !== "0.16.10") {
754
- throw new Error(`Cannot start service: Host version "${"0.16.10"}" does not match binary version ${quote(binaryVersion)}`);
753
+ if (binaryVersion !== "0.16.17") {
754
+ throw new Error(`Cannot start service: Host version "${"0.16.17"}" does not match binary version ${quote(binaryVersion)}`);
755
755
  }
756
756
  return;
757
757
  }
@@ -1238,6 +1238,8 @@ var handlePlugins = (buildKey, sendRequest, sendResponse, refs, streamIn, reques
1238
1238
  checkForInvalidFlags(item, keys, `on plugin ${quote(name)}`);
1239
1239
  let plugin = {
1240
1240
  name,
1241
+ onStart: false,
1242
+ onEnd: false,
1241
1243
  onResolve: [],
1242
1244
  onLoad: []
1243
1245
  };
@@ -1300,11 +1302,13 @@ var handlePlugins = (buildKey, sendRequest, sendResponse, refs, streamIn, reques
1300
1302
  let registeredText = `This error came from the "onStart" callback registered here:`;
1301
1303
  let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart");
1302
1304
  onStartCallbacks.push({ name, callback, note: registeredNote });
1305
+ plugin.onStart = true;
1303
1306
  },
1304
1307
  onEnd(callback) {
1305
1308
  let registeredText = `This error came from the "onEnd" callback registered here:`;
1306
1309
  let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd");
1307
1310
  onEndCallbacks.push({ name, callback, note: registeredNote });
1311
+ plugin.onEnd = true;
1308
1312
  },
1309
1313
  onResolve(options, callback) {
1310
1314
  let registeredText = `This error came from the "onResolve" callback registered here:`;
@@ -1705,7 +1709,7 @@ function convertOutputFiles({ path, contents }) {
1705
1709
  }
1706
1710
 
1707
1711
  // lib/npm/browser.ts
1708
- var version = "0.16.10";
1712
+ var version = "0.16.17";
1709
1713
  var build = (options) => ensureServiceIsRunning().build(options);
1710
1714
  var serve = () => {
1711
1715
  throw new Error(`The "serve" API only works in node`);
@@ -1752,7 +1756,7 @@ var initialize = (options) => {
1752
1756
  var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, null, function* () {
1753
1757
  let worker;
1754
1758
  if (useWorker) {
1755
- let blob = 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.\n var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substr(0, nl));\n outputBuf = outputBuf.substr(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n go: {\n "runtime.wasmExit": (sp) => {\n sp >>>= 0;\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n "runtime.wasmWrite": (sp) => {\n sp >>>= 0;\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n "runtime.resetMemoryDataView": (sp) => {\n sp >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n "runtime.walltime": (sp) => {\n sp >>>= 0;\n const msec = new Date().getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8) + 1\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n "runtime.getRandomData": (sp) => {\n sp >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n "syscall/js.stringVal": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n "syscall/js.valueDelete": (sp) => {\n sp >>>= 0;\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n "syscall/js.valueIndex": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n "syscall/js.valueSetIndex": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n "syscall/js.valueCall": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n "syscall/js.valueInvoke": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueNew": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n "syscall/js.valueLength": (sp) => {\n sp >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n "syscall/js.valueLoadString": (sp) => {\n sp >>>= 0;\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n "syscall/js.valueInstanceOf": (sp) => {\n sp >>>= 0;\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n "syscall/js.copyBytesToGo": (sp) => {\n sp >>>= 0;\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "syscall/js.copyBytesToJS": (sp) => {\n sp >>>= 0;\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n run(instance) {\n return __async(this, null, function* () {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n yield this._exitPromise;\n });\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.16.10"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n };\n function tryToInstantiateModule(wasm, go) {\n return __async(this, null, function* () {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = yield fetch(wasm);\n if (!res.ok)\n throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = yield WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = yield res.arrayBuffer();\n const result = yield WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n });\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
1759
+ let blob = 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.\n var __async = (__this, __arguments, generator) => {\n return new Promise((resolve, reject) => {\n var fulfilled = (value) => {\n try {\n step(generator.next(value));\n } catch (e) {\n reject(e);\n }\n };\n var rejected = (value) => {\n try {\n step(generator.throw(value));\n } catch (e) {\n reject(e);\n }\n };\n var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);\n step((generator = generator.apply(__this, __arguments)).next());\n });\n };\n let onmessage;\n let globalThis = {};\n for (let o = self; o; o = Object.getPrototypeOf(o))\n for (let k of Object.getOwnPropertyNames(o))\n if (!(k in globalThis))\n Object.defineProperty(globalThis, k, { get: () => self[k] });\n "use strict";\n (() => {\n const enosys = () => {\n const err = new Error("not implemented");\n err.code = "ENOSYS";\n return err;\n };\n if (!globalThis.fs) {\n let outputBuf = "";\n globalThis.fs = {\n constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },\n // unused\n writeSync(fd, buf) {\n outputBuf += decoder.decode(buf);\n const nl = outputBuf.lastIndexOf("\\n");\n if (nl != -1) {\n console.log(outputBuf.substr(0, nl));\n outputBuf = outputBuf.substr(nl + 1);\n }\n return buf.length;\n },\n write(fd, buf, offset, length, position, callback) {\n if (offset !== 0 || length !== buf.length || position !== null) {\n callback(enosys());\n return;\n }\n const n = this.writeSync(fd, buf);\n callback(null, n);\n },\n chmod(path, mode, callback) {\n callback(enosys());\n },\n chown(path, uid, gid, callback) {\n callback(enosys());\n },\n close(fd, callback) {\n callback(enosys());\n },\n fchmod(fd, mode, callback) {\n callback(enosys());\n },\n fchown(fd, uid, gid, callback) {\n callback(enosys());\n },\n fstat(fd, callback) {\n callback(enosys());\n },\n fsync(fd, callback) {\n callback(null);\n },\n ftruncate(fd, length, callback) {\n callback(enosys());\n },\n lchown(path, uid, gid, callback) {\n callback(enosys());\n },\n link(path, link, callback) {\n callback(enosys());\n },\n lstat(path, callback) {\n callback(enosys());\n },\n mkdir(path, perm, callback) {\n callback(enosys());\n },\n open(path, flags, mode, callback) {\n callback(enosys());\n },\n read(fd, buffer, offset, length, position, callback) {\n callback(enosys());\n },\n readdir(path, callback) {\n callback(enosys());\n },\n readlink(path, callback) {\n callback(enosys());\n },\n rename(from, to, callback) {\n callback(enosys());\n },\n rmdir(path, callback) {\n callback(enosys());\n },\n stat(path, callback) {\n callback(enosys());\n },\n symlink(path, link, callback) {\n callback(enosys());\n },\n truncate(path, length, callback) {\n callback(enosys());\n },\n unlink(path, callback) {\n callback(enosys());\n },\n utimes(path, atime, mtime, callback) {\n callback(enosys());\n }\n };\n }\n if (!globalThis.process) {\n globalThis.process = {\n getuid() {\n return -1;\n },\n getgid() {\n return -1;\n },\n geteuid() {\n return -1;\n },\n getegid() {\n return -1;\n },\n getgroups() {\n throw enosys();\n },\n pid: -1,\n ppid: -1,\n umask() {\n throw enosys();\n },\n cwd() {\n throw enosys();\n },\n chdir() {\n throw enosys();\n }\n };\n }\n if (!globalThis.crypto) {\n throw new Error("globalThis.crypto is not available, polyfill required (crypto.getRandomValues only)");\n }\n if (!globalThis.performance) {\n throw new Error("globalThis.performance is not available, polyfill required (performance.now only)");\n }\n if (!globalThis.TextEncoder) {\n throw new Error("globalThis.TextEncoder is not available, polyfill required");\n }\n if (!globalThis.TextDecoder) {\n throw new Error("globalThis.TextDecoder is not available, polyfill required");\n }\n const encoder = new TextEncoder("utf-8");\n const decoder = new TextDecoder("utf-8");\n globalThis.Go = class {\n constructor() {\n this.argv = ["js"];\n this.env = {};\n this.exit = (code) => {\n if (code !== 0) {\n console.warn("exit code:", code);\n }\n };\n this._exitPromise = new Promise((resolve) => {\n this._resolveExitPromise = resolve;\n });\n this._pendingEvent = null;\n this._scheduledTimeouts = /* @__PURE__ */ new Map();\n this._nextCallbackTimeoutID = 1;\n const setInt64 = (addr, v) => {\n this.mem.setUint32(addr + 0, v, true);\n this.mem.setUint32(addr + 4, Math.floor(v / 4294967296), true);\n };\n const getInt64 = (addr) => {\n const low = this.mem.getUint32(addr + 0, true);\n const high = this.mem.getInt32(addr + 4, true);\n return low + high * 4294967296;\n };\n const loadValue = (addr) => {\n const f = this.mem.getFloat64(addr, true);\n if (f === 0) {\n return void 0;\n }\n if (!isNaN(f)) {\n return f;\n }\n const id = this.mem.getUint32(addr, true);\n return this._values[id];\n };\n const storeValue = (addr, v) => {\n const nanHead = 2146959360;\n if (typeof v === "number" && v !== 0) {\n if (isNaN(v)) {\n this.mem.setUint32(addr + 4, nanHead, true);\n this.mem.setUint32(addr, 0, true);\n return;\n }\n this.mem.setFloat64(addr, v, true);\n return;\n }\n if (v === void 0) {\n this.mem.setFloat64(addr, 0, true);\n return;\n }\n let id = this._ids.get(v);\n if (id === void 0) {\n id = this._idPool.pop();\n if (id === void 0) {\n id = this._values.length;\n }\n this._values[id] = v;\n this._goRefCounts[id] = 0;\n this._ids.set(v, id);\n }\n this._goRefCounts[id]++;\n let typeFlag = 0;\n switch (typeof v) {\n case "object":\n if (v !== null) {\n typeFlag = 1;\n }\n break;\n case "string":\n typeFlag = 2;\n break;\n case "symbol":\n typeFlag = 3;\n break;\n case "function":\n typeFlag = 4;\n break;\n }\n this.mem.setUint32(addr + 4, nanHead | typeFlag, true);\n this.mem.setUint32(addr, id, true);\n };\n const loadSlice = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return new Uint8Array(this._inst.exports.mem.buffer, array, len);\n };\n const loadSliceOfValues = (addr) => {\n const array = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n const a = new Array(len);\n for (let i = 0; i < len; i++) {\n a[i] = loadValue(array + i * 8);\n }\n return a;\n };\n const loadString = (addr) => {\n const saddr = getInt64(addr + 0);\n const len = getInt64(addr + 8);\n return decoder.decode(new DataView(this._inst.exports.mem.buffer, saddr, len));\n };\n const timeOrigin = Date.now() - performance.now();\n this.importObject = {\n go: {\n // Go\'s SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)\n // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported\n // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).\n // This changes the SP, thus we have to update the SP used by the imported function.\n // func wasmExit(code int32)\n "runtime.wasmExit": (sp) => {\n sp >>>= 0;\n const code = this.mem.getInt32(sp + 8, true);\n this.exited = true;\n delete this._inst;\n delete this._values;\n delete this._goRefCounts;\n delete this._ids;\n delete this._idPool;\n this.exit(code);\n },\n // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)\n "runtime.wasmWrite": (sp) => {\n sp >>>= 0;\n const fd = getInt64(sp + 8);\n const p = getInt64(sp + 16);\n const n = this.mem.getInt32(sp + 24, true);\n globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));\n },\n // func resetMemoryDataView()\n "runtime.resetMemoryDataView": (sp) => {\n sp >>>= 0;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n },\n // func nanotime1() int64\n "runtime.nanotime1": (sp) => {\n sp >>>= 0;\n setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);\n },\n // func walltime() (sec int64, nsec int32)\n "runtime.walltime": (sp) => {\n sp >>>= 0;\n const msec = new Date().getTime();\n setInt64(sp + 8, msec / 1e3);\n this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);\n },\n // func scheduleTimeoutEvent(delay int64) int32\n "runtime.scheduleTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this._nextCallbackTimeoutID;\n this._nextCallbackTimeoutID++;\n this._scheduledTimeouts.set(id, setTimeout(\n () => {\n this._resume();\n while (this._scheduledTimeouts.has(id)) {\n console.warn("scheduleTimeoutEvent: missed timeout event");\n this._resume();\n }\n },\n getInt64(sp + 8) + 1\n // setTimeout has been seen to fire up to 1 millisecond early\n ));\n this.mem.setInt32(sp + 16, id, true);\n },\n // func clearTimeoutEvent(id int32)\n "runtime.clearTimeoutEvent": (sp) => {\n sp >>>= 0;\n const id = this.mem.getInt32(sp + 8, true);\n clearTimeout(this._scheduledTimeouts.get(id));\n this._scheduledTimeouts.delete(id);\n },\n // func getRandomData(r []byte)\n "runtime.getRandomData": (sp) => {\n sp >>>= 0;\n crypto.getRandomValues(loadSlice(sp + 8));\n },\n // func finalizeRef(v ref)\n "syscall/js.finalizeRef": (sp) => {\n sp >>>= 0;\n const id = this.mem.getUint32(sp + 8, true);\n this._goRefCounts[id]--;\n if (this._goRefCounts[id] === 0) {\n const v = this._values[id];\n this._values[id] = null;\n this._ids.delete(v);\n this._idPool.push(id);\n }\n },\n // func stringVal(value string) ref\n "syscall/js.stringVal": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, loadString(sp + 8));\n },\n // func valueGet(v ref, p string) ref\n "syscall/js.valueGet": (sp) => {\n sp >>>= 0;\n const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 32, result);\n },\n // func valueSet(v ref, p string, x ref)\n "syscall/js.valueSet": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));\n },\n // func valueDelete(v ref, p string)\n "syscall/js.valueDelete": (sp) => {\n sp >>>= 0;\n Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));\n },\n // func valueIndex(v ref, i int) ref\n "syscall/js.valueIndex": (sp) => {\n sp >>>= 0;\n storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));\n },\n // valueSetIndex(v ref, i int, x ref)\n "syscall/js.valueSetIndex": (sp) => {\n sp >>>= 0;\n Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));\n },\n // func valueCall(v ref, m string, args []ref) (ref, bool)\n "syscall/js.valueCall": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const m = Reflect.get(v, loadString(sp + 16));\n const args = loadSliceOfValues(sp + 32);\n const result = Reflect.apply(m, v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, result);\n this.mem.setUint8(sp + 64, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 56, err);\n this.mem.setUint8(sp + 64, 0);\n }\n },\n // func valueInvoke(v ref, args []ref) (ref, bool)\n "syscall/js.valueInvoke": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.apply(v, void 0, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueNew(v ref, args []ref) (ref, bool)\n "syscall/js.valueNew": (sp) => {\n sp >>>= 0;\n try {\n const v = loadValue(sp + 8);\n const args = loadSliceOfValues(sp + 16);\n const result = Reflect.construct(v, args);\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, result);\n this.mem.setUint8(sp + 48, 1);\n } catch (err) {\n sp = this._inst.exports.getsp() >>> 0;\n storeValue(sp + 40, err);\n this.mem.setUint8(sp + 48, 0);\n }\n },\n // func valueLength(v ref) int\n "syscall/js.valueLength": (sp) => {\n sp >>>= 0;\n setInt64(sp + 16, parseInt(loadValue(sp + 8).length));\n },\n // valuePrepareString(v ref) (ref, int)\n "syscall/js.valuePrepareString": (sp) => {\n sp >>>= 0;\n const str = encoder.encode(String(loadValue(sp + 8)));\n storeValue(sp + 16, str);\n setInt64(sp + 24, str.length);\n },\n // valueLoadString(v ref, b []byte)\n "syscall/js.valueLoadString": (sp) => {\n sp >>>= 0;\n const str = loadValue(sp + 8);\n loadSlice(sp + 16).set(str);\n },\n // func valueInstanceOf(v ref, t ref) bool\n "syscall/js.valueInstanceOf": (sp) => {\n sp >>>= 0;\n this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);\n },\n // func copyBytesToGo(dst []byte, src ref) (int, bool)\n "syscall/js.copyBytesToGo": (sp) => {\n sp >>>= 0;\n const dst = loadSlice(sp + 8);\n const src = loadValue(sp + 32);\n if (!(src instanceof Uint8Array || src instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n // func copyBytesToJS(dst ref, src []byte) (int, bool)\n "syscall/js.copyBytesToJS": (sp) => {\n sp >>>= 0;\n const dst = loadValue(sp + 8);\n const src = loadSlice(sp + 16);\n if (!(dst instanceof Uint8Array || dst instanceof Uint8ClampedArray)) {\n this.mem.setUint8(sp + 48, 0);\n return;\n }\n const toCopy = src.subarray(0, dst.length);\n dst.set(toCopy);\n setInt64(sp + 40, toCopy.length);\n this.mem.setUint8(sp + 48, 1);\n },\n "debug": (value) => {\n console.log(value);\n }\n }\n };\n }\n run(instance) {\n return __async(this, null, function* () {\n if (!(instance instanceof WebAssembly.Instance)) {\n throw new Error("Go.run: WebAssembly.Instance expected");\n }\n this._inst = instance;\n this.mem = new DataView(this._inst.exports.mem.buffer);\n this._values = [\n // JS values that Go currently has references to, indexed by reference id\n NaN,\n 0,\n null,\n true,\n false,\n globalThis,\n this\n ];\n this._goRefCounts = new Array(this._values.length).fill(Infinity);\n this._ids = /* @__PURE__ */ new Map([\n // mapping from JS values to reference ids\n [0, 1],\n [null, 2],\n [true, 3],\n [false, 4],\n [globalThis, 5],\n [this, 6]\n ]);\n this._idPool = [];\n this.exited = false;\n let offset = 4096;\n const strPtr = (str) => {\n const ptr = offset;\n const bytes = encoder.encode(str + "\\0");\n new Uint8Array(this.mem.buffer, offset, bytes.length).set(bytes);\n offset += bytes.length;\n if (offset % 8 !== 0) {\n offset += 8 - offset % 8;\n }\n return ptr;\n };\n const argc = this.argv.length;\n const argvPtrs = [];\n this.argv.forEach((arg) => {\n argvPtrs.push(strPtr(arg));\n });\n argvPtrs.push(0);\n const keys = Object.keys(this.env).sort();\n keys.forEach((key) => {\n argvPtrs.push(strPtr(`${key}=${this.env[key]}`));\n });\n argvPtrs.push(0);\n const argv = offset;\n argvPtrs.forEach((ptr) => {\n this.mem.setUint32(offset, ptr, true);\n this.mem.setUint32(offset + 4, 0, true);\n offset += 8;\n });\n const wasmMinDataAddr = 4096 + 8192;\n if (offset >= wasmMinDataAddr) {\n throw new Error("total length of command line and environment variables exceeds limit");\n }\n this._inst.exports.run(argc, argv);\n if (this.exited) {\n this._resolveExitPromise();\n }\n yield this._exitPromise;\n });\n }\n _resume() {\n if (this.exited) {\n throw new Error("Go program has already exited");\n }\n this._inst.exports.resume();\n if (this.exited) {\n this._resolveExitPromise();\n }\n }\n _makeFuncWrapper(id) {\n const go = this;\n return function() {\n const event = { id, this: this, args: arguments };\n go._pendingEvent = event;\n go._resume();\n return event.result;\n };\n }\n };\n })();\n onmessage = ({ data: wasm }) => {\n let decoder = new TextDecoder();\n let fs = globalThis.fs;\n let stderr = "";\n fs.writeSync = (fd, buffer) => {\n if (fd === 1) {\n postMessage(buffer);\n } else if (fd === 2) {\n stderr += decoder.decode(buffer);\n let parts = stderr.split("\\n");\n if (parts.length > 1)\n console.log(parts.slice(0, -1).join("\\n"));\n stderr = parts[parts.length - 1];\n } else {\n throw new Error("Bad write");\n }\n return buffer.length;\n };\n let stdin = [];\n let resumeStdin;\n let stdinPos = 0;\n onmessage = ({ data }) => {\n if (data.length > 0) {\n stdin.push(data);\n if (resumeStdin)\n resumeStdin();\n }\n };\n fs.read = (fd, buffer, offset, length, position, callback) => {\n if (fd !== 0 || offset !== 0 || length !== buffer.length || position !== null) {\n throw new Error("Bad read");\n }\n if (stdin.length === 0) {\n resumeStdin = () => fs.read(fd, buffer, offset, length, position, callback);\n return;\n }\n let first = stdin[0];\n let count = Math.max(0, Math.min(length, first.length - stdinPos));\n buffer.set(first.subarray(stdinPos, stdinPos + count), offset);\n stdinPos += count;\n if (stdinPos === first.length) {\n stdin.shift();\n stdinPos = 0;\n }\n callback(null, count);\n };\n let go = new globalThis.Go();\n go.argv = ["", `--service=${"0.16.17"}`];\n tryToInstantiateModule(wasm, go).then(\n (instance) => {\n postMessage(null);\n go.run(instance);\n },\n (error) => {\n postMessage(error);\n }\n );\n };\n function tryToInstantiateModule(wasm, go) {\n return __async(this, null, function* () {\n if (wasm instanceof WebAssembly.Module) {\n return WebAssembly.instantiate(wasm, go.importObject);\n }\n const res = yield fetch(wasm);\n if (!res.ok)\n throw new Error(`Failed to download ${JSON.stringify(wasm)}`);\n if ("instantiateStreaming" in WebAssembly && /^application\\/wasm($|;)/i.test(res.headers.get("Content-Type") || "")) {\n const result2 = yield WebAssembly.instantiateStreaming(res, go.importObject);\n return result2.instance;\n }\n const bytes = yield res.arrayBuffer();\n const result = yield WebAssembly.instantiate(bytes, go.importObject);\n return result.instance;\n });\n }\n return (m) => onmessage(m);\n })'}(postMessage)`], { type: "text/javascript" });
1756
1760
  worker = new Worker(URL.createObjectURL(blob));
1757
1761
  } else {
1758
1762
  let onmessage = ((postMessage) => {
@@ -1796,6 +1800,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
1796
1800
  let outputBuf = "";
1797
1801
  globalThis.fs = {
1798
1802
  constants: { O_WRONLY: -1, O_RDWR: -1, O_CREAT: -1, O_TRUNC: -1, O_APPEND: -1, O_EXCL: -1 },
1803
+ // unused
1799
1804
  writeSync(fd, buf) {
1800
1805
  outputBuf += decoder.decode(buf);
1801
1806
  const nl = outputBuf.lastIndexOf("\n");
@@ -2031,6 +2036,11 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2031
2036
  const timeOrigin = Date.now() - performance.now();
2032
2037
  this.importObject = {
2033
2038
  go: {
2039
+ // Go's SP does not change as long as no Go code is running. Some operations (e.g. calls, getters and setters)
2040
+ // may synchronously trigger a Go event handler. This makes Go code get executed in the middle of the imported
2041
+ // function. A goroutine can switch to a new stack if the current stack is too small (see morestack function).
2042
+ // This changes the SP, thus we have to update the SP used by the imported function.
2043
+ // func wasmExit(code int32)
2034
2044
  "runtime.wasmExit": (sp) => {
2035
2045
  sp >>>= 0;
2036
2046
  const code = this.mem.getInt32(sp + 8, true);
@@ -2042,6 +2052,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2042
2052
  delete this._idPool;
2043
2053
  this.exit(code);
2044
2054
  },
2055
+ // func wasmWrite(fd uintptr, p unsafe.Pointer, n int32)
2045
2056
  "runtime.wasmWrite": (sp) => {
2046
2057
  sp >>>= 0;
2047
2058
  const fd = getInt64(sp + 8);
@@ -2049,20 +2060,24 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2049
2060
  const n = this.mem.getInt32(sp + 24, true);
2050
2061
  globalThis.fs.writeSync(fd, new Uint8Array(this._inst.exports.mem.buffer, p, n));
2051
2062
  },
2063
+ // func resetMemoryDataView()
2052
2064
  "runtime.resetMemoryDataView": (sp) => {
2053
2065
  sp >>>= 0;
2054
2066
  this.mem = new DataView(this._inst.exports.mem.buffer);
2055
2067
  },
2068
+ // func nanotime1() int64
2056
2069
  "runtime.nanotime1": (sp) => {
2057
2070
  sp >>>= 0;
2058
2071
  setInt64(sp + 8, (timeOrigin + performance.now()) * 1e6);
2059
2072
  },
2073
+ // func walltime() (sec int64, nsec int32)
2060
2074
  "runtime.walltime": (sp) => {
2061
2075
  sp >>>= 0;
2062
2076
  const msec = new Date().getTime();
2063
2077
  setInt64(sp + 8, msec / 1e3);
2064
2078
  this.mem.setInt32(sp + 16, msec % 1e3 * 1e6, true);
2065
2079
  },
2080
+ // func scheduleTimeoutEvent(delay int64) int32
2066
2081
  "runtime.scheduleTimeoutEvent": (sp) => {
2067
2082
  sp >>>= 0;
2068
2083
  const id = this._nextCallbackTimeoutID;
@@ -2076,19 +2091,23 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2076
2091
  }
2077
2092
  },
2078
2093
  getInt64(sp + 8) + 1
2094
+ // setTimeout has been seen to fire up to 1 millisecond early
2079
2095
  ));
2080
2096
  this.mem.setInt32(sp + 16, id, true);
2081
2097
  },
2098
+ // func clearTimeoutEvent(id int32)
2082
2099
  "runtime.clearTimeoutEvent": (sp) => {
2083
2100
  sp >>>= 0;
2084
2101
  const id = this.mem.getInt32(sp + 8, true);
2085
2102
  clearTimeout(this._scheduledTimeouts.get(id));
2086
2103
  this._scheduledTimeouts.delete(id);
2087
2104
  },
2105
+ // func getRandomData(r []byte)
2088
2106
  "runtime.getRandomData": (sp) => {
2089
2107
  sp >>>= 0;
2090
2108
  crypto.getRandomValues(loadSlice(sp + 8));
2091
2109
  },
2110
+ // func finalizeRef(v ref)
2092
2111
  "syscall/js.finalizeRef": (sp) => {
2093
2112
  sp >>>= 0;
2094
2113
  const id = this.mem.getUint32(sp + 8, true);
@@ -2100,32 +2119,39 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2100
2119
  this._idPool.push(id);
2101
2120
  }
2102
2121
  },
2122
+ // func stringVal(value string) ref
2103
2123
  "syscall/js.stringVal": (sp) => {
2104
2124
  sp >>>= 0;
2105
2125
  storeValue(sp + 24, loadString(sp + 8));
2106
2126
  },
2127
+ // func valueGet(v ref, p string) ref
2107
2128
  "syscall/js.valueGet": (sp) => {
2108
2129
  sp >>>= 0;
2109
2130
  const result = Reflect.get(loadValue(sp + 8), loadString(sp + 16));
2110
2131
  sp = this._inst.exports.getsp() >>> 0;
2111
2132
  storeValue(sp + 32, result);
2112
2133
  },
2134
+ // func valueSet(v ref, p string, x ref)
2113
2135
  "syscall/js.valueSet": (sp) => {
2114
2136
  sp >>>= 0;
2115
2137
  Reflect.set(loadValue(sp + 8), loadString(sp + 16), loadValue(sp + 32));
2116
2138
  },
2139
+ // func valueDelete(v ref, p string)
2117
2140
  "syscall/js.valueDelete": (sp) => {
2118
2141
  sp >>>= 0;
2119
2142
  Reflect.deleteProperty(loadValue(sp + 8), loadString(sp + 16));
2120
2143
  },
2144
+ // func valueIndex(v ref, i int) ref
2121
2145
  "syscall/js.valueIndex": (sp) => {
2122
2146
  sp >>>= 0;
2123
2147
  storeValue(sp + 24, Reflect.get(loadValue(sp + 8), getInt64(sp + 16)));
2124
2148
  },
2149
+ // valueSetIndex(v ref, i int, x ref)
2125
2150
  "syscall/js.valueSetIndex": (sp) => {
2126
2151
  sp >>>= 0;
2127
2152
  Reflect.set(loadValue(sp + 8), getInt64(sp + 16), loadValue(sp + 24));
2128
2153
  },
2154
+ // func valueCall(v ref, m string, args []ref) (ref, bool)
2129
2155
  "syscall/js.valueCall": (sp) => {
2130
2156
  sp >>>= 0;
2131
2157
  try {
@@ -2142,6 +2168,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2142
2168
  this.mem.setUint8(sp + 64, 0);
2143
2169
  }
2144
2170
  },
2171
+ // func valueInvoke(v ref, args []ref) (ref, bool)
2145
2172
  "syscall/js.valueInvoke": (sp) => {
2146
2173
  sp >>>= 0;
2147
2174
  try {
@@ -2157,6 +2184,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2157
2184
  this.mem.setUint8(sp + 48, 0);
2158
2185
  }
2159
2186
  },
2187
+ // func valueNew(v ref, args []ref) (ref, bool)
2160
2188
  "syscall/js.valueNew": (sp) => {
2161
2189
  sp >>>= 0;
2162
2190
  try {
@@ -2172,25 +2200,30 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2172
2200
  this.mem.setUint8(sp + 48, 0);
2173
2201
  }
2174
2202
  },
2203
+ // func valueLength(v ref) int
2175
2204
  "syscall/js.valueLength": (sp) => {
2176
2205
  sp >>>= 0;
2177
2206
  setInt64(sp + 16, parseInt(loadValue(sp + 8).length));
2178
2207
  },
2208
+ // valuePrepareString(v ref) (ref, int)
2179
2209
  "syscall/js.valuePrepareString": (sp) => {
2180
2210
  sp >>>= 0;
2181
2211
  const str = encoder.encode(String(loadValue(sp + 8)));
2182
2212
  storeValue(sp + 16, str);
2183
2213
  setInt64(sp + 24, str.length);
2184
2214
  },
2215
+ // valueLoadString(v ref, b []byte)
2185
2216
  "syscall/js.valueLoadString": (sp) => {
2186
2217
  sp >>>= 0;
2187
2218
  const str = loadValue(sp + 8);
2188
2219
  loadSlice(sp + 16).set(str);
2189
2220
  },
2221
+ // func valueInstanceOf(v ref, t ref) bool
2190
2222
  "syscall/js.valueInstanceOf": (sp) => {
2191
2223
  sp >>>= 0;
2192
2224
  this.mem.setUint8(sp + 24, loadValue(sp + 8) instanceof loadValue(sp + 16) ? 1 : 0);
2193
2225
  },
2226
+ // func copyBytesToGo(dst []byte, src ref) (int, bool)
2194
2227
  "syscall/js.copyBytesToGo": (sp) => {
2195
2228
  sp >>>= 0;
2196
2229
  const dst = loadSlice(sp + 8);
@@ -2204,6 +2237,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2204
2237
  setInt64(sp + 40, toCopy.length);
2205
2238
  this.mem.setUint8(sp + 48, 1);
2206
2239
  },
2240
+ // func copyBytesToJS(dst ref, src []byte) (int, bool)
2207
2241
  "syscall/js.copyBytesToJS": (sp) => {
2208
2242
  sp >>>= 0;
2209
2243
  const dst = loadValue(sp + 8);
@@ -2231,6 +2265,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2231
2265
  this._inst = instance;
2232
2266
  this.mem = new DataView(this._inst.exports.mem.buffer);
2233
2267
  this._values = [
2268
+ // JS values that Go currently has references to, indexed by reference id
2234
2269
  NaN,
2235
2270
  0,
2236
2271
  null,
@@ -2241,6 +2276,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2241
2276
  ];
2242
2277
  this._goRefCounts = new Array(this._values.length).fill(Infinity);
2243
2278
  this._ids = /* @__PURE__ */ new Map([
2279
+ // mapping from JS values to reference ids
2244
2280
  [0, 1],
2245
2281
  [null, 2],
2246
2282
  [true, 3],
@@ -2356,7 +2392,7 @@ var startRunningService = (wasmURL, wasmModule, useWorker) => __async(void 0, nu
2356
2392
  callback(null, count);
2357
2393
  };
2358
2394
  let go = new globalThis.Go();
2359
- go.argv = ["", `--service=${"0.16.10"}`];
2395
+ go.argv = ["", `--service=${"0.16.17"}`];
2360
2396
  tryToInstantiateModule(wasm, go).then(
2361
2397
  (instance) => {
2362
2398
  postMessage(null);