gemkit-cli 0.2.2 → 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.
Files changed (3) hide show
  1. package/README.md +15 -2
  2. package/dist/index.js +50 -50
  3. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,53 +1,53 @@
1
1
  #!/usr/bin/env node
2
- var FA=Object.create;var qc=Object.defineProperty;var QA=Object.getOwnPropertyDescriptor;var JA=Object.getOwnPropertyNames;var bA=Object.getPrototypeOf,BA=Object.prototype.hasOwnProperty;var Ln=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var ZA=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of JA(e))!BA.call(t,r)&&r!==i&&qc(t,r,{get:()=>e[r],enumerable:!(n=QA(e,r))||n.enumerable});return t};var _n=(t,e,i)=>(i=t!=null?FA(bA(t)):{},ZA(e||!t||!t.__esModule?qc(i,"default",{value:t,enumerable:!0}):i,t));var ml=Ln((ff,G7)=>{G7.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 js=Ln((hf,Il)=>{"use strict";var lr=Object.assign({},ml()),El=Object.keys(lr);Object.defineProperty(lr,"random",{get(){let t=Math.floor(Math.random()*El.length),e=El[t];return lr[e]}});Il.exports=lr});var zl=Ln((Of,Rl)=>{Rl.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 cv=Ln((pz,ec)=>{var Go=process||{},sv=Go.argv||[],xo=Go.env||{},EE=!(xo.NO_COLOR||sv.includes("--no-color"))&&(!!xo.FORCE_COLOR||sv.includes("--color")||Go.platform==="win32"||(Go.stdout||{}).isTTY&&xo.TERM!=="dumb"||!!xo.CI),IE=(t,e,i=t)=>n=>{let r=""+n,o=r.indexOf(e,t.length);return~o?t+pE(r,e,i,o)+e:t+r+e},pE=(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)},av=(t=EE)=>{let e=t?IE:()=>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")}};ec.exports=av();ec.exports.createColors=av});import{EventEmitter as PA}from"events";function as(t){return t==null?[]:Array.isArray(t)?t:[t]}function qA(t,e,i,n){var r,o=t[e],s=~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?s:Array.isArray(o)?o.concat(s):[o,s]}function yA(t,e){t=t||[],e=e||{};var i,n,r,o,s,c={_:[]},l=0,v=0,A=0,u=t.length;let I=e.alias!==void 0,E=e.unknown!==void 0,f=e.default!==void 0;if(e.alias=e.alias||{},e.string=as(e.string),e.boolean=as(e.boolean),I)for(i in e.alias)for(n=e.alias[i]=as(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 R=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&&!~R.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),s=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&&!~R.indexOf(o))return e.unknown("-".repeat(v)+o);qA(c,o,A+1<n.length||s,e)}}}if(f)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 wc=t=>t.replace(/[<[].+/,"").trim(),DA=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 s;for(;s=i.exec(t);)n.push(r(s));return n},wA=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,s)=>s!==i&&o.names.some(c=>n.names.includes(c))&&typeof o.required=="boolean")||e.boolean.push(n.names[0]));return e},yc=t=>t.sort((e,i)=>e.length>i.length?-1:1)[0],Dc=(t,e)=>t.length>=e?t:`${t}${" ".repeat(e-t.length)}`,TA=t=>t.replace(/([a-z])-([a-z])/g,(e,i,n)=>i+n.toUpperCase()),XA=(t,e,i)=>{let n=0,r=e.length,o=t,s;for(;n<r;++n)s=o[e[n]],o=o[e[n]]=n===r-1?i:s??(~e[n+1].indexOf(".")||!(+e[n+1]>-1)?{}:[])},HA=(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)))}},LA=t=>{let e=/([^\\\/]+)$/.exec(t);return e?e[1]:""},Tc=t=>t.split(".").map((e,i)=>i===0?TA(e):e).join("."),Hi=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}},cs=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=wc(e).split(",").map(r=>{let o=r.trim().replace(/^-{1,2}/,"");return o.startsWith("no-")&&(this.negated=!0,o=o.replace(/^no-/,"")),Tc(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}},_A=process.argv,$A=`${process.platform}-${process.arch} node-${process.version}`,er=class{constructor(e,i,n={},r){this.rawName=e,this.description=i,this.config=n,this.cli=r,this.options=[],this.aliasNames=[],this.name=wc(e),this.args=DA(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 cs(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 tr}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,s=[{body:`${e}${n?`/${n}`:""}`}];if(s.push({title:"Usage",body:` $ ${e} ${this.usageText||this.rawName}`}),(this.isGlobalCommand||this.isDefaultCommand)&&i.length>0){let v=yc(i.map(A=>A.rawName));s.push({title:"Commands",body:i.map(A=>` ${Dc(A.rawName,v.length)} ${A.description}`).join(`
3
- `)}),s.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=yc(l.map(A=>A.rawName));s.push({title:"Options",body:l.map(A=>` ${Dc(A.rawName,v.length)} ${A.description} ${A.config.default===void 0?"":`(default: ${A.config.default})`}`).join(`
5
- `)})}this.examples.length>0&&s.push({title:"Examples",body:this.examples.map(v=>typeof v=="function"?v(e):v).join(`
6
- `)}),o&&(s=o(s)||s),console.log(s.map(v=>v.title?`${v.title}:
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
+ `)}),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=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
+ `)})}this.examples.length>0&&a.push({title:"Examples",body:this.examples.map(v=>typeof v=="function"?v(e):v).join(`
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} ${$A}`)}checkRequiredArgs(){let e=this.args.filter(i=>i.required).length;if(this.cli.args.length<e)throw new Hi(`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 Hi(`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 s=n.some(c=>c.negated&&c.names.includes(r.name));if(o===!0||o===!1&&!s)throw new Hi(`option \`${r.rawName}\` value is missing`)}}}},tr=class extends er{constructor(e){super("@@global@@","",{},e)}},$n=Object.assign,ls=class extends PA{constructor(e=""){super(),this.name=e,this.commands=[],this.rawArgs=[],this.args=[],this.options={},this.globalCommand=new tr(this),this.globalCommand.usage("<command> [options]")}usage(e){return this.globalCommand.usage(e),this}command(e,i,n){let r=new er(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=_A,{run:i=!0}={}){this.rawArgs=e,this.name||(this.name=e[1]?LA(e[1]):"cli");let n=!0;for(let o of this.commands){let s=this.mri(e.slice(2),o),c=s.args[0];if(o.isMatched(c)){n=!1;let l=$n($n({},s),{args:s.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 s=this.mri(e.slice(2),o);this.setParsedInfo(s,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=wA(n),o=[],s=e.indexOf("--");s>-1&&(o=e.slice(s+1),e=e.slice(0,s));let c=yA(e,r);c=Object.keys(c).reduce((I,E)=>$n($n({},I),{[Tc(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 I of n){if(!A&&I.config.default!==void 0)for(let E of I.names)v[E]=I.config.default;Array.isArray(I.config.type)&&u[I.name]===void 0&&(u[I.name]=Object.create(null),u[I.name].shouldTransform=!0,u[I.name].transformFunction=I.config.type[0])}for(let I of Object.keys(c))if(I!=="_"){let E=I.split(".");XA(v,E,c[I]),HA(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,s)=>{o.variadic?r.push(e.slice(s)):r.push(e[s])}),r.push(i),n.commandAction.apply(this,r)}},Xc=(t="")=>new ls(t);import{existsSync as kE}from"fs";import{join as FE}from"path";import{spawn as QE,spawnSync as JE}from"child_process";import vr from"node:process";var Hc=(t=0)=>e=>`\x1B[${e+t}m`,Lc=(t=0)=>e=>`\x1B[${38+t};5;${e}m`,_c=(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]}},Z9=Object.keys(S.modifier),e7=Object.keys(S.color),t7=Object.keys(S.bgColor),P9=[...e7,...t7];function i7(){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=Hc(),S.color.ansi256=Lc(),S.color.ansi16m=_c(),S.bgColor.ansi=Hc(10),S.bgColor.ansi256=Lc(10),S.bgColor.ansi16m=_c(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 s=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(i));return o===2&&(s+=60),s},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 n7=i7(),Re=n7;import vs from"node:process";import r7 from"node:os";import $c from"node:tty";function ue(t,e=globalThis.Deno?globalThis.Deno.args:vs.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}=vs,ir;ue("no-color")||ue("no-colors")||ue("color=false")||ue("color=never")?ir=0:(ue("color")||ue("colors")||ue("color=true")||ue("color=always"))&&(ir=1);function o7(){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 s7(t){return t===0?!1:{level:t,hasBasic:!0,has256:t>=2,has16m:t>=3}}function a7(t,{streamIsTTY:e,sniffFlags:i=!0}={}){let n=o7();n!==void 0&&(ir=n);let r=i?ir: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(vs.platform==="win32"){let s=r7.release().split(".");return Number(s[0])>=10&&Number(s[2])>=10586?Number(s[2])>=14931?3:2:1}if("CI"in Y)return["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some(s=>s in Y)?3:["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some(s=>s 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 s=Number.parseInt((Y.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(Y.TERM_PROGRAM){case"iTerm.app":return s>=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 el(t,e={}){let i=a7(t,{streamIsTTY:t&&t.isTTY,...e});return s7(i)}var c7={stdout:el({isTTY:$c.isatty(1)}),stderr:el({isTTY:$c.isatty(2)})},tl=c7;function il(t,e,i){let n=t.indexOf(e);if(n===-1)return t;let r=e.length,o=0,s="";do s+=t.slice(o,n)+e+i,o=n+r,n=t.indexOf(e,o);while(n!==-1);return s+=t.slice(o),s}function nl(t,e,i,n){let r=0,o="";do{let s=t[n-1]==="\r";o+=t.slice(r,s?n-1:n)+e+(s?`\r
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:rl,stderr:ol}=tl,As=Symbol("GENERATOR"),Ei=Symbol("STYLER"),Li=Symbol("IS_EMPTY"),sl=["ansi","ansi","ansi256","ansi16m"],Ii=Object.create(null),l7=(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=rl?rl.level:0;t.level=e.level===void 0?i:e.level};var v7=t=>{let e=(...i)=>i.join(" ");return l7(e,t),Object.setPrototypeOf(e,_i.prototype),e};function _i(t){return v7(t)}Object.setPrototypeOf(_i.prototype,Function.prototype);for(let[t,e]of Object.entries(Re))Ii[t]={get(){let i=nr(this,ms(e.open,e.close,this[Ei]),this[Li]);return Object.defineProperty(this,t,{value:i}),i}};Ii.visible={get(){let t=nr(this,this[Ei],!0);return Object.defineProperty(this,"visible",{value:t}),t}};var us=(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"?us("rgb",e,i,...Re.hexToRgb(...n)):Re[i][t](...n),A7=["rgb","hex","ansi256"];for(let t of A7){Ii[t]={get(){let{level:i}=this;return function(...n){let r=ms(us(t,sl[i],"color",...n),Re.color.close,this[Ei]);return nr(this,r,this[Li])}}};let e="bg"+t[0].toUpperCase()+t.slice(1);Ii[e]={get(){let{level:i}=this;return function(...n){let r=ms(us(t,sl[i],"bgColor",...n),Re.bgColor.close,this[Ei]);return nr(this,r,this[Li])}}}}var u7=Object.defineProperties(()=>{},{...Ii,level:{enumerable:!0,get(){return this[As].level},set(t){this[As].level=t}}}),ms=(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}},nr=(t,e,i)=>{let n=(...r)=>m7(n,r.length===1?""+r[0]:r.join(" "));return Object.setPrototypeOf(n,u7),n[As]=t,n[Ei]=e,n[Li]=i,n},m7=(t,e)=>{if(t.level<=0||!e)return t[Li]?"":e;let i=t[Ei];if(i===void 0)return e;let{openAll:n,closeAll:r}=i;if(e.includes("\x1B"))for(;i!==void 0;)e=il(e,i.close,i.open),i=i.parent;let o=e.indexOf(`
13
- `);return o!==-1&&(e=nl(e,r,n,o)),n+e+r};Object.defineProperties(_i.prototype,Ii);var E7=_i(),$9=_i({level:ol?ol.level:0});var ze=E7;import ul from"node:process";import ar from"node:process";var I7=(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);!p7(r,o)&&n||Object.defineProperty(t,i,o)},p7=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)},f7=(t,e)=>{let i=Object.getPrototypeOf(e);i!==Object.getPrototypeOf(t)&&Object.setPrototypeOf(t,i)},h7=(t,e)=>`/* Wrapped ${t}*/
14
- ${e}`,d7=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),R7=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name"),z7=(t,e,i)=>{let n=i===""?"":`with ${i.trim()}() `,r=h7.bind(null,n,e.toString());Object.defineProperty(r,"name",R7);let{writable:o,enumerable:s,configurable:c}=d7;Object.defineProperty(t,"toString",{value:r,writable:o,enumerable:s,configurable:c})};function Es(t,e,{ignoreNonConfigurable:i=!1}={}){let{name:n}=t;for(let r of Reflect.ownKeys(e))I7(t,e,r,i);return f7(t,e),z7(t,e,n),t}var rr=new WeakMap,al=(t,e={})=>{if(typeof t!="function")throw new TypeError("Expected a function");let i,n=0,r=t.displayName||t.name||"<anonymous>",o=function(...s){if(rr.set(o,++n),n===1)i=t.apply(this,s),t=void 0;else if(e.throw===!0)throw new Error(`Function \`${r}\` can only be called once`);return i};return Es(o,t),rr.set(o,n),o};al.callCount=t=>{if(!rr.has(t))throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`);return rr.get(t)};var cl=al;var Jt=[];Jt.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&Jt.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&Jt.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var or=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",Is=Symbol.for("signal-exit emitter"),ps=globalThis,j7=Object.defineProperty.bind(Object),fs=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if(ps[Is])return ps[Is];j7(ps,Is,{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}},sr=class{},g7=t=>({onExit(e,i){return t.onExit(e,i)},load(){return t.load()},unload(){return t.unload()}}),hs=class extends sr{onExit(){return()=>{}}load(){}unload(){}},ds=class extends sr{#e=Rs.platform==="win32"?"SIGINT":"SIGHUP";#n=new fs;#i;#r;#a;#t={};#o=!1;constructor(e){super(),this.#i=e,this.#t={};for(let i of Jt)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 s=this.#n.emit("exit",null,i),c=i==="SIGHUP"?this.#e:i;s||e.kill(e.pid,c)}};this.#a=e.reallyExit,this.#r=e.emit}onExit(e,i){if(!or(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 Jt)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,Jt.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 or(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"&&or(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)}},Rs=globalThis.process,{onExit:ll,load:af,unload:cf}=g7(or(Rs)?new ds(Rs):new hs);var vl=ar.stderr.isTTY?ar.stderr:ar.stdout.isTTY?ar.stdout:void 0,x7=vl?cl(()=>{ll(()=>{vl.write("\x1B[?25h")},{alwaysLast:!0})}):()=>{},Al=x7;var cr=!1,pi={};pi.show=(t=ul.stderr)=>{t.isTTY&&(cr=!1,t.write("\x1B[?25h"))};pi.hide=(t=ul.stderr)=>{t.isTTY&&(Al(),cr=!0,t.write("\x1B[?25l"))};pi.toggle=(t,e)=>{t!==void 0&&(cr=t),cr?pi.show(e):pi.hide(e)};var zs=pi;var tn=_n(js(),1);import je from"node:process";function gs(){return je.platform!=="win32"?je.env.TERM!=="linux":!!je.env.CI||!!je.env.WT_SESSION||!!je.env.TERMINUS_SUBLIME||je.env.ConEmuTask==="{cmd::Cmder}"||je.env.TERM_PROGRAM==="Terminus-Sublime"||je.env.TERM_PROGRAM==="vscode"||je.env.TERM==="xterm-256color"||je.env.TERM==="alacritty"||je.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var S7={info:ze.blue("\u2139"),success:ze.green("\u2714"),warning:ze.yellow("\u26A0"),error:ze.red("\u2716")},Y7={info:ze.blue("i"),success:ze.green("\u221A"),warning:ze.yellow("\u203C"),error:ze.red("\xD7")},W7=gs()?S7:Y7,$i=W7;function xs({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 M7=xs();function en(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(M7,"")}function pl(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 fl(t){return t===12288||t>=65281&&t<=65376||t>=65504&&t<=65510}function hl(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 C7(t){if(!Number.isSafeInteger(t))throw new TypeError(`Expected a code point, got \`${typeof t}\`.`)}function dl(t,{ambiguousAsWide:e=!1}={}){return C7(t),fl(t)||hl(t)||e&&pl(t)?2:1}var jl=_n(zl(),1),O7=new Intl.Segmenter,U7=new RegExp("^\\p{Default_Ignorable_Code_Point}$","u");function Gs(t,e={}){if(typeof t!="string"||t.length===0)return 0;let{ambiguousIsNarrow:i=!0,countAnsiEscapeCodes:n=!1}=e;if(n||(t=en(t)),t.length===0)return 0;let r=0,o={ambiguousAsWide:!i};for(let{segment:s}of O7.segment(t)){let c=s.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)&&!U7.test(s)){if((0,jl.default)().test(s)){r+=2;continue}r+=dl(c,o)}}return r}function Ss({stream:t=process.stdout}={}){return!!(t&&t.isTTY&&process.env.TERM!=="dumb"&&!("CI"in process.env))}import gl from"node:process";function Ys(){let{env:t}=gl,{TERM:e,TERM_PROGRAM:i}=t;return gl.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 K7=3,Ws=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]===K7&&Ue.emit("SIGINT")}},V7=new Ws,Ms=V7;var N7=_n(js(),1),Cs=class{#e=0;#n=!1;#i=0;#r=-1;#a=0;#t;#o;#s;#m;#I;#v;#A;#u;#p;#c;#l;color;constructor(e){typeof e=="string"&&(e={text:e}),this.#t={color:"cyan",stream:vr.stderr,discardStdin:!0,hideCursor:!0,...e},this.color=this.#t.color,this.spinner=this.#t.spinner,this.#I=this.#t.interval,this.#s=this.#t.stream,this.#v=typeof this.#t.isEnabled=="boolean"?this.#t.isEnabled:Ss({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,vr.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.#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(!Ys())this.#o=tn.default.line;else if(e===void 0)this.#o=tn.default.dots;else if(e!=="default"&&tn.default[e])this.#o=tn.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.#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.#p+"--"+n;this.#i=0;for(let o of en(r).split(`
15
- `))this.#i+=Math.max(1,Math.ceil(Gs(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:"",s=typeof this.#l=="string"&&this.#l!==""?" "+this.#l:"";return r+n+o+s}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&&zs.hide(this.#s),this.#t.discardStdin&&vr.stdin.isTTY&&(this.#n=!0,Ms.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&&zs.show(this.#s),this.#t.discardStdin&&vr.stdin.isTTY&&this.#n&&(Ms.stop(),this.#n=!1),this):this}succeed(e){return this.stopAndPersist({symbol:$i.success,text:e})}fail(e){return this.stopAndPersist({symbol:$i.error,text:e})}warn(e){return this.stopAndPersist({symbol:$i.warning,text:e})}info(e){return this.stopAndPersist({symbol:$i.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 Cs(t)}import{existsSync as Yl,readFileSync as B7,writeFileSync as Z7,mkdirSync as P7}from"fs";import{dirname as q7}from"path";import{homedir as xl}from"os";import{join as y}from"path";var k7=y(xl(),".gemkit"),Os=y(k7,"projects"),Us=y(xl(),".gemini"),_f=y(Us,"config"),fi=y(Us,"cache"),$f=y(Us,"tmp"),hi=".gemini";var F7="plans",Q7=".gk.json",J7="metadata.json",b7=".env";function Ar(t=process.cwd()){return y(t,hi)}function Ks(t=process.cwd()){return y(t,hi,Q7)}function Vs(t=process.cwd()){return y(t,hi,J7)}function bt(t=process.cwd()){return y(t,hi,b7)}function nn(t=process.cwd()){return y(t,hi,"agents")}function Bt(t=process.cwd()){return y(t,hi,"extensions")}function di(t=process.cwd()){return y(t,F7)}function rn(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 y(Os,t)}function Zt(t,e){return y(we(t),`gk-session-${e}.json`)}function on(t,e){return y(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 Gl(t){return!(!t||typeof t!="object")}function Sl(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 ur=class extends Error{constructor(i,n="GEMKIT_ERROR",r){super(i);this.code=n;this.details=r;this.name="GemKitError"}},Pt=class extends ur{constructor(e,i){super(e,"CONFIG_ERROR",i),this.name="ConfigError"}};var Ee=class extends ur{constructor(e,i){super(e,"GITHUB_ERROR",i),this.name="GitHubError"}};function Ve(t){let e=Ks(t);if(!Yl(e))return me;try{let i=B7(e,"utf-8"),n=JSON.parse(i);if(!Gl(n))throw new Pt("Invalid configuration format");return Sl(n)}catch(i){throw i instanceof Pt?i:new Pt(`Failed to load config: ${i}`)}}function Wl(t,e){let i=Ks(e),n=q7(i);Yl(n)||P7(n,{recursive:!0}),Z7(i,JSON.stringify(t,null,2))}function Ml(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 Cl(t,e,i){let n=Ve(i),r=t.split("."),o=r.pop();if(!o)throw new Pt("Invalid config path");let s=n;for(let c of r)(!(c in s)||typeof s[c]!="object")&&(s[c]={}),s=s[c];s[o]=e,Wl(n,i)}function Ol(t){Wl(me,t)}import{existsSync as Ul,readFileSync as y7,writeFileSync as D7,mkdirSync as w7,readdirSync as Kl,unlinkSync as Vl,statSync as T7}from"fs";import{join as Ns}from"path";function ks(){return Ul(fi)||w7(fi,{recursive:!0}),fi}function Nl(t){let e=t.replace(/[^a-zA-Z0-9-_]/g,"_");return Ns(ks(),`${e}.json`)}function mr(t){let e=Nl(t);if(!Ul(e))return null;try{let i=y7(e,"utf-8"),n=JSON.parse(i);return Date.now()-n.timestamp>n.ttl*1e3?(Vl(e),null):n.data}catch{return null}}function Er(t,e,i=3600){let n=Nl(t),r={key:t,data:e,timestamp:Date.now(),ttl:i};D7(n,JSON.stringify(r,null,2))}function kl(){let t=ks(),e=Kl(t).filter(i=>i.endsWith(".json"));for(let i of e)Vl(Ns(t,i));return e.length}function Fl(){let t=ks(),e=Kl(t).filter(n=>n.endsWith(".json")),i=0;for(let n of e){let r=T7(Ns(t,n));i+=r.size}return{entries:e.length,size:i}}var Ql="github-releases",X7=300;async function Ir(t=10){let e=mr(Ql);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 s=await fetch(o,{headers:{Accept:"application/vnd.github.v3+json","User-Agent":"gemkit-cli"}});if(!s.ok)throw new Ee(`Failed to fetch releases: ${s.status}`);let l=(await s.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 Er(Ql,l,X7),l}catch(s){throw s instanceof Ee?s:new Ee(`Failed to fetch releases: ${s}`)}}async function qt(){let t=await Ir(1);return t.length>0?t[0]:null}async function Jl(t){return(await Ir(50)).find(i=>i.version===t||i.tag===t)||null}import{createWriteStream as H7,existsSync as L7,mkdirSync as _7}from"fs";import{pipeline as $7}from"stream/promises";import{join as eu}from"path";async function tu(t,e=fi){L7(e)||_7(e,{recursive:!0});let i=eu(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=H7(i);return await $7(n.body,r),i}catch(n){throw n instanceof Ee?n:new Ee(`Download failed: ${n}`)}}async function Ri(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 tu(e)}import{createReadStream as sE,createWriteStream as cz,existsSync as iv,mkdirSync as aE}from"fs";import{pipeline as cE}from"stream/promises";import{createGunzip as lE}from"zlib";import uu from"events";import ee from"fs";import{EventEmitter as Ps}from"node:events";import ql from"node:stream";import{StringDecoder as iu}from"node:string_decoder";var bl=typeof process=="object"&&process?process:{stdout:null,stderr:null},nu=t=>!!t&&typeof t=="object"&&(t instanceof vn||t instanceof ql||ru(t)||ou(t)),ru=t=>!!t&&typeof t=="object"&&t instanceof Ps&&typeof t.pipe=="function"&&t.pipe!==ql.Writable.prototype.pipe,ou=t=>!!t&&typeof t=="object"&&t instanceof Ps&&typeof t.write=="function"&&typeof t.end=="function",Te=Symbol("EOF"),Xe=Symbol("maybeEmitEnd"),mt=Symbol("emittedEnd"),pr=Symbol("emittingEnd"),sn=Symbol("emittedError"),fr=Symbol("closed"),Bl=Symbol("read"),hr=Symbol("flush"),Zl=Symbol("flushChunk"),ge=Symbol("encoding"),zi=Symbol("decoder"),k=Symbol("flowing"),an=Symbol("paused"),ji=Symbol("resume"),F=Symbol("buffer"),L=Symbol("pipes"),Q=Symbol("bufferLength"),Fs=Symbol("bufferPush"),dr=Symbol("bufferShift"),D=Symbol("objectMode"),C=Symbol("destroyed"),Qs=Symbol("error"),Js=Symbol("emitData"),Pl=Symbol("emitEnd"),bs=Symbol("emitEnd2"),Ne=Symbol("async"),Bs=Symbol("abort"),Rr=Symbol("aborted"),cn=Symbol("signal"),yt=Symbol("dataListeners"),te=Symbol("discarded"),ln=t=>Promise.resolve().then(t),su=t=>t(),au=t=>t==="end"||t==="finish"||t==="prefinish",cu=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,lu=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),zr=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()}},Zs=class extends zr{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)}},vu=t=>!!t.objectMode,Au=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",vn=class extends Ps{[k]=!1;[an]=!1;[L]=[];[F]=[];[D];[ge];[Ne];[zi];[Te]=!1;[mt]=!1;[pr]=!1;[fr]=!1;[sn]=null;[Q]=0;[C]=!1;[cn];[Rr]=!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");vu(i)?(this[D]=!0,this[ge]=null):Au(i)?(this[ge]=i.encoding,this[D]=!1):(this[D]=!1,this[ge]=null),this[Ne]=!!i.async,this[zi]=this[ge]?new iu(this[ge]):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[cn]=n,n.aborted?this[Bs]():n.addEventListener("abort",()=>this[Bs]()))}get bufferLength(){return this[Q]}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[D]}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}[Bs](){this[Rr]=!0,this.emit("abort",this[cn]?.reason),this.destroy(this[cn]?.reason)}get aborted(){return this[Rr]}set aborted(e){}write(e,i,n){if(this[Rr])return!1;if(this[Te])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[Ne]?ln:su;if(!this[D]&&!Buffer.isBuffer(e)){if(lu(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(cu(e))e=Buffer.from(e);else if(typeof e!="string")throw new Error("Non-contiguous data written to non-objectMode stream")}return this[D]?(this[k]&&this[Q]!==0&&this[hr](!0),this[k]?this.emit("data",e):this[Fs](e),this[Q]!==0&&this.emit("readable"),n&&r(n),this[k]):e.length?(typeof e=="string"&&!(i===this[ge]&&!this[zi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[ge]&&(e=this[zi].write(e)),this[k]&&this[Q]!==0&&this[hr](!0),this[k]?this.emit("data",e):this[Fs](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[Xe](),null;this[D]&&(e=null),this[F].length>1&&!this[D]&&(this[F]=[this[ge]?this[F].join(""):Buffer.concat(this[F],this[Q])]);let i=this[Bl](e||null,this[F][0]);return this[Xe](),i}[Bl](e,i){if(this[D])this[dr]();else{let n=i;e===n.length||e===null?this[dr]():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[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[k]||!this[an])&&this[Xe](),this}[ji](){this[C]||(!this[yt]&&!this[L].length&&(this[te]=!0),this[an]=!1,this[k]=!0,this.emit("resume"),this[F].length?this[hr]():this[Te]?this[Xe]():this.emit("drain"))}resume(){return this[ji]()}pause(){this[k]=!1,this[an]=!0,this[te]=!1}get destroyed(){return this[C]}get flowing(){return this[k]}get paused(){return this[an]}[Fs](e){this[D]?this[Q]+=1:this[Q]+=e.length,this[F].push(e)}[dr](){return this[D]?this[Q]-=1:this[Q]-=this[F][0].length,this[F].shift()}[hr](e=!1){do;while(this[Zl](this[dr]())&&this[F].length);!e&&!this[F].length&&!this[Te]&&this.emit("drain")}[Zl](e){return this.emit("data",e),this[k]}pipe(e,i){if(this[C])return e;this[te]=!1;let n=this[mt];return i=i||{},e===bl.stdout||e===bl.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[L].push(i.proxyErrors?new Zs(this,e,i):new zr(this,e,i)),this[Ne]?ln(()=>this[ji]()):this[ji]()),e}unpipe(e){let i=this[L].find(n=>n.dest===e);i&&(this[L].length===1?(this[k]&&this[yt]===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[yt]++,!this[L].length&&!this[k]&&this[ji]();else if(e==="readable"&&this[Q]!==0)super.emit("readable");else if(au(e)&&this[mt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[sn]){let r=i;this[Ne]?ln(()=>r.call(this,this[sn])):r.call(this,this[sn])}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[k]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[yt]=0,!this[te]&&!this[L].length&&(this[k]=!1)),i}get emittedEnd(){return this[mt]}[Xe](){!this[pr]&&!this[mt]&&!this[C]&&this[F].length===0&&this[Te]&&(this[pr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[fr]&&this.emit("close"),this[pr]=!1)}emit(e,...i){let n=i[0];if(e!=="error"&&e!=="close"&&e!==C&&this[C])return!1;if(e==="data")return!this[D]&&!n?!1:this[Ne]?(ln(()=>this[Js](n)),!0):this[Js](n);if(e==="end")return this[Pl]();if(e==="close"){if(this[fr]=!0,!this[mt]&&!this[C])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[sn]=n,super.emit(Qs,n);let o=!this[cn]||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}[Js](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}[Pl](){return this[mt]?!1:(this[mt]=!0,this.readable=!1,this[Ne]?(ln(()=>this[bs]()),!0):this[bs]())}[bs](){if(this[zi]){let i=this[zi].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[D]||(e.dataLength=0);let i=this.promise();return this.on("data",n=>{e.push(n),this[D]||(e.dataLength+=n.length)}),await i,e}async concat(){if(this[D])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(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[Te])return i();let o,s,c=u=>{this.off("data",l),this.off("end",v),this.off(C,A),i(),s(u)},l=u=>{this.off("error",c),this.off("end",v),this.off(C,A),this.pause(),o({value:u,done:!!this[Te]})},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((u,I)=>{s=I,o=u,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(Qs,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(Qs,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[fr]&&i.close(),e?this.emit("error",e):this.emit(C),this}static get isStream(){return nu}};var mu=ee.writev,It=Symbol("_autoClose"),Ge=Symbol("_close"),An=Symbol("_ended"),g=Symbol("_fd"),qs=Symbol("_finished"),Le=Symbol("_flags"),ys=Symbol("_flush"),Xs=Symbol("_handleChunk"),Hs=Symbol("_makeBuf"),mn=Symbol("_mode"),jr=Symbol("_needDrain"),Gi=Symbol("_onerror"),Si=Symbol("_onopen"),Ds=Symbol("_onread"),gi=Symbol("_onwrite"),pt=Symbol("_open"),xe=Symbol("_path"),Et=Symbol("_pos"),ke=Symbol("_queue"),xi=Symbol("_read"),ws=Symbol("_readSize"),He=Symbol("_reading"),un=Symbol("_remain"),Ts=Symbol("_size"),gr=Symbol("_write"),Dt=Symbol("_writing"),xr=Symbol("_defaultFlag"),wt=Symbol("_errored"),Tt=class extends vn{[wt]=!1;[g];[xe];[ws];[He]=!1;[Ts];[un];[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[g]=typeof i.fd=="number"?i.fd:void 0,this[xe]=e,this[ws]=i.readSize||16*1024*1024,this[He]=!1,this[Ts]=typeof i.size=="number"?i.size:1/0,this[un]=this[Ts],this[It]=typeof i.autoClose=="boolean"?i.autoClose:!0,typeof this[g]=="number"?this[xi]():this[pt]()}get fd(){return this[g]}get path(){return this[xe]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[pt](){ee.open(this[xe],"r",(e,i)=>this[Si](e,i))}[Si](e,i){e?this[Gi](e):(this[g]=i,this.emit("open",i),this[xi]())}[Hs](){return Buffer.allocUnsafe(Math.min(this[ws],this[un]))}[xi](){if(!this[He]){this[He]=!0;let e=this[Hs]();if(e.length===0)return process.nextTick(()=>this[Ds](null,0,e));ee.read(this[g],e,0,e.length,null,(i,n,r)=>this[Ds](i,n,r))}}[Ds](e,i,n){this[He]=!1,e?this[Gi](e):this[Xs](i,n)&&this[xi]()}[Ge](){if(this[It]&&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](e){this[He]=!0,this[Ge](),this.emit("error",e)}[Xs](e,i){let n=!1;return this[un]-=e,e>0&&(n=super.write(e<i.length?i.subarray(0,e):i)),(e===0||this[un]<=0)&&(n=!1,this[Ge](),super.end()),n}emit(e,...i){switch(e){case"prefinish":case"finish":return!1;case"drain":return typeof this[g]=="number"&&this[xi](),!1;case"error":return this[wt]?!1:(this[wt]=!0,super.emit(e,...i));default:return super.emit(e,...i)}}},Gr=class extends Tt{[pt](){let e=!0;try{this[Si](null,ee.openSync(this[xe],"r")),e=!1}finally{e&&this[Ge]()}}[xi](){let e=!0;try{if(!this[He]){this[He]=!0;do{let i=this[Hs](),n=i.length===0?0:ee.readSync(this[g],i,0,i.length,null);if(!this[Xs](n,i))break}while(!0);this[He]=!1}e=!1}finally{e&&this[Ge]()}}[Ge](){if(this[It]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.closeSync(e),this.emit("close")}}},_e=class extends uu{readable=!1;writable=!0;[wt]=!1;[Dt]=!1;[An]=!1;[ke]=[];[jr]=!1;[xe];[mn];[It];[g];[xr];[Le];[qs]=!1;[Et];constructor(e,i){i=i||{},super(i),this[xe]=e,this[g]=typeof i.fd=="number"?i.fd:void 0,this[mn]=i.mode===void 0?438:i.mode,this[Et]=typeof i.start=="number"?i.start:void 0,this[It]=typeof i.autoClose=="boolean"?i.autoClose:!0;let n=this[Et]!==void 0?"r+":"w";this[xr]=i.flags===void 0,this[Le]=i.flags===void 0?n:i.flags,this[g]===void 0&&this[pt]()}emit(e,...i){if(e==="error"){if(this[wt])return!1;this[wt]=!0}return super.emit(e,...i)}get fd(){return this[g]}get path(){return this[xe]}[Gi](e){this[Ge](),this[Dt]=!0,this.emit("error",e)}[pt](){ee.open(this[xe],this[Le],this[mn],(e,i)=>this[Si](e,i))}[Si](e,i){this[xr]&&this[Le]==="r+"&&e&&e.code==="ENOENT"?(this[Le]="w",this[pt]()):e?this[Gi](e):(this[g]=i,this.emit("open",i),this[Dt]||this[ys]())}end(e,i){return e&&this.write(e,i),this[An]=!0,!this[Dt]&&!this[ke].length&&typeof this[g]=="number"&&this[gi](null,0),this}write(e,i){return typeof e=="string"&&(e=Buffer.from(e,i)),this[An]?(this.emit("error",new Error("write() after end()")),!1):this[g]===void 0||this[Dt]||this[ke].length?(this[ke].push(e),this[jr]=!0,!1):(this[Dt]=!0,this[gr](e),!0)}[gr](e){ee.write(this[g],e,0,e.length,this[Et],(i,n)=>this[gi](i,n))}[gi](e,i){e?this[Gi](e):(this[Et]!==void 0&&typeof i=="number"&&(this[Et]+=i),this[ke].length?this[ys]():(this[Dt]=!1,this[An]&&!this[qs]?(this[qs]=!0,this[Ge](),this.emit("finish")):this[jr]&&(this[jr]=!1,this.emit("drain"))))}[ys](){if(this[ke].length===0)this[An]&&this[gi](null,0);else if(this[ke].length===1)this[gr](this[ke].pop());else{let e=this[ke];this[ke]=[],mu(this[g],e,this[Et],(i,n)=>this[gi](i,n))}}[Ge](){if(this[It]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.close(e,i=>i?this.emit("error",i):this.emit("close"))}}},Yi=class extends _e{[pt](){let e;if(this[xr]&&this[Le]==="r+")try{e=ee.openSync(this[xe],this[Le],this[mn])}catch(i){if(i?.code==="ENOENT")return this[Le]="w",this[pt]();throw i}else e=ee.openSync(this[xe],this[Le],this[mn]);this[Si](null,e)}[Ge](){if(this[It]&&typeof this[g]=="number"){let e=this[g];this[g]=void 0,ee.closeSync(e),this.emit("close")}}[gr](e){let i=!0;try{this[gi](null,ee.writeSync(this[g],e,0,e.length,this[Et])),i=!1}finally{if(i)try{this[Ge]()}catch{}}}};import V3 from"node:path";import ki from"node:fs";import{dirname as vm,parse as Am}from"path";var Eu=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"]]),yl=t=>!!t.sync&&!!t.file,Dl=t=>!t.sync&&!!t.file,wl=t=>!!t.sync&&!t.file,Tl=t=>!t.sync&&!t.file;var Xl=t=>!!t.file;var Iu=t=>{let e=Eu.get(t);return e||t},En=(t={})=>{if(!t)return{};let e={};for(let[i,n]of Object.entries(t)){let r=Iu(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=[],s,c)=>{Array.isArray(o)&&(s=o,o={}),typeof s=="function"&&(c=s,s=void 0),s?s=Array.from(s):s=[];let l=En(o);if(r?.(l,s),yl(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return t(l,s)}else if(Dl(l)){let v=e(l,s),A=c||void 0;return A?v.then(()=>A(),A):v}else if(wl(l)){if(typeof c=="function")throw new TypeError("callback not supported for sync tar functions");return i(l,s)}else if(Tl(l)){if(typeof c=="function")throw new TypeError("callback only supported with file option");return n(l,s)}else throw new Error("impossible options??")},{syncFile:t,asyncFile:e,syncNoFile:i,asyncNoFile:n,validate:r});import{EventEmitter as sm}from"events";import aa from"assert";import{Buffer as Ht}from"buffer";import{EventEmitter as ra}from"node:events";import e3 from"node:stream";import{StringDecoder as pu}from"node:string_decoder";var Hl=typeof process=="object"&&process?process:{stdout:null,stderr:null},fu=t=>!!t&&typeof t=="object"&&(t instanceof dn||t instanceof e3||hu(t)||du(t)),hu=t=>!!t&&typeof t=="object"&&t instanceof ra&&typeof t.pipe=="function"&&t.pipe!==e3.Writable.prototype.pipe,du=t=>!!t&&typeof t=="object"&&t instanceof ra&&typeof t.write=="function"&&typeof t.end=="function",$e=Symbol("EOF"),et=Symbol("maybeEmitEnd"),ft=Symbol("emittedEnd"),Sr=Symbol("emittingEnd"),In=Symbol("emittedError"),Yr=Symbol("closed"),Ll=Symbol("read"),Wr=Symbol("flush"),_l=Symbol("flushChunk"),Se=Symbol("encoding"),Wi=Symbol("decoder"),J=Symbol("flowing"),pn=Symbol("paused"),Mi=Symbol("resume"),b=Symbol("buffer"),_=Symbol("pipes"),B=Symbol("bufferLength"),_s=Symbol("bufferPush"),Mr=Symbol("bufferShift"),w=Symbol("objectMode"),O=Symbol("destroyed"),$s=Symbol("error"),ea=Symbol("emitData"),$l=Symbol("emitEnd"),ta=Symbol("emitEnd2"),Qe=Symbol("async"),ia=Symbol("abort"),Cr=Symbol("aborted"),fn=Symbol("signal"),Xt=Symbol("dataListeners"),ie=Symbol("discarded"),hn=t=>Promise.resolve().then(t),Ru=t=>t(),zu=t=>t==="end"||t==="finish"||t==="prefinish",ju=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,gu=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Or=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()}},na=class extends Or{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)}},xu=t=>!!t.objectMode,Gu=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",dn=class extends ra{[J]=!1;[pn]=!1;[_]=[];[b]=[];[w];[Se];[Qe];[Wi];[$e]=!1;[ft]=!1;[Sr]=!1;[Yr]=!1;[In]=null;[B]=0;[O]=!1;[fn];[Cr]=!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");xu(i)?(this[w]=!0,this[Se]=null):Gu(i)?(this[Se]=i.encoding,this[w]=!1):(this[w]=!1,this[Se]=null),this[Qe]=!!i.async,this[Wi]=this[Se]?new pu(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[fn]=n,n.aborted?this[ia]():n.addEventListener("abort",()=>this[ia]()))}get bufferLength(){return this[B]}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[w]}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}[ia](){this[Cr]=!0,this.emit("abort",this[fn]?.reason),this.destroy(this[fn]?.reason)}get aborted(){return this[Cr]}set aborted(e){}write(e,i,n){if(this[Cr])return!1;if(this[$e])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[Qe]?hn:Ru;if(!this[w]&&!Buffer.isBuffer(e)){if(gu(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(ju(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[B]!==0&&this[Wr](!0),this[J]?this.emit("data",e):this[_s](e),this[B]!==0&&this.emit("readable"),n&&r(n),this[J]):e.length?(typeof e=="string"&&!(i===this[Se]&&!this[Wi]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[Se]&&(e=this[Wi].write(e)),this[J]&&this[B]!==0&&this[Wr](!0),this[J]?this.emit("data",e):this[_s](e),this[B]!==0&&this.emit("readable"),n&&r(n),this[J]):(this[B]!==0&&this.emit("readable"),n&&r(n),this[J])}read(e){if(this[O])return null;if(this[ie]=!1,this[B]===0||e===0||e&&e>this[B])return this[et](),null;this[w]&&(e=null),this[b].length>1&&!this[w]&&(this[b]=[this[Se]?this[b].join(""):Buffer.concat(this[b],this[B])]);let i=this[Ll](e||null,this[b][0]);return this[et](),i}[Ll](e,i){if(this[w])this[Mr]();else{let n=i;e===n.length||e===null?this[Mr]():typeof n=="string"?(this[b][0]=n.slice(e),i=n.slice(0,e),this[B]-=e):(this[b][0]=n.subarray(e),i=n.subarray(0,e),this[B]-=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[pn])&&this[et](),this}[Mi](){this[O]||(!this[Xt]&&!this[_].length&&(this[ie]=!0),this[pn]=!1,this[J]=!0,this.emit("resume"),this[b].length?this[Wr]():this[$e]?this[et]():this.emit("drain"))}resume(){return this[Mi]()}pause(){this[J]=!1,this[pn]=!0,this[ie]=!1}get destroyed(){return this[O]}get flowing(){return this[J]}get paused(){return this[pn]}[_s](e){this[w]?this[B]+=1:this[B]+=e.length,this[b].push(e)}[Mr](){return this[w]?this[B]-=1:this[B]-=this[b][0].length,this[b].shift()}[Wr](e=!1){do;while(this[_l](this[Mr]())&&this[b].length);!e&&!this[b].length&&!this[$e]&&this.emit("drain")}[_l](e){return this.emit("data",e),this[J]}pipe(e,i){if(this[O])return e;this[ie]=!1;let n=this[ft];return i=i||{},e===Hl.stdout||e===Hl.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[_].push(i.proxyErrors?new na(this,e,i):new Or(this,e,i)),this[Qe]?hn(()=>this[Mi]()):this[Mi]()),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[Mi]();else if(e==="readable"&&this[B]!==0)super.emit("readable");else if(zu(e)&&this[ft])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[In]){let r=i;this[Qe]?hn(()=>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[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[ft]}[et](){!this[Sr]&&!this[ft]&&!this[O]&&this[b].length===0&&this[$e]&&(this[Sr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[Yr]&&this.emit("close"),this[Sr]=!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[Qe]?(hn(()=>this[ea](n)),!0):this[ea](n);if(e==="end")return this[$l]();if(e==="close"){if(this[Yr]=!0,!this[ft]&&!this[O])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[In]=n,super.emit($s,n);let o=!this[fn]||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}[ea](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}[$l](){return this[ft]?!1:(this[ft]=!0,this.readable=!1,this[Qe]?(hn(()=>this[ta]()),!0):this[ta]())}[ta](){if(this[Wi]){let i=this[Wi].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[Se]?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[$e])return i();let o,s,c=u=>{this.off("data",l),this.off("end",v),this.off(O,A),i(),s(u)},l=u=>{this.off("error",c),this.off("end",v),this.off(O,A),this.pause(),o({value:u,done:!!this[$e]})},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,I)=>{s=I,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[ie]=!1;let e=!1,i=()=>(this.pause(),this.off($s,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($s,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[B]=0;let i=this;return typeof i.close=="function"&&!this[Yr]&&i.close(),e?this.emit("error",e):this.emit(O),this}static get isStream(){return fu}};import*as t3 from"zlib";import Su from"zlib";var Yu=Su.constants||{ZLIB_VERNUM:4736},Ie=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},Yu));var Wu=Ht.concat,i3=Object.getOwnPropertyDescriptor(Ht,"concat"),Mu=t=>t,oa=i3?.writable===!0||i3?.set!==void 0?t=>{Ht.concat=t?Mu:Wu}:t=>{},Lt=Symbol("_superWrite"),Ci=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"}},sa=Symbol("flushFlag"),Rn=class extends dn{#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 t3[i]!="function")throw new TypeError("Compression method not supported: "+i);try{this.#t=new t3[i](e)}catch(n){throw new Ci(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 Ci(n))),this.once("end",()=>this.close)}close(){this.#t&&(this.#t.close(),this.#t=void 0,this.emit("close"))}reset(){if(!this.#e)return aa(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),{[sa]: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;aa(this.#t,"zlib binding closed");let r=this.#t._handle,o=r.close;r.close=()=>{};let s=this.#t.close;this.#t.close=()=>{},oa(!0);let c;try{let v=typeof e[sa]=="number"?e[sa]:this.#i;c=this.#t._processChunk(e,v),oa(!1)}catch(v){oa(!1),this.#o(new Ci(v,this.write))}finally{this.#t&&(this.#t._handle=r,r.close=o,this.#t.close=s,this.#t.removeAllListeners("error"))}this.#t&&this.#t.on("error",v=>this.#o(new Ci(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}},Ur=class extends Rn{#e;#n;constructor(e,i){e=e||{},e.flush=e.flush||Ie.Z_NO_FLUSH,e.finishFlush=e.finishFlush||Ie.Z_FINISH,e.fullFlushFlag=Ie.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(Ie.Z_SYNC_FLUSH),aa(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 Ur{#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 Vr=class extends Ur{constructor(e){super(e,"Unzip")}},Nr=class extends Rn{constructor(e,i){e=e||{},e.flush=e.flush||Ie.BROTLI_OPERATION_PROCESS,e.finishFlush=e.finishFlush||Ie.BROTLI_OPERATION_FINISH,e.fullFlushFlag=Ie.BROTLI_OPERATION_FLUSH,super(e,i)}},kr=class extends Nr{constructor(e){super(e,"BrotliCompress")}},Fr=class extends Nr{constructor(e){super(e,"BrotliDecompress")}},Qr=class extends Rn{constructor(e,i){e=e||{},e.flush=e.flush||Ie.ZSTD_e_continue,e.finishFlush=e.finishFlush||Ie.ZSTD_e_end,e.fullFlushFlag=Ie.ZSTD_e_flush,super(e,i)}},Jr=class extends Qr{constructor(e){super(e,"ZstdCompress")}},br=class extends Qr{constructor(e){super(e,"ZstdDecompress")}};import{posix as Oi}from"node:path";var n3=(t,e)=>{if(Number.isSafeInteger(t))t<0?Uu(t,e):Ou(t,e);else throw Error("cannot encode number outside of javascript safe integer range");return e},Ou=(t,e)=>{e[0]=128;for(var i=e.length;i>1;i--)e[i-1]=t&255,t=Math.floor(t/256)},Uu=(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]=o3(r):r===0?e[n-1]=0:(i=!0,e[n-1]=s3(r))}},r3=t=>{let e=t[0],i=e===128?Vu(t.subarray(1,t.length)):e===255?Ku(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},Ku=t=>{for(var e=t.length,i=0,n=!1,r=e-1;r>-1;r--){var o=Number(t[r]),s;n?s=o3(o):o===0?s=o:(n=!0,s=s3(o)),s!==0&&(i-=s*Math.pow(256,e-r-1))}return i},Vu=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},o3=t=>(255^t)&255,s3=t=>(255^t)+1&255;var Br=t=>Zr.has(t);var Zr=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"]]),a3=new Map(Array.from(Zr).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??ht(e,i+100,8),this.uid=n?.uid??r?.uid??ht(e,i+108,8),this.gid=n?.gid??r?.gid??ht(e,i+116,8),this.size=n?.size??r?.size??ht(e,i+124,12),this.mtime=n?.mtime??r?.mtime??ca(e,i+136,12),this.cksum=ht(e,i+148,12),r&&this.#n(r,!0),n&&this.#n(n);let o=_t(e,i+156,1);if(Br(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??ht(e,i+329,8)??0,this.devmin=n?.devmin??r?.devmin??ht(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??ca(e,i+476,12),this.ctime=n?.ctime??r?.ctime??ca(e,i+488,12)}let s=256;for(let c=i;c<i+148;c++)s+=e[c];for(let c=i+156;c<i+512;c++)s+=e[c];this.cksumValid=s===this.cksum,this.cksum===void 0&&s===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=ku(this.path||"",n),o=r[0],s=r[1];this.needPax=!!r[2],this.needPax=$t(e,i,100,o)||this.needPax,this.needPax=dt(e,i+100,8,this.mode)||this.needPax,this.needPax=dt(e,i+108,8,this.uid)||this.needPax,this.needPax=dt(e,i+116,8,this.gid)||this.needPax,this.needPax=dt(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=$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=dt(e,i+329,8,this.devmaj)||this.needPax,this.needPax=dt(e,i+337,8,this.devmin)||this.needPax,this.needPax=$t(e,i+345,n,s)||this.needPax,e[i+475]!==0?this.needPax=$t(e,i+345,155,s)||this.needPax:(this.needPax=$t(e,i+345,130,s)||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,dt(e,i+148,8,this.cksum),this.cksumValid=!0,this.needPax}get type(){return this.#e==="Unsupported"?this.#e:Zr.get(this.#e)}get typeKey(){return this.#e}set type(e){let i=String(a3.get(e));if(Br(i)||i==="Unsupported")this.#e=i;else if(Br(e))this.#e=e;else throw new TypeError("invalid entry type: "+e)}},ku=(t,e)=>{let n=t,r="",o,s=Oi.parse(t).root||".";if(Buffer.byteLength(n)<100)o=[n,r,!1];else{r=Oi.dirname(n),n=Oi.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=Oi.join(Oi.basename(r),n),r=Oi.dirname(r));while(r!==s&&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.*/,""),ca=(t,e,i)=>Fu(ht(t,e,i)),Fu=t=>t===void 0?void 0:new Date(t*1e3),ht=(t,e,i)=>Number(t[e])&128?r3(t.subarray(e,e+i)):Ju(t,e,i),Qu=t=>isNaN(t)?void 0:t,Ju=(t,e,i)=>Qu(parseInt(t.subarray(e,e+i).toString("utf8").replace(/\0.*$/,"").trim(),8)),bu={12:8589934591,8:2097151},dt=(t,e,i,n)=>n===void 0?!1:n>bu[i]||n<0?(n3(n,t.subarray(e,e+i)),!0):(Bu(t,e,i,n),!1),Bu=(t,e,i,n)=>t.write(Zu(n,i),e,i,"ascii"),Zu=(t,e)=>Pu(Math.floor(t).toString(8),e),Pu=(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:dt(t,e,i,n.getTime()/1e3),qu=new Array(156).join("\0"),$t=(t,e,i,n)=>n===void 0?!1:(t.write(n+qu,e,i,"utf8"),n.length!==Buffer.byteLength(n)||n.length>i);import{basename as yu}from"node:path";var Rt=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/"+yu(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),s=Math.floor(Math.log(o)/Math.log(10))+1;return o+s>=Math.pow(10,s)&&(s+=1),s+o+r}static parse(e,i,n=!1){return new t(Du(wu(e),i),n)}},Du=(t,e)=>e?Object.assign({},e,t):t,wu=t=>t.replace(/\n$/,"").split(`
19
- `).reduce(Tu,Object.create(null)),Tu=(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"),s=n.join("=");return t[o]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(o)?new Date(Number(s)*1e3):/^[0-9]+$/.test(s)?+s:s,t};import{EventEmitter as pa}from"node:events";import m3 from"node:stream";import{StringDecoder as Xu}from"node:string_decoder";var l3=typeof process=="object"&&process?process:{stdout:null,stderr:null},Hu=t=>!!t&&typeof t=="object"&&(t instanceof be||t instanceof m3||Lu(t)||_u(t)),Lu=t=>!!t&&typeof t=="object"&&t instanceof pa&&typeof t.pipe=="function"&&t.pipe!==m3.Writable.prototype.pipe,_u=t=>!!t&&typeof t=="object"&&t instanceof pa&&typeof t.write=="function"&&typeof t.end=="function",tt=Symbol("EOF"),it=Symbol("maybeEmitEnd"),zt=Symbol("emittedEnd"),Pr=Symbol("emittingEnd"),zn=Symbol("emittedError"),qr=Symbol("closed"),v3=Symbol("read"),yr=Symbol("flush"),A3=Symbol("flushChunk"),Ye=Symbol("encoding"),Ui=Symbol("decoder"),Z=Symbol("flowing"),jn=Symbol("paused"),Ki=Symbol("resume"),P=Symbol("buffer"),$=Symbol("pipes"),q=Symbol("bufferLength"),va=Symbol("bufferPush"),Dr=Symbol("bufferShift"),T=Symbol("objectMode"),U=Symbol("destroyed"),Aa=Symbol("error"),ua=Symbol("emitData"),u3=Symbol("emitEnd"),ma=Symbol("emitEnd2"),Je=Symbol("async"),Ea=Symbol("abort"),wr=Symbol("aborted"),gn=Symbol("signal"),ei=Symbol("dataListeners"),re=Symbol("discarded"),xn=t=>Promise.resolve().then(t),$u=t=>t(),em=t=>t==="end"||t==="finish"||t==="prefinish",tm=t=>t instanceof ArrayBuffer||!!t&&typeof t=="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0,im=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t),Tr=class{src;dest;opts;ondrain;constructor(e,i,n){this.src=e,this.dest=i,this.opts=n,this.ondrain=()=>e[Ki](),this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(e){}end(){this.unpipe(),this.opts.end&&this.dest.end()}},Ia=class extends Tr{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)}},nm=t=>!!t.objectMode,rm=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer",be=class extends pa{[Z]=!1;[jn]=!1;[$]=[];[P]=[];[T];[Ye];[Je];[Ui];[tt]=!1;[zt]=!1;[Pr]=!1;[qr]=!1;[zn]=null;[q]=0;[U]=!1;[gn];[wr]=!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");nm(i)?(this[T]=!0,this[Ye]=null):rm(i)?(this[Ye]=i.encoding,this[T]=!1):(this[T]=!1,this[Ye]=null),this[Je]=!!i.async,this[Ui]=this[Ye]?new Xu(this[Ye]):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[gn]=n,n.aborted?this[Ea]():n.addEventListener("abort",()=>this[Ea]()))}get bufferLength(){return this[q]}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[T]}set objectMode(e){throw new Error("objectMode must be set at instantiation time")}get async(){return this[Je]}set async(e){this[Je]=this[Je]||!!e}[Ea](){this[wr]=!0,this.emit("abort",this[gn]?.reason),this.destroy(this[gn]?.reason)}get aborted(){return this[wr]}set aborted(e){}write(e,i,n){if(this[wr])return!1;if(this[tt])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[Je]?xn:$u;if(!this[T]&&!Buffer.isBuffer(e)){if(im(e))e=Buffer.from(e.buffer,e.byteOffset,e.byteLength);else if(tm(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[Z]&&this[q]!==0&&this[yr](!0),this[Z]?this.emit("data",e):this[va](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[Z]):e.length?(typeof e=="string"&&!(i===this[Ye]&&!this[Ui]?.lastNeed)&&(e=Buffer.from(e,i)),Buffer.isBuffer(e)&&this[Ye]&&(e=this[Ui].write(e)),this[Z]&&this[q]!==0&&this[yr](!0),this[Z]?this.emit("data",e):this[va](e),this[q]!==0&&this.emit("readable"),n&&r(n),this[Z]):(this[q]!==0&&this.emit("readable"),n&&r(n),this[Z])}read(e){if(this[U])return null;if(this[re]=!1,this[q]===0||e===0||e&&e>this[q])return this[it](),null;this[T]&&(e=null),this[P].length>1&&!this[T]&&(this[P]=[this[Ye]?this[P].join(""):Buffer.concat(this[P],this[q])]);let i=this[v3](e||null,this[P][0]);return this[it](),i}[v3](e,i){if(this[T])this[Dr]();else{let n=i;e===n.length||e===null?this[Dr]():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[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[Z]||!this[jn])&&this[it](),this}[Ki](){this[U]||(!this[ei]&&!this[$].length&&(this[re]=!0),this[jn]=!1,this[Z]=!0,this.emit("resume"),this[P].length?this[yr]():this[tt]?this[it]():this.emit("drain"))}resume(){return this[Ki]()}pause(){this[Z]=!1,this[jn]=!0,this[re]=!1}get destroyed(){return this[U]}get flowing(){return this[Z]}get paused(){return this[jn]}[va](e){this[T]?this[q]+=1:this[q]+=e.length,this[P].push(e)}[Dr](){return this[T]?this[q]-=1:this[q]-=this[P][0].length,this[P].shift()}[yr](e=!1){do;while(this[A3](this[Dr]())&&this[P].length);!e&&!this[P].length&&!this[tt]&&this.emit("drain")}[A3](e){return this.emit("data",e),this[Z]}pipe(e,i){if(this[U])return e;this[re]=!1;let n=this[zt];return i=i||{},e===l3.stdout||e===l3.stderr?i.end=!1:i.end=i.end!==!1,i.proxyErrors=!!i.proxyErrors,n?i.end&&e.end():(this[$].push(i.proxyErrors?new Ia(this,e,i):new Tr(this,e,i)),this[Je]?xn(()=>this[Ki]()):this[Ki]()),e}unpipe(e){let i=this[$].find(n=>n.dest===e);i&&(this[$].length===1?(this[Z]&&this[ei]===0&&(this[Z]=!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[Z]&&this[Ki]();else if(e==="readable"&&this[q]!==0)super.emit("readable");else if(em(e)&&this[zt])super.emit(e),this.removeAllListeners(e);else if(e==="error"&&this[zn]){let r=i;this[Je]?xn(()=>r.call(this,this[zn])):r.call(this,this[zn])}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[Z]=!1)),n}removeAllListeners(e){let i=super.removeAllListeners(e);return(e==="data"||e===void 0)&&(this[ei]=0,!this[re]&&!this[$].length&&(this[Z]=!1)),i}get emittedEnd(){return this[zt]}[it](){!this[Pr]&&!this[zt]&&!this[U]&&this[P].length===0&&this[tt]&&(this[Pr]=!0,this.emit("end"),this.emit("prefinish"),this.emit("finish"),this[qr]&&this.emit("close"),this[Pr]=!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[Je]?(xn(()=>this[ua](n)),!0):this[ua](n);if(e==="end")return this[u3]();if(e==="close"){if(this[qr]=!0,!this[zt]&&!this[U])return!1;let o=super.emit("close");return this.removeAllListeners("close"),o}else if(e==="error"){this[zn]=n,super.emit(Aa,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}[ua](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}[u3](){return this[zt]?!1:(this[zt]=!0,this.readable=!1,this[Je]?(xn(()=>this[ma]()),!0):this[ma]())}[ma](){if(this[Ui]){let i=this[Ui].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[Ye]?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[tt])return i();let o,s,c=u=>{this.off("data",l),this.off("end",v),this.off(U,A),i(),s(u)},l=u=>{this.off("error",c),this.off("end",v),this.off(U,A),this.pause(),o({value:u,done:!!this[tt]})},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,I)=>{s=I,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[re]=!1;let e=!1,i=()=>(this.pause(),this.off(Aa,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(Aa,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[qr]&&i.close(),e?this.emit("error",e):this.emit(U),this}static get isStream(){return Hu}};var om=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,z=om!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");var Vi=class extends be{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=z(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?z(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=z(e.path)),e.linkpath&&(e.linkpath=z(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 am=1024*1024,za=Buffer.from([31,139]),ja=Buffer.from([40,181,47,253]),cm=Math.max(za.length,ja.length),pe=Symbol("state"),ii=Symbol("writeEntry"),nt=Symbol("readEntry"),fa=Symbol("nextEntry"),E3=Symbol("processEntry"),Be=Symbol("extendedHeader"),Gn=Symbol("globalExtendedHeader"),jt=Symbol("meta"),I3=Symbol("emitMeta"),x=Symbol("buffer"),rt=Symbol("queue"),gt=Symbol("ended"),ha=Symbol("emittedEnd"),ni=Symbol("emit"),K=Symbol("unzip"),Xr=Symbol("consumeChunk"),Hr=Symbol("consumeChunkSub"),da=Symbol("consumeBody"),p3=Symbol("consumeMeta"),f3=Symbol("consumeHeader"),Sn=Symbol("consuming"),Ra=Symbol("bufferConcat"),Lr=Symbol("maybeEnd"),Ni=Symbol("writing"),xt=Symbol("aborted"),_r=Symbol("onDone"),ri=Symbol("sawValidEntry"),$r=Symbol("sawNullBlock"),eo=Symbol("sawEOF"),h3=Symbol("closeStream"),lm=()=>!0,ot=class extends sm{file;strict;maxMetaEntrySize;filter;brotli;zstd;writable=!0;readable=!1;[rt]=[];[x];[nt];[ii];[pe]="begin";[jt]="";[Be];[Gn];[gt]=!1;[K];[xt]=!1;[ri];[$r]=!1;[eo]=!1;[Ni]=!1;[Sn]=!1;[ha]=!1;constructor(e={}){super(),this.file=e.file||"",this.on(_r,()=>{(this[pe]==="begin"||this[ri]===!1)&&this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}),e.ondone?this.on(_r,e.ondone):this.on(_r,()=>{this.emit("prefinish"),this.emit("finish"),this.emit("end")}),this.strict=!!e.strict,this.maxMetaEntrySize=e.maxMetaEntrySize||am,this.filter=typeof e.filter=="function"?e.filter:lm;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[h3]()),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)}[f3](e,i){this[ri]===void 0&&(this[ri]=!1);let n;try{n=new ne(e,i,this[Be],this[Gn])}catch(r){return this.warn("TAR_ENTRY_INVALID",r)}if(n.nullBlock)this[$r]?(this[eo]=!0,this[pe]==="begin"&&(this[pe]="header"),this[ni]("eof")):(this[$r]=!0,this[ni]("nullBlock"));else if(this[$r]=!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 Vi(n,this[Be],this[Gn]);if(!this[ri])if(o.remain){let s=()=>{o.invalid||(this[ri]=!0)};o.on("end",s)}else this[ri]=!0;o.meta?o.size>this.maxMetaEntrySize?(o.ignore=!0,this[ni]("ignoredEntry",o),this[pe]="ignore",o.resume()):o.size>0&&(this[jt]="",o.on("data",s=>this[jt]+=s),this[pe]="meta"):(this[Be]=void 0,o.ignore=o.ignore||!this.filter(o.path,o),o.ignore?(this[ni]("ignoredEntry",o),this[pe]=o.remain?"ignore":"header",o.resume()):(o.remain?this[pe]="body":(this[pe]="header",o.end()),this[nt]?this[rt].push(o):(this[rt].push(o),this[fa]())))}}}[h3](){queueMicrotask(()=>this.emit("close"))}[E3](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[fa]()),i=!1);return i}[fa](){do;while(this[E3](this[rt].shift()));if(!this[rt].length){let e=this[nt];!e||e.flowing||e.size===e.remain?this[Ni]||this.emit("drain"):e.once("drain",()=>this.emit("drain"))}}[da](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[pe]="header",this[ii]=void 0,n.end()),o.length}[p3](e,i){let n=this[ii],r=this[da](e,i);return!this[ii]&&n&&this[I3](n),r}[ni](e,i,n){!this[rt].length&&!this[nt]?this.emit(e,i,n):this[rt].push([e,i,n])}[I3](e){switch(this[ni]("meta",this[jt]),e.type){case"ExtendedHeader":case"OldExtendedHeader":this[Be]=Rt.parse(this[jt],this[Be],!1);break;case"GlobalExtendedHeader":this[Gn]=Rt.parse(this[jt],this[Gn],!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[xt]=!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[xt])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<cm)return this[x]=e,n?.(),!0;for(let l=0;this[K]===void 0&&l<za.length;l++)e[l]!==za[l]&&(this[K]=!1);let s=!1;if(this[K]===!1&&this.zstd!==!1){s=!0;for(let l=0;l<ja.length;l++)if(e[l]!==ja[l]){s=!1;break}}let c=this.brotli===void 0&&!s;if(this[K]===!1&&c)if(e.length<512)if(this[gt])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||s)){let l=this[gt];this[gt]=!1,this[K]=this[K]===void 0?new Vr({}):s?new br({}):new Fr({}),this[K].on("data",A=>this[Xr](A)),this[K].on("error",A=>this.abort(A)),this[K].on("end",()=>{this[gt]=!0,this[Xr]()}),this[Ni]=!0;let v=!!this[K][l?"end":"write"](e);return this[Ni]=!1,n?.(),v}}this[Ni]=!0,this[K]?this[K].write(e):this[Xr](e),this[Ni]=!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}[Ra](e){e&&!this[xt]&&(this[x]=this[x]?Buffer.concat([this[x],e]):e)}[Lr](){if(this[gt]&&!this[ha]&&!this[xt]&&!this[Sn]){this[ha]=!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](_r)}}[Xr](e){if(this[Sn]&&e)this[Ra](e);else if(!e&&!this[x])this[Lr]();else if(e){if(this[Sn]=!0,this[x]){this[Ra](e);let i=this[x];this[x]=void 0,this[Hr](i)}else this[Hr](e);for(;this[x]&&this[x]?.length>=512&&!this[xt]&&!this[eo];){let i=this[x];this[x]=void 0,this[Hr](i)}this[Sn]=!1}(!this[x]||this[gt])&&this[Lr]()}[Hr](e){let i=0,n=e.length;for(;i+512<=n&&!this[xt]&&!this[eo];)switch(this[pe]){case"begin":case"header":this[f3](e,i),i+=512;break;case"ignore":case"body":i+=this[da](e,i);break;case"meta":i+=this[p3](e,i);break;default:throw new Error("invalid state: "+this[pe])}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[xt]||(this[K]?(e&&this[K].write(e),this[K].end()):(this[gt]=!0,(this.brotli===void 0||this.zstd===void 0)&&(e=e||Buffer.alloc(0)),e&&this.write(e),this[Lr]())),this}};var Gt=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 um=t=>{let e=t.onReadEntry;t.onReadEntry=e?i=>{e(i),i.resume()}:i=>i.resume()},ga=(t,e)=>{let i=new Map(e.map(o=>[Gt(o),!0])),n=t.filter,r=(o,s="")=>{let c=s||Am(o).root||".",l;if(o===c)l=!1;else{let v=i.get(o);v!==void 0?l=v:l=r(vm(o),c)}return i.set(o,l),l};t.filter=n?(o,s)=>n(o,s)&&r(Gt(o)):o=>r(Gt(o))},mm=t=>{let e=new ot(t),i=t.file,n;try{n=ki.openSync(i,"r");let r=ki.fstatSync(n),o=t.maxReadSize||16*1024*1024;if(r.size<o){let s=Buffer.allocUnsafe(r.size),c=ki.readSync(n,s,0,r.size,0);e.end(c===s.byteLength?s:s.subarray(0,c))}else{let s=0,c=Buffer.allocUnsafe(o);for(;s<r.size;){let l=ki.readSync(n,c,0,o,s);if(l===0)break;s+=l,e.write(c.subarray(0,l))}e.end()}}finally{if(typeof n=="number")try{ki.closeSync(n)}catch{}}},Em=(t,e)=>{let i=new ot(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((s,c)=>{i.on("error",c),i.on("end",s),ki.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(mm,Em,t=>new ot(t),t=>new ot(t),(t,e)=>{e?.length&&ga(t,e),t.noResume||um(t)});import mo from"fs";import Ze from"fs";import j3 from"path";var xa=(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 Im}from"node:path";var{isAbsolute:pm,parse:d3}=Im,Yn=t=>{let e="",i=d3(t);for(;pm(t)||i.root;){let n=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(n.length),e+=n,i=d3(t)}return[e,t]};var to=["|","<",">","?",":"],Ga=to.map(t=>String.fromCharCode(61440+t.charCodeAt(0))),fm=new Map(to.map((t,e)=>[t,Ga[e]])),hm=new Map(Ga.map((t,e)=>[t,to[e]])),Sa=t=>to.reduce((e,i)=>e.split(i).join(fm.get(i)),t),R3=t=>Ga.reduce((e,i)=>e.split(i).join(hm.get(i)),t);var Y3=(t,e)=>e?(t=z(t).replace(/^\.(\/|$)/,""),Gt(e)+"/"+t):z(t),dm=16*1024*1024,g3=Symbol("process"),x3=Symbol("file"),G3=Symbol("directory"),Wa=Symbol("symlink"),S3=Symbol("hardlink"),Wn=Symbol("header"),io=Symbol("read"),Ma=Symbol("lstat"),no=Symbol("onlstat"),Ca=Symbol("onread"),Oa=Symbol("onreadlink"),Ua=Symbol("openfile"),Ka=Symbol("onopenfile"),St=Symbol("close"),ro=Symbol("mode"),Va=Symbol("awaitDrain"),Ya=Symbol("ondrain"),Pe=Symbol("prefix"),Mn=class extends be{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=En(i);super(),this.path=z(e),this.portable=!!n.portable,this.maxReadSize=n.maxReadSize||dm,this.linkCache=n.linkCache||new Map,this.statCache=n.statCache||new Map,this.preservePaths=!!n.preservePaths,this.cwd=z(n.cwd||process.cwd()),this.strict=!!n.strict,this.noPax=!!n.noPax,this.noMtime=!!n.noMtime,this.mtime=n.mtime,this.prefix=n.prefix?z(n.prefix):void 0,this.onWriteEntry=n.onWriteEntry,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let r=!1;if(!this.preservePaths){let[s,c]=Yn(this.path);s&&typeof c=="string"&&(this.path=c,r=s)}this.win32=!!n.win32||process.platform==="win32",this.win32&&(this.path=R3(this.path.replace(/\\/g,"/")),e=e.replace(/\\/g,"/")),this.absolute=z(n.absolute||j3.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[no](o):this[Ma]()}warn(e,i,n={}){return ti(this,e,i,n)}emit(e,...i){return e==="error"&&(this.#e=!0),super.emit(e,...i)}[Ma](){Ze.lstat(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[no](i)})}[no](e){this.statCache.set(this.absolute,e),this.stat=e,e.isFile()||(e.size=0),this.type=Rm(e),this.emit("stat",e),this[g3]()}[g3](){switch(this.type){case"File":return this[x3]();case"Directory":return this[G3]();case"SymbolicLink":return this[Wa]();default:return this.end()}}[ro](e){return xa(e,this.type==="Directory",this.portable)}[Pe](e){return Y3(e,this.prefix)}[Wn](){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[ro](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 Rt({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)}[G3](){if(!this.stat)throw new Error("cannot create directory entry without stat");this.path.slice(-1)!=="/"&&(this.path+="/"),this.stat.size=0,this[Wn](),this.end()}[Wa](){Ze.readlink(this.absolute,(e,i)=>{if(e)return this.emit("error",e);this[Oa](i)})}[Oa](e){this.linkpath=z(e),this[Wn](),this.end()}[S3](e){if(!this.stat)throw new Error("cannot create link entry without stat");this.type="Link",this.linkpath=z(j3.relative(this.cwd,e)),this.stat.size=0,this[Wn](),this.end()}[x3](){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[S3](i);this.linkCache.set(e,this.absolute)}if(this[Wn](),this.stat.size===0)return this.end();this[Ua]()}[Ua](){Ze.open(this.absolute,"r",(e,i)=>{if(e)return this.emit("error",e);this[Ka](i)})}[Ka](e){if(this.fd=e,this.#e)return this[St]();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[io]()}[io](){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,(s,c)=>{if(s)return this[St](()=>this.emit("error",s));this[Ca](c)})}[St](e=()=>{}){this.fd!==void 0&&Ze.close(this.fd,e)}[Ca](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[St](()=>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[St](()=>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[Ya]():this[Va](()=>this[Ya]())}[Va](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)}[Ya](){if(!this.remain)return this.blockRemain&&super.write(Buffer.alloc(this.blockRemain)),this[St](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[io]()}},oo=class extends Mn{sync=!0;[Ma](){this[no](Ze.lstatSync(this.absolute))}[Wa](){this[Oa](Ze.readlinkSync(this.absolute))}[Ua](){this[Ka](Ze.openSync(this.absolute,"r"))}[io](){let e=!0;try{let{fd:i,buf:n,offset:r,length:o,pos:s}=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,s);this[Ca](c),e=!1}finally{if(e)try{this[St](()=>{})}catch{}}}[Va](e){e()}[St](e=()=>{}){this.fd!==void 0&&Ze.closeSync(this.fd),e()}},so=class extends be{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=En(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=z(e.path),this.mode=e.mode!==void 0?this[ro](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?z(e.linkpath):void 0,typeof n.onwarn=="function"&&this.on("warn",n.onwarn);let o=!1;if(!this.preservePaths){let[c,l]=Yn(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 Rt({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 s=this.header?.block;if(!s)throw new Error("failed to encode header");super.write(s),e.pipe(this)}[Pe](e){return Y3(e,this.prefix)}[ro](e){return xa(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}},Rm=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";var ao=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++)jm(this,e[i]);return this.length}unshift(...e){for(var i=0,n=e.length;i<n;i++)gm(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 s=0;r&&s<e;s++)r=r.next;let o=[];for(let s=0;r&&s<i;s++)o.push(r.value),r=this.removeNode(r);r?r!==this.tail&&(r=r.prev):r=this.tail;for(let s of n)r=zm(this,r,s);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 zm(t,e,i){let n=e,r=e?e.next:t.head,o=new Cn(i,n,r,t);return o.next===void 0&&(t.tail=o),o.prev===void 0&&(t.head=o),t.length++,o}function jm(t,e){t.tail=new Cn(e,t.tail,void 0,t),t.head||(t.head=t.tail),t.length++}function gm(t,e){t.head=new Cn(e,void 0,t.head,t),t.tail||(t.tail=t.head),t.length++}var Cn=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 U3 from"path";var Eo=class{path;absolute;entry;stat;readdir;pending=!1;ignore=!1;piped=!1;constructor(e,i){this.path=e||"./",this.absolute=i}},W3=Buffer.alloc(1024),co=Symbol("onStat"),On=Symbol("ended"),We=Symbol("queue"),Fi=Symbol("current"),si=Symbol("process"),Un=Symbol("processing"),M3=Symbol("processJob"),Me=Symbol("jobs"),Na=Symbol("jobDone"),lo=Symbol("addFSEntry"),C3=Symbol("addTarEntry"),Qa=Symbol("stat"),Ja=Symbol("readdir"),vo=Symbol("onreaddir"),Ao=Symbol("pipe"),O3=Symbol("entry"),ka=Symbol("entryOpt"),uo=Symbol("writeEntryClass"),K3=Symbol("write"),Fa=Symbol("ondrain"),Yt=class extends be{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[uo];onWriteEntry;[We];[Me]=0;[Un]=!1;[On]=!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=z(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[uo]=Mn,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 kr(e.brotli)),e.zstd&&(typeof e.zstd!="object"&&(e.zstd={}),this.zip=new Jr(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[Fa]()),this.on("resume",()=>i.resume())}else this.on("drain",this[Fa]);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 ao,this[Me]=0,this.jobs=Number(e.jobs)||4,this[Un]=!1,this[On]=!1}[K3](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[On]=!0,this[si](),n&&n(),this}write(e){if(this[On])throw new Error("write after end");return e instanceof Vi?this[C3](e):this[lo](e),this.flowing}[C3](e){let i=z(U3.resolve(this.cwd,e.path));if(!this.filter(e.path,e))e.resume();else{let n=new Eo(e.path,i);n.entry=new so(e,this[ka](n)),n.entry.on("end",()=>this[Na](n)),this[Me]+=1,this[We].push(n)}this[si]()}[lo](e){let i=z(U3.resolve(this.cwd,e));this[We].push(new Eo(e,i)),this[si]()}[Qa](e){e.pending=!0,this[Me]+=1;let i=this.follow?"stat":"lstat";mo[i](e.absolute,(n,r)=>{e.pending=!1,this[Me]-=1,n?this.emit("error",n):this[co](e,r)})}[co](e,i){this.statCache.set(e.absolute,i),e.stat=i,this.filter(e.path,i)||(e.ignore=!0),this[si]()}[Ja](e){e.pending=!0,this[Me]+=1,mo.readdir(e.absolute,(i,n)=>{if(e.pending=!1,this[Me]-=1,i)return this.emit("error",i);this[vo](e,n)})}[vo](e,i){this.readdirCache.set(e.absolute,i),e.readdir=i,this[si]()}[si](){if(!this[Un]){this[Un]=!0;for(let e=this[We].head;e&&this[Me]<this.jobs;e=e.next)if(this[M3](e.value),e.value.ignore){let i=e.next;this[We].removeNode(e),e.next=i}this[Un]=!1,this[On]&&!this[We].length&&this[Me]===0&&(this.zip?this.zip.end(W3):(super.write(W3),super.end()))}}get[Fi](){return this[We]&&this[We].head&&this[We].head.value}[Na](e){this[We].shift(),this[Me]-=1,this[si]()}[M3](e){if(!e.pending){if(e.entry){e===this[Fi]&&!e.piped&&this[Ao](e);return}if(!e.stat){let i=this.statCache.get(e.absolute);i?this[co](e,i):this[Qa](e)}if(e.stat&&!e.ignore){if(!this.noDirRecurse&&e.stat.isDirectory()&&!e.readdir){let i=this.readdirCache.get(e.absolute);if(i?this[vo](e,i):this[Ja](e),!e.readdir)return}if(e.entry=this[O3](e),!e.entry){e.ignore=!0;return}e===this[Fi]&&!e.piped&&this[Ao](e)}}}[ka](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}}[O3](e){this[Me]+=1;try{return new this[uo](e.path,this[ka](e)).on("end",()=>this[Na](e)).on("error",n=>this.emit("error",n))}catch(i){this.emit("error",i)}}[Fa](){this[Fi]&&this[Fi].entry&&this[Fi].entry.resume()}[Ao](e){e.piped=!0,e.readdir&&e.readdir.forEach(r=>{let o=e.path,s=o==="./"?"":o.replace(/\/*$/,"/");this[lo](s+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 Yt{sync=!0;constructor(e){super(e),this[uo]=oo}pause(){}resume(){}[Qa](e){let i=this.follow?"statSync":"lstatSync";this[co](e,mo[i](e.absolute))}[Ja](e){this[vo](e,mo.readdirSync(e.absolute))}[Ao](e){let i=e.entry,n=this.zip;if(e.readdir&&e.readdir.forEach(r=>{let o=e.path,s=o==="./"?"":o.replace(/\/*$/,"/");this[lo](s+r)}),!i)throw new Error("Cannot pipe without source");n?i.on("data",r=>{n.write(r)}):i.on("data",r=>{super[K3](r)})}};var xm=(t,e)=>{let i=new ai(t),n=new Yi(t.file,{mode:t.mode||438});i.pipe(n),N3(i,e)},Gm=(t,e)=>{let i=new Yt(t),n=new _e(t.file,{mode:t.mode||438});i.pipe(n);let r=new Promise((o,s)=>{n.on("error",s),n.on("close",o),i.on("error",s)});return k3(i,e),r},N3=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?oi({file:V3.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},k3=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await oi({file:V3.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>{t.add(r)}}):t.add(n)}t.end()},Sm=(t,e)=>{let i=new ai(t);return N3(i,e),i},Ym=(t,e)=>{let i=new Yt(t);return k3(i,e),i},Wm=Fe(xm,Gm,Sm,Ym,(t,e)=>{if(!e?.length)throw new TypeError("no paths specified to add to archive")});import ev from"node:fs";import ym from"node:assert";import{randomBytes as $3}from"node:crypto";import j from"node:fs";import st from"node:path";import F3 from"fs";var Mm=process.env.__FAKE_PLATFORM__||process.platform,Cm=Mm==="win32",{O_CREAT:Om,O_TRUNC:Um,O_WRONLY:Km}=F3.constants,Q3=Number(process.env.__FAKE_FS_O_FILENAME__)||F3.constants.UV_FS_O_FILEMAP||0,Vm=Cm&&!!Q3,Nm=512*1024,km=Q3|Um|Om|Km,ba=Vm?t=>t<Nm?km:"w":()=>"w";import po from"node:fs";import Kn from"node:path";var Ba=(t,e,i)=>{try{return po.lchownSync(t,e,i)}catch(n){if(n?.code!=="ENOENT")throw n}},Io=(t,e,i,n)=>{po.lchown(t,e,i,r=>{n(r&&r?.code!=="ENOENT"?r:null)})},Fm=(t,e,i,n,r)=>{if(e.isDirectory())Za(Kn.resolve(t,e.name),i,n,o=>{if(o)return r(o);let s=Kn.resolve(t,e.name);Io(s,i,n,r)});else{let o=Kn.resolve(t,e.name);Io(o,i,n,r)}},Za=(t,e,i,n)=>{po.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 Io(t,e,i,n);let s=o.length,c=null,l=v=>{if(!c){if(v)return n(c=v);if(--s===0)return Io(t,e,i,n)}};for(let v of o)Fm(t,v,e,i,l)})},Qm=(t,e,i,n)=>{e.isDirectory()&&Pa(Kn.resolve(t,e.name),i,n),Ba(Kn.resolve(t,e.name),i,n)},Pa=(t,e,i)=>{let n;try{n=po.readdirSync(t,{withFileTypes:!0})}catch(r){let o=r;if(o?.code==="ENOENT")return;if(o?.code==="ENOTDIR"||o?.code==="ENOTSUP")return Ba(t,e,i);throw o}for(let r of n)Qm(t,r,e,i);return Ba(t,e,i)};import oe from"node:fs";import Jm from"node:fs/promises";import fo from"node:path";var Vn=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 Nn=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 bm=(t,e)=>{oe.stat(t,(i,n)=>{(i||!n.isDirectory())&&(i=new Vn(t,i?.code||"ENOTDIR")),e(i)})},J3=(t,e,i)=>{t=z(t);let n=e.umask??18,r=e.mode|448,o=(r&n)!==0,s=e.uid,c=e.gid,l=typeof s=="number"&&typeof c=="number"&&(s!==e.processUid||c!==e.processGid),v=e.preserve,A=e.unlink,u=z(e.cwd),I=(R,h)=>{R?i(R):h&&l?Za(h,s,c,H=>I(H)):o?oe.chmod(t,r,i):i()};if(t===u)return bm(t,I);if(v)return Jm.mkdir(t,{mode:r,recursive:!0}).then(R=>I(null,R??void 0),I);let f=z(fo.relative(u,t)).split("/");qa(u,f,r,A,u,void 0,I)},qa=(t,e,i,n,r,o,s)=>{if(!e.length)return s(null,o);let c=e.shift(),l=z(fo.resolve(t+"/"+c));oe.mkdir(l,i,b3(l,e,i,n,r,o,s))},b3=(t,e,i,n,r,o,s)=>c=>{c?oe.lstat(t,(l,v)=>{if(l)l.path=l.path&&z(l.path),s(l);else if(v.isDirectory())qa(t,e,i,n,r,o,s);else if(n)oe.unlink(t,A=>{if(A)return s(A);oe.mkdir(t,i,b3(t,e,i,n,r,o,s))});else{if(v.isSymbolicLink())return s(new Nn(t,t+"/"+e.join("/")));s(c)}}):(o=o||t,qa(t,e,i,n,r,o,s))},Bm=t=>{let e=!1,i;try{e=oe.statSync(t).isDirectory()}catch(n){i=n?.code}finally{if(!e)throw new Vn(t,i??"ENOTDIR")}},B3=(t,e)=>{t=z(t);let i=e.umask??18,n=e.mode|448,r=(n&i)!==0,o=e.uid,s=e.gid,c=typeof o=="number"&&typeof s=="number"&&(o!==e.processUid||s!==e.processGid),l=e.preserve,v=e.unlink,A=z(e.cwd),u=R=>{R&&c&&Pa(R,o,s),r&&oe.chmodSync(t,n)};if(t===A)return Bm(A),u();if(l)return u(oe.mkdirSync(t,{mode:n,recursive:!0})??void 0);let E=z(fo.relative(A,t)).split("/"),f;for(let R=E.shift(),h=A;R&&(h+="/"+R);R=E.shift()){h=z(fo.resolve(h));try{oe.mkdirSync(h,n),f=f||h}catch{let ve=oe.lstatSync(h);if(ve.isDirectory())continue;if(v){oe.unlinkSync(h),oe.mkdirSync(h,n),f=f||h;continue}else if(ve.isSymbolicLink())return new Nn(h,h+"/"+E.join("/"))}}return u(f)};import{join as q3}from"node:path";var ya=Object.create(null),Z3=1e4,Qi=new Set,P3=t=>{Qi.has(t)?Qi.delete(t):ya[t]=t.normalize("NFD"),Qi.add(t);let e=ya[t],i=Qi.size-Z3;if(i>Z3/10){for(let n of Qi)if(Qi.delete(n),delete ya[n],--i<=0)break}return e};var Zm=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,Pm=Zm==="win32",qm=t=>t.split("/").slice(0,-1).reduce((i,n)=>{let r=i[i.length-1];return r!==void 0&&(n=q3(r,n)),i.push(n||"/"),i},[]),ho=class{#e=new Map;#n=new Map;#i=new Set;reserve(e,i){e=Pm?["win32 parallelization disabled"]:e.map(r=>Gt(q3(P3(r))).toLowerCase());let n=new Set(e.map(r=>qm(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 s=o[o.length-1];s instanceof Set?s.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 s of n){let c=this.#e.get(s);if(!c||c?.[0]!==e)continue;let l=c[1];if(!l){this.#e.delete(s);continue}if(c.shift(),typeof l=="function")o.add(l);else for(let v of l)o.add(v)}for(let s of r){let c=this.#e.get(s),l=c?.[0];if(!(!c||!(l instanceof Set)))if(l.size===1&&c.length===1){this.#e.delete(s);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(s=>this.#a(s)),!0}};var y3=Symbol("onEntry"),Ta=Symbol("checkFs"),D3=Symbol("checkFs2"),Xa=Symbol("isReusable"),fe=Symbol("makeFs"),Ha=Symbol("file"),La=Symbol("directory"),jo=Symbol("link"),w3=Symbol("symlink"),T3=Symbol("hardlink"),X3=Symbol("unsupported"),H3=Symbol("checkPath"),Wt=Symbol("mkdir"),X=Symbol("onError"),Ro=Symbol("pending"),L3=Symbol("pend"),Ji=Symbol("unpend"),Da=Symbol("ended"),wa=Symbol("maybeClose"),_a=Symbol("skip"),kn=Symbol("doChown"),Fn=Symbol("uid"),Qn=Symbol("gid"),Jn=Symbol("checkedCwd"),Dm=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform,bn=Dm==="win32",wm=1024,Tm=(t,e)=>{if(!bn)return j.unlink(t,e);let i=t+".DELETE."+$3(16).toString("hex");j.rename(t,i,n=>{if(n)return e(n);j.unlink(i,e)})},Xm=t=>{if(!bn)return j.unlinkSync(t);let e=t+".DELETE."+$3(16).toString("hex");j.renameSync(t,e),j.unlinkSync(e)},_3=(t,e,i)=>t!==void 0&&t===t>>>0?t:e!==void 0&&e===e>>>0?e:i,bi=class extends ot{[Da]=!1;[Jn]=!1;[Ro]=0;reservations=new ho;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[Da]=!0,this[wa]()},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:wm,this.forceChown=e.forceChown===!0,this.win32=!!e.win32||bn,this.newer=!!e.newer,this.keep=!!e.keep,this.noMtime=!!e.noMtime,this.preservePaths=!!e.preservePaths,this.unlink=!!e.unlink,this.cwd=z(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[y3](i))}warn(e,i,n={}){return(e==="TAR_BAD_ARCHIVE"||e==="TAR_ABORT")&&(n.recoverable=!1),super.warn(e,i,n)}[wa](){this[Da]&&this[Ro]===0&&(this.emit("prefinish"),this.emit("finish"),this.emit("end"))}[H3](e){let i=z(e.path),n=i.split("/");if(this.strip){if(n.length<this.strip)return!1;if(e.type==="Link"){let r=z(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("..")||bn&&/^[a-z]:\.\.$/i.test(n[0]??""))return this.warn("TAR_ENTRY_ERROR","path contains '..'",{entry:e,path:i}),!1;let[r,o]=Yn(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=z(st.resolve(e.path)):e.absolute=z(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:z(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+Sa(String(e.absolute).slice(r.length));let{root:o}=st.win32.parse(e.path);e.path=o+Sa(e.path.slice(o.length))}return!0}[y3](e){if(!this[H3](e))return e.resume();switch(ym.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[Ta](e);default:return this[X3](e)}}[X](e,i){e.name==="CwdError"?this.emit("error",e):(this.warn("TAR_ENTRY_ERROR",e,{entry:i}),this[Ji](),i.resume())}[Wt](e,i,n){J3(z(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)}[kn](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}[Fn](e){return _3(this.uid,e.uid,this.processUid)}[Qn](e){return _3(this.gid,e.gid,this.processGid)}[Ha](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.fmode,r=new _e(String(e.absolute),{flags:ba(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,s=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[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;j.futimes(v,A,u,I=>I?j.utimes(l,A,u,E=>s(E&&I)):s())}if(typeof v=="number"&&this[kn](e)){o++;let A=this[Fn](e),u=this[Qn](e);typeof A=="number"&&typeof u=="number"&&j.fchown(v,A,u,I=>I?j.chown(l,A,u,E=>s(E&&I)):s())}s()});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)}[La](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode;this[Wt](String(e.absolute),n,r=>{if(r){this[X](r,e),i();return}let o=1,s=()=>{--o===0&&(i(),this[Ji](),e.resume())};e.mtime&&!this.noMtime&&(o++,j.utimes(String(e.absolute),e.atime||new Date,e.mtime,s)),this[kn](e)&&(o++,j.chown(String(e.absolute),Number(this[Fn](e)),Number(this[Qn](e)),s)),s()})}[X3](e){e.unsupported=!0,this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${e.type}`,{entry:e}),e.resume()}[w3](e,i){this[jo](e,String(e.linkpath),"symlink",i)}[T3](e,i){let n=z(st.resolve(this.cwd,String(e.linkpath)));this[jo](e,n,"link",i)}[L3](){this[Ro]++}[Ji](){this[Ro]--,this[wa]()}[_a](e){this[Ji](),e.resume()}[Xa](e,i){return e.type==="File"&&!this.unlink&&i.isFile()&&i.nlink<=1&&!bn}[Ta](e){this[L3]();let i=[e.path];e.linkpath&&i.push(e.linkpath),this.reservations.reserve(i,n=>this[D3](e,n))}[D3](e,i){let n=c=>{i(c)},r=()=>{this[Wt](this.cwd,this.dmode,c=>{if(c){this[X](c,e),n();return}this[Jn]=!0,o()})},o=()=>{if(e.absolute!==this.cwd){let c=z(st.dirname(String(e.absolute)));if(c!==this.cwd)return this[Wt](c,this.dmode,l=>{if(l){this[X](l,e),n();return}s()})}s()},s=()=>{j.lstat(String(e.absolute),(c,l)=>{if(l&&(this.keep||this.newer&&l.mtime>(e.mtime??l.mtime))){this[_a](e),n();return}if(c||this[Xa](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?j.chmod(String(e.absolute),Number(e.mode),A):A()}if(e.absolute!==this.cwd)return j.rmdir(String(e.absolute),v=>this[fe](v??null,e,n))}if(e.absolute===this.cwd)return this[fe](null,e,n);Tm(String(e.absolute),v=>this[fe](v??null,e,n))})};this[Jn]?o():r()}[fe](e,i,n){if(e){this[X](e,i),n();return}switch(i.type){case"File":case"OldFile":case"ContiguousFile":return this[Ha](i,n);case"Link":return this[T3](i,n);case"SymbolicLink":return this[w3](i,n);case"Directory":case"GNUDumpDir":return this[La](i,n)}}[jo](e,i,n,r){j[n](i,String(e.absolute),o=>{o?this[X](o,e):(this[Ji](),e.resume()),r()})}},zo=t=>{try{return[null,t()]}catch(e){return[e,null]}},Bn=class extends bi{sync=!0;[fe](e,i){return super[fe](e,i,()=>{})}[Ta](e){if(!this[Jn]){let o=this[Wt](this.cwd,this.dmode);if(o)return this[X](o,e);this[Jn]=!0}if(e.absolute!==this.cwd){let o=z(st.dirname(String(e.absolute)));if(o!==this.cwd){let s=this[Wt](o,this.dmode);if(s)return this[X](s,e)}}let[i,n]=zo(()=>j.lstatSync(String(e.absolute)));if(n&&(this.keep||this.newer&&n.mtime>(e.mtime??n.mtime)))return this[_a](e);if(i||this[Xa](e,n))return this[fe](null,e);if(n.isDirectory()){if(e.type==="Directory"){let s=this.chmod&&e.mode&&(n.mode&4095)!==e.mode,[c]=s?zo(()=>{j.chmodSync(String(e.absolute),Number(e.mode))}):[];return this[fe](c,e)}let[o]=zo(()=>j.rmdirSync(String(e.absolute)));this[fe](o,e)}let[r]=e.absolute===this.cwd?[]:zo(()=>Xm(String(e.absolute)));this[fe](r,e)}[Ha](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),ba(e.size),n)}catch(c){return r(c)}let s=this.transform&&this.transform(e)||e;s!==e&&(s.on("error",c=>this[X](c,e)),e.pipe(s)),s.on("data",c=>{try{j.writeSync(o,c,0,c.length)}catch(l){r(l)}}),s.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[kn](e)){let l=this[Fn](e),v=this[Qn](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)})}[La](e,i){let n=typeof e.mode=="number"?e.mode&4095:this.dmode,r=this[Wt](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[kn](e))try{j.chownSync(String(e.absolute),Number(this[Fn](e)),Number(this[Qn](e)))}catch{}i(),e.resume()}[Wt](e,i){try{return B3(z(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}}[jo](e,i,n,r){let o=`${n}Sync`;try{j[o](i,String(e.absolute)),r(),e.resume()}catch(s){return this[X](s,e)}}};var Hm=t=>{let e=new Bn(t),i=t.file,n=ev.statSync(i),r=t.maxReadSize||16*1024*1024;new Gr(i,{readSize:r,size:n.size}).pipe(e)},Lm=(t,e)=>{let i=new bi(t),n=t.maxReadSize||16*1024*1024,r=t.file;return new Promise((s,c)=>{i.on("error",c),i.on("close",s),ev.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)}})})},$a=Fe(Hm,Lm,t=>new Bn(t),t=>new bi(t),(t,e)=>{e?.length&&ga(t,e)});import se from"node:fs";import tv from"node:path";var _m=(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 s=se.fstatSync(r),c=Buffer.alloc(512);e:for(o=0;o<s.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>s.size)break;o+=v,t.mtimeCache&&l.mtime&&t.mtimeCache.set(String(l.path),l.mtime)}n=!1,$m(t,i,o,r,e)}finally{if(n)try{se.closeSync(r)}catch{}}},$m=(t,e,i,n,r)=>{let o=new Yi(t.file,{fd:n,start:i});e.pipe(o),tE(e,r)},eE=(t,e)=>{e=Array.from(e);let i=new Yt(t),n=(o,s,c)=>{let l=(E,f)=>{E?se.close(o,R=>c(E)):c(null,f)},v=0;if(s===0)return l(null,0);let A=0,u=Buffer.alloc(512),I=(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,I);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 R=new ne(u);if(!R.cksumValid)return l(null,v);let h=512*Math.ceil((R.size??0)/512);if(v+h+512>s||(v+=h+512,v>=s))return l(null,v);t.mtimeCache&&R.mtime&&t.mtimeCache.set(String(R.path),R.mtime),A=0,se.read(o,u,0,512,v,I)};se.read(o,u,0,512,v,I)};return new Promise((o,s)=>{i.on("error",s);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 s(v);se.fstat(A,(u,I)=>{if(u)return se.close(A,()=>s(u));n(A,I.size,(E,f)=>{if(E)return s(E);let R=new _e(t.file,{fd:A,start:f});i.pipe(R),R.on("error",s),R.on("close",o),iE(i,e)})})};se.open(t.file,c,l)})},tE=(t,e)=>{e.forEach(i=>{i.charAt(0)==="@"?oi({file:tv.resolve(t.cwd,i.slice(1)),sync:!0,noResume:!0,onReadEntry:n=>t.add(n)}):t.add(i)}),t.end()},iE=async(t,e)=>{for(let i=0;i<e.length;i++){let n=String(e[i]);n.charAt(0)==="@"?await oi({file:tv.resolve(String(t.cwd),n.slice(1)),noResume:!0,onReadEntry:r=>t.add(r)}):t.add(n)}t.end()},ci=Fe(_m,eE,()=>{throw new TypeError("file is required")},()=>{throw new TypeError("file is required")},(t,e)=>{if(!Xl(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 nE=Fe(ci.syncFile,ci.asyncFile,ci.syncNoFile,ci.asyncNoFile,(t,e=[])=>{ci.validate?.(t,e),rE(t)}),rE=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 Bi(t){let{source:e,destination:i,strip:n=1,filter:r}=t,o=[];if(!iv(e))return{success:!1,extractedFiles:[],error:`Source file not found: ${e}`};iv(i)||aE(i,{recursive:!0});try{return await cE(sE(e),lE(),$a({cwd:i,strip:n,filter:s=>r&&!r(s)?!1:(o.push(s),!0)})),{success:!0,extractedFiles:o}}catch(s){return{success:!1,extractedFiles:o,error:s instanceof Error?s.message:String(s)}}}import{existsSync as nv,readFileSync as vE,writeFileSync as AE,mkdirSync as uE}from"fs";import{dirname as mE}from"path";function Mt(t){let e=Vs(t);if(!nv(e))return null;try{let i=vE(e,"utf-8");return JSON.parse(i)}catch{return null}}function go(t,e){let i=Vs(e),n=mE(i);nv(n)||uE(n,{recursive:!0}),AE(i,JSON.stringify(t,null,2))}function rv(t,e,i){return{name:"gemkit",version:t,installedAt:new Date().toISOString(),scope:e,installedFiles:i,customizedFiles:[]}}function ov(t){return Mt(t)!==null}var p=_n(cv(),1),fE=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`},Zn=t=>e=>p.default.isColorSupported?`${fE(t)}${e}\x1B[39m`:e,a={primary:Zn("#4f46e5"),secondary:Zn("#9333ea"),accent:Zn("#06b6d4"),geminiBlue:Zn("#1a73e8"),geminiPurple:Zn("#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 a.success("\u25CF");case"completed":return a.dim("\u25CB");case"failed":return a.error("\u2717");default:return"?"}},checkIcon:(t,e=!1)=>t?a.success("\u2713"):e?a.warn("\u25CB"):a.error("\u2717"),header:t=>p.default.bold(a.geminiPurple(t)),section:(t,e=60)=>{console.log(),console.log("\u2500".repeat(e)),console.log(p.default.bold(a.geminiPurple(t))),console.log("\u2500".repeat(e)),console.log()}};var fz={success:a.success,error:a.error,warning:a.warn,info:a.info,dim:a.dim,primary:a.primary,secondary:a.secondary,bold:p.default.bold};var lv={debug:0,info:1,warn:2,error:3,silent:4},he={level:"info",verbose:!1,json:!1};function So(t){he={...he,...t}}function Pn(t){return lv[t]>=lv[he.level]}function hE(t,e){Pn("debug")&&(he.json?console.log(JSON.stringify({level:"debug",message:t,data:e})):(console.log(a.dim(`[DEBUG] ${t}`)),e&&he.verbose&&console.log(a.dim(JSON.stringify(e,null,2)))))}function dE(t,e){Pn("info")&&(he.json?console.log(JSON.stringify({level:"info",message:t,data:e})):(console.log(`${a.info("\u2139")} ${t}`),e&&he.verbose&&console.log(JSON.stringify(e,null,2))))}function RE(t,e){Pn("info")&&(he.json?console.log(JSON.stringify({level:"success",message:t,data:e})):console.log(`${a.success("\u2713")} ${t}`))}function zE(t,e){Pn("warn")&&(he.json?console.log(JSON.stringify({level:"warn",message:t,data:e})):console.log(`${a.warn("\u26A0")} ${t}`))}function jE(t,e){Pn("error")&&(he.json?console.error(JSON.stringify({level:"error",message:t,data:e})):(console.error(`${a.error("\u2717")} ${t}`),e&&he.verbose&&console.error(JSON.stringify(e,null,2))))}function gE(t){he.json?console.log(JSON.stringify(t)):console.table(t)}function xE(t){console.log(JSON.stringify(t,null,2))}var m={debug:hE,info:dE,success:RE,warn:zE,error:jE,table:gE,json:xE,configure:So};import{spawnSync as ME}from"child_process";var GE="https://registry.npmjs.org",SE="npm-version",YE=3600;async function qn(t){let e=`${SE}-${t}`,i=mr(e);if(i)return i;try{let n=await fetch(`${GE}/${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 Er(e,o,YE),o}catch{return null}}function WE(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,s=n[r]||0;if(o>s)return 1;if(o<s)return-1}return 0}function Zi(t,e){return WE(e,t)>0}import{readFileSync as CE}from"fs";import{join as vv,dirname as OE}from"path";import{fileURLToPath as UE}from"url";var yn="gemkit-cli";function KE(){try{let t=UE(import.meta.url),e=OE(t),i=[vv(e,"..","package.json"),vv(e,"..","..","..","package.json")];for(let n of i)try{let r=JSON.parse(CE(n,"utf-8"));if(r.name===yn&&r.version)return r.version}catch{}}catch{}return"0.0.0"}var de=KE();function Av(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 VE(e.force)),n&&(o=await NE(e.force)),console.log(),r||o?m.success("Update complete!"):m.info("Everything is up to date.")})}async function VE(t){console.log(),m.info(`${a.primary("CLI")} Checking for updates...`);let e=await qn(yn);if(!e)return m.warn("Failed to check npm registry for CLI updates."),!1;let i=de,n=e.version;return!Zi(i,n)&&!t?(m.success(`CLI is up to date (v${i})`),!1):(m.info(`Updating CLI: v${i} \u2192 v${n}`),ME("npm",["install","-g",`${yn}@latest`],{encoding:"utf-8",stdio:"inherit",shell:!0}).status!==0?(m.error("CLI update failed. Try running manually:"),m.info(` npm install -g ${yn}@latest`),!1):(m.success(`CLI updated to v${n}`),!0))}async function NE(t){console.log(),m.info(`${a.primary("Kits")} Checking for updates...`);let e=Mt();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 Ri(i),r=Ar(),o=await Bi({source:n,destination:r,strip:1});if(!o.success)return m.error(`Kits update failed: ${o.error}`),!1;let s={...e,version:i.version,installedAt:new Date().toISOString(),installedFiles:o.extractedFiles};return go(s),m.success(`Kits updated to v${i.version}`),!0}async function uv(){let t={cli:null,kits:null};try{let e=await qn(yn);e&&(t.cli={current:de,latest:e.version,available:Zi(de,e.version)})}catch{}try{let e=Mt(),i=await qt();e&&i&&(t.kits={current:e.version,latest:i.version,available:Zi(e.version,i.version)})}catch{}return t}var mv="gemkit-cli";function bE(t){return JE("npm",["install","-g",`${mv}@${t}`],{encoding:"utf-8",stdio:"pipe",shell:!0}).status===0}function BE(t){switch(t){case"gemini":return[".claude",".claude/**",".agent",".agent/**"];case"claude":return[".agent",".agent/**"];case"antigravity":return[".claude",".claude/**"];default:return[]}}function ZE(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 PE(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 qE(t){if(t.length!==0)return e=>!PE(e,t)}async function yE(){let t=FE(".gemini","extensions","spawn-agent");return kE(t)?new Promise(e=>{let i=QE("gemini",["extensions","install",t],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32",cwd:process.cwd()}),n="",r="",o=!1,s=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(s),e(c===0?{success:!0}:{success:!1,error:r||n||`Exit code: ${c}`}))}),i.on("error",c=>{o||(o=!0,clearTimeout(s),e({success:!1,error:`Failed to run gemini CLI: ${c.message}`}))})}):{success:!1,error:`Extension directory not found: ${t}`}}function Ev(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"),ov()&&!e.force){console.log(),m.warn("GemKit is already installed. Use --force to reinstall."),console.log();return}console.log(),console.log(p.default.bold(a.geminiPurple("Initializing GemKit"))),console.log(),console.log(` ${a.dim("Mode")} ${a.accent(ZE(i))}`),console.log();let n=Ke({text:"Checking CLI version...",color:"magenta"}).start();try{let f=await qn(mv);f&&Zi(de,f.version)?(n.text=`Updating CLI v${de} \u2192 v${f.version}...`,bE(f.version)?n.succeed(`CLI updated v${a.primary(de)} \u2192 v${a.primary(f.version)}`):n.warn(`CLI v${a.primary(de)} (update to v${f.version} failed)`)):n.succeed(`CLI v${a.primary(de)}`)}catch{n.succeed(`CLI v${a.primary(de)}`)}let r=Ke({text:"Fetching latest Kits release...",color:"magenta"}).start(),o=e.version?await Jl(e.version):await qt();o||(r.fail("No Kits release found"),console.log(),process.exit(1)),r.succeed(`Found Kits v${a.primary(o.version)}`);let s=Ke({text:"Downloading Kits...",color:"magenta"}).start(),c;try{c=await Ri(o),s.succeed("Kits downloaded")}catch(f){s.fail(`Kits download failed: ${f instanceof Error?f.message:String(f)}`),console.log(),process.exit(1)}let l=BE(i),v=Ke({text:i==="full"?"Extracting Kits...":`Extracting Kits (${i} mode)...`,color:"magenta"}).start(),A=process.cwd(),u=await Bi({source:c,destination:A,strip:1,filter:qE(l)});u.success||(v.fail(`Kits extraction failed: ${u.error}`),console.log(),process.exit(1)),v.succeed(`Extracted ${u.extractedFiles.length} files`);let I=rv(o.version,"local",u.extractedFiles);if(go(I),console.log(),m.success(`Kits v${a.primary(o.version)} installed successfully!`),!e.skipExtension&&(i==="full"||i==="gemini")){console.log();let f=Ke({text:"Installing spawn-agent extension...",color:"magenta"}).start(),R=await yE();R.success?f.succeed("spawn-agent extension installed in Gemini CLI"):(f.warn(`Could not install spawn-agent extension: ${R.error}`),m.info(`You can manually install it with: ${a.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 ${a.primary("gk doctor")} to verify installation.`),console.log()})}function Iv(t){t.command("versions","List available GemKit versions").alias("v").option("--json","Output as JSON").action(async e=>{let i=Mt(),n=await Ir();if(e.json){console.log(JSON.stringify({current:i?.version||null,available:n},null,2));return}console.log(),console.log(p.default.bold(a.geminiPurple("GemKit Versions"))),console.log(),console.log(i?` ${a.dim("Current:")} ${a.success(i.version)}`:` ${a.dim("Current:")} ${a.dim("Not installed")}`),console.log(),console.log(` ${p.default.bold("Available Releases:")}`);for(let r of n){let o=r.version===i?.version?a.success(" (current)"):"";console.log(` - ${a.primary(r.version)}${o}`)}console.log()})}import{existsSync as Yo}from"fs";import{join as DE}from"path";import{spawn as pv}from"child_process";async function wE(){return new Promise(t=>{let e=pv("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",s=>{i+=s.toString()}),e.stderr?.on("data",s=>{n+=s.toString()}),e.on("close",s=>{if(!r)if(r=!0,clearTimeout(o),s===0){let c=i.toLowerCase().includes("spawn-agent");t({installed:c})}else t({installed:!1,error:n||"Failed to check extensions"})}),e.on("error",s=>{r||(r=!0,clearTimeout(o),t({installed:!1,error:`Gemini CLI not available: ${s.message}`}))})})}async function TE(){return new Promise(t=>{let e=pv("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 s=i.trim().split(`
20
- `)[0]||"unknown";t({available:!0,version:s})}else t({available:!1,error:"Command failed"})}),e.on("error",o=>{n||(n=!0,clearTimeout(r),t({available:!1,error:o.message}))})})}function fv(t){t.command("doctor","Check installation health").option("--fix","Attempt to fix issues").action(async e=>{console.log(),console.log(p.default.bold(a.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:a.success("\u2713"),message:`Node.js ${o}`}):(r.push({icon:a.error("\u2717"),message:`Node.js ${o} ${a.error("(requires >= 18)")}`}),i++);let c=Ke({text:"Checking Gemini CLI...",color:"magenta"}).start(),l=await TE();c.stop(),l.available?r.push({icon:a.success("\u2713"),message:`Gemini CLI ${a.dim(`(${l.version})`)}`}):(r.push({icon:a.error("\u2717"),message:`Gemini CLI not found ${a.dim(`(${l.error})`)}`}),i++);let v=Ar();Yo(v)?r.push({icon:a.success("\u2713"),message:".gemini directory exists"}):(r.push({icon:a.error("\u2717"),message:".gemini directory missing"}),i++);let A=nn();Yo(A)?r.push({icon:a.success("\u2713"),message:"Agents directory exists"}):(r.push({icon:a.warn("\u25CB"),message:"Agents directory missing"}),n++);let u=Bt();Yo(u)?r.push({icon:a.success("\u2713"),message:"Extensions directory exists"}):(r.push({icon:a.warn("\u25CB"),message:"Extensions directory missing"}),n++);let I=DE(u,"spawn-agent");if(Yo(I)?r.push({icon:a.success("\u2713"),message:"spawn-agent extension files present"}):(r.push({icon:a.warn("\u25CB"),message:"spawn-agent extension files missing"}),n++),l.available){let f=Ke({text:"Checking spawn-agent extension...",color:"magenta"}).start(),R=await wE();f.stop(),R.installed?r.push({icon:a.success("\u2713"),message:"spawn-agent extension installed in Gemini"}):(r.push({icon:a.error("\u2717"),message:"spawn-agent extension NOT installed in Gemini",hint:R.error?`${R.error}
21
- Run: gemini extensions install .gemini/extensions/spawn-agent`:"Run: gemini extensions install .gemini/extensions/spawn-agent"}),i++)}let E=Mt();E?r.push({icon:a.success("\u2713"),message:`Installation metadata ${a.primary(`(v${E.version})`)}`}):(r.push({icon:a.warn("\u25CB"),message:"Installation metadata missing"}),n++);for(let f of r)if(console.log(` ${f.icon} ${f.message}`),f.hint)for(let R of f.hint.split(`
22
- `))console.log(` ${a.dim(R)}`);console.log(),i===0&&n===0?console.log(a.success("All checks passed!")):i===0?console.log(a.success(`All critical checks passed! ${a.dim(`(${n} warning${n>1?"s":""})`)}`)):(console.log(a.error(`${i} issue(s) found.`)),n>0&&console.log(a.warn(`${n} warning(s).`)),console.log(),console.log("To fix issues:"),console.log(` ${a.dim("1.")} Run ${a.primary("gk init")} to install GemKit`),console.log(` ${a.dim("2.")} Run ${a.primary("gemini extensions install .gemini/extensions/spawn-agent")} to install extension`)),console.log()})}function XE(){console.log(),console.log(p.default.bold(a.geminiPurple("Configuration Management"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk config")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("list")} Show all config (default)`),console.log(` ${a.primary("get")} <key> Get config value`),console.log(` ${a.primary("set")} <key> <val> Set config value`),console.log(` ${a.primary("reset")} Reset to defaults`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} [list] Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk config list")}`),console.log(` ${a.dim("gk config get spawn.defaultModel")}`),console.log(` ${a.dim("gk config set spawn.music true")}`),console.log(` ${a.dim("gk config reset")}`),console.log()}function hv(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 HE(r);break;case"get":i||(console.log(),m.error("Config key required"),console.log(a.dim("Usage: gk config get <key>")),console.log(),process.exit(1)),await LE(i);break;case"set":(!i||n===void 0)&&(console.log(),m.error("Config key and value required"),console.log(a.dim("Usage: gk config set <key> <value>")),console.log(),process.exit(1)),await _E(i,n);break;case"reset":await $E();break;default:XE()}})}async function HE(t){let e=Ve();if(t.json){console.log(JSON.stringify(e,null,2));return}console.log(),console.log(p.default.bold(a.geminiPurple("GemKit Configuration"))),console.log(),console.log(JSON.stringify(e,null,2)),console.log()}async function LE(t){let e=Ml(t);if(e===void 0){console.log(),m.error(`Config key not found: ${t}`),console.log();return}console.log(e)}async function _E(t,e){let i=e;e==="true"?i=!0:e==="false"?i=!1:isNaN(Number(e))||(i=Number(e));try{Cl(t,i),console.log(),m.success(`Config updated: ${a.primary(t)} = ${a.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 $E(){Ol(),console.log(),m.success("Configuration reset to defaults."),console.log()}function dv(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 eI();break;case"clear":await tI();break;default:console.log(),m.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1)}})}async function eI(){let t=Fl();console.log(),console.log(p.default.bold(a.geminiPurple("Cache Statistics"))),console.log(),console.log(` ${a.dim("Entries:")} ${a.primary(String(t.entries))}`),console.log(` ${a.dim("Size:")} ${a.primary((t.size/1024).toFixed(2))} KB`),console.log()}async function tI(){let t=kl();console.log(),m.success(`Cleared ${a.success(String(t))} cache entries.`),console.log()}import{existsSync as iI}from"fs";import{join as nI}from"path";function Rv(t){t.command("new <name>","Create a new project from starter kit").action(async e=>{let i=nI(process.cwd(),e);iI(i)&&(console.log(),m.error(`Directory already exists: ${e}`),console.log(),process.exit(1)),console.log(),console.log(p.default.bold(a.geminiPurple("Creating New Project"))),console.log(),m.info(`Name: ${a.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 Ri(n),o=await Bi({source:r,destination:i,strip:1});o.success?(console.log(),m.success(`Project ${a.primary(e)} created successfully!`),console.log(`
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
- cd ${a.primary(e)}
24
+ cd ${s.primary(e)}
25
25
  gk init
26
- `)):(m.error(`Failed to create project: ${o.error}`),console.log())})}import{spawn as FI}from"child_process";import{access as QI,stat as JI,readdir as bI,readFile as yv}from"fs/promises";import{join as Pi,basename as BI,extname as ZI,relative as PI}from"path";import{existsSync as tc,readFileSync as rI,readdirSync as oI}from"fs";import{join as jv,basename as sI}from"path";function ic(t,e){let i=nn(e),n=jv(i,`${t}.md`);return tc(n)?gv(n):null}function Wo(t){let e=nn(t);if(!tc(e))return[];let i=oI(e).filter(r=>r.endsWith(".md")),n=[];for(let r of i){let o=jv(e,r),s=gv(o);s&&n.push(s)}return n}function aI(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(),s=n.slice(r+1).trim();(s.startsWith('"')&&s.endsWith('"')||s.startsWith("'")&&s.endsWith("'"))&&(s=s.slice(1,-1)),i[o]=s}return i}function zv(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 gv(t){if(!tc(t))return null;let e=rI(t,"utf-8"),i=sI(t,".md"),n="",r="gemini-2.5-flash",o=[],s=aI(e),c=e;if(s)s.description&&(n=s.description),s.model&&(r=s.model),o=zv(s.skills),c=e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/,"").trim();else{let l=e.split(`
27
- `);for(let u of l){if(u.startsWith("# ")){n=u.substring(2).trim();break}if(u.trim()&&!u.startsWith("#")){n=u.trim();break}}let v=e.match(/model:\s*(.+)/i);v&&(r=v[1].trim());let A=e.match(/skills:\s*(.+)/i);A&&(o=zv(A[1]))}return{name:i,description:n,model:r,skills:o,content:c,filePath:t}}import{existsSync as li,readFileSync as oc,readdirSync as cI}from"fs";import{join as Dn}from"path";var sc=".gemini/extensions/spawn-agent/data",xv=3,Gv={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"]}},lI={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 nc={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"},vI={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"]},Mo=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],s=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,I=u*(this.k1+1),E=u+this.k1*(1-this.b+this.b*c/this.avgdl);s+=A*I/E}}n.push([r,s])}return n.sort((r,o)=>o[1]-r[1])}};function AI(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 ac(t){if(!li(t))return[];let i=oc(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 s=AI(i[o]),c={};n.forEach((l,v)=>{c[l]=s[v]?.trim()||""}),r.push(c)}return r}function uI(t,e,i,n,r){if(!li(t))return[];let o=ac(t),s=o.map(A=>e.map(u=>String(A[u]||"")).join(" ")),c=new Mo;c.fit(s);let l=c.score(n),v=[];for(let[A,u]of l.slice(0,r))if(u>0){let I=o[A],E={};for(let f of i)f in I&&(E[f]=I[f]);E._score=Math.round(u*1e4)/1e4,v.push(E)}return v}function cc(){let t=Dn(sc,"synonyms.csv");if(!li(t))return new Map;let e=ac(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(s=>s.trim()))}return i}function Sv(t,e){e||(e=cc());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(s=>n.add(s))}return Array.from(n).join(" ")}function lc(t){let e=t.toLowerCase();for(let[i,n]of Object.entries(lI))for(let r of n)if(e.includes(r))return i;return"standard"}function vc(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 s=[["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 s)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(I=>e.includes(I)).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 Ac(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,s]of i)if(e.includes(o))return s;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,s]of Object.entries(n)){let c=s.filter(l=>e.includes(l)).length;c>0&&(r[o]=c)}return Object.keys(r).length>0?Object.entries(r).sort((o,s)=>s[1]-o[1])[0][0]:"general"}function Yv(t,e=xv,i=!0){let n=Gv.combination,r=Dn(sc,n.file),o=t;if(i){let c=cc();o=Sv(t,c)}let s=uI(r,n.searchCols,n.outputCols,o,e);return{query:t,expandedQuery:i?o:void 0,detectedIntent:vc(t),detectedDomain:Ac(t),detectedComplexity:lc(t),count:s.length,results:s}}function rc(t,e,i,n=xv,r=!0){let o=Gv.combination,s=Dn(sc,o.file);if(!li(s))return{results:[],count:0};let c=ac(s);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=cc();l=Sv(t,E)}let v=c.map(E=>o.searchCols.map(f=>String(E[f]||"")).join(" ")),A=new Mo;A.fit(v);let u=A.score(l),I=[];for(let[E,f]of u.slice(0,n))if(f>0){let R=c[E],h={};for(let H of o.outputCols)H in R&&(h[H]=R[H]);h._score=Math.round(f*1e4)/1e4,I.push(h)}return{results:I,count:I.length}}function mI(t){let e=vc(t),i=Ac(t),n=lc(t);if(["debug","review","test","design","docs","research","plan"].includes(e)){let A=rc(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:nc[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=rc(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 s=Yv(t,1,!0);if(s.count===0){let A=nc[e]||"code-executor",u=vI[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=s.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 Wv(t,e){let{top:i=5,forceIntent:n,forceDomain:r,maxSkills:o}=e||{};if(n||r)return rc(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?nc[n]:l.agent||"code-executor",skills:A,intent:l.intent||n||vc(t),domain:l.domain||r||Ac(t),complexity:l.complexity||lc(t),score:l._score||0,fallback:!1,description:l.description||"",useWhen:l.use_when||""}});let s=Yv(t,i,!0);return s.count===0?[mI(t)]:s.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||s.detectedIntent,domain:c.domain||s.detectedDomain,complexity:c.complexity||s.detectedComplexity,score:c._score||0,fallback:!1,description:c.description||"",useWhen:c.use_when||""}})}function Mv(t){let e=Bt(t),i=[];if(!li(e))return i;let n=cI(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name);for(let r of n){let o=Dn(e,r,"SKILL.md");if(li(o)){let s=oc(o,"utf-8");i.push({name:r,path:o,content:s})}}return i}function Cv(t,e){let i=Bt(e),n=Dn(i,t,"SKILL.md");return li(n)?oc(n,"utf-8"):null}import{existsSync as EI,readFileSync as II}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=bt(t);if(!EI(i))return e;try{let n=II(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 s=n.match(/^PROJECT_DIR=(.*)$/m);s&&(e.PROJECT_DIR=s[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 I=n.match(/^PLAN_DATE_FORMAT=(.*)$/m);I&&(e.PLAN_DATE_FORMAT=I[1].trim())}catch{}return e}function vi(t=process.cwd()){return N(t).ACTIVE_GK_SESSION_ID||void 0}function at(t=process.cwd()){let e=N(t);return e.PROJECT_DIR?e.PROJECT_DIR:rn(t)}function Co(t=process.cwd()){return N(t).GEMINI_PROJECT_HASH||void 0}function wn(t=process.cwd()){return N(t).ACTIVE_PLAN||void 0}import{existsSync as kv,mkdirSync as jI,writeFileSync as uc,readFileSync as gI,renameSync as xI,unlinkSync as GI}from"fs";import{execSync as SI}from"child_process";import{join as YI}from"path";import{createHash as pI}from"crypto";function fI(t){return pI("sha256").update(t).digest("hex")}function hI(t){return fI(t).substring(0,8)}function Ov(t){let e=t.replace(/\\/g,"/").toLowerCase();return hI(e)}function Oo(t,e){let i=Date.now().toString(36),n=Math.random().toString(36).substring(2,6);return`${t}-${e}-${i}-${n}`}import{existsSync as Uv,readFileSync as Kv,readdirSync as dI}from"fs";import{join as RI}from"path";function Ce(t,e){if(!t||!e)return null;let i=Zt(t,e);if(!Uv(i))return null;try{let n=Kv(i,"utf-8");return JSON.parse(n)}catch{return null}}function Vv(t,e={}){let{limit:i=10,status:n="all"}=e,r=we(t);if(!Uv(r))return[];let o=[];try{let s=dI(r).filter(c=>c.startsWith("gk-session-")&&c.endsWith(".json"));for(let c of s){let l=RI(r,c),v=Kv(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((s,c)=>new Date(c.initTimestamp).getTime()-new Date(s.initTimestamp).getTime()),o.slice(0,i)}function zI(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 Nv(t,e){let i=zI(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 WI(t){try{let e=`powershell -Command "$p = Get-CimInstance Win32_Process -Filter 'ProcessId=${t}'; Write-Output $p.ParentProcessId; Write-Output $p.Name"`,n=SI(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 MI(t){return t?["powershell.exe","pwsh.exe","cmd.exe","bash.exe","zsh.exe","sh.exe","fish.exe"].includes(t.toLowerCase()):!1}function CI(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 mc(){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}=WI(e);if(MI(o)&&(i=e),CI(o)&&i)return i;if(!r||r<=4)break;e=r}return i||t}else return t}catch{}return t}function Uo(t){kv(t)||jI(t,{recursive:!0})}function OI(t){let{agents:e,...i}=t;return{...i,agents:e||[]}}function Ec(t,e,i){if(!t||!e)return!1;let n=we(t);Uo(n);let r=Zt(t,e),o=`${r}.tmp`;try{let s=OI(i);return uc(o,JSON.stringify(s,null,2),"utf8"),xI(o,r),!0}catch{try{GI(o)}catch{}return!1}}function Fv(t){try{let e=bt(),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=YI(process.cwd(),".gemini");return Uo(n),uc(e,i,"utf8"),!0}catch{return!1}}function UI(t,e){if(!t||!e)return null;let i=on(t,e);if(!kv(i))return null;try{let n=gI(i,"utf-8");return JSON.parse(n)}catch{return null}}function Qv(t,e,i){if(!t||!e)return!1;let n=we(t);Uo(n);let r=on(t,e);try{return uc(r,JSON.stringify(i,null,2),"utf8"),!0}catch{return!1}}function Jv(t,e,i){let n=UI(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:[]},Qv(t,e,n)),n}function KI(t,e,i){let n=Jv(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,s)=>{let c=new Date(o.startTime||0).getTime();return new Date(s.startTime||0).getTime()-c}),Qv(t,e,n)}function Ko(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(s=>s.gkSessionId===r);if(o>=0){let s=n.agents[o];n.agents[o]={...s,model:s.model||i.model||null,prompt:s.prompt||i.prompt||null}}else{let s={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(s)}return Ec(t,e,n)}function bv(t,e={}){let i=e.cwd||process.cwd(),n=rn(i),r=Ov(i),o=mc(),s=Oo(t,o),c={gkSessionId:s,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:[]};Uo(we(n)),Ec(n,s,c),Jv(n,r,i),KI(n,r,{gkSessionId:s,pid:o,sessionType:"non-gemini",appName:t,startTime:c.initTimestamp,activePlan:c.activePlan});let l=N(),A=l.PROJECT_DIR===n&&l.GEMINI_PROJECT_HASH||"";return Fv({gkSessionId:s,gkProjectHash:r,projectDir:n,geminiSessionId:"",geminiProjectHash:A,activePlan:c.activePlan||"",suggestedPlan:c.suggestedPlan||"",planDateFormat:""}),{session:c,gkSessionId:s,pid:o,projectDir:n,gkProjectHash:r}}function Bv(t,e,i){let n=Ce(t,e);if(!n||(n.activePlan=i,n.suggestedPlan=null,!Ec(t,e,n)))return!1;let r=N();return Fv({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 Zv(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 VI,exec as NI}from"child_process";import{existsSync as Vo,readFileSync as Ic,writeFileSync as pc,unlinkSync as Pv}from"fs";import{join as ko}from"path";import{tmpdir as kI,platform as qv}from"os";var qe=ko(kI(),"elevator-music.lock"),No=3e4,Fo=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 pc(qe,JSON.stringify(e),{flag:"wx"}),this.hasLock=!0,this.lockRefreshInterval=setInterval(()=>{this.refreshLock()},No/3),!0}catch(i){return i.code==="EEXIST"?this.tryTakeStaleLock(e):!1}}tryTakeStaleLock(e){try{let i=JSON.parse(Ic(qe,"utf8"));if(Date.now()-i.timestamp<No&&i.pid!==process.pid)try{return process.kill(i.pid,0),!1}catch{}Pv(qe);try{return pc(qe,JSON.stringify(e),{flag:"wx"}),this.hasLock=!0,this.lockRefreshInterval=setInterval(()=>{this.refreshLock()},No/3),!0}catch{return!1}}catch{return!1}}refreshLock(){if(this.hasLock)try{let e={pid:process.pid,timestamp:Date.now()};pc(qe,JSON.stringify(e),{flag:"w"})}catch{}}releaseLock(){if(this.lockRefreshInterval&&(clearInterval(this.lockRefreshInterval),this.lockRefreshInterval=null),!!this.hasLock){try{Vo(qe)&&JSON.parse(Ic(qe,"utf8")).pid===process.pid&&Pv(qe)}catch{}this.hasLock=!1}}getDefaultAudioFile(){let e=[ko(process.cwd(),".gemini","extensions","spawn-agent","assets","golden-coast-melody.wav"),ko(process.cwd(),".gemini","assets","elevator_music.wav"),ko(process.cwd(),"assets","elevator_music.wav")];for(let i of e)if(Vo(i))return i;return null}getPlayCommand(){if(!this.audioFile)return null;switch(qv()){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||!Vo(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=VI(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&&(qv()==="win32"?NI(`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(!Vo(qe))return!1;let e=JSON.parse(Ic(qe,"utf8"));if(Date.now()-e.timestamp>=No)return!1;try{return process.kill(e.pid,0),!0}catch{return!1}}catch{return!1}}};var Dv=[{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"}],wv=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"];function qI(t){let e=0,i=0,n=0,r=process.stdout.isTTY,o=setInterval(()=>{n++,i++;let s=n%10===0;s&&e++;let c=Dv[e%Dv.length],v=`${wv[i%wv.length]} ${c.icon} ${c.action}... ${n}s`;r?process.stdout.write(`\r\x1B[K${v}`):(n===1||s)&&console.log(v)},1e3);return{interval:o,stop:()=>{clearInterval(o),r&&process.stdout.write("\r\x1B[K")}}}function yI(t){let{agentType:e="Sub Agent",agentRole:i="unknown",parentSessionId:n=null,activePlan:r=null,projectDir:o=null}=t,s=[`Agent Type: ${e}`,`Agent Role: ${i}`];return n&&s.push(`Parent Session: ${n.slice(0,8)}...`),o&&s.push(`Project: ${o}`),r&&s.push(`Active Plan: ${r}`),s.join(`
30
- `)}function Tv(){console.log(),console.log(p.default.bold(a.geminiPurple("Agent Management"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("list")} List all agent profiles`),console.log(` ${a.primary("info")} <name> Show agent profile details`),console.log(` ${a.primary("search")} "<task>" Find best agent+skills for a task`),console.log(` ${a.primary("spawn")} Spawn a sub-agent`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk agent list")}`),console.log(` ${a.dim("gk agent info researcher")}`),console.log(` ${a.dim('gk agent search "implement authentication"')}`),console.log(` ${a.dim('gk agent spawn -a researcher -p "research best practices"')}`),console.log(),console.log("Run with subcommand for specific help:"),console.log(` ${a.dim("gk agent list --help")}`),console.log(` ${a.dim("gk agent spawn --help")}`),console.log()}function DI(){console.log(),console.log(p.default.bold(a.geminiPurple("gk agent list"))),console.log(a.dim("List all available agent profiles")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent list")} [options]`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log()}function wI(){console.log(),console.log(p.default.bold(a.geminiPurple("gk agent info"))),console.log(a.dim("Show detailed information about an agent profile")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent info")} <name> [options]`),console.log(),console.log("Arguments:"),console.log(` ${a.dim("<name>")} Agent profile name (without .md extension)`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log(),console.log("Example:"),console.log(` ${a.dim("gk agent info researcher")}`),console.log()}function TI(){console.log(),console.log(p.default.bold(a.geminiPurple("gk agent search"))),console.log(a.dim("Find best agent+skills combination for a task using BM25 search")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent search")} "<task>" [options]`),console.log(),console.log("Arguments:"),console.log(` ${a.dim("<task>")} Task description to search for`),console.log(),console.log("Options:"),console.log(` ${a.dim("-n, --limit <n>")} Number of results (default: 5)`),console.log(` ${a.dim("-i, --intent <i>")} Force intent: research|plan|execute|debug|review|test|design|docs`),console.log(` ${a.dim("-d, --domain <d>")} Force domain: frontend|backend|auth|payment|database|mobile|ai|etc.`),console.log(` ${a.dim("--max-skills <n>")} Maximum skills to include`),console.log(` ${a.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${a.dim('gk agent search "implement user authentication"')}`),console.log(` ${a.dim('gk agent search "debug the login form" -i debug')}`),console.log(` ${a.dim('gk agent search "build a payment page" -d payment')}`),console.log()}function Xv(){console.log(),console.log(p.default.bold(a.geminiPurple("gk agent spawn"))),console.log(a.dim("Spawn a sub-agent with Gemini CLI")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk agent spawn")} -p "<prompt>" [options]`),console.log(),console.log("Required:"),console.log(` ${a.dim("-p, --prompt <text>")} Task prompt for the agent`),console.log(),console.log("Options:"),console.log(` ${a.dim("-a, --agent <name>")} Agent profile name (from .gemini/agents/)`),console.log(` ${a.dim("-s, --skills <list>")} Comma-separated skill names to inject`),console.log(` ${a.dim("-c, --context <files>")} Context files (@file syntax)`),console.log(` ${a.dim("-m, --model <model>")} Model override (default: from config)`),console.log(` ${a.dim("--music")} Play elevator music while waiting`),console.log(` ${a.dim("--no-music")} Disable elevator music`),console.log(` ${a.dim("--music-file <path>")} Custom music file path`),console.log(),console.log("Examples:"),console.log(` ${a.dim('gk agent spawn -p "fix the login bug"')}`),console.log(` ${a.dim('gk agent spawn -a researcher -p "research React best practices"')}`),console.log(` ${a.dim('gk agent spawn -a code-executor -s "frontend-design" -p "build a dashboard"')}`),console.log(` ${a.dim('gk agent spawn -p "implement auth" -m gemini-2.5-pro --music')}`),console.log()}function Hv(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":DI();return;case"info":wI();return;case"search":TI();return;case"spawn":Xv();return;default:Tv();return}switch(e){case"list":await XI(n);break;case"info":i||(console.log(),m.error("Agent profile name required"),console.log(a.dim("Usage: gk agent info <name>")),console.log(),process.exit(1)),await HI(i,n);break;case"search":i||(console.log(),m.error("Search query required"),console.log(a.dim('Usage: gk agent search "<task>"')),console.log(),process.exit(1)),await LI(i,n);break;case"spawn":await _I(n);break;default:Tv()}})}async function XI(t){let e=Wo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(a.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(` ${a.primary(i.name)}`),console.log(` ${a.dim(i.description)}`),console.log(` ${a.dim("Model:")} ${i.model}`),i.skills&&i.skills.length>0&&console.log(` ${a.dim("Skills:")} ${i.skills.join(", ")}`),console.log("");console.log(a.dim(` Total: ${e.length} agents`)),console.log()}async function HI(t,e){let i=ic(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(p.default.bold(a.geminiPurple(`Agent: ${i.name}`))),console.log(M.doubleLine()),console.log(),console.log(` ${a.dim("Description:")} ${i.description}`),console.log(` ${a.dim("Model:")} ${i.model}`),i.skills?.length&&console.log(` ${a.dim("Skills:")} ${i.skills.join(", ")}`),console.log(` ${a.dim("Path:")} ${i.filePath}`),console.log(),console.log(a.dim("--- Profile Content ---")),console.log(),console.log(a.dim(i.content)),console.log()}async function LI(t,e){let i=Wv(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(a.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?a.warn(" [FALLBACK]"):"";console.log(` ${a.success(n+1+".")} ${a.primary(r.agent)}${o} ${a.dim(`(score: ${r.score})`)}`),console.log(` ${a.dim("Intent:")} ${r.intent} ${a.dim("Domain:")} ${r.domain} ${a.dim("Complexity:")} ${r.complexity}`),r.skills.length>0&&console.log(` ${a.dim("Skills:")} ${r.skills.join(" | ")}`),r.description&&console.log(` ${a.dim(r.description)}`),r.useWhen&&console.log(` ${a.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(a.dim(" Suggested command:")),console.log(` ${a.primary("gk")} agent spawn -a ${n.agent}${r} -p "${t}"`)}console.log()}async function _I(t){t.prompt||(console.log(),m.error("Prompt is required. Use -p or --prompt"),console.log(),Xv(),process.exit(1));let e=Ve(),i=N(),n=i.ACTIVE_GK_SESSION_ID||null,r=i.ACTIVE_GEMINI_SESSION_ID||null,o=i.ACTIVE_PLAN||null,s=i.SUGGESTED_PLAN||null,c=i.PLAN_DATE_FORMAT||null,l=i.PROJECT_DIR||null,v=null;t.agent&&(v=ic(t.agent),v||(console.log(),m.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,f=t.skills?.split(",").map(d=>d.trim())||[],R=v?.skills||[],h=[...new Set([...R,...f])],H=t.context?t.context.split(",").flatMap(d=>d.trim().split(/\s+/).filter(G=>G)).filter(d=>d):[];async function ve(d){let G=d,De=!1;if(d.startsWith("@")){let Ae=d.substring(1),At=[Pi(process.cwd(),".docs",Ae),Pi(process.cwd(),".plans",Ae),Pi(process.cwd(),"docs",Ae),Pi(process.cwd(),"plans",Ae),Pi(process.cwd(),Ae)];for(let ut of At)try{await QI(ut),G=ut,De=!0;break}catch{continue}if(!De){let ut=At.map(ui=>` - ${ui}`).join(`
31
- `);throw new Error(`Context file not found: ${d}
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
- ${ut}
34
- Tip: Place file in .docs/, .plans/, docs/, plans/, or project root`)}}try{if((await JI(G)).isDirectory())return await es(G,d);let At=await yv(G,"utf-8");return{type:"context",name:BI(G),path:G,content:At.trim(),originalRef:d}}catch(Ae){throw new Error(`Failed to load context from ${d}: ${Ae.message}`)}}async function es(d,G){let Ae=[".md",".txt",".json",".yaml",".yml"],At=[];async function ut(ui,Hn=0){if(Hn>3)return;let NA=await bI(ui,{withFileTypes:!0});for(let mi of NA){let Xi=Pi(ui,mi.name);if(!mi.name.startsWith(".")){if(mi.isDirectory())await ut(Xi,Hn+1);else if(mi.isFile()){let kA=ZI(mi.name).toLowerCase();if(Ae.includes(kA))try{let ss=await yv(Xi,"utf-8"),Pc=PI(d,Xi);At.push({type:"context",name:mi.name,path:Xi,relativePath:Pc,content:ss.trim(),originalRef:`${G}/${Pc}`})}catch(ss){console.warn(`Warning: Could not read ${Xi}: ${ss.message}`)}}}}}return await ut(d),At.sort((ui,Hn)=>(ui.relativePath||"").localeCompare(Hn.relativePath||"")),At}function ts(d){if(!d||d.length===0)return"";let G=`<context>
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
- `,d.forEach((De,Ae)=>{G+=`## Document ${Ae+1}: ${De.name}
37
+ `,h.forEach((De,Ae)=>{G+=`## Document ${Ae+1}: ${De.name}
38
38
  `,G+=`Source: ${De.originalRef}
39
39
 
40
40
  `}),G+=`</context>
41
41
 
42
- `,G}let lt=[];if(H&&H.length>0)for(let d of H)try{if(typeof d=="string"){let G=await ve(d);Array.isArray(G)?lt.push(...G):lt.push(G)}else lt.push(d)}catch(G){console.log(),m.error(G.message),console.log(),process.exit(1)}let Ft=v?.name||t.agent||"Sub",V=[],UA=yI({agentType:"Sub Agent",agentRole:Ft,parentSessionId:n,activePlan:o,projectDir:l});if(V.push("<subagent-context>"),V.push(UA),V.push(`</subagent-context>
43
- `),V.push("<task>"),V.push(t.prompt),V.push(`</task>
44
- `),v&&(V.push("<agent>"),V.push(`# Agent: ${v.name}
45
- `),V.push("## Role & Responsibilities"),V.push(v.content),V.push(`</agent>
46
- `)),h.length>0){V.push("<skills>"),V.push(`You have access to the following skills and capabilities:
47
- `);for(let d=0;d<h.length;d++){let G=h[d],De=Cv(G);De&&(V.push(`## Skill ${d+1}: ${G}`),V.push(De),V.push(`---
48
- `))}V.push(`</skills>
49
- `)}lt.length>0&&V.push(ts(lt));let KA=V.join(`
50
- `),VA=t.prompt.length>150?t.prompt.substring(0,150):t.prompt;console.log(),m.info(`Spawning ${a.primary(Ft)} agent with model: ${a.primary(A)}`),n&&m.info(`Parent session: ${a.dim(n.slice(0,20)+"...")}`),o&&m.info(`Active plan: ${a.dim(o)}`),h.length>0&&m.info(`Injected skills: ${a.dim(h.join(", "))}`),lt.length>0&&m.info(`Injected context: ${a.dim(lt.map(d=>d.name).join(", "))}`),console.log(M.line()),console.log();let vt=null;I&&(vt=new Fo({audioFile:E,loop:!0,volume:.3}),vt.start()&&(console.log(a.dim("Playing elevator music while waiting...")),console.log()));let is=lt.map(d=>d.path||d.name),Zc=Oo("gemini-sub",process.pid);n&&l&&Ko(l,n,{gkSessionId:Zc,pid:process.pid,parentGkSessionId:n,agentRole:Ft,prompt:t.prompt,model:A,injected:h.length>0||is.length>0?{skills:h,context:is}:null});let ns=qI(Ft),Qt=FI("gemini",["-y","-m",A],{stdio:["pipe","pipe","pipe"],shell:process.platform==="win32",env:{...process.env,GEMINI_TYPE:"sub-agent",GEMINI_PARENT_SESSION_ID:r||"",GK_PARENT_SESSION_ID:n||"",GK_SUB_SESSION_ID:Zc,GEMINI_AGENT_ROLE:Ft,GEMINI_AGENT_PROMPT:VA,GEMINI_AGENT_MODEL:A||"",GEMINI_AGENT_SKILLS:h.join(","),GEMINI_AGENT_CONTEXT:is.join(","),GK_ACTIVE_PLAN:o||"",GK_SUGGESTED_PLAN:s||"",GK_PLAN_DATE_FORMAT:c||""}}),rs="",os="";Qt.stdout.on("data",d=>{rs+=d.toString()}),Qt.stderr.on("data",d=>{os+=d.toString()}),Qt.stdin.write(KA),Qt.stdin.end(),Qt.on("close",d=>{ns.stop(),vt&&(vt.stop(),console.log(a.dim("Music stopped."))),console.log(),rs&&console.log(rs),os&&console.error(os),d===0?m.success(`${Ft} agent completed successfully`):m.error(`${Ft} agent exited with code: ${d}`),console.log(),process.exit(d||0)}),Qt.on("error",d=>{ns.stop(),vt&&vt.stop(),console.log(),m.error(`Failed to spawn agent: ${d.message}`),console.log(),process.exit(1)}),process.on("SIGINT",()=>{ns.stop(),vt&&vt.stop(),Qt.kill("SIGTERM"),process.exit(1)})}function $I(){console.log(),console.log(p.default.bold(a.geminiPurple("Session Management"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk session")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("status")} Show active session (default)`),console.log(` ${a.primary("list")} List recent sessions`),console.log(` ${a.primary("info")} <id> Show session details`),console.log(` ${a.primary("agents")} [id] List agents in session`),console.log(` ${a.primary("init")} [app] Initialize new session`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log(` ${a.dim("-n, --limit <n>")} Number of results for list (default: 10)`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk session status")}`),console.log(` ${a.dim("gk session list -n 20")}`),console.log(` ${a.dim("gk session info abc123")}`),console.log(` ${a.dim("gk session agents")}`),console.log(` ${a.dim("gk session init myapp")}`),console.log()}function Lv(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 ep(n);break;case"list":await tp(n);break;case"info":i||(console.log(),m.error("Session ID required"),console.log(a.dim("Usage: gk session info <id>")),console.log(),process.exit(1)),await ip(i,n);break;case"agents":await np(i,n);break;case"init":await rp(i||"app",n);break;default:$I()}})}async function ep(t){let e=N(),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(a.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(a.dim(` Project: ${i}`)),console.log();return}let o=Nv(i,n),c=r.agents?.find(l=>l.agentType==="Main Agent")?.status||"active";console.log(),console.log(p.default.bold(a.geminiPurple("Active Session"))),console.log(M.line()),console.log(),console.log(` ${a.dim("GK Session ID:")} ${a.primary(r.gkSessionId)}`),console.log(` ${a.dim("Gemini Session ID:")} ${r.geminiSessionId||a.dim("N/A")}`),console.log(` ${a.dim("Project Dir:")} ${r.projectDir}`),console.log(` ${a.dim("App Name:")} ${r.appName}`),console.log(` ${a.dim("PID:")} ${r.pid}`),console.log(` ${a.dim("Status:")} ${M.statusIcon(c)} ${c}`),console.log(` ${a.dim("Started:")} ${r.initTimestamp}`),r.activePlan&&console.log(` ${a.dim("Active Plan:")} ${a.primary(r.activePlan)}`),console.log(),console.log(` ${a.dim("Agents:")} ${o.total} total (${o.mainAgents} main, ${o.subAgents} sub)`),console.log(` ${a.success(String(o.completed))} completed, ${a.error(String(o.failed))} failed, ${o.active} active`),console.log()}async function tp(t){let e=at(),i=Vv(e,{limit:t.limit});if(t.json){console.log(JSON.stringify(i,null,2));return}if(console.log(),console.log(p.default.bold(a.geminiPurple("Recent Sessions"))),console.log(a.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(),s=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(s)} ${a.primary(c)} ${a.dim(r)}`),n.activePlan&&console.log(` ${a.dim("Plan:")} ${n.activePlan}`)}console.log(),console.log(a.dim(` Showing ${i.length} sessions (limit: ${t.limit})`)),console.log()}async function ip(t,e){let i=at(),n=Ce(i,t);if(n||(console.log(),m.error(`Session not found: ${t}`),console.log(a.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(p.default.bold(a.geminiPurple(`Session: ${n.gkSessionId}`))),console.log(M.line()),console.log(),console.log(JSON.stringify(n,null,2)),console.log()}async function np(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 s=n.length>30?n.slice(0,30)+"...":n;if(console.log(),console.log(p.default.bold(a.geminiPurple("Agents in Session"))),console.log(a.dim(` ${s}`)),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"?a.primary("MAIN"):a.dim("SUB");if(console.log(` ${M.statusIcon(l.status)} [${u}] ${a.primary(v)} ${a.dim(`(${A})`)}`),l.prompt){let I=l.prompt.length>60?l.prompt.slice(0,60)+"...":l.prompt;console.log(` ${a.dim("Prompt:")} ${I}`)}l.tokenUsage&&console.log(` ${a.dim("Tokens:")} ${l.tokenUsage.total.toLocaleString()} total`),l.geminiSessionId&&console.log(` ${a.dim("Gemini ID:")} ${l.geminiSessionId.slice(0,8)}...`)}console.log(),console.log(a.dim(` Total: ${o.length} agents`)),console.log()}async function rp(t,e){let n=N().ACTIVE_GK_SESSION_ID;if(n){let l=Zv(n),v=at();if(l){let A=mc();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: ${a.primary(n.slice(0,30)+"...")}`),console.log(a.dim(` PID: ${l.pid}`)),console.log());return}}}let{session:r,gkSessionId:o,pid:s,projectDir:c}=bv(t);Ko(c,o,{gkSessionId:o,pid:s,geminiSessionId:null,parentGkSessionId:null,agentRole:"main",prompt:null,model:null}),e.json?console.log(JSON.stringify({status:"initialized",gkSessionId:o,pid:s,projectDir:c},null,2)):(console.log(),m.success(`GemKit session initialized: ${a.primary(o.slice(0,30)+"...")}`),console.log(a.dim(` PID: ${s}`)),console.log())}import{existsSync as Tn,readdirSync as op,mkdirSync as Qo,writeFileSync as fc,statSync as sp}from"fs";import{join as Ai}from"path";function hc(t){let e=di(t);if(!Tn(e))return[];let i=wn();return op(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name).map(r=>{let o=Ai(e,r),s=Ai(o,"plan.md"),c="";return Tn(s)&&(c=sp(s).birthtime.toISOString()),{name:r,path:o,createdAt:c,isActive:r===i}})}function _v(t,e){let i=di(e),n=Ai(i,t);if(Tn(i)||Qo(i,{recursive:!0}),Tn(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}
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 fc(Ai(n,"plan.md"),r),{name:t,path:n,createdAt:new Date().toISOString(),isActive:!1}}function dc(t,e){let i=vi();if(!i){let o=bt(e),s=N(),c=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${s.ACTIVE_GK_SESSION_ID||""}`,`GK_PROJECT_HASH=${s.GK_PROJECT_HASH||""}`,`PROJECT_DIR=${s.PROJECT_DIR||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${s.ACTIVE_GEMINI_SESSION_ID||""}`,`GEMINI_PROJECT_HASH=${s.GEMINI_PROJECT_HASH||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t}`,`SUGGESTED_PLAN=${s.SUGGESTED_PLAN||""}`,`PLAN_DATE_FORMAT=${s.PLAN_DATE_FORMAT||""}`,""].join(`
65
- `);return fc(o,c),!0}let n=at(e);if(!Ce(n,i)){let o=bt(e),s=N(),c=["# Auto-generated by gemkit-cli",`# Updated at: ${new Date().toISOString()}`,"","# GEMKIT IDs",`ACTIVE_GK_SESSION_ID=${s.ACTIVE_GK_SESSION_ID||""}`,`GK_PROJECT_HASH=${s.GK_PROJECT_HASH||""}`,`PROJECT_DIR=${s.PROJECT_DIR||""}`,"","# GEMINI IDs (mapped)",`ACTIVE_GEMINI_SESSION_ID=${s.ACTIVE_GEMINI_SESSION_ID||""}`,`GEMINI_PROJECT_HASH=${s.GEMINI_PROJECT_HASH||""}`,"","# PLAN INFO",`ACTIVE_PLAN=${t}`,`SUGGESTED_PLAN=${s.SUGGESTED_PLAN||""}`,`PLAN_DATE_FORMAT=${s.PLAN_DATE_FORMAT||""}`,""].join(`
66
- `);return fc(o,c),!0}return Bv(n,i,t)}function $v(t,e){let i=di(e),n=Ai(i,t);if(!Tn(n))return null;let r=wn();return{name:t,path:n,createdAt:"",isActive:t===r}}function ap(){console.log(),console.log(p.default.bold(a.geminiPurple("Plan Management"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk plan")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("list")} List all plans (default)`),console.log(` ${a.primary("status")} Show active plan status`),console.log(` ${a.primary("create")} <name> Create new plan`),console.log(` ${a.primary("set")} <name> Set active plan`),console.log(` ${a.primary("info")} Get plan info from .env`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log(` ${a.dim("-a, --active")} [info] Show only ACTIVE_PLAN value`),console.log(` ${a.dim("-s, --suggested")} [info] Show only SUGGESTED_PLAN value`),console.log(` ${a.dim("-f, --format")} [info] Show only PLAN_DATE_FORMAT value`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk plan list")}`),console.log(` ${a.dim("gk plan create my-feature")}`),console.log(` ${a.dim("gk plan set my-feature")}`),console.log(` ${a.dim("gk plan info --active")}`),console.log()}function eA(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 cp(n);break;case"status":await lp(n);break;case"create":i||(console.log(),m.error("Plan name required"),console.log(a.dim("Usage: gk plan create <name>")),console.log(),process.exit(1)),await vp(i);break;case"set":i||(console.log(),m.error("Plan name required"),console.log(a.dim("Usage: gk plan set <name>")),console.log(),process.exit(1)),await Ap(i);break;case"info":await up(n);break;default:ap()}})}async function cp(t){let e=hc();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(a.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?a.success("\u2192"):a.dim("\u25CB"),r=i.isActive?a.success(" (active)"):"";console.log(` ${n} ${a.primary(i.name)}${r}`),console.log(` ${a.dim("Created:")} ${a.dim(new Date(i.createdAt).toLocaleDateString())}`)}console.log()}async function lp(t){let e=wn();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=$v(e);if(t.json){console.log(JSON.stringify(i,null,2));return}console.log(),console.log(M.line()),console.log(p.default.bold(a.geminiPurple("Active Plan"))),console.log(M.line()),console.log(),console.log(` ${a.primary(e)}`),console.log()}async function vp(t){try{let e=_v(t);console.log(),m.success(`Plan created: ${a.primary(t)}`),m.info(`Path: ${a.dim(e.path)}`),dc(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 Ap(t){if(!hc().some(o=>o.name===t)){console.log(),m.error(`Plan not found: ${t}`),console.log();return}if(!dc(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: ${a.primary(t)}`),m.info(`Environment updated: ACTIVE_PLAN = ${t}`),console.log(),m.success(`Active plan set to: ${a.primary(t)}`),console.log()}async function up(t){let e=N(),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(p.default.bold(a.geminiPurple("Plan Information"))),console.log(M.line()),console.log(),console.log(` ${a.dim("Active Plan:")} ${i.activePlan||a.dim("(not set)")}`),console.log(` ${a.dim("Suggested Plan:")} ${i.suggestedPlan||a.dim("(not set)")}`),console.log(` ${a.dim("Date Format:")} ${i.planDateFormat||a.dim("(not set)")}`),console.log(),console.log(M.line());let n=i.gkSessionId?i.gkSessionId.substring(0,25)+"...":a.dim("(no session)");console.log(` ${a.dim("Session:")} ${n}`),console.log(` ${a.dim("Project:")} ${i.projectDir||a.dim("(unknown)")}`),console.log()}}import{existsSync as mp,readFileSync as Ep,readdirSync as Ip}from"fs";import{join as tA}from"path";import{homedir as pp}from"os";async function iA(){let t=Co();return t?fp(t):null}function fp(t){let e=tA(pp(),".gemini","tmp",t,"chats");if(!mp(e))return null;let i=Ip(e).filter(n=>n.startsWith("session-")&&n.endsWith(".json")).sort().reverse();if(i.length===0)return null;try{let n=tA(e,i[0]);return hp(n)}catch{return null}}function hp(t){try{let e=Ep(t,"utf-8"),i=JSON.parse(e);if(!i.messages||i.messages.length===0)return null;let n=new Set,r=0,o=0,s=0,c,l=0;for(let h of i.messages)h.model&&n.add(h.model),h.tokens&&(r+=h.tokens.output||0,o+=h.tokens.thoughts||0,s+=h.tokens.tool||0,c=h.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 I={input:u,output:r,cached:A,thoughts:o,tool:s,total:v},E=null;if(i.startTime&&i.lastUpdated)try{let h=new Date(i.startTime),H=new Date(i.lastUpdated),ve=Math.floor((H.getTime()-h.getTime())/1e3),es=Math.floor(ve/60),ts=ve%60;E={seconds:ve,formatted:`${es}m ${ts}s`}}catch{}let f=Array.from(n),R=f[0]||"unknown";return{sessionId:i.sessionId,startTime:i.startTime||null,lastUpdated:i.lastUpdated||null,duration:E,model:R,modelsUsed:f,messageCount:l,tokens:I,averages:{outputPerMessage:l>0?Math.round(r/l):0,thoughtsPerMessage:l>0?Math.round(o/l):0,toolPerMessage:l>0?Math.round(s/l):0}}}catch{return null}}var Xn={"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 dp(t){if(Xn[t])return Xn[t];for(let e of Object.keys(Xn))if(e.includes(t)||t.includes(e))return Xn[e];return Xn.default}function Rc(t,e="default"){let i=dp(e),n=t.input-t.cached;n<0&&(n=0);let r=n/1e6*i.input,o=t.output/1e6*i.output,s=t.cached/1e6*i.cached,c=t.thoughts/1e6*i.thoughts;return{input:r,output:o,cached:s,thoughts:c,total:r+o+s+c,model:e,pricing:i}}function Ct(t){return t>=1?`$${t.toFixed(2)}`:t>=.01?`$${t.toFixed(3)}`:t>=.001?`$${t.toFixed(4)}`:`$${t.toFixed(6)}`}function zc(t){return t>=1e6?`${(t/1e6).toFixed(1)}M`:t>=1e3?`${(t/1e3).toFixed(1)}K`:String(t)}var Ut={topLeft:"\u256D",topRight:"\u256E",bottomLeft:"\u2570",bottomRight:"\u256F",horizontal:"\u2500",vertical:"\u2502",middleLeft:"\u251C",middleRight:"\u2524"};function Rp(t=75){return a.dim(`${Ut.topLeft}${Ut.horizontal.repeat(t-2)}${Ut.topRight}`)}function zp(t=75){return a.dim(`${Ut.bottomLeft}${Ut.horizontal.repeat(t-2)}${Ut.bottomRight}`)}function jp(t,e=75){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-4-i);return`${a.dim(Ut.vertical)} ${t}${" ".repeat(n)} ${a.dim(Ut.vertical)}`}function jc(t){return`
67
- ${p.default.bold(a.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 Ot(t,e){let i=t.replace(/\x1b\[[0-9;]*m/g,"").length,n=Math.max(0,e-i);return t+" ".repeat(n)}function gp(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),s=Math.round(115+-79*r),c=Math.round(232+-62*r);e.push(`\x1B[38;2;${o};${s};${c}m${t[n]}`)}return e.join("")+"\x1B[0m"}function xp(t){let e=Rc(t.tokens,t.model);console.log(),console.log(Rp(75)),console.log(jp(`${gp("SESSION ANALYSIS")} ${a.dim("Cost:")} ${a.warn(Ct(e.total))}`,75)),console.log(zp(75)),console.log(`
68
- ${a.dim("Session ID:")} ${a.accent(t.sessionId)}`),console.log(` ${a.dim("Start Time:")} ${t.startTime||"N/A"}`),console.log(` ${a.dim("Duration:")} ${a.accent(t.duration?.formatted||"N/A")}`),console.log(` ${a.dim("Model:")} ${a.geminiBlue(t.modelsUsed.join(", "))}`),console.log(` ${a.dim("Messages:")} ${a.accent(String(t.messageCount))}`),console.log(jc("Token Breakdown")),console.log(`
69
- ${Ot("Category",10)} ${Oe("Count",14)} ${Oe("Formatted",10)}`),console.log(` ${a.dim("\u2500".repeat(10))} ${a.dim("\u2500".repeat(14))} ${a.dim("\u2500".repeat(10))}`);let i=["input","output","cached","thoughts","tool"];for(let o of i){let s=t.tokens[o],c=Oe(a.accent(s.toLocaleString()),14),l=Oe(a.accent(zc(s)),10);console.log(` ${Ot(o,10)} ${c} ${l}`)}console.log(` ${a.dim("\u2500".repeat(10))} ${a.dim("\u2500".repeat(14))} ${a.dim("\u2500".repeat(10))}`);let n=Oe(a.success(t.tokens.total.toLocaleString()),14),r=Oe(a.success(zc(t.tokens.total)),10);if(console.log(` ${Ot(p.default.bold("total"),10)} ${n} ${r}`),console.log(jc("Estimated Cost")),console.log(`
70
- ${Ot("Input",12)} ${Oe(a.warn(Ct(e.input)),12)}`),console.log(` ${Ot("Output",12)} ${Oe(a.warn(Ct(e.output)),12)}`),console.log(` ${Ot("Cached",12)} ${Oe(a.warn(Ct(e.cached)),12)}`),console.log(` ${Ot("Thoughts",12)} ${Oe(a.warn(Ct(e.thoughts)),12)}`),console.log(` ${a.dim("\u2500".repeat(24))}`),console.log(` ${Ot(p.default.bold("TOTAL"),12)} ${Oe(p.default.bold(a.warn(Ct(e.total))),12)}`),t.messageCount>0){console.log(jc("Averages"));let o=Math.round(t.tokens.total/t.messageCount),s=e.total/t.messageCount;console.log(`
71
- ${a.dim("Tokens/msg:")} ${a.accent(o.toLocaleString())}`),console.log(` ${a.dim("Cost/msg:")} ${a.warn(Ct(s))}`)}console.log()}function Gp(t){let e=Rc(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 nA(t){t.command("tokens","Show token usage for current session").alias("t").option("--json","Output as JSON").action(async e=>{let i=await iA();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){Gp(i);return}xp(i)})}import{existsSync as Sp,readdirSync as Yp}from"fs";function rA(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 Wp():(console.log(),m.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1))})}async function Wp(){let t=Bt();if(!Sp(t)){console.log(),m.info("No extensions directory found."),console.log();return}let e=Yp(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(p.default.bold(a.geminiPurple("Installed Extensions"))),console.log();for(let i of e)console.log(` ${a.success("\u2713")} ${a.primary(i)}`);console.log(),console.log(a.dim(` Total: ${e.length} extensions`)),console.log()}function oA(t){t.command("catalog [subcommand]","Catalog of skills and agents").action(async i=>{let n=i||"skills";switch(n){case"skills":await Mp();break;case"agents":await Cp();break;default:console.log(),m.error(`Unknown subcommand: ${n}`),console.log(),process.exit(1)}})}async function Mp(){let t=Mv();if(console.log(),console.log(p.default.bold(a.geminiPurple("Available Skills"))),console.log(),t.length===0){m.info(" No skills found."),console.log();return}for(let e of t)console.log(` ${a.success("\u2713")} ${a.primary(e.name)}`);console.log(),console.log(a.dim(` Total: ${t.length} skills`)),console.log()}async function Cp(){let t=Wo();if(console.log(),console.log(p.default.bold(a.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(` ${a.success("\u25CF")} ${a.primary(e.name)}`),console.log(` ${a.dim(e.description)}`);console.log(),console.log(a.dim(` Total: ${t.length} profiles`)),console.log()}import{spawnSync as ye}from"child_process";import{existsSync as ce,mkdirSync as sA,writeFileSync as Op,statSync as gc,copyFileSync as Jo,readdirSync as Up}from"fs";import{join as ae,extname as yi}from"path";import{homedir as qi}from"os";var Kp="clipboard-image",Vp="clipboard-video",aA=[".mp4",".webm",".mov",".avi",".mkv",".gif"],Np=5;function cA(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?Zp():Fp(e),r=i?Dp(n):Bp(n);if(e.json)console.log(JSON.stringify(r,null,2));else{if(console.log(),r.success){let o=i?"Video":"Image";console.log(`${a.success("\u2713")} ${o} captured successfully`),console.log(),console.log(` ${a.dim("Path:")} ${a.primary(String(r.path))}`),console.log(` ${a.dim("Size:")} ${r.size}`),i&&r.format&&console.log(` ${a.dim("Format:")} ${r.format}`),r.sourceType&&r.sourceType!=="clipboard"&&console.log(` ${a.dim("Source:")} ${r.sourceType}`),console.log(` ${a.dim("Platform:")} ${r.platform}`)}else console.error(`${a.error("\u2717")} ${r.error}`),r.suggestion&&console.log(` ${a.dim("Hint:")} ${r.suggestion}`);console.log()}process.exit(n.success?0:1)})}function lA(){let t=Co();if(t){let i=ae(qi(),".gemini","tmp",t);return ce(i)||sA(i,{recursive:!0}),i}let e=ae(process.cwd(),".gemini","tmp","clipboard");return ce(e)||sA(e,{recursive:!0}),e}function kp(t="png"){let e=Date.now(),i=Math.random().toString(36).substring(2,8);return`${Kp}-${e}-${i}.${t}`}function bo(t=".mp4"){let e=Date.now(),i=Math.random().toString(36).substring(2,8),n=aA.includes(t.toLowerCase())?t:".mp4";return`${Vp}-${e}-${i}${n}`}function xc(t){let e=yi(t).toLowerCase();return aA.includes(e)}function vA(t,e){for(let i of t)if(ce(i))try{let n=Up(i).filter(r=>xc(r)).map(r=>{let o=ae(i,r);return{name:r,path:o,mtime:gc(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<=Np){let s=yi(r.path),c=bo(s),l=ae(e,c);if(Jo(r.path,l),ce(l))return{success:!0,path:l,sourcePath:r.path,sourceType:"recent-recording"}}}}catch{}return null}function Fp(t){let e=t.format||"png",i=process.platform,n=lA(),r=kp(e),o=ae(n,r),s;switch(i){case"win32":s=Qp(o);break;case"darwin":s=Jp(o);break;case"linux":s=bp(o);break;default:s={success:!1,error:`Unsupported platform: ${i}`}}return s.platform=i,s.tempDir=n,s}function Qp(t){let e=t.replace(/\\/g,"\\\\"),i=`
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,7 +78,7 @@ 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=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 Jp(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 bp(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"}:(Op(t,r.stdout),ce(t)?{success:!0,path:t}:{success:!1,error:"Save failed"})}function Bp(t){if(t.success&&t.path){let e=gc(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 Zp(){let t=process.platform,e=lA(),i;switch(t){case"win32":i=Pp(e);break;case"darwin":i=qp(e);break;case"linux":i=yp(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 Pp(t){let e=`
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
82
  Add-Type -AssemblyName System.Windows.Forms
83
83
 
84
84
  # Try to get file drop list from clipboard (copied files)
@@ -145,7 +145,7 @@ if (Test-Path $videosFolder) {
145
145
 
146
146
  Write-Error "NO_VIDEO_FOUND"
147
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 s=yi(r),c=bo(s),l=ae(t,c);return Jo(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 qp(t){let e=`
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
149
  use scripting additions
150
150
 
151
151
  set thePath to ""
@@ -167,9 +167,9 @@ if thePath is not "" then
167
167
  else
168
168
  return "NO_FILE"
169
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(!xc(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=yi(r),s=bo(o),c=ae(t,s);if(Jo(r,c),ce(c))return{success:!0,path:c,sourcePath:r,sourceType:"clipboard"}}let n=vA([ae(qi(),"Movies"),ae(qi(),"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 yp(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://",""))),xc(o)&&ce(o)){let s=yi(o),c=bo(s),l=ae(t,c);if(Jo(o,l),ce(l))return{success:!0,path:l,sourcePath:o,sourceType:"clipboard"}}}let n=vA([ae(qi(),"Videos"),ae(qi(),"Screencasts"),ae(qi(),"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 Dp(t){if(t.success&&t.path){let i=(gc(t.path).size/(1024*1024)).toFixed(2),n=yi(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 AA={"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 Bo,readdirSync as Zo,mkdirSync as Yc,writeFileSync as uA,copyFileSync as Gc,statSync as mA}from"fs";import{join as W}from"path";var wp=".claude/skills",Tp=".gemini/extensions",Xp=".claude/agents",Hp=".gemini/agents";function Wc(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 s=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[s]=c}return i}function Po(t=process.cwd()){return W(t,wp)}function qo(t=process.cwd()){return W(t,Tp)}function yo(t=process.cwd()){let e=Po(t);if(!le(e))return[];let i=[];try{let n=Zo(e,{withFileTypes:!0}).filter(r=>r.isDirectory()).map(r=>r.name);for(let r of n){let o=W(e,r),s=W(o,"SKILL.md"),c=W(o,"references"),l=le(s),v=le(c)&&mA(c).isDirectory(),A;if(l)try{let u=Bo(s,"utf-8");A=Wc(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 Mc(t,e=process.cwd()){let i=W(qo(e),t);return le(i)}function Lp(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 Sc(t,e,i){le(e)||(Yc(e,{recursive:!0}),i.push(e));let n=Zo(t,{withFileTypes:!0});for(let r of n){let o=W(t,r.name),s=W(e,r.name);r.isDirectory()?Sc(o,s,i):(Gc(o,s),i.push(s))}}function Cc(t,e={},i=process.cwd()){let n={skill:t,success:!1,created:[],skipped:[],errors:[]},r=Po(i),o=qo(i),s=W(r,t),c=W(o,t);if(!le(s))return n.errors.push(`Skill not found: ${t}`),n;let l=W(s,"SKILL.md");if(!le(l))return n.errors.push(`SKILL.md not found in ${t}`),n;if(Mc(t,i)&&!e.force)return n.skipped.push(`Extension already exists: ${t} (use --force to overwrite)`),n;let v=null;try{let E=Bo(l,"utf-8");v=Wc(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(s,"references"),u=le(A)&&mA(A).isDirectory(),I=Lp(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)||(Yc(c,{recursive:!0}),n.created.push(c));let E=W(c,"gemini-extension.json");uA(E,JSON.stringify(I,null,2)+`
171
- `),n.created.push(E);let f=W(c,"SKILL.md");if(Gc(l,f),n.created.push(f),u){let h=W(c,"references");Sc(A,h,n.created)}let R=Zo(s,{withFileTypes:!0});for(let h of R){if(h.name==="SKILL.md"||h.name==="references")continue;let H=W(s,h.name),ve=W(c,h.name);h.isDirectory()?Sc(H,ve,n.created):(Gc(H,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 EA(t={},e=process.cwd()){let i=yo(e),n=[];for(let r of i){let o=Cc(r.name,t,e);n.push(o)}return n}function Oc(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 Do(t=process.cwd()){return W(t,Xp)}function wo(t=process.cwd()){return W(t,Hp)}function IA(t){let e=Wc(t);return e?{name:e.name||"",description:e.description||"",model:e.model,skills:e.skills}:null}function To(t=process.cwd()){let e=Do(t);if(!le(e))return[];let i=[];try{let n=Zo(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),s=r.replace(/\.md$/,""),c,l,v;try{let A=Bo(o,"utf-8"),u=IA(A);u&&(c=u.description,l=u.model,v=u.skills)}catch{}i.push({name:s,path:o,description:c,model:l,skills:v})}}catch{}return i.sort((n,r)=>n.name.localeCompare(r.name))}function Uc(t,e=process.cwd()){let i=W(wo(e),`${t}.md`);return le(i)}function _p(t){if(t)return AA[t]||t}function $p(t,e){let i=t.match(/^(---\r?\n)([\s\S]*?)(\r?\n---)/);if(!i)return t;let[n,r,o,s]=i,c=o.split(/\r?\n/),l=[],v=new Set;for(let u of c){let I=u.indexOf(":");if(I===-1){l.push(u);continue}let E=u.slice(0,I).trim();E in e?(v.add(E),e[E]!==void 0&&l.push(`${E}: ${e[E]}`)):l.push(u)}for(let[u,I]of Object.entries(e))!v.has(u)&&I!==void 0&&l.push(`${u}: ${I}`);let A=r+l.join(`
172
- `)+s;return t.replace(n,A)}function Kc(t,e={},i=process.cwd()){let n={skill:t,success:!1,created:[],skipped:[],errors:[]},r=Do(i),o=wo(i),s=W(r,`${t}.md`),c=W(o,`${t}.md`);if(!le(s))return n.errors.push(`Agent not found: ${t}`),n;if(Uc(t,i)&&!e.force)return n.skipped.push(`Agent already exists in .gemini/agents: ${t} (use --force to overwrite)`),n;let l;try{l=Bo(s,"utf-8")}catch(E){return n.errors.push(`Failed to read agent file: ${E instanceof Error?E.message:String(E)}`),n}let A=IA(l)?.model,u=_p(A),I=l;if(A&&u&&A!==u&&(I=$p(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)||Yc(o,{recursive:!0}),uA(c,I),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 pA(t={},e=process.cwd()){let i=To(e),n=[];for(let r of i){let o=Kc(r.name,t,e);n.push(o)}return n}function fA(){console.log(),console.log(p.default.bold(a.geminiPurple("Convert .claude to .gemini"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk convert")} <type> [name] [options]`),console.log(),console.log("Types:"),console.log(` ${a.primary("skill")} <name> Convert a single skill to extension`),console.log(` ${a.primary("skills")} Convert all skills to extensions`),console.log(` ${a.primary("agent")} <name> Convert a single agent`),console.log(` ${a.primary("agents")} Convert all agents`),console.log(),console.log("Options:"),console.log(` ${a.dim("--list")} List available items`),console.log(` ${a.dim("--force")} Overwrite existing items`),console.log(` ${a.dim("--dry-run")} Show what would be done without changes`),console.log(` ${a.dim("--json")} Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk convert skill --list")}`),console.log(` ${a.dim("gk convert skill my-skill")}`),console.log(` ${a.dim("gk convert skills --force")}`),console.log(` ${a.dim("gk convert agent --list")}`),console.log(` ${a.dim("gk convert agents --dry-run")}`),console.log()}function hA(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){fA();return}if(e==="skill"||e==="skills"){if(n.list){await e9(n);return}if(n.all||e==="skills"){await i9(n);return}i||(console.log(),m.error("Skill name required"),console.log(a.dim("Usage: gk convert skill <name>")),console.log(a.dim(" gk convert skill --list (to see available skills)")),console.log(a.dim(" gk convert skills (to convert all)")),console.log(),process.exit(1)),await t9(i,n);return}if(e==="agent"||e==="agents"){if(n.list){await n9(n);return}if(n.all||e==="agents"){await o9(n);return}i||(console.log(),m.error("Agent name required"),console.log(a.dim("Usage: gk convert agent <name>")),console.log(a.dim(" gk convert agent --list (to see available agents)")),console.log(a.dim(" gk convert agents (to convert all)")),console.log(),process.exit(1)),await r9(i,n);return}fA()})}async function e9(t){let e=yo();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(a.geminiPurple("Available Claude Skills"))),console.log(a.dim(` Source: ${Po()}`)),console.log(),e.length===0){m.info("No skills found in .claude/skills/"),console.log();return}for(let i of e){let n=Mc(i.name),r=n?a.success("\u2713"):a.dim("\u25CB"),o=n?a.dim(" (converted)"):"";if(console.log(` ${r} ${a.primary(i.name)}${o}`),i.description){let s=i.description.length>70?i.description.slice(0,70)+"...":i.description;console.log(` ${a.dim(s)}`)}}console.log(),console.log(a.dim(` Total: ${e.length} skills`)),console.log()}async function t9(t,e){let i=Cc(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(` ${a.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(` ${a.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(` ${a.dim("\u2192")} ${n}`);console.log();return}m.success(`Converted skill: ${a.primary(t)}`),console.log(),console.log(` ${a.dim("Created files:")}`);for(let n of i.created.slice(0,5)){let r=n.replace(process.cwd(),".");console.log(` ${a.success("+")} ${r}`)}i.created.length>5&&console.log(` ${a.dim(`... and ${i.created.length-5} more`)}`),console.log(),console.log(a.dim(` Extension created at: ${qo()}/${t}`)),console.log()}async function i9(t){if(yo().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=EA({force:t.force,dryRun:t.dryRun}),n=Oc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(p.default.bold(a.geminiPurple("[DRY RUN] Skill Conversion Preview"))):console.log(p.default.bold(a.geminiPurple("Skill Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${a.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${a.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${a.dim("\u25CB")} ${r.skill} ${a.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?a.dim("\u2192"):a.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${a.dim("Would convert:")} ${n.success} skills`),console.log(` ${a.dim("Would skip:")} ${n.skipped} skills`),console.log(` ${a.dim("Would fail:")} ${n.failed} skills`)):(console.log(` ${a.success("Converted:")} ${n.success}`),console.log(` ${a.dim("Skipped:")} ${n.skipped}`),console.log(` ${a.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(m.info("Use --force to overwrite existing extensions"),console.log())}async function n9(t){let e=To();if(t.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(p.default.bold(a.geminiPurple("Available Claude Agents"))),console.log(a.dim(` Source: ${Do()}`)),console.log(),e.length===0){m.info("No agents found in .claude/agents/"),console.log();return}for(let i of e){let n=Uc(i.name),r=n?a.success("\u2713"):a.dim("\u25CB"),o=n?a.dim(" (converted)"):"";if(console.log(` ${r} ${a.primary(i.name)}${o}`),i.model&&console.log(` ${a.dim("Model:")} ${i.model}`),i.description){let s=i.description.length>60?i.description.slice(0,60)+"...":i.description;console.log(` ${a.dim(s)}`)}}console.log(),console.log(a.dim(` Total: ${e.length} agents`)),console.log()}async function r9(t,e){let i=Kc(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(` ${a.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(` ${a.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(` ${a.dim("\u2192")} ${n}`);console.log();return}m.success(`Converted agent: ${a.primary(t)}`),console.log();for(let n of i.created){let r=n.replace(process.cwd(),".");console.log(` ${a.success("+")} ${r}`)}console.log(),console.log(a.dim(` Agent created at: ${wo()}/${t}.md`)),console.log()}async function o9(t){if(To().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=pA({force:t.force,dryRun:t.dryRun}),n=Oc(i);if(t.json){console.log(JSON.stringify({results:i,summary:n},null,2));return}console.log(),t.dryRun?console.log(p.default.bold(a.geminiPurple("[DRY RUN] Agent Conversion Preview"))):console.log(p.default.bold(a.geminiPurple("Agent Conversion Results"))),console.log(M.line()),console.log();for(let r of i)if(r.errors.length>0){console.log(` ${a.error("\u2717")} ${r.skill}`);for(let o of r.errors)console.log(` ${a.dim(o)}`)}else if(r.skipped.length>0)console.log(` ${a.dim("\u25CB")} ${r.skill} ${a.dim("(skipped)")}`);else if(r.success){let o=t.dryRun?a.dim("\u2192"):a.success("\u2713");console.log(` ${o} ${r.skill}`)}console.log(),console.log(M.line()),console.log(),t.dryRun?(console.log(` ${a.dim("Would convert:")} ${n.success} agents`),console.log(` ${a.dim("Would skip:")} ${n.skipped} agents`),console.log(` ${a.dim("Would fail:")} ${n.failed} agents`)):(console.log(` ${a.success("Converted:")} ${n.success}`),console.log(` ${a.dim("Skipped:")} ${n.skipped}`),console.log(` ${a.error("Failed:")} ${n.failed}`)),console.log(),n.skipped>0&&!t.force&&(m.info("Use --force to overwrite existing agents"),console.log())}function Kt(){return{orchestrator:null,agents:new Map,sessionId:null,projectDir:null,activePlan:null,appName:null,currentNotification:null,inbox:[],documents:[],isActive:!1}}var s9=[[/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 Xo(t,e=!1){if(e)return"\u{1F451}";for(let[i,n]of s9)if(i.test(t))return n;return"\u{1F916}"}function Vc(t){return t.replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function kc(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 Nc(t,e){return t.agentType==="Main Agent"||t.parentGkSessionId===null||t.gkSessionId===e.gkSessionId}function a9(t,e){return t==="active"?"working":"idle"}function c9(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 l9(t){return t.status==="completed"?"Task complete!":t.status==="failed"?"Task failed":t.injected?.skills?.length?`Working on ${t.injected.skills[0]}...`:null}function dA(t,e){let i=Nc(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:kc(r),icon:Xo(r,i),state:a9(t.status,n),activeSkill:t.injected?.skills?.[0]||null,progress:c9(t),speechBubble:l9(t),hasFireEffect:n,gkSessionId:t.gkSessionId,parentSessionId:t.parentGkSessionId};if(i){let s=e.agents.filter(c=>!Nc(c,e));return{...o,agentType:"orchestrator",delegatedTo:s.filter(c=>c.status==="active").map(c=>c.gkSessionId),totalSubAgents:s.length,completedSubAgents:s.filter(c=>c.status==="completed").length}}return o}function RA(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:Xo(t.agentRole||""),timestamp:t.endTime?new Date(t.endTime).getTime():Date.now(),status:"unread",title:`${Vc(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 Di(t){let e=Kt();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=dA(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(RA(i)))}return e.inbox.sort((i,n)=>n.timestamp-i.timestamp),e}import{existsSync as wi,readdirSync as Ho,statSync as Fc}from"fs";import{join as ct,basename as v9,extname as zA,relative as A9}from"path";import{createHash as u9}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 jA(t){let e=t.match(/^phase-(\d+)/);return e?parseInt(e[1],10):null}function E9(t,e){if(e==="phase"){let i=jA(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 Ti(t,e,i){let n=Fc(t),r=v9(t,zA(t)),o=zA(t).slice(1);return{id:u9("md5").update(t).digest("hex").slice(0,8),name:r,displayName:E9(r,e),type:e,icon:m9(e,o),path:t,relativePath:A9(i,t),modifiedAt:n.mtimeMs,createdAt:n.birthtimeMs,size:n.size,extension:o,phaseNumber:jA(r)}}function Qc(t){if(!wi(t))return[];let e=[],i=ct(t,"plan.md");wi(i)&&e.push(Ti(i,"plan",t));let n=Ho(t);for(let c of n){let l=ct(t,c),v=Fc(l);if(c.startsWith("phase-"))if(v.isDirectory()){let A=ct(l,"phase.md");wi(A)&&e.push(Ti(A,"phase",t))}else c.endsWith(".md")&&e.push(Ti(l,"phase",t))}let r=ct(t,"research");if(wi(r)){let c=Ho(r).filter(l=>l.endsWith(".md"));for(let l of c)e.push(Ti(ct(r,l),"research",t))}let o=ct(t,"artifacts");if(wi(o)){let c=Ho(o);for(let l of c){let v=ct(o,l);Fc(v).isFile()&&e.push(Ti(v,"artifact",t))}}let s=ct(t,"reports");if(wi(s)){let c=Ho(s).filter(l=>l.endsWith(".md"));for(let l of c)e.push(Ti(ct(s,l),"report",t))}return e.sort((c,l)=>l.modifiedAt-c.modifiedAt),e}var I9=1e3,Vt=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>I9&&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 p9,readFileSync as f9,statSync as gA}from"fs";var h9=200,Nt=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=Zt(i,n),!p9(this.sessionPath))return this.options.onError(new Error(`Session file not found: ${this.sessionPath}`)),!1;try{let r=gA(this.sessionPath);this.previousMtime=r.mtimeMs}catch{}return this.loadSession(),this.pollInterval=setInterval(()=>{this.checkForChanges()},h9),!0}stop(){this.pollInterval&&(clearInterval(this.pollInterval),this.pollInterval=null)}checkForChanges(){if(this.sessionPath)try{let i=gA(this.sessionPath).mtimeMs;i>this.previousMtime&&(this.previousMtime=i,this.loadSession())}catch{}}loadSession(){if(this.sessionPath)try{let e=f9(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 s=i.agents.every(l=>l.status==="completed"||l.status==="failed"),c=e.agents.some(l=>l.status==="active");return s&&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:kc(i.agentRole||"coder")}}};import{exec as g9}from"child_process";import{join as x9}from"path";import{createServer as d9}from"http";import{WebSocketServer as R9,WebSocket as GA}from"ws";import{exec as z9}from"child_process";import{existsSync as SA}from"fs";import{resolve as j9}from"path";function xA(){return`<!DOCTYPE html>
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>
173
173
  <html lang="en">
174
174
  <head>
175
175
  <meta charset="UTF-8">
@@ -3575,4 +3575,4 @@ hookStopAgentAnimation();
3575
3575
 
3576
3576
  </script>
3577
3577
  </body>
3578
- </html>`}var Lo=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,s=()=>{this.server=d9((c,l)=>this.handleRequest(c,l)),this.server.on("error",c=>{c.code==="EADDRINUSE"&&r<o?(r++,n++,s()):i(c)}),this.server.listen(n,this.options.host||"localhost",()=>{this.wss=new R9({server:this.server}),this.setupWebSocket(),this.options.emitter.onStateChange(c=>{this.broadcastState(c)}),this.options.emitter.onEvent(c=>{this.broadcastEvent(c)}),e(n)})};s()})}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 s=new URL(n,`http://${e.headers.host}`).searchParams.get("path");if(!s){i.writeHead(400,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:"No path provided"}));return}let c=s;if(SA(c)||(c=j9(process.cwd(),s)),!SA(c)){i.writeHead(404,{"Content-Type":"application/json"}),i.end(JSON.stringify({success:!1,error:`File not found: ${s}`}));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(f=>A.includes(f)),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")),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(xA());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===GA.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===GA.OPEN)try{n.send(i)}catch{}}serializeState(e){return{...e,agents:Object.fromEntries(e.agents)}}};var _o=class{server=null;emitter;watcher;options;constructor(e={}){this.options={port:3847,host:"localhost",autoOpen:!0,...e},this.emitter=new Vt(Kt()),this.watcher=new Nt({onSessionChange:i=>{let n=Di(i);if(n.activePlan)try{let r=di(),o=x9(r,n.activePlan);n.documents=Qc(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 Lo({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}`;g9(i,n=>{n&&console.log(`Open ${e} in your browser`)})}};async function Jc(t={}){let e=new _o(t);return await e.start(),e}function bc(){console.log(),console.log(p.default.bold(a.geminiPurple("Agent Office"))),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk office")} <subcommand> [options]`),console.log(),console.log("Subcommands:"),console.log(` ${a.primary("start")} Start the visualization`),console.log(` ${a.primary("status")} Show current office state`),console.log(` ${a.primary("watch")} Watch office state changes`),console.log(),console.log("Options:"),console.log(` ${a.dim("-p, --port <n>")} [start] Web server port (default: 3847)`),console.log(` ${a.dim("--no-open")} [start] Don't auto-open browser`),console.log(` ${a.dim("--json")} [status/watch] Output as JSON`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk office start")}`),console.log(` ${a.dim("gk office start --port 4000")}`),console.log(` ${a.dim("gk office status --json")}`),console.log(` ${a.dim("gk office watch")}`),console.log()}function G9(){console.log(),console.log(p.default.bold(a.geminiPurple("gk office start"))),console.log(a.dim("Start the Agent Office web dashboard")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk office start")} [options]`),console.log(),console.log("Options:"),console.log(` ${a.dim("-p, --port <n>")} Web server port (default: 3847)`),console.log(` ${a.dim("--no-open")} Don't auto-open browser`),console.log(),console.log("Examples:"),console.log(` ${a.dim("gk office start")}`),console.log(` ${a.dim("gk office start --port 4000")}`),console.log(` ${a.dim("gk office start --port 4000 --no-open")}`),console.log()}function S9(){console.log(),console.log(p.default.bold(a.geminiPurple("gk office status"))),console.log(a.dim("Show current Agent Office state")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk office status")} [options]`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log()}function Y9(){console.log(),console.log(p.default.bold(a.geminiPurple("gk office watch"))),console.log(a.dim("Watch Agent Office state changes in real-time")),console.log(),console.log("Usage:"),console.log(` ${a.primary("gk office watch")} [options]`),console.log(),console.log("Options:"),console.log(` ${a.dim("--json")} Output as JSON`),console.log()}async function W9(t){console.log(),m.info("Starting Agent Office..."),console.log();try{let e=await Jc({port:t.port||3847,autoOpen:t.open!==!1,onReady:i=>{m.success(`Dashboard running at ${a.primary(`http://localhost:${i}`)}`),console.log(a.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(a.dim(" Start a GemKit session first with: gk agent")),console.log()):m.error(`Failed to start: ${e.message}`)),process.exit(1)}}function M9(t){let e=new Vt(Kt()),i=new Nt({onSessionChange:r=>{let o=Di(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(a.geminiPurple("Agent Office Status"))),console.log(M.line()),console.log(),console.log(` ${a.dim("Active Plan:")} ${o.activePlan?a.primary(o.activePlan):a.dim("(none)")}`),console.log(` ${a.dim("Agents:")} ${o.agents.size}`),console.log(` ${a.dim("Inbox Items:")} ${o.inbox.length}`),console.log(` ${a.dim("Documents:")} ${o.documents.length}`),o.agents.size>0){console.log(),console.log(a.dim(" Agents:"));for(let[s,c]of o.agents){let l=c.state==="working"?a.warn:c.state==="idle"?a.success:a.dim;console.log(` ${c.icon} ${a.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(a.dim(" Start a GemKit session first with: gk agent")),console.log(),process.exit(1))}function C9(t){console.log(),m.info("Watching Agent Office state..."),console.log(a.dim(" Press Ctrl+C to stop")),console.log();let e=new Vt(Kt()),i=new Nt({onSessionChange:r=>{let o=Di(r);if(t.json)console.log(JSON.stringify({timestamp:new Date().toISOString(),...o,agents:Object.fromEntries(o.agents)}));else{let s=new Date().toLocaleTimeString();console.log(`${a.dim(s)} ${a.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(`${a.dim(o)} ${a.secondary("Event:")} ${r.type}`)}},onError:r=>{m.error(`Error: ${r.message}`)}});i.start()||(console.log(),m.warn("No active session found."),console.log(a.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 YA(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":G9();return;case"status":S9();return;case"watch":Y9();return;default:bc();return}switch(e){case"start":await W9(i);break;case"status":M9(i);break;case"watch":C9(i);break;case void 0:case"help":bc();break;default:console.log(),m.error(`Unknown subcommand: ${e}`),bc(),process.exit(1)}})}function WA(t){Ev(t),Av(t),Iv(t),fv(t),hv(t),dv(t),Rv(t),Hv(t),Lv(t),eA(t),nA(t),rA(t),oA(t),cA(t),hA(t),YA(t)}import{existsSync as MA,readFileSync as O9,writeFileSync as U9,mkdirSync as K9}from"fs";import{join as V9,dirname as N9}from"path";import{homedir as k9}from"os";var $o=V9(k9(),".gemkit","last-update-check.json");function CA(){try{return MA($o)?JSON.parse(O9($o,"utf-8")):null}catch{return null}}function F9(t){try{let e=N9($o);MA(e)||K9(e,{recursive:!0}),U9($o,JSON.stringify(t,null,2))}catch{}}function Q9(t){let e=CA();if(!e)return!0;let i=new Date(e.lastCheck);return(new Date().getTime()-i.getTime())/(1e3*60*60)>=t}async function OA(){let e=Ve().update;if(e?.autoCheck&&Q9(e.checkInterval))try{let i=await uv(),n=CA()||{lastCheck:""},r=[];i.cli?.available&&n.notifiedCli!==i.cli.latest&&(r.push(`${a.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(`${a.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(a.dim("\u2500".repeat(50))),console.log(`${a.warn("\u2B06")} Updates available:`),r.forEach(o=>console.log(` ${o}`)),console.log(` Run ${a.primary("gk update")} to update.`),console.log(a.dim("\u2500".repeat(50))),console.log()),n.lastCheck=new Date().toISOString(),F9(n)}catch{}}var kt=Xc("gk");kt.version(de);kt.help();kt.option("--verbose","Enable verbose output");kt.option("--json","Output as JSON");kt.option("--no-update-check","Skip auto-update check");var Bc=kt.parse(process.argv,{run:!1});Bc.options.verbose&&So({level:"debug",verbose:!0});Bc.options.json&&So({json:!0});WA(kt);Bc.options.updateCheck!==!1&&OA().catch(()=>{});kt.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();