@stryke/capnp 0.12.41 → 0.12.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/capnpc.cjs +224 -7
- package/bin/capnpc.mjs +219 -9
- package/bin/capnpc.mjs.map +1 -1
- package/dist/capnp-es.GpvEvMIK-BsgDzeBH.mjs +12 -0
- package/dist/capnp-es.GpvEvMIK-BsgDzeBH.mjs.map +1 -0
- package/dist/capnp-es.GpvEvMIK-xNDcbmgx.cjs +11 -0
- package/dist/compile-ChbJ-p6B.cjs +169 -0
- package/dist/compile-DJUj4hs3.mjs +163 -0
- package/dist/compile-DJUj4hs3.mjs.map +1 -0
- package/dist/{compile-DN7i0G3X.d.mts → compile-UkKIpqrK.d.mts} +2 -2
- package/dist/{compile-DN7i0G3X.d.mts.map → compile-UkKIpqrK.d.mts.map} +1 -1
- package/dist/compile.cjs +1 -1
- package/dist/compile.d.mts +2 -2
- package/dist/compile.mjs +1 -1
- package/dist/dist-C1gSYYrg.cjs +1 -0
- package/dist/dist-CK47iMja.mjs +2 -0
- package/dist/dist-CK47iMja.mjs.map +1 -0
- package/dist/helpers-BoKbpcuO.mjs +27 -0
- package/dist/helpers-BoKbpcuO.mjs.map +1 -0
- package/dist/helpers-DSMRKdw1.cjs +26 -0
- package/dist/helpers.cjs +1 -1
- package/dist/helpers.d.mts +1 -1
- package/dist/helpers.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/rpc.cjs +1 -1
- package/dist/rpc.mjs +1 -1
- package/dist/rpc.mjs.map +1 -1
- package/dist/types-BujoAx-K.mjs +2 -0
- package/dist/{types-y_yfxLs5.mjs.map → types-BujoAx-K.mjs.map} +1 -1
- package/dist/{types-DBd3Wi0H.d.mts → types-D03SjfBL.d.mts} +1 -1
- package/dist/{types-DBd3Wi0H.d.mts.map → types-D03SjfBL.d.mts.map} +1 -1
- package/dist/types.cjs +1 -1
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +1 -1
- package/package.json +5 -5
- package/schemas/{index-CDymg4xL.d.mts → index-BAJMwFip.d.mts} +2 -2
- package/schemas/{index-CDymg4xL.d.mts.map → index-BAJMwFip.d.mts.map} +1 -1
- package/schemas/persistent.cjs +1 -1
- package/schemas/persistent.d.mts +1 -1
- package/schemas/persistent.mjs +1 -1
- package/schemas/rpc-twoparty.cjs +1 -1
- package/schemas/rpc-twoparty.d.mts +1 -1
- package/schemas/rpc-twoparty.mjs +1 -1
- package/schemas/rpc-twoparty.mjs.map +1 -1
- package/schemas/rpc.cjs +1 -1
- package/schemas/rpc.d.mts +1 -1
- package/schemas/rpc.mjs +1 -1
- package/schemas/schema.cjs +1 -1
- package/schemas/schema.d.mts +1 -1
- package/schemas/schema.mjs +1 -1
- package/schemas/src-CGrmR2BO.cjs +11 -0
- package/schemas/src-DqIy7I3p.mjs +12 -0
- package/schemas/src-DqIy7I3p.mjs.map +1 -0
- package/dist/compile-DOMgXQRn.cjs +0 -1
- package/dist/compile-cQ918Wl_.mjs +0 -2
- package/dist/compile-cQ918Wl_.mjs.map +0 -1
- package/dist/dist-BzGdCkHS.cjs +0 -1
- package/dist/dist-CvDcvswe.mjs +0 -2
- package/dist/dist-CvDcvswe.mjs.map +0 -1
- package/dist/helpers-BIiGufva.cjs +0 -6
- package/dist/helpers-BYBeqv2d.mjs +0 -7
- package/dist/helpers-BYBeqv2d.mjs.map +0 -1
- package/dist/types-y_yfxLs5.mjs +0 -2
- package/schemas/src-CtkguuVd.mjs +0 -7
- package/schemas/src-CtkguuVd.mjs.map +0 -1
- package/schemas/src-DqnIPdOg.cjs +0 -6
- /package/dist/{types-B2gKzfwi.cjs → types-D6FuBB1k.cjs} +0 -0
package/bin/capnpc.mjs
CHANGED
|
@@ -1,11 +1,221 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{writeFatal as e,writeInfo as t,writeSuccess as n,writeWarning as r}from"@storm-software/config-tools/logger/console";import{exitWithError as i,exitWithSuccess as a,findWorkspaceRootSafe as o,handleProcess as s}from"@storm-software/config-tools/utilities";import{existsSync as c}from"node:fs";import{readFile as l,writeFile as u}from"node:fs/promises";import{Command as d}from"commander";import{compileAll as f}from"capnp-es/compiler";import p from"defu";import{Buffer as m}from"node:buffer";import{exec as h}from"node:child_process";import{parse as g,printParseErrorCode as _}from"jsonc-parser";import ee from"superjson";import{LinesAndColumns as te}from"lines-and-columns";import"nanotar";import{glob as ne}from"glob";import{parseJsonConfigFileContent as v,sys as y}from"typescript";function b(e){return c(e)}const x=e=>e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e),S=e=>typeof e==`object`&&!!e,C=e=>{if(!S(e)||x(e)!==`[object Object]`)return!1;if(Object.getPrototypeOf(e)===null)return!0;let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t},w=e=>{try{return e===null}catch{return!1}},re=e=>{try{return e instanceof Number||typeof e==`number`||Number(e)===e}catch{return!1}},T=e=>e===void 0,ie=e=>{try{return T(e)||w(e)}catch{return!1}},ae=e=>{try{return!ie(e)}catch{return!1}},E=e=>{try{return typeof e==`string`}catch{return!1}},oe=e=>{try{return ae(e)&&E(e)&&e.length>0}catch{return!1}};function se(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const D=/^[A-Z]:\//i,ce=/^[A-Z]:$/i,O=/^[/\\]{2}/,k=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i,A=/^\/([A-Z]:)?$/i,j=/\.[0-9a-z]+$/i;function M(e){return k.test(P(e))}function N(e){return M(e)}function P(e){return e.startsWith(`\\\\?\\`)?e:e.replace(/\\/g,`/`)}function F(e=``){return e&&e.replace(/\\/g,`/`).replace(D,e=>e.toUpperCase())}function I(e){if(!e||e.length===0)return`.`;e=F(e);let t=e.match(O),n=N(e),r=e[e.length-1]===`/`;return e=R(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),ce.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!N(e)?`/${e}`:e)}function L(...e){let t=``;for(let n of e)if(n)if(t.length>0){let e=t[t.length-1]===`/`,r=n[0]===`/`;e&&r?t+=n.slice(1):t+=e||r?n:`/${n}`}else t+=n;return I(t)}function R(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function z(e=``){return e&&P(e).replace(D,e=>e.toUpperCase())}function B(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}function V(e,t={}){let{requireExtension:n=!1,withExtension:r=!0}=t,i=z(e)?.split(e?.includes(`\\`)?`\\`:`/`)?.pop()??``;return n===!0&&!i.includes(`.`)?``:r===!1&&i.includes(`.`)?i.replace(`.${U(i)??``}`,``)||``:i}function H(e,t={}){let n=z(e),r=n.replace(V(n,{requireExtension:!1,...t}),``);return r===`/`?r:r.replace(/\/$/,``)}function U(e){if(e.endsWith(`.`)||e.endsWith(`/`))return;let t=j.exec(z(e));return t&&t.length>0&&oe(t[0])?t[0].replace(`.`,``):void 0}function W(...e){e=e.map(e=>z(e));let t=``,n=!1;for(let r=e.length-1;r>=-1&&!n;r--){let i=r>=0?e[r]:se();!i||i.length===0||(t=`${i}/${t}`,n=N(i))}return t=B(t,!n),n&&!N(t)?`/${t}`:t.length>0?t:`.`}function G(e,t){let n=W(e).replace(A,`$1`).split(`/`),r=W(t).replace(A,`$1`).split(`/`);if(r[0][1]===`:`&&n[0][1]===`:`&&n[0]!==r[0])return r.join(`/`);let i=[...n];for(let e of i){if(r[0]!==e)break;n.shift(),r.shift()}return[...n.map(()=>`..`),...r].join(`/`)}function le(e,t,n=!1){return G(n===!0?e:e.replace(/\/$/,``),n===!0?t:t.replace(/\/$/,``))}function ue(e){return e??=[],Array.isArray(e)?e:[e]}const K=e=>{try{return typeof e==`object`||!!e&&e?.constructor===Object||C(e)}catch{return!1}},q=Symbol(`singleComment`),J=Symbol(`multiComment`);function de(){return``}function fe(e,t,n){return e.slice(t,n).replace(/\S/g,` `)}function pe(e,t){let n=t-1,r=0;for(;e[n]===`\\`;)--n,r+=1;return!!(r%2)}function me(e,{whitespace:t=!0,trailingCommas:n=!1}={}){if(typeof e!=`string`)throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof e}\``);let r=t?fe:de,i=!1,a=!1,o=0,s=``,c=``,l=-1;for(let t=0;t<e.length;t++){let u=e[t],d=e[t+1];!a&&u===`"`&&(pe(e,t)||(i=!i)),!i&&(!a&&u+(d??``)===`//`?(s+=e.slice(o,t),o=t,a=q,t++):a===q&&u+(d??``)===`\r
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
`,
|
|
7
|
-
`)
|
|
8
|
-
${
|
|
9
|
-
|
|
10
|
-
|
|
2
|
+
import{createRequire as e}from"node:module";import{exec as t}from"node:child_process";import{existsSync as n}from"node:fs";import{join as r}from"node:path";import{writeFile as i}from"node:fs/promises";import{existsSync as a}from"@stryke/fs/exists";import{findFilePath as o,relativePath as s}from"@stryke/path/file-path-fns";import{joinPaths as c}from"@stryke/path/join-paths";import l,{parseJsonConfigFileContent as u,sys as d}from"typescript";import"defu";import{Buffer as f}from"node:buffer";import{readJsonFile as p}from"@stryke/fs/json";import{listFiles as m}from"@stryke/fs/list-files";var ee=Object.create,h=Object.defineProperty,te=Object.getOwnPropertyDescriptor,ne=Object.getOwnPropertyNames,re=Object.getPrototypeOf,ie=Object.prototype.hasOwnProperty,g=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),ae=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ne(t),a=0,o=i.length,s;a<o;a++)s=i[a],!ie.call(e,s)&&s!==n&&h(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=te(t,s))||r.enumerable});return e},oe=(e,t,n)=>(n=e==null?{}:ee(re(e)),ae(t||!e||!e.__esModule?h(n,`default`,{value:e,enumerable:!0}):n,e)),se=e(import.meta.url),ce={light:{background:`#fafafa`,foreground:`#1d1e22`,brand:`#1fb2a6`,alternate:`#db2777`,help:`#5C4EE5`,success:`#087f5b`,info:`#0550ae`,warning:`#e3b341`,danger:`#D8314A`,fatal:`#51070f`,link:`#3fa6ff`,positive:`#22c55e`,negative:`#dc2626`,gradient:[`#1fb2a6`,`#db2777`,`#5C4EE5`]},dark:{background:`#1d1e22`,foreground:`#cbd5e1`,brand:`#2dd4bf`,alternate:`#db2777`,help:`#818cf8`,success:`#10b981`,info:`#58a6ff`,warning:`#f3d371`,danger:`#D8314A`,fatal:`#a40e26`,link:`#3fa6ff`,positive:`#22c55e`,negative:`#dc2626`,gradient:[`#1fb2a6`,`#db2777`,`#818cf8`]}},le=g(((e,t)=>{t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}})),ue=g(((e,t)=>{let n=le(),r={};for(let e of Object.keys(n))r[n[e]]=e;let i={rgb:{channels:3,labels:`rgb`},hsl:{channels:3,labels:`hsl`},hsv:{channels:3,labels:`hsv`},hwb:{channels:3,labels:`hwb`},cmyk:{channels:4,labels:`cmyk`},xyz:{channels:3,labels:`xyz`},lab:{channels:3,labels:`lab`},lch:{channels:3,labels:`lch`},hex:{channels:1,labels:[`hex`]},keyword:{channels:1,labels:[`keyword`]},ansi16:{channels:1,labels:[`ansi16`]},ansi256:{channels:1,labels:[`ansi256`]},hcg:{channels:3,labels:[`h`,`c`,`g`]},apple:{channels:3,labels:[`r16`,`g16`,`b16`]},gray:{channels:1,labels:[`gray`]}};t.exports=i;for(let e of Object.keys(i)){if(!(`channels`in i[e]))throw Error(`missing channels property: `+e);if(!(`labels`in i[e]))throw Error(`missing channel labels property: `+e);if(i[e].labels.length!==i[e].channels)throw Error(`channel and label counts mismatch: `+e);let{channels:t,labels:n}=i[e];delete i[e].channels,delete i[e].labels,Object.defineProperty(i[e],`channels`,{value:t}),Object.defineProperty(i[e],`labels`,{value:n})}i.rgb.hsl=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=a-i,s,c;a===i?s=0:t===a?s=(n-r)/o:n===a?s=2+(r-t)/o:r===a&&(s=4+(t-n)/o),s=Math.min(s*60,360),s<0&&(s+=360);let l=(i+a)/2;return c=a===i?0:l<=.5?o/(a+i):o/(2-a-i),[s,c*100,l*100]},i.rgb.hsv=function(e){let t,n,r,i,a,o=e[0]/255,s=e[1]/255,c=e[2]/255,l=Math.max(o,s,c),u=l-Math.min(o,s,c),d=function(e){return(l-e)/6/u+1/2};return u===0?(i=0,a=0):(a=u/l,t=d(o),n=d(s),r=d(c),o===l?i=r-n:s===l?i=1/3+t-r:c===l&&(i=2/3+n-t),i<0?i+=1:i>1&&--i),[i*360,a*100,l*100]},i.rgb.hwb=function(e){let t=e[0],n=e[1],r=e[2],a=i.rgb.hsl(e)[0],o=1/255*Math.min(t,Math.min(n,r));return r=1-1/255*Math.max(t,Math.max(n,r)),[a,o*100,r*100]},i.rgb.cmyk=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.min(1-t,1-n,1-r),a=(1-t-i)/(1-i)||0,o=(1-n-i)/(1-i)||0,s=(1-r-i)/(1-i)||0;return[a*100,o*100,s*100,i*100]};function a(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}i.rgb.keyword=function(e){let t=r[e];if(t)return t;let i=1/0,o;for(let t of Object.keys(n)){let r=n[t],s=a(e,r);s<i&&(i=s,o=t)}return o},i.keyword.rgb=function(e){return n[e]},i.rgb.xyz=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92,r=r>.04045?((r+.055)/1.055)**2.4:r/12.92;let i=t*.4124+n*.3576+r*.1805,a=t*.2126+n*.7152+r*.0722,o=t*.0193+n*.1192+r*.9505;return[i*100,a*100,o*100]},i.rgb.lab=function(e){let t=i.rgb.xyz(e),n=t[0],r=t[1],a=t[2];return n/=95.047,r/=100,a/=108.883,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,a=a>.008856?a**(1/3):7.787*a+16/116,[116*r-16,500*(n-r),200*(r-a)]},i.hsl.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i,a,o;if(n===0)return o=r*255,[o,o,o];i=r<.5?r*(1+n):r+n-r*n;let s=2*r-i,c=[0,0,0];for(let e=0;e<3;e++)a=t+1/3*-(e-1),a<0&&a++,a>1&&a--,o=6*a<1?s+(i-s)*6*a:2*a<1?i:3*a<2?s+(i-s)*(2/3-a)*6:s,c[e]=o*255;return c},i.hsl.hsv=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=n,a=Math.max(r,.01);r*=2,n*=r<=1?r:2-r,i*=a<=1?a:2-a;let o=(r+n)/2;return[t,(r===0?2*i/(a+i):2*n/(r+n))*100,o*100]},i.hsv.rgb=function(e){let t=e[0]/60,n=e[1]/100,r=e[2]/100,i=Math.floor(t)%6,a=t-Math.floor(t),o=255*r*(1-n),s=255*r*(1-n*a),c=255*r*(1-n*(1-a));switch(r*=255,i){case 0:return[r,c,o];case 1:return[s,r,o];case 2:return[o,r,c];case 3:return[o,s,r];case 4:return[c,o,r];case 5:return[r,o,s]}},i.hsv.hsl=function(e){let t=e[0],n=e[1]/100,r=e[2]/100,i=Math.max(r,.01),a,o;o=(2-n)*r;let s=(2-n)*i;return a=n*i,a/=s<=1?s:2-s,a||=0,o/=2,[t,a*100,o*100]},i.hwb.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100,i=n+r,a;i>1&&(n/=i,r/=i);let o=Math.floor(6*t),s=1-r;a=6*t-o,o&1&&(a=1-a);let c=n+a*(s-n),l,u,d;switch(o){default:case 6:case 0:l=s,u=c,d=n;break;case 1:l=c,u=s,d=n;break;case 2:l=n,u=s,d=c;break;case 3:l=n,u=c,d=s;break;case 4:l=c,u=n,d=s;break;case 5:l=s,u=n,d=c;break}return[l*255,u*255,d*255]},i.cmyk.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i=e[3]/100,a=1-Math.min(1,t*(1-i)+i),o=1-Math.min(1,n*(1-i)+i),s=1-Math.min(1,r*(1-i)+i);return[a*255,o*255,s*255]},i.xyz.rgb=function(e){let t=e[0]/100,n=e[1]/100,r=e[2]/100,i,a,o;return i=t*3.2406+n*-1.5372+r*-.4986,a=t*-.9689+n*1.8758+r*.0415,o=t*.0557+n*-.204+r*1.057,i=i>.0031308?1.055*i**(1/2.4)-.055:i*12.92,a=a>.0031308?1.055*a**(1/2.4)-.055:a*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,i=Math.min(Math.max(0,i),1),a=Math.min(Math.max(0,a),1),o=Math.min(Math.max(0,o),1),[i*255,a*255,o*255]},i.xyz.lab=function(e){let t=e[0],n=e[1],r=e[2];return t/=95.047,n/=100,r/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,r=r>.008856?r**(1/3):7.787*r+16/116,[116*n-16,500*(t-n),200*(n-r)]},i.lab.xyz=function(e){let t=e[0],n=e[1],r=e[2],i,a,o;a=(t+16)/116,i=n/500+a,o=a-r/200;let s=a**3,c=i**3,l=o**3;return a=s>.008856?s:(a-16/116)/7.787,i=c>.008856?c:(i-16/116)/7.787,o=l>.008856?l:(o-16/116)/7.787,i*=95.047,a*=100,o*=108.883,[i,a,o]},i.lab.lch=function(e){let t=e[0],n=e[1],r=e[2],i;return i=Math.atan2(r,n)*360/2/Math.PI,i<0&&(i+=360),[t,Math.sqrt(n*n+r*r),i]},i.lch.lab=function(e){let t=e[0],n=e[1],r=e[2]/360*2*Math.PI;return[t,n*Math.cos(r),n*Math.sin(r)]},i.rgb.ansi16=function(e,t=null){let[n,r,a]=e,o=t===null?i.rgb.hsv(e)[2]:t;if(o=Math.round(o/50),o===0)return 30;let s=30+(Math.round(a/255)<<2|Math.round(r/255)<<1|Math.round(n/255));return o===2&&(s+=60),s},i.hsv.ansi16=function(e){return i.rgb.ansi16(i.hsv.rgb(e),e[2])},i.rgb.ansi256=function(e){let t=e[0],n=e[1],r=e[2];return t===n&&n===r?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(r/255*5)},i.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let n=(~~(e>50)+1)*.5;return[(t&1)*n*255,(t>>1&1)*n*255,(t>>2&1)*n*255]},i.ansi256.rgb=function(e){if(e>=232){let t=(e-232)*10+8;return[t,t,t]}e-=16;let t;return[Math.floor(e/36)/5*255,Math.floor((t=e%36)/6)/5*255,t%6/5*255]},i.rgb.hex=function(e){let t=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return`000000`.substring(t.length)+t},i.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let n=t[0];t[0].length===3&&(n=n.split(``).map(e=>e+e).join(``));let r=parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},i.rgb.hcg=function(e){let t=e[0]/255,n=e[1]/255,r=e[2]/255,i=Math.max(Math.max(t,n),r),a=Math.min(Math.min(t,n),r),o=i-a,s,c;return s=o<1?a/(1-o):0,c=o<=0?0:i===t?(n-r)/o%6:i===n?2+(r-t)/o:4+(t-n)/o,c/=6,c%=1,[c*360,o*100,s*100]},i.hsl.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=n<.5?2*t*n:2*t*(1-n),i=0;return r<1&&(i=(n-.5*r)/(1-r)),[e[0],r*100,i*100]},i.hsv.hcg=function(e){let t=e[1]/100,n=e[2]/100,r=t*n,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},i.hcg.rgb=function(e){let t=e[0]/360,n=e[1]/100,r=e[2]/100;if(n===0)return[r*255,r*255,r*255];let i=[0,0,0],a=t%1*6,o=a%1,s=1-o,c=0;switch(Math.floor(a)){case 0:i[0]=1,i[1]=o,i[2]=0;break;case 1:i[0]=s,i[1]=1,i[2]=0;break;case 2:i[0]=0,i[1]=1,i[2]=o;break;case 3:i[0]=0,i[1]=s,i[2]=1;break;case 4:i[0]=o,i[1]=0,i[2]=1;break;default:i[0]=1,i[1]=0,i[2]=s}return c=(1-n)*r,[(n*i[0]+c)*255,(n*i[1]+c)*255,(n*i[2]+c)*255]},i.hcg.hsv=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t),r=0;return n>0&&(r=t/n),[e[0],r*100,n*100]},i.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,r=0;return n>0&&n<.5?r=t/(2*n):n>=.5&&n<1&&(r=t/(2*(1-n))),[e[0],r*100,n*100]},i.hcg.hwb=function(e){let t=e[1]/100,n=t+e[2]/100*(1-t);return[e[0],(n-t)*100,(1-n)*100]},i.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,r=n-t,i=0;return r<1&&(i=(n-r)/(1-r)),[e[0],r*100,i*100]},i.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]},i.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]},i.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]},i.gray.hsl=function(e){return[0,0,e[0]]},i.gray.hsv=i.gray.hsl,i.gray.hwb=function(e){return[0,100,e[0]]},i.gray.cmyk=function(e){return[0,0,0,e[0]]},i.gray.lab=function(e){return[e[0],0,0]},i.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return`000000`.substring(n.length)+n},i.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}})),de=g(((e,t)=>{let n=ue();function r(){let e={},t=Object.keys(n);for(let n=t.length,r=0;r<n;r++)e[t[r]]={distance:-1,parent:null};return e}function i(e){let t=r(),i=[e];for(t[e].distance=0;i.length;){let e=i.pop(),r=Object.keys(n[e]);for(let n=r.length,a=0;a<n;a++){let n=r[a],o=t[n];o.distance===-1&&(o.distance=t[e].distance+1,o.parent=e,i.unshift(n))}}return t}function a(e,t){return function(n){return t(e(n))}}function o(e,t){let r=[t[e].parent,e],i=n[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)r.unshift(t[o].parent),i=a(n[t[o].parent][o],i),o=t[o].parent;return i.conversion=r,i}t.exports=function(e){let t=i(e),n={},r=Object.keys(t);for(let e=r.length,i=0;i<e;i++){let e=r[i];t[e].parent!==null&&(n[e]=o(e,t))}return n}})),fe=g(((e,t)=>{let n=ue(),r=de(),i={},a=Object.keys(n);function o(e){let t=function(...t){let n=t[0];return n==null?n:(n.length>1&&(t=n),e(t))};return`conversion`in e&&(t.conversion=e.conversion),t}function s(e){let t=function(...t){let n=t[0];if(n==null)return n;n.length>1&&(t=n);let r=e(t);if(typeof r==`object`)for(let e=r.length,t=0;t<e;t++)r[t]=Math.round(r[t]);return r};return`conversion`in e&&(t.conversion=e.conversion),t}a.forEach(e=>{i[e]={},Object.defineProperty(i[e],`channels`,{value:n[e].channels}),Object.defineProperty(i[e],`labels`,{value:n[e].labels});let t=r(e);Object.keys(t).forEach(n=>{let r=t[n];i[e][n]=s(r),i[e][n].raw=o(r)})}),t.exports=i})),pe=g(((e,t)=>{let n=(e,t)=>(...n)=>`\u001B[${e(...n)+t}m`,r=(e,t)=>(...n)=>{let r=e(...n);return`\u001B[${38+t};5;${r}m`},i=(e,t)=>(...n)=>{let r=e(...n);return`\u001B[${38+t};2;${r[0]};${r[1]};${r[2]}m`},a=e=>e,o=(e,t,n)=>[e,t,n],s=(e,t,n)=>{Object.defineProperty(e,t,{get:()=>{let r=n();return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0}),r},enumerable:!0,configurable:!0})},c,l=(e,t,n,r)=>{c===void 0&&(c=fe());let i=r?10:0,a={};for(let[r,o]of Object.entries(c)){let s=r===`ansi16`?`ansi`:r;r===t?a[s]=e(n,i):typeof o==`object`&&(a[s]=e(o[t],i))}return a};function u(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[n,r]of Object.entries(t)){for(let[n,i]of Object.entries(r))t[n]={open:`\u001B[${i[0]}m`,close:`\u001B[${i[1]}m`},r[n]=t[n],e.set(i[0],i[1]);Object.defineProperty(t,n,{value:r,enumerable:!1})}return Object.defineProperty(t,`codes`,{value:e,enumerable:!1}),t.color.close=`\x1B[39m`,t.bgColor.close=`\x1B[49m`,s(t.color,`ansi`,()=>l(n,`ansi16`,a,!1)),s(t.color,`ansi256`,()=>l(r,`ansi256`,a,!1)),s(t.color,`ansi16m`,()=>l(i,`rgb`,o,!1)),s(t.bgColor,`ansi`,()=>l(n,`ansi16`,a,!0)),s(t.bgColor,`ansi256`,()=>l(r,`ansi256`,a,!0)),s(t.bgColor,`ansi16m`,()=>l(i,`rgb`,o,!0)),t}Object.defineProperty(t,`exports`,{enumerable:!0,get:u})})),me=g(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),he=g(((e,t)=>{let n=se(`node:os`),r=se(`node:tty`),i=me(),{env:a}=process,o;i(`no-color`)||i(`no-colors`)||i(`color=false`)||i(`color=never`)?o=0:(i(`color`)||i(`colors`)||i(`color=true`)||i(`color=always`))&&(o=1),`FORCE_COLOR`in a&&(o=a.FORCE_COLOR===`true`?1:a.FORCE_COLOR===`false`?0:a.FORCE_COLOR.length===0?1:Math.min(parseInt(a.FORCE_COLOR,10),3));function s(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function c(e,t){if(o===0)return 0;if(i(`color=16m`)||i(`color=full`)||i(`color=truecolor`))return 3;if(i(`color=256`))return 2;if(e&&!t&&o===void 0)return 0;let r=o||0;if(a.TERM===`dumb`)return r;if(process.platform===`win32`){let e=n.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in a)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in a)||a.CI_NAME===`codeship`?1:r;if(`TEAMCITY_VERSION`in a)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(a.TEAMCITY_VERSION)?1:0;if(a.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in a){let e=parseInt((a.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(a.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(a.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(a.TERM)||`COLORTERM`in a?1:r}function l(e){return s(c(e,e&&e.isTTY))}t.exports={supportsColor:l,stdout:s(c(!0,r.isatty(1))),stderr:s(c(!0,r.isatty(2)))}})),ge=g(((e,t)=>{t.exports={stringReplaceAll:(e,t,n)=>{let r=e.indexOf(t);if(r===-1)return e;let i=t.length,a=0,o=``;do o+=e.substr(a,r-a)+t+n,a=r+i,r=e.indexOf(t,a);while(r!==-1);return o+=e.substr(a),o},stringEncaseCRLFWithFirstIndex:(e,t,n,r)=>{let i=0,a=``;do{let o=e[r-1]===`\r`;a+=e.substr(i,(o?r-1:r)-i)+t+(o?`\r
|
|
3
|
+
`:`
|
|
4
|
+
`)+n,i=r+1,r=e.indexOf(`
|
|
5
|
+
`,i)}while(r!==-1);return a+=e.substr(i),a}}})),_e=g(((e,t)=>{let n=/(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi,r=/(?:^|\.)(\w+)(?:\(([^)]*)\))?/g,i=/^(['"])((?:\\.|(?!\1)[^\\])*)\1$/,a=/\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi,o=new Map([[`n`,`
|
|
6
|
+
`],[`r`,`\r`],[`t`,` `],[`b`,`\b`],[`f`,`\f`],[`v`,`\v`],[`0`,`\0`],[`\\`,`\\`],[`e`,`\x1B`],[`a`,`\x07`]]);function s(e){let t=e[0]===`u`,n=e[1]===`{`;return t&&!n&&e.length===5||e[0]===`x`&&e.length===3?String.fromCharCode(parseInt(e.slice(1),16)):t&&n?String.fromCodePoint(parseInt(e.slice(2,-1),16)):o.get(e)||e}function c(e,t){let n=[],r=t.trim().split(/\s*,\s*/g),o;for(let t of r){let r=Number(t);if(!Number.isNaN(r))n.push(r);else if(o=t.match(i))n.push(o[2].replace(a,(e,t,n)=>t?s(t):n));else throw Error(`Invalid Chalk template style argument: ${t} (in style '${e}')`)}return n}function l(e){r.lastIndex=0;let t=[],n;for(;(n=r.exec(e))!==null;){let e=n[1];if(n[2]){let r=c(e,n[2]);t.push([e].concat(r))}else t.push([e])}return t}function u(e,t){let n={};for(let e of t)for(let t of e.styles)n[t[0]]=e.inverse?null:t.slice(1);let r=e;for(let[e,t]of Object.entries(n))if(Array.isArray(t)){if(!(e in r))throw Error(`Unknown Chalk style: ${e}`);r=t.length>0?r[e](...t):r[e]}return r}t.exports=(e,t)=>{let r=[],i=[],a=[];if(t.replace(n,(t,n,o,c,d,f)=>{if(n)a.push(s(n));else if(c){let t=a.join(``);a=[],i.push(r.length===0?t:u(e,r)(t)),r.push({inverse:o,styles:l(c)})}else if(d){if(r.length===0)throw Error(`Found extraneous } in Chalk template literal`);i.push(u(e,r)(a.join(``))),a=[],r.pop()}else a.push(f)}),i.push(a.join(``)),r.length>0){let e=`Chalk template literal is missing ${r.length} closing bracket${r.length===1?``:`s`} (\`}\`)`;throw Error(e)}return i.join(``)}})),ve=oe(g(((e,t)=>{let n=pe(),{stdout:r,stderr:i}=he(),{stringReplaceAll:a,stringEncaseCRLFWithFirstIndex:o}=ge(),{isArray:s}=Array,c=[`ansi`,`ansi`,`ansi256`,`ansi16m`],l=Object.create(null),u=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let n=r?r.level:0;e.level=t.level===void 0?n:t.level};var d=class{constructor(e){return f(e)}};let f=e=>{let t={};return u(t,e),t.template=(...e)=>ie(t.template,...e),Object.setPrototypeOf(t,p.prototype),Object.setPrototypeOf(t.template,t),t.template.constructor=()=>{throw Error("`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.")},t.template.Instance=d,t.template};function p(e){return f(e)}for(let[e,t]of Object.entries(n))l[e]={get(){let n=te(this,h(t.open,t.close,this._styler),this._isEmpty);return Object.defineProperty(this,e,{value:n}),n}};l.visible={get(){let e=te(this,this._styler,!0);return Object.defineProperty(this,`visible`,{value:e}),e}};let m=[`rgb`,`hex`,`keyword`,`hsl`,`hsv`,`hwb`,`ansi`,`ansi256`];for(let e of m)l[e]={get(){let{level:t}=this;return function(...r){let i=h(n.color[c[t]][e](...r),n.color.close,this._styler);return te(this,i,this._isEmpty)}}};for(let e of m){let t=`bg`+e[0].toUpperCase()+e.slice(1);l[t]={get(){let{level:t}=this;return function(...r){let i=h(n.bgColor[c[t]][e](...r),n.bgColor.close,this._styler);return te(this,i,this._isEmpty)}}}}let ee=Object.defineProperties(()=>{},{...l,level:{enumerable:!0,get(){return this._generator.level},set(e){this._generator.level=e}}}),h=(e,t,n)=>{let r,i;return n===void 0?(r=e,i=t):(r=n.openAll+e,i=t+n.closeAll),{open:e,close:t,openAll:r,closeAll:i,parent:n}},te=(e,t,n)=>{let r=(...e)=>s(e[0])&&s(e[0].raw)?ne(r,ie(r,...e)):ne(r,e.length===1?``+e[0]:e.join(` `));return Object.setPrototypeOf(r,ee),r._generator=e,r._styler=t,r._isEmpty=n,r},ne=(e,t)=>{if(e.level<=0||!t)return e._isEmpty?``:t;let n=e._styler;if(n===void 0)return t;let{openAll:r,closeAll:i}=n;if(t.indexOf(`\x1B`)!==-1)for(;n!==void 0;)t=a(t,n.close,n.open),n=n.parent;let s=t.indexOf(`
|
|
7
|
+
`);return s!==-1&&(t=o(t,i,r,s)),r+t+i},re,ie=(e,...t)=>{let[n]=t;if(!s(n)||!s(n.raw))return t.join(` `);let r=t.slice(1),i=[n.raw[0]];for(let e=1;e<n.length;e++)i.push(String(r[e-1]).replace(/[{}\\]/g,`\\$&`),String(n.raw[e]));return re===void 0&&(re=_e()),re(e,i.join(``))};Object.defineProperties(p.prototype,l);let g=p();g.supportsColor=r,g.stderr=p({level:i?i.level:0}),g.stderr.supportsColor=i,t.exports=g}))(),1),ye={hex:e=>e=>e,bgHex:e=>({whiteBright:e=>e,white:e=>e}),white:e=>e,whiteBright:e=>e,gray:e=>e,bold:{hex:e=>e=>e,bgHex:e=>({whiteBright:e=>e,white:e=>e}),whiteBright:e=>e,white:e=>e},dim:{hex:e=>e=>e,gray:e=>e}},be=()=>{let e=ve.default;return(!e?.hex||!e?.bold?.hex||!e?.bgHex||!e?.whiteBright||!e?.white)&&(e=ye),e};function xe(){return process.platform===`win32`?!!process.env.WT_SESSION||!!process.env.TERMINUS_SUBLIME||process.env.ConEmuTask===`{cmd::Cmder}`||process.env.TERM_PROGRAM===`Terminus-Sublime`||process.env.TERM_PROGRAM===`vscode`||process.env.TERM===`xterm-256color`||process.env.TERM===`alacritty`||process.env.TERM===`rxvt-unicode`||process.env.TERM===`rxvt-unicode-256color`||process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:process.env.TERM!==`linux`}var _={SILENT:0,FATAL:10,ERROR:20,WARN:30,SUCCESS:35,INFO:40,DEBUG:60,TRACE:70,ALL:100},v={SILENT:`silent`,FATAL:`fatal`,ERROR:`error`,WARN:`warn`,SUCCESS:`success`,INFO:`info`,DEBUG:`debug`,TRACE:`trace`,ALL:`all`},Se=(e,t)=>xe()?e:t,Ce={[v.ERROR]:Se(`✘`,`×`),[v.FATAL]:Se(`💀`,`×`),[v.WARN]:Se(`⚠`,`‼`),[v.INFO]:Se(`ℹ`,`i`),[v.SUCCESS]:Se(`✔`,`√`),[v.DEBUG]:Se(`🛠`,`D`),[v.TRACE]:Se(`🛠`,`T`),[v.ALL]:Se(`✉`,`→`)},we=(e=new Date)=>`${e.toLocaleDateString()} ${e.toLocaleTimeString()}`,Te=e=>{switch(e){case`all`:return _.ALL;case`trace`:return _.TRACE;case`debug`:return _.DEBUG;case`info`:return _.INFO;case`warn`:return _.WARN;case`error`:return _.ERROR;case`fatal`:return _.FATAL;case`silent`:return _.SILENT;default:return _.INFO}},Ee=(e=_.INFO,t={},n=be())=>{let r=!t.colors?.dark&&!t.colors?.base&&!t.colors?.base?.dark?ce:t.colors?.dark&&typeof t.colors.dark==`string`?t.colors:t.colors?.base?.dark&&typeof t.colors.base.dark==`string`?t.colors.base.dark:t.colors?.base?t.colors?.base:ce,i=t.logLevel||process.env.STORM_LOG_LEVEL||v.INFO;return e>Te(i)||e<=_.SILENT||Te(i)<=_.SILENT?e=>{}:typeof e==`number`&&_.FATAL>=e?e=>{console.error(`
|
|
8
|
+
${n.gray(we())} ${n.hex(r.fatal??ce.dark.fatal)(`[${Ce[v.FATAL]} Fatal] `)}${n.bold.whiteBright(Pe(e))}
|
|
9
|
+
`)}:typeof e==`number`&&_.ERROR>=e?e=>{console.error(`
|
|
10
|
+
${n.gray(we())} ${n.hex(r.danger??ce.dark.danger)(`[${Ce[v.ERROR]} Error] `)}${n.bold.whiteBright(Pe(e))}
|
|
11
|
+
`)}:typeof e==`number`&&_.WARN>=e?e=>{console.warn(`
|
|
12
|
+
${n.gray(we())} ${n.hex(r.warning??ce.dark.warning)(`[${Ce[v.WARN]} Warn] `)}${n.bold.whiteBright(Pe(e))}
|
|
13
|
+
`)}:typeof e==`number`&&_.SUCCESS>=e?e=>{console.info(`
|
|
14
|
+
${n.gray(we())} ${n.hex(r.success??ce.dark.success)(`[${Ce[v.SUCCESS]} Success] `)}${n.bold.whiteBright(Pe(e))}
|
|
15
|
+
`)}:typeof e==`number`&&_.INFO>=e?e=>{console.info(`
|
|
16
|
+
${n.gray(we())} ${n.hex(r.info??ce.dark.info)(`[${Ce[v.INFO]} Info] `)}${n.bold.whiteBright(Pe(e))}
|
|
17
|
+
`)}:typeof e==`number`&&_.DEBUG>=e?e=>{console.debug(`
|
|
18
|
+
${n.gray(we())} ${n.hex(r.info??ce.dark.info)(`[${Ce[v.DEBUG]} Debug] `)}${n.bold.whiteBright(Pe(e))}
|
|
19
|
+
`)}:typeof e==`number`&&_.TRACE>=e?e=>{console.debug(`
|
|
20
|
+
${n.gray(we())} ${n.hex(r.info??ce.dark.info)(`[${Ce[v.TRACE]} Trace] `)}${n.bold.whiteBright(Pe(e))}
|
|
21
|
+
`)}:e=>{console.log(`
|
|
22
|
+
${n.gray(we())} ${n.hex(r.brand??ce.dark.brand)(`[${Ce[v.ALL]} System] `)}${n.bold.whiteBright(Pe(e))}
|
|
23
|
+
`)}},De=(e,t)=>Ee(_.FATAL,t)(e),Oe=(e,t)=>Ee(_.ERROR,t)(e),ke=(e,t)=>Ee(_.WARN,t)(e),Ae=(e,t)=>Ee(_.INFO,t)(e),je=(e,t)=>Ee(_.SUCCESS,t)(e),Me=(e,t)=>Ee(_.TRACE,t)(e),Ne=4,Pe=(e,t={},n=0)=>{if(n>Ne)return`<max depth>`;let r=t.prefix??`-`,i=t.skip??[];return e==null||!e&&typeof e!=`boolean`?`<none>`:typeof e==`string`?e:Array.isArray(e)?`
|
|
24
|
+
${e.map((e,t)=>` ${r}> #${t} = ${Pe(e,{prefix:`${r}-`,skip:i},n+1)}`).join(`
|
|
25
|
+
`)}`:typeof e==`object`?`
|
|
26
|
+
${Object.keys(e).filter(e=>!i.includes(e)).map(t=>` ${r}> ${t} = ${Fe(e[t])?`<function>`:typeof e[t]==`object`?Pe(e[t],{prefix:`${r}-`,skip:i},n+1):e[t]}`).join(`
|
|
27
|
+
`)}`:e},Fe=e=>{try{return e instanceof Function||typeof e==`function`||!!(e?.constructor&&e?.call&&e?.apply)}catch{return!1}},Ie=e=>{De(`Exiting script with an error status...`,e),process.exit(1)},Le=e=>{je(`Script completed successfully. Exiting...`,e),process.exit(0)},Re=e=>{Me(`Using the following arguments to process the script: ${process.argv.join(`, `)}`,e),process.on(`unhandledRejection`,t=>{Oe(`An Unhandled Rejection occurred while running the program: ${t}`,e),Ie(e)}),process.on(`uncaughtException`,t=>{Oe(`An Uncaught Exception occurred while running the program: ${t.message}
|
|
28
|
+
Stacktrace: ${t.stack}`,e),Ie(e)}),process.on(`SIGTERM`,t=>{Oe(`The program terminated with signal code: ${t}`,e),Ie(e)}),process.on(`SIGINT`,t=>{Oe(`The program terminated with signal code: ${t}`,e),Ie(e)}),process.on(`SIGHUP`,t=>{Oe(`The program terminated with signal code: ${t}`,e),Ie(e)})},ze=30,Be=0;function Ve(e,t=[],i=[]){let a=e??process.cwd();if(i.some(e=>n(r(a,e)))||t.some(e=>n(r(a,e))))return a;if(a!==`/`&&Be++<ze)return Ve(r(a,`..`),t,i)}var He=/^[A-Za-z]:\//;function Ue(e=``){return e&&e.replace(/\\/g,`/`).replace(He,e=>e.toUpperCase())}var We=/^[/\\]{2}/,Ge=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,Ke=/^[A-Za-z]:$/,qe=function(e){if(!e||e.length===0)return`.`;e=Ue(e);let t=e?.match(We),n=Ye(e),r=e[e.length-1]===`/`;return e=Je(e,!n),e.length===0?n?`/`:r?`./`:`.`:(r&&(e+=`/`),Ke.test(e)&&(e+=`/`),t?n?`//${e}`:`//./${e}`:n&&!Ye(e)?`/${e}`:e)};function Je(e,t){let n=``,r=0,i=-1,a=0,o=null;for(let s=0;s<=e.length;++s){if(s<e.length)o=e[s];else if(o===`/`)break;else o=`/`;if(o===`/`){if(!(i===s-1||a===1))if(a===2){if(n.length<2||r!==2||n[n.length-1]!==`.`||n[n.length-2]!==`.`){if(n.length>2){let e=n.lastIndexOf(`/`);e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}else if(n.length>0){n=``,r=0,i=s,a=0;continue}}t&&(n+=n.length>0?`/..`:`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1;i=s,a=0}else o===`.`&&a!==-1?++a:a=-1}return n}var Ye=function(e){return Ge.test(e)},Xe=`storm-workspace.json,storm-workspace.yaml,storm-workspace.yml,storm-workspace.js,storm-workspace.ts,.storm-workspace.json,.storm-workspace.yaml,.storm-workspace.yml,.storm-workspace.js,.storm-workspace.ts,lerna.json,nx.json,turbo.json,npm-workspace.json,yarn-workspace.json,pnpm-workspace.json,npm-workspace.yaml,yarn-workspace.yaml,pnpm-workspace.yaml,npm-workspace.yml,yarn-workspace.yml,pnpm-workspace.yml,npm-lock.json,yarn-lock.json,pnpm-lock.json,npm-lock.yaml,yarn-lock.yaml,pnpm-lock.yaml,npm-lock.yml,yarn-lock.yml,pnpm-lock.yml,bun.lockb`.split(`,`),Ze=[`.storm-workspace`,`.nx`,`.git`,`.github`,`.vscode`,`.verdaccio`];function Qe(e){return process.env.STORM_WORKSPACE_ROOT||process.env.NX_WORKSPACE_ROOT_PATH?qe(process.env.STORM_WORKSPACE_ROOT??process.env.NX_WORKSPACE_ROOT_PATH):qe(Ve(e??process.cwd(),Xe,Ze))}var $e=g((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),et=g((e=>{let{InvalidArgumentError:t}=$e();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),tt=g((e=>{let{humanReadableArgName:t}=et();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
29
|
+
`)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
30
|
+
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
31
|
+
`)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),nt=g((e=>{let{InvalidArgumentError:t}=$e();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
32
|
+
- a short flag is a single dash and a single character
|
|
33
|
+
- either use a single dash and a single character (for a short flag)
|
|
34
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
|
|
35
|
+
- too many short flags`):i.test(t)?Error(`${n}
|
|
36
|
+
- too many long flags`):Error(`${n}
|
|
37
|
+
- unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),rt=g((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),it=g((e=>{let t=se(`node:events`).EventEmitter,n=se(`node:child_process`),r=se(`node:path`),i=se(`node:fs`),a=se(`node:process`),{Argument:o,humanReadableArgName:s}=et(),{CommanderError:c}=$e(),{Help:l,stripColor:u}=tt(),{Option:d,DualOptions:f}=nt(),{suggestSimilar:p}=rt();var m=class e extends t{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>a.stdout.write(e),writeErr:e=>a.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>a.stdout.isTTY?a.stdout.columns:void 0,getErrHelpWidth:()=>a.stderr.isTTY?a.stderr.columns:void 0,getOutHasColors:()=>h()??(a.stdout.isTTY&&a.stdout.hasColors?.()),getErrHasColors:()=>h()??(a.stderr.isTTY&&a.stderr.hasColors?.()),stripColor:e=>u(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new l,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
|
|
38
|
+
- specify the name in Command constructor or using .name()`);return t||={},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new o(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
|
|
39
|
+
Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new c(e,t,n)),a.exit(e)}action(e){return this._actionHandler=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)},this}createOption(e,t){return new d(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
40
|
+
- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??=e.negate?!1:e.isBoolean()||e.optional?!0:``,this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{r(t,`error: option '${e.flags}' argument '${t}' is invalid.`,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{r(t,`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof d)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t||={},e===void 0&&t.from===void 0){a.versions?.electron&&(t.from=`electron`);let e=a.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=a.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:a.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
41
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(i.existsSync(e))return;let r=`'${e}' does not exist
|
|
42
|
+
- if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
43
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
44
|
+
- ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let o=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function l(e,t){let n=r.resolve(e,t);if(i.existsSync(n))return n;if(s.includes(r.extname(t)))return;let a=s.find(e=>i.existsSync(`${n}${e}`));if(a)return`${n}${a}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=i.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=r.resolve(r.dirname(e),d)}if(d){let t=l(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=r.basename(this._scriptPath,r.extname(this._scriptPath));n!==this._name&&(t=l(d,`${n}-${e._name}`))}u=t||u}o=s.includes(r.extname(u));let f;a.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=ee(a.execArgv).concat(t),f=n.spawn(a.execPath,t,{stdio:`inherit`})):o?(t.unshift(u),t=ee(a.execArgv).concat(t),f=n.spawn(a.argv[0],t,{stdio:`inherit`})):f=n.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{a.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new c(e,`commander.executeSubCommandAsync`,`(close)`)):a.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)a.exit(1);else{let e=new c(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
45
|
+
`),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in a.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,a.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new f(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=p(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=p(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>s(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=r.basename(e,r.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(a.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
46
|
+
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function ee(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function h(){if(a.env.NO_COLOR||a.env.FORCE_COLOR===`0`||a.env.FORCE_COLOR===`false`)return!1;if(a.env.FORCE_COLOR||a.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=m,e.useColor=h}));const{program:at,createCommand:ot,createArgument:st,createOption:ct,CommanderError:lt,InvalidArgumentError:ut,InvalidOptionArgumentError:dt,Command:ft,Argument:pt,Option:mt,Help:ht}=oe(g((e=>{let{Argument:t}=et(),{Command:n}=it(),{CommanderError:r,InvalidArgumentError:i}=$e(),{Help:a}=tt(),{Option:o}=nt();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;var y=(e=>(e[e.VOID=0]=`VOID`,e[e.BIT=1]=`BIT`,e[e.BYTE=2]=`BYTE`,e[e.BYTE_2=3]=`BYTE_2`,e[e.BYTE_4=4]=`BYTE_4`,e[e.BYTE_8=5]=`BYTE_8`,e[e.POINTER=6]=`POINTER`,e[e.COMPOSITE=7]=`COMPOSITE`,e))(y||{});const gt=new DataView(new ArrayBuffer(8));new Uint16Array(gt.buffer)[0]=258;const _t=4096,vt=64<<20,yt=4096,b=gt.getUint8(0)===2,bt=2147483647,xt=4294967295;function St(e){throw Error(`CAPNP-TS000 Unreachable code detected. (never block hit with: ${e})`)}const Ct=`CAPNP-TS001 Attempted to parse an invalid message frame header; are you sure this is a Cap'n Proto message?`,wt=`CAPNP-TS004 Segment ID %X is out of bounds for message %s.`,Tt=`CAPNP-TS005 First segment must have at least enough room to hold the root pointer (8 bytes).`,Et=`CAPNP-TS011 Nesting depth limit exceeded for %s.`,Dt=`CAPNP-TS016 Invalid list element size: %x.`,Ot=`CAPNP-TS017 Invalid pointer type: %x.`,kt=`CAPNP-TS037 Segment buffer length %d is not a multiple of 8.`,At=`CAPNP-TS039 Requested size %x exceeds maximum value (${xt}).`,jt=`CAPNP-TS045: Cannot call mutative methods on an immutable list.`,Mt=`CAPNP-TS046: Search is not supported for list.`;function Nt(e){let t=new Uint8Array(e),n=[];for(let e=0;e<t.byteLength;e++)n.push(Ft(t[e].toString(16),2));return`[${n.join(` `)}]`}function Pt(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=Math.min(t.byteLength,8192),r=x(`
|
|
47
|
+
=== buffer[%d] ===`,n);for(let e=0;e<n;e+=16){r+=`
|
|
48
|
+
${Ft(e.toString(16),8)}: `;let n=``,i;for(i=0;i<16&&e+i<t.byteLength;i++){let a=t[e+i];r+=`${Ft(a.toString(16),2)} `,n+=a>31&&a<255?String.fromCharCode(a):`·`,i===7&&(r+=` `)}r+=`${` `.repeat((17-i)*3)}${n}`}return r+=`
|
|
49
|
+
`,n!==t.byteLength&&(r+=x(`=== (truncated %d bytes) ===
|
|
50
|
+
`,t.byteLength-n)),r}function x(e,...t){let n=e.length,r,i=0,a,o=!1,s=0,c=!1,l,u=``;function d(){return t[i++]}function f(){let t=``;for(;/\d/.test(e[s]);)t+=e[s++],a=e[s];return t.length>0?Number.parseInt(t,10):null}for(;s<n;++s)if(a=e[s],o)switch(o=!1,a===`.`?(c=!1,a=e[++s]):a===`0`&&e[s+1]===`.`?(c=!0,s+=2,a=e[s]):c=!0,l=f(),a){case`a`:u+=`0x`+Ft(Number.parseInt(String(d()),10).toString(16),8);break;case`b`:u+=Number.parseInt(String(d()),10).toString(2);break;case`c`:r=d(),u+=typeof r==`string`||r instanceof String?r:String.fromCharCode(Number.parseInt(String(r),10));break;case`d`:u+=Number.parseInt(String(d()),10);break;case`f`:{let e=Number.parseFloat(String(d())).toFixed(l||6);u+=c?e:e.replace(/^0/,``);break}case`j`:u+=JSON.stringify(d());break;case`o`:u+=`0`+Number.parseInt(String(d()),10).toString(8);break;case`s`:u+=d();break;case`x`:u+=`0x`+Number.parseInt(String(d()),10).toString(16);break;case`X`:u+=`0x`+Number.parseInt(String(d()),10).toString(16).toUpperCase();break;default:u+=a;break}else a===`%`?o=!0:u+=a;return u}function Ft(e,t,n=`0`){return e.length>=t?e:Array.from({length:t-e.length+1}).join(n)+e}function It(e){return e+7&-8}var S=class{constructor(e,t){this.dataByteLength=e,this.pointerLength=t}toString(){return x(`ObjectSize_dw:%d,pc:%d`,Rt(this),this.pointerLength)}};function Lt(e){return e.dataByteLength+e.pointerLength*8}function Rt(e){return e.dataByteLength/8}function zt(e){return e.dataByteLength/8+e.pointerLength}function Bt(e){return new S(It(e.dataByteLength),e.pointerLength)}var Vt=class{_capnp;byteOffset;segment;constructor(e){let t=E(e);switch(this.segment=t.segment,this.byteOffset=t.byteOffset,this._capnp={},this._capnp.type=dn(e),this._capnp.type){case O.STRUCT:this._capnp.size=fn(e);break;case O.LIST:this._capnp.length=un(e),this._capnp.elementSize=ln(e),this._capnp.elementSize===y.COMPOSITE&&(this._capnp.size=cn(e));break;case O.OTHER:this._capnp.capId=Xt(e);break;default:throw Error(Ot)}qt(e)}_moveTo(e){if(this._capnp===void 0)throw Error(x(`CAPNP-TS009 Attempted to adopt %s more than once.`,this));if(this.segment.message!==e.segment.message)throw Error(x(`CAPNP-TS008 Attempted to adopt %s into a pointer in a different message %s.`,this,e));Kt(e);let t=pn(this.segment,this.byteOffset,e);switch(this._capnp.type){case O.STRUCT:yn(t.offsetWords,this._capnp.size,t.pointer);break;case O.LIST:{let{offsetWords:e}=t;this._capnp.elementSize===y.COMPOSITE&&e--,vn(e,this._capnp.elementSize,this._capnp.length,t.pointer,this._capnp.size);break}case O.OTHER:gn(this._capnp.capId,t.pointer);break;default:throw Error(Ot)}this._capnp=void 0}dispose(){if(this._capnp!==void 0){switch(this._capnp.type){case O.STRUCT:this.segment.fillZeroWords(this.byteOffset,zt(this._capnp.size));break;case O.LIST:{let e=Ut(this._capnp.elementSize,this._capnp.length,this._capnp.size);this.segment.fillZeroWords(this.byteOffset,e);break}}this._capnp=void 0}}[Symbol.for(`nodejs.util.inspect.custom`)](){return x(`Orphan_%d@%a,type:%s`,this.segment.id,this.byteOffset,this._capnp&&this._capnp.type)}};function C(e,t){e._moveTo(t)}function w(e){return new Vt(e)}function Ht(e){return Nt(e.segment.buffer.slice(e.byteOffset,e.byteOffset+8))}function Ut(e,t,n){switch(e){case y.BIT:return It(t+7>>>3);case y.BYTE:case y.BYTE_2:case y.BYTE_4:case y.BYTE_8:case y.POINTER:case y.VOID:return It(Wt(e)*t);case y.COMPOSITE:if(n===void 0)throw Error(x(Dt,NaN));return t*It(Lt(n));default:throw Error(Dt)}}function Wt(e){switch(e){case y.BIT:return NaN;case y.BYTE:return 1;case y.BYTE_2:return 2;case y.BYTE_4:return 4;case y.BYTE_8:case y.POINTER:return 8;case y.COMPOSITE:return NaN;case y.VOID:return 0;default:throw Error(x(Dt,e))}}function Gt(e,t){return new k(t.segment,t.byteOffset+e,t._capnp.depthLimit)}function T(e,t){if(!(t.segment===e.segment&&t.byteOffset===e.byteOffset)&&(Kt(t),!D(e)))switch(dn(e)){case O.STRUCT:Cn(e,t);break;case O.LIST:Sn(e,t);break;case O.OTHER:xn(e,t);break;default:throw Error(x(Ot,dn(t)))}}function Kt(e){if(D(e))return;let t;switch(dn(e)){case O.STRUCT:{let n=fn(e);t=E(e),t.segment.fillZeroWords(t.byteOffset,n.dataByteLength/8);for(let e=0;e<n.pointerLength;e++)Kt(Gt(e*8,t));break}case O.LIST:{let n=ln(e),r=un(e),i=It(r*Wt(n));if(t=E(e),n===y.POINTER){for(let n=0;n<r;n++)Kt(new k(t.segment,t.byteOffset+n*8,e._capnp.depthLimit-1));break}else if(n===y.COMPOSITE){let n=Gt(-8,t),a=on(n),o=Lt(a);i=tn(n),t.segment.setWordZero(t.byteOffset-8);for(let n=0;n<r;n++)for(let r=0;r<a.pointerLength;r++)Kt(new k(t.segment,t.byteOffset+n*o+r*8,e._capnp.depthLimit-1))}t.segment.fillZeroWords(t.byteOffset,i);break}case O.OTHER:break;default:throw Error(x(Ot,dn(e)))}qt(e)}function qt(e){if(nn(e)===O.FAR){let t=Jt(e);mn(e)&&t.segment.setWordZero(t.byteOffset+8),t.segment.setWordZero(t.byteOffset)}e.segment.setWordZero(e.byteOffset)}function Jt(e){return new k(e.segment.message.getSegment(e.segment.getUint32(e.byteOffset+4)),(e.segment.getUint32(e.byteOffset)>>>3)*8,e._capnp.depthLimit-1)}function Yt(e){if(nn(e)===O.FAR){let t=Jt(e);return mn(e)&&(t.byteOffset+=8),t}return e}function Xt(e){return e.segment.getUint32(e.byteOffset+4)}function Zt(e){return dn(e)===O.LIST&&ln(e)===y.COMPOSITE}function E(e,t){let n;if(mn(e)){let t=Jt(e);n=new k(e.segment.message.getSegment(Qt(t)),tn(t)*8)}else{let t=Yt(e);n=new k(t.segment,t.byteOffset+8+tn(t)*8)}return Zt(e)&&(n.byteOffset+=8),!t&&e._capnp.compositeIndex!==void 0&&(n.byteOffset-=8,n.byteOffset+=8+e._capnp.compositeIndex*Lt(Bt(on(n)))),n}function Qt(e){return e.segment.getUint32(e.byteOffset+4)}function $t(e){return e.segment.getUint32(e.byteOffset+4)&7}function en(e){return e.segment.getUint32(e.byteOffset+4)>>>3}function tn(e){let t=e.segment.getInt32(e.byteOffset);return t&2?t>>3:t>>2}function nn(e){return e.segment.getUint32(e.byteOffset)&3}function rn(e){return e.segment.getUint16(e.byteOffset+4)}function an(e){return e.segment.getUint16(e.byteOffset+6)}function on(e){return new S(rn(e)*8,an(e))}function sn(e){let t=E(e);return t.byteOffset-=8,t}function cn(e){return on(sn(e))}function ln(e){return $t(Yt(e))}function un(e){let t=Yt(e);return $t(t)===y.COMPOSITE?tn(sn(e)):en(t)}function dn(e){let t=nn(Yt(e));if(t===O.FAR)throw Error(x(`CAPNP-TS015 Target of a far pointer (%s) is another far pointer.`,e));return t}function fn(e){return on(Yt(e))}function pn(e,t,n){if(n.segment!==e){if(!e.hasCapacity(8)){let r=n.segment.allocate(16);return hn(!0,r.byteOffset/8,r.segment.id,n),hn(!1,t/8,e.id,r),r.byteOffset+=8,new Tn(r,0)}let r=e.allocate(8);if(r.segment.id!==e.id)throw Error(`CAPNP-TS000 Unreachable code detected.`);return hn(!1,r.byteOffset/8,r.segment.id,n),new Tn(r,(t-r.byteOffset-8)/8)}return new Tn(n,(t-n.byteOffset-8)/8)}function mn(e){return nn(e)===O.FAR&&(e.segment.getUint32(e.byteOffset)&4)!=0}function D(e){return e.segment.isWordZero(e.byteOffset)}function hn(e,t,n,r){let i=O.FAR,a=e?1:0,o=t,s=n;r.segment.setUint32(r.byteOffset,i|a<<2|o<<3),r.segment.setUint32(r.byteOffset+4,s)}function gn(e,t){t.segment.setUint32(t.byteOffset,O.OTHER),t.segment.setUint32(t.byteOffset+4,e)}function _n(e){return e.segment.getUint32(e.byteOffset+4)}function vn(e,t,n,r,i){let a=O.LIST,o=e,s=t,c=n;if(t===y.COMPOSITE){if(i===void 0)throw TypeError(`CAPNP-TS040 Must provide a composite element size for composite list pointers.`);c*=zt(i)}r.segment.setUint32(r.byteOffset,a|o<<2),r.segment.setUint32(r.byteOffset+4,s|c<<3)}function yn(e,t,n){let r=O.STRUCT,i=e,a=Rt(t),o=t.pointerLength;n.segment.setUint32(n.byteOffset,r|i<<2),n.segment.setUint16(n.byteOffset+4,a),n.segment.setUint16(n.byteOffset+6,o)}function bn(e,t,n){if(D(t))return;let r=Yt(t);if((r.segment.getUint32(r.byteOffset)&3)!==e)throw Error(x(`CAPNP-TS024 Attempted to convert pointer %s to a %s type.`,t,e));if(n!==void 0&&(r.segment.getUint32(r.byteOffset+4)&7)!==n)throw Error(x(`CAPNP-TS023 Cannot convert %s to a %s list.`,t,y[n]))}function xn(e,t){let n=_n(e);if(n<0)return;let r=e.segment.message._capnp.capTable;if(!r)return;let i=r[n];i&&gn(t.segment.message.addCap(i),t)}function Sn(e,t){if(t._capnp.depthLimit<=0)throw Error(Et);let n=E(e),r=ln(e),i=un(e),a,o,s;if(r===y.POINTER){s=t.segment.allocate(i<<3);for(let r=0;r<i;r++)T(new k(n.segment,n.byteOffset+(r<<3),e._capnp.depthLimit-1),new k(s.segment,s.byteOffset+(r<<3),t._capnp.depthLimit-1))}else if(r===y.COMPOSITE){if(a=Bt(cn(e)),o=Lt(a),s=t.segment.allocate(Lt(a)*i+8),s.segment.copyWord(s.byteOffset,n.segment,n.byteOffset-8),a.dataByteLength>0){let e=zt(a)*i;s.segment.copyWords(s.byteOffset+8,n.segment,n.byteOffset,e)}for(let r=0;r<i;r++)for(let i=0;i<a.pointerLength;i++){let c=r*o+a.dataByteLength+(i<<3);T(new k(n.segment,n.byteOffset+c,e._capnp.depthLimit-1),new k(s.segment,s.byteOffset+c+8,t._capnp.depthLimit-1))}}else{let e=It(r===y.BIT?i+7>>>3:Wt(r)*i),a=e>>>3;s=t.segment.allocate(e),s.segment.copyWords(s.byteOffset,n.segment,n.byteOffset,a)}let c=pn(s.segment,s.byteOffset,t);vn(c.offsetWords,r,i,c.pointer,a)}function Cn(e,t){if(t._capnp.depthLimit<=0)throw Error(Et);let n=E(e),r=fn(e),i=Rt(r),a=t.segment.allocate(Lt(r));a.segment.copyWords(a.byteOffset,n.segment,n.byteOffset,i);for(let i=0;i<r.pointerLength;i++){let o=r.dataByteLength+i*8;T(new k(n.segment,n.byteOffset+o,e._capnp.depthLimit-1),new k(a.segment,a.byteOffset+o,t._capnp.depthLimit-1))}if(t._capnp.compositeList)return;let o=pn(a.segment,a.byteOffset,t);yn(o.offsetWords,r,o.pointer)}function wn(e,t){if(e._capnp.traversalLimit-=8,e._capnp.traversalLimit<=0)throw Error(x(`CAPNP-TS022 Traversal limit exceeded! Slow down! %s`,t))}var Tn=class{constructor(e,t){this.pointer=e,this.offsetWords=t}},O=(e=>(e[e.STRUCT=0]=`STRUCT`,e[e.LIST=1]=`LIST`,e[e.FAR=2]=`FAR`,e[e.OTHER=3]=`OTHER`,e))(O||{}),k=class{static _capnp={displayName:`Pointer`};_capnp;byteOffset;segment;constructor(e,t,n=bt){if(this._capnp={compositeList:!1,depthLimit:n},this.segment=e,this.byteOffset=t,n<1)throw Error(x(Et,this));if(wn(e.message,this),t<0||t>e.byteLength)throw Error(x(`CAPNP-TS019 Pointer offset %a is out of bounds for underlying buffer.`,t))}[Symbol.toStringTag](){return x(`Pointer_%d`,this.segment.id)}toString(){return x(`->%d@%a%s`,this.segment.id,this.byteOffset,Ht(this))}},En=class e extends k{static _capnp={displayName:`List<Generic>`,size:y.VOID};constructor(t,n,r){return super(t,n,r),new Proxy(this,e.#e)}static#e={get(e,t,n){let r=Reflect.get(e,t,n);if(r!==void 0)return r;if(typeof t==`string`)return e.get(+t)}};get length(){return un(this)}toArray(){let{length:e}=this,t=Array.from({length:e});for(let n=0;n<e;n++)t[n]=this.at(n);return t}get(e){throw TypeError(`Cannot get from a generic list.`)}set(e,t){throw TypeError(`Cannot set on a generic list.`)}at(e){return this.get(e<0?this.length+e:e)}concat(e){let{length:t}=this,n=e.length,r=Array.from({length:t+n});for(let e=0;e<t;e++)r[e]=this.at(e);for(let i=0;i<n;i++)r[i+t]=e.at(i);return r}some(e,t){for(let n=0;n<this.length;n++)if(e.call(t,this.at(n),n,this))return!0;return!1}filter(e,t){let n=[];for(let r=0;r<this.length;r++){let i=this.at(r);e.call(t,i,r,this)&&n.push(i)}return n}find(e,t){for(let n=0;n<this.length;n++){let r=this.at(n);if(e.call(t,r,n,this))return r}}findIndex(e,t){for(let n=0;n<this.length;n++){let r=this.at(n);if(e.call(t,r,n,this))return n}return-1}forEach(e,t){for(let n=0;n<this.length;n++)e.call(t,this.at(n),n,this)}map(e,t){let{length:n}=this,r=Array.from({length:n});for(let i=0;i<n;i++)r[i]=e.call(t,this.at(i),i,this);return r}flatMap(e,t){let n=[];for(let r=0;r<this.length;r++){let i=e.call(t,this.at(r),r,this);n.push(...Array.isArray(i)?i:[i])}return n}every(e,t){for(let n=0;n<this.length;n++)if(!e.call(t,this.at(n),n,this))return!1;return!0}reduce(e,t){let n=0,r;for(t===void 0?(r=this.at(0),n++):r=t;n<this.length;n++)r=e(r,this.at(n),n,this);return r}reduceRight(e,t){let n=this.length-1,r;for(t===void 0?(r=this.at(n),n--):r=t;n>=0;n--)r=e(r,this.at(n),n,this);return r}slice(e=0,t){let n=t?Math.min(this.length,t):this.length,r=Array.from({length:n-e});for(let t=e;t<n;t++)r[t]=this.at(t);return r}join(e){return this.toArray().join(e)}toReversed(){return this.toArray().reverse()}toSorted(e){return this.toArray().sort(e)}toSpliced(e,t,...n){return this.toArray().splice(e,t,...n)}fill(e,t,n){let{length:r}=this,i=Math.max(t??0,0),a=Math.min(n??r,r);for(let t=i;t<a;t++)this.set(t,e);return this}copyWithin(e,t,n){let{length:r}=this,i=n??r,a=t<0?Math.max(r+t,0):t,o=e<0?Math.max(r+e,0):e,s=Math.min(i-a,r-o);for(let e=0;e<s;e++)this.set(o+e,this.at(a+e));return this}keys(){return Array.from({length:this.length},(e,t)=>t)[Symbol.iterator]()}values(){return this.toArray().values()}entries(){return this.toArray().entries()}flat(e){return this.toArray().flat(e)}with(e,t){return this.toArray().with(e,t)}includes(e,t){throw Error(Mt)}findLast(e,t){throw Error(Mt)}findLastIndex(e,t){throw Error(Mt)}indexOf(e,t){throw Error(Mt)}lastIndexOf(e,t){throw Error(Mt)}pop(){throw Error(jt)}push(...e){throw Error(jt)}reverse(){throw Error(jt)}shift(){throw Error(jt)}unshift(...e){throw Error(jt)}splice(e,t,...n){throw Error(jt)}sort(e){throw Error(jt)}get[Symbol.unscopables](){return Array.prototype[Symbol.unscopables]}[Symbol.iterator](){return this.values()}toJSON(){return this.toArray()}toString(){return this.join(`,`)}toLocaleString(e,t){return this.toString()}[Symbol.toStringTag](){return`[object Array]`}static[Symbol.toStringTag](){return this._capnp.displayName}};function Dn(e,t,n,r){let i;switch(e){case y.BIT:i=n.segment.allocate(Math.ceil(t/8));break;case y.BYTE:case y.BYTE_2:case y.BYTE_4:case y.BYTE_8:case y.POINTER:i=n.segment.allocate(t*Wt(e));break;case y.COMPOSITE:{if(r===void 0)throw Error(x(`CAPNP-TS010 Attempted to set a composite list without providing a composite element size.`));r=Bt(r);let e=Lt(r)*t;i=n.segment.allocate(e+8),yn(t,r,i);break}case y.VOID:vn(0,e,t,n);return;default:throw Error(x(Dt,e))}let a=pn(i.segment,i.byteOffset,n);vn(a.offsetWords,e,t,a.pointer,r)}var On=class extends En{static fromPointer(e){return bn(O.LIST,e,y.BYTE),this._fromPointerUnchecked(e)}static _fromPointerUnchecked(e){return new this(e.segment,e.byteOffset,e._capnp.depthLimit)}copyBuffer(e){let t=E(this),n=this.length,r=e.byteLength,i=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,Math.min(n,r)),a=new Uint8Array(t.segment.buffer,t.byteOffset,this.length);a.set(i),n>r&&a.fill(0,r,n)}get(e){let t=E(this);return t.segment.getUint8(t.byteOffset+e)}set(e,t){let n=E(this);n.segment.setUint8(n.byteOffset+e,t)}toArrayBuffer(){let e=E(this);return e.segment.buffer.slice(e.byteOffset,e.byteOffset+this.length)}toDataView(){let e=E(this);return new DataView(e.segment.buffer,e.byteOffset,this.length)}[Symbol.toStringTag](){return`Data_${super.toString()}`}toUint8Array(){let e=E(this);return new Uint8Array(e.segment.buffer,e.byteOffset,this.length)}};const kn=new TextEncoder,An=new TextDecoder;var jn=class extends En{static fromPointer(e){return bn(O.LIST,e,y.BYTE),Mn(e)}get(e=0){if(D(this))return``;let t=E(this);return An.decode(new Uint8Array(t.segment.buffer,t.byteOffset+e,this.length-e))}get length(){return super.length-1}set(e,t){let n=kn.encode(t),r=n.byteLength+e,i,a;if(!D(this)){i=E(this);let t=Math.min(this.length,e);a=new Uint8Array(i.segment.buffer.slice(i.byteOffset,i.byteOffset+t)),Kt(this)}Dn(y.BYTE,r+1,this),i=E(this);let o=new Uint8Array(i.segment.buffer,i.byteOffset,r);a&&o.set(a),o.set(n,e)}toString(){return this.get()}toJSON(){return this.get()}[Symbol.toPrimitive](){return this.get()}[Symbol.toStringTag](){return`Text_${super.toString()}`}};function Mn(e){return new jn(e.segment,e.byteOffset,e._capnp.depthLimit)}var A=class extends k{static _capnp={displayName:`Struct`};constructor(e,t,n=bt,r){super(e,t,n),this._capnp.compositeIndex=r,this._capnp.compositeList=r!==void 0}static[Symbol.toStringTag](){return this._capnp.displayName}[Symbol.toStringTag](){return`Struct_${super.toString()}${this._capnp.compositeIndex===void 0?``:`,ci:${this._capnp.compositeIndex}`} > ${E(this).toString()}`}};(class extends A{static _capnp={displayName:`AnyStruct`,id:`0`,size:new S(0,0)}});const j=new DataView(new ArrayBuffer(8));function Nn(e,t){if(t._capnp.compositeIndex!==void 0)throw Error(x(`CAPNP-TS013 Attempted to initialize a struct member from a composite list (%s).`,t));Kt(t);let n=t.segment.allocate(Lt(e)),r=pn(n.segment,n.byteOffset,t);yn(r.offsetWords,e,r.pointer)}function M(e,t,n){let r=Un(e,t,n);return Nn(t._capnp.size,r),r}function Pn(e,t){let{pointerLength:n}=Gn(t);if(e<0||e>=n)throw Error(x(`CAPNP-TS021 Attempted to access out-of-bounds struct pointer (%s, index: %d, length: %d).`,t,e,n))}function Fn(e,t){let n=Gn(t),r=E(t),i=t.segment.allocate(Lt(e));i.segment.copyWords(i.byteOffset,r.segment,r.byteOffset,Math.min(Rt(n),Rt(e)));let a=pn(i.segment,i.byteOffset,t);yn(a.offsetWords,e,a.pointer);for(let t=0;t<Math.min(n.pointerLength,e.pointerLength);t++){let a=new k(r.segment,r.byteOffset+n.dataByteLength+t*8);if(D(a))continue;let o=Yt(a),s=E(a),c=new k(i.segment,i.byteOffset+e.dataByteLength+t*8);dn(a)===O.LIST&&ln(a)===y.COMPOSITE&&(s.byteOffset-=8);let l=pn(s.segment,s.byteOffset,c),u=o.segment.getUint8(o.byteOffset)&3,d=o.segment.getUint32(o.byteOffset+4);l.pointer.segment.setUint32(l.pointer.byteOffset,u|l.offsetWords<<2),l.pointer.segment.setUint32(l.pointer.byteOffset+4,d)}r.segment.fillZeroWords(r.byteOffset,zt(n))}function N(e,t){return new e(t.segment,t.byteOffset,t._capnp.depthLimit,t._capnp.compositeIndex)}function P(e,t,n){let r=Math.floor(e/8),i=1<<e%8;K(r,1,t);let a=F(t),o=a.segment.getUint8(a.byteOffset+r);return n===void 0?(o&i)!==0:((o^n.getUint8(0))&i)!==0}function In(e,t,n){Pn(e,t);let r=Wn(t);r.byteOffset+=e*8;let i=new On(r.segment,r.byteOffset,t._capnp.depthLimit-1);return D(i)&&(n?T(n,i):Dn(y.BYTE,0,i)),i}function F(e){return E(e)}function Ln(e,t,n){K(e,4,t);let r=F(t);if(n===void 0)return r.segment.getFloat32(r.byteOffset+e);let i=r.segment.getUint32(r.byteOffset+e)^n.getUint32(0,!0);return j.setUint32(0,i,b),j.getFloat32(0,b)}function Rn(e,t,n){K(e,8,t);let r=F(t);if(n!==void 0){let t=r.segment.getUint32(r.byteOffset+e)^n.getUint32(0,!0),i=r.segment.getUint32(r.byteOffset+e+4)^n.getUint32(4,!0);return j.setUint32(0,t,b),j.setUint32(4,i,b),j.getFloat64(0,b)}return r.segment.getFloat64(r.byteOffset+e)}function zn(e,t,n){K(e,2,t);let r=F(t);if(n===void 0)return r.segment.getInt16(r.byteOffset+e);let i=r.segment.getUint16(r.byteOffset+e)^n.getUint16(0,!0);return j.setUint16(0,i,b),j.getInt16(0,b)}function Bn(e,t,n){K(e,4,t);let r=F(t);if(n===void 0)return r.segment.getInt32(r.byteOffset+e);let i=r.segment.getUint32(r.byteOffset+e)^n.getUint16(0,!0);return j.setUint32(0,i,b),j.getInt32(0,b)}function Vn(e,t,n){K(e,8,t);let r=F(t);if(n!==void 0){let t=r.segment.getUint32(r.byteOffset+e)^n.getUint32(0,!0),i=r.segment.getUint32(r.byteOffset+e+4)^n.getUint32(4,!0);return j.setUint32(b?0:4,t,b),j.setUint32(b?4:0,i,b),j.getBigInt64(0,b)}return r.segment.getInt64(r.byteOffset+e)}function Hn(e,t,n){K(e,1,t);let r=F(t);if(n===void 0)return r.segment.getInt8(r.byteOffset+e);let i=r.segment.getUint8(r.byteOffset+e)^n.getUint8(0);return j.setUint8(0,i),j.getInt8(0)}function I(e,t,n,r){Pn(e,n);let i=Wn(n);i.byteOffset+=e*8;let a=new t(i.segment,i.byteOffset,n._capnp.depthLimit-1);if(D(a))r?T(r,a):Dn(t._capnp.size,0,a,t._capnp.compositeSize);else if(t._capnp.compositeSize!==void 0){let e=cn(a),n=t._capnp.compositeSize;if(n.dataByteLength>e.dataByteLength||n.pointerLength>e.pointerLength){let r=E(a),i=un(a),o=a.segment.allocate(Lt(n)*i+8),s=pn(o.segment,o.byteOffset,a);vn(s.offsetWords,t._capnp.size,i,s.pointer,n),yn(i,n,o),o.byteOffset+=8;for(let t=0;t<i;t++){let i=r.byteOffset+t*Lt(e),a=o.byteOffset+t*Lt(n);o.segment.copyWords(a,r.segment,i,zt(e));for(let t=0;t<e.pointerLength;t++){let s=new k(r.segment,i+e.dataByteLength+t*8),c=new k(o.segment,a+n.dataByteLength+t*8),l=Yt(s),u=E(s);dn(s)===O.LIST&&ln(s)===y.COMPOSITE&&(u.byteOffset-=8);let d=pn(u.segment,u.byteOffset,c),f=l.segment.getUint8(l.byteOffset)&3,p=l.segment.getUint32(l.byteOffset+4);d.pointer.segment.setUint32(d.pointer.byteOffset,f|d.offsetWords<<2),d.pointer.segment.setUint32(d.pointer.byteOffset+4,p)}}r.segment.fillZeroWords(r.byteOffset,zt(e)*i)}}return a}function L(e,t){Pn(e,t);let n=Wn(t);return n.byteOffset+=e*8,new k(n.segment,n.byteOffset,t._capnp.depthLimit-1)}function Un(e,t,n){Pn(e,n);let r=Wn(n);return r.byteOffset+=e*8,new t(r.segment,r.byteOffset,n._capnp.depthLimit-1)}function Wn(e){let t=E(e);return t.byteOffset+=It(Gn(e).dataByteLength),t}function Gn(e){if(e._capnp.compositeIndex!==void 0){let t=E(e,!0);return t.byteOffset-=8,on(t)}return fn(e)}function R(e,t,n,r){let i=Un(e,t,n);if(D(i))r?T(r,i):Nn(t._capnp.size,i);else{bn(O.STRUCT,i);let e=fn(i);(e.dataByteLength<t._capnp.size.dataByteLength||e.pointerLength<t._capnp.size.pointerLength)&&Fn(t._capnp.size,i)}return i}function Kn(e,t,n){let r=jn.fromPointer(L(e,t));return D(r)&&n&&r.set(0,n),r.get(0)}function z(e,t,n){K(e,2,t);let r=F(t);return n===void 0?r.segment.getUint16(r.byteOffset+e):r.segment.getUint16(r.byteOffset+e)^n.getUint16(0,!0)}function qn(e,t,n){K(e,4,t);let r=F(t);return n===void 0?r.segment.getUint32(r.byteOffset+e):r.segment.getUint32(r.byteOffset+e)^n.getUint32(0,!0)}function B(e,t,n){K(e,8,t);let r=F(t);if(n!==void 0){let t=r.segment.getUint32(r.byteOffset+e)^n.getUint32(0,!0),i=r.segment.getUint32(r.byteOffset+e+4)^n.getUint32(4,!0);return j.setUint32(b?0:4,t,b),j.setUint32(b?4:0,i,b),j.getBigUint64(0,b)}return r.segment.getUint64(r.byteOffset+e)}function Jn(e,t,n){K(e,1,t);let r=F(t);return n===void 0?r.segment.getUint8(r.byteOffset+e):r.segment.getUint8(r.byteOffset+e)^n.getUint8(0)}function Yn(e,t,n){Pn(e,n);let r=Wn(n);r.byteOffset+=e*8;let i=new On(r.segment,r.byteOffset,n._capnp.depthLimit-1);return Kt(i),Dn(y.BYTE,t,i),i}function V(e,t,n,r){Pn(e,r);let i=Wn(r);i.byteOffset+=e*8;let a=new t(i.segment,i.byteOffset,r._capnp.depthLimit-1);return Kt(a),Dn(t._capnp.size,n,a,t._capnp.compositeSize),a}function H(e,t,n,r){let i=Math.floor(e/8),a=1<<e%8;K(i,1,n);let o=F(n),s=o.segment.getUint8(o.byteOffset+i);r!==void 0&&(t=(r.getUint8(0)&a)===0?t:!t),o.segment.setUint8(o.byteOffset+i,t?s|a:s&~a)}function Xn(e,t,n,r){K(e,4,n);let i=F(n);if(r!==void 0){j.setFloat32(0,t,b);let n=j.getUint32(0,b)^r.getUint32(0,!0);i.segment.setUint32(i.byteOffset+e,n);return}i.segment.setFloat32(i.byteOffset+e,t)}function Zn(e,t,n,r){K(e,8,n);let i=F(n);if(r!==void 0){j.setFloat64(0,t,b);let n=j.getUint32(0,b)^r.getUint32(0,!0),a=j.getUint32(4,b)^r.getUint32(4,!0);i.segment.setUint32(i.byteOffset+e,n),i.segment.setUint32(i.byteOffset+e+4,a);return}i.segment.setFloat64(i.byteOffset+e,t)}function Qn(e,t,n,r){K(e,2,n);let i=F(n);if(r!==void 0){j.setInt16(0,t,b);let n=j.getUint16(0,b)^r.getUint16(0,!0);i.segment.setUint16(i.byteOffset+e,n);return}i.segment.setInt16(i.byteOffset+e,t)}function $n(e,t,n,r){K(e,4,n);let i=F(n);if(r!==void 0){j.setInt32(0,t,b);let n=j.getUint32(0,b)^r.getUint32(0,!0);i.segment.setUint32(i.byteOffset+e,n);return}i.segment.setInt32(i.byteOffset+e,t)}function er(e,t,n,r){K(e,8,n);let i=F(n);if(r!==void 0){j.setBigInt64(0,t,b);let n=j.getUint32(b?0:4,b)^r.getUint32(0,!0),a=j.getUint32(b?4:0,b)^r.getUint32(4,!0);i.segment.setUint32(i.byteOffset+e,n),i.segment.setUint32(i.byteOffset+e+4,a);return}i.segment.setInt64(i.byteOffset+e,t)}function tr(e,t,n,r){K(e,1,n);let i=F(n);if(r!==void 0){j.setInt8(0,t);let n=j.getUint8(0)^r.getUint8(0);i.segment.setUint8(i.byteOffset+e,n);return}i.segment.setInt8(i.byteOffset+e,t)}function nr(e,t,n){jn.fromPointer(L(e,n)).set(0,t)}function U(e,t,n,r){K(e,2,n);let i=F(n);r!==void 0&&(t^=r.getUint16(0,!0)),i.segment.setUint16(i.byteOffset+e,t)}function rr(e,t,n,r){K(e,4,n);let i=F(n);r!==void 0&&(t^=r.getUint32(0,!0)),i.segment.setUint32(i.byteOffset+e,t)}function W(e,t,n,r){K(e,8,n);let i=F(n);if(r!==void 0){j.setBigUint64(0,t,b);let n=j.getUint32(b?0:4,b)^r.getUint32(0,!0),a=j.getUint32(b?4:0,b)^r.getUint32(4,!0);i.segment.setUint32(i.byteOffset+e,n),i.segment.setUint32(i.byteOffset+e+4,a);return}i.segment.setUint64(i.byteOffset+e,t)}function ir(e,t,n,r){K(e,1,n);let i=F(n);r!==void 0&&(t^=r.getUint8(0)),i.segment.setUint8(i.byteOffset+e,t)}function G(e,t,n,r){if(t!==n)throw Error(x(`CAPNP-TS018 Attempted to access getter on %s for union field %s that is not currently set (wanted: %d, found: %d).`,r,e,t,n))}function K(e,t,n){let{dataByteLength:r}=Gn(n);if(e<0||t<0||e+t>r)throw Error(x(`CAPNP-TS020 Attempted to access out-of-bounds struct data (struct: %s, %d bytes at %a, data words: %d).`,n,t,e,r))}function q(e){return class extends En{static _capnp={compositeSize:e._capnp.size,displayName:`List<${e._capnp.displayName}>`,size:y.COMPOSITE};get(t){return new e(this.segment,this.byteOffset,this._capnp.depthLimit-1,t)}set(e,t){T(t,this.get(e))}[Symbol.toStringTag](){return`Composite_${super.toString()},cls:${e.toString()}`}}}function ar(e,t){return n=>{let r=new DataView(new ArrayBuffer(e));return t.call(r,0,n,!0),r}}DataView.prototype.setFloat32,DataView.prototype.setFloat64,DataView.prototype.setInt16,DataView.prototype.setInt32,DataView.prototype.setBigInt64,DataView.prototype.setInt8;const or=ar(2,DataView.prototype.setUint16);DataView.prototype.setUint32,DataView.prototype.setBigUint64,DataView.prototype.setUint8;var sr=class extends A{static _capnp={displayName:`Parameter`,id:`b9521bccf10fa3b1`,size:new S(0,1)};get name(){return Kn(0,this)}set name(e){nr(0,e,this)}toString(){return`Node_Parameter_`+super.toString()}},cr=class extends A{static _capnp={displayName:`NestedNode`,id:`debf55bbfa0fc242`,size:new S(8,1)};get name(){return Kn(0,this)}set name(e){nr(0,e,this)}get id(){return B(0,this)}set id(e){W(0,e,this)}toString(){return`Node_NestedNode_`+super.toString()}},lr=class extends A{static _capnp={displayName:`Member`,id:`c2ba9038898e1fa2`,size:new S(0,1)};get docComment(){return Kn(0,this)}set docComment(e){nr(0,e,this)}toString(){return`Node_SourceInfo_Member_`+super.toString()}},ur=class e extends A{static Member=lr;static _capnp={displayName:`SourceInfo`,id:`f38e1de3041357ae`,size:new S(8,2)};static _Members;get id(){return B(0,this)}set id(e){W(0,e,this)}get docComment(){return Kn(0,this)}set docComment(e){nr(0,e,this)}_adoptMembers(e){C(e,L(1,this))}_disownMembers(){return w(this.members)}get members(){return I(1,e._Members,this)}_hasMembers(){return!D(L(1,this))}_initMembers(t){return V(1,e._Members,t,this)}set members(e){T(e,L(1,this))}toString(){return`Node_SourceInfo_`+super.toString()}},dr=class e extends A{static _capnp={displayName:`struct`,id:`9ea0b19b37fb4435`,size:new S(40,6)};static _Fields;get dataWordCount(){return z(14,this)}set dataWordCount(e){U(14,e,this)}get pointerCount(){return z(24,this)}set pointerCount(e){U(24,e,this)}get preferredListEncoding(){return z(26,this)}set preferredListEncoding(e){U(26,e,this)}get isGroup(){return P(224,this)}set isGroup(e){H(224,e,this)}get discriminantCount(){return z(30,this)}set discriminantCount(e){U(30,e,this)}get discriminantOffset(){return qn(32,this)}set discriminantOffset(e){rr(32,e,this)}_adoptFields(e){C(e,L(3,this))}_disownFields(){return w(this.fields)}get fields(){return I(3,e._Fields,this)}_hasFields(){return!D(L(3,this))}_initFields(t){return V(3,e._Fields,t,this)}set fields(e){T(e,L(3,this))}toString(){return`Node_Struct_`+super.toString()}},fr=class e extends A{static _capnp={displayName:`enum`,id:`b54ab3364333f598`,size:new S(40,6)};static _Enumerants;_adoptEnumerants(e){C(e,L(3,this))}_disownEnumerants(){return w(this.enumerants)}get enumerants(){return I(3,e._Enumerants,this)}_hasEnumerants(){return!D(L(3,this))}_initEnumerants(t){return V(3,e._Enumerants,t,this)}set enumerants(e){T(e,L(3,this))}toString(){return`Node_Enum_`+super.toString()}},pr=class e extends A{static _capnp={displayName:`interface`,id:`e82753cff0c2218f`,size:new S(40,6)};static _Methods;static _Superclasses;_adoptMethods(e){C(e,L(3,this))}_disownMethods(){return w(this.methods)}get methods(){return I(3,e._Methods,this)}_hasMethods(){return!D(L(3,this))}_initMethods(t){return V(3,e._Methods,t,this)}set methods(e){T(e,L(3,this))}_adoptSuperclasses(e){C(e,L(4,this))}_disownSuperclasses(){return w(this.superclasses)}get superclasses(){return I(4,e._Superclasses,this)}_hasSuperclasses(){return!D(L(4,this))}_initSuperclasses(t){return V(4,e._Superclasses,t,this)}set superclasses(e){T(e,L(4,this))}toString(){return`Node_Interface_`+super.toString()}},mr=class extends A{static _capnp={displayName:`const`,id:`b18aa5ac7a0d9420`,size:new S(40,6)};_adoptType(e){C(e,L(3,this))}_disownType(){return w(this.type)}get type(){return R(3,Y,this)}_hasType(){return!D(L(3,this))}_initType(){return M(3,Y,this)}set type(e){T(e,L(3,this))}_adoptValue(e){C(e,L(4,this))}_disownValue(){return w(this.value)}get value(){return R(4,Z,this)}_hasValue(){return!D(L(4,this))}_initValue(){return M(4,Z,this)}set value(e){T(e,L(4,this))}toString(){return`Node_Const_`+super.toString()}},hr=class extends A{static _capnp={displayName:`annotation`,id:`ec1619d4400a0290`,size:new S(40,6)};_adoptType(e){C(e,L(3,this))}_disownType(){return w(this.type)}get type(){return R(3,Y,this)}_hasType(){return!D(L(3,this))}_initType(){return M(3,Y,this)}set type(e){T(e,L(3,this))}get targetsFile(){return P(112,this)}set targetsFile(e){H(112,e,this)}get targetsConst(){return P(113,this)}set targetsConst(e){H(113,e,this)}get targetsEnum(){return P(114,this)}set targetsEnum(e){H(114,e,this)}get targetsEnumerant(){return P(115,this)}set targetsEnumerant(e){H(115,e,this)}get targetsStruct(){return P(116,this)}set targetsStruct(e){H(116,e,this)}get targetsField(){return P(117,this)}set targetsField(e){H(117,e,this)}get targetsUnion(){return P(118,this)}set targetsUnion(e){H(118,e,this)}get targetsGroup(){return P(119,this)}set targetsGroup(e){H(119,e,this)}get targetsInterface(){return P(120,this)}set targetsInterface(e){H(120,e,this)}get targetsMethod(){return P(121,this)}set targetsMethod(e){H(121,e,this)}get targetsParam(){return P(122,this)}set targetsParam(e){H(122,e,this)}get targetsAnnotation(){return P(123,this)}set targetsAnnotation(e){H(123,e,this)}toString(){return`Node_Annotation_`+super.toString()}};const gr={FILE:0,STRUCT:1,ENUM:2,INTERFACE:3,CONST:4,ANNOTATION:5};var _r=class e extends A{static FILE=gr.FILE;static STRUCT=gr.STRUCT;static ENUM=gr.ENUM;static INTERFACE=gr.INTERFACE;static CONST=gr.CONST;static ANNOTATION=gr.ANNOTATION;static Parameter=sr;static NestedNode=cr;static SourceInfo=ur;static _capnp={displayName:`Node`,id:`e682ab4cf923a417`,size:new S(40,6)};static _Parameters;static _NestedNodes;static _Annotations;get id(){return B(0,this)}set id(e){W(0,e,this)}get displayName(){return Kn(0,this)}set displayName(e){nr(0,e,this)}get displayNamePrefixLength(){return qn(8,this)}set displayNamePrefixLength(e){rr(8,e,this)}get scopeId(){return B(16,this)}set scopeId(e){W(16,e,this)}_adoptParameters(e){C(e,L(5,this))}_disownParameters(){return w(this.parameters)}get parameters(){return I(5,e._Parameters,this)}_hasParameters(){return!D(L(5,this))}_initParameters(t){return V(5,e._Parameters,t,this)}set parameters(e){T(e,L(5,this))}get isGeneric(){return P(288,this)}set isGeneric(e){H(288,e,this)}_adoptNestedNodes(e){C(e,L(1,this))}_disownNestedNodes(){return w(this.nestedNodes)}get nestedNodes(){return I(1,e._NestedNodes,this)}_hasNestedNodes(){return!D(L(1,this))}_initNestedNodes(t){return V(1,e._NestedNodes,t,this)}set nestedNodes(e){T(e,L(1,this))}_adoptAnnotations(e){C(e,L(2,this))}_disownAnnotations(){return w(this.annotations)}get annotations(){return I(2,e._Annotations,this)}_hasAnnotations(){return!D(L(2,this))}_initAnnotations(t){return V(2,e._Annotations,t,this)}set annotations(e){T(e,L(2,this))}get _isFile(){return z(12,this)===0}set file(e){U(12,0,this)}get struct(){return G(`struct`,z(12,this),1,this),N(dr,this)}_initStruct(){return U(12,1,this),N(dr,this)}get _isStruct(){return z(12,this)===1}set struct(e){U(12,1,this)}get enum(){return G(`enum`,z(12,this),2,this),N(fr,this)}_initEnum(){return U(12,2,this),N(fr,this)}get _isEnum(){return z(12,this)===2}set enum(e){U(12,2,this)}get interface(){return G(`interface`,z(12,this),3,this),N(pr,this)}_initInterface(){return U(12,3,this),N(pr,this)}get _isInterface(){return z(12,this)===3}set interface(e){U(12,3,this)}get const(){return G(`const`,z(12,this),4,this),N(mr,this)}_initConst(){return U(12,4,this),N(mr,this)}get _isConst(){return z(12,this)===4}set const(e){U(12,4,this)}get annotation(){return G(`annotation`,z(12,this),5,this),N(hr,this)}_initAnnotation(){return U(12,5,this),N(hr,this)}get _isAnnotation(){return z(12,this)===5}set annotation(e){U(12,5,this)}toString(){return`Node_`+super.toString()}which(){return z(12,this)}},vr=class extends A{static _capnp={displayName:`slot`,id:`c42305476bb4746f`,size:new S(24,4)};get offset(){return qn(4,this)}set offset(e){rr(4,e,this)}_adoptType(e){C(e,L(2,this))}_disownType(){return w(this.type)}get type(){return R(2,Y,this)}_hasType(){return!D(L(2,this))}_initType(){return M(2,Y,this)}set type(e){T(e,L(2,this))}_adoptDefaultValue(e){C(e,L(3,this))}_disownDefaultValue(){return w(this.defaultValue)}get defaultValue(){return R(3,Z,this)}_hasDefaultValue(){return!D(L(3,this))}_initDefaultValue(){return M(3,Z,this)}set defaultValue(e){T(e,L(3,this))}get hadExplicitDefault(){return P(128,this)}set hadExplicitDefault(e){H(128,e,this)}toString(){return`Field_Slot_`+super.toString()}},yr=class extends A{static _capnp={displayName:`group`,id:`cafccddb68db1d11`,size:new S(24,4)};get typeId(){return B(16,this)}set typeId(e){W(16,e,this)}toString(){return`Field_Group_`+super.toString()}};const br={IMPLICIT:0,EXPLICIT:1};var xr=class extends A{static IMPLICIT=br.IMPLICIT;static EXPLICIT=br.EXPLICIT;static _capnp={displayName:`ordinal`,id:`bb90d5c287870be6`,size:new S(24,4)};get _isImplicit(){return z(10,this)===0}set implicit(e){U(10,0,this)}get explicit(){return G(`explicit`,z(10,this),1,this),z(12,this)}get _isExplicit(){return z(10,this)===1}set explicit(e){U(10,1,this),U(12,e,this)}toString(){return`Field_Ordinal_`+super.toString()}which(){return z(10,this)}};const Sr={SLOT:0,GROUP:1};var Cr=class e extends A{static NO_DISCRIMINANT=65535;static SLOT=Sr.SLOT;static GROUP=Sr.GROUP;static _capnp={displayName:`Field`,id:`9aad50a41f4af45f`,size:new S(24,4),defaultDiscriminantValue:or(65535)};static _Annotations;get name(){return Kn(0,this)}set name(e){nr(0,e,this)}get codeOrder(){return z(0,this)}set codeOrder(e){U(0,e,this)}_adoptAnnotations(e){C(e,L(1,this))}_disownAnnotations(){return w(this.annotations)}get annotations(){return I(1,e._Annotations,this)}_hasAnnotations(){return!D(L(1,this))}_initAnnotations(t){return V(1,e._Annotations,t,this)}set annotations(e){T(e,L(1,this))}get discriminantValue(){return z(2,this,e._capnp.defaultDiscriminantValue)}set discriminantValue(t){U(2,t,this,e._capnp.defaultDiscriminantValue)}get slot(){return G(`slot`,z(8,this),0,this),N(vr,this)}_initSlot(){return U(8,0,this),N(vr,this)}get _isSlot(){return z(8,this)===0}set slot(e){U(8,0,this)}get group(){return G(`group`,z(8,this),1,this),N(yr,this)}_initGroup(){return U(8,1,this),N(yr,this)}get _isGroup(){return z(8,this)===1}set group(e){U(8,1,this)}get ordinal(){return N(xr,this)}_initOrdinal(){return N(xr,this)}toString(){return`Field_`+super.toString()}which(){return z(8,this)}},wr=class e extends A{static _capnp={displayName:`Enumerant`,id:`978a7cebdc549a4d`,size:new S(8,2)};static _Annotations;get name(){return Kn(0,this)}set name(e){nr(0,e,this)}get codeOrder(){return z(0,this)}set codeOrder(e){U(0,e,this)}_adoptAnnotations(e){C(e,L(1,this))}_disownAnnotations(){return w(this.annotations)}get annotations(){return I(1,e._Annotations,this)}_hasAnnotations(){return!D(L(1,this))}_initAnnotations(t){return V(1,e._Annotations,t,this)}set annotations(e){T(e,L(1,this))}toString(){return`Enumerant_`+super.toString()}},Tr=class extends A{static _capnp={displayName:`Superclass`,id:`a9962a9ed0a4d7f8`,size:new S(8,1)};get id(){return B(0,this)}set id(e){W(0,e,this)}_adoptBrand(e){C(e,L(0,this))}_disownBrand(){return w(this.brand)}get brand(){return R(0,Vr,this)}_hasBrand(){return!D(L(0,this))}_initBrand(){return M(0,Vr,this)}set brand(e){T(e,L(0,this))}toString(){return`Superclass_`+super.toString()}},Er=class e extends A{static _capnp={displayName:`Method`,id:`9500cce23b334d80`,size:new S(24,5)};static _ImplicitParameters;static _Annotations;get name(){return Kn(0,this)}set name(e){nr(0,e,this)}get codeOrder(){return z(0,this)}set codeOrder(e){U(0,e,this)}_adoptImplicitParameters(e){C(e,L(4,this))}_disownImplicitParameters(){return w(this.implicitParameters)}get implicitParameters(){return I(4,e._ImplicitParameters,this)}_hasImplicitParameters(){return!D(L(4,this))}_initImplicitParameters(t){return V(4,e._ImplicitParameters,t,this)}set implicitParameters(e){T(e,L(4,this))}get paramStructType(){return B(8,this)}set paramStructType(e){W(8,e,this)}_adoptParamBrand(e){C(e,L(2,this))}_disownParamBrand(){return w(this.paramBrand)}get paramBrand(){return R(2,Vr,this)}_hasParamBrand(){return!D(L(2,this))}_initParamBrand(){return M(2,Vr,this)}set paramBrand(e){T(e,L(2,this))}get resultStructType(){return B(16,this)}set resultStructType(e){W(16,e,this)}_adoptResultBrand(e){C(e,L(3,this))}_disownResultBrand(){return w(this.resultBrand)}get resultBrand(){return R(3,Vr,this)}_hasResultBrand(){return!D(L(3,this))}_initResultBrand(){return M(3,Vr,this)}set resultBrand(e){T(e,L(3,this))}_adoptAnnotations(e){C(e,L(1,this))}_disownAnnotations(){return w(this.annotations)}get annotations(){return I(1,e._Annotations,this)}_hasAnnotations(){return!D(L(1,this))}_initAnnotations(t){return V(1,e._Annotations,t,this)}set annotations(e){T(e,L(1,this))}toString(){return`Method_`+super.toString()}},Dr=class extends A{static _capnp={displayName:`list`,id:`87e739250a60ea97`,size:new S(24,1)};_adoptElementType(e){C(e,L(0,this))}_disownElementType(){return w(this.elementType)}get elementType(){return R(0,Y,this)}_hasElementType(){return!D(L(0,this))}_initElementType(){return M(0,Y,this)}set elementType(e){T(e,L(0,this))}toString(){return`Type_List_`+super.toString()}},Or=class extends A{static _capnp={displayName:`enum`,id:`9e0e78711a7f87a9`,size:new S(24,1)};get typeId(){return B(8,this)}set typeId(e){W(8,e,this)}_adoptBrand(e){C(e,L(0,this))}_disownBrand(){return w(this.brand)}get brand(){return R(0,Vr,this)}_hasBrand(){return!D(L(0,this))}_initBrand(){return M(0,Vr,this)}set brand(e){T(e,L(0,this))}toString(){return`Type_Enum_`+super.toString()}},kr=class extends A{static _capnp={displayName:`struct`,id:`ac3a6f60ef4cc6d3`,size:new S(24,1)};get typeId(){return B(8,this)}set typeId(e){W(8,e,this)}_adoptBrand(e){C(e,L(0,this))}_disownBrand(){return w(this.brand)}get brand(){return R(0,Vr,this)}_hasBrand(){return!D(L(0,this))}_initBrand(){return M(0,Vr,this)}set brand(e){T(e,L(0,this))}toString(){return`Type_Struct_`+super.toString()}},Ar=class extends A{static _capnp={displayName:`interface`,id:`ed8bca69f7fb0cbf`,size:new S(24,1)};get typeId(){return B(8,this)}set typeId(e){W(8,e,this)}_adoptBrand(e){C(e,L(0,this))}_disownBrand(){return w(this.brand)}get brand(){return R(0,Vr,this)}_hasBrand(){return!D(L(0,this))}_initBrand(){return M(0,Vr,this)}set brand(e){T(e,L(0,this))}toString(){return`Type_Interface_`+super.toString()}};const jr={ANY_KIND:0,STRUCT:1,LIST:2,CAPABILITY:3};var Mr=class extends A{static ANY_KIND=jr.ANY_KIND;static STRUCT=jr.STRUCT;static LIST=jr.LIST;static CAPABILITY=jr.CAPABILITY;static _capnp={displayName:`unconstrained`,id:`8e3b5f79fe593656`,size:new S(24,1)};get _isAnyKind(){return z(10,this)===0}set anyKind(e){U(10,0,this)}get _isStruct(){return z(10,this)===1}set struct(e){U(10,1,this)}get _isList(){return z(10,this)===2}set list(e){U(10,2,this)}get _isCapability(){return z(10,this)===3}set capability(e){U(10,3,this)}toString(){return`Type_AnyPointer_Unconstrained_`+super.toString()}which(){return z(10,this)}},Nr=class extends A{static _capnp={displayName:`parameter`,id:`9dd1f724f4614a85`,size:new S(24,1)};get scopeId(){return B(16,this)}set scopeId(e){W(16,e,this)}get parameterIndex(){return z(10,this)}set parameterIndex(e){U(10,e,this)}toString(){return`Type_AnyPointer_Parameter_`+super.toString()}},Pr=class extends A{static _capnp={displayName:`implicitMethodParameter`,id:`baefc9120c56e274`,size:new S(24,1)};get parameterIndex(){return z(10,this)}set parameterIndex(e){U(10,e,this)}toString(){return`Type_AnyPointer_ImplicitMethodParameter_`+super.toString()}};const Fr={UNCONSTRAINED:0,PARAMETER:1,IMPLICIT_METHOD_PARAMETER:2};var Ir=class extends A{static UNCONSTRAINED=Fr.UNCONSTRAINED;static PARAMETER=Fr.PARAMETER;static IMPLICIT_METHOD_PARAMETER=Fr.IMPLICIT_METHOD_PARAMETER;static _capnp={displayName:`anyPointer`,id:`c2573fe8a23e49f1`,size:new S(24,1)};get unconstrained(){return G(`unconstrained`,z(8,this),0,this),N(Mr,this)}_initUnconstrained(){return U(8,0,this),N(Mr,this)}get _isUnconstrained(){return z(8,this)===0}set unconstrained(e){U(8,0,this)}get parameter(){return G(`parameter`,z(8,this),1,this),N(Nr,this)}_initParameter(){return U(8,1,this),N(Nr,this)}get _isParameter(){return z(8,this)===1}set parameter(e){U(8,1,this)}get implicitMethodParameter(){return G(`implicitMethodParameter`,z(8,this),2,this),N(Pr,this)}_initImplicitMethodParameter(){return U(8,2,this),N(Pr,this)}get _isImplicitMethodParameter(){return z(8,this)===2}set implicitMethodParameter(e){U(8,2,this)}toString(){return`Type_AnyPointer_`+super.toString()}which(){return z(8,this)}};const J={VOID:0,BOOL:1,INT8:2,INT16:3,INT32:4,INT64:5,UINT8:6,UINT16:7,UINT32:8,UINT64:9,FLOAT32:10,FLOAT64:11,TEXT:12,DATA:13,LIST:14,ENUM:15,STRUCT:16,INTERFACE:17,ANY_POINTER:18};var Y=class extends A{static VOID=J.VOID;static BOOL=J.BOOL;static INT8=J.INT8;static INT16=J.INT16;static INT32=J.INT32;static INT64=J.INT64;static UINT8=J.UINT8;static UINT16=J.UINT16;static UINT32=J.UINT32;static UINT64=J.UINT64;static FLOAT32=J.FLOAT32;static FLOAT64=J.FLOAT64;static TEXT=J.TEXT;static DATA=J.DATA;static LIST=J.LIST;static ENUM=J.ENUM;static STRUCT=J.STRUCT;static INTERFACE=J.INTERFACE;static ANY_POINTER=J.ANY_POINTER;static _capnp={displayName:`Type`,id:`d07378ede1f9cc60`,size:new S(24,1)};get _isVoid(){return z(0,this)===0}set void(e){U(0,0,this)}get _isBool(){return z(0,this)===1}set bool(e){U(0,1,this)}get _isInt8(){return z(0,this)===2}set int8(e){U(0,2,this)}get _isInt16(){return z(0,this)===3}set int16(e){U(0,3,this)}get _isInt32(){return z(0,this)===4}set int32(e){U(0,4,this)}get _isInt64(){return z(0,this)===5}set int64(e){U(0,5,this)}get _isUint8(){return z(0,this)===6}set uint8(e){U(0,6,this)}get _isUint16(){return z(0,this)===7}set uint16(e){U(0,7,this)}get _isUint32(){return z(0,this)===8}set uint32(e){U(0,8,this)}get _isUint64(){return z(0,this)===9}set uint64(e){U(0,9,this)}get _isFloat32(){return z(0,this)===10}set float32(e){U(0,10,this)}get _isFloat64(){return z(0,this)===11}set float64(e){U(0,11,this)}get _isText(){return z(0,this)===12}set text(e){U(0,12,this)}get _isData(){return z(0,this)===13}set data(e){U(0,13,this)}get list(){return G(`list`,z(0,this),14,this),N(Dr,this)}_initList(){return U(0,14,this),N(Dr,this)}get _isList(){return z(0,this)===14}set list(e){U(0,14,this)}get enum(){return G(`enum`,z(0,this),15,this),N(Or,this)}_initEnum(){return U(0,15,this),N(Or,this)}get _isEnum(){return z(0,this)===15}set enum(e){U(0,15,this)}get struct(){return G(`struct`,z(0,this),16,this),N(kr,this)}_initStruct(){return U(0,16,this),N(kr,this)}get _isStruct(){return z(0,this)===16}set struct(e){U(0,16,this)}get interface(){return G(`interface`,z(0,this),17,this),N(Ar,this)}_initInterface(){return U(0,17,this),N(Ar,this)}get _isInterface(){return z(0,this)===17}set interface(e){U(0,17,this)}get anyPointer(){return G(`anyPointer`,z(0,this),18,this),N(Ir,this)}_initAnyPointer(){return U(0,18,this),N(Ir,this)}get _isAnyPointer(){return z(0,this)===18}set anyPointer(e){U(0,18,this)}toString(){return`Type_`+super.toString()}which(){return z(0,this)}};const Lr={BIND:0,INHERIT:1};var Rr=class e extends A{static BIND=Lr.BIND;static INHERIT=Lr.INHERIT;static _capnp={displayName:`Scope`,id:`abd73485a9636bc9`,size:new S(16,1)};static _Bind;get scopeId(){return B(0,this)}set scopeId(e){W(0,e,this)}_adoptBind(e){U(8,0,this),C(e,L(0,this))}_disownBind(){return w(this.bind)}get bind(){return G(`bind`,z(8,this),0,this),I(0,e._Bind,this)}_hasBind(){return!D(L(0,this))}_initBind(t){return U(8,0,this),V(0,e._Bind,t,this)}get _isBind(){return z(8,this)===0}set bind(e){U(8,0,this),T(e,L(0,this))}get _isInherit(){return z(8,this)===1}set inherit(e){U(8,1,this)}toString(){return`Brand_Scope_`+super.toString()}which(){return z(8,this)}};const zr={UNBOUND:0,TYPE:1};var Br=class extends A{static UNBOUND=zr.UNBOUND;static TYPE=zr.TYPE;static _capnp={displayName:`Binding`,id:`c863cd16969ee7fc`,size:new S(8,1)};get _isUnbound(){return z(0,this)===0}set unbound(e){U(0,0,this)}_adoptType(e){U(0,1,this),C(e,L(0,this))}_disownType(){return w(this.type)}get type(){return G(`type`,z(0,this),1,this),R(0,Y,this)}_hasType(){return!D(L(0,this))}_initType(){return U(0,1,this),M(0,Y,this)}get _isType(){return z(0,this)===1}set type(e){U(0,1,this),T(e,L(0,this))}toString(){return`Brand_Binding_`+super.toString()}which(){return z(0,this)}},Vr=class e extends A{static Scope=Rr;static Binding=Br;static _capnp={displayName:`Brand`,id:`903455f06065422b`,size:new S(0,1)};static _Scopes;_adoptScopes(e){C(e,L(0,this))}_disownScopes(){return w(this.scopes)}get scopes(){return I(0,e._Scopes,this)}_hasScopes(){return!D(L(0,this))}_initScopes(t){return V(0,e._Scopes,t,this)}set scopes(e){T(e,L(0,this))}toString(){return`Brand_`+super.toString()}};const X={VOID:0,BOOL:1,INT8:2,INT16:3,INT32:4,INT64:5,UINT8:6,UINT16:7,UINT32:8,UINT64:9,FLOAT32:10,FLOAT64:11,TEXT:12,DATA:13,LIST:14,ENUM:15,STRUCT:16,INTERFACE:17,ANY_POINTER:18};var Z=class extends A{static VOID=X.VOID;static BOOL=X.BOOL;static INT8=X.INT8;static INT16=X.INT16;static INT32=X.INT32;static INT64=X.INT64;static UINT8=X.UINT8;static UINT16=X.UINT16;static UINT32=X.UINT32;static UINT64=X.UINT64;static FLOAT32=X.FLOAT32;static FLOAT64=X.FLOAT64;static TEXT=X.TEXT;static DATA=X.DATA;static LIST=X.LIST;static ENUM=X.ENUM;static STRUCT=X.STRUCT;static INTERFACE=X.INTERFACE;static ANY_POINTER=X.ANY_POINTER;static _capnp={displayName:`Value`,id:`ce23dcd2d7b00c9b`,size:new S(16,1)};get _isVoid(){return z(0,this)===0}set void(e){U(0,0,this)}get bool(){return G(`bool`,z(0,this),1,this),P(16,this)}get _isBool(){return z(0,this)===1}set bool(e){U(0,1,this),H(16,e,this)}get int8(){return G(`int8`,z(0,this),2,this),Hn(2,this)}get _isInt8(){return z(0,this)===2}set int8(e){U(0,2,this),tr(2,e,this)}get int16(){return G(`int16`,z(0,this),3,this),zn(2,this)}get _isInt16(){return z(0,this)===3}set int16(e){U(0,3,this),Qn(2,e,this)}get int32(){return G(`int32`,z(0,this),4,this),Bn(4,this)}get _isInt32(){return z(0,this)===4}set int32(e){U(0,4,this),$n(4,e,this)}get int64(){return G(`int64`,z(0,this),5,this),Vn(8,this)}get _isInt64(){return z(0,this)===5}set int64(e){U(0,5,this),er(8,e,this)}get uint8(){return G(`uint8`,z(0,this),6,this),Jn(2,this)}get _isUint8(){return z(0,this)===6}set uint8(e){U(0,6,this),ir(2,e,this)}get uint16(){return G(`uint16`,z(0,this),7,this),z(2,this)}get _isUint16(){return z(0,this)===7}set uint16(e){U(0,7,this),U(2,e,this)}get uint32(){return G(`uint32`,z(0,this),8,this),qn(4,this)}get _isUint32(){return z(0,this)===8}set uint32(e){U(0,8,this),rr(4,e,this)}get uint64(){return G(`uint64`,z(0,this),9,this),B(8,this)}get _isUint64(){return z(0,this)===9}set uint64(e){U(0,9,this),W(8,e,this)}get float32(){return G(`float32`,z(0,this),10,this),Ln(4,this)}get _isFloat32(){return z(0,this)===10}set float32(e){U(0,10,this),Xn(4,e,this)}get float64(){return G(`float64`,z(0,this),11,this),Rn(8,this)}get _isFloat64(){return z(0,this)===11}set float64(e){U(0,11,this),Zn(8,e,this)}get text(){return G(`text`,z(0,this),12,this),Kn(0,this)}get _isText(){return z(0,this)===12}set text(e){U(0,12,this),nr(0,e,this)}_adoptData(e){U(0,13,this),C(e,L(0,this))}_disownData(){return w(this.data)}get data(){return G(`data`,z(0,this),13,this),In(0,this)}_hasData(){return!D(L(0,this))}_initData(e){return U(0,13,this),Yn(0,e,this)}get _isData(){return z(0,this)===13}set data(e){U(0,13,this),T(e,L(0,this))}_adoptList(e){U(0,14,this),C(e,L(0,this))}_disownList(){return w(this.list)}get list(){return G(`list`,z(0,this),14,this),L(0,this)}_hasList(){return!D(L(0,this))}get _isList(){return z(0,this)===14}set list(e){U(0,14,this),T(e,L(0,this))}get enum(){return G(`enum`,z(0,this),15,this),z(2,this)}get _isEnum(){return z(0,this)===15}set enum(e){U(0,15,this),U(2,e,this)}_adoptStruct(e){U(0,16,this),C(e,L(0,this))}_disownStruct(){return w(this.struct)}get struct(){return G(`struct`,z(0,this),16,this),L(0,this)}_hasStruct(){return!D(L(0,this))}get _isStruct(){return z(0,this)===16}set struct(e){U(0,16,this),T(e,L(0,this))}get _isInterface(){return z(0,this)===17}set interface(e){U(0,17,this)}_adoptAnyPointer(e){U(0,18,this),C(e,L(0,this))}_disownAnyPointer(){return w(this.anyPointer)}get anyPointer(){return G(`anyPointer`,z(0,this),18,this),L(0,this)}_hasAnyPointer(){return!D(L(0,this))}get _isAnyPointer(){return z(0,this)===18}set anyPointer(e){U(0,18,this),T(e,L(0,this))}toString(){return`Value_`+super.toString()}which(){return z(0,this)}},Hr=class extends A{static _capnp={displayName:`Annotation`,id:`f1c8950dab257542`,size:new S(8,2)};get id(){return B(0,this)}set id(e){W(0,e,this)}_adoptBrand(e){C(e,L(1,this))}_disownBrand(){return w(this.brand)}get brand(){return R(1,Vr,this)}_hasBrand(){return!D(L(1,this))}_initBrand(){return M(1,Vr,this)}set brand(e){T(e,L(1,this))}_adoptValue(e){C(e,L(0,this))}_disownValue(){return w(this.value)}get value(){return R(0,Z,this)}_hasValue(){return!D(L(0,this))}_initValue(){return M(0,Z,this)}set value(e){T(e,L(0,this))}toString(){return`Annotation_`+super.toString()}};const Ur={EMPTY:0,BIT:1,BYTE:2,TWO_BYTES:3,FOUR_BYTES:4,EIGHT_BYTES:5,POINTER:6,INLINE_COMPOSITE:7};var Wr=class extends A{static _capnp={displayName:`CapnpVersion`,id:`d85d305b7d839963`,size:new S(8,0)};get major(){return z(0,this)}set major(e){U(0,e,this)}get minor(){return Jn(2,this)}set minor(e){ir(2,e,this)}get micro(){return Jn(3,this)}set micro(e){ir(3,e,this)}toString(){return`CapnpVersion_`+super.toString()}},Gr=class extends A{static _capnp={displayName:`Import`,id:`ae504193122357e5`,size:new S(8,1)};get id(){return B(0,this)}set id(e){W(0,e,this)}get name(){return Kn(0,this)}set name(e){nr(0,e,this)}toString(){return`CodeGeneratorRequest_RequestedFile_Import_`+super.toString()}},Kr=class e extends A{static Import=Gr;static _capnp={displayName:`RequestedFile`,id:`cfea0eb02e810062`,size:new S(8,2)};static _Imports;get id(){return B(0,this)}set id(e){W(0,e,this)}get filename(){return Kn(0,this)}set filename(e){nr(0,e,this)}_adoptImports(e){C(e,L(1,this))}_disownImports(){return w(this.imports)}get imports(){return I(1,e._Imports,this)}_hasImports(){return!D(L(1,this))}_initImports(t){return V(1,e._Imports,t,this)}set imports(e){T(e,L(1,this))}toString(){return`CodeGeneratorRequest_RequestedFile_`+super.toString()}},qr=class e extends A{static RequestedFile=Kr;static _capnp={displayName:`CodeGeneratorRequest`,id:`bfc546f6210ad7ce`,size:new S(0,4)};static _Nodes;static _SourceInfo;static _RequestedFiles;_adoptCapnpVersion(e){C(e,L(2,this))}_disownCapnpVersion(){return w(this.capnpVersion)}get capnpVersion(){return R(2,Wr,this)}_hasCapnpVersion(){return!D(L(2,this))}_initCapnpVersion(){return M(2,Wr,this)}set capnpVersion(e){T(e,L(2,this))}_adoptNodes(e){C(e,L(0,this))}_disownNodes(){return w(this.nodes)}get nodes(){return I(0,e._Nodes,this)}_hasNodes(){return!D(L(0,this))}_initNodes(t){return V(0,e._Nodes,t,this)}set nodes(e){T(e,L(0,this))}_adoptSourceInfo(e){C(e,L(3,this))}_disownSourceInfo(){return w(this.sourceInfo)}get sourceInfo(){return I(3,e._SourceInfo,this)}_hasSourceInfo(){return!D(L(3,this))}_initSourceInfo(t){return V(3,e._SourceInfo,t,this)}set sourceInfo(e){T(e,L(3,this))}_adoptRequestedFiles(e){C(e,L(1,this))}_disownRequestedFiles(){return w(this.requestedFiles)}get requestedFiles(){return I(1,e._RequestedFiles,this)}_hasRequestedFiles(){return!D(L(1,this))}_initRequestedFiles(t){return V(1,e._RequestedFiles,t,this)}set requestedFiles(e){T(e,L(1,this))}toString(){return`CodeGeneratorRequest_`+super.toString()}};ur._Members=q(lr),dr._Fields=q(Cr),fr._Enumerants=q(wr),pr._Methods=q(Er),pr._Superclasses=q(Tr),_r._Parameters=q(sr),_r._NestedNodes=q(cr),_r._Annotations=q(Hr),Cr._Annotations=q(Hr),wr._Annotations=q(Hr),Er._ImplicitParameters=q(sr),Er._Annotations=q(Hr),Rr._Bind=q(Br),Vr._Scopes=q(Rr),Kr._Imports=q(Gr),qr._Nodes=q(_r),qr._SourceInfo=q(ur),qr._RequestedFiles=q(Kr);var Jr=(e=>(e[e.SINGLE_SEGMENT=0]=`SINGLE_SEGMENT`,e[e.MULTI_SEGMENT=1]=`MULTI_SEGMENT`,e))(Jr||{}),Yr=class{buffer;id;constructor(e,t){this.id=e,this.buffer=t}},Xr=class{constructor(e=[new ArrayBuffer(_t)]){this.buffers=e;let t=e.length;for(;--t>=0;)if(e[t].byteLength&7)throw Error(x(kt,e[t].byteLength))}static allocate=Zr;static getBuffer=Qr;static getNumSegments=$r;kind=Jr.MULTI_SEGMENT;toString(){return x(`MultiSegmentArena_segments:%d`,$r(this))}};function Zr(e,t){let n=new ArrayBuffer(It(Math.max(e,_t)));return t.buffers.push(n),new Yr(t.buffers.length-1,n)}function Qr(e,t){if(e<0||e>=t.buffers.length)throw Error(x(`CAPNP-TS036 Attempted to get an out-of-bounds segment (%d).`,e));return t.buffers[e]}function $r(e){return e.buffers.length}var ei=class{static allocate=ti;static getBuffer=ni;static getNumSegments=ri;buffer;kind=Jr.SINGLE_SEGMENT;constructor(e=new ArrayBuffer(_t)){if(e.byteLength&7)throw Error(x(kt,e.byteLength));this.buffer=e}toString(){return x(`SingleSegmentArena_len:%x`,this.buffer.byteLength)}};function ti(e,t,n){let r=t.length>0?t[0].buffer:n.buffer;return e=e<yt?yt:It(e),n.buffer=new ArrayBuffer(r.byteLength+e),new Float64Array(n.buffer).set(new Float64Array(r)),new Yr(0,n.buffer)}function ni(e,t){if(e!==0)throw Error(x(`CAPNP-TS035 Attempted to get a segment other than 0 (%d) from a single segment arena.`,e));return t.buffer}function ri(){return 1}var ii=class{static allocate=ai;static copy=oi;static getBuffer=si;static getNumSegments=ci};function ai(e,t,n){switch(n.kind){case Jr.MULTI_SEGMENT:return Xr.allocate(e,n);case Jr.SINGLE_SEGMENT:return ei.allocate(e,t,n);default:return St(n)}}function oi(e){switch(e.kind){case Jr.MULTI_SEGMENT:{let t=e.buffers.length,n=Array.from({length:t});for(;--t>=0;)n[t]=e.buffers[t].slice(0);return new Xr(n)}case Jr.SINGLE_SEGMENT:return new ei(e.buffer.slice(0));default:return St(e)}}function si(e,t){switch(t.kind){case Jr.MULTI_SEGMENT:return Xr.getBuffer(e,t);case Jr.SINGLE_SEGMENT:return ei.getBuffer(e,t);default:return St(t)}}function ci(e){switch(e.kind){case Jr.MULTI_SEGMENT:return Xr.getNumSegments(e);case Jr.SINGLE_SEGMENT:return ei.getNumSegments();default:return St(e)}}function li(e){let t=e-(e>>1&1431655765);return t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}function ui(e,t,n,r,i,a,o,s){return(e===0?0:1)|(t===0?0:2)|(n===0?0:4)|(r===0?0:8)|(i===0?0:16)|(a===0?0:32)|(o===0?0:64)|(s===0?0:128)}function di(e){let t=new Uint8Array(e),n=0,r=119;for(let e=0;e<t.byteLength;){let i=t[e];r===0?(n+=i,e++,r=119):r===255?(n+=i,e+=i*8+1,r=119):(n++,e+=li(i)+1,r=i)}return n*8}function fi(e,t,n,r,i,a,o,s){return(e===0?1:0)+(t===0?1:0)+(n===0?1:0)+(r===0?1:0)+(i===0?1:0)+(a===0?1:0)+(o===0?1:0)+(s===0?1:0)}function pi(e,t=0,n){if(e.byteLength%8!=0)throw Error(`CAPNP-TS003 Attempted to pack a message that was not word-aligned.`);let r=new Uint8Array(e,t,n),i=[],a=119,o=0,s=0;for(let e=0;e<r.byteLength;e+=8){let t=r[e],n=r[e+1],c=r[e+2],l=r[e+3],u=r[e+4],d=r[e+5],f=r[e+6],p=r[e+7],m=ui(t,n,c,l,u,d,f,p),ee=!0;switch(a){case 0:m!==0||s>=255?(i.push(s),s=0,ee=!1):s++;break;case 255:fi(t,n,c,l,u,d,f,p)>=2||s>=255?(i[o]=s,s=0,ee=!1):(i.push(t,n,c,l,u,d,f,p),s++);break;default:ee=!1;break}ee||(i.push(m),a=m,t!==0&&i.push(t),n!==0&&i.push(n),c!==0&&i.push(c),l!==0&&i.push(l),u!==0&&i.push(u),d!==0&&i.push(d),f!==0&&i.push(f),p!==0&&i.push(p),m===255&&(o=i.length,i.push(0)))}return a===0?i.push(s):a===255&&(i[o]=s),new Uint8Array(i).buffer}function mi(e){let t=new Uint8Array(e),n=new Uint8Array(new ArrayBuffer(di(e))),r=119;for(let e=0,i=0;e<t.byteLength;){let a=t[e];if(r===0)i+=a*8,e++,r=119;else if(r===255){let o=a*8;n.set(t.subarray(e+1,e+1+o),i),i+=o,e+=1+o,r=119}else{e++;for(let r=1;r<=128;r<<=1)(a&r)!==0&&(n[i]=t[e++]),i++;r=a}}return n.buffer}var hi=class{constructor(e,t,n,r=0){this.id=e,this.message=t,this.message=t,this.buffer=n,this._dv=new DataView(n),this.byteOffset=0,this.byteLength=r}buffer;byteLength;byteOffset;[Symbol.toStringTag]=`Segment`;_dv;allocate(e){let t=this;if(e=It(e),e>xt-8)throw Error(x(At,e));t.hasCapacity(e)||(t=t.message.allocateSegment(e));let n=t.byteLength;return t.byteLength+=e,new k(t,n)}copyWord(e,t,n){let r=t._dv.getFloat64(n,b);this._dv.setFloat64(e,r,b)}copyWords(e,t,n,r){let i=new Float64Array(this.buffer,e,r),a=new Float64Array(t.buffer,n,r);i.set(a)}fillZeroWords(e,t){new Float64Array(this.buffer,e,t).fill(0)}getBigInt64(e,t){return this._dv.getBigInt64(e,t)}getBigUint64(e,t){return this._dv.getBigUint64(e,t)}getCapacity(){return this.buffer.byteLength}getFloat32(e){return this._dv.getFloat32(e,!0)}getFloat64(e){return this._dv.getFloat64(e,!0)}getInt16(e){return this._dv.getInt16(e,!0)}getInt32(e){return this._dv.getInt32(e,!0)}getInt64(e){return this._dv.getBigInt64(e,!0)}getInt8(e){return this._dv.getInt8(e)}getUint16(e){return this._dv.getUint16(e,!0)}getUint32(e){return this._dv.getUint32(e,!0)}getUint64(e){return this._dv.getBigUint64(e,!0)}getUint8(e){return this._dv.getUint8(e)}hasCapacity(e){return this.buffer.byteLength-this.byteLength>=e}isWordZero(e){return this._dv.getFloat64(e,b)===0}replaceBuffer(e){if(this.buffer!==e){if(e.byteLength<this.byteLength)throw Error(`CAPNP-TS038 Attempted to replace a segment buffer with one that is smaller than the allocated space.`);this._dv=new DataView(e),this.buffer=e}}setBigInt64(e,t,n){this._dv.setBigInt64(e,t,n)}setBigUint64(e,t,n){this._dv.setBigUint64(e,t,n)}setFloat32(e,t){this._dv.setFloat32(e,t,!0)}setFloat64(e,t){this._dv.setFloat64(e,t,!0)}setInt16(e,t){this._dv.setInt16(e,t,!0)}setInt32(e,t){this._dv.setInt32(e,t,!0)}setInt8(e,t){this._dv.setInt8(e,t)}setInt64(e,t){this._dv.setBigInt64(e,t,!0)}setUint16(e,t){this._dv.setUint16(e,t,!0)}setUint32(e,t){this._dv.setUint32(e,t,!0)}setUint64(e,t){this._dv.setBigUint64(e,t,!0)}setUint8(e,t){this._dv.setUint8(e,t)}setWordZero(e){this._dv.setFloat64(e,0,b)}toString(){return x(`Segment_id:%d,off:%a,len:%a,cap:%a`,this.id,this.byteLength,this.byteOffset,this.buffer.byteLength)}},gi=class{static allocateSegment=Si;static dump=Ci;static getRoot=wi;static getSegment=Ti;static initRoot=Ei;static readRawPointer=Di;static toArrayBuffer=ki;static toPackedArrayBuffer=Ai;_capnp;constructor(e,t=!0,n=!1){this._capnp=_i(e,t,n),e&&yi(this)}allocateSegment(e){return Si(e,this)}copy(){return Mi(this)}dump(){return Ci(this)}getRoot(e){return wi(e,this)}getSegment(e){return Ti(e,this)}initRoot(e){return Ei(e,this)}setRoot(e){Oi(e,this)}toArrayBuffer(){return ki(this)}toPackedArrayBuffer(){return Ai(this)}addCap(e){this._capnp.capTable||(this._capnp.capTable=[]);let t=this._capnp.capTable.length;return this._capnp.capTable.push(e),t}toString(){return`Message_arena:${this._capnp.arena}`}};function _i(e,t=!0,n=!1){if(e===void 0)return{arena:new ei,segments:[],traversalLimit:vt};if(xi(e))return{arena:e,segments:[],traversalLimit:vt};let r=e;return bi(r)&&(r=r.buffer.slice(r.byteOffset,r.byteOffset+r.byteLength)),t&&(r=mi(r)),n?{arena:new ei(r),segments:[],traversalLimit:vt}:{arena:new Xr(vi(r)),segments:[],traversalLimit:vt}}function vi(e){let t=new DataView(e),n=t.getUint32(0,!0)+1,r=Array.from({length:n}),i=4+n*4;if(i+=i%8,i+n*4>e.byteLength)throw Error(Ct);for(let a=0;a<n;a++){let n=t.getUint32(4+a*4,!0)*8;if(i+n>e.byteLength)throw Error(Ct);r[a]=e.slice(i,i+n),i+=n}return r}function yi(e){let t=ii.getNumSegments(e._capnp.arena);e._capnp.segments=Array.from({length:t});for(let n=0;n<t;n++){if(n===0&&ii.getBuffer(n,e._capnp.arena).byteLength<8)throw Error(Tt);let t=ii.getBuffer(n,e._capnp.arena),r=new hi(n,e,t,t.byteLength);e._capnp.segments[n]=r}}function bi(e){return e.byteOffset!==void 0}function xi(e){return e.kind!==void 0}function Si(e,t){let n=ii.allocate(e,t._capnp.segments,t._capnp.arena),r;if(n.id===t._capnp.segments.length)r=new hi(n.id,t,n.buffer),t._capnp.segments.push(r);else if(n.id<0||n.id>t._capnp.segments.length)throw Error(x(wt,n.id,t));else r=t._capnp.segments[n.id],r.replaceBuffer(n.buffer);return r}function Ci(e){let t=``;if(e._capnp.segments.length===0)return`================
|
|
51
|
+
No Segments
|
|
52
|
+
================
|
|
53
|
+
`;for(let n=0;n<e._capnp.segments.length;n++){t+=`================
|
|
54
|
+
Segment #${n}
|
|
55
|
+
================
|
|
56
|
+
`;let{buffer:r,byteLength:i}=e._capnp.segments[n],a=new Uint8Array(r,0,i);t+=Pt(a)}return t}function wi(e,t){let n=new e(t.getSegment(0),0);bn(O.STRUCT,n);let r=fn(n);return(r.dataByteLength<e._capnp.size.dataByteLength||r.pointerLength<e._capnp.size.pointerLength)&&Fn(e._capnp.size,n),n}function Ti(e,t){let n=t._capnp.segments.length;if(e===0&&n===0){if(ii.getNumSegments(t._capnp.arena)===0?Si(_t,t):t._capnp.segments[0]=new hi(0,t,ii.getBuffer(0,t._capnp.arena)),!t._capnp.segments[0].hasCapacity(8))throw Error(Tt);return t._capnp.segments[0].allocate(8),t._capnp.segments[0]}if(e<0||e>=n)throw Error(x(wt,e,t));return t._capnp.segments[e]}function Ei(e,t){let n=new e(t.getSegment(0),0);return Nn(e._capnp.size,n),n}function Di(e){return new k(new gi(e).getSegment(0),0)}function Oi(e,t){T(e,new k(t.getSegment(0),0))}function ki(e){let t=ji(e);e._capnp.segments.length===0&&Ti(0,e);let{segments:n}=e._capnp,r=t.byteLength+n.reduce((e,t)=>e+It(t.byteLength),0),i=new Uint8Array(new ArrayBuffer(r)),a=t.byteLength;i.set(new Uint8Array(t));for(let e of n){let t=It(e.byteLength);i.set(new Uint8Array(e.buffer,0,t),a),a+=t}return i.buffer}function Ai(e){let t=pi(ji(e));e._capnp.segments.length===0&&e.getSegment(0);let n=e._capnp.segments.map(e=>pi(e.buffer,0,It(e.byteLength))),r=t.byteLength+n.reduce((e,t)=>e+t.byteLength,0),i=new Uint8Array(new ArrayBuffer(r)),a=t.byteLength;i.set(new Uint8Array(t));for(let e of n)i.set(new Uint8Array(e),a),a+=e.byteLength;return i.buffer}function ji(e){let{length:t}=e._capnp.segments;if(t===0)return new Float64Array(1).buffer;let n=4+t*4+(1-t%2)*4,r=new DataView(new ArrayBuffer(n));r.setUint32(0,t-1,!0);for(let[t,n]of e._capnp.segments.entries())r.setUint32(t*4+4,n.byteLength/8,!0);return r.buffer}function Mi(e){return new gi(ii.copy(e._capnp.arena))}const Ni=`CAPNP-ES005 Don't know how to generate a struct field of kind %d.`,Pi={[Y.ANY_POINTER]:`$.AnyPointerList`,[Y.BOOL]:`$.BoolList`,[Y.DATA]:`$.DataList`,[Y.ENUM]:`$.Uint16List`,[Y.FLOAT32]:`$.Float32List`,[Y.FLOAT64]:`$.Float64List`,[Y.INT16]:`$.Int16List`,[Y.INT32]:`$.Int32List`,[Y.INT64]:`$.Int64List`,[Y.INT8]:`$.Int8List`,[Y.INTERFACE]:`$.InterfaceList`,[Y.LIST]:`$.PointerList`,[Y.STRUCT]:`$.CompositeList`,[Y.TEXT]:`$.TextList`,[Y.UINT16]:`$.Uint16List`,[Y.UINT32]:`$.Uint32List`,[Y.UINT64]:`$.Uint64List`,[Y.UINT8]:`$.Uint8List`,[Y.VOID]:`$.VoidList`},Fi={[Y.BOOL]:{byteLength:1,getter:`getBit`,mask:`getBitMask`,setter:`setBit`},[Y.ENUM]:{byteLength:2,getter:`getUint16`,mask:`getUint16Mask`,setter:`setUint16`},[Y.FLOAT32]:{byteLength:4,getter:`getFloat32`,mask:`getFloat32Mask`,setter:`setFloat32`},[Y.FLOAT64]:{byteLength:8,getter:`getFloat64`,mask:`getFloat64Mask`,setter:`setFloat64`},[Y.INT16]:{byteLength:2,getter:`getInt16`,mask:`getInt16Mask`,setter:`setInt16`},[Y.INT32]:{byteLength:4,getter:`getInt32`,mask:`getInt32Mask`,setter:`setInt32`},[Y.INT64]:{byteLength:8,getter:`getInt64`,mask:`getInt64Mask`,setter:`setInt64`},[Y.INT8]:{byteLength:1,getter:`getInt8`,mask:`getInt8Mask`,setter:`setInt8`},[Y.UINT16]:{byteLength:2,getter:`getUint16`,mask:`getUint16Mask`,setter:`setUint16`},[Y.UINT32]:{byteLength:4,getter:`getUint32`,mask:`getUint32Mask`,setter:`setUint32`},[Y.UINT64]:{byteLength:8,getter:`getUint64`,mask:`getUint64Mask`,setter:`setUint64`},[Y.UINT8]:{byteLength:1,getter:`getUint8`,mask:`getUint8Mask`,setter:`setUint8`},[Y.VOID]:{byteLength:0,getter:`getVoid`,mask:`getVoidMask`,setter:`setVoid`}};var Ii,Li;function Ri(){if(Li)return Ii;Li=1;function e(e,t,n){for(var r=[],i=Math.max(e.length,t.length),a=0,o=0;o<i||a;){var s=o<e.length?e[o]:0,c=o<t.length?t[o]:0,l=a+s+c;r.push(l%n),a=Math.floor(l/n),o++}return r}function t(t,n,r){if(t<0)return null;if(t==0)return[];for(var i=[],a=n;t&1&&(i=e(i,a,r)),t>>=1,t!==0;)a=e(a,a,r);return i}function n(e,t){for(var n=e.split(``),r=[],i=n.length-1;i>=0;i--){var a=parseInt(n[i],t);if(isNaN(a))return null;r.push(a)}return r}function r(r,i,a){var o=n(r,i);if(o===null)return null;for(var s=[],c=[1],l=0;l<o.length;l++)o[l]&&(s=e(s,t(o[l],c,a),a)),c=t(i,c,a);for(var u=``,l=s.length-1;l>=0;l--)u+=s[l].toString(a);return u===``&&(u=`0`),u}function i(e,t){var n=t&&t.prefix===!1,i=r(e,10,16);return i?n?i:`0x`+i:null}function a(e){return e.substring(0,2)===`0x`&&(e=e.substring(2)),e=e.toLowerCase(),r(e,16,10)}return Ii={hexToDec:a,decToHex:i},Ii}var zi=Ri();function Bi(e){return Hi(e).map(e=>e.toUpperCase()).join(`_`)}function Vi(e){return e[0].toUpperCase()+e.slice(1)}function Hi(e){let t=!1;return e.split(``).reduce((e,n)=>{let r=n.toUpperCase()!==n,i=n.toLowerCase()!==n;if(e.length===0||t&&i)e.push(n);else{let t=e.length-1;e[t]=e[t]+n}return t=r,e},[])}function Ui(e){return BigInt(zi.hexToDec(e))}function Wi(e,t){return e.codeOrder-t.codeOrder}function Gi(e,t){if(!t._isList)return qi(e,t,!1);let{elementType:n}=t.list,r=n.which();if(r===Y.LIST)return`$.PointerList(${Gi(e,n)})`;if(r===Y.STRUCT){if($(e,n.struct.typeId).struct.preferredListEncoding!==Ur.INLINE_COMPOSITE)throw Error(`CAPNP-ES001 Don't know how to generate non-inline struct lists.`);return`$.CompositeList(${qi(e,n,!1)})`}return Pi[r]}function Ki(e){return e.displayName.slice(e.displayNamePrefixLength)}function Q(e){return e.displayName.split(`:`)[1].split(`.`).map(e=>Vi(e)).join(`_`)}function qi(e,t,n){let r=t.which();switch(r){case Y.ANY_POINTER:return`$.Pointer`;case Y.BOOL:return`boolean`;case Y.DATA:return`$.Data`;case Y.ENUM:return Q($(e,t.enum.typeId));case Y.FLOAT32:case Y.FLOAT64:case Y.INT16:case Y.INT32:case Y.INT8:case Y.UINT16:case Y.UINT32:case Y.UINT8:return`number`;case Y.UINT64:case Y.INT64:return`bigint`;case Y.INTERFACE:return Q($(e,t.interface.typeId));case Y.LIST:return`$.List${n?`Ctor`:``}<${qi(e,t.list.elementType,!1)}>`;case Y.STRUCT:{let r=Q($(e,t.struct.typeId));return n?`$.StructCtor<${r}>`:r}case Y.TEXT:return`string`;case Y.VOID:return`$.Void`;default:throw Error(x(`CAPNP-ES006 Unknown slot type encountered: %d`,r))}}function Ji(e){return e.struct.fields.filter(e=>e.discriminantValue!==Cr.NO_DISCRIMINANT)}function Yi(e,t){let n=typeof t==`bigint`?t:t.id;return e.nodes.some(e=>e.id===n)}function Xi(e,t){let n=new va(e,t);return n.tsPath=$(n,t.id).displayName.replace(/\.capnp$/,``)+`.ts`,n}function $(e,t){let n=typeof t==`bigint`?t:t.id,r=e.nodes.find(e=>e.id===n);if(r===void 0)throw Error(x(`CAPNP-ES002 Failed to look up node id %s.`,n));return r}function Zi(e,t){let n=typeof t==`bigint`?t:t.id;return e.req.sourceInfo.find(e=>e.id===n)}function Qi(e){if(!e._isSlot)return!1;let t=e.slot.type;if(!t._isList)return!1;let{elementType:n}=t.list;return n._isStruct||n._isList}function $i(e){let t=e.toString(16),n=``;return t[0]===`-`&&(t=t.slice(1),n=`-`),`${n}BigInt("0x${t}")`}function ea(e){let t=e?.docComment;return t?`/**
|
|
57
|
+
`+t.toString().split(`
|
|
58
|
+
`).map(e=>`* ${e}`).join(`
|
|
59
|
+
`)+`
|
|
60
|
+
*/`:``}function ta(e,t,n,r){let i=r.map(({codeOrder:e},t)=>({fieldIndex:t,codeOrder:e})).sort(Wi).map(({fieldIndex:e})=>e),a=Zi(e,n),o=i.map(e=>{let t=r[e];return`
|
|
61
|
+
${ea(a?.members.at(e))}
|
|
62
|
+
${Bi(t.name)}: ${t.discriminantValue||e}`});e.codeParts.push(`
|
|
63
|
+
export const ${t} = {
|
|
64
|
+
${o.join(`,
|
|
65
|
+
`)}
|
|
66
|
+
} as const;
|
|
67
|
+
|
|
68
|
+
export type ${t} = (typeof ${t})[keyof typeof ${t}];
|
|
69
|
+
`)}function na(e,t){ra(e,t),aa(e,t),ia(e,t)}function ra(e,t){for(let n of t.interface.methods){let t=$(e,n.paramStructType),r=$(e,n.resultStructType);ga(e,t),ga(e,r),oa(e,r)}}function ia(e,t){let n=Q(t),r=`${n}$Server`,i=`${r}$Target`,a=`${n}$Client`,o=t.interface.methods.map(t=>{let n=Q($(e,t.paramStructType)),r=Q($(e,t.resultStructType));return`${t.name}(params: ${n}, results: ${r}): Promise<void>;`}).join(`
|
|
70
|
+
`);e.codeParts.push(`
|
|
71
|
+
export interface ${i} {
|
|
72
|
+
${o}
|
|
73
|
+
}`);let s=[];s.push(`public override readonly target: ${i};`);let c=[],l=0;for(let e of t.interface.methods)c.push(`{
|
|
74
|
+
...${a}.methods[${l}],
|
|
75
|
+
impl: target.${e.name}
|
|
76
|
+
}`),l++;s.push(`
|
|
77
|
+
constructor(target: ${i}) {
|
|
78
|
+
super(target, [
|
|
79
|
+
${c.join(`,
|
|
80
|
+
`)}
|
|
81
|
+
]);
|
|
82
|
+
this.target = target;
|
|
83
|
+
}
|
|
84
|
+
client(): ${a} {
|
|
85
|
+
return new ${a}(this);
|
|
86
|
+
}
|
|
87
|
+
`),e.codeParts.push(`
|
|
88
|
+
export class ${r} extends $.Server {
|
|
89
|
+
${s.join(`
|
|
90
|
+
`)}
|
|
91
|
+
}
|
|
92
|
+
`)}function aa(e,t){let n=`${Q(t)}$Client`,r=[];r.push(`
|
|
93
|
+
client: $.Client;
|
|
94
|
+
static readonly interfaceId: bigint = ${$i(t.id)};
|
|
95
|
+
constructor(client: $.Client) {
|
|
96
|
+
this.client = client;
|
|
97
|
+
}
|
|
98
|
+
`);let i=[],a=[],o=[];for(let r=0;r<t.interface.methods.length;r++)sa(e,t,n,i,a,o,r);r.push(`
|
|
99
|
+
static readonly methods:[
|
|
100
|
+
${o.join(`,
|
|
101
|
+
`)}
|
|
102
|
+
] = [
|
|
103
|
+
${a.join(`,
|
|
104
|
+
`)}
|
|
105
|
+
];
|
|
106
|
+
${i.join(`
|
|
107
|
+
`)}
|
|
108
|
+
`),e.codeParts.push(`
|
|
109
|
+
export class ${n} {
|
|
110
|
+
${r.join(`
|
|
111
|
+
`)}
|
|
112
|
+
}
|
|
113
|
+
$.Registry.register(${n}.interfaceId, ${n});
|
|
114
|
+
`)}function oa(e,t){let n=t.id;if(e.generatedResultsPromiseIds.has(n))return;e.generatedResultsPromiseIds.add(n);let r=Q(t),i=`${r}$Promise`,a=[];a.push(`
|
|
115
|
+
pipeline: $.Pipeline<any, any, ${r}>;
|
|
116
|
+
constructor(pipeline: $.Pipeline<any, any, ${r}>) {
|
|
117
|
+
this.pipeline = pipeline;
|
|
118
|
+
}
|
|
119
|
+
`);let{struct:o}=t,s=o.fields.toArray().sort(Wi),c=t=>{let n,r=!1,i;if(t._isSlot){i=t.slot;let a=i.type;if(a.which()!==Y.INTERFACE)return;r=!0,n=qi(e,a,!1)}else if(t._isGroup)return;else throw Error(x(Ni,t.which()));let o=n;r&&(n=`${n}$Client`);let{name:s}=t,c=Vi(s);a.push(`
|
|
120
|
+
get${c}(): ${n} {
|
|
121
|
+
return new ${n}(this.pipeline.getPipeline(${o}, ${i.offset}).client());
|
|
122
|
+
}
|
|
123
|
+
`)};for(let e of s)c(e);a.push(`
|
|
124
|
+
async promise(): Promise<${r}> {
|
|
125
|
+
return await this.pipeline.struct();
|
|
126
|
+
}
|
|
127
|
+
`),e.codeParts.push(`
|
|
128
|
+
export class ${i} {
|
|
129
|
+
${a.join(`
|
|
130
|
+
`)}
|
|
131
|
+
}
|
|
132
|
+
`)}function sa(e,t,n,r,i,a,o){let s=t.interface.methods[o],{name:c}=s,l=Q($(e,s.paramStructType)),u=Q($(e,s.resultStructType));a.push(`$.Method<${l}, ${u}>`),i.push(`{
|
|
133
|
+
ParamsClass: ${l},
|
|
134
|
+
ResultsClass: ${u},
|
|
135
|
+
interfaceId: ${n}.interfaceId,
|
|
136
|
+
methodId: ${o},
|
|
137
|
+
interfaceName: "${t.displayName}",
|
|
138
|
+
methodName: "${s.name}"
|
|
139
|
+
}`);let d=ea(Zi(e,t)?.members.at(o));r.push(`
|
|
140
|
+
${d}
|
|
141
|
+
${c}(paramsFunc?: (params: ${l}) => void): ${u}$Promise {
|
|
142
|
+
const answer = this.client.call({
|
|
143
|
+
method: ${n}.methods[${o}],
|
|
144
|
+
paramsFunc: paramsFunc
|
|
145
|
+
});
|
|
146
|
+
const pipeline = new $.Pipeline(${u}, answer);
|
|
147
|
+
return new ${u}$Promise(pipeline);
|
|
148
|
+
}
|
|
149
|
+
`)}function ca(e,t){let n=Ki(t),r=Q(t),i=t.nestedNodes.map(({id:t})=>$(e,t)).filter(e=>!e._isConst&&!e._isAnnotation),a=t.id,o=a.toString(16),s=Ji(t),{struct:c}=t,{dataWordCount:l,discriminantCount:u,discriminantOffset:d,pointerCount:f}=c,p=l*8,m=c.fields.toArray(),ee=m.map(({codeOrder:e},t)=>({fieldIndex:t,codeOrder:e})).sort(Wi).map(({fieldIndex:e})=>e),h=m.filter(e=>Qi(e)).sort(Wi),te=e.nodes.filter(e=>e.scopeId===a&&e._isConst),ne=u!==0;ne&&ta(e,r+`_Which`,t,s);let re=[];re.push(...te.map(e=>`static readonly ${Bi(Ki(e))} = ${pa(e.const.value)}`),...s.sort(Wi).map(e=>fa(r,e)),...i.map(e=>ma(e)));let ie=[];for(let e of ee){let t=m[e];t._isSlot&&t.slot.hadExplicitDefault&&t.slot.type.which()!==Y.VOID&&ie.push(ua(t))}re.push(`
|
|
150
|
+
public static override readonly _capnp = {
|
|
151
|
+
displayName: "${n}",
|
|
152
|
+
id: "${o}",
|
|
153
|
+
size: new $.ObjectSize(${p}, ${f}),
|
|
154
|
+
${ie.join(`,`)}
|
|
155
|
+
}`,...h.map(t=>da(e,t)));for(let n of ee){let r=m[n];la(e,re,t,r,n)}re.push(`public override toString(): string { return "${r}_" + super.toString(); }`),ne&&re.push(`
|
|
156
|
+
which(): ${r}_Which {
|
|
157
|
+
return $.utils.getUint16(${d*2}, this) as ${r}_Which;
|
|
158
|
+
}
|
|
159
|
+
`);let g=`
|
|
160
|
+
${ea(Zi(e,t))}
|
|
161
|
+
export class ${r} extends $.Struct {
|
|
162
|
+
${re.join(`
|
|
163
|
+
`)}
|
|
164
|
+
}`;e.codeParts.push(g),e.concreteLists.push(...h.map(e=>[r,e]))}function la(e,t,n,r,i){let a,o;if(r._isSlot){let t=r.slot.type;a=qi(e,t,!1),o=t.which()}else if(r._isGroup)a=Q($(e,r.group.typeId)),o=`group`;else throw Error(x(Ni,r.which()));o===Y.INTERFACE&&(a=`${a}$Client`);let{discriminantOffset:s}=n.struct,{name:c}=r,l=c===`constructor`?`$constructor`:c,u=Vi(c),{discriminantValue:d}=r,f=Q(n),p=r._isSlot&&r.slot.hadExplicitDefault,m=p?`, ${f}._capnp.default${u}`:``,ee=d!==Cr.NO_DISCRIMINANT,h=r._isSlot?r.slot.offset:0,te=!1,ne=!1,re=!1,ie,g,ae;switch(o){case Y.ANY_POINTER:te=!0,ne=!0,re=!0,g=`$.utils.getPointer(${h}, this${m})`,ae=`$.utils.copyFrom(value, ${g})`;break;case Y.BOOL:case Y.ENUM:case Y.FLOAT32:case Y.FLOAT64:case Y.INT16:case Y.INT32:case Y.INT64:case Y.INT8:case Y.UINT16:case Y.UINT32:case Y.UINT64:case Y.UINT8:{let{byteLength:e,getter:t,setter:n}=Fi[o],r=h*e;g=`$.utils.${t}(${r}, this${m})`,ae=`$.utils.${n}(${r}, value, this${m})`,o===Y.ENUM&&(g=`${g} as ${a}`);break}case Y.DATA:te=!0,ne=!0,re=!0,g=`$.utils.getData(${h}, this${m})`,ae=`$.utils.copyFrom(value, $.utils.getPointer(${h}, this))`,ie=`$.utils.initData(${h}, length, this)`;break;case Y.INTERFACE:g=`new ${a}($.utils.getInterfaceClientOrNullAt(${h}, this))`,ae=`$.utils.setInterfacePointer(this.segment.message.addCap(value.client), $.utils.getPointer(${h}, this))`;break;case Y.LIST:{let e=r.slot.type.list.elementType.which(),t=Pi[e];if(e===Y.LIST||e===Y.STRUCT)t=`${f}._${u}`;else if(t===void 0)throw Error(x(`CAPNP-ES007 Encountered an unsupported list element type: %d`,e));te=!0,ne=!0,re=!0,g=`$.utils.getList(${h}, ${t}, this${m})`,ae=`$.utils.copyFrom(value, $.utils.getPointer(${h}, this))`,ie=`$.utils.initList(${h}, ${t}, length, this)`,e===Y.ENUM&&(g=`${g} as ${a}`,ie=`${ie} as ${a}`);break}case Y.STRUCT:te=!0,ne=!0,re=!0,g=`$.utils.getStruct(${h}, ${a}, this${m})`,ae=`$.utils.copyFrom(value, $.utils.getPointer(${h}, this))`,ie=`$.utils.initStructAt(${h}, ${a}, this)`;break;case Y.TEXT:g=`$.utils.getText(${h}, this${m})`,ae=`$.utils.setText(${h}, value, this)`;break;case Y.VOID:break;case`group`:if(p)throw Error(x(`CAPNP-ES000 Don't know how to generate a %s field with an explicit default value.`,`group`));g=`$.utils.getAs(${a}, this)`,ie=g;break}if(te&&t.push(`
|
|
165
|
+
_adopt${u}(value: $.Orphan<${a}>): void {
|
|
166
|
+
${ee?`$.utils.setUint16(${s*2}, ${d}, this);`:``}
|
|
167
|
+
$.utils.adopt(value, $.utils.getPointer(${h}, this));
|
|
168
|
+
}
|
|
169
|
+
`),ne&&t.push(`
|
|
170
|
+
_disown${u}(): $.Orphan<${a}> {
|
|
171
|
+
return $.utils.disown(this.${c===`constructor`?`$${c}`:c});
|
|
172
|
+
}
|
|
173
|
+
`),g){let r=ea(Zi(e,n)?.members.at(i));t.push(`
|
|
174
|
+
${r}
|
|
175
|
+
get ${l}(): ${a} {
|
|
176
|
+
${ee?`$.utils.testWhich(${JSON.stringify(c)}, $.utils.getUint16(${s*2}, this), ${d}, this);`:``}
|
|
177
|
+
return ${g};
|
|
178
|
+
}
|
|
179
|
+
`)}if(re&&t.push(`
|
|
180
|
+
_has${u}(): boolean {
|
|
181
|
+
return !$.utils.isNull($.utils.getPointer(${h}, this));
|
|
182
|
+
}
|
|
183
|
+
`),ie){let e=o===Y.DATA||o===Y.LIST?`length: number`:``;t.push(`
|
|
184
|
+
_init${u}(${e}): ${a} {
|
|
185
|
+
${ee?`$.utils.setUint16(${s*2}, ${d}, this);`:``}
|
|
186
|
+
return ${ie};
|
|
187
|
+
}
|
|
188
|
+
`)}if(ee&&t.push(`
|
|
189
|
+
get _is${u}(): boolean {
|
|
190
|
+
return $.utils.getUint16(${s*2}, this) === ${d};
|
|
191
|
+
}
|
|
192
|
+
`),ae||ee){let e=ae?`value: ${a}`:`_: true`;t.push(`
|
|
193
|
+
set ${l}(${e}) {
|
|
194
|
+
${ee?`$.utils.setUint16(${s*2}, ${d}, this);`:``}
|
|
195
|
+
${ae?`${ae};`:``}
|
|
196
|
+
}
|
|
197
|
+
`)}}function ua(e){let{name:t,slot:n}=e,r=n.type.which(),i=Fi[r],a;switch(r){case J.ANY_POINTER:case J.DATA:case J.LIST:case J.STRUCT:case J.INTERFACE:a=pa(n.defaultValue);break;case J.TEXT:a=JSON.stringify(n.defaultValue.text);break;case J.BOOL:{let e=pa(n.defaultValue),t=n.offset%8;a=`$.${i.mask}(${e}, ${t})`;break}case J.ENUM:case J.FLOAT32:case J.FLOAT64:case J.INT16:case J.INT32:case J.INT64:case J.INT8:case J.UINT16:case J.UINT32:case J.UINT64:case J.UINT8:{let e=pa(n.defaultValue);a=`$.${i.mask}(${e})`;break}default:throw Error(x(`CAPNP-ES010 Don't know how to generate a default value for %s fields.`,r))}return`default${Vi(t)}: ${a}`}function da(e,t){return`static ${`_${Vi(t.name)}`}: ${qi(e,t.slot.type,!0)};`}function fa(e,t){let n=Bi(t.name);return`static readonly ${n} = ${`${e}_Which.${n}`};`}function pa(e){let t;switch(e.which()){case Z.BOOL:return e.bool?`true`:`false`;case Z.ENUM:return String(e.enum);case Z.FLOAT32:return String(e.float32);case Z.FLOAT64:return String(e.float64);case Z.INT8:return String(e.int8);case Z.INT16:return String(e.int16);case Z.INT32:return String(e.int32);case Z.INT64:return $i(e.int64);case Z.UINT8:return String(e.uint8);case Z.UINT16:return String(e.uint16);case Z.UINT32:return String(e.uint32);case Z.UINT64:return $i(e.uint64);case Z.TEXT:return JSON.stringify(e.text);case Z.VOID:return`undefined`;case Z.ANY_POINTER:t=e.anyPointer;break;case Z.DATA:t=e.data;break;case Z.LIST:t=e.list;break;case Z.STRUCT:t=e.struct;break;case Z.INTERFACE:G(`interface`,z(0,e),17,e),t=L(0,e);break;default:throw Error(x(`CAPNP-ES004 Don't know how to serialize a value of kind %s.`,e.which()))}let n=new gi;n.setRoot(t);let r=new Uint8Array(n.toPackedArrayBuffer()),i=[];for(let e=0;e<r.byteLength;e++)i.push(`0x${Ft(r[e].toString(16),2)}`);return`$.readRawPointer(new Uint8Array([${i.join(`,`)}]).buffer)`}function ma(e){return`static readonly ${Ki(e)} = ${Q(e)};`}function ha(e,t){let n=Ki(t),r=Q(t),i=t.nestedNodes.map(t=>$(e,t)).filter(e=>!e._isConst&&!e._isAnnotation),a=t.id,o=a.toString(16),s=e.nodes.filter(e=>e.scopeId===a&&e._isConst),c=[];c.push(...s.map(e=>`static readonly ${Bi(Ki(e))} = ${pa(e.const.value)}`),...i.map(e=>ma(e)),`static readonly Client = ${r}$Client;
|
|
198
|
+
static readonly Server = ${r}$Server;
|
|
199
|
+
public static override readonly _capnp = {
|
|
200
|
+
displayName: "${n}",
|
|
201
|
+
id: "${o}",
|
|
202
|
+
size: new $.ObjectSize(0, 0),
|
|
203
|
+
}
|
|
204
|
+
public override toString(): string { return "${r}_" + super.toString(); }`);let l=`
|
|
205
|
+
${ea(Zi(e,t))}
|
|
206
|
+
export class ${r} extends $.Interface {
|
|
207
|
+
${c.join(`
|
|
208
|
+
`)}
|
|
209
|
+
}`;na(e,t),e.codeParts.push(l)}function ga(e,t){let n=t.id,r=n.toString(16);if(e.generatedNodeIds.has(r))return;e.generatedNodeIds.add(r);let i=t.nestedNodes.map(t=>$(e,t));for(let t of i)ga(e,t);let a=e.nodes.filter(e=>e.scopeId===n&&e._isStruct&&e.struct.isGroup);for(let t of a)ga(e,t);let o=t.which();switch(o){case _r.STRUCT:ca(e,t);break;case _r.CONST:break;case _r.ENUM:ta(e,Q(t),t,t.enum.enumerants.toArray());break;case _r.INTERFACE:ha(e,t);break;case _r.ANNOTATION:break;default:throw Error(x(`CAPNP-ES003 Don't know how to generate a "%s" node.`,o))}}var _a=class{files=[]},va=class{constructor(e,t){this.req=e,this.file=t,this.nodes=e.nodes.toArray(),this.imports=t.imports.toArray()}nodes;imports;concreteLists=[];generatedNodeIds=new Set;generatedResultsPromiseIds=new Set;tsPath=``;codeParts=[];toString(){return this.file?.filename??`CodeGeneratorFileContext()`}};function ya(e){e.codeParts.push(`export const _capnpFileId = BigInt("0x${e.file.id.toString(16)}");`)}function ba(e,t,n){let r=`_${Vi(n.name)}`,i=Gi(e,n.slot.type);e.codeParts.push(`${t}.${r} = ${i};`)}function xa(e){let t=$(e,e.file),n=Ui(`e37ded525a68a7c9`),r=e.nodes.find(e=>e.id===n)?.nestedNodes.find(e=>e.name===`importPath`),i=r&&t.annotations.find(e=>e.id===r.id),a=i===void 0?`@stryke/capnp`:i.value.text;e.codeParts.push(`import * as $ from '${a}';`)}function Sa(e){for(let t of e.imports){let{name:n}=t,r;n.startsWith(`/capnp/`)?r=`@stryke/capnp/schemas/${n.slice(7).replace(/\.capnp$/,``)}`:(r=n.replace(/\.capnp$/,``),r[0]!==`.`&&(r=`./${r}`));let i=Ca(e,$(e,t)).flatMap(e=>{let t=Q(e);return e._isInterface?[t,`${t}$Client`]:t}).sort().join(`, `);i.length!==0&&e.codeParts.push(`import { ${i} } from "${r}";`)}}function Ca(e,t,n=new Set){n.add(t.id);let r=t.nestedNodes.filter(({id:t})=>Yi(e,t)).filter(({id:e})=>!n.has(e)).map(({id:t})=>$(e,t)).filter(e=>e._isStruct||e._isEnum||e._isInterface);return r.concat(r.flatMap(t=>Ca(e,t,n)))}async function wa(e,t){let n=new gi(e,!1).getRoot(qr),r=new _a;if(r.files=n.requestedFiles.map(e=>Xi(n,e)),r.files.length===0)throw Error(GEN_NO_FILES);let i=new Map(r.files.map(e=>[e.tsPath,Ta(e)]));if(i.size===0)throw Error(GEN_NO_FILES);if((t?.dts===!0||t?.js===!0)&&Ea(i,t?.dts===!0,t?.js===!0,t?.tsconfig),!t?.ts)for(let[e]of i)e.endsWith(`.ts`)&&!e.endsWith(`.d.ts`)&&i.delete(e);return{ctx:r,files:i}}function Ta(e){xa(e),Sa(e),ya(e);let t=$(e,e.file).nestedNodes.map(t=>$(e,t));for(let n of t)ga(e,n);for(let[t,n]of e.concreteLists)ba(e,t,n);let n=l.createSourceFile(e.tsPath,e.codeParts.map(e=>e.toString()).join(``),l.ScriptTarget.Latest,!1,l.ScriptKind.TS);return`
|
|
210
|
+
/* eslint-disable */
|
|
211
|
+
// biome-ignore lint: disable
|
|
212
|
+
|
|
213
|
+
// Generated by storm-capnpc
|
|
214
|
+
// Note: Do not edit this file manually - it will be overwritten automatically
|
|
215
|
+
|
|
216
|
+
`+l.createPrinter().printFile(n)}function Ea(e,t,n,r){if(!t&&!n)return;let i={moduleResolution:l.ModuleResolutionKind.Bundler,target:l.ScriptTarget.ESNext,strict:!0,...r,noEmitOnError:!1,noFallthroughCasesInSwitch:!0,preserveConstEnums:!0,noImplicitReturns:!0,noUnusedLocals:!1,noUnusedParameters:!1,removeComments:!1,skipLibCheck:!0,sourceMap:!1,emitDeclarationOnly:t&&!n,declaration:t},a=l.createCompilerHost(i);a.writeFile=(t,n)=>{e.set(t,n)};let o=a.readFile;a.readFile=t=>e.has(t)?e.get(t):o(t);let s=l.createProgram([...e.keys()],i,a),c=s.emit(),u=[...l.getPreEmitDiagnostics(s),...c.diagnostics];if(u.length>0){for(let e of u){let t=l.flattenDiagnosticMessageText(e.messageText,`
|
|
217
|
+
`);if(e.file&&e.start){let{line:n,character:r}=e.file.getLineAndCharacterOfPosition(e.start);console.log(`${e.file.fileName}:${n+1}:${r+1} ${t}`)}else console.log(`==> ${t}`)}throw Error(`CAPNP-ES009 Failed to transpile emitted schema source code; see above for error messages.`)}}function Da(e){return e??=[],Array.isArray(e)?e:[e]}async function Oa(e){let t=e.tsconfigPath?e.tsconfigPath.replace(`{projectRoot}`,e.projectRoot).replace(`{workspaceRoot}`,e.workspaceRoot):c(e.projectRoot,`tsconfig.json`),n=Da(e.schemas?e.schemas:c(e.projectRoot,`schemas/**/*.capnp`)).filter(Boolean).map(t=>t.replace(`{projectRoot}`,e.projectRoot).replace(`{workspaceRoot}`,e.workspaceRoot)),r;if(e.tsconfig)r=e.tsconfig;else{if(!t||!a(t)){let e=t?`✖ The specified TypeScript configuration file "${t}" does not exist. Please provide a valid path.`:`✖ The specified TypeScript configuration file does not exist. Please provide a valid path.`;throw De(e,{logLevel:`all`}),Error(e)}if(r=u(await p(t),d,o(t)),!r){let e=`✖ The specified TypeScript configuration file "${t}" is invalid. Please provide a valid configuration.`;throw De(e,{logLevel:`all`}),Error(e)}r.options.configFilePath=t,r.options.noImplicitOverride=!1,r.options.noUnusedLocals=!1,r.options.noUnusedParameters=!1}let i=[];for(let e of n){let t=e;!e.endsWith(`.capnp`)&&!e.includes(`*`)&&(t=`${e.replace(/\/$/g,``)}/*.capnp`),i.push(...await m(t))}if(i.length===0||!i[0])return ke(`✖ No Cap'n Proto schema files found in the specified source paths: ${n.join(`, `)}. As a result, the Cap'n Proto compiler will not be able to generate any output files. Please ensure that the paths are correct and contain .capnp files.`,{logLevel:`all`}),null;let l=e.output?e.output.replace(`{projectRoot}`,e.projectRoot).replace(`{workspaceRoot}`,e.workspaceRoot):c(e.projectRoot,s(t?o(t):e.projectRoot,c(e.workspaceRoot,i[0].endsWith(`.capnp`)?o(i[0]):i[0])));return r.options.outDir=l,{...e,importPath:e.importPath?e.importPath.split(`,`).map(e=>e.trim()):[],workspaceRoot:e.workspaceRoot,projectRoot:e.projectRoot,schemas:i,output:l,js:e.js===!0,ts:e.noTs!==!0,dts:e.dts??e.noDts!==!0,tsconfig:r}}async function ka(e){let{output:n,tsconfig:r,schemas:i=[],tty:o}=e,s=f.alloc(0);if(o){let e=[];process.stdin.on(`data`,t=>{e.push(t)}),await new Promise(e=>{process.stdin.on(`end`,e)});let t=f.alloc(e.reduce((e,t)=>e+t.byteLength,0)),n=0;for(let r of e)r.copy(t,n),n+=r.byteLength;s=t}if(s.byteLength===0){let e=[];n&&a(n)?e.push(`-o-:${n}`):(n&&!a(n)&&ke(`Output directory "${n}" does not exist, will write to schema path...`),e.push(`-o-`)),s=await new Promise(n=>{t(`capnpc ${e.join(` `)} ${i.join(` `)}`,{encoding:`buffer`},(e,t,r)=>{if(r.length>0&&process.stderr.write(r),e)throw e;n(t)})})}return wa(s,{ts:e.ts??!0,js:!1,dts:!1,tsconfig:r.options})}const Aa=e=>async t=>{if(!t.projectRoot)throw Error(`✖ The project root directory must be specified using the -p or --project-root option.`);let n=await Oa({workspaceRoot:e,...t,tsconfig:void 0,tsconfigPath:t.tsconfig,schemas:t.schema});if(!n){ke(`✖ Unable to resolve Cap'n Proto compiler options - the program will terminate`,{logLevel:`all`});return}Ae(`📦 Storm Cap'n Proto Compiler will output ${n.ts?`TypeScript code`:``}${n.js?n.ts?`, JavaScript code`:`JavaScript code`:``}${n.dts?n.ts||n.js?`, TypeScript declarations`:`TypeScript declarations`:``} files from schemas at ${t.schema?t.schema.replace(`{projectRoot}`,n.projectRoot).replace(`{workspaceRoot}`,n.workspaceRoot):n.projectRoot} to ${n.tsconfig.options.outDir}...`,{logLevel:`all`});let r=await ka(n);if(r.files.size===0){ke(`⚠️ No files were generated. Please check your schema files.`,{logLevel:`all`});return}Ae(`📋 Writing ${r.files.size} generated files to disk...`,{logLevel:`all`});for(let[e,n]of r.files){let r=e;if(!a(o(r))){let e=`/${r}`;a(o(e))&&(r=e)}t.output&&(r=c(t.output,e),a(o(t.output))||ke(`Output directory "${o(t.output)}" does not exist, it will be created...`)),await i(r,n.replace(/^\s+/gm,e=>` `.repeat(e.length/2)))}je(`⚡ Storm Cap'n Proto Compiler completed successfully.`,{logLevel:`all`})};function ja(){Ae(`⚡ Running Storm Cap'n Proto Compiler Tools`,{logLevel:`all`});let e=Qe(process.cwd());process.env.STORM_WORKSPACE_ROOT??=e,process.env.NX_WORKSPACE_ROOT_PATH??=e,e&&process.chdir(e);let t=new ft;return t.name(`storm-capnpc`).description(`Run the Storm Cap'n Proto compiler`).version(`1.0.0`,`-v --version`,`display CLI version`),t.command(`compile`,{isDefault:!0}).option(`-p --project-root <path>`,`The path to the project root directory`).option(`-s --schema <path>`,`The directory (or a glob to the directory) containing the Cap'n Proto schema files to compile (default: current working directory)`).option(`-o --output <path>`,`The directory to output the generated files to`).option(`--tsconfig <path>`,`The path to the TypeScript configuration file to use for compilation`).option(`--skip-generating-id`,`Skip generating a new 64-bit unique ID for use in a Cap'n Proto schema`).option(`--no-standard-imports`,`Skip adding default import paths; use only those specified by -I`).option(`--no-ts`,`An indicator to disable generation of TypeScript files`).option(`--js`,`An indicator to generate JavaScript files`).option(`--dts`,`An indicator to generate TypeScript declaration files`).option(`--no-dts`,`An indicator to disable generation of TypeScript declaration files`).option(`-w --workspace-root <path>`,`The path to the workspace root directory`,e||process.cwd()).option(`--tty`,`An indicator to enable TTY mode for the compiler`).action(Aa(e)),t}(async()=>{try{Re(),await ja().parseAsync(process.argv),Le()}catch(e){De(`✖ A fatal error occurred while running the Storm Cap'n Proto compiler tool:
|
|
218
|
+
${e?.message?e?.name?`[${e.name}]: ${e.message}`:e.message:JSON.stringify(e)}${e?.stack?`
|
|
219
|
+
|
|
220
|
+
Stack Trace: ${e.stack}`:``}`,{logLevel:`all`}),Ie()}})();export{ja as createProgram};
|
|
11
221
|
//# sourceMappingURL=capnpc.mjs.map
|