gemkit-cli 0.2.1 → 0.2.3
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/README.md +15 -2
- package/dist/index.js +134 -45
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var hA=Object.create;var Cc=Object.defineProperty;var fA=Object.getOwnPropertyDescriptor;var zA=Object.getOwnPropertyNames;var RA=Object.getPrototypeOf,dA=Object.prototype.hasOwnProperty;var qn=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var jA=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of zA(e))!dA.call(t,r)&&r!==i&&Cc(t,r,{get:()=>e[r],enumerable:!(n=fA(e,r))||n.enumerable});return t};var Dn=(t,e,i)=>(i=t!=null?hA(RA(t)):{},jA(e||!t||!t.__esModule?Cc(i,"default",{value:t,enumerable:!0}):i,t));var $c=qn((xp,o7)=>{o7.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var va=qn((Gp,tl)=>{"use strict";var ir=Object.assign({},$c()),el=Object.keys(ir);Object.defineProperty(ir,"random",{get(){let t=Math.floor(Math.random()*el.length),e=el[t];return ir[e]}});tl.exports=ir});var sl=qn((Qp,al)=>{al.exports=()=>/[#*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 H3=qn((xR,bs)=>{var Io=process||{},T3=Io.argv||[],Eo=Io.env||{},Tu=!(Eo.NO_COLOR||T3.includes("--no-color"))&&(!!Eo.FORCE_COLOR||T3.includes("--color")||Io.platform==="win32"||(Io.stdout||{}).isTTY&&Eo.TERM!=="dumb"||!!Eo.CI),Xu=(t,e,i=t)=>n=>{let r=""+n,o=r.indexOf(e,t.length);return~o?t+Hu(r,e,i,o)+e:t+r+e},Hu=(t,e,i,n)=>{let r="",o=0;do r+=t.substring(o,n)+i,o=n+e.length,n=t.indexOf(e,o);while(~n);return r+t.substring(o)},X3=(t=Tu)=>{let e=t?Xu:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};bs.exports=X3();bs.exports.createColors=X3});import{EventEmitter as gA}from"events";function Xo(t){return t==null?[]:Array.isArray(t)?t:[t]}function xA(t,e,i,n){var r,o=t[e],a=~n.string.indexOf(e)?i==null||i===!0?"":String(i):typeof i=="boolean"?i:~n.boolean.indexOf(e)?i==="false"?!1:i==="true"||(t._.push((r=+i,r*0===0?r:i)),!!i):(r=+i,r*0===0?r:i);t[e]=o==null?a:Array.isArray(o)?o.concat(a):[o,a]}function GA(t,e){t=t||[],e=e||{};var i,n,r,o,a,c={_:[]},l=0,v=0,A=0,m=t.length;let I=e.alias!==void 0,E=e.unknown!==void 0,h=e.default!==void 0;if(e.alias=e.alias||{},e.string=Xo(e.string),e.boolean=Xo(e.boolean),I)for(i in e.alias)for(n=e.alias[i]=Xo(e.alias[i]),l=0;l<n.length;l++)(e.alias[n[l]]=n.concat(i)).splice(l,1);for(l=e.boolean.length;l-- >0;)for(n=e.alias[e.boolean[l]]||[],v=n.length;v-- >0;)e.boolean.push(n[v]);for(l=e.string.length;l-- >0;)for(n=e.alias[e.string[l]]||[],v=n.length;v-- >0;)e.string.push(n[v]);if(h){for(i in e.default)if(o=typeof e.default[i],n=e.alias[i]=e.alias[i]||[],e[o]!==void 0)for(e[o].push(i),l=0;l<n.length;l++)e[o].push(n[l])}let d=E?Object.keys(e.alias):[];for(l=0;l<m;l++){if(r=t[l],r==="--"){c._=c._.concat(t.slice(++l));break}for(v=0;v<r.length&&r.charCodeAt(v)===45;v++);if(v===0)c._.push(r);else if(r.substring(v,v+3)==="no-"){if(o=r.substring(v+3),E&&!~d.indexOf(o))return e.unknown(r);c[o]=!1}else{for(A=v+1;A<r.length&&r.charCodeAt(A)!==61;A++);for(o=r.substring(v,A),a=r.substring(++A)||l+1===m||(""+t[l+1]).charCodeAt(0)===45||t[++l],n=v===2?[o]:o,A=0;A<n.length;A++){if(o=n[A],E&&!~d.indexOf(o))return e.unknown("-".repeat(v)+o);xA(c,o,A+1<n.length||a,e)}}}if(h)for(i in e.default)c[i]===void 0&&(c[i]=e.default[i]);if(I)for(i in c)for(n=e.alias[i]||[];n.length>0;)c[n.shift()]=c[i];return c}var Kc=t=>t.replace(/[<[].+/,"").trim(),SA=t=>{let e=/<([^>]+)>/g,i=/\[([^\]]+)\]/g,n=[],r=c=>{let l=!1,v=c[1];return v.startsWith("...")&&(v=v.slice(3),l=!0),{required:c[0].startsWith("<"),value:v,variadic:l}},o;for(;o=e.exec(t);)n.push(r(o));let a;for(;a=i.exec(t);)n.push(r(a));return n},YA=t=>{let e={alias:{},boolean:[]};for(let[i,n]of t.entries())n.names.length>1&&(e.alias[n.names[0]]=n.names.slice(1)),n.isBoolean&&(n.negated&&t.some((o,a)=>a!==i&&o.names.some(c=>n.names.includes(c))&&typeof o.required=="boolean")||e.boolean.push(n.names[0]));return e},Oc=t=>t.sort((e,i)=>e.length>i.length?-1:1)[0],Uc=(t,e)=>t.length>=e?t:`${t}${" ".repeat(e-t.length)}`,WA=t=>t.replace(/([a-z])-([a-z])/g,(e,i,n)=>i+n.toUpperCase()),MA=(t,e,i)=>{let n=0,r=e.length,o=t,a;for(;n<r;++n)a=o[e[n]],o=o[e[n]]=n===r-1?i:a??(~e[n+1].indexOf(".")||!(+e[n+1]>-1)?{}:[])},CA=(t,e)=>{for(let i of Object.keys(e)){let n=e[i];n.shouldTransform&&(t[i]=Array.prototype.concat.call([],t[i]),typeof n.transformFunction=="function"&&(t[i]=t[i].map(n.transformFunction)))}},OA=t=>{let e=/([^\\\/]+)$/.exec(t);return e?e[1]:""},Vc=t=>t.split(".").map((e,i)=>i===0?WA(e):e).join("."),qi=class extends Error{constructor(e){super(e),this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}},Ho=class{constructor(e,i,n){this.rawName=e,this.description=i,this.config=Object.assign({},n),e=e.replace(/\.\*/g,""),this.negated=!1,this.names=Kc(e).split(",").map(r=>{let o=r.trim().replace(/^-{1,2}/,"");return o.startsWith("no-")&&(this.negated=!0,o=o.replace(/^no-/,"")),Vc(o)}).sort((r,o)=>r.length>o.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null&&(this.config.default=!0),e.includes("<")?this.required=!0:e.includes("[")?this.required=!1:this.isBoolean=!0}},UA=process.argv,KA=`${process.platform}-${process.arch} node-${process.version}`,wn=class{constructor(e,i,n={},r){this.rawName=e,this.description=i,this.config=n,this.cli=r,this.options=[],this.aliasNames=[],this.name=Kc(e),this.args=SA(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,i="-v, --version"){return this.versionNumber=e,this.option(i,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,i,n){let r=new Ho(e,i,n);return this.options.push(r),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof Tn}hasOption(e){return e=e.split(".")[0],this.options.find(i=>i.names.includes(e))}outputHelp(){let{name:e,commands:i}=this.cli,{versionNumber:n,options:r,helpCallback:o}=this.cli.globalCommand,a=[{body:`${e}${n?`/${n}`:""}`}];if(a.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&i.length>0){let v=Oc(i.map(A=>A.rawName));a.push({title:"Commands",body:i.map(A=>` ${Uc(A.rawName,v.length)} ${A.description}`).join(`
|
|
2
|
+
var HA=Object.create;var $c=Object.defineProperty;var LA=Object.getOwnPropertyDescriptor;var _A=Object.getOwnPropertyNames;var $A=Object.getPrototypeOf,eu=Object.prototype.hasOwnProperty;var er=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var tu=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of _A(e))!eu.call(t,r)&&r!==i&&$c(t,r,{get:()=>e[r],enumerable:!(n=LA(e,r))||n.enumerable});return t};var tr=(t,e,i)=>(i=t!=null?HA($A(t)):{},tu(e||!t||!t.__esModule?$c(i,"default",{value:t,enumerable:!0}):i,t));var gl=er((Qf,Qu)=>{Qu.exports={dots:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"]},dots2:{interval:80,frames:["\u28FE","\u28FD","\u28FB","\u28BF","\u287F","\u28DF","\u28EF","\u28F7"]},dots3:{interval:80,frames:["\u280B","\u2819","\u281A","\u281E","\u2816","\u2826","\u2834","\u2832","\u2833","\u2813"]},dots4:{interval:80,frames:["\u2804","\u2806","\u2807","\u280B","\u2819","\u2838","\u2830","\u2820","\u2830","\u2838","\u2819","\u280B","\u2807","\u2806"]},dots5:{interval:80,frames:["\u280B","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B"]},dots6:{interval:80,frames:["\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2834","\u2832","\u2812","\u2802","\u2802","\u2812","\u281A","\u2819","\u2809","\u2801"]},dots7:{interval:80,frames:["\u2808","\u2809","\u280B","\u2813","\u2812","\u2810","\u2810","\u2812","\u2816","\u2826","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808"]},dots8:{interval:80,frames:["\u2801","\u2801","\u2809","\u2819","\u281A","\u2812","\u2802","\u2802","\u2812","\u2832","\u2834","\u2824","\u2804","\u2804","\u2824","\u2820","\u2820","\u2824","\u2826","\u2816","\u2812","\u2810","\u2810","\u2812","\u2813","\u280B","\u2809","\u2808","\u2808"]},dots9:{interval:80,frames:["\u28B9","\u28BA","\u28BC","\u28F8","\u28C7","\u2867","\u2857","\u284F"]},dots10:{interval:80,frames:["\u2884","\u2882","\u2881","\u2841","\u2848","\u2850","\u2860"]},dots11:{interval:100,frames:["\u2801","\u2802","\u2804","\u2840","\u2880","\u2820","\u2810","\u2808"]},dots12:{interval:80,frames:["\u2880\u2800","\u2840\u2800","\u2804\u2800","\u2882\u2800","\u2842\u2800","\u2805\u2800","\u2883\u2800","\u2843\u2800","\u280D\u2800","\u288B\u2800","\u284B\u2800","\u280D\u2801","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2888\u2829","\u2840\u2899","\u2804\u2859","\u2882\u2829","\u2842\u2898","\u2805\u2858","\u2883\u2828","\u2843\u2890","\u280D\u2850","\u288B\u2820","\u284B\u2880","\u280D\u2841","\u288B\u2801","\u284B\u2801","\u280D\u2809","\u280B\u2809","\u280B\u2809","\u2809\u2819","\u2809\u2819","\u2809\u2829","\u2808\u2899","\u2808\u2859","\u2808\u2829","\u2800\u2899","\u2800\u2859","\u2800\u2829","\u2800\u2898","\u2800\u2858","\u2800\u2828","\u2800\u2890","\u2800\u2850","\u2800\u2820","\u2800\u2880","\u2800\u2840"]},dots13:{interval:80,frames:["\u28FC","\u28F9","\u28BB","\u283F","\u285F","\u28CF","\u28E7","\u28F6"]},dots8Bit:{interval:80,frames:["\u2800","\u2801","\u2802","\u2803","\u2804","\u2805","\u2806","\u2807","\u2840","\u2841","\u2842","\u2843","\u2844","\u2845","\u2846","\u2847","\u2808","\u2809","\u280A","\u280B","\u280C","\u280D","\u280E","\u280F","\u2848","\u2849","\u284A","\u284B","\u284C","\u284D","\u284E","\u284F","\u2810","\u2811","\u2812","\u2813","\u2814","\u2815","\u2816","\u2817","\u2850","\u2851","\u2852","\u2853","\u2854","\u2855","\u2856","\u2857","\u2818","\u2819","\u281A","\u281B","\u281C","\u281D","\u281E","\u281F","\u2858","\u2859","\u285A","\u285B","\u285C","\u285D","\u285E","\u285F","\u2820","\u2821","\u2822","\u2823","\u2824","\u2825","\u2826","\u2827","\u2860","\u2861","\u2862","\u2863","\u2864","\u2865","\u2866","\u2867","\u2828","\u2829","\u282A","\u282B","\u282C","\u282D","\u282E","\u282F","\u2868","\u2869","\u286A","\u286B","\u286C","\u286D","\u286E","\u286F","\u2830","\u2831","\u2832","\u2833","\u2834","\u2835","\u2836","\u2837","\u2870","\u2871","\u2872","\u2873","\u2874","\u2875","\u2876","\u2877","\u2838","\u2839","\u283A","\u283B","\u283C","\u283D","\u283E","\u283F","\u2878","\u2879","\u287A","\u287B","\u287C","\u287D","\u287E","\u287F","\u2880","\u2881","\u2882","\u2883","\u2884","\u2885","\u2886","\u2887","\u28C0","\u28C1","\u28C2","\u28C3","\u28C4","\u28C5","\u28C6","\u28C7","\u2888","\u2889","\u288A","\u288B","\u288C","\u288D","\u288E","\u288F","\u28C8","\u28C9","\u28CA","\u28CB","\u28CC","\u28CD","\u28CE","\u28CF","\u2890","\u2891","\u2892","\u2893","\u2894","\u2895","\u2896","\u2897","\u28D0","\u28D1","\u28D2","\u28D3","\u28D4","\u28D5","\u28D6","\u28D7","\u2898","\u2899","\u289A","\u289B","\u289C","\u289D","\u289E","\u289F","\u28D8","\u28D9","\u28DA","\u28DB","\u28DC","\u28DD","\u28DE","\u28DF","\u28A0","\u28A1","\u28A2","\u28A3","\u28A4","\u28A5","\u28A6","\u28A7","\u28E0","\u28E1","\u28E2","\u28E3","\u28E4","\u28E5","\u28E6","\u28E7","\u28A8","\u28A9","\u28AA","\u28AB","\u28AC","\u28AD","\u28AE","\u28AF","\u28E8","\u28E9","\u28EA","\u28EB","\u28EC","\u28ED","\u28EE","\u28EF","\u28B0","\u28B1","\u28B2","\u28B3","\u28B4","\u28B5","\u28B6","\u28B7","\u28F0","\u28F1","\u28F2","\u28F3","\u28F4","\u28F5","\u28F6","\u28F7","\u28B8","\u28B9","\u28BA","\u28BB","\u28BC","\u28BD","\u28BE","\u28BF","\u28F8","\u28F9","\u28FA","\u28FB","\u28FC","\u28FD","\u28FE","\u28FF"]},sand:{interval:80,frames:["\u2801","\u2802","\u2804","\u2840","\u2848","\u2850","\u2860","\u28C0","\u28C1","\u28C2","\u28C4","\u28CC","\u28D4","\u28E4","\u28E5","\u28E6","\u28EE","\u28F6","\u28F7","\u28FF","\u287F","\u283F","\u289F","\u281F","\u285B","\u281B","\u282B","\u288B","\u280B","\u280D","\u2849","\u2809","\u2811","\u2821","\u2881"]},line:{interval:130,frames:["-","\\","|","/"]},line2:{interval:100,frames:["\u2802","-","\u2013","\u2014","\u2013","-"]},pipe:{interval:100,frames:["\u2524","\u2518","\u2534","\u2514","\u251C","\u250C","\u252C","\u2510"]},simpleDots:{interval:400,frames:[". ",".. ","..."," "]},simpleDotsScrolling:{interval:200,frames:[". ",".. ","..."," .."," ."," "]},star:{interval:70,frames:["\u2736","\u2738","\u2739","\u273A","\u2739","\u2737"]},star2:{interval:80,frames:["+","x","*"]},flip:{interval:70,frames:["_","_","_","-","`","`","'","\xB4","-","_","_","_"]},hamburger:{interval:100,frames:["\u2631","\u2632","\u2634"]},growVertical:{interval:120,frames:["\u2581","\u2583","\u2584","\u2585","\u2586","\u2587","\u2586","\u2585","\u2584","\u2583"]},growHorizontal:{interval:120,frames:["\u258F","\u258E","\u258D","\u258C","\u258B","\u258A","\u2589","\u258A","\u258B","\u258C","\u258D","\u258E"]},balloon:{interval:140,frames:[" ",".","o","O","@","*"," "]},balloon2:{interval:120,frames:[".","o","O","\xB0","O","o","."]},noise:{interval:100,frames:["\u2593","\u2592","\u2591"]},bounce:{interval:120,frames:["\u2801","\u2802","\u2804","\u2802"]},boxBounce:{interval:120,frames:["\u2596","\u2598","\u259D","\u2597"]},boxBounce2:{interval:100,frames:["\u258C","\u2580","\u2590","\u2584"]},triangle:{interval:50,frames:["\u25E2","\u25E3","\u25E4","\u25E5"]},binary:{interval:80,frames:["010010","001100","100101","111010","111101","010111","101011","111000","110011","110101"]},arc:{interval:100,frames:["\u25DC","\u25E0","\u25DD","\u25DE","\u25E1","\u25DF"]},circle:{interval:120,frames:["\u25E1","\u2299","\u25E0"]},squareCorners:{interval:180,frames:["\u25F0","\u25F3","\u25F2","\u25F1"]},circleQuarters:{interval:120,frames:["\u25F4","\u25F7","\u25F6","\u25F5"]},circleHalves:{interval:50,frames:["\u25D0","\u25D3","\u25D1","\u25D2"]},squish:{interval:100,frames:["\u256B","\u256A"]},toggle:{interval:250,frames:["\u22B6","\u22B7"]},toggle2:{interval:80,frames:["\u25AB","\u25AA"]},toggle3:{interval:120,frames:["\u25A1","\u25A0"]},toggle4:{interval:100,frames:["\u25A0","\u25A1","\u25AA","\u25AB"]},toggle5:{interval:100,frames:["\u25AE","\u25AF"]},toggle6:{interval:300,frames:["\u101D","\u1040"]},toggle7:{interval:80,frames:["\u29BE","\u29BF"]},toggle8:{interval:100,frames:["\u25CD","\u25CC"]},toggle9:{interval:100,frames:["\u25C9","\u25CE"]},toggle10:{interval:100,frames:["\u3282","\u3280","\u3281"]},toggle11:{interval:50,frames:["\u29C7","\u29C6"]},toggle12:{interval:120,frames:["\u2617","\u2616"]},toggle13:{interval:80,frames:["=","*","-"]},arrow:{interval:100,frames:["\u2190","\u2196","\u2191","\u2197","\u2192","\u2198","\u2193","\u2199"]},arrow2:{interval:80,frames:["\u2B06\uFE0F ","\u2197\uFE0F ","\u27A1\uFE0F ","\u2198\uFE0F ","\u2B07\uFE0F ","\u2199\uFE0F ","\u2B05\uFE0F ","\u2196\uFE0F "]},arrow3:{interval:120,frames:["\u25B9\u25B9\u25B9\u25B9\u25B9","\u25B8\u25B9\u25B9\u25B9\u25B9","\u25B9\u25B8\u25B9\u25B9\u25B9","\u25B9\u25B9\u25B8\u25B9\u25B9","\u25B9\u25B9\u25B9\u25B8\u25B9","\u25B9\u25B9\u25B9\u25B9\u25B8"]},bouncingBar:{interval:80,frames:["[ ]","[= ]","[== ]","[=== ]","[====]","[ ===]","[ ==]","[ =]","[ ]","[ =]","[ ==]","[ ===]","[====]","[=== ]","[== ]","[= ]"]},bouncingBall:{interval:80,frames:["( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF)","( \u25CF )","( \u25CF )","( \u25CF )","( \u25CF )","(\u25CF )"]},smiley:{interval:200,frames:["\u{1F604} ","\u{1F61D} "]},monkey:{interval:300,frames:["\u{1F648} ","\u{1F648} ","\u{1F649} ","\u{1F64A} "]},hearts:{interval:100,frames:["\u{1F49B} ","\u{1F499} ","\u{1F49C} ","\u{1F49A} ","\u2764\uFE0F "]},clock:{interval:100,frames:["\u{1F55B} ","\u{1F550} ","\u{1F551} ","\u{1F552} ","\u{1F553} ","\u{1F554} ","\u{1F555} ","\u{1F556} ","\u{1F557} ","\u{1F558} ","\u{1F559} ","\u{1F55A} "]},earth:{interval:180,frames:["\u{1F30D} ","\u{1F30E} ","\u{1F30F} "]},material:{interval:17,frames:["\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2588","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581","\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581\u2581"]},moon:{interval:80,frames:["\u{1F311} ","\u{1F312} ","\u{1F313} ","\u{1F314} ","\u{1F315} ","\u{1F316} ","\u{1F317} ","\u{1F318} "]},runner:{interval:140,frames:["\u{1F6B6} ","\u{1F3C3} "]},pong:{interval:80,frames:["\u2590\u2802 \u258C","\u2590\u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802\u258C","\u2590 \u2820\u258C","\u2590 \u2840\u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590 \u2820 \u258C","\u2590 \u2802 \u258C","\u2590 \u2808 \u258C","\u2590 \u2802 \u258C","\u2590 \u2820 \u258C","\u2590 \u2840 \u258C","\u2590\u2820 \u258C"]},shark:{interval:120,frames:["\u2590|\\____________\u258C","\u2590_|\\___________\u258C","\u2590__|\\__________\u258C","\u2590___|\\_________\u258C","\u2590____|\\________\u258C","\u2590_____|\\_______\u258C","\u2590______|\\______\u258C","\u2590_______|\\_____\u258C","\u2590________|\\____\u258C","\u2590_________|\\___\u258C","\u2590__________|\\__\u258C","\u2590___________|\\_\u258C","\u2590____________|\\\u258C","\u2590____________/|\u258C","\u2590___________/|_\u258C","\u2590__________/|__\u258C","\u2590_________/|___\u258C","\u2590________/|____\u258C","\u2590_______/|_____\u258C","\u2590______/|______\u258C","\u2590_____/|_______\u258C","\u2590____/|________\u258C","\u2590___/|_________\u258C","\u2590__/|__________\u258C","\u2590_/|___________\u258C","\u2590/|____________\u258C"]},dqpb:{interval:100,frames:["d","q","p","b"]},weather:{interval:100,frames:["\u2600\uFE0F ","\u2600\uFE0F ","\u2600\uFE0F ","\u{1F324} ","\u26C5\uFE0F ","\u{1F325} ","\u2601\uFE0F ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u26C8 ","\u{1F328} ","\u{1F327} ","\u{1F328} ","\u2601\uFE0F ","\u{1F325} ","\u26C5\uFE0F ","\u{1F324} ","\u2600\uFE0F ","\u2600\uFE0F "]},christmas:{interval:400,frames:["\u{1F332}","\u{1F384}"]},grenade:{interval:80,frames:["\u060C ","\u2032 "," \xB4 "," \u203E "," \u2E0C"," \u2E0A"," |"," \u204E"," \u2055"," \u0DF4 "," \u2053"," "," "," "]},point:{interval:125,frames:["\u2219\u2219\u2219","\u25CF\u2219\u2219","\u2219\u25CF\u2219","\u2219\u2219\u25CF","\u2219\u2219\u2219"]},layer:{interval:150,frames:["-","=","\u2261"]},betaWave:{interval:80,frames:["\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1\u03B2","\u03B2\u03B2\u03B2\u03B2\u03B2\u03B2\u03C1"]},fingerDance:{interval:160,frames:["\u{1F918} ","\u{1F91F} ","\u{1F596} ","\u270B ","\u{1F91A} ","\u{1F446} "]},fistBump:{interval:80,frames:["\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u{1F91C}\u3000\u3000\u3000\u3000\u{1F91B} ","\u3000\u{1F91C}\u3000\u3000\u{1F91B}\u3000 ","\u3000\u3000\u{1F91C}\u{1F91B}\u3000\u3000 ","\u3000\u{1F91C}\u2728\u{1F91B}\u3000\u3000 ","\u{1F91C}\u3000\u2728\u3000\u{1F91B}\u3000 "]},soccerHeader:{interval:80,frames:[" \u{1F9D1}\u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F\u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} ","\u{1F9D1} \u26BD\uFE0F \u{1F9D1} "]},mindblown:{interval:160,frames:["\u{1F610} ","\u{1F610} ","\u{1F62E} ","\u{1F62E} ","\u{1F626} ","\u{1F626} ","\u{1F627} ","\u{1F627} ","\u{1F92F} ","\u{1F4A5} ","\u2728 ","\u3000 ","\u3000 ","\u3000 "]},speaker:{interval:160,frames:["\u{1F508} ","\u{1F509} ","\u{1F50A} ","\u{1F509} "]},orangePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} "]},bluePulse:{interval:100,frames:["\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},orangeBluePulse:{interval:100,frames:["\u{1F538} ","\u{1F536} ","\u{1F7E0} ","\u{1F7E0} ","\u{1F536} ","\u{1F539} ","\u{1F537} ","\u{1F535} ","\u{1F535} ","\u{1F537} "]},timeTravel:{interval:100,frames:["\u{1F55B} ","\u{1F55A} ","\u{1F559} ","\u{1F558} ","\u{1F557} ","\u{1F556} ","\u{1F555} ","\u{1F554} ","\u{1F553} ","\u{1F552} ","\u{1F551} ","\u{1F550} "]},aesthetic:{interval:80,frames:["\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B1","\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0\u25B0","\u25B0\u25B1\u25B1\u25B1\u25B1\u25B1\u25B1"]},dwarfFortress:{interval:80,frames:[" \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A\u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 ","\u263A \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\u2588\xA3\xA3\xA3 "," \u263A \u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2588\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2593\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2592\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A\u2591\u2588\xA3\xA3\xA3 "," \u263A \u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2588\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2592\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A\u2591\xA3\xA3\xA3 "," \u263A \xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\xA3\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2593\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2592\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A\u2591\xA3\xA3 "," \u263A \xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\xA3\xA3 "," \u263A\u2593\xA3 "," \u263A\u2593\xA3 "," \u263A\u2592\xA3 "," \u263A\u2592\xA3 "," \u263A\u2591\xA3 "," \u263A\u2591\xA3 "," \u263A \xA3 "," \u263A\xA3 "," \u263A\xA3 "," \u263A\u2593 "," \u263A\u2593 "," \u263A\u2592 "," \u263A\u2592 "," \u263A\u2591 "," \u263A\u2591 "," \u263A "," \u263A &"," \u263A \u263C&"," \u263A \u263C &"," \u263A\u263C &"," \u263A\u263C & "," \u203C & "," \u263A & "," \u203C & "," \u263A & "," \u203C & "," \u263A & ","\u203C & "," & "," & "," & \u2591 "," & \u2592 "," & \u2593 "," & \xA3 "," & \u2591\xA3 "," & \u2592\xA3 "," & \u2593\xA3 "," & \xA3\xA3 "," & \u2591\xA3\xA3 "," & \u2592\xA3\xA3 ","& \u2593\xA3\xA3 ","& \xA3\xA3\xA3 "," \u2591\xA3\xA3\xA3 "," \u2592\xA3\xA3\xA3 "," \u2593\xA3\xA3\xA3 "," \u2588\xA3\xA3\xA3 "," \u2591\u2588\xA3\xA3\xA3 "," \u2592\u2588\xA3\xA3\xA3 "," \u2593\u2588\xA3\xA3\xA3 "," \u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2591\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2592\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2593\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "," \u2588\u2588\u2588\u2588\u2588\u2588\xA3\xA3\xA3 "]}}});var Os=er((bf,xl)=>{"use strict";var ur=Object.assign({},gl()),jl=Object.keys(ur);Object.defineProperty(ur,"random",{get(){let t=Math.floor(Math.random()*jl.length),e=jl[t];return ur[e]}});xl.exports=ur});var Cl=er((_f,Ml)=>{Ml.exports=()=>/[#*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 fv=er((Fz,lc)=>{var Wo=process||{},pv=Wo.argv||[],Yo=Wo.env||{},YE=!(Yo.NO_COLOR||pv.includes("--no-color"))&&(!!Yo.FORCE_COLOR||pv.includes("--color")||Wo.platform==="win32"||(Wo.stdout||{}).isTTY&&Yo.TERM!=="dumb"||!!Yo.CI),WE=(t,e,i=t)=>n=>{let r=""+n,o=r.indexOf(e,t.length);return~o?t+ME(r,e,i,o)+e:t+r+e},ME=(t,e,i,n)=>{let r="",o=0;do r+=t.substring(o,n)+i,o=n+e.length,n=t.indexOf(e,o);while(~n);return r+t.substring(o)},Iv=(t=YE)=>{let e=t?WE:()=>String;return{isColorSupported:t,reset:e("\x1B[0m","\x1B[0m"),bold:e("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:e("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:e("\x1B[3m","\x1B[23m"),underline:e("\x1B[4m","\x1B[24m"),inverse:e("\x1B[7m","\x1B[27m"),hidden:e("\x1B[8m","\x1B[28m"),strikethrough:e("\x1B[9m","\x1B[29m"),black:e("\x1B[30m","\x1B[39m"),red:e("\x1B[31m","\x1B[39m"),green:e("\x1B[32m","\x1B[39m"),yellow:e("\x1B[33m","\x1B[39m"),blue:e("\x1B[34m","\x1B[39m"),magenta:e("\x1B[35m","\x1B[39m"),cyan:e("\x1B[36m","\x1B[39m"),white:e("\x1B[37m","\x1B[39m"),gray:e("\x1B[90m","\x1B[39m"),bgBlack:e("\x1B[40m","\x1B[49m"),bgRed:e("\x1B[41m","\x1B[49m"),bgGreen:e("\x1B[42m","\x1B[49m"),bgYellow:e("\x1B[43m","\x1B[49m"),bgBlue:e("\x1B[44m","\x1B[49m"),bgMagenta:e("\x1B[45m","\x1B[49m"),bgCyan:e("\x1B[46m","\x1B[49m"),bgWhite:e("\x1B[47m","\x1B[49m"),blackBright:e("\x1B[90m","\x1B[39m"),redBright:e("\x1B[91m","\x1B[39m"),greenBright:e("\x1B[92m","\x1B[39m"),yellowBright:e("\x1B[93m","\x1B[39m"),blueBright:e("\x1B[94m","\x1B[39m"),magentaBright:e("\x1B[95m","\x1B[39m"),cyanBright:e("\x1B[96m","\x1B[39m"),whiteBright:e("\x1B[97m","\x1B[39m"),bgBlackBright:e("\x1B[100m","\x1B[49m"),bgRedBright:e("\x1B[101m","\x1B[49m"),bgGreenBright:e("\x1B[102m","\x1B[49m"),bgYellowBright:e("\x1B[103m","\x1B[49m"),bgBlueBright:e("\x1B[104m","\x1B[49m"),bgMagentaBright:e("\x1B[105m","\x1B[49m"),bgCyanBright:e("\x1B[106m","\x1B[49m"),bgWhiteBright:e("\x1B[107m","\x1B[49m")}};lc.exports=Iv();lc.exports.createColors=Iv});import{EventEmitter as iu}from"events";function Is(t){return t==null?[]:Array.isArray(t)?t:[t]}function nu(t,e,i,n){var r,o=t[e],a=~n.string.indexOf(e)?i==null||i===!0?"":String(i):typeof i=="boolean"?i:~n.boolean.indexOf(e)?i==="false"?!1:i==="true"||(t._.push((r=+i,r*0===0?r:i)),!!i):(r=+i,r*0===0?r:i);t[e]=o==null?a:Array.isArray(o)?o.concat(a):[o,a]}function ru(t,e){t=t||[],e=e||{};var i,n,r,o,a,c={_:[]},l=0,v=0,A=0,u=t.length;let p=e.alias!==void 0,E=e.unknown!==void 0,f=e.default!==void 0;if(e.alias=e.alias||{},e.string=Is(e.string),e.boolean=Is(e.boolean),p)for(i in e.alias)for(n=e.alias[i]=Is(e.alias[i]),l=0;l<n.length;l++)(e.alias[n[l]]=n.concat(i)).splice(l,1);for(l=e.boolean.length;l-- >0;)for(n=e.alias[e.boolean[l]]||[],v=n.length;v-- >0;)e.boolean.push(n[v]);for(l=e.string.length;l-- >0;)for(n=e.alias[e.string[l]]||[],v=n.length;v-- >0;)e.string.push(n[v]);if(f){for(i in e.default)if(o=typeof e.default[i],n=e.alias[i]=e.alias[i]||[],e[o]!==void 0)for(e[o].push(i),l=0;l<n.length;l++)e[o].push(n[l])}let d=E?Object.keys(e.alias):[];for(l=0;l<u;l++){if(r=t[l],r==="--"){c._=c._.concat(t.slice(++l));break}for(v=0;v<r.length&&r.charCodeAt(v)===45;v++);if(v===0)c._.push(r);else if(r.substring(v,v+3)==="no-"){if(o=r.substring(v+3),E&&!~d.indexOf(o))return e.unknown(r);c[o]=!1}else{for(A=v+1;A<r.length&&r.charCodeAt(A)!==61;A++);for(o=r.substring(v,A),a=r.substring(++A)||l+1===u||(""+t[l+1]).charCodeAt(0)===45||t[++l],n=v===2?[o]:o,A=0;A<n.length;A++){if(o=n[A],E&&!~d.indexOf(o))return e.unknown("-".repeat(v)+o);nu(c,o,A+1<n.length||a,e)}}}if(f)for(i in e.default)c[i]===void 0&&(c[i]=e.default[i]);if(p)for(i in c)for(n=e.alias[i]||[];n.length>0;)c[n.shift()]=c[i];return c}var il=t=>t.replace(/[<[].+/,"").trim(),ou=t=>{let e=/<([^>]+)>/g,i=/\[([^\]]+)\]/g,n=[],r=c=>{let l=!1,v=c[1];return v.startsWith("...")&&(v=v.slice(3),l=!0),{required:c[0].startsWith("<"),value:v,variadic:l}},o;for(;o=e.exec(t);)n.push(r(o));let a;for(;a=i.exec(t);)n.push(r(a));return n},su=t=>{let e={alias:{},boolean:[]};for(let[i,n]of t.entries())n.names.length>1&&(e.alias[n.names[0]]=n.names.slice(1)),n.isBoolean&&(n.negated&&t.some((o,a)=>a!==i&&o.names.some(c=>n.names.includes(c))&&typeof o.required=="boolean")||e.boolean.push(n.names[0]));return e},el=t=>t.sort((e,i)=>e.length>i.length?-1:1)[0],tl=(t,e)=>t.length>=e?t:`${t}${" ".repeat(e-t.length)}`,au=t=>t.replace(/([a-z])-([a-z])/g,(e,i,n)=>i+n.toUpperCase()),cu=(t,e,i)=>{let n=0,r=e.length,o=t,a;for(;n<r;++n)a=o[e[n]],o=o[e[n]]=n===r-1?i:a??(~e[n+1].indexOf(".")||!(+e[n+1]>-1)?{}:[])},lu=(t,e)=>{for(let i of Object.keys(e)){let n=e[i];n.shouldTransform&&(t[i]=Array.prototype.concat.call([],t[i]),typeof n.transformFunction=="function"&&(t[i]=t[i].map(n.transformFunction)))}},vu=t=>{let e=/([^\\\/]+)$/.exec(t);return e?e[1]:""},nl=t=>t.split(".").map((e,i)=>i===0?au(e):e).join("."),_i=class extends Error{constructor(e){super(e),this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(this,this.constructor):this.stack=new Error(e).stack}},fs=class{constructor(e,i,n){this.rawName=e,this.description=i,this.config=Object.assign({},n),e=e.replace(/\.\*/g,""),this.negated=!1,this.names=il(e).split(",").map(r=>{let o=r.trim().replace(/^-{1,2}/,"");return o.startsWith("no-")&&(this.negated=!0,o=o.replace(/^no-/,"")),nl(o)}).sort((r,o)=>r.length>o.length?1:-1),this.name=this.names[this.names.length-1],this.negated&&this.config.default==null&&(this.config.default=!0),e.includes("<")?this.required=!0:e.includes("[")?this.required=!1:this.isBoolean=!0}},Au=process.argv,uu=`${process.platform}-${process.arch} node-${process.version}`,nr=class{constructor(e,i,n={},r){this.rawName=e,this.description=i,this.config=n,this.cli=r,this.options=[],this.aliasNames=[],this.name=il(e),this.args=ou(e),this.examples=[]}usage(e){return this.usageText=e,this}allowUnknownOptions(){return this.config.allowUnknownOptions=!0,this}ignoreOptionDefaultValue(){return this.config.ignoreOptionDefaultValue=!0,this}version(e,i="-v, --version"){return this.versionNumber=e,this.option(i,"Display version number"),this}example(e){return this.examples.push(e),this}option(e,i,n){let r=new fs(e,i,n);return this.options.push(r),this}alias(e){return this.aliasNames.push(e),this}action(e){return this.commandAction=e,this}isMatched(e){return this.name===e||this.aliasNames.includes(e)}get isDefaultCommand(){return this.name===""||this.aliasNames.includes("!")}get isGlobalCommand(){return this instanceof rr}hasOption(e){return e=e.split(".")[0],this.options.find(i=>i.names.includes(e))}outputHelp(){let{name:e,commands:i}=this.cli,{versionNumber:n,options:r,helpCallback:o}=this.cli.globalCommand,a=[{body:`${e}${n?`/${n}`:""}`}];if(a.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&i.length>0){let v=el(i.map(A=>A.rawName));a.push({title:"Commands",body:i.map(A=>` ${tl(A.rawName,v.length)} ${A.description}`).join(`
|
|
3
3
|
`)}),a.push({title:"For more info, run any command with the `--help` flag",body:i.map(A=>` $ ${e}${A.name===""?"":` ${A.name}`} --help`).join(`
|
|
4
|
-
`)})}let l=this.isGlobalCommand?r:[...this.options,...r||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(l=l.filter(v=>v.name!=="version")),l.length>0){let v=
|
|
4
|
+
`)})}let l=this.isGlobalCommand?r:[...this.options,...r||[]];if(!this.isGlobalCommand&&!this.isDefaultCommand&&(l=l.filter(v=>v.name!=="version")),l.length>0){let v=el(l.map(A=>A.rawName));a.push({title:"Options",body:l.map(A=>` ${tl(A.rawName,v.length)} ${A.description} ${A.config.default===void 0?"":`(default: ${A.config.default})`}`).join(`
|
|
5
5
|
`)})}this.examples.length>0&&a.push({title:"Examples",body:this.examples.map(v=>typeof v=="function"?v(e):v).join(`
|
|
6
6
|
`)}),o&&(a=o(a)||a),console.log(a.map(v=>v.title?`${v.title}:
|
|
7
7
|
${v.body}`:v.body).join(`
|
|
8
8
|
|
|
9
|
-
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:i}=this.cli.globalCommand;i&&console.log(`${e}/${i} ${
|
|
9
|
+
`))}outputVersion(){let{name:e}=this.cli,{versionNumber:i}=this.cli.globalCommand;i&&console.log(`${e}/${i} ${uu}`)}checkRequiredArgs(){let e=this.args.filter(i=>i.required).length;if(this.cli.args.length<e)throw new _i(`missing required args for command \`${this.rawName}\``)}checkUnknownOptions(){let{options:e,globalCommand:i}=this.cli;if(!this.config.allowUnknownOptions){for(let n of Object.keys(e))if(n!=="--"&&!this.hasOption(n)&&!i.hasOption(n))throw new _i(`Unknown option \`${n.length>1?`--${n}`:`-${n}`}\``)}}checkOptionValue(){let{options:e,globalCommand:i}=this.cli,n=[...i.options,...this.options];for(let r of n){let o=e[r.name.split(".")[0]];if(r.required){let a=n.some(c=>c.negated&&c.names.includes(r.name));if(o===!0||o===!1&&!a)throw new _i(`option \`${r.rawName}\` value is missing`)}}}},rr=class extends nr{constructor(e){super("@@global@@","",{},e)}},ir=Object.assign,hs=class extends iu{constructor(e=""){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new rr(this),this.globalCommand.usage("<command> [options]")}usage(e){return this.globalCommand.usage(e),this}command(e,i,n){let r=new nr(e,i||"",n,this);return r.globalCommand=this.globalCommand,this.commands.push(r),r}option(e,i,n){return this.globalCommand.option(e,i,n),this}help(e){return this.globalCommand.option("-h, --help","Display this message"),this.globalCommand.helpCallback=e,this.showHelpOnExit=!0,this}version(e,i="-v, --version"){return this.globalCommand.version(e,i),this.showVersionOnExit=!0,this}example(e){return this.globalCommand.example(e),this}outputHelp(){this.matchedCommand?this.matchedCommand.outputHelp():this.globalCommand.outputHelp()}outputVersion(){this.globalCommand.outputVersion()}setParsedInfo({args:e,options:i},n,r){return this.args=e,this.options=i,n&&(this.matchedCommand=n),r&&(this.matchedCommandName=r),this}unsetMatchedCommand(){this.matchedCommand=void 0,this.matchedCommandName=void 0}parse(e=Au,{run:i=!0}={}){this.rawArgs=e,this.name||(this.name=e[1]?vu(e[1]):"cli");let n=!0;for(let o of this.commands){let a=this.mri(e.slice(2),o),c=a.args[0];if(o.isMatched(c)){n=!1;let l=ir(ir({},a),{args:a.args.slice(1)});this.setParsedInfo(l,o,c),this.emit(`command:${c}`,o)}}if(n){for(let o of this.commands)if(o.name===""){n=!1;let a=this.mri(e.slice(2),o);this.setParsedInfo(a,o),this.emit("command:!",o)}}if(n){let o=this.mri(e.slice(2));this.setParsedInfo(o)}this.options.help&&this.showHelpOnExit&&(this.outputHelp(),i=!1,this.unsetMatchedCommand()),this.options.version&&this.showVersionOnExit&&this.matchedCommandName==null&&(this.outputVersion(),i=!1,this.unsetMatchedCommand());let r={args:this.args,options:this.options};return i&&this.runMatchedCommand(),!this.matchedCommand&&this.args[0]&&this.emit("command:*"),r}mri(e,i){let n=[...this.globalCommand.options,...i?i.options:[]],r=su(n),o=[],a=e.indexOf("--");a>-1&&(o=e.slice(a+1),e=e.slice(0,a));let c=ru(e,r);c=Object.keys(c).reduce((p,E)=>ir(ir({},p),{[nl(E)]:c[E]}),{_:[]});let l=c._,v={"--":o},A=i&&i.config.ignoreOptionDefaultValue?i.config.ignoreOptionDefaultValue:this.globalCommand.config.ignoreOptionDefaultValue,u=Object.create(null);for(let p of n){if(!A&&p.config.default!==void 0)for(let E of p.names)v[E]=p.config.default;Array.isArray(p.config.type)&&u[p.name]===void 0&&(u[p.name]=Object.create(null),u[p.name].shouldTransform=!0,u[p.name].transformFunction=p.config.type[0])}for(let p of Object.keys(c))if(p!=="_"){let E=p.split(".");cu(v,E,c[p]),lu(v,u)}return{args:l,options:v}}runMatchedCommand(){let{args:e,options:i,matchedCommand:n}=this;if(!n||!n.commandAction)return;n.checkUnknownOptions(),n.checkOptionValue(),n.checkRequiredArgs();let r=[];return n.args.forEach((o,a)=>{o.variadic?r.push(e.slice(a)):r.push(e[a])}),r.push(i),n.commandAction.apply(this,r)}},rl=(t="")=>new hs(t);import{existsSync as XE}from"fs";import{join as HE}from"path";import{spawn as LE,spawnSync as _E}from"child_process";import mr from"node:process";var ol=(t=0)=>e=>`\x1B[${e+t}m`,sl=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,al=(t=0)=>(e,i,n)=>`\x1B[${38+t};2;${e};${i};${n}m`,S={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]}},vf=Object.keys(S.modifier),mu=Object.keys(S.color),Eu=Object.keys(S.bgColor),Af=[...mu,...Eu];function pu(){let t=new Map;for(let[e,i]of Object.entries(S)){for(let[n,r]of Object.entries(i))S[n]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},i[n]=S[n],t.set(r[0],r[1]);Object.defineProperty(S,e,{value:i,enumerable:!1})}return Object.defineProperty(S,"codes",{value:t,enumerable:!1}),S.color.close="\x1B[39m",S.bgColor.close="\x1B[49m",S.color.ansi=ol(),S.color.ansi256=sl(),S.color.ansi16m=al(),S.bgColor.ansi=ol(10),S.bgColor.ansi256=sl(10),S.bgColor.ansi16m=al(10),Object.defineProperties(S,{rgbToAnsi256:{value(e,i,n){return e===i&&i===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(i/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(e){let i=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!i)return[0,0,0];let[n]=i;n.length===3&&(n=[...n].map(o=>o+o).join(""));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>S.rgbToAnsi256(...S.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return 90+(e-8);let i,n,r;if(e>=232)i=((e-232)*10+8)/255,n=i,r=i;else{e-=16;let c=e%36;i=Math.floor(e/36)/5,n=Math.floor(c/6)/5,r=c%6/5}let o=Math.max(i,n,r)*2;if(o===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(i));return o===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,i,n)=>S.ansi256ToAnsi(S.rgbToAnsi256(e,i,n)),enumerable:!1},hexToAnsi:{value:e=>S.ansi256ToAnsi(S.hexToAnsi256(e)),enumerable:!1}}),S}var Iu=pu(),Re=Iu;import ds from"node:process";import fu from"node:os";import cl from"node:tty";function ue(t,e=globalThis.Deno?globalThis.Deno.args:ds.argv){let i=t.startsWith("-")?"":t.length===1?"-":"--",n=e.indexOf(i+t),r=e.indexOf("--");return n!==-1&&(r===-1||n<r)}var{env:Y}=ds,or;ue("no-color")||ue("no-colors")||ue("color=false")||ue("color=never")?or=0:(ue("color")||ue("colors")||ue("color=true")||ue("color=always"))&&(or=1);function hu(){if("FORCE_COLOR"in Y)return Y.FORCE_COLOR==="true"?1:Y.FORCE_COLOR==="false"?0:Y.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(Y.FORCE_COLOR,10),3)}function du(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function Ru(t,{streamIsTTY:e,sniffFlags:i=!0}={}){let n=hu();n!==void 0&&(or=n);let r=i?or:n;if(r===0)return 0;if(i){if(ue("color=16m")||ue("color=full")||ue("color=truecolor"))return 3;if(ue("color=256"))return 2}if("TF_BUILD"in Y&&"AGENT_NAME"in Y)return 1;if(t&&!e&&r===void 0)return 0;let o=r||0;if(Y.TERM==="dumb")return o;if(ds.platform==="win32"){let a=fu.release().split(".");return Number(a[0])>=10&&Number(a[2])>=10586?Number(a[2])>=14931?3:2:1}if("CI"in Y)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(a=>a in Y)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(a=>a in Y)||Y.CI_NAME==="codeship"?1:o;if("TEAMCITY_VERSION"in Y)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(Y.TEAMCITY_VERSION)?1:0;if(Y.COLORTERM==="truecolor"||Y.TERM==="xterm-kitty"||Y.TERM==="xterm-ghostty"||Y.TERM==="wezterm")return 3;if("TERM_PROGRAM"in Y){let a=Number.parseInt((Y.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Y.TERM_PROGRAM){case"iTerm.app":return a>=3?3:2;case"Apple_Terminal":return 2}}return/-256(color)?$/i.test(Y.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(Y.TERM)||"COLORTERM"in Y?1:o}function ll(t,e={}){let i=Ru(t,{streamIsTTY:t&&t.isTTY,...e});return du(i)}var zu={stdout:ll({isTTY:cl.isatty(1)}),stderr:ll({isTTY:cl.isatty(2)})},vl=zu;function Al(t,e,i){let n=t.indexOf(e);if(n===-1)return t;let r=e.length,o=0,a="";do a+=t.slice(o,n)+e+i,o=n+r,n=t.indexOf(e,o);while(n!==-1);return a+=t.slice(o),a}function ul(t,e,i,n){let r=0,o="";do{let a=t[n-1]==="\r";o+=t.slice(r,a?n-1:n)+e+(a?`\r
|
|
10
10
|
`:`
|
|
11
11
|
`)+i,r=n+1,n=t.indexOf(`
|
|
12
|
-
`,r)}while(n!==-1);return o+=t.slice(r),o}var{stdout:
|
|
13
|
-
`);return o!==-1&&(e=
|
|
14
|
-
${e}`,$A=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),e7=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),t7=(t,e,i)=>{let n=i===""?"":`with ${i.trim()}() `,r=_A.bind(null,n,e.toString());Object.defineProperty(r,"name",e7);let{writable:o,enumerable:a,configurable:c}=$A;Object.defineProperty(t,"toString",{value:r,writable:o,enumerable:a,configurable:c})};function ia(t,e,{ignoreNonConfigurable:i=!1}={}){let{name:n}=t;for(let r of Reflect.ownKeys(e))XA(t,e,r,i);return LA(t,e),t7(t,e,n),t}var Ln=new WeakMap,wc=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let i,n=0,r=t.displayName||t.name||"<anonymous>",o=function(...a){if(Ln.set(o,++n),n===1)i=t.apply(this,a),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return i};return ia(o,t),Ln.set(o,n),o};wc.callCount=t=>{if(!Ln.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return Ln.get(t)};var Tc=wc;var Kt=[];Kt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Kt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Kt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var _n=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",na=Symbol.for("signal-exit emitter"),ra=globalThis,i7=Object.defineProperty.bind(Object),oa=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(ra[na])return ra[na];i7(ra,na,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,i){this.listeners[e].push(i)}removeListener(e,i){let n=this.listeners[e],r=n.indexOf(i);r!==-1&&(r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,i,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let o of this.listeners[e])r=o(i,n)===!0||r;return e==="exit"&&(r=this.emit("afterExit",i,n)||r),r}},$n=class{},n7=t=>({onExit(e,i){return t.onExit(e,i)},load(){return t.load()},unload(){return t.unload()}}),aa=class extends $n{onExit(){return()=>{}}load(){}unload(){}},sa=class extends $n{#e=ca.platform==="win32"?"SIGINT":"SIGHUP";#n=new oa;#i;#r;#s;#t={};#o=!1;constructor(e){super(),this.#i=e,this.#t={};for(let i of Kt)this.#t[i]=()=>{let n=this.#i.listeners(i),{count:r}=this.#n,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(r+=o.__signal_exit_emitter__.count),n.length===r){this.unload();let a=this.#n.emit("exit",null,i),c=i==="SIGHUP"?this.#e:i;a||e.kill(e.pid,c)}};this.#s=e.reallyExit,this.#r=e.emit}onExit(e,i){if(!_n(this.#i))return()=>{};this.#o===!1&&this.load();let n=i?.alwaysLast?"afterExit":"exit";return this.#n.on(n,e),()=>{this.#n.removeListener(n,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#n.count+=1;for(let e of Kt)try{let i=this.#t[e];i&&this.#i.on(e,i)}catch{}this.#i.emit=(e,...i)=>this.#u(e,...i),this.#i.reallyExit=e=>this.#a(e)}}unload(){this.#o&&(this.#o=!1,Kt.forEach(e=>{let i=this.#t[e];if(!i)throw new Error("Listener not defined for signal: "+e);try{this.#i.removeListener(e,i)}catch{}}),this.#i.emit=this.#r,this.#i.reallyExit=this.#s,this.#n.count-=1)}#a(e){return _n(this.#i)?(this.#i.exitCode=e||0,this.#n.emit("exit",this.#i.exitCode,null),this.#s.call(this.#i,this.#i.exitCode)):0}#u(e,...i){let n=this.#r;if(e==="exit"&&_n(this.#i)){typeof i[0]=="number"&&(this.#i.exitCode=i[0]);let r=n.call(this.#i,e,...i);return this.#n.emit("exit",this.#i.exitCode,null),r}else return n.call(this.#i,e,...i)}},ca=globalThis.process,{onExit:Xc,load:Ep,unload:Ip}=n7(_n(ca)?new sa(ca):new aa);var Hc=er.stderr.isTTY?er.stderr:er.stdout.isTTY?er.stdout:void 0,r7=Hc?Tc(()=>{Xc(()=>{Hc.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Lc=r7;var tr=!1,Ai={};Ai.show=(t=_c.stderr)=>{t.isTTY&&(tr=!1,t.write("\x1B[?25h"))};Ai.hide=(t=_c.stderr)=>{t.isTTY&&(Lc(),tr=!0,t.write("\x1B[?25l"))};Ai.toggle=(t,e)=>{t!==void 0&&(tr=t),tr?Ai.show(e):Ai.hide(e)};var la=Ai;var Xi=Dn(va(),1);import fe from"node:process";function Aa(){return fe.platform!=="win32"?fe.env.TERM!=="linux":!!fe.env.CI||!!fe.env.WT_SESSION||!!fe.env.TERMINUS_SUBLIME||fe.env.ConEmuTask==="{cmd::Cmder}"||fe.env.TERM_PROGRAM==="Terminus-Sublime"||fe.env.TERM_PROGRAM==="vscode"||fe.env.TERM==="xterm-256color"||fe.env.TERM==="alacritty"||fe.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var a7={info:he.blue("\u2139"),success:he.green("\u2714"),warning:he.yellow("\u26A0"),error:he.red("\u2716")},s7={info:he.blue("i"),success:he.green("\u221A"),warning:he.yellow("\u203C"),error:he.red("\xD7")},c7=Aa()?a7:s7,wi=c7;function ma({onlyFirst:t=!1}={}){let r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,t?void 0:"g")}var l7=ma();function Ti(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(l7,"")}function il(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function nl(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function rl(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function v7(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function ol(t,{ambiguousAsWide:e=!1}={}){return v7(t),nl(t)||rl(t)||e&&il(t)?2:1}var cl=Dn(sl(),1),A7=new Intl.Segmenter,m7=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function ua(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:i=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=Ti(t)),t.length===0)return 0;let r=0,o={ambiguousAsWide:!i};for(let{segment:a}of A7.segment(t)){let c=a.codePointAt(0);if(!(c<=31||c>=127&&c<=159)&&!(c>=8203&&c<=8207||c===65279)&&!(c>=768&&c<=879||c>=6832&&c<=6911||c>=7616&&c<=7679||c>=8400&&c<=8447||c>=65056&&c<=65071)&&!(c>=55296&&c<=57343)&&!(c>=65024&&c<=65039)&&!m7.test(a)){if((0,cl.default)().test(a)){r+=2;continue}r+=ol(c,o)}}return r}function Ea({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import ll from"node:process";function Ia(){let{env:t}=ll,{TERM:e,TERM_PROGRAM:i}=t;return ll.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||i==="Terminus-Sublime"||i==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}import Me from"node:process";var u7=3,pa=class{#e=0;start(){this.#e++,this.#e===1&&this.#n()}stop(){if(this.#e<=0)throw new Error("`stop` called more times than `start`");this.#e--,this.#e===0&&this.#i()}#n(){Me.platform==="win32"||!Me.stdin.isTTY||(Me.stdin.setRawMode(!0),Me.stdin.on("data",this.#r),Me.stdin.resume())}#i(){Me.stdin.isTTY&&(Me.stdin.off("data",this.#r),Me.stdin.pause(),Me.stdin.setRawMode(!1))}#r(e){e[0]===u7&&Me.emit("SIGINT")}},E7=new pa,ha=E7;var I7=Dn(va(),1),fa=class{#e=0;#n=!1;#i=0;#r=-1;#s=0;#t;#o;#a;#u;#I;#v;#A;#m;#p;#c;#l;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:nr.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#I=this.#t.interval,this.#a=this.#t.stream,this.#v=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ea({stream:this.#a}),this.#A=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,nr.env.NODE_ENV==="test"&&(this._stream=this.#a,this._isEnabled=this.#v,Object.defineProperty(this,"_linesToClear",{get(){return this.#e},set(i){this.#e=i}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#r}}),Object.defineProperty(this,"_lineCount",{get(){return this.#i}}))}get indent(){return this.#m}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#m=e,this.#E()}get interval(){return this.#I??this.#o.interval??100}get spinner(){return this.#o}set spinner(e){if(this.#r=-1,this.#I=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#o=e}else if(!Ia())this.#o=Xi.default.line;else if(e===void 0)this.#o=Xi.default.dots;else if(e!=="default"&&Xi.default[e])this.#o=Xi.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#p}set text(e=""){this.#p=e,this.#E()}get prefixText(){return this.#c}set prefixText(e=""){this.#c=e,this.#E()}get suffixText(){return this.#l}set suffixText(e=""){this.#l=e,this.#E()}get isSpinning(){return this.#u!==void 0}#h(e=this.#c,i=" "){return typeof e=="string"&&e!==""?e+i:typeof e=="function"?e()+i:""}#f(e=this.#l,i=" "){return typeof e=="string"&&e!==""?i+e:typeof e=="function"?i+e():""}#E(){let e=this.#a.columns??80,i=this.#h(this.#c,"-"),n=this.#f(this.#l,"-"),r=" ".repeat(this.#m)+i+"--"+this.#p+"--"+n;this.#i=0;for(let o of Ti(r).split(`
|
|
15
|
-
`))this.#i+=Math.max(1,Math.ceil(
|
|
16
|
-
`),this)}stop(){return this.#v?(clearInterval(this.#
|
|
17
|
-
`;return this.stop(),this.#a.write(A),this}};function Ze(t){return new fa(t)}import{existsSync as ul,readFileSync as d7,writeFileSync as j7,mkdirSync as g7}from"fs";import{dirname as x7}from"path";import{homedir as vl}from"os";import{join as D}from"path";var p7=D(vl(),".gemkit"),za=D(p7,"projects"),Ra=D(vl(),".gemini"),oh=D(Ra,"config"),mi=D(Ra,"cache"),ah=D(Ra,"tmp"),ui=".gemini";var h7="plans",f7=".gk.json",z7="metadata.json",R7=".env";function rr(t=process.cwd()){return D(t,ui)}function da(t=process.cwd()){return D(t,ui,f7)}function ja(t=process.cwd()){return D(t,ui,z7)}function Vt(t=process.cwd()){return D(t,ui,R7)}function Hi(t=process.cwd()){return D(t,ui,"agents")}function Nt(t=process.cwd()){return D(t,ui,"extensions")}function Ei(t=process.cwd()){return D(t,h7)}function Li(t){return t?t.replace(/^[A-Za-z]:/,e=>e.replace(":","")).replace(/[\\/]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):""}function be(t){return D(za,t)}function kt(t,e){return D(be(t),`gk-session-${e}.json`)}function _i(t,e){return D(be(t),`gk-project-${e}.json`)}var ze={defaultScope:"local",github:{repo:"therichardngai-code/gemkit-kits-starter",apiUrl:"https://api.github.com"},cache:{enabled:!0,ttl:3600},installation:{excludePatterns:[],backupOnUpdate:!0},ui:{colors:!0,spinner:!0,verbose:!1},paths:{},spawn:{defaultModel:"gemini-2.5-flash",music:!1},office:{enabled:!0,mode:"web",port:3847,autoOpen:!0,sounds:!1,refreshRate:500}};function Al(t){return!(!t||typeof t!="object")}function ml(t){return{...ze,...t,github:{...ze.github,...t.github||{}},cache:{...ze.cache,...t.cache||{}},installation:{...ze.installation,...t.installation||{}},ui:{...ze.ui,...t.ui||{}},paths:{...ze.paths,...t.paths||{}},spawn:{...ze.spawn,...t.spawn||{}},office:{...ze.office,...t.office||{}}}}var or=class extends Error{constructor(i,n="GEMKIT_ERROR",r){super(i);this.code=n;this.details=r;this.name="GemKitError"}},Ft=class extends or{constructor(e,i){super(e,"CONFIG_ERROR",i),this.name="ConfigError"}};var Ae=class extends or{constructor(e,i){super(e,"GITHUB_ERROR",i),this.name="GitHubError"}};function ct(t){let e=da(t);if(!ul(e))return ze;try{let i=d7(e,"utf-8"),n=JSON.parse(i);if(!Al(n))throw new Ft("Invalid configuration format");return ml(n)}catch(i){throw i instanceof Ft?i:new Ft(`Failed to load config: ${i}`)}}function El(t,e){let i=da(e),n=x7(i);ul(n)||g7(n,{recursive:!0}),j7(i,JSON.stringify(t,null,2))}function Il(t,e){let i=ct(e),n=t.split("."),r=i;for(let o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return;return r}function pl(t,e,i){let n=ct(i),r=t.split("."),o=r.pop();if(!o)throw new Ft("Invalid config path");let a=n;for(let c of r)(!(c in a)||typeof a[c]!="object")&&(a[c]={}),a=a[c];a[o]=e,El(n,i)}function hl(t){El(ze,t)}import{existsSync as fl,readFileSync as G7,writeFileSync as S7,mkdirSync as Y7,readdirSync as zl,unlinkSync as Rl,statSync as W7}from"fs";import{join as ga}from"path";function xa(){return fl(mi)||Y7(mi,{recursive:!0}),mi}function dl(t){let e=t.replace(/[^a-zA-Z0-9-_]/g,"_");return ga(xa(),`${e}.json`)}function jl(t){let e=dl(t);if(!fl(e))return null;try{let i=G7(e,"utf-8"),n=JSON.parse(i);return Date.now()-n.timestamp>n.ttl*1e3?(Rl(e),null):n.data}catch{return null}}function gl(t,e,i=3600){let n=dl(t),r={key:t,data:e,timestamp:Date.now(),ttl:i};S7(n,JSON.stringify(r,null,2))}function xl(){let t=xa(),e=zl(t).filter(i=>i.endsWith(".json"));for(let i of e)Rl(ga(t,i));return e.length}function Gl(){let t=xa(),e=zl(t).filter(n=>n.endsWith(".json")),i=0;for(let n of e){let r=W7(ga(t,n));i+=r.size}return{entries:e.length,size:i}}var Sl="github-releases",M7=300;async function ar(t=10){let e=jl(Sl);if(e)return e.slice(0,t);let i=ct(),{repo:n,apiUrl:r}=i.github,o=`${r}/repos/${n}/releases?per_page=${t}`;try{let a=await fetch(o,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"gemkit-cli"}});if(!a.ok)throw new Ae(`Failed to fetch releases: ${a.status}`);let l=(await a.json()).map(v=>({version:v.tag_name.replace(/^v/,""),tag:v.tag_name,publishedAt:v.published_at,prerelease:v.prerelease,assets:v.assets.map(A=>({name:A.name,url:A.url,size:A.size,downloadUrl:A.browser_download_url}))}));return gl(Sl,l,M7),l}catch(a){throw a instanceof Ae?a:new Ae(`Failed to fetch releases: ${a}`)}}async function Ii(){let t=await ar(1);return t.length>0?t[0]:null}async function Yl(t){return(await ar(50)).find(i=>i.version===t||i.tag===t)||null}import{createWriteStream as C7,existsSync as O7,mkdirSync as U7}from"fs";import{pipeline as K7}from"stream/promises";import{join as V7}from"path";async function N7(t,e=mi){O7(e)||U7(e,{recursive:!0});let i=V7(e,t.name);try{let n=await fetch(t.downloadUrl,{headers:{"User-Agent":"gemkit-cli"}});if(!n.ok)throw new Ae(`Failed to download asset: ${n.status}`);if(!n.body)throw new Ae("No response body");let r=C7(i);return await K7(n.body,r),i}catch(n){throw n instanceof Ae?n:new Ae(`Download failed: ${n}`)}}async function pi(t){let e=t.assets.find(i=>i.name.endsWith(".tar.gz")||i.name.endsWith(".tgz"));if(!e)throw new Ae("No tarball asset found in release");return N7(e)}import{createReadStream as Bu,createWriteStream as pR,existsSync as q3,mkdirSync as Zu}from"fs";import{pipeline as bu}from"stream/promises";import{createGunzip as Pu}from"zlib";import y7 from"events";import ee from"fs";import{EventEmitter as Oa}from"node:events";import Ul from"node:stream";import{StringDecoder as k7}from"node:string_decoder";var Wl=typeof process=="object"&&process?process:{stdout:null,stderr:null},F7=t=>!!t&&typeof t=="object"&&(t instanceof rn||t instanceof Ul||Q7(t)||J7(t)),Q7=t=>!!t&&typeof t=="object"&&t instanceof Oa&&typeof t.pipe=="function"&&t.pipe!==Ul.Writable.prototype.pipe,J7=t=>!!t&&typeof t=="object"&&t instanceof Oa&&typeof t.write=="function"&&typeof t.end=="function",Pe=Symbol("EOF"),qe=Symbol("maybeEmitEnd"),lt=Symbol("emittedEnd"),sr=Symbol("emittingEnd"),$i=Symbol("emittedError"),cr=Symbol("closed"),Ml=Symbol("read"),lr=Symbol("flush"),Cl=Symbol("flushChunk"),Re=Symbol("encoding"),hi=Symbol("decoder"),k=Symbol("flowing"),en=Symbol("paused"),fi=Symbol("resume"),F=Symbol("buffer"),L=Symbol("pipes"),Q=Symbol("bufferLength"),Ga=Symbol("bufferPush"),vr=Symbol("bufferShift"),y=Symbol("objectMode"),C=Symbol("destroyed"),Sa=Symbol("error"),Ya=Symbol("emitData"),Ol=Symbol("emitEnd"),Wa=Symbol("emitEnd2"),Ce=Symbol("async"),Ma=Symbol("abort"),Ar=Symbol("aborted"),tn=Symbol("signal"),Qt=Symbol("dataListeners"),te=Symbol("discarded"),nn=t=>Promise.resolve().then(t),B7=t=>t(),Z7=t=>t==="end"||t==="finish"||t==="prefinish",b7=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,P7=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),mr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[fi](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ca=class extends mr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},q7=t=>!!t.objectMode,D7=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",rn=class extends Oa{[k]=!1;[en]=!1;[L]=[];[F]=[];[y];[Re];[Ce];[hi];[Pe]=!1;[lt]=!1;[sr]=!1;[cr]=!1;[$i]=null;[Q]=0;[C]=!1;[tn];[Ar]=!1;[Qt]=0;[te]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");q7(i)?(this[y]=!0,this[Re]=null):D7(i)?(this[Re]=i.encoding,this[y]=!1):(this[y]=!1,this[Re]=null),this[Ce]=!!i.async,this[hi]=this[Re]?new k7(this[Re]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[F]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[L]});let{signal:n}=i;n&&(this[tn]=n,n.aborted?this[Ma]():n.addEventListener("abort",()=>this[Ma]()))}get bufferLength(){return this[Q]}get encoding(){return this[Re]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[y]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ce]}set async(e){this[Ce]=this[Ce]||!!e}[Ma](){this[Ar]=!0,this.emit("abort",this[tn]?.reason),this.destroy(this[tn]?.reason)}get aborted(){return this[Ar]}set aborted(e){}write(e,i,n){if(this[Ar])return!1;if(this[Pe])throw new Error("write after end");if(this[C])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Ce]?nn:B7;if(!this[y]&&!Buffer.isBuffer(e)){if(P7(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(b7(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[y]?(this[k]&&this[Q]!==0&&this[lr](!0),this[k]?this.emit("data",e):this[Ga](e),this[Q]!==0&&this.emit("readable"),n&&r(n),this[k]):e.length?(typeof e=="string"&&!(i===this[Re]&&!this[hi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[Re]&&(e=this[hi].write(e)),this[k]&&this[Q]!==0&&this[lr](!0),this[k]?this.emit("data",e):this[Ga](e),this[Q]!==0&&this.emit("readable"),n&&r(n),this[k]):(this[Q]!==0&&this.emit("readable"),n&&r(n),this[k])}read(e){if(this[C])return null;if(this[te]=!1,this[Q]===0||e===0||e&&e>this[Q])return this[qe](),null;this[y]&&(e=null),this[F].length>1&&!this[y]&&(this[F]=[this[Re]?this[F].join(""):Buffer.concat(this[F],this[Q])]);let i=this[Ml](e||null,this[F][0]);return this[qe](),i}[Ml](e,i){if(this[y])this[vr]();else{let n=i;e===n.length||e===null?this[vr]():typeof n=="string"?(this[F][0]=n.slice(e),i=n.slice(0,e),this[Q]-=e):(this[F][0]=n.subarray(e),i=n.subarray(0,e),this[Q]-=e)}return this.emit("data",i),!this[F].length&&!this[Pe]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[Pe]=!0,this.writable=!1,(this[k]||!this[en])&&this[qe](),this}[fi](){this[C]||(!this[Qt]&&!this[L].length&&(this[te]=!0),this[en]=!1,this[k]=!0,this.emit("resume"),this[F].length?this[lr]():this[Pe]?this[qe]():this.emit("drain"))}resume(){return this[fi]()}pause(){this[k]=!1,this[en]=!0,this[te]=!1}get destroyed(){return this[C]}get flowing(){return this[k]}get paused(){return this[en]}[Ga](e){this[y]?this[Q]+=1:this[Q]+=e.length,this[F].push(e)}[vr](){return this[y]?this[Q]-=1:this[Q]-=this[F][0].length,this[F].shift()}[lr](e=!1){do;while(this[Cl](this[vr]())&&this[F].length);!e&&!this[F].length&&!this[Pe]&&this.emit("drain")}[Cl](e){return this.emit("data",e),this[k]}pipe(e,i){if(this[C])return e;this[te]=!1;let n=this[lt];return i=i||{},e===Wl.stdout||e===Wl.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[L].push(i.proxyErrors?new Ca(this,e,i):new mr(this,e,i)),this[Ce]?nn(()=>this[fi]()):this[fi]()),e}unpipe(e){let i=this[L].find(n=>n.dest===e);i&&(this[L].length===1?(this[k]&&this[Qt]===0&&(this[k]=!1),this[L]=[]):this[L].splice(this[L].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[te]=!1,this[Qt]++,!this[L].length&&!this[k]&&this[fi]();else if(e==="readable"&&this[Q]!==0)super.emit("readable");else if(Z7(e)&&this[lt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[$i]){let r=i;this[Ce]?nn(()=>r.call(this,this[$i])):r.call(this,this[$i])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[Qt]=this.listeners("data").length,this[Qt]===0&&!this[te]&&!this[L].length&&(this[k]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Qt]=0,!this[te]&&!this[L].length&&(this[k]=!1)),i}get emittedEnd(){return this[lt]}[qe](){!this[sr]&&!this[lt]&&!this[C]&&this[F].length===0&&this[Pe]&&(this[sr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[cr]&&this.emit("close"),this[sr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==C&&this[C])return!1;if(e==="data")return!this[y]&&!n?!1:this[Ce]?(nn(()=>this[Ya](n)),!0):this[Ya](n);if(e==="end")return this[Ol]();if(e==="close"){if(this[cr]=!0,!this[lt]&&!this[C])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[$i]=n,super.emit(Sa,n);let o=!this[tn]||this.listeners("error").length?super.emit("error",n):!1;return this[qe](),o}else if(e==="resume"){let o=super.emit("resume");return this[qe](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[qe](),r}[Ya](e){for(let n of this[L])n.dest.write(e)===!1&&this.pause();let i=this[te]?!1:super.emit("data",e);return this[qe](),i}[Ol](){return this[lt]?!1:(this[lt]=!0,this.readable=!1,this[Ce]?(nn(()=>this[Wa]()),!0):this[Wa]())}[Wa](){if(this[hi]){let i=this[hi].end();if(i){for(let n of this[L])n.dest.write(i);this[te]||super.emit("data",i)}}for(let i of this[L])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[y]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[y]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[y])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Re]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(C,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[te]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Pe])return i();let o,a,c=m=>{this.off("data",l),this.off("end",v),this.off(C,A),i(),a(m)},l=m=>{this.off("error",c),this.off("end",v),this.off(C,A),this.pause(),o({value:m,done:!!this[Pe]})},v=()=>{this.off("error",c),this.off("data",l),this.off(C,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((m,I)=>{a=I,o=m,this.once(C,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[te]=!1;let e=!1,i=()=>(this.pause(),this.off(Sa,i),this.off(C,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(Sa,i),this.once(C,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[C])return e?this.emit("error",e):this.emit(C),this;this[C]=!0,this[te]=!0,this[F].length=0,this[Q]=0;let i=this;return typeof i.close=="function"&&!this[cr]&&i.close(),e?this.emit("error",e):this.emit(C),this}static get isStream(){return F7}};var w7=ee.writev,At=Symbol("_autoClose"),je=Symbol("_close"),on=Symbol("_ended"),g=Symbol("_fd"),Ua=Symbol("_finished"),ye=Symbol("_flags"),Ka=Symbol("_flush"),Fa=Symbol("_handleChunk"),Qa=Symbol("_makeBuf"),sn=Symbol("_mode"),ur=Symbol("_needDrain"),di=Symbol("_onerror"),ji=Symbol("_onopen"),Va=Symbol("_onread"),zi=Symbol("_onwrite"),mt=Symbol("_open"),de=Symbol("_path"),vt=Symbol("_pos"),Oe=Symbol("_queue"),Ri=Symbol("_read"),Na=Symbol("_readSize"),De=Symbol("_reading"),an=Symbol("_remain"),ka=Symbol("_size"),Er=Symbol("_write"),Jt=Symbol("_writing"),Ir=Symbol("_defaultFlag"),Bt=Symbol("_errored"),Zt=class extends rn{[Bt]=!1;[g];[de];[Na];[De]=!1;[ka];[an];[At];constructor(e,i){if(i=i||{},super(i),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[Bt]=!1,this[g]=typeof i.fd=="number"?i.fd:void 0,this[de]=e,this[Na]=i.readSize||16*1024*1024,this[De]=!1,this[ka]=typeof i.size=="number"?i.size:1/0,this[an]=this[ka],this[At]=typeof i.autoClose=="boolean"?i.autoClose:!0,typeof this[g]=="number"?this[Ri]():this[mt]()}get fd(){return this[g]}get path(){return this[de]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[mt](){ee.open(this[de],"r",(e,i)=>this[ji](e,i))}[ji](e,i){e?this[di](e):(this[g]=i,this.emit("open",i),this[Ri]())}[Qa](){return Buffer.allocUnsafe(Math.min(this[Na],this[an]))}[Ri](){if(!this[De]){this[De]=!0;let e=this[Qa]();if(e.length===0)return process.nextTick(()=>this[Va](null,0,e));ee.read(this[g],e,0,e.length,null,(i,n,r)=>this[Va](i,n,r))}}[Va](e,i,n){this[De]=!1,e?this[di](e):this[Fa](i,n)&&this[Ri]()}[je](){if(this[At]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.close(e,i=>i?this.emit("error",i):this.emit("close"))}}[di](e){this[De]=!0,this[je](),this.emit("error",e)}[Fa](e,i){let n=!1;return this[an]-=e,e>0&&(n=super.write(e<i.length?i.subarray(0,e):i)),(e===0||this[an]<=0)&&(n=!1,this[je](),super.end()),n}emit(e,...i){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[g]=="number"&&this[Ri](),!1;case"error":return this[Bt]?!1:(this[Bt]=!0,super.emit(e,...i));default:return super.emit(e,...i)}}},pr=class extends Zt{[mt](){let e=!0;try{this[ji](null,ee.openSync(this[de],"r")),e=!1}finally{e&&this[je]()}}[Ri](){let e=!0;try{if(!this[De]){this[De]=!0;do{let i=this[Qa](),n=i.length===0?0:ee.readSync(this[g],i,0,i.length,null);if(!this[Fa](n,i))break}while(!0);this[De]=!1}e=!1}finally{e&&this[je]()}}[je](){if(this[At]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.closeSync(e),this.emit("close")}}},we=class extends y7{readable=!1;writable=!0;[Bt]=!1;[Jt]=!1;[on]=!1;[Oe]=[];[ur]=!1;[de];[sn];[At];[g];[Ir];[ye];[Ua]=!1;[vt];constructor(e,i){i=i||{},super(i),this[de]=e,this[g]=typeof i.fd=="number"?i.fd:void 0,this[sn]=i.mode===void 0?438:i.mode,this[vt]=typeof i.start=="number"?i.start:void 0,this[At]=typeof i.autoClose=="boolean"?i.autoClose:!0;let n=this[vt]!==void 0?"r+":"w";this[Ir]=i.flags===void 0,this[ye]=i.flags===void 0?n:i.flags,this[g]===void 0&&this[mt]()}emit(e,...i){if(e==="error"){if(this[Bt])return!1;this[Bt]=!0}return super.emit(e,...i)}get fd(){return this[g]}get path(){return this[de]}[di](e){this[je](),this[Jt]=!0,this.emit("error",e)}[mt](){ee.open(this[de],this[ye],this[sn],(e,i)=>this[ji](e,i))}[ji](e,i){this[Ir]&&this[ye]==="r+"&&e&&e.code==="ENOENT"?(this[ye]="w",this[mt]()):e?this[di](e):(this[g]=i,this.emit("open",i),this[Jt]||this[Ka]())}end(e,i){return e&&this.write(e,i),this[on]=!0,!this[Jt]&&!this[Oe].length&&typeof this[g]=="number"&&this[zi](null,0),this}write(e,i){return typeof e=="string"&&(e=Buffer.from(e,i)),this[on]?(this.emit("error",new Error("write() after end()")),!1):this[g]===void 0||this[Jt]||this[Oe].length?(this[Oe].push(e),this[ur]=!0,!1):(this[Jt]=!0,this[Er](e),!0)}[Er](e){ee.write(this[g],e,0,e.length,this[vt],(i,n)=>this[zi](i,n))}[zi](e,i){e?this[di](e):(this[vt]!==void 0&&typeof i=="number"&&(this[vt]+=i),this[Oe].length?this[Ka]():(this[Jt]=!1,this[on]&&!this[Ua]?(this[Ua]=!0,this[je](),this.emit("finish")):this[ur]&&(this[ur]=!1,this.emit("drain"))))}[Ka](){if(this[Oe].length===0)this[on]&&this[zi](null,0);else if(this[Oe].length===1)this[Er](this[Oe].pop());else{let e=this[Oe];this[Oe]=[],w7(this[g],e,this[vt],(i,n)=>this[zi](i,n))}}[je](){if(this[At]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.close(e,i=>i?this.emit("error",i):this.emit("close"))}}},gi=class extends we{[mt](){let e;if(this[Ir]&&this[ye]==="r+")try{e=ee.openSync(this[de],this[ye],this[sn])}catch(i){if(i?.code==="ENOENT")return this[ye]="w",this[mt]();throw i}else e=ee.openSync(this[de],this[ye],this[sn]);this[ji](null,e)}[je](){if(this[At]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.closeSync(e),this.emit("close")}}[Er](e){let i=!0;try{this[zi](null,ee.writeSync(this[g],e,0,e.length,this[vt])),i=!1}finally{if(i)try{this[je]()}catch{}}}};import j3 from"node:path";import Ui from"node:fs";import{dirname as qm,parse as Dm}from"path";var T7=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),Kl=t=>!!t.sync&&!!t.file,Vl=t=>!t.sync&&!!t.file,Nl=t=>!!t.sync&&!t.file,kl=t=>!t.sync&&!t.file;var Fl=t=>!!t.file;var X7=t=>{let e=T7.get(t);return e||t},cn=(t={})=>{if(!t)return{};let e={};for(let[i,n]of Object.entries(t)){let r=X7(i);e[r]=n}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e};var Ue=(t,e,i,n,r)=>Object.assign((o=[],a,c)=>{Array.isArray(o)&&(a=o,o={}),typeof a=="function"&&(c=a,a=void 0),a?a=Array.from(a):a=[];let l=cn(o);if(r?.(l,a),Kl(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return t(l,a)}else if(Vl(l)){let v=e(l,a),A=c||void 0;return A?v.then(()=>A(),A):v}else if(Nl(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return i(l,a)}else if(kl(l)){if(typeof c=="function")throw new TypeError("callback only supported with file option");return n(l,a)}else throw new Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:n,validate:r});import{EventEmitter as Bm}from"events";import Xa from"assert";import{Buffer as Pt}from"buffer";import{EventEmitter as ya}from"node:events";import bl from"node:stream";import{StringDecoder as H7}from"node:string_decoder";var Ql=typeof process=="object"&&process?process:{stdout:null,stderr:null},L7=t=>!!t&&typeof t=="object"&&(t instanceof un||t instanceof bl||_7(t)||$7(t)),_7=t=>!!t&&typeof t=="object"&&t instanceof ya&&typeof t.pipe=="function"&&t.pipe!==bl.Writable.prototype.pipe,$7=t=>!!t&&typeof t=="object"&&t instanceof ya&&typeof t.write=="function"&&typeof t.end=="function",Te=Symbol("EOF"),Xe=Symbol("maybeEmitEnd"),ut=Symbol("emittedEnd"),hr=Symbol("emittingEnd"),ln=Symbol("emittedError"),fr=Symbol("closed"),Jl=Symbol("read"),zr=Symbol("flush"),Bl=Symbol("flushChunk"),ge=Symbol("encoding"),xi=Symbol("decoder"),J=Symbol("flowing"),vn=Symbol("paused"),Gi=Symbol("resume"),B=Symbol("buffer"),_=Symbol("pipes"),Z=Symbol("bufferLength"),Ba=Symbol("bufferPush"),Rr=Symbol("bufferShift"),w=Symbol("objectMode"),O=Symbol("destroyed"),Za=Symbol("error"),ba=Symbol("emitData"),Zl=Symbol("emitEnd"),Pa=Symbol("emitEnd2"),Ke=Symbol("async"),qa=Symbol("abort"),dr=Symbol("aborted"),An=Symbol("signal"),bt=Symbol("dataListeners"),ie=Symbol("discarded"),mn=t=>Promise.resolve().then(t),em=t=>t(),tm=t=>t==="end"||t==="finish"||t==="prefinish",im=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,nm=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),jr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[Gi](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Da=class extends jr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},rm=t=>!!t.objectMode,om=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",un=class extends ya{[J]=!1;[vn]=!1;[_]=[];[B]=[];[w];[ge];[Ke];[xi];[Te]=!1;[ut]=!1;[hr]=!1;[fr]=!1;[ln]=null;[Z]=0;[O]=!1;[An];[dr]=!1;[bt]=0;[ie]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");rm(i)?(this[w]=!0,this[ge]=null):om(i)?(this[ge]=i.encoding,this[w]=!1):(this[w]=!1,this[ge]=null),this[Ke]=!!i.async,this[xi]=this[ge]?new H7(this[ge]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[B]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[_]});let{signal:n}=i;n&&(this[An]=n,n.aborted?this[qa]():n.addEventListener("abort",()=>this[qa]()))}get bufferLength(){return this[Z]}get encoding(){return this[ge]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[w]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ke]}set async(e){this[Ke]=this[Ke]||!!e}[qa](){this[dr]=!0,this.emit("abort",this[An]?.reason),this.destroy(this[An]?.reason)}get aborted(){return this[dr]}set aborted(e){}write(e,i,n){if(this[dr])return!1;if(this[Te])throw new Error("write after end");if(this[O])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Ke]?mn:em;if(!this[w]&&!Buffer.isBuffer(e)){if(nm(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(im(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[w]?(this[J]&&this[Z]!==0&&this[zr](!0),this[J]?this.emit("data",e):this[Ba](e),this[Z]!==0&&this.emit("readable"),n&&r(n),this[J]):e.length?(typeof e=="string"&&!(i===this[ge]&&!this[xi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[ge]&&(e=this[xi].write(e)),this[J]&&this[Z]!==0&&this[zr](!0),this[J]?this.emit("data",e):this[Ba](e),this[Z]!==0&&this.emit("readable"),n&&r(n),this[J]):(this[Z]!==0&&this.emit("readable"),n&&r(n),this[J])}read(e){if(this[O])return null;if(this[ie]=!1,this[Z]===0||e===0||e&&e>this[Z])return this[Xe](),null;this[w]&&(e=null),this[B].length>1&&!this[w]&&(this[B]=[this[ge]?this[B].join(""):Buffer.concat(this[B],this[Z])]);let i=this[Jl](e||null,this[B][0]);return this[Xe](),i}[Jl](e,i){if(this[w])this[Rr]();else{let n=i;e===n.length||e===null?this[Rr]():typeof n=="string"?(this[B][0]=n.slice(e),i=n.slice(0,e),this[Z]-=e):(this[B][0]=n.subarray(e),i=n.subarray(0,e),this[Z]-=e)}return this.emit("data",i),!this[B].length&&!this[Te]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[Te]=!0,this.writable=!1,(this[J]||!this[vn])&&this[Xe](),this}[Gi](){this[O]||(!this[bt]&&!this[_].length&&(this[ie]=!0),this[vn]=!1,this[J]=!0,this.emit("resume"),this[B].length?this[zr]():this[Te]?this[Xe]():this.emit("drain"))}resume(){return this[Gi]()}pause(){this[J]=!1,this[vn]=!0,this[ie]=!1}get destroyed(){return this[O]}get flowing(){return this[J]}get paused(){return this[vn]}[Ba](e){this[w]?this[Z]+=1:this[Z]+=e.length,this[B].push(e)}[Rr](){return this[w]?this[Z]-=1:this[Z]-=this[B][0].length,this[B].shift()}[zr](e=!1){do;while(this[Bl](this[Rr]())&&this[B].length);!e&&!this[B].length&&!this[Te]&&this.emit("drain")}[Bl](e){return this.emit("data",e),this[J]}pipe(e,i){if(this[O])return e;this[ie]=!1;let n=this[ut];return i=i||{},e===Ql.stdout||e===Ql.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[_].push(i.proxyErrors?new Da(this,e,i):new jr(this,e,i)),this[Ke]?mn(()=>this[Gi]()):this[Gi]()),e}unpipe(e){let i=this[_].find(n=>n.dest===e);i&&(this[_].length===1?(this[J]&&this[bt]===0&&(this[J]=!1),this[_]=[]):this[_].splice(this[_].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[ie]=!1,this[bt]++,!this[_].length&&!this[J]&&this[Gi]();else if(e==="readable"&&this[Z]!==0)super.emit("readable");else if(tm(e)&&this[ut])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[ln]){let r=i;this[Ke]?mn(()=>r.call(this,this[ln])):r.call(this,this[ln])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[bt]=this.listeners("data").length,this[bt]===0&&!this[ie]&&!this[_].length&&(this[J]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[bt]=0,!this[ie]&&!this[_].length&&(this[J]=!1)),i}get emittedEnd(){return this[ut]}[Xe](){!this[hr]&&!this[ut]&&!this[O]&&this[B].length===0&&this[Te]&&(this[hr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[fr]&&this.emit("close"),this[hr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==O&&this[O])return!1;if(e==="data")return!this[w]&&!n?!1:this[Ke]?(mn(()=>this[ba](n)),!0):this[ba](n);if(e==="end")return this[Zl]();if(e==="close"){if(this[fr]=!0,!this[ut]&&!this[O])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[ln]=n,super.emit(Za,n);let o=!this[An]||this.listeners("error").length?super.emit("error",n):!1;return this[Xe](),o}else if(e==="resume"){let o=super.emit("resume");return this[Xe](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[Xe](),r}[ba](e){for(let n of this[_])n.dest.write(e)===!1&&this.pause();let i=this[ie]?!1:super.emit("data",e);return this[Xe](),i}[Zl](){return this[ut]?!1:(this[ut]=!0,this.readable=!1,this[Ke]?(mn(()=>this[Pa]()),!0):this[Pa]())}[Pa](){if(this[xi]){let i=this[xi].end();if(i){for(let n of this[_])n.dest.write(i);this[ie]||super.emit("data",i)}}for(let i of this[_])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[w]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[w]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[w])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[ge]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(O,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[ie]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Te])return i();let o,a,c=m=>{this.off("data",l),this.off("end",v),this.off(O,A),i(),a(m)},l=m=>{this.off("error",c),this.off("end",v),this.off(O,A),this.pause(),o({value:m,done:!!this[Te]})},v=()=>{this.off("error",c),this.off("data",l),this.off(O,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((m,I)=>{a=I,o=m,this.once(O,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ie]=!1;let e=!1,i=()=>(this.pause(),this.off(Za,i),this.off(O,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(Za,i),this.once(O,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[O])return e?this.emit("error",e):this.emit(O),this;this[O]=!0,this[ie]=!0,this[B].length=0,this[Z]=0;let i=this;return typeof i.close=="function"&&!this[fr]&&i.close(),e?this.emit("error",e):this.emit(O),this}static get isStream(){return L7}};import*as Pl from"zlib";import am from"zlib";var sm=am.constants||{ZLIB_VERNUM:4736},me=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},sm));var cm=Pt.concat,ql=Object.getOwnPropertyDescriptor(Pt,"concat"),lm=t=>t,wa=ql?.writable===!0||ql?.set!==void 0?t=>{Pt.concat=t?lm:cm}:t=>{},qt=Symbol("_superWrite"),Si=class extends Error{code;errno;constructor(e,i){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,i??this.constructor)}get name(){return"ZlibError"}},Ta=Symbol("flushFlag"),En=class extends un{#e=!1;#n=!1;#i;#r;#s;#t;#o;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#i}constructor(e,i){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(e),this.#i=e.flush??0,this.#r=e.finishFlush??0,this.#s=e.fullFlushFlag??0,typeof Pl[i]!="function")throw new TypeError("Compression method not supported: "+i);try{this.#t=new Pl[i](e)}catch(n){throw new Si(n,this.constructor)}this.#o=n=>{this.#e||(this.#e=!0,this.close(),this.emit("error",n))},this.#t?.on("error",n=>this.#o(new Si(n))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return Xa(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#s),this.write(Object.assign(Pt.alloc(0),{[Ta]:e})))}end(e,i,n){return typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),e&&(i?this.write(e,i):this.write(e)),this.flush(this.#r),this.#n=!0,super.end(n)}get ended(){return this.#n}[qt](e){return super.write(e)}write(e,i,n){if(typeof i=="function"&&(n=i,i="utf8"),typeof e=="string"&&(e=Pt.from(e,i)),this.#e)return;Xa(this.#t,"zlib binding closed");let r=this.#t._handle,o=r.close;r.close=()=>{};let a=this.#t.close;this.#t.close=()=>{},wa(!0);let c;try{let v=typeof e[Ta]=="number"?e[Ta]:this.#i;c=this.#t._processChunk(e,v),wa(!1)}catch(v){wa(!1),this.#o(new Si(v,this.write))}finally{this.#t&&(this.#t._handle=r,r.close=o,this.#t.close=a,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",v=>this.#o(new Si(v,this.write)));let l;if(c)if(Array.isArray(c)&&c.length>0){let v=c[0];l=this[qt](Pt.from(v));for(let A=1;A<c.length;A++)l=this[qt](c[A])}else l=this[qt](Pt.from(c));return n&&n(),l}},gr=class extends En{#e;#n;constructor(e,i){e=e||{},e.flush=e.flush||me.Z_NO_FLUSH,e.finishFlush=e.finishFlush||me.Z_FINISH,e.fullFlushFlag=me.Z_FULL_FLUSH,super(e,i),this.#e=e.level,this.#n=e.strategy}params(e,i){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#e!==e||this.#n!==i){this.flush(me.Z_SYNC_FLUSH),Xa(this.handle,"zlib binding closed");let n=this.handle.flush;this.handle.flush=(r,o)=>{typeof r=="function"&&(o=r,r=this.flushFlag),this.flush(r),o?.()};try{this.handle.params(e,i)}finally{this.handle.flush=n}this.handle&&(this.#e=e,this.#n=i)}}}};var xr=class extends gr{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[qt](e){return this.#e?(this.#e=!1,e[9]=255,super[qt](e)):super[qt](e)}};var Gr=class extends gr{constructor(e){super(e,"Unzip")}},Sr=class extends En{constructor(e,i){e=e||{},e.flush=e.flush||me.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||me.BROTLI_OPERATION_FINISH,e.fullFlushFlag=me.BROTLI_OPERATION_FLUSH,super(e,i)}},Yr=class extends Sr{constructor(e){super(e,"BrotliCompress")}},Wr=class extends Sr{constructor(e){super(e,"BrotliDecompress")}},Mr=class extends En{constructor(e,i){e=e||{},e.flush=e.flush||me.ZSTD_e_continue,e.finishFlush=e.finishFlush||me.ZSTD_e_end,e.fullFlushFlag=me.ZSTD_e_flush,super(e,i)}},Cr=class extends Mr{constructor(e){super(e,"ZstdCompress")}},Or=class extends Mr{constructor(e){super(e,"ZstdDecompress")}};import{posix as Yi}from"node:path";var Dl=(t,e)=>{if(Number.isSafeInteger(t))t<0?mm(t,e):Am(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Am=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=t&255,t=Math.floor(t/256)},mm=(t,e)=>{e[0]=255;var i=!1;t=t*-1;for(var n=e.length;n>1;n--){var r=t&255;t=Math.floor(t/256),i?e[n-1]=wl(r):r===0?e[n-1]=0:(i=!0,e[n-1]=Tl(r))}},yl=t=>{let e=t[0],i=e===128?Em(t.subarray(1,t.length)):e===255?um(t):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},um=t=>{for(var e=t.length,i=0,n=!1,r=e-1;r>-1;r--){var o=Number(t[r]),a;n?a=wl(o):o===0?a=o:(n=!0,a=Tl(o)),a!==0&&(i-=a*Math.pow(256,e-r-1))}return i},Em=t=>{for(var e=t.length,i=0,n=e-1;n>-1;n--){var r=Number(t[n]);r!==0&&(i+=r*Math.pow(256,e-n-1))}return i},wl=t=>(255^t)&255,Tl=t=>(255^t)+1&255;var Ur=t=>Kr.has(t);var Kr=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),Xl=new Map(Array.from(Kr).map(t=>[t[1],t[0]]));var ne=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,i=0,n,r){Buffer.isBuffer(e)?this.decode(e,i||0,n,r):e&&this.#n(e)}decode(e,i,n,r){if(i||(i=0),!e||!(e.length>=i+512))throw new Error("need 512 bytes for header");this.path=n?.path??Dt(e,i,100),this.mode=n?.mode??r?.mode??Et(e,i+100,8),this.uid=n?.uid??r?.uid??Et(e,i+108,8),this.gid=n?.gid??r?.gid??Et(e,i+116,8),this.size=n?.size??r?.size??Et(e,i+124,12),this.mtime=n?.mtime??r?.mtime??Ha(e,i+136,12),this.cksum=Et(e,i+148,12),r&&this.#n(r,!0),n&&this.#n(n);let o=Dt(e,i+156,1);if(Ur(o)&&(this.#e=o||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=Dt(e,i+157,100),e.subarray(i+257,i+265).toString()==="ustar\x0000")if(this.uname=n?.uname??r?.uname??Dt(e,i+265,32),this.gname=n?.gname??r?.gname??Dt(e,i+297,32),this.devmaj=n?.devmaj??r?.devmaj??Et(e,i+329,8)??0,this.devmin=n?.devmin??r?.devmin??Et(e,i+337,8)??0,e[i+475]!==0){let c=Dt(e,i+345,155);this.path=c+"/"+this.path}else{let c=Dt(e,i+345,130);c&&(this.path=c+"/"+this.path),this.atime=n?.atime??r?.atime??Ha(e,i+476,12),this.ctime=n?.ctime??r?.ctime??Ha(e,i+488,12)}let a=256;for(let c=i;c<i+148;c++)a+=e[c];for(let c=i+156;c<i+512;c++)a+=e[c];this.cksumValid=a===this.cksum,this.cksum===void 0&&a===256&&(this.nullBlock=!0)}#n(e,i=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,r])=>!(r==null||n==="path"&&i||n==="linkpath"&&i||n==="global"))))}encode(e,i=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=i+512))throw new Error("need 512 bytes for header");let n=this.ctime||this.atime?130:155,r=pm(this.path||"",n),o=r[0],a=r[1];this.needPax=!!r[2],this.needPax=yt(e,i,100,o)||this.needPax,this.needPax=It(e,i+100,8,this.mode)||this.needPax,this.needPax=It(e,i+108,8,this.uid)||this.needPax,this.needPax=It(e,i+116,8,this.gid)||this.needPax,this.needPax=It(e,i+124,12,this.size)||this.needPax,this.needPax=La(e,i+136,12,this.mtime)||this.needPax,e[i+156]=this.#e.charCodeAt(0),this.needPax=yt(e,i+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",i+257,8),this.needPax=yt(e,i+265,32,this.uname)||this.needPax,this.needPax=yt(e,i+297,32,this.gname)||this.needPax,this.needPax=It(e,i+329,8,this.devmaj)||this.needPax,this.needPax=It(e,i+337,8,this.devmin)||this.needPax,this.needPax=yt(e,i+345,n,a)||this.needPax,e[i+475]!==0?this.needPax=yt(e,i+345,155,a)||this.needPax:(this.needPax=yt(e,i+345,130,a)||this.needPax,this.needPax=La(e,i+476,12,this.atime)||this.needPax,this.needPax=La(e,i+488,12,this.ctime)||this.needPax);let c=256;for(let l=i;l<i+148;l++)c+=e[l];for(let l=i+156;l<i+512;l++)c+=e[l];return this.cksum=c,It(e,i+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Kr.get(this.#e)}get typeKey(){return this.#e}set type(e){let i=String(Xl.get(e));if(Ur(i)||i==="Unsupported")this.#e=i;else if(Ur(e))this.#e=e;else throw new TypeError("invalid entry type: "+e)}},pm=(t,e)=>{let n=t,r="",o,a=Yi.parse(t).root||".";if(Buffer.byteLength(n)<100)o=[n,r,!1];else{r=Yi.dirname(n),n=Yi.basename(n);do Buffer.byteLength(n)<=100&&Buffer.byteLength(r)<=e?o=[n,r,!1]:Buffer.byteLength(n)>100&&Buffer.byteLength(r)<=e?o=[n.slice(0,99),r,!0]:(n=Yi.join(Yi.basename(r),n),r=Yi.dirname(r));while(r!==a&&o===void 0);o||(o=[t.slice(0,99),"",!0])}return o},Dt=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),Ha=(t,e,i)=>hm(Et(t,e,i)),hm=t=>t===void 0?void 0:new Date(t*1e3),Et=(t,e,i)=>Number(t[e])&128?yl(t.subarray(e,e+i)):zm(t,e,i),fm=t=>isNaN(t)?void 0:t,zm=(t,e,i)=>fm(parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),Rm={12:8589934591,8:2097151},It=(t,e,i,n)=>n===void 0?!1:n>Rm[i]||n<0?(Dl(n,t.subarray(e,e+i)),!0):(dm(t,e,i,n),!1),dm=(t,e,i,n)=>t.write(jm(n,i),e,i,"ascii"),jm=(t,e)=>gm(Math.floor(t).toString(8),e),gm=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",La=(t,e,i,n)=>n===void 0?!1:It(t,e,i,n.getTime()/1e3),xm=new Array(156).join("\0"),yt=(t,e,i,n)=>n===void 0?!1:(t.write(n+xm,e,i,"utf8"),n.length!==Buffer.byteLength(n)||n.length>i);import{basename as Gm}from"node:path";var pt=class t{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,i=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=i,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(e),n=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(n);for(let o=0;o<512;o++)r[o]=0;new ne({path:("PaxHeader/"+Gm(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(e,512,i,"utf8");for(let o=i+512;o<r.length;o++)r[o]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let i=this[e],n=i instanceof Date?i.getTime()/1e3:i,r=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+n+`
|
|
18
|
-
`,o=Buffer.byteLength(r),a=Math.floor(Math.log(o)/Math.log(10))+1;return o+a>=Math.pow(10,a)&&(a+=1),a+o+r}static parse(e,i,n=!1){return new t(
|
|
19
|
-
`).reduce(Wm,Object.create(null)),Wm=(t,e)=>{let i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;e=e.slice((i+" ").length);let n=e.split("="),r=n.shift();if(!r)return t;let o=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),a=n.join("=");return t[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(Number(a)*1e3):/^[0-9]+$/.test(a)?+a:a,t};import{EventEmitter as rs}from"node:events";import t3 from"node:stream";import{StringDecoder as Mm}from"node:string_decoder";var Ll=typeof process=="object"&&process?process:{stdout:null,stderr:null},Cm=t=>!!t&&typeof t=="object"&&(t instanceof Ne||t instanceof t3||Om(t)||Um(t)),Om=t=>!!t&&typeof t=="object"&&t instanceof rs&&typeof t.pipe=="function"&&t.pipe!==t3.Writable.prototype.pipe,Um=t=>!!t&&typeof t=="object"&&t instanceof rs&&typeof t.write=="function"&&typeof t.end=="function",He=Symbol("EOF"),Le=Symbol("maybeEmitEnd"),ht=Symbol("emittedEnd"),Vr=Symbol("emittingEnd"),In=Symbol("emittedError"),Nr=Symbol("closed"),_l=Symbol("read"),kr=Symbol("flush"),$l=Symbol("flushChunk"),xe=Symbol("encoding"),Wi=Symbol("decoder"),b=Symbol("flowing"),pn=Symbol("paused"),Mi=Symbol("resume"),P=Symbol("buffer"),$=Symbol("pipes"),q=Symbol("bufferLength"),_a=Symbol("bufferPush"),Fr=Symbol("bufferShift"),T=Symbol("objectMode"),U=Symbol("destroyed"),$a=Symbol("error"),es=Symbol("emitData"),e3=Symbol("emitEnd"),ts=Symbol("emitEnd2"),Ve=Symbol("async"),is=Symbol("abort"),Qr=Symbol("aborted"),hn=Symbol("signal"),wt=Symbol("dataListeners"),re=Symbol("discarded"),fn=t=>Promise.resolve().then(t),Km=t=>t(),Vm=t=>t==="end"||t==="finish"||t==="prefinish",Nm=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,km=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Jr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[Mi](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ns=class extends Jr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},Fm=t=>!!t.objectMode,Qm=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",Ne=class extends rs{[b]=!1;[pn]=!1;[$]=[];[P]=[];[T];[xe];[Ve];[Wi];[He]=!1;[ht]=!1;[Vr]=!1;[Nr]=!1;[In]=null;[q]=0;[U]=!1;[hn];[Qr]=!1;[wt]=0;[re]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Fm(i)?(this[T]=!0,this[xe]=null):Qm(i)?(this[xe]=i.encoding,this[T]=!1):(this[T]=!1,this[xe]=null),this[Ve]=!!i.async,this[Wi]=this[xe]?new Mm(this[xe]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[P]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[$]});let{signal:n}=i;n&&(this[hn]=n,n.aborted?this[is]():n.addEventListener("abort",()=>this[is]()))}get bufferLength(){return this[q]}get encoding(){return this[xe]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[T]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ve]}set async(e){this[Ve]=this[Ve]||!!e}[is](){this[Qr]=!0,this.emit("abort",this[hn]?.reason),this.destroy(this[hn]?.reason)}get aborted(){return this[Qr]}set aborted(e){}write(e,i,n){if(this[Qr])return!1;if(this[He])throw new Error("write after end");if(this[U])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Ve]?fn:Km;if(!this[T]&&!Buffer.isBuffer(e)){if(km(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Nm(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[T]?(this[b]&&this[q]!==0&&this[kr](!0),this[b]?this.emit("data",e):this[_a](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[b]):e.length?(typeof e=="string"&&!(i===this[xe]&&!this[Wi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[xe]&&(e=this[Wi].write(e)),this[b]&&this[q]!==0&&this[kr](!0),this[b]?this.emit("data",e):this[_a](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[b]):(this[q]!==0&&this.emit("readable"),n&&r(n),this[b])}read(e){if(this[U])return null;if(this[re]=!1,this[q]===0||e===0||e&&e>this[q])return this[Le](),null;this[T]&&(e=null),this[P].length>1&&!this[T]&&(this[P]=[this[xe]?this[P].join(""):Buffer.concat(this[P],this[q])]);let i=this[_l](e||null,this[P][0]);return this[Le](),i}[_l](e,i){if(this[T])this[Fr]();else{let n=i;e===n.length||e===null?this[Fr]():typeof n=="string"?(this[P][0]=n.slice(e),i=n.slice(0,e),this[q]-=e):(this[P][0]=n.subarray(e),i=n.subarray(0,e),this[q]-=e)}return this.emit("data",i),!this[P].length&&!this[He]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[He]=!0,this.writable=!1,(this[b]||!this[pn])&&this[Le](),this}[Mi](){this[U]||(!this[wt]&&!this[$].length&&(this[re]=!0),this[pn]=!1,this[b]=!0,this.emit("resume"),this[P].length?this[kr]():this[He]?this[Le]():this.emit("drain"))}resume(){return this[Mi]()}pause(){this[b]=!1,this[pn]=!0,this[re]=!1}get destroyed(){return this[U]}get flowing(){return this[b]}get paused(){return this[pn]}[_a](e){this[T]?this[q]+=1:this[q]+=e.length,this[P].push(e)}[Fr](){return this[T]?this[q]-=1:this[q]-=this[P][0].length,this[P].shift()}[kr](e=!1){do;while(this[$l](this[Fr]())&&this[P].length);!e&&!this[P].length&&!this[He]&&this.emit("drain")}[$l](e){return this.emit("data",e),this[b]}pipe(e,i){if(this[U])return e;this[re]=!1;let n=this[ht];return i=i||{},e===Ll.stdout||e===Ll.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[$].push(i.proxyErrors?new ns(this,e,i):new Jr(this,e,i)),this[Ve]?fn(()=>this[Mi]()):this[Mi]()),e}unpipe(e){let i=this[$].find(n=>n.dest===e);i&&(this[$].length===1?(this[b]&&this[wt]===0&&(this[b]=!1),this[$]=[]):this[$].splice(this[$].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[re]=!1,this[wt]++,!this[$].length&&!this[b]&&this[Mi]();else if(e==="readable"&&this[q]!==0)super.emit("readable");else if(Vm(e)&&this[ht])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[In]){let r=i;this[Ve]?fn(()=>r.call(this,this[In])):r.call(this,this[In])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[wt]=this.listeners("data").length,this[wt]===0&&!this[re]&&!this[$].length&&(this[b]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[wt]=0,!this[re]&&!this[$].length&&(this[b]=!1)),i}get emittedEnd(){return this[ht]}[Le](){!this[Vr]&&!this[ht]&&!this[U]&&this[P].length===0&&this[He]&&(this[Vr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Nr]&&this.emit("close"),this[Vr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==U&&this[U])return!1;if(e==="data")return!this[T]&&!n?!1:this[Ve]?(fn(()=>this[es](n)),!0):this[es](n);if(e==="end")return this[e3]();if(e==="close"){if(this[Nr]=!0,!this[ht]&&!this[U])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[In]=n,super.emit($a,n);let o=!this[hn]||this.listeners("error").length?super.emit("error",n):!1;return this[Le](),o}else if(e==="resume"){let o=super.emit("resume");return this[Le](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[Le](),r}[es](e){for(let n of this[$])n.dest.write(e)===!1&&this.pause();let i=this[re]?!1:super.emit("data",e);return this[Le](),i}[e3](){return this[ht]?!1:(this[ht]=!0,this.readable=!1,this[Ve]?(fn(()=>this[ts]()),!0):this[ts]())}[ts](){if(this[Wi]){let i=this[Wi].end();if(i){for(let n of this[$])n.dest.write(i);this[re]||super.emit("data",i)}}for(let i of this[$])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[T]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[T]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[T])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[xe]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(U,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[re]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[He])return i();let o,a,c=m=>{this.off("data",l),this.off("end",v),this.off(U,A),i(),a(m)},l=m=>{this.off("error",c),this.off("end",v),this.off(U,A),this.pause(),o({value:m,done:!!this[He]})},v=()=>{this.off("error",c),this.off("data",l),this.off(U,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((m,I)=>{a=I,o=m,this.once(U,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[re]=!1;let e=!1,i=()=>(this.pause(),this.off($a,i),this.off(U,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once($a,i),this.once(U,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[U])return e?this.emit("error",e):this.emit(U),this;this[U]=!0,this[re]=!0,this[P].length=0,this[q]=0;let i=this;return typeof i.close=="function"&&!this[Nr]&&i.close(),e?this.emit("error",e):this.emit(U),this}static get isStream(){return Cm}};var Jm=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,R=Jm!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");var Ci=class extends Ne{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,i,n){switch(super({}),this.pause(),this.extended=i,this.globalExtended=n,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=R(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?R(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,i&&this.#e(i),n&&this.#e(n,!0)}write(e){let i=e.length;if(i>this.blockRemain)throw new Error("writing more to entry than is appropriate");let n=this.remain,r=this.blockRemain;return this.remain=Math.max(0,n-i),this.blockRemain=Math.max(0,r-i),this.ignore?!0:n>=i?super.write(e):super.write(e.subarray(0,n))}#e(e,i=!1){e.path&&(e.path=R(e.path)),e.linkpath&&(e.linkpath=R(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,r])=>!(r==null||n==="path"&&i))))}};var Tt=(t,e,i,n={})=>{t.file&&(n.file=t.file),t.cwd&&(n.cwd=t.cwd),n.code=i instanceof Error&&i.code||e,n.tarCode=e,!t.strict&&n.recoverable!==!1?(i instanceof Error&&(n=Object.assign(i,n),i=i.message),t.emit("warn",e,i,n)):i instanceof Error?t.emit("error",Object.assign(i,n)):t.emit("error",Object.assign(new Error(`${e}: ${i}`),n))};var Zm=1024*1024,ls=Buffer.from([31,139]),vs=Buffer.from([40,181,47,253]),bm=Math.max(ls.length,vs.length),ue=Symbol("state"),Xt=Symbol("writeEntry"),_e=Symbol("readEntry"),os=Symbol("nextEntry"),i3=Symbol("processEntry"),ke=Symbol("extendedHeader"),zn=Symbol("globalExtendedHeader"),ft=Symbol("meta"),n3=Symbol("emitMeta"),x=Symbol("buffer"),$e=Symbol("queue"),zt=Symbol("ended"),as=Symbol("emittedEnd"),Ht=Symbol("emit"),K=Symbol("unzip"),Br=Symbol("consumeChunk"),Zr=Symbol("consumeChunkSub"),ss=Symbol("consumeBody"),r3=Symbol("consumeMeta"),o3=Symbol("consumeHeader"),Rn=Symbol("consuming"),cs=Symbol("bufferConcat"),br=Symbol("maybeEnd"),Oi=Symbol("writing"),Rt=Symbol("aborted"),Pr=Symbol("onDone"),Lt=Symbol("sawValidEntry"),qr=Symbol("sawNullBlock"),Dr=Symbol("sawEOF"),a3=Symbol("closeStream"),Pm=()=>!0,et=class extends Bm{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[$e]=[];[x];[_e];[Xt];[ue]="begin";[ft]="";[ke];[zn];[zt]=!1;[K];[Rt]=!1;[Lt];[qr]=!1;[Dr]=!1;[Oi]=!1;[Rn]=!1;[as]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(Pr,()=>{(this[ue]==="begin"||this[Lt]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(Pr,e.ondone):this.on(Pr,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||Zm,this.filter=typeof e.filter=="function"?e.filter:Pm;let i=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:i?void 0:!1;let n=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:n?!0:void 0,this.on("end",()=>this[a3]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,i,n={}){Tt(this,e,i,n)}[o3](e,i){this[Lt]===void 0&&(this[Lt]=!1);let n;try{n=new ne(e,i,this[ke],this[zn])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(n.nullBlock)this[qr]?(this[Dr]=!0,this[ue]==="begin"&&(this[ue]="header"),this[Ht]("eof")):(this[qr]=!0,this[Ht]("nullBlock"));else if(this[qr]=!1,!n.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:n});else if(!n.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:n});else{let r=n.type;if(/^(Symbolic)?Link$/.test(r)&&!n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:n});else if(!/^(Symbolic)?Link$/.test(r)&&!/^(Global)?ExtendedHeader$/.test(r)&&n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:n});else{let o=this[Xt]=new Ci(n,this[ke],this[zn]);if(!this[Lt])if(o.remain){let a=()=>{o.invalid||(this[Lt]=!0)};o.on("end",a)}else this[Lt]=!0;o.meta?o.size>this.maxMetaEntrySize?(o.ignore=!0,this[Ht]("ignoredEntry",o),this[ue]="ignore",o.resume()):o.size>0&&(this[ft]="",o.on("data",a=>this[ft]+=a),this[ue]="meta"):(this[ke]=void 0,o.ignore=o.ignore||!this.filter(o.path,o),o.ignore?(this[Ht]("ignoredEntry",o),this[ue]=o.remain?"ignore":"header",o.resume()):(o.remain?this[ue]="body":(this[ue]="header",o.end()),this[_e]?this[$e].push(o):(this[$e].push(o),this[os]())))}}}[a3](){queueMicrotask(()=>this.emit("close"))}[i3](e){let i=!0;if(!e)this[_e]=void 0,i=!1;else if(Array.isArray(e)){let[n,...r]=e;this.emit(n,...r)}else this[_e]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[os]()),i=!1);return i}[os](){do;while(this[i3](this[$e].shift()));if(!this[$e].length){let e=this[_e];!e||e.flowing||e.size===e.remain?this[Oi]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[ss](e,i){let n=this[Xt];if(!n)throw new Error("attempt to consume body without entry??");let r=n.blockRemain??0,o=r>=e.length&&i===0?e:e.subarray(i,i+r);return n.write(o),n.blockRemain||(this[ue]="header",this[Xt]=void 0,n.end()),o.length}[r3](e,i){let n=this[Xt],r=this[ss](e,i);return!this[Xt]&&n&&this[n3](n),r}[Ht](e,i,n){!this[$e].length&&!this[_e]?this.emit(e,i,n):this[$e].push([e,i,n])}[n3](e){switch(this[Ht]("meta",this[ft]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[ke]=pt.parse(this[ft],this[ke],!1);break;case"GlobalExtendedHeader":this[zn]=pt.parse(this[ft],this[zn],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let i=this[ke]??Object.create(null);this[ke]=i,i.path=this[ft].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let i=this[ke]||Object.create(null);this[ke]=i,i.linkpath=this[ft].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Rt]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,i,n){if(typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8")),this[Rt])return n?.(),!1;if((this[K]===void 0||this.brotli===void 0&&this[K]===!1)&&e){if(this[x]&&(e=Buffer.concat([this[x],e]),this[x]=void 0),e.length<bm)return this[x]=e,n?.(),!0;for(let l=0;this[K]===void 0&&l<ls.length;l++)e[l]!==ls[l]&&(this[K]=!1);let a=!1;if(this[K]===!1&&this.zstd!==!1){a=!0;for(let l=0;l<vs.length;l++)if(e[l]!==vs[l]){a=!1;break}}let c=this.brotli===void 0&&!a;if(this[K]===!1&&c)if(e.length<512)if(this[zt])this.brotli=!0;else return this[x]=e,n?.(),!0;else try{new ne(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[K]===void 0||this[K]===!1&&(this.brotli||a)){let l=this[zt];this[zt]=!1,this[K]=this[K]===void 0?new Gr({}):a?new Or({}):new Wr({}),this[K].on("data",A=>this[Br](A)),this[K].on("error",A=>this.abort(A)),this[K].on("end",()=>{this[zt]=!0,this[Br]()}),this[Oi]=!0;let v=!!this[K][l?"end":"write"](e);return this[Oi]=!1,n?.(),v}}this[Oi]=!0,this[K]?this[K].write(e):this[Br](e),this[Oi]=!1;let o=this[$e].length?!1:this[_e]?this[_e].flowing:!0;return!o&&!this[$e].length&&this[_e]?.once("drain",()=>this.emit("drain")),n?.(),o}[cs](e){e&&!this[Rt]&&(this[x]=this[x]?Buffer.concat([this[x],e]):e)}[br](){if(this[zt]&&!this[as]&&!this[Rt]&&!this[Rn]){this[as]=!0;let e=this[Xt];if(e&&e.blockRemain){let i=this[x]?this[x].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${i} available)`,{entry:e}),this[x]&&e.write(this[x]),e.end()}this[Ht](Pr)}}[Br](e){if(this[Rn]&&e)this[cs](e);else if(!e&&!this[x])this[br]();else if(e){if(this[Rn]=!0,this[x]){this[cs](e);let i=this[x];this[x]=void 0,this[Zr](i)}else this[Zr](e);for(;this[x]&&this[x]?.length>=512&&!this[Rt]&&!this[Dr];){let i=this[x];this[x]=void 0,this[Zr](i)}this[Rn]=!1}(!this[x]||this[zt])&&this[br]()}[Zr](e){let i=0,n=e.length;for(;i+512<=n&&!this[Rt]&&!this[Dr];)switch(this[ue]){case"begin":case"header":this[o3](e,i),i+=512;break;case"ignore":case"body":i+=this[ss](e,i);break;case"meta":i+=this[r3](e,i);break;default:throw new Error("invalid state: "+this[ue])}i<n&&(this[x]?this[x]=Buffer.concat([e.subarray(i),this[x]]):this[x]=e.subarray(i))}end(e,i,n){return typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,i)),n&&this.once("finish",n),this[Rt]||(this[K]?(e&&this[K].write(e),this[K].end()):(this[zt]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[br]())),this}};var dt=t=>{let e=t.length-1,i=-1;for(;e>-1&&t.charAt(e)==="/";)i=e,e--;return i===-1?t:t.slice(0,i)};var ym=t=>{let e=t.onReadEntry;t.onReadEntry=e?i=>{e(i),i.resume()}:i=>i.resume()},As=(t,e)=>{let i=new Map(e.map(o=>[dt(o),!0])),n=t.filter,r=(o,a="")=>{let c=a||Dm(o).root||".",l;if(o===c)l=!1;else{let v=i.get(o);v!==void 0?l=v:l=r(qm(o),c)}return i.set(o,l),l};t.filter=n?(o,a)=>n(o,a)&&r(dt(o)):o=>r(dt(o))},wm=t=>{let e=new et(t),i=t.file,n;try{n=Ui.openSync(i,"r");let r=Ui.fstatSync(n),o=t.maxReadSize||16*1024*1024;if(r.size<o){let a=Buffer.allocUnsafe(r.size),c=Ui.readSync(n,a,0,r.size,0);e.end(c===a.byteLength?a:a.subarray(0,c))}else{let a=0,c=Buffer.allocUnsafe(o);for(;a<r.size;){let l=Ui.readSync(n,c,0,o,a);if(l===0)break;a+=l,e.write(c.subarray(0,l))}e.end()}}finally{if(typeof n=="number")try{Ui.closeSync(n)}catch{}}},Tm=(t,e)=>{let i=new et(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((a,c)=>{i.on("error",c),i.on("end",a),Ui.stat(r,(l,v)=>{if(l)c(l);else{let A=new Zt(r,{readSize:n,size:v.size});A.on("error",c),A.pipe(i)}})})},_t=Ue(wm,Tm,t=>new et(t),t=>new et(t),(t,e)=>{e?.length&&As(t,e),t.noResume||ym(t)});import ro from"fs";import Fe from"fs";import v3 from"path";var ms=(t,e,i)=>(t&=4095,i&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t);import{win32 as Xm}from"node:path";var{isAbsolute:Hm,parse:s3}=Xm,dn=t=>{let e="",i=s3(t);for(;Hm(t)||i.root;){let n=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(n.length),e+=n,i=s3(t)}return[e,t]};var yr=["|","<",">","?",":"],us=yr.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),Lm=new Map(yr.map((t,e)=>[t,us[e]])),_m=new Map(us.map((t,e)=>[t,yr[e]])),Es=t=>yr.reduce((e,i)=>e.split(i).join(Lm.get(i)),t),c3=t=>us.reduce((e,i)=>e.split(i).join(_m.get(i)),t);var I3=(t,e)=>e?(t=R(t).replace(/^\.(\/|$)/,""),dt(e)+"/"+t):R(t),$m=16*1024*1024,A3=Symbol("process"),m3=Symbol("file"),u3=Symbol("directory"),ps=Symbol("symlink"),E3=Symbol("hardlink"),jn=Symbol("header"),wr=Symbol("read"),hs=Symbol("lstat"),Tr=Symbol("onlstat"),fs=Symbol("onread"),zs=Symbol("onreadlink"),Rs=Symbol("openfile"),ds=Symbol("onopenfile"),jt=Symbol("close"),Xr=Symbol("mode"),js=Symbol("awaitDrain"),Is=Symbol("ondrain"),Qe=Symbol("prefix"),gn=class extends Ne{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,i={}){let n=cn(i);super(),this.path=R(e),this.portable=!!n.portable,this.maxReadSize=n.maxReadSize||$m,this.linkCache=n.linkCache||new Map,this.statCache=n.statCache||new Map,this.preservePaths=!!n.preservePaths,this.cwd=R(n.cwd||process.cwd()),this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.mtime=n.mtime,this.prefix=n.prefix?R(n.prefix):void 0,this.onWriteEntry=n.onWriteEntry,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let r=!1;if(!this.preservePaths){let[a,c]=dn(this.path);a&&typeof c=="string"&&(this.path=c,r=a)}this.win32=!!n.win32||process.platform==="win32",this.win32&&(this.path=c3(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=R(n.absolute||v3.resolve(this.cwd,e)),this.path===""&&(this.path="./"),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path});let o=this.statCache.get(this.absolute);o?this[Tr](o):this[hs]()}warn(e,i,n={}){return Tt(this,e,i,n)}emit(e,...i){return e==="error"&&(this.#e=!0),super.emit(e,...i)}[hs](){Fe.lstat(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[Tr](i)})}[Tr](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=eu(e),this.emit("stat",e),this[A3]()}[A3](){switch(this.type){case"File":return this[m3]();case"Directory":return this[u3]();case"SymbolicLink":return this[ps]();default:return this.end()}}[Xr](e){return ms(e,this.type==="Directory",this.portable)}[Qe](e){return I3(e,this.prefix)}[jn](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new ne({path:this[Qe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Qe](this.linkpath):this.linkpath,mode:this[Xr](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new pt({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[Qe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Qe](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[u3](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[jn](),this.end()}[ps](){Fe.readlink(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[zs](i)})}[zs](e){this.linkpath=R(e),this[jn](),this.end()}[E3](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=R(v3.relative(this.cwd,e)),this.stat.size=0,this[jn](),this.end()}[m3](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,i=this.linkCache.get(e);if(i?.indexOf(this.cwd)===0)return this[E3](i);this.linkCache.set(e,this.absolute)}if(this[jn](),this.stat.size===0)return this.end();this[Rs]()}[Rs](){Fe.open(this.absolute,"r",(e,i)=>{if(e)return this.emit("error",e);this[ds](i)})}[ds](e){if(this.fd=e,this.#e)return this[jt]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let i=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(i),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[wr]()}[wr](){let{fd:e,buf:i,offset:n,length:r,pos:o}=this;if(e===void 0||i===void 0)throw new Error("cannot read file without first opening");Fe.read(e,i,n,r,o,(a,c)=>{if(a)return this[jt](()=>this.emit("error",a));this[fs](c)})}[jt](e=()=>{}){this.fd!==void 0&&Fe.close(this.fd,e)}[fs](e){if(e<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[jt](()=>this.emit("error",r))}if(e>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[jt](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let r=e;r<this.length&&e<this.blockRemain;r++)this.buf[r+this.offset]=0,e++,this.remain++;let i=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(i)?this[Is]():this[js](()=>this[Is]())}[js](e){this.once("drain",e)}write(e,i,n){if(typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8")),this.blockRemain<e.length){let r=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",r)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,n)}[Is](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[jt](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[wr]()}},Hr=class extends gn{sync=!0;[hs](){this[Tr](Fe.lstatSync(this.absolute))}[ps](){this[zs](Fe.readlinkSync(this.absolute))}[Rs](){this[ds](Fe.openSync(this.absolute,"r"))}[wr](){let e=!0;try{let{fd:i,buf:n,offset:r,length:o,pos:a}=this;if(i===void 0||n===void 0)throw new Error("fd and buf must be set in READ method");let c=Fe.readSync(i,n,r,o,a);this[fs](c),e=!1}finally{if(e)try{this[jt](()=>{})}catch{}}}[js](e){e()}[jt](e=()=>{}){this.fd!==void 0&&Fe.closeSync(this.fd),e()}},Lr=class extends Ne{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,i,n={}){return Tt(this,e,i,n)}constructor(e,i={}){let n=cn(i);super(),this.preservePaths=!!n.preservePaths,this.portable=!!n.portable,this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.onWriteEntry=n.onWriteEntry,this.readEntry=e;let{type:r}=e;if(r==="Unsupported")throw new Error("writing entry that should be ignored");this.type=r,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=n.prefix,this.path=R(e.path),this.mode=e.mode!==void 0?this[Xr](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:n.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?R(e.linkpath):void 0,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let o=!1;if(!this.preservePaths){let[c,l]=dn(this.path);c&&typeof l=="string"&&(this.path=l,o=c)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new ne({path:this[Qe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Qe](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),o&&this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path}),this.header.encode()&&!this.noPax&&super.write(new pt({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[Qe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Qe](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let a=this.header?.block;if(!a)throw new Error("failed to encode header");super.write(a),e.pipe(this)}[Qe](e){return I3(e,this.prefix)}[Xr](e){return ms(e,this.type==="Directory",this.portable)}write(e,i,n){typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8"));let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(e,n)}end(e,i,n){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,i??"utf8")),n&&this.once("finish",n),e?super.end(e,n):super.end(n),this}},eu=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";var _r=class t{tail;head;length=0;static create(e=[]){return new t(e)}constructor(e=[]){for(let i of e)this.push(i)}*[Symbol.iterator](){for(let e=this.head;e;e=e.next)yield e.value}removeNode(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");let i=e.next,n=e.prev;return i&&(i.prev=n),n&&(n.next=i),e===this.head&&(this.head=i),e===this.tail&&(this.tail=n),this.length--,e.next=void 0,e.prev=void 0,e.list=void 0,i}unshiftNode(e){if(e===this.head)return;e.list&&e.list.removeNode(e);let i=this.head;e.list=this,e.next=i,i&&(i.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}pushNode(e){if(e===this.tail)return;e.list&&e.list.removeNode(e);let i=this.tail;e.list=this,e.prev=i,i&&(i.next=e),this.tail=e,this.head||(this.head=e),this.length++}push(...e){for(let i=0,n=e.length;i<n;i++)iu(this,e[i]);return this.length}unshift(...e){for(var i=0,n=e.length;i<n;i++)nu(this,e[i]);return this.length}pop(){if(!this.tail)return;let e=this.tail.value,i=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,i.list=void 0,this.length--,e}shift(){if(!this.head)return;let e=this.head.value,i=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,i.list=void 0,this.length--,e}forEach(e,i){i=i||this;for(let n=this.head,r=0;n;r++)e.call(i,n.value,r,this),n=n.next}forEachReverse(e,i){i=i||this;for(let n=this.tail,r=this.length-1;n;r--)e.call(i,n.value,r,this),n=n.prev}get(e){let i=0,n=this.head;for(;n&&i<e;i++)n=n.next;if(i===e&&n)return n.value}getReverse(e){let i=0,n=this.tail;for(;n&&i<e;i++)n=n.prev;if(i===e&&n)return n.value}map(e,i){i=i||this;let n=new t;for(let r=this.head;r;)n.push(e.call(i,r.value,this)),r=r.next;return n}mapReverse(e,i){i=i||this;var n=new t;for(let r=this.tail;r;)n.push(e.call(i,r.value,this)),r=r.prev;return n}reduce(e,i){let n,r=this.head;if(arguments.length>1)n=i;else if(this.head)r=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;r;o++)n=e(n,r.value,o),r=r.next;return n}reduceReverse(e,i){let n,r=this.tail;if(arguments.length>1)n=i;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let o=this.length-1;r;o--)n=e(n,r.value,o),r=r.prev;return n}toArray(){let e=new Array(this.length);for(let i=0,n=this.head;n;i++)e[i]=n.value,n=n.next;return e}toArrayReverse(){let e=new Array(this.length);for(let i=0,n=this.tail;n;i++)e[i]=n.value,n=n.prev;return e}slice(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let n=new t;if(i<e||i<0)return n;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.head,o=0;for(o=0;r&&o<e;o++)r=r.next;for(;r&&o<i;o++,r=r.next)n.push(r.value);return n}sliceReverse(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let n=new t;if(i<e||i<0)return n;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.length,o=this.tail;for(;o&&r>i;r--)o=o.prev;for(;o&&r>e;r--,o=o.prev)n.push(o.value);return n}splice(e,i=0,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);let r=this.head;for(let a=0;r&&a<e;a++)r=r.next;let o=[];for(let a=0;r&&a<i;a++)o.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let a of n)r=tu(this,r,a);return o}reverse(){let e=this.head,i=this.tail;for(let n=e;n;n=n.prev){let r=n.prev;n.prev=n.next,n.next=r}return this.head=i,this.tail=e,this}};function tu(t,e,i){let n=e,r=e?e.next:t.head,o=new xn(i,n,r,t);return o.next===void 0&&(t.tail=o),o.prev===void 0&&(t.head=o),t.length++,o}function iu(t,e){t.tail=new xn(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function nu(t,e){t.head=new xn(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var xn=class{list;next;prev;value;constructor(e,i,n,r){this.list=r,this.value=e,i?(i.next=this,this.prev=i):this.prev=void 0,n?(n.prev=this,this.next=n):this.next=void 0}};import R3 from"path";var oo=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,i){this.path=e||"./",this.absolute=i}},p3=Buffer.alloc(1024),$r=Symbol("onStat"),Gn=Symbol("ended"),Ge=Symbol("queue"),Ki=Symbol("current"),$t=Symbol("process"),Sn=Symbol("processing"),h3=Symbol("processJob"),Se=Symbol("jobs"),gs=Symbol("jobDone"),eo=Symbol("addFSEntry"),f3=Symbol("addTarEntry"),Ss=Symbol("stat"),Ys=Symbol("readdir"),to=Symbol("onreaddir"),io=Symbol("pipe"),z3=Symbol("entry"),xs=Symbol("entryOpt"),no=Symbol("writeEntryClass"),d3=Symbol("write"),Gs=Symbol("ondrain"),gt=class extends Ne{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[no];onWriteEntry;[Ge];[Se]=0;[Sn]=!1;[Gn]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=R(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[no]=gn,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new xr(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new Yr(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new Cr(e.zstd)),!this.zip)throw new Error("impossible");let i=this.zip;i.on("data",n=>super.write(n)),i.on("end",()=>super.end()),i.on("drain",()=>this[Gs]()),this.on("resume",()=>i.resume())}else this.on("drain",this[Gs]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[Ge]=new _r,this[Se]=0,this.jobs=Number(e.jobs)||4,this[Sn]=!1,this[Gn]=!1}[d3](e){return super.write(e)}add(e){return this.write(e),this}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i=void 0),e&&this.add(e),this[Gn]=!0,this[$t](),n&&n(),this}write(e){if(this[Gn])throw new Error("write after end");return e instanceof Ci?this[f3](e):this[eo](e),this.flowing}[f3](e){let i=R(R3.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let n=new oo(e.path,i);n.entry=new Lr(e,this[xs](n)),n.entry.on("end",()=>this[gs](n)),this[Se]+=1,this[Ge].push(n)}this[$t]()}[eo](e){let i=R(R3.resolve(this.cwd,e));this[Ge].push(new oo(e,i)),this[$t]()}[Ss](e){e.pending=!0,this[Se]+=1;let i=this.follow?"stat":"lstat";ro[i](e.absolute,(n,r)=>{e.pending=!1,this[Se]-=1,n?this.emit("error",n):this[$r](e,r)})}[$r](e,i){this.statCache.set(e.absolute,i),e.stat=i,this.filter(e.path,i)||(e.ignore=!0),this[$t]()}[Ys](e){e.pending=!0,this[Se]+=1,ro.readdir(e.absolute,(i,n)=>{if(e.pending=!1,this[Se]-=1,i)return this.emit("error",i);this[to](e,n)})}[to](e,i){this.readdirCache.set(e.absolute,i),e.readdir=i,this[$t]()}[$t](){if(!this[Sn]){this[Sn]=!0;for(let e=this[Ge].head;e&&this[Se]<this.jobs;e=e.next)if(this[h3](e.value),e.value.ignore){let i=e.next;this[Ge].removeNode(e),e.next=i}this[Sn]=!1,this[Gn]&&!this[Ge].length&&this[Se]===0&&(this.zip?this.zip.end(p3):(super.write(p3),super.end()))}}get[Ki](){return this[Ge]&&this[Ge].head&&this[Ge].head.value}[gs](e){this[Ge].shift(),this[Se]-=1,this[$t]()}[h3](e){if(!e.pending){if(e.entry){e===this[Ki]&&!e.piped&&this[io](e);return}if(!e.stat){let i=this.statCache.get(e.absolute);i?this[$r](e,i):this[Ss](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let i=this.readdirCache.get(e.absolute);if(i?this[to](e,i):this[Ys](e),!e.readdir)return}if(e.entry=this[z3](e),!e.entry){e.ignore=!0;return}e===this[Ki]&&!e.piped&&this[io](e)}}}[xs](e){return{onwarn:(i,n,r)=>this.warn(i,n,r),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[z3](e){this[Se]+=1;try{return new this[no](e.path,this[xs](e)).on("end",()=>this[gs](e)).on("error",n=>this.emit("error",n))}catch(i){this.emit("error",i)}}[Gs](){this[Ki]&&this[Ki].entry&&this[Ki].entry.resume()}[io](e){e.piped=!0,e.readdir&&e.readdir.forEach(r=>{let o=e.path,a=o==="./"?"":o.replace(/\/*$/,"/");this[eo](a+r)});let i=e.entry,n=this.zip;if(!i)throw new Error("cannot pipe without source");n?i.on("data",r=>{n.write(r)||i.pause()}):i.on("data",r=>{super.write(r)||i.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,i,n={}){Tt(this,e,i,n)}},ei=class extends gt{sync=!0;constructor(e){super(e),this[no]=Hr}pause(){}resume(){}[Ss](e){let i=this.follow?"statSync":"lstatSync";this[$r](e,ro[i](e.absolute))}[Ys](e){this[to](e,ro.readdirSync(e.absolute))}[io](e){let i=e.entry,n=this.zip;if(e.readdir&&e.readdir.forEach(r=>{let o=e.path,a=o==="./"?"":o.replace(/\/*$/,"/");this[eo](a+r)}),!i)throw new Error("Cannot pipe without source");n?i.on("data",r=>{n.write(r)}):i.on("data",r=>{super[d3](r)})}};var ru=(t,e)=>{let i=new ei(t),n=new gi(t.file,{mode:t.mode||438});i.pipe(n),g3(i,e)},ou=(t,e)=>{let i=new gt(t),n=new we(t.file,{mode:t.mode||438});i.pipe(n);let r=new Promise((o,a)=>{n.on("error",a),n.on("close",o),i.on("error",a)});return x3(i,e),r},g3=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?_t({file:j3.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},x3=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await _t({file:j3.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>{t.add(r)}}):t.add(n)}t.end()},au=(t,e)=>{let i=new ei(t);return g3(i,e),i},su=(t,e)=>{let i=new gt(t);return x3(i,e),i},cu=Ue(ru,ou,au,su,(t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")});import b3 from"node:fs";import Gu from"node:assert";import{randomBytes as Z3}from"node:crypto";import j from"node:fs";import tt from"node:path";import G3 from"fs";var lu=process.env.__FAKE_PLATFORM__||process.platform,vu=lu==="win32",{O_CREAT:Au,O_TRUNC:mu,O_WRONLY:uu}=G3.constants,S3=Number(process.env.__FAKE_FS_O_FILENAME__)||G3.constants.UV_FS_O_FILEMAP||0,Eu=vu&&!!S3,Iu=512*1024,pu=S3|mu|Au|uu,Ws=Eu?t=>t<Iu?pu:"w":()=>"w";import so from"node:fs";import Yn from"node:path";var Ms=(t,e,i)=>{try{return so.lchownSync(t,e,i)}catch(n){if(n?.code!=="ENOENT")throw n}},ao=(t,e,i,n)=>{so.lchown(t,e,i,r=>{n(r&&r?.code!=="ENOENT"?r:null)})},hu=(t,e,i,n,r)=>{if(e.isDirectory())Cs(Yn.resolve(t,e.name),i,n,o=>{if(o)return r(o);let a=Yn.resolve(t,e.name);ao(a,i,n,r)});else{let o=Yn.resolve(t,e.name);ao(o,i,n,r)}},Cs=(t,e,i,n)=>{so.readdir(t,{withFileTypes:!0},(r,o)=>{if(r){if(r.code==="ENOENT")return n();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return n(r)}if(r||!o.length)return ao(t,e,i,n);let a=o.length,c=null,l=v=>{if(!c){if(v)return n(c=v);if(--a===0)return ao(t,e,i,n)}};for(let v of o)hu(t,v,e,i,l)})},fu=(t,e,i,n)=>{e.isDirectory()&&Os(Yn.resolve(t,e.name),i,n),Ms(Yn.resolve(t,e.name),i,n)},Os=(t,e,i)=>{let n;try{n=so.readdirSync(t,{withFileTypes:!0})}catch(r){let o=r;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return Ms(t,e,i);throw o}for(let r of n)fu(t,r,e,i);return Ms(t,e,i)};import oe from"node:fs";import zu from"node:fs/promises";import co from"node:path";var Wn=class extends Error{path;code;syscall="chdir";constructor(e,i){super(`${i}: Cannot cd into '${e}'`),this.path=e,this.code=i}get name(){return"CwdError"}};var Mn=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,i){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=i}get name(){return"SymlinkError"}};var Ru=(t,e)=>{oe.stat(t,(i,n)=>{(i||!n.isDirectory())&&(i=new Wn(t,i?.code||"ENOTDIR")),e(i)})},Y3=(t,e,i)=>{t=R(t);let n=e.umask??18,r=e.mode|448,o=(r&n)!==0,a=e.uid,c=e.gid,l=typeof a=="number"&&typeof c=="number"&&(a!==e.processUid||c!==e.processGid),v=e.preserve,A=e.unlink,m=R(e.cwd),I=(d,f)=>{d?i(d):f&&l?Cs(f,a,c,H=>I(H)):o?oe.chmod(t,r,i):i()};if(t===m)return Ru(t,I);if(v)return zu.mkdir(t,{mode:r,recursive:!0}).then(d=>I(null,d??void 0),I);let h=R(co.relative(m,t)).split("/");Us(m,h,r,A,m,void 0,I)},Us=(t,e,i,n,r,o,a)=>{if(!e.length)return a(null,o);let c=e.shift(),l=R(co.resolve(t+"/"+c));oe.mkdir(l,i,W3(l,e,i,n,r,o,a))},W3=(t,e,i,n,r,o,a)=>c=>{c?oe.lstat(t,(l,v)=>{if(l)l.path=l.path&&R(l.path),a(l);else if(v.isDirectory())Us(t,e,i,n,r,o,a);else if(n)oe.unlink(t,A=>{if(A)return a(A);oe.mkdir(t,i,W3(t,e,i,n,r,o,a))});else{if(v.isSymbolicLink())return a(new Mn(t,t+"/"+e.join("/")));a(c)}}):(o=o||t,Us(t,e,i,n,r,o,a))},du=t=>{let e=!1,i;try{e=oe.statSync(t).isDirectory()}catch(n){i=n?.code}finally{if(!e)throw new Wn(t,i??"ENOTDIR")}},M3=(t,e)=>{t=R(t);let i=e.umask??18,n=e.mode|448,r=(n&i)!==0,o=e.uid,a=e.gid,c=typeof o=="number"&&typeof a=="number"&&(o!==e.processUid||a!==e.processGid),l=e.preserve,v=e.unlink,A=R(e.cwd),m=d=>{d&&c&&Os(d,o,a),r&&oe.chmodSync(t,n)};if(t===A)return du(A),m();if(l)return m(oe.mkdirSync(t,{mode:n,recursive:!0})??void 0);let E=R(co.relative(A,t)).split("/"),h;for(let d=E.shift(),f=A;d&&(f+="/"+d);d=E.shift()){f=R(co.resolve(f));try{oe.mkdirSync(f,n),h=h||f}catch{let ce=oe.lstatSync(f);if(ce.isDirectory())continue;if(v){oe.unlinkSync(f),oe.mkdirSync(f,n),h=h||f;continue}else if(ce.isSymbolicLink())return new Mn(f,f+"/"+E.join("/"))}}return m(h)};import{join as U3}from"node:path";var Ks=Object.create(null),C3=1e4,Vi=new Set,O3=t=>{Vi.has(t)?Vi.delete(t):Ks[t]=t.normalize("NFD"),Vi.add(t);let e=Ks[t],i=Vi.size-C3;if(i>C3/10){for(let n of Vi)if(Vi.delete(n),delete Ks[n],--i<=0)break}return e};var ju=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,gu=ju==="win32",xu=t=>t.split("/").slice(0,-1).reduce((i,n)=>{let r=i[i.length-1];return r!==void 0&&(n=U3(r,n)),i.push(n||"/"),i},[]),lo=class{#e=new Map;#n=new Map;#i=new Set;reserve(e,i){e=gu?["win32 parallelization disabled"]:e.map(r=>dt(U3(O3(r))).toLowerCase());let n=new Set(e.map(r=>xu(r)).reduce((r,o)=>r.concat(o)));this.#n.set(i,{dirs:n,paths:e});for(let r of e){let o=this.#e.get(r);o?o.push(i):this.#e.set(r,[i])}for(let r of n){let o=this.#e.get(r);if(!o)this.#e.set(r,[new Set([i])]);else{let a=o[o.length-1];a instanceof Set?a.add(i):o.push(new Set([i]))}}return this.#s(i)}#r(e){let i=this.#n.get(e);if(!i)throw new Error("function does not have any path reservations");return{paths:i.paths.map(n=>this.#e.get(n)),dirs:[...i.dirs].map(n=>this.#e.get(n))}}check(e){let{paths:i,dirs:n}=this.#r(e);return i.every(r=>r&&r[0]===e)&&n.every(r=>r&&r[0]instanceof Set&&r[0].has(e))}#s(e){return this.#i.has(e)||!this.check(e)?!1:(this.#i.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#i.has(e))return!1;let i=this.#n.get(e);if(!i)throw new Error("invalid reservation");let{paths:n,dirs:r}=i,o=new Set;for(let a of n){let c=this.#e.get(a);if(!c||c?.[0]!==e)continue;let l=c[1];if(!l){this.#e.delete(a);continue}if(c.shift(),typeof l=="function")o.add(l);else for(let v of l)o.add(v)}for(let a of r){let c=this.#e.get(a),l=c?.[0];if(!(!c||!(l instanceof Set)))if(l.size===1&&c.length===1){this.#e.delete(a);continue}else if(l.size===1){c.shift();let v=c[0];typeof v=="function"&&o.add(v)}else l.delete(e)}return this.#i.delete(e),o.forEach(a=>this.#s(a)),!0}};var K3=Symbol("onEntry"),ks=Symbol("checkFs"),V3=Symbol("checkFs2"),Fs=Symbol("isReusable"),Ee=Symbol("makeFs"),Qs=Symbol("file"),Js=Symbol("directory"),mo=Symbol("link"),N3=Symbol("symlink"),k3=Symbol("hardlink"),F3=Symbol("unsupported"),Q3=Symbol("checkPath"),xt=Symbol("mkdir"),X=Symbol("onError"),vo=Symbol("pending"),J3=Symbol("pend"),Ni=Symbol("unpend"),Vs=Symbol("ended"),Ns=Symbol("maybeClose"),Bs=Symbol("skip"),Cn=Symbol("doChown"),On=Symbol("uid"),Un=Symbol("gid"),Kn=Symbol("checkedCwd"),Su=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Vn=Su==="win32",Yu=1024,Wu=(t,e)=>{if(!Vn)return j.unlink(t,e);let i=t+".DELETE."+Z3(16).toString("hex");j.rename(t,i,n=>{if(n)return e(n);j.unlink(i,e)})},Mu=t=>{if(!Vn)return j.unlinkSync(t);let e=t+".DELETE."+Z3(16).toString("hex");j.renameSync(t,e),j.unlinkSync(e)},B3=(t,e,i)=>t!==void 0&&t===t>>>0?t:e!==void 0&&e===e>>>0?e:i,ki=class extends et{[Vs]=!1;[Kn]=!1;[vo]=0;reservations=new lo;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[Vs]=!0,this[Ns]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:Yu,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Vn,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=R(tt.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:process.umask():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",i=>this[K3](i))}warn(e,i,n={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(n.recoverable=!1),super.warn(e,i,n)}[Ns](){this[Vs]&&this[vo]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[Q3](e){let i=R(e.path),n=i.split("/");if(this.strip){if(n.length<this.strip)return!1;if(e.type==="Link"){let r=R(String(e.linkpath)).split("/");if(r.length>=this.strip)e.linkpath=r.slice(this.strip).join("/");else return!1}n.splice(0,this.strip),e.path=n.join("/")}if(isFinite(this.maxDepth)&&n.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:i,depth:n.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(n.includes("..")||Vn&&/^[a-z]:\.\.$/i.test(n[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:i}),!1;let[r,o]=dn(i);r&&(e.path=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:e,path:i}))}if(tt.isAbsolute(e.path)?e.absolute=R(tt.resolve(e.path)):e.absolute=R(tt.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:R(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=tt.win32.parse(String(e.absolute));e.absolute=r+Es(String(e.absolute).slice(r.length));let{root:o}=tt.win32.parse(e.path);e.path=o+Es(e.path.slice(o.length))}return!0}[K3](e){if(!this[Q3](e))return e.resume();switch(Gu.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[ks](e);default:return this[F3](e)}}[X](e,i){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:i}),this[Ni](),i.resume())}[xt](e,i,n){Y3(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:i},n)}[Cn](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[On](e){return B3(this.uid,e.uid,this.processUid)}[Un](e){return B3(this.gid,e.gid,this.processGid)}[Qs](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,r=new we(String(e.absolute),{flags:Ws(e.size),mode:n,autoClose:!1});r.on("error",l=>{r.fd&&j.close(r.fd,()=>{}),r.write=()=>!0,this[X](l,e),i()});let o=1,a=l=>{if(l){r.fd&&j.close(r.fd,()=>{}),this[X](l,e),i();return}--o===0&&r.fd!==void 0&&j.close(r.fd,v=>{v?this[X](v,e):this[Ni](),i()})};r.on("finish",()=>{let l=String(e.absolute),v=r.fd;if(typeof v=="number"&&e.mtime&&!this.noMtime){o++;let A=e.atime||new Date,m=e.mtime;j.futimes(v,A,m,I=>I?j.utimes(l,A,m,E=>a(E&&I)):a())}if(typeof v=="number"&&this[Cn](e)){o++;let A=this[On](e),m=this[Un](e);typeof A=="number"&&typeof m=="number"&&j.fchown(v,A,m,I=>I?j.chown(l,A,m,E=>a(E&&I)):a())}a()});let c=this.transform&&this.transform(e)||e;c!==e&&(c.on("error",l=>{this[X](l,e),i()}),e.pipe(c)),c.pipe(r)}[Js](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode;this[xt](String(e.absolute),n,r=>{if(r){this[X](r,e),i();return}let o=1,a=()=>{--o===0&&(i(),this[Ni](),e.resume())};e.mtime&&!this.noMtime&&(o++,j.utimes(String(e.absolute),e.atime||new Date,e.mtime,a)),this[Cn](e)&&(o++,j.chown(String(e.absolute),Number(this[On](e)),Number(this[Un](e)),a)),a()})}[F3](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[N3](e,i){this[mo](e,String(e.linkpath),"symlink",i)}[k3](e,i){let n=R(tt.resolve(this.cwd,String(e.linkpath)));this[mo](e,n,"link",i)}[J3](){this[vo]++}[Ni](){this[vo]--,this[Ns]()}[Bs](e){this[Ni](),e.resume()}[Fs](e,i){return e.type==="File"&&!this.unlink&&i.isFile()&&i.nlink<=1&&!Vn}[ks](e){this[J3]();let i=[e.path];e.linkpath&&i.push(e.linkpath),this.reservations.reserve(i,n=>this[V3](e,n))}[V3](e,i){let n=c=>{i(c)},r=()=>{this[xt](this.cwd,this.dmode,c=>{if(c){this[X](c,e),n();return}this[Kn]=!0,o()})},o=()=>{if(e.absolute!==this.cwd){let c=R(tt.dirname(String(e.absolute)));if(c!==this.cwd)return this[xt](c,this.dmode,l=>{if(l){this[X](l,e),n();return}a()})}a()},a=()=>{j.lstat(String(e.absolute),(c,l)=>{if(l&&(this.keep||this.newer&&l.mtime>(e.mtime??l.mtime))){this[Bs](e),n();return}if(c||this[Fs](e,l))return this[Ee](null,e,n);if(l.isDirectory()){if(e.type==="Directory"){let v=this.chmod&&e.mode&&(l.mode&4095)!==e.mode,A=m=>this[Ee](m??null,e,n);return v?j.chmod(String(e.absolute),Number(e.mode),A):A()}if(e.absolute!==this.cwd)return j.rmdir(String(e.absolute),v=>this[Ee](v??null,e,n))}if(e.absolute===this.cwd)return this[Ee](null,e,n);Wu(String(e.absolute),v=>this[Ee](v??null,e,n))})};this[Kn]?o():r()}[Ee](e,i,n){if(e){this[X](e,i),n();return}switch(i.type){case"File":case"OldFile":case"ContiguousFile":return this[Qs](i,n);case"Link":return this[k3](i,n);case"SymbolicLink":return this[N3](i,n);case"Directory":case"GNUDumpDir":return this[Js](i,n)}}[mo](e,i,n,r){j[n](i,String(e.absolute),o=>{o?this[X](o,e):(this[Ni](),e.resume()),r()})}},Ao=t=>{try{return[null,t()]}catch(e){return[e,null]}},Nn=class extends ki{sync=!0;[Ee](e,i){return super[Ee](e,i,()=>{})}[ks](e){if(!this[Kn]){let o=this[xt](this.cwd,this.dmode);if(o)return this[X](o,e);this[Kn]=!0}if(e.absolute!==this.cwd){let o=R(tt.dirname(String(e.absolute)));if(o!==this.cwd){let a=this[xt](o,this.dmode);if(a)return this[X](a,e)}}let[i,n]=Ao(()=>j.lstatSync(String(e.absolute)));if(n&&(this.keep||this.newer&&n.mtime>(e.mtime??n.mtime)))return this[Bs](e);if(i||this[Fs](e,n))return this[Ee](null,e);if(n.isDirectory()){if(e.type==="Directory"){let a=this.chmod&&e.mode&&(n.mode&4095)!==e.mode,[c]=a?Ao(()=>{j.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[Ee](c,e)}let[o]=Ao(()=>j.rmdirSync(String(e.absolute)));this[Ee](o,e)}let[r]=e.absolute===this.cwd?[]:Ao(()=>Mu(String(e.absolute)));this[Ee](r,e)}[Qs](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,r=c=>{let l;try{j.closeSync(o)}catch(v){l=v}(c||l)&&this[X](c||l,e),i()},o;try{o=j.openSync(String(e.absolute),Ws(e.size),n)}catch(c){return r(c)}let a=this.transform&&this.transform(e)||e;a!==e&&(a.on("error",c=>this[X](c,e)),e.pipe(a)),a.on("data",c=>{try{j.writeSync(o,c,0,c.length)}catch(l){r(l)}}),a.on("end",()=>{let c=null;if(e.mtime&&!this.noMtime){let l=e.atime||new Date,v=e.mtime;try{j.futimesSync(o,l,v)}catch(A){try{j.utimesSync(String(e.absolute),l,v)}catch{c=A}}}if(this[Cn](e)){let l=this[On](e),v=this[Un](e);try{j.fchownSync(o,Number(l),Number(v))}catch(A){try{j.chownSync(String(e.absolute),Number(l),Number(v))}catch{c=c||A}}}r(c)})}[Js](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode,r=this[xt](String(e.absolute),n);if(r){this[X](r,e),i();return}if(e.mtime&&!this.noMtime)try{j.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Cn](e))try{j.chownSync(String(e.absolute),Number(this[On](e)),Number(this[Un](e)))}catch{}i(),e.resume()}[xt](e,i){try{return M3(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:i})}catch(n){return n}}[mo](e,i,n,r){let o=`${n}Sync`;try{j[o](i,String(e.absolute)),r(),e.resume()}catch(a){return this[X](a,e)}}};var Cu=t=>{let e=new Nn(t),i=t.file,n=b3.statSync(i),r=t.maxReadSize||16*1024*1024;new pr(i,{readSize:r,size:n.size}).pipe(e)},Ou=(t,e)=>{let i=new ki(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((a,c)=>{i.on("error",c),i.on("close",a),b3.stat(r,(l,v)=>{if(l)c(l);else{let A=new Zt(r,{readSize:n,size:v.size});A.on("error",c),A.pipe(i)}})})},Zs=Ue(Cu,Ou,t=>new Nn(t),t=>new ki(t),(t,e)=>{e?.length&&As(t,e)});import ae from"node:fs";import P3 from"node:path";var Uu=(t,e)=>{let i=new ei(t),n=!0,r,o;try{try{r=ae.openSync(t.file,"r+")}catch(l){if(l?.code==="ENOENT")r=ae.openSync(t.file,"w+");else throw l}let a=ae.fstatSync(r),c=Buffer.alloc(512);e:for(o=0;o<a.size;o+=512){for(let A=0,m=0;A<512;A+=m){if(m=ae.readSync(r,c,A,c.length-A,o+A),o===0&&c[0]===31&&c[1]===139)throw new Error("cannot append to compressed archives");if(!m)break e}let l=new ne(c);if(!l.cksumValid)break;let v=512*Math.ceil((l.size||0)/512);if(o+v+512>a.size)break;o+=v,t.mtimeCache&&l.mtime&&t.mtimeCache.set(String(l.path),l.mtime)}n=!1,Ku(t,i,o,r,e)}finally{if(n)try{ae.closeSync(r)}catch{}}},Ku=(t,e,i,n,r)=>{let o=new gi(t.file,{fd:n,start:i});e.pipe(o),Nu(e,r)},Vu=(t,e)=>{e=Array.from(e);let i=new gt(t),n=(o,a,c)=>{let l=(E,h)=>{E?ae.close(o,d=>c(E)):c(null,h)},v=0;if(a===0)return l(null,0);let A=0,m=Buffer.alloc(512),I=(E,h)=>{if(E||typeof h>"u")return l(E);if(A+=h,A<512&&h)return ae.read(o,m,A,m.length-A,v+A,I);if(v===0&&m[0]===31&&m[1]===139)return l(new Error("cannot append to compressed archives"));if(A<512)return l(null,v);let d=new ne(m);if(!d.cksumValid)return l(null,v);let f=512*Math.ceil((d.size??0)/512);if(v+f+512>a||(v+=f+512,v>=a))return l(null,v);t.mtimeCache&&d.mtime&&t.mtimeCache.set(String(d.path),d.mtime),A=0,ae.read(o,m,0,512,v,I)};ae.read(o,m,0,512,v,I)};return new Promise((o,a)=>{i.on("error",a);let c="r+",l=(v,A)=>{if(v&&v.code==="ENOENT"&&c==="r+")return c="w+",ae.open(t.file,c,l);if(v||!A)return a(v);ae.fstat(A,(m,I)=>{if(m)return ae.close(A,()=>a(m));n(A,I.size,(E,h)=>{if(E)return a(E);let d=new we(t.file,{fd:A,start:h});i.pipe(d),d.on("error",a),d.on("close",o),ku(i,e)})})};ae.open(t.file,c,l)})},Nu=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?_t({file:P3.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},ku=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await _t({file:P3.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>t.add(r)}):t.add(n)}t.end()},ti=Ue(Uu,Vu,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(t,e)=>{if(!Fl(t))throw new TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")});var Fu=Ue(ti.syncFile,ti.asyncFile,ti.syncNoFile,ti.asyncNoFile,(t,e=[])=>{ti.validate?.(t,e),Qu(t)}),Qu=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(i,n)=>e(i,n)&&!((t.mtimeCache?.get(i)??n.mtime??0)>(n.mtime??0)):(i,n)=>!((t.mtimeCache?.get(i)??n.mtime??0)>(n.mtime??0))};async function Fi(t){let{source:e,destination:i,strip:n=1,filter:r}=t,o=[];if(!q3(e))return{success:!1,extractedFiles:[],error:`Source file not found: ${e}`};q3(i)||Zu(i,{recursive:!0});try{return await bu(Bu(e),Pu(),Zs({cwd:i,strip:n,filter:a=>r&&!r(a)?!1:(o.push(a),!0)})),{success:!0,extractedFiles:o}}catch(a){return{success:!1,extractedFiles:o,error:a instanceof Error?a.message:String(a)}}}import{existsSync as D3,readFileSync as qu,writeFileSync as Du,mkdirSync as yu}from"fs";import{dirname as wu}from"path";function ii(t){let e=ja(t);if(!D3(e))return null;try{let i=qu(e,"utf-8");return JSON.parse(i)}catch{return null}}function uo(t,e){let i=ja(e),n=wu(i);D3(n)||yu(n,{recursive:!0}),Du(i,JSON.stringify(t,null,2))}function y3(t,e,i){return{name:"gemkit",version:t,installedAt:new Date().toISOString(),scope:e,installedFiles:i,customizedFiles:[]}}function w3(t){return ii(t)!==null}var p=Dn(H3(),1),Lu=t=>{let e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),n=parseInt(t.slice(5,7),16);return`\x1B[38;2;${e};${i};${n}m`},kn=t=>e=>p.default.isColorSupported?`${Lu(t)}${e}\x1B[39m`:e,s={primary:kn("#4f46e5"),secondary:kn("#9333ea"),accent:kn("#06b6d4"),geminiBlue:kn("#1a73e8"),geminiPurple:kn("#8e24aa"),success:t=>p.default.green(t),error:t=>p.default.red(t),warn:t=>p.default.yellow(t),info:t=>p.default.cyan(t),dim:t=>p.default.dim(t)},M={line:(t=60)=>"\u2500".repeat(t),doubleLine:(t=60)=>"\u2550".repeat(t),statusIcon:t=>{switch(t){case"active":return s.success("\u25CF");case"completed":return s.dim("\u25CB");case"failed":return s.error("\u2717");default:return"?"}},checkIcon:(t,e=!1)=>t?s.success("\u2713"):e?s.warn("\u25CB"):s.error("\u2717"),header:t=>p.default.bold(s.geminiPurple(t)),section:(t,e=60)=>{console.log(),console.log("\u2500".repeat(e)),console.log(p.default.bold(s.geminiPurple(t))),console.log("\u2500".repeat(e)),console.log()}};var GR={success:s.success,error:s.error,warning:s.warn,info:s.info,dim:s.dim,primary:s.primary,secondary:s.secondary,bold:p.default.bold};var L3={debug:0,info:1,warn:2,error:3,silent:4},Ie={level:"info",verbose:!1,json:!1};function po(t){Ie={...Ie,...t}}function Fn(t){return L3[t]>=L3[Ie.level]}function _u(t,e){Fn("debug")&&(Ie.json?console.log(JSON.stringify({level:"debug",message:t,data:e})):(console.log(s.dim(`[DEBUG] ${t}`)),e&&Ie.verbose&&console.log(s.dim(JSON.stringify(e,null,2)))))}function $u(t,e){Fn("info")&&(Ie.json?console.log(JSON.stringify({level:"info",message:t,data:e})):(console.log(`${s.info("\u2139")} ${t}`),e&&Ie.verbose&&console.log(JSON.stringify(e,null,2))))}function eE(t,e){Fn("info")&&(Ie.json?console.log(JSON.stringify({level:"success",message:t,data:e})):console.log(`${s.success("\u2713")} ${t}`))}function tE(t,e){Fn("warn")&&(Ie.json?console.log(JSON.stringify({level:"warn",message:t,data:e})):console.log(`${s.warn("\u26A0")} ${t}`))}function iE(t,e){Fn("error")&&(Ie.json?console.error(JSON.stringify({level:"error",message:t,data:e})):(console.error(`${s.error("\u2717")} ${t}`),e&&Ie.verbose&&console.error(JSON.stringify(e,null,2))))}function nE(t){Ie.json?console.log(JSON.stringify(t)):console.table(t)}function rE(t){console.log(JSON.stringify(t,null,2))}var u={debug:_u,info:$u,success:eE,warn:tE,error:iE,table:nE,json:rE,configure:po};function cE(t){switch(t){case"gemini":return[".claude",".claude/**",".agent",".agent/**"];case"claude":return[".agent",".agent/**"];case"antigravity":return[".claude",".claude/**"];default:return[]}}function lE(t){switch(t){case"gemini":return"Gemini CLI (excludes .claude, .agent)";case"claude":return"Claude Code (excludes .agent)";case"antigravity":return"Antigravity (excludes .claude)";default:return"Full (all files)"}}function vE(t,e){let i=t.replace(/\\/g,"/");for(let n of e)if(n.includes("*")){if(n.endsWith("/**")){let r=n.slice(0,-3);if(i.startsWith(r+"/"))return!0}}else if(i===n||i.startsWith(n+"/"))return!0;return!1}function AE(t){if(t.length!==0)return e=>!vE(e,t)}async function mE(){let t=aE(".gemini","extensions","spawn-agent");return oE(t)?new Promise(e=>{let i=sE("gemini",["extensions","install",t],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32",cwd:process.cwd()}),n="",r="",o=!1,a=setTimeout(()=>{o||(o=!0,i.kill(),e({success:!1,error:"Extension installation timed out"}))},3e4);i.stdout?.on("data",c=>{n+=c.toString()}),i.stderr?.on("data",c=>{r+=c.toString()}),i.on("close",c=>{o||(o=!0,clearTimeout(a),e(c===0?{success:!0}:{success:!1,error:r||n||`Exit code: ${c}`}))}),i.on("error",c=>{o||(o=!0,clearTimeout(a),e({success:!1,error:`Failed to run gemini CLI: ${c.message}`}))})}):{success:!1,error:`Extension directory not found: ${t}`}}function _3(t){t.command("init","Initialize GemKit in project").option("--version <ver>","Specific version to install").option("-f, --force","Overwrite existing installation").option("--exclude <patterns...>","File patterns to exclude").option("--skip-extension","Skip spawn-agent extension installation").option("--full","Install all files (default)").option("--gemini","Gemini CLI mode (excludes .claude, .agent folders)").option("--claude","Claude Code mode (excludes .agent folder)").option("--antigravity","Antigravity mode (excludes .claude folder)").action(async e=>{let i="full";if(e.gemini?i="gemini":e.claude?i="claude":e.antigravity?i="antigravity":e.full&&(i="full"),w3()&&!e.force){console.log(),u.warn("GemKit is already installed. Use --force to reinstall."),console.log();return}console.log(),console.log(p.default.bold(s.geminiPurple("Initializing GemKit"))),console.log(` ${s.dim("Mode:")} ${s.accent(lE(i))}`),console.log();let n=Ze({text:"Fetching latest release...",color:"magenta"}).start(),r=e.version?await Yl(e.version):await Ii();r||(n.fail("No release found"),console.log(),process.exit(1)),n.succeed(`Found version ${s.primary(r.version)}`);let o=Ze({text:"Downloading release...",color:"magenta"}).start(),a;try{a=await pi(r),o.succeed("Download complete")}catch(E){o.fail(`Download failed: ${E instanceof Error?E.message:String(E)}`),console.log(),process.exit(1)}let c=cE(i),l=Ze({text:i==="full"?"Extracting files...":`Extracting files (${i} mode)...`,color:"magenta"}).start(),v=process.cwd(),A=await Fi({source:a,destination:v,strip:1,filter:AE(c)});A.success||(l.fail(`Extraction failed: ${A.error}`),console.log(),process.exit(1)),l.succeed(`Extracted ${A.extractedFiles.length} files`);let m=y3(r.version,"local",A.extractedFiles);if(uo(m),console.log(),u.success(`GemKit ${s.primary(r.version)} installed successfully!`),!e.skipExtension&&(i==="full"||i==="gemini")){console.log();let E=Ze({text:"Installing spawn-agent extension...",color:"magenta"}).start(),h=await mE();h.success?E.succeed("spawn-agent extension installed in Gemini CLI"):(E.warn(`Could not install spawn-agent extension: ${h.error}`),u.info(`You can manually install it with: ${s.primary("gemini extensions install .gemini/extensions/spawn-agent")}`))}else(i==="claude"||i==="antigravity")&&(console.log(),u.info(`Skipped Gemini extension (${i} mode).`));console.log(),u.info(`Run ${s.primary("gk doctor")} to verify installation.`),console.log()})}function $3(t){t.command("update","Update GemKit to latest version").option("-f, --force","Force update and overwrite modified files").option("--no-backup","Disable backup before update").action(async e=>{let i=ii();i||(u.error('GemKit not initialized. Run "gk init" first.'),process.exit(1)),u.info("Checking for updates...");let n=await Ii();if(n||(u.error("Failed to check for updates."),process.exit(1)),n.version===i.version&&!e.force){u.success(`GemKit is already up to date (v${i.version})`);return}u.info(`Updating from v${i.version} to v${n.version}...`);let r=await pi(n),o=rr(),a=await Fi({source:r,destination:o,strip:1});a.success||(u.error(`Update failed: ${a.error}`),process.exit(1));let c={...i,version:n.version,installedAt:new Date().toISOString(),installedFiles:a.extractedFiles};uo(c),u.success(`GemKit updated to v${n.version} successfully!`)})}function ev(t){t.command("versions","List available GemKit versions").alias("v").option("--json","Output as JSON").action(async e=>{let i=ii(),n=await ar();if(e.json){console.log(JSON.stringify({current:i?.version||null,available:n},null,2));return}console.log(),console.log(p.default.bold(s.geminiPurple("GemKit Versions"))),console.log(),console.log(i?` ${s.dim("Current:")} ${s.success(i.version)}`:` ${s.dim("Current:")} ${s.dim("Not installed")}`),console.log(),console.log(` ${p.default.bold("Available Releases:")}`);for(let r of n){let o=r.version===i?.version?s.success(" (current)"):"";console.log(` - ${s.primary(r.version)}${o}`)}console.log()})}import{existsSync as ho}from"fs";import{join as uE}from"path";import{spawn as tv}from"child_process";async function EE(){return new Promise(t=>{let e=tv("gemini",["extensions","list"],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32"}),i="",n="",r=!1,o=setTimeout(()=>{r||(r=!0,e.kill(),t({installed:!1,error:"Check timed out"}))},2e4);e.stdout?.on("data",a=>{i+=a.toString()}),e.stderr?.on("data",a=>{n+=a.toString()}),e.on("close",a=>{if(!r)if(r=!0,clearTimeout(o),a===0){let c=i.toLowerCase().includes("spawn-agent");t({installed:c})}else t({installed:!1,error:n||"Failed to check extensions"})}),e.on("error",a=>{r||(r=!0,clearTimeout(o),t({installed:!1,error:`Gemini CLI not available: ${a.message}`}))})})}async function IE(){return new Promise(t=>{let e=tv("gemini",["--version"],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32"}),i="",n=!1,r=setTimeout(()=>{n||(n=!0,e.kill(),t({available:!1,error:"Timed out"}))},15e3);e.stdout?.on("data",o=>{i+=o.toString()}),e.on("close",o=>{if(!n)if(n=!0,clearTimeout(r),o===0){let a=i.trim().split(`
|
|
20
|
-
`)[0]||"unknown";t({available:!0,version:a})}else t({available:!1,error:"Command failed"})}),e.on("error",o=>{n||(n=!0,clearTimeout(r),t({available:!1,error:o.message}))})})}function
|
|
21
|
-
Run: gemini extensions install .gemini/extensions/spawn-agent`:"Run: gemini extensions install .gemini/extensions/spawn-agent"}),i++)}let E=
|
|
22
|
-
`))console.log(` ${s.dim(d)}`);console.log(),i===0&&n===0?console.log(s.success("All checks passed!")):i===0?console.log(s.success(`All critical checks passed! ${s.dim(`(${n} warning${n>1?"s":""})`)}`)):(console.log(s.error(`${i} issue(s) found.`)),n>0&&console.log(s.warn(`${n} warning(s).`)),console.log(),console.log("To fix issues:"),console.log(` ${s.dim("1.")} Run ${s.primary("gk init")} to install GemKit`),console.log(` ${s.dim("2.")} Run ${s.primary("gemini extensions install .gemini/extensions/spawn-agent")} to install extension`)),console.log()})}function
|
|
12
|
+
`,r)}while(n!==-1);return o+=t.slice(r),o}var{stdout:ml,stderr:El}=vl,Rs=Symbol("GENERATOR"),pi=Symbol("STYLER"),$i=Symbol("IS_EMPTY"),pl=["ansi","ansi","ansi256","ansi16m"],Ii=Object.create(null),gu=(t,e={})=>{if(e.level&&!(Number.isInteger(e.level)&&e.level>=0&&e.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let i=ml?ml.level:0;t.level=e.level===void 0?i:e.level};var ju=t=>{let e=(...i)=>i.join(" ");return gu(e,t),Object.setPrototypeOf(e,en.prototype),e};function en(t){return ju(t)}Object.setPrototypeOf(en.prototype,Function.prototype);for(let[t,e]of Object.entries(Re))Ii[t]={get(){let i=sr(this,gs(e.open,e.close,this[pi]),this[$i]);return Object.defineProperty(this,t,{value:i}),i}};Ii.visible={get(){let t=sr(this,this[pi],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var zs=(t,e,i,...n)=>t==="rgb"?e==="ansi16m"?Re[i].ansi16m(...n):e==="ansi256"?Re[i].ansi256(Re.rgbToAnsi256(...n)):Re[i].ansi(Re.rgbToAnsi(...n)):t==="hex"?zs("rgb",e,i,...Re.hexToRgb(...n)):Re[i][t](...n),xu=["rgb","hex","ansi256"];for(let t of xu){Ii[t]={get(){let{level:i}=this;return function(...n){let r=gs(zs(t,pl[i],"color",...n),Re.color.close,this[pi]);return sr(this,r,this[$i])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);Ii[e]={get(){let{level:i}=this;return function(...n){let r=gs(zs(t,pl[i],"bgColor",...n),Re.bgColor.close,this[pi]);return sr(this,r,this[$i])}}}}var Gu=Object.defineProperties(()=>{},{...Ii,level:{enumerable:!0,get(){return this[Rs].level},set(t){this[Rs].level=t}}}),gs=(t,e,i)=>{let n,r;return i===void 0?(n=t,r=e):(n=i.openAll+t,r=e+i.closeAll),{open:t,close:e,openAll:n,closeAll:r,parent:i}},sr=(t,e,i)=>{let n=(...r)=>Su(n,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(n,Gu),n[Rs]=t,n[pi]=e,n[$i]=i,n},Su=(t,e)=>{if(t.level<=0||!e)return t[$i]?"":e;let i=t[pi];if(i===void 0)return e;let{openAll:n,closeAll:r}=i;if(e.includes("\x1B"))for(;i!==void 0;)e=Al(e,i.close,i.open),i=i.parent;let o=e.indexOf(`
|
|
13
|
+
`);return o!==-1&&(e=ul(e,r,n,o)),n+e+r};Object.defineProperties(en.prototype,Ii);var Yu=en(),zf=en({level:El?El.level:0});var ze=Yu;import zl from"node:process";import vr from"node:process";var Wu=(t,e,i,n)=>{if(i==="length"||i==="prototype"||i==="arguments"||i==="caller")return;let r=Object.getOwnPropertyDescriptor(t,i),o=Object.getOwnPropertyDescriptor(e,i);!Mu(r,o)&&n||Object.defineProperty(t,i,o)},Mu=function(t,e){return t===void 0||t.configurable||t.writable===e.writable&&t.enumerable===e.enumerable&&t.configurable===e.configurable&&(t.writable||t.value===e.value)},Cu=(t,e)=>{let i=Object.getPrototypeOf(e);i!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,i)},Ou=(t,e)=>`/* Wrapped ${t}*/
|
|
14
|
+
${e}`,Uu=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),Ku=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),Vu=(t,e,i)=>{let n=i===""?"":`with ${i.trim()}() `,r=Ou.bind(null,n,e.toString());Object.defineProperty(r,"name",Ku);let{writable:o,enumerable:a,configurable:c}=Uu;Object.defineProperty(t,"toString",{value:r,writable:o,enumerable:a,configurable:c})};function js(t,e,{ignoreNonConfigurable:i=!1}={}){let{name:n}=t;for(let r of Reflect.ownKeys(e))Wu(t,e,r,i);return Cu(t,e),Vu(t,e,n),t}var ar=new WeakMap,Il=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let i,n=0,r=t.displayName||t.name||"<anonymous>",o=function(...a){if(ar.set(o,++n),n===1)i=t.apply(this,a),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return i};return js(o,t),ar.set(o,n),o};Il.callCount=t=>{if(!ar.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return ar.get(t)};var fl=Il;var bt=[];bt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&bt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&bt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var cr=t=>!!t&&typeof t=="object"&&typeof t.removeListener=="function"&&typeof t.emit=="function"&&typeof t.reallyExit=="function"&&typeof t.listeners=="function"&&typeof t.kill=="function"&&typeof t.pid=="number"&&typeof t.on=="function",xs=Symbol.for("signal-exit emitter"),Gs=globalThis,Nu=Object.defineProperty.bind(Object),Ss=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(Gs[xs])return Gs[xs];Nu(Gs,xs,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(e,i){this.listeners[e].push(i)}removeListener(e,i){let n=this.listeners[e],r=n.indexOf(i);r!==-1&&(r===0&&n.length===1?n.length=0:n.splice(r,1))}emit(e,i,n){if(this.emitted[e])return!1;this.emitted[e]=!0;let r=!1;for(let o of this.listeners[e])r=o(i,n)===!0||r;return e==="exit"&&(r=this.emit("afterExit",i,n)||r),r}},lr=class{},ku=t=>({onExit(e,i){return t.onExit(e,i)},load(){return t.load()},unload(){return t.unload()}}),Ys=class extends lr{onExit(){return()=>{}}load(){}unload(){}},Ws=class extends lr{#e=Ms.platform==="win32"?"SIGINT":"SIGHUP";#n=new Ss;#i;#r;#a;#t={};#o=!1;constructor(e){super(),this.#i=e,this.#t={};for(let i of bt)this.#t[i]=()=>{let n=this.#i.listeners(i),{count:r}=this.#n,o=e;if(typeof o.__signal_exit_emitter__=="object"&&typeof o.__signal_exit_emitter__.count=="number"&&(r+=o.__signal_exit_emitter__.count),n.length===r){this.unload();let a=this.#n.emit("exit",null,i),c=i==="SIGHUP"?this.#e:i;a||e.kill(e.pid,c)}};this.#a=e.reallyExit,this.#r=e.emit}onExit(e,i){if(!cr(this.#i))return()=>{};this.#o===!1&&this.load();let n=i?.alwaysLast?"afterExit":"exit";return this.#n.on(n,e),()=>{this.#n.removeListener(n,e),this.#n.listeners.exit.length===0&&this.#n.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#o){this.#o=!0,this.#n.count+=1;for(let e of bt)try{let i=this.#t[e];i&&this.#i.on(e,i)}catch{}this.#i.emit=(e,...i)=>this.#m(e,...i),this.#i.reallyExit=e=>this.#s(e)}}unload(){this.#o&&(this.#o=!1,bt.forEach(e=>{let i=this.#t[e];if(!i)throw new Error("Listener not defined for signal: "+e);try{this.#i.removeListener(e,i)}catch{}}),this.#i.emit=this.#r,this.#i.reallyExit=this.#a,this.#n.count-=1)}#s(e){return cr(this.#i)?(this.#i.exitCode=e||0,this.#n.emit("exit",this.#i.exitCode,null),this.#a.call(this.#i,this.#i.exitCode)):0}#m(e,...i){let n=this.#r;if(e==="exit"&&cr(this.#i)){typeof i[0]=="number"&&(this.#i.exitCode=i[0]);let r=n.call(this.#i,e,...i);return this.#n.emit("exit",this.#i.exitCode,null),r}else return n.call(this.#i,e,...i)}},Ms=globalThis.process,{onExit:hl,load:Wf,unload:Mf}=ku(cr(Ms)?new Ws(Ms):new Ys);var dl=vr.stderr.isTTY?vr.stderr:vr.stdout.isTTY?vr.stdout:void 0,Fu=dl?fl(()=>{hl(()=>{dl.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Rl=Fu;var Ar=!1,fi={};fi.show=(t=zl.stderr)=>{t.isTTY&&(Ar=!1,t.write("\x1B[?25h"))};fi.hide=(t=zl.stderr)=>{t.isTTY&&(Rl(),Ar=!0,t.write("\x1B[?25l"))};fi.toggle=(t,e)=>{t!==void 0&&(Ar=t),Ar?fi.show(e):fi.hide(e)};var Cs=fi;var rn=tr(Os(),1);import ge from"node:process";function Us(){return ge.platform!=="win32"?ge.env.TERM!=="linux":!!ge.env.CI||!!ge.env.WT_SESSION||!!ge.env.TERMINUS_SUBLIME||ge.env.ConEmuTask==="{cmd::Cmder}"||ge.env.TERM_PROGRAM==="Terminus-Sublime"||ge.env.TERM_PROGRAM==="vscode"||ge.env.TERM==="xterm-256color"||ge.env.TERM==="alacritty"||ge.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var bu={info:ze.blue("\u2139"),success:ze.green("\u2714"),warning:ze.yellow("\u26A0"),error:ze.red("\u2716")},Ju={info:ze.blue("i"),success:ze.green("\u221A"),warning:ze.yellow("\u203C"),error:ze.red("\xD7")},Bu=Us()?bu:Ju,tn=Bu;function Ks({onlyFirst:t=!1}={}){let r="(?:\\u001B\\][\\s\\S]*?(?:\\u0007|\\u001B\\u005C|\\u009C))|[\\u001B\\u009B][[\\]()#;?]*(?:\\d{1,4}(?:[;:]\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]";return new RegExp(r,t?void 0:"g")}var Zu=Ks();function nn(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(Zu,"")}function Gl(t){return t===161||t===164||t===167||t===168||t===170||t===173||t===174||t>=176&&t<=180||t>=182&&t<=186||t>=188&&t<=191||t===198||t===208||t===215||t===216||t>=222&&t<=225||t===230||t>=232&&t<=234||t===236||t===237||t===240||t===242||t===243||t>=247&&t<=250||t===252||t===254||t===257||t===273||t===275||t===283||t===294||t===295||t===299||t>=305&&t<=307||t===312||t>=319&&t<=322||t===324||t>=328&&t<=331||t===333||t===338||t===339||t===358||t===359||t===363||t===462||t===464||t===466||t===468||t===470||t===472||t===474||t===476||t===593||t===609||t===708||t===711||t>=713&&t<=715||t===717||t===720||t>=728&&t<=731||t===733||t===735||t>=768&&t<=879||t>=913&&t<=929||t>=931&&t<=937||t>=945&&t<=961||t>=963&&t<=969||t===1025||t>=1040&&t<=1103||t===1105||t===8208||t>=8211&&t<=8214||t===8216||t===8217||t===8220||t===8221||t>=8224&&t<=8226||t>=8228&&t<=8231||t===8240||t===8242||t===8243||t===8245||t===8251||t===8254||t===8308||t===8319||t>=8321&&t<=8324||t===8364||t===8451||t===8453||t===8457||t===8467||t===8470||t===8481||t===8482||t===8486||t===8491||t===8531||t===8532||t>=8539&&t<=8542||t>=8544&&t<=8555||t>=8560&&t<=8569||t===8585||t>=8592&&t<=8601||t===8632||t===8633||t===8658||t===8660||t===8679||t===8704||t===8706||t===8707||t===8711||t===8712||t===8715||t===8719||t===8721||t===8725||t===8730||t>=8733&&t<=8736||t===8739||t===8741||t>=8743&&t<=8748||t===8750||t>=8756&&t<=8759||t===8764||t===8765||t===8776||t===8780||t===8786||t===8800||t===8801||t>=8804&&t<=8807||t===8810||t===8811||t===8814||t===8815||t===8834||t===8835||t===8838||t===8839||t===8853||t===8857||t===8869||t===8895||t===8978||t>=9312&&t<=9449||t>=9451&&t<=9547||t>=9552&&t<=9587||t>=9600&&t<=9615||t>=9618&&t<=9621||t===9632||t===9633||t>=9635&&t<=9641||t===9650||t===9651||t===9654||t===9655||t===9660||t===9661||t===9664||t===9665||t>=9670&&t<=9672||t===9675||t>=9678&&t<=9681||t>=9698&&t<=9701||t===9711||t===9733||t===9734||t===9737||t===9742||t===9743||t===9756||t===9758||t===9792||t===9794||t===9824||t===9825||t>=9827&&t<=9829||t>=9831&&t<=9834||t===9836||t===9837||t===9839||t===9886||t===9887||t===9919||t>=9926&&t<=9933||t>=9935&&t<=9939||t>=9941&&t<=9953||t===9955||t===9960||t===9961||t>=9963&&t<=9969||t===9972||t>=9974&&t<=9977||t===9979||t===9980||t===9982||t===9983||t===10045||t>=10102&&t<=10111||t>=11094&&t<=11097||t>=12872&&t<=12879||t>=57344&&t<=63743||t>=65024&&t<=65039||t===65533||t>=127232&&t<=127242||t>=127248&&t<=127277||t>=127280&&t<=127337||t>=127344&&t<=127373||t===127375||t===127376||t>=127387&&t<=127404||t>=917760&&t<=917999||t>=983040&&t<=1048573||t>=1048576&&t<=1114109}function Sl(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function Yl(t){return t>=4352&&t<=4447||t===8986||t===8987||t===9001||t===9002||t>=9193&&t<=9196||t===9200||t===9203||t===9725||t===9726||t===9748||t===9749||t>=9776&&t<=9783||t>=9800&&t<=9811||t===9855||t>=9866&&t<=9871||t===9875||t===9889||t===9898||t===9899||t===9917||t===9918||t===9924||t===9925||t===9934||t===9940||t===9962||t===9970||t===9971||t===9973||t===9978||t===9981||t===9989||t===9994||t===9995||t===10024||t===10060||t===10062||t>=10067&&t<=10069||t===10071||t>=10133&&t<=10135||t===10160||t===10175||t===11035||t===11036||t===11088||t===11093||t>=11904&&t<=11929||t>=11931&&t<=12019||t>=12032&&t<=12245||t>=12272&&t<=12287||t>=12289&&t<=12350||t>=12353&&t<=12438||t>=12441&&t<=12543||t>=12549&&t<=12591||t>=12593&&t<=12686||t>=12688&&t<=12773||t>=12783&&t<=12830||t>=12832&&t<=12871||t>=12880&&t<=42124||t>=42128&&t<=42182||t>=43360&&t<=43388||t>=44032&&t<=55203||t>=63744&&t<=64255||t>=65040&&t<=65049||t>=65072&&t<=65106||t>=65108&&t<=65126||t>=65128&&t<=65131||t>=94176&&t<=94180||t>=94192&&t<=94198||t>=94208&&t<=101589||t>=101631&&t<=101662||t>=101760&&t<=101874||t>=110576&&t<=110579||t>=110581&&t<=110587||t===110589||t===110590||t>=110592&&t<=110882||t===110898||t>=110928&&t<=110930||t===110933||t>=110948&&t<=110951||t>=110960&&t<=111355||t>=119552&&t<=119638||t>=119648&&t<=119670||t===126980||t===127183||t===127374||t>=127377&&t<=127386||t>=127488&&t<=127490||t>=127504&&t<=127547||t>=127552&&t<=127560||t===127568||t===127569||t>=127584&&t<=127589||t>=127744&&t<=127776||t>=127789&&t<=127797||t>=127799&&t<=127868||t>=127870&&t<=127891||t>=127904&&t<=127946||t>=127951&&t<=127955||t>=127968&&t<=127984||t===127988||t>=127992&&t<=128062||t===128064||t>=128066&&t<=128252||t>=128255&&t<=128317||t>=128331&&t<=128334||t>=128336&&t<=128359||t===128378||t===128405||t===128406||t===128420||t>=128507&&t<=128591||t>=128640&&t<=128709||t===128716||t>=128720&&t<=128722||t>=128725&&t<=128728||t>=128732&&t<=128735||t===128747||t===128748||t>=128756&&t<=128764||t>=128992&&t<=129003||t===129008||t>=129292&&t<=129338||t>=129340&&t<=129349||t>=129351&&t<=129535||t>=129648&&t<=129660||t>=129664&&t<=129674||t>=129678&&t<=129734||t===129736||t>=129741&&t<=129756||t>=129759&&t<=129770||t>=129775&&t<=129784||t>=131072&&t<=196605||t>=196608&&t<=262141}function Pu(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function Wl(t,{ambiguousAsWide:e=!1}={}){return Pu(t),Sl(t)||Yl(t)||e&&Gl(t)?2:1}var Ol=tr(Cl(),1),qu=new Intl.Segmenter,yu=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function Vs(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:i=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=nn(t)),t.length===0)return 0;let r=0,o={ambiguousAsWide:!i};for(let{segment:a}of qu.segment(t)){let c=a.codePointAt(0);if(!(c<=31||c>=127&&c<=159)&&!(c>=8203&&c<=8207||c===65279)&&!(c>=768&&c<=879||c>=6832&&c<=6911||c>=7616&&c<=7679||c>=8400&&c<=8447||c>=65056&&c<=65071)&&!(c>=55296&&c<=57343)&&!(c>=65024&&c<=65039)&&!yu.test(a)){if((0,Ol.default)().test(a)){r+=2;continue}r+=Wl(c,o)}}return r}function Ns({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import Ul from"node:process";function ks(){let{env:t}=Ul,{TERM:e,TERM_PROGRAM:i}=t;return Ul.platform!=="win32"?e!=="linux":!!t.WT_SESSION||!!t.TERMINUS_SUBLIME||t.ConEmuTask==="{cmd::Cmder}"||i==="Terminus-Sublime"||i==="vscode"||e==="xterm-256color"||e==="alacritty"||e==="rxvt-unicode"||e==="rxvt-unicode-256color"||t.TERMINAL_EMULATOR==="JetBrains-JediTerm"}import Ue from"node:process";var Du=3,Fs=class{#e=0;start(){this.#e++,this.#e===1&&this.#n()}stop(){if(this.#e<=0)throw new Error("`stop` called more times than `start`");this.#e--,this.#e===0&&this.#i()}#n(){Ue.platform==="win32"||!Ue.stdin.isTTY||(Ue.stdin.setRawMode(!0),Ue.stdin.on("data",this.#r),Ue.stdin.resume())}#i(){Ue.stdin.isTTY&&(Ue.stdin.off("data",this.#r),Ue.stdin.pause(),Ue.stdin.setRawMode(!1))}#r(e){e[0]===Du&&Ue.emit("SIGINT")}},wu=new Fs,Qs=wu;var Tu=tr(Os(),1),bs=class{#e=0;#n=!1;#i=0;#r=-1;#a=0;#t;#o;#s;#m;#p;#v;#A;#u;#I;#c;#l;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:mr.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#p=this.#t.interval,this.#s=this.#t.stream,this.#v=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ns({stream:this.#s}),this.#A=typeof this.#t.isSilent=="boolean"?this.#t.isSilent:!1,this.text=this.#t.text,this.prefixText=this.#t.prefixText,this.suffixText=this.#t.suffixText,this.indent=this.#t.indent,mr.env.NODE_ENV==="test"&&(this._stream=this.#s,this._isEnabled=this.#v,Object.defineProperty(this,"_linesToClear",{get(){return this.#e},set(i){this.#e=i}}),Object.defineProperty(this,"_frameIndex",{get(){return this.#r}}),Object.defineProperty(this,"_lineCount",{get(){return this.#i}}))}get indent(){return this.#u}set indent(e=0){if(!(e>=0&&Number.isInteger(e)))throw new Error("The `indent` option must be an integer from 0 and up");this.#u=e,this.#E()}get interval(){return this.#p??this.#o.interval??100}get spinner(){return this.#o}set spinner(e){if(this.#r=-1,this.#p=void 0,typeof e=="object"){if(e.frames===void 0)throw new Error("The given spinner must have a `frames` property");this.#o=e}else if(!ks())this.#o=rn.default.line;else if(e===void 0)this.#o=rn.default.dots;else if(e!=="default"&&rn.default[e])this.#o=rn.default[e];else throw new Error(`There is no built-in spinner named '${e}'. See https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json for a full list.`)}get text(){return this.#I}set text(e=""){this.#I=e,this.#E()}get prefixText(){return this.#c}set prefixText(e=""){this.#c=e,this.#E()}get suffixText(){return this.#l}set suffixText(e=""){this.#l=e,this.#E()}get isSpinning(){return this.#m!==void 0}#f(e=this.#c,i=" "){return typeof e=="string"&&e!==""?e+i:typeof e=="function"?e()+i:""}#h(e=this.#l,i=" "){return typeof e=="string"&&e!==""?i+e:typeof e=="function"?i+e():""}#E(){let e=this.#s.columns??80,i=this.#f(this.#c,"-"),n=this.#h(this.#l,"-"),r=" ".repeat(this.#u)+i+"--"+this.#I+"--"+n;this.#i=0;for(let o of nn(r).split(`
|
|
15
|
+
`))this.#i+=Math.max(1,Math.ceil(Vs(o,{countAnsiEscapeCodes:!0})/e))}get isEnabled(){return this.#v&&!this.#A}set isEnabled(e){if(typeof e!="boolean")throw new TypeError("The `isEnabled` option must be a boolean");this.#v=e}get isSilent(){return this.#A}set isSilent(e){if(typeof e!="boolean")throw new TypeError("The `isSilent` option must be a boolean");this.#A=e}frame(){let e=Date.now();(this.#r===-1||e-this.#a>=this.interval)&&(this.#r=++this.#r%this.#o.frames.length,this.#a=e);let{frames:i}=this.#o,n=i[this.#r];this.color&&(n=ze[this.color](n));let r=typeof this.#c=="string"&&this.#c!==""?this.#c+" ":"",o=typeof this.text=="string"?" "+this.text:"",a=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return r+n+o+a}clear(){if(!this.#v||!this.#s.isTTY)return this;this.#s.cursorTo(0);for(let e=0;e<this.#e;e++)e>0&&this.#s.moveCursor(0,-1),this.#s.clearLine(1);return(this.#u||this.lastIndent!==this.#u)&&this.#s.cursorTo(this.#u),this.lastIndent=this.#u,this.#e=0,this}render(){return this.#A?this:(this.clear(),this.#s.write(this.frame()),this.#e=this.#i,this)}start(e){return e&&(this.text=e),this.#A?this:this.#v?this.isSpinning?this:(this.#t.hideCursor&&Cs.hide(this.#s),this.#t.discardStdin&&mr.stdin.isTTY&&(this.#n=!0,Qs.start()),this.render(),this.#m=setInterval(this.render.bind(this),this.interval),this):(this.text&&this.#s.write(`- ${this.text}
|
|
16
|
+
`),this)}stop(){return this.#v?(clearInterval(this.#m),this.#m=void 0,this.#r=0,this.clear(),this.#t.hideCursor&&Cs.show(this.#s),this.#t.discardStdin&&mr.stdin.isTTY&&this.#n&&(Qs.stop(),this.#n=!1),this):this}succeed(e){return this.stopAndPersist({symbol:tn.success,text:e})}fail(e){return this.stopAndPersist({symbol:tn.error,text:e})}warn(e){return this.stopAndPersist({symbol:tn.warning,text:e})}info(e){return this.stopAndPersist({symbol:tn.info,text:e})}stopAndPersist(e={}){if(this.#A)return this;let i=e.prefixText??this.#c,n=this.#f(i," "),r=e.symbol??" ",o=e.text??this.text,c=typeof o=="string"?(r?" ":"")+o:"",l=e.suffixText??this.#l,v=this.#h(l," "),A=n+r+c+v+`
|
|
17
|
+
`;return this.stop(),this.#s.write(A),this}};function Ke(t){return new bs(t)}import{existsSync as kl,readFileSync as e7,writeFileSync as t7,mkdirSync as i7}from"fs";import{dirname as n7}from"path";import{homedir as Kl}from"os";import{join as D}from"path";var Xu=D(Kl(),".gemkit"),Js=D(Xu,"projects"),Bs=D(Kl(),".gemini"),dh=D(Bs,"config"),hi=D(Bs,"cache"),Rh=D(Bs,"tmp"),di=".gemini";var Hu="plans",Lu=".gk.json",_u="metadata.json",$u=".env";function Er(t=process.cwd()){return D(t,di)}function Zs(t=process.cwd()){return D(t,di,Lu)}function Ps(t=process.cwd()){return D(t,di,_u)}function Jt(t=process.cwd()){return D(t,di,$u)}function on(t=process.cwd()){return D(t,di,"agents")}function Bt(t=process.cwd()){return D(t,di,"extensions")}function Ri(t=process.cwd()){return D(t,Hu)}function sn(t){return t?t.replace(/^[A-Za-z]:/,e=>e.replace(":","")).replace(/[\\/]+/g,"-").replace(/[^a-zA-Z0-9-]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,""):""}function we(t){return D(Js,t)}function Zt(t,e){return D(we(t),`gk-session-${e}.json`)}function an(t,e){return D(we(t),`gk-project-${e}.json`)}var me={defaultScope:"local",github:{repo:"therichardngai-code/gemkit-kits-starter",apiUrl:"https://api.github.com"},cache:{enabled:!0,ttl:3600},installation:{excludePatterns:[],backupOnUpdate:!0},ui:{colors:!0,spinner:!0,verbose:!1},paths:{},spawn:{defaultModel:"gemini-2.5-flash",music:!1},office:{enabled:!0,mode:"web",port:3847,autoOpen:!0,sounds:!1,refreshRate:500},update:{autoCheck:!0,checkInterval:24,notifyOnly:!0}};function Vl(t){return!(!t||typeof t!="object")}function Nl(t){return{...me,...t,github:{...me.github,...t.github||{}},cache:{...me.cache,...t.cache||{}},installation:{...me.installation,...t.installation||{}},ui:{...me.ui,...t.ui||{}},paths:{...me.paths,...t.paths||{}},spawn:{...me.spawn,...t.spawn||{}},office:{...me.office,...t.office||{}},update:{...me.update,...t.update||{}}}}var pr=class extends Error{constructor(i,n="GEMKIT_ERROR",r){super(i);this.code=n;this.details=r;this.name="GemKitError"}},Pt=class extends pr{constructor(e,i){super(e,"CONFIG_ERROR",i),this.name="ConfigError"}};var Ee=class extends pr{constructor(e,i){super(e,"GITHUB_ERROR",i),this.name="GitHubError"}};function Ve(t){let e=Zs(t);if(!kl(e))return me;try{let i=e7(e,"utf-8"),n=JSON.parse(i);if(!Vl(n))throw new Pt("Invalid configuration format");return Nl(n)}catch(i){throw i instanceof Pt?i:new Pt(`Failed to load config: ${i}`)}}function Fl(t,e){let i=Zs(e),n=n7(i);kl(n)||i7(n,{recursive:!0}),t7(i,JSON.stringify(t,null,2))}function Ql(t,e){let i=Ve(e),n=t.split("."),r=i;for(let o of n)if(r&&typeof r=="object"&&o in r)r=r[o];else return;return r}function bl(t,e,i){let n=Ve(i),r=t.split("."),o=r.pop();if(!o)throw new Pt("Invalid config path");let a=n;for(let c of r)(!(c in a)||typeof a[c]!="object")&&(a[c]={}),a=a[c];a[o]=e,Fl(n,i)}function Jl(t){Fl(me,t)}import{existsSync as Bl,readFileSync as r7,writeFileSync as o7,mkdirSync as s7,readdirSync as Zl,unlinkSync as Pl,statSync as a7}from"fs";import{join as qs}from"path";function ys(){return Bl(hi)||s7(hi,{recursive:!0}),hi}function ql(t){let e=t.replace(/[^a-zA-Z0-9-_]/g,"_");return qs(ys(),`${e}.json`)}function Ir(t){let e=ql(t);if(!Bl(e))return null;try{let i=r7(e,"utf-8"),n=JSON.parse(i);return Date.now()-n.timestamp>n.ttl*1e3?(Pl(e),null):n.data}catch{return null}}function fr(t,e,i=3600){let n=ql(t),r={key:t,data:e,timestamp:Date.now(),ttl:i};o7(n,JSON.stringify(r,null,2))}function yl(){let t=ys(),e=Zl(t).filter(i=>i.endsWith(".json"));for(let i of e)Pl(qs(t,i));return e.length}function Dl(){let t=ys(),e=Zl(t).filter(n=>n.endsWith(".json")),i=0;for(let n of e){let r=a7(qs(t,n));i+=r.size}return{entries:e.length,size:i}}var wl="github-releases",c7=300;async function hr(t=10){let e=Ir(wl);if(e)return e.slice(0,t);let i=Ve(),{repo:n,apiUrl:r}=i.github,o=`${r}/repos/${n}/releases?per_page=${t}`;try{let a=await fetch(o,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"gemkit-cli"}});if(!a.ok)throw new Ee(`Failed to fetch releases: ${a.status}`);let l=(await a.json()).map(v=>({version:v.tag_name.replace(/^v/,""),tag:v.tag_name,publishedAt:v.published_at,prerelease:v.prerelease,assets:v.assets.map(A=>({name:A.name,url:A.url,size:A.size,downloadUrl:A.browser_download_url}))}));return fr(wl,l,c7),l}catch(a){throw a instanceof Ee?a:new Ee(`Failed to fetch releases: ${a}`)}}async function qt(){let t=await hr(1);return t.length>0?t[0]:null}async function Tl(t){return(await hr(50)).find(i=>i.version===t||i.tag===t)||null}import{createWriteStream as l7,existsSync as v7,mkdirSync as A7}from"fs";import{pipeline as u7}from"stream/promises";import{join as m7}from"path";async function E7(t,e=hi){v7(e)||A7(e,{recursive:!0});let i=m7(e,t.name);try{let n=await fetch(t.downloadUrl,{headers:{"User-Agent":"gemkit-cli"}});if(!n.ok)throw new Ee(`Failed to download asset: ${n.status}`);if(!n.body)throw new Ee("No response body");let r=l7(i);return await u7(n.body,r),i}catch(n){throw n instanceof Ee?n:new Ee(`Download failed: ${n}`)}}async function zi(t){let e=t.assets.find(i=>i.name.endsWith(".tar.gz")||i.name.endsWith(".tgz"));if(!e)throw new Ee("No tarball asset found in release");return E7(e)}import{createReadStream as dE,createWriteStream as Mz,existsSync as Av,mkdirSync as RE}from"fs";import{pipeline as zE}from"stream/promises";import{createGunzip as gE}from"zlib";import G7 from"events";import ee from"fs";import{EventEmitter as _s}from"node:events";import $l from"node:stream";import{StringDecoder as p7}from"node:string_decoder";var Xl=typeof process=="object"&&process?process:{stdout:null,stderr:null},I7=t=>!!t&&typeof t=="object"&&(t instanceof un||t instanceof $l||f7(t)||h7(t)),f7=t=>!!t&&typeof t=="object"&&t instanceof _s&&typeof t.pipe=="function"&&t.pipe!==$l.Writable.prototype.pipe,h7=t=>!!t&&typeof t=="object"&&t instanceof _s&&typeof t.write=="function"&&typeof t.end=="function",Te=Symbol("EOF"),Xe=Symbol("maybeEmitEnd"),Et=Symbol("emittedEnd"),dr=Symbol("emittingEnd"),cn=Symbol("emittedError"),Rr=Symbol("closed"),Hl=Symbol("read"),zr=Symbol("flush"),Ll=Symbol("flushChunk"),je=Symbol("encoding"),gi=Symbol("decoder"),F=Symbol("flowing"),ln=Symbol("paused"),ji=Symbol("resume"),Q=Symbol("buffer"),L=Symbol("pipes"),b=Symbol("bufferLength"),Ds=Symbol("bufferPush"),gr=Symbol("bufferShift"),w=Symbol("objectMode"),O=Symbol("destroyed"),ws=Symbol("error"),Ts=Symbol("emitData"),_l=Symbol("emitEnd"),Xs=Symbol("emitEnd2"),Ne=Symbol("async"),Hs=Symbol("abort"),jr=Symbol("aborted"),vn=Symbol("signal"),yt=Symbol("dataListeners"),te=Symbol("discarded"),An=t=>Promise.resolve().then(t),d7=t=>t(),R7=t=>t==="end"||t==="finish"||t==="prefinish",z7=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,g7=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),xr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[ji](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ls=class extends xr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},j7=t=>!!t.objectMode,x7=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",un=class extends _s{[F]=!1;[ln]=!1;[L]=[];[Q]=[];[w];[je];[Ne];[gi];[Te]=!1;[Et]=!1;[dr]=!1;[Rr]=!1;[cn]=null;[b]=0;[O]=!1;[vn];[jr]=!1;[yt]=0;[te]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");j7(i)?(this[w]=!0,this[je]=null):x7(i)?(this[je]=i.encoding,this[w]=!1):(this[w]=!1,this[je]=null),this[Ne]=!!i.async,this[gi]=this[je]?new p7(this[je]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[Q]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[L]});let{signal:n}=i;n&&(this[vn]=n,n.aborted?this[Hs]():n.addEventListener("abort",()=>this[Hs]()))}get bufferLength(){return this[b]}get encoding(){return this[je]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[w]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Ne]}set async(e){this[Ne]=this[Ne]||!!e}[Hs](){this[jr]=!0,this.emit("abort",this[vn]?.reason),this.destroy(this[vn]?.reason)}get aborted(){return this[jr]}set aborted(e){}write(e,i,n){if(this[jr])return!1;if(this[Te])throw new Error("write after end");if(this[O])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Ne]?An:d7;if(!this[w]&&!Buffer.isBuffer(e)){if(g7(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(z7(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[w]?(this[F]&&this[b]!==0&&this[zr](!0),this[F]?this.emit("data",e):this[Ds](e),this[b]!==0&&this.emit("readable"),n&&r(n),this[F]):e.length?(typeof e=="string"&&!(i===this[je]&&!this[gi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[je]&&(e=this[gi].write(e)),this[F]&&this[b]!==0&&this[zr](!0),this[F]?this.emit("data",e):this[Ds](e),this[b]!==0&&this.emit("readable"),n&&r(n),this[F]):(this[b]!==0&&this.emit("readable"),n&&r(n),this[F])}read(e){if(this[O])return null;if(this[te]=!1,this[b]===0||e===0||e&&e>this[b])return this[Xe](),null;this[w]&&(e=null),this[Q].length>1&&!this[w]&&(this[Q]=[this[je]?this[Q].join(""):Buffer.concat(this[Q],this[b])]);let i=this[Hl](e||null,this[Q][0]);return this[Xe](),i}[Hl](e,i){if(this[w])this[gr]();else{let n=i;e===n.length||e===null?this[gr]():typeof n=="string"?(this[Q][0]=n.slice(e),i=n.slice(0,e),this[b]-=e):(this[Q][0]=n.subarray(e),i=n.subarray(0,e),this[b]-=e)}return this.emit("data",i),!this[Q].length&&!this[Te]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[Te]=!0,this.writable=!1,(this[F]||!this[ln])&&this[Xe](),this}[ji](){this[O]||(!this[yt]&&!this[L].length&&(this[te]=!0),this[ln]=!1,this[F]=!0,this.emit("resume"),this[Q].length?this[zr]():this[Te]?this[Xe]():this.emit("drain"))}resume(){return this[ji]()}pause(){this[F]=!1,this[ln]=!0,this[te]=!1}get destroyed(){return this[O]}get flowing(){return this[F]}get paused(){return this[ln]}[Ds](e){this[w]?this[b]+=1:this[b]+=e.length,this[Q].push(e)}[gr](){return this[w]?this[b]-=1:this[b]-=this[Q][0].length,this[Q].shift()}[zr](e=!1){do;while(this[Ll](this[gr]())&&this[Q].length);!e&&!this[Q].length&&!this[Te]&&this.emit("drain")}[Ll](e){return this.emit("data",e),this[F]}pipe(e,i){if(this[O])return e;this[te]=!1;let n=this[Et];return i=i||{},e===Xl.stdout||e===Xl.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[L].push(i.proxyErrors?new Ls(this,e,i):new xr(this,e,i)),this[Ne]?An(()=>this[ji]()):this[ji]()),e}unpipe(e){let i=this[L].find(n=>n.dest===e);i&&(this[L].length===1?(this[F]&&this[yt]===0&&(this[F]=!1),this[L]=[]):this[L].splice(this[L].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[te]=!1,this[yt]++,!this[L].length&&!this[F]&&this[ji]();else if(e==="readable"&&this[b]!==0)super.emit("readable");else if(R7(e)&&this[Et])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[cn]){let r=i;this[Ne]?An(()=>r.call(this,this[cn])):r.call(this,this[cn])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[yt]=this.listeners("data").length,this[yt]===0&&!this[te]&&!this[L].length&&(this[F]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[yt]=0,!this[te]&&!this[L].length&&(this[F]=!1)),i}get emittedEnd(){return this[Et]}[Xe](){!this[dr]&&!this[Et]&&!this[O]&&this[Q].length===0&&this[Te]&&(this[dr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Rr]&&this.emit("close"),this[dr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==O&&this[O])return!1;if(e==="data")return!this[w]&&!n?!1:this[Ne]?(An(()=>this[Ts](n)),!0):this[Ts](n);if(e==="end")return this[_l]();if(e==="close"){if(this[Rr]=!0,!this[Et]&&!this[O])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[cn]=n,super.emit(ws,n);let o=!this[vn]||this.listeners("error").length?super.emit("error",n):!1;return this[Xe](),o}else if(e==="resume"){let o=super.emit("resume");return this[Xe](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[Xe](),r}[Ts](e){for(let n of this[L])n.dest.write(e)===!1&&this.pause();let i=this[te]?!1:super.emit("data",e);return this[Xe](),i}[_l](){return this[Et]?!1:(this[Et]=!0,this.readable=!1,this[Ne]?(An(()=>this[Xs]()),!0):this[Xs]())}[Xs](){if(this[gi]){let i=this[gi].end();if(i){for(let n of this[L])n.dest.write(i);this[te]||super.emit("data",i)}}for(let i of this[L])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[w]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[w]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[w])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[je]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(O,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[te]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[Te])return i();let o,a,c=u=>{this.off("data",l),this.off("end",v),this.off(O,A),i(),a(u)},l=u=>{this.off("error",c),this.off("end",v),this.off(O,A),this.pause(),o({value:u,done:!!this[Te]})},v=()=>{this.off("error",c),this.off("data",l),this.off(O,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((u,p)=>{a=p,o=u,this.once(O,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[te]=!1;let e=!1,i=()=>(this.pause(),this.off(ws,i),this.off(O,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(ws,i),this.once(O,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[O])return e?this.emit("error",e):this.emit(O),this;this[O]=!0,this[te]=!0,this[Q].length=0,this[b]=0;let i=this;return typeof i.close=="function"&&!this[Rr]&&i.close(),e?this.emit("error",e):this.emit(O),this}static get isStream(){return I7}};var S7=ee.writev,It=Symbol("_autoClose"),Ge=Symbol("_close"),mn=Symbol("_ended"),j=Symbol("_fd"),$s=Symbol("_finished"),Le=Symbol("_flags"),ea=Symbol("_flush"),ra=Symbol("_handleChunk"),oa=Symbol("_makeBuf"),pn=Symbol("_mode"),Gr=Symbol("_needDrain"),Si=Symbol("_onerror"),Yi=Symbol("_onopen"),ta=Symbol("_onread"),xi=Symbol("_onwrite"),ft=Symbol("_open"),xe=Symbol("_path"),pt=Symbol("_pos"),ke=Symbol("_queue"),Gi=Symbol("_read"),ia=Symbol("_readSize"),He=Symbol("_reading"),En=Symbol("_remain"),na=Symbol("_size"),Sr=Symbol("_write"),Dt=Symbol("_writing"),Yr=Symbol("_defaultFlag"),wt=Symbol("_errored"),Tt=class extends un{[wt]=!1;[j];[xe];[ia];[He]=!1;[na];[En];[It];constructor(e,i){if(i=i||{},super(i),this.readable=!0,this.writable=!1,typeof e!="string")throw new TypeError("path must be a string");this[wt]=!1,this[j]=typeof i.fd=="number"?i.fd:void 0,this[xe]=e,this[ia]=i.readSize||16*1024*1024,this[He]=!1,this[na]=typeof i.size=="number"?i.size:1/0,this[En]=this[na],this[It]=typeof i.autoClose=="boolean"?i.autoClose:!0,typeof this[j]=="number"?this[Gi]():this[ft]()}get fd(){return this[j]}get path(){return this[xe]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[ft](){ee.open(this[xe],"r",(e,i)=>this[Yi](e,i))}[Yi](e,i){e?this[Si](e):(this[j]=i,this.emit("open",i),this[Gi]())}[oa](){return Buffer.allocUnsafe(Math.min(this[ia],this[En]))}[Gi](){if(!this[He]){this[He]=!0;let e=this[oa]();if(e.length===0)return process.nextTick(()=>this[ta](null,0,e));ee.read(this[j],e,0,e.length,null,(i,n,r)=>this[ta](i,n,r))}}[ta](e,i,n){this[He]=!1,e?this[Si](e):this[ra](i,n)&&this[Gi]()}[Ge](){if(this[It]&&typeof this[j]=="number"){let e=this[j];this[j]=void 0,ee.close(e,i=>i?this.emit("error",i):this.emit("close"))}}[Si](e){this[He]=!0,this[Ge](),this.emit("error",e)}[ra](e,i){let n=!1;return this[En]-=e,e>0&&(n=super.write(e<i.length?i.subarray(0,e):i)),(e===0||this[En]<=0)&&(n=!1,this[Ge](),super.end()),n}emit(e,...i){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[j]=="number"&&this[Gi](),!1;case"error":return this[wt]?!1:(this[wt]=!0,super.emit(e,...i));default:return super.emit(e,...i)}}},Wr=class extends Tt{[ft](){let e=!0;try{this[Yi](null,ee.openSync(this[xe],"r")),e=!1}finally{e&&this[Ge]()}}[Gi](){let e=!0;try{if(!this[He]){this[He]=!0;do{let i=this[oa](),n=i.length===0?0:ee.readSync(this[j],i,0,i.length,null);if(!this[ra](n,i))break}while(!0);this[He]=!1}e=!1}finally{e&&this[Ge]()}}[Ge](){if(this[It]&&typeof this[j]=="number"){let e=this[j];this[j]=void 0,ee.closeSync(e),this.emit("close")}}},_e=class extends G7{readable=!1;writable=!0;[wt]=!1;[Dt]=!1;[mn]=!1;[ke]=[];[Gr]=!1;[xe];[pn];[It];[j];[Yr];[Le];[$s]=!1;[pt];constructor(e,i){i=i||{},super(i),this[xe]=e,this[j]=typeof i.fd=="number"?i.fd:void 0,this[pn]=i.mode===void 0?438:i.mode,this[pt]=typeof i.start=="number"?i.start:void 0,this[It]=typeof i.autoClose=="boolean"?i.autoClose:!0;let n=this[pt]!==void 0?"r+":"w";this[Yr]=i.flags===void 0,this[Le]=i.flags===void 0?n:i.flags,this[j]===void 0&&this[ft]()}emit(e,...i){if(e==="error"){if(this[wt])return!1;this[wt]=!0}return super.emit(e,...i)}get fd(){return this[j]}get path(){return this[xe]}[Si](e){this[Ge](),this[Dt]=!0,this.emit("error",e)}[ft](){ee.open(this[xe],this[Le],this[pn],(e,i)=>this[Yi](e,i))}[Yi](e,i){this[Yr]&&this[Le]==="r+"&&e&&e.code==="ENOENT"?(this[Le]="w",this[ft]()):e?this[Si](e):(this[j]=i,this.emit("open",i),this[Dt]||this[ea]())}end(e,i){return e&&this.write(e,i),this[mn]=!0,!this[Dt]&&!this[ke].length&&typeof this[j]=="number"&&this[xi](null,0),this}write(e,i){return typeof e=="string"&&(e=Buffer.from(e,i)),this[mn]?(this.emit("error",new Error("write() after end()")),!1):this[j]===void 0||this[Dt]||this[ke].length?(this[ke].push(e),this[Gr]=!0,!1):(this[Dt]=!0,this[Sr](e),!0)}[Sr](e){ee.write(this[j],e,0,e.length,this[pt],(i,n)=>this[xi](i,n))}[xi](e,i){e?this[Si](e):(this[pt]!==void 0&&typeof i=="number"&&(this[pt]+=i),this[ke].length?this[ea]():(this[Dt]=!1,this[mn]&&!this[$s]?(this[$s]=!0,this[Ge](),this.emit("finish")):this[Gr]&&(this[Gr]=!1,this.emit("drain"))))}[ea](){if(this[ke].length===0)this[mn]&&this[xi](null,0);else if(this[ke].length===1)this[Sr](this[ke].pop());else{let e=this[ke];this[ke]=[],S7(this[j],e,this[pt],(i,n)=>this[xi](i,n))}}[Ge](){if(this[It]&&typeof this[j]=="number"){let e=this[j];this[j]=void 0,ee.close(e,i=>i?this.emit("error",i):this.emit("close"))}}},Wi=class extends _e{[ft](){let e;if(this[Yr]&&this[Le]==="r+")try{e=ee.openSync(this[xe],this[Le],this[pn])}catch(i){if(i?.code==="ENOENT")return this[Le]="w",this[ft]();throw i}else e=ee.openSync(this[xe],this[Le],this[pn]);this[Yi](null,e)}[Ge](){if(this[It]&&typeof this[j]=="number"){let e=this[j];this[j]=void 0,ee.closeSync(e),this.emit("close")}}[Sr](e){let i=!0;try{this[xi](null,ee.writeSync(this[j],e,0,e.length,this[pt])),i=!1}finally{if(i)try{this[Ge]()}catch{}}}};import P3 from"node:path";import Fi from"node:fs";import{dirname as jm,parse as xm}from"path";var Y7=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]),e3=t=>!!t.sync&&!!t.file,t3=t=>!t.sync&&!!t.file,i3=t=>!!t.sync&&!t.file,n3=t=>!t.sync&&!t.file;var r3=t=>!!t.file;var W7=t=>{let e=Y7.get(t);return e||t},In=(t={})=>{if(!t)return{};let e={};for(let[i,n]of Object.entries(t)){let r=W7(i);e[r]=n}return e.chmod===void 0&&e.noChmod===!1&&(e.chmod=!0),delete e.noChmod,e};var Fe=(t,e,i,n,r)=>Object.assign((o=[],a,c)=>{Array.isArray(o)&&(a=o,o={}),typeof a=="function"&&(c=a,a=void 0),a?a=Array.from(a):a=[];let l=In(o);if(r?.(l,a),e3(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return t(l,a)}else if(t3(l)){let v=e(l,a),A=c||void 0;return A?v.then(()=>A(),A):v}else if(i3(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return i(l,a)}else if(n3(l)){if(typeof c=="function")throw new TypeError("callback only supported with file option");return n(l,a)}else throw new Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:n,validate:r});import{EventEmitter as dm}from"events";import Ia from"assert";import{Buffer as Ht}from"buffer";import{EventEmitter as ma}from"node:events";import l3 from"node:stream";import{StringDecoder as M7}from"node:string_decoder";var o3=typeof process=="object"&&process?process:{stdout:null,stderr:null},C7=t=>!!t&&typeof t=="object"&&(t instanceof zn||t instanceof l3||O7(t)||U7(t)),O7=t=>!!t&&typeof t=="object"&&t instanceof ma&&typeof t.pipe=="function"&&t.pipe!==l3.Writable.prototype.pipe,U7=t=>!!t&&typeof t=="object"&&t instanceof ma&&typeof t.write=="function"&&typeof t.end=="function",$e=Symbol("EOF"),et=Symbol("maybeEmitEnd"),ht=Symbol("emittedEnd"),Mr=Symbol("emittingEnd"),fn=Symbol("emittedError"),Cr=Symbol("closed"),s3=Symbol("read"),Or=Symbol("flush"),a3=Symbol("flushChunk"),Se=Symbol("encoding"),Mi=Symbol("decoder"),J=Symbol("flowing"),hn=Symbol("paused"),Ci=Symbol("resume"),B=Symbol("buffer"),_=Symbol("pipes"),Z=Symbol("bufferLength"),aa=Symbol("bufferPush"),Ur=Symbol("bufferShift"),T=Symbol("objectMode"),U=Symbol("destroyed"),ca=Symbol("error"),la=Symbol("emitData"),c3=Symbol("emitEnd"),va=Symbol("emitEnd2"),Qe=Symbol("async"),Aa=Symbol("abort"),Kr=Symbol("aborted"),dn=Symbol("signal"),Xt=Symbol("dataListeners"),ie=Symbol("discarded"),Rn=t=>Promise.resolve().then(t),K7=t=>t(),V7=t=>t==="end"||t==="finish"||t==="prefinish",N7=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,k7=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Vr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[Ci](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},ua=class extends Vr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},F7=t=>!!t.objectMode,Q7=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",zn=class extends ma{[J]=!1;[hn]=!1;[_]=[];[B]=[];[T];[Se];[Qe];[Mi];[$e]=!1;[ht]=!1;[Mr]=!1;[Cr]=!1;[fn]=null;[Z]=0;[U]=!1;[dn];[Kr]=!1;[Xt]=0;[ie]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");F7(i)?(this[T]=!0,this[Se]=null):Q7(i)?(this[Se]=i.encoding,this[T]=!1):(this[T]=!1,this[Se]=null),this[Qe]=!!i.async,this[Mi]=this[Se]?new M7(this[Se]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[B]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[_]});let{signal:n}=i;n&&(this[dn]=n,n.aborted?this[Aa]():n.addEventListener("abort",()=>this[Aa]()))}get bufferLength(){return this[Z]}get encoding(){return this[Se]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[T]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Qe]}set async(e){this[Qe]=this[Qe]||!!e}[Aa](){this[Kr]=!0,this.emit("abort",this[dn]?.reason),this.destroy(this[dn]?.reason)}get aborted(){return this[Kr]}set aborted(e){}write(e,i,n){if(this[Kr])return!1;if(this[$e])throw new Error("write after end");if(this[U])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[Qe]?Rn:K7;if(!this[T]&&!Buffer.isBuffer(e)){if(k7(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(N7(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[T]?(this[J]&&this[Z]!==0&&this[Or](!0),this[J]?this.emit("data",e):this[aa](e),this[Z]!==0&&this.emit("readable"),n&&r(n),this[J]):e.length?(typeof e=="string"&&!(i===this[Se]&&!this[Mi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[Se]&&(e=this[Mi].write(e)),this[J]&&this[Z]!==0&&this[Or](!0),this[J]?this.emit("data",e):this[aa](e),this[Z]!==0&&this.emit("readable"),n&&r(n),this[J]):(this[Z]!==0&&this.emit("readable"),n&&r(n),this[J])}read(e){if(this[U])return null;if(this[ie]=!1,this[Z]===0||e===0||e&&e>this[Z])return this[et](),null;this[T]&&(e=null),this[B].length>1&&!this[T]&&(this[B]=[this[Se]?this[B].join(""):Buffer.concat(this[B],this[Z])]);let i=this[s3](e||null,this[B][0]);return this[et](),i}[s3](e,i){if(this[T])this[Ur]();else{let n=i;e===n.length||e===null?this[Ur]():typeof n=="string"?(this[B][0]=n.slice(e),i=n.slice(0,e),this[Z]-=e):(this[B][0]=n.subarray(e),i=n.subarray(0,e),this[Z]-=e)}return this.emit("data",i),!this[B].length&&!this[$e]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[$e]=!0,this.writable=!1,(this[J]||!this[hn])&&this[et](),this}[Ci](){this[U]||(!this[Xt]&&!this[_].length&&(this[ie]=!0),this[hn]=!1,this[J]=!0,this.emit("resume"),this[B].length?this[Or]():this[$e]?this[et]():this.emit("drain"))}resume(){return this[Ci]()}pause(){this[J]=!1,this[hn]=!0,this[ie]=!1}get destroyed(){return this[U]}get flowing(){return this[J]}get paused(){return this[hn]}[aa](e){this[T]?this[Z]+=1:this[Z]+=e.length,this[B].push(e)}[Ur](){return this[T]?this[Z]-=1:this[Z]-=this[B][0].length,this[B].shift()}[Or](e=!1){do;while(this[a3](this[Ur]())&&this[B].length);!e&&!this[B].length&&!this[$e]&&this.emit("drain")}[a3](e){return this.emit("data",e),this[J]}pipe(e,i){if(this[U])return e;this[ie]=!1;let n=this[ht];return i=i||{},e===o3.stdout||e===o3.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[_].push(i.proxyErrors?new ua(this,e,i):new Vr(this,e,i)),this[Qe]?Rn(()=>this[Ci]()):this[Ci]()),e}unpipe(e){let i=this[_].find(n=>n.dest===e);i&&(this[_].length===1?(this[J]&&this[Xt]===0&&(this[J]=!1),this[_]=[]):this[_].splice(this[_].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[ie]=!1,this[Xt]++,!this[_].length&&!this[J]&&this[Ci]();else if(e==="readable"&&this[Z]!==0)super.emit("readable");else if(V7(e)&&this[ht])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[fn]){let r=i;this[Qe]?Rn(()=>r.call(this,this[fn])):r.call(this,this[fn])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[Xt]=this.listeners("data").length,this[Xt]===0&&!this[ie]&&!this[_].length&&(this[J]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[Xt]=0,!this[ie]&&!this[_].length&&(this[J]=!1)),i}get emittedEnd(){return this[ht]}[et](){!this[Mr]&&!this[ht]&&!this[U]&&this[B].length===0&&this[$e]&&(this[Mr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Cr]&&this.emit("close"),this[Mr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==U&&this[U])return!1;if(e==="data")return!this[T]&&!n?!1:this[Qe]?(Rn(()=>this[la](n)),!0):this[la](n);if(e==="end")return this[c3]();if(e==="close"){if(this[Cr]=!0,!this[ht]&&!this[U])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[fn]=n,super.emit(ca,n);let o=!this[dn]||this.listeners("error").length?super.emit("error",n):!1;return this[et](),o}else if(e==="resume"){let o=super.emit("resume");return this[et](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[et](),r}[la](e){for(let n of this[_])n.dest.write(e)===!1&&this.pause();let i=this[ie]?!1:super.emit("data",e);return this[et](),i}[c3](){return this[ht]?!1:(this[ht]=!0,this.readable=!1,this[Qe]?(Rn(()=>this[va]()),!0):this[va]())}[va](){if(this[Mi]){let i=this[Mi].end();if(i){for(let n of this[_])n.dest.write(i);this[ie]||super.emit("data",i)}}for(let i of this[_])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[T]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[T]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[T])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Se]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(U,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[ie]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[$e])return i();let o,a,c=u=>{this.off("data",l),this.off("end",v),this.off(U,A),i(),a(u)},l=u=>{this.off("error",c),this.off("end",v),this.off(U,A),this.pause(),o({value:u,done:!!this[$e]})},v=()=>{this.off("error",c),this.off("data",l),this.off(U,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((u,p)=>{a=p,o=u,this.once(U,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[ie]=!1;let e=!1,i=()=>(this.pause(),this.off(ca,i),this.off(U,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(ca,i),this.once(U,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[U])return e?this.emit("error",e):this.emit(U),this;this[U]=!0,this[ie]=!0,this[B].length=0,this[Z]=0;let i=this;return typeof i.close=="function"&&!this[Cr]&&i.close(),e?this.emit("error",e):this.emit(U),this}static get isStream(){return C7}};import*as v3 from"zlib";import b7 from"zlib";var J7=b7.constants||{ZLIB_VERNUM:4736},pe=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:1/0,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},J7));var B7=Ht.concat,A3=Object.getOwnPropertyDescriptor(Ht,"concat"),Z7=t=>t,Ea=A3?.writable===!0||A3?.set!==void 0?t=>{Ht.concat=t?Z7:B7}:t=>{},Lt=Symbol("_superWrite"),Oi=class extends Error{code;errno;constructor(e,i){super("zlib: "+e.message,{cause:e}),this.code=e.code,this.errno=e.errno,this.code||(this.code="ZLIB_ERROR"),this.message="zlib: "+e.message,Error.captureStackTrace(this,i??this.constructor)}get name(){return"ZlibError"}},pa=Symbol("flushFlag"),gn=class extends zn{#e=!1;#n=!1;#i;#r;#a;#t;#o;get sawError(){return this.#e}get handle(){return this.#t}get flushFlag(){return this.#i}constructor(e,i){if(!e||typeof e!="object")throw new TypeError("invalid options for ZlibBase constructor");if(super(e),this.#i=e.flush??0,this.#r=e.finishFlush??0,this.#a=e.fullFlushFlag??0,typeof v3[i]!="function")throw new TypeError("Compression method not supported: "+i);try{this.#t=new v3[i](e)}catch(n){throw new Oi(n,this.constructor)}this.#o=n=>{this.#e||(this.#e=!0,this.close(),this.emit("error",n))},this.#t?.on("error",n=>this.#o(new Oi(n))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return Ia(this.#t,"zlib binding closed"),this.#t.reset?.()}flush(e){this.ended||(typeof e!="number"&&(e=this.#a),this.write(Object.assign(Ht.alloc(0),{[pa]:e})))}end(e,i,n){return typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),e&&(i?this.write(e,i):this.write(e)),this.flush(this.#r),this.#n=!0,super.end(n)}get ended(){return this.#n}[Lt](e){return super.write(e)}write(e,i,n){if(typeof i=="function"&&(n=i,i="utf8"),typeof e=="string"&&(e=Ht.from(e,i)),this.#e)return;Ia(this.#t,"zlib binding closed");let r=this.#t._handle,o=r.close;r.close=()=>{};let a=this.#t.close;this.#t.close=()=>{},Ea(!0);let c;try{let v=typeof e[pa]=="number"?e[pa]:this.#i;c=this.#t._processChunk(e,v),Ea(!1)}catch(v){Ea(!1),this.#o(new Oi(v,this.write))}finally{this.#t&&(this.#t._handle=r,r.close=o,this.#t.close=a,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",v=>this.#o(new Oi(v,this.write)));let l;if(c)if(Array.isArray(c)&&c.length>0){let v=c[0];l=this[Lt](Ht.from(v));for(let A=1;A<c.length;A++)l=this[Lt](c[A])}else l=this[Lt](Ht.from(c));return n&&n(),l}},Nr=class extends gn{#e;#n;constructor(e,i){e=e||{},e.flush=e.flush||pe.Z_NO_FLUSH,e.finishFlush=e.finishFlush||pe.Z_FINISH,e.fullFlushFlag=pe.Z_FULL_FLUSH,super(e,i),this.#e=e.level,this.#n=e.strategy}params(e,i){if(!this.sawError){if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#e!==e||this.#n!==i){this.flush(pe.Z_SYNC_FLUSH),Ia(this.handle,"zlib binding closed");let n=this.handle.flush;this.handle.flush=(r,o)=>{typeof r=="function"&&(o=r,r=this.flushFlag),this.flush(r),o?.()};try{this.handle.params(e,i)}finally{this.handle.flush=n}this.handle&&(this.#e=e,this.#n=i)}}}};var kr=class extends Nr{#e;constructor(e){super(e,"Gzip"),this.#e=e&&!!e.portable}[Lt](e){return this.#e?(this.#e=!1,e[9]=255,super[Lt](e)):super[Lt](e)}};var Fr=class extends Nr{constructor(e){super(e,"Unzip")}},Qr=class extends gn{constructor(e,i){e=e||{},e.flush=e.flush||pe.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||pe.BROTLI_OPERATION_FINISH,e.fullFlushFlag=pe.BROTLI_OPERATION_FLUSH,super(e,i)}},br=class extends Qr{constructor(e){super(e,"BrotliCompress")}},Jr=class extends Qr{constructor(e){super(e,"BrotliDecompress")}},Br=class extends gn{constructor(e,i){e=e||{},e.flush=e.flush||pe.ZSTD_e_continue,e.finishFlush=e.finishFlush||pe.ZSTD_e_end,e.fullFlushFlag=pe.ZSTD_e_flush,super(e,i)}},Zr=class extends Br{constructor(e){super(e,"ZstdCompress")}},Pr=class extends Br{constructor(e){super(e,"ZstdDecompress")}};import{posix as Ui}from"node:path";var u3=(t,e)=>{if(Number.isSafeInteger(t))t<0?y7(t,e):q7(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},q7=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=t&255,t=Math.floor(t/256)},y7=(t,e)=>{e[0]=255;var i=!1;t=t*-1;for(var n=e.length;n>1;n--){var r=t&255;t=Math.floor(t/256),i?e[n-1]=E3(r):r===0?e[n-1]=0:(i=!0,e[n-1]=p3(r))}},m3=t=>{let e=t[0],i=e===128?w7(t.subarray(1,t.length)):e===255?D7(t):null;if(i===null)throw Error("invalid base256 encoding");if(!Number.isSafeInteger(i))throw Error("parsed number outside of javascript safe integer range");return i},D7=t=>{for(var e=t.length,i=0,n=!1,r=e-1;r>-1;r--){var o=Number(t[r]),a;n?a=E3(o):o===0?a=o:(n=!0,a=p3(o)),a!==0&&(i-=a*Math.pow(256,e-r-1))}return i},w7=t=>{for(var e=t.length,i=0,n=e-1;n>-1;n--){var r=Number(t[n]);r!==0&&(i+=r*Math.pow(256,e-n-1))}return i},E3=t=>(255^t)&255,p3=t=>(255^t)+1&255;var qr=t=>yr.has(t);var yr=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]),I3=new Map(Array.from(yr).map(t=>[t[1],t[0]]));var ne=class{cksumValid=!1;needPax=!1;nullBlock=!1;block;path;mode;uid;gid;size;cksum;#e="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(e,i=0,n,r){Buffer.isBuffer(e)?this.decode(e,i||0,n,r):e&&this.#n(e)}decode(e,i,n,r){if(i||(i=0),!e||!(e.length>=i+512))throw new Error("need 512 bytes for header");this.path=n?.path??_t(e,i,100),this.mode=n?.mode??r?.mode??dt(e,i+100,8),this.uid=n?.uid??r?.uid??dt(e,i+108,8),this.gid=n?.gid??r?.gid??dt(e,i+116,8),this.size=n?.size??r?.size??dt(e,i+124,12),this.mtime=n?.mtime??r?.mtime??fa(e,i+136,12),this.cksum=dt(e,i+148,12),r&&this.#n(r,!0),n&&this.#n(n);let o=_t(e,i+156,1);if(qr(o)&&(this.#e=o||"0"),this.#e==="0"&&this.path.slice(-1)==="/"&&(this.#e="5"),this.#e==="5"&&(this.size=0),this.linkpath=_t(e,i+157,100),e.subarray(i+257,i+265).toString()==="ustar\x0000")if(this.uname=n?.uname??r?.uname??_t(e,i+265,32),this.gname=n?.gname??r?.gname??_t(e,i+297,32),this.devmaj=n?.devmaj??r?.devmaj??dt(e,i+329,8)??0,this.devmin=n?.devmin??r?.devmin??dt(e,i+337,8)??0,e[i+475]!==0){let c=_t(e,i+345,155);this.path=c+"/"+this.path}else{let c=_t(e,i+345,130);c&&(this.path=c+"/"+this.path),this.atime=n?.atime??r?.atime??fa(e,i+476,12),this.ctime=n?.ctime??r?.ctime??fa(e,i+488,12)}let a=256;for(let c=i;c<i+148;c++)a+=e[c];for(let c=i+156;c<i+512;c++)a+=e[c];this.cksumValid=a===this.cksum,this.cksum===void 0&&a===256&&(this.nullBlock=!0)}#n(e,i=!1){Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,r])=>!(r==null||n==="path"&&i||n==="linkpath"&&i||n==="global"))))}encode(e,i=0){if(e||(e=this.block=Buffer.alloc(512)),this.#e==="Unsupported"&&(this.#e="0"),!(e.length>=i+512))throw new Error("need 512 bytes for header");let n=this.ctime||this.atime?130:155,r=X7(this.path||"",n),o=r[0],a=r[1];this.needPax=!!r[2],this.needPax=$t(e,i,100,o)||this.needPax,this.needPax=Rt(e,i+100,8,this.mode)||this.needPax,this.needPax=Rt(e,i+108,8,this.uid)||this.needPax,this.needPax=Rt(e,i+116,8,this.gid)||this.needPax,this.needPax=Rt(e,i+124,12,this.size)||this.needPax,this.needPax=ha(e,i+136,12,this.mtime)||this.needPax,e[i+156]=this.#e.charCodeAt(0),this.needPax=$t(e,i+157,100,this.linkpath)||this.needPax,e.write("ustar\x0000",i+257,8),this.needPax=$t(e,i+265,32,this.uname)||this.needPax,this.needPax=$t(e,i+297,32,this.gname)||this.needPax,this.needPax=Rt(e,i+329,8,this.devmaj)||this.needPax,this.needPax=Rt(e,i+337,8,this.devmin)||this.needPax,this.needPax=$t(e,i+345,n,a)||this.needPax,e[i+475]!==0?this.needPax=$t(e,i+345,155,a)||this.needPax:(this.needPax=$t(e,i+345,130,a)||this.needPax,this.needPax=ha(e,i+476,12,this.atime)||this.needPax,this.needPax=ha(e,i+488,12,this.ctime)||this.needPax);let c=256;for(let l=i;l<i+148;l++)c+=e[l];for(let l=i+156;l<i+512;l++)c+=e[l];return this.cksum=c,Rt(e,i+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:yr.get(this.#e)}get typeKey(){return this.#e}set type(e){let i=String(I3.get(e));if(qr(i)||i==="Unsupported")this.#e=i;else if(qr(e))this.#e=e;else throw new TypeError("invalid entry type: "+e)}},X7=(t,e)=>{let n=t,r="",o,a=Ui.parse(t).root||".";if(Buffer.byteLength(n)<100)o=[n,r,!1];else{r=Ui.dirname(n),n=Ui.basename(n);do Buffer.byteLength(n)<=100&&Buffer.byteLength(r)<=e?o=[n,r,!1]:Buffer.byteLength(n)>100&&Buffer.byteLength(r)<=e?o=[n.slice(0,99),r,!0]:(n=Ui.join(Ui.basename(r),n),r=Ui.dirname(r));while(r!==a&&o===void 0);o||(o=[t.slice(0,99),"",!0])}return o},_t=(t,e,i)=>t.subarray(e,e+i).toString("utf8").replace(/\0.*/,""),fa=(t,e,i)=>H7(dt(t,e,i)),H7=t=>t===void 0?void 0:new Date(t*1e3),dt=(t,e,i)=>Number(t[e])&128?m3(t.subarray(e,e+i)):_7(t,e,i),L7=t=>isNaN(t)?void 0:t,_7=(t,e,i)=>L7(parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),$7={12:8589934591,8:2097151},Rt=(t,e,i,n)=>n===void 0?!1:n>$7[i]||n<0?(u3(n,t.subarray(e,e+i)),!0):(em(t,e,i,n),!1),em=(t,e,i,n)=>t.write(tm(n,i),e,i,"ascii"),tm=(t,e)=>im(Math.floor(t).toString(8),e),im=(t,e)=>(t.length===e-1?t:new Array(e-t.length-1).join("0")+t+" ")+"\0",ha=(t,e,i,n)=>n===void 0?!1:Rt(t,e,i,n.getTime()/1e3),nm=new Array(156).join("\0"),$t=(t,e,i,n)=>n===void 0?!1:(t.write(n+nm,e,i,"utf8"),n.length!==Buffer.byteLength(n)||n.length>i);import{basename as rm}from"node:path";var zt=class t{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(e,i=!1){this.atime=e.atime,this.charset=e.charset,this.comment=e.comment,this.ctime=e.ctime,this.dev=e.dev,this.gid=e.gid,this.global=i,this.gname=e.gname,this.ino=e.ino,this.linkpath=e.linkpath,this.mtime=e.mtime,this.nlink=e.nlink,this.path=e.path,this.size=e.size,this.uid=e.uid,this.uname=e.uname}encode(){let e=this.encodeBody();if(e==="")return Buffer.allocUnsafe(0);let i=Buffer.byteLength(e),n=512*Math.ceil(1+i/512),r=Buffer.allocUnsafe(n);for(let o=0;o<512;o++)r[o]=0;new ne({path:("PaxHeader/"+rm(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(r),r.write(e,512,i,"utf8");for(let o=i+512;o<r.length;o++)r[o]=0;return r}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(e){if(this[e]===void 0)return"";let i=this[e],n=i instanceof Date?i.getTime()/1e3:i,r=" "+(e==="dev"||e==="ino"||e==="nlink"?"SCHILY.":"")+e+"="+n+`
|
|
18
|
+
`,o=Buffer.byteLength(r),a=Math.floor(Math.log(o)/Math.log(10))+1;return o+a>=Math.pow(10,a)&&(a+=1),a+o+r}static parse(e,i,n=!1){return new t(om(sm(e),i),n)}},om=(t,e)=>e?Object.assign({},e,t):t,sm=t=>t.replace(/\n$/,"").split(`
|
|
19
|
+
`).reduce(am,Object.create(null)),am=(t,e)=>{let i=parseInt(e,10);if(i!==Buffer.byteLength(e)+1)return t;e=e.slice((i+" ").length);let n=e.split("="),r=n.shift();if(!r)return t;let o=r.replace(/^SCHILY\.(dev|ino|nlink)/,"$1"),a=n.join("=");return t[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(Number(a)*1e3):/^[0-9]+$/.test(a)?+a:a,t};import{EventEmitter as Ga}from"node:events";import g3 from"node:stream";import{StringDecoder as cm}from"node:string_decoder";var h3=typeof process=="object"&&process?process:{stdout:null,stderr:null},lm=t=>!!t&&typeof t=="object"&&(t instanceof Je||t instanceof g3||vm(t)||Am(t)),vm=t=>!!t&&typeof t=="object"&&t instanceof Ga&&typeof t.pipe=="function"&&t.pipe!==g3.Writable.prototype.pipe,Am=t=>!!t&&typeof t=="object"&&t instanceof Ga&&typeof t.write=="function"&&typeof t.end=="function",tt=Symbol("EOF"),it=Symbol("maybeEmitEnd"),gt=Symbol("emittedEnd"),Dr=Symbol("emittingEnd"),jn=Symbol("emittedError"),wr=Symbol("closed"),d3=Symbol("read"),Tr=Symbol("flush"),R3=Symbol("flushChunk"),Ye=Symbol("encoding"),Ki=Symbol("decoder"),P=Symbol("flowing"),xn=Symbol("paused"),Vi=Symbol("resume"),q=Symbol("buffer"),$=Symbol("pipes"),y=Symbol("bufferLength"),da=Symbol("bufferPush"),Xr=Symbol("bufferShift"),X=Symbol("objectMode"),K=Symbol("destroyed"),Ra=Symbol("error"),za=Symbol("emitData"),z3=Symbol("emitEnd"),ga=Symbol("emitEnd2"),be=Symbol("async"),ja=Symbol("abort"),Hr=Symbol("aborted"),Gn=Symbol("signal"),ei=Symbol("dataListeners"),re=Symbol("discarded"),Sn=t=>Promise.resolve().then(t),um=t=>t(),mm=t=>t==="end"||t==="finish"||t==="prefinish",Em=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,pm=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Lr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[Vi](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},xa=class extends Lr{unpipe(){this.src.removeListener("error",this.proxyErrors),super.unpipe()}constructor(e,i,n){super(e,i,n),this.proxyErrors=r=>i.emit("error",r),e.on("error",this.proxyErrors)}},Im=t=>!!t.objectMode,fm=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",Je=class extends Ga{[P]=!1;[xn]=!1;[$]=[];[q]=[];[X];[Ye];[be];[Ki];[tt]=!1;[gt]=!1;[Dr]=!1;[wr]=!1;[jn]=null;[y]=0;[K]=!1;[Gn];[Hr]=!1;[ei]=0;[re]=!1;writable=!0;readable=!0;constructor(...e){let i=e[0]||{};if(super(),i.objectMode&&typeof i.encoding=="string")throw new TypeError("Encoding and objectMode may not be used together");Im(i)?(this[X]=!0,this[Ye]=null):fm(i)?(this[Ye]=i.encoding,this[X]=!1):(this[X]=!1,this[Ye]=null),this[be]=!!i.async,this[Ki]=this[Ye]?new cm(this[Ye]):null,i&&i.debugExposeBuffer===!0&&Object.defineProperty(this,"buffer",{get:()=>this[q]}),i&&i.debugExposePipes===!0&&Object.defineProperty(this,"pipes",{get:()=>this[$]});let{signal:n}=i;n&&(this[Gn]=n,n.aborted?this[ja]():n.addEventListener("abort",()=>this[ja]()))}get bufferLength(){return this[y]}get encoding(){return this[Ye]}set encoding(e){throw new Error("Encoding must be set at instantiation time")}setEncoding(e){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[X]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[be]}set async(e){this[be]=this[be]||!!e}[ja](){this[Hr]=!0,this.emit("abort",this[Gn]?.reason),this.destroy(this[Gn]?.reason)}get aborted(){return this[Hr]}set aborted(e){}write(e,i,n){if(this[Hr])return!1;if(this[tt])throw new Error("write after end");if(this[K])return this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"})),!0;typeof i=="function"&&(n=i,i="utf8"),i||(i="utf8");let r=this[be]?Sn:um;if(!this[X]&&!Buffer.isBuffer(e)){if(pm(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(Em(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[X]?(this[P]&&this[y]!==0&&this[Tr](!0),this[P]?this.emit("data",e):this[da](e),this[y]!==0&&this.emit("readable"),n&&r(n),this[P]):e.length?(typeof e=="string"&&!(i===this[Ye]&&!this[Ki]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[Ye]&&(e=this[Ki].write(e)),this[P]&&this[y]!==0&&this[Tr](!0),this[P]?this.emit("data",e):this[da](e),this[y]!==0&&this.emit("readable"),n&&r(n),this[P]):(this[y]!==0&&this.emit("readable"),n&&r(n),this[P])}read(e){if(this[K])return null;if(this[re]=!1,this[y]===0||e===0||e&&e>this[y])return this[it](),null;this[X]&&(e=null),this[q].length>1&&!this[X]&&(this[q]=[this[Ye]?this[q].join(""):Buffer.concat(this[q],this[y])]);let i=this[d3](e||null,this[q][0]);return this[it](),i}[d3](e,i){if(this[X])this[Xr]();else{let n=i;e===n.length||e===null?this[Xr]():typeof n=="string"?(this[q][0]=n.slice(e),i=n.slice(0,e),this[y]-=e):(this[q][0]=n.subarray(e),i=n.subarray(0,e),this[y]-=e)}return this.emit("data",i),!this[q].length&&!this[tt]&&this.emit("drain"),i}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i="utf8"),e!==void 0&&this.write(e,i),n&&this.once("end",n),this[tt]=!0,this.writable=!1,(this[P]||!this[xn])&&this[it](),this}[Vi](){this[K]||(!this[ei]&&!this[$].length&&(this[re]=!0),this[xn]=!1,this[P]=!0,this.emit("resume"),this[q].length?this[Tr]():this[tt]?this[it]():this.emit("drain"))}resume(){return this[Vi]()}pause(){this[P]=!1,this[xn]=!0,this[re]=!1}get destroyed(){return this[K]}get flowing(){return this[P]}get paused(){return this[xn]}[da](e){this[X]?this[y]+=1:this[y]+=e.length,this[q].push(e)}[Xr](){return this[X]?this[y]-=1:this[y]-=this[q][0].length,this[q].shift()}[Tr](e=!1){do;while(this[R3](this[Xr]())&&this[q].length);!e&&!this[q].length&&!this[tt]&&this.emit("drain")}[R3](e){return this.emit("data",e),this[P]}pipe(e,i){if(this[K])return e;this[re]=!1;let n=this[gt];return i=i||{},e===h3.stdout||e===h3.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[$].push(i.proxyErrors?new xa(this,e,i):new Lr(this,e,i)),this[be]?Sn(()=>this[Vi]()):this[Vi]()),e}unpipe(e){let i=this[$].find(n=>n.dest===e);i&&(this[$].length===1?(this[P]&&this[ei]===0&&(this[P]=!1),this[$]=[]):this[$].splice(this[$].indexOf(i),1),i.unpipe())}addListener(e,i){return this.on(e,i)}on(e,i){let n=super.on(e,i);if(e==="data")this[re]=!1,this[ei]++,!this[$].length&&!this[P]&&this[Vi]();else if(e==="readable"&&this[y]!==0)super.emit("readable");else if(mm(e)&&this[gt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[jn]){let r=i;this[be]?Sn(()=>r.call(this,this[jn])):r.call(this,this[jn])}return n}removeListener(e,i){return this.off(e,i)}off(e,i){let n=super.off(e,i);return e==="data"&&(this[ei]=this.listeners("data").length,this[ei]===0&&!this[re]&&!this[$].length&&(this[P]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[ei]=0,!this[re]&&!this[$].length&&(this[P]=!1)),i}get emittedEnd(){return this[gt]}[it](){!this[Dr]&&!this[gt]&&!this[K]&&this[q].length===0&&this[tt]&&(this[Dr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[wr]&&this.emit("close"),this[Dr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==K&&this[K])return!1;if(e==="data")return!this[X]&&!n?!1:this[be]?(Sn(()=>this[za](n)),!0):this[za](n);if(e==="end")return this[z3]();if(e==="close"){if(this[wr]=!0,!this[gt]&&!this[K])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[jn]=n,super.emit(Ra,n);let o=!this[Gn]||this.listeners("error").length?super.emit("error",n):!1;return this[it](),o}else if(e==="resume"){let o=super.emit("resume");return this[it](),o}else if(e==="finish"||e==="prefinish"){let o=super.emit(e);return this.removeAllListeners(e),o}let r=super.emit(e,...i);return this[it](),r}[za](e){for(let n of this[$])n.dest.write(e)===!1&&this.pause();let i=this[re]?!1:super.emit("data",e);return this[it](),i}[z3](){return this[gt]?!1:(this[gt]=!0,this.readable=!1,this[be]?(Sn(()=>this[ga]()),!0):this[ga]())}[ga](){if(this[Ki]){let i=this[Ki].end();if(i){for(let n of this[$])n.dest.write(i);this[re]||super.emit("data",i)}}for(let i of this[$])i.end();let e=super.emit("end");return this.removeAllListeners("end"),e}async collect(){let e=Object.assign([],{dataLength:0});this[X]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[X]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[X])throw new Error("cannot concat in objectMode");let e=await this.collect();return this[Ye]?e.join(""):Buffer.concat(e,e.dataLength)}async promise(){return new Promise((e,i)=>{this.on(K,()=>i(new Error("stream destroyed"))),this.on("error",n=>i(n)),this.on("end",()=>e())})}[Symbol.asyncIterator](){this[re]=!1;let e=!1,i=async()=>(this.pause(),e=!0,{value:void 0,done:!0});return{next:()=>{if(e)return i();let r=this.read();if(r!==null)return Promise.resolve({done:!1,value:r});if(this[tt])return i();let o,a,c=u=>{this.off("data",l),this.off("end",v),this.off(K,A),i(),a(u)},l=u=>{this.off("error",c),this.off("end",v),this.off(K,A),this.pause(),o({value:u,done:!!this[tt]})},v=()=>{this.off("error",c),this.off("data",l),this.off(K,A),i(),o({done:!0,value:void 0})},A=()=>c(new Error("stream destroyed"));return new Promise((u,p)=>{a=p,o=u,this.once(K,A),this.once("error",c),this.once("end",v),this.once("data",l)})},throw:i,return:i,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[re]=!1;let e=!1,i=()=>(this.pause(),this.off(Ra,i),this.off(K,i),this.off("end",i),e=!0,{done:!0,value:void 0}),n=()=>{if(e)return i();let r=this.read();return r===null?i():{done:!1,value:r}};return this.once("end",i),this.once(Ra,i),this.once(K,i),{next:n,throw:i,return:i,[Symbol.iterator](){return this}}}destroy(e){if(this[K])return e?this.emit("error",e):this.emit(K),this;this[K]=!0,this[re]=!0,this[q].length=0,this[y]=0;let i=this;return typeof i.close=="function"&&!this[wr]&&i.close(),e?this.emit("error",e):this.emit(K),this}static get isStream(){return lm}};var hm=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,R=hm!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");var Ni=class extends Je{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=!1;ignore=!1;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=!1;absolute;unsupported=!1;constructor(e,i,n){switch(super({}),this.pause(),this.extended=i,this.globalExtended=n,this.header=e,this.remain=e.size??0,this.startBlockSize=512*Math.ceil(this.remain/512),this.blockRemain=this.startBlockSize,this.type=e.type,this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=!0;break;default:this.ignore=!0}if(!e.path)throw new Error("no path provided for tar.ReadEntry");this.path=R(e.path),this.mode=e.mode,this.mode&&(this.mode=this.mode&4095),this.uid=e.uid,this.gid=e.gid,this.uname=e.uname,this.gname=e.gname,this.size=this.remain,this.mtime=e.mtime,this.atime=e.atime,this.ctime=e.ctime,this.linkpath=e.linkpath?R(e.linkpath):void 0,this.uname=e.uname,this.gname=e.gname,i&&this.#e(i),n&&this.#e(n,!0)}write(e){let i=e.length;if(i>this.blockRemain)throw new Error("writing more to entry than is appropriate");let n=this.remain,r=this.blockRemain;return this.remain=Math.max(0,n-i),this.blockRemain=Math.max(0,r-i),this.ignore?!0:n>=i?super.write(e):super.write(e.subarray(0,n))}#e(e,i=!1){e.path&&(e.path=R(e.path)),e.linkpath&&(e.linkpath=R(e.linkpath)),Object.assign(this,Object.fromEntries(Object.entries(e).filter(([n,r])=>!(r==null||n==="path"&&i))))}};var ti=(t,e,i,n={})=>{t.file&&(n.file=t.file),t.cwd&&(n.cwd=t.cwd),n.code=i instanceof Error&&i.code||e,n.tarCode=e,!t.strict&&n.recoverable!==!1?(i instanceof Error&&(n=Object.assign(i,n),i=i.message),t.emit("warn",e,i,n)):i instanceof Error?t.emit("error",Object.assign(i,n)):t.emit("error",Object.assign(new Error(`${e}: ${i}`),n))};var Rm=1024*1024,Ca=Buffer.from([31,139]),Oa=Buffer.from([40,181,47,253]),zm=Math.max(Ca.length,Oa.length),Ie=Symbol("state"),ii=Symbol("writeEntry"),nt=Symbol("readEntry"),Sa=Symbol("nextEntry"),j3=Symbol("processEntry"),Be=Symbol("extendedHeader"),Yn=Symbol("globalExtendedHeader"),jt=Symbol("meta"),x3=Symbol("emitMeta"),x=Symbol("buffer"),rt=Symbol("queue"),xt=Symbol("ended"),Ya=Symbol("emittedEnd"),ni=Symbol("emit"),V=Symbol("unzip"),_r=Symbol("consumeChunk"),$r=Symbol("consumeChunkSub"),Wa=Symbol("consumeBody"),G3=Symbol("consumeMeta"),S3=Symbol("consumeHeader"),Wn=Symbol("consuming"),Ma=Symbol("bufferConcat"),eo=Symbol("maybeEnd"),ki=Symbol("writing"),Gt=Symbol("aborted"),to=Symbol("onDone"),ri=Symbol("sawValidEntry"),io=Symbol("sawNullBlock"),no=Symbol("sawEOF"),Y3=Symbol("closeStream"),gm=()=>!0,ot=class extends dm{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[rt]=[];[x];[nt];[ii];[Ie]="begin";[jt]="";[Be];[Yn];[xt]=!1;[V];[Gt]=!1;[ri];[io]=!1;[no]=!1;[ki]=!1;[Wn]=!1;[Ya]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(to,()=>{(this[Ie]==="begin"||this[ri]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(to,e.ondone):this.on(to,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||Rm,this.filter=typeof e.filter=="function"?e.filter:gm;let i=e.file&&(e.file.endsWith(".tar.br")||e.file.endsWith(".tbr"));this.brotli=!(e.gzip||e.zstd)&&e.brotli!==void 0?e.brotli:i?void 0:!1;let n=e.file&&(e.file.endsWith(".tar.zst")||e.file.endsWith(".tzst"));this.zstd=!(e.gzip||e.brotli)&&e.zstd!==void 0?e.zstd:n?!0:void 0,this.on("end",()=>this[Y3]()),typeof e.onwarn=="function"&&this.on("warn",e.onwarn),typeof e.onReadEntry=="function"&&this.on("entry",e.onReadEntry)}warn(e,i,n={}){ti(this,e,i,n)}[S3](e,i){this[ri]===void 0&&(this[ri]=!1);let n;try{n=new ne(e,i,this[Be],this[Yn])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(n.nullBlock)this[io]?(this[no]=!0,this[Ie]==="begin"&&(this[Ie]="header"),this[ni]("eof")):(this[io]=!0,this[ni]("nullBlock"));else if(this[io]=!1,!n.cksumValid)this.warn("TAR_ENTRY_INVALID","checksum failure",{header:n});else if(!n.path)this.warn("TAR_ENTRY_INVALID","path is required",{header:n});else{let r=n.type;if(/^(Symbolic)?Link$/.test(r)&&!n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath required",{header:n});else if(!/^(Symbolic)?Link$/.test(r)&&!/^(Global)?ExtendedHeader$/.test(r)&&n.linkpath)this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:n});else{let o=this[ii]=new Ni(n,this[Be],this[Yn]);if(!this[ri])if(o.remain){let a=()=>{o.invalid||(this[ri]=!0)};o.on("end",a)}else this[ri]=!0;o.meta?o.size>this.maxMetaEntrySize?(o.ignore=!0,this[ni]("ignoredEntry",o),this[Ie]="ignore",o.resume()):o.size>0&&(this[jt]="",o.on("data",a=>this[jt]+=a),this[Ie]="meta"):(this[Be]=void 0,o.ignore=o.ignore||!this.filter(o.path,o),o.ignore?(this[ni]("ignoredEntry",o),this[Ie]=o.remain?"ignore":"header",o.resume()):(o.remain?this[Ie]="body":(this[Ie]="header",o.end()),this[nt]?this[rt].push(o):(this[rt].push(o),this[Sa]())))}}}[Y3](){queueMicrotask(()=>this.emit("close"))}[j3](e){let i=!0;if(!e)this[nt]=void 0,i=!1;else if(Array.isArray(e)){let[n,...r]=e;this.emit(n,...r)}else this[nt]=e,this.emit("entry",e),e.emittedEnd||(e.on("end",()=>this[Sa]()),i=!1);return i}[Sa](){do;while(this[j3](this[rt].shift()));if(!this[rt].length){let e=this[nt];!e||e.flowing||e.size===e.remain?this[ki]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[Wa](e,i){let n=this[ii];if(!n)throw new Error("attempt to consume body without entry??");let r=n.blockRemain??0,o=r>=e.length&&i===0?e:e.subarray(i,i+r);return n.write(o),n.blockRemain||(this[Ie]="header",this[ii]=void 0,n.end()),o.length}[G3](e,i){let n=this[ii],r=this[Wa](e,i);return!this[ii]&&n&&this[x3](n),r}[ni](e,i,n){!this[rt].length&&!this[nt]?this.emit(e,i,n):this[rt].push([e,i,n])}[x3](e){switch(this[ni]("meta",this[jt]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Be]=zt.parse(this[jt],this[Be],!1);break;case"GlobalExtendedHeader":this[Yn]=zt.parse(this[jt],this[Yn],!0);break;case"NextFileHasLongPath":case"OldGnuLongPath":{let i=this[Be]??Object.create(null);this[Be]=i,i.path=this[jt].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{let i=this[Be]||Object.create(null);this[Be]=i,i.linkpath=this[jt].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+e.type)}}abort(e){this[Gt]=!0,this.emit("abort",e),this.warn("TAR_ABORT",e,{recoverable:!1})}write(e,i,n){if(typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8")),this[Gt])return n?.(),!1;if((this[V]===void 0||this.brotli===void 0&&this[V]===!1)&&e){if(this[x]&&(e=Buffer.concat([this[x],e]),this[x]=void 0),e.length<zm)return this[x]=e,n?.(),!0;for(let l=0;this[V]===void 0&&l<Ca.length;l++)e[l]!==Ca[l]&&(this[V]=!1);let a=!1;if(this[V]===!1&&this.zstd!==!1){a=!0;for(let l=0;l<Oa.length;l++)if(e[l]!==Oa[l]){a=!1;break}}let c=this.brotli===void 0&&!a;if(this[V]===!1&&c)if(e.length<512)if(this[xt])this.brotli=!0;else return this[x]=e,n?.(),!0;else try{new ne(e.subarray(0,512)),this.brotli=!1}catch{this.brotli=!0}if(this[V]===void 0||this[V]===!1&&(this.brotli||a)){let l=this[xt];this[xt]=!1,this[V]=this[V]===void 0?new Fr({}):a?new Pr({}):new Jr({}),this[V].on("data",A=>this[_r](A)),this[V].on("error",A=>this.abort(A)),this[V].on("end",()=>{this[xt]=!0,this[_r]()}),this[ki]=!0;let v=!!this[V][l?"end":"write"](e);return this[ki]=!1,n?.(),v}}this[ki]=!0,this[V]?this[V].write(e):this[_r](e),this[ki]=!1;let o=this[rt].length?!1:this[nt]?this[nt].flowing:!0;return!o&&!this[rt].length&&this[nt]?.once("drain",()=>this.emit("drain")),n?.(),o}[Ma](e){e&&!this[Gt]&&(this[x]=this[x]?Buffer.concat([this[x],e]):e)}[eo](){if(this[xt]&&!this[Ya]&&!this[Gt]&&!this[Wn]){this[Ya]=!0;let e=this[ii];if(e&&e.blockRemain){let i=this[x]?this[x].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${e.blockRemain} more bytes, only ${i} available)`,{entry:e}),this[x]&&e.write(this[x]),e.end()}this[ni](to)}}[_r](e){if(this[Wn]&&e)this[Ma](e);else if(!e&&!this[x])this[eo]();else if(e){if(this[Wn]=!0,this[x]){this[Ma](e);let i=this[x];this[x]=void 0,this[$r](i)}else this[$r](e);for(;this[x]&&this[x]?.length>=512&&!this[Gt]&&!this[no];){let i=this[x];this[x]=void 0,this[$r](i)}this[Wn]=!1}(!this[x]||this[xt])&&this[eo]()}[$r](e){let i=0,n=e.length;for(;i+512<=n&&!this[Gt]&&!this[no];)switch(this[Ie]){case"begin":case"header":this[S3](e,i),i+=512;break;case"ignore":case"body":i+=this[Wa](e,i);break;case"meta":i+=this[G3](e,i);break;default:throw new Error("invalid state: "+this[Ie])}i<n&&(this[x]?this[x]=Buffer.concat([e.subarray(i),this[x]]):this[x]=e.subarray(i))}end(e,i,n){return typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,i)),n&&this.once("finish",n),this[Gt]||(this[V]?(e&&this[V].write(e),this[V].end()):(this[xt]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[eo]())),this}};var St=t=>{let e=t.length-1,i=-1;for(;e>-1&&t.charAt(e)==="/";)i=e,e--;return i===-1?t:t.slice(0,i)};var Gm=t=>{let e=t.onReadEntry;t.onReadEntry=e?i=>{e(i),i.resume()}:i=>i.resume()},Ua=(t,e)=>{let i=new Map(e.map(o=>[St(o),!0])),n=t.filter,r=(o,a="")=>{let c=a||xm(o).root||".",l;if(o===c)l=!1;else{let v=i.get(o);v!==void 0?l=v:l=r(jm(o),c)}return i.set(o,l),l};t.filter=n?(o,a)=>n(o,a)&&r(St(o)):o=>r(St(o))},Sm=t=>{let e=new ot(t),i=t.file,n;try{n=Fi.openSync(i,"r");let r=Fi.fstatSync(n),o=t.maxReadSize||16*1024*1024;if(r.size<o){let a=Buffer.allocUnsafe(r.size),c=Fi.readSync(n,a,0,r.size,0);e.end(c===a.byteLength?a:a.subarray(0,c))}else{let a=0,c=Buffer.allocUnsafe(o);for(;a<r.size;){let l=Fi.readSync(n,c,0,o,a);if(l===0)break;a+=l,e.write(c.subarray(0,l))}e.end()}}finally{if(typeof n=="number")try{Fi.closeSync(n)}catch{}}},Ym=(t,e)=>{let i=new ot(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((a,c)=>{i.on("error",c),i.on("end",a),Fi.stat(r,(l,v)=>{if(l)c(l);else{let A=new Tt(r,{readSize:n,size:v.size});A.on("error",c),A.pipe(i)}})})},oi=Fe(Sm,Ym,t=>new ot(t),t=>new ot(t),(t,e)=>{e?.length&&Ua(t,e),t.noResume||Gm(t)});import Io from"fs";import Ze from"fs";import O3 from"path";var Ka=(t,e,i)=>(t&=4095,i&&(t=(t|384)&-19),e&&(t&256&&(t|=64),t&32&&(t|=8),t&4&&(t|=1)),t);import{win32 as Wm}from"node:path";var{isAbsolute:Mm,parse:W3}=Wm,Mn=t=>{let e="",i=W3(t);for(;Mm(t)||i.root;){let n=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(n.length),e+=n,i=W3(t)}return[e,t]};var ro=["|","<",">","?",":"],Va=ro.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),Cm=new Map(ro.map((t,e)=>[t,Va[e]])),Om=new Map(Va.map((t,e)=>[t,ro[e]])),Na=t=>ro.reduce((e,i)=>e.split(i).join(Cm.get(i)),t),M3=t=>Va.reduce((e,i)=>e.split(i).join(Om.get(i)),t);var k3=(t,e)=>e?(t=R(t).replace(/^\.(\/|$)/,""),St(e)+"/"+t):R(t),Um=16*1024*1024,U3=Symbol("process"),K3=Symbol("file"),V3=Symbol("directory"),Fa=Symbol("symlink"),N3=Symbol("hardlink"),Cn=Symbol("header"),oo=Symbol("read"),Qa=Symbol("lstat"),so=Symbol("onlstat"),ba=Symbol("onread"),Ja=Symbol("onreadlink"),Ba=Symbol("openfile"),Za=Symbol("onopenfile"),Yt=Symbol("close"),ao=Symbol("mode"),Pa=Symbol("awaitDrain"),ka=Symbol("ondrain"),Pe=Symbol("prefix"),On=class extends Je{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#e=!1;constructor(e,i={}){let n=In(i);super(),this.path=R(e),this.portable=!!n.portable,this.maxReadSize=n.maxReadSize||Um,this.linkCache=n.linkCache||new Map,this.statCache=n.statCache||new Map,this.preservePaths=!!n.preservePaths,this.cwd=R(n.cwd||process.cwd()),this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.mtime=n.mtime,this.prefix=n.prefix?R(n.prefix):void 0,this.onWriteEntry=n.onWriteEntry,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let r=!1;if(!this.preservePaths){let[a,c]=Mn(this.path);a&&typeof c=="string"&&(this.path=c,r=a)}this.win32=!!n.win32||process.platform==="win32",this.win32&&(this.path=M3(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=R(n.absolute||O3.resolve(this.cwd,e)),this.path===""&&(this.path="./"),r&&this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:this,path:r+this.path});let o=this.statCache.get(this.absolute);o?this[so](o):this[Qa]()}warn(e,i,n={}){return ti(this,e,i,n)}emit(e,...i){return e==="error"&&(this.#e=!0),super.emit(e,...i)}[Qa](){Ze.lstat(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[so](i)})}[so](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=Km(e),this.emit("stat",e),this[U3]()}[U3](){switch(this.type){case"File":return this[K3]();case"Directory":return this[V3]();case"SymbolicLink":return this[Fa]();default:return this.end()}}[ao](e){return Ka(e,this.type==="Directory",this.portable)}[Pe](e){return k3(e,this.prefix)}[Cn](){if(!this.stat)throw new Error("cannot write header before stat");this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.onWriteEntry?.(this),this.header=new ne({path:this[Pe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Pe](this.linkpath):this.linkpath,mode:this[ao](this.stat.mode),uid:this.portable?void 0:this.stat.uid,gid:this.portable?void 0:this.stat.gid,size:this.stat.size,mtime:this.noMtime?void 0:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?void 0:this.type,uname:this.portable?void 0:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?void 0:this.stat.atime,ctime:this.portable?void 0:this.stat.ctime}),this.header.encode()&&!this.noPax&&super.write(new zt({atime:this.portable?void 0:this.header.atime,ctime:this.portable?void 0:this.header.ctime,gid:this.portable?void 0:this.header.gid,mtime:this.noMtime?void 0:this.mtime||this.header.mtime,path:this[Pe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Pe](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?void 0:this.header.uid,uname:this.portable?void 0:this.header.uname,dev:this.portable?void 0:this.stat.dev,ino:this.portable?void 0:this.stat.ino,nlink:this.portable?void 0:this.stat.nlink}).encode());let e=this.header?.block;if(!e)throw new Error("failed to encode header");super.write(e)}[V3](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Cn](),this.end()}[Fa](){Ze.readlink(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[Ja](i)})}[Ja](e){this.linkpath=R(e),this[Cn](),this.end()}[N3](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=R(O3.relative(this.cwd,e)),this.stat.size=0,this[Cn](),this.end()}[K3](){if(!this.stat)throw new Error("cannot create file entry without stat");if(this.stat.nlink>1){let e=`${this.stat.dev}:${this.stat.ino}`,i=this.linkCache.get(e);if(i?.indexOf(this.cwd)===0)return this[N3](i);this.linkCache.set(e,this.absolute)}if(this[Cn](),this.stat.size===0)return this.end();this[Ba]()}[Ba](){Ze.open(this.absolute,"r",(e,i)=>{if(e)return this.emit("error",e);this[Za](i)})}[Za](e){if(this.fd=e,this.#e)return this[Yt]();if(!this.stat)throw new Error("should stat before calling onopenfile");this.blockLen=512*Math.ceil(this.stat.size/512),this.blockRemain=this.blockLen;let i=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(i),this.offset=0,this.pos=0,this.remain=this.stat.size,this.length=this.buf.length,this[oo]()}[oo](){let{fd:e,buf:i,offset:n,length:r,pos:o}=this;if(e===void 0||i===void 0)throw new Error("cannot read file without first opening");Ze.read(e,i,n,r,o,(a,c)=>{if(a)return this[Yt](()=>this.emit("error",a));this[ba](c)})}[Yt](e=()=>{}){this.fd!==void 0&&Ze.close(this.fd,e)}[ba](e){if(e<=0&&this.remain>0){let r=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Yt](()=>this.emit("error",r))}if(e>this.remain){let r=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[Yt](()=>this.emit("error",r))}if(!this.buf)throw new Error("should have created buffer prior to reading");if(e===this.remain)for(let r=e;r<this.length&&e<this.blockRemain;r++)this.buf[r+this.offset]=0,e++,this.remain++;let i=this.offset===0&&e===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+e);this.write(i)?this[ka]():this[Pa](()=>this[ka]())}[Pa](e){this.once("drain",e)}write(e,i,n){if(typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8")),this.blockRemain<e.length){let r=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",r)}return this.remain-=e.length,this.blockRemain-=e.length,this.pos+=e.length,this.offset+=e.length,super.write(e,null,n)}[ka](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[Yt](e=>e?this.emit("error",e):this.end());if(!this.buf)throw new Error("buffer lost somehow in ONDRAIN");this.offset>=this.length&&(this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length)),this.offset=0),this.length=this.buf.length-this.offset,this[oo]()}},co=class extends On{sync=!0;[Qa](){this[so](Ze.lstatSync(this.absolute))}[Fa](){this[Ja](Ze.readlinkSync(this.absolute))}[Ba](){this[Za](Ze.openSync(this.absolute,"r"))}[oo](){let e=!0;try{let{fd:i,buf:n,offset:r,length:o,pos:a}=this;if(i===void 0||n===void 0)throw new Error("fd and buf must be set in READ method");let c=Ze.readSync(i,n,r,o,a);this[ba](c),e=!1}finally{if(e)try{this[Yt](()=>{})}catch{}}}[Pa](e){e()}[Yt](e=()=>{}){this.fd!==void 0&&Ze.closeSync(this.fd),e()}},lo=class extends Je{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(e,i,n={}){return ti(this,e,i,n)}constructor(e,i={}){let n=In(i);super(),this.preservePaths=!!n.preservePaths,this.portable=!!n.portable,this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.onWriteEntry=n.onWriteEntry,this.readEntry=e;let{type:r}=e;if(r==="Unsupported")throw new Error("writing entry that should be ignored");this.type=r,this.type==="Directory"&&this.portable&&(this.noMtime=!0),this.prefix=n.prefix,this.path=R(e.path),this.mode=e.mode!==void 0?this[ao](e.mode):void 0,this.uid=this.portable?void 0:e.uid,this.gid=this.portable?void 0:e.gid,this.uname=this.portable?void 0:e.uname,this.gname=this.portable?void 0:e.gname,this.size=e.size,this.mtime=this.noMtime?void 0:n.mtime||e.mtime,this.atime=this.portable?void 0:e.atime,this.ctime=this.portable?void 0:e.ctime,this.linkpath=e.linkpath!==void 0?R(e.linkpath):void 0,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let o=!1;if(!this.preservePaths){let[c,l]=Mn(this.path);c&&typeof l=="string"&&(this.path=l,o=c)}this.remain=e.size,this.blockRemain=e.startBlockSize,this.onWriteEntry?.(this),this.header=new ne({path:this[Pe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Pe](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?void 0:this.uid,gid:this.portable?void 0:this.gid,size:this.size,mtime:this.noMtime?void 0:this.mtime,type:this.type,uname:this.portable?void 0:this.uname,atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime}),o&&this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path}),this.header.encode()&&!this.noPax&&super.write(new zt({atime:this.portable?void 0:this.atime,ctime:this.portable?void 0:this.ctime,gid:this.portable?void 0:this.gid,mtime:this.noMtime?void 0:this.mtime,path:this[Pe](this.path),linkpath:this.type==="Link"&&this.linkpath!==void 0?this[Pe](this.linkpath):this.linkpath,size:this.size,uid:this.portable?void 0:this.uid,uname:this.portable?void 0:this.uname,dev:this.portable?void 0:this.readEntry.dev,ino:this.portable?void 0:this.readEntry.ino,nlink:this.portable?void 0:this.readEntry.nlink}).encode());let a=this.header?.block;if(!a)throw new Error("failed to encode header");super.write(a),e.pipe(this)}[Pe](e){return k3(e,this.prefix)}[ao](e){return Ka(e,this.type==="Directory",this.portable)}write(e,i,n){typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,typeof i=="string"?i:"utf8"));let r=e.length;if(r>this.blockRemain)throw new Error("writing more to entry than is appropriate");return this.blockRemain-=r,super.write(e,n)}end(e,i,n){return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),typeof e=="function"&&(n=e,i=void 0,e=void 0),typeof i=="function"&&(n=i,i=void 0),typeof e=="string"&&(e=Buffer.from(e,i??"utf8")),n&&this.once("finish",n),e?super.end(e,n):super.end(n),this}},Km=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";var vo=class t{tail;head;length=0;static create(e=[]){return new t(e)}constructor(e=[]){for(let i of e)this.push(i)}*[Symbol.iterator](){for(let e=this.head;e;e=e.next)yield e.value}removeNode(e){if(e.list!==this)throw new Error("removing node which does not belong to this list");let i=e.next,n=e.prev;return i&&(i.prev=n),n&&(n.next=i),e===this.head&&(this.head=i),e===this.tail&&(this.tail=n),this.length--,e.next=void 0,e.prev=void 0,e.list=void 0,i}unshiftNode(e){if(e===this.head)return;e.list&&e.list.removeNode(e);let i=this.head;e.list=this,e.next=i,i&&(i.prev=e),this.head=e,this.tail||(this.tail=e),this.length++}pushNode(e){if(e===this.tail)return;e.list&&e.list.removeNode(e);let i=this.tail;e.list=this,e.prev=i,i&&(i.next=e),this.tail=e,this.head||(this.head=e),this.length++}push(...e){for(let i=0,n=e.length;i<n;i++)Nm(this,e[i]);return this.length}unshift(...e){for(var i=0,n=e.length;i<n;i++)km(this,e[i]);return this.length}pop(){if(!this.tail)return;let e=this.tail.value,i=this.tail;return this.tail=this.tail.prev,this.tail?this.tail.next=void 0:this.head=void 0,i.list=void 0,this.length--,e}shift(){if(!this.head)return;let e=this.head.value,i=this.head;return this.head=this.head.next,this.head?this.head.prev=void 0:this.tail=void 0,i.list=void 0,this.length--,e}forEach(e,i){i=i||this;for(let n=this.head,r=0;n;r++)e.call(i,n.value,r,this),n=n.next}forEachReverse(e,i){i=i||this;for(let n=this.tail,r=this.length-1;n;r--)e.call(i,n.value,r,this),n=n.prev}get(e){let i=0,n=this.head;for(;n&&i<e;i++)n=n.next;if(i===e&&n)return n.value}getReverse(e){let i=0,n=this.tail;for(;n&&i<e;i++)n=n.prev;if(i===e&&n)return n.value}map(e,i){i=i||this;let n=new t;for(let r=this.head;r;)n.push(e.call(i,r.value,this)),r=r.next;return n}mapReverse(e,i){i=i||this;var n=new t;for(let r=this.tail;r;)n.push(e.call(i,r.value,this)),r=r.prev;return n}reduce(e,i){let n,r=this.head;if(arguments.length>1)n=i;else if(this.head)r=this.head.next,n=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var o=0;r;o++)n=e(n,r.value,o),r=r.next;return n}reduceReverse(e,i){let n,r=this.tail;if(arguments.length>1)n=i;else if(this.tail)r=this.tail.prev,n=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(let o=this.length-1;r;o--)n=e(n,r.value,o),r=r.prev;return n}toArray(){let e=new Array(this.length);for(let i=0,n=this.head;n;i++)e[i]=n.value,n=n.next;return e}toArrayReverse(){let e=new Array(this.length);for(let i=0,n=this.tail;n;i++)e[i]=n.value,n=n.prev;return e}slice(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let n=new t;if(i<e||i<0)return n;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.head,o=0;for(o=0;r&&o<e;o++)r=r.next;for(;r&&o<i;o++,r=r.next)n.push(r.value);return n}sliceReverse(e=0,i=this.length){i<0&&(i+=this.length),e<0&&(e+=this.length);let n=new t;if(i<e||i<0)return n;e<0&&(e=0),i>this.length&&(i=this.length);let r=this.length,o=this.tail;for(;o&&r>i;r--)o=o.prev;for(;o&&r>e;r--,o=o.prev)n.push(o.value);return n}splice(e,i=0,...n){e>this.length&&(e=this.length-1),e<0&&(e=this.length+e);let r=this.head;for(let a=0;r&&a<e;a++)r=r.next;let o=[];for(let a=0;r&&a<i;a++)o.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let a of n)r=Vm(this,r,a);return o}reverse(){let e=this.head,i=this.tail;for(let n=e;n;n=n.prev){let r=n.prev;n.prev=n.next,n.next=r}return this.head=i,this.tail=e,this}};function Vm(t,e,i){let n=e,r=e?e.next:t.head,o=new Un(i,n,r,t);return o.next===void 0&&(t.tail=o),o.prev===void 0&&(t.head=o),t.length++,o}function Nm(t,e){t.tail=new Un(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function km(t,e){t.head=new Un(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var Un=class{list;next;prev;value;constructor(e,i,n,r){this.list=r,this.value=e,i?(i.next=this,this.prev=i):this.prev=void 0,n?(n.prev=this,this.next=n):this.next=void 0}};import B3 from"path";var fo=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,i){this.path=e||"./",this.absolute=i}},F3=Buffer.alloc(1024),Ao=Symbol("onStat"),Kn=Symbol("ended"),We=Symbol("queue"),Qi=Symbol("current"),si=Symbol("process"),Vn=Symbol("processing"),Q3=Symbol("processJob"),Me=Symbol("jobs"),qa=Symbol("jobDone"),uo=Symbol("addFSEntry"),b3=Symbol("addTarEntry"),wa=Symbol("stat"),Ta=Symbol("readdir"),mo=Symbol("onreaddir"),Eo=Symbol("pipe"),J3=Symbol("entry"),ya=Symbol("entryOpt"),po=Symbol("writeEntryClass"),Z3=Symbol("write"),Da=Symbol("ondrain"),Wt=class extends Je{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[po];onWriteEntry;[We];[Me]=0;[Vn]=!1;[Kn]=!1;constructor(e={}){if(super(),this.opt=e,this.file=e.file||"",this.cwd=e.cwd||process.cwd(),this.maxReadSize=e.maxReadSize,this.preservePaths=!!e.preservePaths,this.strict=!!e.strict,this.noPax=!!e.noPax,this.prefix=R(e.prefix||""),this.linkCache=e.linkCache||new Map,this.statCache=e.statCache||new Map,this.readdirCache=e.readdirCache||new Map,this.onWriteEntry=e.onWriteEntry,this[po]=On,typeof e.onwarn=="function"&&this.on("warn",e.onwarn),this.portable=!!e.portable,e.gzip||e.brotli||e.zstd){if((e.gzip?1:0)+(e.brotli?1:0)+(e.zstd?1:0)>1)throw new TypeError("gzip, brotli, zstd are mutually exclusive");if(e.gzip&&(typeof e.gzip!="object"&&(e.gzip={}),this.portable&&(e.gzip.portable=!0),this.zip=new kr(e.gzip)),e.brotli&&(typeof e.brotli!="object"&&(e.brotli={}),this.zip=new br(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new Zr(e.zstd)),!this.zip)throw new Error("impossible");let i=this.zip;i.on("data",n=>super.write(n)),i.on("end",()=>super.end()),i.on("drain",()=>this[Da]()),this.on("resume",()=>i.resume())}else this.on("drain",this[Da]);this.noDirRecurse=!!e.noDirRecurse,this.follow=!!e.follow,this.noMtime=!!e.noMtime,e.mtime&&(this.mtime=e.mtime),this.filter=typeof e.filter=="function"?e.filter:()=>!0,this[We]=new vo,this[Me]=0,this.jobs=Number(e.jobs)||4,this[Vn]=!1,this[Kn]=!1}[Z3](e){return super.write(e)}add(e){return this.write(e),this}end(e,i,n){return typeof e=="function"&&(n=e,e=void 0),typeof i=="function"&&(n=i,i=void 0),e&&this.add(e),this[Kn]=!0,this[si](),n&&n(),this}write(e){if(this[Kn])throw new Error("write after end");return e instanceof Ni?this[b3](e):this[uo](e),this.flowing}[b3](e){let i=R(B3.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let n=new fo(e.path,i);n.entry=new lo(e,this[ya](n)),n.entry.on("end",()=>this[qa](n)),this[Me]+=1,this[We].push(n)}this[si]()}[uo](e){let i=R(B3.resolve(this.cwd,e));this[We].push(new fo(e,i)),this[si]()}[wa](e){e.pending=!0,this[Me]+=1;let i=this.follow?"stat":"lstat";Io[i](e.absolute,(n,r)=>{e.pending=!1,this[Me]-=1,n?this.emit("error",n):this[Ao](e,r)})}[Ao](e,i){this.statCache.set(e.absolute,i),e.stat=i,this.filter(e.path,i)||(e.ignore=!0),this[si]()}[Ta](e){e.pending=!0,this[Me]+=1,Io.readdir(e.absolute,(i,n)=>{if(e.pending=!1,this[Me]-=1,i)return this.emit("error",i);this[mo](e,n)})}[mo](e,i){this.readdirCache.set(e.absolute,i),e.readdir=i,this[si]()}[si](){if(!this[Vn]){this[Vn]=!0;for(let e=this[We].head;e&&this[Me]<this.jobs;e=e.next)if(this[Q3](e.value),e.value.ignore){let i=e.next;this[We].removeNode(e),e.next=i}this[Vn]=!1,this[Kn]&&!this[We].length&&this[Me]===0&&(this.zip?this.zip.end(F3):(super.write(F3),super.end()))}}get[Qi](){return this[We]&&this[We].head&&this[We].head.value}[qa](e){this[We].shift(),this[Me]-=1,this[si]()}[Q3](e){if(!e.pending){if(e.entry){e===this[Qi]&&!e.piped&&this[Eo](e);return}if(!e.stat){let i=this.statCache.get(e.absolute);i?this[Ao](e,i):this[wa](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let i=this.readdirCache.get(e.absolute);if(i?this[mo](e,i):this[Ta](e),!e.readdir)return}if(e.entry=this[J3](e),!e.entry){e.ignore=!0;return}e===this[Qi]&&!e.piped&&this[Eo](e)}}}[ya](e){return{onwarn:(i,n,r)=>this.warn(i,n,r),noPax:this.noPax,cwd:this.cwd,absolute:e.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[J3](e){this[Me]+=1;try{return new this[po](e.path,this[ya](e)).on("end",()=>this[qa](e)).on("error",n=>this.emit("error",n))}catch(i){this.emit("error",i)}}[Da](){this[Qi]&&this[Qi].entry&&this[Qi].entry.resume()}[Eo](e){e.piped=!0,e.readdir&&e.readdir.forEach(r=>{let o=e.path,a=o==="./"?"":o.replace(/\/*$/,"/");this[uo](a+r)});let i=e.entry,n=this.zip;if(!i)throw new Error("cannot pipe without source");n?i.on("data",r=>{n.write(r)||i.pause()}):i.on("data",r=>{super.write(r)||i.pause()})}pause(){return this.zip&&this.zip.pause(),super.pause()}warn(e,i,n={}){ti(this,e,i,n)}},ai=class extends Wt{sync=!0;constructor(e){super(e),this[po]=co}pause(){}resume(){}[wa](e){let i=this.follow?"statSync":"lstatSync";this[Ao](e,Io[i](e.absolute))}[Ta](e){this[mo](e,Io.readdirSync(e.absolute))}[Eo](e){let i=e.entry,n=this.zip;if(e.readdir&&e.readdir.forEach(r=>{let o=e.path,a=o==="./"?"":o.replace(/\/*$/,"/");this[uo](a+r)}),!i)throw new Error("Cannot pipe without source");n?i.on("data",r=>{n.write(r)}):i.on("data",r=>{super[Z3](r)})}};var Fm=(t,e)=>{let i=new ai(t),n=new Wi(t.file,{mode:t.mode||438});i.pipe(n),q3(i,e)},Qm=(t,e)=>{let i=new Wt(t),n=new _e(t.file,{mode:t.mode||438});i.pipe(n);let r=new Promise((o,a)=>{n.on("error",a),n.on("close",o),i.on("error",a)});return y3(i,e),r},q3=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?oi({file:P3.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},y3=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await oi({file:P3.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>{t.add(r)}}):t.add(n)}t.end()},bm=(t,e)=>{let i=new ai(t);return q3(i,e),i},Jm=(t,e)=>{let i=new Wt(t);return y3(i,e),i},Bm=Fe(Fm,Qm,bm,Jm,(t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")});import lv from"node:fs";import rE from"node:assert";import{randomBytes as cv}from"node:crypto";import g from"node:fs";import st from"node:path";import D3 from"fs";var Zm=process.env.__FAKE_PLATFORM__||process.platform,Pm=Zm==="win32",{O_CREAT:qm,O_TRUNC:ym,O_WRONLY:Dm}=D3.constants,w3=Number(process.env.__FAKE_FS_O_FILENAME__)||D3.constants.UV_FS_O_FILEMAP||0,wm=Pm&&!!w3,Tm=512*1024,Xm=w3|ym|qm|Dm,Xa=wm?t=>t<Tm?Xm:"w":()=>"w";import Ro from"node:fs";import Nn from"node:path";var Ha=(t,e,i)=>{try{return Ro.lchownSync(t,e,i)}catch(n){if(n?.code!=="ENOENT")throw n}},ho=(t,e,i,n)=>{Ro.lchown(t,e,i,r=>{n(r&&r?.code!=="ENOENT"?r:null)})},Hm=(t,e,i,n,r)=>{if(e.isDirectory())La(Nn.resolve(t,e.name),i,n,o=>{if(o)return r(o);let a=Nn.resolve(t,e.name);ho(a,i,n,r)});else{let o=Nn.resolve(t,e.name);ho(o,i,n,r)}},La=(t,e,i,n)=>{Ro.readdir(t,{withFileTypes:!0},(r,o)=>{if(r){if(r.code==="ENOENT")return n();if(r.code!=="ENOTDIR"&&r.code!=="ENOTSUP")return n(r)}if(r||!o.length)return ho(t,e,i,n);let a=o.length,c=null,l=v=>{if(!c){if(v)return n(c=v);if(--a===0)return ho(t,e,i,n)}};for(let v of o)Hm(t,v,e,i,l)})},Lm=(t,e,i,n)=>{e.isDirectory()&&_a(Nn.resolve(t,e.name),i,n),Ha(Nn.resolve(t,e.name),i,n)},_a=(t,e,i)=>{let n;try{n=Ro.readdirSync(t,{withFileTypes:!0})}catch(r){let o=r;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return Ha(t,e,i);throw o}for(let r of n)Lm(t,r,e,i);return Ha(t,e,i)};import oe from"node:fs";import _m from"node:fs/promises";import zo from"node:path";var kn=class extends Error{path;code;syscall="chdir";constructor(e,i){super(`${i}: Cannot cd into '${e}'`),this.path=e,this.code=i}get name(){return"CwdError"}};var Fn=class extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(e,i){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link"),this.symlink=e,this.path=i}get name(){return"SymlinkError"}};var $m=(t,e)=>{oe.stat(t,(i,n)=>{(i||!n.isDirectory())&&(i=new kn(t,i?.code||"ENOTDIR")),e(i)})},T3=(t,e,i)=>{t=R(t);let n=e.umask??18,r=e.mode|448,o=(r&n)!==0,a=e.uid,c=e.gid,l=typeof a=="number"&&typeof c=="number"&&(a!==e.processUid||c!==e.processGid),v=e.preserve,A=e.unlink,u=R(e.cwd),p=(d,z)=>{d?i(d):z&&l?La(z,a,c,C=>p(C)):o?oe.chmod(t,r,i):i()};if(t===u)return $m(t,p);if(v)return _m.mkdir(t,{mode:r,recursive:!0}).then(d=>p(null,d??void 0),p);let f=R(zo.relative(u,t)).split("/");$a(u,f,r,A,u,void 0,p)},$a=(t,e,i,n,r,o,a)=>{if(!e.length)return a(null,o);let c=e.shift(),l=R(zo.resolve(t+"/"+c));oe.mkdir(l,i,X3(l,e,i,n,r,o,a))},X3=(t,e,i,n,r,o,a)=>c=>{c?oe.lstat(t,(l,v)=>{if(l)l.path=l.path&&R(l.path),a(l);else if(v.isDirectory())$a(t,e,i,n,r,o,a);else if(n)oe.unlink(t,A=>{if(A)return a(A);oe.mkdir(t,i,X3(t,e,i,n,r,o,a))});else{if(v.isSymbolicLink())return a(new Fn(t,t+"/"+e.join("/")));a(c)}}):(o=o||t,$a(t,e,i,n,r,o,a))},eE=t=>{let e=!1,i;try{e=oe.statSync(t).isDirectory()}catch(n){i=n?.code}finally{if(!e)throw new kn(t,i??"ENOTDIR")}},H3=(t,e)=>{t=R(t);let i=e.umask??18,n=e.mode|448,r=(n&i)!==0,o=e.uid,a=e.gid,c=typeof o=="number"&&typeof a=="number"&&(o!==e.processUid||a!==e.processGid),l=e.preserve,v=e.unlink,A=R(e.cwd),u=d=>{d&&c&&_a(d,o,a),r&&oe.chmodSync(t,n)};if(t===A)return eE(A),u();if(l)return u(oe.mkdirSync(t,{mode:n,recursive:!0})??void 0);let E=R(zo.relative(A,t)).split("/"),f;for(let d=E.shift(),z=A;d&&(z+="/"+d);d=E.shift()){z=R(zo.resolve(z));try{oe.mkdirSync(z,n),f=f||z}catch{let ve=oe.lstatSync(z);if(ve.isDirectory())continue;if(v){oe.unlinkSync(z),oe.mkdirSync(z,n),f=f||z;continue}else if(ve.isSymbolicLink())return new Fn(z,z+"/"+E.join("/"))}}return u(f)};import{join as $3}from"node:path";var ec=Object.create(null),L3=1e4,bi=new Set,_3=t=>{bi.has(t)?bi.delete(t):ec[t]=t.normalize("NFD"),bi.add(t);let e=ec[t],i=bi.size-L3;if(i>L3/10){for(let n of bi)if(bi.delete(n),delete ec[n],--i<=0)break}return e};var tE=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,iE=tE==="win32",nE=t=>t.split("/").slice(0,-1).reduce((i,n)=>{let r=i[i.length-1];return r!==void 0&&(n=$3(r,n)),i.push(n||"/"),i},[]),go=class{#e=new Map;#n=new Map;#i=new Set;reserve(e,i){e=iE?["win32 parallelization disabled"]:e.map(r=>St($3(_3(r))).toLowerCase());let n=new Set(e.map(r=>nE(r)).reduce((r,o)=>r.concat(o)));this.#n.set(i,{dirs:n,paths:e});for(let r of e){let o=this.#e.get(r);o?o.push(i):this.#e.set(r,[i])}for(let r of n){let o=this.#e.get(r);if(!o)this.#e.set(r,[new Set([i])]);else{let a=o[o.length-1];a instanceof Set?a.add(i):o.push(new Set([i]))}}return this.#a(i)}#r(e){let i=this.#n.get(e);if(!i)throw new Error("function does not have any path reservations");return{paths:i.paths.map(n=>this.#e.get(n)),dirs:[...i.dirs].map(n=>this.#e.get(n))}}check(e){let{paths:i,dirs:n}=this.#r(e);return i.every(r=>r&&r[0]===e)&&n.every(r=>r&&r[0]instanceof Set&&r[0].has(e))}#a(e){return this.#i.has(e)||!this.check(e)?!1:(this.#i.add(e),e(()=>this.#t(e)),!0)}#t(e){if(!this.#i.has(e))return!1;let i=this.#n.get(e);if(!i)throw new Error("invalid reservation");let{paths:n,dirs:r}=i,o=new Set;for(let a of n){let c=this.#e.get(a);if(!c||c?.[0]!==e)continue;let l=c[1];if(!l){this.#e.delete(a);continue}if(c.shift(),typeof l=="function")o.add(l);else for(let v of l)o.add(v)}for(let a of r){let c=this.#e.get(a),l=c?.[0];if(!(!c||!(l instanceof Set)))if(l.size===1&&c.length===1){this.#e.delete(a);continue}else if(l.size===1){c.shift();let v=c[0];typeof v=="function"&&o.add(v)}else l.delete(e)}return this.#i.delete(e),o.forEach(a=>this.#a(a)),!0}};var ev=Symbol("onEntry"),nc=Symbol("checkFs"),tv=Symbol("checkFs2"),rc=Symbol("isReusable"),fe=Symbol("makeFs"),oc=Symbol("file"),sc=Symbol("directory"),Go=Symbol("link"),iv=Symbol("symlink"),nv=Symbol("hardlink"),rv=Symbol("unsupported"),ov=Symbol("checkPath"),Mt=Symbol("mkdir"),H=Symbol("onError"),jo=Symbol("pending"),sv=Symbol("pend"),Ji=Symbol("unpend"),tc=Symbol("ended"),ic=Symbol("maybeClose"),ac=Symbol("skip"),Qn=Symbol("doChown"),bn=Symbol("uid"),Jn=Symbol("gid"),Bn=Symbol("checkedCwd"),oE=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Zn=oE==="win32",sE=1024,aE=(t,e)=>{if(!Zn)return g.unlink(t,e);let i=t+".DELETE."+cv(16).toString("hex");g.rename(t,i,n=>{if(n)return e(n);g.unlink(i,e)})},cE=t=>{if(!Zn)return g.unlinkSync(t);let e=t+".DELETE."+cv(16).toString("hex");g.renameSync(t,e),g.unlinkSync(e)},av=(t,e,i)=>t!==void 0&&t===t>>>0?t:e!==void 0&&e===e>>>0?e:i,Bi=class extends ot{[tc]=!1;[Bn]=!1;[jo]=0;reservations=new go;transform;writable=!0;readable=!1;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(e={}){if(e.ondone=()=>{this[tc]=!0,this[ic]()},super(e),this.transform=e.transform,this.chmod=!!e.chmod,typeof e.uid=="number"||typeof e.gid=="number"){if(typeof e.uid!="number"||typeof e.gid!="number")throw new TypeError("cannot set owner without number uid and gid");if(e.preserveOwner)throw new TypeError("cannot preserve owner in archive and also set owner explicitly");this.uid=e.uid,this.gid=e.gid,this.setOwner=!0}else this.uid=void 0,this.gid=void 0,this.setOwner=!1;e.preserveOwner===void 0&&typeof e.uid!="number"?this.preserveOwner=!!(process.getuid&&process.getuid()===0):this.preserveOwner=!!e.preserveOwner,this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():void 0,this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():void 0,this.maxDepth=typeof e.maxDepth=="number"?e.maxDepth:sE,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||Zn,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=R(st.resolve(e.cwd||process.cwd())),this.strip=Number(e.strip)||0,this.processUmask=this.chmod?typeof e.processUmask=="number"?e.processUmask:process.umask():0,this.umask=typeof e.umask=="number"?e.umask:this.processUmask,this.dmode=e.dmode||511&~this.umask,this.fmode=e.fmode||438&~this.umask,this.on("entry",i=>this[ev](i))}warn(e,i,n={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(n.recoverable=!1),super.warn(e,i,n)}[ic](){this[tc]&&this[jo]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[ov](e){let i=R(e.path),n=i.split("/");if(this.strip){if(n.length<this.strip)return!1;if(e.type==="Link"){let r=R(String(e.linkpath)).split("/");if(r.length>=this.strip)e.linkpath=r.slice(this.strip).join("/");else return!1}n.splice(0,this.strip),e.path=n.join("/")}if(isFinite(this.maxDepth)&&n.length>this.maxDepth)return this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:e,path:i,depth:n.length,maxDepth:this.maxDepth}),!1;if(!this.preservePaths){if(n.includes("..")||Zn&&/^[a-z]:\.\.$/i.test(n[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:i}),!1;let[r,o]=Mn(i);r&&(e.path=String(o),this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:e,path:i}))}if(st.isAbsolute(e.path)?e.absolute=R(st.resolve(e.path)):e.absolute=R(st.resolve(this.cwd,e.path)),!this.preservePaths&&typeof e.absolute=="string"&&e.absolute.indexOf(this.cwd+"/")!==0&&e.absolute!==this.cwd)return this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:e,path:R(e.path),resolvedPath:e.absolute,cwd:this.cwd}),!1;if(e.absolute===this.cwd&&e.type!=="Directory"&&e.type!=="GNUDumpDir")return!1;if(this.win32){let{root:r}=st.win32.parse(String(e.absolute));e.absolute=r+Na(String(e.absolute).slice(r.length));let{root:o}=st.win32.parse(e.path);e.path=o+Na(e.path.slice(o.length))}return!0}[ev](e){if(!this[ov](e))return e.resume();switch(rE.equal(typeof e.absolute,"string"),e.type){case"Directory":case"GNUDumpDir":e.mode&&(e.mode=e.mode|448);case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[nc](e);default:return this[rv](e)}}[H](e,i){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:i}),this[Ji](),i.resume())}[Mt](e,i,n){T3(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:i},n)}[Qn](e){return this.forceChown||this.preserveOwner&&(typeof e.uid=="number"&&e.uid!==this.processUid||typeof e.gid=="number"&&e.gid!==this.processGid)||typeof this.uid=="number"&&this.uid!==this.processUid||typeof this.gid=="number"&&this.gid!==this.processGid}[bn](e){return av(this.uid,e.uid,this.processUid)}[Jn](e){return av(this.gid,e.gid,this.processGid)}[oc](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,r=new _e(String(e.absolute),{flags:Xa(e.size),mode:n,autoClose:!1});r.on("error",l=>{r.fd&&g.close(r.fd,()=>{}),r.write=()=>!0,this[H](l,e),i()});let o=1,a=l=>{if(l){r.fd&&g.close(r.fd,()=>{}),this[H](l,e),i();return}--o===0&&r.fd!==void 0&&g.close(r.fd,v=>{v?this[H](v,e):this[Ji](),i()})};r.on("finish",()=>{let l=String(e.absolute),v=r.fd;if(typeof v=="number"&&e.mtime&&!this.noMtime){o++;let A=e.atime||new Date,u=e.mtime;g.futimes(v,A,u,p=>p?g.utimes(l,A,u,E=>a(E&&p)):a())}if(typeof v=="number"&&this[Qn](e)){o++;let A=this[bn](e),u=this[Jn](e);typeof A=="number"&&typeof u=="number"&&g.fchown(v,A,u,p=>p?g.chown(l,A,u,E=>a(E&&p)):a())}a()});let c=this.transform&&this.transform(e)||e;c!==e&&(c.on("error",l=>{this[H](l,e),i()}),e.pipe(c)),c.pipe(r)}[sc](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode;this[Mt](String(e.absolute),n,r=>{if(r){this[H](r,e),i();return}let o=1,a=()=>{--o===0&&(i(),this[Ji](),e.resume())};e.mtime&&!this.noMtime&&(o++,g.utimes(String(e.absolute),e.atime||new Date,e.mtime,a)),this[Qn](e)&&(o++,g.chown(String(e.absolute),Number(this[bn](e)),Number(this[Jn](e)),a)),a()})}[rv](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[iv](e,i){this[Go](e,String(e.linkpath),"symlink",i)}[nv](e,i){let n=R(st.resolve(this.cwd,String(e.linkpath)));this[Go](e,n,"link",i)}[sv](){this[jo]++}[Ji](){this[jo]--,this[ic]()}[ac](e){this[Ji](),e.resume()}[rc](e,i){return e.type==="File"&&!this.unlink&&i.isFile()&&i.nlink<=1&&!Zn}[nc](e){this[sv]();let i=[e.path];e.linkpath&&i.push(e.linkpath),this.reservations.reserve(i,n=>this[tv](e,n))}[tv](e,i){let n=c=>{i(c)},r=()=>{this[Mt](this.cwd,this.dmode,c=>{if(c){this[H](c,e),n();return}this[Bn]=!0,o()})},o=()=>{if(e.absolute!==this.cwd){let c=R(st.dirname(String(e.absolute)));if(c!==this.cwd)return this[Mt](c,this.dmode,l=>{if(l){this[H](l,e),n();return}a()})}a()},a=()=>{g.lstat(String(e.absolute),(c,l)=>{if(l&&(this.keep||this.newer&&l.mtime>(e.mtime??l.mtime))){this[ac](e),n();return}if(c||this[rc](e,l))return this[fe](null,e,n);if(l.isDirectory()){if(e.type==="Directory"){let v=this.chmod&&e.mode&&(l.mode&4095)!==e.mode,A=u=>this[fe](u??null,e,n);return v?g.chmod(String(e.absolute),Number(e.mode),A):A()}if(e.absolute!==this.cwd)return g.rmdir(String(e.absolute),v=>this[fe](v??null,e,n))}if(e.absolute===this.cwd)return this[fe](null,e,n);aE(String(e.absolute),v=>this[fe](v??null,e,n))})};this[Bn]?o():r()}[fe](e,i,n){if(e){this[H](e,i),n();return}switch(i.type){case"File":case"OldFile":case"ContiguousFile":return this[oc](i,n);case"Link":return this[nv](i,n);case"SymbolicLink":return this[iv](i,n);case"Directory":case"GNUDumpDir":return this[sc](i,n)}}[Go](e,i,n,r){g[n](i,String(e.absolute),o=>{o?this[H](o,e):(this[Ji](),e.resume()),r()})}},xo=t=>{try{return[null,t()]}catch(e){return[e,null]}},Pn=class extends Bi{sync=!0;[fe](e,i){return super[fe](e,i,()=>{})}[nc](e){if(!this[Bn]){let o=this[Mt](this.cwd,this.dmode);if(o)return this[H](o,e);this[Bn]=!0}if(e.absolute!==this.cwd){let o=R(st.dirname(String(e.absolute)));if(o!==this.cwd){let a=this[Mt](o,this.dmode);if(a)return this[H](a,e)}}let[i,n]=xo(()=>g.lstatSync(String(e.absolute)));if(n&&(this.keep||this.newer&&n.mtime>(e.mtime??n.mtime)))return this[ac](e);if(i||this[rc](e,n))return this[fe](null,e);if(n.isDirectory()){if(e.type==="Directory"){let a=this.chmod&&e.mode&&(n.mode&4095)!==e.mode,[c]=a?xo(()=>{g.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[fe](c,e)}let[o]=xo(()=>g.rmdirSync(String(e.absolute)));this[fe](o,e)}let[r]=e.absolute===this.cwd?[]:xo(()=>cE(String(e.absolute)));this[fe](r,e)}[oc](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,r=c=>{let l;try{g.closeSync(o)}catch(v){l=v}(c||l)&&this[H](c||l,e),i()},o;try{o=g.openSync(String(e.absolute),Xa(e.size),n)}catch(c){return r(c)}let a=this.transform&&this.transform(e)||e;a!==e&&(a.on("error",c=>this[H](c,e)),e.pipe(a)),a.on("data",c=>{try{g.writeSync(o,c,0,c.length)}catch(l){r(l)}}),a.on("end",()=>{let c=null;if(e.mtime&&!this.noMtime){let l=e.atime||new Date,v=e.mtime;try{g.futimesSync(o,l,v)}catch(A){try{g.utimesSync(String(e.absolute),l,v)}catch{c=A}}}if(this[Qn](e)){let l=this[bn](e),v=this[Jn](e);try{g.fchownSync(o,Number(l),Number(v))}catch(A){try{g.chownSync(String(e.absolute),Number(l),Number(v))}catch{c=c||A}}}r(c)})}[sc](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode,r=this[Mt](String(e.absolute),n);if(r){this[H](r,e),i();return}if(e.mtime&&!this.noMtime)try{g.utimesSync(String(e.absolute),e.atime||new Date,e.mtime)}catch{}if(this[Qn](e))try{g.chownSync(String(e.absolute),Number(this[bn](e)),Number(this[Jn](e)))}catch{}i(),e.resume()}[Mt](e,i){try{return H3(R(e),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cwd:this.cwd,mode:i})}catch(n){return n}}[Go](e,i,n,r){let o=`${n}Sync`;try{g[o](i,String(e.absolute)),r(),e.resume()}catch(a){return this[H](a,e)}}};var lE=t=>{let e=new Pn(t),i=t.file,n=lv.statSync(i),r=t.maxReadSize||16*1024*1024;new Wr(i,{readSize:r,size:n.size}).pipe(e)},vE=(t,e)=>{let i=new Bi(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((a,c)=>{i.on("error",c),i.on("close",a),lv.stat(r,(l,v)=>{if(l)c(l);else{let A=new Tt(r,{readSize:n,size:v.size});A.on("error",c),A.pipe(i)}})})},cc=Fe(lE,vE,t=>new Pn(t),t=>new Bi(t),(t,e)=>{e?.length&&Ua(t,e)});import se from"node:fs";import vv from"node:path";var AE=(t,e)=>{let i=new ai(t),n=!0,r,o;try{try{r=se.openSync(t.file,"r+")}catch(l){if(l?.code==="ENOENT")r=se.openSync(t.file,"w+");else throw l}let a=se.fstatSync(r),c=Buffer.alloc(512);e:for(o=0;o<a.size;o+=512){for(let A=0,u=0;A<512;A+=u){if(u=se.readSync(r,c,A,c.length-A,o+A),o===0&&c[0]===31&&c[1]===139)throw new Error("cannot append to compressed archives");if(!u)break e}let l=new ne(c);if(!l.cksumValid)break;let v=512*Math.ceil((l.size||0)/512);if(o+v+512>a.size)break;o+=v,t.mtimeCache&&l.mtime&&t.mtimeCache.set(String(l.path),l.mtime)}n=!1,uE(t,i,o,r,e)}finally{if(n)try{se.closeSync(r)}catch{}}},uE=(t,e,i,n,r)=>{let o=new Wi(t.file,{fd:n,start:i});e.pipe(o),EE(e,r)},mE=(t,e)=>{e=Array.from(e);let i=new Wt(t),n=(o,a,c)=>{let l=(E,f)=>{E?se.close(o,d=>c(E)):c(null,f)},v=0;if(a===0)return l(null,0);let A=0,u=Buffer.alloc(512),p=(E,f)=>{if(E||typeof f>"u")return l(E);if(A+=f,A<512&&f)return se.read(o,u,A,u.length-A,v+A,p);if(v===0&&u[0]===31&&u[1]===139)return l(new Error("cannot append to compressed archives"));if(A<512)return l(null,v);let d=new ne(u);if(!d.cksumValid)return l(null,v);let z=512*Math.ceil((d.size??0)/512);if(v+z+512>a||(v+=z+512,v>=a))return l(null,v);t.mtimeCache&&d.mtime&&t.mtimeCache.set(String(d.path),d.mtime),A=0,se.read(o,u,0,512,v,p)};se.read(o,u,0,512,v,p)};return new Promise((o,a)=>{i.on("error",a);let c="r+",l=(v,A)=>{if(v&&v.code==="ENOENT"&&c==="r+")return c="w+",se.open(t.file,c,l);if(v||!A)return a(v);se.fstat(A,(u,p)=>{if(u)return se.close(A,()=>a(u));n(A,p.size,(E,f)=>{if(E)return a(E);let d=new _e(t.file,{fd:A,start:f});i.pipe(d),d.on("error",a),d.on("close",o),pE(i,e)})})};se.open(t.file,c,l)})},EE=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?oi({file:vv.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},pE=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await oi({file:vv.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>t.add(r)}):t.add(n)}t.end()},ci=Fe(AE,mE,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(t,e)=>{if(!r3(t))throw new TypeError("file is required");if(t.gzip||t.brotli||t.zstd||t.file.endsWith(".br")||t.file.endsWith(".tbr"))throw new TypeError("cannot append to compressed archives");if(!e?.length)throw new TypeError("no paths specified to add/replace")});var IE=Fe(ci.syncFile,ci.asyncFile,ci.syncNoFile,ci.asyncNoFile,(t,e=[])=>{ci.validate?.(t,e),fE(t)}),fE=t=>{let e=t.filter;t.mtimeCache||(t.mtimeCache=new Map),t.filter=e?(i,n)=>e(i,n)&&!((t.mtimeCache?.get(i)??n.mtime??0)>(n.mtime??0)):(i,n)=>!((t.mtimeCache?.get(i)??n.mtime??0)>(n.mtime??0))};async function Zi(t){let{source:e,destination:i,strip:n=1,filter:r}=t,o=[];if(!Av(e))return{success:!1,extractedFiles:[],error:`Source file not found: ${e}`};Av(i)||RE(i,{recursive:!0});try{return await zE(dE(e),gE(),cc({cwd:i,strip:n,filter:a=>r&&!r(a)?!1:(o.push(a),!0)})),{success:!0,extractedFiles:o}}catch(a){return{success:!1,extractedFiles:o,error:a instanceof Error?a.message:String(a)}}}import{existsSync as uv,readFileSync as jE,writeFileSync as xE,mkdirSync as GE}from"fs";import{dirname as SE}from"path";function Ct(t){let e=Ps(t);if(!uv(e))return null;try{let i=jE(e,"utf-8");return JSON.parse(i)}catch{return null}}function So(t,e){let i=Ps(e),n=SE(i);uv(n)||GE(n,{recursive:!0}),xE(i,JSON.stringify(t,null,2))}function mv(t,e,i){return{name:"gemkit",version:t,installedAt:new Date().toISOString(),scope:e,installedFiles:i,customizedFiles:[]}}function Ev(t){return Ct(t)!==null}var I=tr(fv(),1),CE=t=>{let e=parseInt(t.slice(1,3),16),i=parseInt(t.slice(3,5),16),n=parseInt(t.slice(5,7),16);return`\x1B[38;2;${e};${i};${n}m`},qn=t=>e=>I.default.isColorSupported?`${CE(t)}${e}\x1B[39m`:e,s={primary:qn("#4f46e5"),secondary:qn("#9333ea"),accent:qn("#06b6d4"),geminiBlue:qn("#1a73e8"),geminiPurple:qn("#8e24aa"),success:t=>I.default.green(t),error:t=>I.default.red(t),warn:t=>I.default.yellow(t),info:t=>I.default.cyan(t),dim:t=>I.default.dim(t)},M={line:(t=60)=>"\u2500".repeat(t),doubleLine:(t=60)=>"\u2550".repeat(t),statusIcon:t=>{switch(t){case"active":return s.success("\u25CF");case"completed":return s.dim("\u25CB");case"failed":return s.error("\u2717");default:return"?"}},checkIcon:(t,e=!1)=>t?s.success("\u2713"):e?s.warn("\u25CB"):s.error("\u2717"),header:t=>I.default.bold(s.geminiPurple(t)),section:(t,e=60)=>{console.log(),console.log("\u2500".repeat(e)),console.log(I.default.bold(s.geminiPurple(t))),console.log("\u2500".repeat(e)),console.log()}};var Qz={success:s.success,error:s.error,warning:s.warn,info:s.info,dim:s.dim,primary:s.primary,secondary:s.secondary,bold:I.default.bold};var hv={debug:0,info:1,warn:2,error:3,silent:4},he={level:"info",verbose:!1,json:!1};function Mo(t){he={...he,...t}}function yn(t){return hv[t]>=hv[he.level]}function OE(t,e){yn("debug")&&(he.json?console.log(JSON.stringify({level:"debug",message:t,data:e})):(console.log(s.dim(`[DEBUG] ${t}`)),e&&he.verbose&&console.log(s.dim(JSON.stringify(e,null,2)))))}function UE(t,e){yn("info")&&(he.json?console.log(JSON.stringify({level:"info",message:t,data:e})):(console.log(`${s.info("\u2139")} ${t}`),e&&he.verbose&&console.log(JSON.stringify(e,null,2))))}function KE(t,e){yn("info")&&(he.json?console.log(JSON.stringify({level:"success",message:t,data:e})):console.log(`${s.success("\u2713")} ${t}`))}function VE(t,e){yn("warn")&&(he.json?console.log(JSON.stringify({level:"warn",message:t,data:e})):console.log(`${s.warn("\u26A0")} ${t}`))}function NE(t,e){yn("error")&&(he.json?console.error(JSON.stringify({level:"error",message:t,data:e})):(console.error(`${s.error("\u2717")} ${t}`),e&&he.verbose&&console.error(JSON.stringify(e,null,2))))}function kE(t){he.json?console.log(JSON.stringify(t)):console.table(t)}function FE(t){console.log(JSON.stringify(t,null,2))}var m={debug:OE,info:UE,success:KE,warn:VE,error:NE,table:kE,json:FE,configure:Mo};import{spawnSync as ZE}from"child_process";var QE="https://registry.npmjs.org",bE="npm-version",JE=3600;async function Dn(t){let e=`${bE}-${t}`,i=Ir(e);if(i)return i;try{let n=await fetch(`${QE}/${t}/latest`,{headers:{Accept:"application/json","User-Agent":"gemkit-cli"}});if(!n.ok)return null;let r=await n.json(),o={name:r.name,version:r.version,description:r.description,publishedAt:r.time?.[r.version]};return fr(e,o,JE),o}catch{return null}}function BE(t,e){let i=t.replace(/^v/,"").split(".").map(Number),n=e.replace(/^v/,"").split(".").map(Number);for(let r=0;r<Math.max(i.length,n.length);r++){let o=i[r]||0,a=n[r]||0;if(o>a)return 1;if(o<a)return-1}return 0}function Pi(t,e){return BE(e,t)>0}import{readFileSync as PE}from"fs";import{join as dv,dirname as qE}from"path";import{fileURLToPath as yE}from"url";var wn="gemkit-cli";function DE(){try{let t=yE(import.meta.url),e=qE(t),i=[dv(e,"..","package.json"),dv(e,"..","..","..","package.json")];for(let n of i)try{let r=JSON.parse(PE(n,"utf-8"));if(r.name===wn&&r.version)return r.version}catch{}}catch{}return"0.0.0"}var de=DE();function Rv(t){t.command("update","Update GemKit CLI and/or Kits to latest version").option("-f, --force","Force update even if already up to date").option("--no-backup","Disable backup before kits update").option("--cli","Update CLI only (npm package)").option("--kits","Update Kits only (.gemini folder)").action(async e=>{let i=e.cli===!0||!e.cli&&!e.kits,n=e.kits===!0||!e.cli&&!e.kits,r=!1,o=!1;i&&(r=await wE(e.force)),n&&(o=await TE(e.force)),console.log(),r||o?m.success("Update complete!"):m.info("Everything is up to date.")})}async function wE(t){console.log(),m.info(`${s.primary("CLI")} Checking for updates...`);let e=await Dn(wn);if(!e)return m.warn("Failed to check npm registry for CLI updates."),!1;let i=de,n=e.version;return!Pi(i,n)&&!t?(m.success(`CLI is up to date (v${i})`),!1):(m.info(`Updating CLI: v${i} \u2192 v${n}`),ZE("npm",["install","-g",`${wn}@latest`],{encoding:"utf-8",stdio:"inherit",shell:!0}).status!==0?(m.error("CLI update failed. Try running manually:"),m.info(` npm install -g ${wn}@latest`),!1):(m.success(`CLI updated to v${n}`),!0))}async function TE(t){console.log(),m.info(`${s.primary("Kits")} Checking for updates...`);let e=Ct();if(!e)return m.warn('GemKit not initialized. Run "gk init" first to install kits.'),!1;let i=await qt();if(!i)return m.warn("Failed to check GitHub for kits updates."),!1;if(i.version===e.version&&!t)return m.success(`Kits are up to date (v${e.version})`),!1;m.info(`Updating Kits: v${e.version} \u2192 v${i.version}`);let n=await zi(i),r=Er(),o=await Zi({source:n,destination:r,strip:1});if(!o.success)return m.error(`Kits update failed: ${o.error}`),!1;let a={...e,version:i.version,installedAt:new Date().toISOString(),installedFiles:o.extractedFiles};return So(a),m.success(`Kits updated to v${i.version}`),!0}async function zv(){let t={cli:null,kits:null};try{let e=await Dn(wn);e&&(t.cli={current:de,latest:e.version,available:Pi(de,e.version)})}catch{}try{let e=Ct(),i=await qt();e&&i&&(t.kits={current:e.version,latest:i.version,available:Pi(e.version,i.version)})}catch{}return t}var gv="gemkit-cli";function $E(t){return _E("npm",["install","-g",`${gv}@${t}`],{encoding:"utf-8",stdio:"pipe",shell:!0}).status===0}function ep(t){switch(t){case"gemini":return[".claude",".claude/**",".agent",".agent/**"];case"claude":return[".agent",".agent/**"];case"antigravity":return[".claude",".claude/**"];default:return[]}}function tp(t){switch(t){case"gemini":return"Gemini CLI (excludes .claude, .agent)";case"claude":return"Claude Code (excludes .agent)";case"antigravity":return"Antigravity (excludes .claude)";default:return"Full (all files)"}}function ip(t,e){let i=t.replace(/\\/g,"/");for(let n of e)if(n.includes("*")){if(n.endsWith("/**")){let r=n.slice(0,-3);if(i.startsWith(r+"/"))return!0}}else if(i===n||i.startsWith(n+"/"))return!0;return!1}function np(t){if(t.length!==0)return e=>!ip(e,t)}async function rp(){let t=HE(".gemini","extensions","spawn-agent");return XE(t)?new Promise(e=>{let i=LE("gemini",["extensions","install",t],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32",cwd:process.cwd()}),n="",r="",o=!1,a=setTimeout(()=>{o||(o=!0,i.kill(),e({success:!1,error:"Extension installation timed out"}))},3e4);i.stdout?.on("data",c=>{n+=c.toString()}),i.stderr?.on("data",c=>{r+=c.toString()}),i.on("close",c=>{o||(o=!0,clearTimeout(a),e(c===0?{success:!0}:{success:!1,error:r||n||`Exit code: ${c}`}))}),i.on("error",c=>{o||(o=!0,clearTimeout(a),e({success:!1,error:`Failed to run gemini CLI: ${c.message}`}))})}):{success:!1,error:`Extension directory not found: ${t}`}}function jv(t){t.command("init","Initialize GemKit in project").option("--version <ver>","Specific version to install").option("-f, --force","Overwrite existing installation").option("--exclude <patterns...>","File patterns to exclude").option("--skip-extension","Skip spawn-agent extension installation").option("--full","Install all files (default)").option("--gemini","Gemini CLI mode (excludes .claude, .agent folders)").option("--claude","Claude Code mode (excludes .agent folder)").option("--antigravity","Antigravity mode (excludes .claude folder)").action(async e=>{let i="full";if(e.gemini?i="gemini":e.claude?i="claude":e.antigravity?i="antigravity":e.full&&(i="full"),Ev()&&!e.force){console.log(),m.warn("GemKit is already installed. Use --force to reinstall."),console.log();return}console.log(),console.log(I.default.bold(s.geminiPurple("Initializing GemKit"))),console.log(),console.log(` ${s.dim("Mode")} ${s.accent(tp(i))}`),console.log();let n=Ke({text:"Checking CLI version...",color:"magenta"}).start();try{let f=await Dn(gv);f&&Pi(de,f.version)?(n.text=`Updating CLI v${de} \u2192 v${f.version}...`,$E(f.version)?n.succeed(`CLI updated v${s.primary(de)} \u2192 v${s.primary(f.version)}`):n.warn(`CLI v${s.primary(de)} (update to v${f.version} failed)`)):n.succeed(`CLI v${s.primary(de)}`)}catch{n.succeed(`CLI v${s.primary(de)}`)}let r=Ke({text:"Fetching latest Kits release...",color:"magenta"}).start(),o=e.version?await Tl(e.version):await qt();o||(r.fail("No Kits release found"),console.log(),process.exit(1)),r.succeed(`Found Kits v${s.primary(o.version)}`);let a=Ke({text:"Downloading Kits...",color:"magenta"}).start(),c;try{c=await zi(o),a.succeed("Kits downloaded")}catch(f){a.fail(`Kits download failed: ${f instanceof Error?f.message:String(f)}`),console.log(),process.exit(1)}let l=ep(i),v=Ke({text:i==="full"?"Extracting Kits...":`Extracting Kits (${i} mode)...`,color:"magenta"}).start(),A=process.cwd(),u=await Zi({source:c,destination:A,strip:1,filter:np(l)});u.success||(v.fail(`Kits extraction failed: ${u.error}`),console.log(),process.exit(1)),v.succeed(`Extracted ${u.extractedFiles.length} files`);let p=mv(o.version,"local",u.extractedFiles);if(So(p),console.log(),m.success(`Kits v${s.primary(o.version)} installed successfully!`),!e.skipExtension&&(i==="full"||i==="gemini")){console.log();let f=Ke({text:"Installing spawn-agent extension...",color:"magenta"}).start(),d=await rp();d.success?f.succeed("spawn-agent extension installed in Gemini CLI"):(f.warn(`Could not install spawn-agent extension: ${d.error}`),m.info(`You can manually install it with: ${s.primary("gemini extensions install .gemini/extensions/spawn-agent")}`))}else(i==="claude"||i==="antigravity")&&(console.log(),m.info(`Skipped Gemini extension (${i} mode).`));console.log(),m.info(`Run ${s.primary("gk doctor")} to verify installation.`),console.log()})}function xv(t){t.command("versions","List available GemKit versions").alias("v").option("--json","Output as JSON").action(async e=>{let i=Ct(),n=await hr();if(e.json){console.log(JSON.stringify({current:i?.version||null,available:n},null,2));return}console.log(),console.log(I.default.bold(s.geminiPurple("GemKit Versions"))),console.log(),console.log(i?` ${s.dim("Current:")} ${s.success(i.version)}`:` ${s.dim("Current:")} ${s.dim("Not installed")}`),console.log(),console.log(` ${I.default.bold("Available Releases:")}`);for(let r of n){let o=r.version===i?.version?s.success(" (current)"):"";console.log(` - ${s.primary(r.version)}${o}`)}console.log()})}import{existsSync as Co}from"fs";import{join as op}from"path";import{spawn as Gv}from"child_process";async function sp(){return new Promise(t=>{let e=Gv("gemini",["extensions","list"],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32"}),i="",n="",r=!1,o=setTimeout(()=>{r||(r=!0,e.kill(),t({installed:!1,error:"Check timed out"}))},2e4);e.stdout?.on("data",a=>{i+=a.toString()}),e.stderr?.on("data",a=>{n+=a.toString()}),e.on("close",a=>{if(!r)if(r=!0,clearTimeout(o),a===0){let c=i.toLowerCase().includes("spawn-agent");t({installed:c})}else t({installed:!1,error:n||"Failed to check extensions"})}),e.on("error",a=>{r||(r=!0,clearTimeout(o),t({installed:!1,error:`Gemini CLI not available: ${a.message}`}))})})}async function ap(){return new Promise(t=>{let e=Gv("gemini",["--version"],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32"}),i="",n=!1,r=setTimeout(()=>{n||(n=!0,e.kill(),t({available:!1,error:"Timed out"}))},15e3);e.stdout?.on("data",o=>{i+=o.toString()}),e.on("close",o=>{if(!n)if(n=!0,clearTimeout(r),o===0){let a=i.trim().split(`
|
|
20
|
+
`)[0]||"unknown";t({available:!0,version:a})}else t({available:!1,error:"Command failed"})}),e.on("error",o=>{n||(n=!0,clearTimeout(r),t({available:!1,error:o.message}))})})}function Sv(t){t.command("doctor","Check installation health").option("--fix","Attempt to fix issues").action(async e=>{console.log(),console.log(I.default.bold(s.geminiPurple("GemKit Health Check"))),console.log();let i=0,n=0,r=[],o=process.version;parseInt(o.slice(1).split(".")[0],10)>=18?r.push({icon:s.success("\u2713"),message:`Node.js ${o}`}):(r.push({icon:s.error("\u2717"),message:`Node.js ${o} ${s.error("(requires >= 18)")}`}),i++);let c=Ke({text:"Checking Gemini CLI...",color:"magenta"}).start(),l=await ap();c.stop(),l.available?r.push({icon:s.success("\u2713"),message:`Gemini CLI ${s.dim(`(${l.version})`)}`}):(r.push({icon:s.error("\u2717"),message:`Gemini CLI not found ${s.dim(`(${l.error})`)}`}),i++);let v=Er();Co(v)?r.push({icon:s.success("\u2713"),message:".gemini directory exists"}):(r.push({icon:s.error("\u2717"),message:".gemini directory missing"}),i++);let A=on();Co(A)?r.push({icon:s.success("\u2713"),message:"Agents directory exists"}):(r.push({icon:s.warn("\u25CB"),message:"Agents directory missing"}),n++);let u=Bt();Co(u)?r.push({icon:s.success("\u2713"),message:"Extensions directory exists"}):(r.push({icon:s.warn("\u25CB"),message:"Extensions directory missing"}),n++);let p=op(u,"spawn-agent");if(Co(p)?r.push({icon:s.success("\u2713"),message:"spawn-agent extension files present"}):(r.push({icon:s.warn("\u25CB"),message:"spawn-agent extension files missing"}),n++),l.available){let f=Ke({text:"Checking spawn-agent extension...",color:"magenta"}).start(),d=await sp();f.stop(),d.installed?r.push({icon:s.success("\u2713"),message:"spawn-agent extension installed in Gemini"}):(r.push({icon:s.error("\u2717"),message:"spawn-agent extension NOT installed in Gemini",hint:d.error?`${d.error}
|
|
21
|
+
Run: gemini extensions install .gemini/extensions/spawn-agent`:"Run: gemini extensions install .gemini/extensions/spawn-agent"}),i++)}let E=Ct();E?r.push({icon:s.success("\u2713"),message:`Installation metadata ${s.primary(`(v${E.version})`)}`}):(r.push({icon:s.warn("\u25CB"),message:"Installation metadata missing"}),n++);for(let f of r)if(console.log(` ${f.icon} ${f.message}`),f.hint)for(let d of f.hint.split(`
|
|
22
|
+
`))console.log(` ${s.dim(d)}`);console.log(),i===0&&n===0?console.log(s.success("All checks passed!")):i===0?console.log(s.success(`All critical checks passed! ${s.dim(`(${n} warning${n>1?"s":""})`)}`)):(console.log(s.error(`${i} issue(s) found.`)),n>0&&console.log(s.warn(`${n} warning(s).`)),console.log(),console.log("To fix issues:"),console.log(` ${s.dim("1.")} Run ${s.primary("gk init")} to install GemKit`),console.log(` ${s.dim("2.")} Run ${s.primary("gemini extensions install .gemini/extensions/spawn-agent")} to install extension`)),console.log()})}function cp(){console.log(),console.log(I.default.bold(s.geminiPurple("Configuration Management"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk config")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("list")} Show all config (default)`),console.log(` ${s.primary("get")} <key> Get config value`),console.log(` ${s.primary("set")} <key> <val> Set config value`),console.log(` ${s.primary("reset")} Reset to defaults`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} [list] Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk config list")}`),console.log(` ${s.dim("gk config get spawn.defaultModel")}`),console.log(` ${s.dim("gk config set spawn.music true")}`),console.log(` ${s.dim("gk config reset")}`),console.log()}function Yv(t){t.command("config [subcommand] [key] [value]","Configuration management (list, get, set, reset)").alias("c").option("--json","[list] Output as JSON").action(async(e,i,n,r)=>{switch(e||"list"){case"list":await lp(r);break;case"get":i||(console.log(),m.error("Config key required"),console.log(s.dim("Usage: gk config get <key>")),console.log(),process.exit(1)),await vp(i);break;case"set":(!i||n===void 0)&&(console.log(),m.error("Config key and value required"),console.log(s.dim("Usage: gk config set <key> <value>")),console.log(),process.exit(1)),await Ap(i,n);break;case"reset":await up();break;default:cp()}})}async function lp(t){let e=Ve();if(t.json){console.log(JSON.stringify(e,null,2));return}console.log(),console.log(I.default.bold(s.geminiPurple("GemKit Configuration"))),console.log(),console.log(JSON.stringify(e,null,2)),console.log()}async function vp(t){let e=Ql(t);if(e===void 0){console.log(),m.error(`Config key not found: ${t}`),console.log();return}console.log(e)}async function Ap(t,e){let i=e;e==="true"?i=!0:e==="false"?i=!1:isNaN(Number(e))||(i=Number(e));try{bl(t,i),console.log(),m.success(`Config updated: ${s.primary(t)} = ${s.success(String(i))}`),console.log()}catch(n){console.log(),m.error(`Failed to set config: ${n instanceof Error?n.message:String(n)}`),console.log()}}async function up(){Jl(),console.log(),m.success("Configuration reset to defaults."),console.log()}function Wv(t){let e=t.command("cache <subcommand>","Cache management");e.example("gk cache stats # Show cache statistics"),e.example("gk cache clear # Clear all cache"),e.action(async i=>{let n=i||"stats";switch(n){case"stats":await mp();break;case"clear":await Ep();break;default:console.log(),m.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1)}})}async function mp(){let t=Dl();console.log(),console.log(I.default.bold(s.geminiPurple("Cache Statistics"))),console.log(),console.log(` ${s.dim("Entries:")} ${s.primary(String(t.entries))}`),console.log(` ${s.dim("Size:")} ${s.primary((t.size/1024).toFixed(2))} KB`),console.log()}async function Ep(){let t=yl();console.log(),m.success(`Cleared ${s.success(String(t))} cache entries.`),console.log()}import{existsSync as pp}from"fs";import{join as Ip}from"path";function Mv(t){t.command("new <name>","Create a new project from starter kit").action(async e=>{let i=Ip(process.cwd(),e);pp(i)&&(console.log(),m.error(`Directory already exists: ${e}`),console.log(),process.exit(1)),console.log(),console.log(I.default.bold(s.geminiPurple("Creating New Project"))),console.log(),m.info(`Name: ${s.primary(e)}`);let n=await qt();n||(m.error("Failed to fetch latest starter kit."),console.log(),process.exit(1)),m.info(`Fetching latest starter kit (v${n.version})...`);let r=await zi(n),o=await Zi({source:r,destination:i,strip:1});o.success?(console.log(),m.success(`Project ${s.primary(e)} created successfully!`),console.log(`
|
|
23
23
|
Next steps:
|
|
24
24
|
cd ${s.primary(e)}
|
|
25
25
|
gk init
|
|
26
|
-
`)):(
|
|
27
|
-
`);for(let
|
|
28
|
-
`);if(i.length<2)return[];let n=i[0].split(",").map(o=>o.trim()),r=[];for(let o=1;o<i.length;o++){let a=UE(i[o]),c={};n.forEach((l,v)=>{c[l]=a[v]?.trim()||""}),r.push(c)}return r}function KE(t,e,i,n,r){if(!ni(t))return[];let o=Xs(t),a=o.map(A=>e.map(m=>String(A[m]||"")).join(" ")),c=new zo;c.fit(a);let l=c.score(n),v=[];for(let[A,m]of l.slice(0,r))if(m>0){let I=o[A],E={};for(let h of i)h in I&&(E[h]=I[h]);E._score=Math.round(m*1e4)/1e4,v.push(E)}return v}function Hs(){let t=Qn(Ts,"synonyms.csv");if(!ni(t))return new Map;let e=Xs(t),i=new Map;for(let n of e){let r=(n.word||"").toLowerCase().trim(),o=(n.synonyms||"").toLowerCase().trim();r&&o&&i.set(r,o.split(",").map(a=>a.trim()))}return i}function Av(t,e){e||(e=Hs());let i=t.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/),n=new Set(i);for(let r of i){let o=e.get(r);o&&o.forEach(a=>n.add(a))}return Array.from(n).join(" ")}function Ls(t){let e=t.toLowerCase();for(let[i,n]of Object.entries(CE))for(let r of n)if(e.includes(r))return i;return"standard"}function _s(t){let e=t.toLowerCase(),n=e.split(/\s+/)[0]||"",r=[[/system architecture/,"plan"],[/design.*architecture/,"plan"],[/architect.*system/,"plan"],[/create.*roadmap/,"plan"],[/build.*roadmap/,"plan"],[/create.*strategy/,"plan"],[/stunning/,"design"],[/gorgeous/,"design"],[/beautiful.*ui/,"design"],[/beautiful.*component/,"design"],[/beautiful.*page/,"design"],[/write.*documentation/,"docs"],[/write.*docs/,"docs"],[/create.*documentation/,"docs"],[/research.*codebase/,"research"],[/deep research/,"research"]];for(let[v,A]of r)if(typeof v=="string"?e.includes(v):v.test(e))return A;let o={implement:"execute",build:"execute",create:"execute",add:"execute",make:"execute",code:"execute",develop:"execute",write:"execute",setup:"execute",configure:"execute",test:"test",verify:"test",validate:"test",debug:"debug",fix:"debug",troubleshoot:"debug",review:"review",audit:"review",document:"docs",plan:"plan",design:"design",research:"research",analyze:"research",investigate:"research"};if(n in o)return o[n];let a=[["best practices","research"],["how does","research"],["how do","research"],["what is","research"],["why is","research"],["compare","research"],["investigate","research"],["research","research"],["understand","research"],["system architecture","plan"],["implementation plan","plan"],["roadmap","plan"],["strategy for","plan"],["blueprint","plan"],["fix the","debug"],["debug the","debug"],["not working","debug"],["is broken","debug"],["error in","debug"],["fix bug","debug"],["test the","test"],["run tests","test"],["verify the","test"],["review the","review"],["audit the","review"],["check code","review"],["document the","docs"],["write docs","docs"],["api documentation","docs"]];for(let[v,A]of a)if(e.includes(v))return A;let c={debug:["fix","debug","troubleshoot","error","issue","bug","broken","failing","crash"],review:["review","audit","assess","check code","pr review","security audit"],test:["test","verify","validate","qa","coverage","unit test","e2e test"],design:["beautiful","stunning","gorgeous","ui design","ux design","mockup","layout"],docs:["document","documentation","readme","api docs","technical writing"],git:["commit","push","pull","merge","branch","git","stage"],manage:["status","progress","track","milestone","sprint"],plan:["plan","architect","roadmap","strategy","architecture design"],execute:["implement","build","create","add","make","code","develop"],research:["research","investigate","explore","study","analyze","examine","learn"]},l={};for(let[v,A]of Object.entries(c)){let m=A.filter(I=>e.includes(I)).length;m>0&&(l[v]=m)}return Object.keys(l).length>0?Object.entries(l).sort((v,A)=>A[1]-v[1])[0][0]:"execute"}function $s(t){let e=t.toLowerCase(),i=[["flutter","mobile"],["react native","mobile"],["swift","mobile"],["kotlin","mobile"],["ios app","mobile"],["android app","mobile"],["next.js","fullstack"],["nextjs","fullstack"],["nuxt","fullstack"],["sveltekit","fullstack"],["remix","fullstack"],["server component","fullstack"],["openai","ai"],["anthropic","ai"],["claude","ai"],["langchain","ai"],["llm","ai"],["chatbot","ai"],["rag","ai"],["embedding","ai"],["gpt","ai"],["angular","frontend"],["react","frontend"],["vue","frontend"],["svelte","frontend"],["tailwind","frontend"],["nestjs","backend"],["express","backend"],["fastify","backend"],["hono","backend"],["fastapi","backend"],["websocket","backend"],["shopify","ecommerce"],["product catalog","ecommerce"],["checkout flow","ecommerce"],["stripe","payment"],["paypal","payment"],["subscription","payment"],["billing","payment"],["oauth","auth"],["authentication","auth"],["login","auth"],["signup","auth"],["prisma","database"],["drizzle","database"],["postgresql","database"],["mongodb","database"],["mysql","database"],["pdf","media"],["image","media"],["video","media"],["audio","media"],["codebase","codebase"],["repository","codebase"]];for(let[o,a]of i)if(e.includes(o))return a;let n={auth:["login","signup","authentication","oauth","jwt","session","password","2fa"],payment:["payment","checkout","billing","stripe","subscription","invoice","cart"],database:["database","sql","query","migration","schema","prisma","postgresql"],frontend:["ui","component","react","vue","css","tailwind","button","form","modal"],backend:["api","endpoint","server","service","route","rest","graphql","middleware"],mobile:["mobile","ios","android","react native","flutter","app","native"],fullstack:["fullstack","nextjs","next.js","nuxt","sveltekit","app router"],ecommerce:["ecommerce","shopify","store","product","cart","checkout","order"],media:["image","video","audio","media","upload","file","ocr"],ai:["ai","llm","gpt","claude","machine learning","embedding","vector","openai"],quality:["code review","lint","test","coverage","quality","refactor"],codebase:["codebase","repository","repo","project structure"],general:[]},r={};for(let[o,a]of Object.entries(n)){let c=a.filter(l=>e.includes(l)).length;c>0&&(r[o]=c)}return Object.keys(r).length>0?Object.entries(r).sort((o,a)=>a[1]-o[1])[0][0]:"general"}function mv(t,e=lv,i=!0){let n=vv.combination,r=Qn(Ts,n.file),o=t;if(i){let c=Hs();o=Av(t,c)}let a=KE(r,n.searchCols,n.outputCols,o,e);return{query:t,expandedQuery:i?o:void 0,detectedIntent:_s(t),detectedDomain:$s(t),detectedComplexity:Ls(t),count:a.length,results:a}}function ys(t,e,i,n=lv,r=!0){let o=vv.combination,a=Qn(Ts,o.file);if(!ni(a))return{results:[],count:0};let c=Xs(a);if(e&&(c=c.filter(E=>(E.intent||"").toLowerCase()===e.toLowerCase())),i&&(c=c.filter(E=>(E.domain||"").toLowerCase()===i.toLowerCase())),c.length===0)return{results:[],count:0};let l=t;if(r){let E=Hs();l=Av(t,E)}let v=c.map(E=>o.searchCols.map(h=>String(E[h]||"")).join(" ")),A=new zo;A.fit(v);let m=A.score(l),I=[];for(let[E,h]of m.slice(0,n))if(h>0){let d=c[E],f={};for(let H of o.outputCols)H in d&&(f[H]=d[H]);f._score=Math.round(h*1e4)/1e4,I.push(f)}return{results:I,count:I.length}}function VE(t){let e=_s(t),i=$s(t),n=Ls(t);if(["debug","review","test","design","docs","research","plan"].includes(e)){let A=ys(t,e,void 0,1,!0);if(A.results.length>0){let m=A.results[0],E=(m.skills||"").split("|").map(h=>h.trim()).filter(Boolean);return{agent:Ds[e]||m.agent||"code-executor",skills:E,intent:e,domain:m.domain||i,complexity:m.complexity||n,score:m._score||0,fallback:!1,description:m.description||"",useWhen:m.use_when||""}}}if(e==="execute"&&["mobile","ai","payment","ecommerce","media","auth","database","fullstack"].includes(i)){let A=ys(t,"execute",i,1,!0);if(A.results.length>0){let m=A.results[0];return{agent:"code-executor",skills:(m.skills||"").split("|").map(h=>h.trim()).filter(Boolean),intent:e,domain:i,complexity:m.complexity||n,score:m._score||0,fallback:!1,description:m.description||"",useWhen:m.use_when||""}}}let a=mv(t,1,!0);if(a.count===0){let A=Ds[e]||"code-executor",m=OE[i]||["research"];return{agent:A,skills:m,intent:e,domain:i,complexity:n,score:0,fallback:!0,description:`Fallback combination based on detected intent (${e}) and domain (${i})`}}let c=a.results[0],v=(c.skills||"").split("|").map(A=>A.trim()).filter(Boolean);return{agent:c.agent||"code-executor",skills:v,intent:c.intent||e,domain:c.domain||i,complexity:c.complexity||n,score:c._score||0,fallback:!1,description:c.description||"",useWhen:c.use_when||""}}function uv(t,e){let{top:i=5,forceIntent:n,forceDomain:r,maxSkills:o}=e||{};if(n||r)return ys(t,n,r,i,!0).results.map(l=>{let A=(l.skills||"").split("|").map(m=>m.trim()).filter(Boolean);return o&&(A=A.slice(0,o)),{agent:n?Ds[n]:l.agent||"code-executor",skills:A,intent:l.intent||n||_s(t),domain:l.domain||r||$s(t),complexity:l.complexity||Ls(t),score:l._score||0,fallback:!1,description:l.description||"",useWhen:l.use_when||""}});let a=mv(t,i,!0);return a.count===0?[VE(t)]:a.results.map(c=>{let v=(c.skills||"").split("|").map(A=>A.trim()).filter(Boolean);return o&&(v=v.slice(0,o)),{agent:c.agent||"code-executor",skills:v,intent:c.intent||a.detectedIntent,domain:c.domain||a.detectedDomain,complexity:c.complexity||a.detectedComplexity,score:c._score||0,fallback:!1,description:c.description||"",useWhen:c.use_when||""}})}function Ev(t){let e=Nt(t),i=[];if(!ni(e))return i;let n=ME(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name);for(let r of n){let o=Qn(e,r,"SKILL.md");if(ni(o)){let a=ws(o,"utf-8");i.push({name:r,path:o,content:a})}}return i}function Iv(t,e){let i=Nt(e),n=Qn(i,t,"SKILL.md");return ni(n)?ws(n,"utf-8"):null}import{existsSync as NE,readFileSync as kE}from"fs";function N(t=process.cwd()){let e={ACTIVE_GK_SESSION_ID:"",GK_PROJECT_HASH:"",PROJECT_DIR:"",ACTIVE_GEMINI_SESSION_ID:"",GEMINI_PROJECT_HASH:"",GEMINI_PARENT_ID:"",ACTIVE_PLAN:"",SUGGESTED_PLAN:"",PLAN_DATE_FORMAT:""},i=Vt(t);if(!NE(i))return e;try{let n=kE(i,"utf-8"),r=n.match(/^ACTIVE_GK_SESSION_ID=(.*)$/m);r&&(e.ACTIVE_GK_SESSION_ID=r[1].trim());let o=n.match(/^GK_PROJECT_HASH=(.*)$/m);o&&(e.GK_PROJECT_HASH=o[1].trim());let a=n.match(/^PROJECT_DIR=(.*)$/m);a&&(e.PROJECT_DIR=a[1].trim());let c=n.match(/^ACTIVE_GEMINI_SESSION_ID=(.*)$/m);c&&(e.ACTIVE_GEMINI_SESSION_ID=c[1].trim());let l=n.match(/^GEMINI_PROJECT_HASH=(.*)$/m);l&&(e.GEMINI_PROJECT_HASH=l[1].trim());let v=n.match(/^GEMINI_PARENT_ID=(.*)$/m);v&&(e.GEMINI_PARENT_ID=v[1].trim());let A=n.match(/^ACTIVE_PLAN=(.*)$/m);A&&(e.ACTIVE_PLAN=A[1].trim());let m=n.match(/^SUGGESTED_PLAN=(.*)$/m);m&&(e.SUGGESTED_PLAN=m[1].trim());let I=n.match(/^PLAN_DATE_FORMAT=(.*)$/m);I&&(e.PLAN_DATE_FORMAT=I[1].trim())}catch{}return e}function ri(t=process.cwd()){return N(t).ACTIVE_GK_SESSION_ID||void 0}function it(t=process.cwd()){let e=N(t);return e.PROJECT_DIR?e.PROJECT_DIR:Li(t)}function Ro(t=process.cwd()){return N(t).GEMINI_PROJECT_HASH||void 0}function Jn(t=process.cwd()){return N(t).ACTIVE_PLAN||void 0}import{existsSync as dv,mkdirSync as PE,writeFileSync as ec,readFileSync as qE,renameSync as DE,unlinkSync as yE}from"fs";import{execSync as wE}from"child_process";import{join as TE}from"path";import{createHash as FE}from"crypto";function QE(t){return FE("sha256").update(t).digest("hex")}function JE(t){return QE(t).substring(0,8)}function pv(t){let e=t.replace(/\\/g,"/").toLowerCase();return JE(e)}function jo(t,e){let i=Date.now().toString(36),n=Math.random().toString(36).substring(2,6);return`${t}-${e}-${i}-${n}`}import{existsSync as hv,readFileSync as fv,readdirSync as BE}from"fs";import{join as ZE}from"path";function Ye(t,e){if(!t||!e)return null;let i=kt(t,e);if(!hv(i))return null;try{let n=fv(i,"utf-8");return JSON.parse(n)}catch{return null}}function zv(t,e={}){let{limit:i=10,status:n="all"}=e,r=be(t);if(!hv(r))return[];let o=[];try{let a=BE(r).filter(c=>c.startsWith("gk-session-")&&c.endsWith(".json"));for(let c of a){let l=ZE(r,c),v=fv(l,"utf-8"),A=JSON.parse(v);n!=="all"&&(A.agents?.find(E=>E.agentType==="Main Agent")?.status||"active")!==n||o.push(A)}}catch{}return o.sort((a,c)=>new Date(c.initTimestamp).getTime()-new Date(a.initTimestamp).getTime()),o.slice(0,i)}function bE(t,e,i={}){let n=Ye(t,e);if(!n||!n.agents)return[];let r=n.agents;return i.agentType&&(r=r.filter(o=>o.agentType===i.agentType)),i.status&&(r=r.filter(o=>o.status===i.status)),r}function Rv(t,e){let i=bE(t,e),n={total:i.length,active:0,completed:0,failed:0,mainAgents:0,subAgents:0,totalDurationMs:0};return i.forEach(r=>{r.status==="active"?n.active++:r.status==="completed"?n.completed++:r.status==="failed"&&n.failed++,r.agentType==="Main Agent"?n.mainAgents++:n.subAgents++,r.startTime&&r.endTime&&(n.totalDurationMs+=new Date(r.endTime).getTime()-new Date(r.startTime).getTime())}),n}function XE(t){try{let e=`powershell -Command "$p = Get-CimInstance Win32_Process -Filter 'ProcessId=${t}'; Write-Output $p.ParentProcessId; Write-Output $p.Name"`,n=wE(e,{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim().split(/\r?\n/),r=parseInt(n[0],10),o=n[1]||null;return{parentPid:!isNaN(r)&&r>0?r:null,processName:o}}catch{return{parentPid:null,processName:null}}}function HE(t){return t?["powershell.exe","pwsh.exe","cmd.exe","bash.exe","zsh.exe","sh.exe","fish.exe"].includes(t.toLowerCase()):!1}function LE(t){if(!t)return!1;let e=t.toLowerCase();return["code.exe","code - insiders.exe","cursor.exe","windsurf.exe","positron.exe","idea64.exe","idea.exe","webstorm64.exe","webstorm.exe","pycharm64.exe","pycharm.exe","phpstorm64.exe","phpstorm.exe","goland64.exe","goland.exe","rustrover64.exe","rustrover.exe","rider64.exe","rider.exe","clion64.exe","clion.exe","datagrip64.exe","datagrip.exe","fleet.exe","windowsterminal.exe","sublime_text.exe","zed.exe","terminal.app"].includes(e)}function tc(){let t=process.ppid;try{if(process.platform==="win32"){let e=t,i=null;for(let n=0;n<10;n++){let{parentPid:r,processName:o}=XE(e);if(HE(o)&&(i=e),LE(o)&&i)return i;if(!r||r<=4)break;e=r}return i||t}else return t}catch{}return t}function go(t){dv(t)||PE(t,{recursive:!0})}function _E(t){let{agents:e,...i}=t;return{...i,agents:e||[]}}function ic(t,e,i){if(!t||!e)return!1;let n=be(t);go(n);let r=kt(t,e),o=`${r}.tmp`;try{let a=_E(i);return ec(o,JSON.stringify(a,null,2),"utf8"),DE(o,r),!0}catch{try{yE(o)}catch{}return!1}}function jv(t){try{let e=Vt(),i=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${t.gkSessionId||""}`,`GK_PROJECT_HASH=${t.gkProjectHash||""}`,`PROJECT_DIR=${t.projectDir||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${t.geminiSessionId||""}`,`GEMINI_PROJECT_HASH=${t.geminiProjectHash||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t.activePlan||""}`,`SUGGESTED_PLAN=${t.suggestedPlan||""}`,`PLAN_DATE_FORMAT=${t.planDateFormat||""}`,""].join(`
|
|
29
|
-
`),n=
|
|
30
|
-
`)}function Kv(){console.log(),console.log(p.default.bold(s.geminiPurple("Agent Management"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("list")} List all agent profiles`),console.log(` ${s.primary("info")} <name> Show agent profile details`),console.log(` ${s.primary("search")} "<task>" Find best agent+skills for a task`),console.log(` ${s.primary("spawn")} Spawn a sub-agent`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk agent list")}`),console.log(` ${s.dim("gk agent info researcher")}`),console.log(` ${s.dim('gk agent search "implement authentication"')}`),console.log(` ${s.dim('gk agent spawn -a researcher -p "research best practices"')}`),console.log(),console.log("Run with subcommand for specific help:"),console.log(` ${s.dim("gk agent list --help")}`),console.log(` ${s.dim("gk agent spawn --help")}`),console.log()}function uI(){console.log(),console.log(p.default.bold(s.geminiPurple("gk agent list"))),console.log(s.dim("List all available agent profiles")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent list")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log()}function EI(){console.log(),console.log(p.default.bold(s.geminiPurple("gk agent info"))),console.log(s.dim("Show detailed information about an agent profile")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent info")} <name> [options]`),console.log(),console.log("Arguments:"),console.log(` ${s.dim("<name>")} Agent profile name (without .md extension)`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log(),console.log("Example:"),console.log(` ${s.dim("gk agent info researcher")}`),console.log()}function II(){console.log(),console.log(p.default.bold(s.geminiPurple("gk agent search"))),console.log(s.dim("Find best agent+skills combination for a task using BM25 search")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent search")} "<task>" [options]`),console.log(),console.log("Arguments:"),console.log(` ${s.dim("<task>")} Task description to search for`),console.log(),console.log("Options:"),console.log(` ${s.dim("-n, --limit <n>")} Number of results (default: 5)`),console.log(` ${s.dim("-i, --intent <i>")} Force intent: research|plan|execute|debug|review|test|design|docs`),console.log(` ${s.dim("-d, --domain <d>")} Force domain: frontend|backend|auth|payment|database|mobile|ai|etc.`),console.log(` ${s.dim("--max-skills <n>")} Maximum skills to include`),console.log(` ${s.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim('gk agent search "implement user authentication"')}`),console.log(` ${s.dim('gk agent search "debug the login form" -i debug')}`),console.log(` ${s.dim('gk agent search "build a payment page" -d payment')}`),console.log()}function Vv(){console.log(),console.log(p.default.bold(s.geminiPurple("gk agent spawn"))),console.log(s.dim("Spawn a sub-agent with Gemini CLI")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent spawn")} -p "<prompt>" [options]`),console.log(),console.log("Required:"),console.log(` ${s.dim("-p, --prompt <text>")} Task prompt for the agent`),console.log(),console.log("Options:"),console.log(` ${s.dim("-a, --agent <name>")} Agent profile name (from .gemini/agents/)`),console.log(` ${s.dim("-s, --skills <list>")} Comma-separated skill names to inject`),console.log(` ${s.dim("-c, --context <files>")} Context files (@file syntax)`),console.log(` ${s.dim("-m, --model <model>")} Model override (default: from config)`),console.log(` ${s.dim("--music")} Play elevator music while waiting`),console.log(` ${s.dim("--no-music")} Disable elevator music`),console.log(` ${s.dim("--music-file <path>")} Custom music file path`),console.log(),console.log("Examples:"),console.log(` ${s.dim('gk agent spawn -p "fix the login bug"')}`),console.log(` ${s.dim('gk agent spawn -a researcher -p "research React best practices"')}`),console.log(` ${s.dim('gk agent spawn -a code-executor -s "frontend-design" -p "build a dashboard"')}`),console.log(` ${s.dim('gk agent spawn -p "implement auth" -m gemini-2.5-pro --music')}`),console.log()}function Nv(t){t.command("agent [subcommand] [arg]","Agent management (list, info, search, spawn)").alias("a").option("--json","[all] Output as JSON").option("-n, --limit <n>","[search] Number of results (default: 5)",{default:5}).option("-i, --intent <intent>","[search] Force intent: research|plan|execute|debug|review|test|design|docs").option("-d, --domain <domain>","[search] Force domain: frontend|backend|auth|payment|database|mobile|ai").option("--max-skills <n>","[search] Maximum skills to include").option("-a, --agent <name>","[spawn] Agent profile name from .gemini/agents/").option("-p, --prompt <text>","[spawn] Task prompt (required for spawn)").option("-s, --skills <list>","[spawn] Comma-separated skill names").option("-c, --context <files>","[spawn] Context files (@file syntax)").option("-m, --model <model>","[spawn] Model override").option("--music","[spawn] Play elevator music while waiting").option("--no-music","[spawn] Disable elevator music").option("--music-file <path>","[spawn] Custom music file path").action(async(e,i,n)=>{if(n.help||n.h)switch(e){case"list":uI();return;case"info":EI();return;case"search":II();return;case"spawn":Vv();return;default:Kv();return}switch(e){case"list":await pI(n);break;case"info":i||(console.log(),u.error("Agent profile name required"),console.log(s.dim("Usage: gk agent info <name>")),console.log(),process.exit(1)),await hI(i,n);break;case"search":i||(console.log(),u.error("Search query required"),console.log(s.dim('Usage: gk agent search "<task>"')),console.log(),process.exit(1)),await fI(i,n);break;case"spawn":await zI(n);break;default:Kv()}})}async function pI(t){let e=fo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple("Available Agents"))),console.log(),e.length===0){u.warn('No agent profiles found. Run "gk init" first.'),console.log();return}for(let i of e)console.log(` ${s.primary(i.name)}`),console.log(` ${s.dim(i.description)}`),console.log(` ${s.dim("Model:")} ${i.model}`),i.skills&&i.skills.length>0&&console.log(` ${s.dim("Skills:")} ${i.skills.join(", ")}`),console.log("");console.log(s.dim(` Total: ${e.length} agents`)),console.log()}async function hI(t,e){let i=qs(t);if(i||(console.log(),u.error(`Agent profile not found: ${t}`),console.log(),process.exit(1)),e.json){console.log(JSON.stringify(i,null,2));return}console.log(),console.log(M.doubleLine()),console.log(p.default.bold(s.geminiPurple(`Agent: ${i.name}`))),console.log(M.doubleLine()),console.log(),console.log(` ${s.dim("Description:")} ${i.description}`),console.log(` ${s.dim("Model:")} ${i.model}`),i.skills?.length&&console.log(` ${s.dim("Skills:")} ${i.skills.join(", ")}`),console.log(` ${s.dim("Path:")} ${i.filePath}`),console.log(),console.log(s.dim("--- Profile Content ---")),console.log(),console.log(s.dim(i.content)),console.log()}async function fI(t,e){let i=uv(t,{top:e.limit,forceIntent:e.intent,forceDomain:e.domain,maxSkills:e.maxSkills});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple(`Search results for: "${t}"`))),console.log(),i.length===0){u.warn("No matching agents found for task."),console.log();return}for(let n=0;n<i.length;n++){let r=i[n],o=r.fallback?s.warn(" [FALLBACK]"):"";console.log(` ${s.success(n+1+".")} ${s.primary(r.agent)}${o} ${s.dim(`(score: ${r.score})`)}`),console.log(` ${s.dim("Intent:")} ${r.intent} ${s.dim("Domain:")} ${r.domain} ${s.dim("Complexity:")} ${r.complexity}`),r.skills.length>0&&console.log(` ${s.dim("Skills:")} ${r.skills.join(" | ")}`),r.description&&console.log(` ${s.dim(r.description)}`),r.useWhen&&console.log(` ${s.dim("Use when:")} ${r.useWhen}`),console.log("")}if(i.length>0){let n=i[0],r=n.skills.length>0?` -s "${n.skills.join(",")}"`:"";console.log(s.dim(" Suggested command:")),console.log(` ${s.primary("gk")} agent spawn -a ${n.agent}${r} -p "${t}"`)}console.log()}async function zI(t){t.prompt||(console.log(),u.error("Prompt is required. Use -p or --prompt"),console.log(),Vv(),process.exit(1));let e=ct(),i=N(),n=i.ACTIVE_GK_SESSION_ID||null,r=i.ACTIVE_GEMINI_SESSION_ID||null,o=i.ACTIVE_PLAN||null,a=i.SUGGESTED_PLAN||null,c=i.PLAN_DATE_FORMAT||null,l=i.PROJECT_DIR||null,v=null;t.agent&&(v=qs(t.agent),v||(console.log(),u.error(`Agent profile not found: ${t.agent}`),console.log(),process.exit(1)));let A=t.model||v?.model||e.spawn.defaultModel,I=process.argv.includes("--music")||process.argv.includes("--no-music")?t.music:e.spawn.music,E=t.musicFile||e.spawn.musicFile,h=t.skills?.split(",").map(z=>z.trim())||[],d=v?.skills||[],f=[...new Set([...d,...h])],H=t.context?t.context.split(",").flatMap(z=>z.trim().split(/\s+/).filter(G=>G)).filter(z=>z):[];async function ce(z){let G=z,Be=!1;if(z.startsWith("@")){let le=z.substring(1),at=[Qi(process.cwd(),".docs",le),Qi(process.cwd(),".plans",le),Qi(process.cwd(),"docs",le),Qi(process.cwd(),"plans",le),Qi(process.cwd(),le)];for(let st of at)try{await oI(st),G=st,Be=!0;break}catch{continue}if(!Be){let st=at.map(si=>` - ${si}`).join(`
|
|
31
|
-
`);throw new Error(`Context file not found: ${
|
|
26
|
+
`)):(m.error(`Failed to create project: ${o.error}`),console.log())})}import{spawn as rI}from"child_process";import{access as oI,stat as sI,readdir as aI,readFile as iA}from"fs/promises";import{join as qi,basename as cI,extname as lI,relative as vI}from"path";import{existsSync as Ko,readFileSync as Gp,readdirSync as Sp}from"fs";import{join as vc,basename as Yp}from"path";var fp={"gemini-3-pro-preview":"opus","gemini-2.5-pro":"opus","gemini-3-flash-preview":"sonnet","gemini-2.5-flash":"sonnet","gemini-2.5-flash-lite":"haiku"},hp={opus:"gemini-2.5-pro",sonnet:"gemini-2.5-flash",haiku:"gemini-2.5-flash-lite"},dp=["haiku","sonnet","opus"];function Oo(t,e){return e==="claude"?dp.includes(t)?t:fp[t]||"sonnet":t.startsWith("gemini-")?t:hp[t]||"gemini-2.5-flash"}var Rp={list_directory:"Bash",read_file:"Read",write_file:"Write",glob:"Glob",search_file_content:"Grep",replace:"Edit",run_shell_command:"Bash",web_fetch:"WebFetch",google_web_search:"WebSearch",save_memory:"TodoWrite",write_todos:"TodoWrite"},zp={Read:"read_file",Write:"write_file",Edit:"replace",Bash:"run_shell_command",Glob:"glob",Grep:"search_file_content",WebFetch:"web_fetch",WebSearch:"google_web_search",TodoWrite:"write_todos",Task:""};function gp(t){return/^[A-Z]/.test(t)}function jp(t){return t.includes("_")||t.startsWith("gemini")}function xp(t,e){let i=t.match(/^([^(]+)(\(.*\))?$/),n=i?.[1]||t,r=i?.[2]||"";if(e==="claude"){if(gp(n))return t;let o=Rp[n];return o?n==="run_shell_command"&&r==="(*)"?o:o+r:t}else{if(jp(n))return t;let o=zp[n];return o?n==="Bash"&&!r?"run_shell_command(*)":o+r:t}}function Uo(t,e){let i=t.map(n=>xp(n,e)).filter(Boolean);return[...new Set(i)]}function Cv(t){return t==="claude"?[".claude/agents",".gemini/agents"]:[".gemini/agents",".claude/agents"]}function Kv(t,e){let i=on(e),n=vc(i,`${t}.md`);return Ko(n)?Ac(n):null}function Vo(t){let e=on(t);if(!Ko(e))return[];let i=Sp(e).filter(r=>r.endsWith(".md")),n=[];for(let r of i){let o=vc(e,r),a=Ac(o);a&&n.push(a)}return n}function Wp(t){let e=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return null;let i={};for(let n of e[1].split(/\r?\n/)){let r=n.indexOf(":");if(r===-1)continue;let o=n.slice(0,r).trim(),a=n.slice(r+1).trim();(a.startsWith('"')&&a.endsWith('"')||a.startsWith("'")&&a.endsWith("'"))&&(a=a.slice(1,-1)),i[o]=a}return i}function Ov(t){if(!t)return[];let e=t.trim();return e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1)),e.split(",").map(i=>i.trim().replace(/['"]/g,"")).filter(Boolean)}function Uv(t){if(!t)return[];let e=t.trim();return e.startsWith("[")&&e.endsWith("]")&&(e=e.slice(1,-1)),e.split(",").map(i=>i.trim().replace(/['"]/g,"")).filter(Boolean)}function Ac(t){if(!Ko(t))return null;let e=Gp(t,"utf-8"),i=Yp(t,".md"),n="",r="gemini-2.5-flash",o=[],a=[],c=Wp(e),l=e;if(c)c.description&&(n=c.description),c.model&&(r=c.model),o=Ov(c.skills),a=Uv(c.tools),l=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").trim();else{let v=e.split(`
|
|
27
|
+
`);for(let E of v){if(E.startsWith("# ")){n=E.substring(2).trim();break}if(E.trim()&&!E.startsWith("#")){n=E.trim();break}}let A=e.match(/model:\s*(.+)/i);A&&(r=A[1].trim());let u=e.match(/skills:\s*(.+)/i);u&&(o=Ov(u[1]));let p=e.match(/tools:\s*(.+)/i);p&&(a=Uv(p[1]))}return{name:i,description:n,model:r,skills:o,tools:a,content:l,filePath:t}}function Vv(t,e,i){let n=i||process.cwd(),r=Cv(e);for(let o of r){let a=vc(n,o,`${t}.md`);if(Ko(a)){let c=Ac(a);if(c)return o===r[0]||(c.model=Oo(c.model,e),c.tools&&c.tools.length>0&&(c.tools=Uo(c.tools,e))),c}}return null}import{existsSync as li,readFileSync as Ec,readdirSync as Mp}from"fs";import{join as Tn}from"path";var pc=".gemini/extensions/spawn-agent/data",Nv=3,kv={combination:{file:"combinations.csv",searchCols:["keywords","description","use_when","agent","skills","intent","domain"],outputCols:["id","agent","skills","intent","domain","complexity","description","use_when"]},intent:{file:"intents.csv",searchCols:["primary_keywords","expanded_keywords","question_patterns"],outputCols:["intent","agent","primary_keywords","expanded_keywords","action_verbs"]},domain:{file:"domains.csv",searchCols:["keywords","frameworks","file_patterns","technical_terms"],outputCols:["domain","base_skills","enhanced_skills","keywords","frameworks"]},synonym:{file:"synonyms.csv",searchCols:["word","synonyms"],outputCols:["word","synonyms","category"]}},Cp={simple:["quick","simple","basic","small","minor","trivial","easy","straightforward"],standard:[],full:["comprehensive","full","complete","entire","thorough","detailed"],complex:["deep","extensive","advanced","complex","sophisticated","enterprise","production"]};var uc={research:"researcher",plan:"planner",execute:"code-executor",debug:"debugger",review:"code-reviewer",test:"tester",design:"ui-ux-designer",docs:"docs-manager",git:"git-manager",manage:"project-manager"},Op={frontend:["frontend-design"],backend:["backend-development"],auth:["better-auth","backend-development"],payment:["payment-integration"],database:["databases"],mobile:["mobile-development"],fullstack:["web-frameworks","backend-development"],ecommerce:["shopify"],media:["ai-multimodal"],ai:["ai-multimodal"],quality:["code-review"],codebase:["repomix"],general:["research"]},No=class{k1;b;corpus=[];docLengths=[];avgdl=0;idf=new Map;docFreqs=new Map;N=0;constructor(e=1.5,i=.75){this.k1=e,this.b=i}tokenize(e){return String(e).toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/).filter(n=>n.length>1)}fit(e){if(this.corpus=e.map(i=>this.tokenize(i)),this.N=this.corpus.length,this.N!==0){this.docLengths=this.corpus.map(i=>i.length),this.avgdl=this.docLengths.reduce((i,n)=>i+n,0)/this.N;for(let i of this.corpus){let n=new Set;for(let r of i)n.has(r)||(this.docFreqs.set(r,(this.docFreqs.get(r)||0)+1),n.add(r))}for(let[i,n]of this.docFreqs.entries())this.idf.set(i,Math.log((this.N-n+.5)/(n+.5)+1))}}score(e){let i=this.tokenize(e),n=[];for(let r=0;r<this.corpus.length;r++){let o=this.corpus[r],a=0,c=this.docLengths[r],l=new Map;for(let v of o)l.set(v,(l.get(v)||0)+1);for(let v of i){let A=this.idf.get(v);if(A!==void 0){let u=l.get(v)||0,p=u*(this.k1+1),E=u+this.k1*(1-this.b+this.b*c/this.avgdl);a+=A*p/E}}n.push([r,a])}return n.sort((r,o)=>o[1]-r[1])}};function Up(t){let e=[],i="",n=!1;for(let r=0;r<t.length;r++){let o=t[r];o==='"'?n=!n:o===","&&!n?(e.push(i),i=""):i+=o}return e.push(i),e}function Ic(t){if(!li(t))return[];let i=Ec(t,"utf-8").trim().split(`
|
|
28
|
+
`);if(i.length<2)return[];let n=i[0].split(",").map(o=>o.trim()),r=[];for(let o=1;o<i.length;o++){let a=Up(i[o]),c={};n.forEach((l,v)=>{c[l]=a[v]?.trim()||""}),r.push(c)}return r}function Kp(t,e,i,n,r){if(!li(t))return[];let o=Ic(t),a=o.map(A=>e.map(u=>String(A[u]||"")).join(" ")),c=new No;c.fit(a);let l=c.score(n),v=[];for(let[A,u]of l.slice(0,r))if(u>0){let p=o[A],E={};for(let f of i)f in p&&(E[f]=p[f]);E._score=Math.round(u*1e4)/1e4,v.push(E)}return v}function fc(){let t=Tn(pc,"synonyms.csv");if(!li(t))return new Map;let e=Ic(t),i=new Map;for(let n of e){let r=(n.word||"").toLowerCase().trim(),o=(n.synonyms||"").toLowerCase().trim();r&&o&&i.set(r,o.split(",").map(a=>a.trim()))}return i}function Fv(t,e){e||(e=fc());let i=t.toLowerCase().replace(/[^\w\s]/g," ").split(/\s+/),n=new Set(i);for(let r of i){let o=e.get(r);o&&o.forEach(a=>n.add(a))}return Array.from(n).join(" ")}function hc(t){let e=t.toLowerCase();for(let[i,n]of Object.entries(Cp))for(let r of n)if(e.includes(r))return i;return"standard"}function dc(t){let e=t.toLowerCase(),n=e.split(/\s+/)[0]||"",r=[[/system architecture/,"plan"],[/design.*architecture/,"plan"],[/architect.*system/,"plan"],[/create.*roadmap/,"plan"],[/build.*roadmap/,"plan"],[/create.*strategy/,"plan"],[/stunning/,"design"],[/gorgeous/,"design"],[/beautiful.*ui/,"design"],[/beautiful.*component/,"design"],[/beautiful.*page/,"design"],[/write.*documentation/,"docs"],[/write.*docs/,"docs"],[/create.*documentation/,"docs"],[/research.*codebase/,"research"],[/deep research/,"research"]];for(let[v,A]of r)if(typeof v=="string"?e.includes(v):v.test(e))return A;let o={implement:"execute",build:"execute",create:"execute",add:"execute",make:"execute",code:"execute",develop:"execute",write:"execute",setup:"execute",configure:"execute",test:"test",verify:"test",validate:"test",debug:"debug",fix:"debug",troubleshoot:"debug",review:"review",audit:"review",document:"docs",plan:"plan",design:"design",research:"research",analyze:"research",investigate:"research"};if(n in o)return o[n];let a=[["best practices","research"],["how does","research"],["how do","research"],["what is","research"],["why is","research"],["compare","research"],["investigate","research"],["research","research"],["understand","research"],["system architecture","plan"],["implementation plan","plan"],["roadmap","plan"],["strategy for","plan"],["blueprint","plan"],["fix the","debug"],["debug the","debug"],["not working","debug"],["is broken","debug"],["error in","debug"],["fix bug","debug"],["test the","test"],["run tests","test"],["verify the","test"],["review the","review"],["audit the","review"],["check code","review"],["document the","docs"],["write docs","docs"],["api documentation","docs"]];for(let[v,A]of a)if(e.includes(v))return A;let c={debug:["fix","debug","troubleshoot","error","issue","bug","broken","failing","crash"],review:["review","audit","assess","check code","pr review","security audit"],test:["test","verify","validate","qa","coverage","unit test","e2e test"],design:["beautiful","stunning","gorgeous","ui design","ux design","mockup","layout"],docs:["document","documentation","readme","api docs","technical writing"],git:["commit","push","pull","merge","branch","git","stage"],manage:["status","progress","track","milestone","sprint"],plan:["plan","architect","roadmap","strategy","architecture design"],execute:["implement","build","create","add","make","code","develop"],research:["research","investigate","explore","study","analyze","examine","learn"]},l={};for(let[v,A]of Object.entries(c)){let u=A.filter(p=>e.includes(p)).length;u>0&&(l[v]=u)}return Object.keys(l).length>0?Object.entries(l).sort((v,A)=>A[1]-v[1])[0][0]:"execute"}function Rc(t){let e=t.toLowerCase(),i=[["flutter","mobile"],["react native","mobile"],["swift","mobile"],["kotlin","mobile"],["ios app","mobile"],["android app","mobile"],["next.js","fullstack"],["nextjs","fullstack"],["nuxt","fullstack"],["sveltekit","fullstack"],["remix","fullstack"],["server component","fullstack"],["openai","ai"],["anthropic","ai"],["claude","ai"],["langchain","ai"],["llm","ai"],["chatbot","ai"],["rag","ai"],["embedding","ai"],["gpt","ai"],["angular","frontend"],["react","frontend"],["vue","frontend"],["svelte","frontend"],["tailwind","frontend"],["nestjs","backend"],["express","backend"],["fastify","backend"],["hono","backend"],["fastapi","backend"],["websocket","backend"],["shopify","ecommerce"],["product catalog","ecommerce"],["checkout flow","ecommerce"],["stripe","payment"],["paypal","payment"],["subscription","payment"],["billing","payment"],["oauth","auth"],["authentication","auth"],["login","auth"],["signup","auth"],["prisma","database"],["drizzle","database"],["postgresql","database"],["mongodb","database"],["mysql","database"],["pdf","media"],["image","media"],["video","media"],["audio","media"],["codebase","codebase"],["repository","codebase"]];for(let[o,a]of i)if(e.includes(o))return a;let n={auth:["login","signup","authentication","oauth","jwt","session","password","2fa"],payment:["payment","checkout","billing","stripe","subscription","invoice","cart"],database:["database","sql","query","migration","schema","prisma","postgresql"],frontend:["ui","component","react","vue","css","tailwind","button","form","modal"],backend:["api","endpoint","server","service","route","rest","graphql","middleware"],mobile:["mobile","ios","android","react native","flutter","app","native"],fullstack:["fullstack","nextjs","next.js","nuxt","sveltekit","app router"],ecommerce:["ecommerce","shopify","store","product","cart","checkout","order"],media:["image","video","audio","media","upload","file","ocr"],ai:["ai","llm","gpt","claude","machine learning","embedding","vector","openai"],quality:["code review","lint","test","coverage","quality","refactor"],codebase:["codebase","repository","repo","project structure"],general:[]},r={};for(let[o,a]of Object.entries(n)){let c=a.filter(l=>e.includes(l)).length;c>0&&(r[o]=c)}return Object.keys(r).length>0?Object.entries(r).sort((o,a)=>a[1]-o[1])[0][0]:"general"}function Qv(t,e=Nv,i=!0){let n=kv.combination,r=Tn(pc,n.file),o=t;if(i){let c=fc();o=Fv(t,c)}let a=Kp(r,n.searchCols,n.outputCols,o,e);return{query:t,expandedQuery:i?o:void 0,detectedIntent:dc(t),detectedDomain:Rc(t),detectedComplexity:hc(t),count:a.length,results:a}}function mc(t,e,i,n=Nv,r=!0){let o=kv.combination,a=Tn(pc,o.file);if(!li(a))return{results:[],count:0};let c=Ic(a);if(e&&(c=c.filter(E=>(E.intent||"").toLowerCase()===e.toLowerCase())),i&&(c=c.filter(E=>(E.domain||"").toLowerCase()===i.toLowerCase())),c.length===0)return{results:[],count:0};let l=t;if(r){let E=fc();l=Fv(t,E)}let v=c.map(E=>o.searchCols.map(f=>String(E[f]||"")).join(" ")),A=new No;A.fit(v);let u=A.score(l),p=[];for(let[E,f]of u.slice(0,n))if(f>0){let d=c[E],z={};for(let C of o.outputCols)C in d&&(z[C]=d[C]);z._score=Math.round(f*1e4)/1e4,p.push(z)}return{results:p,count:p.length}}function Vp(t){let e=dc(t),i=Rc(t),n=hc(t);if(["debug","review","test","design","docs","research","plan"].includes(e)){let A=mc(t,e,void 0,1,!0);if(A.results.length>0){let u=A.results[0],E=(u.skills||"").split("|").map(f=>f.trim()).filter(Boolean);return{agent:uc[e]||u.agent||"code-executor",skills:E,intent:e,domain:u.domain||i,complexity:u.complexity||n,score:u._score||0,fallback:!1,description:u.description||"",useWhen:u.use_when||""}}}if(e==="execute"&&["mobile","ai","payment","ecommerce","media","auth","database","fullstack"].includes(i)){let A=mc(t,"execute",i,1,!0);if(A.results.length>0){let u=A.results[0];return{agent:"code-executor",skills:(u.skills||"").split("|").map(f=>f.trim()).filter(Boolean),intent:e,domain:i,complexity:u.complexity||n,score:u._score||0,fallback:!1,description:u.description||"",useWhen:u.use_when||""}}}let a=Qv(t,1,!0);if(a.count===0){let A=uc[e]||"code-executor",u=Op[i]||["research"];return{agent:A,skills:u,intent:e,domain:i,complexity:n,score:0,fallback:!0,description:`Fallback combination based on detected intent (${e}) and domain (${i})`}}let c=a.results[0],v=(c.skills||"").split("|").map(A=>A.trim()).filter(Boolean);return{agent:c.agent||"code-executor",skills:v,intent:c.intent||e,domain:c.domain||i,complexity:c.complexity||n,score:c._score||0,fallback:!1,description:c.description||"",useWhen:c.use_when||""}}function bv(t,e){let{top:i=5,forceIntent:n,forceDomain:r,maxSkills:o}=e||{};if(n||r)return mc(t,n,r,i,!0).results.map(l=>{let A=(l.skills||"").split("|").map(u=>u.trim()).filter(Boolean);return o&&(A=A.slice(0,o)),{agent:n?uc[n]:l.agent||"code-executor",skills:A,intent:l.intent||n||dc(t),domain:l.domain||r||Rc(t),complexity:l.complexity||hc(t),score:l._score||0,fallback:!1,description:l.description||"",useWhen:l.use_when||""}});let a=Qv(t,i,!0);return a.count===0?[Vp(t)]:a.results.map(c=>{let v=(c.skills||"").split("|").map(A=>A.trim()).filter(Boolean);return o&&(v=v.slice(0,o)),{agent:c.agent||"code-executor",skills:v,intent:c.intent||a.detectedIntent,domain:c.domain||a.detectedDomain,complexity:c.complexity||a.detectedComplexity,score:c._score||0,fallback:!1,description:c.description||"",useWhen:c.use_when||""}})}function Jv(t){let e=Bt(t),i=[];if(!li(e))return i;let n=Mp(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name);for(let r of n){let o=Tn(e,r,"SKILL.md");if(li(o)){let a=Ec(o,"utf-8");i.push({name:r,path:o,content:a})}}return i}function Bv(t,e){let i=Bt(e),n=Tn(i,t,"SKILL.md");return li(n)?Ec(n,"utf-8"):null}import{existsSync as Np,readFileSync as kp}from"fs";function k(t=process.cwd()){let e={ACTIVE_GK_SESSION_ID:"",GK_PROJECT_HASH:"",PROJECT_DIR:"",ACTIVE_GEMINI_SESSION_ID:"",GEMINI_PROJECT_HASH:"",GEMINI_PARENT_ID:"",ACTIVE_PLAN:"",SUGGESTED_PLAN:"",PLAN_DATE_FORMAT:""},i=Jt(t);if(!Np(i))return e;try{let n=kp(i,"utf-8"),r=n.match(/^ACTIVE_GK_SESSION_ID=(.*)$/m);r&&(e.ACTIVE_GK_SESSION_ID=r[1].trim());let o=n.match(/^GK_PROJECT_HASH=(.*)$/m);o&&(e.GK_PROJECT_HASH=o[1].trim());let a=n.match(/^PROJECT_DIR=(.*)$/m);a&&(e.PROJECT_DIR=a[1].trim());let c=n.match(/^ACTIVE_GEMINI_SESSION_ID=(.*)$/m);c&&(e.ACTIVE_GEMINI_SESSION_ID=c[1].trim());let l=n.match(/^GEMINI_PROJECT_HASH=(.*)$/m);l&&(e.GEMINI_PROJECT_HASH=l[1].trim());let v=n.match(/^GEMINI_PARENT_ID=(.*)$/m);v&&(e.GEMINI_PARENT_ID=v[1].trim());let A=n.match(/^ACTIVE_PLAN=(.*)$/m);A&&(e.ACTIVE_PLAN=A[1].trim());let u=n.match(/^SUGGESTED_PLAN=(.*)$/m);u&&(e.SUGGESTED_PLAN=u[1].trim());let p=n.match(/^PLAN_DATE_FORMAT=(.*)$/m);p&&(e.PLAN_DATE_FORMAT=p[1].trim())}catch{}return e}function vi(t=process.cwd()){return k(t).ACTIVE_GK_SESSION_ID||void 0}function at(t=process.cwd()){let e=k(t);return e.PROJECT_DIR?e.PROJECT_DIR:sn(t)}function ko(t=process.cwd()){return k(t).GEMINI_PROJECT_HASH||void 0}function Xn(t=process.cwd()){return k(t).ACTIVE_PLAN||void 0}import{existsSync as wv,mkdirSync as Pp,writeFileSync as zc,readFileSync as qp,renameSync as yp,unlinkSync as Dp}from"fs";import{execSync as wp}from"child_process";import{join as Tp}from"path";import{createHash as Fp}from"crypto";function Qp(t){return Fp("sha256").update(t).digest("hex")}function bp(t){return Qp(t).substring(0,8)}function Zv(t){let e=t.replace(/\\/g,"/").toLowerCase();return bp(e)}function Fo(t,e){let i=Date.now().toString(36),n=Math.random().toString(36).substring(2,6);return`${t}-${e}-${i}-${n}`}import{existsSync as Pv,readFileSync as qv,readdirSync as Jp}from"fs";import{join as Bp}from"path";function Ce(t,e){if(!t||!e)return null;let i=Zt(t,e);if(!Pv(i))return null;try{let n=qv(i,"utf-8");return JSON.parse(n)}catch{return null}}function yv(t,e={}){let{limit:i=10,status:n="all"}=e,r=we(t);if(!Pv(r))return[];let o=[];try{let a=Jp(r).filter(c=>c.startsWith("gk-session-")&&c.endsWith(".json"));for(let c of a){let l=Bp(r,c),v=qv(l,"utf-8"),A=JSON.parse(v);n!=="all"&&(A.agents?.find(E=>E.agentType==="Main Agent")?.status||"active")!==n||o.push(A)}}catch{}return o.sort((a,c)=>new Date(c.initTimestamp).getTime()-new Date(a.initTimestamp).getTime()),o.slice(0,i)}function Zp(t,e,i={}){let n=Ce(t,e);if(!n||!n.agents)return[];let r=n.agents;return i.agentType&&(r=r.filter(o=>o.agentType===i.agentType)),i.status&&(r=r.filter(o=>o.status===i.status)),r}function Dv(t,e){let i=Zp(t,e),n={total:i.length,active:0,completed:0,failed:0,mainAgents:0,subAgents:0,totalDurationMs:0};return i.forEach(r=>{r.status==="active"?n.active++:r.status==="completed"?n.completed++:r.status==="failed"&&n.failed++,r.agentType==="Main Agent"?n.mainAgents++:n.subAgents++,r.startTime&&r.endTime&&(n.totalDurationMs+=new Date(r.endTime).getTime()-new Date(r.startTime).getTime())}),n}function Xp(t){try{let e=`powershell -Command "$p = Get-CimInstance Win32_Process -Filter 'ProcessId=${t}'; Write-Output $p.ParentProcessId; Write-Output $p.Name"`,n=wp(e,{encoding:"utf8",stdio:["pipe","pipe","pipe"]}).trim().split(/\r?\n/),r=parseInt(n[0],10),o=n[1]||null;return{parentPid:!isNaN(r)&&r>0?r:null,processName:o}}catch{return{parentPid:null,processName:null}}}function Hp(t){return t?["powershell.exe","pwsh.exe","cmd.exe","bash.exe","zsh.exe","sh.exe","fish.exe"].includes(t.toLowerCase()):!1}function Lp(t){if(!t)return!1;let e=t.toLowerCase();return["code.exe","code - insiders.exe","cursor.exe","windsurf.exe","positron.exe","idea64.exe","idea.exe","webstorm64.exe","webstorm.exe","pycharm64.exe","pycharm.exe","phpstorm64.exe","phpstorm.exe","goland64.exe","goland.exe","rustrover64.exe","rustrover.exe","rider64.exe","rider.exe","clion64.exe","clion.exe","datagrip64.exe","datagrip.exe","fleet.exe","windowsterminal.exe","sublime_text.exe","zed.exe","terminal.app"].includes(e)}function gc(){let t=process.ppid;try{if(process.platform==="win32"){let e=t,i=null;for(let n=0;n<10;n++){let{parentPid:r,processName:o}=Xp(e);if(Hp(o)&&(i=e),Lp(o)&&i)return i;if(!r||r<=4)break;e=r}return i||t}else return t}catch{}return t}function Qo(t){wv(t)||Pp(t,{recursive:!0})}function _p(t){let{agents:e,...i}=t;return{...i,agents:e||[]}}function jc(t,e,i){if(!t||!e)return!1;let n=we(t);Qo(n);let r=Zt(t,e),o=`${r}.tmp`;try{let a=_p(i);return zc(o,JSON.stringify(a,null,2),"utf8"),yp(o,r),!0}catch{try{Dp(o)}catch{}return!1}}function Tv(t){try{let e=Jt(),i=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${t.gkSessionId||""}`,`GK_PROJECT_HASH=${t.gkProjectHash||""}`,`PROJECT_DIR=${t.projectDir||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${t.geminiSessionId||""}`,`GEMINI_PROJECT_HASH=${t.geminiProjectHash||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t.activePlan||""}`,`SUGGESTED_PLAN=${t.suggestedPlan||""}`,`PLAN_DATE_FORMAT=${t.planDateFormat||""}`,""].join(`
|
|
29
|
+
`),n=Tp(process.cwd(),".gemini");return Qo(n),zc(e,i,"utf8"),!0}catch{return!1}}function $p(t,e){if(!t||!e)return null;let i=an(t,e);if(!wv(i))return null;try{let n=qp(i,"utf-8");return JSON.parse(n)}catch{return null}}function Xv(t,e,i){if(!t||!e)return!1;let n=we(t);Qo(n);let r=an(t,e);try{return zc(r,JSON.stringify(i,null,2),"utf8"),!0}catch{return!1}}function Hv(t,e,i){let n=$p(t,e);return n||(n={gkProjectHash:e,projectDir:t,projectPath:i||process.cwd(),geminiProjectHash:null,initialized:!0,initTimestamp:new Date().toISOString(),lastActiveTimestamp:new Date().toISOString(),activeGkSessionId:null,sessions:[]},Xv(t,e,n)),n}function eI(t,e,i){let n=Hv(t,e);n.activeGkSessionId=i.gkSessionId,n.lastActiveTimestamp=new Date().toISOString();let r=n.sessions.findIndex(o=>o.gkSessionId===i.gkSessionId);if(r>=0){let o=n.sessions[r];n.sessions[r]={gkSessionId:i.gkSessionId,pid:i.pid??o.pid,sessionType:i.sessionType||o.sessionType,appName:i.appName||o.appName,prompt:i.prompt??o.prompt??null,activePlan:i.activePlan??o.activePlan??null,startTime:i.startTime||o.startTime,endTime:i.endTime??o.endTime??null}}else n.sessions.push({gkSessionId:i.gkSessionId,pid:i.pid??null,sessionType:i.sessionType||"gemini",appName:i.appName||"gemini-main",prompt:i.prompt??null,activePlan:i.activePlan??null,startTime:i.startTime||new Date().toISOString(),endTime:i.endTime??null});return n.sessions.sort((o,a)=>{let c=new Date(o.startTime||0).getTime();return new Date(a.startTime||0).getTime()-c}),Xv(t,e,n)}function bo(t,e,i){let n=Ce(t,e);if(!n)return!1;let r=i.gkSessionId||e;n.agents=n.agents||[];let o=n.agents.findIndex(a=>a.gkSessionId===r);if(o>=0){let a=n.agents[o];n.agents[o]={...a,model:a.model||i.model||null,prompt:a.prompt||i.prompt||null}}else{let a={gkSessionId:r,pid:i.pid||null,geminiSessionId:i.geminiSessionId||null,geminiProjectHash:i.geminiProjectHash||null,parentGkSessionId:i.parentGkSessionId||null,agentType:i.parentGkSessionId?"Sub Agent":"Main Agent",agentRole:i.agentRole||"main",prompt:i.prompt||null,model:i.model||null,tokenUsage:i.tokenUsage||null,retryCount:i.retryCount||0,resumeCount:i.resumeCount||0,generation:i.generation||0,injected:i.injected||null,startTime:new Date().toISOString(),endTime:null,status:"active",exitCode:null,error:null};n.agents.push(a)}return jc(t,e,n)}function Lv(t,e={}){let i=e.cwd||process.cwd(),n=sn(i),r=Zv(i),o=gc(),a=Fo(t,o),c={gkSessionId:a,gkProjectHash:r,projectDir:n,geminiSessionId:null,geminiParentId:null,geminiProjectHash:null,initialized:!0,initTimestamp:new Date().toISOString(),sessionType:"non-gemini",appName:t,pid:o,activePlan:e.activePlan||null,suggestedPlan:e.suggestedPlan||null,agents:[]};Qo(we(n)),jc(n,a,c),Hv(n,r,i),eI(n,r,{gkSessionId:a,pid:o,sessionType:"non-gemini",appName:t,startTime:c.initTimestamp,activePlan:c.activePlan});let l=k(),A=l.PROJECT_DIR===n&&l.GEMINI_PROJECT_HASH||"";return Tv({gkSessionId:a,gkProjectHash:r,projectDir:n,geminiSessionId:"",geminiProjectHash:A,activePlan:c.activePlan||"",suggestedPlan:c.suggestedPlan||"",planDateFormat:""}),{session:c,gkSessionId:a,pid:o,projectDir:n,gkProjectHash:r}}function _v(t,e,i){let n=Ce(t,e);if(!n||(n.activePlan=i,n.suggestedPlan=null,!jc(t,e,n)))return!1;let r=k();return Tv({gkSessionId:e,gkProjectHash:n.gkProjectHash||r.GK_PROJECT_HASH,projectDir:t,geminiSessionId:n.geminiSessionId||r.ACTIVE_GEMINI_SESSION_ID,geminiProjectHash:n.geminiProjectHash||r.GEMINI_PROJECT_HASH,activePlan:i,suggestedPlan:"",planDateFormat:n.planDateFormat||r.PLAN_DATE_FORMAT})}function $v(t){if(!t)return null;let e=t.match(/^(.+)-(\d+)-([a-z0-9]+)-([a-z0-9]{4})$/);return e?{appName:e[1],pid:parseInt(e[2],10),timestamp:e[3],random:e[4]}:null}import{spawn as tI,exec as iI}from"child_process";import{existsSync as Jo,readFileSync as xc,writeFileSync as Gc,unlinkSync as eA}from"fs";import{join as Zo}from"path";import{tmpdir as nI,platform as tA}from"os";var qe=Zo(nI(),"elevator-music.lock"),Bo=3e4,Po=class{audioFile;loop;volume;process=null;isPlaying=!1;loopInterval=null;hasLock=!1;lockRefreshInterval=null;triedFallback=!1;constructor(e={}){this.audioFile=e.audioFile||this.getDefaultAudioFile(),this.loop=e.loop!==!1,this.volume=e.volume||.5}tryAcquireLock(){let e={pid:process.pid,timestamp:Date.now()};try{return Gc(qe,JSON.stringify(e),{flag:"wx"}),this.hasLock=!0,this.lockRefreshInterval=setInterval(()=>{this.refreshLock()},Bo/3),!0}catch(i){return i.code==="EEXIST"?this.tryTakeStaleLock(e):!1}}tryTakeStaleLock(e){try{let i=JSON.parse(xc(qe,"utf8"));if(Date.now()-i.timestamp<Bo&&i.pid!==process.pid)try{return process.kill(i.pid,0),!1}catch{}eA(qe);try{return Gc(qe,JSON.stringify(e),{flag:"wx"}),this.hasLock=!0,this.lockRefreshInterval=setInterval(()=>{this.refreshLock()},Bo/3),!0}catch{return!1}}catch{return!1}}refreshLock(){if(this.hasLock)try{let e={pid:process.pid,timestamp:Date.now()};Gc(qe,JSON.stringify(e),{flag:"w"})}catch{}}releaseLock(){if(this.lockRefreshInterval&&(clearInterval(this.lockRefreshInterval),this.lockRefreshInterval=null),!!this.hasLock){try{Jo(qe)&&JSON.parse(xc(qe,"utf8")).pid===process.pid&&eA(qe)}catch{}this.hasLock=!1}}getDefaultAudioFile(){let e=[Zo(process.cwd(),".gemini","extensions","spawn-agent","assets","golden-coast-melody.wav"),Zo(process.cwd(),".gemini","assets","elevator_music.wav"),Zo(process.cwd(),"assets","elevator_music.wav")];for(let i of e)if(Jo(i))return i;return null}getPlayCommand(){if(!this.audioFile)return null;switch(tA()){case"win32":return{command:"powershell",args:["-NoProfile","-Command",`$player = New-Object System.Media.SoundPlayer '${this.audioFile}'; $player.PlaySync()`],shell:!1};case"darwin":return{command:"afplay",args:["-v",String(this.volume),this.audioFile],shell:!1};case"linux":return{command:"paplay",args:["--volume",String(Math.round(this.volume*65536)),this.audioFile],shell:!1,fallback:{command:"aplay",args:["-q",this.audioFile],shell:!1}};default:return null}}start(e={}){if(!this.audioFile||!Jo(this.audioFile))return!1;if(this.isPlaying)return!0;if(!e.force&&!this.tryAcquireLock())return!1;let i=this.getPlayCommand();return i?(this.isPlaying=!0,this.playLoop(i),!0):(this.releaseLock(),!1)}playLoop(e){if(!this.isPlaying)return;let i=n=>{this.process=tI(n.command,n.args,{stdio:["ignore","ignore","pipe"],windowsHide:!0,shell:n.shell}),this.process.stderr?.on("data",()=>{n.fallback&&!this.triedFallback&&(this.triedFallback=!0,this.process?.kill(),i(n.fallback))}),this.process.on("close",()=>{this.isPlaying&&this.loop&&(this.loopInterval=setTimeout(()=>{this.playLoop(e)},100))}),this.process.on("error",()=>{n.fallback&&!this.triedFallback&&(this.triedFallback=!0,i(n.fallback))})};i(e)}stop(){this.isPlaying=!1,this.loopInterval&&(clearTimeout(this.loopInterval),this.loopInterval=null),this.process&&(tA()==="win32"?iI(`taskkill /pid ${this.process.pid} /T /F`,{windowsHide:!0}):this.process.kill("SIGTERM"),this.process=null),this.releaseLock()}get playing(){return this.isPlaying}static isAnyPlaying(){try{if(!Jo(qe))return!1;let e=JSON.parse(xc(qe,"utf8"));if(Date.now()-e.timestamp>=Bo)return!1;try{return process.kill(e.pid,0),!0}catch{return!1}}catch{return!1}}};var nA=[{icon:"\u{1F4A9}",action:"Pooping out some code"},{icon:"\u{1F373}",action:"Cooking up solutions"},{icon:"\u{1F9E0}",action:"Brain cells working overtime"},{icon:"\u26A1",action:"Neurons firing rapidly"},{icon:"\u{1F52E}",action:"Consulting the crystal ball"},{icon:"\u{1F3B0}",action:"Rolling the dice on this one"},{icon:"\u{1F680}",action:"Launching into hyperthink"},{icon:"\u{1F32A}\uFE0F",action:"Brainstorming intensifies"},{icon:"\u{1F3AA}",action:"Juggling multiple thoughts"},{icon:"\u{1F527}",action:"Tightening the logic bolts"},{icon:"\u{1F3A8}",action:"Painting the solution"},{icon:"\u{1F3D7}\uFE0F",action:"Building something awesome"},{icon:"\u{1F52C}",action:"Analyzing under the microscope"},{icon:"\u{1F9EA}",action:"Mixing the secret sauce"},{icon:"\u{1F3AF}",action:"Aiming for perfection"},{icon:"\u{1F9D9}",action:"Casting coding spells"},{icon:"\u{1F419}",action:"Multitasking like an octopus"},{icon:"\u{1F9BE}",action:"Flexing the AI muscles"},{icon:"\u{1F308}",action:"Finding the pot of gold"},{icon:"\u{1F3B8}",action:"Rocking out some logic"}],rA=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function AI(t){let e=0,i=0,n=0,r=process.stdout.isTTY,o=setInterval(()=>{n++,i++;let a=n%10===0;a&&e++;let c=nA[e%nA.length],v=`${rA[i%rA.length]} ${c.icon} ${c.action}... ${n}s`;r?process.stdout.write(`\r\x1B[K${v}`):(n===1||a)&&console.log(v)},1e3);return{interval:o,stop:()=>{clearInterval(o),r&&process.stdout.write("\r\x1B[K")}}}function uI(t){let{agentType:e="Sub Agent",agentRole:i="unknown",parentSessionId:n=null,activePlan:r=null,projectDir:o=null}=t,a=[`Agent Type: ${e}`,`Agent Role: ${i}`];return n&&a.push(`Parent Session: ${n.slice(0,8)}...`),o&&a.push(`Project: ${o}`),r&&a.push(`Active Plan: ${r}`),a.join(`
|
|
30
|
+
`)}function oA(){console.log(),console.log(I.default.bold(s.geminiPurple("Agent Management"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("list")} List all agent profiles`),console.log(` ${s.primary("info")} <name> Show agent profile details`),console.log(` ${s.primary("search")} "<task>" Find best agent+skills for a task`),console.log(` ${s.primary("spawn")} Spawn a sub-agent`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk agent list")}`),console.log(` ${s.dim("gk agent info researcher")}`),console.log(` ${s.dim('gk agent search "implement authentication"')}`),console.log(` ${s.dim('gk agent spawn -a researcher -p "research best practices"')}`),console.log(),console.log("Run with subcommand for specific help:"),console.log(` ${s.dim("gk agent list --help")}`),console.log(` ${s.dim("gk agent spawn --help")}`),console.log()}function mI(){console.log(),console.log(I.default.bold(s.geminiPurple("gk agent list"))),console.log(s.dim("List all available agent profiles")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent list")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log()}function EI(){console.log(),console.log(I.default.bold(s.geminiPurple("gk agent info"))),console.log(s.dim("Show detailed information about an agent profile")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent info")} <name> [options]`),console.log(),console.log("Arguments:"),console.log(` ${s.dim("<name>")} Agent profile name (without .md extension)`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log(),console.log("Example:"),console.log(` ${s.dim("gk agent info researcher")}`),console.log()}function pI(){console.log(),console.log(I.default.bold(s.geminiPurple("gk agent search"))),console.log(s.dim("Find best agent+skills combination for a task using BM25 search")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent search")} "<task>" [options]`),console.log(),console.log("Arguments:"),console.log(` ${s.dim("<task>")} Task description to search for`),console.log(),console.log("Options:"),console.log(` ${s.dim("-n, --limit <n>")} Number of results (default: 5)`),console.log(` ${s.dim("-i, --intent <i>")} Force intent: research|plan|execute|debug|review|test|design|docs`),console.log(` ${s.dim("-d, --domain <d>")} Force domain: frontend|backend|auth|payment|database|mobile|ai|etc.`),console.log(` ${s.dim("--max-skills <n>")} Maximum skills to include`),console.log(` ${s.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim('gk agent search "implement user authentication"')}`),console.log(` ${s.dim('gk agent search "debug the login form" -i debug')}`),console.log(` ${s.dim('gk agent search "build a payment page" -d payment')}`),console.log()}function sA(){console.log(),console.log(I.default.bold(s.geminiPurple("gk agent spawn"))),console.log(s.dim("Spawn a sub-agent with Gemini or Claude CLI")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk agent spawn")} -p "<prompt>" [options]`),console.log(),console.log("Required:"),console.log(` ${s.dim("-p, --prompt <text>")} Task prompt for the agent`),console.log(),console.log("Options:"),console.log(` ${s.dim("-a, --agent <name>")} Agent profile name`),console.log(` ${s.dim("-s, --skills <list>")} Comma-separated skill names to inject`),console.log(` ${s.dim("-c, --context <files>")} Context files (@file syntax)`),console.log(` ${s.dim("-m, --model <model>")} Model override (default: from config)`),console.log(` ${s.dim("-t, --tools <list>")} Comma-separated tools to auto-approve`),console.log(` ${s.dim("--cli <provider>")} CLI provider: gemini (default) or claude`),console.log(` ${s.dim("--music")} Play elevator music while waiting`),console.log(` ${s.dim("--no-music")} Disable elevator music`),console.log(` ${s.dim("--music-file <path>")} Custom music file path`),console.log(),console.log("CLI Providers:"),console.log(` ${s.dim("gemini")} Uses Gemini CLI (default). Loads from .gemini/agents/, falls back to .claude/agents/`),console.log(` ${s.dim("claude")} Uses Claude CLI. Loads from .claude/agents/, falls back to .gemini/agents/`),console.log(` ${s.dim("Models and tools are automatically mapped between providers when using fallback.")}`),console.log(),console.log("Examples:"),console.log(` ${s.dim('gk agent spawn -p "fix the login bug"')}`),console.log(` ${s.dim('gk agent spawn -a researcher -p "research React best practices"')}`),console.log(` ${s.dim('gk agent spawn -a code-executor -s "frontend-design" -p "build a dashboard"')}`),console.log(` ${s.dim('gk agent spawn -p "implement auth" -m gemini-2.5-pro --music')}`),console.log(` ${s.dim('gk agent spawn -a researcher -t "list_directory,read_file,glob" -p "analyze code"')}`),console.log(` ${s.dim('gk agent spawn --cli claude -a researcher -p "analyze codebase"')}`),console.log(),console.log("Allowed Tools:"),console.log(` ${s.dim("Tools can be defined in agent frontmatter (tools: tool1, tool2)")}`),console.log(` ${s.dim("or passed via CLI. Both sources are merged and deduplicated.")}`),console.log(` ${s.dim("Gemini tools: list_directory, read_file, write_file, glob, run_shell_command(*)")}`),console.log(` ${s.dim("Claude tools: Read, Write, Edit, Bash, Glob, Grep, WebFetch, WebSearch")}`),console.log()}function aA(t){t.command("agent [subcommand] [arg]","Agent management (list, info, search, spawn)").alias("a").option("--json","[all] Output as JSON").option("-n, --limit <n>","[search] Number of results (default: 5)",{default:5}).option("-i, --intent <intent>","[search] Force intent: research|plan|execute|debug|review|test|design|docs").option("-d, --domain <domain>","[search] Force domain: frontend|backend|auth|payment|database|mobile|ai").option("--max-skills <n>","[search] Maximum skills to include").option("-a, --agent <name>","[spawn] Agent profile name").option("-p, --prompt <text>","[spawn] Task prompt (required for spawn)").option("-s, --skills <list>","[spawn] Comma-separated skill names").option("-c, --context <files>","[spawn] Context files (@file syntax)").option("-m, --model <model>","[spawn] Model override").option("-t, --tools <list>","[spawn] Comma-separated tools to auto-approve").option("--cli <provider>","[spawn] CLI provider: gemini (default) or claude").option("--music","[spawn] Play elevator music while waiting").option("--no-music","[spawn] Disable elevator music").option("--music-file <path>","[spawn] Custom music file path").action(async(e,i,n)=>{if(n.help||n.h)switch(e){case"list":mI();return;case"info":EI();return;case"search":pI();return;case"spawn":sA();return;default:oA();return}switch(e){case"list":await II(n);break;case"info":i||(console.log(),m.error("Agent profile name required"),console.log(s.dim("Usage: gk agent info <name>")),console.log(),process.exit(1)),await fI(i,n);break;case"search":i||(console.log(),m.error("Search query required"),console.log(s.dim('Usage: gk agent search "<task>"')),console.log(),process.exit(1)),await hI(i,n);break;case"spawn":await dI(n);break;default:oA()}})}async function II(t){let e=Vo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(I.default.bold(s.geminiPurple("Available Agents"))),console.log(),e.length===0){m.warn('No agent profiles found. Run "gk init" first.'),console.log();return}for(let i of e)console.log(` ${s.primary(i.name)}`),console.log(` ${s.dim(i.description)}`),console.log(` ${s.dim("Model:")} ${i.model}`),i.skills&&i.skills.length>0&&console.log(` ${s.dim("Skills:")} ${i.skills.join(", ")}`),console.log("");console.log(s.dim(` Total: ${e.length} agents`)),console.log()}async function fI(t,e){let i=Kv(t);if(i||(console.log(),m.error(`Agent profile not found: ${t}`),console.log(),process.exit(1)),e.json){console.log(JSON.stringify(i,null,2));return}console.log(),console.log(M.doubleLine()),console.log(I.default.bold(s.geminiPurple(`Agent: ${i.name}`))),console.log(M.doubleLine()),console.log(),console.log(` ${s.dim("Description:")} ${i.description}`),console.log(` ${s.dim("Model:")} ${i.model}`),i.skills?.length&&console.log(` ${s.dim("Skills:")} ${i.skills.join(", ")}`),console.log(` ${s.dim("Path:")} ${i.filePath}`),console.log(),console.log(s.dim("--- Profile Content ---")),console.log(),console.log(s.dim(i.content)),console.log()}async function hI(t,e){let i=bv(t,{top:e.limit,forceIntent:e.intent,forceDomain:e.domain,maxSkills:e.maxSkills});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),console.log(I.default.bold(s.geminiPurple(`Search results for: "${t}"`))),console.log(),i.length===0){m.warn("No matching agents found for task."),console.log();return}for(let n=0;n<i.length;n++){let r=i[n],o=r.fallback?s.warn(" [FALLBACK]"):"";console.log(` ${s.success(n+1+".")} ${s.primary(r.agent)}${o} ${s.dim(`(score: ${r.score})`)}`),console.log(` ${s.dim("Intent:")} ${r.intent} ${s.dim("Domain:")} ${r.domain} ${s.dim("Complexity:")} ${r.complexity}`),r.skills.length>0&&console.log(` ${s.dim("Skills:")} ${r.skills.join(" | ")}`),r.description&&console.log(` ${s.dim(r.description)}`),r.useWhen&&console.log(` ${s.dim("Use when:")} ${r.useWhen}`),console.log("")}if(i.length>0){let n=i[0],r=n.skills.length>0?` -s "${n.skills.join(",")}"`:"";console.log(s.dim(" Suggested command:")),console.log(` ${s.primary("gk")} agent spawn -a ${n.agent}${r} -p "${t}"`)}console.log()}async function dI(t){t.prompt||(console.log(),m.error("Prompt is required. Use -p or --prompt"),console.log(),sA(),process.exit(1));let e=t.cli==="claude"?"claude":"gemini",i=Ve(),n=k(),r=n.ACTIVE_GK_SESSION_ID||null,o=n.ACTIVE_GEMINI_SESSION_ID||null,a=n.ACTIVE_PLAN||null,c=n.SUGGESTED_PLAN||null,l=n.PLAN_DATE_FORMAT||null,v=n.PROJECT_DIR||null,A=null;t.agent&&(A=Vv(t.agent,e),A||(console.log(),m.error(`Agent profile not found: ${t.agent}`),console.log(s.dim(`Searched: .${e==="claude"?"claude":"gemini"}/agents/ and fallback folder`)),console.log(),process.exit(1)));let u=t.model||A?.model||i.spawn.defaultModel;u=Oo(u,e);let E=process.argv.includes("--music")||process.argv.includes("--no-music")?t.music:i.spawn.music,f=t.musicFile||i.spawn.musicFile,d=t.skills?.split(",").map(h=>h.trim()).filter(Boolean)||[],z=A?.skills||[],C=[...new Set([...z,...d])],ve=t.tools?.split(",").map(h=>h.trim()).filter(Boolean)||[],ss=A?.tools||[],as=[...new Set([...ss,...ve])],ui=Uo(as,e),cs=t.context?t.context.split(",").flatMap(h=>h.trim().split(/\s+/).filter(G=>G)).filter(h=>h):[];async function PA(h){let G=h,De=!1;if(h.startsWith("@")){let Ae=h.substring(1),ut=[qi(process.cwd(),".docs",Ae),qi(process.cwd(),".plans",Ae),qi(process.cwd(),"docs",Ae),qi(process.cwd(),"plans",Ae),qi(process.cwd(),Ae)];for(let mt of ut)try{await oI(mt),G=mt,De=!0;break}catch{continue}if(!De){let mt=ut.map(mi=>` - ${mi}`).join(`
|
|
31
|
+
`);throw new Error(`Context file not found: ${h}
|
|
32
32
|
Searched paths:
|
|
33
|
-
${
|
|
34
|
-
Tip: Place file in .docs/, .plans/, docs/, plans/, or project root`)}}try{if((await
|
|
33
|
+
${mt}
|
|
34
|
+
Tip: Place file in .docs/, .plans/, docs/, plans/, or project root`)}}try{if((await sI(G)).isDirectory())return await qA(G,h);let ut=await iA(G,"utf-8");return{type:"context",name:cI(G),path:G,content:ut.trim(),originalRef:h}}catch(Ae){throw new Error(`Failed to load context from ${h}: ${Ae.message}`)}}async function qA(h,G){let Ae=[".md",".txt",".json",".yaml",".yml"],ut=[];async function mt(mi,$n=0){if($n>3)return;let TA=await aI(mi,{withFileTypes:!0});for(let Ei of TA){let Li=qi(mi,Ei.name);if(!Ei.name.startsWith(".")){if(Ei.isDirectory())await mt(Li,$n+1);else if(Ei.isFile()){let XA=lI(Ei.name).toLowerCase();if(Ae.includes(XA))try{let ps=await iA(Li,"utf-8"),_c=vI(h,Li);ut.push({type:"context",name:Ei.name,path:Li,relativePath:_c,content:ps.trim(),originalRef:`${G}/${_c}`})}catch(ps){console.warn(`Warning: Could not read ${Li}: ${ps.message}`)}}}}}return await mt(h),ut.sort((mi,$n)=>(mi.relativePath||"").localeCompare($n.relativePath||"")),ut}function yA(h){if(!h||h.length===0)return"";let G=`<context>
|
|
35
35
|
`;return G+=`The following documents provide additional context for this task:
|
|
36
36
|
|
|
37
|
-
`,
|
|
38
|
-
`,G+=`Source: ${
|
|
37
|
+
`,h.forEach((De,Ae)=>{G+=`## Document ${Ae+1}: ${De.name}
|
|
38
|
+
`,G+=`Source: ${De.originalRef}
|
|
39
39
|
|
|
40
40
|
`}),G+=`</context>
|
|
41
41
|
|
|
42
|
-
`,G}let
|
|
43
|
-
`),
|
|
44
|
-
`),
|
|
45
|
-
`),
|
|
46
|
-
`)),
|
|
47
|
-
`);for(let
|
|
48
|
-
`))}
|
|
49
|
-
`)}
|
|
50
|
-
`),
|
|
42
|
+
`,G}let lt=[];if(cs&&cs.length>0)for(let h of cs)try{if(typeof h=="string"){let G=await PA(h);Array.isArray(G)?lt.push(...G):lt.push(G)}else lt.push(h)}catch(G){console.log(),m.error(G.message),console.log(),process.exit(1)}let vt=A?.name||t.agent||"Sub",N=[],DA=uI({agentType:"Sub Agent",agentRole:vt,parentSessionId:r,activePlan:a,projectDir:v});if(N.push("<subagent-context>"),N.push(DA),N.push(`</subagent-context>
|
|
43
|
+
`),N.push("<task>"),N.push(t.prompt),N.push(`</task>
|
|
44
|
+
`),A&&(N.push("<agent>"),N.push(`# Agent: ${A.name}
|
|
45
|
+
`),N.push("## Role & Responsibilities"),N.push(A.content),N.push(`</agent>
|
|
46
|
+
`)),C.length>0){N.push("<skills>"),N.push(`You have access to the following skills and capabilities:
|
|
47
|
+
`);for(let h=0;h<C.length;h++){let G=C[h],De=Bv(G);De&&(N.push(`## Skill ${h+1}: ${G}`),N.push(De),N.push(`---
|
|
48
|
+
`))}N.push(`</skills>
|
|
49
|
+
`)}lt.length>0&&N.push(yA(lt));let wA=N.join(`
|
|
50
|
+
`),Lc=t.prompt.length>150?t.prompt.substring(0,150):t.prompt;console.log(),m.info(`Spawning ${s.primary(vt)} agent with ${s.primary(e)} CLI`),m.info(`Model: ${s.primary(u)}`),r&&m.info(`Parent session: ${s.dim(r.slice(0,20)+"...")}`),a&&m.info(`Active plan: ${s.dim(a)}`),C.length>0&&m.info(`Injected skills: ${s.dim(C.join(", "))}`),lt.length>0&&m.info(`Injected context: ${s.dim(lt.map(h=>h.name).join(", "))}`),ui.length>0&&m.info(`Allowed tools: ${s.dim(ui.join(", "))}`),console.log(M.line()),console.log();let At=null;E&&(At=new Po({audioFile:f,loop:!0,volume:.3}),At.start()&&(console.log(s.dim("Playing elevator music while waiting...")),console.log()));let _n=lt.map(h=>h.path||h.name),ls=Fo("gemini-sub",process.pid);r&&v&&bo(v,r,{gkSessionId:ls,pid:process.pid,parentGkSessionId:r,agentRole:vt,prompt:t.prompt,model:u,injected:C.length>0||_n.length>0?{skills:C,context:_n}:null});let vs=AI(vt),As,Hi,us;e==="claude"?(As="claude",Hi=["-p","--model",u],ui.length>0&&Hi.push("--allowedTools",ui.join(",")),us={...process.env,CLAUDE_TYPE:"sub-agent",GK_PARENT_SESSION_ID:r||"",GK_SUB_SESSION_ID:ls,CLAUDE_AGENT_ROLE:vt,CLAUDE_AGENT_PROMPT:Lc,CLAUDE_AGENT_MODEL:u||"",CLAUDE_AGENT_SKILLS:C.join(","),CLAUDE_AGENT_CONTEXT:_n.join(","),GK_ACTIVE_PLAN:a||"",GK_SUGGESTED_PLAN:c||"",GK_PLAN_DATE_FORMAT:l||""}):(As="gemini",Hi=["-m",u],ui.length>0&&Hi.push("--allowed-tools",JSON.stringify(ui)),us={...process.env,GEMINI_TYPE:"sub-agent",GEMINI_PARENT_SESSION_ID:o||"",GK_PARENT_SESSION_ID:r||"",GK_SUB_SESSION_ID:ls,GEMINI_AGENT_ROLE:vt,GEMINI_AGENT_PROMPT:Lc,GEMINI_AGENT_MODEL:u||"",GEMINI_AGENT_SKILLS:C.join(","),GEMINI_AGENT_CONTEXT:_n.join(","),GK_ACTIVE_PLAN:a||"",GK_SUGGESTED_PLAN:c||"",GK_PLAN_DATE_FORMAT:l||""});let Qt=rI(As,Hi,{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32",env:us}),ms="",Es="";Qt.stdout.on("data",h=>{ms+=h.toString()}),Qt.stderr.on("data",h=>{Es+=h.toString()}),Qt.stdin.write(wA),Qt.stdin.end(),Qt.on("close",h=>{vs.stop(),At&&(At.stop(),console.log(s.dim("Music stopped."))),console.log(),ms&&console.log(ms),Es&&console.error(Es),h===0?m.success(`${vt} agent completed successfully`):m.error(`${vt} agent exited with code: ${h}`),console.log(),process.exit(h||0)}),Qt.on("error",h=>{vs.stop(),At&&At.stop(),console.log(),m.error(`Failed to spawn agent: ${h.message}`),console.log(),process.exit(1)}),process.on("SIGINT",()=>{vs.stop(),At&&At.stop(),Qt.kill("SIGTERM"),process.exit(1)})}function RI(){console.log(),console.log(I.default.bold(s.geminiPurple("Session Management"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk session")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("status")} Show active session (default)`),console.log(` ${s.primary("list")} List recent sessions`),console.log(` ${s.primary("info")} <id> Show session details`),console.log(` ${s.primary("agents")} [id] List agents in session`),console.log(` ${s.primary("init")} [app] Initialize new session`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log(` ${s.dim("-n, --limit <n>")} Number of results for list (default: 10)`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk session status")}`),console.log(` ${s.dim("gk session list -n 20")}`),console.log(` ${s.dim("gk session info abc123")}`),console.log(` ${s.dim("gk session agents")}`),console.log(` ${s.dim("gk session init myapp")}`),console.log()}function cA(t){t.command("session [subcommand] [id]","Session management (status, list, info, agents, init)").alias("s").option("--json","[all] Output as JSON").option("-n, --limit <n>","[list] Number of results",{default:10}).action(async(e,i,n)=>{switch(e||"status"){case"status":await zI(n);break;case"list":await gI(n);break;case"info":i||(console.log(),m.error("Session ID required"),console.log(s.dim("Usage: gk session info <id>")),console.log(),process.exit(1)),await jI(i,n);break;case"agents":await xI(i,n);break;case"init":await GI(i||"app",n);break;default:RI()}})}async function zI(t){let e=k(),i=at(),n=e.ACTIVE_GK_SESSION_ID;if(!n){t.json?console.log(JSON.stringify({active:!1,projectDir:i},null,2)):(console.log(),m.info("No active GemKit session."),console.log(s.dim(` Project: ${i}`)),console.log());return}let r=Ce(i,n);if(t.json){console.log(JSON.stringify(r||{active:!1,gkSessionId:n},null,2));return}if(!r){console.log(),m.warn(`Session ID in .env but file not found: ${n}`),console.log(s.dim(` Project: ${i}`)),console.log();return}let o=Dv(i,n),c=r.agents?.find(l=>l.agentType==="Main Agent")?.status||"active";console.log(),console.log(I.default.bold(s.geminiPurple("Active Session"))),console.log(M.line()),console.log(),console.log(` ${s.dim("GK Session ID:")} ${s.primary(r.gkSessionId)}`),console.log(` ${s.dim("Gemini Session ID:")} ${r.geminiSessionId||s.dim("N/A")}`),console.log(` ${s.dim("Project Dir:")} ${r.projectDir}`),console.log(` ${s.dim("App Name:")} ${r.appName}`),console.log(` ${s.dim("PID:")} ${r.pid}`),console.log(` ${s.dim("Status:")} ${M.statusIcon(c)} ${c}`),console.log(` ${s.dim("Started:")} ${r.initTimestamp}`),r.activePlan&&console.log(` ${s.dim("Active Plan:")} ${s.primary(r.activePlan)}`),console.log(),console.log(` ${s.dim("Agents:")} ${o.total} total (${o.mainAgents} main, ${o.subAgents} sub)`),console.log(` ${s.success(String(o.completed))} completed, ${s.error(String(o.failed))} failed, ${o.active} active`),console.log()}async function gI(t){let e=at(),i=yv(e,{limit:t.limit});if(t.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),console.log(I.default.bold(s.geminiPurple("Recent Sessions"))),console.log(s.dim(` Project: ${e}`)),console.log(),i.length===0){m.info(" No sessions found."),console.log();return}for(let n of i){let r=new Date(n.initTimestamp).toLocaleString(),a=n.agents?.find(l=>l.agentType==="Main Agent")?.status||"active",c=n.gkSessionId.length>25?n.gkSessionId.slice(0,25)+"...":n.gkSessionId;console.log(` ${M.statusIcon(a)} ${s.primary(c)} ${s.dim(r)}`),n.activePlan&&console.log(` ${s.dim("Plan:")} ${n.activePlan}`)}console.log(),console.log(s.dim(` Showing ${i.length} sessions (limit: ${t.limit})`)),console.log()}async function jI(t,e){let i=at(),n=Ce(i,t);if(n||(console.log(),m.error(`Session not found: ${t}`),console.log(s.dim(` Looked in: ~/.gemkit/projects/${i}/`)),console.log(),process.exit(1)),e.json){console.log(JSON.stringify(n,null,2));return}console.log(),console.log(I.default.bold(s.geminiPurple(`Session: ${n.gkSessionId}`))),console.log(M.line()),console.log(),console.log(JSON.stringify(n,null,2)),console.log()}async function xI(t,e){let i=at(),n=t||vi();n||(console.log(),m.error("No session ID provided and no active session found."),console.log(),process.exit(1));let r=Ce(i,n);r||(console.log(),m.error(`Session not found: ${n}`),console.log(),process.exit(1));let o=r.agents||[];if(e.json){console.log(JSON.stringify(o,null,2));return}let a=n.length>30?n.slice(0,30)+"...":n;if(console.log(),console.log(I.default.bold(s.geminiPurple("Agents in Session"))),console.log(s.dim(` ${a}`)),console.log(),o.length===0){m.info(" No agents in this session."),console.log();return}for(let c=0;c<o.length;c++){let l=o[c],v=l.agentRole||"unknown",A=l.model||"default",u=l.agentType==="Main Agent"?s.primary("MAIN"):s.dim("SUB");if(console.log(` ${M.statusIcon(l.status)} [${u}] ${s.primary(v)} ${s.dim(`(${A})`)}`),l.prompt){let p=l.prompt.length>60?l.prompt.slice(0,60)+"...":l.prompt;console.log(` ${s.dim("Prompt:")} ${p}`)}l.tokenUsage&&console.log(` ${s.dim("Tokens:")} ${l.tokenUsage.total.toLocaleString()} total`),l.geminiSessionId&&console.log(` ${s.dim("Gemini ID:")} ${l.geminiSessionId.slice(0,8)}...`)}console.log(),console.log(s.dim(` Total: ${o.length} agents`)),console.log()}async function GI(t,e){let n=k().ACTIVE_GK_SESSION_ID;if(n){let l=$v(n),v=at();if(l){let A=gc();if(Ce(v,n)&&l.pid===A){e.json?console.log(JSON.stringify({status:"existing",gkSessionId:n,pid:l.pid},null,2)):(console.log(),m.info(`GemKit session already active: ${s.primary(n.slice(0,30)+"...")}`),console.log(s.dim(` PID: ${l.pid}`)),console.log());return}}}let{session:r,gkSessionId:o,pid:a,projectDir:c}=Lv(t);bo(c,o,{gkSessionId:o,pid:a,geminiSessionId:null,parentGkSessionId:null,agentRole:"main",prompt:null,model:null}),e.json?console.log(JSON.stringify({status:"initialized",gkSessionId:o,pid:a,projectDir:c},null,2)):(console.log(),m.success(`GemKit session initialized: ${s.primary(o.slice(0,30)+"...")}`),console.log(s.dim(` PID: ${a}`)),console.log())}import{existsSync as Hn,readdirSync as SI,mkdirSync as qo,writeFileSync as Sc,statSync as YI}from"fs";import{join as Ai}from"path";function Yc(t){let e=Ri(t);if(!Hn(e))return[];let i=Xn();return SI(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name).map(r=>{let o=Ai(e,r),a=Ai(o,"plan.md"),c="";return Hn(a)&&(c=YI(a).birthtime.toISOString()),{name:r,path:o,createdAt:c,isActive:r===i}})}function lA(t,e){let i=Ri(e),n=Ai(i,t);if(Hn(i)||qo(i,{recursive:!0}),Hn(n))throw new Error(`Plan already exists: ${t}`);qo(n,{recursive:!0}),qo(Ai(n,"research"),{recursive:!0}),qo(Ai(n,"artifacts"),{recursive:!0});let r=`# ${t}
|
|
51
51
|
|
|
52
52
|
## Overview
|
|
53
53
|
|
|
@@ -61,14 +61,14 @@ Tip: Place file in .docs/, .plans/, docs/, plans/, or project root`)}}try{if((aw
|
|
|
61
61
|
|
|
62
62
|
## Notes
|
|
63
63
|
|
|
64
|
-
`;return
|
|
65
|
-
`);return
|
|
66
|
-
`);return
|
|
67
|
-
${
|
|
68
|
-
${s.dim("Session ID:")} ${s.accent(t.sessionId)}`),console.log(` ${s.dim("Start Time:")} ${t.startTime||"N/A"}`),console.log(` ${s.dim("Duration:")} ${s.accent(t.duration?.formatted||"N/A")}`),console.log(` ${s.dim("Model:")} ${s.geminiBlue(t.modelsUsed.join(", "))}`),console.log(` ${s.dim("Messages:")} ${s.accent(String(t.messageCount))}`),console.log(
|
|
69
|
-
${
|
|
70
|
-
${
|
|
71
|
-
${s.dim("Tokens/msg:")} ${s.accent(o.toLocaleString())}`),console.log(` ${s.dim("Cost/msg:")} ${s.warn(
|
|
64
|
+
`;return Sc(Ai(n,"plan.md"),r),{name:t,path:n,createdAt:new Date().toISOString(),isActive:!1}}function Wc(t,e){let i=vi();if(!i){let o=Jt(e),a=k(),c=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${a.ACTIVE_GK_SESSION_ID||""}`,`GK_PROJECT_HASH=${a.GK_PROJECT_HASH||""}`,`PROJECT_DIR=${a.PROJECT_DIR||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${a.ACTIVE_GEMINI_SESSION_ID||""}`,`GEMINI_PROJECT_HASH=${a.GEMINI_PROJECT_HASH||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t}`,`SUGGESTED_PLAN=${a.SUGGESTED_PLAN||""}`,`PLAN_DATE_FORMAT=${a.PLAN_DATE_FORMAT||""}`,""].join(`
|
|
65
|
+
`);return Sc(o,c),!0}let n=at(e);if(!Ce(n,i)){let o=Jt(e),a=k(),c=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${a.ACTIVE_GK_SESSION_ID||""}`,`GK_PROJECT_HASH=${a.GK_PROJECT_HASH||""}`,`PROJECT_DIR=${a.PROJECT_DIR||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${a.ACTIVE_GEMINI_SESSION_ID||""}`,`GEMINI_PROJECT_HASH=${a.GEMINI_PROJECT_HASH||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t}`,`SUGGESTED_PLAN=${a.SUGGESTED_PLAN||""}`,`PLAN_DATE_FORMAT=${a.PLAN_DATE_FORMAT||""}`,""].join(`
|
|
66
|
+
`);return Sc(o,c),!0}return _v(n,i,t)}function vA(t,e){let i=Ri(e),n=Ai(i,t);if(!Hn(n))return null;let r=Xn();return{name:t,path:n,createdAt:"",isActive:t===r}}function WI(){console.log(),console.log(I.default.bold(s.geminiPurple("Plan Management"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk plan")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("list")} List all plans (default)`),console.log(` ${s.primary("status")} Show active plan status`),console.log(` ${s.primary("create")} <name> Create new plan`),console.log(` ${s.primary("set")} <name> Set active plan`),console.log(` ${s.primary("info")} Get plan info from .env`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log(` ${s.dim("-a, --active")} [info] Show only ACTIVE_PLAN value`),console.log(` ${s.dim("-s, --suggested")} [info] Show only SUGGESTED_PLAN value`),console.log(` ${s.dim("-f, --format")} [info] Show only PLAN_DATE_FORMAT value`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk plan list")}`),console.log(` ${s.dim("gk plan create my-feature")}`),console.log(` ${s.dim("gk plan set my-feature")}`),console.log(` ${s.dim("gk plan info --active")}`),console.log()}function AA(t){t.command("plan [subcommand] [name]","Plan management (list, status, create, set, info)").alias("p").option("--json","[all] Output as JSON").option("-a, --active","[info] Show only ACTIVE_PLAN value").option("-s, --suggested","[info] Show only SUGGESTED_PLAN value").option("-f, --format","[info] Show only PLAN_DATE_FORMAT value").action(async(e,i,n)=>{switch(e||"list"){case"list":await MI(n);break;case"status":await CI(n);break;case"create":i||(console.log(),m.error("Plan name required"),console.log(s.dim("Usage: gk plan create <name>")),console.log(),process.exit(1)),await OI(i);break;case"set":i||(console.log(),m.error("Plan name required"),console.log(s.dim("Usage: gk plan set <name>")),console.log(),process.exit(1)),await UI(i);break;case"info":await KI(n);break;default:WI()}})}async function MI(t){let e=Yc();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(I.default.bold(s.geminiPurple("Project Plans"))),console.log(),e.length===0){m.info('No plans found. Create one with "gk plan create <name>".'),console.log();return}for(let i of e){let n=i.isActive?s.success("\u2192"):s.dim("\u25CB"),r=i.isActive?s.success(" (active)"):"";console.log(` ${n} ${s.primary(i.name)}${r}`),console.log(` ${s.dim("Created:")} ${s.dim(new Date(i.createdAt).toLocaleDateString())}`)}console.log()}async function CI(t){let e=Xn();if(!e){t.json?console.log(JSON.stringify({active:!1},null,2)):(console.log(),m.info("No active plan set."),console.log());return}let i=vA(e);if(t.json){console.log(JSON.stringify(i,null,2));return}console.log(),console.log(M.line()),console.log(I.default.bold(s.geminiPurple("Active Plan"))),console.log(M.line()),console.log(),console.log(` ${s.primary(e)}`),console.log()}async function OI(t){try{let e=lA(t);console.log(),m.success(`Plan created: ${s.primary(t)}`),m.info(`Path: ${s.dim(e.path)}`),Wc(t),m.info("Set as active plan."),console.log()}catch(e){console.log(),m.error(`Failed to create plan: ${e instanceof Error?e.message:String(e)}`),console.log()}}async function UI(t){if(!Yc().some(o=>o.name===t)){console.log(),m.error(`Plan not found: ${t}`),console.log();return}if(!Wc(t)){console.log(),m.error("Failed to update session or env file"),console.log();return}let r=vi();console.log(),r&&m.success(`Session ${r.slice(0,20)}...: activePlan set to: ${s.primary(t)}`),m.info(`Environment updated: ACTIVE_PLAN = ${t}`),console.log(),m.success(`Active plan set to: ${s.primary(t)}`),console.log()}async function KI(t){let e=k(),i={activePlan:e.ACTIVE_PLAN||null,suggestedPlan:e.SUGGESTED_PLAN||null,planDateFormat:e.PLAN_DATE_FORMAT||null,gkSessionId:e.ACTIVE_GK_SESSION_ID||null,projectDir:e.PROJECT_DIR||null};if(t.active){t.json?console.log(JSON.stringify({activePlan:i.activePlan})):console.log(i.activePlan||"");return}if(t.suggested){t.json?console.log(JSON.stringify({suggestedPlan:i.suggestedPlan})):console.log(i.suggestedPlan||"");return}if(t.format){t.json?console.log(JSON.stringify({planDateFormat:i.planDateFormat})):console.log(i.planDateFormat||"");return}if(t.json)console.log(JSON.stringify({activePlan:i.activePlan,suggestedPlan:i.suggestedPlan,planDateFormat:i.planDateFormat,context:{gkSessionId:i.gkSessionId,projectDir:i.projectDir}},null,2));else{console.log(),console.log(M.line()),console.log(I.default.bold(s.geminiPurple("Plan Information"))),console.log(M.line()),console.log(),console.log(` ${s.dim("Active Plan:")} ${i.activePlan||s.dim("(not set)")}`),console.log(` ${s.dim("Suggested Plan:")} ${i.suggestedPlan||s.dim("(not set)")}`),console.log(` ${s.dim("Date Format:")} ${i.planDateFormat||s.dim("(not set)")}`),console.log(),console.log(M.line());let n=i.gkSessionId?i.gkSessionId.substring(0,25)+"...":s.dim("(no session)");console.log(` ${s.dim("Session:")} ${n}`),console.log(` ${s.dim("Project:")} ${i.projectDir||s.dim("(unknown)")}`),console.log()}}import{existsSync as VI,readFileSync as NI,readdirSync as kI}from"fs";import{join as uA}from"path";import{homedir as FI}from"os";async function mA(){let t=ko();return t?QI(t):null}function QI(t){let e=uA(FI(),".gemini","tmp",t,"chats");if(!VI(e))return null;let i=kI(e).filter(n=>n.startsWith("session-")&&n.endsWith(".json")).sort().reverse();if(i.length===0)return null;try{let n=uA(e,i[0]);return bI(n)}catch{return null}}function bI(t){try{let e=NI(t,"utf-8"),i=JSON.parse(e);if(!i.messages||i.messages.length===0)return null;let n=new Set,r=0,o=0,a=0,c,l=0;for(let z of i.messages)z.model&&n.add(z.model),z.tokens&&(r+=z.tokens.output||0,o+=z.tokens.thoughts||0,a+=z.tokens.tool||0,c=z.tokens,l++);if(!c||l===0)return null;let v=c.total||0,A=c.cached||0,u=v-r-o;u<0&&(u=0);let p={input:u,output:r,cached:A,thoughts:o,tool:a,total:v},E=null;if(i.startTime&&i.lastUpdated)try{let z=new Date(i.startTime),C=new Date(i.lastUpdated),ve=Math.floor((C.getTime()-z.getTime())/1e3),ss=Math.floor(ve/60),as=ve%60;E={seconds:ve,formatted:`${ss}m ${as}s`}}catch{}let f=Array.from(n),d=f[0]||"unknown";return{sessionId:i.sessionId,startTime:i.startTime||null,lastUpdated:i.lastUpdated||null,duration:E,model:d,modelsUsed:f,messageCount:l,tokens:p,averages:{outputPerMessage:l>0?Math.round(r/l):0,thoughtsPerMessage:l>0?Math.round(o/l):0,toolPerMessage:l>0?Math.round(a/l):0}}}catch{return null}}var Ln={"gemini-3-pro-preview":{input:2,output:12,cached:.2,thoughts:12},"gemini-3-flash-preview":{input:.5,output:3,cached:.05,thoughts:3},"gemini-2.5-pro":{input:1.25,output:10,cached:.125,thoughts:10},"gemini-2.5-pro-preview":{input:1.25,output:10,cached:.125,thoughts:10},"gemini-2.5-flash":{input:.3,output:2.5,cached:.03,thoughts:2.5},"gemini-2.5-flash-lite":{input:.1,output:.4,cached:.01,thoughts:.4},"gemini-2.0-flash":{input:.1,output:.4,cached:.01,thoughts:.4},"gemini-2.0-flash-exp":{input:.1,output:.4,cached:.01,thoughts:.4},default:{input:.5,output:3,cached:.05,thoughts:3}};function JI(t){if(Ln[t])return Ln[t];for(let e of Object.keys(Ln))if(e.includes(t)||t.includes(e))return Ln[e];return Ln.default}function Mc(t,e="default"){let i=JI(e),n=t.input-t.cached;n<0&&(n=0);let r=n/1e6*i.input,o=t.output/1e6*i.output,a=t.cached/1e6*i.cached,c=t.thoughts/1e6*i.thoughts;return{input:r,output:o,cached:a,thoughts:c,total:r+o+a+c,model:e,pricing:i}}function Ot(t){return t>=1?`$${t.toFixed(2)}`:t>=.01?`$${t.toFixed(3)}`:t>=.001?`$${t.toFixed(4)}`:`$${t.toFixed(6)}`}function Cc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}var Kt={topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",middleLeft:"\u251C",middleRight:"\u2524"};function BI(t=75){return s.dim(`${Kt.topLeft}${Kt.horizontal.repeat(t-2)}${Kt.topRight}`)}function ZI(t=75){return s.dim(`${Kt.bottomLeft}${Kt.horizontal.repeat(t-2)}${Kt.bottomRight}`)}function PI(t,e=75){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-4-i);return`${s.dim(Kt.vertical)} ${t}${" ".repeat(n)} ${s.dim(Kt.vertical)}`}function Oc(t){return`
|
|
67
|
+
${I.default.bold(s.geminiPurple(`## ${t}`))}`}function Oe(t,e){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-i);return" ".repeat(n)+t}function Ut(t,e){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-i);return t+" ".repeat(n)}function qI(t){let e=[],i=t.length;for(let n=0;n<i;n++){let r=n/Math.max(i-1,1),o=Math.round(26+116*r),a=Math.round(115+-79*r),c=Math.round(232+-62*r);e.push(`\x1B[38;2;${o};${a};${c}m${t[n]}`)}return e.join("")+"\x1B[0m"}function yI(t){let e=Mc(t.tokens,t.model);console.log(),console.log(BI(75)),console.log(PI(`${qI("SESSION ANALYSIS")} ${s.dim("Cost:")} ${s.warn(Ot(e.total))}`,75)),console.log(ZI(75)),console.log(`
|
|
68
|
+
${s.dim("Session ID:")} ${s.accent(t.sessionId)}`),console.log(` ${s.dim("Start Time:")} ${t.startTime||"N/A"}`),console.log(` ${s.dim("Duration:")} ${s.accent(t.duration?.formatted||"N/A")}`),console.log(` ${s.dim("Model:")} ${s.geminiBlue(t.modelsUsed.join(", "))}`),console.log(` ${s.dim("Messages:")} ${s.accent(String(t.messageCount))}`),console.log(Oc("Token Breakdown")),console.log(`
|
|
69
|
+
${Ut("Category",10)} ${Oe("Count",14)} ${Oe("Formatted",10)}`),console.log(` ${s.dim("\u2500".repeat(10))} ${s.dim("\u2500".repeat(14))} ${s.dim("\u2500".repeat(10))}`);let i=["input","output","cached","thoughts","tool"];for(let o of i){let a=t.tokens[o],c=Oe(s.accent(a.toLocaleString()),14),l=Oe(s.accent(Cc(a)),10);console.log(` ${Ut(o,10)} ${c} ${l}`)}console.log(` ${s.dim("\u2500".repeat(10))} ${s.dim("\u2500".repeat(14))} ${s.dim("\u2500".repeat(10))}`);let n=Oe(s.success(t.tokens.total.toLocaleString()),14),r=Oe(s.success(Cc(t.tokens.total)),10);if(console.log(` ${Ut(I.default.bold("total"),10)} ${n} ${r}`),console.log(Oc("Estimated Cost")),console.log(`
|
|
70
|
+
${Ut("Input",12)} ${Oe(s.warn(Ot(e.input)),12)}`),console.log(` ${Ut("Output",12)} ${Oe(s.warn(Ot(e.output)),12)}`),console.log(` ${Ut("Cached",12)} ${Oe(s.warn(Ot(e.cached)),12)}`),console.log(` ${Ut("Thoughts",12)} ${Oe(s.warn(Ot(e.thoughts)),12)}`),console.log(` ${s.dim("\u2500".repeat(24))}`),console.log(` ${Ut(I.default.bold("TOTAL"),12)} ${Oe(I.default.bold(s.warn(Ot(e.total))),12)}`),t.messageCount>0){console.log(Oc("Averages"));let o=Math.round(t.tokens.total/t.messageCount),a=e.total/t.messageCount;console.log(`
|
|
71
|
+
${s.dim("Tokens/msg:")} ${s.accent(o.toLocaleString())}`),console.log(` ${s.dim("Cost/msg:")} ${s.warn(Ot(a))}`)}console.log()}function DI(t){let e=Mc(t.tokens,t.model);console.log(JSON.stringify({sessionId:t.sessionId,startTime:t.startTime,duration:t.duration,model:t.model,modelsUsed:t.modelsUsed,messageCount:t.messageCount,tokens:t.tokens,averages:t.averages,cost:{input:e.input,output:e.output,cached:e.cached,thoughts:e.thoughts,total:e.total}},null,2))}function EA(t){t.command("tokens","Show token usage for current session").alias("t").option("--json","Output as JSON").action(async e=>{let i=await mA();if(!i){e.json?console.log(JSON.stringify({found:!1},null,2)):(console.log(),m.info("No token usage found for current session."),console.log());return}if(e.json){DI(i);return}yI(i)})}import{existsSync as wI,readdirSync as TI}from"fs";function pA(t){let e=t.command("extension <subcommand>","Extension management").alias("ext");e.example("gk extension list # List installed extensions"),e.action(async i=>{let n=i||"list";n==="list"?await XI():(console.log(),m.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1))})}async function XI(){let t=Bt();if(!wI(t)){console.log(),m.info("No extensions directory found."),console.log();return}let e=TI(t,{withFileTypes:!0}).filter(i=>i.isDirectory()).map(i=>i.name);if(e.length===0){console.log(),m.info("No extensions installed."),console.log();return}console.log(),console.log(I.default.bold(s.geminiPurple("Installed Extensions"))),console.log();for(let i of e)console.log(` ${s.success("\u2713")} ${s.primary(i)}`);console.log(),console.log(s.dim(` Total: ${e.length} extensions`)),console.log()}function IA(t){t.command("catalog [subcommand]","Catalog of skills and agents").action(async i=>{let n=i||"skills";switch(n){case"skills":await HI();break;case"agents":await LI();break;default:console.log(),m.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1)}})}async function HI(){let t=Jv();if(console.log(),console.log(I.default.bold(s.geminiPurple("Available Skills"))),console.log(),t.length===0){m.info(" No skills found."),console.log();return}for(let e of t)console.log(` ${s.success("\u2713")} ${s.primary(e.name)}`);console.log(),console.log(s.dim(` Total: ${t.length} skills`)),console.log()}async function LI(){let t=Vo();if(console.log(),console.log(I.default.bold(s.geminiPurple("Available Agent Profiles"))),console.log(),t.length===0){m.info(" No agent profiles found."),console.log();return}for(let e of t)console.log(` ${s.success("\u25CF")} ${s.primary(e.name)}`),console.log(` ${s.dim(e.description)}`);console.log(),console.log(s.dim(` Total: ${t.length} profiles`)),console.log()}import{spawnSync as ye}from"child_process";import{existsSync as ce,mkdirSync as fA,writeFileSync as _I,statSync as Uc,copyFileSync as yo,readdirSync as $I}from"fs";import{join as ae,extname as Di}from"path";import{homedir as yi}from"os";var e9="clipboard-image",t9="clipboard-video",hA=[".mp4",".webm",".mov",".avi",".mkv",".gif"],i9=5;function dA(t){t.command("paste","Capture clipboard image or video for Gemini analysis").alias("p").option("--image","Capture image from clipboard (default)").option("--video","Capture video from clipboard or recent recordings").option("--format <fmt>","Image format (png, jpg)",{default:"png"}).option("--json","Output as JSON").action(async e=>{let i=e.video===!0,n=i?l9():r9(e),r=i?m9(n):c9(n);if(e.json)console.log(JSON.stringify(r,null,2));else{if(console.log(),r.success){let o=i?"Video":"Image";console.log(`${s.success("\u2713")} ${o} captured successfully`),console.log(),console.log(` ${s.dim("Path:")} ${s.primary(String(r.path))}`),console.log(` ${s.dim("Size:")} ${r.size}`),i&&r.format&&console.log(` ${s.dim("Format:")} ${r.format}`),r.sourceType&&r.sourceType!=="clipboard"&&console.log(` ${s.dim("Source:")} ${r.sourceType}`),console.log(` ${s.dim("Platform:")} ${r.platform}`)}else console.error(`${s.error("\u2717")} ${r.error}`),r.suggestion&&console.log(` ${s.dim("Hint:")} ${r.suggestion}`);console.log()}process.exit(n.success?0:1)})}function RA(){let t=ko();if(t){let i=ae(yi(),".gemini","tmp",t);return ce(i)||fA(i,{recursive:!0}),i}let e=ae(process.cwd(),".gemini","tmp","clipboard");return ce(e)||fA(e,{recursive:!0}),e}function n9(t="png"){let e=Date.now(),i=Math.random().toString(36).substring(2,8);return`${e9}-${e}-${i}.${t}`}function Do(t=".mp4"){let e=Date.now(),i=Math.random().toString(36).substring(2,8),n=hA.includes(t.toLowerCase())?t:".mp4";return`${t9}-${e}-${i}${n}`}function Kc(t){let e=Di(t).toLowerCase();return hA.includes(e)}function zA(t,e){for(let i of t)if(ce(i))try{let n=$I(i).filter(r=>Kc(r)).map(r=>{let o=ae(i,r);return{name:r,path:o,mtime:Uc(o).mtime}}).sort((r,o)=>o.mtime.getTime()-r.mtime.getTime());if(n.length>0){let r=n[0];if((Date.now()-r.mtime.getTime())/6e4<=i9){let a=Di(r.path),c=Do(a),l=ae(e,c);if(yo(r.path,l),ce(l))return{success:!0,path:l,sourcePath:r.path,sourceType:"recent-recording"}}}}catch{}return null}function r9(t){let e=t.format||"png",i=process.platform,n=RA(),r=n9(e),o=ae(n,r),a;switch(i){case"win32":a=o9(o);break;case"darwin":a=s9(o);break;case"linux":a=a9(o);break;default:a={success:!1,error:`Unsupported platform: ${i}`}}return a.platform=i,a.tempDir=n,a}function o9(t){let e=t.replace(/\\/g,"\\\\"),i=`
|
|
72
72
|
Add-Type -AssemblyName System.Windows.Forms
|
|
73
73
|
Add-Type -AssemblyName System.Drawing
|
|
74
74
|
$clipboard = [System.Windows.Forms.Clipboard]::GetImage()
|
|
@@ -78,9 +78,98 @@ if (-not (Test-Path $dir)) { New-Item -ItemType Directory -Path $dir -Force | Ou
|
|
|
78
78
|
$clipboard.Save("${e}", [System.Drawing.Imaging.ImageFormat]::Png)
|
|
79
79
|
$clipboard.Dispose()
|
|
80
80
|
Write-Output "SUCCESS"
|
|
81
|
-
`.trim(),n=
|
|
82
|
-
|
|
83
|
-
`)+a;return t.replace(n,A)}function Rc(t,e={},i=process.cwd()){let n={skill:t,success:!1,created:[],skipped:[],errors:[]},r=No(i),o=ko(i),a=W(r,`${t}.md`),c=W(o,`${t}.md`);if(!se(a))return n.errors.push(`Agent not found: ${t}`),n;if(zc(t,i)&&!e.force)return n.skipped.push(`Agent already exists in .gemini/agents: ${t} (use --force to overwrite)`),n;let l;try{l=Co(a,"utf-8")}catch(E){return n.errors.push(`Failed to read agent file: ${E instanceof Error?E.message:String(E)}`),n}let A=Lv(l)?.model,m=E9(A),I=l;if(A&&m&&A!==m&&(I=I9(l,{model:m})),e.dryRun)return n.created.push(`[DRY RUN] Would create: ${c}`),A&&m&&A!==m&&n.created.push(`[DRY RUN] Would map model: ${A} -> ${m}`),n.success=!0,n;try{se(o)||Ec(o,{recursive:!0}),Tv(c,I),n.created.push(c),A&&m&&A!==m&&n.created.push(`Model mapped: ${A} -> ${m}`),n.success=!0}catch(E){n.errors.push(`Failed to convert: ${E instanceof Error?E.message:String(E)}`)}return n}function _v(t={},e=process.cwd()){let i=Fo(e),n=[];for(let r of i){let o=Rc(r.name,t,e);n.push(o)}return n}function $v(){console.log(),console.log(p.default.bold(s.geminiPurple("Convert .claude to .gemini"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk convert")} <type> [name] [options]`),console.log(),console.log("Types:"),console.log(` ${s.primary("skill")} <name> Convert a single skill to extension`),console.log(` ${s.primary("skills")} Convert all skills to extensions`),console.log(` ${s.primary("agent")} <name> Convert a single agent`),console.log(` ${s.primary("agents")} Convert all agents`),console.log(),console.log("Options:"),console.log(` ${s.dim("--list")} List available items`),console.log(` ${s.dim("--force")} Overwrite existing items`),console.log(` ${s.dim("--dry-run")} Show what would be done without changes`),console.log(` ${s.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk convert skill --list")}`),console.log(` ${s.dim("gk convert skill my-skill")}`),console.log(` ${s.dim("gk convert skills --force")}`),console.log(` ${s.dim("gk convert agent --list")}`),console.log(` ${s.dim("gk convert agents --dry-run")}`),console.log()}function eA(t){t.command("convert [type] [name]","Convert .claude to .gemini resources").alias("cv").option("--all","[all] Convert all items").option("--list","[all] List available items").option("--force","[all] Overwrite existing items").option("--dry-run","[all] Show what would be done without making changes").option("--json","[all] Output as JSON").action(async(e,i,n)=>{if(!e){$v();return}if(e==="skill"||e==="skills"){if(n.list){await p9(n);return}if(n.all||e==="skills"){await f9(n);return}i||(console.log(),u.error("Skill name required"),console.log(s.dim("Usage: gk convert skill <name>")),console.log(s.dim(" gk convert skill --list (to see available skills)")),console.log(s.dim(" gk convert skills (to convert all)")),console.log(),process.exit(1)),await h9(i,n);return}if(e==="agent"||e==="agents"){if(n.list){await z9(n);return}if(n.all||e==="agents"){await d9(n);return}i||(console.log(),u.error("Agent name required"),console.log(s.dim("Usage: gk convert agent <name>")),console.log(s.dim(" gk convert agent --list (to see available agents)")),console.log(s.dim(" gk convert agents (to convert all)")),console.log(),process.exit(1)),await R9(i,n);return}$v()})}async function p9(t){let e=Vo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple("Available Claude Skills"))),console.log(s.dim(` Source: ${Uo()}`)),console.log(),e.length===0){u.info("No skills found in .claude/skills/"),console.log();return}for(let i of e){let n=pc(i.name),r=n?s.success("\u2713"):s.dim("\u25CB"),o=n?s.dim(" (converted)"):"";if(console.log(` ${r} ${s.primary(i.name)}${o}`),i.description){let a=i.description.length>70?i.description.slice(0,70)+"...":i.description;console.log(` ${s.dim(a)}`)}}console.log(),console.log(s.dim(` Total: ${e.length} skills`)),console.log()}async function h9(t,e){let i=hc(t,{force:e.force,dryRun:e.dryRun});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),i.errors.length>0){u.error(`Failed to convert skill: ${t}`);for(let n of i.errors)console.log(` ${s.error("\u2717")} ${n}`);console.log(),process.exit(1)}if(i.skipped.length>0){u.warn(`Skipped skill: ${t}`);for(let n of i.skipped)console.log(` ${s.dim("\u25CB")} ${n}`);console.log();return}if(e.dryRun){u.info(`[DRY RUN] Would convert skill: ${t}`);for(let n of i.created)console.log(` ${s.dim("\u2192")} ${n}`);console.log();return}u.success(`Converted skill: ${s.primary(t)}`),console.log(),console.log(` ${s.dim("Created files:")}`);for(let n of i.created.slice(0,5)){let r=n.replace(process.cwd(),".");console.log(` ${s.success("+")} ${r}`)}i.created.length>5&&console.log(` ${s.dim(`... and ${i.created.length-5} more`)}`),console.log(),console.log(s.dim(` Extension created at: ${Ko()}/${t}`)),console.log()}async function f9(t){if(Vo().length===0){t.json?console.log(JSON.stringify({results:[],summary:{total:0,success:0,skipped:0,failed:0}},null,2)):(console.log(),u.info("No skills found in .claude/skills/"),console.log());return}let i=Hv({force:t.force,dryRun:t.dryRun}),n=fc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(p.default.bold(s.geminiPurple("[DRY RUN] Skill Conversion Preview"))):console.log(p.default.bold(s.geminiPurple("Skill Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${s.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${s.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${s.dim("\u25CB")} ${r.skill} ${s.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?s.dim("\u2192"):s.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${s.dim("Would convert:")} ${n.success} skills`),console.log(` ${s.dim("Would skip:")} ${n.skipped} skills`),console.log(` ${s.dim("Would fail:")} ${n.failed} skills`)):(console.log(` ${s.success("Converted:")} ${n.success}`),console.log(` ${s.dim("Skipped:")} ${n.skipped}`),console.log(` ${s.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(u.info("Use --force to overwrite existing extensions"),console.log())}async function z9(t){let e=Fo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(s.geminiPurple("Available Claude Agents"))),console.log(s.dim(` Source: ${No()}`)),console.log(),e.length===0){u.info("No agents found in .claude/agents/"),console.log();return}for(let i of e){let n=zc(i.name),r=n?s.success("\u2713"):s.dim("\u25CB"),o=n?s.dim(" (converted)"):"";if(console.log(` ${r} ${s.primary(i.name)}${o}`),i.model&&console.log(` ${s.dim("Model:")} ${i.model}`),i.description){let a=i.description.length>60?i.description.slice(0,60)+"...":i.description;console.log(` ${s.dim(a)}`)}}console.log(),console.log(s.dim(` Total: ${e.length} agents`)),console.log()}async function R9(t,e){let i=Rc(t,{force:e.force,dryRun:e.dryRun});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),i.errors.length>0){u.error(`Failed to convert agent: ${t}`);for(let n of i.errors)console.log(` ${s.error("\u2717")} ${n}`);console.log(),process.exit(1)}if(i.skipped.length>0){u.warn(`Skipped agent: ${t}`);for(let n of i.skipped)console.log(` ${s.dim("\u25CB")} ${n}`);console.log();return}if(e.dryRun){u.info(`[DRY RUN] Would convert agent: ${t}`);for(let n of i.created)console.log(` ${s.dim("\u2192")} ${n}`);console.log();return}u.success(`Converted agent: ${s.primary(t)}`),console.log();for(let n of i.created){let r=n.replace(process.cwd(),".");console.log(` ${s.success("+")} ${r}`)}console.log(),console.log(s.dim(` Agent created at: ${ko()}/${t}.md`)),console.log()}async function d9(t){if(Fo().length===0){t.json?console.log(JSON.stringify({results:[],summary:{total:0,success:0,skipped:0,failed:0}},null,2)):(console.log(),u.info("No agents found in .claude/agents/"),console.log());return}let i=_v({force:t.force,dryRun:t.dryRun}),n=fc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(p.default.bold(s.geminiPurple("[DRY RUN] Agent Conversion Preview"))):console.log(p.default.bold(s.geminiPurple("Agent Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${s.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${s.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${s.dim("\u25CB")} ${r.skill} ${s.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?s.dim("\u2192"):s.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${s.dim("Would convert:")} ${n.success} agents`),console.log(` ${s.dim("Would skip:")} ${n.skipped} agents`),console.log(` ${s.dim("Would fail:")} ${n.failed} agents`)):(console.log(` ${s.success("Converted:")} ${n.success}`),console.log(` ${s.dim("Skipped:")} ${n.skipped}`),console.log(` ${s.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(u.info("Use --force to overwrite existing agents"),console.log())}function Wt(){return{orchestrator:null,agents:new Map,sessionId:null,projectDir:null,activePlan:null,appName:null,currentNotification:null,inbox:[],documents:[],isActive:!1}}var j9=[[/research|search|analyze/i,"\u{1F50D}"],[/code|implement|execute|develop/i,"\u{1F4BB}"],[/plan|architect/i,"\u{1F4CB}"],[/debug|fix|troubleshoot/i,"\u{1F41B}"],[/test|qa|quality/i,"\u{1F9EA}"],[/design|ui|ux/i,"\u{1F3A8}"],[/review|audit|check/i,"\u2705"],[/doc|write|content/i,"\u{1F4DD}"]];function Qo(t,e=!1){if(e)return"\u{1F451}";for(let[i,n]of j9)if(i.test(t))return n;return"\u{1F916}"}function dc(t){return t.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function gc(t){let e=t.toLowerCase();return e.includes("main")?"orchestrator":e.includes("research")||e.includes("scout")?"researcher":e.includes("code")||e.includes("executor")||e.includes("debug")?"coder":e.includes("plan")?"planner":e.includes("test")?"tester":e.includes("design")||e.includes("ui")||e.includes("ux")||e.includes("artist")?"designer":e.includes("doc")||e.includes("writer")?"writer":e.includes("manager")||e.includes("git")?"manager":"other"}function jc(t,e){return t.agentType==="Main Agent"||t.parentGkSessionId===null||t.gkSessionId===e.gkSessionId}function g9(t,e){return t==="active"?"working":"idle"}function x9(t){if(t.status==="completed")return 100;if(t.status==="failed"||!t.startTime)return 0;let e=new Date(t.startTime).getTime(),n=Date.now()-e;return Math.min(100,Math.round(n/12e4*100))}function G9(t){return t.status==="completed"?"Task complete!":t.status==="failed"?"Task failed":t.injected?.skills?.length?`Working on ${t.injected.skills[0]}...`:null}function tA(t,e){let i=jc(t,e),n=!!(t.injected?.skills?.length&&t.status==="active"),r=t.agentRole||"unknown",o={id:t.gkSessionId,agentType:i?"orchestrator":"sub-agent",role:r,characterType:gc(r),icon:Qo(r,i),state:g9(t.status,n),activeSkill:t.injected?.skills?.[0]||null,progress:x9(t),speechBubble:G9(t),hasFireEffect:n,gkSessionId:t.gkSessionId,parentSessionId:t.parentGkSessionId};if(i){let a=e.agents.filter(c=>!jc(c,e));return{...o,agentType:"orchestrator",delegatedTo:a.filter(c=>c.status==="active").map(c=>c.gkSessionId),totalSubAgents:a.length,completedSubAgents:a.filter(c=>c.status==="completed").length}}return o}function iA(t){let e=t.endTime&&t.startTime?new Date(t.endTime).getTime()-new Date(t.startTime).getTime():0;return{id:`inbox-${t.gkSessionId}`,agentId:t.gkSessionId,agentRole:t.agentRole||"unknown",agentIcon:Qo(t.agentRole||""),timestamp:t.endTime?new Date(t.endTime).getTime():Date.now(),status:"unread",title:`${dc(t.agentRole||"Agent")} completed`,preview:t.prompt?t.prompt.slice(0,100):"Task completed",fullContent:null,tokenUsage:t.tokenUsage?{input:t.tokenUsage.input,output:t.tokenUsage.output}:null,duration:e,skillsUsed:t.injected?.skills||[]}}function Bi(t){let e=Wt();if(!t)return e;e.sessionId=t.gkSessionId,e.projectDir=t.projectDir,e.activePlan=t.activePlan,e.appName=t.appName||null,e.isActive=t.agents.some(i=>i.status==="active");for(let i of t.agents){let n=tA(i,t);n.agentType==="orchestrator"?e.orchestrator=n:e.agents.set(n.id,n),i.status==="completed"&&(e.inbox.find(o=>o.agentId===i.gkSessionId)||e.inbox.push(iA(i)))}return e.inbox.sort((i,n)=>n.timestamp-i.timestamp),e}import{existsSync as Zi,readdirSync as Jo,statSync as xc}from"fs";import{join as nt,basename as S9,extname as nA,relative as Y9}from"path";import{createHash as W9}from"crypto";function M9(t,e){let i={plan:"\u{1F4CB}",phase:"\u{1F4D1}",research:"\u{1F50D}",artifact:"\u{1F4E6}",report:"\u{1F4CA}",other:"\u{1F4C4}"};return t==="artifact"?{sql:"\u{1F5C4}\uFE0F",json:"\u{1F4E6}",png:"\u{1F5BC}\uFE0F",jpg:"\u{1F5BC}\uFE0F",ts:"\u{1F4BB}",js:"\u{1F4BB}"}[e]||i.artifact:i[t]}function rA(t){let e=t.match(/^phase-(\d+)/);return e?parseInt(e[1],10):null}function C9(t,e){if(e==="phase"){let i=rA(t),n=t.replace(/^phase-\d+-?/,"").replace(/-/g," ");return i!==null?`Phase ${i}: ${n}`:t}return t.replace(/-/g," ").replace(/\b\w/g,i=>i.toUpperCase())}function bi(t,e,i){let n=xc(t),r=S9(t,nA(t)),o=nA(t).slice(1);return{id:W9("md5").update(t).digest("hex").slice(0,8),name:r,displayName:C9(r,e),type:e,icon:M9(e,o),path:t,relativePath:Y9(i,t),modifiedAt:n.mtimeMs,createdAt:n.birthtimeMs,size:n.size,extension:o,phaseNumber:rA(r)}}function Gc(t){if(!Zi(t))return[];let e=[],i=nt(t,"plan.md");Zi(i)&&e.push(bi(i,"plan",t));let n=Jo(t);for(let c of n){let l=nt(t,c),v=xc(l);if(c.startsWith("phase-"))if(v.isDirectory()){let A=nt(l,"phase.md");Zi(A)&&e.push(bi(A,"phase",t))}else c.endsWith(".md")&&e.push(bi(l,"phase",t))}let r=nt(t,"research");if(Zi(r)){let c=Jo(r).filter(l=>l.endsWith(".md"));for(let l of c)e.push(bi(nt(r,l),"research",t))}let o=nt(t,"artifacts");if(Zi(o)){let c=Jo(o);for(let l of c){let v=nt(o,l);xc(v).isFile()&&e.push(bi(v,"artifact",t))}}let a=nt(t,"reports");if(Zi(a)){let c=Jo(a).filter(l=>l.endsWith(".md"));for(let l of c)e.push(bi(nt(a,l),"report",t))}return e.sort((c,l)=>l.modifiedAt-c.modifiedAt),e}var O9=1e3,Mt=class{state;stateListeners=new Set;eventListeners=new Set;eventHistory=[];constructor(e){this.state=e}onStateChange(e){return this.stateListeners.add(e),e(this.state),()=>this.stateListeners.delete(e)}onEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}emit(e){this.eventHistory.push(e),this.eventHistory.length>O9&&this.eventHistory.shift();for(let i of this.eventListeners)try{i(e)}catch(n){console.error("Event listener error:",n)}}setState(e){this.state=e;for(let i of this.stateListeners)try{i(this.state)}catch(n){console.error("State listener error:",n)}}getState(){return this.state}getHistory(){return[...this.eventHistory]}replay(e){return this.eventHistory.filter(i=>i.timestamp>=e)}dispose(){this.stateListeners.clear(),this.eventListeners.clear(),this.eventHistory=[]}};import{existsSync as U9,readFileSync as K9,statSync as oA}from"fs";var V9=200,Ct=class{pollInterval=null;previousSession=null;previousMtime=0;options;sessionPath=null;constructor(e){this.options=e}start(){let e=N(),i=e.PROJECT_DIR,n=e.ACTIVE_GK_SESSION_ID;if(!i||!n)return this.options.onError(new Error("No active session found")),!1;if(this.sessionPath=kt(i,n),!U9(this.sessionPath))return this.options.onError(new Error(`Session file not found: ${this.sessionPath}`)),!1;try{let r=oA(this.sessionPath);this.previousMtime=r.mtimeMs}catch{}return this.loadSession(),this.pollInterval=setInterval(()=>{this.checkForChanges()},V9),!0}stop(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}checkForChanges(){if(this.sessionPath)try{let i=oA(this.sessionPath).mtimeMs;i>this.previousMtime&&(this.previousMtime=i,this.loadSession())}catch{}}loadSession(){if(this.sessionPath)try{let e=K9(this.sessionPath,"utf-8"),i=JSON.parse(e),n=this.previousSession?this.diffSessions(this.previousSession,i):[];this.previousSession=i,this.options.onSessionChange(i);for(let r of n)this.options.onEvent(r)}catch(e){this.options.onError(e)}}diffSessions(e,i){let n=[],r=Date.now(),o=new Map(e.agents.map(l=>[l.gkSessionId,l]));for(let l of i.agents){let v=o.get(l.gkSessionId);if(!v)n.push(this.createEvent("received_work",l,r)),l.injected?.skills?.length&&n.push(this.createEvent("skill_activated",l,r,l.injected.skills[0]));else{v.status==="active"&&l.status==="completed"&&(n.push(this.createEvent("task_complete",l,r)),n.push(this.createEvent("delivering",l,r)));let A=v.injected?.skills||[],I=(l.injected?.skills||[]).filter(E=>!A.includes(E));for(let E of I)n.push(this.createEvent("skill_activated",l,r,E))}}let a=i.agents.every(l=>l.status==="completed"||l.status==="failed"),c=e.agents.some(l=>l.status==="active");return a&&c&&i.agents.length>0&&n.push({type:"session_complete",agentId:i.gkSessionId,targetAgentId:null,skill:null,message:"All tasks completed",timestamp:r}),n}createEvent(e,i,n,r){let o={agent_idle:"Waiting for work",agent_working:"Working...",skill_activated:`Activated skill: ${r||"unknown"}`,handoff_start:"Passing work...",handoff_complete:"Handoff complete!",received_work:"Received work",delivering:"Delivering results...",task_complete:"Task complete!",session_complete:"All tasks completed"};return{type:e,agentId:i.gkSessionId,targetAgentId:i.parentGkSessionId,skill:r||i.injected?.skills?.[0]||null,message:o[e],timestamp:n,characterType:gc(i.agentRole||"coder")}}};import{exec as J9}from"child_process";import{join as B9}from"path";import{createServer as N9}from"http";import{WebSocketServer as k9,WebSocket as sA}from"ws";import{exec as F9}from"child_process";import{existsSync as cA}from"fs";import{resolve as Q9}from"path";function aA(){return`<!DOCTYPE html>
|
|
81
|
+
`.trim(),n=ye("powershell",["-NoProfile","-NonInteractive","-Command",i],{encoding:"utf-8",windowsHide:!0});return n.stderr?.includes("NO_IMAGE")?{success:!1,error:"No image in clipboard. Copy an image first."}:n.status!==0?{success:!1,error:`Failed: ${n.stderr||n.stdout}`.trim()}:ce(t)?{success:!0,path:t}:{success:!1,error:"File not created"}}function s9(t){return ye("which",["pngpaste"],{encoding:"utf-8"}).status===0&&ye("pngpaste",[t],{encoding:"utf-8"}).status===0&&ce(t)?{success:!0,path:t}:{success:!1,error:"No image or pngpaste failed",suggestion:"brew install pngpaste"}}function a9(t){if(ye("which",["xclip"],{encoding:"utf-8"}).status!==0)return{success:!1,error:"xclip not installed",suggestion:"apt install xclip"};let i=ye("xclip",["-selection","clipboard","-t","TARGETS","-o"],{encoding:"utf-8"});if(!i.stdout?.includes("image/png")&&!i.stdout?.includes("image/jpeg"))return{success:!1,error:"No image in clipboard"};let n=i.stdout.includes("image/png")?"image/png":"image/jpeg",r=ye("xclip",["-selection","clipboard","-t",n,"-o"],{encoding:"buffer"});return r.status!==0||!r.stdout?.length?{success:!1,error:"Failed to read clipboard"}:(_I(t,r.stdout),ce(t)?{success:!0,path:t}:{success:!1,error:"Save failed"})}function c9(t){if(t.success&&t.path){let e=Uc(t.path);return{success:!0,message:"Image captured",path:t.path,size:`${(e.size/1024).toFixed(1)} KB`,platform:t.platform}}return{success:!1,error:t.error,suggestion:t.suggestion,platform:t.platform}}function l9(){let t=process.platform,e=RA(),i;switch(t){case"win32":i=v9(e);break;case"darwin":i=A9(e);break;case"linux":i=u9(e);break;default:i={success:!1,error:`Unsupported platform: ${t}`,suggestion:"This tool supports Windows, macOS, and Linux only"}}return i.platform=t,i.tempDir=e,i}function v9(t){let e=`
|
|
82
|
+
Add-Type -AssemblyName System.Windows.Forms
|
|
83
|
+
|
|
84
|
+
# Try to get file drop list from clipboard (copied files)
|
|
85
|
+
$files = [System.Windows.Forms.Clipboard]::GetFileDropList()
|
|
86
|
+
|
|
87
|
+
if ($files -and $files.Count -gt 0) {
|
|
88
|
+
# Return first video file found in clipboard
|
|
89
|
+
foreach ($file in $files) {
|
|
90
|
+
$ext = [System.IO.Path]::GetExtension($file).ToLower()
|
|
91
|
+
if ($ext -in @('.mp4', '.webm', '.mov', '.avi', '.mkv', '.gif')) {
|
|
92
|
+
Write-Output "FILE:$file"
|
|
93
|
+
exit 0
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
# Fallback: Check for recent Snipping Tool videos
|
|
99
|
+
$snipFolder = [System.IO.Path]::Combine($env:USERPROFILE, 'Videos', 'Screen Recordings')
|
|
100
|
+
if (Test-Path $snipFolder) {
|
|
101
|
+
$recentVideo = Get-ChildItem -Path $snipFolder -Filter "*.mp4" |
|
|
102
|
+
Sort-Object LastWriteTime -Descending |
|
|
103
|
+
Select-Object -First 1
|
|
104
|
+
|
|
105
|
+
if ($recentVideo) {
|
|
106
|
+
$age = (Get-Date) - $recentVideo.LastWriteTime
|
|
107
|
+
if ($age.TotalMinutes -le 5) {
|
|
108
|
+
Write-Output "SNIP:$($recentVideo.FullName)"
|
|
109
|
+
exit 0
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
# Also check Screenshots folder (some versions save there)
|
|
115
|
+
$screenshotFolder = [System.IO.Path]::Combine($env:USERPROFILE, 'Pictures', 'Screenshots')
|
|
116
|
+
if (Test-Path $screenshotFolder) {
|
|
117
|
+
$recentVideo = Get-ChildItem -Path $screenshotFolder -Filter "*.mp4" |
|
|
118
|
+
Sort-Object LastWriteTime -Descending |
|
|
119
|
+
Select-Object -First 1
|
|
120
|
+
|
|
121
|
+
if ($recentVideo) {
|
|
122
|
+
$age = (Get-Date) - $recentVideo.LastWriteTime
|
|
123
|
+
if ($age.TotalMinutes -le 5) {
|
|
124
|
+
Write-Output "SNIP:$($recentVideo.FullName)"
|
|
125
|
+
exit 0
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
# Also check Videos folder root
|
|
131
|
+
$videosFolder = [System.IO.Path]::Combine($env:USERPROFILE, 'Videos')
|
|
132
|
+
if (Test-Path $videosFolder) {
|
|
133
|
+
$recentVideo = Get-ChildItem -Path $videosFolder -Filter "*.mp4" -File |
|
|
134
|
+
Sort-Object LastWriteTime -Descending |
|
|
135
|
+
Select-Object -First 1
|
|
136
|
+
|
|
137
|
+
if ($recentVideo) {
|
|
138
|
+
$age = (Get-Date) - $recentVideo.LastWriteTime
|
|
139
|
+
if ($age.TotalMinutes -le 5) {
|
|
140
|
+
Write-Output "SNIP:$($recentVideo.FullName)"
|
|
141
|
+
exit 0
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
Write-Error "NO_VIDEO_FOUND"
|
|
147
|
+
exit 1
|
|
148
|
+
`.trim();try{let i=ye("powershell",["-NoProfile","-NonInteractive","-Command",e],{encoding:"utf-8",windowsHide:!0,timeout:1e4});if(i.error)return{success:!1,error:`PowerShell error: ${i.error.message}`};if(i.stderr?.includes("NO_VIDEO_FOUND"))return{success:!1,error:"No video found in clipboard or recent recordings.",suggestion:"Copy a video file or record with Snipping Tool (Win+Shift+R) first."};if(i.status!==0)return{success:!1,error:`Failed to capture: ${(i.stderr||i.stdout||"Unknown PowerShell error").trim()}`};let n=i.stdout.trim(),r=null,o="clipboard";if(n.startsWith("FILE:")?(r=n.substring(5),o="clipboard"):n.startsWith("SNIP:")&&(r=n.substring(5),o="snipping-tool"),!r||!ce(r))return{success:!1,error:"Video file not found or inaccessible"};let a=Di(r),c=Do(a),l=ae(t,c);return yo(r,l),ce(l)?{success:!0,path:l,sourcePath:r,sourceType:o}:{success:!1,error:"Failed to copy video file"}}catch(i){return{success:!1,error:`Windows video capture error: ${i instanceof Error?i.message:String(i)}`}}}function A9(t){let e=`
|
|
149
|
+
use scripting additions
|
|
150
|
+
|
|
151
|
+
set thePath to ""
|
|
152
|
+
|
|
153
|
+
try
|
|
154
|
+
set theFiles to the clipboard as \xABclass furl\xBB
|
|
155
|
+
set thePath to POSIX path of theFiles
|
|
156
|
+
on error
|
|
157
|
+
try
|
|
158
|
+
set theFiles to the clipboard as list
|
|
159
|
+
if (count of theFiles) > 0 then
|
|
160
|
+
set thePath to POSIX path of (item 1 of theFiles)
|
|
161
|
+
end if
|
|
162
|
+
end try
|
|
163
|
+
end try
|
|
164
|
+
|
|
165
|
+
if thePath is not "" then
|
|
166
|
+
return thePath
|
|
167
|
+
else
|
|
168
|
+
return "NO_FILE"
|
|
169
|
+
end if
|
|
170
|
+
`.trim();try{let i=ye("osascript",["-e",e],{encoding:"utf-8",timeout:5e3});if(i.stdout&&i.stdout.trim()!=="NO_FILE"){let r=i.stdout.trim();if(!Kc(r))return{success:!1,error:"Clipboard does not contain a video file",suggestion:"Copy a video file (.mp4, .mov, .webm) to clipboard first"};if(!ce(r))return{success:!1,error:"Video file not found"};let o=Di(r),a=Do(o),c=ae(t,a);if(yo(r,c),ce(c))return{success:!0,path:c,sourcePath:r,sourceType:"clipboard"}}let n=zA([ae(yi(),"Movies"),ae(yi(),"Desktop")],t);return n||{success:!1,error:"No video in clipboard or recent recordings",suggestion:"Copy a video file or use Cmd+Shift+5 to record screen"}}catch(i){return{success:!1,error:`macOS video capture error: ${i instanceof Error?i.message:String(i)}`}}}function u9(t){try{if(ye("which",["xclip"],{encoding:"utf-8"}).status!==0)return{success:!1,error:"xclip is not installed",suggestion:"Install with: sudo apt install xclip"};let i=ye("xclip",["-selection","clipboard","-t","text/uri-list","-o"],{encoding:"utf-8",timeout:5e3});if(i.status===0&&i.stdout){let r=i.stdout.trim(),o=r;if(r.startsWith("file://")&&(o=decodeURIComponent(r.replace("file://",""))),Kc(o)&&ce(o)){let a=Di(o),c=Do(a),l=ae(t,c);if(yo(o,l),ce(l))return{success:!0,path:l,sourcePath:o,sourceType:"clipboard"}}}let n=zA([ae(yi(),"Videos"),ae(yi(),"Screencasts"),ae(yi(),"Desktop")],t);return n||{success:!1,error:"No video in clipboard or recent recordings",suggestion:"Copy a video file or use a screen recorder first"}}catch(e){return{success:!1,error:`Linux video capture error: ${e instanceof Error?e.message:String(e)}`}}}function m9(t){if(t.success&&t.path){let i=(Uc(t.path).size/(1024*1024)).toFixed(2),n=Di(t.path).toLowerCase();return{success:!0,message:`Video captured from ${t.sourceType}`,path:t.path,sourcePath:t.sourcePath,sourceType:t.sourceType,size:`${i} MB`,format:n.substring(1).toUpperCase(),platform:t.platform}}return{success:!1,error:t.error,suggestion:t.suggestion||"Record a video with Snipping Tool (Win+Shift+R) or copy a video file to clipboard",platform:t.platform}}var gA={"claude-3-opus":"gemini-2.5-pro","claude-3-sonnet":"gemini-2.5-flash","claude-3-haiku":"gemini-2.5-flash","claude-3.5-sonnet":"gemini-2.5-pro","claude-3.5-haiku":"gemini-2.5-flash","gemini-2.5-pro":"gemini-2.5-pro","gemini-2.5-flash":"gemini-2.5-flash","gemini-3-flash-preview":"gemini-3-flash-preview"};import{existsSync as le,readFileSync as wo,readdirSync as To,mkdirSync as kc,writeFileSync as jA,copyFileSync as Vc,statSync as xA}from"fs";import{join as W}from"path";var E9=".claude/skills",p9=".gemini/extensions",I9=".claude/agents",f9=".gemini/agents";function Fc(t){let e=t.match(/^---\r?\n([\s\S]*?)\r?\n---/);if(!e)return null;let i={name:"",description:""},n=e[1].split(/\r?\n/);for(let r of n){let o=r.indexOf(":");if(o===-1)continue;let a=r.slice(0,o).trim(),c=r.slice(o+1).trim();(c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'"))&&(c=c.slice(1,-1)),i[a]=c}return i}function Xo(t=process.cwd()){return W(t,E9)}function Ho(t=process.cwd()){return W(t,p9)}function Lo(t=process.cwd()){let e=Xo(t);if(!le(e))return[];let i=[];try{let n=To(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name);for(let r of n){let o=W(e,r),a=W(o,"SKILL.md"),c=W(o,"references"),l=le(a),v=le(c)&&xA(c).isDirectory(),A;if(l)try{let u=wo(a,"utf-8");A=Fc(u)?.description}catch{}i.push({name:r,path:o,hasSkillMd:l,hasReferences:v,description:A})}}catch{}return i.sort((n,r)=>n.name.localeCompare(r.name))}function Qc(t,e=process.cwd()){let i=W(Ho(e),t);return le(i)}function h9(t,e){let i=["SKILL.md"];return e&&i.push("references/*.md"),{name:t.name||"",version:"1.0.0",description:t.description||"",license:"MIT",contextFileName:i}}function Nc(t,e,i){le(e)||(kc(e,{recursive:!0}),i.push(e));let n=To(t,{withFileTypes:!0});for(let r of n){let o=W(t,r.name),a=W(e,r.name);r.isDirectory()?Nc(o,a,i):(Vc(o,a),i.push(a))}}function bc(t,e={},i=process.cwd()){let n={skill:t,success:!1,created:[],skipped:[],errors:[]},r=Xo(i),o=Ho(i),a=W(r,t),c=W(o,t);if(!le(a))return n.errors.push(`Skill not found: ${t}`),n;let l=W(a,"SKILL.md");if(!le(l))return n.errors.push(`SKILL.md not found in ${t}`),n;if(Qc(t,i)&&!e.force)return n.skipped.push(`Extension already exists: ${t} (use --force to overwrite)`),n;let v=null;try{let E=wo(l,"utf-8");v=Fc(E)}catch(E){return n.errors.push(`Failed to read SKILL.md: ${E instanceof Error?E.message:String(E)}`),n}(!v||!v.name)&&(v={name:t,description:""});let A=W(a,"references"),u=le(A)&&xA(A).isDirectory(),p=h9(v,u);if(e.dryRun)return n.created.push(`[DRY RUN] Would create: ${c}`),n.created.push(`[DRY RUN] Would create: ${W(c,"gemini-extension.json")}`),n.created.push("[DRY RUN] Would copy: SKILL.md"),u&&n.created.push("[DRY RUN] Would copy: references/"),n.success=!0,n;try{le(c)||(kc(c,{recursive:!0}),n.created.push(c));let E=W(c,"gemini-extension.json");jA(E,JSON.stringify(p,null,2)+`
|
|
171
|
+
`),n.created.push(E);let f=W(c,"SKILL.md");if(Vc(l,f),n.created.push(f),u){let z=W(c,"references");Nc(A,z,n.created)}let d=To(a,{withFileTypes:!0});for(let z of d){if(z.name==="SKILL.md"||z.name==="references")continue;let C=W(a,z.name),ve=W(c,z.name);z.isDirectory()?Nc(C,ve,n.created):(Vc(C,ve),n.created.push(ve))}n.success=!0}catch(E){n.errors.push(`Failed to convert: ${E instanceof Error?E.message:String(E)}`)}return n}function GA(t={},e=process.cwd()){let i=Lo(e),n=[];for(let r of i){let o=bc(r.name,t,e);n.push(o)}return n}function Jc(t){return{total:t.length,success:t.filter(e=>e.success&&e.errors.length===0&&e.skipped.length===0).length,skipped:t.filter(e=>e.skipped.length>0).length,failed:t.filter(e=>e.errors.length>0).length}}function _o(t=process.cwd()){return W(t,I9)}function $o(t=process.cwd()){return W(t,f9)}function SA(t){let e=Fc(t);return e?{name:e.name||"",description:e.description||"",model:e.model,skills:e.skills}:null}function es(t=process.cwd()){let e=_o(t);if(!le(e))return[];let i=[];try{let n=To(e,{withFileTypes:!0}).filter(r=>r.isFile()&&r.name.endsWith(".md")).map(r=>r.name);for(let r of n){let o=W(e,r),a=r.replace(/\.md$/,""),c,l,v;try{let A=wo(o,"utf-8"),u=SA(A);u&&(c=u.description,l=u.model,v=u.skills)}catch{}i.push({name:a,path:o,description:c,model:l,skills:v})}}catch{}return i.sort((n,r)=>n.name.localeCompare(r.name))}function Bc(t,e=process.cwd()){let i=W($o(e),`${t}.md`);return le(i)}function d9(t){if(t)return gA[t]||t}function R9(t,e){let i=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---)/);if(!i)return t;let[n,r,o,a]=i,c=o.split(/\r?\n/),l=[],v=new Set;for(let u of c){let p=u.indexOf(":");if(p===-1){l.push(u);continue}let E=u.slice(0,p).trim();E in e?(v.add(E),e[E]!==void 0&&l.push(`${E}: ${e[E]}`)):l.push(u)}for(let[u,p]of Object.entries(e))!v.has(u)&&p!==void 0&&l.push(`${u}: ${p}`);let A=r+l.join(`
|
|
172
|
+
`)+a;return t.replace(n,A)}function Zc(t,e={},i=process.cwd()){let n={skill:t,success:!1,created:[],skipped:[],errors:[]},r=_o(i),o=$o(i),a=W(r,`${t}.md`),c=W(o,`${t}.md`);if(!le(a))return n.errors.push(`Agent not found: ${t}`),n;if(Bc(t,i)&&!e.force)return n.skipped.push(`Agent already exists in .gemini/agents: ${t} (use --force to overwrite)`),n;let l;try{l=wo(a,"utf-8")}catch(E){return n.errors.push(`Failed to read agent file: ${E instanceof Error?E.message:String(E)}`),n}let A=SA(l)?.model,u=d9(A),p=l;if(A&&u&&A!==u&&(p=R9(l,{model:u})),e.dryRun)return n.created.push(`[DRY RUN] Would create: ${c}`),A&&u&&A!==u&&n.created.push(`[DRY RUN] Would map model: ${A} -> ${u}`),n.success=!0,n;try{le(o)||kc(o,{recursive:!0}),jA(c,p),n.created.push(c),A&&u&&A!==u&&n.created.push(`Model mapped: ${A} -> ${u}`),n.success=!0}catch(E){n.errors.push(`Failed to convert: ${E instanceof Error?E.message:String(E)}`)}return n}function YA(t={},e=process.cwd()){let i=es(e),n=[];for(let r of i){let o=Zc(r.name,t,e);n.push(o)}return n}function WA(){console.log(),console.log(I.default.bold(s.geminiPurple("Convert .claude to .gemini"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk convert")} <type> [name] [options]`),console.log(),console.log("Types:"),console.log(` ${s.primary("skill")} <name> Convert a single skill to extension`),console.log(` ${s.primary("skills")} Convert all skills to extensions`),console.log(` ${s.primary("agent")} <name> Convert a single agent`),console.log(` ${s.primary("agents")} Convert all agents`),console.log(),console.log("Options:"),console.log(` ${s.dim("--list")} List available items`),console.log(` ${s.dim("--force")} Overwrite existing items`),console.log(` ${s.dim("--dry-run")} Show what would be done without changes`),console.log(` ${s.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk convert skill --list")}`),console.log(` ${s.dim("gk convert skill my-skill")}`),console.log(` ${s.dim("gk convert skills --force")}`),console.log(` ${s.dim("gk convert agent --list")}`),console.log(` ${s.dim("gk convert agents --dry-run")}`),console.log()}function MA(t){t.command("convert [type] [name]","Convert .claude to .gemini resources").alias("cv").option("--all","[all] Convert all items").option("--list","[all] List available items").option("--force","[all] Overwrite existing items").option("--dry-run","[all] Show what would be done without making changes").option("--json","[all] Output as JSON").action(async(e,i,n)=>{if(!e){WA();return}if(e==="skill"||e==="skills"){if(n.list){await z9(n);return}if(n.all||e==="skills"){await j9(n);return}i||(console.log(),m.error("Skill name required"),console.log(s.dim("Usage: gk convert skill <name>")),console.log(s.dim(" gk convert skill --list (to see available skills)")),console.log(s.dim(" gk convert skills (to convert all)")),console.log(),process.exit(1)),await g9(i,n);return}if(e==="agent"||e==="agents"){if(n.list){await x9(n);return}if(n.all||e==="agents"){await S9(n);return}i||(console.log(),m.error("Agent name required"),console.log(s.dim("Usage: gk convert agent <name>")),console.log(s.dim(" gk convert agent --list (to see available agents)")),console.log(s.dim(" gk convert agents (to convert all)")),console.log(),process.exit(1)),await G9(i,n);return}WA()})}async function z9(t){let e=Lo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(I.default.bold(s.geminiPurple("Available Claude Skills"))),console.log(s.dim(` Source: ${Xo()}`)),console.log(),e.length===0){m.info("No skills found in .claude/skills/"),console.log();return}for(let i of e){let n=Qc(i.name),r=n?s.success("\u2713"):s.dim("\u25CB"),o=n?s.dim(" (converted)"):"";if(console.log(` ${r} ${s.primary(i.name)}${o}`),i.description){let a=i.description.length>70?i.description.slice(0,70)+"...":i.description;console.log(` ${s.dim(a)}`)}}console.log(),console.log(s.dim(` Total: ${e.length} skills`)),console.log()}async function g9(t,e){let i=bc(t,{force:e.force,dryRun:e.dryRun});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),i.errors.length>0){m.error(`Failed to convert skill: ${t}`);for(let n of i.errors)console.log(` ${s.error("\u2717")} ${n}`);console.log(),process.exit(1)}if(i.skipped.length>0){m.warn(`Skipped skill: ${t}`);for(let n of i.skipped)console.log(` ${s.dim("\u25CB")} ${n}`);console.log();return}if(e.dryRun){m.info(`[DRY RUN] Would convert skill: ${t}`);for(let n of i.created)console.log(` ${s.dim("\u2192")} ${n}`);console.log();return}m.success(`Converted skill: ${s.primary(t)}`),console.log(),console.log(` ${s.dim("Created files:")}`);for(let n of i.created.slice(0,5)){let r=n.replace(process.cwd(),".");console.log(` ${s.success("+")} ${r}`)}i.created.length>5&&console.log(` ${s.dim(`... and ${i.created.length-5} more`)}`),console.log(),console.log(s.dim(` Extension created at: ${Ho()}/${t}`)),console.log()}async function j9(t){if(Lo().length===0){t.json?console.log(JSON.stringify({results:[],summary:{total:0,success:0,skipped:0,failed:0}},null,2)):(console.log(),m.info("No skills found in .claude/skills/"),console.log());return}let i=GA({force:t.force,dryRun:t.dryRun}),n=Jc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(I.default.bold(s.geminiPurple("[DRY RUN] Skill Conversion Preview"))):console.log(I.default.bold(s.geminiPurple("Skill Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${s.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${s.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${s.dim("\u25CB")} ${r.skill} ${s.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?s.dim("\u2192"):s.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${s.dim("Would convert:")} ${n.success} skills`),console.log(` ${s.dim("Would skip:")} ${n.skipped} skills`),console.log(` ${s.dim("Would fail:")} ${n.failed} skills`)):(console.log(` ${s.success("Converted:")} ${n.success}`),console.log(` ${s.dim("Skipped:")} ${n.skipped}`),console.log(` ${s.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(m.info("Use --force to overwrite existing extensions"),console.log())}async function x9(t){let e=es();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(I.default.bold(s.geminiPurple("Available Claude Agents"))),console.log(s.dim(` Source: ${_o()}`)),console.log(),e.length===0){m.info("No agents found in .claude/agents/"),console.log();return}for(let i of e){let n=Bc(i.name),r=n?s.success("\u2713"):s.dim("\u25CB"),o=n?s.dim(" (converted)"):"";if(console.log(` ${r} ${s.primary(i.name)}${o}`),i.model&&console.log(` ${s.dim("Model:")} ${i.model}`),i.description){let a=i.description.length>60?i.description.slice(0,60)+"...":i.description;console.log(` ${s.dim(a)}`)}}console.log(),console.log(s.dim(` Total: ${e.length} agents`)),console.log()}async function G9(t,e){let i=Zc(t,{force:e.force,dryRun:e.dryRun});if(e.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),i.errors.length>0){m.error(`Failed to convert agent: ${t}`);for(let n of i.errors)console.log(` ${s.error("\u2717")} ${n}`);console.log(),process.exit(1)}if(i.skipped.length>0){m.warn(`Skipped agent: ${t}`);for(let n of i.skipped)console.log(` ${s.dim("\u25CB")} ${n}`);console.log();return}if(e.dryRun){m.info(`[DRY RUN] Would convert agent: ${t}`);for(let n of i.created)console.log(` ${s.dim("\u2192")} ${n}`);console.log();return}m.success(`Converted agent: ${s.primary(t)}`),console.log();for(let n of i.created){let r=n.replace(process.cwd(),".");console.log(` ${s.success("+")} ${r}`)}console.log(),console.log(s.dim(` Agent created at: ${$o()}/${t}.md`)),console.log()}async function S9(t){if(es().length===0){t.json?console.log(JSON.stringify({results:[],summary:{total:0,success:0,skipped:0,failed:0}},null,2)):(console.log(),m.info("No agents found in .claude/agents/"),console.log());return}let i=YA({force:t.force,dryRun:t.dryRun}),n=Jc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(I.default.bold(s.geminiPurple("[DRY RUN] Agent Conversion Preview"))):console.log(I.default.bold(s.geminiPurple("Agent Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${s.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${s.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${s.dim("\u25CB")} ${r.skill} ${s.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?s.dim("\u2192"):s.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${s.dim("Would convert:")} ${n.success} agents`),console.log(` ${s.dim("Would skip:")} ${n.skipped} agents`),console.log(` ${s.dim("Would fail:")} ${n.failed} agents`)):(console.log(` ${s.success("Converted:")} ${n.success}`),console.log(` ${s.dim("Skipped:")} ${n.skipped}`),console.log(` ${s.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(m.info("Use --force to overwrite existing agents"),console.log())}function Vt(){return{orchestrator:null,agents:new Map,sessionId:null,projectDir:null,activePlan:null,appName:null,currentNotification:null,inbox:[],documents:[],isActive:!1}}var Y9=[[/research|search|analyze/i,"\u{1F50D}"],[/code|implement|execute|develop/i,"\u{1F4BB}"],[/plan|architect/i,"\u{1F4CB}"],[/debug|fix|troubleshoot/i,"\u{1F41B}"],[/test|qa|quality/i,"\u{1F9EA}"],[/design|ui|ux/i,"\u{1F3A8}"],[/review|audit|check/i,"\u2705"],[/doc|write|content/i,"\u{1F4DD}"]];function ts(t,e=!1){if(e)return"\u{1F451}";for(let[i,n]of Y9)if(i.test(t))return n;return"\u{1F916}"}function Pc(t){return t.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function yc(t){let e=t.toLowerCase();return e.includes("main")?"orchestrator":e.includes("research")||e.includes("scout")?"researcher":e.includes("code")||e.includes("executor")||e.includes("debug")?"coder":e.includes("plan")?"planner":e.includes("test")?"tester":e.includes("design")||e.includes("ui")||e.includes("ux")||e.includes("artist")?"designer":e.includes("doc")||e.includes("writer")?"writer":e.includes("manager")||e.includes("git")?"manager":"other"}function qc(t,e){return t.agentType==="Main Agent"||t.parentGkSessionId===null||t.gkSessionId===e.gkSessionId}function W9(t,e){return t==="active"?"working":"idle"}function M9(t){if(t.status==="completed")return 100;if(t.status==="failed"||!t.startTime)return 0;let e=new Date(t.startTime).getTime(),n=Date.now()-e;return Math.min(100,Math.round(n/12e4*100))}function C9(t){return t.status==="completed"?"Task complete!":t.status==="failed"?"Task failed":t.injected?.skills?.length?`Working on ${t.injected.skills[0]}...`:null}function CA(t,e){let i=qc(t,e),n=!!(t.injected?.skills?.length&&t.status==="active"),r=t.agentRole||"unknown",o={id:t.gkSessionId,agentType:i?"orchestrator":"sub-agent",role:r,characterType:yc(r),icon:ts(r,i),state:W9(t.status,n),activeSkill:t.injected?.skills?.[0]||null,progress:M9(t),speechBubble:C9(t),hasFireEffect:n,gkSessionId:t.gkSessionId,parentSessionId:t.parentGkSessionId};if(i){let a=e.agents.filter(c=>!qc(c,e));return{...o,agentType:"orchestrator",delegatedTo:a.filter(c=>c.status==="active").map(c=>c.gkSessionId),totalSubAgents:a.length,completedSubAgents:a.filter(c=>c.status==="completed").length}}return o}function OA(t){let e=t.endTime&&t.startTime?new Date(t.endTime).getTime()-new Date(t.startTime).getTime():0;return{id:`inbox-${t.gkSessionId}`,agentId:t.gkSessionId,agentRole:t.agentRole||"unknown",agentIcon:ts(t.agentRole||""),timestamp:t.endTime?new Date(t.endTime).getTime():Date.now(),status:"unread",title:`${Pc(t.agentRole||"Agent")} completed`,preview:t.prompt?t.prompt.slice(0,100):"Task completed",fullContent:null,tokenUsage:t.tokenUsage?{input:t.tokenUsage.input,output:t.tokenUsage.output}:null,duration:e,skillsUsed:t.injected?.skills||[]}}function wi(t){let e=Vt();if(!t)return e;e.sessionId=t.gkSessionId,e.projectDir=t.projectDir,e.activePlan=t.activePlan,e.appName=t.appName||null,e.isActive=t.agents.some(i=>i.status==="active");for(let i of t.agents){let n=CA(i,t);n.agentType==="orchestrator"?e.orchestrator=n:e.agents.set(n.id,n),i.status==="completed"&&(e.inbox.find(o=>o.agentId===i.gkSessionId)||e.inbox.push(OA(i)))}return e.inbox.sort((i,n)=>n.timestamp-i.timestamp),e}import{existsSync as Ti,readdirSync as is,statSync as Dc}from"fs";import{join as ct,basename as O9,extname as UA,relative as U9}from"path";import{createHash as K9}from"crypto";function V9(t,e){let i={plan:"\u{1F4CB}",phase:"\u{1F4D1}",research:"\u{1F50D}",artifact:"\u{1F4E6}",report:"\u{1F4CA}",other:"\u{1F4C4}"};return t==="artifact"?{sql:"\u{1F5C4}\uFE0F",json:"\u{1F4E6}",png:"\u{1F5BC}\uFE0F",jpg:"\u{1F5BC}\uFE0F",ts:"\u{1F4BB}",js:"\u{1F4BB}"}[e]||i.artifact:i[t]}function KA(t){let e=t.match(/^phase-(\d+)/);return e?parseInt(e[1],10):null}function N9(t,e){if(e==="phase"){let i=KA(t),n=t.replace(/^phase-\d+-?/,"").replace(/-/g," ");return i!==null?`Phase ${i}: ${n}`:t}return t.replace(/-/g," ").replace(/\b\w/g,i=>i.toUpperCase())}function Xi(t,e,i){let n=Dc(t),r=O9(t,UA(t)),o=UA(t).slice(1);return{id:K9("md5").update(t).digest("hex").slice(0,8),name:r,displayName:N9(r,e),type:e,icon:V9(e,o),path:t,relativePath:U9(i,t),modifiedAt:n.mtimeMs,createdAt:n.birthtimeMs,size:n.size,extension:o,phaseNumber:KA(r)}}function wc(t){if(!Ti(t))return[];let e=[],i=ct(t,"plan.md");Ti(i)&&e.push(Xi(i,"plan",t));let n=is(t);for(let c of n){let l=ct(t,c),v=Dc(l);if(c.startsWith("phase-"))if(v.isDirectory()){let A=ct(l,"phase.md");Ti(A)&&e.push(Xi(A,"phase",t))}else c.endsWith(".md")&&e.push(Xi(l,"phase",t))}let r=ct(t,"research");if(Ti(r)){let c=is(r).filter(l=>l.endsWith(".md"));for(let l of c)e.push(Xi(ct(r,l),"research",t))}let o=ct(t,"artifacts");if(Ti(o)){let c=is(o);for(let l of c){let v=ct(o,l);Dc(v).isFile()&&e.push(Xi(v,"artifact",t))}}let a=ct(t,"reports");if(Ti(a)){let c=is(a).filter(l=>l.endsWith(".md"));for(let l of c)e.push(Xi(ct(a,l),"report",t))}return e.sort((c,l)=>l.modifiedAt-c.modifiedAt),e}var k9=1e3,Nt=class{state;stateListeners=new Set;eventListeners=new Set;eventHistory=[];constructor(e){this.state=e}onStateChange(e){return this.stateListeners.add(e),e(this.state),()=>this.stateListeners.delete(e)}onEvent(e){return this.eventListeners.add(e),()=>this.eventListeners.delete(e)}emit(e){this.eventHistory.push(e),this.eventHistory.length>k9&&this.eventHistory.shift();for(let i of this.eventListeners)try{i(e)}catch(n){console.error("Event listener error:",n)}}setState(e){this.state=e;for(let i of this.stateListeners)try{i(this.state)}catch(n){console.error("State listener error:",n)}}getState(){return this.state}getHistory(){return[...this.eventHistory]}replay(e){return this.eventHistory.filter(i=>i.timestamp>=e)}dispose(){this.stateListeners.clear(),this.eventListeners.clear(),this.eventHistory=[]}};import{existsSync as F9,readFileSync as Q9,statSync as VA}from"fs";var b9=200,kt=class{pollInterval=null;previousSession=null;previousMtime=0;options;sessionPath=null;constructor(e){this.options=e}start(){let e=k(),i=e.PROJECT_DIR,n=e.ACTIVE_GK_SESSION_ID;if(!i||!n)return this.options.onError(new Error("No active session found")),!1;if(this.sessionPath=Zt(i,n),!F9(this.sessionPath))return this.options.onError(new Error(`Session file not found: ${this.sessionPath}`)),!1;try{let r=VA(this.sessionPath);this.previousMtime=r.mtimeMs}catch{}return this.loadSession(),this.pollInterval=setInterval(()=>{this.checkForChanges()},b9),!0}stop(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}checkForChanges(){if(this.sessionPath)try{let i=VA(this.sessionPath).mtimeMs;i>this.previousMtime&&(this.previousMtime=i,this.loadSession())}catch{}}loadSession(){if(this.sessionPath)try{let e=Q9(this.sessionPath,"utf-8"),i=JSON.parse(e),n=this.previousSession?this.diffSessions(this.previousSession,i):[];this.previousSession=i,this.options.onSessionChange(i);for(let r of n)this.options.onEvent(r)}catch(e){this.options.onError(e)}}diffSessions(e,i){let n=[],r=Date.now(),o=new Map(e.agents.map(l=>[l.gkSessionId,l]));for(let l of i.agents){let v=o.get(l.gkSessionId);if(!v)n.push(this.createEvent("received_work",l,r)),l.injected?.skills?.length&&n.push(this.createEvent("skill_activated",l,r,l.injected.skills[0]));else{v.status==="active"&&l.status==="completed"&&(n.push(this.createEvent("task_complete",l,r)),n.push(this.createEvent("delivering",l,r)));let A=v.injected?.skills||[],p=(l.injected?.skills||[]).filter(E=>!A.includes(E));for(let E of p)n.push(this.createEvent("skill_activated",l,r,E))}}let a=i.agents.every(l=>l.status==="completed"||l.status==="failed"),c=e.agents.some(l=>l.status==="active");return a&&c&&i.agents.length>0&&n.push({type:"session_complete",agentId:i.gkSessionId,targetAgentId:null,skill:null,message:"All tasks completed",timestamp:r}),n}createEvent(e,i,n,r){let o={agent_idle:"Waiting for work",agent_working:"Working...",skill_activated:`Activated skill: ${r||"unknown"}`,handoff_start:"Passing work...",handoff_complete:"Handoff complete!",received_work:"Received work",delivering:"Delivering results...",task_complete:"Task complete!",session_complete:"All tasks completed"};return{type:e,agentId:i.gkSessionId,targetAgentId:i.parentGkSessionId,skill:r||i.injected?.skills?.[0]||null,message:o[e],timestamp:n,characterType:yc(i.agentRole||"coder")}}};import{exec as q9}from"child_process";import{join as y9}from"path";import{createServer as J9}from"http";import{WebSocketServer as B9,WebSocket as kA}from"ws";import{exec as Z9}from"child_process";import{existsSync as FA}from"fs";import{resolve as P9}from"path";function NA(){return`<!DOCTYPE html>
|
|
84
173
|
<html lang="en">
|
|
85
174
|
<head>
|
|
86
175
|
<meta charset="UTF-8">
|
|
@@ -3486,4 +3575,4 @@ hookStopAgentAnimation();
|
|
|
3486
3575
|
|
|
3487
3576
|
</script>
|
|
3488
3577
|
</body>
|
|
3489
|
-
</html>`}var Bo=class{server=null;wss=null;options;clients=new Set;constructor(e){this.options=e}async start(){return new Promise((e,i)=>{let n=this.options.port,r=0,o=10,a=()=>{this.server=N9((c,l)=>this.handleRequest(c,l)),this.server.on("error",c=>{c.code==="EADDRINUSE"&&r<o?(r++,n++,a()):i(c)}),this.server.listen(n,this.options.host||"localhost",()=>{this.wss=new k9({server:this.server}),this.setupWebSocket(),this.options.emitter.onStateChange(c=>{this.broadcastState(c)}),this.options.emitter.onEvent(c=>{this.broadcastEvent(c)}),e(n)})};a()})}stop(){if(this.wss){for(let e of this.clients)e.close();this.wss.close(),this.wss=null}this.server&&(this.server.close(),this.server=null),this.clients.clear()}handleRequest(e,i){let n=e.url||"/";if(n==="/api/state"){i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify(this.serializeState(this.options.emitter.getState())));return}if(n==="/api/history"){i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify(this.options.emitter.getHistory()));return}if(n.startsWith("/api/open-doc")){let a=new URL(n,`http://${e.headers.host}`).searchParams.get("path");if(!a){i.writeHead(400,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:"No path provided"}));return}let c=a;if(cA(c)||(c=Q9(process.cwd(),a)),!cA(c)){i.writeHead(404,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:`File not found: ${a}`}));return}let l=process.env.EDITOR||process.env.VISUAL,A=this.options.emitter.getState().appName?.toLowerCase()||"",I=["code","cursor","windsurf","zed","vim","nvim","nano","subl","atom","idea","webstorm","notepad++","antigravity"].some(h=>A.includes(h)),E;l?(E=`"${l}" "${c}"`,console.log(`[Agent Office] Using IDE from EDITOR env: ${l}`)):A&&I?(E=`${A} "${c}"`,console.log(`[Agent Office] Using IDE from session: ${A}`)):(E=`code "${c}"`,console.log("[Agent Office] No IDE detected, defaulting to VS Code")),F9(E,h=>{h?(i.writeHead(500,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:h.message}))):(i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!0})))});return}let r=n.split("?")[0].split("#")[0];if(r==="/"||r==="/index.html"){i.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),i.end(aA());return}i.writeHead(404),i.end("Not Found")}setupWebSocket(){this.wss&&this.wss.on("connection",e=>{this.clients.add(e);let i=this.options.emitter.getState();try{e.send(JSON.stringify({type:"state",data:this.serializeState(i)}))}catch{}e.on("message",n=>{try{let r=JSON.parse(n.toString());if(r.type==="ping"&&e.send(JSON.stringify({type:"pong"})),r.type==="replay"){let o=this.options.emitter.replay(r.fromTimestamp);e.send(JSON.stringify({type:"replay",data:o}))}}catch{}}),e.on("close",()=>{this.clients.delete(e)})})}broadcastState(e){let i=JSON.stringify({type:"state",data:this.serializeState(e)});for(let n of this.clients)if(n.readyState===sA.OPEN)try{n.send(i)}catch{}}broadcastEvent(e){let i=JSON.stringify({type:"event",data:e});for(let n of this.clients)if(n.readyState===sA.OPEN)try{n.send(i)}catch{}}serializeState(e){return{...e,agents:Object.fromEntries(e.agents)}}};var Zo=class{server=null;emitter;watcher;options;constructor(e={}){this.options={port:3847,host:"localhost",autoOpen:!0,...e},this.emitter=new Mt(Wt()),this.watcher=new Ct({onSessionChange:i=>{let n=Bi(i);if(n.activePlan)try{let r=Ei(),o=B9(r,n.activePlan);n.documents=Gc(o)}catch{}this.emitter.setState(n)},onEvent:i=>{this.emitter.emit(i)},onError:i=>{this.options.onError&&this.options.onError(i)}})}async start(){if(!this.watcher.start())throw new Error("No active session found");this.server=new Bo({port:this.options.port,host:this.options.host,emitter:this.emitter});let i=await this.server.start();return this.options.autoOpen&&this.openBrowser(`http://${this.options.host}:${i}`),this.options.onReady&&this.options.onReady(i),i}stop(){this.server&&(this.server.stop(),this.server=null),this.watcher.stop(),this.emitter.dispose()}openBrowser(e){let i=process.platform==="win32"?`start ${e}`:process.platform==="darwin"?`open ${e}`:`xdg-open ${e}`;J9(i,n=>{n&&console.log(`Open ${e} in your browser`)})}};async function Sc(t={}){let e=new Zo(t);return await e.start(),e}function Yc(){console.log(),console.log(p.default.bold(s.geminiPurple("Agent Office"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("start")} Start the visualization`),console.log(` ${s.primary("status")} Show current office state`),console.log(` ${s.primary("watch")} Watch office state changes`),console.log(),console.log("Options:"),console.log(` ${s.dim("-p, --port <n>")} [start] Web server port (default: 3847)`),console.log(` ${s.dim("--no-open")} [start] Don't auto-open browser`),console.log(` ${s.dim("--json")} [status/watch] Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk office start")}`),console.log(` ${s.dim("gk office start --port 4000")}`),console.log(` ${s.dim("gk office status --json")}`),console.log(` ${s.dim("gk office watch")}`),console.log()}function Z9(){console.log(),console.log(p.default.bold(s.geminiPurple("gk office start"))),console.log(s.dim("Start the Agent Office web dashboard")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office start")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("-p, --port <n>")} Web server port (default: 3847)`),console.log(` ${s.dim("--no-open")} Don't auto-open browser`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk office start")}`),console.log(` ${s.dim("gk office start --port 4000")}`),console.log(` ${s.dim("gk office start --port 4000 --no-open")}`),console.log()}function b9(){console.log(),console.log(p.default.bold(s.geminiPurple("gk office status"))),console.log(s.dim("Show current Agent Office state")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office status")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log()}function P9(){console.log(),console.log(p.default.bold(s.geminiPurple("gk office watch"))),console.log(s.dim("Watch Agent Office state changes in real-time")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office watch")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log()}async function q9(t){console.log(),u.info("Starting Agent Office..."),console.log();try{let e=await Sc({port:t.port||3847,autoOpen:t.open!==!1,onReady:i=>{u.success(`Dashboard running at ${s.primary(`http://localhost:${i}`)}`),console.log(s.dim(" Press Ctrl+C to stop")),console.log()},onError:i=>{u.error(`Error: ${i.message}`)}});process.on("SIGINT",()=>{e.stop(),console.log(),u.info("Agent Office stopped."),console.log(),process.exit(0)})}catch(e){e instanceof Error&&(e.message==="No active session found"?(console.log(),u.warn("No active session found."),console.log(s.dim(" Start a GemKit session first with: gk agent")),console.log()):u.error(`Failed to start: ${e.message}`)),process.exit(1)}}function D9(t){let e=new Mt(Wt()),i=new Ct({onSessionChange:r=>{let o=Bi(r);if(t.json)console.log(JSON.stringify({...o,agents:Object.fromEntries(o.agents)},null,2));else{if(console.log(),console.log(p.default.bold(s.geminiPurple("Agent Office Status"))),console.log(M.line()),console.log(),console.log(` ${s.dim("Active Plan:")} ${o.activePlan?s.primary(o.activePlan):s.dim("(none)")}`),console.log(` ${s.dim("Agents:")} ${o.agents.size}`),console.log(` ${s.dim("Inbox Items:")} ${o.inbox.length}`),console.log(` ${s.dim("Documents:")} ${o.documents.length}`),o.agents.size>0){console.log(),console.log(s.dim(" Agents:"));for(let[a,c]of o.agents){let l=c.state==="working"?s.warn:c.state==="idle"?s.success:s.dim;console.log(` ${c.icon} ${s.primary(c.role)} ${l(`[${c.state}]`)}`)}}console.log()}i.stop(),e.dispose()},onEvent:()=>{},onError:r=>{console.log(),u.error(`Error: ${r.message}`),console.log(),process.exit(1)}});i.start()||(console.log(),u.warn("No active session found."),console.log(s.dim(" Start a GemKit session first with: gk agent")),console.log(),process.exit(1))}function y9(t){console.log(),u.info("Watching Agent Office state..."),console.log(s.dim(" Press Ctrl+C to stop")),console.log();let e=new Mt(Wt()),i=new Ct({onSessionChange:r=>{let o=Bi(r);if(t.json)console.log(JSON.stringify({timestamp:new Date().toISOString(),...o,agents:Object.fromEntries(o.agents)}));else{let a=new Date().toLocaleTimeString();console.log(`${s.dim(a)} ${s.info("State:")} ${o.agents.size} agents, ${o.inbox.length} inbox items`)}},onEvent:r=>{if(t.json)console.log(JSON.stringify({type:"event",event:r}));else{let o=new Date().toLocaleTimeString();console.log(`${s.dim(o)} ${s.secondary("Event:")} ${r.type}`)}},onError:r=>{u.error(`Error: ${r.message}`)}});i.start()||(console.log(),u.warn("No active session found."),console.log(s.dim(" Start a GemKit session first with: gk agent")),console.log(),process.exit(1)),process.on("SIGINT",()=>{i.stop(),e.dispose(),console.log(),u.info("Stopped watching."),console.log(),process.exit(0)})}function lA(t){t.command("office [subcommand]","Agent Office visualization (start, status, watch)").option("-p, --port <port>","[start] Web server port",{default:3847}).option("--no-open","[start] Don't auto-open browser").option("--json","[status/watch] Output as JSON").action(async(e,i)=>{if(i.port&&(i.port=parseInt(String(i.port),10)),i.help||i.h)switch(e){case"start":Z9();return;case"status":b9();return;case"watch":P9();return;default:Yc();return}switch(e){case"start":await q9(i);break;case"status":D9(i);break;case"watch":y9(i);break;case void 0:case"help":Yc();break;default:console.log(),u.error(`Unknown subcommand: ${e}`),Yc(),process.exit(1)}})}function vA(t){_3(t),$3(t),ev(t),iv(t),nv(t),rv(t),ov(t),Nv(t),kv(t),Jv(t),bv(t),Pv(t),qv(t),yv(t),eA(t),lA(t)}var ai=Nc("gk");ai.version("0.1.0");ai.help();ai.option("--verbose","Enable verbose output");ai.option("--json","Output as JSON");var AA=ai.parse(process.argv,{run:!1});AA.options.verbose&&po({level:"debug",verbose:!0});AA.options.json&&po({json:!0});vA(ai);ai.parse();
|
|
3578
|
+
</html>`}var ns=class{server=null;wss=null;options;clients=new Set;constructor(e){this.options=e}async start(){return new Promise((e,i)=>{let n=this.options.port,r=0,o=10,a=()=>{this.server=J9((c,l)=>this.handleRequest(c,l)),this.server.on("error",c=>{c.code==="EADDRINUSE"&&r<o?(r++,n++,a()):i(c)}),this.server.listen(n,this.options.host||"localhost",()=>{this.wss=new B9({server:this.server}),this.setupWebSocket(),this.options.emitter.onStateChange(c=>{this.broadcastState(c)}),this.options.emitter.onEvent(c=>{this.broadcastEvent(c)}),e(n)})};a()})}stop(){if(this.wss){for(let e of this.clients)e.close();this.wss.close(),this.wss=null}this.server&&(this.server.close(),this.server=null),this.clients.clear()}handleRequest(e,i){let n=e.url||"/";if(n==="/api/state"){i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify(this.serializeState(this.options.emitter.getState())));return}if(n==="/api/history"){i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify(this.options.emitter.getHistory()));return}if(n.startsWith("/api/open-doc")){let a=new URL(n,`http://${e.headers.host}`).searchParams.get("path");if(!a){i.writeHead(400,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:"No path provided"}));return}let c=a;if(FA(c)||(c=P9(process.cwd(),a)),!FA(c)){i.writeHead(404,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:`File not found: ${a}`}));return}let l=process.env.EDITOR||process.env.VISUAL,A=this.options.emitter.getState().appName?.toLowerCase()||"",p=["code","cursor","windsurf","zed","vim","nvim","nano","subl","atom","idea","webstorm","notepad++","antigravity"].some(f=>A.includes(f)),E;l?(E=`"${l}" "${c}"`,console.log(`[Agent Office] Using IDE from EDITOR env: ${l}`)):A&&p?(E=`${A} "${c}"`,console.log(`[Agent Office] Using IDE from session: ${A}`)):(E=`code "${c}"`,console.log("[Agent Office] No IDE detected, defaulting to VS Code")),Z9(E,f=>{f?(i.writeHead(500,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:f.message}))):(i.writeHead(200,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!0})))});return}let r=n.split("?")[0].split("#")[0];if(r==="/"||r==="/index.html"){i.writeHead(200,{"Content-Type":"text/html; charset=utf-8"}),i.end(NA());return}i.writeHead(404),i.end("Not Found")}setupWebSocket(){this.wss&&this.wss.on("connection",e=>{this.clients.add(e);let i=this.options.emitter.getState();try{e.send(JSON.stringify({type:"state",data:this.serializeState(i)}))}catch{}e.on("message",n=>{try{let r=JSON.parse(n.toString());if(r.type==="ping"&&e.send(JSON.stringify({type:"pong"})),r.type==="replay"){let o=this.options.emitter.replay(r.fromTimestamp);e.send(JSON.stringify({type:"replay",data:o}))}}catch{}}),e.on("close",()=>{this.clients.delete(e)})})}broadcastState(e){let i=JSON.stringify({type:"state",data:this.serializeState(e)});for(let n of this.clients)if(n.readyState===kA.OPEN)try{n.send(i)}catch{}}broadcastEvent(e){let i=JSON.stringify({type:"event",data:e});for(let n of this.clients)if(n.readyState===kA.OPEN)try{n.send(i)}catch{}}serializeState(e){return{...e,agents:Object.fromEntries(e.agents)}}};var rs=class{server=null;emitter;watcher;options;constructor(e={}){this.options={port:3847,host:"localhost",autoOpen:!0,...e},this.emitter=new Nt(Vt()),this.watcher=new kt({onSessionChange:i=>{let n=wi(i);if(n.activePlan)try{let r=Ri(),o=y9(r,n.activePlan);n.documents=wc(o)}catch{}this.emitter.setState(n)},onEvent:i=>{this.emitter.emit(i)},onError:i=>{this.options.onError&&this.options.onError(i)}})}async start(){if(!this.watcher.start())throw new Error("No active session found");this.server=new ns({port:this.options.port,host:this.options.host,emitter:this.emitter});let i=await this.server.start();return this.options.autoOpen&&this.openBrowser(`http://${this.options.host}:${i}`),this.options.onReady&&this.options.onReady(i),i}stop(){this.server&&(this.server.stop(),this.server=null),this.watcher.stop(),this.emitter.dispose()}openBrowser(e){let i=process.platform==="win32"?`start ${e}`:process.platform==="darwin"?`open ${e}`:`xdg-open ${e}`;q9(i,n=>{n&&console.log(`Open ${e} in your browser`)})}};async function Tc(t={}){let e=new rs(t);return await e.start(),e}function Xc(){console.log(),console.log(I.default.bold(s.geminiPurple("Agent Office"))),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${s.primary("start")} Start the visualization`),console.log(` ${s.primary("status")} Show current office state`),console.log(` ${s.primary("watch")} Watch office state changes`),console.log(),console.log("Options:"),console.log(` ${s.dim("-p, --port <n>")} [start] Web server port (default: 3847)`),console.log(` ${s.dim("--no-open")} [start] Don't auto-open browser`),console.log(` ${s.dim("--json")} [status/watch] Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk office start")}`),console.log(` ${s.dim("gk office start --port 4000")}`),console.log(` ${s.dim("gk office status --json")}`),console.log(` ${s.dim("gk office watch")}`),console.log()}function D9(){console.log(),console.log(I.default.bold(s.geminiPurple("gk office start"))),console.log(s.dim("Start the Agent Office web dashboard")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office start")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("-p, --port <n>")} Web server port (default: 3847)`),console.log(` ${s.dim("--no-open")} Don't auto-open browser`),console.log(),console.log("Examples:"),console.log(` ${s.dim("gk office start")}`),console.log(` ${s.dim("gk office start --port 4000")}`),console.log(` ${s.dim("gk office start --port 4000 --no-open")}`),console.log()}function w9(){console.log(),console.log(I.default.bold(s.geminiPurple("gk office status"))),console.log(s.dim("Show current Agent Office state")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office status")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log()}function T9(){console.log(),console.log(I.default.bold(s.geminiPurple("gk office watch"))),console.log(s.dim("Watch Agent Office state changes in real-time")),console.log(),console.log("Usage:"),console.log(` ${s.primary("gk office watch")} [options]`),console.log(),console.log("Options:"),console.log(` ${s.dim("--json")} Output as JSON`),console.log()}async function X9(t){console.log(),m.info("Starting Agent Office..."),console.log();try{let e=await Tc({port:t.port||3847,autoOpen:t.open!==!1,onReady:i=>{m.success(`Dashboard running at ${s.primary(`http://localhost:${i}`)}`),console.log(s.dim(" Press Ctrl+C to stop")),console.log()},onError:i=>{m.error(`Error: ${i.message}`)}});process.on("SIGINT",()=>{e.stop(),console.log(),m.info("Agent Office stopped."),console.log(),process.exit(0)})}catch(e){e instanceof Error&&(e.message==="No active session found"?(console.log(),m.warn("No active session found."),console.log(s.dim(" Start a GemKit session first with: gk agent")),console.log()):m.error(`Failed to start: ${e.message}`)),process.exit(1)}}function H9(t){let e=new Nt(Vt()),i=new kt({onSessionChange:r=>{let o=wi(r);if(t.json)console.log(JSON.stringify({...o,agents:Object.fromEntries(o.agents)},null,2));else{if(console.log(),console.log(I.default.bold(s.geminiPurple("Agent Office Status"))),console.log(M.line()),console.log(),console.log(` ${s.dim("Active Plan:")} ${o.activePlan?s.primary(o.activePlan):s.dim("(none)")}`),console.log(` ${s.dim("Agents:")} ${o.agents.size}`),console.log(` ${s.dim("Inbox Items:")} ${o.inbox.length}`),console.log(` ${s.dim("Documents:")} ${o.documents.length}`),o.agents.size>0){console.log(),console.log(s.dim(" Agents:"));for(let[a,c]of o.agents){let l=c.state==="working"?s.warn:c.state==="idle"?s.success:s.dim;console.log(` ${c.icon} ${s.primary(c.role)} ${l(`[${c.state}]`)}`)}}console.log()}i.stop(),e.dispose()},onEvent:()=>{},onError:r=>{console.log(),m.error(`Error: ${r.message}`),console.log(),process.exit(1)}});i.start()||(console.log(),m.warn("No active session found."),console.log(s.dim(" Start a GemKit session first with: gk agent")),console.log(),process.exit(1))}function L9(t){console.log(),m.info("Watching Agent Office state..."),console.log(s.dim(" Press Ctrl+C to stop")),console.log();let e=new Nt(Vt()),i=new kt({onSessionChange:r=>{let o=wi(r);if(t.json)console.log(JSON.stringify({timestamp:new Date().toISOString(),...o,agents:Object.fromEntries(o.agents)}));else{let a=new Date().toLocaleTimeString();console.log(`${s.dim(a)} ${s.info("State:")} ${o.agents.size} agents, ${o.inbox.length} inbox items`)}},onEvent:r=>{if(t.json)console.log(JSON.stringify({type:"event",event:r}));else{let o=new Date().toLocaleTimeString();console.log(`${s.dim(o)} ${s.secondary("Event:")} ${r.type}`)}},onError:r=>{m.error(`Error: ${r.message}`)}});i.start()||(console.log(),m.warn("No active session found."),console.log(s.dim(" Start a GemKit session first with: gk agent")),console.log(),process.exit(1)),process.on("SIGINT",()=>{i.stop(),e.dispose(),console.log(),m.info("Stopped watching."),console.log(),process.exit(0)})}function QA(t){t.command("office [subcommand]","Agent Office visualization (start, status, watch)").option("-p, --port <port>","[start] Web server port",{default:3847}).option("--no-open","[start] Don't auto-open browser").option("--json","[status/watch] Output as JSON").action(async(e,i)=>{if(i.port&&(i.port=parseInt(String(i.port),10)),i.help||i.h)switch(e){case"start":D9();return;case"status":w9();return;case"watch":T9();return;default:Xc();return}switch(e){case"start":await X9(i);break;case"status":H9(i);break;case"watch":L9(i);break;case void 0:case"help":Xc();break;default:console.log(),m.error(`Unknown subcommand: ${e}`),Xc(),process.exit(1)}})}function bA(t){jv(t),Rv(t),xv(t),Sv(t),Yv(t),Wv(t),Mv(t),aA(t),cA(t),AA(t),EA(t),pA(t),IA(t),dA(t),MA(t),QA(t)}import{existsSync as JA,readFileSync as _9,writeFileSync as $9,mkdirSync as ef}from"fs";import{join as tf,dirname as nf}from"path";import{homedir as rf}from"os";var os=tf(rf(),".gemkit","last-update-check.json");function BA(){try{return JA(os)?JSON.parse(_9(os,"utf-8")):null}catch{return null}}function of(t){try{let e=nf(os);JA(e)||ef(e,{recursive:!0}),$9(os,JSON.stringify(t,null,2))}catch{}}function sf(t){let e=BA();if(!e)return!0;let i=new Date(e.lastCheck);return(new Date().getTime()-i.getTime())/(1e3*60*60)>=t}async function ZA(){let e=Ve().update;if(e?.autoCheck&&sf(e.checkInterval))try{let i=await zv(),n=BA()||{lastCheck:""},r=[];i.cli?.available&&n.notifiedCli!==i.cli.latest&&(r.push(`${s.primary("CLI")} update available: v${i.cli.current} \u2192 v${i.cli.latest}`),n.notifiedCli=i.cli.latest),i.kits?.available&&n.notifiedKits!==i.kits.latest&&(r.push(`${s.primary("Kits")} update available: v${i.kits.current} \u2192 v${i.kits.latest}`),n.notifiedKits=i.kits.latest),r.length>0&&(console.log(),console.log(s.dim("\u2500".repeat(50))),console.log(`${s.warn("\u2B06")} Updates available:`),r.forEach(o=>console.log(` ${o}`)),console.log(` Run ${s.primary("gk update")} to update.`),console.log(s.dim("\u2500".repeat(50))),console.log()),n.lastCheck=new Date().toISOString(),of(n)}catch{}}var Ft=rl("gk");Ft.version(de);Ft.help();Ft.option("--verbose","Enable verbose output");Ft.option("--json","Output as JSON");Ft.option("--no-update-check","Skip auto-update check");var Hc=Ft.parse(process.argv,{run:!1});Hc.options.verbose&&Mo({level:"debug",verbose:!0});Hc.options.json&&Mo({json:!0});bA(Ft);Hc.options.updateCheck!==!1&&ZA().catch(()=>{});Ft.parse();
|