@coryrylan/cradle 1.3.0 → 1.3.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.3.1](https://github.com/coryrylan/cradle/compare/cradle-v1.3.0...cradle-v1.3.1) (2026-08-30)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **clI:** update dependencies ([24e2afe](https://github.com/coryrylan/cradle/commit/24e2afe3827a4f2916015fd1676464cb66a2dcd5))
6
+ * **cli:** update deps ([07e4065](https://github.com/coryrylan/cradle/commit/07e4065826a2193d5c08ff7295441f0b496f89fe))
7
+
1
8
  ## [1.3.0](https://github.com/coryrylan/cradle/compare/cradle-v1.2.0...cradle-v1.3.0) (2026-07-26)
2
9
 
3
10
  ### Features
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ![CI Build](https://github.com/coryrylan/cradle/actions/workflows/pull-request.yml/badge.svg)
4
4
 
5
- A runtime for portable agents defined as folders. `cradle run <dir>` reads an agent folder — a `SYSTEM.md` or `APPEND_SYSTEM.md` (at least one) plus optional pi-native config, skills, extensions, and sandbox posture — and launches the [pi](https://github.com/earendil-works/pi-mono) coding agent configured from it. An agent declaring `sandbox/nono.json` or `sandbox/sbx.json` runs sandboxed — inside the [nono](https://github.com/always-further/nono) filesystem sandbox or the [Docker Sandboxes](https://docs.docker.com/ai/sandboxes/) microVM, respectively. See [ARCHITECTURE.md](../../ARCHITECTURE.md) for the folder format and [`examples/hello`](../../examples/hello) for a minimal agent. Built with Bun and TypeScript; install the standalone binary via `install.sh` (primary) or the npm package [`@coryrylan/cradle`](https://www.npmjs.com/package/@coryrylan/cradle) (alternative).
5
+ A runtime for portable agents defined as folders. `cradle run <dir>` reads an agent folder — a `SYSTEM.md` or `APPEND_SYSTEM.md` (at least one) plus optional pi-native config, skills, extensions, and sandbox posture — and launches the [pi](https://github.com/earendil-works/pi-mono) coding agent configured from it. An agent declaring `sandbox/nono.json` or `sandbox/sbx.json` runs sandboxed — inside the [nono](https://github.com/nolabs-ai/nono) filesystem sandbox or the [Docker Sandboxes](https://docs.docker.com/ai/sandboxes/) microVM, respectively. See [ARCHITECTURE.md](../../ARCHITECTURE.md) for the folder format and [`examples/hello`](../../examples/hello) for a minimal agent. Built with Bun and TypeScript; install the standalone binary via `install.sh` (primary) or the npm package [`@coryrylan/cradle`](https://www.npmjs.com/package/@coryrylan/cradle) (alternative).
6
6
 
7
7
  ## Dependencies
8
8
 
@@ -11,7 +11,7 @@ A runtime for portable agents defined as folders. `cradle run <dir>` reads an ag
11
11
  | Tool | Status | Why |
12
12
  | ------------------------------------------------- | --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
13
13
  | [`pi`](https://github.com/earendil-works/pi-mono) | **Required** | The coding agent cradle launches. Every `cradle run` spawns it. |
14
- | [`nono`](https://github.com/always-further/nono) | **Recommended** | The filesystem sandbox pi runs inside for a nono-backend run — a folder declaring `sandbox/nono.json`, or `--sandbox`/`--sandbox-backend nono`/`--offline`/`--allow-host` with no `sandbox/sbx.json`; required for that run, not needed otherwise. |
14
+ | [`nono`](https://github.com/nolabs-ai/nono) | **Recommended** | The filesystem sandbox pi runs inside for a nono-backend run — a folder declaring `sandbox/nono.json`, or `--sandbox`/`--sandbox-backend nono`/`--offline`/`--allow-host` with no `sandbox/sbx.json`; required for that run, not needed otherwise. |
15
15
  | [`sbx`](https://docs.docker.com/ai/sandboxes/) | **Recommended** | The Docker Sandboxes microVM pi runs inside for an sbx-backend run — a folder declaring `sandbox/sbx.json`, or `--sandbox-backend sbx`; required for that run, not needed otherwise. |
16
16
  | [`mise`](https://mise.jdx.dev) | **Recommended** | The supported way to install and manage `pi` and `nono`. cradle doesn't invoke mise directly, but it falls back to mise's shims when resolving the tools, and the generated sandbox profile grants mise's trees so a sandboxed pi finds its runtime. |
17
17
 
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
1
  #!/usr/bin/env bun
2
2
  // @bun
3
- var S8=Object.create;var{getPrototypeOf:P8,defineProperty:cF,getOwnPropertyNames:x8}=Object;var b8=Object.prototype.hasOwnProperty;function h8(D){return this[D]}var w8,m8,v8=(D,u,F)=>{var C=D!=null&&typeof D==="object";if(C){var E=u?w8??=new WeakMap:m8??=new WeakMap,B=E.get(D);if(B)return B}F=D!=null?S8(P8(D)):{};let $=u||!D||!D.__esModule?cF(F,"default",{value:D,enumerable:!0}):F;for(let Z of x8(D))if(!b8.call($,Z))cF($,Z,{get:h8.bind(D,Z),enumerable:!0});if(C)E.set(D,$);return $};var c8=(D,u)=>()=>(u||D((u={exports:{}}).exports,u),u.exports);var N0=c8((m9,_0)=>{_0.exports=function(u){if(u===void 0)u=2;if(u>=Error.stackTraceLimit)throw TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+u+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");var F=Error.prepareStackTrace;Error.prepareStackTrace=function(E,B){return B};var C=Error().stack;if(Error.prepareStackTrace=F,C!==null&&typeof C==="object")return C[u]?C[u].getFileName():void 0}});import{join as f8}from"path";import{notStrictEqual as j3,strictEqual as _3}from"assert";var d8={right:y8,center:g8};class kF{constructor(D){var u;this.width=D.width,this.wrap=(u=D.wrap)!==null&&u!==void 0?u:!0,this.rows=[]}span(...D){let u=this.div(...D);u.span=!0}resetOutput(){this.rows=[]}div(...D){if(D.length===0)this.div("");if(this.wrap&&this.shouldApplyLayoutDSL(...D)&&typeof D[0]==="string")return this.applyLayoutDSL(D[0]);let u=D.map((F)=>{if(typeof F==="string")return this.colFromString(F);return F});return this.rows.push(u),u}shouldApplyLayoutDSL(...D){return D.length===1&&typeof D[0]==="string"&&/[\t\n]/.test(D[0])}applyLayoutDSL(D){let u=D.split(`
4
- `).map((C)=>C.split("\t")),F=0;return u.forEach((C)=>{if(C.length>1&&YD.stringWidth(C[0])>F)F=Math.min(Math.floor(this.width*0.5),YD.stringWidth(C[0]))}),u.forEach((C)=>{this.div(...C.map((E,B)=>{return{text:E.trim(),padding:this.measurePadding(E),width:B===0&&C.length>1?F:void 0}}))}),this.rows[this.rows.length-1]}colFromString(D){return{text:D,padding:this.measurePadding(D)}}measurePadding(D){let u=YD.stripAnsi(D);return[0,u.match(/\s*$/)[0].length,0,u.match(/^\s*/)[0].length]}toString(){let D=[];return this.rows.forEach((u)=>{this.rowToString(u,D)}),D.filter((u)=>!u.hidden).map((u)=>u.text).join(`
5
- `)}rowToString(D,u){return this.rasterize(D).forEach((F,C)=>{let E="";F.forEach((B,$)=>{let{width:Z}=D[$],M=this.negatePadding(D[$]),H=B;if(M>YD.stringWidth(B))H+=" ".repeat(M-YD.stringWidth(B));if(D[$].align&&D[$].align!=="left"&&this.wrap){let Y=d8[D[$].align];if(H=Y(H,M),YD.stringWidth(H)<M)H+=" ".repeat((Z||0)-YD.stringWidth(H)-1)}let V=D[$].padding||[0,0,0,0];if(V[3])E+=" ".repeat(V[3]);if(E+=dF(D[$],H,"| "),E+=H,E+=dF(D[$],H," |"),V[1])E+=" ".repeat(V[1]);if(C===0&&u.length>0)E=this.renderInline(E,u[u.length-1])}),u.push({text:E.replace(/ +$/,""),span:D.span})}),u}renderInline(D,u){let F=D.match(/^ */),C=F?F[0].length:0,E=u.text,B=YD.stringWidth(E.trimRight());if(!u.span)return D;if(!this.wrap)return u.hidden=!0,E+D;if(C<B)return D;return u.hidden=!0,E.trimRight()+" ".repeat(C-B)+D.trimLeft()}rasterize(D){let u=[],F=this.columnWidths(D),C;return D.forEach((E,B)=>{if(E.width=F[B],this.wrap)C=YD.wrap(E.text,this.negatePadding(E),{hard:!0}).split(`
6
- `);else C=E.text.split(`
7
- `);if(E.border)C.unshift("."+"-".repeat(this.negatePadding(E)+2)+"."),C.push("'"+"-".repeat(this.negatePadding(E)+2)+"'");if(E.padding)C.unshift(...Array(E.padding[0]||0).fill("")),C.push(...Array(E.padding[2]||0).fill(""));C.forEach(($,Z)=>{if(!u[Z])u.push([]);let M=u[Z];for(let H=0;H<B;H++)if(M[H]===void 0)M.push("");M.push($)})}),u}negatePadding(D){let u=D.width||0;if(D.padding)u-=(D.padding[3]||0)+(D.padding[1]||0);if(D.border)u-=4;return u}columnWidths(D){if(!this.wrap)return D.map((B)=>{return B.width||YD.stringWidth(B.text)});let u=D.length,F=this.width,C=D.map((B)=>{if(B.width)return u--,F-=B.width,B.width;return}),E=u?Math.floor(F/u):0;return C.map((B,$)=>{if(B===void 0)return Math.max(E,k8(D[$]));return B})}}function dF(D,u,F){if(D.border){if(/[.']-+[.']/.test(u))return"";if(u.trim().length!==0)return F;return" "}return""}function k8(D){let u=D.padding||[],F=1+(u[3]||0)+(u[1]||0);if(D.border)return F+4;return F}function p8(){if(typeof process==="object"&&process.stdout&&process.stdout.columns)return process.stdout.columns;return 80}function y8(D,u){D=D.trim();let F=YD.stringWidth(D);if(F<u)return" ".repeat(u-F)+D;return D}function g8(D,u){D=D.trim();let F=YD.stringWidth(D);if(F>=u)return D;return" ".repeat(u-F>>1)+D}var YD;function pF(D,u){return YD=u,new kF({width:(D===null||D===void 0?void 0:D.width)||p8(),wrap:D===null||D===void 0?void 0:D.wrap})}function eu({onlyFirst:D=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",D?void 0:"g")}var t8=eu();function kD(D){if(typeof D!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof D}\``);if(!D.includes("\x1B")&&!D.includes("\x9B"))return D;return D.replace(t8,"")}var yF=161,gF=1114109,tF=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],lF=12288,iF=65510,oF=[12288,12288,65281,65376,65504,65510];var nF=4352,sF=262141,DF=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var Nu=(D,u)=>{let F=0,C=Math.floor(D.length/2)-1;while(F<=C){let E=Math.floor((F+C)/2),B=E*2;if(u<D[B])C=E-1;else if(u>D[B+1])F=E+1;else return!0}return!1};var rF=19968,[l8,i8]=o8(DF);function o8(D){let u=D[0],F=D[1];for(let C=0;C<D.length;C+=2){let E=D[C],B=D[C+1];if(rF>=E&&rF<=B)return[E,B];if(B-E>F-u)u=E,F=B}return[u,F]}var aF=(D)=>{if(D<yF||D>gF)return!1;return Nu(tF,D)},eF=(D)=>{if(D<lF||D>iF)return!1;return Nu(oF,D)};var D0=(D)=>{if(D>=l8&&D<=i8)return!0;if(D<nF||D>sF)return!1;return Nu(DF,D)};function n8(D){if(!Number.isSafeInteger(D))throw TypeError(`Expected a code point, got \`${typeof D}\`.`)}function u0(D,{ambiguousAsWide:u=!1}={}){if(n8(D),eF(D)||D0(D)||u&&aF(D))return 2;return 1}var F0=()=>{return/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g};var s8=new Intl.Segmenter,r8=/^\p{Default_Ignorable_Code_Point}$/u;function LD(D,u={}){if(typeof D!=="string"||D.length===0)return 0;let{ambiguousIsNarrow:F=!0,countAnsiEscapeCodes:C=!1}=u;if(!C)D=kD(D);if(D.length===0)return 0;let E=0,B={ambiguousAsWide:!F};for(let{segment:$}of s8.segment(D)){let Z=$.codePointAt(0);if(Z<=31||Z>=127&&Z<=159)continue;if(Z>=8203&&Z<=8207||Z===65279)continue;if(Z>=768&&Z<=879||Z>=6832&&Z<=6911||Z>=7616&&Z<=7679||Z>=8400&&Z<=8447||Z>=65056&&Z<=65071)continue;if(Z>=55296&&Z<=57343)continue;if(Z>=65024&&Z<=65039)continue;if(r8.test($))continue;if(F0().test($)){E+=2;continue}E+=u0(Z,B)}return E}var C0=(D=0)=>(u)=>`\x1B[${u+D}m`,E0=(D=0)=>(u)=>`\x1B[${38+D};5;${u}m`,B0=(D=0)=>(u,F,C)=>`\x1B[${38+D};2;${u};${F};${C}m`,o={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},e7=Object.keys(o.modifier),a8=Object.keys(o.color),e8=Object.keys(o.bgColor),D9=[...a8,...e8];function D3(){let D=new Map;for(let[u,F]of Object.entries(o)){for(let[C,E]of Object.entries(F))o[C]={open:`\x1B[${E[0]}m`,close:`\x1B[${E[1]}m`},F[C]=o[C],D.set(E[0],E[1]);Object.defineProperty(o,u,{value:F,enumerable:!1})}return Object.defineProperty(o,"codes",{value:D,enumerable:!1}),o.color.close="\x1B[39m",o.bgColor.close="\x1B[49m",o.color.ansi=C0(),o.color.ansi256=E0(),o.color.ansi16m=B0(),o.bgColor.ansi=C0(10),o.bgColor.ansi256=E0(10),o.bgColor.ansi16m=B0(10),Object.defineProperties(o,{rgbToAnsi256:{value(u,F,C){if(u===F&&F===C){if(u<8)return 16;if(u>248)return 231;return Math.round((u-8)/247*24)+232}return 16+36*Math.round(u/255*5)+6*Math.round(F/255*5)+Math.round(C/255*5)},enumerable:!1},hexToRgb:{value(u){let F=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!F)return[0,0,0];let[C]=F;if(C.length===3)C=[...C].map((B)=>B+B).join("");let E=Number.parseInt(C,16);return[E>>16&255,E>>8&255,E&255]},enumerable:!1},hexToAnsi256:{value:(u)=>o.rgbToAnsi256(...o.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value(u){if(u<8)return 30+u;if(u<16)return 90+(u-8);let F,C,E;if(u>=232)F=((u-232)*10+8)/255,C=F,E=F;else{u-=16;let Z=u%36;F=Math.floor(u/36)/5,C=Math.floor(Z/6)/5,E=Z%6/5}let B=Math.max(F,C,E)*2;if(B===0)return 30;let $=30+(Math.round(E)<<2|Math.round(C)<<1|Math.round(F));if(B===2)$+=60;return $},enumerable:!1},rgbToAnsi:{value:(u,F,C)=>o.ansi256ToAnsi(o.rgbToAnsi256(u,F,C)),enumerable:!1},hexToAnsi:{value:(u)=>o.ansi256ToAnsi(o.hexToAnsi256(u)),enumerable:!1}}),o}var u3=D3(),$0=u3;var fu=new Set(["\x1B","\x9B"]),F3=39,FF="\x07",Q0="[",C3="]",X0="m",Ru=`${C3}8;;`,z0=(D)=>`${fu.values().next().value}${Q0}${D}${X0}`,Z0=(D)=>`${fu.values().next().value}${Ru}${D}${FF}`,E3=(D)=>D.split(" ").map((u)=>LD(u)),uF=(D,u,F)=>{let C=[...u],E=!1,B=!1,$=LD(kD(D.at(-1)));for(let[Z,M]of C.entries()){let H=LD(M);if($+H<=F)D[D.length-1]+=M;else D.push(M),$=0;if(fu.has(M))E=!0,B=C.slice(Z+1,Z+1+Ru.length).join("")===Ru;if(E){if(B){if(M===FF)E=!1,B=!1}else if(M===X0)E=!1;continue}if($+=H,$===F&&Z<C.length-1)D.push(""),$=0}if(!$&&D.at(-1).length>0&&D.length>1)D[D.length-2]+=D.pop()},B3=(D)=>{let u=D.split(" "),F=u.length;while(F>0){if(LD(u[F-1])>0)break;F--}if(F===u.length)return D;return u.slice(0,F).join(" ")+u.slice(F).join("")},$3=(D,u,F={})=>{if(F.trim!==!1&&D.trim()==="")return"";let C="",E,B,$=E3(D),Z=[""];for(let[Y,q]of D.split(" ").entries()){if(F.trim!==!1)Z[Z.length-1]=Z.at(-1).trimStart();let O=LD(Z.at(-1));if(Y!==0){if(O>=u&&(F.wordWrap===!1||F.trim===!1))Z.push(""),O=0;if(O>0||F.trim===!1)Z[Z.length-1]+=" ",O++}if(F.hard&&$[Y]>u){let W=u-O,J=1+Math.floor(($[Y]-W-1)/u);if(Math.floor(($[Y]-1)/u)<J)Z.push("");uF(Z,q,u);continue}if(O+$[Y]>u&&O>0&&$[Y]>0){if(F.wordWrap===!1&&O<u){uF(Z,q,u);continue}Z.push("")}if(O+$[Y]>u&&F.wordWrap===!1){uF(Z,q,u);continue}Z[Z.length-1]+=q}if(F.trim!==!1)Z=Z.map((Y)=>B3(Y));let M=Z.join(`
8
- `),H=[...M],V=0;for(let[Y,q]of H.entries()){if(C+=q,fu.has(q)){let{groups:W}=new RegExp(`(?:\\${Q0}(?<code>\\d+)m|\\${Ru}(?<uri>.*)${FF})`).exec(M.slice(V))||{groups:{}};if(W.code!==void 0){let J=Number.parseFloat(W.code);E=J===F3?void 0:J}else if(W.uri!==void 0)B=W.uri.length===0?void 0:W.uri}let O=$0.codes.get(Number(E));if(H[Y+1]===`
9
- `){if(B)C+=Z0("");if(E&&O)C+=z0(O)}else if(q===`
10
- `){if(E&&O)C+=z0(E);if(B)C+=Z0(B)}V+=q.length}return C};function CF(D,u,F){return String(D).normalize().replaceAll(`\r
3
+ var Rs=Object.create;var{getPrototypeOf:Ts,defineProperty:Vn,getOwnPropertyNames:Ws}=Object;var Ls=Object.prototype.hasOwnProperty;function Gs(e){return this[e]}var Vs,Hs,zs=(e,t,n)=>{var i=e!=null&&typeof e==="object";if(i){var r=t?Vs??=new WeakMap:Hs??=new WeakMap,s=r.get(e);if(s)return s}n=e!=null?Rs(Ts(e)):{};let o=t||!e||!e.__esModule?Vn(n,"default",{value:e,enumerable:!0}):n;if(e&&typeof e==="object"||typeof e==="function"){for(let a of Ws(e))if(!Ls.call(o,a))Vn(o,a,{get:Gs.bind(e,a),enumerable:!0})}if(i)r.set(e,o);return o};var Us=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var ki=Us(function(uf,$i){$i.exports=function(t){if(t===void 0)t=2;if(t>=Error.stackTraceLimit)throw TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+t+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`");var n=Error.prepareStackTrace;Error.prepareStackTrace=function(r,s){return s};var i=Error().stack;if(Error.prepareStackTrace=n,i!==null&&typeof i==="object")return i[t]?i[t].getFileName():void 0}});import{join as Ns}from"path";import{notStrictEqual as zo,strictEqual as Uo}from"assert";var Ys={right:qs,center:Xs};class zn{constructor(e){var t;this.width=e.width,this.wrap=(t=e.wrap)!==null&&t!==void 0?t:!0,this.rows=[]}span(...e){let t=this.div(...e);t.span=!0}resetOutput(){this.rows=[]}div(...e){if(e.length===0)this.div("");if(this.wrap&&this.shouldApplyLayoutDSL(...e)&&typeof e[0]==="string")return this.applyLayoutDSL(e[0]);let t=e.map((n)=>{if(typeof n==="string")return this.colFromString(n);return n});return this.rows.push(t),t}shouldApplyLayoutDSL(...e){return e.length===1&&typeof e[0]==="string"&&/[\t\n]/.test(e[0])}applyLayoutDSL(e){let t=e.split(`
4
+ `).map((i)=>i.split("\t")),n=0;return t.forEach((i)=>{if(i.length>1&&pe.stringWidth(i[0])>n)n=Math.min(Math.floor(this.width*0.5),pe.stringWidth(i[0]))}),t.forEach((i)=>{this.div(...i.map((r,s)=>({text:r.trim(),padding:this.measurePadding(r),width:s===0&&i.length>1?n:void 0})))}),this.rows[this.rows.length-1]}colFromString(e){return{text:e,padding:this.measurePadding(e)}}measurePadding(e){let t=pe.stripAnsi(e);return[0,t.match(/\s*$/)[0].length,0,t.match(/^\s*/)[0].length]}toString(){let e=[];return this.rows.forEach((t)=>{this.rowToString(t,e)}),e.filter((t)=>!t.hidden).map((t)=>t.text).join(`
5
+ `)}rowToString(e,t){return this.rasterize(e).forEach((n,i)=>{let r="";n.forEach((s,o)=>{let{width:a}=e[o],c=this.negatePadding(e[o]),g=s;if(c>pe.stringWidth(s))g+=" ".repeat(c-pe.stringWidth(s));if(e[o].align&&e[o].align!=="left"&&this.wrap){let h=Ys[e[o].align];if(g=h(g,c),pe.stringWidth(g)<c)g+=" ".repeat((a||0)-pe.stringWidth(g)-1)}let E=e[o].padding||[0,0,0,0];if(E[3])r+=" ".repeat(E[3]);if(r+=Hn(e[o],g,"| "),r+=g,r+=Hn(e[o],g," |"),E[1])r+=" ".repeat(E[1]);if(i===0&&t.length>0)r=this.renderInline(r,t[t.length-1])}),t.push({text:r.replace(/ +$/,""),span:e.span})}),t}renderInline(e,t){let n=e.match(/^ */),i=n?n[0].length:0,r=t.text,s=pe.stringWidth(r.trimRight());if(!t.span)return e;if(!this.wrap)return t.hidden=!0,r+e;if(i<s)return e;return t.hidden=!0,r.trimRight()+" ".repeat(i-s)+e.trimLeft()}rasterize(e){let t=[],n=this.columnWidths(e),i;return e.forEach((r,s)=>{if(r.width=n[s],this.wrap)i=pe.wrap(r.text,this.negatePadding(r),{hard:!0}).split(`
6
+ `);else i=r.text.split(`
7
+ `);if(r.border)i.unshift("."+"-".repeat(this.negatePadding(r)+2)+"."),i.push("'"+"-".repeat(this.negatePadding(r)+2)+"'");if(r.padding)i.unshift(...Array(r.padding[0]||0).fill("")),i.push(...Array(r.padding[2]||0).fill(""));i.forEach((o,a)=>{if(!t[a])t.push([]);let c=t[a];for(let g=0;g<s;g++)if(c[g]===void 0)c.push("");c.push(o)})}),t}negatePadding(e){let t=e.width||0;if(e.padding)t-=(e.padding[3]||0)+(e.padding[1]||0);if(e.border)t-=4;return t}columnWidths(e){if(!this.wrap)return e.map((s)=>s.width||pe.stringWidth(s.text));let t=e.length,n=this.width,i=e.map((s)=>{if(s.width)return t--,n-=s.width,s.width;return}),r=t?Math.floor(n/t):0;return i.map((s,o)=>{if(s===void 0)return Math.max(r,Js(e[o]));return s})}}function Hn(e,t,n){if(e.border){if(/[.']-+[.']/.test(t))return"";if(t.trim().length!==0)return n;return" "}return""}function Js(e){let t=e.padding||[],n=1+(t[3]||0)+(t[1]||0);if(e.border)return n+4;return n}function Ks(){if(typeof process==="object"&&process.stdout&&process.stdout.columns)return process.stdout.columns;return 80}function qs(e,t){e=e.trim();let n=pe.stringWidth(e);if(n<t)return" ".repeat(t-n)+e;return e}function Xs(e,t){e=e.trim();let n=pe.stringWidth(e);if(n>=t)return e;return" ".repeat(t-n>>1)+e}var pe;function Un(e,t){return pe=t,new zn({width:(e===null||e===void 0?void 0:e.width)||Ks(),wrap:e===null||e===void 0?void 0:e.wrap})}function tn({onlyFirst:e=!1}={}){return new RegExp("(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]",e?void 0:"g")}var Zs=tn();function Oe(e){if(typeof e!=="string")throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);if(!e.includes("\x1B")&&!e.includes("\x9B"))return e;return e.replace(Zs,"")}var Yn=161,Jn=1114109,Kn=[161,161,164,164,167,168,170,170,173,174,176,180,182,186,188,191,198,198,208,208,215,216,222,225,230,230,232,234,236,237,240,240,242,243,247,250,252,252,254,254,257,257,273,273,275,275,283,283,294,295,299,299,305,307,312,312,319,322,324,324,328,331,333,333,338,339,358,359,363,363,462,462,464,464,466,466,468,468,470,470,472,472,474,474,476,476,593,593,609,609,708,708,711,711,713,715,717,717,720,720,728,731,733,733,735,735,768,879,913,929,931,937,945,961,963,969,1025,1025,1040,1103,1105,1105,8208,8208,8211,8214,8216,8217,8220,8221,8224,8226,8228,8231,8240,8240,8242,8243,8245,8245,8251,8251,8254,8254,8308,8308,8319,8319,8321,8324,8364,8364,8451,8451,8453,8453,8457,8457,8467,8467,8470,8470,8481,8482,8486,8486,8491,8491,8531,8532,8539,8542,8544,8555,8560,8569,8585,8585,8592,8601,8632,8633,8658,8658,8660,8660,8679,8679,8704,8704,8706,8707,8711,8712,8715,8715,8719,8719,8721,8721,8725,8725,8730,8730,8733,8736,8739,8739,8741,8741,8743,8748,8750,8750,8756,8759,8764,8765,8776,8776,8780,8780,8786,8786,8800,8801,8804,8807,8810,8811,8814,8815,8834,8835,8838,8839,8853,8853,8857,8857,8869,8869,8895,8895,8978,8978,9312,9449,9451,9547,9552,9587,9600,9615,9618,9621,9632,9633,9635,9641,9650,9651,9654,9655,9660,9661,9664,9665,9670,9672,9675,9675,9678,9681,9698,9701,9711,9711,9733,9734,9737,9737,9742,9743,9756,9756,9758,9758,9792,9792,9794,9794,9824,9825,9827,9829,9831,9834,9836,9837,9839,9839,9886,9887,9919,9919,9926,9933,9935,9939,9941,9953,9955,9955,9960,9961,9963,9969,9972,9972,9974,9977,9979,9980,9982,9983,10045,10045,10102,10111,11094,11097,12872,12879,57344,63743,65024,65039,65533,65533,127232,127242,127248,127277,127280,127337,127344,127373,127375,127376,127387,127404,917760,917999,983040,1048573,1048576,1114109],qn=12288,Xn=65510,Zn=[12288,12288,65281,65376,65504,65510];var Qn=4352,ei=262141,nn=[4352,4447,8986,8987,9001,9002,9193,9196,9200,9200,9203,9203,9725,9726,9748,9749,9776,9783,9800,9811,9855,9855,9866,9871,9875,9875,9889,9889,9898,9899,9917,9918,9924,9925,9934,9934,9940,9940,9962,9962,9970,9971,9973,9973,9978,9978,9981,9981,9989,9989,9994,9995,10024,10024,10060,10060,10062,10062,10067,10069,10071,10071,10133,10135,10160,10160,10175,10175,11035,11036,11088,11088,11093,11093,11904,11929,11931,12019,12032,12245,12272,12287,12289,12350,12353,12438,12441,12543,12549,12591,12593,12686,12688,12773,12783,12830,12832,12871,12880,42124,42128,42182,43360,43388,44032,55203,63744,64255,65040,65049,65072,65106,65108,65126,65128,65131,94176,94180,94192,94198,94208,101589,101631,101662,101760,101874,110576,110579,110581,110587,110589,110590,110592,110882,110898,110898,110928,110930,110933,110933,110948,110951,110960,111355,119552,119638,119648,119670,126980,126980,127183,127183,127374,127374,127377,127386,127488,127490,127504,127547,127552,127560,127568,127569,127584,127589,127744,127776,127789,127797,127799,127868,127870,127891,127904,127946,127951,127955,127968,127984,127988,127988,127992,128062,128064,128064,128066,128252,128255,128317,128331,128334,128336,128359,128378,128378,128405,128406,128420,128420,128507,128591,128640,128709,128716,128716,128720,128722,128725,128728,128732,128735,128747,128748,128756,128764,128992,129003,129008,129008,129292,129338,129340,129349,129351,129535,129648,129660,129664,129674,129678,129734,129736,129736,129741,129756,129759,129770,129775,129784,131072,196605,196608,262141];var Pt=(e,t)=>{let n=0,i=Math.floor(e.length/2)-1;while(n<=i){let r=Math.floor((n+i)/2),s=r*2;if(t<e[s])i=r-1;else if(t>e[s+1])n=r+1;else return!0}return!1};var ti=19968,[Qs,eo]=to(nn);function to(e){let t=e[0],n=e[1];for(let i=0;i<e.length;i+=2){let r=e[i],s=e[i+1];if(ti>=r&&ti<=s)return[r,s];if(s-r>n-t)t=r,n=s}return[t,n]}var ni=(e)=>{if(e<Yn||e>Jn)return!1;return Pt(Kn,e)},ii=(e)=>{if(e<qn||e>Xn)return!1;return Pt(Zn,e)};var ri=(e)=>{if(e>=Qs&&e<=eo)return!0;if(e<Qn||e>ei)return!1;return Pt(nn,e)};function no(e){if(!Number.isSafeInteger(e))throw TypeError(`Expected a code point, got \`${typeof e}\`.`)}function Ve(e,{ambiguousAsWide:t=!1}={}){if(no(e),ii(e)||ri(e)||t&&ni(e))return 2;return 1}var si=()=>/[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;var io=new Intl.Segmenter,ro=/^\p{Default_Ignorable_Code_Point}$/u;function je(e,t={}){if(typeof e!=="string"||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:i=!1}=t;if(!i)e=Oe(e);if(e.length===0)return 0;let r=0,s={ambiguousAsWide:!n};for(let{segment:o}of io.segment(e)){let a=o.codePointAt(0);if(a<=31||a>=127&&a<=159)continue;if(a>=8203&&a<=8207||a===65279)continue;if(a>=768&&a<=879||a>=6832&&a<=6911||a>=7616&&a<=7679||a>=8400&&a<=8447||a>=65056&&a<=65071)continue;if(a>=55296&&a<=57343)continue;if(a>=65024&&a<=65039)continue;if(ro.test(o))continue;if(si().test(o)){r+=2;continue}r+=Ve(a,s)}return r}var oi=(e=0)=>(t)=>`\x1B[${t+e}m`,ui=(e=0)=>(t)=>`\x1B[${38+e};5;${t}m`,ai=(e=0)=>(t,n,i)=>`\x1B[${38+e};2;${t};${n};${i}m`,K={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},bc=Object.keys(K.modifier),so=Object.keys(K.color),oo=Object.keys(K.bgColor),Ec=[...so,...oo];function uo(){let e=new Map;for(let[t,n]of Object.entries(K)){for(let[i,r]of Object.entries(n))K[i]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[i]=K[i],e.set(r[0],r[1]);Object.defineProperty(K,t,{value:n,enumerable:!1})}return Object.defineProperty(K,"codes",{value:e,enumerable:!1}),K.color.close="\x1B[39m",K.bgColor.close="\x1B[49m",K.color.ansi=oi(),K.color.ansi256=ui(),K.color.ansi16m=ai(),K.bgColor.ansi=oi(10),K.bgColor.ansi256=ui(10),K.bgColor.ansi16m=ai(10),Object.defineProperties(K,{rgbToAnsi256:{value(t,n,i){if(t===n&&n===i){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(n/255*5)+Math.round(i/255*5)},enumerable:!1},hexToRgb:{value(t){let n=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!n)return[0,0,0];let[i]=n;if(i.length===3)i=[...i].map((s)=>s+s).join("");let r=Number.parseInt(i,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:(t)=>K.rgbToAnsi256(...K.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let n,i,r;if(t>=232)n=((t-232)*10+8)/255,i=n,r=n;else{t-=16;let a=t%36;n=Math.floor(t/36)/5,i=Math.floor(a/6)/5,r=a%6/5}let s=Math.max(n,i,r)*2;if(s===0)return 30;let o=30+(Math.round(r)<<2|Math.round(i)<<1|Math.round(n));if(s===2)o+=60;return o},enumerable:!1},rgbToAnsi:{value:(t,n,i)=>K.ansi256ToAnsi(K.rgbToAnsi256(t,n,i)),enumerable:!1},hexToAnsi:{value:(t)=>K.ansi256ToAnsi(K.hexToAnsi256(t)),enumerable:!1}}),K}var ao=uo(),li=ao;var jt=new Set(["\x1B","\x9B"]),lo=39,sn="\x07",di="[",co="]",Di="m",Ot=`${co}8;;`,ci=(e)=>`${jt.values().next().value}${di}${e}${Di}`,fi=(e)=>`${jt.values().next().value}${Ot}${e}${sn}`,fo=(e)=>e.split(" ").map((t)=>je(t)),rn=(e,t,n)=>{let i=[...t],r=!1,s=!1,o=je(Oe(e.at(-1)));for(let[a,c]of i.entries()){let g=je(c);if(o+g<=n)e[e.length-1]+=c;else e.push(c),o=0;if(jt.has(c))r=!0,s=i.slice(a+1,a+1+Ot.length).join("")===Ot;if(r){if(s){if(c===sn)r=!1,s=!1}else if(c===Di)r=!1;continue}if(o+=g,o===n&&a<i.length-1)e.push(""),o=0}if(!o&&e.at(-1).length>0&&e.length>1)e[e.length-2]+=e.pop()},Do=(e)=>{let t=e.split(" "),n=t.length;while(n>0){if(je(t[n-1])>0)break;n--}if(n===t.length)return e;return t.slice(0,n).join(" ")+t.slice(n).join("")},ho=(e,t,n={})=>{if(n.trim!==!1&&e.trim()==="")return"";let i="",r,s,o=fo(e),a=[""];for(let[h,p]of e.split(" ").entries()){if(n.trim!==!1)a[a.length-1]=a.at(-1).trimStart();let m=je(a.at(-1));if(h!==0){if(m>=t&&(n.wordWrap===!1||n.trim===!1))a.push(""),m=0;if(m>0||n.trim===!1)a[a.length-1]+=" ",m++}if(n.hard&&o[h]>t){let b=t-m,D=1+Math.floor((o[h]-b-1)/t);if(Math.floor((o[h]-1)/t)<D)a.push("");rn(a,p,t);continue}if(m+o[h]>t&&m>0&&o[h]>0){if(n.wordWrap===!1&&m<t){rn(a,p,t);continue}a.push("")}if(m+o[h]>t&&n.wordWrap===!1){rn(a,p,t);continue}a[a.length-1]+=p}if(n.trim!==!1)a=a.map((h)=>Do(h));let c=a.join(`
8
+ `),g=[...c],E=0;for(let[h,p]of g.entries()){if(i+=p,jt.has(p)){let{groups:b}=new RegExp(`(?:\\${di}(?<code>\\d+)m|\\${Ot}(?<uri>.*)${sn})`).exec(c.slice(E))||{groups:{}};if(b.code!==void 0){let D=Number.parseFloat(b.code);r=D===lo?void 0:D}else if(b.uri!==void 0)s=b.uri.length===0?void 0:b.uri}let m=li.codes.get(Number(r));if(g[h+1]===`
9
+ `){if(s)i+=fi("");if(r&&m)i+=ci(m)}else if(p===`
10
+ `){if(r&&m)i+=ci(r);if(s)i+=fi(s)}E+=p.length}return i};function on(e,t,n){return String(e).normalize().replaceAll(`\r
11
11
  `,`
12
12
  `).split(`
13
- `).map((C)=>$3(C,u,F)).join(`
14
- `)}function EF(D){return pF(D,{stringWidth:LD,stripAnsi:kD,wrap:CF})}import{dirname as M0,resolve as G0}from"path";import{readdirSync as z3,statSync as Z3}from"fs";function BF(D,u){let F=G0(".",D),C;if(!Z3(F).isDirectory())F=M0(F);while(!0){if(C=u(F,z3(F)),C)return G0(F,C);if(F=M0(C=F),C===F)break}}import{inspect as N3}from"util";import{fileURLToPath as f0}from"url";import{format as M3}from"util";import{normalize as G3,resolve as J3}from"path";function pD(D){if(!(D!==D.toLowerCase()&&D!==D.toUpperCase()))D=D.toLowerCase();if(D.indexOf("-")===-1&&D.indexOf("_")===-1)return D;else{let F="",C=!1,E=D.match(/^-+/);for(let B=E?E[0].length:0;B<D.length;B++){let $=D.charAt(B);if(C)C=!1,$=$.toUpperCase();if(B!==0&&($==="-"||$==="_"))C=!0;else if($!=="-"&&$!=="_")F+=$}return F}}function Au(D,u){let F=D.toLowerCase();u=u||"-";let C="";for(let E=0;E<D.length;E++){let B=F.charAt(E),$=D.charAt(E);if(B!==$&&E>0)C+=`${u}${F.charAt(E)}`;else C+=$}return C}function Su(D){if(D===null||D===void 0)return!1;if(typeof D==="number")return!0;if(/^0x[0-9a-f]+$/i.test(D))return!0;if(/^0[^.]/.test(D))return!1;return/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(D)}function J0(D){if(Array.isArray(D))return D.map(($)=>typeof $!=="string"?$+"":$);D=D.trim();let u=0,F=null,C=null,E=null,B=[];for(let $=0;$<D.length;$++){if(F=C,C=D.charAt($),C===" "&&!E){if(F!==" ")u++;continue}if(C===E)E=null;else if((C==="'"||C==='"')&&!E)E=C;if(!B[u])B[u]="";B[u]+=C}return B}var UD;(function(D){D.BOOLEAN="boolean",D.STRING="string",D.NUMBER="number",D.ARRAY="array"})(UD||(UD={}));var AD;class zF{constructor(D){AD=D}parse(D,u){let F=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},u),C=J0(D),E=typeof D==="string",B=Q3(Object.assign(Object.create(null),F.alias)),$=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},F.configuration),Z=Object.assign(Object.create(null),F.default),M=F.configObjects||[],H=F.envPrefix,V=$["populate--"],Y=V?"--":"_",q=Object.create(null),O=Object.create(null),W=F.__||AD.format,J={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},S=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,d=new RegExp("^--"+$["negation-prefix"]+"(.+)");if([].concat(F.array||[]).filter(Boolean).forEach(function(Q){let G=typeof Q==="object"?Q.key:Q,T=Object.keys(Q).map(function(U){return{boolean:"bools",string:"strings",number:"numbers"}[U]}).filter(Boolean).pop();if(T)J[T][G]=!0;J.arrays[G]=!0,J.keys.push(G)}),[].concat(F.boolean||[]).filter(Boolean).forEach(function(Q){J.bools[Q]=!0,J.keys.push(Q)}),[].concat(F.string||[]).filter(Boolean).forEach(function(Q){J.strings[Q]=!0,J.keys.push(Q)}),[].concat(F.number||[]).filter(Boolean).forEach(function(Q){J.numbers[Q]=!0,J.keys.push(Q)}),[].concat(F.count||[]).filter(Boolean).forEach(function(Q){J.counts[Q]=!0,J.keys.push(Q)}),[].concat(F.normalize||[]).filter(Boolean).forEach(function(Q){J.normalize[Q]=!0,J.keys.push(Q)}),typeof F.narg==="object")Object.entries(F.narg).forEach(([Q,G])=>{if(typeof G==="number")J.nargs[Q]=G,J.keys.push(Q)});if(typeof F.coerce==="object")Object.entries(F.coerce).forEach(([Q,G])=>{if(typeof G==="function")J.coercions[Q]=G,J.keys.push(Q)});if(typeof F.config<"u"){if(Array.isArray(F.config)||typeof F.config==="string")[].concat(F.config).filter(Boolean).forEach(function(Q){J.configs[Q]=!0});else if(typeof F.config==="object")Object.entries(F.config).forEach(([Q,G])=>{if(typeof G==="boolean"||typeof G==="function")J.configs[Q]=G})}Yu(F.key,B,F.default,J.arrays),Object.keys(Z).forEach(function(Q){(J.aliases[Q]||[]).forEach(function(G){Z[G]=Z[Q]})});let v=null;au();let QD=[],m=Object.assign(Object.create(null),{_:[]}),l={};for(let Q=0;Q<C.length;Q++){let G=C[Q],T=G.replace(/^-{3,}/,"---"),U,X,_,I,A,BD;if(G!=="--"&&/^-/.test(G)&&g(G))uD(G);else if(T.match(/^---+(=|$)/)){uD(G);continue}else if(G.match(/^--.+=/)||!$["short-option-groups"]&&G.match(/^-.+=/)){if(I=G.match(/^--?([^=]+)=([\s\S]*)$/),I!==null&&Array.isArray(I)&&I.length>=3)if(P(I[1],J.arrays))Q=jD(Q,I[1],C,I[2]);else if(P(I[1],J.nargs)!==!1)Q=s(Q,I[1],C,I[2]);else y(I[1],I[2],!0)}else if(G.match(d)&&$["boolean-negation"]){if(I=G.match(d),I!==null&&Array.isArray(I)&&I.length>=2)X=I[1],y(X,P(X,J.arrays)?[!1]:!1)}else if(G.match(/^--.+/)||!$["short-option-groups"]&&G.match(/^-[^-]+/)){if(I=G.match(/^--?(.+)/),I!==null&&Array.isArray(I)&&I.length>=2)if(X=I[1],P(X,J.arrays))Q=jD(Q,X,C);else if(P(X,J.nargs)!==!1)Q=s(Q,X,C);else if(A=C[Q+1],A!==void 0&&(!A.match(/^-/)||A.match(S))&&!P(X,J.bools)&&!P(X,J.counts))y(X,A),Q++;else if(/^(true|false)$/.test(A))y(X,A),Q++;else y(X,c(X))}else if(G.match(/^-.\..+=/)){if(I=G.match(/^-([^=]+)=([\s\S]*)$/),I!==null&&Array.isArray(I)&&I.length>=3)y(I[1],I[2])}else if(G.match(/^-.\..+/)&&!G.match(S)){if(A=C[Q+1],I=G.match(/^-(.\..+)/),I!==null&&Array.isArray(I)&&I.length>=2)if(X=I[1],A!==void 0&&!A.match(/^-/)&&!P(X,J.bools)&&!P(X,J.counts))y(X,A),Q++;else y(X,c(X))}else if(G.match(/^-[^-]+/)&&!G.match(S)){_=G.slice(1,-1).split(""),U=!1;for(let MD=0;MD<_.length;MD++){if(A=G.slice(MD+2),_[MD+1]&&_[MD+1]==="="){if(BD=G.slice(MD+3),X=_[MD],P(X,J.arrays))Q=jD(Q,X,C,BD);else if(P(X,J.nargs)!==!1)Q=s(Q,X,C,BD);else y(X,BD);U=!0;break}if(A==="-"){y(_[MD],A);continue}if(/[A-Za-z]/.test(_[MD])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(A)&&P(A,J.bools)===!1){y(_[MD],A),U=!0;break}if(_[MD+1]&&_[MD+1].match(/\W/)){y(_[MD],A),U=!0;break}else y(_[MD],c(_[MD]))}if(X=G.slice(-1)[0],!U&&X!=="-")if(P(X,J.arrays))Q=jD(Q,X,C);else if(P(X,J.nargs)!==!1)Q=s(Q,X,C);else if(A=C[Q+1],A!==void 0&&(!/^(-|--)[^-]/.test(A)||A.match(S))&&!P(X,J.bools)&&!P(X,J.counts))y(X,A),Q++;else if(/^(true|false)$/.test(A))y(X,A),Q++;else y(X,c(X))}else if(G.match(/^-[0-9]$/)&&G.match(S)&&P(G.slice(1),J.bools))X=G.slice(1),y(X,c(X));else if(G==="--"){QD=C.slice(Q+1);break}else if($["halt-at-non-option"]){QD=C.slice(Q);break}else uD(G)}if(DD(m,!0),DD(m,!1),R(m),p(),PD(m,J.aliases,Z,!0),k(m),$["set-placeholder-key"])FD(m);if(Object.keys(J.counts).forEach(function(Q){if(!t(m,Q.split(".")))y(Q,0)}),V&&QD.length)m[Y]=[];if(QD.forEach(function(Q){m[Y].push(Q)}),$["camel-case-expansion"]&&$["strip-dashed"])Object.keys(m).filter((Q)=>Q!=="--"&&Q.includes("-")).forEach((Q)=>{delete m[Q]});if($["strip-aliased"])[].concat(...Object.keys(B).map((Q)=>B[Q])).forEach((Q)=>{if($["camel-case-expansion"]&&Q.includes("-"))delete m[Q.split(".").map((G)=>pD(G)).join(".")];delete m[Q]});function uD(Q){let G=L("_",Q);if(typeof G==="string"||typeof G==="number")m._.push(G)}function s(Q,G,T,U){let X,_=P(G,J.nargs);if(_=typeof _!=="number"||isNaN(_)?1:_,_===0){if(!ED(U))v=Error(W("Argument unexpected for: %s",G));return y(G,c(G)),Q}let I=ED(U)?0:1;if($["nargs-eats-options"]){if(T.length-(Q+1)+I<_)v=Error(W("Not enough arguments following: %s",G));I=_}else{for(X=Q+1;X<T.length;X++)if(!T[X].match(/^-[^0-9]/)||T[X].match(S)||g(T[X]))I++;else break;if(I<_)v=Error(W("Not enough arguments following: %s",G))}let A=Math.min(I,_);if(!ED(U)&&A>0)y(G,U),A--;for(X=Q+1;X<A+Q+1;X++)y(G,T[X]);return Q+A}function jD(Q,G,T,U){let X=[],_=U||T[Q+1],I=P(G,J.nargs);if(P(G,J.bools)&&!/^(true|false)$/.test(_))X.push(!0);else if(ED(_)||ED(U)&&/^-/.test(_)&&!S.test(_)&&!g(_)){if(Z[G]!==void 0){let A=Z[G];X=Array.isArray(A)?A:[A]}}else{if(!ED(U))X.push(N(G,U,!0));for(let A=Q+1;A<T.length;A++){if(!$["greedy-arrays"]&&X.length>0||I&&typeof I==="number"&&X.length>=I)break;if(_=T[A],/^-/.test(_)&&!S.test(_)&&!g(_))break;Q=A,X.push(N(G,_,E))}}if(typeof I==="number"&&(I&&X.length<I||isNaN(I)&&X.length===0))v=Error(W("Not enough arguments following: %s",G));return y(G,X),Q}function y(Q,G,T=E){if(/-/.test(Q)&&$["camel-case-expansion"]){let _=Q.split(".").map(function(I){return pD(I)}).join(".");Ju(Q,_)}let U=N(Q,G,T),X=Q.split(".");if(fD(m,X,U),J.aliases[Q])J.aliases[Q].forEach(function(_){let I=_.split(".");fD(m,I,U)});if(X.length>1&&$["dot-notation"])(J.aliases[X[0]]||[]).forEach(function(_){let I=_.split("."),A=[].concat(X);if(A.shift(),I=I.concat(A),!(J.aliases[Q]||[]).includes(I.join(".")))fD(m,I,U)});if(P(Q,J.normalize)&&!P(Q,J.arrays))[Q].concat(J.aliases[Q]||[]).forEach(function(I){Object.defineProperty(l,I,{enumerable:!0,get(){return G},set(A){G=typeof A==="string"?AD.normalize(A):A}})})}function Ju(Q,G){if(!(J.aliases[Q]&&J.aliases[Q].length))J.aliases[Q]=[G],q[G]=!0;if(!(J.aliases[G]&&J.aliases[G].length))Ju(G,Q)}function N(Q,G,T){if(T)G=X3(G);if(P(Q,J.bools)||P(Q,J.counts)){if(typeof G==="string")G=G==="true"}let U=Array.isArray(G)?G.map(function(X){return L(Q,X)}):L(Q,G);if(P(Q,J.counts)&&(ED(U)||typeof U==="boolean"))U=$F();if(P(Q,J.normalize)&&P(Q,J.arrays))if(Array.isArray(G))U=G.map((X)=>{return AD.normalize(X)});else U=AD.normalize(G);return U}function L(Q,G){if(!$["parse-positional-numbers"]&&Q==="_")return G;if(!P(Q,J.strings)&&!P(Q,J.bools)&&!Array.isArray(G)){if(Su(G)&&$["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${G}`)))||!ED(G)&&P(Q,J.numbers))G=Number(G)}return G}function R(Q){let G=Object.create(null);PD(G,J.aliases,Z),Object.keys(J.configs).forEach(function(T){let U=Q[T]||G[T];if(U)try{let X=null,_=AD.resolve(AD.cwd(),U),I=J.configs[T];if(typeof I==="function"){try{X=I(_)}catch(A){X=A}if(X instanceof Error){v=X;return}}else X=AD.require(_);h(X)}catch(X){if(X.name==="PermissionDenied")v=X;else if(Q[T])v=Error(W("Invalid JSON config file: %s",U))}})}function h(Q,G){Object.keys(Q).forEach(function(T){let U=Q[T],X=G?G+"."+T:T;if(typeof U==="object"&&U!==null&&!Array.isArray(U)&&$["dot-notation"])h(U,X);else if(!t(m,X.split("."))||P(X,J.arrays)&&$["combine-arrays"])y(X,U)})}function p(){if(typeof M<"u")M.forEach(function(Q){h(Q)})}function DD(Q,G){if(typeof H>"u")return;let T=typeof H==="string"?H:"",U=AD.env();Object.keys(U).forEach(function(X){if(T===""||X.lastIndexOf(T,0)===0){let _=X.split("__").map(function(I,A){if(A===0)I=I.substring(T.length);return pD(I)});if((G&&J.configs[_.join(".")]||!G)&&!t(Q,_))y(_.join("."),U[X])}})}function k(Q){let G,T=new Set;Object.keys(Q).forEach(function(U){if(!T.has(U)){if(G=P(U,J.coercions),typeof G==="function")try{let X=L(U,G(Q[U]));[].concat(J.aliases[U]||[],U).forEach((_)=>{T.add(_),Q[_]=X})}catch(X){v=X}}})}function FD(Q){return J.keys.forEach((G)=>{if(~G.indexOf("."))return;if(typeof Q[G]>"u")Q[G]=void 0}),Q}function PD(Q,G,T,U=!1){Object.keys(T).forEach(function(X){if(!t(Q,X.split("."))){if(fD(Q,X.split("."),T[X]),U)O[X]=!0;(G[X]||[]).forEach(function(_){if(t(Q,_.split(".")))return;fD(Q,_.split("."),T[X])})}})}function t(Q,G){let T=Q;if(!$["dot-notation"])G=[G.join(".")];G.slice(0,-1).forEach(function(X){T=T[X]||{}});let U=G[G.length-1];if(typeof T!=="object")return!1;else return U in T}function fD(Q,G,T){let U=Q;if(!$["dot-notation"])G=[G.join(".")];G.slice(0,-1).forEach(function(BD){if(BD=Y0(BD),typeof U==="object"&&U[BD]===void 0)U[BD]={};if(typeof U[BD]!=="object"||Array.isArray(U[BD])){if(Array.isArray(U[BD]))U[BD].push({});else U[BD]=[U[BD],{}];U=U[BD][U[BD].length-1]}else U=U[BD]});let X=Y0(G[G.length-1]),_=P(G.join("."),J.arrays),I=Array.isArray(T),A=$["duplicate-arguments-array"];if(!A&&P(X,J.nargs)){if(A=!0,!ED(U[X])&&J.nargs[X]===1||Array.isArray(U[X])&&U[X].length===J.nargs[X])U[X]=void 0}if(T===$F())U[X]=$F(U[X]);else if(Array.isArray(U[X]))if(A&&_&&I)U[X]=$["flatten-duplicate-arrays"]?U[X].concat(T):(Array.isArray(U[X][0])?U[X]:[U[X]]).concat([T]);else if(!A&&Boolean(_)===Boolean(I))U[X]=T;else U[X]=U[X].concat([T]);else if(U[X]===void 0&&_)U[X]=I?T:[T];else if(A&&!(U[X]===void 0||P(X,J.counts)||P(X,J.bools)))U[X]=[U[X],T];else U[X]=T}function Yu(...Q){Q.forEach(function(G){Object.keys(G||{}).forEach(function(T){if(J.aliases[T])return;J.aliases[T]=[].concat(B[T]||[]),J.aliases[T].concat(T).forEach(function(U){if(/-/.test(U)&&$["camel-case-expansion"]){let X=pD(U);if(X!==T&&J.aliases[T].indexOf(X)===-1)J.aliases[T].push(X),q[X]=!0}}),J.aliases[T].concat(T).forEach(function(U){if(U.length>1&&/[A-Z]/.test(U)&&$["camel-case-expansion"]){let X=Au(U,"-");if(X!==T&&J.aliases[T].indexOf(X)===-1)J.aliases[T].push(X),q[X]=!0}}),J.aliases[T].forEach(function(U){J.aliases[U]=[T].concat(J.aliases[T].filter(function(X){return U!==X}))})})})}function P(Q,G){let T=[].concat(J.aliases[Q]||[],Q),U=Object.keys(G),X=T.find((_)=>U.includes(_));return X?G[X]:!1}function Eu(Q){let G=Object.keys(J);return[].concat(G.map((U)=>J[U])).some(function(U){return Array.isArray(U)?U.includes(Q):U[Q]})}function vF(Q,...G){return[].concat(...G).some(function(U){let X=Q.match(U);return X&&Eu(X[1])})}function x(Q){if(Q.match(S)||!Q.match(/^-[^-]+/))return!1;let G=!0,T,U=Q.slice(1).split("");for(let X=0;X<U.length;X++){if(T=Q.slice(X+2),!Eu(U[X])){G=!1;break}if(U[X+1]&&U[X+1]==="="||T==="-"||/[A-Za-z]/.test(U[X])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(T)||U[X+1]&&U[X+1].match(/\W/))break}return G}function g(Q){return $["unknown-options-as-args"]&&CD(Q)}function CD(Q){if(Q=Q.replace(/^-{3,}/,"--"),Q.match(S))return!1;if(x(Q))return!1;return!vF(Q,/^-+([^=]+?)=[\s\S]*$/,d,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function c(Q){if(!P(Q,J.bools)&&!P(Q,J.counts)&&`${Q}`in Z)return Z[Q];else return zD(r(Q))}function zD(Q){return{[UD.BOOLEAN]:!0,[UD.STRING]:"",[UD.NUMBER]:void 0,[UD.ARRAY]:[]}[Q]}function r(Q){let G=UD.BOOLEAN;if(P(Q,J.strings))G=UD.STRING;else if(P(Q,J.numbers))G=UD.NUMBER;else if(P(Q,J.bools))G=UD.BOOLEAN;else if(P(Q,J.arrays))G=UD.ARRAY;return G}function ED(Q){return Q===void 0}function au(){Object.keys(J.counts).find((Q)=>{if(P(Q,J.arrays))return v=Error(W("Invalid configuration: %s, opts.count excludes opts.array.",Q)),!0;else if(P(Q,J.nargs))return v=Error(W("Invalid configuration: %s, opts.count excludes opts.narg.",Q)),!0;return!1})}return{aliases:Object.assign({},J.aliases),argv:Object.assign(l,m),configuration:$,defaulted:Object.assign({},O),error:v,newAliases:Object.assign({},q)}}}function Q3(D){let u=[],F=Object.create(null),C=!0;Object.keys(D).forEach(function(E){u.push([].concat(D[E],E))});while(C){C=!1;for(let E=0;E<u.length;E++)for(let B=E+1;B<u.length;B++)if(u[E].filter(function(Z){return u[B].indexOf(Z)!==-1}).length){u[E]=u[E].concat(u[B]),u.splice(B,1),C=!0;break}}return u.forEach(function(E){E=E.filter(function($,Z,M){return M.indexOf($)===Z});let B=E.pop();if(B!==void 0&&typeof B==="string")F[B]=E}),F}function $F(D){return D!==void 0?D+1:1}function Y0(D){if(D==="__proto__")return"___proto___";return D}function X3(D){return typeof D==="string"&&(D[0]==="'"||D[0]==='"')&&D[D.length-1]===D[0]?D.substring(1,D.length-1):D}import{readFileSync as Y3}from"fs";import{createRequire as q0}from"module";var ZF,QF,XF,H0=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):20,O0=(QF=(ZF=process===null||process===void 0?void 0:process.versions)===null||ZF===void 0?void 0:ZF.node)!==null&&QF!==void 0?QF:(XF=process===null||process===void 0?void 0:process.version)===null||XF===void 0?void 0:XF.slice(1);if(O0){if(Number(O0.match(/^([^.]+)/)[1])<H0)throw Error(`yargs parser supports a minimum Node.js version of ${H0}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`)}var q3=process?process.env:{},U0=q0?q0(import.meta.url):void 0,W0=new zF({cwd:process.cwd,env:()=>{return q3},format:M3,normalize:G3,resolve:J3,require:(D)=>{if(typeof U0<"u")return U0(D);else if(D.match(/\.json$/))return JSON.parse(Y3(D,"utf8"));else throw Error("only .json config files are supported in ESM")}}),qu=function(u,F){return W0.parse(u.slice(),F).argv};qu.detailed=function(D,u){return W0.parse(D.slice(),u)};qu.camelCase=pD;qu.decamelize=Au;qu.looksLikeNumber=Su;var V0=qu;import{basename as R3,dirname as f3,extname as A3,relative as S3,resolve as R0,join as P3}from"path";function H3(){if(O3())return 0;return 1}function O3(){return U3()&&!process.defaultApp}function U3(){return!!process.versions.electron}function T0(){return process.argv[H3()]}import{readFileSync as W3,statSync as V3,writeFile as T3}from"fs";import{format as L3}from"util";import{resolve as I3}from"path";var L0={fs:{readFileSync:W3,writeFile:T3},format:L3,resolve:I3,exists:(D)=>{try{return V3(D).isFile()}catch(u){return!1}}};var ID;class I0{constructor(D){D=D||{},this.directory=D.directory||"./locales",this.updateFiles=typeof D.updateFiles==="boolean"?D.updateFiles:!0,this.locale=D.locale||"en",this.fallbackToLanguage=typeof D.fallbackToLanguage==="boolean"?D.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...D){if(typeof arguments[0]!=="string")return this._taggedLiteral(arguments[0],...arguments);let u=D.shift(),F=function(){};if(typeof D[D.length-1]==="function")F=D.pop();if(F=F||function(){},!this.cache[this.locale])this._readLocaleFile();if(!this.cache[this.locale][u]&&this.updateFiles)this.cache[this.locale][u]=u,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:F});else F();return ID.format.apply(ID.format,[this.cache[this.locale][u]||u].concat(D))}__n(){let D=Array.prototype.slice.call(arguments),u=D.shift(),F=D.shift(),C=D.shift(),E=function(){};if(typeof D[D.length-1]==="function")E=D.pop();if(!this.cache[this.locale])this._readLocaleFile();let B=C===1?u:F;if(this.cache[this.locale][u])B=this.cache[this.locale][u][C===1?"one":"other"];if(!this.cache[this.locale][u]&&this.updateFiles)this.cache[this.locale][u]={one:u,other:F},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:E});else E();let $=[B];if(~B.indexOf("%d"))$.push(C);return ID.format.apply(ID.format,$.concat(D))}setLocale(D){this.locale=D}getLocale(){return this.locale}updateLocale(D){if(!this.cache[this.locale])this._readLocaleFile();for(let u in D)if(Object.prototype.hasOwnProperty.call(D,u))this.cache[this.locale][u]=D[u]}_taggedLiteral(D,...u){let F="";return D.forEach(function(C,E){let B=u[E+1];if(F+=C,typeof B<"u")F+="%s"}),this.__.apply(this,[F].concat([].slice.call(u,1)))}_enqueueWrite(D){if(this.writeQueue.push(D),this.writeQueue.length===1)this._processWriteQueue()}_processWriteQueue(){let D=this,u=this.writeQueue[0],F=u.directory,C=u.locale,E=u.cb,B=this._resolveLocaleFile(F,C),$=JSON.stringify(this.cache[C],null,2);ID.fs.writeFile(B,$,"utf-8",function(Z){if(D.writeQueue.shift(),D.writeQueue.length>0)D._processWriteQueue();E(Z)})}_readLocaleFile(){let D={},u=this._resolveLocaleFile(this.directory,this.locale);try{if(ID.fs.readFileSync)D=JSON.parse(ID.fs.readFileSync(u,"utf-8"))}catch(F){if(F instanceof SyntaxError)F.message="syntax error in "+u;if(F.code==="ENOENT")D={};else throw F}this.cache[this.locale]=D}_resolveLocaleFile(D,u){let F=ID.resolve(D,"./",u+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(F)&&~u.lastIndexOf("_")){let C=ID.resolve(D,"./",u.split("_")[0]+".json");if(this._fileExistsSync(C))F=C}return F}_fileExistsSync(D){return ID.exists(D)}}function K0(D,u){ID=u;let F=new I0(D);return{__:F.__.bind(F),__n:F.__n.bind(F),setLocale:F.setLocale.bind(F),getLocale:F.getLocale.bind(F),updateLocale:F.updateLocale.bind(F),locale:F.locale}}var K3=(D)=>{return K0(D,L0)},j0=K3;var A0=v8(N0(),1);import{createRequire as x3}from"module";import{readFileSync as b3,readdirSync as h3}from"fs";var MF=f0(import.meta.url),w3=MF.substring(0,MF.lastIndexOf("node_modules")),m3=x3(import.meta.url),S0={assert:{notStrictEqual:j3,strictEqual:_3},cliui:EF,findUp:BF,getEnv:(D)=>{return process.env[D]},inspect:N3,getProcessArgvBin:T0,mainFilename:w3||process.cwd(),Parser:V0,path:{basename:R3,dirname:f3,extname:A3,relative:S3,resolve:R0,join:P3},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(D,u)=>process.emitWarning(D,u),execPath:()=>process.execPath,exit:(D)=>{process.exit(D)},nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:b3,readdirSync:h3,require:m3,getCallerFile:()=>{let D=A0.default(3);return D.match(/^file:\/\//)?f0(D):D},stringWidth:LD,y18n:j0({directory:R0(MF,"../../../locales"),updateFiles:!1})};function GD(D,u,F,C){F.assert.notStrictEqual(D,u,C)}function GF(D,u){u.assert.strictEqual(typeof D,"string")}function Bu(D){return Object.keys(D)}function i(D){return!!D&&!!D.then&&typeof D.then==="function"}class a extends Error{constructor(D){super(D||"yargs error");if(this.name="YError",Error.captureStackTrace)Error.captureStackTrace(this,a)}}function xD(D){let F=D.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),C=/\.*[\][<>]/g,E=F.shift();if(!E)throw Error(`No command found in: ${D}`);let B={cmd:E.replace(C,""),demanded:[],optional:[]};return F.forEach(($,Z)=>{let M=!1;if($=$.replace(/\s/g,""),/\.+[\]>]/.test($)&&Z===F.length-1)M=!0;if(/^\[/.test($))B.optional.push({cmd:$.replace(C,"").split("|"),variadic:M});else B.demanded.push({cmd:$.replace(C,"").split("|"),variadic:M})}),B}var v3=["first","second","third","fourth","fifth","sixth"];function K(D,u,F){function C(){return typeof D==="object"?[{demanded:[],optional:[]},D,u]:[xD(`cmd ${D}`),u,F]}try{let E=0,[B,$,Z]=C(),M=[].slice.call($);while(M.length&&M[M.length-1]===void 0)M.pop();let H=Z||M.length;if(H<B.demanded.length)throw new a(`Not enough arguments provided. Expected ${B.demanded.length} but received ${M.length}.`);let V=B.demanded.length+B.optional.length;if(H>V)throw new a(`Too many arguments provided. Expected max ${V} but received ${H}.`);B.demanded.forEach((Y)=>{let q=M.shift(),O=P0(q);if(Y.cmd.filter((J)=>J===O||J==="*").length===0)x0(O,Y.cmd,E);E+=1}),B.optional.forEach((Y)=>{if(M.length===0)return;let q=M.shift(),O=P0(q);if(Y.cmd.filter((J)=>J===O||J==="*").length===0)x0(O,Y.cmd,E);E+=1})}catch(E){console.warn(E.stack)}}function P0(D){if(Array.isArray(D))return"array";else if(D===null)return"null";return typeof D}function x0(D,u,F){throw new a(`Invalid ${v3[F]||"manyith"} argument. Expected ${u.join(" or ")} but received ${D}.`)}class JF{constructor(D){this.globalMiddleware=[],this.frozens=[],this.yargs=D}addMiddleware(D,u,F=!0,C=!1){if(K("<array|function> [boolean] [boolean] [boolean]",[D,u,F],arguments.length),Array.isArray(D)){for(let E=0;E<D.length;E++){if(typeof D[E]!=="function")throw Error("middleware must be a function");let B=D[E];B.applyBeforeValidation=u,B.global=F}Array.prototype.push.apply(this.globalMiddleware,D)}else if(typeof D==="function"){let E=D;E.applyBeforeValidation=u,E.global=F,E.mutates=C,this.globalMiddleware.push(D)}return this.yargs}addCoerceMiddleware(D,u){let F=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((C)=>{let E=[...F[u]||[],u];if(!C.option)return!0;else return!E.includes(C.option)}),D.option=u,this.addMiddleware(D,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let D=this.frozens.pop();if(D!==void 0)this.globalMiddleware=D}reset(){this.globalMiddleware=this.globalMiddleware.filter((D)=>D.global)}}function b0(D){if(!D)return[];return D.map((u)=>{return u.applyBeforeValidation=!1,u})}function yD(D,u,F,C){return F.reduce((E,B)=>{if(B.applyBeforeValidation!==C)return E;if(B.mutates){if(B.applied)return E;B.applied=!0}if(i(E))return E.then(($)=>Promise.all([$,B($,u)])).then(([$,Z])=>Object.assign($,Z));else{let $=B(E,u);return i($)?$.then((Z)=>Object.assign(E,Z)):Object.assign(E,$)}},D)}function gD(D,u,F=(C)=>{throw C}){try{let C=c3(D)?D():D;return i(C)?C.then((E)=>u(E)):u(C)}catch(C){return F(C)}}function c3(D){return typeof D==="function"}var $u=/(^\*)|(^\$0)/;class w0{constructor(D,u,F,C){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=C,this.usage=D,this.globalMiddleware=F,this.validation=u}addDirectory(D,u,F,C){C=C||{},this.requireCache.add(F);let E=this.shim.path.resolve(this.shim.path.dirname(F),D),B=this.shim.readdirSync(E,{recursive:C.recurse?!0:!1});if(!Array.isArray(C.extensions))C.extensions=["js"];let $=typeof C.visit==="function"?C.visit:(Z)=>Z;for(let Z of B){let M=Z.toString();if(C.exclude){let V=!1;if(typeof C.exclude==="function")V=C.exclude(M);else V=C.exclude.test(M);if(V)continue}if(C.include){let V=!1;if(typeof C.include==="function")V=C.include(M);else V=C.include.test(M);if(!V)continue}let H=!1;for(let V of C.extensions)if(M.endsWith(V))H=!0;if(H){let V=this.shim.path.join(E,M),Y=u(V),q=Object.create(null,Object.getOwnPropertyDescriptors({...Y}));if($(q,V,M)){if(this.requireCache.has(V))continue;else this.requireCache.add(V);if(!q.command)q.command=this.shim.path.basename(V,this.shim.path.extname(V));this.addHandler(q)}}}}addHandler(D,u,F,C,E,B){let $=[],Z=b0(E);if(C=C||(()=>{}),Array.isArray(D))if(d3(D))[D,...$]=D;else for(let M of D)this.addHandler(M);else if(p3(D)){let M=Array.isArray(D.command)||typeof D.command==="string"?D.command:null;if(M===null)throw Error(`No command name given for module: ${this.shim.inspect(D)}`);if(D.aliases)M=[].concat(M).concat(D.aliases);this.addHandler(M,this.extractDesc(D),D.builder,D.handler,D.middlewares,D.deprecated);return}else if(h0(F)){this.addHandler([D].concat($),u,F.builder,F.handler,F.middlewares,F.deprecated);return}if(typeof D==="string"){let M=xD(D);$=$.map((Y)=>xD(Y).cmd);let H=!1,V=[M.cmd].concat($).filter((Y)=>{if($u.test(Y))return H=!0,!1;return!0});if(V.length===0&&H)V.push("$0");if(H)M.cmd=V[0],$=V.slice(1),D=D.replace($u,M.cmd);if($.forEach((Y)=>{this.aliasMap[Y]=M.cmd}),u!==!1)this.usage.command(D,u,H,$,B);if(this.handlers[M.cmd]={original:D,description:u,handler:C,builder:F||{},middlewares:Z,deprecated:B,demanded:M.demanded,optional:M.optional},H)this.defaultCommand=this.handlers[M.cmd]}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(D,u,F,C,E,B){let $=this.handlers[D]||this.handlers[this.aliasMap[D]]||this.defaultCommand,Z=u.getInternalMethods().getContext(),M=Z.commands.slice(),H=!D;if(D)Z.commands.push(D),Z.fullCommands.push($.original);let V=this.applyBuilderUpdateUsageAndParse(H,$,u,F.aliases,M,C,E,B);return i(V)?V.then((Y)=>this.applyMiddlewareAndGetResult(H,$,Y.innerArgv,Z,E,Y.aliases,u)):this.applyMiddlewareAndGetResult(H,$,V.innerArgv,Z,E,V.aliases,u)}applyBuilderUpdateUsageAndParse(D,u,F,C,E,B,$,Z){let M=u.builder,H=F;if(Pu(M)){F.getInternalMethods().getUsageInstance().freeze();let V=M(F.getInternalMethods().reset(C),Z);if(i(V))return V.then((Y)=>{return H=v0(Y)?Y:F,this.parseAndUpdateUsage(D,u,H,E,B,$)})}else if(k3(M))F.getInternalMethods().getUsageInstance().freeze(),H=F.getInternalMethods().reset(C),Object.keys(u.builder).forEach((V)=>{H.option(V,M[V])});return this.parseAndUpdateUsage(D,u,H,E,B,$)}parseAndUpdateUsage(D,u,F,C,E,B){if(D)F.getInternalMethods().getUsageInstance().unfreeze(!0);if(this.shouldUpdateUsage(F))F.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(C,u),u.description);let $=F.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,E,B);return i($)?$.then((Z)=>({aliases:F.parsed.aliases,innerArgv:Z})):{aliases:F.parsed.aliases,innerArgv:$}}shouldUpdateUsage(D){return!D.getInternalMethods().getUsageInstance().getUsageDisabled()&&D.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(D,u){let F=$u.test(u.original)?u.original.replace($u,"").trim():u.original,C=D.filter((E)=>{return!$u.test(E)});return C.push(F),`$0 ${C.join(" ")}`}handleValidationAndGetResult(D,u,F,C,E,B,$,Z){if(!B.getInternalMethods().getHasOutput()){let M=B.getInternalMethods().runValidation(E,Z,B.parsed.error,D);F=gD(F,(H)=>{return M(H),H})}if(u.handler&&!B.getInternalMethods().getHasOutput()){B.getInternalMethods().setHasOutput();let M=!!B.getOptions().configuration["populate--"];if(B.getInternalMethods().postProcess(F,M,!1,!1),F=yD(F,B,$,!1),F=gD(F,(H)=>{let V=u.handler(H);return i(V)?V.then(()=>H):H}),!D)B.getInternalMethods().getUsageInstance().cacheHelpMessage();if(i(F)&&!B.getInternalMethods().hasParseCallback())F.catch((H)=>{try{B.getInternalMethods().getUsageInstance().fail(null,H)}catch(V){}})}if(!D)C.commands.pop(),C.fullCommands.pop();return F}applyMiddlewareAndGetResult(D,u,F,C,E,B,$){let Z={};if(E)return F;if(!$.getInternalMethods().getHasOutput())Z=this.populatePositionals(u,F,C,$);let M=this.globalMiddleware.getMiddleware().slice(0).concat(u.middlewares),H=yD(F,$,M,!0);return i(H)?H.then((V)=>this.handleValidationAndGetResult(D,u,V,C,B,$,M,Z)):this.handleValidationAndGetResult(D,u,H,C,B,$,M,Z)}populatePositionals(D,u,F,C){u._=u._.slice(F.commands.length);let E=D.demanded.slice(0),B=D.optional.slice(0),$={};this.validation.positionalCount(E.length,u._.length);while(E.length){let Z=E.shift();this.populatePositional(Z,u,$)}while(B.length){let Z=B.shift();this.populatePositional(Z,u,$)}return u._=F.commands.concat(u._.map((Z)=>""+Z)),this.postProcessPositionals(u,$,this.cmdToParseOptions(D.original),C),$}populatePositional(D,u,F){let C=D.cmd[0];if(D.variadic)F[C]=u._.splice(0).map(String);else if(u._.length)F[C]=[String(u._.shift())]}cmdToParseOptions(D){let u={array:[],default:{},alias:{},demand:{}},F=xD(D);return F.demanded.forEach((C)=>{let[E,...B]=C.cmd;if(C.variadic)u.array.push(E),u.default[E]=[];u.alias[E]=B,u.demand[E]=!0}),F.optional.forEach((C)=>{let[E,...B]=C.cmd;if(C.variadic)u.array.push(E),u.default[E]=[];u.alias[E]=B}),u}postProcessPositionals(D,u,F,C){let E=Object.assign({},C.getOptions());E.default=Object.assign(F.default,E.default);for(let M of Object.keys(F.alias))E.alias[M]=(E.alias[M]||[]).concat(F.alias[M]);E.array=E.array.concat(F.array),E.config={};let B=[];if(Object.keys(u).forEach((M)=>{u[M].map((H)=>{if(E.configuration["unknown-options-as-args"])E.key[M]=!0;B.push(`--${M}`),B.push(H)})}),!B.length)return;let $=Object.assign({},E.configuration,{"populate--":!1}),Z=this.shim.Parser.detailed(B,Object.assign({},E,{configuration:$}));if(Z.error)C.getInternalMethods().getUsageInstance().fail(Z.error.message,Z.error);else{let M=Object.keys(u);Object.keys(u).forEach((H)=>{M.push(...Z.aliases[H])}),Object.keys(Z.argv).forEach((H)=>{if(M.includes(H)){if(!u[H])u[H]=Z.argv[H];if(!this.isInConfigs(C,H)&&!this.isDefaulted(C,H)&&Object.prototype.hasOwnProperty.call(D,H)&&Object.prototype.hasOwnProperty.call(Z.argv,H)&&(Array.isArray(D[H])||Array.isArray(Z.argv[H])))D[H]=[].concat(D[H],Z.argv[H]);else D[H]=Z.argv[H]}})}}isDefaulted(D,u){let{default:F}=D.getOptions();return Object.prototype.hasOwnProperty.call(F,u)||Object.prototype.hasOwnProperty.call(F,this.shim.Parser.camelCase(u))}isInConfigs(D,u){let{configObjects:F}=D.getOptions();return F.some((C)=>Object.prototype.hasOwnProperty.call(C,u))||F.some((C)=>Object.prototype.hasOwnProperty.call(C,this.shim.Parser.camelCase(u)))}runDefaultBuilderOn(D){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(D)){let F=$u.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");D.getInternalMethods().getUsageInstance().usage(F,this.defaultCommand.description)}let u=this.defaultCommand.builder;if(Pu(u))return u(D,!0);else if(!h0(u))Object.keys(u).forEach((F)=>{D.option(F,u[F])});return}extractDesc({describe:D,description:u,desc:F}){for(let C of[D,u,F]){if(typeof C==="string"||C===!1)return C;GD(C,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let D=this.frozens.pop();GD(D,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=D}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function m0(D,u,F,C){return new w0(D,u,F,C)}function h0(D){return typeof D==="object"&&!!D.builder&&typeof D.handler==="function"}function d3(D){return D.every((u)=>typeof u==="string")}function Pu(D){return typeof D==="function"}function k3(D){return typeof D==="object"}function p3(D){return typeof D==="object"&&!Array.isArray(D)}function bD(D={},u=()=>!0){let F={};return Bu(D).forEach((C)=>{if(u(C,D[C]))F[C]=D[C]}),F}function hD(D){if(typeof process>"u")return;[process.stdout,process.stderr].forEach((u)=>{let F=u;if(F._handle&&F.isTTY&&typeof F._handle.setBlocking==="function")F._handle.setBlocking(D)})}function y3(D){return typeof D==="boolean"}function d0(D,u){let F=u.y18n.__,C={},E=[];C.failFn=function(L){E.push(L)};let B=null,$=null,Z=!0;C.showHelpOnFail=function(L=!0,R){let[h,p]=typeof L==="string"?[!0,L]:[L,R];if(D.getInternalMethods().isGlobalContext())$=p;return B=p,Z=h,C};let M=!1;C.fail=function(L,R){let h=D.getInternalMethods().getLoggerInstance();if(E.length)for(let p=E.length-1;p>=0;--p){let DD=E[p];if(y3(DD)){if(R)throw R;else if(L)throw Error(L)}else DD(L,R,C)}else{if(D.getExitProcess())hD(!0);if(!M){if(M=!0,Z)D.showHelp("error"),h.error();if(L||R)h.error(L||R);let p=B||$;if(p){if(L||R)h.error("");h.error(p)}}if(R=R||new a(L),D.getExitProcess())return D.exit(1);else if(D.getInternalMethods().hasParseCallback())return D.exit(1,R);else throw R}};let H=[],V=!1;C.usage=(N,L)=>{if(N===null)return V=!0,H=[],C;return V=!1,H.push([N,L||""]),C},C.getUsage=()=>{return H},C.getUsageDisabled=()=>{return V},C.getPositionalGroupName=()=>{return F("Positionals:")};let Y=[];C.example=(N,L)=>{Y.push([N,L||""])};let q=[];C.command=function(L,R,h,p,DD=!1){if(h)q=q.map((k)=>{return k[2]=!1,k});q.push([L,R||"",h,p,DD])},C.getCommands=()=>q;let O={};C.describe=function(L,R){if(Array.isArray(L))L.forEach((h)=>{C.describe(h,R)});else if(typeof L==="object")Object.keys(L).forEach((h)=>{C.describe(h,L[h])});else O[L]=R},C.getDescriptions=()=>O;let W=[];C.epilog=(N)=>{W.push(N)};let J=!1,S;C.wrap=(N)=>{J=!0,S=N},C.getWrap=()=>{if(u.getEnv("YARGS_DISABLE_WRAP"))return null;if(!J)S=jD(),J=!0;return S};let d="__yargsString__:";C.deferY18nLookup=(N)=>d+N,C.help=function(){if(m)return m;QD();let L=D.customScriptName?D.$0:u.path.basename(D.$0),R=D.getDemandedOptions(),h=D.getDemandedCommands(),p=D.getDeprecatedOptions(),DD=D.getGroups(),k=D.getOptions(),FD=[];FD=FD.concat(Object.keys(O)),FD=FD.concat(Object.keys(R)),FD=FD.concat(Object.keys(h)),FD=FD.concat(Object.keys(k.default)),FD=FD.filter(uD),FD=Object.keys(FD.reduce((x,g)=>{if(g!=="_")x[g]=!0;return x},{}));let PD=C.getWrap(),t=u.cliui({width:PD,wrap:!!PD});if(!V){if(H.length)H.forEach((x)=>{if(t.div({text:`${x[0].replace(/\$0/g,L)}`}),x[1])t.div({text:`${x[1]}`,padding:[1,0,0,0]})}),t.div();else if(q.length){let x=null;if(h._)x=`${L} <${F("command")}>
15
- `;else x=`${L} [${F("command")}]
16
- `;t.div(`${x}`)}}if(q.length>1||q.length===1&&!q[0][2]){t.div(F("Commands:"));let x=D.getInternalMethods().getContext(),g=x.commands.length?`${x.commands.join(" ")} `:"";if(D.getInternalMethods().getParserConfiguration()["sort-commands"]===!0)q=q.sort((c,zD)=>c[0].localeCompare(zD[0]));let CD=L?`${L} `:"";q.forEach((c)=>{let zD=`${CD}${g}${c[0].replace(/^\$0 ?/,"")}`;t.span({text:zD,padding:[0,2,0,2],width:v(q,PD,`${L}${g}`)+4},{text:c[1]});let r=[];if(c[2])r.push(`[${F("default")}]`);if(c[3]&&c[3].length)r.push(`[${F("aliases:")} ${c[3].join(", ")}]`);if(c[4])if(typeof c[4]==="string")r.push(`[${F("deprecated: %s",c[4])}]`);else r.push(`[${F("deprecated")}]`);if(r.length)t.div({text:r.join(" "),padding:[0,0,0,2],align:"right"});else t.div()}),t.div()}let fD=(Object.keys(k.alias)||[]).concat(Object.keys(D.parsed.newAliases)||[]);FD=FD.filter((x)=>!D.parsed.newAliases[x]&&fD.every((g)=>(k.alias[g]||[]).indexOf(x)===-1));let Yu=F("Options:");if(!DD[Yu])DD[Yu]=[];l(FD,k.alias,DD,Yu);let P=(x)=>/^--/.test(xu(x)),Eu=Object.keys(DD).filter((x)=>DD[x].length>0).map((x)=>{let g=DD[x].filter(uD).map((CD)=>{if(fD.includes(CD))return CD;for(let c=0,zD;(zD=fD[c])!==void 0;c++)if((k.alias[zD]||[]).includes(CD))return zD;return CD});return{groupName:x,normalizedKeys:g}}).filter(({normalizedKeys:x})=>x.length>0).map(({groupName:x,normalizedKeys:g})=>{let CD=g.reduce((c,zD)=>{return c[zD]=[zD].concat(k.alias[zD]||[]).map((r)=>{if(x===C.getPositionalGroupName())return r;else return(/^[0-9]$/.test(r)?k.boolean.includes(zD)?"-":"--":r.length>1?"--":"-")+r}).sort((r,ED)=>P(r)===P(ED)?0:P(r)?1:-1).join(", "),c},{});return{groupName:x,normalizedKeys:g,switches:CD}});if(Eu.filter(({groupName:x})=>x!==C.getPositionalGroupName()).some(({normalizedKeys:x,switches:g})=>!x.every((CD)=>P(g[CD]))))Eu.filter(({groupName:x})=>x!==C.getPositionalGroupName()).forEach(({normalizedKeys:x,switches:g})=>{x.forEach((CD)=>{if(P(g[CD]))g[CD]=g3(g[CD],4)})});if(Eu.forEach(({groupName:x,normalizedKeys:g,switches:CD})=>{t.div(x),g.forEach((c)=>{let zD=CD[c],r=O[c]||"",ED=null;if(r.includes(d))r=F(r.substring(d.length));if(k.boolean.includes(c))ED=`[${F("boolean")}]`;if(k.count.includes(c))ED=`[${F("count")}]`;if(k.string.includes(c))ED=`[${F("string")}]`;if(k.normalize.includes(c))ED=`[${F("string")}]`;if(k.array.includes(c))ED=`[${F("array")}]`;if(k.number.includes(c))ED=`[${F("number")}]`;let au=(T)=>typeof T==="string"?`[${F("deprecated: %s",T)}]`:`[${F("deprecated")}]`,Q=[c in p?au(p[c]):null,ED,c in R?`[${F("required")}]`:null,k.choices&&k.choices[c]?`[${F("choices:")} ${C.stringifiedValues(k.choices[c])}]`:null,s(k.default[c],k.defaultDescription[c])].filter(Boolean).join(" ");t.span({text:xu(zD),padding:[0,2,0,2+c0(zD)],width:v(CD,PD)+4},r);let G=D.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;if(Q&&!G)t.div({text:Q,padding:[0,0,0,2],align:"right"});else t.div()}),t.div()}),Y.length)t.div(F("Examples:")),Y.forEach((x)=>{x[0]=x[0].replace(/\$0/g,L)}),Y.forEach((x)=>{if(x[1]==="")t.div({text:x[0],padding:[0,2,0,2]});else t.div({text:x[0],padding:[0,2,0,2],width:v(Y,PD)+4},{text:x[1]})}),t.div();if(W.length>0){let x=W.map((g)=>g.replace(/\$0/g,L)).join(`
17
- `);t.div(`${x}
18
- `)}return t.toString().replace(/\s*$/,"")};function v(N,L,R){let h=0;if(!Array.isArray(N))N=Object.values(N).map((p)=>[p]);if(N.forEach((p)=>{h=Math.max(u.stringWidth(R?`${R} ${xu(p[0])}`:xu(p[0]))+c0(p[0]),h)}),L)h=Math.min(h,parseInt((L*0.5).toString(),10));return h}function QD(){let N=D.getDemandedOptions(),L=D.getOptions();(Object.keys(L.alias)||[]).forEach((R)=>{L.alias[R].forEach((h)=>{if(O[h])C.describe(R,O[h]);if(h in N)D.demandOption(R,N[h]);if(L.boolean.includes(h))D.boolean(R);if(L.count.includes(h))D.count(R);if(L.string.includes(h))D.string(R);if(L.normalize.includes(h))D.normalize(R);if(L.array.includes(h))D.array(R);if(L.number.includes(h))D.number(R)})})}let m;C.cacheHelpMessage=function(){m=this.help()},C.clearCachedHelpMessage=function(){m=void 0},C.hasCachedHelpMessage=function(){return!!m};function l(N,L,R,h){let p=[],DD=null;return Object.keys(R).forEach((k)=>{p=p.concat(R[k])}),N.forEach((k)=>{if(DD=[k].concat(L[k]),!DD.some((FD)=>p.indexOf(FD)!==-1))R[h].push(k)}),p}function uD(N){return D.getOptions().hiddenOptions.indexOf(N)<0||D.parsed.argv[D.getOptions().showHiddenOpt]}C.showHelp=(N)=>{let L=D.getInternalMethods().getLoggerInstance();if(!N)N="error";(typeof N==="function"?N:L[N])(C.help())},C.functionDescription=(N)=>{return["(",N.name?u.Parser.decamelize(N.name,"-"):F("generated-value"),")"].join("")},C.stringifiedValues=function(L,R){let h="",p=R||", ",DD=[].concat(L);if(!L||!DD.length)return h;return DD.forEach((k)=>{if(h.length)h+=p;h+=JSON.stringify(k)}),h};function s(N,L){let R=`[${F("default:")} `;if(N===void 0&&!L)return null;if(L)R+=L;else switch(typeof N){case"string":R+=`"${N}"`;break;case"object":R+=JSON.stringify(N);break;default:R+=N}return`${R}]`}function jD(){if(u.process.stdColumns)return Math.min(80,u.process.stdColumns);else return 80}let y=null;C.version=(N)=>{y=N},C.showVersion=(N)=>{let L=D.getInternalMethods().getLoggerInstance();if(!N)N="error";(typeof N==="function"?N:L[N])(y)},C.reset=function(L){return B=null,M=!1,H=[],V=!1,W=[],Y=[],q=[],O=bD(O,(R)=>!L[R]),C};let Ju=[];return C.freeze=function(){Ju.push({failMessage:B,failureOutput:M,usages:H,usageDisabled:V,epilogs:W,examples:Y,commands:q,descriptions:O})},C.unfreeze=function(L=!1){let R=Ju.pop();if(!R)return;if(L)O={...R.descriptions,...O},q=[...R.commands,...q],H=[...R.usages,...H],Y=[...R.examples,...Y],W=[...R.epilogs,...W];else({failMessage:B,failureOutput:M,usages:H,usageDisabled:V,epilogs:W,examples:Y,commands:q,descriptions:O}=R)},C}function YF(D){return typeof D==="object"}function g3(D,u){return YF(D)?{text:D.text,indentation:D.indentation+u}:{text:D,indentation:u}}function c0(D){return YF(D)?D.indentation:0}function xu(D){return YF(D)?D.text:D}var k0=`###-begin-{{app_name}}-completions-###
13
+ `).map((i)=>ho(i,t,n)).join(`
14
+ `)}function un(e){return Un(e,{stringWidth:je,stripAnsi:Oe,wrap:on})}import{dirname as hi,resolve as pi}from"path";import{readdirSync as po,statSync as go}from"fs";function an(e,t){let n=pi(".",e),i;if(!go(n).isDirectory())n=hi(n);while(!0){if(i=t(n,po(n)),i)return pi(n,i);if(n=hi(i=n),i===n)break}}import{inspect as Yo}from"util";import{fileURLToPath as Ni}from"url";import{format as bo}from"util";import{normalize as Eo,resolve as yo}from"path";function He(e){if(!(e!==e.toLowerCase()&&e!==e.toUpperCase()))e=e.toLowerCase();if(e.indexOf("-")===-1&&e.indexOf("_")===-1)return e;else{let n="",i=!1,r=e.match(/^-+/);for(let s=r?r[0].length:0;s<e.length;s++){let o=e.charAt(s);if(i)i=!1,o=o.toUpperCase();if(s!==0&&(o==="-"||o==="_"))i=!0;else if(o!=="-"&&o!=="_")n+=o}return n}}function vt(e,t){let n=e.toLowerCase();t=t||"-";let i="";for(let r=0;r<e.length;r++){let s=n.charAt(r),o=e.charAt(r);if(s!==o&&r>0)i+=`${t}${n.charAt(r)}`;else i+=o}return i}function $t(e){if(e===null||e===void 0)return!1;if(typeof e==="number")return!0;if(/^0x[0-9a-f]+$/i.test(e))return!0;if(/^0[^.]/.test(e))return!1;return/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function gi(e){if(Array.isArray(e))return e.map((o)=>typeof o!=="string"?o+"":o);e=e.trim();let t=0,n=null,i=null,r=null,s=[];for(let o=0;o<e.length;o++){if(n=i,i=e.charAt(o),i===" "&&!r){if(n!==" ")t++;continue}if(i===r)r=null;else if((i==="'"||i==='"')&&!r)r=i;if(!s[t])s[t]="";s[t]+=i}return s}var be;(function(e){e.BOOLEAN="boolean",e.STRING="string",e.NUMBER="number",e.ARRAY="array"})(be||(be={}));var ve;class cn{constructor(e){ve=e}parse(e,t){let n=Object.assign({alias:void 0,array:void 0,boolean:void 0,config:void 0,configObjects:void 0,configuration:void 0,coerce:void 0,count:void 0,default:void 0,envPrefix:void 0,narg:void 0,normalize:void 0,string:void 0,number:void 0,__:void 0,key:void 0},t),i=gi(e),r=typeof e==="string",s=mo(Object.assign(Object.create(null),n.alias)),o=Object.assign({"boolean-negation":!0,"camel-case-expansion":!0,"combine-arrays":!1,"dot-notation":!0,"duplicate-arguments-array":!0,"flatten-duplicate-arrays":!0,"greedy-arrays":!0,"halt-at-non-option":!1,"nargs-eats-options":!1,"negation-prefix":"no-","parse-numbers":!0,"parse-positional-numbers":!0,"populate--":!1,"set-placeholder-key":!1,"short-option-groups":!0,"strip-aliased":!1,"strip-dashed":!1,"unknown-options-as-args":!1},n.configuration),a=Object.assign(Object.create(null),n.default),c=n.configObjects||[],g=n.envPrefix,E=o["populate--"],h=E?"--":"_",p=Object.create(null),m=Object.create(null),b=n.__||ve.format,D={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]},j=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/,L=new RegExp("^--"+o["negation-prefix"]+"(.+)");if([].concat(n.array||[]).filter(Boolean).forEach(function(l){let d=typeof l==="object"?l.key:l,y=Object.keys(l).map(function(F){return{boolean:"bools",string:"strings",number:"numbers"}[F]}).filter(Boolean).pop();if(y)D[y][d]=!0;D.arrays[d]=!0,D.keys.push(d)}),[].concat(n.boolean||[]).filter(Boolean).forEach(function(l){D.bools[l]=!0,D.keys.push(l)}),[].concat(n.string||[]).filter(Boolean).forEach(function(l){D.strings[l]=!0,D.keys.push(l)}),[].concat(n.number||[]).filter(Boolean).forEach(function(l){D.numbers[l]=!0,D.keys.push(l)}),[].concat(n.count||[]).filter(Boolean).forEach(function(l){D.counts[l]=!0,D.keys.push(l)}),[].concat(n.normalize||[]).filter(Boolean).forEach(function(l){D.normalize[l]=!0,D.keys.push(l)}),typeof n.narg==="object")Object.entries(n.narg).forEach(([l,d])=>{if(typeof d==="number")D.nargs[l]=d,D.keys.push(l)});if(typeof n.coerce==="object")Object.entries(n.coerce).forEach(([l,d])=>{if(typeof d==="function")D.coercions[l]=d,D.keys.push(l)});if(typeof n.config<"u"){if(Array.isArray(n.config)||typeof n.config==="string")[].concat(n.config).filter(Boolean).forEach(function(l){D.configs[l]=!0});else if(typeof n.config==="object")Object.entries(n.config).forEach(([l,d])=>{if(typeof d==="boolean"||typeof d==="function")D.configs[l]=d})}gt(n.key,s,n.default,D.arrays),Object.keys(a).forEach(function(l){(D.aliases[l]||[]).forEach(function(d){a[d]=a[l]})});let T=null;en();let ce=[],R=Object.assign(Object.create(null),{_:[]}),Y={};for(let l=0;l<i.length;l++){let d=i[l],y=d.replace(/^-{3,}/,"---"),F,f,_,x,O,oe;if(d!=="--"&&/^-/.test(d)&&z(d))ne(d);else if(y.match(/^---+(=|$)/)){ne(d);continue}else if(d.match(/^--.+=/)||!o["short-option-groups"]&&d.match(/^-.+=/)){if(x=d.match(/^--?([^=]+)=([\s\S]*)$/),x!==null&&Array.isArray(x)&&x.length>=3)if(v(x[1],D.arrays))l=Ae(l,x[1],i,x[2]);else if(v(x[1],D.nargs)!==!1)l=X(l,x[1],i,x[2]);else H(x[1],x[2],!0)}else if(d.match(L)&&o["boolean-negation"]){if(x=d.match(L),x!==null&&Array.isArray(x)&&x.length>=2)f=x[1],H(f,v(f,D.arrays)?[!1]:!1)}else if(d.match(/^--.+/)||!o["short-option-groups"]&&d.match(/^-[^-]+/)){if(x=d.match(/^--?(.+)/),x!==null&&Array.isArray(x)&&x.length>=2)if(f=x[1],v(f,D.arrays))l=Ae(l,f,i);else if(v(f,D.nargs)!==!1)l=X(l,f,i);else if(O=i[l+1],O!==void 0&&(!O.match(/^-/)||O.match(j))&&!v(f,D.bools)&&!v(f,D.counts))H(f,O),l++;else if(/^(true|false)$/.test(O))H(f,O),l++;else H(f,W(f))}else if(d.match(/^-.\..+=/)){if(x=d.match(/^-([^=]+)=([\s\S]*)$/),x!==null&&Array.isArray(x)&&x.length>=3)H(x[1],x[2])}else if(d.match(/^-.\..+/)&&!d.match(j)){if(O=i[l+1],x=d.match(/^-(.\..+)/),x!==null&&Array.isArray(x)&&x.length>=2)if(f=x[1],O!==void 0&&!O.match(/^-/)&&!v(f,D.bools)&&!v(f,D.counts))H(f,O),l++;else H(f,W(f))}else if(d.match(/^-[^-]+/)&&!d.match(j)){_=d.slice(1,-1).split(""),F=!1;for(let de=0;de<_.length;de++){if(O=d.slice(de+2),_[de+1]&&_[de+1]==="="){if(oe=d.slice(de+3),f=_[de],v(f,D.arrays))l=Ae(l,f,i,oe);else if(v(f,D.nargs)!==!1)l=X(l,f,i,oe);else H(f,oe);F=!0;break}if(O==="-"){H(_[de],O);continue}if(/[A-Za-z]/.test(_[de])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(O)&&v(O,D.bools)===!1){H(_[de],O),F=!0;break}if(_[de+1]&&_[de+1].match(/\W/)){H(_[de],O),F=!0;break}else H(_[de],W(_[de]))}if(f=d.slice(-1)[0],!F&&f!=="-")if(v(f,D.arrays))l=Ae(l,f,i);else if(v(f,D.nargs)!==!1)l=X(l,f,i);else if(O=i[l+1],O!==void 0&&(!/^(-|--)[^-]/.test(O)||O.match(j))&&!v(f,D.bools)&&!v(f,D.counts))H(f,O),l++;else if(/^(true|false)$/.test(O))H(f,O),l++;else H(f,W(f))}else if(d.match(/^-[0-9]$/)&&d.match(j)&&v(d.slice(1),D.bools))f=d.slice(1),H(f,W(f));else if(d==="--"){ce=i.slice(l+1);break}else if(o["halt-at-non-option"]){ce=i.slice(l);break}else ne(d)}if(te(R,!0),te(R,!1),B(R),V(),ke(R,D.aliases,a,!0),G(R),o["set-placeholder-key"])ie(R);if(Object.keys(D.counts).forEach(function(l){if(!U(R,l.split(".")))H(l,0)}),E&&ce.length)R[h]=[];if(ce.forEach(function(l){R[h].push(l)}),o["camel-case-expansion"]&&o["strip-dashed"])Object.keys(R).filter((l)=>l!=="--"&&l.includes("-")).forEach((l)=>{delete R[l]});if(o["strip-aliased"])[].concat(...Object.keys(s).map((l)=>s[l])).forEach((l)=>{if(o["camel-case-expansion"]&&l.includes("-"))delete R[l.split(".").map((d)=>He(d)).join(".")];delete R[l]});function ne(l){let d=C("_",l);if(typeof d==="string"||typeof d==="number")R._.push(d)}function X(l,d,y,F){let f,_=v(d,D.nargs);if(_=typeof _!=="number"||isNaN(_)?1:_,_===0){if(!se(F))T=Error(b("Argument unexpected for: %s",d));return H(d,W(d)),l}let x=se(F)?0:1;if(o["nargs-eats-options"]){if(y.length-(l+1)+x<_)T=Error(b("Not enough arguments following: %s",d));x=_}else{for(f=l+1;f<y.length;f++)if(!y[f].match(/^-[^0-9]/)||y[f].match(j)||z(y[f]))x++;else break;if(x<_)T=Error(b("Not enough arguments following: %s",d))}let O=Math.min(x,_);if(!se(F)&&O>0)H(d,F),O--;for(f=l+1;f<O+l+1;f++)H(d,y[f]);return l+O}function Ae(l,d,y,F){let f=[],_=F||y[l+1],x=v(d,D.nargs);if(v(d,D.bools)&&!/^(true|false)$/.test(_))f.push(!0);else if(se(_)||se(F)&&/^-/.test(_)&&!j.test(_)&&!z(_)){if(a[d]!==void 0){let O=a[d];f=Array.isArray(O)?O:[O]}}else{if(!se(F))f.push(S(d,F,!0));for(let O=l+1;O<y.length;O++){if(!o["greedy-arrays"]&&f.length>0||x&&typeof x==="number"&&f.length>=x)break;if(_=y[O],/^-/.test(_)&&!j.test(_)&&!z(_))break;l=O,f.push(S(d,_,r))}}if(typeof x==="number"&&(x&&f.length<x||isNaN(x)&&f.length===0))T=Error(b("Not enough arguments following: %s",d));return H(d,f),l}function H(l,d,y=r){if(/-/.test(l)&&o["camel-case-expansion"]){let _=l.split(".").map(function(x){return He(x)}).join(".");pt(l,_)}let F=S(l,d,y),f=l.split(".");if(Pe(R,f,F),D.aliases[l])D.aliases[l].forEach(function(_){let x=_.split(".");Pe(R,x,F)});if(f.length>1&&o["dot-notation"])(D.aliases[f[0]]||[]).forEach(function(_){let x=_.split("."),O=[].concat(f);if(O.shift(),x=x.concat(O),!(D.aliases[l]||[]).includes(x.join(".")))Pe(R,x,F)});if(v(l,D.normalize)&&!v(l,D.arrays))[l].concat(D.aliases[l]||[]).forEach(function(x){Object.defineProperty(Y,x,{enumerable:!0,get(){return d},set(O){d=typeof O==="string"?ve.normalize(O):O}})})}function pt(l,d){if(!(D.aliases[l]&&D.aliases[l].length))D.aliases[l]=[d],p[d]=!0;if(!(D.aliases[d]&&D.aliases[d].length))pt(d,l)}function S(l,d,y){if(y)d=Fo(d);if(v(l,D.bools)||v(l,D.counts)){if(typeof d==="string")d=d==="true"}let F=Array.isArray(d)?d.map(function(f){return C(l,f)}):C(l,d);if(v(l,D.counts)&&(se(F)||typeof F==="boolean"))F=ln();if(v(l,D.normalize)&&v(l,D.arrays))if(Array.isArray(d))F=d.map((f)=>ve.normalize(f));else F=ve.normalize(d);return F}function C(l,d){if(!o["parse-positional-numbers"]&&l==="_")return d;if(!v(l,D.strings)&&!v(l,D.bools)&&!Array.isArray(d)){if($t(d)&&o["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${d}`)))||!se(d)&&v(l,D.numbers))d=Number(d)}return d}function B(l){let d=Object.create(null);ke(d,D.aliases,a),Object.keys(D.configs).forEach(function(y){let F=l[y]||d[y];if(F)try{let f=null,_=ve.resolve(ve.cwd(),F),x=D.configs[y];if(typeof x==="function"){try{f=x(_)}catch(O){f=O}if(f instanceof Error){T=f;return}}else f=ve.require(_);N(f)}catch(f){if(f.name==="PermissionDenied")T=f;else if(l[y])T=Error(b("Invalid JSON config file: %s",F))}})}function N(l,d){Object.keys(l).forEach(function(y){let F=l[y],f=d?d+"."+y:y;if(typeof F==="object"&&F!==null&&!Array.isArray(F)&&o["dot-notation"])N(F,f);else if(!U(R,f.split("."))||v(f,D.arrays)&&o["combine-arrays"])H(f,F)})}function V(){if(typeof c<"u")c.forEach(function(l){N(l)})}function te(l,d){if(typeof g>"u")return;let y=typeof g==="string"?g:"",F=ve.env();Object.keys(F).forEach(function(f){if(y===""||f.lastIndexOf(y,0)===0){let _=f.split("__").map(function(x,O){if(O===0)x=x.substring(y.length);return He(x)});if((d&&D.configs[_.join(".")]||!d)&&!U(l,_))H(_.join("."),F[f])}})}function G(l){let d,y=new Set;Object.keys(l).forEach(function(F){if(!y.has(F)){if(d=v(F,D.coercions),typeof d==="function")try{let f=C(F,d(l[F]));[].concat(D.aliases[F]||[],F).forEach((_)=>{y.add(_),l[_]=f})}catch(f){T=f}}})}function ie(l){return D.keys.forEach((d)=>{if(~d.indexOf("."))return;if(typeof l[d]>"u")l[d]=void 0}),l}function ke(l,d,y,F=!1){Object.keys(y).forEach(function(f){if(!U(l,f.split("."))){if(Pe(l,f.split("."),y[f]),F)m[f]=!0;(d[f]||[]).forEach(function(_){if(U(l,_.split(".")))return;Pe(l,_.split("."),y[f])})}})}function U(l,d){let y=l;if(!o["dot-notation"])d=[d.join(".")];d.slice(0,-1).forEach(function(f){y=y[f]||{}});let F=d[d.length-1];if(typeof y!=="object")return!1;else return F in y}function Pe(l,d,y){let F=l;if(!o["dot-notation"])d=[d.join(".")];d.slice(0,-1).forEach(function(oe){if(oe=mi(oe),typeof F==="object"&&F[oe]===void 0)F[oe]={};if(typeof F[oe]!=="object"||Array.isArray(F[oe])){if(Array.isArray(F[oe]))F[oe].push({});else F[oe]=[F[oe],{}];F=F[oe][F[oe].length-1]}else F=F[oe]});let f=mi(d[d.length-1]),_=v(d.join("."),D.arrays),x=Array.isArray(y),O=o["duplicate-arguments-array"];if(!O&&v(f,D.nargs)){if(O=!0,!se(F[f])&&D.nargs[f]===1||Array.isArray(F[f])&&F[f].length===D.nargs[f])F[f]=void 0}if(y===ln())F[f]=ln(F[f]);else if(Array.isArray(F[f]))if(O&&_&&x)F[f]=o["flatten-duplicate-arrays"]?F[f].concat(y):(Array.isArray(F[f][0])?F[f]:[F[f]]).concat([y]);else if(!O&&Boolean(_)===Boolean(x))F[f]=y;else F[f]=F[f].concat([y]);else if(F[f]===void 0&&_)F[f]=x?y:[y];else if(O&&!(F[f]===void 0||v(f,D.counts)||v(f,D.bools)))F[f]=[F[f],y];else F[f]=y}function gt(...l){l.forEach(function(d){Object.keys(d||{}).forEach(function(y){if(D.aliases[y])return;D.aliases[y]=[].concat(s[y]||[]),D.aliases[y].concat(y).forEach(function(F){if(/-/.test(F)&&o["camel-case-expansion"]){let f=He(F);if(f!==y&&D.aliases[y].indexOf(f)===-1)D.aliases[y].push(f),p[f]=!0}}),D.aliases[y].concat(y).forEach(function(F){if(F.length>1&&/[A-Z]/.test(F)&&o["camel-case-expansion"]){let f=vt(F,"-");if(f!==y&&D.aliases[y].indexOf(f)===-1)D.aliases[y].push(f),p[f]=!0}}),D.aliases[y].forEach(function(F){D.aliases[F]=[y].concat(D.aliases[y].filter(function(f){return F!==f}))})})})}function v(l,d){let y=[].concat(D.aliases[l]||[],l),F=Object.keys(d),f=y.find((_)=>F.includes(_));return f?d[f]:!1}function ot(l){let d=Object.keys(D);return[].concat(d.map((F)=>D[F])).some(function(F){return Array.isArray(F)?F.includes(l):F[l]})}function Gn(l,...d){return[].concat(...d).some(function(F){let f=l.match(F);return f&&ot(f[1])})}function k(l){if(l.match(j)||!l.match(/^-[^-]+/))return!1;let d=!0,y,F=l.slice(1).split("");for(let f=0;f<F.length;f++){if(y=l.slice(f+2),!ot(F[f])){d=!1;break}if(F[f+1]&&F[f+1]==="="||y==="-"||/[A-Za-z]/.test(F[f])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(y)||F[f+1]&&F[f+1].match(/\W/))break}return d}function z(l){return o["unknown-options-as-args"]&&re(l)}function re(l){if(l=l.replace(/^-{3,}/,"--"),l.match(j))return!1;if(k(l))return!1;return!Gn(l,/^-+([^=]+?)=[\s\S]*$/,L,/^-+([^=]+?)$/,/^-+([^=]+?)-$/,/^-+([^=]+?\d+)$/,/^-+([^=]+?)\W+.*$/)}function W(l){if(!v(l,D.bools)&&!v(l,D.counts)&&`${l}`in a)return a[l];else return ae(Z(l))}function ae(l){return{[be.BOOLEAN]:!0,[be.STRING]:"",[be.NUMBER]:void 0,[be.ARRAY]:[]}[l]}function Z(l){let d=be.BOOLEAN;if(v(l,D.strings))d=be.STRING;else if(v(l,D.numbers))d=be.NUMBER;else if(v(l,D.bools))d=be.BOOLEAN;else if(v(l,D.arrays))d=be.ARRAY;return d}function se(l){return l===void 0}function en(){Object.keys(D.counts).find((l)=>{if(v(l,D.arrays))return T=Error(b("Invalid configuration: %s, opts.count excludes opts.array.",l)),!0;else if(v(l,D.nargs))return T=Error(b("Invalid configuration: %s, opts.count excludes opts.narg.",l)),!0;return!1})}return{aliases:Object.assign({},D.aliases),argv:Object.assign(Y,R),configuration:o,defaulted:Object.assign({},m),error:T,newAliases:Object.assign({},p)}}}function mo(e){let t=[],n=Object.create(null),i=!0;Object.keys(e).forEach(function(r){t.push([].concat(e[r],r))});while(i){i=!1;for(let r=0;r<t.length;r++)for(let s=r+1;s<t.length;s++)if(t[r].filter(function(a){return t[s].indexOf(a)!==-1}).length){t[r]=t[r].concat(t[s]),t.splice(s,1),i=!0;break}}return t.forEach(function(r){r=r.filter(function(o,a,c){return c.indexOf(o)===a});let s=r.pop();if(s!==void 0&&typeof s==="string")n[s]=r}),n}function ln(e){return e!==void 0?e+1:1}function mi(e){if(e==="__proto__")return"___proto___";return e}function Fo(e){return typeof e==="string"&&(e[0]==="'"||e[0]==='"')&&e[e.length-1]===e[0]?e.substring(1,e.length-1):e}import{readFileSync as Co}from"fs";import{createRequire as Fi}from"module";var fn,dn,Dn,bi=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):20,Ei=(dn=(fn=process===null||process===void 0?void 0:process.versions)===null||fn===void 0?void 0:fn.node)!==null&&dn!==void 0?dn:(Dn=process===null||process===void 0?void 0:process.version)===null||Dn===void 0?void 0:Dn.slice(1);if(Ei){if(Number(Ei.match(/^([^.]+)/)[1])<bi)throw Error(`yargs parser supports a minimum Node.js version of ${bi}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`)}var xo=process?process.env:{},yi=Fi?Fi(import.meta.url):void 0,Ci=new cn({cwd:process.cwd,env:()=>xo,format:bo,normalize:Eo,resolve:yo,require:(e)=>{if(typeof yi<"u")return yi(e);else if(e.match(/\.json$/))return JSON.parse(Co(e,"utf8"));else throw Error("only .json config files are supported in ESM")}}),mt=function(t,n){return Ci.parse(t.slice(),n).argv};mt.detailed=function(e,t){return Ci.parse(e.slice(),t)};mt.camelCase=He;mt.decamelize=vt;mt.looksLikeNumber=$t;var xi=mt;import{basename as Jo,dirname as Ko,extname as qo,relative as Xo,resolve as Mi,join as Zo}from"path";function wo(){if(Ao())return 0;return 1}function Ao(){return _o()&&!process.defaultApp}function _o(){return!!process.versions.electron}function wi(){return process.argv[wo()]}var So=new Intl.Segmenter,Ai=/^(?:\p{Default_Ignorable_Code_Point}|\p{Control}|\p{Format}|\p{Nonspacing_Mark}|\p{Enclosing_Mark}|\p{Surrogate})+$/v,Bo=/^[\p{Default_Ignorable_Code_Point}\p{Control}\p{Format}\p{Nonspacing_Mark}\p{Enclosing_Mark}\p{Surrogate}]+/v,Po=/\p{Spacing_Mark}/v,Oo=/^\p{RGI_Emoji}$/v,jo=/^[\d#*]\u20E3$/,vo=/\p{Extended_Pictographic}/gu;function $o(e){if(e.length>50)return!1;if(jo.test(e))return!0;if(e.includes("\u200D")){let t=e.match(vo);return t!==null&&t.length>=2}return!1}function ko(e){return e.replace(Bo,"")}function Mo(e){return Ai.test(e)}function _i(e){return e>=4352&&e<=4447||e>=43360&&e<=43388}function Si(e){return e>=4448&&e<=4519||e>=55216&&e<=55238}function Bi(e){return e>=4520&&e<=4607||e>=55243&&e<=55291}function No(e){return _i(e)||Si(e)||Bi(e)}function Io(e,t){let n=[];for(let r of e){if(Ai.test(r))continue;n.push(r.codePointAt(0))}if(n.length===0)return;let i=0;for(let r=0;r<n.length;r++){let s=n[r];if(!No(s)){if(i===0)return;for(let o=r;o<n.length;o++)i+=Ve(n[o],t);return i}if(_i(s)&&Si(n[r+1])){i+=2,r+=Bi(n[r+2])?2:1;continue}i+=Ve(s,t)}return i}function Ro(e,t){let n=0,i=!0;for(let r of e){if(i){i=!1;continue}if(Po.test(r)||r>="\uFF00"&&r<="\uFFEF")n+=Ve(r.codePointAt(0),t)}return n}function hn(e,t={}){if(typeof e!=="string"||e.length===0)return 0;let{ambiguousIsNarrow:n=!0,countAnsiEscapeCodes:i=!1}=t,r=e;if(!i&&(r.includes("\x1B")||r.includes("\x9B")))r=Oe(r);if(r.length===0)return 0;if(/^[\u0020-\u007E]*$/.test(r))return r.length;let s=0,o={ambiguousAsWide:!n};for(let{segment:a}of So.segment(r)){if(Mo(a))continue;if(Oo.test(a)||$o(a)){s+=2;continue}let c=ko(a),g=Io(c,o);if(g!==void 0){s+=g;continue}let E=c.codePointAt(0);s+=Ve(E,o),s+=Ro(c,o)}return s}import{readFileSync as To,statSync as Wo,writeFile as Lo}from"fs";import{format as Go}from"util";import{resolve as Vo}from"path";var Pi={fs:{readFileSync:To,writeFile:Lo},format:Go,resolve:Vo,exists:(e)=>{try{return Wo(e).isFile()}catch(t){return!1}}};var xe;class Oi{constructor(e){e=e||{},this.directory=e.directory||"./locales",this.updateFiles=typeof e.updateFiles==="boolean"?e.updateFiles:!0,this.locale=e.locale||"en",this.fallbackToLanguage=typeof e.fallbackToLanguage==="boolean"?e.fallbackToLanguage:!0,this.cache=Object.create(null),this.writeQueue=[]}__(...e){if(typeof arguments[0]!=="string")return this._taggedLiteral(arguments[0],...arguments);let t=e.shift(),n=function(){};if(typeof e[e.length-1]==="function")n=e.pop();if(n=n||function(){},!this.cache[this.locale])this._readLocaleFile();if(!this.cache[this.locale][t]&&this.updateFiles)this.cache[this.locale][t]=t,this._enqueueWrite({directory:this.directory,locale:this.locale,cb:n});else n();return xe.format.apply(xe.format,[this.cache[this.locale][t]||t].concat(e))}__n(){let e=Array.prototype.slice.call(arguments),t=e.shift(),n=e.shift(),i=e.shift(),r=function(){};if(typeof e[e.length-1]==="function")r=e.pop();if(!this.cache[this.locale])this._readLocaleFile();let s=i===1?t:n;if(this.cache[this.locale][t])s=this.cache[this.locale][t][i===1?"one":"other"];if(!this.cache[this.locale][t]&&this.updateFiles)this.cache[this.locale][t]={one:t,other:n},this._enqueueWrite({directory:this.directory,locale:this.locale,cb:r});else r();let o=[s];if(~s.indexOf("%d"))o.push(i);return xe.format.apply(xe.format,o.concat(e))}setLocale(e){this.locale=e}getLocale(){return this.locale}updateLocale(e){if(!this.cache[this.locale])this._readLocaleFile();for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))this.cache[this.locale][t]=e[t]}_taggedLiteral(e,...t){let n="";return e.forEach(function(i,r){let s=t[r+1];if(n+=i,typeof s<"u")n+="%s"}),this.__.apply(this,[n].concat([].slice.call(t,1)))}_enqueueWrite(e){if(this.writeQueue.push(e),this.writeQueue.length===1)this._processWriteQueue()}_processWriteQueue(){let e=this,t=this.writeQueue[0],n=t.directory,i=t.locale,r=t.cb,s=this._resolveLocaleFile(n,i),o=JSON.stringify(this.cache[i],null,2);xe.fs.writeFile(s,o,"utf-8",function(a){if(e.writeQueue.shift(),e.writeQueue.length>0)e._processWriteQueue();r(a)})}_readLocaleFile(){let e={},t=this._resolveLocaleFile(this.directory,this.locale);try{if(xe.fs.readFileSync)e=JSON.parse(xe.fs.readFileSync(t,"utf-8"))}catch(n){if(n instanceof SyntaxError)n.message="syntax error in "+t;if(n.code==="ENOENT")e={};else throw n}this.cache[this.locale]=e}_resolveLocaleFile(e,t){let n=xe.resolve(e,"./",t+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(n)&&~t.lastIndexOf("_")){let i=xe.resolve(e,"./",t.split("_")[0]+".json");if(this._fileExistsSync(i))n=i}return n}_fileExistsSync(e){return xe.exists(e)}}function ji(e,t){xe=t;let n=new Oi(e);return{__:n.__.bind(n),__n:n.__n.bind(n),setLocale:n.setLocale.bind(n),getLocale:n.getLocale.bind(n),updateLocale:n.updateLocale.bind(n),locale:n.locale}}var Ho=(e)=>ji(e,Pi),vi=Ho;var Ii=zs(ki(),1);import{createRequire as Qo}from"module";import{readFileSync as eu,readdirSync as tu}from"fs";var pn=Ni(import.meta.url),nu=pn.substring(0,pn.lastIndexOf("node_modules")),iu=Qo(import.meta.url),Ri={assert:{notStrictEqual:zo,strictEqual:Uo},cliui:un,findUp:an,getEnv:(e)=>process.env[e],inspect:Yo,getProcessArgvBin:wi,mainFilename:nu||process.cwd(),Parser:xi,path:{basename:Jo,dirname:Ko,extname:qo,relative:Xo,resolve:Mi,join:Zo},process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(e,t)=>process.emitWarning(e,t),execPath:()=>process.execPath,exit:(e)=>{process.exit(e)},nextTick:process.nextTick,stdColumns:typeof process.stdout.columns<"u"?process.stdout.columns:null},readFileSync:eu,readdirSync:tu,require:iu,getCallerFile:()=>{let e=Ii.default(3);return e.match(/^file:\/\//)?Ni(e):e},stringWidth:hn,y18n:vi({directory:Mi(pn,"../../../locales"),updateFiles:!1})};function De(e,t,n,i){n.assert.notStrictEqual(e,t,i)}function gn(e,t){t.assert.strictEqual(typeof e,"string")}function ut(e){return Object.keys(e)}function J(e){return!!e&&!!e.then&&typeof e.then==="function"}class Q extends Error{constructor(e){super(e||"yargs error");if(this.name="YError",Error.captureStackTrace)Error.captureStackTrace(this,Q)}}function Me(e){let n=e.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),i=/\.*[\][<>]/g,r=n.shift();if(!r)throw Error(`No command found in: ${e}`);let s={cmd:r.replace(i,""),demanded:[],optional:[]};return n.forEach((o,a)=>{let c=!1;if(o=o.replace(/\s/g,""),/\.+[\]>]/.test(o)&&a===n.length-1)c=!0;if(/^\[/.test(o))s.optional.push({cmd:o.replace(i,"").split("|"),variadic:c});else s.demanded.push({cmd:o.replace(i,"").split("|"),variadic:c})}),s}var ru=["first","second","third","fourth","fifth","sixth"];function w(e,t,n){function i(){return typeof e==="object"?[{demanded:[],optional:[]},e,t]:[Me(`cmd ${e}`),t,n]}try{let r=0,[s,o,a]=i(),c=[].slice.call(o);while(c.length&&c[c.length-1]===void 0)c.pop();let g=a||c.length;if(g<s.demanded.length)throw new Q(`Not enough arguments provided. Expected ${s.demanded.length} but received ${c.length}.`);let E=s.demanded.length+s.optional.length;if(g>E)throw new Q(`Too many arguments provided. Expected max ${E} but received ${g}.`);s.demanded.forEach((h)=>{let p=c.shift(),m=Ti(p);if(h.cmd.filter((D)=>D===m||D==="*").length===0)Wi(m,h.cmd,r);r+=1}),s.optional.forEach((h)=>{if(c.length===0)return;let p=c.shift(),m=Ti(p);if(h.cmd.filter((D)=>D===m||D==="*").length===0)Wi(m,h.cmd,r);r+=1})}catch(r){console.warn(r.stack)}}function Ti(e){if(Array.isArray(e))return"array";else if(e===null)return"null";return typeof e}function Wi(e,t,n){throw new Q(`Invalid ${ru[n]||"manyith"} argument. Expected ${t.join(" or ")} but received ${e}.`)}class mn{constructor(e){this.globalMiddleware=[],this.frozens=[],this.yargs=e}addMiddleware(e,t,n=!0,i=!1){if(w("<array|function> [boolean] [boolean] [boolean]",[e,t,n],arguments.length),Array.isArray(e)){for(let r=0;r<e.length;r++){if(typeof e[r]!=="function")throw Error("middleware must be a function");let s=e[r];s.applyBeforeValidation=t,s.global=n}Array.prototype.push.apply(this.globalMiddleware,e)}else if(typeof e==="function"){let r=e;r.applyBeforeValidation=t,r.global=n,r.mutates=i,this.globalMiddleware.push(e)}return this.yargs}addCoerceMiddleware(e,t){let n=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((i)=>{let r=[...n[t]||[],t];if(!i.option)return!0;else return!r.includes(i.option)}),e.option=t,this.addMiddleware(e,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){let e=this.frozens.pop();if(e!==void 0)this.globalMiddleware=e}reset(){this.globalMiddleware=this.globalMiddleware.filter((e)=>e.global)}}function Li(e){if(!e)return[];return e.map((t)=>(t.applyBeforeValidation=!1,t))}function ze(e,t,n,i){return n.reduce((r,s)=>{if(s.applyBeforeValidation!==i)return r;if(s.mutates){if(s.applied)return r;s.applied=!0}if(J(r))return r.then((o)=>Promise.all([o,s(o,t)])).then(([o,a])=>Object.assign(o,a));else{let o=s(r,t);return J(o)?o.then((a)=>Object.assign(r,a)):Object.assign(r,o)}},e)}function Ue(e,t,n=(i)=>{throw i}){try{let i=su(e)?e():e;return J(i)?i.then((r)=>t(r)):t(i)}catch(i){return n(i)}}function su(e){return typeof e==="function"}var at=/(^\*)|(^\$0)/;class Vi{constructor(e,t,n,i){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=i,this.usage=e,this.globalMiddleware=n,this.validation=t}addDirectory(e,t,n,i){i=i||{},this.requireCache.add(n);let r=this.shim.path.resolve(this.shim.path.dirname(n),e),s=this.shim.readdirSync(r,{recursive:i.recurse?!0:!1});if(!Array.isArray(i.extensions))i.extensions=["js"];let o=typeof i.visit==="function"?i.visit:(a)=>a;for(let a of s){let c=a.toString();if(i.exclude){let E=!1;if(typeof i.exclude==="function")E=i.exclude(c);else E=i.exclude.test(c);if(E)continue}if(i.include){let E=!1;if(typeof i.include==="function")E=i.include(c);else E=i.include.test(c);if(!E)continue}let g=!1;for(let E of i.extensions)if(c.endsWith(E))g=!0;if(g){let E=this.shim.path.join(r,c),h=t(E),p=Object.create(null,Object.getOwnPropertyDescriptors({...h}));if(o(p,E,c)){if(this.requireCache.has(E))continue;else this.requireCache.add(E);if(!p.command)p.command=this.shim.path.basename(E,this.shim.path.extname(E));this.addHandler(p)}}}}addHandler(e,t,n,i,r,s){let o=[],a=Li(r);if(i=i||(()=>{}),Array.isArray(e))if(ou(e))[e,...o]=e;else for(let c of e)this.addHandler(c);else if(au(e)){let c=Array.isArray(e.command)||typeof e.command==="string"?e.command:null;if(c===null)throw Error(`No command name given for module: ${this.shim.inspect(e)}`);if(e.aliases)c=[].concat(c).concat(e.aliases);this.addHandler(c,this.extractDesc(e),e.builder,e.handler,e.middlewares,e.deprecated);return}else if(Gi(n)){this.addHandler([e].concat(o),t,n.builder,n.handler,n.middlewares,n.deprecated);return}if(typeof e==="string"){let c=Me(e);o=o.map((h)=>Me(h).cmd);let g=!1,E=[c.cmd].concat(o).filter((h)=>{if(at.test(h))return g=!0,!1;return!0});if(E.length===0&&g)E.push("$0");if(g)c.cmd=E[0],o=E.slice(1),e=e.replace(at,c.cmd);if(o.forEach((h)=>{this.aliasMap[h]=c.cmd}),t!==!1)this.usage.command(e,t,g,o,s);if(this.handlers[c.cmd]={original:e,description:t,handler:i,builder:n||{},middlewares:a,deprecated:s,demanded:c.demanded,optional:c.optional},g)this.defaultCommand=this.handlers[c.cmd]}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(e,t,n,i,r,s){let o=this.handlers[e]||this.handlers[this.aliasMap[e]]||this.defaultCommand,a=t.getInternalMethods().getContext(),c=a.commands.slice(),g=!e;if(e)a.commands.push(e),a.fullCommands.push(o.original);let E=this.applyBuilderUpdateUsageAndParse(g,o,t,n.aliases,c,i,r,s);return J(E)?E.then((h)=>this.applyMiddlewareAndGetResult(g,o,h.innerArgv,a,r,h.aliases,t)):this.applyMiddlewareAndGetResult(g,o,E.innerArgv,a,r,E.aliases,t)}applyBuilderUpdateUsageAndParse(e,t,n,i,r,s,o,a){let c=t.builder,g=n;if(kt(c)){n.getInternalMethods().getUsageInstance().freeze();let E=c(n.getInternalMethods().reset(i),a);if(J(E))return E.then((h)=>(g=zi(h)?h:n,this.parseAndUpdateUsage(e,t,g,r,s,o)))}else if(uu(c))n.getInternalMethods().getUsageInstance().freeze(),g=n.getInternalMethods().reset(i),Object.keys(t.builder).forEach((E)=>{g.option(E,c[E])});return this.parseAndUpdateUsage(e,t,g,r,s,o)}parseAndUpdateUsage(e,t,n,i,r,s){if(e)n.getInternalMethods().getUsageInstance().unfreeze(!0);if(this.shouldUpdateUsage(n))n.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i,t),t.description);let o=n.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,r,s);return J(o)?o.then((a)=>({aliases:n.parsed.aliases,innerArgv:a})):{aliases:n.parsed.aliases,innerArgv:o}}shouldUpdateUsage(e){return!e.getInternalMethods().getUsageInstance().getUsageDisabled()&&e.getInternalMethods().getUsageInstance().getUsage().length===0}usageFromParentCommandsCommandHandler(e,t){let n=at.test(t.original)?t.original.replace(at,"").trim():t.original,i=e.filter((r)=>!at.test(r));return i.push(n),`$0 ${i.join(" ")}`}handleValidationAndGetResult(e,t,n,i,r,s,o,a){if(!s.getInternalMethods().getHasOutput()){let c=s.getInternalMethods().runValidation(r,a,s.parsed.error,e);n=Ue(n,(g)=>(c(g),g))}if(t.handler&&!s.getInternalMethods().getHasOutput()){s.getInternalMethods().setHasOutput();let c=!!s.getOptions().configuration["populate--"];if(s.getInternalMethods().postProcess(n,c,!1,!1),n=ze(n,s,o,!1),n=Ue(n,(g)=>{let E=t.handler(g);return J(E)?E.then(()=>g):g}),!e)s.getInternalMethods().getUsageInstance().cacheHelpMessage();if(J(n)&&!s.getInternalMethods().hasParseCallback())n.catch((g)=>{try{s.getInternalMethods().getUsageInstance().fail(null,g)}catch(E){}})}if(!e)i.commands.pop(),i.fullCommands.pop();return n}applyMiddlewareAndGetResult(e,t,n,i,r,s,o){let a={};if(r)return n;if(!o.getInternalMethods().getHasOutput())a=this.populatePositionals(t,n,i,o);let c=this.globalMiddleware.getMiddleware().slice(0).concat(t.middlewares),g=ze(n,o,c,!0);return J(g)?g.then((E)=>this.handleValidationAndGetResult(e,t,E,i,s,o,c,a)):this.handleValidationAndGetResult(e,t,g,i,s,o,c,a)}populatePositionals(e,t,n,i){t._=t._.slice(n.commands.length);let r=e.demanded.slice(0),s=e.optional.slice(0),o={};this.validation.positionalCount(r.length,t._.length);while(r.length){let a=r.shift();this.populatePositional(a,t,o)}while(s.length){let a=s.shift();this.populatePositional(a,t,o)}return t._=n.commands.concat(t._.map((a)=>""+a)),this.postProcessPositionals(t,o,this.cmdToParseOptions(e.original),i),o}populatePositional(e,t,n){let i=e.cmd[0];if(e.variadic)n[i]=t._.splice(0).map(String);else if(t._.length)n[i]=[String(t._.shift())]}cmdToParseOptions(e){let t={array:[],default:{},alias:{},demand:{}},n=Me(e);return n.demanded.forEach((i)=>{let[r,...s]=i.cmd;if(i.variadic)t.array.push(r),t.default[r]=[];t.alias[r]=s,t.demand[r]=!0}),n.optional.forEach((i)=>{let[r,...s]=i.cmd;if(i.variadic)t.array.push(r),t.default[r]=[];t.alias[r]=s}),t}postProcessPositionals(e,t,n,i){let r=Object.assign({},i.getOptions());r.default=Object.assign(n.default,r.default);for(let c of Object.keys(n.alias))r.alias[c]=(r.alias[c]||[]).concat(n.alias[c]);r.array=r.array.concat(n.array),r.config={};let s=[];if(Object.keys(t).forEach((c)=>{t[c].map((g)=>{if(r.configuration["unknown-options-as-args"])r.key[c]=!0;s.push(`--${c}`),s.push(g)})}),!s.length)return;let o=Object.assign({},r.configuration,{"populate--":!1}),a=this.shim.Parser.detailed(s,Object.assign({},r,{configuration:o}));if(a.error)i.getInternalMethods().getUsageInstance().fail(a.error.message,a.error);else{let c=Object.keys(t);Object.keys(t).forEach((g)=>{c.push(...a.aliases[g])}),Object.keys(a.argv).forEach((g)=>{if(c.includes(g)){if(!t[g])t[g]=a.argv[g];if(!this.isInConfigs(i,g)&&!this.isDefaulted(i,g)&&Object.prototype.hasOwnProperty.call(e,g)&&Object.prototype.hasOwnProperty.call(a.argv,g)&&(Array.isArray(e[g])||Array.isArray(a.argv[g])))e[g]=[].concat(e[g],a.argv[g]);else e[g]=a.argv[g]}})}}isDefaulted(e,t){let{default:n}=e.getOptions();return Object.prototype.hasOwnProperty.call(n,t)||Object.prototype.hasOwnProperty.call(n,this.shim.Parser.camelCase(t))}isInConfigs(e,t){let{configObjects:n}=e.getOptions();return n.some((i)=>Object.prototype.hasOwnProperty.call(i,t))||n.some((i)=>Object.prototype.hasOwnProperty.call(i,this.shim.Parser.camelCase(t)))}runDefaultBuilderOn(e){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(e)){let n=at.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");e.getInternalMethods().getUsageInstance().usage(n,this.defaultCommand.description)}let t=this.defaultCommand.builder;if(kt(t))return t(e,!0);else if(!Gi(t))Object.keys(t).forEach((n)=>{e.option(n,t[n])});return}extractDesc({describe:e,description:t,desc:n}){for(let i of[e,t,n]){if(typeof i==="string"||i===!1)return i;De(i,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){let e=this.frozens.pop();De(e,void 0,this.shim),{handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=e}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function Hi(e,t,n,i){return new Vi(e,t,n,i)}function Gi(e){return typeof e==="object"&&!!e.builder&&typeof e.handler==="function"}function ou(e){return e.every((t)=>typeof t==="string")}function kt(e){return typeof e==="function"}function uu(e){return typeof e==="object"}function au(e){return typeof e==="object"&&!Array.isArray(e)}function Ne(e={},t=()=>!0){let n={};return ut(e).forEach((i)=>{if(t(i,e[i]))n[i]=e[i]}),n}function Ie(e){if(typeof process>"u")return;[process.stdout,process.stderr].forEach((t)=>{let n=t;if(n._handle&&n.isTTY&&typeof n._handle.setBlocking==="function")n._handle.setBlocking(e)})}function lu(e){return typeof e==="boolean"}function Yi(e,t){let n=t.y18n.__,i={},r=[];i.failFn=function(C){r.push(C)};let s=null,o=null,a=!0;i.showHelpOnFail=function(C=!0,B){let[N,V]=typeof C==="string"?[!0,C]:[C,B];if(e.getInternalMethods().isGlobalContext())o=V;return s=V,a=N,i};let c=!1;i.fail=function(C,B){let N=e.getInternalMethods().getLoggerInstance();if(r.length)for(let V=r.length-1;V>=0;--V){let te=r[V];if(lu(te)){if(B)throw B;else if(C)throw Error(C)}else te(C,B,i)}else{if(e.getExitProcess())Ie(!0);if(!c){if(c=!0,a)e.showHelp("error"),N.error();if(C||B)N.error(C||B);let V=s||o;if(V){if(C||B)N.error("");N.error(V)}}if(B=B||new Q(C),e.getExitProcess())return e.exit(1);else if(e.getInternalMethods().hasParseCallback())return e.exit(1,B);else throw B}};let g=[],E=!1;i.usage=(S,C)=>{if(S===null)return E=!0,g=[],i;return E=!1,g.push([S,C||""]),i},i.getUsage=()=>g,i.getUsageDisabled=()=>E,i.getPositionalGroupName=()=>n("Positionals:");let h=[];i.example=(S,C)=>{h.push([S,C||""])};let p=[];i.command=function(C,B,N,V,te=!1){if(N)p=p.map((G)=>(G[2]=!1,G));p.push([C,B||"",N,V,te])},i.getCommands=()=>p;let m={};i.describe=function(C,B){if(Array.isArray(C))C.forEach((N)=>{i.describe(N,B)});else if(typeof C==="object")Object.keys(C).forEach((N)=>{i.describe(N,C[N])});else m[C]=B},i.getDescriptions=()=>m;let b=[];i.epilog=(S)=>{b.push(S)};let D=!1,j;i.wrap=(S)=>{D=!0,j=S},i.getWrap=()=>{if(t.getEnv("YARGS_DISABLE_WRAP"))return null;if(!D)j=Ae(),D=!0;return j};let L="__yargsString__:";i.deferY18nLookup=(S)=>L+S,i.help=function(){if(R)return R;ce();let C=e.customScriptName?e.$0:t.path.basename(e.$0),B=e.getDemandedOptions(),N=e.getDemandedCommands(),V=e.getDeprecatedOptions(),te=e.getGroups(),G=e.getOptions(),ie=[];ie=ie.concat(Object.keys(m)),ie=ie.concat(Object.keys(B)),ie=ie.concat(Object.keys(N)),ie=ie.concat(Object.keys(G.default)),ie=ie.filter(ne),ie=Object.keys(ie.reduce((k,z)=>{if(z!=="_")k[z]=!0;return k},{}));let ke=i.getWrap(),U=t.cliui({width:ke,wrap:!!ke});if(!E){if(g.length)g.forEach((k)=>{if(U.div({text:`${k[0].replace(/\$0/g,C)}`}),k[1])U.div({text:`${k[1]}`,padding:[1,0,0,0]})}),U.div();else if(p.length){let k=null;if(N._)k=`${C} <${n("command")}>
15
+ `;else k=`${C} [${n("command")}]
16
+ `;U.div(`${k}`)}}if(p.length>1||p.length===1&&!p[0][2]){U.div(n("Commands:"));let k=e.getInternalMethods().getContext(),z=k.commands.length?`${k.commands.join(" ")} `:"";if(e.getInternalMethods().getParserConfiguration()["sort-commands"]===!0)p=p.sort((W,ae)=>W[0].localeCompare(ae[0]));let re=C?`${C} `:"";p.forEach((W)=>{let ae=`${re}${z}${W[0].replace(/^\$0 ?/,"")}`;U.span({text:ae,padding:[0,2,0,2],width:T(p,ke,`${C}${z}`)+4},{text:W[1]});let Z=[];if(W[2])Z.push(`[${n("default")}]`);if(W[3]&&W[3].length)Z.push(`[${n("aliases:")} ${W[3].join(", ")}]`);if(W[4])if(typeof W[4]==="string")Z.push(`[${n("deprecated: %s",W[4])}]`);else Z.push(`[${n("deprecated")}]`);if(Z.length)U.div({text:Z.join(" "),padding:[0,0,0,2],align:"right"});else U.div()}),U.div()}let Pe=(Object.keys(G.alias)||[]).concat(Object.keys(e.parsed.newAliases)||[]);ie=ie.filter((k)=>!e.parsed.newAliases[k]&&Pe.every((z)=>(G.alias[z]||[]).indexOf(k)===-1));let gt=n("Options:");if(!te[gt])te[gt]=[];Y(ie,G.alias,te,gt);let v=(k)=>/^--/.test(Mt(k)),ot=Object.keys(te).filter((k)=>te[k].length>0).map((k)=>{let z=te[k].filter(ne).map((re)=>{if(Pe.includes(re))return re;for(let W=0,ae;(ae=Pe[W])!==void 0;W++)if((G.alias[ae]||[]).includes(re))return ae;return re});return{groupName:k,normalizedKeys:z}}).filter(({normalizedKeys:k})=>k.length>0).map(({groupName:k,normalizedKeys:z})=>{let re=z.reduce((W,ae)=>(W[ae]=[ae].concat(G.alias[ae]||[]).map((Z)=>{if(k===i.getPositionalGroupName())return Z;else return(/^[0-9]$/.test(Z)?G.boolean.includes(ae)?"-":"--":Z.length>1?"--":"-")+Z}).sort((Z,se)=>v(Z)===v(se)?0:v(Z)?1:-1).join(", "),W),{});return{groupName:k,normalizedKeys:z,switches:re}});if(ot.filter(({groupName:k})=>k!==i.getPositionalGroupName()).some(({normalizedKeys:k,switches:z})=>!k.every((re)=>v(z[re]))))ot.filter(({groupName:k})=>k!==i.getPositionalGroupName()).forEach(({normalizedKeys:k,switches:z})=>{k.forEach((re)=>{if(v(z[re]))z[re]=cu(z[re],4)})});if(ot.forEach(({groupName:k,normalizedKeys:z,switches:re})=>{U.div(k),z.forEach((W)=>{let ae=re[W],Z=m[W]||"",se=null;if(Z.includes(L))Z=n(Z.substring(L.length));if(G.boolean.includes(W))se=`[${n("boolean")}]`;if(G.count.includes(W))se=`[${n("count")}]`;if(G.string.includes(W))se=`[${n("string")}]`;if(G.normalize.includes(W))se=`[${n("string")}]`;if(G.array.includes(W))se=`[${n("array")}]`;if(G.number.includes(W))se=`[${n("number")}]`;let en=(y)=>typeof y==="string"?`[${n("deprecated: %s",y)}]`:`[${n("deprecated")}]`,l=[W in V?en(V[W]):null,se,W in B?`[${n("required")}]`:null,G.choices&&G.choices[W]?`[${n("choices:")} ${i.stringifiedValues(G.choices[W])}]`:null,X(G.default[W],G.defaultDescription[W])].filter(Boolean).join(" ");U.span({text:Mt(ae),padding:[0,2,0,2+Ui(ae)],width:T(re,ke)+4},Z);let d=e.getInternalMethods().getUsageConfiguration()["hide-types"]===!0;if(l&&!d)U.div({text:l,padding:[0,0,0,2],align:"right"});else U.div()}),U.div()}),h.length)U.div(n("Examples:")),h.forEach((k)=>{k[0]=k[0].replace(/\$0/g,C)}),h.forEach((k)=>{if(k[1]==="")U.div({text:k[0],padding:[0,2,0,2]});else U.div({text:k[0],padding:[0,2,0,2],width:T(h,ke)+4},{text:k[1]})}),U.div();if(b.length>0){let k=b.map((z)=>z.replace(/\$0/g,C)).join(`
17
+ `);U.div(`${k}
18
+ `)}return U.toString().replace(/\s*$/,"")};function T(S,C,B){let N=0;if(!Array.isArray(S))S=Object.values(S).map((V)=>[V]);if(S.forEach((V)=>{N=Math.max(t.stringWidth(B?`${B} ${Mt(V[0])}`:Mt(V[0]))+Ui(V[0]),N)}),C)N=Math.min(N,parseInt((C*0.5).toString(),10));return N}function ce(){let S=e.getDemandedOptions(),C=e.getOptions();(Object.keys(C.alias)||[]).forEach((B)=>{C.alias[B].forEach((N)=>{if(m[N])i.describe(B,m[N]);if(N in S)e.demandOption(B,S[N]);if(C.boolean.includes(N))e.boolean(B);if(C.count.includes(N))e.count(B);if(C.string.includes(N))e.string(B);if(C.normalize.includes(N))e.normalize(B);if(C.array.includes(N))e.array(B);if(C.number.includes(N))e.number(B)})})}let R;i.cacheHelpMessage=function(){R=this.help()},i.clearCachedHelpMessage=function(){R=void 0},i.hasCachedHelpMessage=function(){return!!R};function Y(S,C,B,N){let V=[],te=null;return Object.keys(B).forEach((G)=>{V=V.concat(B[G])}),S.forEach((G)=>{if(te=[G].concat(C[G]),!te.some((ie)=>V.indexOf(ie)!==-1))B[N].push(G)}),V}function ne(S){return e.getOptions().hiddenOptions.indexOf(S)<0||e.parsed.argv[e.getOptions().showHiddenOpt]}i.showHelp=(S)=>{let C=e.getInternalMethods().getLoggerInstance();if(!S)S="error";(typeof S==="function"?S:C[S])(i.help())},i.functionDescription=(S)=>["(",S.name?t.Parser.decamelize(S.name,"-"):n("generated-value"),")"].join(""),i.stringifiedValues=function(C,B){let N="",V=B||", ",te=[].concat(C);if(!C||!te.length)return N;return te.forEach((G)=>{if(N.length)N+=V;N+=JSON.stringify(G)}),N};function X(S,C){let B=`[${n("default:")} `;if(S===void 0&&!C)return null;if(C)B+=C;else switch(typeof S){case"string":B+=`"${S}"`;break;case"object":B+=JSON.stringify(S);break;default:B+=S}return`${B}]`}function Ae(){if(t.process.stdColumns)return Math.min(80,t.process.stdColumns);else return 80}let H=null;i.version=(S)=>{H=S},i.showVersion=(S)=>{let C=e.getInternalMethods().getLoggerInstance();if(!S)S="error";(typeof S==="function"?S:C[S])(H)},i.reset=function(C){return s=null,c=!1,g=[],E=!1,b=[],h=[],p=[],m=Ne(m,(B)=>!C[B]),i};let pt=[];return i.freeze=function(){pt.push({failMessage:s,failureOutput:c,usages:g,usageDisabled:E,epilogs:b,examples:h,commands:p,descriptions:m})},i.unfreeze=function(C=!1){let B=pt.pop();if(!B)return;if(C)m={...B.descriptions,...m},p=[...B.commands,...p],g=[...B.usages,...g],h=[...B.examples,...h],b=[...B.epilogs,...b];else({failMessage:s,failureOutput:c,usages:g,usageDisabled:E,epilogs:b,examples:h,commands:p,descriptions:m}=B)},i}function Fn(e){return typeof e==="object"}function cu(e,t){return Fn(e)?{text:e.text,indentation:e.indentation+t}:{text:e,indentation:t}}function Ui(e){return Fn(e)?e.indentation:0}function Mt(e){return Fn(e)?e.text:e}var Ji=`###-begin-{{app_name}}-completions-###
19
19
  #
20
20
  # yargs command completion script
21
21
  #
@@ -44,7 +44,7 @@ _{{app_name}}_yargs_completions()
44
44
  }
45
45
  complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
46
46
  ###-end-{{app_name}}-completions-###
47
- `,p0=`#compdef {{app_name}}
47
+ `,Ki=`#compdef {{app_name}}
48
48
  ###-begin-{{app_name}}-completions-###
49
49
  #
50
50
  # yargs command completion script
@@ -71,14 +71,14 @@ else
71
71
  compdef _{{app_name}}_yargs_completions {{app_name}}
72
72
  fi
73
73
  ###-end-{{app_name}}-completions-###
74
- `;class y0{constructor(D,u,F,C){var E,B,$;this.yargs=D,this.usage=u,this.command=F,this.shim=C,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=($=((E=this.shim.getEnv("SHELL"))===null||E===void 0?void 0:E.includes("zsh"))||((B=this.shim.getEnv("ZSH_NAME"))===null||B===void 0?void 0:B.includes("zsh")))!==null&&$!==void 0?$:!1}defaultCompletion(D,u,F,C){let E=this.command.getCommandHandlers();for(let $=0,Z=D.length;$<Z;++$)if(E[D[$]]&&E[D[$]].builder){let M=E[D[$]].builder;if(Pu(M)){this.indexAfterLastReset=$+1;let H=this.yargs.getInternalMethods().reset();return M(H,!0),H.argv}}let B=[];this.commandCompletions(B,D,F),this.optionCompletions(B,D,u,F),this.choicesFromOptionsCompletions(B,D,u,F),this.choicesFromPositionalsCompletions(B,D,u,F),C(null,B)}commandCompletions(D,u,F){let C=this.yargs.getInternalMethods().getContext().commands;if(!F.match(/^-/)&&C[C.length-1]!==F&&!this.previousArgHasChoices(u))this.usage.getCommands().forEach((E)=>{let B=xD(E[0]).cmd;if(u.indexOf(B)===-1)if(!this.zshShell)D.push(B);else{let $=E[1]||"";D.push(B.replace(/:/g,"\\:")+":"+$)}})}optionCompletions(D,u,F,C){if((C.match(/^-/)||C===""&&D.length===0)&&!this.previousArgHasChoices(u)){let E=this.yargs.getOptions(),B=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(E.key).forEach(($)=>{let Z=!!E.configuration["boolean-negation"]&&E.boolean.includes($);if(!B.includes($)&&!E.hiddenOptions.includes($)&&!this.argsContainKey(u,$,Z))this.completeOptionKey($,D,C,Z&&!!E.default[$])})}}choicesFromOptionsCompletions(D,u,F,C){if(this.previousArgHasChoices(u)){let E=this.getPreviousArgChoices(u);if(E&&E.length>0)D.push(...E.map((B)=>B.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(D,u,F,C){if(C===""&&D.length>0&&this.previousArgHasChoices(u))return;let E=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],B=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),$=E[F._.length-B-1];if(!$)return;let Z=this.yargs.getOptions().choices[$]||[];for(let M of Z)if(M.startsWith(C))D.push(M.replace(/:/g,"\\:"))}getPreviousArgChoices(D){if(D.length<1)return;let u=D[D.length-1],F="";if(!u.startsWith("-")&&D.length>1)F=u,u=D[D.length-2];if(!u.startsWith("-"))return;let C=u.replace(/^-+/,""),E=this.yargs.getOptions(),B=[C,...this.yargs.getAliases()[C]||[]],$;for(let Z of B)if(Object.prototype.hasOwnProperty.call(E.key,Z)&&Array.isArray(E.choices[Z])){$=E.choices[Z];break}if($)return $.filter((Z)=>!F||Z.startsWith(F))}previousArgHasChoices(D){let u=this.getPreviousArgChoices(D);return u!==void 0&&u.length>0}argsContainKey(D,u,F){let C=(E)=>D.indexOf((/^[^0-9]$/.test(E)?"-":"--")+E)!==-1;if(C(u))return!0;if(F&&C(`no-${u}`))return!0;if(this.aliases){for(let E of this.aliases[u])if(C(E))return!0}return!1}completeOptionKey(D,u,F,C){var E,B,$,Z;let M=D;if(this.zshShell){let q=this.usage.getDescriptions(),O=(B=(E=this===null||this===void 0?void 0:this.aliases)===null||E===void 0?void 0:E[D])===null||B===void 0?void 0:B.find((S)=>{let d=q[S];return typeof d==="string"&&d.length>0}),W=O?q[O]:void 0,J=(Z=($=q[D])!==null&&$!==void 0?$:W)!==null&&Z!==void 0?Z:"";M=`${D.replace(/:/g,"\\:")}:${J.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let H=(q)=>/^--/.test(q),V=(q)=>/^[^0-9]$/.test(q),Y=!H(F)&&V(D)?"-":"--";if(u.push(Y+M),C)u.push(Y+"no-"+M)}customCompletion(D,u,F,C){if(GD(this.customCompletionFunction,null,this.shim),l3(this.customCompletionFunction)){let E=this.customCompletionFunction(F,u);if(i(E))return E.then((B)=>{this.shim.process.nextTick(()=>{C(null,B)})}).catch((B)=>{this.shim.process.nextTick(()=>{C(B,void 0)})});return C(null,E)}else if(i3(this.customCompletionFunction))return this.customCompletionFunction(F,u,(E=C)=>this.defaultCompletion(D,u,F,E),(E)=>{C(null,E)});else return this.customCompletionFunction(F,u,(E)=>{C(null,E)})}getCompletion(D,u){let F=D.length?D[D.length-1]:"",C=this.yargs.parse(D,!0),E=this.customCompletionFunction?(B)=>this.customCompletion(D,B,F,u):(B)=>this.defaultCompletion(D,B,F,u);return i(C)?C.then(E):E(C)}generateCompletionScript(D,u){let F=this.zshShell?p0:k0,C=this.shim.path.basename(D);if(D.match(/\.js$/))D=`./${D}`;return F=F.replace(/{{app_name}}/g,C),F=F.replace(/{{completion_command}}/g,u),F.replace(/{{app_path}}/g,D)}registerFunction(D){this.customCompletionFunction=D}setParsed(D){this.aliases=D.aliases}}function g0(D,u,F,C){return new y0(D,u,F,C)}function l3(D){return D.length<3}function i3(D){return D.length>3}function t0(D,u){if(D.length===0)return u.length;if(u.length===0)return D.length;let F=[],C;for(C=0;C<=u.length;C++)F[C]=[C];let E;for(E=0;E<=D.length;E++)F[0][E]=E;for(C=1;C<=u.length;C++)for(E=1;E<=D.length;E++)if(u.charAt(C-1)===D.charAt(E-1))F[C][E]=F[C-1][E-1];else if(C>1&&E>1&&u.charAt(C-2)===D.charAt(E-1)&&u.charAt(C-1)===D.charAt(E-2))F[C][E]=F[C-2][E-2]+1;else F[C][E]=Math.min(F[C-1][E-1]+1,Math.min(F[C][E-1]+1,F[C-1][E]+1));return F[u.length][D.length]}var l0=["$0","--","_"];function i0(D,u,F){let C=F.y18n.__,E=F.y18n.__n,B={};B.nonOptionCount=function(Y){let q=D.getDemandedCommands(),W=Y._.length+(Y["--"]?Y["--"].length:0)-D.getInternalMethods().getContext().commands.length;if(q._&&(W<q._.min||W>q._.max)){if(W<q._.min)if(q._.minMsg!==void 0)u.fail(q._.minMsg?q._.minMsg.replace(/\$0/g,W.toString()).replace(/\$1/,q._.min.toString()):null);else u.fail(E("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",W,W.toString(),q._.min.toString()));else if(W>q._.max)if(q._.maxMsg!==void 0)u.fail(q._.maxMsg?q._.maxMsg.replace(/\$0/g,W.toString()).replace(/\$1/,q._.max.toString()):null);else u.fail(E("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",W,W.toString(),q._.max.toString()))}},B.positionalCount=function(Y,q){if(q<Y)u.fail(E("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",q,q+"",Y+""))},B.requiredArguments=function(Y,q){let O=null;for(let W of Object.keys(q))if(!Object.prototype.hasOwnProperty.call(Y,W)||typeof Y[W]>"u")O=O||{},O[W]=q[W];if(O){let W=[];for(let S of Object.keys(O)){let d=O[S];if(d&&W.indexOf(d)<0)W.push(d)}let J=W.length?`
75
- ${W.join(`
76
- `)}`:"";u.fail(E("Missing required argument: %s","Missing required arguments: %s",Object.keys(O).length,Object.keys(O).join(", ")+J))}},B.unknownArguments=function(Y,q,O,W,J=!0){var S;let d=D.getInternalMethods().getCommandInstance().getCommands(),v=[],QD=D.getInternalMethods().getContext();if(Object.keys(Y).forEach((m)=>{if(!l0.includes(m)&&!Object.prototype.hasOwnProperty.call(O,m)&&!Object.prototype.hasOwnProperty.call(D.getInternalMethods().getParseContext(),m)&&!B.isValidAndSomeAliasIsNotNew(m,q))v.push(m)}),J&&(QD.commands.length>0||d.length>0||W))Y._.slice(QD.commands.length).forEach((m)=>{if(!d.includes(""+m))v.push(""+m)});if(J){let l=((S=D.getDemandedCommands()._)===null||S===void 0?void 0:S.max)||0,uD=QD.commands.length+l;if(uD<Y._.length)Y._.slice(uD).forEach((s)=>{if(s=String(s),!QD.commands.includes(s)&&!v.includes(s))v.push(s)})}if(v.length)u.fail(E("Unknown argument: %s","Unknown arguments: %s",v.length,v.map((m)=>m.trim()?m:`"${m}"`).join(", ")))},B.unknownCommands=function(Y){let q=D.getInternalMethods().getCommandInstance().getCommands(),O=[],W=D.getInternalMethods().getContext();if(W.commands.length>0||q.length>0)Y._.slice(W.commands.length).forEach((J)=>{if(!q.includes(""+J))O.push(""+J)});if(O.length>0)return u.fail(E("Unknown command: %s","Unknown commands: %s",O.length,O.join(", "))),!0;else return!1},B.isValidAndSomeAliasIsNotNew=function(Y,q){if(!Object.prototype.hasOwnProperty.call(q,Y))return!1;let O=D.parsed.newAliases;return[Y,...q[Y]].some((W)=>!Object.prototype.hasOwnProperty.call(O,W)||!O[Y])},B.limitedChoices=function(Y){let q=D.getOptions(),O={};if(!Object.keys(q.choices).length)return;Object.keys(Y).forEach((S)=>{if(l0.indexOf(S)===-1&&Object.prototype.hasOwnProperty.call(q.choices,S))[].concat(Y[S]).forEach((d)=>{if(q.choices[S].indexOf(d)===-1&&d!==void 0)O[S]=(O[S]||[]).concat(d)})});let W=Object.keys(O);if(!W.length)return;let J=C("Invalid values:");W.forEach((S)=>{J+=`
77
- ${C("Argument: %s, Given: %s, Choices: %s",S,u.stringifiedValues(O[S]),u.stringifiedValues(q.choices[S]))}`}),u.fail(J)};let $={};B.implies=function(Y,q){if(K("<string|object> [array|number|string]",[Y,q],arguments.length),typeof Y==="object")Object.keys(Y).forEach((O)=>{B.implies(O,Y[O])});else{if(D.global(Y),!$[Y])$[Y]=[];if(Array.isArray(q))q.forEach((O)=>B.implies(Y,O));else GD(q,void 0,F),$[Y].push(q)}},B.getImplied=function(){return $};function Z(V,Y){let q=Number(Y);if(Y=isNaN(q)?Y:q,typeof Y==="number")Y=V._.length>=Y;else if(Y.match(/^--no-.+/))Y=Y.match(/^--no-(.+)/)[1],Y=!Object.prototype.hasOwnProperty.call(V,Y);else Y=Object.prototype.hasOwnProperty.call(V,Y);return Y}B.implications=function(Y){let q=[];if(Object.keys($).forEach((O)=>{let W=O;($[O]||[]).forEach((J)=>{let S=W,d=J;if(S=Z(Y,S),J=Z(Y,J),S&&!J)q.push(` ${W} -> ${d}`)})}),q.length){let O=`${C("Implications failed:")}
78
- `;q.forEach((W)=>{O+=W}),u.fail(O)}};let M={};B.conflicts=function(Y,q){if(K("<string|object> [array|string]",[Y,q],arguments.length),typeof Y==="object")Object.keys(Y).forEach((O)=>{B.conflicts(O,Y[O])});else{if(D.global(Y),!M[Y])M[Y]=[];if(Array.isArray(q))q.forEach((O)=>B.conflicts(Y,O));else M[Y].push(q)}},B.getConflicting=()=>M,B.conflicting=function(Y){if(Object.keys(Y).forEach((q)=>{if(M[q])M[q].forEach((O)=>{if(O&&Y[q]!==void 0&&Y[O]!==void 0)u.fail(C("Arguments %s and %s are mutually exclusive",q,O))})}),D.getInternalMethods().getParserConfiguration()["strip-dashed"])Object.keys(M).forEach((q)=>{M[q].forEach((O)=>{if(O&&Y[F.Parser.camelCase(q)]!==void 0&&Y[F.Parser.camelCase(O)]!==void 0)u.fail(C("Arguments %s and %s are mutually exclusive",q,O))})})},B.recommendCommands=function(Y,q){q=q.sort((S,d)=>d.length-S.length);let W=null,J=1/0;for(let S=0,d;(d=q[S])!==void 0;S++){let v=t0(Y,d);if(v<=3&&v<J)J=v,W=d}if(W)u.fail(C("Did you mean %s?",W))},B.reset=function(Y){return $=bD($,(q)=>!Y[q]),M=bD(M,(q)=>!Y[q]),B};let H=[];return B.freeze=function(){H.push({implied:$,conflicting:M})},B.unfreeze=function(){let Y=H.pop();GD(Y,void 0,F),{implied:$,conflicting:M}=Y},B}var qF=[],Hu;function bu(D,u,F,C){Hu=C;let E={};if(Object.prototype.hasOwnProperty.call(D,"extends")){if(typeof D.extends!=="string")return E;let B=/\.json|\..*rc$/.test(D.extends),$=null;if(!B)try{$=import.meta.resolve(D.extends)}catch(Z){return D}else $=n3(u,D.extends);o3($),qF.push($),E=B?JSON.parse(Hu.readFileSync($,"utf8")):C.require(D.extends),delete D.extends,E=bu(E,Hu.path.dirname($),F,Hu)}return qF=[],F?o0(E,D):Object.assign({},E,D)}function o3(D){if(qF.indexOf(D)>-1)throw new a(`Circular extended configurations: '${D}'.`)}function n3(D,u){return Hu.path.resolve(D,u)}function o0(D,u){let F={};function C(E){return E&&typeof E==="object"&&!Array.isArray(E)}Object.assign(F,D);for(let E of Object.keys(u))if(C(u[E])&&C(F[E]))F[E]=o0(D[E],u[E]);else F[E]=u[E];return F}var j=function(D,u,F,C,E){if(C==="m")throw TypeError("Private method is not writable");if(C==="a"&&!E)throw TypeError("Private accessor was defined without a setter");if(typeof u==="function"?D!==u||!E:!u.has(D))throw TypeError("Cannot write private member to an object whose class did not declare it");return C==="a"?E.call(D,F):E?E.value=F:u.set(D,F),F},z=function(D,u,F,C){if(F==="a"&&!C)throw TypeError("Private accessor was defined without a getter");if(typeof u==="function"?D!==u||!C:!u.has(D))throw TypeError("Cannot read private member from an object whose class did not declare it");return F==="m"?C:F==="a"?C.call(D):C?C.value:u.get(D)},e,tD,Ou,JD,qD,hu,wD,lD,wu,WD,mu,VD,_D,HD,TD,vu,iD,$D,f,cu,du,OD,oD,zu,nD,mD,ku,b,sD,rD,aD,w,pu,ND,n;function Y2(D){return(u=[],F=D.process.cwd(),C)=>{let E=new q2(u,F,C,D);return Object.defineProperty(E,"argv",{get:()=>{return E.parse()},enumerable:!0}),E.help(),E.version(),E}}var n0=Symbol("copyDoubleDash"),s0=Symbol("copyDoubleDash"),HF=Symbol("deleteFromParserHintObject"),r0=Symbol("emitWarning"),a0=Symbol("freeze"),e0=Symbol("getDollarZero"),eD=Symbol("getParserConfiguration"),D2=Symbol("getUsageConfiguration"),OF=Symbol("guessLocale"),u2=Symbol("guessVersion"),F2=Symbol("parsePositionalNumbers"),UF=Symbol("pkgUp"),vD=Symbol("populateParserHintArray"),Zu=Symbol("populateParserHintSingleValueDictionary"),WF=Symbol("populateParserHintArrayDictionary"),VF=Symbol("populateParserHintDictionary"),TF=Symbol("sanitizeKey"),LF=Symbol("setKey"),IF=Symbol("unfreeze"),C2=Symbol("validateAsync"),E2=Symbol("getCommandInstance"),B2=Symbol("getContext"),$2=Symbol("getHasOutput"),z2=Symbol("getLoggerInstance"),Z2=Symbol("getParseContext"),Q2=Symbol("getUsageInstance"),X2=Symbol("getValidationInstance"),yu=Symbol("hasParseCallback"),M2=Symbol("isGlobalContext"),Du=Symbol("postProcess"),G2=Symbol("rebase"),KF=Symbol("reset"),Uu=Symbol("runYargsParserAndExecuteCommands"),jF=Symbol("runValidation"),J2=Symbol("setHasOutput"),uu=Symbol("kTrackManuallySetKeys"),s3="en_US";class q2{constructor(D=[],u,F,C){this.customScriptName=!1,this.parsed=!1,e.set(this,void 0),tD.set(this,void 0),Ou.set(this,{commands:[],fullCommands:[]}),JD.set(this,null),qD.set(this,null),hu.set(this,"show-hidden"),wD.set(this,null),lD.set(this,!0),wu.set(this,{}),WD.set(this,!0),mu.set(this,[]),VD.set(this,void 0),_D.set(this,{}),HD.set(this,!1),TD.set(this,null),vu.set(this,!0),iD.set(this,void 0),$D.set(this,""),f.set(this,void 0),cu.set(this,void 0),du.set(this,{}),OD.set(this,null),oD.set(this,null),zu.set(this,{}),nD.set(this,{}),mD.set(this,void 0),ku.set(this,!1),b.set(this,void 0),sD.set(this,!1),rD.set(this,!1),aD.set(this,!1),w.set(this,void 0),pu.set(this,{}),ND.set(this,null),n.set(this,void 0),j(this,b,C,"f"),j(this,mD,D,"f"),j(this,tD,u,"f"),j(this,cu,F,"f"),j(this,VD,new JF(this),"f"),this.$0=this[e0](),this[KF](),j(this,e,z(this,e,"f"),"f"),j(this,w,z(this,w,"f"),"f"),j(this,n,z(this,n,"f"),"f"),j(this,f,z(this,f,"f"),"f"),z(this,f,"f").showHiddenOpt=z(this,hu,"f"),j(this,iD,this[s0](),"f"),z(this,b,"f").y18n.setLocale(s3)}addHelpOpt(D,u){if(K("[string|boolean] [string]",[D,u],arguments.length),z(this,TD,"f"))this[HF](z(this,TD,"f")),j(this,TD,null,"f");if(D===!1&&u===void 0)return this;return j(this,TD,typeof D==="string"?D:"help","f"),this.boolean(z(this,TD,"f")),this.describe(z(this,TD,"f"),u||z(this,w,"f").deferY18nLookup("Show help")),this}help(D,u){return this.addHelpOpt(D,u)}addShowHiddenOpt(D,u){if(K("[string|boolean] [string]",[D,u],arguments.length),D===!1&&u===void 0)return this;let F=typeof D==="string"?D:z(this,hu,"f");return this.boolean(F),this.describe(F,u||z(this,w,"f").deferY18nLookup("Show hidden options")),z(this,f,"f").showHiddenOpt=F,this}showHidden(D,u){return this.addShowHiddenOpt(D,u)}alias(D,u){return K("<object|string|array> [string|array]",[D,u],arguments.length),this[WF](this.alias.bind(this),"alias",D,u),this}array(D){return K("<array|string>",[D],arguments.length),this[vD]("array",D),this[uu](D),this}boolean(D){return K("<array|string>",[D],arguments.length),this[vD]("boolean",D),this[uu](D),this}check(D,u){return K("<function> [boolean]",[D,u],arguments.length),this.middleware((F,C)=>{return gD(()=>{return D(F,C.getOptions())},(E)=>{if(!E)z(this,w,"f").fail(z(this,b,"f").y18n.__("Argument check failed: %s",D.toString()));else if(typeof E==="string"||E instanceof Error)z(this,w,"f").fail(E.toString(),E);return F},(E)=>{return z(this,w,"f").fail(E.message?E.message:E.toString(),E),F})},!1,u),this}choices(D,u){return K("<object|string|array> [string|array]",[D,u],arguments.length),this[WF](this.choices.bind(this),"choices",D,u),this}coerce(D,u){if(K("<object|string|array> [function]",[D,u],arguments.length),Array.isArray(D)){if(!u)throw new a("coerce callback must be provided");for(let C of D)this.coerce(C,u);return this}else if(typeof D==="object"){for(let C of Object.keys(D))this.coerce(C,D[C]);return this}if(!u)throw new a("coerce callback must be provided");let F=D;return z(this,f,"f").key[F]=!0,z(this,VD,"f").addCoerceMiddleware((C,E)=>{var B;let $=(B=E.getAliases()[F])!==null&&B!==void 0?B:[],Z=[F,...$].filter((M)=>Object.prototype.hasOwnProperty.call(C,M));if(Z.length===0)return C;return gD(()=>{return u(C[Z[0]])},(M)=>{return Z.forEach((H)=>{C[H]=M}),C},(M)=>{throw new a(M.message)})},F),this}conflicts(D,u){return K("<string|object> [string|array]",[D,u],arguments.length),z(this,n,"f").conflicts(D,u),this}config(D="config",u,F){if(K("[object|string] [string|function] [function]",[D,u,F],arguments.length),typeof D==="object"&&!Array.isArray(D))return D=bu(D,z(this,tD,"f"),this[eD]()["deep-merge-config"]||!1,z(this,b,"f")),z(this,f,"f").configObjects=(z(this,f,"f").configObjects||[]).concat(D),this;if(typeof u==="function")F=u,u=void 0;return this.describe(D,u||z(this,w,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(D)?D:[D]).forEach((C)=>{z(this,f,"f").config[C]=F||!0}),this}completion(D,u,F){if(K("[string] [string|boolean|function] [function]",[D,u,F],arguments.length),typeof u==="function")F=u,u=void 0;if(j(this,qD,D||z(this,qD,"f")||"completion","f"),!u&&u!==!1)u="generate completion script";if(this.command(z(this,qD,"f"),u),F)z(this,JD,"f").registerFunction(F);return this}command(D,u,F,C,E,B){return K("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[D,u,F,C,E,B],arguments.length),z(this,e,"f").addHandler(D,u,F,C,E,B),this}commands(D,u,F,C,E,B){return this.command(D,u,F,C,E,B)}commandDir(D,u){K("<string> [object]",[D,u],arguments.length);let F=z(this,cu,"f")||z(this,b,"f").require;return z(this,e,"f").addDirectory(D,F,z(this,b,"f").getCallerFile(),u),this}count(D){return K("<array|string>",[D],arguments.length),this[vD]("count",D),this[uu](D),this}default(D,u,F){if(K("<object|string|array> [*] [string]",[D,u,F],arguments.length),F)GF(D,z(this,b,"f")),z(this,f,"f").defaultDescription[D]=F;if(typeof u==="function"){if(GF(D,z(this,b,"f")),!z(this,f,"f").defaultDescription[D])z(this,f,"f").defaultDescription[D]=z(this,w,"f").functionDescription(u);u=u.call()}return this[Zu](this.default.bind(this),"default",D,u),this}defaults(D,u,F){return this.default(D,u,F)}demandCommand(D=1,u,F,C){if(K("[number] [number|string] [string|null|undefined] [string|null|undefined]",[D,u,F,C],arguments.length),typeof u!=="number")F=u,u=1/0;return this.global("_",!1),z(this,f,"f").demandedCommands._={min:D,max:u,minMsg:F,maxMsg:C},this}demand(D,u,F){if(Array.isArray(u))u.forEach((C)=>{GD(F,!0,z(this,b,"f")),this.demandOption(C,F)}),u=1/0;else if(typeof u!=="number")F=u,u=1/0;if(typeof D==="number")GD(F,!0,z(this,b,"f")),this.demandCommand(D,u,F,F);else if(Array.isArray(D))D.forEach((C)=>{GD(F,!0,z(this,b,"f")),this.demandOption(C,F)});else if(typeof F==="string")this.demandOption(D,F);else if(F===!0||typeof F>"u")this.demandOption(D);return this}demandOption(D,u){return K("<object|string|array> [string]",[D,u],arguments.length),this[Zu](this.demandOption.bind(this),"demandedOptions",D,u),this}deprecateOption(D,u){return K("<string> [string|boolean]",[D,u],arguments.length),z(this,f,"f").deprecatedOptions[D]=u,this}describe(D,u){return K("<object|string|array> [string]",[D,u],arguments.length),this[LF](D,!0),z(this,w,"f").describe(D,u),this}detectLocale(D){return K("<boolean>",[D],arguments.length),j(this,lD,D,"f"),this}env(D){if(K("[string|boolean]",[D],arguments.length),D===!1)delete z(this,f,"f").envPrefix;else z(this,f,"f").envPrefix=D||"";return this}epilogue(D){return K("<string>",[D],arguments.length),z(this,w,"f").epilog(D),this}epilog(D){return this.epilogue(D)}example(D,u){if(K("<string|array> [string]",[D,u],arguments.length),Array.isArray(D))D.forEach((F)=>this.example(...F));else z(this,w,"f").example(D,u);return this}exit(D,u){if(j(this,HD,!0,"f"),j(this,wD,u,"f"),z(this,WD,"f"))z(this,b,"f").process.exit(D)}exitProcess(D=!0){return K("[boolean]",[D],arguments.length),j(this,WD,D,"f"),this}fail(D){if(K("<function|boolean>",[D],arguments.length),typeof D==="boolean"&&D!==!1)throw new a("Invalid first argument. Expected function or boolean 'false'");return z(this,w,"f").failFn(D),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(D,u){if(K("<array> [function]",[D,u],arguments.length),!u)return new Promise((F,C)=>{z(this,JD,"f").getCompletion(D,(E,B)=>{if(E)C(E);else F(B)})});else return z(this,JD,"f").getCompletion(D,u)}getDemandedOptions(){return K([],0),z(this,f,"f").demandedOptions}getDemandedCommands(){return K([],0),z(this,f,"f").demandedCommands}getDeprecatedOptions(){return K([],0),z(this,f,"f").deprecatedOptions}getDetectLocale(){return z(this,lD,"f")}getExitProcess(){return z(this,WD,"f")}getGroups(){return Object.assign({},z(this,_D,"f"),z(this,nD,"f"))}getHelp(){if(j(this,HD,!0,"f"),!z(this,w,"f").hasCachedHelpMessage()){if(!this.parsed){let u=this[Uu](z(this,mD,"f"),void 0,void 0,0,!0);if(i(u))return u.then(()=>{return z(this,w,"f").help()})}let D=z(this,e,"f").runDefaultBuilderOn(this);if(i(D))return D.then(()=>{return z(this,w,"f").help()})}return Promise.resolve(z(this,w,"f").help())}getOptions(){return z(this,f,"f")}getStrict(){return z(this,sD,"f")}getStrictCommands(){return z(this,rD,"f")}getStrictOptions(){return z(this,aD,"f")}global(D,u){if(K("<string|array> [boolean]",[D,u],arguments.length),D=[].concat(D),u!==!1)z(this,f,"f").local=z(this,f,"f").local.filter((F)=>D.indexOf(F)===-1);else D.forEach((F)=>{if(!z(this,f,"f").local.includes(F))z(this,f,"f").local.push(F)});return this}group(D,u){K("<string|array> <string>",[D,u],arguments.length);let F=z(this,nD,"f")[u]||z(this,_D,"f")[u];if(z(this,nD,"f")[u])delete z(this,nD,"f")[u];let C={};return z(this,_D,"f")[u]=(F||[]).concat(D).filter((E)=>{if(C[E])return!1;return C[E]=!0}),this}hide(D){return K("<string>",[D],arguments.length),z(this,f,"f").hiddenOptions.push(D),this}implies(D,u){return K("<string|object> [number|string|array]",[D,u],arguments.length),z(this,n,"f").implies(D,u),this}locale(D){if(K("[string]",[D],arguments.length),D===void 0)return this[OF](),z(this,b,"f").y18n.getLocale();return j(this,lD,!1,"f"),z(this,b,"f").y18n.setLocale(D),this}middleware(D,u,F){return z(this,VD,"f").addMiddleware(D,!!u,F)}nargs(D,u){return K("<string|object|array> [number]",[D,u],arguments.length),this[Zu](this.nargs.bind(this),"narg",D,u),this}normalize(D){return K("<array|string>",[D],arguments.length),this[vD]("normalize",D),this}number(D){return K("<array|string>",[D],arguments.length),this[vD]("number",D),this[uu](D),this}option(D,u){if(K("<string|object> [object]",[D,u],arguments.length),typeof D==="object")Object.keys(D).forEach((F)=>{this.options(F,D[F])});else{if(typeof u!=="object")u={};if(this[uu](D),z(this,ND,"f")&&(D==="version"||(u===null||u===void 0?void 0:u.alias)==="version"))this[r0](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
79
- `),void 0,"versionWarning");if(z(this,f,"f").key[D]=!0,u.alias)this.alias(D,u.alias);let F=u.deprecate||u.deprecated;if(F)this.deprecateOption(D,F);let C=u.demand||u.required||u.require;if(C)this.demand(D,C);if(u.demandOption)this.demandOption(D,typeof u.demandOption==="string"?u.demandOption:void 0);if(u.conflicts)this.conflicts(D,u.conflicts);if("default"in u)this.default(D,u.default);if(u.implies!==void 0)this.implies(D,u.implies);if(u.nargs!==void 0)this.nargs(D,u.nargs);if(u.config)this.config(D,u.configParser);if(u.normalize)this.normalize(D);if(u.choices)this.choices(D,u.choices);if(u.coerce)this.coerce(D,u.coerce);if(u.group)this.group(D,u.group);if(u.boolean||u.type==="boolean"){if(this.boolean(D),u.alias)this.boolean(u.alias)}if(u.array||u.type==="array"){if(this.array(D),u.alias)this.array(u.alias)}if(u.number||u.type==="number"){if(this.number(D),u.alias)this.number(u.alias)}if(u.string||u.type==="string"){if(this.string(D),u.alias)this.string(u.alias)}if(u.count||u.type==="count")this.count(D);if(typeof u.global==="boolean")this.global(D,u.global);if(u.defaultDescription)z(this,f,"f").defaultDescription[D]=u.defaultDescription;if(u.skipValidation)this.skipValidation(D);let E=u.describe||u.description||u.desc,B=z(this,w,"f").getDescriptions();if(!Object.prototype.hasOwnProperty.call(B,D)||typeof E==="string")this.describe(D,E);if(u.hidden)this.hide(D);if(u.requiresArg)this.requiresArg(D)}return this}options(D,u){return this.option(D,u)}parse(D,u,F){if(K("[string|array] [function|boolean|object] [function]",[D,u,F],arguments.length),this[a0](),typeof D>"u")D=z(this,mD,"f");if(typeof u==="object")j(this,oD,u,"f"),u=F;if(typeof u==="function")j(this,OD,u,"f"),u=!1;if(!u)j(this,mD,D,"f");if(z(this,OD,"f"))j(this,WD,!1,"f");let C=this[Uu](D,!!u),E=this.parsed;if(z(this,JD,"f").setParsed(this.parsed),i(C))return C.then((B)=>{if(z(this,OD,"f"))z(this,OD,"f").call(this,z(this,wD,"f"),B,z(this,$D,"f"));return B}).catch((B)=>{if(z(this,OD,"f"))z(this,OD,"f")(B,this.parsed.argv,z(this,$D,"f"));throw B}).finally(()=>{this[IF](),this.parsed=E});else{if(z(this,OD,"f"))z(this,OD,"f").call(this,z(this,wD,"f"),C,z(this,$D,"f"));this[IF](),this.parsed=E}return C}parseAsync(D,u,F){let C=this.parse(D,u,F);return!i(C)?Promise.resolve(C):C}parseSync(D,u,F){let C=this.parse(D,u,F);if(i(C))throw new a(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return C}parserConfiguration(D){return K("<object>",[D],arguments.length),j(this,du,D,"f"),this}pkgConf(D,u){K("<string> [string]",[D,u],arguments.length);let F=null,C=this[UF](u||z(this,tD,"f"));if(C[D]&&typeof C[D]==="object")F=bu(C[D],u||z(this,tD,"f"),this[eD]()["deep-merge-config"]||!1,z(this,b,"f")),z(this,f,"f").configObjects=(z(this,f,"f").configObjects||[]).concat(F);return this}positional(D,u){K("<string> <object>",[D,u],arguments.length);let F=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];u=bD(u,(B,$)=>{if(B==="type"&&!["string","number","boolean"].includes($))return!1;return F.includes(B)});let C=z(this,Ou,"f").fullCommands[z(this,Ou,"f").fullCommands.length-1],E=C?z(this,e,"f").cmdToParseOptions(C):{array:[],alias:{},default:{},demand:{}};return Bu(E).forEach((B)=>{let $=E[B];if(Array.isArray($)){if($.indexOf(D)!==-1)u[B]=!0}else if($[D]&&!(B in u))u[B]=$[D]}),this.group(D,z(this,w,"f").getPositionalGroupName()),this.option(D,u)}recommendCommands(D=!0){return K("[boolean]",[D],arguments.length),j(this,ku,D,"f"),this}required(D,u,F){return this.demand(D,u,F)}require(D,u,F){return this.demand(D,u,F)}requiresArg(D){if(K("<array|string|object> [number]",[D],arguments.length),typeof D==="string"&&z(this,f,"f").narg[D])return this;else this[Zu](this.requiresArg.bind(this),"narg",D,NaN);return this}showCompletionScript(D,u){return K("[string] [string]",[D,u],arguments.length),D=D||this.$0,z(this,iD,"f").log(z(this,JD,"f").generateCompletionScript(D,u||z(this,qD,"f")||"completion")),this}showHelp(D){if(K("[string|function]",[D],arguments.length),j(this,HD,!0,"f"),!z(this,w,"f").hasCachedHelpMessage()){if(!this.parsed){let F=this[Uu](z(this,mD,"f"),void 0,void 0,0,!0);if(i(F))return F.then(()=>{z(this,w,"f").showHelp(D)}),this}let u=z(this,e,"f").runDefaultBuilderOn(this);if(i(u))return u.then(()=>{z(this,w,"f").showHelp(D)}),this}return z(this,w,"f").showHelp(D),this}scriptName(D){return this.customScriptName=!0,this.$0=D,this}showHelpOnFail(D,u){return K("[boolean|string] [string]",[D,u],arguments.length),z(this,w,"f").showHelpOnFail(D,u),this}showVersion(D){return K("[string|function]",[D],arguments.length),z(this,w,"f").showVersion(D),this}skipValidation(D){return K("<array|string>",[D],arguments.length),this[vD]("skipValidation",D),this}strict(D){return K("[boolean]",[D],arguments.length),j(this,sD,D!==!1,"f"),this}strictCommands(D){return K("[boolean]",[D],arguments.length),j(this,rD,D!==!1,"f"),this}strictOptions(D){return K("[boolean]",[D],arguments.length),j(this,aD,D!==!1,"f"),this}string(D){return K("<array|string>",[D],arguments.length),this[vD]("string",D),this[uu](D),this}terminalWidth(){return K([],0),z(this,b,"f").process.stdColumns}updateLocale(D){return this.updateStrings(D)}updateStrings(D){return K("<object>",[D],arguments.length),j(this,lD,!1,"f"),z(this,b,"f").y18n.updateLocale(D),this}usage(D,u,F,C){if(K("<string|null|undefined> [string|boolean] [function|object] [function]",[D,u,F,C],arguments.length),u!==void 0)if(GD(D,null,z(this,b,"f")),(D||"").match(/^\$0( |$)/))return this.command(D,u,F,C);else throw new a(".usage() description must start with $0 if being used as alias for .command()");else return z(this,w,"f").usage(D),this}usageConfiguration(D){return K("<object>",[D],arguments.length),j(this,pu,D,"f"),this}version(D,u,F){if(K("[boolean|string] [string] [string]",[D,u,F],arguments.length),z(this,ND,"f"))this[HF](z(this,ND,"f")),z(this,w,"f").version(void 0),j(this,ND,null,"f");if(arguments.length===0)F=this[u2](),D="version";else if(arguments.length===1){if(D===!1)return this;F=D,D="version"}else if(arguments.length===2)F=u,u=void 0;return j(this,ND,typeof D==="string"?D:"version","f"),u=u||z(this,w,"f").deferY18nLookup("Show version number"),z(this,w,"f").version(F||void 0),this.boolean(z(this,ND,"f")),this.describe(z(this,ND,"f"),u),this}wrap(D){return K("<number|null|undefined>",[D],arguments.length),z(this,w,"f").wrap(D),this}[(e=new WeakMap,tD=new WeakMap,Ou=new WeakMap,JD=new WeakMap,qD=new WeakMap,hu=new WeakMap,wD=new WeakMap,lD=new WeakMap,wu=new WeakMap,WD=new WeakMap,mu=new WeakMap,VD=new WeakMap,_D=new WeakMap,HD=new WeakMap,TD=new WeakMap,vu=new WeakMap,iD=new WeakMap,$D=new WeakMap,f=new WeakMap,cu=new WeakMap,du=new WeakMap,OD=new WeakMap,oD=new WeakMap,zu=new WeakMap,nD=new WeakMap,mD=new WeakMap,ku=new WeakMap,b=new WeakMap,sD=new WeakMap,rD=new WeakMap,aD=new WeakMap,w=new WeakMap,pu=new WeakMap,ND=new WeakMap,n=new WeakMap,n0)](D){if(!D._||!D["--"])return D;D._.push.apply(D._,D["--"]);try{delete D["--"]}catch(u){}return D}[s0](){return{log:(...D)=>{if(!this[yu]())console.log(...D);if(j(this,HD,!0,"f"),z(this,$D,"f").length)j(this,$D,z(this,$D,"f")+`
80
- `,"f");j(this,$D,z(this,$D,"f")+D.join(" "),"f")},error:(...D)=>{if(!this[yu]())console.error(...D);if(j(this,HD,!0,"f"),z(this,$D,"f").length)j(this,$D,z(this,$D,"f")+`
81
- `,"f");j(this,$D,z(this,$D,"f")+D.join(" "),"f")}}}[HF](D){Bu(z(this,f,"f")).forEach((u)=>{if(((C)=>C==="configObjects")(u))return;let F=z(this,f,"f")[u];if(Array.isArray(F)){if(F.includes(D))F.splice(F.indexOf(D),1)}else if(typeof F==="object")delete F[D]}),delete z(this,w,"f").getDescriptions()[D]}[r0](D,u,F){if(!z(this,wu,"f")[F])z(this,b,"f").process.emitWarning(D,u),z(this,wu,"f")[F]=!0}[a0](){z(this,mu,"f").push({options:z(this,f,"f"),configObjects:z(this,f,"f").configObjects.slice(0),exitProcess:z(this,WD,"f"),groups:z(this,_D,"f"),strict:z(this,sD,"f"),strictCommands:z(this,rD,"f"),strictOptions:z(this,aD,"f"),completionCommand:z(this,qD,"f"),output:z(this,$D,"f"),exitError:z(this,wD,"f"),hasOutput:z(this,HD,"f"),parsed:this.parsed,parseFn:z(this,OD,"f"),parseContext:z(this,oD,"f")}),z(this,w,"f").freeze(),z(this,n,"f").freeze(),z(this,e,"f").freeze(),z(this,VD,"f").freeze()}[e0](){let D="",u;if(/\b(node|iojs|electron)(\.exe)?$/.test(z(this,b,"f").process.argv()[0]))u=z(this,b,"f").process.argv().slice(1,2);else u=z(this,b,"f").process.argv().slice(0,1);if(D=u.map((F)=>{let C=this[G2](z(this,tD,"f"),F);return F.match(/^(\/|([a-zA-Z]:)?\\)/)&&C.length<F.length?C:F}).join(" ").trim(),z(this,b,"f").getEnv("_")&&z(this,b,"f").getProcessArgvBin()===z(this,b,"f").getEnv("_"))D=z(this,b,"f").getEnv("_").replace(`${z(this,b,"f").path.dirname(z(this,b,"f").process.execPath())}/`,"");return D}[eD](){return z(this,du,"f")}[D2](){return z(this,pu,"f")}[OF](){if(!z(this,lD,"f"))return;let D=z(this,b,"f").getEnv("LC_ALL")||z(this,b,"f").getEnv("LC_MESSAGES")||z(this,b,"f").getEnv("LANG")||z(this,b,"f").getEnv("LANGUAGE")||"en_US";this.locale(D.replace(/[.:].*/,""))}[u2](){return this[UF]().version||"unknown"}[F2](D){let u=D["--"]?D["--"]:D._;for(let F=0,C;(C=u[F])!==void 0;F++)if(z(this,b,"f").Parser.looksLikeNumber(C)&&Number.isSafeInteger(Math.floor(parseFloat(`${C}`))))u[F]=Number(C);return D}[UF](D){let u=D||"*";if(z(this,zu,"f")[u])return z(this,zu,"f")[u];let F={};try{let C=D||z(this,b,"f").mainFilename;if(z(this,b,"f").path.extname(C))C=z(this,b,"f").path.dirname(C);let E=z(this,b,"f").findUp(C,(B,$)=>{if($.includes("package.json"))return"package.json";else return});GD(E,void 0,z(this,b,"f")),F=JSON.parse(z(this,b,"f").readFileSync(E,"utf8"))}catch(C){}return z(this,zu,"f")[u]=F||{},z(this,zu,"f")[u]}[vD](D,u){u=[].concat(u),u.forEach((F)=>{F=this[TF](F),z(this,f,"f")[D].push(F)})}[Zu](D,u,F,C){this[VF](D,u,F,C,(E,B,$)=>{z(this,f,"f")[E][B]=$})}[WF](D,u,F,C){this[VF](D,u,F,C,(E,B,$)=>{z(this,f,"f")[E][B]=(z(this,f,"f")[E][B]||[]).concat($)})}[VF](D,u,F,C,E){if(Array.isArray(F))F.forEach((B)=>{D(B,C)});else if(((B)=>typeof B==="object")(F))for(let B of Bu(F))D(B,F[B]);else E(u,this[TF](F),C)}[TF](D){if(D==="__proto__")return"___proto___";return D}[LF](D,u){return this[Zu](this[LF].bind(this),"key",D,u),this}[IF](){var D,u,F,C,E,B,$,Z,M,H,V,Y;let q=z(this,mu,"f").pop();GD(q,void 0,z(this,b,"f"));let O;D=this,u=this,F=this,C=this,E=this,B=this,$=this,Z=this,M=this,H=this,V=this,Y=this,{options:{set value(W){j(D,f,W,"f")}}.value,configObjects:O,exitProcess:{set value(W){j(u,WD,W,"f")}}.value,groups:{set value(W){j(F,_D,W,"f")}}.value,output:{set value(W){j(C,$D,W,"f")}}.value,exitError:{set value(W){j(E,wD,W,"f")}}.value,hasOutput:{set value(W){j(B,HD,W,"f")}}.value,parsed:this.parsed,strict:{set value(W){j($,sD,W,"f")}}.value,strictCommands:{set value(W){j(Z,rD,W,"f")}}.value,strictOptions:{set value(W){j(M,aD,W,"f")}}.value,completionCommand:{set value(W){j(H,qD,W,"f")}}.value,parseFn:{set value(W){j(V,OD,W,"f")}}.value,parseContext:{set value(W){j(Y,oD,W,"f")}}.value}=q,z(this,f,"f").configObjects=O,z(this,w,"f").unfreeze(),z(this,n,"f").unfreeze(),z(this,e,"f").unfreeze(),z(this,VD,"f").unfreeze()}[C2](D,u){return gD(u,(F)=>{return D(F),F})}getInternalMethods(){return{getCommandInstance:this[E2].bind(this),getContext:this[B2].bind(this),getHasOutput:this[$2].bind(this),getLoggerInstance:this[z2].bind(this),getParseContext:this[Z2].bind(this),getParserConfiguration:this[eD].bind(this),getUsageConfiguration:this[D2].bind(this),getUsageInstance:this[Q2].bind(this),getValidationInstance:this[X2].bind(this),hasParseCallback:this[yu].bind(this),isGlobalContext:this[M2].bind(this),postProcess:this[Du].bind(this),reset:this[KF].bind(this),runValidation:this[jF].bind(this),runYargsParserAndExecuteCommands:this[Uu].bind(this),setHasOutput:this[J2].bind(this)}}[E2](){return z(this,e,"f")}[B2](){return z(this,Ou,"f")}[$2](){return z(this,HD,"f")}[z2](){return z(this,iD,"f")}[Z2](){return z(this,oD,"f")||{}}[Q2](){return z(this,w,"f")}[X2](){return z(this,n,"f")}[yu](){return!!z(this,OD,"f")}[M2](){return z(this,vu,"f")}[Du](D,u,F,C){if(F)return D;if(i(D))return D;if(!u)D=this[n0](D);if(this[eD]()["parse-positional-numbers"]||this[eD]()["parse-positional-numbers"]===void 0)D=this[F2](D);if(C)D=yD(D,this,z(this,VD,"f").getMiddleware(),!1);return D}[KF](D={}){j(this,f,z(this,f,"f")||{},"f");let u={};u.local=z(this,f,"f").local||[],u.configObjects=z(this,f,"f").configObjects||[];let F={};u.local.forEach((B)=>{F[B]=!0,(D[B]||[]).forEach(($)=>{F[$]=!0})}),Object.assign(z(this,nD,"f"),Object.keys(z(this,_D,"f")).reduce((B,$)=>{let Z=z(this,_D,"f")[$].filter((M)=>!(M in F));if(Z.length>0)B[$]=Z;return B},{})),j(this,_D,{},"f");let C=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],E=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];if(C.forEach((B)=>{u[B]=(z(this,f,"f")[B]||[]).filter(($)=>!F[$])}),E.forEach((B)=>{u[B]=bD(z(this,f,"f")[B],($)=>!F[$])}),u.envPrefix=z(this,f,"f").envPrefix,j(this,f,u,"f"),j(this,w,z(this,w,"f")?z(this,w,"f").reset(F):d0(this,z(this,b,"f")),"f"),j(this,n,z(this,n,"f")?z(this,n,"f").reset(F):i0(this,z(this,w,"f"),z(this,b,"f")),"f"),j(this,e,z(this,e,"f")?z(this,e,"f").reset():m0(z(this,w,"f"),z(this,n,"f"),z(this,VD,"f"),z(this,b,"f")),"f"),!z(this,JD,"f"))j(this,JD,g0(this,z(this,w,"f"),z(this,e,"f"),z(this,b,"f")),"f");return z(this,VD,"f").reset(),j(this,qD,null,"f"),j(this,$D,"","f"),j(this,wD,null,"f"),j(this,HD,!1,"f"),this.parsed=!1,this}[G2](D,u){return z(this,b,"f").path.relative(D,u)}[Uu](D,u,F,C=0,E=!1){var B,$,Z,M;let H=!!F||E;D=D||z(this,mD,"f"),z(this,f,"f").__=z(this,b,"f").y18n.__,z(this,f,"f").configuration=this[eD]();let V=!!z(this,f,"f").configuration["populate--"],Y=Object.assign({},z(this,f,"f").configuration,{"populate--":!0}),q=z(this,b,"f").Parser.detailed(D,Object.assign({},z(this,f,"f"),{configuration:{"parse-positional-numbers":!1,...Y}})),O=Object.assign(q.argv,z(this,oD,"f")),W=void 0,J=q.aliases,S=!1,d=!1;if(Object.keys(O).forEach((v)=>{if(v===z(this,TD,"f")&&O[v])S=!0;else if(v===z(this,ND,"f")&&O[v])d=!0}),O.$0=this.$0,this.parsed=q,C===0)z(this,w,"f").clearCachedHelpMessage();try{if(this[OF](),u)return this[Du](O,V,!!F,!1);if(z(this,TD,"f")){if([z(this,TD,"f")].concat(J[z(this,TD,"f")]||[]).filter((uD)=>uD.length>1).includes(""+O._[O._.length-1]))O._.pop(),S=!0}j(this,vu,!1,"f");let v=z(this,e,"f").getCommands(),QD=((B=z(this,JD,"f"))===null||B===void 0?void 0:B.completionKey)?[($=z(this,JD,"f"))===null||$===void 0?void 0:$.completionKey,...(M=this.getAliases()[(Z=z(this,JD,"f"))===null||Z===void 0?void 0:Z.completionKey])!==null&&M!==void 0?M:[]].some((l)=>Object.prototype.hasOwnProperty.call(O,l)):!1,m=S||QD||E;if(O._.length){if(v.length){let l;for(let uD=C||0,s;O._[uD]!==void 0;uD++)if(s=String(O._[uD]),v.includes(s)&&s!==z(this,qD,"f")){let jD=z(this,e,"f").runCommand(s,this,q,uD+1,E,S||d||E);return this[Du](jD,V,!!F,!1)}else if(!l&&s!==z(this,qD,"f")){l=s;break}if(!z(this,e,"f").hasDefaultCommand()&&z(this,ku,"f")&&l&&!m)z(this,n,"f").recommendCommands(l,v)}if(z(this,qD,"f")&&O._.includes(z(this,qD,"f"))&&!QD){if(z(this,WD,"f"))hD(!0);this.showCompletionScript(),this.exit(0)}}if(z(this,e,"f").hasDefaultCommand()&&!m){let l=z(this,e,"f").runCommand(null,this,q,0,E,S||d||E);return this[Du](l,V,!!F,!1)}if(QD){if(z(this,WD,"f"))hD(!0);D=[].concat(D);let l=D.slice(D.indexOf(`--${z(this,JD,"f").completionKey}`)+1);return z(this,JD,"f").getCompletion(l,(uD,s)=>{if(uD)throw new a(uD.message);(s||[]).forEach((jD)=>{z(this,iD,"f").log(jD)}),this.exit(0)}),this[Du](O,!V,!!F,!1)}if(!z(this,HD,"f")){if(S){if(z(this,WD,"f"))hD(!0);H=!0,this.showHelp((l)=>{z(this,iD,"f").log(l),this.exit(0)})}else if(d){if(z(this,WD,"f"))hD(!0);H=!0,z(this,w,"f").showVersion("log"),this.exit(0)}}if(!H&&z(this,f,"f").skipValidation.length>0)H=Object.keys(O).some((l)=>z(this,f,"f").skipValidation.indexOf(l)>=0&&O[l]===!0);if(!H){if(q.error)throw new a(q.error.message);if(!QD){let l=this[jF](J,{},q.error);if(!F)W=yD(O,this,z(this,VD,"f").getMiddleware(),!0);if(W=this[C2](l,W!==null&&W!==void 0?W:O),i(W)&&!F)W=W.then(()=>{return yD(O,this,z(this,VD,"f").getMiddleware(),!1)})}}}catch(v){if(v instanceof a)z(this,w,"f").fail(v.message,v);else throw v}return this[Du](W!==null&&W!==void 0?W:O,V,!!F,!0)}[jF](D,u,F,C){let E={...this.getDemandedOptions()};return(B)=>{if(F)throw new a(F.message);z(this,n,"f").nonOptionCount(B),z(this,n,"f").requiredArguments(B,E);let $=!1;if(z(this,rD,"f"))$=z(this,n,"f").unknownCommands(B);if(z(this,sD,"f")&&!$)z(this,n,"f").unknownArguments(B,D,u,!!C);else if(z(this,aD,"f"))z(this,n,"f").unknownArguments(B,D,{},!1,!1);z(this,n,"f").limitedChoices(B),z(this,n,"f").implications(B),z(this,n,"f").conflicting(B)}}[J2](){j(this,HD,!0,"f")}[uu](D){if(typeof D==="string")z(this,f,"f").key[D]=!0;else for(let u of D)z(this,f,"f").key[u]=!0}}function v0(D){return!!D&&typeof D.getInternalMethods==="function"}var r3=Y2(S0),H2=r3;var O2={name:"@coryrylan/cradle",version:"1.2.0",description:"A runtime for portable agents defined as folders \u2014 launches the pi coding agent configured from an agent folder, sandboxed with nono",main:"./dist/index.js",module:"./dist/index.js",types:"./dist/index.d.ts",type:"module",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},bin:{cradle:"dist/index.js"},files:["README.md","CHANGELOG.md","LICENSE","package.json","dist/index.js","dist/**/*.d.ts","!dist/**/*.test.d.ts"],repository:{type:"git",url:"git+https://github.com/coryrylan/cradle.git",directory:"projects/cli"},keywords:["pi","agents","agent-folders","sandbox","nono","cli","bun"],author:"Cory Rylan (https://coryrylan.com)",license:"MIT",bugs:{url:"https://github.com/coryrylan/cradle/issues"},homepage:"https://github.com/coryrylan/cradle/tree/main/projects/cli#readme",engines:{bun:">=1.3.0"},publishConfig:{access:"public"},scripts:{start:"wireit",ci:"wireit","ci:nocache":"bun run clean && bun run ci",clean:"rm -rf dist",test:"wireit","test:coverage":"wireit",lint:"wireit",build:"wireit","install:local":"wireit","uninstall:local":"wireit",release:"wireit"},wireit:{start:{command:"bun src/index.ts",cache:!1},ci:{dependencies:["lint","build","test:coverage"]},test:{command:"bun test",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json","bunfig.toml"],output:[]},"test:coverage":{command:"bun test --coverage",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json","bunfig.toml"],output:[]},lint:{command:"eslint .",files:["src/**/*.ts","eslint.config.js","package.json"],output:[]},build:{dependencies:["build:js","build:tsc","build:darwin-arm64","build:darwin-x64","build:linux-x64","build:linux-arm64","build:windows-x64"]},"build:js":{command:"bun build ./src/index.ts --outdir=./dist --target=bun --format=esm --minify",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/index.js"]},"build:tsc":{command:"tsc --emitDeclarationOnly --project tsconfig.types.json",files:["src/**/*.ts","src/**/*.json","tsconfig.json","tsconfig.types.json"],output:["dist/**/*.d.ts"]},"build:darwin-arm64":{command:"bun build --compile --minify src/index.ts --target=bun-darwin-arm64 --outfile dist/cradle-macos-arm64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-macos-arm64"]},"build:darwin-x64":{command:"bun build --compile --minify src/index.ts --target=bun-darwin-x64 --outfile dist/cradle-macos-x64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-macos-x64"]},"build:linux-x64":{command:"bun build --compile --minify src/index.ts --target=bun-linux-x64 --outfile dist/cradle-linux-x64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-linux-x64"]},"build:linux-arm64":{command:"bun build --compile --minify src/index.ts --target=bun-linux-arm64 --outfile dist/cradle-linux-arm64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-linux-arm64"]},"build:windows-x64":{command:"bun build --compile --minify src/index.ts --target=bun-windows-x64 --outfile dist/cradle-windows-x64.exe",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-windows-x64.exe"]},"install:local":{dependencies:["build"],command:"bash install.sh",cache:!1},"uninstall:local":{command:'rm -f "$HOME/.local/bin/cradle"',cache:!1},release:{command:"HUSKY=0 bun x semantic-release",dependencies:["ci"]}},dependencies:{yargs:"^18.0.0"},devDependencies:{"@coryrylan/tools":"1.1.0","@eslint/js":"catalog:","@eslint/json":"1.2.0","@types/bun":"catalog:","@types/yargs":"17.0.35",eslint:"catalog:","eslint-plugin-jsdoc":"63.2.0",typescript:"catalog:","typescript-eslint":"catalog:"}};import{join as W2}from"path";var gu="agent-browser-nono-fallback.ts";function U2(){return`// generated by cradle for sandboxed agent-browser processes \u2014 do not edit
74
+ `;class qi{constructor(e,t,n,i){var r,s,o;this.yargs=e,this.usage=t,this.command=n,this.shim=i,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=(o=((r=this.shim.getEnv("SHELL"))===null||r===void 0?void 0:r.includes("zsh"))||((s=this.shim.getEnv("ZSH_NAME"))===null||s===void 0?void 0:s.includes("zsh")))!==null&&o!==void 0?o:!1}defaultCompletion(e,t,n,i){let r=this.command.getCommandHandlers();for(let o=0,a=e.length;o<a;++o)if(r[e[o]]&&r[e[o]].builder){let c=r[e[o]].builder;if(kt(c)){this.indexAfterLastReset=o+1;let g=this.yargs.getInternalMethods().reset();return c(g,!0),g.argv}}let s=[];this.commandCompletions(s,e,n),this.optionCompletions(s,e,t,n),this.choicesFromOptionsCompletions(s,e,t,n),this.choicesFromPositionalsCompletions(s,e,t,n),i(null,s)}commandCompletions(e,t,n){let i=this.yargs.getInternalMethods().getContext().commands;if(!n.match(/^-/)&&i[i.length-1]!==n&&!this.previousArgHasChoices(t))this.usage.getCommands().forEach((r)=>{let s=Me(r[0]).cmd;if(t.indexOf(s)===-1)if(!this.zshShell)e.push(s);else{let o=r[1]||"";e.push(s.replace(/:/g,"\\:")+":"+o)}})}optionCompletions(e,t,n,i){if((i.match(/^-/)||i===""&&e.length===0)&&!this.previousArgHasChoices(t)){let r=this.yargs.getOptions(),s=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(r.key).forEach((o)=>{let a=!!r.configuration["boolean-negation"]&&r.boolean.includes(o);if(!s.includes(o)&&!r.hiddenOptions.includes(o)&&!this.argsContainKey(t,o,a))this.completeOptionKey(o,e,i,a&&!!r.default[o])})}}choicesFromOptionsCompletions(e,t,n,i){if(this.previousArgHasChoices(t)){let r=this.getPreviousArgChoices(t);if(r&&r.length>0)e.push(...r.map((s)=>s.replace(/:/g,"\\:")))}}choicesFromPositionalsCompletions(e,t,n,i){if(i===""&&e.length>0&&this.previousArgHasChoices(t))return;let r=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],s=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),o=r[n._.length-s-1];if(!o)return;let a=this.yargs.getOptions().choices[o]||[];for(let c of a)if(c.startsWith(i))e.push(c.replace(/:/g,"\\:"))}getPreviousArgChoices(e){if(e.length<1)return;let t=e[e.length-1],n="";if(!t.startsWith("-")&&e.length>1)n=t,t=e[e.length-2];if(!t.startsWith("-"))return;let i=t.replace(/^-+/,""),r=this.yargs.getOptions(),s=[i,...this.yargs.getAliases()[i]||[]],o;for(let a of s)if(Object.prototype.hasOwnProperty.call(r.key,a)&&Array.isArray(r.choices[a])){o=r.choices[a];break}if(o)return o.filter((a)=>!n||a.startsWith(n))}previousArgHasChoices(e){let t=this.getPreviousArgChoices(e);return t!==void 0&&t.length>0}argsContainKey(e,t,n){let i=(r)=>e.indexOf((/^[^0-9]$/.test(r)?"-":"--")+r)!==-1;if(i(t))return!0;if(n&&i(`no-${t}`))return!0;if(this.aliases){for(let r of this.aliases[t])if(i(r))return!0}return!1}completeOptionKey(e,t,n,i){var r,s,o,a;let c=e;if(this.zshShell){let p=this.usage.getDescriptions(),m=(s=(r=this===null||this===void 0?void 0:this.aliases)===null||r===void 0?void 0:r[e])===null||s===void 0?void 0:s.find((j)=>{let L=p[j];return typeof L==="string"&&L.length>0}),b=m?p[m]:void 0,D=(a=(o=p[e])!==null&&o!==void 0?o:b)!==null&&a!==void 0?a:"";c=`${e.replace(/:/g,"\\:")}:${D.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}let g=(p)=>/^--/.test(p),E=(p)=>/^[^0-9]$/.test(p),h=!g(n)&&E(e)?"-":"--";if(t.push(h+c),i)t.push(h+"no-"+c)}customCompletion(e,t,n,i){if(De(this.customCompletionFunction,null,this.shim),du(this.customCompletionFunction)){let r=this.customCompletionFunction(n,t);if(J(r))return r.then((s)=>{this.shim.process.nextTick(()=>{i(null,s)})}).catch((s)=>{this.shim.process.nextTick(()=>{i(s,void 0)})});return i(null,r)}else if(Du(this.customCompletionFunction))return this.customCompletionFunction(n,t,(r=i)=>this.defaultCompletion(e,t,n,r),(r)=>{i(null,r)});else return this.customCompletionFunction(n,t,(r)=>{i(null,r)})}getCompletion(e,t){let n=e.length?e[e.length-1]:"",i=this.yargs.parse(e,!0),r=this.customCompletionFunction?(s)=>this.customCompletion(e,s,n,t):(s)=>this.defaultCompletion(e,s,n,t);return J(i)?i.then(r):r(i)}generateCompletionScript(e,t){let n=this.zshShell?Ki:Ji,i=this.shim.path.basename(e);if(e.match(/\.js$/))e=`./${e}`;return n=n.replace(/{{app_name}}/g,i),n=n.replace(/{{completion_command}}/g,t),n.replace(/{{app_path}}/g,e)}registerFunction(e){this.customCompletionFunction=e}setParsed(e){this.aliases=e.aliases}}function Xi(e,t,n,i){return new qi(e,t,n,i)}function du(e){return e.length<3}function Du(e){return e.length>3}function Zi(e,t){if(e.length===0)return t.length;if(t.length===0)return e.length;let n=[],i;for(i=0;i<=t.length;i++)n[i]=[i];let r;for(r=0;r<=e.length;r++)n[0][r]=r;for(i=1;i<=t.length;i++)for(r=1;r<=e.length;r++)if(t.charAt(i-1)===e.charAt(r-1))n[i][r]=n[i-1][r-1];else if(i>1&&r>1&&t.charAt(i-2)===e.charAt(r-1)&&t.charAt(i-1)===e.charAt(r-2))n[i][r]=n[i-2][r-2]+1;else n[i][r]=Math.min(n[i-1][r-1]+1,Math.min(n[i][r-1]+1,n[i-1][r]+1));return n[t.length][e.length]}var Qi=["$0","--","_"];function er(e,t,n){let i=n.y18n.__,r=n.y18n.__n,s={};s.nonOptionCount=function(h){let p=e.getDemandedCommands(),b=h._.length+(h["--"]?h["--"].length:0)-e.getInternalMethods().getContext().commands.length;if(p._&&(b<p._.min||b>p._.max)){if(b<p._.min)if(p._.minMsg!==void 0)t.fail(p._.minMsg?p._.minMsg.replace(/\$0/g,b.toString()).replace(/\$1/,p._.min.toString()):null);else t.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",b,b.toString(),p._.min.toString()));else if(b>p._.max)if(p._.maxMsg!==void 0)t.fail(p._.maxMsg?p._.maxMsg.replace(/\$0/g,b.toString()).replace(/\$1/,p._.max.toString()):null);else t.fail(r("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",b,b.toString(),p._.max.toString()))}},s.positionalCount=function(h,p){if(p<h)t.fail(r("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",p,p+"",h+""))},s.requiredArguments=function(h,p){let m=null;for(let b of Object.keys(p))if(!Object.prototype.hasOwnProperty.call(h,b)||typeof h[b]>"u")m=m||{},m[b]=p[b];if(m){let b=[];for(let j of Object.keys(m)){let L=m[j];if(L&&b.indexOf(L)<0)b.push(L)}let D=b.length?`
75
+ ${b.join(`
76
+ `)}`:"";t.fail(r("Missing required argument: %s","Missing required arguments: %s",Object.keys(m).length,Object.keys(m).join(", ")+D))}},s.unknownArguments=function(h,p,m,b,D=!0){var j;let L=e.getInternalMethods().getCommandInstance().getCommands(),T=[],ce=e.getInternalMethods().getContext();if(Object.keys(h).forEach((R)=>{if(!Qi.includes(R)&&!Object.prototype.hasOwnProperty.call(m,R)&&!Object.prototype.hasOwnProperty.call(e.getInternalMethods().getParseContext(),R)&&!s.isValidAndSomeAliasIsNotNew(R,p))T.push(R)}),D&&(ce.commands.length>0||L.length>0||b))h._.slice(ce.commands.length).forEach((R)=>{if(!L.includes(""+R))T.push(""+R)});if(D){let Y=((j=e.getDemandedCommands()._)===null||j===void 0?void 0:j.max)||0,ne=ce.commands.length+Y;if(ne<h._.length)h._.slice(ne).forEach((X)=>{if(X=String(X),!ce.commands.includes(X)&&!T.includes(X))T.push(X)})}if(T.length)t.fail(r("Unknown argument: %s","Unknown arguments: %s",T.length,T.map((R)=>R.trim()?R:`"${R}"`).join(", ")))},s.unknownCommands=function(h){let p=e.getInternalMethods().getCommandInstance().getCommands(),m=[],b=e.getInternalMethods().getContext();if(b.commands.length>0||p.length>0)h._.slice(b.commands.length).forEach((D)=>{if(!p.includes(""+D))m.push(""+D)});if(m.length>0)return t.fail(r("Unknown command: %s","Unknown commands: %s",m.length,m.join(", "))),!0;else return!1},s.isValidAndSomeAliasIsNotNew=function(h,p){if(!Object.prototype.hasOwnProperty.call(p,h))return!1;let m=e.parsed.newAliases;return[h,...p[h]].some((b)=>!Object.prototype.hasOwnProperty.call(m,b)||!m[h])},s.limitedChoices=function(h){let p=e.getOptions(),m={};if(!Object.keys(p.choices).length)return;Object.keys(h).forEach((j)=>{if(Qi.indexOf(j)===-1&&Object.prototype.hasOwnProperty.call(p.choices,j))[].concat(h[j]).forEach((L)=>{if(p.choices[j].indexOf(L)===-1&&L!==void 0)m[j]=(m[j]||[]).concat(L)})});let b=Object.keys(m);if(!b.length)return;let D=i("Invalid values:");b.forEach((j)=>{D+=`
77
+ ${i("Argument: %s, Given: %s, Choices: %s",j,t.stringifiedValues(m[j]),t.stringifiedValues(p.choices[j]))}`}),t.fail(D)};let o={};s.implies=function(h,p){if(w("<string|object> [array|number|string]",[h,p],arguments.length),typeof h==="object")Object.keys(h).forEach((m)=>{s.implies(m,h[m])});else{if(e.global(h),!o[h])o[h]=[];if(Array.isArray(p))p.forEach((m)=>s.implies(h,m));else De(p,void 0,n),o[h].push(p)}},s.getImplied=function(){return o};function a(E,h){let p=Number(h);if(h=isNaN(p)?h:p,typeof h==="number")h=E._.length>=h;else if(h.match(/^--no-.+/))h=h.match(/^--no-(.+)/)[1],h=!Object.prototype.hasOwnProperty.call(E,h);else h=Object.prototype.hasOwnProperty.call(E,h);return h}s.implications=function(h){let p=[];if(Object.keys(o).forEach((m)=>{let b=m;(o[m]||[]).forEach((D)=>{let j=b,L=D;if(j=a(h,j),D=a(h,D),j&&!D)p.push(` ${b} -> ${L}`)})}),p.length){let m=`${i("Implications failed:")}
78
+ `;p.forEach((b)=>{m+=b}),t.fail(m)}};let c={};s.conflicts=function(h,p){if(w("<string|object> [array|string]",[h,p],arguments.length),typeof h==="object")Object.keys(h).forEach((m)=>{s.conflicts(m,h[m])});else{if(e.global(h),!c[h])c[h]=[];if(Array.isArray(p))p.forEach((m)=>s.conflicts(h,m));else c[h].push(p)}},s.getConflicting=()=>c,s.conflicting=function(h){if(Object.keys(h).forEach((p)=>{if(c[p])c[p].forEach((m)=>{if(m&&h[p]!==void 0&&h[m]!==void 0)t.fail(i("Arguments %s and %s are mutually exclusive",p,m))})}),e.getInternalMethods().getParserConfiguration()["strip-dashed"])Object.keys(c).forEach((p)=>{c[p].forEach((m)=>{if(m&&h[n.Parser.camelCase(p)]!==void 0&&h[n.Parser.camelCase(m)]!==void 0)t.fail(i("Arguments %s and %s are mutually exclusive",p,m))})})},s.recommendCommands=function(h,p){p=p.sort((j,L)=>L.length-j.length);let b=null,D=1/0;for(let j=0,L;(L=p[j])!==void 0;j++){let T=Zi(h,L);if(T<=3&&T<D)D=T,b=L}if(b)t.fail(i("Did you mean %s?",b))},s.reset=function(h){return o=Ne(o,(p)=>!h[p]),c=Ne(c,(p)=>!h[p]),s};let g=[];return s.freeze=function(){g.push({implied:o,conflicting:c})},s.unfreeze=function(){let h=g.pop();De(h,void 0,n),{implied:o,conflicting:c}=h},s}var bn=[],Ft;function Nt(e,t,n,i){Ft=i;let r={};if(Object.prototype.hasOwnProperty.call(e,"extends")){if(typeof e.extends!=="string")return r;let s=/\.json|\..*rc$/.test(e.extends),o=null;if(!s)try{o=import.meta.resolve(e.extends)}catch(a){return e}else o=pu(t,e.extends);hu(o),bn.push(o),r=s?JSON.parse(Ft.readFileSync(o,"utf8")):i.require(e.extends),delete e.extends,r=Nt(r,Ft.path.dirname(o),n,Ft)}return bn=[],n?tr(r,e):Object.assign({},r,e)}function hu(e){if(bn.indexOf(e)>-1)throw new Q(`Circular extended configurations: '${e}'.`)}function pu(e,t){return Ft.path.resolve(e,t)}function tr(e,t){let n={};function i(r){return r&&typeof r==="object"&&!Array.isArray(r)}Object.assign(n,e);for(let r of Object.keys(t)){if(r==="__proto__")continue;if(i(t[r])&&i(n[r]))n[r]=tr(e[r],t[r]);else n[r]=t[r]}return n}var A=function(e,t,n,i,r){if(i==="m")throw TypeError("Private method is not writable");if(i==="a"&&!r)throw TypeError("Private accessor was defined without a setter");if(typeof t==="function"?e!==t||!r:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?r.call(e,n):r?r.value=n:t.set(e,n),n},u=function(e,t,n,i){if(n==="a"&&!i)throw TypeError("Private accessor was defined without a getter");if(typeof t==="function"?e!==t||!i:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?i:n==="a"?i.call(e):i?i.value:t.get(e)},ee,Ye,bt,he,ge,It,Re,Je,Rt,Ee,Tt,ye,_e,me,Ce,Wt,Ke,ue,P,Lt,Gt,Fe,qe,lt,Xe,Te,Vt,M,Ze,Qe,et,I,Ht,Se,q;function yr(e){return(t=[],n=e.process.cwd(),i)=>{let r=new Cr(t,n,i,e);return Object.defineProperty(r,"argv",{get:()=>r.parse(),enumerable:!0}),r.help(),r.version(),r}}var nr=Symbol("copyDoubleDash"),ir=Symbol("copyDoubleDash"),En=Symbol("deleteFromParserHintObject"),rr=Symbol("emitWarning"),sr=Symbol("freeze"),or=Symbol("getDollarZero"),tt=Symbol("getParserConfiguration"),ur=Symbol("getUsageConfiguration"),yn=Symbol("guessLocale"),ar=Symbol("guessVersion"),lr=Symbol("parsePositionalNumbers"),Cn=Symbol("pkgUp"),We=Symbol("populateParserHintArray"),ct=Symbol("populateParserHintSingleValueDictionary"),xn=Symbol("populateParserHintArrayDictionary"),wn=Symbol("populateParserHintDictionary"),An=Symbol("sanitizeKey"),_n=Symbol("setKey"),Sn=Symbol("unfreeze"),cr=Symbol("validateAsync"),fr=Symbol("getCommandInstance"),dr=Symbol("getContext"),Dr=Symbol("getHasOutput"),hr=Symbol("getLoggerInstance"),pr=Symbol("getParseContext"),gr=Symbol("getUsageInstance"),mr=Symbol("getValidationInstance"),zt=Symbol("hasParseCallback"),Fr=Symbol("isGlobalContext"),nt=Symbol("postProcess"),br=Symbol("rebase"),Bn=Symbol("reset"),Et=Symbol("runYargsParserAndExecuteCommands"),Pn=Symbol("runValidation"),Er=Symbol("setHasOutput"),it=Symbol("kTrackManuallySetKeys"),gu="en_US";class Cr{constructor(e=[],t,n,i){this.customScriptName=!1,this.parsed=!1,ee.set(this,void 0),Ye.set(this,void 0),bt.set(this,{commands:[],fullCommands:[]}),he.set(this,null),ge.set(this,null),It.set(this,"show-hidden"),Re.set(this,null),Je.set(this,!0),Rt.set(this,{}),Ee.set(this,!0),Tt.set(this,[]),ye.set(this,void 0),_e.set(this,{}),me.set(this,!1),Ce.set(this,null),Wt.set(this,!0),Ke.set(this,void 0),ue.set(this,""),P.set(this,void 0),Lt.set(this,void 0),Gt.set(this,{}),Fe.set(this,null),qe.set(this,null),lt.set(this,{}),Xe.set(this,{}),Te.set(this,void 0),Vt.set(this,!1),M.set(this,void 0),Ze.set(this,!1),Qe.set(this,!1),et.set(this,!1),I.set(this,void 0),Ht.set(this,{}),Se.set(this,null),q.set(this,void 0),A(this,M,i,"f"),A(this,Te,e,"f"),A(this,Ye,t,"f"),A(this,Lt,n,"f"),A(this,ye,new mn(this),"f"),this.$0=this[or](),this[Bn](),A(this,ee,u(this,ee,"f"),"f"),A(this,I,u(this,I,"f"),"f"),A(this,q,u(this,q,"f"),"f"),A(this,P,u(this,P,"f"),"f"),u(this,P,"f").showHiddenOpt=u(this,It,"f"),A(this,Ke,this[ir](),"f"),u(this,M,"f").y18n.setLocale(gu)}addHelpOpt(e,t){if(w("[string|boolean] [string]",[e,t],arguments.length),u(this,Ce,"f"))this[En](u(this,Ce,"f")),A(this,Ce,null,"f");if(e===!1&&t===void 0)return this;return A(this,Ce,typeof e==="string"?e:"help","f"),this.boolean(u(this,Ce,"f")),this.describe(u(this,Ce,"f"),t||u(this,I,"f").deferY18nLookup("Show help")),this}help(e,t){return this.addHelpOpt(e,t)}addShowHiddenOpt(e,t){if(w("[string|boolean] [string]",[e,t],arguments.length),e===!1&&t===void 0)return this;let n=typeof e==="string"?e:u(this,It,"f");return this.boolean(n),this.describe(n,t||u(this,I,"f").deferY18nLookup("Show hidden options")),u(this,P,"f").showHiddenOpt=n,this}showHidden(e,t){return this.addShowHiddenOpt(e,t)}alias(e,t){return w("<object|string|array> [string|array]",[e,t],arguments.length),this[xn](this.alias.bind(this),"alias",e,t),this}array(e){return w("<array|string>",[e],arguments.length),this[We]("array",e),this[it](e),this}boolean(e){return w("<array|string>",[e],arguments.length),this[We]("boolean",e),this[it](e),this}check(e,t){return w("<function> [boolean]",[e,t],arguments.length),this.middleware((n,i)=>Ue(()=>e(n,i.getOptions()),(r)=>{if(!r)u(this,I,"f").fail(u(this,M,"f").y18n.__("Argument check failed: %s",e.toString()));else if(typeof r==="string"||r instanceof Error)u(this,I,"f").fail(r.toString(),r);return n},(r)=>(u(this,I,"f").fail(r.message?r.message:r.toString(),r),n)),!1,t),this}choices(e,t){return w("<object|string|array> [string|array]",[e,t],arguments.length),this[xn](this.choices.bind(this),"choices",e,t),this}coerce(e,t){if(w("<object|string|array> [function]",[e,t],arguments.length),Array.isArray(e)){if(!t)throw new Q("coerce callback must be provided");for(let i of e)this.coerce(i,t);return this}else if(typeof e==="object"){for(let i of Object.keys(e))this.coerce(i,e[i]);return this}if(!t)throw new Q("coerce callback must be provided");let n=e;return u(this,P,"f").key[n]=!0,u(this,ye,"f").addCoerceMiddleware((i,r)=>{var s;let o=(s=r.getAliases()[n])!==null&&s!==void 0?s:[],a=[n,...o].filter((c)=>Object.prototype.hasOwnProperty.call(i,c));if(a.length===0)return i;return Ue(()=>t(i[a[0]]),(c)=>(a.forEach((g)=>{i[g]=c}),i),(c)=>{throw new Q(c.message)})},n),this}conflicts(e,t){return w("<string|object> [string|array]",[e,t],arguments.length),u(this,q,"f").conflicts(e,t),this}config(e="config",t,n){if(w("[object|string] [string|function] [function]",[e,t,n],arguments.length),typeof e==="object"&&!Array.isArray(e))return e=Nt(e,u(this,Ye,"f"),this[tt]()["deep-merge-config"]||!1,u(this,M,"f")),u(this,P,"f").configObjects=(u(this,P,"f").configObjects||[]).concat(e),this;if(typeof t==="function")n=t,t=void 0;return this.describe(e,t||u(this,I,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(e)?e:[e]).forEach((i)=>{u(this,P,"f").config[i]=n||!0}),this}completion(e,t,n){if(w("[string] [string|boolean|function] [function]",[e,t,n],arguments.length),typeof t==="function")n=t,t=void 0;if(A(this,ge,e||u(this,ge,"f")||"completion","f"),!t&&t!==!1)t="generate completion script";if(this.command(u(this,ge,"f"),t),n)u(this,he,"f").registerFunction(n);return this}command(e,t,n,i,r,s){return w("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[e,t,n,i,r,s],arguments.length),u(this,ee,"f").addHandler(e,t,n,i,r,s),this}commands(e,t,n,i,r,s){return this.command(e,t,n,i,r,s)}commandDir(e,t){w("<string> [object]",[e,t],arguments.length);let n=u(this,Lt,"f")||u(this,M,"f").require;return u(this,ee,"f").addDirectory(e,n,u(this,M,"f").getCallerFile(),t),this}count(e){return w("<array|string>",[e],arguments.length),this[We]("count",e),this[it](e),this}default(e,t,n){if(w("<object|string|array> [*] [string]",[e,t,n],arguments.length),n)gn(e,u(this,M,"f")),u(this,P,"f").defaultDescription[e]=n;if(typeof t==="function"){if(gn(e,u(this,M,"f")),!u(this,P,"f").defaultDescription[e])u(this,P,"f").defaultDescription[e]=u(this,I,"f").functionDescription(t);t=t.call()}return this[ct](this.default.bind(this),"default",e,t),this}defaults(e,t,n){return this.default(e,t,n)}demandCommand(e=1,t,n,i){if(w("[number] [number|string] [string|null|undefined] [string|null|undefined]",[e,t,n,i],arguments.length),typeof t!=="number")n=t,t=1/0;return this.global("_",!1),u(this,P,"f").demandedCommands._={min:e,max:t,minMsg:n,maxMsg:i},this}demand(e,t,n){if(Array.isArray(t))t.forEach((i)=>{De(n,!0,u(this,M,"f")),this.demandOption(i,n)}),t=1/0;else if(typeof t!=="number")n=t,t=1/0;if(typeof e==="number")De(n,!0,u(this,M,"f")),this.demandCommand(e,t,n,n);else if(Array.isArray(e))e.forEach((i)=>{De(n,!0,u(this,M,"f")),this.demandOption(i,n)});else if(typeof n==="string")this.demandOption(e,n);else if(n===!0||typeof n>"u")this.demandOption(e);return this}demandOption(e,t){return w("<object|string|array> [string]",[e,t],arguments.length),this[ct](this.demandOption.bind(this),"demandedOptions",e,t),this}deprecateOption(e,t){return w("<string> [string|boolean]",[e,t],arguments.length),u(this,P,"f").deprecatedOptions[e]=t,this}describe(e,t){return w("<object|string|array> [string]",[e,t],arguments.length),this[_n](e,!0),u(this,I,"f").describe(e,t),this}detectLocale(e){return w("<boolean>",[e],arguments.length),A(this,Je,e,"f"),this}env(e){if(w("[string|boolean]",[e],arguments.length),e===!1)delete u(this,P,"f").envPrefix;else u(this,P,"f").envPrefix=e||"";return this}epilogue(e){return w("<string>",[e],arguments.length),u(this,I,"f").epilog(e),this}epilog(e){return this.epilogue(e)}example(e,t){if(w("<string|array> [string]",[e,t],arguments.length),Array.isArray(e))e.forEach((n)=>this.example(...n));else u(this,I,"f").example(e,t);return this}exit(e,t){if(A(this,me,!0,"f"),A(this,Re,t,"f"),u(this,Ee,"f"))u(this,M,"f").process.exit(e)}exitProcess(e=!0){return w("[boolean]",[e],arguments.length),A(this,Ee,e,"f"),this}fail(e){if(w("<function|boolean>",[e],arguments.length),typeof e==="boolean"&&e!==!1)throw new Q("Invalid first argument. Expected function or boolean 'false'");return u(this,I,"f").failFn(e),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(e,t){if(w("<array> [function]",[e,t],arguments.length),!t)return new Promise((n,i)=>{u(this,he,"f").getCompletion(e,(r,s)=>{if(r)i(r);else n(s)})});else return u(this,he,"f").getCompletion(e,t)}getDemandedOptions(){return w([],0),u(this,P,"f").demandedOptions}getDemandedCommands(){return w([],0),u(this,P,"f").demandedCommands}getDeprecatedOptions(){return w([],0),u(this,P,"f").deprecatedOptions}getDetectLocale(){return u(this,Je,"f")}getExitProcess(){return u(this,Ee,"f")}getGroups(){return Object.assign({},u(this,_e,"f"),u(this,Xe,"f"))}getHelp(){if(A(this,me,!0,"f"),!u(this,I,"f").hasCachedHelpMessage()){if(!this.parsed){let t=this[Et](u(this,Te,"f"),void 0,void 0,0,!0);if(J(t))return t.then(()=>u(this,I,"f").help())}let e=u(this,ee,"f").runDefaultBuilderOn(this);if(J(e))return e.then(()=>u(this,I,"f").help())}return Promise.resolve(u(this,I,"f").help())}getOptions(){return u(this,P,"f")}getStrict(){return u(this,Ze,"f")}getStrictCommands(){return u(this,Qe,"f")}getStrictOptions(){return u(this,et,"f")}global(e,t){if(w("<string|array> [boolean]",[e,t],arguments.length),e=[].concat(e),t!==!1)u(this,P,"f").local=u(this,P,"f").local.filter((n)=>e.indexOf(n)===-1);else e.forEach((n)=>{if(!u(this,P,"f").local.includes(n))u(this,P,"f").local.push(n)});return this}group(e,t){w("<string|array> <string>",[e,t],arguments.length);let n=u(this,Xe,"f")[t]||u(this,_e,"f")[t];if(u(this,Xe,"f")[t])delete u(this,Xe,"f")[t];let i={};return u(this,_e,"f")[t]=(n||[]).concat(e).filter((r)=>{if(i[r])return!1;return i[r]=!0}),this}hide(e){return w("<string>",[e],arguments.length),u(this,P,"f").hiddenOptions.push(e),this}implies(e,t){return w("<string|object> [number|string|array]",[e,t],arguments.length),u(this,q,"f").implies(e,t),this}locale(e){if(w("[string]",[e],arguments.length),e===void 0)return this[yn](),u(this,M,"f").y18n.getLocale();return A(this,Je,!1,"f"),u(this,M,"f").y18n.setLocale(e),this}middleware(e,t,n){return u(this,ye,"f").addMiddleware(e,!!t,n)}nargs(e,t){return w("<string|object|array> [number]",[e,t],arguments.length),this[ct](this.nargs.bind(this),"narg",e,t),this}normalize(e){return w("<array|string>",[e],arguments.length),this[We]("normalize",e),this}number(e){return w("<array|string>",[e],arguments.length),this[We]("number",e),this[it](e),this}option(e,t){if(w("<string|object> [object]",[e,t],arguments.length),typeof e==="object")Object.keys(e).forEach((n)=>{this.options(n,e[n])});else{if(typeof t!=="object")t={};if(this[it](e),u(this,Se,"f")&&(e==="version"||(t===null||t===void 0?void 0:t.alias)==="version"))this[rr](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join(`
79
+ `),void 0,"versionWarning");if(u(this,P,"f").key[e]=!0,t.alias)this.alias(e,t.alias);let n=t.deprecate||t.deprecated;if(n)this.deprecateOption(e,n);let i=t.demand||t.required||t.require;if(i)this.demand(e,i);if(t.demandOption)this.demandOption(e,typeof t.demandOption==="string"?t.demandOption:void 0);if(t.conflicts)this.conflicts(e,t.conflicts);if("default"in t)this.default(e,t.default);if(t.implies!==void 0)this.implies(e,t.implies);if(t.nargs!==void 0)this.nargs(e,t.nargs);if(t.config)this.config(e,t.configParser);if(t.normalize)this.normalize(e);if(t.choices)this.choices(e,t.choices);if(t.coerce)this.coerce(e,t.coerce);if(t.group)this.group(e,t.group);if(t.boolean||t.type==="boolean"){if(this.boolean(e),t.alias)this.boolean(t.alias)}if(t.array||t.type==="array"){if(this.array(e),t.alias)this.array(t.alias)}if(t.number||t.type==="number"){if(this.number(e),t.alias)this.number(t.alias)}if(t.string||t.type==="string"){if(this.string(e),t.alias)this.string(t.alias)}if(t.count||t.type==="count")this.count(e);if(typeof t.global==="boolean")this.global(e,t.global);if(t.defaultDescription)u(this,P,"f").defaultDescription[e]=t.defaultDescription;if(t.skipValidation)this.skipValidation(e);let r=t.describe||t.description||t.desc,s=u(this,I,"f").getDescriptions();if(!Object.prototype.hasOwnProperty.call(s,e)||typeof r==="string")this.describe(e,r);if(t.hidden)this.hide(e);if(t.requiresArg)this.requiresArg(e)}return this}options(e,t){return this.option(e,t)}parse(e,t,n){if(w("[string|array] [function|boolean|object] [function]",[e,t,n],arguments.length),this[sr](),typeof e>"u")e=u(this,Te,"f");if(typeof t==="object")A(this,qe,t,"f"),t=n;if(typeof t==="function")A(this,Fe,t,"f"),t=!1;if(!t)A(this,Te,e,"f");if(u(this,Fe,"f"))A(this,Ee,!1,"f");let i=this[Et](e,!!t),r=this.parsed;if(u(this,he,"f").setParsed(this.parsed),J(i))return i.then((s)=>{if(u(this,Fe,"f"))u(this,Fe,"f").call(this,u(this,Re,"f"),s,u(this,ue,"f"));return s}).catch((s)=>{if(u(this,Fe,"f"))u(this,Fe,"f")(s,this.parsed.argv,u(this,ue,"f"));throw s}).finally(()=>{this[Sn](),this.parsed=r});else{if(u(this,Fe,"f"))u(this,Fe,"f").call(this,u(this,Re,"f"),i,u(this,ue,"f"));this[Sn](),this.parsed=r}return i}parseAsync(e,t,n){let i=this.parse(e,t,n);return!J(i)?Promise.resolve(i):i}parseSync(e,t,n){let i=this.parse(e,t,n);if(J(i))throw new Q(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return i}parserConfiguration(e){return w("<object>",[e],arguments.length),A(this,Gt,e,"f"),this}pkgConf(e,t){w("<string> [string]",[e,t],arguments.length);let n=null,i=this[Cn](t||u(this,Ye,"f"));if(i[e]&&typeof i[e]==="object")n=Nt(i[e],t||u(this,Ye,"f"),this[tt]()["deep-merge-config"]||!1,u(this,M,"f")),u(this,P,"f").configObjects=(u(this,P,"f").configObjects||[]).concat(n);return this}positional(e,t){w("<string> <object>",[e,t],arguments.length);let n=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];t=Ne(t,(s,o)=>{if(s==="type"&&!["string","number","boolean"].includes(o))return!1;return n.includes(s)});let i=u(this,bt,"f").fullCommands[u(this,bt,"f").fullCommands.length-1],r=i?u(this,ee,"f").cmdToParseOptions(i):{array:[],alias:{},default:{},demand:{}};return ut(r).forEach((s)=>{let o=r[s];if(Array.isArray(o)){if(o.indexOf(e)!==-1)t[s]=!0}else if(o[e]&&!(s in t))t[s]=o[e]}),this.group(e,u(this,I,"f").getPositionalGroupName()),this.option(e,t)}recommendCommands(e=!0){return w("[boolean]",[e],arguments.length),A(this,Vt,e,"f"),this}required(e,t,n){return this.demand(e,t,n)}require(e,t,n){return this.demand(e,t,n)}requiresArg(e){if(w("<array|string|object> [number]",[e],arguments.length),typeof e==="string"&&u(this,P,"f").narg[e])return this;else this[ct](this.requiresArg.bind(this),"narg",e,NaN);return this}showCompletionScript(e,t){return w("[string] [string]",[e,t],arguments.length),e=e||this.$0,u(this,Ke,"f").log(u(this,he,"f").generateCompletionScript(e,t||u(this,ge,"f")||"completion")),this}showHelp(e){if(w("[string|function]",[e],arguments.length),A(this,me,!0,"f"),!u(this,I,"f").hasCachedHelpMessage()){if(!this.parsed){let n=this[Et](u(this,Te,"f"),void 0,void 0,0,!0);if(J(n))return n.then(()=>{u(this,I,"f").showHelp(e)}),this}let t=u(this,ee,"f").runDefaultBuilderOn(this);if(J(t))return t.then(()=>{u(this,I,"f").showHelp(e)}),this}return u(this,I,"f").showHelp(e),this}scriptName(e){return this.customScriptName=!0,this.$0=e,this}showHelpOnFail(e,t){return w("[boolean|string] [string]",[e,t],arguments.length),u(this,I,"f").showHelpOnFail(e,t),this}showVersion(e){return w("[string|function]",[e],arguments.length),u(this,I,"f").showVersion(e),this}skipValidation(e){return w("<array|string>",[e],arguments.length),this[We]("skipValidation",e),this}strict(e){return w("[boolean]",[e],arguments.length),A(this,Ze,e!==!1,"f"),this}strictCommands(e){return w("[boolean]",[e],arguments.length),A(this,Qe,e!==!1,"f"),this}strictOptions(e){return w("[boolean]",[e],arguments.length),A(this,et,e!==!1,"f"),this}string(e){return w("<array|string>",[e],arguments.length),this[We]("string",e),this[it](e),this}terminalWidth(){return w([],0),u(this,M,"f").process.stdColumns}updateLocale(e){return this.updateStrings(e)}updateStrings(e){return w("<object>",[e],arguments.length),A(this,Je,!1,"f"),u(this,M,"f").y18n.updateLocale(e),this}usage(e,t,n,i){if(w("<string|null|undefined> [string|boolean] [function|object] [function]",[e,t,n,i],arguments.length),t!==void 0)if(De(e,null,u(this,M,"f")),(e||"").match(/^\$0( |$)/))return this.command(e,t,n,i);else throw new Q(".usage() description must start with $0 if being used as alias for .command()");else return u(this,I,"f").usage(e),this}usageConfiguration(e){return w("<object>",[e],arguments.length),A(this,Ht,e,"f"),this}version(e,t,n){if(w("[boolean|string] [string] [string]",[e,t,n],arguments.length),u(this,Se,"f"))this[En](u(this,Se,"f")),u(this,I,"f").version(void 0),A(this,Se,null,"f");if(arguments.length===0)n=this[ar](),e="version";else if(arguments.length===1){if(e===!1)return this;n=e,e="version"}else if(arguments.length===2)n=t,t=void 0;return A(this,Se,typeof e==="string"?e:"version","f"),t=t||u(this,I,"f").deferY18nLookup("Show version number"),u(this,I,"f").version(n||void 0),this.boolean(u(this,Se,"f")),this.describe(u(this,Se,"f"),t),this}wrap(e){return w("<number|null|undefined>",[e],arguments.length),u(this,I,"f").wrap(e),this}[(ee=new WeakMap,Ye=new WeakMap,bt=new WeakMap,he=new WeakMap,ge=new WeakMap,It=new WeakMap,Re=new WeakMap,Je=new WeakMap,Rt=new WeakMap,Ee=new WeakMap,Tt=new WeakMap,ye=new WeakMap,_e=new WeakMap,me=new WeakMap,Ce=new WeakMap,Wt=new WeakMap,Ke=new WeakMap,ue=new WeakMap,P=new WeakMap,Lt=new WeakMap,Gt=new WeakMap,Fe=new WeakMap,qe=new WeakMap,lt=new WeakMap,Xe=new WeakMap,Te=new WeakMap,Vt=new WeakMap,M=new WeakMap,Ze=new WeakMap,Qe=new WeakMap,et=new WeakMap,I=new WeakMap,Ht=new WeakMap,Se=new WeakMap,q=new WeakMap,nr)](e){if(!e._||!e["--"])return e;e._.push.apply(e._,e["--"]);try{delete e["--"]}catch(t){}return e}[ir](){return{log:(...e)=>{if(!this[zt]())console.log(...e);if(A(this,me,!0,"f"),u(this,ue,"f").length)A(this,ue,u(this,ue,"f")+`
80
+ `,"f");A(this,ue,u(this,ue,"f")+e.join(" "),"f")},error:(...e)=>{if(!this[zt]())console.error(...e);if(A(this,me,!0,"f"),u(this,ue,"f").length)A(this,ue,u(this,ue,"f")+`
81
+ `,"f");A(this,ue,u(this,ue,"f")+e.join(" "),"f")}}}[En](e){ut(u(this,P,"f")).forEach((t)=>{if(((i)=>i==="configObjects")(t))return;let n=u(this,P,"f")[t];if(Array.isArray(n)){if(n.includes(e))n.splice(n.indexOf(e),1)}else if(typeof n==="object")delete n[e]}),delete u(this,I,"f").getDescriptions()[e]}[rr](e,t,n){if(!u(this,Rt,"f")[n])u(this,M,"f").process.emitWarning(e,t),u(this,Rt,"f")[n]=!0}[sr](){u(this,Tt,"f").push({options:u(this,P,"f"),configObjects:u(this,P,"f").configObjects.slice(0),exitProcess:u(this,Ee,"f"),groups:u(this,_e,"f"),strict:u(this,Ze,"f"),strictCommands:u(this,Qe,"f"),strictOptions:u(this,et,"f"),completionCommand:u(this,ge,"f"),output:u(this,ue,"f"),exitError:u(this,Re,"f"),hasOutput:u(this,me,"f"),parsed:this.parsed,parseFn:u(this,Fe,"f"),parseContext:u(this,qe,"f")}),u(this,I,"f").freeze(),u(this,q,"f").freeze(),u(this,ee,"f").freeze(),u(this,ye,"f").freeze()}[or](){let e="",t;if(/\b(node|iojs|electron|bun)(\.exe)?$/.test(u(this,M,"f").process.argv()[0]))t=u(this,M,"f").process.argv().slice(1,2);else t=u(this,M,"f").process.argv().slice(0,1);if(e=t.map((n)=>{let i=this[br](u(this,Ye,"f"),n);return n.match(/^(\/|([a-zA-Z]:)?\\)/)&&i.length<n.length?i:n}).join(" ").trim(),u(this,M,"f").getEnv("_")&&u(this,M,"f").getProcessArgvBin()===u(this,M,"f").getEnv("_"))e=u(this,M,"f").getEnv("_").replace(`${u(this,M,"f").path.dirname(u(this,M,"f").process.execPath())}/`,"");return e}[tt](){return u(this,Gt,"f")}[ur](){return u(this,Ht,"f")}[yn](){if(!u(this,Je,"f"))return;let e=u(this,M,"f").getEnv("LC_ALL")||u(this,M,"f").getEnv("LC_MESSAGES")||u(this,M,"f").getEnv("LANG")||u(this,M,"f").getEnv("LANGUAGE")||"en_US";this.locale(e.replace(/[.:].*/,""))}[ar](){return this[Cn]().version||"unknown"}[lr](e){let t=e["--"]?e["--"]:e._;for(let n=0,i;(i=t[n])!==void 0;n++)if(u(this,M,"f").Parser.looksLikeNumber(i)&&Number.isSafeInteger(Math.floor(parseFloat(`${i}`))))t[n]=Number(i);return e}[Cn](e){let t=e||"*";if(u(this,lt,"f")[t])return u(this,lt,"f")[t];let n={};try{let i=e||u(this,M,"f").mainFilename;if(u(this,M,"f").path.extname(i))i=u(this,M,"f").path.dirname(i);let r=u(this,M,"f").findUp(i,(s,o)=>{if(o.includes("package.json"))return"package.json";else return});De(r,void 0,u(this,M,"f")),n=JSON.parse(u(this,M,"f").readFileSync(r,"utf8"))}catch(i){}return u(this,lt,"f")[t]=n||{},u(this,lt,"f")[t]}[We](e,t){t=[].concat(t),t.forEach((n)=>{n=this[An](n),u(this,P,"f")[e].push(n)})}[ct](e,t,n,i){this[wn](e,t,n,i,(r,s,o)=>{u(this,P,"f")[r][s]=o})}[xn](e,t,n,i){this[wn](e,t,n,i,(r,s,o)=>{u(this,P,"f")[r][s]=(u(this,P,"f")[r][s]||[]).concat(o)})}[wn](e,t,n,i,r){if(Array.isArray(n))n.forEach((s)=>{e(s,i)});else if(((s)=>typeof s==="object")(n))for(let s of ut(n))e(s,n[s]);else r(t,this[An](n),i)}[An](e){if(e==="__proto__")return"___proto___";return e}[_n](e,t){return this[ct](this[_n].bind(this),"key",e,t),this}[Sn](){var e,t,n,i,r,s,o,a,c,g,E,h;let p=u(this,Tt,"f").pop();De(p,void 0,u(this,M,"f"));let m;e=this,t=this,n=this,i=this,r=this,s=this,o=this,a=this,c=this,g=this,E=this,h=this,{options:{set value(b){A(e,P,b,"f")}}.value,configObjects:m,exitProcess:{set value(b){A(t,Ee,b,"f")}}.value,groups:{set value(b){A(n,_e,b,"f")}}.value,output:{set value(b){A(i,ue,b,"f")}}.value,exitError:{set value(b){A(r,Re,b,"f")}}.value,hasOutput:{set value(b){A(s,me,b,"f")}}.value,parsed:this.parsed,strict:{set value(b){A(o,Ze,b,"f")}}.value,strictCommands:{set value(b){A(a,Qe,b,"f")}}.value,strictOptions:{set value(b){A(c,et,b,"f")}}.value,completionCommand:{set value(b){A(g,ge,b,"f")}}.value,parseFn:{set value(b){A(E,Fe,b,"f")}}.value,parseContext:{set value(b){A(h,qe,b,"f")}}.value}=p,u(this,P,"f").configObjects=m,u(this,I,"f").unfreeze(),u(this,q,"f").unfreeze(),u(this,ee,"f").unfreeze(),u(this,ye,"f").unfreeze()}[cr](e,t){return Ue(t,(n)=>(e(n),n))}getInternalMethods(){return{getCommandInstance:this[fr].bind(this),getContext:this[dr].bind(this),getHasOutput:this[Dr].bind(this),getLoggerInstance:this[hr].bind(this),getParseContext:this[pr].bind(this),getParserConfiguration:this[tt].bind(this),getUsageConfiguration:this[ur].bind(this),getUsageInstance:this[gr].bind(this),getValidationInstance:this[mr].bind(this),hasParseCallback:this[zt].bind(this),isGlobalContext:this[Fr].bind(this),postProcess:this[nt].bind(this),reset:this[Bn].bind(this),runValidation:this[Pn].bind(this),runYargsParserAndExecuteCommands:this[Et].bind(this),setHasOutput:this[Er].bind(this)}}[fr](){return u(this,ee,"f")}[dr](){return u(this,bt,"f")}[Dr](){return u(this,me,"f")}[hr](){return u(this,Ke,"f")}[pr](){return u(this,qe,"f")||{}}[gr](){return u(this,I,"f")}[mr](){return u(this,q,"f")}[zt](){return!!u(this,Fe,"f")}[Fr](){return u(this,Wt,"f")}[nt](e,t,n,i){if(n)return e;if(J(e))return e;if(!t)e=this[nr](e);if(this[tt]()["parse-positional-numbers"]||this[tt]()["parse-positional-numbers"]===void 0)e=this[lr](e);if(i)e=ze(e,this,u(this,ye,"f").getMiddleware(),!1);return e}[Bn](e={}){A(this,P,u(this,P,"f")||{},"f");let t={};t.local=u(this,P,"f").local||[],t.configObjects=u(this,P,"f").configObjects||[];let n={};t.local.forEach((s)=>{n[s]=!0,(e[s]||[]).forEach((o)=>{n[o]=!0})}),Object.assign(u(this,Xe,"f"),Object.keys(u(this,_e,"f")).reduce((s,o)=>{let a=u(this,_e,"f")[o].filter((c)=>!(c in n));if(a.length>0)s[o]=a;return s},{})),A(this,_e,{},"f");let i=["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"],r=["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"];if(i.forEach((s)=>{t[s]=(u(this,P,"f")[s]||[]).filter((o)=>!n[o])}),r.forEach((s)=>{t[s]=Ne(u(this,P,"f")[s],(o)=>!n[o])}),t.envPrefix=u(this,P,"f").envPrefix,A(this,P,t,"f"),A(this,I,u(this,I,"f")?u(this,I,"f").reset(n):Yi(this,u(this,M,"f")),"f"),A(this,q,u(this,q,"f")?u(this,q,"f").reset(n):er(this,u(this,I,"f"),u(this,M,"f")),"f"),A(this,ee,u(this,ee,"f")?u(this,ee,"f").reset():Hi(u(this,I,"f"),u(this,q,"f"),u(this,ye,"f"),u(this,M,"f")),"f"),!u(this,he,"f"))A(this,he,Xi(this,u(this,I,"f"),u(this,ee,"f"),u(this,M,"f")),"f");return u(this,ye,"f").reset(),A(this,ge,null,"f"),A(this,ue,"","f"),A(this,Re,null,"f"),A(this,me,!1,"f"),this.parsed=!1,this}[br](e,t){return u(this,M,"f").path.relative(e,t)}[Et](e,t,n,i=0,r=!1){var s,o,a,c;let g=!!n||r;e=e||u(this,Te,"f"),u(this,P,"f").__=u(this,M,"f").y18n.__,u(this,P,"f").configuration=this[tt]();let E=!!u(this,P,"f").configuration["populate--"],h=Object.assign({},u(this,P,"f").configuration,{"populate--":!0}),p=u(this,M,"f").Parser.detailed(e,Object.assign({},u(this,P,"f"),{configuration:{"parse-positional-numbers":!1,...h}})),m=Object.assign(p.argv,u(this,qe,"f")),b=void 0,D=p.aliases,j=!1,L=!1;if(Object.keys(m).forEach((T)=>{if(T===u(this,Ce,"f")&&m[T])j=!0;else if(T===u(this,Se,"f")&&m[T])L=!0}),m.$0=this.$0,this.parsed=p,i===0)u(this,I,"f").clearCachedHelpMessage();try{if(this[yn](),t)return this[nt](m,E,!!n,!1);if(u(this,Ce,"f")){if([u(this,Ce,"f")].concat(D[u(this,Ce,"f")]||[]).filter((ne)=>ne.length>1).includes(""+m._[m._.length-1]))m._.pop(),j=!0}A(this,Wt,!1,"f");let T=u(this,ee,"f").getCommands(),ce=((s=u(this,he,"f"))===null||s===void 0?void 0:s.completionKey)?[(o=u(this,he,"f"))===null||o===void 0?void 0:o.completionKey,...(c=this.getAliases()[(a=u(this,he,"f"))===null||a===void 0?void 0:a.completionKey])!==null&&c!==void 0?c:[]].some((Y)=>Object.prototype.hasOwnProperty.call(m,Y)):!1,R=j||ce||r;if(m._.length){if(T.length){let Y;for(let ne=i||0,X;m._[ne]!==void 0;ne++)if(X=String(m._[ne]),T.includes(X)&&X!==u(this,ge,"f")){let Ae=u(this,ee,"f").runCommand(X,this,p,ne+1,r,j||L||r);return this[nt](Ae,E,!!n,!1)}else if(!Y&&X!==u(this,ge,"f")){Y=X;break}if(!u(this,ee,"f").hasDefaultCommand()&&u(this,Vt,"f")&&Y&&!R)u(this,q,"f").recommendCommands(Y,T)}if(u(this,ge,"f")&&m._.includes(u(this,ge,"f"))&&!ce){if(u(this,Ee,"f"))Ie(!0);this.showCompletionScript(),this.exit(0)}}if(u(this,ee,"f").hasDefaultCommand()&&!R){let Y=u(this,ee,"f").runCommand(null,this,p,0,r,j||L||r);return this[nt](Y,E,!!n,!1)}if(ce){if(u(this,Ee,"f"))Ie(!0);e=[].concat(e);let Y=e.slice(e.indexOf(`--${u(this,he,"f").completionKey}`)+1);return u(this,he,"f").getCompletion(Y,(ne,X)=>{if(ne)throw new Q(ne.message);(X||[]).forEach((Ae)=>{u(this,Ke,"f").log(Ae)}),this.exit(0)}),this[nt](m,!E,!!n,!1)}if(!u(this,me,"f")){if(j){if(u(this,Ee,"f"))Ie(!0);g=!0,this.showHelp((Y)=>{u(this,Ke,"f").log(Y),this.exit(0)})}else if(L){if(u(this,Ee,"f"))Ie(!0);g=!0,u(this,I,"f").showVersion("log"),this.exit(0)}}if(!g&&u(this,P,"f").skipValidation.length>0)g=Object.keys(m).some((Y)=>u(this,P,"f").skipValidation.indexOf(Y)>=0&&m[Y]===!0);if(!g){if(p.error)throw new Q(p.error.message);if(!ce){let Y=this[Pn](D,{},p.error);if(!n)b=ze(m,this,u(this,ye,"f").getMiddleware(),!0);if(b=this[cr](Y,b!==null&&b!==void 0?b:m),J(b)&&!n)b=b.then(()=>ze(m,this,u(this,ye,"f").getMiddleware(),!1))}}}catch(T){if(T instanceof Q)u(this,I,"f").fail(T.message,T);else throw T}return this[nt](b!==null&&b!==void 0?b:m,E,!!n,!0)}[Pn](e,t,n,i){let r={...this.getDemandedOptions()};return(s)=>{if(n)throw new Q(n.message);u(this,q,"f").nonOptionCount(s),u(this,q,"f").requiredArguments(s,r);let o=!1;if(u(this,Qe,"f"))o=u(this,q,"f").unknownCommands(s);if(u(this,Ze,"f")&&!o)u(this,q,"f").unknownArguments(s,e,t,!!i);else if(u(this,et,"f"))u(this,q,"f").unknownArguments(s,e,{},!1,!1);u(this,q,"f").limitedChoices(s),u(this,q,"f").implications(s),u(this,q,"f").conflicting(s)}}[Er](){A(this,me,!0,"f")}[it](e){if(typeof e==="string")u(this,P,"f").key[e]=!0;else for(let t of e)u(this,P,"f").key[t]=!0}}function zi(e){return!!e&&typeof e.getInternalMethods==="function"}var mu=yr(Ri),xr=mu;var wr={name:"@coryrylan/cradle",version:"1.3.0",description:"A runtime for portable agents defined as folders \u2014 launches the pi coding agent configured from an agent folder, sandboxed with nono",main:"./dist/index.js",module:"./dist/index.js",types:"./dist/index.d.ts",type:"module",exports:{".":{types:"./dist/index.d.ts",default:"./dist/index.js"}},bin:{cradle:"dist/index.js"},files:["README.md","CHANGELOG.md","LICENSE","package.json","dist/index.js","dist/**/*.d.ts","!dist/**/*.test.d.ts"],repository:{type:"git",url:"git+https://github.com/coryrylan/cradle.git",directory:"projects/cli"},keywords:["pi","agents","agent-folders","sandbox","nono","cli","bun"],author:"Cory Rylan (https://coryrylan.com)",license:"MIT",bugs:{url:"https://github.com/coryrylan/cradle/issues"},homepage:"https://github.com/coryrylan/cradle/tree/main/projects/cli#readme",engines:{bun:">=1.4.0"},publishConfig:{access:"public"},scripts:{start:"wireit",ci:"wireit","ci:nocache":"bun run clean && bun run ci",clean:"rm -rf dist",test:"wireit","test:coverage":"wireit",lint:"wireit",build:"wireit","install:local":"wireit","uninstall:local":"wireit",release:"wireit"},wireit:{start:{command:"bun src/index.ts",cache:!1},ci:{dependencies:["lint","build","test:coverage"]},test:{command:"bun test",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json","bunfig.toml"],output:[]},"test:coverage":{command:"bun test --coverage",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json","bunfig.toml"],output:[]},lint:{command:"eslint .",files:["src/**/*.ts","eslint.config.js","package.json"],output:[]},build:{dependencies:["build:js","build:tsc","build:darwin-arm64","build:darwin-x64","build:linux-x64","build:linux-arm64","build:windows-x64"]},"build:js":{command:"bun build ./src/index.ts --outdir=./dist --target=bun --format=esm --minify",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/index.js"]},"build:tsc":{command:"tsc --emitDeclarationOnly --project tsconfig.types.json",files:["src/**/*.ts","src/**/*.json","tsconfig.json","tsconfig.types.json"],output:["dist/**/*.d.ts"]},"build:darwin-arm64":{command:"bun build --compile --minify src/index.ts --target=bun-darwin-arm64 --outfile dist/cradle-macos-arm64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-macos-arm64"]},"build:darwin-x64":{command:"bun build --compile --minify src/index.ts --target=bun-darwin-x64 --outfile dist/cradle-macos-x64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-macos-x64"]},"build:linux-x64":{command:"bun build --compile --minify src/index.ts --target=bun-linux-x64 --outfile dist/cradle-linux-x64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-linux-x64"]},"build:linux-arm64":{command:"bun build --compile --minify src/index.ts --target=bun-linux-arm64 --outfile dist/cradle-linux-arm64",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-linux-arm64"]},"build:windows-x64":{command:"bun build --compile --minify src/index.ts --target=bun-windows-x64 --outfile dist/cradle-windows-x64.exe",files:["src/**/*.ts","src/**/*.json","src/**/*.txt","tsconfig.json"],output:["dist/cradle-windows-x64.exe"]},"install:local":{dependencies:["build"],command:"bash install.sh",cache:!1},"uninstall:local":{command:'rm -f "$HOME/.local/bin/cradle"',cache:!1},release:{command:"HUSKY=0 bun x semantic-release",dependencies:["ci"]}},dependencies:{yargs:"^18.1.0"},devDependencies:{"@coryrylan/tools":"1.1.1","@eslint/js":"catalog:","@eslint/json":"2.0.1","@types/bun":"catalog:","@types/yargs":"17.0.35",eslint:"catalog:","eslint-plugin-jsdoc":"64.2.1",typescript:"catalog:","typescript-eslint":"catalog:"}};import{join as _r}from"path";var Ut="agent-browser-nono-fallback.ts";function Ar(){return`// generated by cradle for sandboxed agent-browser processes \u2014 do not edit
82
82
  import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
83
83
 
84
84
  export default function configureAgentBrowserNonoEnvironment(_pi: ExtensionAPI): void {
@@ -95,18 +95,18 @@ export default function configureAgentBrowserNonoEnvironment(_pi: ExtensionAPI):
95
95
  process.env.AGENT_BROWSER_PROXY = nonoProxy;
96
96
  }
97
97
  }
98
- `}function e3(D){let u=[];if(D.systemFilePath!==null)u.push("--system-prompt",D.systemFilePath);if(D.appendSystemFilePath!==null)u.push("--append-system-prompt",D.appendSystemFilePath);return u}function D1(D){let{folder:u}=D,{settings:F}=u,C=[D.piBin,...e3(u),"--no-extensions","--no-skills","--no-prompt-templates"];if(u.providersJson!==null)C.push("-e",W2(D.extensionsDir,"providers.ts"));if(D.backend==="nono")C.push("-e",W2(D.extensionsDir,gu));for(let E of D.packageEntries??[])C.push("-e",E);for(let E of u.extensionFiles)C.push("-e",E);if(u.skillsDir!==null)C.push("--skill",u.skillsDir);if(F.defaultProvider!==void 0)C.push("--provider",F.defaultProvider);if(F.defaultModel!==void 0)C.push("--model",F.defaultModel);if(F.defaultThinkingLevel!==void 0)C.push("--thinking",F.defaultThinkingLevel);return C.push("--session-dir",D.sessionsDir),C.push(...D.passthrough),C}function _F(D){return D.backend==="nono"?{MISE_CACHE_DIR:D.miseCacheDir}:{}}function Qu(D){let u=D1(D);if(D.backend!=="nono")return u;return[D.nonoBin,"run",...D.verbose===!0?[]:["--silent"],"--profile",D.profilePath,"--",...u]}import{existsSync as u1}from"fs";import{homedir as F1}from"os";import{join as C1}from"path";function E1(D,u=F1()){let F=C1(u,".local","share","mise","shims",D);return u1(F)?F:null}var V2=(D)=>Bun.which(D)??E1(D);function NF(D,u=V2){return u(D)}function tu(D,u=V2){let F=NF(D,u);if(!F)throw Error(`Required executable "${D}" not found on PATH \u2014 install it, then run \`cradle doctor\` to verify`);return F}var B1="recommended: the supported way to install pi/nono \u2014 cradle resolves them from mise shims and the sandbox profile assumes a mise-managed install",$1="required for sandboxed runs (a folder declaring sandbox/nono.json, or --sandbox/--offline/--allow-host); not needed otherwise",z1="required for sbx-backend runs (a folder declaring sandbox/sbx.json, or --sandbox-backend sbx); not needed otherwise";async function T2(D={}){let u=(Y)=>NF(Y,D.which),F=async(Y,q)=>Y!==null&&D.readVersion?D.readVersion(Y,q):null,C=u("pi"),E=u("nono"),B=u("sbx"),$=u("mise"),[Z,M,H,V]=await Promise.all([F(C),F(E),F(B,["version"]),F($)]);return[{name:"pi",bin:"pi",required:!0,found:C,version:Z},{name:"nono",bin:"nono",required:!1,found:E,version:M,...E?{}:{note:$1}},{name:"sbx",bin:"sbx",required:!1,found:B,version:H,...B?{}:{note:z1}},{name:"mise",bin:"mise",required:!1,found:$,version:V,...$?{}:{note:B1}}]}function Z1(D){let u=D.found?`\u2713 ${D.name.padEnd(8)} ${D.version??"?"} ${D.found}`:D.required?`\u2717 ${D.name.padEnd(8)} MISSING (required)`:`\u25CB ${D.name.padEnd(8)} not found (recommended)`;return D.note?`${u}
99
- \u26A0 ${D.note}`:u}function L2(D){return D.map(Z1).join(`
100
- `)}function I2(D){return D.some((u)=>u.required&&!u.found)?1:0}import{exists as a6,mkdir as mF,rm as e6,writeFile as V8}from"fs/promises";import{homedir as D7}from"os";import{basename as u7,dirname as F7,join as ju}from"path";import{stat as j1}from"fs/promises";import{join as x2,resolve as _1}from"path";import{basename as X1,isAbsolute as M1,join as G1,relative as J1}from"path";var Wu={extends:"default",meta:{name:"cradle-pi"},groups:{include:["node_runtime","git_config","unlink_protection"]},filesystem:{read:["$HOME/.agents","$HOME/.local/share/mise","$HOME/.config/mise","$HOME/.local/state/mise","$HOME/.config/gh","/System/iOSSupport/System/Library/ExtensionKit/Extensions","/System/Library/AssetsV2/com_apple_MobileAsset_TTSAXResourceModelAssets","/System/Library/AssetsV2/com_apple_MobileAsset_UAF_Siri_TextToSpeech"],allow:["$HOME/.pi/agent"]},unsafe_macos_seatbelt_rules:['(allow user-preference-read (preference-domain "kCFPreferencesAnyApplication") (preference-domain "com.apple.speech.voice.prefs") (preference-domain "com.apple.speakselection") (preference-domain "com.apple.assistant.backedup") (preference-domain "com.apple.assistant.support") (preference-domain "com.apple.accessibility"))']};var K2="nono-profile.json";function lu(D,u){let F=J1(D,u);return F===""||!F.startsWith("..")&&!M1(F)}function j2(D,u){let F=G1(u,".local","state","nono");return lu(D,F)||lu(F,D)?D:void 0}function Vu(D,u){if(D==="~"||D==="$HOME")return u;if(D.startsWith("~/"))return`${u}${D.slice(1)}`;if(D.startsWith("$HOME/"))return`${u}${D.slice(5)}`;return D}function _2(D){let u=($)=>Vu($,D.home),F=Wu.filesystem,C=D.network!==void 0?Y1(D.network):void 0,E=[...F.unix_socket_dir_bind??[],...D.grants.unixSocketDirBind.map(u)],B={...Wu,meta:{...Wu.meta,name:`cradle-${X1(D.stateDir)}`},filesystem:{...F,read:[...F.read??[],D.agentDir,...D.grants.read.map(u)],write:[...F.write??[],...D.grants.write.map(u)],allow:[...F.allow??[],D.cwd,D.stateDir,...D.linkedGitDir!==void 0?[D.linkedGitDir]:[],...D.grants.allow.map(u)],...E.length>0?{unix_socket_dir_bind:E}:{}},unsafe_macos_seatbelt_rules:[...Wu.unsafe_macos_seatbelt_rules,...D.rules],...C!==void 0?{network:C}:{}};return JSON.stringify(B,null,2)}function Y1(D){return{...D.block!==void 0?{block:D.block}:{},...D.networkProfile!==void 0?{network_profile:D.networkProfile}:{},...D.allowDomain!==void 0?{allow_domain:D.allowDomain}:{},...D.openPort!==void 0?{open_port:D.openPort}:{},...D.listenPort!==void 0?{listen_port:D.listenPort}:{}}}import{chmod as N2,lstat as q1,mkdir as H1,readdir as R2,readFile as O1,rm as U1,writeFile as W1}from"fs/promises";import{dirname as V1,join as ou,relative as T1}from"path";function ZD(D){return typeof D==="object"&&D!==null&&!Array.isArray(D)}function Xu(D,u){try{return JSON.parse(D)}catch(F){throw Error(`${u} is not valid JSON: ${Fu(F)}`,{cause:F})}}function Fu(D){return D instanceof Error?D.message:String(D)}function XD(D,u){return typeof D==="object"&&D!==null&&"code"in D&&D.code===u}function Mu(D){if(/^[A-Za-z0-9_./:@%+=,-]+$/u.test(D))return D;return`'${D.replaceAll("'","'\\''")}'`}function cD(D){return Array.isArray(D)&&D.every((u)=>typeof u==="string")}function Tu(D){return/^(?:\/|~(?:\/|$)|\$HOME(?:\/|$)|[A-Za-z]:[\\/]|\\\\)/.test(D)}function RD(D,u,F,C){let E=Object.keys(D).filter((B)=>!F.includes(B));if(E.length>0)C.push(`${u}: unsupported keys ignored: ${E.join(", ")}`)}function iu(D,u,F,C){D.results.push({name:u,detail:F,status:C})}function L1(D,u,F){D.failures.push(`${u}: ${F}`),iu(D,u,F,"failed")}async function f2(D,u,F,C){try{if(await K1(F,C)){iu(D,u,F,"unchanged");return}if(D.dryRun){iu(D,u,`would replace ${F}`,"changed");return}await S2(F),await U1(F,{force:!0,recursive:!0});for(let E of C)await I1(F,E);iu(D,u,F,"changed")}catch(E){L1(D,u,Fu(E))}}async function I1(D,u){let F=ou(D,u.rel);if(await H1(V1(F),{recursive:!0}),await W1(F,u.content,"utf8"),u.mode!==void 0)await N2(F,u.mode)}async function K1(D,u){let F=await A2(D);if(F.length!==u.length)return!1;let C=new Set(F);for(let E of u){if(!C.has(E.rel))return!1;if(await SD(ou(D,E.rel))!==E.content)return!1}return!0}async function A2(D,u=D){let F=await P2(D);if(!F||!F.isDirectory())return[];let C=[];for(let E of await R2(D,{withFileTypes:!0})){let B=ou(D,E.name);if(E.isDirectory())C.push(...await A2(B,u));else C.push(T1(u,B))}return C}async function S2(D){let u=await P2(D);if(!u||u.isSymbolicLink())return;if(await N2(D,u.isDirectory()?493:420),!u.isDirectory())return;let F=await R2(D);await Promise.all(F.map((C)=>S2(ou(D,C))))}async function SD(D){try{return await O1(D,"utf8")}catch(u){if(XD(u,"ENOENT"))return;throw u}}async function P2(D){try{return await q1(D)}catch(u){if(XD(u,"ENOENT"))return;throw u}}var N1=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;async function h2(D,u){if(!R1(D))return{dir:D,warnings:[]};let F=x2(u.home,".cradle","settings.json"),C=[],E=await f1(F,C),B=x2(u.cwd,D),$=E.get(D);if($!==void 0){let Z=_1(Vu($,u.home));if(await b2(B))C.push(P1(D,Z));return{dir:Z,warnings:C}}if(await b2(B))return{dir:B,warnings:C};throw Error(x1(D,B,F,E))}function R1(D){return N1.test(D)}async function b2(D){try{return(await j1(D)).isDirectory()}catch(u){if(XD(u,"ENOENT")||XD(u,"ENOTDIR"))return!1;throw u}}async function f1(D,u){let F=await SD(D);if(F===void 0)return new Map;let C=Xu(F,D);if(!ZD(C))return u.push(`${D}: settings must be a JSON object \u2014 ignored`),new Map;return RD(C,D,["agents"],u),A1(C,D,u)}function A1(D,u,F){let C=D.agents;if(C===void 0)return new Map;if(!ZD(C))return F.push(`${u}: agents must be an object \u2014 ignored`),new Map;let E=Object.entries(C).map((B)=>{let[$,Z]=B,M=S1(Z,$,u,F);return M===void 0?void 0:[$,M]}).filter((B)=>B!==void 0);return new Map(E)}function S1(D,u,F,C){if(!ZD(D)){C.push(`${F}: agents.${u} must be an object with a "path" \u2014 ignored`);return}let E=D.path;if(typeof E!=="string"||E.trim()===""){C.push(`${F}: agents.${u}.path must be a non-empty string \u2014 ignored`);return}if(!Tu(E)){C.push(`${F}: agents.${u}.path must be an absolute, ~/, or $HOME/ path \u2014 ignored: ${E}`);return}return E}function P1(D,u){return`started alias "${D}" (${u}) \u2014 a directory named ${D} exists in the current directory; use ./${D} to run it instead`}function x1(D,u,F,C){let E=C.size>0?` (known agents: ${[...C.keys()].join(", ")})`:"";return`Agent folder not found: ${u} \u2014 and no "agents.${D}" entry in ${F}${E}`}import{createHash as b1}from"crypto";import{join as h1}from"path";var m2="host.docker.internal",w2="@earendil-works/pi-coding-agent",w1=/^\d+\.\d+\.\d+\.\d+$/,m1=new Set(["localhost","127.0.0.1"]);function v2(D){let u=(C)=>Vu(C,D.home),F=[{path:D.cwd,readonly:!1},{path:D.agentDir,readonly:!0},{path:D.stateDir,readonly:!1},{path:h1(D.home,".pi","agent"),readonly:!1},...D.linkedGitDir!==void 0?[{path:D.linkedGitDir,readonly:!1}]:[],...D.grants.read.map((C)=>({path:u(C),readonly:!0})),...D.grants.write.map((C)=>({path:u(C),readonly:!1})),...D.grants.allow.map((C)=>({path:u(C),readonly:!1}))];return v1(F)}function v1(D){let u=[],F=new Map;for(let C of D){if(!F.has(C.path))u.push(C.path);if(F.get(C.path)!==!1)F.set(C.path,C.readonly)}return u.map((C)=>({path:C,readonly:F.get(C)===!0}))}function c2(D,u){let F=u.map((E)=>`${E.path}:${E.readonly?"ro":"rw"}`).sort().join("|"),C=b1("sha256").update(F).digest("hex").slice(0,8);return`cradle-${D}-${C}`}function d2(D){let u=D.mounts.map((F)=>F.readonly?`${F.path}:ro`:F.path);return[D.sbxBin,"create","shell",...u,"--name",D.name,"-q"]}function c1(D){let u=[],F=!1;for(let C of D)if(m1.has(C))F=!0;else if(w1.test(C))u.push(C);else u.push(C,`*.${C}`);if(F)u.push(m2);return u}function k2(D){let{network:u,sbxBin:F,name:C}=D;if(u===void 0)return[];if(u.block===!0)return[[F,"policy","deny","network","--sandbox",C,"**"]];let E=c1(u.allowDomain??[]);return E.length>0?[[F,"policy","allow","network","--sandbox",C,E.join(",")]]:[]}function d1(D){return D.networkProfile!==void 0?"network_profile is nono-only \u2014 ignored under the sbx backend":void 0}function k1(D){return(D.openPort?.length??0)>0||(D.listenPort?.length??0)>0?"open_port/listen_port are nono-only \u2014 guest-local ports are unrestricted and host services are reachable via host.docker.internal under sbx":void 0}function p1(D){return D.block!==!0&&(D.allowDomain?.length??0)>0?"sbx allow rules add to your global sbx policy but cannot subtract from it \u2014 run `sbx policy init deny-all` for strict allowlist semantics (nono enforces the allowlist exactly)":void 0}function p2(D){if(D===void 0)return[];return[d1(D),k1(D),p1(D)].filter((u)=>u!==void 0)}function y2(D){return D.unixSocketDirBind.length>0?["unix_socket_dir_bind is nono-only \u2014 Unix sockets cannot cross the sbx VM boundary; grant ignored"]:[]}function RF(D){let u=D.piVersion===null?`command -v pi >/dev/null 2>&1 || npm i -g ${w2}`:`command -v pi >/dev/null 2>&1 && [ "$(pi --version 2>/dev/null)" = "${D.piVersion}" ] || npm i -g ${w2}@${D.piVersion}`;return[D.sbxBin,"exec",D.name,"bash","-lc",u]}function nu(D,u){return[D.sbxBin,"exec","-i",...D.tty?["-t"]:[],"-e",`HOME=${D.home}`,"-w",D.cwd,D.name,...u]}function g2(D){return D.toLowerCase().includes("already exists")}function t2(D){let u;try{u=new URL(D)}catch{return D}if(u.hostname!=="localhost"&&u.hostname!=="127.0.0.1")return D;return u.hostname=m2,u.toString()}function l2(D,u={}){return`// generated by cradle from the agent folder's models.json \u2014 do not edit
98
+ `}function bu(e){let t=[];if(e.systemFilePath!==null)t.push("--system-prompt",e.systemFilePath);if(e.appendSystemFilePath!==null)t.push("--append-system-prompt",e.appendSystemFilePath);return t}function Eu(e){let{folder:t}=e,{settings:n}=t,i=[e.piBin,...bu(t),"--no-extensions","--no-skills","--no-prompt-templates"];if(t.providersJson!==null)i.push("-e",_r(e.extensionsDir,"providers.ts"));if(e.backend==="nono")i.push("-e",_r(e.extensionsDir,Ut));for(let r of e.packageEntries??[])i.push("-e",r);for(let r of t.extensionFiles)i.push("-e",r);if(t.skillsDir!==null)i.push("--skill",t.skillsDir);if(n.defaultProvider!==void 0)i.push("--provider",n.defaultProvider);if(n.defaultModel!==void 0)i.push("--model",n.defaultModel);if(n.defaultThinkingLevel!==void 0)i.push("--thinking",n.defaultThinkingLevel);return i.push("--session-dir",e.sessionsDir),i.push(...e.passthrough),i}function On(e){return e.backend==="nono"?{MISE_CACHE_DIR:e.miseCacheDir}:{}}function ft(e){let t=Eu(e);if(e.backend!=="nono")return t;return[e.nonoBin,"run",...e.verbose===!0?[]:["--silent"],"--profile",e.profilePath,"--",...t]}import{existsSync as yu}from"fs";import{homedir as Cu}from"os";import{join as xu}from"path";function wu(e,t=Cu()){let n=xu(t,".local","share","mise","shims",e);return yu(n)?n:null}var Sr=(e)=>Bun.which(e)??wu(e);function jn(e,t=Sr){return t(e)}function Yt(e,t=Sr){let n=jn(e,t);if(!n)throw Error(`Required executable "${e}" not found on PATH \u2014 install it, then run \`cradle doctor\` to verify`);return n}var Au="recommended: the supported way to install pi/nono \u2014 cradle resolves them from mise shims and the sandbox profile assumes a mise-managed install",_u="required for sandboxed runs (a folder declaring sandbox/nono.json, or --sandbox/--offline/--allow-host); not needed otherwise",Su="required for sbx-backend runs (a folder declaring sandbox/sbx.json, or --sandbox-backend sbx); not needed otherwise";async function Br(e={}){let t=(h)=>jn(h,e.which),n=async(h,p)=>h!==null&&e.readVersion?e.readVersion(h,p):null,i=t("pi"),r=t("nono"),s=t("sbx"),o=t("mise"),[a,c,g,E]=await Promise.all([n(i),n(r),n(s,["version"]),n(o)]);return[{name:"pi",bin:"pi",required:!0,found:i,version:a},{name:"nono",bin:"nono",required:!1,found:r,version:c,...r?{}:{note:_u}},{name:"sbx",bin:"sbx",required:!1,found:s,version:g,...s?{}:{note:Su}},{name:"mise",bin:"mise",required:!1,found:o,version:E,...o?{}:{note:Au}}]}function Bu(e){let t=e.found?`\u2713 ${e.name.padEnd(8)} ${e.version??"?"} ${e.found}`:e.required?`\u2717 ${e.name.padEnd(8)} MISSING (required)`:`\u25CB ${e.name.padEnd(8)} not found (recommended)`;return e.note?`${t}
99
+ \u26A0 ${e.note}`:t}function Pr(e){return e.map(Bu).join(`
100
+ `)}function Or(e){return e.some((t)=>t.required&&!t.found)?1:0}import{exists as Fl,mkdir as Ln,rm as bl,writeFile as Ss}from"fs/promises";import{homedir as El}from"os";import{basename as yl,dirname as Cl,join as St}from"path";import{stat as zu}from"fs/promises";import{join as Wr,resolve as Uu}from"path";import{basename as Ou,isAbsolute as ju,join as vu,relative as $u}from"path";var yt={extends:"default",meta:{name:"cradle-pi"},groups:{include:["node_runtime","git_config","unlink_protection"]},filesystem:{read:["$HOME/.agents","$HOME/.local/share/mise","$HOME/.config/mise","$HOME/.local/state/mise","$HOME/.config/gh","/System/iOSSupport/System/Library/ExtensionKit/Extensions","/System/Library/AssetsV2/com_apple_MobileAsset_TTSAXResourceModelAssets","/System/Library/AssetsV2/com_apple_MobileAsset_UAF_Siri_TextToSpeech"],allow:["$HOME/.pi/agent"]},unsafe_macos_seatbelt_rules:['(allow user-preference-read (preference-domain "kCFPreferencesAnyApplication") (preference-domain "com.apple.speech.voice.prefs") (preference-domain "com.apple.speakselection") (preference-domain "com.apple.assistant.backedup") (preference-domain "com.apple.assistant.support") (preference-domain "com.apple.accessibility"))']};var jr="nono-profile.json";function Jt(e,t){let n=$u(e,t);return n===""||!n.startsWith("..")&&!ju(n)}function vr(e,t){let n=vu(t,".local","state","nono");return Jt(e,n)||Jt(n,e)?e:void 0}function Ct(e,t){if(e==="~"||e==="$HOME")return t;if(e.startsWith("~/"))return`${t}${e.slice(1)}`;if(e.startsWith("$HOME/"))return`${t}${e.slice(5)}`;return e}function $r(e){let t=(o)=>Ct(o,e.home),n=yt.filesystem,i=e.network!==void 0?ku(e.network):void 0,r=[...n.unix_socket_dir_bind??[],...e.grants.unixSocketDirBind.map(t)],s={...yt,meta:{...yt.meta,name:`cradle-${Ou(e.stateDir)}`},filesystem:{...n,read:[...n.read??[],e.agentDir,...e.grants.read.map(t)],write:[...n.write??[],...e.grants.write.map(t)],allow:[...n.allow??[],e.cwd,e.stateDir,...e.linkedGitDir!==void 0?[e.linkedGitDir]:[],...e.grants.allow.map(t)],...r.length>0?{unix_socket_dir_bind:r}:{}},unsafe_macos_seatbelt_rules:[...yt.unsafe_macos_seatbelt_rules,...e.rules],...i!==void 0?{network:i}:{}};return JSON.stringify(s,null,2)}function ku(e){return{...e.block!==void 0?{block:e.block}:{},...e.networkProfile!==void 0?{network_profile:e.networkProfile}:{},...e.allowDomain!==void 0?{allow_domain:e.allowDomain}:{},...e.openPort!==void 0?{open_port:e.openPort}:{},...e.listenPort!==void 0?{listen_port:e.listenPort}:{}}}import{chmod as kr,lstat as Mu,mkdir as Nu,readdir as Mr,readFile as Iu,rm as Ru,writeFile as Tu}from"fs/promises";import{dirname as Wu,join as qt,relative as Lu}from"path";function le(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function dt(e,t){try{return JSON.parse(e)}catch(n){throw Error(`${t} is not valid JSON: ${rt(n)}`,{cause:n})}}function rt(e){return e instanceof Error?e.message:String(e)}function fe(e,t){return typeof e==="object"&&e!==null&&"code"in e&&e.code===t}function Dt(e){if(/^[A-Za-z0-9_./:@%+=,-]+$/u.test(e))return e;return`'${e.replaceAll("'","'\\''")}'`}function Le(e){return Array.isArray(e)&&e.every((t)=>typeof t==="string")}function xt(e){return/^(?:\/|~(?:\/|$)|\$HOME(?:\/|$)|[A-Za-z]:[\\/]|\\\\)/.test(e)}function Be(e,t,n,i){let r=Object.keys(e).filter((s)=>!n.includes(s));if(r.length>0)i.push(`${t}: unsupported keys ignored: ${r.join(", ")}`)}function Kt(e,t,n,i){e.results.push({name:t,detail:n,status:i})}function Gu(e,t,n){e.failures.push(`${t}: ${n}`),Kt(e,t,n,"failed")}async function Nr(e,t,n,i){try{if(await Hu(n,i)){Kt(e,t,n,"unchanged");return}if(e.dryRun){Kt(e,t,`would replace ${n}`,"changed");return}await Rr(n),await Ru(n,{force:!0,recursive:!0});for(let r of i)await Vu(n,r);Kt(e,t,n,"changed")}catch(r){Gu(e,t,rt(r))}}async function Vu(e,t){let n=qt(e,t.rel);if(await Nu(Wu(n),{recursive:!0}),await Tu(n,t.content,"utf8"),t.mode!==void 0)await kr(n,t.mode)}async function Hu(e,t){let n=await Ir(e);if(n.length!==t.length)return!1;let i=new Set(n);for(let r of t){if(!i.has(r.rel))return!1;if(await $e(qt(e,r.rel))!==r.content)return!1}return!0}async function Ir(e,t=e){let n=await Tr(e);if(!n||!n.isDirectory())return[];let i=[];for(let r of await Mr(e,{withFileTypes:!0})){let s=qt(e,r.name);if(r.isDirectory())i.push(...await Ir(s,t));else i.push(Lu(t,s))}return i}async function Rr(e){let t=await Tr(e);if(!t||t.isSymbolicLink())return;if(await kr(e,t.isDirectory()?493:420),!t.isDirectory())return;let n=await Mr(e);await Promise.all(n.map((i)=>Rr(qt(e,i))))}async function $e(e){try{return await Iu(e,"utf8")}catch(t){if(fe(t,"ENOENT"))return;throw t}}async function Tr(e){try{return await Mu(e)}catch(t){if(fe(t,"ENOENT"))return;throw t}}var Yu=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;async function Gr(e,t){if(!Ju(e))return{dir:e,warnings:[]};let n=Wr(t.home,".cradle","settings.json"),i=[],r=await Ku(n,i),s=Wr(t.cwd,e),o=r.get(e);if(o!==void 0){let a=Uu(Ct(o,t.home));if(await Lr(s))i.push(Zu(e,a));return{dir:a,warnings:i}}if(await Lr(s))return{dir:s,warnings:i};throw Error(Qu(e,s,n,r))}function Ju(e){return Yu.test(e)}async function Lr(e){try{return(await zu(e)).isDirectory()}catch(t){if(fe(t,"ENOENT")||fe(t,"ENOTDIR"))return!1;throw t}}async function Ku(e,t){let n=await $e(e);if(n===void 0)return new Map;let i=dt(n,e);if(!le(i))return t.push(`${e}: settings must be a JSON object \u2014 ignored`),new Map;return Be(i,e,["agents"],t),qu(i,e,t)}function qu(e,t,n){let i=e.agents;if(i===void 0)return new Map;if(!le(i))return n.push(`${t}: agents must be an object \u2014 ignored`),new Map;let r=Object.entries(i).map((s)=>{let[o,a]=s,c=Xu(a,o,t,n);return c===void 0?void 0:[o,c]}).filter((s)=>s!==void 0);return new Map(r)}function Xu(e,t,n,i){if(!le(e)){i.push(`${n}: agents.${t} must be an object with a "path" \u2014 ignored`);return}let r=e.path;if(typeof r!=="string"||r.trim()===""){i.push(`${n}: agents.${t}.path must be a non-empty string \u2014 ignored`);return}if(!xt(r)){i.push(`${n}: agents.${t}.path must be an absolute, ~/, or $HOME/ path \u2014 ignored: ${r}`);return}return r}function Zu(e,t){return`started alias "${e}" (${t}) \u2014 a directory named ${e} exists in the current directory; use ./${e} to run it instead`}function Qu(e,t,n,i){let r=i.size>0?` (known agents: ${[...i.keys()].join(", ")})`:"";return`Agent folder not found: ${t} \u2014 and no "agents.${e}" entry in ${n}${r}`}import{createHash as ea}from"crypto";import{join as ta}from"path";var Hr="host.docker.internal",Vr="@earendil-works/pi-coding-agent",na=/^\d+\.\d+\.\d+\.\d+$/,ia=new Set(["localhost","127.0.0.1"]);function zr(e){let t=(i)=>Ct(i,e.home),n=[{path:e.cwd,readonly:!1},{path:e.agentDir,readonly:!0},{path:e.stateDir,readonly:!1},{path:ta(e.home,".pi","agent"),readonly:!1},...e.linkedGitDir!==void 0?[{path:e.linkedGitDir,readonly:!1}]:[],...e.grants.read.map((i)=>({path:t(i),readonly:!0})),...e.grants.write.map((i)=>({path:t(i),readonly:!1})),...e.grants.allow.map((i)=>({path:t(i),readonly:!1}))];return ra(n)}function ra(e){let t=[],n=new Map;for(let i of e){if(!n.has(i.path))t.push(i.path);if(n.get(i.path)!==!1)n.set(i.path,i.readonly)}return t.map((i)=>({path:i,readonly:n.get(i)===!0}))}function Ur(e,t){let n=t.map((r)=>`${r.path}:${r.readonly?"ro":"rw"}`).sort().join("|"),i=ea("sha256").update(n).digest("hex").slice(0,8);return`cradle-${e}-${i}`}function Yr(e){let t=e.mounts.map((n)=>n.readonly?`${n.path}:ro`:n.path);return[e.sbxBin,"create","shell",...t,"--name",e.name,"-q"]}function sa(e){let t=[],n=!1;for(let i of e)if(ia.has(i))n=!0;else if(na.test(i))t.push(i);else t.push(i,`*.${i}`);if(n)t.push(Hr);return t}function Jr(e){let{network:t,sbxBin:n,name:i}=e;if(t===void 0)return[];if(t.block===!0)return[[n,"policy","deny","network","--sandbox",i,"**"]];let r=sa(t.allowDomain??[]);return r.length>0?[[n,"policy","allow","network","--sandbox",i,r.join(",")]]:[]}function oa(e){return e.networkProfile!==void 0?"network_profile is nono-only \u2014 ignored under the sbx backend":void 0}function ua(e){return(e.openPort?.length??0)>0||(e.listenPort?.length??0)>0?"open_port/listen_port are nono-only \u2014 guest-local ports are unrestricted and host services are reachable via host.docker.internal under sbx":void 0}function aa(e){return e.block!==!0&&(e.allowDomain?.length??0)>0?"sbx allow rules add to your global sbx policy but cannot subtract from it \u2014 run `sbx policy init deny-all` for strict allowlist semantics (nono enforces the allowlist exactly)":void 0}function Kr(e){if(e===void 0)return[];return[oa(e),ua(e),aa(e)].filter((t)=>t!==void 0)}function qr(e){return e.unixSocketDirBind.length>0?["unix_socket_dir_bind is nono-only \u2014 Unix sockets cannot cross the sbx VM boundary; grant ignored"]:[]}function vn(e){let t=e.piVersion===null?`command -v pi >/dev/null 2>&1 || npm i -g ${Vr}`:`command -v pi >/dev/null 2>&1 && [ "$(pi --version 2>/dev/null)" = "${e.piVersion}" ] || npm i -g ${Vr}@${e.piVersion}`;return[e.sbxBin,"exec",e.name,"bash","-lc",t]}function Xt(e,t){return[e.sbxBin,"exec","-i",...e.tty?["-t"]:[],"-e",`HOME=${e.home}`,"-w",e.cwd,e.name,...t]}function Xr(e){return e.toLowerCase().includes("already exists")}function Zr(e){let t;try{t=new URL(e)}catch{return e}if(t.hostname!=="localhost"&&t.hostname!=="127.0.0.1")return e;return t.hostname=Hr,t.toString()}function Qr(e,t={}){return`// generated by cradle from the agent folder's models.json \u2014 do not edit
101
101
  import type { ExtensionAPI } from '@earendil-works/pi-coding-agent';
102
102
 
103
- const providers = ${u.rewriteLocalhostBaseUrls===!0?y1(D):D} as const;
103
+ const providers = ${t.rewriteLocalhostBaseUrls===!0?la(e):e} as const;
104
104
 
105
105
  export default function (pi: ExtensionAPI): void {
106
106
  for (const [name, config] of Object.entries(providers)) {
107
107
  pi.registerProvider(name, config as never);
108
108
  }
109
109
  }
110
- `}function y1(D){let u=JSON.parse(D);for(let F of Object.values(u)){if(F===null||typeof F!=="object")continue;let C=F;if(typeof C.baseUrl==="string")C.baseUrl=t2(C.baseUrl)}return JSON.stringify(u,null,2)}import{lstat as V6,readdir as Q8,stat as T6}from"fs/promises";import{join as KD,resolve as L6}from"path";import{readdir as l1,stat as i1}from"fs/promises";import{join as dD,resolve as s2,sep as r2}from"path";import{basename as g1,relative as o2,sep as i2}from"path";function Lu(D){return D.startsWith("!")||D.startsWith("+")||D.startsWith("-")}function PF(D,u,F){let C=u.filter((Z)=>!Lu(Z)),E=fF(u,"!"),B=fF(u,"+"),$=fF(u,"-");return D.filter((Z)=>{if(SF(Z,$,F))return!1;if(SF(Z,B,F))return!0;if(AF(Z,E,F))return!1;return C.length===0||AF(Z,C,F)})}function n2(D,u,F){return D.filter((C)=>{let E=u.filter((B)=>t1(C,B,F)).at(-1);return E!==void 0&&!E.startsWith("-")&&!E.startsWith("!")})}function t1(D,u,F){let C=Lu(u)?u.slice(1):u;return u.startsWith("+")||u.startsWith("-")?SF(D,[C],F):AF(D,[C],F)}function fF(D,u){return D.filter((F)=>F.startsWith(u)).map((F)=>F.slice(1))}function AF(D,u,F){let C=[Gu(o2(F,D)),g1(D),Gu(D)];return u.some((E)=>{let B=new Bun.Glob(Gu(E));return C.some(($)=>B.match($))})}function SF(D,u,F){let C=Gu(o2(F,D)),E=Gu(D);return u.some((B)=>{let $=Gu(B.startsWith("./")?B.slice(2):B);return $===C||$===E})}function Gu(D){return i2==="/"?D:D.split(i2).join("/")}var o1=/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,n1=/^[0-9A-Za-z.^~><=* +-]+$/,s1=/\.[tj]s$/,r1=/[*?]/;function e2(D,u,F){let C=D.packages;if(C===void 0)return[];if(!Array.isArray(C))return F.push(`${u}: packages must be an array \u2014 ignored`),[];let E=a1(C,u,F),B=C6(E,u,F);return E6(B,u,F)}function a1(D,u,F){let C=[],E=[];for(let B of D){let $=typeof B==="string"?{source:B}:e1(B,u,F);if($===null)E.push(JSON.stringify(B));else C.push($)}if(E.length>0)F.push(`${u}: packages entries must be a source string or a { "source": \u2026 } object \u2014 ignored: ${E.join(", ")}`);return C}function e1(D,u,F){if(!ZD(D))return null;let C=D.source;if(typeof C!=="string")return null;F6(D,C,u,F);let E=D.autoload;if(E!==void 0&&typeof E!=="boolean")F.push(`${u}: packages entry ${C}: autoload must be a boolean \u2014 ignored`);let B=D6(D,C,u,F);return{source:C,...B!==void 0?{extensions:B}:{},...E===!1?{autoloadDisabled:!0}:{}}}function D6(D,u,F,C){let E=D.extensions;if(E===void 0)return;if(!cD(E)){C.push(`${F}: packages entry ${u}: extensions must be an array of strings \u2014 ignored`);return}return E}var u6=new Set(["source","extensions","autoload"]),a2=new Set(["skills","prompts","themes"]);function F6(D,u,F,C){let E=Object.keys(D).filter((Z)=>!u6.has(Z)),B=E.filter((Z)=>a2.has(Z)),$=E.filter((Z)=>!a2.has(Z));if(B.length>0)C.push(`${F}: packages entry ${u}: cradle loads a package's extensions and nothing else \u2014 ignored: ${B.join(", ")}`);if($.length>0)C.push(`${F}: packages entry ${u}: unknown filter keys \u2014 ignored: ${$.join(", ")}`)}function C6(D,u,F){let C=D.filter((B)=>B.source.startsWith("npm:")),E=D.filter((B)=>!B.source.startsWith("npm:"));if(E.length>0){let B=E.map(($)=>$.source).join(", ");F.push(`${u}: only npm: package sources are supported \u2014 ignored: ${B}`)}return C}function E6(D,u,F){let C=[],E=[];for(let{source:B,...$}of D){let Z=B6(B.slice(4));if(Z===null)E.push(B);else C.push({...Z,...$})}if(E.length>0)F.push(`${u}: packages entries must be npm:<name>[@<version>] \u2014 ignored: ${E.join(", ")}`);return C}function B6(D){let u=D.lastIndexOf("@"),F=u>0,C=F?D.slice(0,u):D,E=F?D.slice(u+1):"latest";if(!o1.test(C)||!n1.test(E))return null;return{name:C,version:E}}function D8(D){let u=Object.fromEntries([...D].sort((F,C)=>F.name.localeCompare(C.name)).map((F)=>[F.name,F.version]));return`${JSON.stringify({name:"cradle-agent-packages",private:!0,dependencies:u},null,2)}
111
- `}async function u8(D,u){let F=await Promise.all(u.map(async(C)=>{let E=[];return{entries:await $6(D,C,E),warnings:E}}));return{entries:F.flatMap((C)=>C.entries),warnings:F.flatMap((C)=>C.warnings)}}async function $6(D,u,F){let C=dD(D,"node_modules",u.name),E=await z6(u.name,C,F);if(E===null)return[];let B=await Z6(C,E,u.name,F);return H6(B,u,C)}async function z6(D,u,F){let C=dD(u,"package.json"),E=await SD(C);if(E===void 0)return F.push(`package ${D} is not installed \u2014 skipped`),null;try{let B=Xu(E,C);if(!ZD(B))return F.push(`package ${D}: ${C} must be a JSON object \u2014 skipped`),null;return B}catch(B){return F.push(`package ${D}: ${Fu(B)} \u2014 skipped`),null}}async function Z6(D,u,F,C){let E=Q6(u);if(E!==void 0)return X6(D,E,F,C);let B=await F8(dD(D,"extensions"));if(B.length>0)return B;return q6(F,D,C)}function Q6(D){let u=D.pi;if(u===void 0||!ZD(u))return;let F=u.extensions;if(F===void 0||!cD(F)||F.length===0)return;return F}async function X6(D,u,F,C){let E=u.filter((M)=>!Lu(M)),$=(await Promise.all(E.map((M)=>M6(D,M,F,C)))).flat(),Z=u.filter(Lu);return Z.length>0?PF($,Z,D):$}async function M6(D,u,F,C){let E=await G6(D,u),B=E.filter((Z)=>O6(D,Z));if(B.length<E.length)C.push(`package ${F}: extension entry "${u}" escapes the package directory \u2014 skipped`);let $=await Promise.all(B.map(async(Z)=>({files:await J6(Z)})));if($.some((Z)=>Z.files===null))C.push(`package ${F}: extension entry "${u}" not found \u2014 skipped`);return $.flatMap((Z)=>Z.files??[])}async function G6(D,u){if(!r1.test(u))return[s2(D,u)];let F=new Bun.Glob(u).scan({cwd:D,absolute:!0,onlyFiles:!1});return(await Array.fromAsync(F)).map((C)=>s2(C)).sort()}async function J6(D){let u=await U6(D);if(u===void 0)return null;return u.isDirectory()?F8(D):[D]}async function F8(D){let F=[...await W6(D)].sort((E,B)=>E.name.localeCompare(B.name));return(await Promise.all(F.map((E)=>Y6(D,E)))).flat()}async function Y6(D,u){if(u.name.startsWith(".")||u.name==="node_modules")return[];if(u.isFile())return s1.test(u.name)?[dD(D,u.name)]:[];if(!u.isDirectory())return[];let F=await C8([dD(D,u.name,"index.ts"),dD(D,u.name,"index.js")]);return F===null?[]:[F]}async function q6(D,u,F){let C=await C8([dD(u,"index.ts"),dD(u,"index.js")]);if(C===null)return F.push(`package ${D} declares no pi extensions \u2014 skipped`),[];return[C]}function H6(D,u,F){if(u.autoloadDisabled===!0)return n2(D,u.extensions??[],F);if(u.extensions===void 0)return[...D];if(u.extensions.length===0)return[];return PF(D,u.extensions,F)}function O6(D,u){let F=D.endsWith(r2)?D:`${D}${r2}`;return u===D||u.startsWith(F)}async function C8(D){return(await Promise.all(D.map(async(F)=>await Bun.file(F).exists()?F:null))).find((F)=>F!==null)??null}async function U6(D){try{return await i1(D)}catch(u){if(XD(u,"ENOENT")||XD(u,"ENOTDIR"))return;throw u}}async function W6(D){try{return await l1(D,{withFileTypes:!0})}catch(u){if(XD(u,"ENOENT")||XD(u,"ENOTDIR"))return[];throw u}}var E8=["off","minimal","low","medium","high","xhigh"],B8=new Set(["schedules","subagents","channels","connections"]),I6=new Set(["SYSTEM.md","APPEND_SYSTEM.md","settings.json","models.json","skills","extensions","sandbox"]),K6=new Set([".git",".gitignore",".DS_Store","README.md","LICENSE"]),Iu={read:[],write:[],allow:[],unixSocketDirBind:[]},su={posture:"unconfigured",filesystem:Iu,unsafeMacosSeatbeltRules:[]};async function X8(D){let u=L6(D),F=await j6(u),C=new Map(F.map((M)=>[M.name,M])),E=C.has("SYSTEM.md"),B=C.has("APPEND_SYSTEM.md");if(!E&&!B){let M=C.has("AGENTS.md")?" \u2014 found AGENTS.md, rename it to APPEND_SYSTEM.md":"";throw Error(`Not an agent folder: ${u} (needs SYSTEM.md or APPEND_SYSTEM.md${M} \u2014 see ARCHITECTURE.md)`)}let $=[];_6(F,$);let Z=await h6(u,C.get("sandbox"),$);return{dir:u,systemFilePath:E?KD(u,"SYSTEM.md"):null,appendSystemFilePath:B?KD(u,"APPEND_SYSTEM.md"):null,settings:await N6(u,C.has("settings.json"),$),providersJson:await S6(u,C.has("models.json"),$),skillsDir:await x6(u,C.get("skills"),$),extensionFiles:await b6(u,C.get("extensions"),$),sandbox:Z.nono,sbx:Z.sbx,warnings:$}}async function j6(D){try{return await Q8(D,{withFileTypes:!0})}catch(u){if(XD(u,"ENOENT")||XD(u,"ENOTDIR"))throw Error(`Agent folder not found: ${D}`,{cause:u});throw u}}async function bF(D,u){if(u.isDirectory())return!0;if(!u.isSymbolicLink())return!1;try{return(await T6(KD(D,u.name))).isDirectory()}catch(F){if(XD(F,"ENOENT"))return!1;throw F}}function _6(D,u){let F=D.filter((E)=>B8.has(E.name)).map((E)=>E.name),C=D.map((E)=>E.name).filter((E)=>!I6.has(E)&&!B8.has(E)&&!K6.has(E));if(F.length>0)u.push(`reserved for a future cradle release, ignored: ${F.join(", ")}`);if(C.length>0)u.push(`not part of the agent folder format, ignored: ${C.join(", ")}`)}async function N6(D,u,F){if(!u)return{};let C=KD(D,"settings.json"),E=await wF(C);f6(E,C,F);let B=xF(E,"defaultProvider",C,F),$=xF(E,"defaultModel",C,F),Z=l6(E,C,F),M=e2(E,C,F),H=A6(E,C,F);return{...B!==void 0?{defaultProvider:B}:{},...$!==void 0?{defaultModel:$}:{},...Z!==void 0?{defaultThinkingLevel:Z}:{},...M.length>0?{packages:M}:{},...H!==void 0?{npmCommand:H}:{}}}var R6=new Set(["defaultProvider","defaultModel","defaultThinkingLevel","packages","npmCommand"]);function f6(D,u,F){let C=Object.keys(D).filter((E)=>!R6.has(E));if(C.length>0)F.push(`${u}: keys cradle does not map are ignored \u2014 pi reads them from ~/.pi/agent/settings.json or `+`the project's .pi/settings.json, not the agent folder: ${C.join(", ")}`)}var $8=new Set(["npm","pnpm","yarn","bun"]);function A6(D,u,F){let C=D.npmCommand;if(C===void 0)return;let[E,...B]=cD(C)?C:[];if(E===void 0||B.length>0||!$8.has(E)){let $=[...$8].join(", ");F.push(`${u}: npmCommand must be a single-element array naming one of ${$} \u2014 ignored`);return}return[E]}async function S6(D,u,F){if(!u)return null;let C=KD(D,"models.json"),E=await wF(C),B=E.providers;if(B===void 0||!ZD(B))throw Error(`${C} must contain a "providers" object`);return RD(E,C,["providers"],F),JSON.stringify(P6(B),null,2)}function P6(D){let u={input:0,output:0,cacheRead:0,cacheWrite:0};return Object.fromEntries(Object.entries(D).map(([F,C])=>{if(!ZD(C)||!Array.isArray(C.models))return[F,C];let E=C.models.map((B)=>ZD(B)&&B.cost===void 0?{cost:u,...B}:B);return[F,{...C,models:E}]}))}async function x6(D,u,F){if(!u)return null;if(!await bF(D,u))return F.push("skills must be a directory \u2014 ignored"),null;return KD(D,"skills")}async function b6(D,u,F){if(!u)return[];if(!await bF(D,u))return F.push("extensions must be a directory \u2014 ignored"),[];let C=KD(D,"extensions"),E=await Q8(C,{withFileTypes:!0});return(await Promise.all(E.sort(($,Z)=>$.name.localeCompare(Z.name)).map(async($)=>{if($.isFile()&&$.name.endsWith(".ts")&&!$.name.startsWith("."))return KD(C,$.name);if($.isDirectory()){let Z=KD(C,$.name,"index.ts");return await Bun.file(Z).exists()?Z:null}return null}))).filter(($)=>$!==null)}async function h6(D,u,F){let C={nono:su,sbx:su};if(!u)return C;if(!await bF(D,u))return F.push("sandbox must be a directory \u2014 ignored"),C;let E=KD(D,"sandbox","nono.json"),B=KD(D,"sandbox","sbx.json"),$=await z8(E),Z=await z8(B);if($===void 0&&Z===void 0)return F.push("sandbox/ has no nono.json or sbx.json \u2014 sandboxing stays off unless --sandbox is passed"),C;return{nono:$===void 0?su:w6($,E,F),sbx:Z===void 0?su:m6(Z,B,F)}}function w6(D,u,F){let C=ru(D,"sandbox",u,F),E=p6(D,u,F);return k6(D,u,F),RD(D,u,["sandbox","network","filesystem","unsafe_macos_seatbelt_rules","net"],F),{posture:C===!1?"disabled":"enabled",...E!==void 0?{network:E}:{},filesystem:g6(D.filesystem,u,F),unsafeMacosSeatbeltRules:y6(D.unsafe_macos_seatbelt_rules,u,F)}}function m6(D,u,F){let C=ru(D,"sandbox",u,F),E=v6(D,u,F);return hF({record:D,key:"unsafe_macos_seatbelt_rules",path:u,explanation:"the sbx VM boundary replaces Seatbelt"},F),RD(D,u,["sandbox","network","filesystem","unsafe_macos_seatbelt_rules"],F),{posture:C===!1?"disabled":"enabled",...E!==void 0?{network:E}:{},filesystem:c6(D.filesystem,u,F),unsafeMacosSeatbeltRules:[]}}function v6(D,u,F){let C=D.network;if(C===void 0)return;if(!ZD(C)){F.push(`${u}: network must be an object \u2014 ignored`);return}for(let M of["network_profile","open_port","listen_port"])hF({record:C,key:M,path:u},F);let E=`${u} network`;RD(C,E,["block","allow_domain","network_profile","open_port","listen_port"],F);let B=ru(C,"block",E,F),$=M8(C,"allow_domain",E,F),Z={...B!==void 0?{block:B}:{},...$.length>0?{allowDomain:$}:{}};return Object.keys(Z).length>0?Z:void 0}function c6(D,u,F){if(D===void 0)return Iu;if(!ZD(D))return F.push(`${u}: filesystem must be an object \u2014 ignored`),Iu;return hF({record:D,key:"unix_socket_dir_bind",path:u,explanation:"Unix sockets cannot cross the sbx VM boundary"},F),RD(D,`${u} filesystem`,["read","write","allow","unix_socket_dir_bind"],F),{read:Cu(D,"read",u,F),write:Cu(D,"write",u,F),allow:Cu(D,"allow",u,F),unixSocketDirBind:[]}}function hF({record:D,key:u,path:F,explanation:C},E){if(D[u]===void 0)return;E.push(`${F}: ${u} is nono-only \u2014 ${C!==void 0?`${C}; `:""}ignored`)}async function z8(D){return await d6(D)?wF(D):void 0}async function d6(D){try{return await V6(D),!0}catch(u){if(XD(u,"ENOENT"))return!1;throw u}}function k6(D,u,F){if(D.net!==void 0)F.push(`${u}: "net" was removed \u2014 use "network" instead (see ARCHITECTURE.md) \u2014 ignored`)}function p6(D,u,F){let C=D.network;if(C===void 0)return;if(!ZD(C)){F.push(`${u}: network must be an object \u2014 ignored`);return}let E=`${u} network`;RD(C,E,["block","network_profile","allow_domain","open_port","listen_port"],F);let B=ru(C,"block",E,F),$=xF(C,"network_profile",E,F),Z=M8(C,"allow_domain",E,F),M=Z8(C,"open_port",E,F),H=Z8(C,"listen_port",E,F),V={...B!==void 0?{block:B}:{},...$!==void 0?{networkProfile:$}:{},...Z.length>0?{allowDomain:Z}:{},...M.length>0?{openPort:M}:{},...H.length>0?{listenPort:H}:{}};return Object.keys(V).length>0?V:void 0}function M8(D,u,F,C){let E=D[u];if(E===void 0)return[];if(!cD(E))return C.push(`${F}: ${u} must be an array of strings \u2014 ignored`),[];let B=E.map(($)=>$.trim()).filter(($)=>$!=="");if(B.length!==E.length)C.push(`${F}: ${u} entries must be non-empty \u2014 blanks ignored`);return B}function Z8(D,u,F,C){let E=D[u];if(E===void 0)return[];if(!Array.isArray(E))return C.push(`${F}: ${u} must be an array of port numbers \u2014 ignored`),[];let B=(Z)=>typeof Z==="number"&&Number.isInteger(Z)&&Z>=0&&Z<=65535,$=E.filter((Z)=>!B(Z)).map((Z)=>typeof Z==="object"&&Z!==null?JSON.stringify(Z):String(Z));if($.length>0)C.push(`${F}: ${u} entries must be integers 0\u201365535 \u2014 ignored: ${$.join(", ")}`);return E.filter(B)}function y6(D,u,F){if(D===void 0)return[];if(!cD(D))return F.push(`${u}: unsafe_macos_seatbelt_rules must be an array of strings \u2014 ignored`),[];let C=(B)=>{let $=B.trim();return $.startsWith("(")&&$.endsWith(")")},E=D.filter((B)=>!C(B));if(E.length>0)F.push(`${u}: unsafe_macos_seatbelt_rules entries must be parenthesized s-expressions \u2014 ignored: ${E.join(", ")}`);return D.filter(C).map((B)=>B.trim())}function ru(D,u,F,C){let E=D[u];if(E===void 0)return;if(typeof E!=="boolean"){C.push(`${F}: ${u} must be true or false \u2014 ignored`);return}return E}function g6(D,u,F){if(D===void 0)return Iu;if(!ZD(D))return F.push(`${u}: filesystem must be an object \u2014 ignored`),Iu;return RD(D,`${u} filesystem`,["read","write","allow","unix_socket_dir_bind"],F),{read:Cu(D,"read",u,F),write:Cu(D,"write",u,F),allow:Cu(D,"allow",u,F),unixSocketDirBind:Cu(D,"unix_socket_dir_bind",u,F)}}function Cu(D,u,F,C){let E=D[u];if(E===void 0)return[];if(!cD(E))return C.push(`${F}: ${u} must be an array of strings \u2014 ignored`),[];let B=E.filter(($)=>!Tu($));if(B.length>0)C.push(`${F}: ${u} entries must be absolute, ~/, or $HOME/ paths \u2014 ignored: ${B.join(", ")}`);return E.filter(Tu)}async function wF(D){let u=Xu(await t6(D),D);if(!ZD(u))throw Error(`${D} must be a JSON object`);return u}async function t6(D){let u;try{u=await SD(D)}catch(F){throw Error(`${D} could not be read: ${Fu(F)}`,{cause:F})}if(u===void 0)throw Error(`${D} could not be read \u2014 broken symlink?`);return u}function xF(D,u,F,C){let E=D[u];if(E===void 0)return;if(typeof E!=="string"){C.push(`${F}: ${u} must be a string \u2014 ignored`);return}return E}function l6(D,u,F){let C=D.defaultThinkingLevel;if(C===void 0)return;if(typeof C!=="string"||!E8.includes(C)){F.push(`${u}: defaultThinkingLevel must be one of ${E8.join(", ")} \u2014 ignored`);return}return C}import{createHash as i6}from"crypto";import{homedir as o6}from"os";import{basename as n6,join as Ku}from"path";function s6(D){let u=n6(D).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),F=i6("sha256").update(D).digest("hex").slice(0,8);return`${u===""?"agent":u}-${F}`}function G8(D,u=o6(),F=process.env.CRADLE_STATE_DIR){let C=F||Ku(u,".cradle");return Ku(C,"agents",s6(D))}function J8(D){return{extensionsDir:Ku(D,"extensions"),sessionsDir:Ku(D,"sessions"),miseCacheDir:Ku(D,"mise-cache")}}import{readFile as r6}from"fs/promises";import{join as Y8,resolve as q8}from"path";var H8="gitdir:";async function O8(D){try{return await r6(D,"utf8")}catch{return}}async function U8(D){let u=await O8(Y8(D,".git"));if(u===void 0||!u.startsWith(H8))return;let F=q8(D,u.slice(H8.length).trim()),C=await O8(Y8(F,"commondir")),E=C!==void 0?q8(F,C.trim()):F;return lu(D,E)?void 0:E}async function T8(D,u={}){let F=u.home??D7(),C=u.cwd??process.cwd(),{dir:E,warnings:B}=await h2(D.dir,{home:F,cwd:C}),$=await X8(E),Z=G8($.dir,F),{extensionsDir:M,sessionsDir:H,miseCacheDir:V}=J8(Z),Y=B7(D,$),q=D.dryRun??!1,O=W7(Y.backend,q,u.which),W=C7({folder:$,flags:D,backend:Y.backend,bins:O,stateDir:Z,extensionsDir:M,sessionsDir:H,miseCacheDir:V}),J=await V7(Y,$,{home:F,cwd:C,stateDir:Z,profilePath:W.profilePath,sbxBin:O.sbxBin,hostPiBin:O.piBin,tty:u.tty??!1}),S=E7($,Z);return{files:I7($,Y.backend),extensionsDir:M,sessionsDir:H,warnings:[...B,...Y.warnings,...J.warnings],profile:J.profile,sbx:J.sbx,packages:S,launch:W,dryRun:q}}function C7(D){let{folder:u,flags:F,backend:C,bins:E,stateDir:B,extensionsDir:$,sessionsDir:Z,miseCacheDir:M}=D;return{folder:u,stateDir:B,extensionsDir:$,sessionsDir:Z,miseCacheDir:M,backend:C,passthrough:F.passthrough??[],nonoBin:E.nonoBin,piBin:C==="sbx"?"pi":E.piBin,profilePath:ju(B,K2),...F.verbose?{verbose:!0}:{}}}function E7(D,u){let F=D.settings.packages;if(F===void 0||F.length===0)return null;return{npmDir:ju(u,"npm"),manifest:D8(F),specs:F,installCommand:[...D.settings.npmCommand??["npm"],"install","--ignore-scripts"]}}function B7(D,u){let{backend:F,warnings:C}=M7(D,u),E=[],B=$7(D,u,F,E);return{backend:F,network:B,warnings:Q7(F!==null,B,[...C,...E])}}function $7(D,u,F,C){if(D.offline)return{block:!0};let E=z7(D.allowHost??[],C);if(E.length>0)return{allowDomain:E};return F==="sbx"?u.sbx.network:u.sandbox.network}function z7(D,u){let F=D.map((C)=>C.trim()).filter((C)=>C!=="");if(F.length!==D.length)u.push("--allow-host entries must be non-empty \u2014 blanks ignored");return F}function Z7(D){return D!==void 0&&(D.block===!0||(D.allowDomain?.length??0)>0)}function Q7(D,u,F){if(D||!Z7(u))return F;return[...F,"network policy has no effect without the sandbox \u2014 pi runs with no network isolation (--sandbox to enforce it)"]}function X7(D){return D.offline===!0||(D.allowHost?.length??0)>0}function M7(D,u){if(D.noSandbox===!0)return{backend:null,warnings:u.warnings};if(D.sandboxBackend!==void 0)return{backend:D.sandboxBackend,warnings:u.warnings};let F=G7(u);if(D.noSandbox===!1||F.backend!==null)return{...F,backend:F.backend??"nono"};return J7(D,u,F.warnings)}function G7(D){let u=D.sandbox.posture==="enabled",F=D.sbx.posture==="enabled";if(u&&F)return{backend:"nono",warnings:[...D.warnings,"both sandbox/nono.json and sandbox/sbx.json declare a sandbox \u2014 using nono (pass --sandbox-backend sbx to override)"]};return{backend:u?"nono":F?"sbx":null,warnings:D.warnings}}function J7(D,u,F){let C=Y7(u);if(X7(D))return{backend:"nono",warnings:[...F,`${C} \u2014 sandbox forced on to enforce the requested network policy (--no-sandbox to override)`]};return{backend:null,warnings:[...F,`${C} \u2014 agent is running without OS isolation (--sandbox to force enable)`]}}function Y7(D){if(D.sandbox.posture==="disabled")return"sandbox disabled by sandbox/nono.json";if(D.sbx.posture==="disabled")return"sandbox disabled by sandbox/sbx.json";return"sandbox/nono.json or sbx.json not found"}async function L8(D,u={}){let F={dryRun:!1,results:[],failures:[]};if(await f2(F,"extensions",D.extensionsDir,D.files),F.failures.length>0)throw Error(`Failed to write agent extensions: ${F.failures.join("; ")}`);if(await mF(D.sessionsDir,{recursive:!0}),D.profile!==null)await mF(F7(D.profile.path),{recursive:!0}),await V8(D.profile.path,D.profile.content,"utf8");if(D.sbx!==null)await q7(D.sbx,u);let C={...D.launch,extensionsDir:D.extensionsDir,sessionsDir:D.sessionsDir},E=D.packages===null?{argv:Qu(C),warnings:[]}:await U7(D.packages,C,u);if(D.sbx===null)return E;return{argv:nu(D.sbx.spec,E.argv),warnings:E.warnings}}async function q7(D,u){let F=u.run;if(F===void 0)throw Error("An sbx-backend run needs a command runner but none was provided");let C=await F(D.createArgv);if(C.exitCode!==0&&!g2(C.stderr))throw Error(`Failed to create sbx sandbox ${D.spec.name}: ${C.stderr.trim()}`);for(let E of D.policyArgvs)await W8(F,E,`apply sbx network policy (${D.spec.name})`);await W8(F,await H7(D,u),`provision pi in sbx sandbox ${D.spec.name}`)}async function W8(D,u,F){let C=await D(u);if(C.exitCode!==0)throw Error(`Failed to ${F}: ${C.stderr.trim()}`)}async function H7(D,u){if(u.readPiVersion===void 0)return D.provisionArgv;let F=await u.readPiVersion(D.hostPiBin);return RF({...D.spec,piVersion:F})}async function O7(D,u){if(await SD(ju(D,"package.json"))!==u)return!1;return a6(ju(D,"node_modules"))}async function U7(D,u,F){if(await mF(D.npmDir,{recursive:!0}),!await O7(D.npmDir,D.manifest)){if(F.install===void 0)throw Error("Packages declared but no installer provided");let B=ju(D.npmDir,"package.json");await V8(B,D.manifest,"utf8");try{await F.install(D.installCommand,D.npmDir)}catch($){throw await e6(B,{force:!0}),$}}let{entries:C,warnings:E}=await u8(D.npmDir,D.specs);return{argv:Qu({...u,packageEntries:C}),warnings:E}}function W7(D,u,F){if(u)return{nonoBin:"nono",piBin:"pi",sbxBin:"sbx"};return{nonoBin:D==="nono"?tu("nono",F):"nono",sbxBin:D==="sbx"?tu("sbx",F):"sbx",piBin:tu("pi",F)}}async function V7(D,u,F){let C=D.backend!==null?await U8(F.cwd):void 0,E=L7(D.backend==="nono",u,D.network,{home:F.home,cwd:F.cwd,stateDir:F.stateDir,profilePath:F.profilePath,...C!==void 0?{linkedGitDir:C}:{}});if(D.backend!=="sbx")return{profile:E,sbx:null,warnings:[]};let B=T7(D.network,u,{...F,...C!==void 0?{linkedGitDir:C}:{}});return{profile:E,sbx:B,warnings:[...p2(D.network),...y2(u.sbx.filesystem)]}}function T7(D,u,F){let C=v2({cwd:F.cwd,agentDir:u.dir,stateDir:F.stateDir,home:F.home,grants:u.sbx.filesystem,...F.linkedGitDir!==void 0?{linkedGitDir:F.linkedGitDir}:{}}),E={sbxBin:F.sbxBin,name:c2(u7(F.stateDir),C),cwd:F.cwd,home:F.home,mounts:C,...D!==void 0?{network:D}:{},piVersion:null,tty:F.tty};return{spec:E,hostPiBin:F.hostPiBin,createArgv:d2(E),policyArgvs:k2(E),provisionArgv:RF(E)}}function L7(D,u,F,C){if(!D)return null;let E=j2(C.cwd,C.home);if(E!==void 0)throw Error(`cannot sandbox from ${E} \u2014 this directory is (or contains) nono's protected state root `+"(~/.local/state/nono) and nono refuses to start with an overlapping grant; run `cradle run` from a project directory instead");let B=_2({home:C.home,cwd:C.cwd,agentDir:u.dir,stateDir:C.stateDir,grants:u.sandbox.filesystem,rules:u.sandbox.unsafeMacosSeatbeltRules,...F!==void 0?{network:F}:{},...C.linkedGitDir!==void 0?{linkedGitDir:C.linkedGitDir}:{}});return{path:C.profilePath,content:B}}function I7(D,u){return[...D.providersJson!==null?[{rel:"providers.ts",content:l2(D.providersJson,{rewriteLocalhostBaseUrls:u==="sbx"})}]:[],...u==="nono"?[{rel:gu,content:U2()}]:[]]}function I8(D,u){return u?`\x1B[33m${D}\x1B[0m`:D}function K8(D,u){return()=>{D.kill(u)}}async function j8(D,u={}){let[F,...C]=D;if(!F)throw Error("Command requires at least one argument");let E=Bun.spawn([F,...C],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...process.env,...u}}),B=K8(E,"SIGINT"),$=K8(E,"SIGTERM");process.on("SIGINT",B),process.on("SIGTERM",$);try{return await E.exited}finally{process.off("SIGINT",B),process.off("SIGTERM",$)}}async function _8(D){let[u,...F]=D;if(!u)throw Error("Command requires at least one argument");let C=Bun.spawn([u,...F],{stdin:"ignore",stdout:"ignore",stderr:"pipe",env:process.env}),[E,B]=await Promise.all([new Response(C.stderr).text(),C.exited]);return{exitCode:B,stderr:E}}async function N8(D,u){let[F,...C]=D;if(!F)throw Error("Command requires at least one argument");let B=await Bun.spawn([F,...C],{cwd:u,stdin:"ignore",stdout:"inherit",stderr:"inherit",env:process.env}).exited;if(B!==0)throw Error(`Package install failed (${D.join(" ")} exited ${String(B)})`)}var _u=H2(process.argv.slice(2)).scriptName("cradle").version(O2.version).usage("$0 <cmd> [args]").parserConfiguration({"populate--":!0,"parse-numbers":!1,"parse-positional-numbers":!1}).strict();_u.command("$0","show help",()=>{},async()=>{console.log(await _u.getHelp())});_u.command("run [dir]","run an agent folder with pi, sandboxed when sandbox/nono.json or sandbox/sbx.json is present",(D)=>D.positional("dir",{type:"string",default:".",describe:"agent folder, or a name from ~/.cradle/settings.json (default: .)"}).option("offline",{type:"boolean",description:"block all outbound network (overrides the folder network policy; implies --sandbox)"}).option("allow-host",{type:"array",string:!0,description:"restrict network to these hosts (repeatable; overrides the folder allowlist; implies --sandbox)"}).option("sandbox",{type:"boolean",description:"run sandboxed (--sandbox forces it when no sandbox/ file enables one or the folder opts out; --no-sandbox disables)"}).option("sandbox-backend",{type:"string",choices:["nono","sbx"],description:"sandbox implementation (implies --sandbox): nono (host OS policy) or sbx (Docker Sandboxes microVM)"}).option("verbose",{type:"boolean",default:!1,description:"show nono's full sandbox capabilities banner instead of the one-line status"}).option("dry-run",{type:"boolean",default:!1,description:"print the write plan + command, do not spawn"}).epilogue("Everything after `--` is forwarded to pi."),async(D)=>{let u=(D["--"]??[]).map(String),F=(D.allowHost??[]).map(String),C={dir:D.dir,dryRun:D.dryRun,...D.sandbox!==void 0?{noSandbox:!D.sandbox}:{},...D.sandboxBackend!==void 0?{sandboxBackend:D.sandboxBackend}:{},...D.offline?{offline:!0}:{},...F.length?{allowHost:F}:{},...D.verbose?{verbose:!0}:{},...u.length?{passthrough:u}:{}};await K7(C)});_u.command("doctor","check pi / nono / mise on PATH",()=>{},async()=>{let D=await T2({readVersion:A8});console.log(L2(D)),process.exitCode=I2(D)});async function K7(D){try{let u=await T8(D,{tty:process.stdout.isTTY});if(R8(u.warnings),u.dryRun){j7(u);return}let F=await L8(u,{install:N8,run:_8,readPiVersion:A8});if(R8(F.warnings),u.profile!==null&&!D.verbose)console.log("\uD83D\uDD12 Sandbox Active");if(u.sbx!==null&&!D.verbose)console.log("\uD83D\uDD12 Sandbox Active (sbx)");process.exit(await j8(F.argv,_F(u.launch)))}catch(u){R7(u)}}function j7(D){for(let C of D.files)console.log(`write: ${f8(D.extensionsDir,C.rel)}`);if(D.profile!==null)console.log(`write: ${D.profile.path}`);if(D.sbx!==null)_7(D.sbx);if(D.packages!==null)N7(D.packages);let u=Object.entries(_F(D.launch)).map(([C,E])=>`${C}=${Mu(E)}`),F=D.sbx!==null?nu(D.sbx.spec,Qu(D.launch)):Qu(D.launch);console.log([...u,...F.map(Mu)].join(" "))}function _7(D){console.log(`create: ${D.createArgv.map(Mu).join(" ")}`);for(let u of D.policyArgvs)console.log(`policy: ${u.map(Mu).join(" ")}`);console.log(`provision: ${D.provisionArgv.map(Mu).join(" ")}`)}function N7(D){console.log(`write: ${f8(D.npmDir,"package.json")}`);let u=D.specs.map((F)=>`${F.name}@${F.version}`).join(", ");console.log(`install: ${D.installCommand.join(" ")} (${D.npmDir}): ${u}`)}function R8(D){let u=process.stderr.isTTY;for(let F of D)console.error(I8(`warning: ${F}`,u))}async function A8(D,u=["--version"]){try{let F=Bun.spawn([D,...u],{stdout:"pipe",stderr:"ignore"}),[C,E]=await Promise.all([new Response(F.stdout).text(),F.exited]);if(E!==0)return null;return C.split(`
112
- `)[0]?.match(/v?\d+\.\d+\S*/)?.[0]??null}catch{return null}}function R7(D){console.error(D instanceof Error?D.message:String(D)),process.exitCode=1}_u.parse();
110
+ `}function la(e){let t=JSON.parse(e);for(let n of Object.values(t)){if(n===null||typeof n!=="object")continue;let i=n;if(typeof i.baseUrl==="string")i.baseUrl=Zr(i.baseUrl)}return JSON.stringify(t,null,2)}import{lstat as Wa,readdir as gs,stat as La}from"fs/promises";import{join as we,resolve as Ga}from"path";import{readdir as da,stat as Da}from"fs/promises";import{join as Ge,resolve as is,sep as rs}from"path";import{basename as ca,relative as ts,sep as es}from"path";function wt(e){return e.startsWith("!")||e.startsWith("+")||e.startsWith("-")}function Nn(e,t,n){let i=t.filter((a)=>!wt(a)),r=$n(t,"!"),s=$n(t,"+"),o=$n(t,"-");return e.filter((a)=>{if(Mn(a,o,n))return!1;if(Mn(a,s,n))return!0;if(kn(a,r,n))return!1;return i.length===0||kn(a,i,n)})}function ns(e,t,n){return e.filter((i)=>{let r=t.filter((s)=>fa(i,s,n)).at(-1);return r!==void 0&&!r.startsWith("-")&&!r.startsWith("!")})}function fa(e,t,n){let i=wt(t)?t.slice(1):t;return t.startsWith("+")||t.startsWith("-")?Mn(e,[i],n):kn(e,[i],n)}function $n(e,t){return e.filter((n)=>n.startsWith(t)).map((n)=>n.slice(1))}function kn(e,t,n){let i=[ht(ts(n,e)),ca(e),ht(e)];return t.some((r)=>{let s=new Bun.Glob(ht(r));return i.some((o)=>s.match(o))})}function Mn(e,t,n){let i=ht(ts(n,e)),r=ht(e);return t.some((s)=>{let o=ht(s.startsWith("./")?s.slice(2):s);return o===i||o===r})}function ht(e){return es==="/"?e:e.split(es).join("/")}var ha=/^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/,pa=/^[0-9A-Za-z.^~><=* +-]+$/,ga=/\.[tj]s$/,ma=/[*?]/;function os(e,t,n){let i=e.packages;if(i===void 0)return[];if(!Array.isArray(i))return n.push(`${t}: packages must be an array \u2014 ignored`),[];let r=Fa(i,t,n),s=xa(r,t,n);return wa(s,t,n)}function Fa(e,t,n){let i=[],r=[];for(let s of e){let o=typeof s==="string"?{source:s}:ba(s,t,n);if(o===null)r.push(JSON.stringify(s));else i.push(o)}if(r.length>0)n.push(`${t}: packages entries must be a source string or a { "source": \u2026 } object \u2014 ignored: ${r.join(", ")}`);return i}function ba(e,t,n){if(!le(e))return null;let i=e.source;if(typeof i!=="string")return null;Ca(e,i,t,n);let r=e.autoload;if(r!==void 0&&typeof r!=="boolean")n.push(`${t}: packages entry ${i}: autoload must be a boolean \u2014 ignored`);let s=Ea(e,i,t,n);return{source:i,...s!==void 0?{extensions:s}:{},...r===!1?{autoloadDisabled:!0}:{}}}function Ea(e,t,n,i){let r=e.extensions;if(r===void 0)return;if(!Le(r)){i.push(`${n}: packages entry ${t}: extensions must be an array of strings \u2014 ignored`);return}return r}var ya=new Set(["source","extensions","autoload"]),ss=new Set(["skills","prompts","themes"]);function Ca(e,t,n,i){let r=Object.keys(e).filter((a)=>!ya.has(a)),s=r.filter((a)=>ss.has(a)),o=r.filter((a)=>!ss.has(a));if(s.length>0)i.push(`${n}: packages entry ${t}: cradle loads a package's extensions and nothing else \u2014 ignored: ${s.join(", ")}`);if(o.length>0)i.push(`${n}: packages entry ${t}: unknown filter keys \u2014 ignored: ${o.join(", ")}`)}function xa(e,t,n){let i=e.filter((s)=>s.source.startsWith("npm:")),r=e.filter((s)=>!s.source.startsWith("npm:"));if(r.length>0){let s=r.map((o)=>o.source).join(", ");n.push(`${t}: only npm: package sources are supported \u2014 ignored: ${s}`)}return i}function wa(e,t,n){let i=[],r=[];for(let{source:s,...o}of e){let a=Aa(s.slice(4));if(a===null)r.push(s);else i.push({...a,...o})}if(r.length>0)n.push(`${t}: packages entries must be npm:<name>[@<version>] \u2014 ignored: ${r.join(", ")}`);return i}function Aa(e){let t=e.lastIndexOf("@"),n=t>0,i=n?e.slice(0,t):e,r=n?e.slice(t+1):"latest";if(!ha.test(i)||!pa.test(r))return null;return{name:i,version:r}}function us(e){let t=Object.fromEntries([...e].sort((n,i)=>n.name.localeCompare(i.name)).map((n)=>[n.name,n.version]));return`${JSON.stringify({name:"cradle-agent-packages",private:!0,dependencies:t},null,2)}
111
+ `}async function as(e,t){let n=await Promise.all(t.map(async(i)=>{let r=[];return{entries:await _a(e,i,r),warnings:r}}));return{entries:n.flatMap((i)=>i.entries),warnings:n.flatMap((i)=>i.warnings)}}async function _a(e,t,n){let i=Ge(e,"node_modules",t.name),r=await Sa(t.name,i,n);if(r===null)return[];let s=await Ba(i,r,t.name,n);return Na(s,t,i)}async function Sa(e,t,n){let i=Ge(t,"package.json"),r=await $e(i);if(r===void 0)return n.push(`package ${e} is not installed \u2014 skipped`),null;try{let s=dt(r,i);if(!le(s))return n.push(`package ${e}: ${i} must be a JSON object \u2014 skipped`),null;return s}catch(s){return n.push(`package ${e}: ${rt(s)} \u2014 skipped`),null}}async function Ba(e,t,n,i){let r=Pa(t);if(r!==void 0)return Oa(e,r,n,i);let s=await ls(Ge(e,"extensions"));if(s.length>0)return s;return Ma(n,e,i)}function Pa(e){let t=e.pi;if(t===void 0||!le(t))return;let n=t.extensions;if(n===void 0||!Le(n)||n.length===0)return;return n}async function Oa(e,t,n,i){let r=t.filter((c)=>!wt(c)),o=(await Promise.all(r.map((c)=>ja(e,c,n,i)))).flat(),a=t.filter(wt);return a.length>0?Nn(o,a,e):o}async function ja(e,t,n,i){let r=await va(e,t),s=r.filter((a)=>Ia(e,a));if(s.length<r.length)i.push(`package ${n}: extension entry "${t}" escapes the package directory \u2014 skipped`);let o=await Promise.all(s.map(async(a)=>({files:await $a(a)})));if(o.some((a)=>a.files===null))i.push(`package ${n}: extension entry "${t}" not found \u2014 skipped`);return o.flatMap((a)=>a.files??[])}async function va(e,t){if(!ma.test(t))return[is(e,t)];let n=new Bun.Glob(t).scan({cwd:e,absolute:!0,onlyFiles:!1});return(await Array.fromAsync(n)).map((i)=>is(i)).sort()}async function $a(e){let t=await Ra(e);if(t===void 0)return null;return t.isDirectory()?ls(e):[e]}async function ls(e){let n=[...await Ta(e)].sort((r,s)=>r.name.localeCompare(s.name));return(await Promise.all(n.map((r)=>ka(e,r)))).flat()}async function ka(e,t){if(t.name.startsWith(".")||t.name==="node_modules")return[];if(t.isFile())return ga.test(t.name)?[Ge(e,t.name)]:[];if(!t.isDirectory())return[];let n=await cs([Ge(e,t.name,"index.ts"),Ge(e,t.name,"index.js")]);return n===null?[]:[n]}async function Ma(e,t,n){let i=await cs([Ge(t,"index.ts"),Ge(t,"index.js")]);if(i===null)return n.push(`package ${e} declares no pi extensions \u2014 skipped`),[];return[i]}function Na(e,t,n){if(t.autoloadDisabled===!0)return ns(e,t.extensions??[],n);if(t.extensions===void 0)return[...e];if(t.extensions.length===0)return[];return Nn(e,t.extensions,n)}function Ia(e,t){let n=e.endsWith(rs)?e:`${e}${rs}`;return t===e||t.startsWith(n)}async function cs(e){return(await Promise.all(e.map(async(n)=>await Bun.file(n).exists()?n:null))).find((n)=>n!==null)??null}async function Ra(e){try{return await Da(e)}catch(t){if(fe(t,"ENOENT")||fe(t,"ENOTDIR"))return;throw t}}async function Ta(e){try{return await da(e,{withFileTypes:!0})}catch(t){if(fe(t,"ENOENT")||fe(t,"ENOTDIR"))return[];throw t}}var fs=["off","minimal","low","medium","high","xhigh"],ds=new Set(["schedules","subagents","channels","connections"]),Va=new Set(["SYSTEM.md","APPEND_SYSTEM.md","settings.json","models.json","skills","extensions","sandbox"]),Ha=new Set([".git",".gitignore",".DS_Store","README.md","LICENSE"]),At={read:[],write:[],allow:[],unixSocketDirBind:[]},Zt={posture:"unconfigured",filesystem:At,unsafeMacosSeatbeltRules:[]};async function ms(e){let t=Ga(e),n=await za(t),i=new Map(n.map((c)=>[c.name,c])),r=i.has("SYSTEM.md"),s=i.has("APPEND_SYSTEM.md");if(!r&&!s){let c=i.has("AGENTS.md")?" \u2014 found AGENTS.md, rename it to APPEND_SYSTEM.md":"";throw Error(`Not an agent folder: ${t} (needs SYSTEM.md or APPEND_SYSTEM.md${c} \u2014 see ARCHITECTURE.md)`)}let o=[];Ua(n,o);let a=await tl(t,i.get("sandbox"),o);return{dir:t,systemFilePath:r?we(t,"SYSTEM.md"):null,appendSystemFilePath:s?we(t,"APPEND_SYSTEM.md"):null,settings:await Ya(t,i.has("settings.json"),o),providersJson:await Xa(t,i.has("models.json"),o),skillsDir:await Qa(t,i.get("skills"),o),extensionFiles:await el(t,i.get("extensions"),o),sandbox:a.nono,sbx:a.sbx,warnings:o}}async function za(e){try{return await gs(e,{withFileTypes:!0})}catch(t){if(fe(t,"ENOENT")||fe(t,"ENOTDIR"))throw Error(`Agent folder not found: ${e}`,{cause:t});throw t}}async function Rn(e,t){if(t.isDirectory())return!0;if(!t.isSymbolicLink())return!1;try{return(await La(we(e,t.name))).isDirectory()}catch(n){if(fe(n,"ENOENT"))return!1;throw n}}function Ua(e,t){let n=e.filter((r)=>ds.has(r.name)).map((r)=>r.name),i=e.map((r)=>r.name).filter((r)=>!Va.has(r)&&!ds.has(r)&&!Ha.has(r));if(n.length>0)t.push(`reserved for a future cradle release, ignored: ${n.join(", ")}`);if(i.length>0)t.push(`not part of the agent folder format, ignored: ${i.join(", ")}`)}async function Ya(e,t,n){if(!t)return{};let i=we(e,"settings.json"),r=await Wn(i);Ka(r,i,n);let s=In(r,"defaultProvider",i,n),o=In(r,"defaultModel",i,n),a=dl(r,i,n),c=os(r,i,n),g=qa(r,i,n);return{...s!==void 0?{defaultProvider:s}:{},...o!==void 0?{defaultModel:o}:{},...a!==void 0?{defaultThinkingLevel:a}:{},...c.length>0?{packages:c}:{},...g!==void 0?{npmCommand:g}:{}}}var Ja=new Set(["defaultProvider","defaultModel","defaultThinkingLevel","packages","npmCommand"]);function Ka(e,t,n){let i=Object.keys(e).filter((r)=>!Ja.has(r));if(i.length>0)n.push(`${t}: keys cradle does not map are ignored \u2014 pi reads them from ~/.pi/agent/settings.json or `+`the project's .pi/settings.json, not the agent folder: ${i.join(", ")}`)}var Ds=new Set(["npm","pnpm","yarn","bun"]);function qa(e,t,n){let i=e.npmCommand;if(i===void 0)return;let[r,...s]=Le(i)?i:[];if(r===void 0||s.length>0||!Ds.has(r)){let o=[...Ds].join(", ");n.push(`${t}: npmCommand must be a single-element array naming one of ${o} \u2014 ignored`);return}return[r]}async function Xa(e,t,n){if(!t)return null;let i=we(e,"models.json"),r=await Wn(i),s=r.providers;if(s===void 0||!le(s))throw Error(`${i} must contain a "providers" object`);return Be(r,i,["providers"],n),JSON.stringify(Za(s),null,2)}function Za(e){let t={input:0,output:0,cacheRead:0,cacheWrite:0};return Object.fromEntries(Object.entries(e).map(([n,i])=>{if(!le(i)||!Array.isArray(i.models))return[n,i];let r=i.models.map((s)=>le(s)&&s.cost===void 0?{cost:t,...s}:s);return[n,{...i,models:r}]}))}async function Qa(e,t,n){if(!t)return null;if(!await Rn(e,t))return n.push("skills must be a directory \u2014 ignored"),null;return we(e,"skills")}async function el(e,t,n){if(!t)return[];if(!await Rn(e,t))return n.push("extensions must be a directory \u2014 ignored"),[];let i=we(e,"extensions"),r=await gs(i,{withFileTypes:!0});return(await Promise.all(r.sort((o,a)=>o.name.localeCompare(a.name)).map(async(o)=>{if(o.isFile()&&o.name.endsWith(".ts")&&!o.name.startsWith("."))return we(i,o.name);if(o.isDirectory()){let a=we(i,o.name,"index.ts");return await Bun.file(a).exists()?a:null}return null}))).filter((o)=>o!==null)}async function tl(e,t,n){let i={nono:Zt,sbx:Zt};if(!t)return i;if(!await Rn(e,t))return n.push("sandbox must be a directory \u2014 ignored"),i;let r=we(e,"sandbox","nono.json"),s=we(e,"sandbox","sbx.json"),o=await hs(r),a=await hs(s);if(o===void 0&&a===void 0)return n.push("sandbox/ has no nono.json or sbx.json \u2014 sandboxing stays off unless --sandbox is passed"),i;return{nono:o===void 0?Zt:nl(o,r,n),sbx:a===void 0?Zt:il(a,s,n)}}function nl(e,t,n){let i=Qt(e,"sandbox",t,n),r=al(e,t,n);return ul(e,t,n),Be(e,t,["sandbox","network","filesystem","unsafe_macos_seatbelt_rules","net"],n),{posture:i===!1?"disabled":"enabled",...r!==void 0?{network:r}:{},filesystem:cl(e.filesystem,t,n),unsafeMacosSeatbeltRules:ll(e.unsafe_macos_seatbelt_rules,t,n)}}function il(e,t,n){let i=Qt(e,"sandbox",t,n),r=rl(e,t,n);return Tn({record:e,key:"unsafe_macos_seatbelt_rules",path:t,explanation:"the sbx VM boundary replaces Seatbelt"},n),Be(e,t,["sandbox","network","filesystem","unsafe_macos_seatbelt_rules"],n),{posture:i===!1?"disabled":"enabled",...r!==void 0?{network:r}:{},filesystem:sl(e.filesystem,t,n),unsafeMacosSeatbeltRules:[]}}function rl(e,t,n){let i=e.network;if(i===void 0)return;if(!le(i)){n.push(`${t}: network must be an object \u2014 ignored`);return}for(let c of["network_profile","open_port","listen_port"])Tn({record:i,key:c,path:t},n);let r=`${t} network`;Be(i,r,["block","allow_domain","network_profile","open_port","listen_port"],n);let s=Qt(i,"block",r,n),o=Fs(i,"allow_domain",r,n),a={...s!==void 0?{block:s}:{},...o.length>0?{allowDomain:o}:{}};return Object.keys(a).length>0?a:void 0}function sl(e,t,n){if(e===void 0)return At;if(!le(e))return n.push(`${t}: filesystem must be an object \u2014 ignored`),At;return Tn({record:e,key:"unix_socket_dir_bind",path:t,explanation:"Unix sockets cannot cross the sbx VM boundary"},n),Be(e,`${t} filesystem`,["read","write","allow","unix_socket_dir_bind"],n),{read:st(e,"read",t,n),write:st(e,"write",t,n),allow:st(e,"allow",t,n),unixSocketDirBind:[]}}function Tn({record:e,key:t,path:n,explanation:i},r){if(e[t]===void 0)return;r.push(`${n}: ${t} is nono-only \u2014 ${i!==void 0?`${i}; `:""}ignored`)}async function hs(e){return await ol(e)?Wn(e):void 0}async function ol(e){try{return await Wa(e),!0}catch(t){if(fe(t,"ENOENT"))return!1;throw t}}function ul(e,t,n){if(e.net!==void 0)n.push(`${t}: "net" was removed \u2014 use "network" instead (see ARCHITECTURE.md) \u2014 ignored`)}function al(e,t,n){let i=e.network;if(i===void 0)return;if(!le(i)){n.push(`${t}: network must be an object \u2014 ignored`);return}let r=`${t} network`;Be(i,r,["block","network_profile","allow_domain","open_port","listen_port"],n);let s=Qt(i,"block",r,n),o=In(i,"network_profile",r,n),a=Fs(i,"allow_domain",r,n),c=ps(i,"open_port",r,n),g=ps(i,"listen_port",r,n),E={...s!==void 0?{block:s}:{},...o!==void 0?{networkProfile:o}:{},...a.length>0?{allowDomain:a}:{},...c.length>0?{openPort:c}:{},...g.length>0?{listenPort:g}:{}};return Object.keys(E).length>0?E:void 0}function Fs(e,t,n,i){let r=e[t];if(r===void 0)return[];if(!Le(r))return i.push(`${n}: ${t} must be an array of strings \u2014 ignored`),[];let s=r.map((o)=>o.trim()).filter((o)=>o!=="");if(s.length!==r.length)i.push(`${n}: ${t} entries must be non-empty \u2014 blanks ignored`);return s}function ps(e,t,n,i){let r=e[t];if(r===void 0)return[];if(!Array.isArray(r))return i.push(`${n}: ${t} must be an array of port numbers \u2014 ignored`),[];let s=(a)=>typeof a==="number"&&Number.isInteger(a)&&a>=0&&a<=65535,o=r.filter((a)=>!s(a)).map((a)=>typeof a==="object"&&a!==null?JSON.stringify(a):String(a));if(o.length>0)i.push(`${n}: ${t} entries must be integers 0\u201365535 \u2014 ignored: ${o.join(", ")}`);return r.filter(s)}function ll(e,t,n){if(e===void 0)return[];if(!Le(e))return n.push(`${t}: unsafe_macos_seatbelt_rules must be an array of strings \u2014 ignored`),[];let i=(s)=>{let o=s.trim();return o.startsWith("(")&&o.endsWith(")")},r=e.filter((s)=>!i(s));if(r.length>0)n.push(`${t}: unsafe_macos_seatbelt_rules entries must be parenthesized s-expressions \u2014 ignored: ${r.join(", ")}`);return e.filter(i).map((s)=>s.trim())}function Qt(e,t,n,i){let r=e[t];if(r===void 0)return;if(typeof r!=="boolean"){i.push(`${n}: ${t} must be true or false \u2014 ignored`);return}return r}function cl(e,t,n){if(e===void 0)return At;if(!le(e))return n.push(`${t}: filesystem must be an object \u2014 ignored`),At;return Be(e,`${t} filesystem`,["read","write","allow","unix_socket_dir_bind"],n),{read:st(e,"read",t,n),write:st(e,"write",t,n),allow:st(e,"allow",t,n),unixSocketDirBind:st(e,"unix_socket_dir_bind",t,n)}}function st(e,t,n,i){let r=e[t];if(r===void 0)return[];if(!Le(r))return i.push(`${n}: ${t} must be an array of strings \u2014 ignored`),[];let s=r.filter((o)=>!xt(o));if(s.length>0)i.push(`${n}: ${t} entries must be absolute, ~/, or $HOME/ paths \u2014 ignored: ${s.join(", ")}`);return r.filter(xt)}async function Wn(e){let t=dt(await fl(e),e);if(!le(t))throw Error(`${e} must be a JSON object`);return t}async function fl(e){let t;try{t=await $e(e)}catch(n){throw Error(`${e} could not be read: ${rt(n)}`,{cause:n})}if(t===void 0)throw Error(`${e} could not be read \u2014 broken symlink?`);return t}function In(e,t,n,i){let r=e[t];if(r===void 0)return;if(typeof r!=="string"){i.push(`${n}: ${t} must be a string \u2014 ignored`);return}return r}function dl(e,t,n){let i=e.defaultThinkingLevel;if(i===void 0)return;if(typeof i!=="string"||!fs.includes(i)){n.push(`${t}: defaultThinkingLevel must be one of ${fs.join(", ")} \u2014 ignored`);return}return i}import{createHash as Dl}from"crypto";import{homedir as hl}from"os";import{basename as pl,join as _t}from"path";function gl(e){let t=pl(e).toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),n=Dl("sha256").update(e).digest("hex").slice(0,8);return`${t===""?"agent":t}-${n}`}function bs(e,t=hl(),n=process.env.CRADLE_STATE_DIR){let i=n||_t(t,".cradle");return _t(i,"agents",gl(e))}function Es(e){return{extensionsDir:_t(e,"extensions"),sessionsDir:_t(e,"sessions"),miseCacheDir:_t(e,"mise-cache")}}import{readFile as ml}from"fs/promises";import{join as ys,resolve as Cs}from"path";var xs="gitdir:";async function ws(e){try{return await ml(e,"utf8")}catch{return}}async function As(e){let t=await ws(ys(e,".git"));if(t===void 0||!t.startsWith(xs))return;let n=Cs(e,t.slice(xs.length).trim()),i=await ws(ys(n,"commondir")),r=i!==void 0?Cs(n,i.trim()):n;return Jt(e,r)?void 0:r}async function Bs(e,t={}){let n=t.home??El(),i=t.cwd??process.cwd(),{dir:r,warnings:s}=await Gr(e.dir,{home:n,cwd:i}),o=await ms(r),a=bs(o.dir,n),{extensionsDir:c,sessionsDir:g,miseCacheDir:E}=Es(a),h=Al(e,o),p=e.dryRun??!1,m=Tl(h.backend,p,t.which),b=xl({folder:o,flags:e,backend:h.backend,bins:m,stateDir:a,extensionsDir:c,sessionsDir:g,miseCacheDir:E}),D=await Wl(h,o,{home:n,cwd:i,stateDir:a,profilePath:b.profilePath,sbxBin:m.sbxBin,hostPiBin:m.piBin,tty:t.tty??!1}),j=wl(o,a);return{files:Vl(o,h.backend),extensionsDir:c,sessionsDir:g,warnings:[...s,...h.warnings,...D.warnings],profile:D.profile,sbx:D.sbx,packages:j,launch:b,dryRun:p}}function xl(e){let{folder:t,flags:n,backend:i,bins:r,stateDir:s,extensionsDir:o,sessionsDir:a,miseCacheDir:c}=e;return{folder:t,stateDir:s,extensionsDir:o,sessionsDir:a,miseCacheDir:c,backend:i,passthrough:n.passthrough??[],nonoBin:r.nonoBin,piBin:i==="sbx"?"pi":r.piBin,profilePath:St(s,jr),...n.verbose?{verbose:!0}:{}}}function wl(e,t){let n=e.settings.packages;if(n===void 0||n.length===0)return null;return{npmDir:St(t,"npm"),manifest:us(n),specs:n,installCommand:[...e.settings.npmCommand??["npm"],"install","--ignore-scripts"]}}function Al(e,t){let{backend:n,warnings:i}=jl(e,t),r=[],s=_l(e,t,n,r);return{backend:n,network:s,warnings:Pl(n!==null,s,[...i,...r])}}function _l(e,t,n,i){if(e.offline)return{block:!0};let r=Sl(e.allowHost??[],i);if(r.length>0)return{allowDomain:r};return n==="sbx"?t.sbx.network:t.sandbox.network}function Sl(e,t){let n=e.map((i)=>i.trim()).filter((i)=>i!=="");if(n.length!==e.length)t.push("--allow-host entries must be non-empty \u2014 blanks ignored");return n}function Bl(e){return e!==void 0&&(e.block===!0||(e.allowDomain?.length??0)>0)}function Pl(e,t,n){if(e||!Bl(t))return n;return[...n,"network policy has no effect without the sandbox \u2014 pi runs with no network isolation (--sandbox to enforce it)"]}function Ol(e){return e.offline===!0||(e.allowHost?.length??0)>0}function jl(e,t){if(e.noSandbox===!0)return{backend:null,warnings:t.warnings};if(e.sandboxBackend!==void 0)return{backend:e.sandboxBackend,warnings:t.warnings};let n=vl(t);if(e.noSandbox===!1||n.backend!==null)return{...n,backend:n.backend??"nono"};return $l(e,t,n.warnings)}function vl(e){let t=e.sandbox.posture==="enabled",n=e.sbx.posture==="enabled";if(t&&n)return{backend:"nono",warnings:[...e.warnings,"both sandbox/nono.json and sandbox/sbx.json declare a sandbox \u2014 using nono (pass --sandbox-backend sbx to override)"]};return{backend:t?"nono":n?"sbx":null,warnings:e.warnings}}function $l(e,t,n){let i=kl(t);if(Ol(e))return{backend:"nono",warnings:[...n,`${i} \u2014 sandbox forced on to enforce the requested network policy (--no-sandbox to override)`]};return{backend:null,warnings:[...n,`${i} \u2014 agent is running without OS isolation (--sandbox to force enable)`]}}function kl(e){if(e.sandbox.posture==="disabled")return"sandbox disabled by sandbox/nono.json";if(e.sbx.posture==="disabled")return"sandbox disabled by sandbox/sbx.json";return"sandbox/nono.json or sbx.json not found"}async function Ps(e,t={}){let n={dryRun:!1,results:[],failures:[]};if(await Nr(n,"extensions",e.extensionsDir,e.files),n.failures.length>0)throw Error(`Failed to write agent extensions: ${n.failures.join("; ")}`);if(await Ln(e.sessionsDir,{recursive:!0}),e.profile!==null)await Ln(Cl(e.profile.path),{recursive:!0}),await Ss(e.profile.path,e.profile.content,"utf8");if(e.sbx!==null)await Ml(e.sbx,t);let i={...e.launch,extensionsDir:e.extensionsDir,sessionsDir:e.sessionsDir},r=e.packages===null?{argv:ft(i),warnings:[]}:await Rl(e.packages,i,t);if(e.sbx===null)return r;return{argv:Xt(e.sbx.spec,r.argv),warnings:r.warnings}}async function Ml(e,t){let n=t.run;if(n===void 0)throw Error("An sbx-backend run needs a command runner but none was provided");let i=await n(e.createArgv);if(i.exitCode!==0&&!Xr(i.stderr))throw Error(`Failed to create sbx sandbox ${e.spec.name}: ${i.stderr.trim()}`);for(let r of e.policyArgvs)await _s(n,r,`apply sbx network policy (${e.spec.name})`);await _s(n,await Nl(e,t),`provision pi in sbx sandbox ${e.spec.name}`)}async function _s(e,t,n){let i=await e(t);if(i.exitCode!==0)throw Error(`Failed to ${n}: ${i.stderr.trim()}`)}async function Nl(e,t){if(t.readPiVersion===void 0)return e.provisionArgv;let n=await t.readPiVersion(e.hostPiBin);return vn({...e.spec,piVersion:n})}async function Il(e,t){if(await $e(St(e,"package.json"))!==t)return!1;return Fl(St(e,"node_modules"))}async function Rl(e,t,n){if(await Ln(e.npmDir,{recursive:!0}),!await Il(e.npmDir,e.manifest)){if(n.install===void 0)throw Error("Packages declared but no installer provided");let s=St(e.npmDir,"package.json");await Ss(s,e.manifest,"utf8");try{await n.install(e.installCommand,e.npmDir)}catch(o){throw await bl(s,{force:!0}),o}}let{entries:i,warnings:r}=await as(e.npmDir,e.specs);return{argv:ft({...t,packageEntries:i}),warnings:r}}function Tl(e,t,n){if(t)return{nonoBin:"nono",piBin:"pi",sbxBin:"sbx"};return{nonoBin:e==="nono"?Yt("nono",n):"nono",sbxBin:e==="sbx"?Yt("sbx",n):"sbx",piBin:Yt("pi",n)}}async function Wl(e,t,n){let i=e.backend!==null?await As(n.cwd):void 0,r=Gl(e.backend==="nono",t,e.network,{home:n.home,cwd:n.cwd,stateDir:n.stateDir,profilePath:n.profilePath,...i!==void 0?{linkedGitDir:i}:{}});if(e.backend!=="sbx")return{profile:r,sbx:null,warnings:[]};let s=Ll(e.network,t,{...n,...i!==void 0?{linkedGitDir:i}:{}});return{profile:r,sbx:s,warnings:[...Kr(e.network),...qr(t.sbx.filesystem)]}}function Ll(e,t,n){let i=zr({cwd:n.cwd,agentDir:t.dir,stateDir:n.stateDir,home:n.home,grants:t.sbx.filesystem,...n.linkedGitDir!==void 0?{linkedGitDir:n.linkedGitDir}:{}}),r={sbxBin:n.sbxBin,name:Ur(yl(n.stateDir),i),cwd:n.cwd,home:n.home,mounts:i,...e!==void 0?{network:e}:{},piVersion:null,tty:n.tty};return{spec:r,hostPiBin:n.hostPiBin,createArgv:Yr(r),policyArgvs:Jr(r),provisionArgv:vn(r)}}function Gl(e,t,n,i){if(!e)return null;let r=vr(i.cwd,i.home);if(r!==void 0)throw Error(`cannot sandbox from ${r} \u2014 this directory is (or contains) nono's protected state root `+"(~/.local/state/nono) and nono refuses to start with an overlapping grant; run `cradle run` from a project directory instead");let s=$r({home:i.home,cwd:i.cwd,agentDir:t.dir,stateDir:i.stateDir,grants:t.sandbox.filesystem,rules:t.sandbox.unsafeMacosSeatbeltRules,...n!==void 0?{network:n}:{},...i.linkedGitDir!==void 0?{linkedGitDir:i.linkedGitDir}:{}});return{path:i.profilePath,content:s}}function Vl(e,t){return[...e.providersJson!==null?[{rel:"providers.ts",content:Qr(e.providersJson,{rewriteLocalhostBaseUrls:t==="sbx"})}]:[],...t==="nono"?[{rel:Ut,content:Ar()}]:[]]}function Os(e,t){return t?`\x1B[33m${e}\x1B[0m`:e}function js(e,t){return()=>{e.kill(t)}}async function vs(e,t={}){let[n,...i]=e;if(!n)throw Error("Command requires at least one argument");let r=Bun.spawn([n,...i],{stdin:"inherit",stdout:"inherit",stderr:"inherit",env:{...process.env,...t}}),s=js(r,"SIGINT"),o=js(r,"SIGTERM");process.on("SIGINT",s),process.on("SIGTERM",o);try{return await r.exited}finally{process.off("SIGINT",s),process.off("SIGTERM",o)}}async function $s(e){let[t,...n]=e;if(!t)throw Error("Command requires at least one argument");let i=Bun.spawn([t,...n],{stdin:"ignore",stdout:"ignore",stderr:"pipe",env:process.env}),[r,s]=await Promise.all([new Response(i.stderr).text(),i.exited]);return{exitCode:s,stderr:r}}async function ks(e,t){let[n,...i]=e;if(!n)throw Error("Command requires at least one argument");let s=await Bun.spawn([n,...i],{cwd:t,stdin:"ignore",stdout:"inherit",stderr:"inherit",env:process.env}).exited;if(s!==0)throw Error(`Package install failed (${e.join(" ")} exited ${String(s)})`)}var Bt=xr(process.argv.slice(2)).scriptName("cradle").version(wr.version).usage("$0 <cmd> [args]").parserConfiguration({"populate--":!0,"parse-numbers":!1,"parse-positional-numbers":!1}).strict();Bt.command("$0","show help",()=>{},async()=>{console.log(await Bt.getHelp())});Bt.command("run [dir]","run an agent folder with pi, sandboxed when sandbox/nono.json or sandbox/sbx.json is present",(e)=>e.positional("dir",{type:"string",default:".",describe:"agent folder, or a name from ~/.cradle/settings.json (default: .)"}).option("offline",{type:"boolean",description:"block all outbound network (overrides the folder network policy; implies --sandbox)"}).option("allow-host",{type:"array",string:!0,description:"restrict network to these hosts (repeatable; overrides the folder allowlist; implies --sandbox)"}).option("sandbox",{type:"boolean",description:"run sandboxed (--sandbox forces it when no sandbox/ file enables one or the folder opts out; --no-sandbox disables)"}).option("sandbox-backend",{type:"string",choices:["nono","sbx"],description:"sandbox implementation (implies --sandbox): nono (host OS policy) or sbx (Docker Sandboxes microVM)"}).option("verbose",{type:"boolean",default:!1,description:"show nono's full sandbox capabilities banner instead of the one-line status"}).option("dry-run",{type:"boolean",default:!1,description:"print the write plan + command, do not spawn"}).epilogue("Everything after `--` is forwarded to pi."),async(e)=>{let t=(e["--"]??[]).map(String),n=(e.allowHost??[]).map(String),i={dir:e.dir,dryRun:e.dryRun,...e.sandbox!==void 0?{noSandbox:!e.sandbox}:{},...e.sandboxBackend!==void 0?{sandboxBackend:e.sandboxBackend}:{},...e.offline?{offline:!0}:{},...n.length?{allowHost:n}:{},...e.verbose?{verbose:!0}:{},...t.length?{passthrough:t}:{}};await Hl(i)});Bt.command("doctor","check pi / nono / mise on PATH",()=>{},async()=>{let e=await Br({readVersion:Is});console.log(Pr(e)),process.exitCode=Or(e)});async function Hl(e){try{let t=await Bs(e,{tty:process.stdout.isTTY});if(Ms(t.warnings),t.dryRun){zl(t);return}let n=await Ps(t,{install:ks,run:$s,readPiVersion:Is});if(Ms(n.warnings),t.profile!==null&&!e.verbose)console.log("\uD83D\uDD12 Sandbox Active");if(t.sbx!==null&&!e.verbose)console.log("\uD83D\uDD12 Sandbox Active (sbx)");process.exit(await vs(n.argv,On(t.launch)))}catch(t){Jl(t)}}function zl(e){for(let i of e.files)console.log(`write: ${Ns(e.extensionsDir,i.rel)}`);if(e.profile!==null)console.log(`write: ${e.profile.path}`);if(e.sbx!==null)Ul(e.sbx);if(e.packages!==null)Yl(e.packages);let t=Object.entries(On(e.launch)).map(([i,r])=>`${i}=${Dt(r)}`),n=e.sbx!==null?Xt(e.sbx.spec,ft(e.launch)):ft(e.launch);console.log([...t,...n.map(Dt)].join(" "))}function Ul(e){console.log(`create: ${e.createArgv.map(Dt).join(" ")}`);for(let t of e.policyArgvs)console.log(`policy: ${t.map(Dt).join(" ")}`);console.log(`provision: ${e.provisionArgv.map(Dt).join(" ")}`)}function Yl(e){console.log(`write: ${Ns(e.npmDir,"package.json")}`);let t=e.specs.map((n)=>`${n.name}@${n.version}`).join(", ");console.log(`install: ${e.installCommand.join(" ")} (${e.npmDir}): ${t}`)}function Ms(e){let t=process.stderr.isTTY;for(let n of e)console.error(Os(`warning: ${n}`,t))}async function Is(e,t=["--version"]){try{let n=Bun.spawn([e,...t],{stdout:"pipe",stderr:"ignore"}),[i,r]=await Promise.all([new Response(n.stdout).text(),n.exited]);if(r!==0)return null;return i.split(`
112
+ `)[0]?.match(/v?\d+\.\d+\S*/)?.[0]??null}catch{return null}}function Jl(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}Bt.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coryrylan/cradle",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A runtime for portable agents defined as folders — launches the pi coding agent configured from an agent folder, sandboxed with nono",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -45,7 +45,7 @@
45
45
  },
46
46
  "homepage": "https://github.com/coryrylan/cradle/tree/main/projects/cli#readme",
47
47
  "engines": {
48
- "bun": ">=1.3.0"
48
+ "bun": ">=1.4.0"
49
49
  },
50
50
  "publishConfig": {
51
51
  "access": "public"
@@ -220,17 +220,17 @@
220
220
  }
221
221
  },
222
222
  "dependencies": {
223
- "yargs": "^18.0.0"
223
+ "yargs": "^18.1.0"
224
224
  },
225
225
  "devDependencies": {
226
- "@coryrylan/tools": "1.1.0",
226
+ "@coryrylan/tools": "1.1.1",
227
227
  "@eslint/js": "10.0.1",
228
- "@eslint/json": "1.2.0",
229
- "@types/bun": "1.3.14",
228
+ "@eslint/json": "2.0.1",
229
+ "@types/bun": "1.4.0",
230
230
  "@types/yargs": "17.0.35",
231
- "eslint": "10.6.0",
232
- "eslint-plugin-jsdoc": "63.2.0",
231
+ "eslint": "10.9.1",
232
+ "eslint-plugin-jsdoc": "64.2.1",
233
233
  "typescript": "6.0.3",
234
- "typescript-eslint": "8.62.1"
234
+ "typescript-eslint": "8.68.0"
235
235
  }
236
236
  }