d1-prisma 0.1.0

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 +156 -0
  2. package/dist/index.js +300 -0
  3. package/package.json +30 -0
package/README.md ADDED
@@ -0,0 +1,156 @@
1
+ # d1-prisma
2
+
3
+ A Bridge CLI to manage Cloudflare D1 migrations with Prisma
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g d1-prisma
9
+ # or
10
+ yarn global add d1-prisma
11
+ # or
12
+ pnpm add -g d1-prisma
13
+ # or
14
+ bun add -g d1-prisma
15
+ ```
16
+
17
+ ## Building from Source
18
+
19
+ To install dependencies:
20
+
21
+ ```bash
22
+ bun install
23
+ ```
24
+
25
+ To build:
26
+
27
+ ```bash
28
+ bun run build
29
+ ```
30
+
31
+ To run from source:
32
+
33
+ ```bash
34
+ bun run src/index.ts
35
+ ```
36
+
37
+ This project was created using `bun init` in bun v1.3.3. [Bun](https://bun.com) is a fast all-in-one JavaScript runtime.
38
+
39
+ ## Features
40
+
41
+ - **Seamless Integration**: Bridges Cloudflare D1 and Prisma migrations for a smooth development workflow
42
+ - **Migration Creation**: Generates SQL migration files based on Prisma schema changes
43
+ - **Migration Application**: Applies migrations to local or remote D1 databases
44
+ - **Prisma Client Generation**: Automatically regenerates Prisma client after migrations
45
+ - **Cross-Platform**: Works on Windows, macOS, and Linux
46
+ - **Multiple Package Managers**: Compatible with npm, yarn, pnpm, and bun
47
+
48
+ ## Usage
49
+
50
+ ### Database Configuration
51
+
52
+ First, ensure you have a `wrangler.toml` or `wrangler.jsonc` file in your project root with your D1 database configuration:
53
+
54
+ ```toml
55
+ # wrangler.toml
56
+ [[d1_databases]]
57
+ binding = "DB"
58
+ database_name = "my-database"
59
+ database_id = "your-database-id"
60
+ ```
61
+
62
+ ### Creating Migrations
63
+
64
+ To create a new migration:
65
+
66
+ ```bash
67
+ d1-prisma create --name "add-users-table"
68
+ ```
69
+
70
+ Options:
71
+ - `--name`, `-n`: Migration name
72
+ - `--schema`: Path to Prisma schema (default: "./prisma/schema.prisma")
73
+ - `--database`, `-d`: Specific database to use
74
+
75
+ The CLI will:
76
+ 1. Back up your current Prisma schema
77
+ 2. Create a new migration file using Wrangler
78
+ 3. Pull the current database schema into Prisma
79
+ 4. Generate a diff between the current and desired schema
80
+ 5. Append the diff to the migration file
81
+ 6. Restore your original schema
82
+
83
+ ### Applying Migrations
84
+
85
+ To apply migrations locally:
86
+
87
+ ```bash
88
+ d1-prisma apply
89
+ ```
90
+
91
+ To apply migrations to remote database:
92
+
93
+ ```bash
94
+ d1-prisma apply --remote
95
+ ```
96
+
97
+ After applying, the CLI automatically regenerates your Prisma client.
98
+
99
+ ## Prerequisites
100
+
101
+ - Node.js (v16 or higher)
102
+ - Wrangler CLI installed (`npm install -g wrangler`)
103
+ - Prisma CLI installed (`npm install -g prisma`)
104
+ - A configured Cloudflare D1 database
105
+
106
+ ## Configuration
107
+
108
+ The tool automatically detects your configuration files:
109
+
110
+ - `wrangler.jsonc`
111
+ - `wrangler.toml`
112
+
113
+ If multiple D1 databases are configured, you'll be prompted to select one.
114
+
115
+ ## Development
116
+
117
+ ### Scripts
118
+
119
+ - `build`: Build the project to `dist/` directory
120
+ - `dev`: Watch mode for development
121
+ - `start`: Run the built CLI
122
+
123
+ ### Architecture
124
+
125
+ The project consists of:
126
+
127
+ - `src/index.ts`: Main CLI entry point
128
+ - `src/utils/config.ts`: Configuration file parsing
129
+ - `src/utils/shell.ts`: Shell command utilities
130
+
131
+ ## Contributing
132
+
133
+ Contributions are welcome! Please feel free to submit a Pull Request.
134
+
135
+ ## License
136
+
137
+ This project is open source and available under the [MIT License](LICENSE).
138
+
139
+ ## Acknowledgments
140
+
141
+ - [Cloudflare D1](https://developers.cloudflare.com/d1/) - Serverless database
142
+ - [Prisma](https://prisma.io) - Database toolkit
143
+ - [Wrangler](https://developers.cloudflare.com/workers/wrangler/) - Cloudflare CLI tool
144
+ - Inspired by [Alex Anderson Migrator CLI](https://gist.github.com/alexanderson1993/0852a8162ebac591b62a79883a81e1a8)
145
+
146
+ ## Support
147
+
148
+ If you encounter any issues or have questions, please open an issue on GitHub.
149
+
150
+ ## Changelog
151
+
152
+ ### v0.1.0
153
+
154
+ - Initial release
155
+ - Basic migration creation and application
156
+ - Support for local and remote databases
package/dist/index.js ADDED
@@ -0,0 +1,300 @@
1
+ #!/usr/bin/env node
2
+ var mO=Object.create;var{getPrototypeOf:cO,defineProperty:dI,getOwnPropertyNames:jO}=Object;var gO=Object.prototype.hasOwnProperty;var II=(I,R,E)=>{E=I!=null?mO(cO(I)):{};let N=R||!I||!I.__esModule?dI(E,"default",{value:I,enumerable:!0}):E;for(let T of jO(I))if(!gO.call(N,T))dI(N,T,{get:()=>I[T],enumerable:!0});return N};var vI=(I,R)=>()=>(R||I((R={exports:{}}).exports,R),R.exports);var MI=vI((L1,lI)=>{var GI={to(I,R){if(!R)return`\x1B[${I+1}G`;return`\x1B[${R+1};${I+1}H`},move(I,R){let E="";if(I<0)E+=`\x1B[${-I}D`;else if(I>0)E+=`\x1B[${I}C`;if(R<0)E+=`\x1B[${-R}A`;else if(R>0)E+=`\x1B[${R}B`;return E},up:(I=1)=>`\x1B[${I}A`,down:(I=1)=>`\x1B[${I}B`,forward:(I=1)=>`\x1B[${I}C`,backward:(I=1)=>`\x1B[${I}D`,nextLine:(I=1)=>"\x1B[E".repeat(I),prevLine:(I=1)=>"\x1B[F".repeat(I),left:"\x1B[G",hide:"\x1B[?25l",show:"\x1B[?25h",save:"\x1B7",restore:"\x1B8"},kO={up:(I=1)=>"\x1B[S".repeat(I),down:(I=1)=>"\x1B[T".repeat(I)},yO={screen:"\x1B[2J",up:(I=1)=>"\x1B[1J".repeat(I),down:(I=1)=>"\x1B[J".repeat(I),line:"\x1B[2K",lineEnd:"\x1B[K",lineStart:"\x1B[1K",lines(I){let R="";for(let E=0;E<I;E++)R+=this.line+(E<I-1?GI.up():"");if(I)R+=GI.left;return R}};lI.exports={cursor:GI,scroll:kO,erase:yO,beep:"\x07"}});var WI=vI((A1,$I)=>{var RI=process||{},oI=RI.argv||[],OI=RI.env||{},dO=!(!!OI.NO_COLOR||oI.includes("--no-color"))&&(!!OI.FORCE_COLOR||oI.includes("--color")||RI.platform==="win32"||(RI.stdout||{}).isTTY&&OI.TERM!=="dumb"||!!OI.CI),vO=(I,R,E=I)=>(N)=>{let T=""+N,S=T.indexOf(R,I.length);return~S?I+lO(T,R,E,S)+R:I+T+R},lO=(I,R,E,N)=>{let T="",S=0;do T+=I.substring(S,N)+E,S=N+R.length,N=I.indexOf(R,S);while(~N);return T+I.substring(S)},nI=(I=dO)=>{let R=I?vO:()=>String;return{isColorSupported:I,reset:R("\x1B[0m","\x1B[0m"),bold:R("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:R("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:R("\x1B[3m","\x1B[23m"),underline:R("\x1B[4m","\x1B[24m"),inverse:R("\x1B[7m","\x1B[27m"),hidden:R("\x1B[8m","\x1B[28m"),strikethrough:R("\x1B[9m","\x1B[29m"),black:R("\x1B[30m","\x1B[39m"),red:R("\x1B[31m","\x1B[39m"),green:R("\x1B[32m","\x1B[39m"),yellow:R("\x1B[33m","\x1B[39m"),blue:R("\x1B[34m","\x1B[39m"),magenta:R("\x1B[35m","\x1B[39m"),cyan:R("\x1B[36m","\x1B[39m"),white:R("\x1B[37m","\x1B[39m"),gray:R("\x1B[90m","\x1B[39m"),bgBlack:R("\x1B[40m","\x1B[49m"),bgRed:R("\x1B[41m","\x1B[49m"),bgGreen:R("\x1B[42m","\x1B[49m"),bgYellow:R("\x1B[43m","\x1B[49m"),bgBlue:R("\x1B[44m","\x1B[49m"),bgMagenta:R("\x1B[45m","\x1B[49m"),bgCyan:R("\x1B[46m","\x1B[49m"),bgWhite:R("\x1B[47m","\x1B[49m"),blackBright:R("\x1B[90m","\x1B[39m"),redBright:R("\x1B[91m","\x1B[39m"),greenBright:R("\x1B[92m","\x1B[39m"),yellowBright:R("\x1B[93m","\x1B[39m"),blueBright:R("\x1B[94m","\x1B[39m"),magentaBright:R("\x1B[95m","\x1B[39m"),cyanBright:R("\x1B[96m","\x1B[39m"),whiteBright:R("\x1B[97m","\x1B[39m"),bgBlackBright:R("\x1B[100m","\x1B[49m"),bgRedBright:R("\x1B[101m","\x1B[49m"),bgGreenBright:R("\x1B[102m","\x1B[49m"),bgYellowBright:R("\x1B[103m","\x1B[49m"),bgBlueBright:R("\x1B[104m","\x1B[49m"),bgMagentaBright:R("\x1B[105m","\x1B[49m"),bgCyanBright:R("\x1B[106m","\x1B[49m"),bgWhiteBright:R("\x1B[107m","\x1B[49m")}};$I.exports=nI();$I.exports.createColors=nI});import yI from"node:fs/promises";import R1 from"node:path";var Q=II(MI(),1),OO=II(WI(),1);import{stdin as eI,stdout as IO}from"node:process";import*as k from"node:readline";import iI from"node:readline";import{Writable as oO}from"node:stream";function nO({onlyFirst:I=!1}={}){let R=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");return new RegExp(R,I?void 0:"g")}var iO=nO();function RO(I){if(typeof I!="string")throw TypeError(`Expected a \`string\`, got \`${typeof I}\``);return I.replace(iO,"")}function EO(I){return I&&I.__esModule&&Object.prototype.hasOwnProperty.call(I,"default")?I.default:I}var NO={exports:{}};(function(I){var R={};I.exports=R,R.eastAsianWidth=function(N){var T=N.charCodeAt(0),S=N.length==2?N.charCodeAt(1):0,O=T;return 55296<=T&&T<=56319&&56320<=S&&S<=57343&&(T&=1023,S&=1023,O=T<<10|S,O+=65536),O==12288||65281<=O&&O<=65376||65504<=O&&O<=65510?"F":O==8361||65377<=O&&O<=65470||65474<=O&&O<=65479||65482<=O&&O<=65487||65490<=O&&O<=65495||65498<=O&&O<=65500||65512<=O&&O<=65518?"H":4352<=O&&O<=4447||4515<=O&&O<=4519||4602<=O&&O<=4607||9001<=O&&O<=9002||11904<=O&&O<=11929||11931<=O&&O<=12019||12032<=O&&O<=12245||12272<=O&&O<=12283||12289<=O&&O<=12350||12353<=O&&O<=12438||12441<=O&&O<=12543||12549<=O&&O<=12589||12593<=O&&O<=12686||12688<=O&&O<=12730||12736<=O&&O<=12771||12784<=O&&O<=12830||12832<=O&&O<=12871||12880<=O&&O<=13054||13056<=O&&O<=19903||19968<=O&&O<=42124||42128<=O&&O<=42182||43360<=O&&O<=43388||44032<=O&&O<=55203||55216<=O&&O<=55238||55243<=O&&O<=55291||63744<=O&&O<=64255||65040<=O&&O<=65049||65072<=O&&O<=65106||65108<=O&&O<=65126||65128<=O&&O<=65131||110592<=O&&O<=110593||127488<=O&&O<=127490||127504<=O&&O<=127546||127552<=O&&O<=127560||127568<=O&&O<=127569||131072<=O&&O<=194367||177984<=O&&O<=196605||196608<=O&&O<=262141?"W":32<=O&&O<=126||162<=O&&O<=163||165<=O&&O<=166||O==172||O==175||10214<=O&&O<=10221||10629<=O&&O<=10630?"Na":O==161||O==164||167<=O&&O<=168||O==170||173<=O&&O<=174||176<=O&&O<=180||182<=O&&O<=186||188<=O&&O<=191||O==198||O==208||215<=O&&O<=216||222<=O&&O<=225||O==230||232<=O&&O<=234||236<=O&&O<=237||O==240||242<=O&&O<=243||247<=O&&O<=250||O==252||O==254||O==257||O==273||O==275||O==283||294<=O&&O<=295||O==299||305<=O&&O<=307||O==312||319<=O&&O<=322||O==324||328<=O&&O<=331||O==333||338<=O&&O<=339||358<=O&&O<=359||O==363||O==462||O==464||O==466||O==468||O==470||O==472||O==474||O==476||O==593||O==609||O==708||O==711||713<=O&&O<=715||O==717||O==720||728<=O&&O<=731||O==733||O==735||768<=O&&O<=879||913<=O&&O<=929||931<=O&&O<=937||945<=O&&O<=961||963<=O&&O<=969||O==1025||1040<=O&&O<=1103||O==1105||O==8208||8211<=O&&O<=8214||8216<=O&&O<=8217||8220<=O&&O<=8221||8224<=O&&O<=8226||8228<=O&&O<=8231||O==8240||8242<=O&&O<=8243||O==8245||O==8251||O==8254||O==8308||O==8319||8321<=O&&O<=8324||O==8364||O==8451||O==8453||O==8457||O==8467||O==8470||8481<=O&&O<=8482||O==8486||O==8491||8531<=O&&O<=8532||8539<=O&&O<=8542||8544<=O&&O<=8555||8560<=O&&O<=8569||O==8585||8592<=O&&O<=8601||8632<=O&&O<=8633||O==8658||O==8660||O==8679||O==8704||8706<=O&&O<=8707||8711<=O&&O<=8712||O==8715||O==8719||O==8721||O==8725||O==8730||8733<=O&&O<=8736||O==8739||O==8741||8743<=O&&O<=8748||O==8750||8756<=O&&O<=8759||8764<=O&&O<=8765||O==8776||O==8780||O==8786||8800<=O&&O<=8801||8804<=O&&O<=8807||8810<=O&&O<=8811||8814<=O&&O<=8815||8834<=O&&O<=8835||8838<=O&&O<=8839||O==8853||O==8857||O==8869||O==8895||O==8978||9312<=O&&O<=9449||9451<=O&&O<=9547||9552<=O&&O<=9587||9600<=O&&O<=9615||9618<=O&&O<=9621||9632<=O&&O<=9633||9635<=O&&O<=9641||9650<=O&&O<=9651||9654<=O&&O<=9655||9660<=O&&O<=9661||9664<=O&&O<=9665||9670<=O&&O<=9672||O==9675||9678<=O&&O<=9681||9698<=O&&O<=9701||O==9711||9733<=O&&O<=9734||O==9737||9742<=O&&O<=9743||9748<=O&&O<=9749||O==9756||O==9758||O==9792||O==9794||9824<=O&&O<=9825||9827<=O&&O<=9829||9831<=O&&O<=9834||9836<=O&&O<=9837||O==9839||9886<=O&&O<=9887||9918<=O&&O<=9919||9924<=O&&O<=9933||9935<=O&&O<=9953||O==9955||9960<=O&&O<=9983||O==10045||O==10071||10102<=O&&O<=10111||11093<=O&&O<=11097||12872<=O&&O<=12879||57344<=O&&O<=63743||65024<=O&&O<=65039||O==65533||127232<=O&&O<=127242||127248<=O&&O<=127277||127280<=O&&O<=127337||127344<=O&&O<=127386||917760<=O&&O<=917999||983040<=O&&O<=1048573||1048576<=O&&O<=1114109?"A":"N"},R.characterLength=function(N){var T=this.eastAsianWidth(N);return T=="F"||T=="W"||T=="A"?2:1};function E(N){return N.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}R.length=function(N){for(var T=E(N),S=0,O=0;O<T.length;O++)S=S+this.characterLength(T[O]);return S},R.slice=function(N,T,S){textLen=R.length(N),T=T||0,S=S||1,T<0&&(T=textLen+T),S<0&&(S=textLen+S);for(var O="",L=0,H=E(N),A=0;A<H.length;A++){var w=H[A],Y=R.length(w);if(L>=T-(Y==2?1:0))if(L+Y<=S)O+=w;else break;L+=Y}return O}})(NO);var pO=NO.exports,DO=EO(pO),uO=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\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|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\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]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g},aO=EO(uO);function u(I,R={}){if(typeof I!="string"||I.length===0||(R={ambiguousIsNarrow:!0,...R},I=RO(I),I.length===0))return 0;I=I.replace(aO()," ");let E=R.ambiguousIsNarrow?1:2,N=0;for(let T of I){let S=T.codePointAt(0);if(S<=31||S>=127&&S<=159||S>=768&&S<=879)continue;switch(DO.eastAsianWidth(T)){case"F":case"W":N+=2;break;case"A":N+=E;break;default:N+=1}}return N}var bI=10,pI=(I=0)=>(R)=>`\x1B[${R+I}m`,DI=(I=0)=>(R)=>`\x1B[${38+I};5;${R}m`,uI=(I=0)=>(R,E,N)=>`\x1B[${38+I};2;${R};${E};${N}m`,G={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]}};Object.keys(G.modifier);var rO=Object.keys(G.color),sO=Object.keys(G.bgColor);[...rO,...sO];function tO(){let I=new Map;for(let[R,E]of Object.entries(G)){for(let[N,T]of Object.entries(E))G[N]={open:`\x1B[${T[0]}m`,close:`\x1B[${T[1]}m`},E[N]=G[N],I.set(T[0],T[1]);Object.defineProperty(G,R,{value:E,enumerable:!1})}return Object.defineProperty(G,"codes",{value:I,enumerable:!1}),G.color.close="\x1B[39m",G.bgColor.close="\x1B[49m",G.color.ansi=pI(),G.color.ansi256=DI(),G.color.ansi16m=uI(),G.bgColor.ansi=pI(bI),G.bgColor.ansi256=DI(bI),G.bgColor.ansi16m=uI(bI),Object.defineProperties(G,{rgbToAnsi256:{value:(R,E,N)=>R===E&&E===N?R<8?16:R>248?231:Math.round((R-8)/247*24)+232:16+36*Math.round(R/255*5)+6*Math.round(E/255*5)+Math.round(N/255*5),enumerable:!1},hexToRgb:{value:(R)=>{let E=/[a-f\d]{6}|[a-f\d]{3}/i.exec(R.toString(16));if(!E)return[0,0,0];let[N]=E;N.length===3&&(N=[...N].map((S)=>S+S).join(""));let T=Number.parseInt(N,16);return[T>>16&255,T>>8&255,T&255]},enumerable:!1},hexToAnsi256:{value:(R)=>G.rgbToAnsi256(...G.hexToRgb(R)),enumerable:!1},ansi256ToAnsi:{value:(R)=>{if(R<8)return 30+R;if(R<16)return 90+(R-8);let E,N,T;if(R>=232)E=((R-232)*10+8)/255,N=E,T=E;else{R-=16;let L=R%36;E=Math.floor(R/36)/5,N=Math.floor(L/6)/5,T=L%6/5}let S=Math.max(E,N,T)*2;if(S===0)return 30;let O=30+(Math.round(T)<<2|Math.round(N)<<1|Math.round(E));return S===2&&(O+=60),O},enumerable:!1},rgbToAnsi:{value:(R,E,N)=>G.ansi256ToAnsi(G.rgbToAnsi256(R,E,N)),enumerable:!1},hexToAnsi:{value:(R)=>G.ansi256ToAnsi(G.hexToAnsi256(R)),enumerable:!1}}),G}var eO=tO(),TI=new Set(["\x1B","›"]),IR=39,fI="\x07",TO="[",OR="]",SO="m",QI=`${OR}8;;`,aI=(I)=>`${TI.values().next().value}${TO}${I}${SO}`,rI=(I)=>`${TI.values().next().value}${QI}${I}${fI}`,RR=(I)=>I.split(" ").map((R)=>u(R)),VI=(I,R,E)=>{let N=[...R],T=!1,S=!1,O=u(RO(I[I.length-1]));for(let[L,H]of N.entries()){let A=u(H);if(O+A<=E?I[I.length-1]+=H:(I.push(H),O=0),TI.has(H)&&(T=!0,S=N.slice(L+1).join("").startsWith(QI)),T){S?H===fI&&(T=!1,S=!1):H===SO&&(T=!1);continue}O+=A,O===E&&L<N.length-1&&(I.push(""),O=0)}!O&&I[I.length-1].length>0&&I.length>1&&(I[I.length-2]+=I.pop())},ER=(I)=>{let R=I.split(" "),E=R.length;for(;E>0&&!(u(R[E-1])>0);)E--;return E===R.length?I:R.slice(0,E).join(" ")+R.slice(E).join("")},NR=(I,R,E={})=>{if(E.trim!==!1&&I.trim()==="")return"";let N="",T,S,O=RR(I),L=[""];for(let[A,w]of I.split(" ").entries()){E.trim!==!1&&(L[L.length-1]=L[L.length-1].trimStart());let Y=u(L[L.length-1]);if(A!==0&&(Y>=R&&(E.wordWrap===!1||E.trim===!1)&&(L.push(""),Y=0),(Y>0||E.trim===!1)&&(L[L.length-1]+=" ",Y++)),E.hard&&O[A]>R){let C=R-Y,x=1+Math.floor((O[A]-C-1)/R);Math.floor((O[A]-1)/R)<x&&L.push(""),VI(L,w,R);continue}if(Y+O[A]>R&&Y>0&&O[A]>0){if(E.wordWrap===!1&&Y<R){VI(L,w,R);continue}L.push("")}if(Y+O[A]>R&&E.wordWrap===!1){VI(L,w,R);continue}L[L.length-1]+=w}E.trim!==!1&&(L=L.map((A)=>ER(A)));let H=[...L.join(`
3
+ `)];for(let[A,w]of H.entries()){if(N+=w,TI.has(w)){let{groups:C}=new RegExp(`(?:\\${TO}(?<code>\\d+)m|\\${QI}(?<uri>.*)${fI})`).exec(H.slice(A).join(""))||{groups:{}};if(C.code!==void 0){let x=Number.parseFloat(C.code);T=x===IR?void 0:x}else C.uri!==void 0&&(S=C.uri.length===0?void 0:C.uri)}let Y=eO.codes.get(Number(T));H[A+1]===`
4
+ `?(S&&(N+=rI("")),T&&Y&&(N+=aI(Y))):w===`
5
+ `&&(T&&Y&&(N+=aI(T)),S&&(N+=rI(S)))}return N};function sI(I,R,E){return String(I).normalize().replace(/\r\n/g,`
6
+ `).split(`
7
+ `).map((N)=>NR(N,R,E)).join(`
8
+ `)}var TR=["up","down","left","right","space","enter","cancel"],NI={actions:new Set(TR),aliases:new Map([["k","up"],["j","down"],["h","left"],["l","right"],["\x03","cancel"],["escape","cancel"]])};function hI(I,R){if(typeof I=="string")return NI.aliases.get(I)===R;for(let E of I)if(E!==void 0&&hI(E,R))return!0;return!1}function SR(I,R){if(I===R)return;let E=I.split(`
9
+ `),N=R.split(`
10
+ `),T=[];for(let S=0;S<Math.max(E.length,N.length);S++)E[S]!==N[S]&&T.push(S);return T}var LR=globalThis.process.platform.startsWith("win"),XI=Symbol("clack:cancel");function a(I){return I===XI}function EI(I,R){let E=I;E.isTTY&&E.setRawMode(R)}function LO({input:I=eI,output:R=IO,overwrite:E=!0,hideCursor:N=!0}={}){let T=k.createInterface({input:I,output:R,prompt:"",tabSize:1});k.emitKeypressEvents(I,T),I.isTTY&&I.setRawMode(!0);let S=(O,{name:L,sequence:H})=>{let A=String(O);if(hI([A,L,H],"cancel")){N&&R.write(Q.cursor.show),process.exit(0);return}if(!E)return;k.moveCursor(R,L==="return"?0:-1,L==="return"?-1:0,()=>{k.clearLine(R,1,()=>{I.once("keypress",S)})})};return N&&R.write(Q.cursor.hide),I.once("keypress",S),()=>{I.off("keypress",S),N&&R.write(Q.cursor.show),I.isTTY&&!LR&&I.setRawMode(!1),T.terminal=!1,T.close()}}var AR=Object.defineProperty,HR=(I,R,E)=>(R in I)?AR(I,R,{enumerable:!0,configurable:!0,writable:!0,value:E}):I[R]=E,q=(I,R,E)=>(HR(I,typeof R!="symbol"?R+"":R,E),E);class zI{constructor(I,R=!0){q(this,"input"),q(this,"output"),q(this,"_abortSignal"),q(this,"rl"),q(this,"opts"),q(this,"_render"),q(this,"_track",!1),q(this,"_prevFrame",""),q(this,"_subscribers",new Map),q(this,"_cursor",0),q(this,"state","initial"),q(this,"error",""),q(this,"value");let{input:E=eI,output:N=IO,render:T,signal:S,...O}=I;this.opts=O,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=T.bind(this),this._track=R,this._abortSignal=S,this.input=E,this.output=N}unsubscribe(){this._subscribers.clear()}setSubscriber(I,R){let E=this._subscribers.get(I)??[];E.push(R),this._subscribers.set(I,E)}on(I,R){this.setSubscriber(I,{cb:R})}once(I,R){this.setSubscriber(I,{cb:R,once:!0})}emit(I,...R){let E=this._subscribers.get(I)??[],N=[];for(let T of E)T.cb(...R),T.once&&N.push(()=>E.splice(E.indexOf(T),1));for(let T of N)T()}prompt(){return new Promise((I,R)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state="cancel",this.close(),I(XI);this._abortSignal.addEventListener("abort",()=>{this.state="cancel",this.close()},{once:!0})}let E=new oO;E._write=(N,T,S)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,""),this._cursor=this.rl?.cursor??0,this.emit("value",this.value)),S()},this.input.pipe(E),this.rl=iI.createInterface({input:this.input,output:E,tabSize:2,prompt:"",escapeCodeTimeout:50,terminal:!0}),iI.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),EI(this.input,!0),this.output.on("resize",this.render),this.render(),this.once("submit",()=>{this.output.write(Q.cursor.show),this.output.off("resize",this.render),EI(this.input,!1),I(this.value)}),this.once("cancel",()=>{this.output.write(Q.cursor.show),this.output.off("resize",this.render),EI(this.input,!1),I(XI)})})}onKeypress(I,R){if(this.state==="error"&&(this.state="active"),R?.name&&(!this._track&&NI.aliases.has(R.name)&&this.emit("cursor",NI.aliases.get(R.name)),NI.actions.has(R.name)&&this.emit("cursor",R.name)),I&&(I.toLowerCase()==="y"||I.toLowerCase()==="n")&&this.emit("confirm",I.toLowerCase()==="y"),I==="\t"&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit("value",this.opts.placeholder))),I&&this.emit("key",I.toLowerCase()),R?.name==="return"){if(this.opts.validate){let E=this.opts.validate(this.value);E&&(this.error=E instanceof Error?E.message:E,this.state="error",this.rl?.write(this.value))}this.state!=="error"&&(this.state="submit")}hI([I,R?.name,R?.sequence],"cancel")&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
11
+ `),EI(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let I=sI(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
12
+ `).length-1;this.output.write(Q.cursor.move(-999,I*-1))}render(){let I=sI(this._render(this)??"",process.stdout.columns,{hard:!0});if(I!==this._prevFrame){if(this.state==="initial")this.output.write(Q.cursor.hide);else{let R=SR(this._prevFrame,I);if(this.restoreCursor(),R&&R?.length===1){let E=R[0];this.output.write(Q.cursor.move(0,E)),this.output.write(Q.erase.lines(1));let N=I.split(`
13
+ `);this.output.write(N[E]),this._prevFrame=I,this.output.write(Q.cursor.move(0,N.length-E-1));return}if(R&&R?.length>1){let E=R[0];this.output.write(Q.cursor.move(0,E)),this.output.write(Q.erase.down());let N=I.split(`
14
+ `).slice(E);this.output.write(N.join(`
15
+ `)),this._prevFrame=I;return}this.output.write(Q.erase.down())}this.output.write(I),this.state==="initial"&&(this.state="active"),this._prevFrame=I}}}var UR;UR=new WeakMap;var CR=Object.defineProperty,wR=(I,R,E)=>(R in I)?CR(I,R,{enumerable:!0,configurable:!0,writable:!0,value:E}):I[R]=E,tI=(I,R,E)=>(wR(I,typeof R!="symbol"?R+"":R,E),E);class ZI extends zI{constructor(I){super(I,!1),tI(this,"options"),tI(this,"cursor",0),this.options=I.options,this.cursor=this.options.findIndex(({value:R})=>R===I.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",(R)=>{switch(R){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}}class qI extends zI{get valueWithCursor(){if(this.state==="submit")return this.value;if(this.cursor>=this.value.length)return`${this.value}█`;let I=this.value.slice(0,this.cursor),[R,...E]=this.value.slice(this.cursor);return`${I}${OO.default.inverse(R)}${E.join("")}`}get cursor(){return this._cursor}constructor(I){super(I),this.on("finalize",()=>{this.value||(this.value=I.defaultValue)})}}var U=II(WI(),1),LI=II(MI(),1);import J from"node:process";function BR(){return J.platform!=="win32"?J.env.TERM!=="linux":!!J.env.CI||!!J.env.WT_SESSION||!!J.env.TERMINUS_SUBLIME||J.env.ConEmuTask==="{cmd::Cmder}"||J.env.TERM_PROGRAM==="Terminus-Sublime"||J.env.TERM_PROGRAM==="vscode"||J.env.TERM==="xterm-256color"||J.env.TERM==="alacritty"||J.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var JI=BR(),M=(I,R)=>JI?I:R,YR=M("◆","*"),AO=M("■","x"),HO=M("▲","x"),KI=M("◇","o"),xR=M("┌","T"),W=M("│","|"),SI=M("└","—"),GR=M("●",">"),MR=M("○"," "),V1=M("◻","[•]"),X1=M("◼","[+]"),f1=M("◻","[ ]"),Q1=M("▪","•"),h1=M("─","-"),z1=M("╮","+"),Z1=M("├","+"),q1=M("╯","+"),$R=M("●","•"),WR=M("◆","*"),bR=M("▲","!"),VR=M("■","x"),UO=(I)=>{switch(I){case"initial":case"active":return U.default.cyan(YR);case"cancel":return U.default.red(AO);case"error":return U.default.yellow(HO);case"submit":return U.default.green(KI)}},XR=(I)=>{let{cursor:R,options:E,style:N}=I,T=I.maxItems??Number.POSITIVE_INFINITY,S=Math.max(process.stdout.rows-4,0),O=Math.min(S,Math.max(T,5)),L=0;R>=L+O-3?L=Math.max(Math.min(R-O+3,E.length-O),0):R<L+2&&(L=Math.max(R-2,0));let H=O<E.length&&L>0,A=O<E.length&&L+O<E.length;return E.slice(L,L+O).map((w,Y,C)=>{let x=Y===0&&H,f=Y===C.length-1&&A;return x||f?U.default.dim("..."):N(w,Y+L===R)})},CO=(I)=>new qI({validate:I.validate,placeholder:I.placeholder,defaultValue:I.defaultValue,initialValue:I.initialValue,render(){let R=`${U.default.gray(W)}
16
+ ${UO(this.state)} ${I.message}
17
+ `,E=I.placeholder?U.default.inverse(I.placeholder[0])+U.default.dim(I.placeholder.slice(1)):U.default.inverse(U.default.hidden("_")),N=this.value?this.valueWithCursor:E;switch(this.state){case"error":return`${R.trim()}
18
+ ${U.default.yellow(W)} ${N}
19
+ ${U.default.yellow(SI)} ${U.default.yellow(this.error)}
20
+ `;case"submit":return`${R}${U.default.gray(W)} ${U.default.dim(this.value||I.placeholder)}`;case"cancel":return`${R}${U.default.gray(W)} ${U.default.strikethrough(U.default.dim(this.value??""))}${this.value?.trim()?`
21
+ ${U.default.gray(W)}`:""}`;default:return`${R}${U.default.cyan(W)} ${N}
22
+ ${U.default.cyan(SI)}
23
+ `}}}).prompt();var wO=(I)=>{let R=(E,N)=>{let T=E.label??String(E.value);switch(N){case"selected":return`${U.default.dim(T)}`;case"active":return`${U.default.green(GR)} ${T} ${E.hint?U.default.dim(`(${E.hint})`):""}`;case"cancelled":return`${U.default.strikethrough(U.default.dim(T))}`;default:return`${U.default.dim(MR)} ${U.default.dim(T)}`}};return new ZI({options:I.options,initialValue:I.initialValue,render(){let E=`${U.default.gray(W)}
24
+ ${UO(this.state)} ${I.message}
25
+ `;switch(this.state){case"submit":return`${E}${U.default.gray(W)} ${R(this.options[this.cursor],"selected")}`;case"cancel":return`${E}${U.default.gray(W)} ${R(this.options[this.cursor],"cancelled")}
26
+ ${U.default.gray(W)}`;default:return`${E}${U.default.cyan(W)} ${XR({cursor:this.cursor,options:this.options,maxItems:I.maxItems,style:(N,T)=>R(N,T?"active":"inactive")}).join(`
27
+ ${U.default.cyan(W)} `)}
28
+ ${U.default.cyan(SI)}
29
+ `}}}).prompt()};var BO=(I="")=>{process.stdout.write(`${U.default.gray(xR)} ${I}
30
+ `)},YO=(I="")=>{process.stdout.write(`${U.default.gray(W)}
31
+ ${U.default.gray(SI)} ${I}
32
+
33
+ `)},K={message:(I="",{symbol:R=U.default.gray(W)}={})=>{let E=[`${U.default.gray(W)}`];if(I){let[N,...T]=I.split(`
34
+ `);E.push(`${R} ${N}`,...T.map((S)=>`${U.default.gray(W)} ${S}`))}process.stdout.write(`${E.join(`
35
+ `)}
36
+ `)},info:(I)=>{K.message(I,{symbol:U.default.blue($R)})},success:(I)=>{K.message(I,{symbol:U.default.green(WR)})},step:(I)=>{K.message(I,{symbol:U.default.green(KI)})},warn:(I)=>{K.message(I,{symbol:U.default.yellow(bR)})},warning:(I)=>{K.warn(I)},error:(I)=>{K.message(I,{symbol:U.default.red(VR)})}},J1=`${U.default.gray(W)} `;var _I=({indicator:I="dots"}={})=>{let R=JI?["◒","◐","◓","◑"]:["•","o","O","0"],E=JI?80:120,N=process.env.CI==="true",T,S,O=!1,L="",H,A=performance.now(),w=(b)=>{let h=b>1?"Something went wrong":"Canceled";O&&D(h,b)},Y=()=>w(2),C=()=>w(1),x=()=>{process.on("uncaughtExceptionMonitor",Y),process.on("unhandledRejection",Y),process.on("SIGINT",C),process.on("SIGTERM",C),process.on("exit",w)},f=()=>{process.removeListener("uncaughtExceptionMonitor",Y),process.removeListener("unhandledRejection",Y),process.removeListener("SIGINT",C),process.removeListener("SIGTERM",C),process.removeListener("exit",w)},l=()=>{if(H===void 0)return;N&&process.stdout.write(`
37
+ `);let b=H.split(`
38
+ `);process.stdout.write(LI.cursor.move(-999,b.length-1)),process.stdout.write(LI.erase.down(b.length))},o=(b)=>b.replace(/\.+$/,""),p=(b)=>{let h=(performance.now()-b)/1000,V=Math.floor(h/60),F=Math.floor(h%60);return V>0?`[${V}m ${F}s]`:`[${F}s]`},s=(b="")=>{O=!0,T=LO(),L=o(b),A=performance.now(),process.stdout.write(`${U.default.gray(W)}
39
+ `);let h=0,V=0;x(),S=setInterval(()=>{if(N&&L===H)return;l(),H=L;let F=U.default.magenta(R[h]);if(N)process.stdout.write(`${F} ${L}...`);else if(I==="timer")process.stdout.write(`${F} ${L} ${p(A)}`);else{let _=".".repeat(Math.floor(V)).slice(0,3);process.stdout.write(`${F} ${L}${_}`)}h=h+1<R.length?h+1:0,V=V<R.length?V+0.125:0},E)},D=(b="",h=0)=>{O=!1,clearInterval(S),l();let V=h===0?U.default.green(KI):h===1?U.default.red(AO):U.default.red(HO);L=o(b??L),I==="timer"?process.stdout.write(`${V} ${L} ${p(A)}
40
+ `):process.stdout.write(`${V} ${L}
41
+ `),f(),T()};return{start:s,stop:D,message:(b="")=>{L=o(b??L)}}};var fR=(I)=>{return Array.isArray(I)?I:[I]},PI=(I)=>{return I===!0||I===!1},QR=(I)=>{return I===null||I===void 0},FI=(I)=>{return I===null},AI=(I)=>{return QR(I)||PI(I)||I===""},xO=(I)=>{return I===void 0},GO=(I,R,E,N)=>{if(N)I[R]=E;else if(Array.isArray(I[R]))I[R].push(E);else if(AI(I[R]))I[R]=E;else I[R]=[I[R],E]},MO=(I,R,E,N)=>{let T=fR(E);if(N)I[R]=T;else if(Array.isArray(I[R]))I[R].push(...T);else if(AI(I[R]))I[R]=T;else I[R]=[I[R],...T]},HI=(I)=>{return Array.from(new Set(I))},$O=(I,R)=>{let E=new Set;return I.filter((N,T,S)=>{let O=R(N,T,S);if(E.has(O))return!1;return E.add(O),!0})},WO=(I,R)=>{return I.filter((E)=>E!==R)},bO=(I,R)=>{return Object.fromEntries(Array.from(I).map((E)=>[E,R]))};var hR=(I={})=>{let R={};for(let E in I){let N=HI([E,...I[E]||[]]);for(let T of N){if(T in R)continue;R[T]=WO(N,T)}}return R},zR=(I,R)=>{let E=new Map;for(let N in R){let T=R[N];if(xO(T))continue;E.set(N,T);let S=I[N];if(!S)continue;for(let O of S)E.set(O,T)}return E},g=(I,R=[])=>{let E=R.flatMap((T)=>I[T]||[]);return new Set([...R,...E])},ZR=(I,R={})=>{let E={};for(let N in R){let T=R[N],S=HI([N,...I[N]||[]]);for(let O of S){if(O in E)continue;E[O]=T}}return E},qR=(I,R={})=>{let E={};for(let N in R){let T=g(I,[N]),S=g(I,R[N]);for(let O of T)for(let L of S){let H=E[O]||(E[O]=new Set),A=E[L]||(E[L]=new Set);H.add(L),A.add(O)}}return E},mI=(I,R,E,N,T,S)=>{let O=T?MO:GO;O(I,R,E,N),S[R]?.forEach((L)=>{O(I,L,E,N)})},JR=(I)=>{let R=I.indexOf("--");if(R<0)return[I,[]];let E=I.slice(0,R),N=I.slice(R+1);return[E,N]},cI=(I,R,E)=>{return I.flatMap((N)=>{let T=R.exec(N);if(!T)return N;return E(...T)})},KR=(I)=>{return cI(I,/^-([a-zA-Z0-9\.]{2,})([^]*)$/,(E,N)=>N.split("").map((T)=>`-${T}`))},_R=(I)=>{let R=/^(--?[^=][^=]*?)=([^]*)$/,E=(N)=>N.startsWith("-")?`"${N}"`:N;return cI(I,R,(N,T,S)=>[T,E(S)])},PR=(I)=>{return cI(I,/^(--?(?:no-)?\S*?[a-zA-Z]\S*?)((?:[0-9\/]|-(?=$))[^]*)$/,(E,N,T)=>[N,T])},FR=(I)=>{let R=/^--?(no-)?(__proto__|prototype|constructor)$/;return I.filter((E,N)=>!R.test(E)&&!R.test(I[N-1]))},mR=(I)=>{let E=/^(--?)([^]+)$/.exec(I);if(!E)return;return E[2]},cR=(I)=>{let E=/^no-([^]+)$/.exec(I);if(!E)return[I,!0];return[E[1],!1]},jR=(I,R,E,N,T,S,O)=>{let L=gR(String(R));if(O.get(I)?.(L)===!1)return null;if(E.has(I)){if(L==="true")return!0;if(L==="false")return!1}if(N.has(I)){let A=Number(L);if(Number.isInteger(A))return A;return null}if(T.has(I)){let A=Number(L);if(!Number.isNaN(A))return A;return null}if(S.has(I)||L!==R)return L;if(/^0[xX][0-9a-fA-F]+$|^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][-+]?\d+)?$/.test(L))return Number(L);else return L},gR=(I)=>{return I.replace(/^(['"])(\1*)(.*)(\1\2)$/,"$3")},kR=(I,R={})=>{let E=hR(R.alias),N=g(E,R.boolean),T=g(E,R.integer),S=g(E,R.number),O=g(E,R.string),L=g(E,R.eager),H=g(E,R.unary),A=g(E,R.variadic),w=ZR(E,R.default),Y=qR(E,R.incompatible),C=zR(E,R.validators),x=R.required||[],f=new Set([...N,...T,...S,...O,...Object.keys(w)]),l=[],o=R.onIncompatible,p=R.onInvalid,s=R.onMissing,D=R.onUnknown,[b,h]=JR(I),V={_:[],"--":h},F=KR(PR(_R(FR(b)))),_="",d="";for(let X=0,Z=F.length;X<Z;X++){let P=F[X],m=mR(P);if(m){let[$,c]=cR(m);if(AI(V[$])){if(!T.has($)&&!S.has($)&&!O.has($)){let j=H.has($),e=A.has($);mI(V,$,e?[c]:c,j,e,E)}}l.push($),_=m,d=L.has($)?m:""}else{let $=jR(_,P,N,T,S,O,C);if(_&&(!N.has(_)||PI($))){if(!FI($)){let c=H.has(_),j=A.has(_);mI(V,_,$,c,j,E)}}else if(d&&!N.has(d)){if(!FI($)){let c=H.has(d),j=A.has(d);mI(V,d,$,c,j,E)}}else V._.push(String($??P)),d="";_=""}}let t={...w,...V},FO={...bO(N,!1),...t};if(D){let X=Object.keys(t).filter((Z)=>Z!=="_"&&Z!=="--"&&!f.has(Z));if(X.length)D(X)}if(s){let X=x.filter((Z)=>!(Z in t));if(X.length)s(X)}if(p){let X=l.filter((Z)=>t[Z]===void 0);if(X.length)p(X)}if(o){let X=HI(l),Z=[];for(let P=0,m=X.length;P<m;P++){let $=X[P],c=Y[$];if(!c)continue;for(let j=P+1,e=m;j<e;j++){let xI=X[j];if(!c.has(xI))continue;Z.push([$,xI])}}if(Z.length){let P=$O(Z,(m)=>[...m].sort().join());o(P)}}return FO},VO=kR;import{exec as yR}from"node:child_process";var dR=()=>{let I=process.env.npm_config_user_agent||"";if(I.includes("bun"))return"bunx";if(I.includes("pnpm"))return"pnpm dlx";return"npx"},n=(I)=>new Promise((R,E)=>{yR(`${dR()} ${I}`,(N,T,S)=>{if(N)E(S||N.message);else R(T)})});import kI from"node:fs/promises";var UI=Symbol("singleComment"),XO=Symbol("multiComment");function vR(){return""}function lR(I,R,E){return I.slice(R,E).replace(/[^ \t\r\n]/g," ")}function oR(I,R){let E=R-1,N=0;while(I[E]==="\\")E-=1,N+=1;return Boolean(N%2)}var nR={trailingCommas:!1,whitespace:!0};function jI(I,R=nR){if(typeof I!=="string")throw TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof I}\``);let{trailingCommas:E=!1,whitespace:N=!0}=R,T=N?lR:vR,S=!1,O=!1,L=0,H="",A="",w=-1;for(let C=0;C<I.length;C++){let x=I[C],f=I[C+1];if(!x)continue;if(!O&&x==='"'){if(!oR(I,C))S=!S}if(S)continue;if(!O&&x+f==="//")H+=I.slice(L,C),L=C,O=UI,C++;else if(O===UI&&x+f===`\r
42
+ `){C++,O=!1,H+=T(I,L,C),L=C;continue}else if(O===UI&&x===`
43
+ `)O=!1,H+=T(I,L,C),L=C;else if(!O&&x+f==="/*"){H+=I.slice(L,C),L=C,O=XO,C++;continue}else if(O===XO&&x+f==="*/"){C++,O=!1,H+=T(I,L,C+1),L=C+1;continue}else if(E&&!O){if(w!==-1){if(x==="}"||x==="]")H+=I.slice(L,C),A+=T(H,0,1)+H.slice(1),H="",L=C,w=-1;else if(x!==" "&&x!=="\t"&&x!=="\r"&&x!==`
44
+ `)H+=I.slice(L,C),L=C,w=-1}else if(x===",")A+=H+I.slice(L,C),H="",L=C,w=C}}let Y=O===UI?T(I,L):I.slice(L);return A+H+Y}function fO(I,R){try{return JSON.parse(I)}catch{return JSON.parse(jI(I,{...R,trailingCommas:!0}))}}/*!
45
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
46
+ * SPDX-License-Identifier: BSD-3-Clause
47
+ *
48
+ * Redistribution and use in source and binary forms, with or without
49
+ * modification, are permitted provided that the following conditions are met:
50
+ *
51
+ * 1. Redistributions of source code must retain the above copyright notice, this
52
+ * list of conditions and the following disclaimer.
53
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
54
+ * this list of conditions and the following disclaimer in the
55
+ * documentation and/or other materials provided with the distribution.
56
+ * 3. Neither the name of the copyright holder nor the names of its contributors
57
+ * may be used to endorse or promote products derived from this software without
58
+ * specific prior written permission.
59
+ *
60
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
61
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
62
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
63
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
64
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
66
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
67
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
68
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
69
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
70
+ */function iR(I,R){let E=I.slice(0,R).split(/\r\n|\n|\r/g);return[E.length,E.pop().length+1]}function pR(I,R,E){let N=I.split(/\r\n|\n|\r/g),T="",S=(Math.log10(R+1)|0)+1;for(let O=R-1;O<=R+1;O++){let L=N[O-1];if(!L)continue;if(T+=O.toString().padEnd(S," "),T+=": ",T+=L,T+=`
71
+ `,O===R)T+=" ".repeat(S+E+2),T+=`^
72
+ `}return T}class B extends Error{line;column;codeblock;constructor(I,R){let[E,N]=iR(R.toml,R.ptr),T=pR(R.toml,E,N);super(`Invalid TOML document: ${I}
73
+
74
+ ${T}`,R);this.line=E,this.column=N,this.codeblock=T}}/*!
75
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
76
+ * SPDX-License-Identifier: BSD-3-Clause
77
+ *
78
+ * Redistribution and use in source and binary forms, with or without
79
+ * modification, are permitted provided that the following conditions are met:
80
+ *
81
+ * 1. Redistributions of source code must retain the above copyright notice, this
82
+ * list of conditions and the following disclaimer.
83
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
84
+ * this list of conditions and the following disclaimer in the
85
+ * documentation and/or other materials provided with the distribution.
86
+ * 3. Neither the name of the copyright holder nor the names of its contributors
87
+ * may be used to endorse or promote products derived from this software without
88
+ * specific prior written permission.
89
+ *
90
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
91
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
92
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
93
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
94
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
95
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
96
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
97
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
98
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
99
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
100
+ */function DR(I,R){let E=0;while(I[R-++E]==="\\");return--E&&E%2}function CI(I,R=0,E=I.length){let N=I.indexOf(`
101
+ `,R);if(I[N-1]==="\r")N--;return N<=E?N:-1}function i(I,R){for(let E=R;E<I.length;E++){let N=I[E];if(N===`
102
+ `)return E;if(N==="\r"&&I[E+1]===`
103
+ `)return E+1;if(N<" "&&N!=="\t"||N==="")throw new B("control characters are not allowed in comments",{toml:I,ptr:R})}return I.length}function z(I,R,E,N){let T;while((T=I[R])===" "||T==="\t"||!E&&(T===`
104
+ `||T==="\r"&&I[R+1]===`
105
+ `))R++;return N||T!=="#"?R:z(I,i(I,R),E)}function QO(I,R,E,N,T=!1){if(!N)return R=CI(I,R),R<0?I.length:R;for(let S=R;S<I.length;S++){let O=I[S];if(O==="#")S=CI(I,S);else if(O===E)return S+1;else if(O===N||T&&(O===`
106
+ `||O==="\r"&&I[S+1]===`
107
+ `))return S}throw new B("cannot find end of structure",{toml:I,ptr:R})}function wI(I,R){let E=I[R],N=E===I[R+1]&&I[R+1]===I[R+2]?I.slice(R,R+3):E;R+=N.length-1;do R=I.indexOf(N,++R);while(R>-1&&E!=="'"&&DR(I,R));if(R>-1){if(R+=N.length,N.length>1){if(I[R]===E)R++;if(I[R]===E)R++}}return R}/*!
108
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
109
+ * SPDX-License-Identifier: BSD-3-Clause
110
+ *
111
+ * Redistribution and use in source and binary forms, with or without
112
+ * modification, are permitted provided that the following conditions are met:
113
+ *
114
+ * 1. Redistributions of source code must retain the above copyright notice, this
115
+ * list of conditions and the following disclaimer.
116
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
117
+ * this list of conditions and the following disclaimer in the
118
+ * documentation and/or other materials provided with the distribution.
119
+ * 3. Neither the name of the copyright holder nor the names of its contributors
120
+ * may be used to endorse or promote products derived from this software without
121
+ * specific prior written permission.
122
+ *
123
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
124
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
125
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
126
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
127
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
128
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
129
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
130
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
131
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
132
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
133
+ */var uR=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;class y extends Date{#O=!1;#R=!1;#I=null;constructor(I){let R=!0,E=!0,N="Z";if(typeof I==="string"){let T=I.match(uR);if(T){if(!T[1])R=!1,I=`0000-01-01T${I}`;if(E=!!T[2],E&&I[10]===" "&&(I=I.replace(" ","T")),T[2]&&+T[2]>23)I="";else if(N=T[3]||null,I=I.toUpperCase(),!N&&E)I+="Z"}else I=""}super(I);if(!isNaN(this.getTime()))this.#O=R,this.#R=E,this.#I=N}isDateTime(){return this.#O&&this.#R}isLocal(){return!this.#O||!this.#R||!this.#I}isDate(){return this.#O&&!this.#R}isTime(){return this.#R&&!this.#O}isValid(){return this.#O||this.#R}toISOString(){let I=super.toISOString();if(this.isDate())return I.slice(0,10);if(this.isTime())return I.slice(11,23);if(this.#I===null)return I.slice(0,-1);if(this.#I==="Z")return I;let R=+this.#I.slice(1,3)*60+ +this.#I.slice(4,6);return R=this.#I[0]==="-"?R:-R,new Date(this.getTime()-R*60000).toISOString().slice(0,-1)+this.#I}static wrapAsOffsetDateTime(I,R="Z"){let E=new y(I);return E.#I=R,E}static wrapAsLocalDateTime(I){let R=new y(I);return R.#I=null,R}static wrapAsLocalDate(I){let R=new y(I);return R.#R=!1,R.#I=null,R}static wrapAsLocalTime(I){let R=new y(I);return R.#O=!1,R.#I=null,R}}/*!
134
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
135
+ * SPDX-License-Identifier: BSD-3-Clause
136
+ *
137
+ * Redistribution and use in source and binary forms, with or without
138
+ * modification, are permitted provided that the following conditions are met:
139
+ *
140
+ * 1. Redistributions of source code must retain the above copyright notice, this
141
+ * list of conditions and the following disclaimer.
142
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
143
+ * this list of conditions and the following disclaimer in the
144
+ * documentation and/or other materials provided with the distribution.
145
+ * 3. Neither the name of the copyright holder nor the names of its contributors
146
+ * may be used to endorse or promote products derived from this software without
147
+ * specific prior written permission.
148
+ *
149
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
150
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
151
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
152
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
153
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
154
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
155
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
156
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
157
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
158
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
159
+ */var aR=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,rR=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,sR=/^[+-]?0[0-9_]/,tR=/^[0-9a-f]{2,8}$/i,hO={b:"\b",t:"\t",n:`
160
+ `,f:"\f",r:"\r",e:"\x1B",'"':'"',"\\":"\\"};function BI(I,R=0,E=I.length){let N=I[R]==="'",T=I[R++]===I[R]&&I[R]===I[R+1];if(T){if(E-=2,I[R+=2]==="\r")R++;if(I[R]===`
161
+ `)R++}let S=0,O,L="",H=R;while(R<E-1){let A=I[R++];if(A===`
162
+ `||A==="\r"&&I[R]===`
163
+ `){if(!T)throw new B("newlines are not allowed in strings",{toml:I,ptr:R-1})}else if(A<" "&&A!=="\t"||A==="")throw new B("control characters are not allowed in strings",{toml:I,ptr:R-1});if(O){if(O=!1,A==="x"||A==="u"||A==="U"){let w=I.slice(R,R+=A==="x"?2:A==="u"?4:8);if(!tR.test(w))throw new B("invalid unicode escape",{toml:I,ptr:S});try{L+=String.fromCodePoint(parseInt(w,16))}catch{throw new B("invalid unicode escape",{toml:I,ptr:S})}}else if(T&&(A===`
164
+ `||A===" "||A==="\t"||A==="\r")){if(R=z(I,R-1,!0),I[R]!==`
165
+ `&&I[R]!=="\r")throw new B("invalid escape: only line-ending whitespace may be escaped",{toml:I,ptr:S});R=z(I,R)}else if(A in hO)L+=hO[A];else throw new B("unrecognized escape sequence",{toml:I,ptr:S});H=R}else if(!N&&A==="\\")S=R-1,O=!0,L+=I.slice(H,S)}return L+I.slice(H,E-1)}function zO(I,R,E,N){if(I==="true")return!0;if(I==="false")return!1;if(I==="-inf")return-1/0;if(I==="inf"||I==="+inf")return 1/0;if(I==="nan"||I==="+nan"||I==="-nan")return NaN;if(I==="-0")return N?0n:0;let T=aR.test(I);if(T||rR.test(I)){if(sR.test(I))throw new B("leading zeroes are not allowed",{toml:R,ptr:E});I=I.replace(/_/g,"");let O=+I;if(isNaN(O))throw new B("invalid number",{toml:R,ptr:E});if(T){if((T=!Number.isSafeInteger(O))&&!N)throw new B("integer value cannot be represented losslessly",{toml:R,ptr:E});if(T||N===!0)O=BigInt(I)}return O}let S=new y(I);if(!S.isValid())throw new B("invalid value",{toml:R,ptr:E});return S}/*!
166
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
167
+ * SPDX-License-Identifier: BSD-3-Clause
168
+ *
169
+ * Redistribution and use in source and binary forms, with or without
170
+ * modification, are permitted provided that the following conditions are met:
171
+ *
172
+ * 1. Redistributions of source code must retain the above copyright notice, this
173
+ * list of conditions and the following disclaimer.
174
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
175
+ * this list of conditions and the following disclaimer in the
176
+ * documentation and/or other materials provided with the distribution.
177
+ * 3. Neither the name of the copyright holder nor the names of its contributors
178
+ * may be used to endorse or promote products derived from this software without
179
+ * specific prior written permission.
180
+ *
181
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
182
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
183
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
184
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
185
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
186
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
187
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
188
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
189
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
190
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
191
+ */function eR(I,R,E){let N=I.slice(R,E),T=N.indexOf("#");if(T>-1)i(I,T),N=N.slice(0,T);return[N.trimEnd(),T]}function r(I,R,E,N,T){if(N===0)throw new B("document contains excessively nested structures. aborting.",{toml:I,ptr:R});let S=I[R];if(S==="["||S==="{"){let[H,A]=S==="["?qO(I,R,N,T):ZO(I,R,N,T);if(E){if(A=z(I,A),I[A]===",")A++;else if(I[A]!==E)throw new B("expected comma or end of structure",{toml:I,ptr:A})}return[H,A]}let O;if(S==='"'||S==="'"){O=wI(I,R);let H=BI(I,R,O);if(E){if(O=z(I,O),I[O]&&I[O]!==","&&I[O]!==E&&I[O]!==`
192
+ `&&I[O]!=="\r")throw new B("unexpected character encountered",{toml:I,ptr:O});O+=+(I[O]===",")}return[H,O]}O=QO(I,R,",",E);let L=eR(I,R,O-+(I[O-1]===","));if(!L[0])throw new B("incomplete key-value declaration: no value specified",{toml:I,ptr:R});if(E&&L[1]>-1)O=z(I,R+L[1]),O+=+(I[O]===",");return[zO(L[0],I,R,T),O]}/*!
193
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
194
+ * SPDX-License-Identifier: BSD-3-Clause
195
+ *
196
+ * Redistribution and use in source and binary forms, with or without
197
+ * modification, are permitted provided that the following conditions are met:
198
+ *
199
+ * 1. Redistributions of source code must retain the above copyright notice, this
200
+ * list of conditions and the following disclaimer.
201
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
202
+ * this list of conditions and the following disclaimer in the
203
+ * documentation and/or other materials provided with the distribution.
204
+ * 3. Neither the name of the copyright holder nor the names of its contributors
205
+ * may be used to endorse or promote products derived from this software without
206
+ * specific prior written permission.
207
+ *
208
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
209
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
210
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
211
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
212
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
213
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
214
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
215
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
216
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
217
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
218
+ */var I1=/^[a-zA-Z0-9-_]+[ \t]*$/;function YI(I,R,E="="){let N=R-1,T=[],S=I.indexOf(E,R);if(S<0)throw new B("incomplete key-value: cannot find end of key",{toml:I,ptr:R});do{let O=I[R=++N];if(O!==" "&&O!=="\t")if(O==='"'||O==="'"){if(O===I[R+1]&&O===I[R+2])throw new B("multiline strings are not allowed in keys",{toml:I,ptr:R});let L=wI(I,R);if(L<0)throw new B("unfinished string encountered",{toml:I,ptr:R});N=I.indexOf(".",L);let H=I.slice(L,N<0||N>S?S:N),A=CI(H);if(A>-1)throw new B("newlines are not allowed in keys",{toml:I,ptr:R+N+A});if(H.trimStart())throw new B("found extra tokens after the string part",{toml:I,ptr:L});if(S<L){if(S=I.indexOf(E,L),S<0)throw new B("incomplete key-value: cannot find end of key",{toml:I,ptr:R})}T.push(BI(I,R,L))}else{N=I.indexOf(".",R);let L=I.slice(R,N<0||N>S?S:N);if(!I1.test(L))throw new B("only letter, numbers, dashes and underscores are allowed in keys",{toml:I,ptr:R});T.push(L.trimEnd())}}while(N+1&&N<S);return[T,z(I,S+1,!0,!0)]}function ZO(I,R,E,N){let T={},S=new Set,O;R++;while((O=I[R++])!=="}"&&O)if(O===",")throw new B("expected value, found comma",{toml:I,ptr:R-1});else if(O==="#")R=i(I,R);else if(O!==" "&&O!=="\t"&&O!==`
219
+ `&&O!=="\r"){let L,H=T,A=!1,[w,Y]=YI(I,R-1);for(let f=0;f<w.length;f++){if(f)H=A?H[L]:H[L]={};if(L=w[f],(A=Object.hasOwn(H,L))&&(typeof H[L]!=="object"||S.has(H[L])))throw new B("trying to redefine an already defined value",{toml:I,ptr:R});if(!A&&L==="__proto__")Object.defineProperty(H,L,{enumerable:!0,configurable:!0,writable:!0})}if(A)throw new B("trying to redefine an already defined value",{toml:I,ptr:R});let[C,x]=r(I,Y,"}",E-1,N);S.add(C),H[L]=C,R=x}if(!O)throw new B("unfinished table encountered",{toml:I,ptr:R});return[T,R]}function qO(I,R,E,N){let T=[],S;R++;while((S=I[R++])!=="]"&&S)if(S===",")throw new B("expected value, found comma",{toml:I,ptr:R-1});else if(S==="#")R=i(I,R);else if(S!==" "&&S!=="\t"&&S!==`
220
+ `&&S!=="\r"){let O=r(I,R-1,"]",E-1,N);T.push(O[0]),R=O[1]}if(!S)throw new B("unfinished array encountered",{toml:I,ptr:R});return[T,R]}/*!
221
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
222
+ * SPDX-License-Identifier: BSD-3-Clause
223
+ *
224
+ * Redistribution and use in source and binary forms, with or without
225
+ * modification, are permitted provided that the following conditions are met:
226
+ *
227
+ * 1. Redistributions of source code must retain the above copyright notice, this
228
+ * list of conditions and the following disclaimer.
229
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
230
+ * this list of conditions and the following disclaimer in the
231
+ * documentation and/or other materials provided with the distribution.
232
+ * 3. Neither the name of the copyright holder nor the names of its contributors
233
+ * may be used to endorse or promote products derived from this software without
234
+ * specific prior written permission.
235
+ *
236
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
237
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
238
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
239
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
240
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
241
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
242
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
243
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
244
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
245
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
246
+ */function JO(I,R,E,N){let T=R,S=E,O,L=!1,H;for(let A=0;A<I.length;A++){if(A){if(T=L?T[O]:T[O]={},S=(H=S[O]).c,N===0&&(H.t===1||H.t===2))return null;if(H.t===2){let w=T.length-1;T=T[w],S=S[w].c}}if(O=I[A],(L=Object.hasOwn(T,O))&&S[O]?.t===0&&S[O]?.d)return null;if(!L){if(O==="__proto__")Object.defineProperty(T,O,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(S,O,{enumerable:!0,configurable:!0,writable:!0});S[O]={t:A<I.length-1&&N===2?3:N,d:!1,i:0,c:{}}}}if(H=S[O],H.t!==N&&!(N===1&&H.t===3))return null;if(N===2){if(!H.d)H.d=!0,T[O]=[];T[O].push(T={}),H.c[H.i++]=H={t:1,d:!1,i:0,c:{}}}if(H.d)return null;if(H.d=!0,N===1)T=L?T[O]:T[O]={};else if(N===0&&L)return null;return[O,T,H.c]}function gI(I,{maxDepth:R=1000,integersAsBigInt:E}={}){let N={},T={},S=N,O=T;for(let L=z(I,0);L<I.length;){if(I[L]==="["){let H=I[++L]==="[",A=YI(I,L+=+H,"]");if(H){if(I[A[1]-1]!=="]")throw new B("expected end of table declaration",{toml:I,ptr:A[1]-1});A[1]++}let w=JO(A[0],N,T,H?2:1);if(!w)throw new B("trying to redefine an already defined table or value",{toml:I,ptr:L});O=w[2],S=w[1],L=A[1]}else{let H=YI(I,L),A=JO(H[0],S,O,0);if(!A)throw new B("trying to redefine an already defined table or value",{toml:I,ptr:L});let w=r(I,H[1],void 0,R,E);A[1][A[0]]=w[0],L=w[1]}if(L=z(I,L,!0),I[L]&&I[L]!==`
247
+ `&&I[L]!=="\r")throw new B("each key-value declaration must be followed by an end-of-line",{toml:I,ptr:L});L=z(I,L)}return N}/*!
248
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
249
+ * SPDX-License-Identifier: BSD-3-Clause
250
+ *
251
+ * Redistribution and use in source and binary forms, with or without
252
+ * modification, are permitted provided that the following conditions are met:
253
+ *
254
+ * 1. Redistributions of source code must retain the above copyright notice, this
255
+ * list of conditions and the following disclaimer.
256
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
257
+ * this list of conditions and the following disclaimer in the
258
+ * documentation and/or other materials provided with the distribution.
259
+ * 3. Neither the name of the copyright holder nor the names of its contributors
260
+ * may be used to endorse or promote products derived from this software without
261
+ * specific prior written permission.
262
+ *
263
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
264
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
265
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
266
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
267
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
268
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
269
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
270
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
271
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
272
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273
+ *//*!
274
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
275
+ * SPDX-License-Identifier: BSD-3-Clause
276
+ *
277
+ * Redistribution and use in source and binary forms, with or without
278
+ * modification, are permitted provided that the following conditions are met:
279
+ *
280
+ * 1. Redistributions of source code must retain the above copyright notice, this
281
+ * list of conditions and the following disclaimer.
282
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
283
+ * this list of conditions and the following disclaimer in the
284
+ * documentation and/or other materials provided with the distribution.
285
+ * 3. Neither the name of the copyright holder nor the names of its contributors
286
+ * may be used to endorse or promote products derived from this software without
287
+ * specific prior written permission.
288
+ *
289
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
290
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
291
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
292
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
293
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
294
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
295
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
296
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
297
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
298
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
299
+ */async function _O(){let I;try{if(await KO("wrangler.jsonc")){let R=await kI.readFile("wrangler.jsonc","utf-8");I=fO(R)}else if(await KO("wrangler.toml")){let R=await kI.readFile("wrangler.toml","utf-8");I=gI(R)}else throw Error("No wrangler.jsonc or wrangler.toml found.");return I.d1_databases?.map((R)=>({value:R.database_name,label:R.database_name}))||[]}catch(R){return[]}}async function KO(I){return kI.access(I).then(()=>!0).catch(()=>!1)}var v=VO(process.argv.slice(2)),PO=v._[0];async function E1(){BO("D1 Prisma Migrate CLI");let I=await _O();if(I.length===0)K.error("No D1 databases configured in wrangler."),process.exit(1);let R=v.d||v.database||await wO({message:"Select the D1 database:",options:I});if(a(R))process.exit(0);if(PO==="create")await N1(R);else if(PO==="apply")await T1(R);else K.info("Usage: d1-prisma [create|apply] [--remote]"),process.exit(0)}async function N1(I){let R=v.name||v.n||await CO({message:"Migration name?"});if(a(R))return;let E=v.schema||"./prisma/schema.prisma",N=`${E}.backup.${Date.now()}`,T=_I();try{await yI.copyFile(E,N),T.start("Creating migration file...");let O=(await n(`wrangler d1 migrations create ${I} ${R}`)).trim().split(`
300
+ `).find((L)=>L.endsWith(".sql"));if(!O)throw Error("Migration path not found");T.message("Synchronizing Prisma schema with DB..."),await n(`prisma db pull --schema ${E}`),T.message("Generating SQL diff..."),await n(`prisma migrate diff --from-schema-datamodel ${E} --to-schema-datamodel ${N} --script >> ${O}`),T.stop(`Migration created: ${R1.basename(O)}`)}catch(S){K.error(`Error: ${S}`)}finally{await yI.copyFile(N,E),await yI.rm(N)}}async function T1(I){let R=_I(),E=v.remote?"--remote":"--local";try{R.start(`Applying migrations ${E}...`),await n(`wrangler d1 migrations apply ${I} ${E}`),R.message("Regenerating Prisma Client..."),await n("prisma generate"),R.stop("Database updated successfully!"),YO("Done.")}catch(N){R.stop("Failed."),K.error(`${N}`)}}E1().catch(console.error);
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "d1-prisma",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Bridge CLI to manage Cloudflare D1 migrations with Prisma",
6
+ "main": "./dist/index.js",
7
+ "bin": {
8
+ "d1-prisma": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "scripts": {
14
+ "build": "bun build src/index.ts --format esm --clean --minify --target node --outdir ./dist",
15
+ "dev": "bun src/index.ts --format esm --watch",
16
+ "start": "node dist/index.js",
17
+ "prepublishOnly": "bun run build"
18
+ },
19
+ "dependencies": {
20
+ "@clack/prompts": "^0.11.0",
21
+ "bun": "^1.3.5",
22
+ "jsonc-parse": "^2.0.0",
23
+ "smol-toml": "^1.6.0",
24
+ "tiny-parse-argv": "^2.8.2"
25
+ },
26
+ "devDependencies": {
27
+ "@types/node": "^20.0.0",
28
+ "typescript": "^5.0.0"
29
+ }
30
+ }