@mavenagi/apps 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +141 -0
- package/dist/index.js +1 -45
- package/dist/next.js +1 -1
- package/package.json +4 -21
- package/index.ts +0 -52
- package/tsconfig.json +0 -108
package/LICENSE
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
MAVEN SOURCE CODE LICENSE
|
|
2
|
+
|
|
3
|
+
This Maven Source Code License ("License") is a binding legal agreement between you
|
|
4
|
+
(referred to in this License as "you" or "Licensee") and Maven AGI, Inc. (the
|
|
5
|
+
"Company") and governs your access to and use of the Licensed Source Code (as
|
|
6
|
+
defined below).
|
|
7
|
+
|
|
8
|
+
By accessing or using the Licensed Source Code (as defined below), you agree to be
|
|
9
|
+
bound by the terms of this License. You may not use the Licensed Source Code if you
|
|
10
|
+
are not of legal age to form a binding contract with the Company.
|
|
11
|
+
|
|
12
|
+
If you are using the Licensed Source Code on behalf of a company, organization,
|
|
13
|
+
government, or other entity, you represent and warrant that you have the authority
|
|
14
|
+
to bind such company, organization, government, or entity to this License, in which
|
|
15
|
+
case the words "you" "your" and "Licensee" as used in this License shall refer to
|
|
16
|
+
you and such entity.
|
|
17
|
+
|
|
18
|
+
1. LICENSE AND RESTRICTIONS
|
|
19
|
+
|
|
20
|
+
1.1. License. Subject to the terms and conditions of this License, Company hereby
|
|
21
|
+
grants to Licensee a perpetual, worldwide, non-exclusive, royalty-free copyright
|
|
22
|
+
license to use, reproduce, prepare derivative works of, publicly display, publicly
|
|
23
|
+
perform, and distribute the source code, application programming interfaces,
|
|
24
|
+
software development kits and related tools, documentation, data, technology, code,
|
|
25
|
+
and materials that the Company makes available under this License (such items,
|
|
26
|
+
including any modifications, enhancements or new versions that are made available
|
|
27
|
+
by Company during the term of this License, the "Licensed Source Code"), in each
|
|
28
|
+
case solely in connection with the Company's artificial intelligence-powered
|
|
29
|
+
customer experience platform (the "Maven Platform"). For the avoidance of doubt,
|
|
30
|
+
any access to or use of the Maven Platform is subject to a separate agreement.
|
|
31
|
+
|
|
32
|
+
1.2. Restrictions. Licensee shall not (and shall not allow any other person to):
|
|
33
|
+
(a) use the Licensed Source Code in violation of any applicable laws or
|
|
34
|
+
regulations; (b) use the Licensed Source Code to develop any software or
|
|
35
|
+
applications for any product, software or service other than the Maven Platform;
|
|
36
|
+
(c) modify, distribute, or use the Licensed Source Code in a manner that would
|
|
37
|
+
subject the Licensed Source Code to any open source software license terms; or (d)
|
|
38
|
+
remove, modify or otherwise tamper with any notices or legends on or in the
|
|
39
|
+
Licensed Source Code or any labeling on any physical media. This License does not
|
|
40
|
+
grant permission to use the trade names, trademarks, service marks, or product
|
|
41
|
+
names of the Company.
|
|
42
|
+
|
|
43
|
+
1.3. Ownership. As between the Company and Licensee, the Company retains all
|
|
44
|
+
right, title and interest in and to all intellectual property rights embodied in
|
|
45
|
+
or pertaining to the Licensed Source Code. There are no implied licenses under
|
|
46
|
+
this License, and any rights not expressly granted to Licensee hereunder are
|
|
47
|
+
reserved by the Company. Licensee shall not take any action inconsistent with the
|
|
48
|
+
Company's ownership of the Licensed Source Code.
|
|
49
|
+
|
|
50
|
+
2. TERM AND TERMINATION
|
|
51
|
+
|
|
52
|
+
2.1. Term; Termination. This License shall commence on the date that Licensee
|
|
53
|
+
first accesses or uses the Licensed Source Code and shall continue until
|
|
54
|
+
terminated in accordance with this Section 2.1. This License may be terminated by
|
|
55
|
+
either party (a) upon written notice to the other party if the other party
|
|
56
|
+
materially breaches any term of this License and fails to cure such breach within
|
|
57
|
+
30 days of written notice or (b) for any reason upon written notice to the other
|
|
58
|
+
party. Upon termination of this License, Licensee shall cease access to and use of
|
|
59
|
+
the Licensed Source Code and destroy all local copies thereof in its possession or
|
|
60
|
+
control. The provisions of Sections 1.2., 1.3, 2.1, 3 and 4 shall survive any
|
|
61
|
+
termination of this License.
|
|
62
|
+
|
|
63
|
+
3. DISCLAIMER; INDEMNITY; LIMITATION OF LIABILITY
|
|
64
|
+
|
|
65
|
+
3.1. Disclaimer of Other Warranties. Company is not obligated to provide any
|
|
66
|
+
technical or other support for the Licensed Source Code. Unless required by
|
|
67
|
+
applicable law, the Company provides the Licensed Source Code on an "AS IS" BASIS,
|
|
68
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including,
|
|
69
|
+
without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT,
|
|
70
|
+
MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible
|
|
71
|
+
for determining the appropriateness of using the Licensed Source Code and assume
|
|
72
|
+
any risks associated with your exercise of the permissions under this License. YOU
|
|
73
|
+
ACKNOWLEDGE THAT YOU HAVE NOT ENTERED INTO THIS AGREEMENT IN RELIANCE UPON ANY
|
|
74
|
+
WARRANTY OR REPRESENTATION EXCEPT THOSE SPECIFICALLY SET FORTH HEREIN.
|
|
75
|
+
|
|
76
|
+
3.2. Limitation of Liability. In no event and under no legal theory, whether in
|
|
77
|
+
tort (including negligence), contract, or otherwise, unless required by applicable
|
|
78
|
+
law (such as deliberate and grossly negligent acts) or agreed to in writing,
|
|
79
|
+
shall the Company be liable to Licensee for any damages, including any direct,
|
|
80
|
+
indirect, special, incidental, or consequential damages of any character arising
|
|
81
|
+
as a result of this License or out of the use or inability to use the Licensed
|
|
82
|
+
Source Code (including but not limited to damages for loss of goodwill, work
|
|
83
|
+
stoppage, computer failure or malfunction, or any and all other commercial damages
|
|
84
|
+
or losses), even if the Company has been advised of the possibility of such
|
|
85
|
+
damages.
|
|
86
|
+
|
|
87
|
+
4. MISCELLANEOUS.
|
|
88
|
+
|
|
89
|
+
Dispute Resolution; Governing Law. This License and any dispute arising under or
|
|
90
|
+
in connection with this License shall be governed by the laws of the State of
|
|
91
|
+
Delaware, without regard to its choice of law principles. Each party irrevocably
|
|
92
|
+
and unconditionally submits to the exclusive jurisdiction of such courts;
|
|
93
|
+
provided, however, that notwithstanding the foregoing, either party may seek
|
|
94
|
+
injunctive or other equitable relief at any time in courts of competent
|
|
95
|
+
jurisdiction.
|
|
96
|
+
|
|
97
|
+
Assignment. Licensee may not assign this License, or any of its rights or
|
|
98
|
+
obligations hereunder, without the prior written consent of the Company and any
|
|
99
|
+
assignment in violation of this provision shall be null and void from the
|
|
100
|
+
beginning. The Company may freely assign this License, or any of its rights or
|
|
101
|
+
obligations hereunder, without Licensee's prior written consent. Subject to the
|
|
102
|
+
foregoing limitation on assignment, this License is binding upon and inures to the
|
|
103
|
+
benefit of the successors and assigns of the respective parties hereto.
|
|
104
|
+
|
|
105
|
+
No Agency Relationship. The relationship between the Company and Licensee shall
|
|
106
|
+
not be construed as a joint venture, partnership or principal-agent relationship.
|
|
107
|
+
|
|
108
|
+
Third Party Beneficiaries. This License is not intended and shall not be
|
|
109
|
+
construed to create any rights or benefits upon any person not a party to this
|
|
110
|
+
License.
|
|
111
|
+
|
|
112
|
+
Entire Agreement. This License constitutes the entire agreement between the
|
|
113
|
+
parties relating to the subject matter hereof. This License supersedes all prior
|
|
114
|
+
understandings, negotiations and discussions, written or oral, of the parties
|
|
115
|
+
relating to the transactions contemplated by this License.
|
|
116
|
+
|
|
117
|
+
Modification. The Company may modify this License from time to time upon notice to
|
|
118
|
+
Licensee. The modified License will be effective as of the time of posting, or
|
|
119
|
+
such later date as may be specified in the applicable notice. Licensee's
|
|
120
|
+
continued access to or use of the Licensed Source Code after the modifications
|
|
121
|
+
have become effective will be deemed Licensee's acceptance of the modified
|
|
122
|
+
License. If Licensee does not agree with such modifications, Licensee's sole
|
|
123
|
+
option is to cease access to and use of the Licensed Source Code.
|
|
124
|
+
|
|
125
|
+
Provisions Severable. If any provision of this License shall be or become wholly
|
|
126
|
+
or partially invalid, illegal or unenforceable, such provision shall be enforced
|
|
127
|
+
to the extent that it is legal and valid and the validity, legality, and
|
|
128
|
+
enforceability of the remaining provisions shall in no way be affected or
|
|
129
|
+
impaired.
|
|
130
|
+
|
|
131
|
+
Waivers; Cumulative Remedies; Injunctive Relief. No failure or delay by a party
|
|
132
|
+
to insist upon the strict performance of any term or condition under this License
|
|
133
|
+
or to exercise any right or remedy available under this License at law or in
|
|
134
|
+
equity, shall imply or otherwise constitute a waiver of such right or remedy, and
|
|
135
|
+
no single or partial exercise of any right or remedy by any party will preclude
|
|
136
|
+
exercise of any other right or remedy. All rights and remedies provided in this
|
|
137
|
+
License are cumulative and not alternative; and are in addition to all other
|
|
138
|
+
available remedies at law or in equity.
|
|
139
|
+
|
|
140
|
+
How to Contact Us. You may contact us regarding this License at:
|
|
141
|
+
131 Dartmouth St, 3rd Floor, Boston, MA 02116
|
package/dist/index.js
CHANGED
|
@@ -1,46 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { execFileSync } from 'child_process';
|
|
3
|
-
import fs from 'fs';
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import { compiledUserWorkerEntrypointScript } from './next.js';
|
|
6
|
-
const p = (f) => `${fs.existsSync('./src') ? 'src/' : ''}${f}`;
|
|
7
|
-
fs.rmSync(p('app/mavenagi-cgi'), { recursive: true, force: true });
|
|
8
|
-
fs.mkdirSync(p('app/mavenagi-cgi'), { recursive: true });
|
|
9
|
-
fs.writeFileSync(p('app/mavenagi-cgi/next.ts'), `// @ts-nocheck\n${compiledUserWorkerEntrypointScript}`);
|
|
10
|
-
Object.entries({
|
|
11
|
-
'pre-install': 'preInstall',
|
|
12
|
-
'post-install': 'postInstall',
|
|
13
|
-
feedbacks: 'feedbackCreatedOrUpdated',
|
|
14
|
-
conversations: 'conversationCreatedOrUpdated',
|
|
15
|
-
'execute-action': 'executeAction',
|
|
16
|
-
'knowledge-base-refreshed': 'knowledgeBaseRefreshed',
|
|
17
|
-
}).forEach(([f, name]) => {
|
|
18
|
-
fs.mkdirSync(p(`app/mavenagi-cgi/v1/${f}`), { recursive: true });
|
|
19
|
-
const indexFileContents = fs.readFileSync(p(`index.ts`), 'utf8');
|
|
20
|
-
const isEdge = indexFileContents.includes("export const runtime = 'edge'") ||
|
|
21
|
-
indexFileContents.includes('export const runtime = "edge"');
|
|
22
|
-
fs.writeFileSync(p(`app/mavenagi-cgi/v1/${f}/route.ts`), `// @ts-nocheck\nimport {${name}} from '../../next'
|
|
23
|
-
import userWorker from '../../../..'
|
|
24
|
-
|
|
25
|
-
export const POST = ${name}
|
|
26
|
-
export const runtime = ${isEdge ? "'edge'" : "'nodejs'"}
|
|
27
|
-
export const maxDuration = 900
|
|
28
|
-
`);
|
|
29
|
-
});
|
|
30
|
-
let packageManager = 'npm';
|
|
31
|
-
if (fs.existsSync('yarn.lock')) {
|
|
32
|
-
packageManager = 'yarn';
|
|
33
|
-
}
|
|
34
|
-
else if (fs.existsSync('pnpm-lock.yaml')) {
|
|
35
|
-
packageManager = 'pnpm';
|
|
36
|
-
}
|
|
37
|
-
else if (fs.existsSync('bun.lockb')) {
|
|
38
|
-
packageManager = 'bun';
|
|
39
|
-
}
|
|
40
|
-
try {
|
|
41
|
-
execFileSync(packageManager, ['run', ...process.argv.slice(2)], { stdio: 'inherit' });
|
|
42
|
-
process.exit(0);
|
|
43
|
-
}
|
|
44
|
-
catch (err) {
|
|
45
|
-
process.exit(err.status || 1);
|
|
46
|
-
}
|
|
2
|
+
(()=>{var __webpack_modules__={8587:t=>{"use strict";t.exports=({onlyFirst:t=false}={})=>{const s=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(s,t?undefined:"g")}},3694:(t,s,b)=>{"use strict";t=b.nmd(t);const wrapAnsi16=(t,s)=>(...b)=>{const F=t(...b);return`[${F+s}m`};const wrapAnsi256=(t,s)=>(...b)=>{const F=t(...b);return`[${38+s};5;${F}m`};const wrapAnsi16m=(t,s)=>(...b)=>{const F=t(...b);return`[${38+s};2;${F[0]};${F[1]};${F[2]}m`};const ansi2ansi=t=>t;const rgb2rgb=(t,s,b)=>[t,s,b];const setLazyProperty=(t,s,b)=>{Object.defineProperty(t,s,{get:()=>{const F=b();Object.defineProperty(t,s,{value:F,enumerable:true,configurable:true});return F},enumerable:true,configurable:true})};let F;const makeDynamicStyles=(t,s,B,M)=>{if(F===undefined){F=b(7319)}const T=M?10:0;const L={};for(const[b,M]of Object.entries(F)){const F=b==="ansi16"?"ansi":b;if(b===s){L[F]=t(B,T)}else if(typeof M==="object"){L[F]=t(M[s],T)}}return L};function assembleStyles(){const t=new Map;const s={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};s.color.gray=s.color.blackBright;s.bgColor.bgGray=s.bgColor.bgBlackBright;s.color.grey=s.color.blackBright;s.bgColor.bgGrey=s.bgColor.bgBlackBright;for(const[b,F]of Object.entries(s)){for(const[b,B]of Object.entries(F)){s[b]={open:`[${B[0]}m`,close:`[${B[1]}m`};F[b]=s[b];t.set(B[0],B[1])}Object.defineProperty(s,b,{value:F,enumerable:false})}Object.defineProperty(s,"codes",{value:t,enumerable:false});s.color.close="[39m";s.bgColor.close="[49m";setLazyProperty(s.color,"ansi",(()=>makeDynamicStyles(wrapAnsi16,"ansi16",ansi2ansi,false)));setLazyProperty(s.color,"ansi256",(()=>makeDynamicStyles(wrapAnsi256,"ansi256",ansi2ansi,false)));setLazyProperty(s.color,"ansi16m",(()=>makeDynamicStyles(wrapAnsi16m,"rgb",rgb2rgb,false)));setLazyProperty(s.bgColor,"ansi",(()=>makeDynamicStyles(wrapAnsi16,"ansi16",ansi2ansi,true)));setLazyProperty(s.bgColor,"ansi256",(()=>makeDynamicStyles(wrapAnsi256,"ansi256",ansi2ansi,true)));setLazyProperty(s.bgColor,"ansi16m",(()=>makeDynamicStyles(wrapAnsi16m,"rgb",rgb2rgb,true)));return s}Object.defineProperty(t,"exports",{enumerable:true,get:assembleStyles})},2986:(t,s,b)=>{"use strict";const F=b(1838);const B=b(764);const M=b(3694);const T=new Set(["",""]);const L=39;const G="";const R="[";const U="]";const W="m";const z=`${U}8;;`;const wrapAnsi=t=>`${T.values().next().value}${R}${t}${W}`;const wrapAnsiHyperlink=t=>`${T.values().next().value}${z}${t}${G}`;const wordLengths=t=>t.split(" ").map((t=>F(t)));const wrapWord=(t,s,b)=>{const M=[...s];let L=false;let R=false;let U=F(B(t[t.length-1]));for(const[s,B]of M.entries()){const q=F(B);if(U+q<=b){t[t.length-1]+=B}else{t.push(B);U=0}if(T.has(B)){L=true;R=M.slice(s+1).join("").startsWith(z)}if(L){if(R){if(B===G){L=false;R=false}}else if(B===W){L=false}continue}U+=q;if(U===b&&s<M.length-1){t.push("");U=0}}if(!U&&t[t.length-1].length>0&&t.length>1){t[t.length-2]+=t.pop()}};const stringVisibleTrimSpacesRight=t=>{const s=t.split(" ");let b=s.length;while(b>0){if(F(s[b-1])>0){break}b--}if(b===s.length){return t}return s.slice(0,b).join(" ")+s.slice(b).join("")};const exec=(t,s,b={})=>{if(b.trim!==false&&t.trim()===""){return""}let B="";let U;let W;const q=wordLengths(t);let H=[""];for(const[B,M]of t.split(" ").entries()){if(b.trim!==false){H[H.length-1]=H[H.length-1].trimStart()}let t=F(H[H.length-1]);if(B!==0){if(t>=s&&(b.wordWrap===false||b.trim===false)){H.push("");t=0}if(t>0||b.trim===false){H[H.length-1]+=" ";t++}}if(b.hard&&q[B]>s){const b=s-t;const F=1+Math.floor((q[B]-b-1)/s);const T=Math.floor((q[B]-1)/s);if(T<F){H.push("")}wrapWord(H,M,s);continue}if(t+q[B]>s&&t>0&&q[B]>0){if(b.wordWrap===false&&t<s){wrapWord(H,M,s);continue}H.push("")}if(t+q[B]>s&&b.wordWrap===false){wrapWord(H,M,s);continue}H[H.length-1]+=M}if(b.trim!==false){H=H.map(stringVisibleTrimSpacesRight)}const V=[...H.join("\n")];for(const[t,s]of V.entries()){B+=s;if(T.has(s)){const{groups:s}=new RegExp(`(?:\\${R}(?<code>\\d+)m|\\${z}(?<uri>.*)${G})`).exec(V.slice(t).join(""))||{groups:{}};if(s.code!==undefined){const t=Number.parseFloat(s.code);U=t===L?undefined:t}else if(s.uri!==undefined){W=s.uri.length===0?undefined:s.uri}}const b=M.codes.get(Number(U));if(V[t+1]==="\n"){if(W){B+=wrapAnsiHyperlink("")}if(U&&b){B+=wrapAnsi(b)}}else if(s==="\n"){if(U&&b){B+=wrapAnsi(U)}if(W){B+=wrapAnsiHyperlink(W)}}}return B};t.exports=(t,s,b)=>String(t).normalize().replace(/\r\n/g,"\n").split("\n").map((t=>exec(t,s,b))).join("\n")},9006:(t,s,b)=>{const F=b(8147);const B={};for(const t of Object.keys(F)){B[F[t]]=t}const M={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};t.exports=M;for(const t of Object.keys(M)){if(!("channels"in M[t])){throw new Error("missing channels property: "+t)}if(!("labels"in M[t])){throw new Error("missing channel labels property: "+t)}if(M[t].labels.length!==M[t].channels){throw new Error("channel and label counts mismatch: "+t)}const{channels:s,labels:b}=M[t];delete M[t].channels;delete M[t].labels;Object.defineProperty(M[t],"channels",{value:s});Object.defineProperty(M[t],"labels",{value:b})}M.rgb.hsl=function(t){const s=t[0]/255;const b=t[1]/255;const F=t[2]/255;const B=Math.min(s,b,F);const M=Math.max(s,b,F);const T=M-B;let L;let G;if(M===B){L=0}else if(s===M){L=(b-F)/T}else if(b===M){L=2+(F-s)/T}else if(F===M){L=4+(s-b)/T}L=Math.min(L*60,360);if(L<0){L+=360}const R=(B+M)/2;if(M===B){G=0}else if(R<=.5){G=T/(M+B)}else{G=T/(2-M-B)}return[L,G*100,R*100]};M.rgb.hsv=function(t){let s;let b;let F;let B;let M;const T=t[0]/255;const L=t[1]/255;const G=t[2]/255;const R=Math.max(T,L,G);const U=R-Math.min(T,L,G);const diffc=function(t){return(R-t)/6/U+1/2};if(U===0){B=0;M=0}else{M=U/R;s=diffc(T);b=diffc(L);F=diffc(G);if(T===R){B=F-b}else if(L===R){B=1/3+s-F}else if(G===R){B=2/3+b-s}if(B<0){B+=1}else if(B>1){B-=1}}return[B*360,M*100,R*100]};M.rgb.hwb=function(t){const s=t[0];const b=t[1];let F=t[2];const B=M.rgb.hsl(t)[0];const T=1/255*Math.min(s,Math.min(b,F));F=1-1/255*Math.max(s,Math.max(b,F));return[B,T*100,F*100]};M.rgb.cmyk=function(t){const s=t[0]/255;const b=t[1]/255;const F=t[2]/255;const B=Math.min(1-s,1-b,1-F);const M=(1-s-B)/(1-B)||0;const T=(1-b-B)/(1-B)||0;const L=(1-F-B)/(1-B)||0;return[M*100,T*100,L*100,B*100]};function comparativeDistance(t,s){return(t[0]-s[0])**2+(t[1]-s[1])**2+(t[2]-s[2])**2}M.rgb.keyword=function(t){const s=B[t];if(s){return s}let b=Infinity;let M;for(const s of Object.keys(F)){const B=F[s];const T=comparativeDistance(t,B);if(T<b){b=T;M=s}}return M};M.keyword.rgb=function(t){return F[t]};M.rgb.xyz=function(t){let s=t[0]/255;let b=t[1]/255;let F=t[2]/255;s=s>.04045?((s+.055)/1.055)**2.4:s/12.92;b=b>.04045?((b+.055)/1.055)**2.4:b/12.92;F=F>.04045?((F+.055)/1.055)**2.4:F/12.92;const B=s*.4124+b*.3576+F*.1805;const M=s*.2126+b*.7152+F*.0722;const T=s*.0193+b*.1192+F*.9505;return[B*100,M*100,T*100]};M.rgb.lab=function(t){const s=M.rgb.xyz(t);let b=s[0];let F=s[1];let B=s[2];b/=95.047;F/=100;B/=108.883;b=b>.008856?b**(1/3):7.787*b+16/116;F=F>.008856?F**(1/3):7.787*F+16/116;B=B>.008856?B**(1/3):7.787*B+16/116;const T=116*F-16;const L=500*(b-F);const G=200*(F-B);return[T,L,G]};M.hsl.rgb=function(t){const s=t[0]/360;const b=t[1]/100;const F=t[2]/100;let B;let M;let T;if(b===0){T=F*255;return[T,T,T]}if(F<.5){B=F*(1+b)}else{B=F+b-F*b}const L=2*F-B;const G=[0,0,0];for(let t=0;t<3;t++){M=s+1/3*-(t-1);if(M<0){M++}if(M>1){M--}if(6*M<1){T=L+(B-L)*6*M}else if(2*M<1){T=B}else if(3*M<2){T=L+(B-L)*(2/3-M)*6}else{T=L}G[t]=T*255}return G};M.hsl.hsv=function(t){const s=t[0];let b=t[1]/100;let F=t[2]/100;let B=b;const M=Math.max(F,.01);F*=2;b*=F<=1?F:2-F;B*=M<=1?M:2-M;const T=(F+b)/2;const L=F===0?2*B/(M+B):2*b/(F+b);return[s,L*100,T*100]};M.hsv.rgb=function(t){const s=t[0]/60;const b=t[1]/100;let F=t[2]/100;const B=Math.floor(s)%6;const M=s-Math.floor(s);const T=255*F*(1-b);const L=255*F*(1-b*M);const G=255*F*(1-b*(1-M));F*=255;switch(B){case 0:return[F,G,T];case 1:return[L,F,T];case 2:return[T,F,G];case 3:return[T,L,F];case 4:return[G,T,F];case 5:return[F,T,L]}};M.hsv.hsl=function(t){const s=t[0];const b=t[1]/100;const F=t[2]/100;const B=Math.max(F,.01);let M;let T;T=(2-b)*F;const L=(2-b)*B;M=b*B;M/=L<=1?L:2-L;M=M||0;T/=2;return[s,M*100,T*100]};M.hwb.rgb=function(t){const s=t[0]/360;let b=t[1]/100;let F=t[2]/100;const B=b+F;let M;if(B>1){b/=B;F/=B}const T=Math.floor(6*s);const L=1-F;M=6*s-T;if((T&1)!==0){M=1-M}const G=b+M*(L-b);let R;let U;let W;switch(T){default:case 6:case 0:R=L;U=G;W=b;break;case 1:R=G;U=L;W=b;break;case 2:R=b;U=L;W=G;break;case 3:R=b;U=G;W=L;break;case 4:R=G;U=b;W=L;break;case 5:R=L;U=b;W=G;break}return[R*255,U*255,W*255]};M.cmyk.rgb=function(t){const s=t[0]/100;const b=t[1]/100;const F=t[2]/100;const B=t[3]/100;const M=1-Math.min(1,s*(1-B)+B);const T=1-Math.min(1,b*(1-B)+B);const L=1-Math.min(1,F*(1-B)+B);return[M*255,T*255,L*255]};M.xyz.rgb=function(t){const s=t[0]/100;const b=t[1]/100;const F=t[2]/100;let B;let M;let T;B=s*3.2406+b*-1.5372+F*-.4986;M=s*-.9689+b*1.8758+F*.0415;T=s*.0557+b*-.204+F*1.057;B=B>.0031308?1.055*B**(1/2.4)-.055:B*12.92;M=M>.0031308?1.055*M**(1/2.4)-.055:M*12.92;T=T>.0031308?1.055*T**(1/2.4)-.055:T*12.92;B=Math.min(Math.max(0,B),1);M=Math.min(Math.max(0,M),1);T=Math.min(Math.max(0,T),1);return[B*255,M*255,T*255]};M.xyz.lab=function(t){let s=t[0];let b=t[1];let F=t[2];s/=95.047;b/=100;F/=108.883;s=s>.008856?s**(1/3):7.787*s+16/116;b=b>.008856?b**(1/3):7.787*b+16/116;F=F>.008856?F**(1/3):7.787*F+16/116;const B=116*b-16;const M=500*(s-b);const T=200*(b-F);return[B,M,T]};M.lab.xyz=function(t){const s=t[0];const b=t[1];const F=t[2];let B;let M;let T;M=(s+16)/116;B=b/500+M;T=M-F/200;const L=M**3;const G=B**3;const R=T**3;M=L>.008856?L:(M-16/116)/7.787;B=G>.008856?G:(B-16/116)/7.787;T=R>.008856?R:(T-16/116)/7.787;B*=95.047;M*=100;T*=108.883;return[B,M,T]};M.lab.lch=function(t){const s=t[0];const b=t[1];const F=t[2];let B;const M=Math.atan2(F,b);B=M*360/2/Math.PI;if(B<0){B+=360}const T=Math.sqrt(b*b+F*F);return[s,T,B]};M.lch.lab=function(t){const s=t[0];const b=t[1];const F=t[2];const B=F/360*2*Math.PI;const M=b*Math.cos(B);const T=b*Math.sin(B);return[s,M,T]};M.rgb.ansi16=function(t,s=null){const[b,F,B]=t;let T=s===null?M.rgb.hsv(t)[2]:s;T=Math.round(T/50);if(T===0){return 30}let L=30+(Math.round(B/255)<<2|Math.round(F/255)<<1|Math.round(b/255));if(T===2){L+=60}return L};M.hsv.ansi16=function(t){return M.rgb.ansi16(M.hsv.rgb(t),t[2])};M.rgb.ansi256=function(t){const s=t[0];const b=t[1];const F=t[2];if(s===b&&b===F){if(s<8){return 16}if(s>248){return 231}return Math.round((s-8)/247*24)+232}const B=16+36*Math.round(s/255*5)+6*Math.round(b/255*5)+Math.round(F/255*5);return B};M.ansi16.rgb=function(t){let s=t%10;if(s===0||s===7){if(t>50){s+=3.5}s=s/10.5*255;return[s,s,s]}const b=(~~(t>50)+1)*.5;const F=(s&1)*b*255;const B=(s>>1&1)*b*255;const M=(s>>2&1)*b*255;return[F,B,M]};M.ansi256.rgb=function(t){if(t>=232){const s=(t-232)*10+8;return[s,s,s]}t-=16;let s;const b=Math.floor(t/36)/5*255;const F=Math.floor((s=t%36)/6)/5*255;const B=s%6/5*255;return[b,F,B]};M.rgb.hex=function(t){const s=((Math.round(t[0])&255)<<16)+((Math.round(t[1])&255)<<8)+(Math.round(t[2])&255);const b=s.toString(16).toUpperCase();return"000000".substring(b.length)+b};M.hex.rgb=function(t){const s=t.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!s){return[0,0,0]}let b=s[0];if(s[0].length===3){b=b.split("").map((t=>t+t)).join("")}const F=parseInt(b,16);const B=F>>16&255;const M=F>>8&255;const T=F&255;return[B,M,T]};M.rgb.hcg=function(t){const s=t[0]/255;const b=t[1]/255;const F=t[2]/255;const B=Math.max(Math.max(s,b),F);const M=Math.min(Math.min(s,b),F);const T=B-M;let L;let G;if(T<1){L=M/(1-T)}else{L=0}if(T<=0){G=0}else if(B===s){G=(b-F)/T%6}else if(B===b){G=2+(F-s)/T}else{G=4+(s-b)/T}G/=6;G%=1;return[G*360,T*100,L*100]};M.hsl.hcg=function(t){const s=t[1]/100;const b=t[2]/100;const F=b<.5?2*s*b:2*s*(1-b);let B=0;if(F<1){B=(b-.5*F)/(1-F)}return[t[0],F*100,B*100]};M.hsv.hcg=function(t){const s=t[1]/100;const b=t[2]/100;const F=s*b;let B=0;if(F<1){B=(b-F)/(1-F)}return[t[0],F*100,B*100]};M.hcg.rgb=function(t){const s=t[0]/360;const b=t[1]/100;const F=t[2]/100;if(b===0){return[F*255,F*255,F*255]}const B=[0,0,0];const M=s%1*6;const T=M%1;const L=1-T;let G=0;switch(Math.floor(M)){case 0:B[0]=1;B[1]=T;B[2]=0;break;case 1:B[0]=L;B[1]=1;B[2]=0;break;case 2:B[0]=0;B[1]=1;B[2]=T;break;case 3:B[0]=0;B[1]=L;B[2]=1;break;case 4:B[0]=T;B[1]=0;B[2]=1;break;default:B[0]=1;B[1]=0;B[2]=L}G=(1-b)*F;return[(b*B[0]+G)*255,(b*B[1]+G)*255,(b*B[2]+G)*255]};M.hcg.hsv=function(t){const s=t[1]/100;const b=t[2]/100;const F=s+b*(1-s);let B=0;if(F>0){B=s/F}return[t[0],B*100,F*100]};M.hcg.hsl=function(t){const s=t[1]/100;const b=t[2]/100;const F=b*(1-s)+.5*s;let B=0;if(F>0&&F<.5){B=s/(2*F)}else if(F>=.5&&F<1){B=s/(2*(1-F))}return[t[0],B*100,F*100]};M.hcg.hwb=function(t){const s=t[1]/100;const b=t[2]/100;const F=s+b*(1-s);return[t[0],(F-s)*100,(1-F)*100]};M.hwb.hcg=function(t){const s=t[1]/100;const b=t[2]/100;const F=1-b;const B=F-s;let M=0;if(B<1){M=(F-B)/(1-B)}return[t[0],B*100,M*100]};M.apple.rgb=function(t){return[t[0]/65535*255,t[1]/65535*255,t[2]/65535*255]};M.rgb.apple=function(t){return[t[0]/255*65535,t[1]/255*65535,t[2]/255*65535]};M.gray.rgb=function(t){return[t[0]/100*255,t[0]/100*255,t[0]/100*255]};M.gray.hsl=function(t){return[0,0,t[0]]};M.gray.hsv=M.gray.hsl;M.gray.hwb=function(t){return[0,100,t[0]]};M.gray.cmyk=function(t){return[0,0,0,t[0]]};M.gray.lab=function(t){return[t[0],0,0]};M.gray.hex=function(t){const s=Math.round(t[0]/100*255)&255;const b=(s<<16)+(s<<8)+s;const F=b.toString(16).toUpperCase();return"000000".substring(F.length)+F};M.rgb.gray=function(t){const s=(t[0]+t[1]+t[2])/3;return[s/255*100]}},7319:(t,s,b)=>{const F=b(9006);const B=b(2450);const M={};const T=Object.keys(F);function wrapRaw(t){const wrappedFn=function(...s){const b=s[0];if(b===undefined||b===null){return b}if(b.length>1){s=b}return t(s)};if("conversion"in t){wrappedFn.conversion=t.conversion}return wrappedFn}function wrapRounded(t){const wrappedFn=function(...s){const b=s[0];if(b===undefined||b===null){return b}if(b.length>1){s=b}const F=t(s);if(typeof F==="object"){for(let t=F.length,s=0;s<t;s++){F[s]=Math.round(F[s])}}return F};if("conversion"in t){wrappedFn.conversion=t.conversion}return wrappedFn}T.forEach((t=>{M[t]={};Object.defineProperty(M[t],"channels",{value:F[t].channels});Object.defineProperty(M[t],"labels",{value:F[t].labels});const s=B(t);const b=Object.keys(s);b.forEach((b=>{const F=s[b];M[t][b]=wrapRounded(F);M[t][b].raw=wrapRaw(F)}))}));t.exports=M},2450:(t,s,b)=>{const F=b(9006);function buildGraph(){const t={};const s=Object.keys(F);for(let b=s.length,F=0;F<b;F++){t[s[F]]={distance:-1,parent:null}}return t}function deriveBFS(t){const s=buildGraph();const b=[t];s[t].distance=0;while(b.length){const t=b.pop();const B=Object.keys(F[t]);for(let F=B.length,M=0;M<F;M++){const F=B[M];const T=s[F];if(T.distance===-1){T.distance=s[t].distance+1;T.parent=t;b.unshift(F)}}}return s}function link(t,s){return function(b){return s(t(b))}}function wrapConversion(t,s){const b=[s[t].parent,t];let B=F[s[t].parent][t];let M=s[t].parent;while(s[M].parent){b.unshift(s[M].parent);B=link(F[s[M].parent][M],B);M=s[M].parent}B.conversion=b;return B}t.exports=function(t){const s=deriveBFS(t);const b={};const F=Object.keys(s);for(let t=F.length,B=0;B<t;B++){const t=F[B];const M=s[t];if(M.parent===null){continue}b[t]=wrapConversion(t,s)}return b}},8147:t=>{"use strict";t.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}},3220:(t,s,b)=>{"use strict";const F=b(5317);const B=b(8291);const M=b(2691);function spawn(t,s,b){const T=B(t,s,b);const L=F.spawn(T.command,T.args,T.options);M.hookChildProcess(L,T);return L}function spawnSync(t,s,b){const T=B(t,s,b);const L=F.spawnSync(T.command,T.args,T.options);L.error=L.error||M.verifyENOENTSync(L.status,T);return L}t.exports=spawn;t.exports.spawn=spawn;t.exports.sync=spawnSync;t.exports._parse=B;t.exports._enoent=M},2691:t=>{"use strict";const s=process.platform==="win32";function notFoundError(t,s){return Object.assign(new Error(`${s} ${t.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${s} ${t.command}`,path:t.command,spawnargs:t.args})}function hookChildProcess(t,b){if(!s){return}const F=t.emit;t.emit=function(s,B){if(s==="exit"){const s=verifyENOENT(B,b);if(s){return F.call(t,"error",s)}}return F.apply(t,arguments)}}function verifyENOENT(t,b){if(s&&t===1&&!b.file){return notFoundError(b.original,"spawn")}return null}function verifyENOENTSync(t,b){if(s&&t===1&&!b.file){return notFoundError(b.original,"spawnSync")}return null}t.exports={hookChildProcess:hookChildProcess,verifyENOENT:verifyENOENT,verifyENOENTSync:verifyENOENTSync,notFoundError:notFoundError}},8291:(t,s,b)=>{"use strict";const F=b(6928);const B=b(8032);const M=b(6878);const T=b(2537);const L=process.platform==="win32";const G=/\.(?:com|exe)$/i;const R=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function detectShebang(t){t.file=B(t);const s=t.file&&T(t.file);if(s){t.args.unshift(t.file);t.command=s;return B(t)}return t.file}function parseNonShell(t){if(!L){return t}const s=detectShebang(t);const b=!G.test(s);if(t.options.forceShell||b){const b=R.test(s);t.command=F.normalize(t.command);t.command=M.command(t.command);t.args=t.args.map((t=>M.argument(t,b)));const B=[t.command].concat(t.args).join(" ");t.args=["/d","/s","/c",`"${B}"`];t.command=process.env.comspec||"cmd.exe";t.options.windowsVerbatimArguments=true}return t}function parse(t,s,b){if(s&&!Array.isArray(s)){b=s;s=null}s=s?s.slice(0):[];b=Object.assign({},b);const F={command:t,args:s,options:b,file:undefined,original:{command:t,args:s}};return b.shell?F:parseNonShell(F)}t.exports=parse},6878:t=>{"use strict";const s=/([()\][%!^"`<>&|;, *?])/g;function escapeCommand(t){t=t.replace(s,"^$1");return t}function escapeArgument(t,b){t=`${t}`;t=t.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"');t=t.replace(/(?=(\\+?)?)\1$/,"$1$1");t=`"${t}"`;t=t.replace(s,"^$1");if(b){t=t.replace(s,"^$1")}return t}t.exports.command=escapeCommand;t.exports.argument=escapeArgument},2537:(t,s,b)=>{"use strict";const F=b(9896);const B=b(934);function readShebang(t){const s=150;const b=Buffer.alloc(s);let M;try{M=F.openSync(t,"r");F.readSync(M,b,0,s,0);F.closeSync(M)}catch(t){}return B(b.toString())}t.exports=readShebang},8032:(t,s,b)=>{"use strict";const F=b(6928);const B=b(4950);const M=b(8251);function resolveCommandAttempt(t,s){const b=t.options.env||process.env;const T=process.cwd();const L=t.options.cwd!=null;const G=L&&process.chdir!==undefined&&!process.chdir.disabled;if(G){try{process.chdir(t.options.cwd)}catch(t){}}let R;try{R=B.sync(t.command,{path:b[M({env:b})],pathExt:s?F.delimiter:undefined})}catch(t){}finally{if(G){process.chdir(T)}}if(R){R=F.resolve(L?t.options.cwd:"",R)}return R}function resolveCommand(t){return resolveCommandAttempt(t)||resolveCommandAttempt(t,true)}t.exports=resolveCommand},7020:(t,s,b)=>{const{dirname:F,resolve:B}=b(6928);const{readdirSync:M,statSync:T}=b(9896);t.exports=function(t,s){let b=B(".",t);let L,G=T(b);if(!G.isDirectory()){b=F(b)}while(true){L=s(b,M(b));if(L)return B(b,L);b=F(L=b);if(L===b)break}}},5426:(t,s,b)=>{"use strict";const F=b(6928);const B=b(5317);const M=b(3220);const T=b(2740);const L=b(7221);const G=b(163);const R=b(8244);const U=b(9487);const{spawnedKill:W,spawnedCancel:z,setupTimeout:q,validateTimeout:H,setExitHandler:V}=b(5676);const{handleInput:K,getSpawnedResult:Y,makeAllStream:Q,validateInputSync:X}=b(7828);const{mergePromise:Z,getSpawnedPromise:J}=b(6163);const{joinCommand:ee,parseCommand:ne,getEscapedCommand:se}=b(4835);const re=1e3*1e3*100;const getEnv=({env:t,extendEnv:s,preferLocal:b,localDir:F,execPath:B})=>{const M=s?{...process.env,...t}:t;if(b){return L.env({env:M,cwd:F,execPath:B})}return M};const handleArguments=(t,s,b={})=>{const B=M._parse(t,s,b);t=B.command;s=B.args;b=B.options;b={maxBuffer:re,buffer:true,stripFinalNewline:true,extendEnv:true,preferLocal:false,localDir:b.cwd||process.cwd(),execPath:process.execPath,encoding:"utf8",reject:true,cleanup:true,all:false,windowsHide:true,...b};b.env=getEnv(b);b.stdio=U(b);if(process.platform==="win32"&&F.basename(t,".exe")==="cmd"){s.unshift("/q")}return{file:t,args:s,options:b,parsed:B}};const handleOutput=(t,s,b)=>{if(typeof s!=="string"&&!Buffer.isBuffer(s)){return b===undefined?undefined:""}if(t.stripFinalNewline){return T(s)}return s};const execa=(t,s,b)=>{const F=handleArguments(t,s,b);const M=ee(t,s);const T=se(t,s);H(F.options);let L;try{L=B.spawn(F.file,F.args,F.options)}catch(t){const s=new B.ChildProcess;const b=Promise.reject(R({error:t,stdout:"",stderr:"",all:"",command:M,escapedCommand:T,parsed:F,timedOut:false,isCanceled:false,killed:false}));return Z(s,b)}const U=J(L);const X=q(L,F.options,U);const ne=V(L,F.options,X);const re={isCanceled:false};L.kill=W.bind(null,L.kill.bind(L));L.cancel=z.bind(null,L,re);const handlePromise=async()=>{const[{error:t,exitCode:s,signal:b,timedOut:B},G,U,W]=await Y(L,F.options,ne);const z=handleOutput(F.options,G);const q=handleOutput(F.options,U);const H=handleOutput(F.options,W);if(t||s!==0||b!==null){const G=R({error:t,exitCode:s,signal:b,stdout:z,stderr:q,all:H,command:M,escapedCommand:T,parsed:F,timedOut:B,isCanceled:re.isCanceled,killed:L.killed});if(!F.options.reject){return G}throw G}return{command:M,escapedCommand:T,exitCode:0,stdout:z,stderr:q,all:H,failed:false,timedOut:false,isCanceled:false,killed:false}};const ie=G(handlePromise);K(L,F.options.input);L.all=Q(L,F.options);return Z(L,ie)};t.exports=execa;t.exports.sync=(t,s,b)=>{const F=handleArguments(t,s,b);const M=ee(t,s);const T=se(t,s);X(F.options);let L;try{L=B.spawnSync(F.file,F.args,F.options)}catch(t){throw R({error:t,stdout:"",stderr:"",all:"",command:M,escapedCommand:T,parsed:F,timedOut:false,isCanceled:false,killed:false})}const G=handleOutput(F.options,L.stdout,L.error);const U=handleOutput(F.options,L.stderr,L.error);if(L.error||L.status!==0||L.signal!==null){const t=R({stdout:G,stderr:U,error:L.error,signal:L.signal,exitCode:L.status,command:M,escapedCommand:T,parsed:F,timedOut:L.error&&L.error.code==="ETIMEDOUT",isCanceled:false,killed:L.signal!==null});if(!F.options.reject){return t}throw t}return{command:M,escapedCommand:T,exitCode:0,stdout:G,stderr:U,failed:false,timedOut:false,isCanceled:false,killed:false}};t.exports.command=(t,s)=>{const[b,...F]=ne(t);return execa(b,F,s)};t.exports.commandSync=(t,s)=>{const[b,...F]=ne(t);return execa.sync(b,F,s)};t.exports.node=(t,s,b={})=>{if(s&&!Array.isArray(s)&&typeof s==="object"){b=s;s=[]}const F=U.node(b);const B=process.execArgv.filter((t=>!t.startsWith("--inspect")));const{nodePath:M=process.execPath,nodeOptions:T=B}=b;return execa(M,[...T,t,...Array.isArray(s)?s:[]],{...b,stdin:undefined,stdout:undefined,stderr:undefined,stdio:F,shell:false})}},4835:t=>{"use strict";const normalizeArgs=(t,s=[])=>{if(!Array.isArray(s)){return[t]}return[t,...s]};const s=/^[\w.-]+$/;const b=/"/g;const escapeArg=t=>{if(typeof t!=="string"||s.test(t)){return t}return`"${t.replace(b,'\\"')}"`};const joinCommand=(t,s)=>normalizeArgs(t,s).join(" ");const getEscapedCommand=(t,s)=>normalizeArgs(t,s).map((t=>escapeArg(t))).join(" ");const F=/ +/g;const parseCommand=t=>{const s=[];for(const b of t.trim().split(F)){const t=s[s.length-1];if(t&&t.endsWith("\\")){s[s.length-1]=`${t.slice(0,-1)} ${b}`}else{s.push(b)}}return s};t.exports={joinCommand:joinCommand,getEscapedCommand:getEscapedCommand,parseCommand:parseCommand}},8244:(t,s,b)=>{"use strict";const{signalsByName:F}=b(7976);const getErrorPrefix=({timedOut:t,timeout:s,errorCode:b,signal:F,signalDescription:B,exitCode:M,isCanceled:T})=>{if(t){return`timed out after ${s} milliseconds`}if(T){return"was canceled"}if(b!==undefined){return`failed with ${b}`}if(F!==undefined){return`was killed with ${F} (${B})`}if(M!==undefined){return`failed with exit code ${M}`}return"failed"};const makeError=({stdout:t,stderr:s,all:b,error:B,signal:M,exitCode:T,command:L,escapedCommand:G,timedOut:R,isCanceled:U,killed:W,parsed:{options:{timeout:z}}})=>{T=T===null?undefined:T;M=M===null?undefined:M;const q=M===undefined?undefined:F[M].description;const H=B&&B.code;const V=getErrorPrefix({timedOut:R,timeout:z,errorCode:H,signal:M,signalDescription:q,exitCode:T,isCanceled:U});const K=`Command ${V}: ${L}`;const Y=Object.prototype.toString.call(B)==="[object Error]";const Q=Y?`${K}\n${B.message}`:K;const X=[Q,s,t].filter(Boolean).join("\n");if(Y){B.originalMessage=B.message;B.message=X}else{B=new Error(X)}B.shortMessage=Q;B.command=L;B.escapedCommand=G;B.exitCode=T;B.signal=M;B.signalDescription=q;B.stdout=t;B.stderr=s;if(b!==undefined){B.all=b}if("bufferedData"in B){delete B.bufferedData}B.failed=true;B.timedOut=Boolean(R);B.isCanceled=U;B.killed=W&&!R;return B};t.exports=makeError},5676:(t,s,b)=>{"use strict";const F=b(857);const B=b(1521);const M=1e3*5;const spawnedKill=(t,s="SIGTERM",b={})=>{const F=t(s);setKillTimeout(t,s,b,F);return F};const setKillTimeout=(t,s,b,F)=>{if(!shouldForceKill(s,b,F)){return}const B=getForceKillAfterTimeout(b);const M=setTimeout((()=>{t("SIGKILL")}),B);if(M.unref){M.unref()}};const shouldForceKill=(t,{forceKillAfterTimeout:s},b)=>isSigterm(t)&&s!==false&&b;const isSigterm=t=>t===F.constants.signals.SIGTERM||typeof t==="string"&&t.toUpperCase()==="SIGTERM";const getForceKillAfterTimeout=({forceKillAfterTimeout:t=true})=>{if(t===true){return M}if(!Number.isFinite(t)||t<0){throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)}return t};const spawnedCancel=(t,s)=>{const b=t.kill();if(b){s.isCanceled=true}};const timeoutKill=(t,s,b)=>{t.kill(s);b(Object.assign(new Error("Timed out"),{timedOut:true,signal:s}))};const setupTimeout=(t,{timeout:s,killSignal:b="SIGTERM"},F)=>{if(s===0||s===undefined){return F}let B;const M=new Promise(((F,M)=>{B=setTimeout((()=>{timeoutKill(t,b,M)}),s)}));const T=F.finally((()=>{clearTimeout(B)}));return Promise.race([M,T])};const validateTimeout=({timeout:t})=>{if(t!==undefined&&(!Number.isFinite(t)||t<0)){throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${t}\` (${typeof t})`)}};const setExitHandler=async(t,{cleanup:s,detached:b},F)=>{if(!s||b){return F}const M=B((()=>{t.kill()}));return F.finally((()=>{M()}))};t.exports={spawnedKill:spawnedKill,spawnedCancel:spawnedCancel,setupTimeout:setupTimeout,validateTimeout:validateTimeout,setExitHandler:setExitHandler}},6163:t=>{"use strict";const s=(async()=>{})().constructor.prototype;const b=["then","catch","finally"].map((t=>[t,Reflect.getOwnPropertyDescriptor(s,t)]));const mergePromise=(t,s)=>{for(const[F,B]of b){const b=typeof s==="function"?(...t)=>Reflect.apply(B.value,s(),t):B.value.bind(s);Reflect.defineProperty(t,F,{...B,value:b})}return t};const getSpawnedPromise=t=>new Promise(((s,b)=>{t.on("exit",((t,b)=>{s({exitCode:t,signal:b})}));t.on("error",(t=>{b(t)}));if(t.stdin){t.stdin.on("error",(t=>{b(t)}))}}));t.exports={mergePromise:mergePromise,getSpawnedPromise:getSpawnedPromise}},9487:t=>{"use strict";const s=["stdin","stdout","stderr"];const hasAlias=t=>s.some((s=>t[s]!==undefined));const normalizeStdio=t=>{if(!t){return}const{stdio:b}=t;if(b===undefined){return s.map((s=>t[s]))}if(hasAlias(t)){throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${s.map((t=>`\`${t}\``)).join(", ")}`)}if(typeof b==="string"){return b}if(!Array.isArray(b)){throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof b}\``)}const F=Math.max(b.length,s.length);return Array.from({length:F},((t,s)=>b[s]))};t.exports=normalizeStdio;t.exports.node=t=>{const s=normalizeStdio(t);if(s==="ipc"){return"ipc"}if(s===undefined||typeof s==="string"){return[s,s,s,"ipc"]}if(s.includes("ipc")){return s}return[...s,"ipc"]}},7828:(t,s,b)=>{"use strict";const F=b(7277);const B=b(3221);const M=b(2993);const handleInput=(t,s)=>{if(s===undefined||t.stdin===undefined){return}if(F(s)){s.pipe(t.stdin)}else{t.stdin.end(s)}};const makeAllStream=(t,{all:s})=>{if(!s||!t.stdout&&!t.stderr){return}const b=M();if(t.stdout){b.add(t.stdout)}if(t.stderr){b.add(t.stderr)}return b};const getBufferedData=async(t,s)=>{if(!t){return}t.destroy();try{return await s}catch(t){return t.bufferedData}};const getStreamPromise=(t,{encoding:s,buffer:b,maxBuffer:F})=>{if(!t||!b){return}if(s){return B(t,{encoding:s,maxBuffer:F})}return B.buffer(t,{maxBuffer:F})};const getSpawnedResult=async({stdout:t,stderr:s,all:b},{encoding:F,buffer:B,maxBuffer:M},T)=>{const L=getStreamPromise(t,{encoding:F,buffer:B,maxBuffer:M});const G=getStreamPromise(s,{encoding:F,buffer:B,maxBuffer:M});const R=getStreamPromise(b,{encoding:F,buffer:B,maxBuffer:M*2});try{return await Promise.all([T,L,G,R])}catch(F){return Promise.all([{error:F,signal:F.signal,timedOut:F.timedOut},getBufferedData(t,L),getBufferedData(s,G),getBufferedData(b,R)])}};const validateInputSync=({input:t})=>{if(F(t)){throw new TypeError("The `input` option cannot be a stream in sync mode")}};t.exports={handleInput:handleInput,makeAllStream:makeAllStream,getSpawnedResult:getSpawnedResult,validateInputSync:validateInputSync}},1694:(t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:true});s.SIGNALS=void 0;const b=[{name:"SIGHUP",number:1,action:"terminate",description:"Terminal closed",standard:"posix"},{name:"SIGINT",number:2,action:"terminate",description:"User interruption with CTRL-C",standard:"ansi"},{name:"SIGQUIT",number:3,action:"core",description:"User interruption with CTRL-\\",standard:"posix"},{name:"SIGILL",number:4,action:"core",description:"Invalid machine instruction",standard:"ansi"},{name:"SIGTRAP",number:5,action:"core",description:"Debugger breakpoint",standard:"posix"},{name:"SIGABRT",number:6,action:"core",description:"Aborted",standard:"ansi"},{name:"SIGIOT",number:6,action:"core",description:"Aborted",standard:"bsd"},{name:"SIGBUS",number:7,action:"core",description:"Bus error due to misaligned, non-existing address or paging error",standard:"bsd"},{name:"SIGEMT",number:7,action:"terminate",description:"Command should be emulated but is not implemented",standard:"other"},{name:"SIGFPE",number:8,action:"core",description:"Floating point arithmetic error",standard:"ansi"},{name:"SIGKILL",number:9,action:"terminate",description:"Forced termination",standard:"posix",forced:true},{name:"SIGUSR1",number:10,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGSEGV",number:11,action:"core",description:"Segmentation fault",standard:"ansi"},{name:"SIGUSR2",number:12,action:"terminate",description:"Application-specific signal",standard:"posix"},{name:"SIGPIPE",number:13,action:"terminate",description:"Broken pipe or socket",standard:"posix"},{name:"SIGALRM",number:14,action:"terminate",description:"Timeout or timer",standard:"posix"},{name:"SIGTERM",number:15,action:"terminate",description:"Termination",standard:"ansi"},{name:"SIGSTKFLT",number:16,action:"terminate",description:"Stack is empty or overflowed",standard:"other"},{name:"SIGCHLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"posix"},{name:"SIGCLD",number:17,action:"ignore",description:"Child process terminated, paused or unpaused",standard:"other"},{name:"SIGCONT",number:18,action:"unpause",description:"Unpaused",standard:"posix",forced:true},{name:"SIGSTOP",number:19,action:"pause",description:"Paused",standard:"posix",forced:true},{name:"SIGTSTP",number:20,action:"pause",description:'Paused using CTRL-Z or "suspend"',standard:"posix"},{name:"SIGTTIN",number:21,action:"pause",description:"Background process cannot read terminal input",standard:"posix"},{name:"SIGBREAK",number:21,action:"terminate",description:"User interruption with CTRL-BREAK",standard:"other"},{name:"SIGTTOU",number:22,action:"pause",description:"Background process cannot write to terminal output",standard:"posix"},{name:"SIGURG",number:23,action:"ignore",description:"Socket received out-of-band data",standard:"bsd"},{name:"SIGXCPU",number:24,action:"core",description:"Process timed out",standard:"bsd"},{name:"SIGXFSZ",number:25,action:"core",description:"File too big",standard:"bsd"},{name:"SIGVTALRM",number:26,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGPROF",number:27,action:"terminate",description:"Timeout or timer",standard:"bsd"},{name:"SIGWINCH",number:28,action:"ignore",description:"Terminal window size changed",standard:"bsd"},{name:"SIGIO",number:29,action:"terminate",description:"I/O is available",standard:"other"},{name:"SIGPOLL",number:29,action:"terminate",description:"Watched event",standard:"other"},{name:"SIGINFO",number:29,action:"ignore",description:"Request for process information",standard:"other"},{name:"SIGPWR",number:30,action:"terminate",description:"Device running out of power",standard:"systemv"},{name:"SIGSYS",number:31,action:"core",description:"Invalid system call",standard:"other"},{name:"SIGUNUSED",number:31,action:"terminate",description:"Invalid system call",standard:"other"}];s.SIGNALS=b},7976:(t,s,b)=>{"use strict";Object.defineProperty(s,"__esModule",{value:true});s.signalsByNumber=s.signalsByName=void 0;var F=b(857);var B=b(5136);var M=b(968);const getSignalsByName=function(){const t=(0,B.getSignals)();return t.reduce(getSignalByName,{})};const getSignalByName=function(t,{name:s,number:b,description:F,supported:B,action:M,forced:T,standard:L}){return{...t,[s]:{name:s,number:b,description:F,supported:B,action:M,forced:T,standard:L}}};const T=getSignalsByName();s.signalsByName=T;const getSignalsByNumber=function(){const t=(0,B.getSignals)();const s=M.SIGRTMAX+1;const b=Array.from({length:s},((s,b)=>getSignalByNumber(b,t)));return Object.assign({},...b)};const getSignalByNumber=function(t,s){const b=findSignalByNumber(t,s);if(b===undefined){return{}}const{name:F,description:B,supported:M,action:T,forced:L,standard:G}=b;return{[t]:{name:F,number:t,description:B,supported:M,action:T,forced:L,standard:G}}};const findSignalByNumber=function(t,s){const b=s.find((({name:s})=>F.constants.signals[s]===t));if(b!==undefined){return b}return s.find((s=>s.number===t))};const L=getSignalsByNumber();s.signalsByNumber=L},968:(t,s)=>{"use strict";Object.defineProperty(s,"__esModule",{value:true});s.SIGRTMAX=s.getRealtimeSignals=void 0;const getRealtimeSignals=function(){const t=F-b+1;return Array.from({length:t},getRealtimeSignal)};s.getRealtimeSignals=getRealtimeSignals;const getRealtimeSignal=function(t,s){return{name:`SIGRT${s+1}`,number:b+s,action:"terminate",description:"Application-specific signal (realtime)",standard:"posix"}};const b=34;const F=64;s.SIGRTMAX=F},5136:(t,s,b)=>{"use strict";Object.defineProperty(s,"__esModule",{value:true});s.getSignals=void 0;var F=b(857);var B=b(1694);var M=b(968);const getSignals=function(){const t=(0,M.getRealtimeSignals)();const s=[...B.SIGNALS,...t].map(normalizeSignal);return s};s.getSignals=getSignals;const normalizeSignal=function({name:t,number:s,description:b,action:B,forced:M=false,standard:T}){const{signals:{[t]:L}}=F.constants;const G=L!==undefined;const R=G?L:s;return{name:t,number:R,description:b,supported:G,action:B,forced:M,standard:T}}},1521:(t,s,b)=>{var F=global.process;const processOk=function(t){return 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"};if(!processOk(F)){t.exports=function(){return function(){}}}else{var B=b(2613);var M=b(2280);var T=/^win/i.test(F.platform);var L=b(4434);if(typeof L!=="function"){L=L.EventEmitter}var G;if(F.__signal_exit_emitter__){G=F.__signal_exit_emitter__}else{G=F.__signal_exit_emitter__=new L;G.count=0;G.emitted={}}if(!G.infinite){G.setMaxListeners(Infinity);G.infinite=true}t.exports=function(t,s){if(!processOk(global.process)){return function(){}}B.equal(typeof t,"function","a callback must be provided for exit handler");if(z===false){q()}var b="exit";if(s&&s.alwaysLast){b="afterexit"}var remove=function(){G.removeListener(b,t);if(G.listeners("exit").length===0&&G.listeners("afterexit").length===0){R()}};G.on(b,t);return remove};var R=function unload(){if(!z||!processOk(global.process)){return}z=false;M.forEach((function(t){try{F.removeListener(t,W[t])}catch(t){}}));F.emit=K;F.reallyExit=H;G.count-=1};t.exports.unload=R;var U=function emit(t,s,b){if(G.emitted[t]){return}G.emitted[t]=true;G.emit(t,s,b)};var W={};M.forEach((function(t){W[t]=function listener(){if(!processOk(global.process)){return}var s=F.listeners(t);if(s.length===G.count){R();U("exit",null,t);U("afterexit",null,t);if(T&&t==="SIGHUP"){t="SIGINT"}F.kill(F.pid,t)}}}));t.exports.signals=function(){return M};var z=false;var q=function load(){if(z||!processOk(global.process)){return}z=true;G.count+=1;M=M.filter((function(t){try{F.on(t,W[t]);return true}catch(t){return false}}));F.emit=Y;F.reallyExit=V};t.exports.load=q;var H=F.reallyExit;var V=function processReallyExit(t){if(!processOk(global.process)){return}F.exitCode=t||0;U("exit",F.exitCode,null);U("afterexit",F.exitCode,null);H.call(F,F.exitCode)};var K=F.emit;var Y=function processEmit(t,s){if(t==="exit"&&processOk(global.process)){if(s!==undefined){F.exitCode=s}var b=K.apply(this,arguments);U("exit",F.exitCode,null);U("afterexit",F.exitCode,null);return b}else{return K.apply(this,arguments)}}}},2280:t=>{t.exports=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(process.platform!=="win32"){t.exports.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(process.platform==="linux"){t.exports.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}},2740:t=>{"use strict";t.exports=t=>{const s=typeof t==="string"?"\n":"\n".charCodeAt();const b=typeof t==="string"?"\r":"\r".charCodeAt();if(t[t.length-1]===s){t=t.slice(0,t.length-1)}if(t[t.length-1]===b){t=t.slice(0,t.length-1)}return t}},9103:t=>{"use strict";t.exports=function getCallerFile(t){if(t===void 0){t=2}if(t>=Error.stackTraceLimit){throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `"+t+"` and Error.stackTraceLimit was: `"+Error.stackTraceLimit+"`")}var s=Error.prepareStackTrace;Error.prepareStackTrace=function(t,s){return s};var b=(new Error).stack;Error.prepareStackTrace=s;if(b!==null&&typeof b==="object"){return b[t]?b[t].getFileName():undefined}}},324:(t,s,b)=>{"use strict";const{PassThrough:F}=b(2203);t.exports=t=>{t={...t};const{array:s}=t;let{encoding:b}=t;const B=b==="buffer";let M=false;if(s){M=!(b||B)}else{b=b||"utf8"}if(B){b=null}const T=new F({objectMode:M});if(b){T.setEncoding(b)}let L=0;const G=[];T.on("data",(t=>{G.push(t);if(M){L=G.length}else{L+=t.length}}));T.getBufferedValue=()=>{if(s){return G}return B?Buffer.concat(G,L):G.join("")};T.getBufferedLength=()=>L;return T}},3221:(t,s,b)=>{"use strict";const{constants:F}=b(181);const B=b(2203);const{promisify:M}=b(9023);const T=b(324);const L=M(B.pipeline);class MaxBufferError extends Error{constructor(){super("maxBuffer exceeded");this.name="MaxBufferError"}}async function getStream(t,s){if(!t){throw new Error("Expected a stream")}s={maxBuffer:Infinity,...s};const{maxBuffer:b}=s;const B=T(s);await new Promise(((s,M)=>{const rejectPromise=t=>{if(t&&B.getBufferedLength()<=F.MAX_LENGTH){t.bufferedData=B.getBufferedValue()}M(t)};(async()=>{try{await L(t,B);s()}catch(t){rejectPromise(t)}})();B.on("data",(()=>{if(B.getBufferedLength()>b){rejectPromise(new MaxBufferError)}}))}));return B.getBufferedValue()}t.exports=getStream;t.exports.buffer=(t,s)=>getStream(t,{...s,encoding:"buffer"});t.exports.array=(t,s)=>getStream(t,{...s,array:true});t.exports.MaxBufferError=MaxBufferError},205:t=>{"use strict";const isFullwidthCodePoint=t=>{if(Number.isNaN(t)){return false}if(t>=4352&&(t<=4447||t===9001||t===9002||11904<=t&&t<=12871&&t!==12351||12880<=t&&t<=19903||19968<=t&&t<=42182||43360<=t&&t<=43388||44032<=t&&t<=55203||63744<=t&&t<=64255||65040<=t&&t<=65049||65072<=t&&t<=65131||65281<=t&&t<=65376||65504<=t&&t<=65510||110592<=t&&t<=110593||127488<=t&&t<=127569||131072<=t&&t<=262141)){return true}return false};t.exports=isFullwidthCodePoint;t.exports["default"]=isFullwidthCodePoint},7277:t=>{"use strict";const isStream=t=>t!==null&&typeof t==="object"&&typeof t.pipe==="function";isStream.writable=t=>isStream(t)&&t.writable!==false&&typeof t._write==="function"&&typeof t._writableState==="object";isStream.readable=t=>isStream(t)&&t.readable!==false&&typeof t._read==="function"&&typeof t._readableState==="object";isStream.duplex=t=>isStream.writable(t)&&isStream.readable(t);isStream.transform=t=>isStream.duplex(t)&&typeof t._transform==="function";t.exports=isStream},7210:(t,s,b)=>{var F=b(9896);var B;if(process.platform==="win32"||global.TESTING_WINDOWS){B=b(6431)}else{B=b(2891)}t.exports=isexe;isexe.sync=sync;function isexe(t,s,b){if(typeof s==="function"){b=s;s={}}if(!b){if(typeof Promise!=="function"){throw new TypeError("callback not provided")}return new Promise((function(b,F){isexe(t,s||{},(function(t,s){if(t){F(t)}else{b(s)}}))}))}B(t,s||{},(function(t,F){if(t){if(t.code==="EACCES"||s&&s.ignoreErrors){t=null;F=false}}b(t,F)}))}function sync(t,s){try{return B.sync(t,s||{})}catch(t){if(s&&s.ignoreErrors||t.code==="EACCES"){return false}else{throw t}}}},2891:(t,s,b)=>{t.exports=isexe;isexe.sync=sync;var F=b(9896);function isexe(t,s,b){F.stat(t,(function(t,F){b(t,t?false:checkStat(F,s))}))}function sync(t,s){return checkStat(F.statSync(t),s)}function checkStat(t,s){return t.isFile()&&checkMode(t,s)}function checkMode(t,s){var b=t.mode;var F=t.uid;var B=t.gid;var M=s.uid!==undefined?s.uid:process.getuid&&process.getuid();var T=s.gid!==undefined?s.gid:process.getgid&&process.getgid();var L=parseInt("100",8);var G=parseInt("010",8);var R=parseInt("001",8);var U=L|G;var W=b&R||b&G&&B===T||b&L&&F===M||b&U&&M===0;return W}},6431:(t,s,b)=>{t.exports=isexe;isexe.sync=sync;var F=b(9896);function checkPathExt(t,s){var b=s.pathExt!==undefined?s.pathExt:process.env.PATHEXT;if(!b){return true}b=b.split(";");if(b.indexOf("")!==-1){return true}for(var F=0;F<b.length;F++){var B=b[F].toLowerCase();if(B&&t.substr(-B.length).toLowerCase()===B){return true}}return false}function checkStat(t,s,b){if(!t.isSymbolicLink()&&!t.isFile()){return false}return checkPathExt(s,b)}function isexe(t,s,b){F.stat(t,(function(F,B){b(F,F?false:checkStat(B,t,s))}))}function sync(t,s){return checkStat(F.statSync(t),t,s)}},2993:(t,s,b)=>{"use strict";const{PassThrough:F}=b(2203);t.exports=function(){var t=[];var s=new F({objectMode:true});s.setMaxListeners(0);s.add=add;s.isEmpty=isEmpty;s.on("unpipe",remove);Array.prototype.slice.call(arguments).forEach(add);return s;function add(b){if(Array.isArray(b)){b.forEach(add);return this}t.push(b);b.once("end",remove.bind(null,b));b.once("error",s.emit.bind(s,"error"));b.pipe(s,{end:false});return this}function isEmpty(){return t.length==0}function remove(b){t=t.filter((function(t){return t!==b}));if(!t.length&&s.readable){s.end()}}}},7221:(t,s,b)=>{"use strict";const F=b(6928);const B=b(8251);const npmRunPath=t=>{t={cwd:process.cwd(),path:process.env[B()],execPath:process.execPath,...t};let s;let b=F.resolve(t.cwd);const M=[];while(s!==b){M.push(F.join(b,"node_modules/.bin"));s=b;b=F.resolve(b,"..")}const T=F.resolve(t.cwd,t.execPath,"..");M.push(T);return M.concat(t.path).join(F.delimiter)};t.exports=npmRunPath;t.exports["default"]=npmRunPath;t.exports.env=s=>{s={env:process.env,...s};const b={...s.env};const F=B({env:b});s.path=b[F];b[F]=t.exports(s);return b}},163:(t,s,b)=>{"use strict";const F=b(7631);const B=new WeakMap;const onetime=(t,s={})=>{if(typeof t!=="function"){throw new TypeError("Expected a function")}let b;let M=0;const T=t.displayName||t.name||"<anonymous>";const onetime=function(...F){B.set(onetime,++M);if(M===1){b=t.apply(this,F);t=null}else if(s.throw===true){throw new Error(`Function \`${T}\` can only be called once`)}return b};F(onetime,t);B.set(onetime,M);return onetime};t.exports=onetime;t.exports["default"]=onetime;t.exports.callCount=t=>{if(!B.has(t)){throw new Error(`The given function \`${t.name}\` is not wrapped by the \`onetime\` package`)}return B.get(t)}},7631:t=>{"use strict";const mimicFn=(t,s)=>{for(const b of Reflect.ownKeys(s)){Object.defineProperty(t,b,Object.getOwnPropertyDescriptor(s,b))}return t};t.exports=mimicFn;t.exports["default"]=mimicFn},8251:t=>{"use strict";const pathKey=(t={})=>{const s=t.env||process.env;const b=t.platform||process.platform;if(b!=="win32"){return"PATH"}return Object.keys(s).reverse().find((t=>t.toUpperCase()==="PATH"))||"Path"};t.exports=pathKey;t.exports["default"]=pathKey},763:(t,s,b)=>{"use strict";var F=b(9896),B=b(6928).join,M=b(6928).resolve,T=b(6928).dirname,L={extensions:["js","json","coffee"],recurse:true,rename:function(t){return t},visit:function(t){return t}};function checkFileInclusion(t,s,b){return new RegExp("\\.("+b.extensions.join("|")+")$","i").test(s)&&!(b.include&&b.include instanceof RegExp&&!b.include.test(t))&&!(b.include&&typeof b.include==="function"&&!b.include(t,s))&&!(b.exclude&&b.exclude instanceof RegExp&&b.exclude.test(t))&&!(b.exclude&&typeof b.exclude==="function"&&b.exclude(t,s))}function requireDirectory(t,s,b){var G={};if(s&&!b&&typeof s!=="string"){b=s;s=null}b=b||{};for(var R in L){if(typeof b[R]==="undefined"){b[R]=L[R]}}s=!s?T(t.filename):M(T(t.filename),s);F.readdirSync(s).forEach((function(M){var T=B(s,M),L,R,U;if(F.statSync(T).isDirectory()&&b.recurse){L=requireDirectory(t,T,b);if(Object.keys(L).length){G[b.rename(M,T,M)]=L}}else{if(T!==t.filename&&checkFileInclusion(T,M,b)){R=M.substring(0,M.lastIndexOf("."));U=t.require(T);G[b.rename(R,T,M)]=b.visit(U,T,M)||U}}}));return G}t.exports=requireDirectory;t.exports.defaults=L},934:(t,s,b)=>{"use strict";const F=b(1368);t.exports=(t="")=>{const s=t.match(F);if(!s){return null}const[b,B]=s[0].replace(/#! ?/,"").split(" ");const M=b.split("/").pop();if(M==="env"){return B}return B?`${M} ${B}`:M}},1368:t=>{"use strict";t.exports=/^#!(.*)/},1838:(t,s,b)=>{"use strict";const F=b(764);const B=b(205);const M=b(3718);const stringWidth=t=>{if(typeof t!=="string"||t.length===0){return 0}t=F(t);if(t.length===0){return 0}t=t.replace(M()," ");let s=0;for(let b=0;b<t.length;b++){const F=t.codePointAt(b);if(F<=31||F>=127&&F<=159){continue}if(F>=768&&F<=879){continue}if(F>65535){b++}s+=B(F)?2:1}return s};t.exports=stringWidth;t.exports["default"]=stringWidth},3718:t=>{"use strict";t.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\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\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])|\uD83C[\uDF3E\uDF73\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])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\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])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\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\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\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\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*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\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\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\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[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}},764:(t,s,b)=>{"use strict";const F=b(8587);t.exports=t=>typeof t==="string"?t.replace(F(),""):t},4950:(t,s,b)=>{const F=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys";const B=b(6928);const M=F?";":":";const T=b(7210);const getNotFoundError=t=>Object.assign(new Error(`not found: ${t}`),{code:"ENOENT"});const getPathInfo=(t,s)=>{const b=s.colon||M;const B=t.match(/\//)||F&&t.match(/\\/)?[""]:[...F?[process.cwd()]:[],...(s.path||process.env.PATH||"").split(b)];const T=F?s.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"";const L=F?T.split(b):[""];if(F){if(t.indexOf(".")!==-1&&L[0]!=="")L.unshift("")}return{pathEnv:B,pathExt:L,pathExtExe:T}};const which=(t,s,b)=>{if(typeof s==="function"){b=s;s={}}if(!s)s={};const{pathEnv:F,pathExt:M,pathExtExe:L}=getPathInfo(t,s);const G=[];const step=b=>new Promise(((M,T)=>{if(b===F.length)return s.all&&G.length?M(G):T(getNotFoundError(t));const L=F[b];const R=/^".*"$/.test(L)?L.slice(1,-1):L;const U=B.join(R,t);const W=!R&&/^\.[\\\/]/.test(t)?t.slice(0,2)+U:U;M(subStep(W,b,0))}));const subStep=(t,b,F)=>new Promise(((B,R)=>{if(F===M.length)return B(step(b+1));const U=M[F];T(t+U,{pathExt:L},((M,T)=>{if(!M&&T){if(s.all)G.push(t+U);else return B(t+U)}return B(subStep(t,b,F+1))}))}));return b?step(0).then((t=>b(null,t)),b):step(0)};const whichSync=(t,s)=>{s=s||{};const{pathEnv:b,pathExt:F,pathExtExe:M}=getPathInfo(t,s);const L=[];for(let G=0;G<b.length;G++){const R=b[G];const U=/^".*"$/.test(R)?R.slice(1,-1):R;const W=B.join(U,t);const z=!U&&/^\.[\\\/]/.test(t)?t.slice(0,2)+W:W;for(let t=0;t<F.length;t++){const b=z+F[t];try{const t=T.sync(b,{pathExt:M});if(t){if(s.all)L.push(b);else return b}}catch(t){}}}if(s.all&&L.length)return L;if(s.nothrow)return null;throw getNotFoundError(t)};t.exports=which;which.sync=whichSync},1719:(t,s,b)=>{"use strict";b.a(t,(async(t,F)=>{try{b.r(s);var B=b(5317);var M=b.n(B);var T=b(1943);var L=b.n(T);var G=b(9309);var R=b(222);var U=b(5998);var W=b.n(U);const prepare=async()=>{await L().access("src").catch((()=>{throw new Error("src directory not found. Make sure all your source code is in the src directory.")}));await L().access("src/pages").then((()=>{throw new Error("pages directory found. Only NextJS App Router is supported. Convert your app to use App Router and delete the pages directory.")})).catch((()=>{}));await L().rm("src/app/mavenagi-cgi",{recursive:true,force:true});await L().mkdir("src/app/mavenagi-cgi",{recursive:true});await Promise.all([L().writeFile("src/app/mavenagi-cgi/next.ts",`// @ts-nocheck\n${U.compiledUserWorkerEntrypointScript}`),...Object.entries({"pre-install":"preInstall","post-install":"postInstall",feedbacks:"feedbackCreatedOrUpdated",conversations:"conversationCreatedOrUpdated","execute-action":"executeAction","knowledge-base-refreshed":"knowledgeBaseRefreshed"}).map((async([t,s])=>{await L().mkdir(`src/app/mavenagi-cgi/v1/${t}`,{recursive:true});const b=await L().readFile(`src/index.ts`,"utf8");const F=b.includes("export const runtime = 'edge'")||b.includes('export const runtime = "edge"');if(F){throw new Error("Edge runtime is no longer supported. Remove the runtime export from index.ts.")}await L().writeFile(`src/app/mavenagi-cgi/v1/${t}/route.ts`,`// @ts-nocheck\nimport {${s}} from '../../next'\n import userWorker from '../../../..'\n \n export const POST = ${s}\n `)}))])};await(0,R.A)(process.argv.slice(2)).scriptName("mavenagi").usage("$0 <cmd> [args]").command("build","build",(async()=>{await prepare();(0,B.execFileSync)(await(0,G.o0)(),["run","build"],{stdio:"inherit"});process.exit(0)})).command("dev","dev",(async()=>{await prepare();(0,B.execFileSync)(await(0,G.o0)(),["run","dev"],{stdio:"inherit"});process.exit(0)})).help().argv;F()}catch(t){F(t)}}),1)},5998:module=>{module.exports=eval("require")("./next.js")},803:t=>{function webpackEmptyContext(t){var s=new Error("Cannot find module '"+t+"'");s.code="MODULE_NOT_FOUND";throw s}webpackEmptyContext.keys=()=>[];webpackEmptyContext.resolve=webpackEmptyContext;webpackEmptyContext.id=803;t.exports=webpackEmptyContext},8501:t=>{function webpackEmptyContext(t){var s=new Error("Cannot find module '"+t+"'");s.code="MODULE_NOT_FOUND";throw s}webpackEmptyContext.keys=()=>[];webpackEmptyContext.resolve=webpackEmptyContext;webpackEmptyContext.id=8501;t.exports=webpackEmptyContext},2613:t=>{"use strict";t.exports=require("assert")},181:t=>{"use strict";t.exports=require("buffer")},5317:t=>{"use strict";t.exports=require("child_process")},4434:t=>{"use strict";t.exports=require("events")},9896:t=>{"use strict";t.exports=require("fs")},1943:t=>{"use strict";t.exports=require("fs/promises")},857:t=>{"use strict";t.exports=require("os")},6928:t=>{"use strict";t.exports=require("path")},2203:t=>{"use strict";t.exports=require("stream")},9023:t=>{"use strict";t.exports=require("util")},702:(t,s,b)=>{"use strict";const F={right:alignRight,center:alignCenter};const B=0;const M=1;const T=2;const L=3;class UI{constructor(t){var s;this.width=t.width;this.wrap=(s=t.wrap)!==null&&s!==void 0?s:true;this.rows=[]}span(...t){const s=this.div(...t);s.span=true}resetOutput(){this.rows=[]}div(...t){if(t.length===0){this.div("")}if(this.wrap&&this.shouldApplyLayoutDSL(...t)&&typeof t[0]==="string"){return this.applyLayoutDSL(t[0])}const s=t.map((t=>{if(typeof t==="string"){return this.colFromString(t)}return t}));this.rows.push(s);return s}shouldApplyLayoutDSL(...t){return t.length===1&&typeof t[0]==="string"&&/[\t\n]/.test(t[0])}applyLayoutDSL(t){const s=t.split("\n").map((t=>t.split("\t")));let b=0;s.forEach((t=>{if(t.length>1&&G.stringWidth(t[0])>b){b=Math.min(Math.floor(this.width*.5),G.stringWidth(t[0]))}}));s.forEach((t=>{this.div(...t.map(((s,F)=>({text:s.trim(),padding:this.measurePadding(s),width:F===0&&t.length>1?b:undefined}))))}));return this.rows[this.rows.length-1]}colFromString(t){return{text:t,padding:this.measurePadding(t)}}measurePadding(t){const s=G.stripAnsi(t);return[0,s.match(/\s*$/)[0].length,0,s.match(/^\s*/)[0].length]}toString(){const t=[];this.rows.forEach((s=>{this.rowToString(s,t)}));return t.filter((t=>!t.hidden)).map((t=>t.text)).join("\n")}rowToString(t,s){this.rasterize(t).forEach(((b,B)=>{let T="";b.forEach(((b,R)=>{const{width:U}=t[R];const W=this.negatePadding(t[R]);let z=b;if(W>G.stringWidth(b)){z+=" ".repeat(W-G.stringWidth(b))}if(t[R].align&&t[R].align!=="left"&&this.wrap){const s=F[t[R].align];z=s(z,W);if(G.stringWidth(z)<W){z+=" ".repeat((U||0)-G.stringWidth(z)-1)}}const q=t[R].padding||[0,0,0,0];if(q[L]){T+=" ".repeat(q[L])}T+=addBorder(t[R],z,"| ");T+=z;T+=addBorder(t[R],z," |");if(q[M]){T+=" ".repeat(q[M])}if(B===0&&s.length>0){T=this.renderInline(T,s[s.length-1])}}));s.push({text:T.replace(/ +$/,""),span:t.span})}));return s}renderInline(t,s){const b=t.match(/^ */);const F=b?b[0].length:0;const B=s.text;const M=G.stringWidth(B.trimRight());if(!s.span){return t}if(!this.wrap){s.hidden=true;return B+t}if(F<M){return t}s.hidden=true;return B.trimRight()+" ".repeat(F-M)+t.trimLeft()}rasterize(t){const s=[];const b=this.columnWidths(t);let F;t.forEach(((t,M)=>{t.width=b[M];if(this.wrap){F=G.wrap(t.text,this.negatePadding(t),{hard:true}).split("\n")}else{F=t.text.split("\n")}if(t.border){F.unshift("."+"-".repeat(this.negatePadding(t)+2)+".");F.push("'"+"-".repeat(this.negatePadding(t)+2)+"'")}if(t.padding){F.unshift(...new Array(t.padding[B]||0).fill(""));F.push(...new Array(t.padding[T]||0).fill(""))}F.forEach(((t,b)=>{if(!s[b]){s.push([])}const F=s[b];for(let t=0;t<M;t++){if(F[t]===undefined){F.push("")}}F.push(t)}))}));return s}negatePadding(t){let s=t.width||0;if(t.padding){s-=(t.padding[L]||0)+(t.padding[M]||0)}if(t.border){s-=4}return s}columnWidths(t){if(!this.wrap){return t.map((t=>t.width||G.stringWidth(t.text)))}let s=t.length;let b=this.width;const F=t.map((t=>{if(t.width){s--;b-=t.width;return t.width}return undefined}));const B=s?Math.floor(b/s):0;return F.map(((s,b)=>{if(s===undefined){return Math.max(B,_minWidth(t[b]))}return s}))}}function addBorder(t,s,b){if(t.border){if(/[.']-+[.']/.test(s)){return""}if(s.trim().length!==0){return b}return" "}return""}function _minWidth(t){const s=t.padding||[];const b=1+(s[L]||0)+(s[M]||0);if(t.border){return b+4}return b}function getWindowWidth(){if(typeof process==="object"&&process.stdout&&process.stdout.columns){return process.stdout.columns}return 80}function alignRight(t,s){t=t.trim();const b=G.stringWidth(t);if(b<s){return" ".repeat(s-b)+t}return t}function alignCenter(t,s){t=t.trim();const b=G.stringWidth(t);if(b>=s){return t}return" ".repeat(s-b>>1)+t}let G;function cliui(t,s){G=s;return new UI({width:(t===null||t===void 0?void 0:t.width)||getWindowWidth(),wrap:t===null||t===void 0?void 0:t.wrap})}const R=b(1838);const U=b(764);const W=b(2986);function ui(t){return cliui(t,{stringWidth:R,stripAnsi:U,wrap:W})}t.exports=ui},9162:(t,s,b)=>{"use strict";var F=b(9896);var B=b(9023);var M=b(6928);let T;class Y18N{constructor(t){t=t||{};this.directory=t.directory||"./locales";this.updateFiles=typeof t.updateFiles==="boolean"?t.updateFiles:true;this.locale=t.locale||"en";this.fallbackToLanguage=typeof t.fallbackToLanguage==="boolean"?t.fallbackToLanguage:true;this.cache=Object.create(null);this.writeQueue=[]}__(...t){if(typeof arguments[0]!=="string"){return this._taggedLiteral(arguments[0],...arguments)}const s=t.shift();let cb=function(){};if(typeof t[t.length-1]==="function")cb=t.pop();cb=cb||function(){};if(!this.cache[this.locale])this._readLocaleFile();if(!this.cache[this.locale][s]&&this.updateFiles){this.cache[this.locale][s]=s;this._enqueueWrite({directory:this.directory,locale:this.locale,cb:cb})}else{cb()}return T.format.apply(T.format,[this.cache[this.locale][s]||s].concat(t))}__n(){const t=Array.prototype.slice.call(arguments);const s=t.shift();const b=t.shift();const F=t.shift();let cb=function(){};if(typeof t[t.length-1]==="function")cb=t.pop();if(!this.cache[this.locale])this._readLocaleFile();let B=F===1?s:b;if(this.cache[this.locale][s]){const t=this.cache[this.locale][s];B=t[F===1?"one":"other"]}if(!this.cache[this.locale][s]&&this.updateFiles){this.cache[this.locale][s]={one:s,other:b};this._enqueueWrite({directory:this.directory,locale:this.locale,cb:cb})}else{cb()}const M=[B];if(~B.indexOf("%d"))M.push(F);return T.format.apply(T.format,M.concat(t))}setLocale(t){this.locale=t}getLocale(){return this.locale}updateLocale(t){if(!this.cache[this.locale])this._readLocaleFile();for(const s in t){if(Object.prototype.hasOwnProperty.call(t,s)){this.cache[this.locale][s]=t[s]}}}_taggedLiteral(t,...s){let b="";t.forEach((function(t,F){const B=s[F+1];b+=t;if(typeof B!=="undefined"){b+="%s"}}));return this.__.apply(this,[b].concat([].slice.call(s,1)))}_enqueueWrite(t){this.writeQueue.push(t);if(this.writeQueue.length===1)this._processWriteQueue()}_processWriteQueue(){const t=this;const s=this.writeQueue[0];const b=s.directory;const F=s.locale;const B=s.cb;const M=this._resolveLocaleFile(b,F);const L=JSON.stringify(this.cache[F],null,2);T.fs.writeFile(M,L,"utf-8",(function(s){t.writeQueue.shift();if(t.writeQueue.length>0)t._processWriteQueue();B(s)}))}_readLocaleFile(){let t={};const s=this._resolveLocaleFile(this.directory,this.locale);try{if(T.fs.readFileSync){t=JSON.parse(T.fs.readFileSync(s,"utf-8"))}}catch(b){if(b instanceof SyntaxError){b.message="syntax error in "+s}if(b.code==="ENOENT")t={};else throw b}this.cache[this.locale]=t}_resolveLocaleFile(t,s){let b=T.resolve(t,"./",s+".json");if(this.fallbackToLanguage&&!this._fileExistsSync(b)&&~s.lastIndexOf("_")){const F=T.resolve(t,"./",s.split("_")[0]+".json");if(this._fileExistsSync(F))b=F}return b}_fileExistsSync(t){return T.exists(t)}}function y18n$1(t,s){T=s;const b=new Y18N(t);return{__:b.__.bind(b),__n:b.__n.bind(b),setLocale:b.setLocale.bind(b),getLocale:b.getLocale.bind(b),updateLocale:b.updateLocale.bind(b),locale:b.locale}}var L={fs:{readFileSync:F.readFileSync,writeFile:F.writeFile},format:B.format,resolve:M.resolve,exists:t=>{try{return F.statSync(t).isFile()}catch(t){return false}}};const y18n=t=>y18n$1(t,L);t.exports=y18n},6420:(t,s,b)=>{"use strict";var F=b(9023);var B=b(6928);var M=b(9896);function camelCase(t){const s=t!==t.toLowerCase()&&t!==t.toUpperCase();if(!s){t=t.toLowerCase()}if(t.indexOf("-")===-1&&t.indexOf("_")===-1){return t}else{let s="";let b=false;const F=t.match(/^-+/);for(let B=F?F[0].length:0;B<t.length;B++){let F=t.charAt(B);if(b){b=false;F=F.toUpperCase()}if(B!==0&&(F==="-"||F==="_")){b=true}else if(F!=="-"&&F!=="_"){s+=F}}return s}}function decamelize(t,s){const b=t.toLowerCase();s=s||"-";let F="";for(let B=0;B<t.length;B++){const M=b.charAt(B);const T=t.charAt(B);if(M!==T&&B>0){F+=`${s}${b.charAt(B)}`}else{F+=T}}return F}function looksLikeNumber(t){if(t===null||t===undefined)return false;if(typeof t==="number")return true;if(/^0x[0-9a-f]+$/i.test(t))return true;if(/^0[^.]/.test(t))return false;return/^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(t)}function tokenizeArgString(t){if(Array.isArray(t)){return t.map((t=>typeof t!=="string"?t+"":t))}t=t.trim();let s=0;let b=null;let F=null;let B=null;const M=[];for(let T=0;T<t.length;T++){b=F;F=t.charAt(T);if(F===" "&&!B){if(!(b===" ")){s++}continue}if(F===B){B=null}else if((F==="'"||F==='"')&&!B){B=F}if(!M[s])M[s]="";M[s]+=F}return M}var T;(function(t){t["BOOLEAN"]="boolean";t["STRING"]="string";t["NUMBER"]="number";t["ARRAY"]="array"})(T||(T={}));let L;class YargsParser{constructor(t){L=t}parse(t,s){const b=Object.assign({alias:undefined,array:undefined,boolean:undefined,config:undefined,configObjects:undefined,configuration:undefined,coerce:undefined,count:undefined,default:undefined,envPrefix:undefined,narg:undefined,normalize:undefined,string:undefined,number:undefined,__:undefined,key:undefined},s);const F=tokenizeArgString(t);const B=typeof t==="string";const M=combineAliases(Object.assign(Object.create(null),b.alias));const G=Object.assign({"boolean-negation":true,"camel-case-expansion":true,"combine-arrays":false,"dot-notation":true,"duplicate-arguments-array":true,"flatten-duplicate-arrays":true,"greedy-arrays":true,"halt-at-non-option":false,"nargs-eats-options":false,"negation-prefix":"no-","parse-numbers":true,"parse-positional-numbers":true,"populate--":false,"set-placeholder-key":false,"short-option-groups":true,"strip-aliased":false,"strip-dashed":false,"unknown-options-as-args":false},b.configuration);const R=Object.assign(Object.create(null),b.default);const U=b.configObjects||[];const W=b.envPrefix;const z=G["populate--"];const q=z?"--":"_";const H=Object.create(null);const V=Object.create(null);const K=b.__||L.format;const Y={aliases:Object.create(null),arrays:Object.create(null),bools:Object.create(null),strings:Object.create(null),numbers:Object.create(null),counts:Object.create(null),normalize:Object.create(null),configs:Object.create(null),nargs:Object.create(null),coercions:Object.create(null),keys:[]};const Q=/^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;const X=new RegExp("^--"+G["negation-prefix"]+"(.+)");[].concat(b.array||[]).filter(Boolean).forEach((function(t){const s=typeof t==="object"?t.key:t;const b=Object.keys(t).map((function(t){const s={boolean:"bools",string:"strings",number:"numbers"};return s[t]})).filter(Boolean).pop();if(b){Y[b][s]=true}Y.arrays[s]=true;Y.keys.push(s)}));[].concat(b.boolean||[]).filter(Boolean).forEach((function(t){Y.bools[t]=true;Y.keys.push(t)}));[].concat(b.string||[]).filter(Boolean).forEach((function(t){Y.strings[t]=true;Y.keys.push(t)}));[].concat(b.number||[]).filter(Boolean).forEach((function(t){Y.numbers[t]=true;Y.keys.push(t)}));[].concat(b.count||[]).filter(Boolean).forEach((function(t){Y.counts[t]=true;Y.keys.push(t)}));[].concat(b.normalize||[]).filter(Boolean).forEach((function(t){Y.normalize[t]=true;Y.keys.push(t)}));if(typeof b.narg==="object"){Object.entries(b.narg).forEach((([t,s])=>{if(typeof s==="number"){Y.nargs[t]=s;Y.keys.push(t)}}))}if(typeof b.coerce==="object"){Object.entries(b.coerce).forEach((([t,s])=>{if(typeof s==="function"){Y.coercions[t]=s;Y.keys.push(t)}}))}if(typeof b.config!=="undefined"){if(Array.isArray(b.config)||typeof b.config==="string"){[].concat(b.config).filter(Boolean).forEach((function(t){Y.configs[t]=true}))}else if(typeof b.config==="object"){Object.entries(b.config).forEach((([t,s])=>{if(typeof s==="boolean"||typeof s==="function"){Y.configs[t]=s}}))}}extendAliases(b.key,M,b.default,Y.arrays);Object.keys(R).forEach((function(t){(Y.aliases[t]||[]).forEach((function(s){R[s]=R[t]}))}));let Z=null;checkConfiguration();let J=[];const ee=Object.assign(Object.create(null),{_:[]});const ne={};for(let t=0;t<F.length;t++){const s=F[t];const b=s.replace(/^-{3,}/,"---");let B;let M;let T;let L;let R;let U;if(s!=="--"&&/^-/.test(s)&&isUnknownOptionAsArg(s)){pushPositional(s)}else if(b.match(/^---+(=|$)/)){pushPositional(s);continue}else if(s.match(/^--.+=/)||!G["short-option-groups"]&&s.match(/^-.+=/)){L=s.match(/^--?([^=]+)=([\s\S]*)$/);if(L!==null&&Array.isArray(L)&&L.length>=3){if(checkAllAliases(L[1],Y.arrays)){t=eatArray(t,L[1],F,L[2])}else if(checkAllAliases(L[1],Y.nargs)!==false){t=eatNargs(t,L[1],F,L[2])}else{setArg(L[1],L[2],true)}}}else if(s.match(X)&&G["boolean-negation"]){L=s.match(X);if(L!==null&&Array.isArray(L)&&L.length>=2){M=L[1];setArg(M,checkAllAliases(M,Y.arrays)?[false]:false)}}else if(s.match(/^--.+/)||!G["short-option-groups"]&&s.match(/^-[^-]+/)){L=s.match(/^--?(.+)/);if(L!==null&&Array.isArray(L)&&L.length>=2){M=L[1];if(checkAllAliases(M,Y.arrays)){t=eatArray(t,M,F)}else if(checkAllAliases(M,Y.nargs)!==false){t=eatNargs(t,M,F)}else{R=F[t+1];if(R!==undefined&&(!R.match(/^-/)||R.match(Q))&&!checkAllAliases(M,Y.bools)&&!checkAllAliases(M,Y.counts)){setArg(M,R);t++}else if(/^(true|false)$/.test(R)){setArg(M,R);t++}else{setArg(M,defaultValue(M))}}}}else if(s.match(/^-.\..+=/)){L=s.match(/^-([^=]+)=([\s\S]*)$/);if(L!==null&&Array.isArray(L)&&L.length>=3){setArg(L[1],L[2])}}else if(s.match(/^-.\..+/)&&!s.match(Q)){R=F[t+1];L=s.match(/^-(.\..+)/);if(L!==null&&Array.isArray(L)&&L.length>=2){M=L[1];if(R!==undefined&&!R.match(/^-/)&&!checkAllAliases(M,Y.bools)&&!checkAllAliases(M,Y.counts)){setArg(M,R);t++}else{setArg(M,defaultValue(M))}}}else if(s.match(/^-[^-]+/)&&!s.match(Q)){T=s.slice(1,-1).split("");B=false;for(let b=0;b<T.length;b++){R=s.slice(b+2);if(T[b+1]&&T[b+1]==="="){U=s.slice(b+3);M=T[b];if(checkAllAliases(M,Y.arrays)){t=eatArray(t,M,F,U)}else if(checkAllAliases(M,Y.nargs)!==false){t=eatNargs(t,M,F,U)}else{setArg(M,U)}B=true;break}if(R==="-"){setArg(T[b],R);continue}if(/[A-Za-z]/.test(T[b])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(R)&&checkAllAliases(R,Y.bools)===false){setArg(T[b],R);B=true;break}if(T[b+1]&&T[b+1].match(/\W/)){setArg(T[b],R);B=true;break}else{setArg(T[b],defaultValue(T[b]))}}M=s.slice(-1)[0];if(!B&&M!=="-"){if(checkAllAliases(M,Y.arrays)){t=eatArray(t,M,F)}else if(checkAllAliases(M,Y.nargs)!==false){t=eatNargs(t,M,F)}else{R=F[t+1];if(R!==undefined&&(!/^(-|--)[^-]/.test(R)||R.match(Q))&&!checkAllAliases(M,Y.bools)&&!checkAllAliases(M,Y.counts)){setArg(M,R);t++}else if(/^(true|false)$/.test(R)){setArg(M,R);t++}else{setArg(M,defaultValue(M))}}}}else if(s.match(/^-[0-9]$/)&&s.match(Q)&&checkAllAliases(s.slice(1),Y.bools)){M=s.slice(1);setArg(M,defaultValue(M))}else if(s==="--"){J=F.slice(t+1);break}else if(G["halt-at-non-option"]){J=F.slice(t);break}else{pushPositional(s)}}applyEnvVars(ee,true);applyEnvVars(ee,false);setConfig(ee);setConfigObjects();applyDefaultsAndAliases(ee,Y.aliases,R,true);applyCoercions(ee);if(G["set-placeholder-key"])setPlaceholderKeys(ee);Object.keys(Y.counts).forEach((function(t){if(!hasKey(ee,t.split(".")))setArg(t,0)}));if(z&&J.length)ee[q]=[];J.forEach((function(t){ee[q].push(t)}));if(G["camel-case-expansion"]&&G["strip-dashed"]){Object.keys(ee).filter((t=>t!=="--"&&t.includes("-"))).forEach((t=>{delete ee[t]}))}if(G["strip-aliased"]){[].concat(...Object.keys(M).map((t=>M[t]))).forEach((t=>{if(G["camel-case-expansion"]&&t.includes("-")){delete ee[t.split(".").map((t=>camelCase(t))).join(".")]}delete ee[t]}))}function pushPositional(t){const s=maybeCoerceNumber("_",t);if(typeof s==="string"||typeof s==="number"){ee._.push(s)}}function eatNargs(t,s,b,F){let B;let M=checkAllAliases(s,Y.nargs);M=typeof M!=="number"||isNaN(M)?1:M;if(M===0){if(!isUndefined(F)){Z=Error(K("Argument unexpected for: %s",s))}setArg(s,defaultValue(s));return t}let T=isUndefined(F)?0:1;if(G["nargs-eats-options"]){if(b.length-(t+1)+T<M){Z=Error(K("Not enough arguments following: %s",s))}T=M}else{for(B=t+1;B<b.length;B++){if(!b[B].match(/^-[^0-9]/)||b[B].match(Q)||isUnknownOptionAsArg(b[B]))T++;else break}if(T<M)Z=Error(K("Not enough arguments following: %s",s))}let L=Math.min(T,M);if(!isUndefined(F)&&L>0){setArg(s,F);L--}for(B=t+1;B<L+t+1;B++){setArg(s,b[B])}return t+L}function eatArray(t,s,b,F){let M=[];let T=F||b[t+1];const L=checkAllAliases(s,Y.nargs);if(checkAllAliases(s,Y.bools)&&!/^(true|false)$/.test(T)){M.push(true)}else if(isUndefined(T)||isUndefined(F)&&/^-/.test(T)&&!Q.test(T)&&!isUnknownOptionAsArg(T)){if(R[s]!==undefined){const t=R[s];M=Array.isArray(t)?t:[t]}}else{if(!isUndefined(F)){M.push(processValue(s,F,true))}for(let F=t+1;F<b.length;F++){if(!G["greedy-arrays"]&&M.length>0||L&&typeof L==="number"&&M.length>=L)break;T=b[F];if(/^-/.test(T)&&!Q.test(T)&&!isUnknownOptionAsArg(T))break;t=F;M.push(processValue(s,T,B))}}if(typeof L==="number"&&(L&&M.length<L||isNaN(L)&&M.length===0)){Z=Error(K("Not enough arguments following: %s",s))}setArg(s,M);return t}function setArg(t,s,b=B){if(/-/.test(t)&&G["camel-case-expansion"]){const s=t.split(".").map((function(t){return camelCase(t)})).join(".");addNewAlias(t,s)}const F=processValue(t,s,b);const M=t.split(".");setKey(ee,M,F);if(Y.aliases[t]){Y.aliases[t].forEach((function(t){const s=t.split(".");setKey(ee,s,F)}))}if(M.length>1&&G["dot-notation"]){(Y.aliases[M[0]]||[]).forEach((function(s){let b=s.split(".");const B=[].concat(M);B.shift();b=b.concat(B);if(!(Y.aliases[t]||[]).includes(b.join("."))){setKey(ee,b,F)}}))}if(checkAllAliases(t,Y.normalize)&&!checkAllAliases(t,Y.arrays)){const b=[t].concat(Y.aliases[t]||[]);b.forEach((function(t){Object.defineProperty(ne,t,{enumerable:true,get(){return s},set(t){s=typeof t==="string"?L.normalize(t):t}})}))}}function addNewAlias(t,s){if(!(Y.aliases[t]&&Y.aliases[t].length)){Y.aliases[t]=[s];H[s]=true}if(!(Y.aliases[s]&&Y.aliases[s].length)){addNewAlias(s,t)}}function processValue(t,s,b){if(b){s=stripQuotes(s)}if(checkAllAliases(t,Y.bools)||checkAllAliases(t,Y.counts)){if(typeof s==="string")s=s==="true"}let F=Array.isArray(s)?s.map((function(s){return maybeCoerceNumber(t,s)})):maybeCoerceNumber(t,s);if(checkAllAliases(t,Y.counts)&&(isUndefined(F)||typeof F==="boolean")){F=increment()}if(checkAllAliases(t,Y.normalize)&&checkAllAliases(t,Y.arrays)){if(Array.isArray(s))F=s.map((t=>L.normalize(t)));else F=L.normalize(s)}return F}function maybeCoerceNumber(t,s){if(!G["parse-positional-numbers"]&&t==="_")return s;if(!checkAllAliases(t,Y.strings)&&!checkAllAliases(t,Y.bools)&&!Array.isArray(s)){const b=looksLikeNumber(s)&&G["parse-numbers"]&&Number.isSafeInteger(Math.floor(parseFloat(`${s}`)));if(b||!isUndefined(s)&&checkAllAliases(t,Y.numbers)){s=Number(s)}}return s}function setConfig(t){const s=Object.create(null);applyDefaultsAndAliases(s,Y.aliases,R);Object.keys(Y.configs).forEach((function(b){const F=t[b]||s[b];if(F){try{let t=null;const s=L.resolve(L.cwd(),F);const B=Y.configs[b];if(typeof B==="function"){try{t=B(s)}catch(s){t=s}if(t instanceof Error){Z=t;return}}else{t=L.require(s)}setConfigObject(t)}catch(s){if(s.name==="PermissionDenied")Z=s;else if(t[b])Z=Error(K("Invalid JSON config file: %s",F))}}}))}function setConfigObject(t,s){Object.keys(t).forEach((function(b){const F=t[b];const B=s?s+"."+b:b;if(typeof F==="object"&&F!==null&&!Array.isArray(F)&&G["dot-notation"]){setConfigObject(F,B)}else{if(!hasKey(ee,B.split("."))||checkAllAliases(B,Y.arrays)&&G["combine-arrays"]){setArg(B,F)}}}))}function setConfigObjects(){if(typeof U!=="undefined"){U.forEach((function(t){setConfigObject(t)}))}}function applyEnvVars(t,s){if(typeof W==="undefined")return;const b=typeof W==="string"?W:"";const F=L.env();Object.keys(F).forEach((function(B){if(b===""||B.lastIndexOf(b,0)===0){const M=B.split("__").map((function(t,s){if(s===0){t=t.substring(b.length)}return camelCase(t)}));if((s&&Y.configs[M.join(".")]||!s)&&!hasKey(t,M)){setArg(M.join("."),F[B])}}}))}function applyCoercions(t){let s;const b=new Set;Object.keys(t).forEach((function(F){if(!b.has(F)){s=checkAllAliases(F,Y.coercions);if(typeof s==="function"){try{const B=maybeCoerceNumber(F,s(t[F]));[].concat(Y.aliases[F]||[],F).forEach((s=>{b.add(s);t[s]=B}))}catch(t){Z=t}}}}))}function setPlaceholderKeys(t){Y.keys.forEach((s=>{if(~s.indexOf("."))return;if(typeof t[s]==="undefined")t[s]=undefined}));return t}function applyDefaultsAndAliases(t,s,b,F=false){Object.keys(b).forEach((function(B){if(!hasKey(t,B.split("."))){setKey(t,B.split("."),b[B]);if(F)V[B]=true;(s[B]||[]).forEach((function(s){if(hasKey(t,s.split(".")))return;setKey(t,s.split("."),b[B])}))}}))}function hasKey(t,s){let b=t;if(!G["dot-notation"])s=[s.join(".")];s.slice(0,-1).forEach((function(t){b=b[t]||{}}));const F=s[s.length-1];if(typeof b!=="object")return false;else return F in b}function setKey(t,s,b){let F=t;if(!G["dot-notation"])s=[s.join(".")];s.slice(0,-1).forEach((function(t){t=sanitizeKey(t);if(typeof F==="object"&&F[t]===undefined){F[t]={}}if(typeof F[t]!=="object"||Array.isArray(F[t])){if(Array.isArray(F[t])){F[t].push({})}else{F[t]=[F[t],{}]}F=F[t][F[t].length-1]}else{F=F[t]}}));const B=sanitizeKey(s[s.length-1]);const M=checkAllAliases(s.join("."),Y.arrays);const T=Array.isArray(b);let L=G["duplicate-arguments-array"];if(!L&&checkAllAliases(B,Y.nargs)){L=true;if(!isUndefined(F[B])&&Y.nargs[B]===1||Array.isArray(F[B])&&F[B].length===Y.nargs[B]){F[B]=undefined}}if(b===increment()){F[B]=increment(F[B])}else if(Array.isArray(F[B])){if(L&&M&&T){F[B]=G["flatten-duplicate-arrays"]?F[B].concat(b):(Array.isArray(F[B][0])?F[B]:[F[B]]).concat([b])}else if(!L&&Boolean(M)===Boolean(T)){F[B]=b}else{F[B]=F[B].concat([b])}}else if(F[B]===undefined&&M){F[B]=T?b:[b]}else if(L&&!(F[B]===undefined||checkAllAliases(B,Y.counts)||checkAllAliases(B,Y.bools))){F[B]=[F[B],b]}else{F[B]=b}}function extendAliases(...t){t.forEach((function(t){Object.keys(t||{}).forEach((function(t){if(Y.aliases[t])return;Y.aliases[t]=[].concat(M[t]||[]);Y.aliases[t].concat(t).forEach((function(s){if(/-/.test(s)&&G["camel-case-expansion"]){const b=camelCase(s);if(b!==t&&Y.aliases[t].indexOf(b)===-1){Y.aliases[t].push(b);H[b]=true}}}));Y.aliases[t].concat(t).forEach((function(s){if(s.length>1&&/[A-Z]/.test(s)&&G["camel-case-expansion"]){const b=decamelize(s,"-");if(b!==t&&Y.aliases[t].indexOf(b)===-1){Y.aliases[t].push(b);H[b]=true}}}));Y.aliases[t].forEach((function(s){Y.aliases[s]=[t].concat(Y.aliases[t].filter((function(t){return s!==t})))}))}))}))}function checkAllAliases(t,s){const b=[].concat(Y.aliases[t]||[],t);const F=Object.keys(s);const B=b.find((t=>F.includes(t)));return B?s[B]:false}function hasAnyFlag(t){const s=Object.keys(Y);const b=[].concat(s.map((t=>Y[t])));return b.some((function(s){return Array.isArray(s)?s.includes(t):s[t]}))}function hasFlagsMatching(t,...s){const b=[].concat(...s);return b.some((function(s){const b=t.match(s);return b&&hasAnyFlag(b[1])}))}function hasAllShortFlags(t){if(t.match(Q)||!t.match(/^-[^-]+/)){return false}let s=true;let b;const F=t.slice(1).split("");for(let B=0;B<F.length;B++){b=t.slice(B+2);if(!hasAnyFlag(F[B])){s=false;break}if(F[B+1]&&F[B+1]==="="||b==="-"||/[A-Za-z]/.test(F[B])&&/^-?\d+(\.\d*)?(e-?\d+)?$/.test(b)||F[B+1]&&F[B+1].match(/\W/)){break}}return s}function isUnknownOptionAsArg(t){return G["unknown-options-as-args"]&&isUnknownOption(t)}function isUnknownOption(t){t=t.replace(/^-{3,}/,"--");if(t.match(Q)){return false}if(hasAllShortFlags(t)){return false}const s=/^-+([^=]+?)=[\s\S]*$/;const b=/^-+([^=]+?)$/;const F=/^-+([^=]+?)-$/;const B=/^-+([^=]+?\d+)$/;const M=/^-+([^=]+?)\W+.*$/;return!hasFlagsMatching(t,s,X,b,F,B,M)}function defaultValue(t){if(!checkAllAliases(t,Y.bools)&&!checkAllAliases(t,Y.counts)&&`${t}`in R){return R[t]}else{return defaultForType(guessType(t))}}function defaultForType(t){const s={[T.BOOLEAN]:true,[T.STRING]:"",[T.NUMBER]:undefined,[T.ARRAY]:[]};return s[t]}function guessType(t){let s=T.BOOLEAN;if(checkAllAliases(t,Y.strings))s=T.STRING;else if(checkAllAliases(t,Y.numbers))s=T.NUMBER;else if(checkAllAliases(t,Y.bools))s=T.BOOLEAN;else if(checkAllAliases(t,Y.arrays))s=T.ARRAY;return s}function isUndefined(t){return t===undefined}function checkConfiguration(){Object.keys(Y.counts).find((t=>{if(checkAllAliases(t,Y.arrays)){Z=Error(K("Invalid configuration: %s, opts.count excludes opts.array.",t));return true}else if(checkAllAliases(t,Y.nargs)){Z=Error(K("Invalid configuration: %s, opts.count excludes opts.narg.",t));return true}return false}))}return{aliases:Object.assign({},Y.aliases),argv:Object.assign(ne,ee),configuration:G,defaulted:Object.assign({},V),error:Z,newAliases:Object.assign({},H)}}}function combineAliases(t){const s=[];const b=Object.create(null);let F=true;Object.keys(t).forEach((function(b){s.push([].concat(t[b],b))}));while(F){F=false;for(let t=0;t<s.length;t++){for(let b=t+1;b<s.length;b++){const B=s[t].filter((function(t){return s[b].indexOf(t)!==-1}));if(B.length){s[t]=s[t].concat(s[b]);s.splice(b,1);F=true;break}}}}s.forEach((function(t){t=t.filter((function(t,s,b){return b.indexOf(t)===s}));const s=t.pop();if(s!==undefined&&typeof s==="string"){b[s]=t}}));return b}function increment(t){return t!==undefined?t+1:1}function sanitizeKey(t){if(t==="__proto__")return"___proto___";return t}function stripQuotes(t){return typeof t==="string"&&(t[0]==="'"||t[0]==='"')&&t[t.length-1]===t[0]?t.substring(1,t.length-1):t}var G,R,U;const W=process&&process.env&&process.env.YARGS_MIN_NODE_VERSION?Number(process.env.YARGS_MIN_NODE_VERSION):12;const z=(R=(G=process===null||process===void 0?void 0:process.versions)===null||G===void 0?void 0:G.node)!==null&&R!==void 0?R:(U=process===null||process===void 0?void 0:process.version)===null||U===void 0?void 0:U.slice(1);if(z){const t=Number(z.match(/^([^.]+)/)[1]);if(t<W){throw Error(`yargs parser supports a minimum Node.js version of ${W}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`)}}const q=process?process.env:{};const H=new YargsParser({cwd:process.cwd,env:()=>q,format:F.format,normalize:B.normalize,resolve:B.resolve,require:t=>{if(true){return b(803)(t)}else{}}});const V=function Parser(t,s){const b=H.parse(t.slice(),s);return b.argv};V.detailed=function(t,s){return H.parse(t.slice(),s)};V.camelCase=camelCase;V.decamelize=decamelize;V.looksLikeNumber=looksLikeNumber;t.exports=V},2612:(t,s,b)=>{"use strict";var F=b(2613);class e extends Error{constructor(t){super(t||"yargs error"),this.name="YError",Error.captureStackTrace&&Error.captureStackTrace(this,e)}}let B,M=[];function n(t,s,F,T){B=T;let L={};if(Object.prototype.hasOwnProperty.call(t,"extends")){if("string"!=typeof t.extends)return L;const T=/\.json|\..*rc$/.test(t.extends);let G=null;if(T)G=function(t,s){return B.path.resolve(t,s)}(s,t.extends);else try{G=b(8501).resolve(t.extends)}catch(s){return t}!function(t){if(M.indexOf(t)>-1)throw new e(`Circular extended configurations: '${t}'.`)}(G),M.push(G),L=T?JSON.parse(B.readFileSync(G,"utf8")):b(8501)(t.extends),delete t.extends,L=n(L,B.path.dirname(G),F,B)}return M=[],F?r(L,t):Object.assign({},L,t)}function r(t,s){const b={};function i(t){return t&&"object"==typeof t&&!Array.isArray(t)}Object.assign(b,t);for(const F of Object.keys(s))i(s[F])&&i(b[F])?b[F]=r(t[F],s[F]):b[F]=s[F];return b}function o(t){const s=t.replace(/\s{2,}/g," ").split(/\s+(?![^[]*]|[^<]*>)/),b=/\.*[\][<>]/g,F=s.shift();if(!F)throw new Error(`No command found in: ${t}`);const B={cmd:F.replace(b,""),demanded:[],optional:[]};return s.forEach(((t,F)=>{let M=!1;t=t.replace(/\s/g,""),/\.+[\]>]/.test(t)&&F===s.length-1&&(M=!0),/^\[/.test(t)?B.optional.push({cmd:t.replace(b,"").split("|"),variadic:M}):B.demanded.push({cmd:t.replace(b,"").split("|"),variadic:M})})),B}const T=["first","second","third","fourth","fifth","sixth"];function h(t,s,b){try{let F=0;const[B,M,T]="object"==typeof t?[{demanded:[],optional:[]},t,s]:[o(`cmd ${t}`),s,b],L=[].slice.call(M);for(;L.length&&void 0===L[L.length-1];)L.pop();const G=T||L.length;if(G<B.demanded.length)throw new e(`Not enough arguments provided. Expected ${B.demanded.length} but received ${L.length}.`);const R=B.demanded.length+B.optional.length;if(G>R)throw new e(`Too many arguments provided. Expected max ${R} but received ${G}.`);B.demanded.forEach((t=>{const s=l(L.shift());0===t.cmd.filter((t=>t===s||"*"===t)).length&&c(s,t.cmd,F),F+=1})),B.optional.forEach((t=>{if(0===L.length)return;const s=l(L.shift());0===t.cmd.filter((t=>t===s||"*"===t)).length&&c(s,t.cmd,F),F+=1}))}catch(t){console.warn(t.stack)}}function l(t){return Array.isArray(t)?"array":null===t?"null":typeof t}function c(t,s,b){throw new e(`Invalid ${T[b]||"manyith"} argument. Expected ${s.join(" or ")} but received ${t}.`)}function f(t){return!!t&&!!t.then&&"function"==typeof t.then}function d(t,s,b,F){b.assert.notStrictEqual(t,s,F)}function u(t,s){s.assert.strictEqual(typeof t,"string")}function p(t){return Object.keys(t)}function g(t={},s=()=>!0){const b={};return p(t).forEach((F=>{s(F,t[F])&&(b[F]=t[F])})),b}function m(){return process.versions.electron&&!process.defaultApp?0:1}function y(){return process.argv[m()]}var L=Object.freeze({__proto__:null,hideBin:function(t){return t.slice(m()+1)},getProcessArgvBin:y});function v(t,s,b,F){if("a"===b&&!F)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof s?t!==s||!F:!s.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===b?F:"a"===b?F.call(t):F?F.value:s.get(t)}function O(t,s,b,F,B){if("m"===F)throw new TypeError("Private method is not writable");if("a"===F&&!B)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof s?t!==s||!B:!s.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===F?B.call(t,b):B?B.value=b:s.set(t,b),b}class w{constructor(t){this.globalMiddleware=[],this.frozens=[],this.yargs=t}addMiddleware(t,s,b=!0,F=!1){if(h("<array|function> [boolean] [boolean] [boolean]",[t,s,b],arguments.length),Array.isArray(t)){for(let F=0;F<t.length;F++){if("function"!=typeof t[F])throw Error("middleware must be a function");const B=t[F];B.applyBeforeValidation=s,B.global=b}Array.prototype.push.apply(this.globalMiddleware,t)}else if("function"==typeof t){const B=t;B.applyBeforeValidation=s,B.global=b,B.mutates=F,this.globalMiddleware.push(t)}return this.yargs}addCoerceMiddleware(t,s){const b=this.yargs.getAliases();return this.globalMiddleware=this.globalMiddleware.filter((t=>{const F=[...b[s]||[],s];return!t.option||!F.includes(t.option)})),t.option=s,this.addMiddleware(t,!0,!0,!0)}getMiddleware(){return this.globalMiddleware}freeze(){this.frozens.push([...this.globalMiddleware])}unfreeze(){const t=this.frozens.pop();void 0!==t&&(this.globalMiddleware=t)}reset(){this.globalMiddleware=this.globalMiddleware.filter((t=>t.global))}}function C(t,s,b,F){return b.reduce(((t,b)=>{if(b.applyBeforeValidation!==F)return t;if(b.mutates){if(b.applied)return t;b.applied=!0}if(f(t))return t.then((t=>Promise.all([t,b(t,s)]))).then((([t,s])=>Object.assign(t,s)));{const F=b(t,s);return f(F)?F.then((s=>Object.assign(t,s))):Object.assign(t,F)}}),t)}function j(t,s,b=t=>{throw t}){try{const b="function"==typeof t?t():t;return f(b)?b.then((t=>s(t))):s(b)}catch(t){return b(t)}}const G=/(^\*)|(^\$0)/;class _{constructor(t,s,b,F){this.requireCache=new Set,this.handlers={},this.aliasMap={},this.frozens=[],this.shim=F,this.usage=t,this.globalMiddleware=b,this.validation=s}addDirectory(t,s,b,F){"boolean"!=typeof(F=F||{}).recurse&&(F.recurse=!1),Array.isArray(F.extensions)||(F.extensions=["js"]);const B="function"==typeof F.visit?F.visit:t=>t;F.visit=(t,s,b)=>{const F=B(t,s,b);if(F){if(this.requireCache.has(s))return F;this.requireCache.add(s),this.addHandler(F)}return F},this.shim.requireDirectory({require:s,filename:b},t,F)}addHandler(t,s,b,F,B,M){let T=[];const L=function(t){return t?t.map((t=>(t.applyBeforeValidation=!1,t))):[]}(B);if(F=F||(()=>{}),Array.isArray(t))if(function(t){return t.every((t=>"string"==typeof t))}(t))[t,...T]=t;else for(const s of t)this.addHandler(s);else{if(function(t){return"object"==typeof t&&!Array.isArray(t)}(t)){let s=Array.isArray(t.command)||"string"==typeof t.command?t.command:this.moduleName(t);return t.aliases&&(s=[].concat(s).concat(t.aliases)),void this.addHandler(s,this.extractDesc(t),t.builder,t.handler,t.middlewares,t.deprecated)}if(k(b))return void this.addHandler([t].concat(T),s,b.builder,b.handler,b.middlewares,b.deprecated)}if("string"==typeof t){const B=o(t);T=T.map((t=>o(t).cmd));let R=!1;const U=[B.cmd].concat(T).filter((t=>!G.test(t)||(R=!0,!1)));0===U.length&&R&&U.push("$0"),R&&(B.cmd=U[0],T=U.slice(1),t=t.replace(G,B.cmd)),T.forEach((t=>{this.aliasMap[t]=B.cmd})),!1!==s&&this.usage.command(t,s,R,T,M),this.handlers[B.cmd]={original:t,description:s,handler:F,builder:b||{},middlewares:L,deprecated:M,demanded:B.demanded,optional:B.optional},R&&(this.defaultCommand=this.handlers[B.cmd])}}getCommandHandlers(){return this.handlers}getCommands(){return Object.keys(this.handlers).concat(Object.keys(this.aliasMap))}hasDefaultCommand(){return!!this.defaultCommand}runCommand(t,s,b,F,B,M){const T=this.handlers[t]||this.handlers[this.aliasMap[t]]||this.defaultCommand,L=s.getInternalMethods().getContext(),G=L.commands.slice(),R=!t;t&&(L.commands.push(t),L.fullCommands.push(T.original));const U=this.applyBuilderUpdateUsageAndParse(R,T,s,b.aliases,G,F,B,M);return f(U)?U.then((t=>this.applyMiddlewareAndGetResult(R,T,t.innerArgv,L,B,t.aliases,s))):this.applyMiddlewareAndGetResult(R,T,U.innerArgv,L,B,U.aliases,s)}applyBuilderUpdateUsageAndParse(t,s,b,F,B,M,T,L){const G=s.builder;let R=b;if(x(G)){b.getInternalMethods().getUsageInstance().freeze();const U=G(b.getInternalMethods().reset(F),L);if(f(U))return U.then((F=>{var L;return R=(L=F)&&"function"==typeof L.getInternalMethods?F:b,this.parseAndUpdateUsage(t,s,R,B,M,T)}))}else(function(t){return"object"==typeof t})(G)&&(b.getInternalMethods().getUsageInstance().freeze(),R=b.getInternalMethods().reset(F),Object.keys(s.builder).forEach((t=>{R.option(t,G[t])})));return this.parseAndUpdateUsage(t,s,R,B,M,T)}parseAndUpdateUsage(t,s,b,F,B,M){t&&b.getInternalMethods().getUsageInstance().unfreeze(!0),this.shouldUpdateUsage(b)&&b.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(F,s),s.description);const T=b.getInternalMethods().runYargsParserAndExecuteCommands(null,void 0,!0,B,M);return f(T)?T.then((t=>({aliases:b.parsed.aliases,innerArgv:t}))):{aliases:b.parsed.aliases,innerArgv:T}}shouldUpdateUsage(t){return!t.getInternalMethods().getUsageInstance().getUsageDisabled()&&0===t.getInternalMethods().getUsageInstance().getUsage().length}usageFromParentCommandsCommandHandler(t,s){const b=G.test(s.original)?s.original.replace(G,"").trim():s.original,F=t.filter((t=>!G.test(t)));return F.push(b),`$0 ${F.join(" ")}`}handleValidationAndGetResult(t,s,b,F,B,M,T,L){if(!M.getInternalMethods().getHasOutput()){const s=M.getInternalMethods().runValidation(B,L,M.parsed.error,t);b=j(b,(t=>(s(t),t)))}if(s.handler&&!M.getInternalMethods().getHasOutput()){M.getInternalMethods().setHasOutput();const F=!!M.getOptions().configuration["populate--"];M.getInternalMethods().postProcess(b,F,!1,!1),b=j(b=C(b,M,T,!1),(t=>{const b=s.handler(t);return f(b)?b.then((()=>t)):t})),t||M.getInternalMethods().getUsageInstance().cacheHelpMessage(),f(b)&&!M.getInternalMethods().hasParseCallback()&&b.catch((t=>{try{M.getInternalMethods().getUsageInstance().fail(null,t)}catch(t){}}))}return t||(F.commands.pop(),F.fullCommands.pop()),b}applyMiddlewareAndGetResult(t,s,b,F,B,M,T){let L={};if(B)return b;T.getInternalMethods().getHasOutput()||(L=this.populatePositionals(s,b,F,T));const G=this.globalMiddleware.getMiddleware().slice(0).concat(s.middlewares),R=C(b,T,G,!0);return f(R)?R.then((b=>this.handleValidationAndGetResult(t,s,b,F,M,T,G,L))):this.handleValidationAndGetResult(t,s,R,F,M,T,G,L)}populatePositionals(t,s,b,F){s._=s._.slice(b.commands.length);const B=t.demanded.slice(0),M=t.optional.slice(0),T={};for(this.validation.positionalCount(B.length,s._.length);B.length;){const t=B.shift();this.populatePositional(t,s,T)}for(;M.length;){const t=M.shift();this.populatePositional(t,s,T)}return s._=b.commands.concat(s._.map((t=>""+t))),this.postProcessPositionals(s,T,this.cmdToParseOptions(t.original),F),T}populatePositional(t,s,b){const F=t.cmd[0];t.variadic?b[F]=s._.splice(0).map(String):s._.length&&(b[F]=[String(s._.shift())])}cmdToParseOptions(t){const s={array:[],default:{},alias:{},demand:{}},b=o(t);return b.demanded.forEach((t=>{const[b,...F]=t.cmd;t.variadic&&(s.array.push(b),s.default[b]=[]),s.alias[b]=F,s.demand[b]=!0})),b.optional.forEach((t=>{const[b,...F]=t.cmd;t.variadic&&(s.array.push(b),s.default[b]=[]),s.alias[b]=F})),s}postProcessPositionals(t,s,b,F){const B=Object.assign({},F.getOptions());B.default=Object.assign(b.default,B.default);for(const t of Object.keys(b.alias))B.alias[t]=(B.alias[t]||[]).concat(b.alias[t]);B.array=B.array.concat(b.array),B.config={};const M=[];if(Object.keys(s).forEach((t=>{s[t].map((s=>{B.configuration["unknown-options-as-args"]&&(B.key[t]=!0),M.push(`--${t}`),M.push(s)}))})),!M.length)return;const T=Object.assign({},B.configuration,{"populate--":!1}),L=this.shim.Parser.detailed(M,Object.assign({},B,{configuration:T}));if(L.error)F.getInternalMethods().getUsageInstance().fail(L.error.message,L.error);else{const b=Object.keys(s);Object.keys(s).forEach((t=>{b.push(...L.aliases[t])})),Object.keys(L.argv).forEach((B=>{b.includes(B)&&(s[B]||(s[B]=L.argv[B]),!this.isInConfigs(F,B)&&!this.isDefaulted(F,B)&&Object.prototype.hasOwnProperty.call(t,B)&&Object.prototype.hasOwnProperty.call(L.argv,B)&&(Array.isArray(t[B])||Array.isArray(L.argv[B]))?t[B]=[].concat(t[B],L.argv[B]):t[B]=L.argv[B])}))}}isDefaulted(t,s){const{default:b}=t.getOptions();return Object.prototype.hasOwnProperty.call(b,s)||Object.prototype.hasOwnProperty.call(b,this.shim.Parser.camelCase(s))}isInConfigs(t,s){const{configObjects:b}=t.getOptions();return b.some((t=>Object.prototype.hasOwnProperty.call(t,s)))||b.some((t=>Object.prototype.hasOwnProperty.call(t,this.shim.Parser.camelCase(s))))}runDefaultBuilderOn(t){if(!this.defaultCommand)return;if(this.shouldUpdateUsage(t)){const s=G.test(this.defaultCommand.original)?this.defaultCommand.original:this.defaultCommand.original.replace(/^[^[\]<>]*/,"$0 ");t.getInternalMethods().getUsageInstance().usage(s,this.defaultCommand.description)}const s=this.defaultCommand.builder;if(x(s))return s(t,!0);k(s)||Object.keys(s).forEach((b=>{t.option(b,s[b])}))}moduleName(t){const s=function(t){if(false){}for(let s,F=0,B=Object.keys(b.c);F<B.length;F++)if(s=b.c[B[F]],s.exports===t)return s;return null}(t);if(!s)throw new Error(`No command name given for module: ${this.shim.inspect(t)}`);return this.commandFromFilename(s.filename)}commandFromFilename(t){return this.shim.path.basename(t,this.shim.path.extname(t))}extractDesc({describe:t,description:s,desc:b}){for(const F of[t,s,b]){if("string"==typeof F||!1===F)return F;d(F,!0,this.shim)}return!1}freeze(){this.frozens.push({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand})}unfreeze(){const t=this.frozens.pop();d(t,void 0,this.shim),({handlers:this.handlers,aliasMap:this.aliasMap,defaultCommand:this.defaultCommand}=t)}reset(){return this.handlers={},this.aliasMap={},this.defaultCommand=void 0,this.requireCache=new Set,this}}function k(t){return"object"==typeof t&&!!t.builder&&"function"==typeof t.handler}function x(t){return"function"==typeof t}function E(t){"undefined"!=typeof process&&[process.stdout,process.stderr].forEach((s=>{const b=s;b._handle&&b.isTTY&&"function"==typeof b._handle.setBlocking&&b._handle.setBlocking(t)}))}function A(t){return"boolean"==typeof t}function P(t,s){const b=s.y18n.__,F={},B=[];F.failFn=function(t){B.push(t)};let M=null,T=null,L=!0;F.showHelpOnFail=function(s=!0,b){const[B,G]="string"==typeof s?[!0,s]:[s,b];return t.getInternalMethods().isGlobalContext()&&(T=G),M=G,L=B,F};let G=!1;F.fail=function(s,b){const R=t.getInternalMethods().getLoggerInstance();if(!B.length){if(t.getExitProcess()&&E(!0),!G){G=!0,L&&(t.showHelp("error"),R.error()),(s||b)&&R.error(s||b);const F=M||T;F&&((s||b)&&R.error(""),R.error(F))}if(b=b||new e(s),t.getExitProcess())return t.exit(1);if(t.getInternalMethods().hasParseCallback())return t.exit(1,b);throw b}for(let t=B.length-1;t>=0;--t){const M=B[t];if(A(M)){if(b)throw b;if(s)throw Error(s)}else M(s,b,F)}};let R=[],U=!1;F.usage=(t,s)=>null===t?(U=!0,R=[],F):(U=!1,R.push([t,s||""]),F),F.getUsage=()=>R,F.getUsageDisabled=()=>U,F.getPositionalGroupName=()=>b("Positionals:");let W=[];F.example=(t,s)=>{W.push([t,s||""])};let z=[];F.command=function(t,s,b,F,B=!1){b&&(z=z.map((t=>(t[2]=!1,t)))),z.push([t,s||"",b,F,B])},F.getCommands=()=>z;let q={};F.describe=function(t,s){Array.isArray(t)?t.forEach((t=>{F.describe(t,s)})):"object"==typeof t?Object.keys(t).forEach((s=>{F.describe(s,t[s])})):q[t]=s},F.getDescriptions=()=>q;let H=[];F.epilog=t=>{H.push(t)};let V,K=!1;F.wrap=t=>{K=!0,V=t},F.getWrap=()=>s.getEnv("YARGS_DISABLE_WRAP")?null:(K||(V=function(){const t=80;return s.process.stdColumns?Math.min(t,s.process.stdColumns):t}(),K=!0),V);const Y="__yargsString__:";function O(t,b,F){let B=0;return Array.isArray(t)||(t=Object.values(t).map((t=>[t]))),t.forEach((t=>{B=Math.max(s.stringWidth(F?`${F} ${I(t[0])}`:I(t[0]))+$(t[0]),B)})),b&&(B=Math.min(B,parseInt((.5*b).toString(),10))),B}let Q;function C(s){return t.getOptions().hiddenOptions.indexOf(s)<0||t.parsed.argv[t.getOptions().showHiddenOpt]}function j(t,s){let F=`[${b("default:")} `;if(void 0===t&&!s)return null;if(s)F+=s;else switch(typeof t){case"string":F+=`"${t}"`;break;case"object":F+=JSON.stringify(t);break;default:F+=t}return`${F}]`}F.deferY18nLookup=t=>Y+t,F.help=function(){if(Q)return Q;!function(){const s=t.getDemandedOptions(),b=t.getOptions();(Object.keys(b.alias)||[]).forEach((B=>{b.alias[B].forEach((M=>{q[M]&&F.describe(B,q[M]),M in s&&t.demandOption(B,s[M]),b.boolean.includes(M)&&t.boolean(B),b.count.includes(M)&&t.count(B),b.string.includes(M)&&t.string(B),b.normalize.includes(M)&&t.normalize(B),b.array.includes(M)&&t.array(B),b.number.includes(M)&&t.number(B)}))}))}();const B=t.customScriptName?t.$0:s.path.basename(t.$0),M=t.getDemandedOptions(),T=t.getDemandedCommands(),L=t.getDeprecatedOptions(),G=t.getGroups(),V=t.getOptions();let K=[];K=K.concat(Object.keys(q)),K=K.concat(Object.keys(M)),K=K.concat(Object.keys(T)),K=K.concat(Object.keys(V.default)),K=K.filter(C),K=Object.keys(K.reduce(((t,s)=>("_"!==s&&(t[s]=!0),t)),{}));const X=F.getWrap(),Z=s.cliui({width:X,wrap:!!X});if(!U)if(R.length)R.forEach((t=>{Z.div({text:`${t[0].replace(/\$0/g,B)}`}),t[1]&&Z.div({text:`${t[1]}`,padding:[1,0,0,0]})})),Z.div();else if(z.length){let t=null;t=T._?`${B} <${b("command")}>\n`:`${B} [${b("command")}]\n`,Z.div(`${t}`)}if(z.length>1||1===z.length&&!z[0][2]){Z.div(b("Commands:"));const s=t.getInternalMethods().getContext(),F=s.commands.length?`${s.commands.join(" ")} `:"";!0===t.getInternalMethods().getParserConfiguration()["sort-commands"]&&(z=z.sort(((t,s)=>t[0].localeCompare(s[0]))));const M=B?`${B} `:"";z.forEach((t=>{const s=`${M}${F}${t[0].replace(/^\$0 ?/,"")}`;Z.span({text:s,padding:[0,2,0,2],width:O(z,X,`${B}${F}`)+4},{text:t[1]});const T=[];t[2]&&T.push(`[${b("default")}]`),t[3]&&t[3].length&&T.push(`[${b("aliases:")} ${t[3].join(", ")}]`),t[4]&&("string"==typeof t[4]?T.push(`[${b("deprecated: %s",t[4])}]`):T.push(`[${b("deprecated")}]`)),T.length?Z.div({text:T.join(" "),padding:[0,0,0,2],align:"right"}):Z.div()})),Z.div()}const J=(Object.keys(V.alias)||[]).concat(Object.keys(t.parsed.newAliases)||[]);K=K.filter((s=>!t.parsed.newAliases[s]&&J.every((t=>-1===(V.alias[t]||[]).indexOf(s)))));const ee=b("Options:");G[ee]||(G[ee]=[]),function(t,s,b,F){let B=[],M=null;Object.keys(b).forEach((t=>{B=B.concat(b[t])})),t.forEach((t=>{M=[t].concat(s[t]),M.some((t=>-1!==B.indexOf(t)))||b[F].push(t)}))}(K,V.alias,G,ee);const k=t=>/^--/.test(I(t)),ne=Object.keys(G).filter((t=>G[t].length>0)).map((t=>({groupName:t,normalizedKeys:G[t].filter(C).map((t=>{if(J.includes(t))return t;for(let s,b=0;void 0!==(s=J[b]);b++)if((V.alias[s]||[]).includes(t))return s;return t}))}))).filter((({normalizedKeys:t})=>t.length>0)).map((({groupName:t,normalizedKeys:s})=>{const b=s.reduce(((s,b)=>(s[b]=[b].concat(V.alias[b]||[]).map((s=>t===F.getPositionalGroupName()?s:(/^[0-9]$/.test(s)?V.boolean.includes(b)?"-":"--":s.length>1?"--":"-")+s)).sort(((t,s)=>k(t)===k(s)?0:k(t)?1:-1)).join(", "),s)),{});return{groupName:t,normalizedKeys:s,switches:b}}));if(ne.filter((({groupName:t})=>t!==F.getPositionalGroupName())).some((({normalizedKeys:t,switches:s})=>!t.every((t=>k(s[t])))))&&ne.filter((({groupName:t})=>t!==F.getPositionalGroupName())).forEach((({normalizedKeys:t,switches:s})=>{t.forEach((t=>{var b,F;k(s[t])&&(s[t]=(b=s[t],F=4,S(b)?{text:b.text,indentation:b.indentation+F}:{text:b,indentation:F}))}))})),ne.forEach((({groupName:s,normalizedKeys:B,switches:T})=>{Z.div(s),B.forEach((s=>{const B=T[s];let G=q[s]||"",R=null;G.includes(Y)&&(G=b(G.substring(16))),V.boolean.includes(s)&&(R=`[${b("boolean")}]`),V.count.includes(s)&&(R=`[${b("count")}]`),V.string.includes(s)&&(R=`[${b("string")}]`),V.normalize.includes(s)&&(R=`[${b("string")}]`),V.array.includes(s)&&(R=`[${b("array")}]`),V.number.includes(s)&&(R=`[${b("number")}]`);const U=[s in L?(W=L[s],"string"==typeof W?`[${b("deprecated: %s",W)}]`:`[${b("deprecated")}]`):null,R,s in M?`[${b("required")}]`:null,V.choices&&V.choices[s]?`[${b("choices:")} ${F.stringifiedValues(V.choices[s])}]`:null,j(V.default[s],V.defaultDescription[s])].filter(Boolean).join(" ");var W;Z.span({text:I(B),padding:[0,2,0,2+$(B)],width:O(T,X)+4},G);const z=!0===t.getInternalMethods().getUsageConfiguration()["hide-types"];U&&!z?Z.div({text:U,padding:[0,0,0,2],align:"right"}):Z.div()})),Z.div()})),W.length&&(Z.div(b("Examples:")),W.forEach((t=>{t[0]=t[0].replace(/\$0/g,B)})),W.forEach((t=>{""===t[1]?Z.div({text:t[0],padding:[0,2,0,2]}):Z.div({text:t[0],padding:[0,2,0,2],width:O(W,X)+4},{text:t[1]})})),Z.div()),H.length>0){const t=H.map((t=>t.replace(/\$0/g,B))).join("\n");Z.div(`${t}\n`)}return Z.toString().replace(/\s*$/,"")},F.cacheHelpMessage=function(){Q=this.help()},F.clearCachedHelpMessage=function(){Q=void 0},F.hasCachedHelpMessage=function(){return!!Q},F.showHelp=s=>{const b=t.getInternalMethods().getLoggerInstance();s||(s="error");("function"==typeof s?s:b[s])(F.help())},F.functionDescription=t=>["(",t.name?s.Parser.decamelize(t.name,"-"):b("generated-value"),")"].join(""),F.stringifiedValues=function(t,s){let b="";const F=s||", ",B=[].concat(t);return t&&B.length?(B.forEach((t=>{b.length&&(b+=F),b+=JSON.stringify(t)})),b):b};let X=null;F.version=t=>{X=t},F.showVersion=s=>{const b=t.getInternalMethods().getLoggerInstance();s||(s="error");("function"==typeof s?s:b[s])(X)},F.reset=function(t){return M=null,G=!1,R=[],U=!1,H=[],W=[],z=[],q=g(q,(s=>!t[s])),F};const Z=[];return F.freeze=function(){Z.push({failMessage:M,failureOutput:G,usages:R,usageDisabled:U,epilogs:H,examples:W,commands:z,descriptions:q})},F.unfreeze=function(t=!1){const s=Z.pop();s&&(t?(q={...s.descriptions,...q},z=[...s.commands,...z],R=[...s.usages,...R],W=[...s.examples,...W],H=[...s.epilogs,...H]):({failMessage:M,failureOutput:G,usages:R,usageDisabled:U,epilogs:H,examples:W,commands:z,descriptions:q}=s))},F}function S(t){return"object"==typeof t}function $(t){return S(t)?t.indentation:0}function I(t){return S(t)?t.text:t}class D{constructor(t,s,b,F){var B,M,T;this.yargs=t,this.usage=s,this.command=b,this.shim=F,this.completionKey="get-yargs-completions",this.aliases=null,this.customCompletionFunction=null,this.indexAfterLastReset=0,this.zshShell=null!==(T=(null===(B=this.shim.getEnv("SHELL"))||void 0===B?void 0:B.includes("zsh"))||(null===(M=this.shim.getEnv("ZSH_NAME"))||void 0===M?void 0:M.includes("zsh")))&&void 0!==T&&T}defaultCompletion(t,s,b,F){const B=this.command.getCommandHandlers();for(let s=0,b=t.length;s<b;++s)if(B[t[s]]&&B[t[s]].builder){const b=B[t[s]].builder;if(x(b)){this.indexAfterLastReset=s+1;const t=this.yargs.getInternalMethods().reset();return b(t,!0),t.argv}}const M=[];this.commandCompletions(M,t,b),this.optionCompletions(M,t,s,b),this.choicesFromOptionsCompletions(M,t,s,b),this.choicesFromPositionalsCompletions(M,t,s,b),F(null,M)}commandCompletions(t,s,b){const F=this.yargs.getInternalMethods().getContext().commands;b.match(/^-/)||F[F.length-1]===b||this.previousArgHasChoices(s)||this.usage.getCommands().forEach((b=>{const F=o(b[0]).cmd;if(-1===s.indexOf(F))if(this.zshShell){const s=b[1]||"";t.push(F.replace(/:/g,"\\:")+":"+s)}else t.push(F)}))}optionCompletions(t,s,b,F){if((F.match(/^-/)||""===F&&0===t.length)&&!this.previousArgHasChoices(s)){const b=this.yargs.getOptions(),B=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[];Object.keys(b.key).forEach((M=>{const T=!!b.configuration["boolean-negation"]&&b.boolean.includes(M);B.includes(M)||b.hiddenOptions.includes(M)||this.argsContainKey(s,M,T)||this.completeOptionKey(M,t,F,T&&!!b.default[M])}))}}choicesFromOptionsCompletions(t,s,b,F){if(this.previousArgHasChoices(s)){const b=this.getPreviousArgChoices(s);b&&b.length>0&&t.push(...b.map((t=>t.replace(/:/g,"\\:"))))}}choicesFromPositionalsCompletions(t,s,b,F){if(""===F&&t.length>0&&this.previousArgHasChoices(s))return;const B=this.yargs.getGroups()[this.usage.getPositionalGroupName()]||[],M=Math.max(this.indexAfterLastReset,this.yargs.getInternalMethods().getContext().commands.length+1),T=B[b._.length-M-1];if(!T)return;const L=this.yargs.getOptions().choices[T]||[];for(const s of L)s.startsWith(F)&&t.push(s.replace(/:/g,"\\:"))}getPreviousArgChoices(t){if(t.length<1)return;let s=t[t.length-1],b="";if(!s.startsWith("-")&&t.length>1&&(b=s,s=t[t.length-2]),!s.startsWith("-"))return;const F=s.replace(/^-+/,""),B=this.yargs.getOptions(),M=[F,...this.yargs.getAliases()[F]||[]];let T;for(const t of M)if(Object.prototype.hasOwnProperty.call(B.key,t)&&Array.isArray(B.choices[t])){T=B.choices[t];break}return T?T.filter((t=>!b||t.startsWith(b))):void 0}previousArgHasChoices(t){const s=this.getPreviousArgChoices(t);return void 0!==s&&s.length>0}argsContainKey(t,s,b){const i=s=>-1!==t.indexOf((/^[^0-9]$/.test(s)?"-":"--")+s);if(i(s))return!0;if(b&&i(`no-${s}`))return!0;if(this.aliases)for(const t of this.aliases[s])if(i(t))return!0;return!1}completeOptionKey(t,s,b,F){var B,M,T,L;let G=t;if(this.zshShell){const s=this.usage.getDescriptions(),b=null===(M=null===(B=null==this?void 0:this.aliases)||void 0===B?void 0:B[t])||void 0===M?void 0:M.find((t=>{const b=s[t];return"string"==typeof b&&b.length>0})),F=b?s[b]:void 0,R=null!==(L=null!==(T=s[t])&&void 0!==T?T:F)&&void 0!==L?L:"";G=`${t.replace(/:/g,"\\:")}:${R.replace("__yargsString__:","").replace(/(\r\n|\n|\r)/gm," ")}`}const R=!/^--/.test(b)&&(t=>/^[^0-9]$/.test(t))(t)?"-":"--";s.push(R+G),F&&s.push(R+"no-"+G)}customCompletion(t,s,b,F){if(d(this.customCompletionFunction,null,this.shim),this.customCompletionFunction.length<3){const t=this.customCompletionFunction(b,s);return f(t)?t.then((t=>{this.shim.process.nextTick((()=>{F(null,t)}))})).catch((t=>{this.shim.process.nextTick((()=>{F(t,void 0)}))})):F(null,t)}return function(t){return t.length>3}(this.customCompletionFunction)?this.customCompletionFunction(b,s,((B=F)=>this.defaultCompletion(t,s,b,B)),(t=>{F(null,t)})):this.customCompletionFunction(b,s,(t=>{F(null,t)}))}getCompletion(t,s){const b=t.length?t[t.length-1]:"",F=this.yargs.parse(t,!0),B=this.customCompletionFunction?F=>this.customCompletion(t,F,b,s):F=>this.defaultCompletion(t,F,b,s);return f(F)?F.then(B):B(F)}generateCompletionScript(t,s){let b=this.zshShell?'#compdef {{app_name}}\n###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc\n# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local reply\n local si=$IFS\n IFS=$\'\n\' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "${words[@]}"))\n IFS=$si\n _describe \'values\' reply\n}\ncompdef _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n':'###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';const F=this.shim.path.basename(t);return t.match(/\.js$/)&&(t=`./${t}`),b=b.replace(/{{app_name}}/g,F),b=b.replace(/{{completion_command}}/g,s),b.replace(/{{app_path}}/g,t)}registerFunction(t){this.customCompletionFunction=t}setParsed(t){this.aliases=t.aliases}}function N(t,s){if(0===t.length)return s.length;if(0===s.length)return t.length;const b=[];let F,B;for(F=0;F<=s.length;F++)b[F]=[F];for(B=0;B<=t.length;B++)b[0][B]=B;for(F=1;F<=s.length;F++)for(B=1;B<=t.length;B++)s.charAt(F-1)===t.charAt(B-1)?b[F][B]=b[F-1][B-1]:F>1&&B>1&&s.charAt(F-2)===t.charAt(B-1)&&s.charAt(F-1)===t.charAt(B-2)?b[F][B]=b[F-2][B-2]+1:b[F][B]=Math.min(b[F-1][B-1]+1,Math.min(b[F][B-1]+1,b[F-1][B]+1));return b[s.length][t.length]}const R=["$0","--","_"];var U,W,z,q,H,V,K,Y,Q,X,Z,J,ee,ne,se,re,ie,oe,ae,ue,ce,le,fe,he,de,De,pe,ge,me,ye,be,ve,Ce,Ee,Fe;const we=Symbol("copyDoubleDash"),Ae=Symbol("copyDoubleDash"),Oe=Symbol("deleteFromParserHintObject"),xe=Symbol("emitWarning"),ke=Symbol("freeze"),_e=Symbol("getDollarZero"),Se=Symbol("getParserConfiguration"),je=Symbol("getUsageConfiguration"),Be=Symbol("guessLocale"),Me=Symbol("guessVersion"),Pe=Symbol("parsePositionalNumbers"),Ie=Symbol("pkgUp"),$e=Symbol("populateParserHintArray"),Ne=Symbol("populateParserHintSingleValueDictionary"),Te=Symbol("populateParserHintArrayDictionary"),Le=Symbol("populateParserHintDictionary"),Ge=Symbol("sanitizeKey"),Re=Symbol("setKey"),Ue=Symbol("unfreeze"),We=Symbol("validateAsync"),ze=Symbol("getCommandInstance"),qe=Symbol("getContext"),He=Symbol("getHasOutput"),Ve=Symbol("getLoggerInstance"),Ke=Symbol("getParseContext"),Ye=Symbol("getUsageInstance"),Qe=Symbol("getValidationInstance"),Xe=Symbol("hasParseCallback"),Ze=Symbol("isGlobalContext"),Je=Symbol("postProcess"),et=Symbol("rebase"),tt=Symbol("reset"),nt=Symbol("runYargsParserAndExecuteCommands"),st=Symbol("runValidation"),rt=Symbol("setHasOutput"),it=Symbol("kTrackManuallySetKeys");class te{constructor(t=[],s,b,F){this.customScriptName=!1,this.parsed=!1,U.set(this,void 0),W.set(this,void 0),z.set(this,{commands:[],fullCommands:[]}),q.set(this,null),H.set(this,null),V.set(this,"show-hidden"),K.set(this,null),Y.set(this,!0),Q.set(this,{}),X.set(this,!0),Z.set(this,[]),J.set(this,void 0),ee.set(this,{}),ne.set(this,!1),se.set(this,null),re.set(this,!0),ie.set(this,void 0),oe.set(this,""),ae.set(this,void 0),ue.set(this,void 0),ce.set(this,{}),le.set(this,null),fe.set(this,null),he.set(this,{}),de.set(this,{}),De.set(this,void 0),pe.set(this,!1),ge.set(this,void 0),me.set(this,!1),ye.set(this,!1),be.set(this,!1),ve.set(this,void 0),Ce.set(this,{}),Ee.set(this,null),Fe.set(this,void 0),O(this,ge,F,"f"),O(this,De,t,"f"),O(this,W,s,"f"),O(this,ue,b,"f"),O(this,J,new w(this),"f"),this.$0=this[_e](),this[tt](),O(this,U,v(this,U,"f"),"f"),O(this,ve,v(this,ve,"f"),"f"),O(this,Fe,v(this,Fe,"f"),"f"),O(this,ae,v(this,ae,"f"),"f"),v(this,ae,"f").showHiddenOpt=v(this,V,"f"),O(this,ie,this[Ae](),"f")}addHelpOpt(t,s){return h("[string|boolean] [string]",[t,s],arguments.length),v(this,se,"f")&&(this[Oe](v(this,se,"f")),O(this,se,null,"f")),!1===t&&void 0===s||(O(this,se,"string"==typeof t?t:"help","f"),this.boolean(v(this,se,"f")),this.describe(v(this,se,"f"),s||v(this,ve,"f").deferY18nLookup("Show help"))),this}help(t,s){return this.addHelpOpt(t,s)}addShowHiddenOpt(t,s){if(h("[string|boolean] [string]",[t,s],arguments.length),!1===t&&void 0===s)return this;const b="string"==typeof t?t:v(this,V,"f");return this.boolean(b),this.describe(b,s||v(this,ve,"f").deferY18nLookup("Show hidden options")),v(this,ae,"f").showHiddenOpt=b,this}showHidden(t,s){return this.addShowHiddenOpt(t,s)}alias(t,s){return h("<object|string|array> [string|array]",[t,s],arguments.length),this[Te](this.alias.bind(this),"alias",t,s),this}array(t){return h("<array|string>",[t],arguments.length),this[$e]("array",t),this[it](t),this}boolean(t){return h("<array|string>",[t],arguments.length),this[$e]("boolean",t),this[it](t),this}check(t,s){return h("<function> [boolean]",[t,s],arguments.length),this.middleware(((s,b)=>j((()=>t(s,b.getOptions())),(b=>(b?("string"==typeof b||b instanceof Error)&&v(this,ve,"f").fail(b.toString(),b):v(this,ve,"f").fail(v(this,ge,"f").y18n.__("Argument check failed: %s",t.toString())),s)),(t=>(v(this,ve,"f").fail(t.message?t.message:t.toString(),t),s)))),!1,s),this}choices(t,s){return h("<object|string|array> [string|array]",[t,s],arguments.length),this[Te](this.choices.bind(this),"choices",t,s),this}coerce(t,s){if(h("<object|string|array> [function]",[t,s],arguments.length),Array.isArray(t)){if(!s)throw new e("coerce callback must be provided");for(const b of t)this.coerce(b,s);return this}if("object"==typeof t){for(const s of Object.keys(t))this.coerce(s,t[s]);return this}if(!s)throw new e("coerce callback must be provided");return v(this,ae,"f").key[t]=!0,v(this,J,"f").addCoerceMiddleware(((b,F)=>{let B;return Object.prototype.hasOwnProperty.call(b,t)?j((()=>(B=F.getAliases(),s(b[t]))),(s=>{b[t]=s;const M=F.getInternalMethods().getParserConfiguration()["strip-aliased"];if(B[t]&&!0!==M)for(const F of B[t])b[F]=s;return b}),(t=>{throw new e(t.message)})):b}),t),this}conflicts(t,s){return h("<string|object> [string|array]",[t,s],arguments.length),v(this,Fe,"f").conflicts(t,s),this}config(t="config",s,b){return h("[object|string] [string|function] [function]",[t,s,b],arguments.length),"object"!=typeof t||Array.isArray(t)?("function"==typeof s&&(b=s,s=void 0),this.describe(t,s||v(this,ve,"f").deferY18nLookup("Path to JSON config file")),(Array.isArray(t)?t:[t]).forEach((t=>{v(this,ae,"f").config[t]=b||!0})),this):(t=n(t,v(this,W,"f"),this[Se]()["deep-merge-config"]||!1,v(this,ge,"f")),v(this,ae,"f").configObjects=(v(this,ae,"f").configObjects||[]).concat(t),this)}completion(t,s,b){return h("[string] [string|boolean|function] [function]",[t,s,b],arguments.length),"function"==typeof s&&(b=s,s=void 0),O(this,H,t||v(this,H,"f")||"completion","f"),s||!1===s||(s="generate completion script"),this.command(v(this,H,"f"),s),b&&v(this,q,"f").registerFunction(b),this}command(t,s,b,F,B,M){return h("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]",[t,s,b,F,B,M],arguments.length),v(this,U,"f").addHandler(t,s,b,F,B,M),this}commands(t,s,b,F,B,M){return this.command(t,s,b,F,B,M)}commandDir(t,s){h("<string> [object]",[t,s],arguments.length);const b=v(this,ue,"f")||v(this,ge,"f").require;return v(this,U,"f").addDirectory(t,b,v(this,ge,"f").getCallerFile(),s),this}count(t){return h("<array|string>",[t],arguments.length),this[$e]("count",t),this[it](t),this}default(t,s,b){return h("<object|string|array> [*] [string]",[t,s,b],arguments.length),b&&(u(t,v(this,ge,"f")),v(this,ae,"f").defaultDescription[t]=b),"function"==typeof s&&(u(t,v(this,ge,"f")),v(this,ae,"f").defaultDescription[t]||(v(this,ae,"f").defaultDescription[t]=v(this,ve,"f").functionDescription(s)),s=s.call()),this[Ne](this.default.bind(this),"default",t,s),this}defaults(t,s,b){return this.default(t,s,b)}demandCommand(t=1,s,b,F){return h("[number] [number|string] [string|null|undefined] [string|null|undefined]",[t,s,b,F],arguments.length),"number"!=typeof s&&(b=s,s=1/0),this.global("_",!1),v(this,ae,"f").demandedCommands._={min:t,max:s,minMsg:b,maxMsg:F},this}demand(t,s,b){return Array.isArray(s)?(s.forEach((t=>{d(b,!0,v(this,ge,"f")),this.demandOption(t,b)})),s=1/0):"number"!=typeof s&&(b=s,s=1/0),"number"==typeof t?(d(b,!0,v(this,ge,"f")),this.demandCommand(t,s,b,b)):Array.isArray(t)?t.forEach((t=>{d(b,!0,v(this,ge,"f")),this.demandOption(t,b)})):"string"==typeof b?this.demandOption(t,b):!0!==b&&void 0!==b||this.demandOption(t),this}demandOption(t,s){return h("<object|string|array> [string]",[t,s],arguments.length),this[Ne](this.demandOption.bind(this),"demandedOptions",t,s),this}deprecateOption(t,s){return h("<string> [string|boolean]",[t,s],arguments.length),v(this,ae,"f").deprecatedOptions[t]=s,this}describe(t,s){return h("<object|string|array> [string]",[t,s],arguments.length),this[Re](t,!0),v(this,ve,"f").describe(t,s),this}detectLocale(t){return h("<boolean>",[t],arguments.length),O(this,Y,t,"f"),this}env(t){return h("[string|boolean]",[t],arguments.length),!1===t?delete v(this,ae,"f").envPrefix:v(this,ae,"f").envPrefix=t||"",this}epilogue(t){return h("<string>",[t],arguments.length),v(this,ve,"f").epilog(t),this}epilog(t){return this.epilogue(t)}example(t,s){return h("<string|array> [string]",[t,s],arguments.length),Array.isArray(t)?t.forEach((t=>this.example(...t))):v(this,ve,"f").example(t,s),this}exit(t,s){O(this,ne,!0,"f"),O(this,K,s,"f"),v(this,X,"f")&&v(this,ge,"f").process.exit(t)}exitProcess(t=!0){return h("[boolean]",[t],arguments.length),O(this,X,t,"f"),this}fail(t){if(h("<function|boolean>",[t],arguments.length),"boolean"==typeof t&&!1!==t)throw new e("Invalid first argument. Expected function or boolean 'false'");return v(this,ve,"f").failFn(t),this}getAliases(){return this.parsed?this.parsed.aliases:{}}async getCompletion(t,s){return h("<array> [function]",[t,s],arguments.length),s?v(this,q,"f").getCompletion(t,s):new Promise(((s,b)=>{v(this,q,"f").getCompletion(t,((t,F)=>{t?b(t):s(F)}))}))}getDemandedOptions(){return h([],0),v(this,ae,"f").demandedOptions}getDemandedCommands(){return h([],0),v(this,ae,"f").demandedCommands}getDeprecatedOptions(){return h([],0),v(this,ae,"f").deprecatedOptions}getDetectLocale(){return v(this,Y,"f")}getExitProcess(){return v(this,X,"f")}getGroups(){return Object.assign({},v(this,ee,"f"),v(this,de,"f"))}getHelp(){if(O(this,ne,!0,"f"),!v(this,ve,"f").hasCachedHelpMessage()){if(!this.parsed){const t=this[nt](v(this,De,"f"),void 0,void 0,0,!0);if(f(t))return t.then((()=>v(this,ve,"f").help()))}const t=v(this,U,"f").runDefaultBuilderOn(this);if(f(t))return t.then((()=>v(this,ve,"f").help()))}return Promise.resolve(v(this,ve,"f").help())}getOptions(){return v(this,ae,"f")}getStrict(){return v(this,me,"f")}getStrictCommands(){return v(this,ye,"f")}getStrictOptions(){return v(this,be,"f")}global(t,s){return h("<string|array> [boolean]",[t,s],arguments.length),t=[].concat(t),!1!==s?v(this,ae,"f").local=v(this,ae,"f").local.filter((s=>-1===t.indexOf(s))):t.forEach((t=>{v(this,ae,"f").local.includes(t)||v(this,ae,"f").local.push(t)})),this}group(t,s){h("<string|array> <string>",[t,s],arguments.length);const b=v(this,de,"f")[s]||v(this,ee,"f")[s];v(this,de,"f")[s]&&delete v(this,de,"f")[s];const F={};return v(this,ee,"f")[s]=(b||[]).concat(t).filter((t=>!F[t]&&(F[t]=!0))),this}hide(t){return h("<string>",[t],arguments.length),v(this,ae,"f").hiddenOptions.push(t),this}implies(t,s){return h("<string|object> [number|string|array]",[t,s],arguments.length),v(this,Fe,"f").implies(t,s),this}locale(t){return h("[string]",[t],arguments.length),void 0===t?(this[Be](),v(this,ge,"f").y18n.getLocale()):(O(this,Y,!1,"f"),v(this,ge,"f").y18n.setLocale(t),this)}middleware(t,s,b){return v(this,J,"f").addMiddleware(t,!!s,b)}nargs(t,s){return h("<string|object|array> [number]",[t,s],arguments.length),this[Ne](this.nargs.bind(this),"narg",t,s),this}normalize(t){return h("<array|string>",[t],arguments.length),this[$e]("normalize",t),this}number(t){return h("<array|string>",[t],arguments.length),this[$e]("number",t),this[it](t),this}option(t,s){if(h("<string|object> [object]",[t,s],arguments.length),"object"==typeof t)Object.keys(t).forEach((s=>{this.options(s,t[s])}));else{"object"!=typeof s&&(s={}),this[it](t),!v(this,Ee,"f")||"version"!==t&&"version"!==(null==s?void 0:s.alias)||this[xe](['"version" is a reserved word.',"Please do one of the following:",'- Disable version with `yargs.version(false)` if using "version" as an option',"- Use the built-in `yargs.version` method instead (if applicable)","- Use a different option key","https://yargs.js.org/docs/#api-reference-version"].join("\n"),void 0,"versionWarning"),v(this,ae,"f").key[t]=!0,s.alias&&this.alias(t,s.alias);const b=s.deprecate||s.deprecated;b&&this.deprecateOption(t,b);const F=s.demand||s.required||s.require;F&&this.demand(t,F),s.demandOption&&this.demandOption(t,"string"==typeof s.demandOption?s.demandOption:void 0),s.conflicts&&this.conflicts(t,s.conflicts),"default"in s&&this.default(t,s.default),void 0!==s.implies&&this.implies(t,s.implies),void 0!==s.nargs&&this.nargs(t,s.nargs),s.config&&this.config(t,s.configParser),s.normalize&&this.normalize(t),s.choices&&this.choices(t,s.choices),s.coerce&&this.coerce(t,s.coerce),s.group&&this.group(t,s.group),(s.boolean||"boolean"===s.type)&&(this.boolean(t),s.alias&&this.boolean(s.alias)),(s.array||"array"===s.type)&&(this.array(t),s.alias&&this.array(s.alias)),(s.number||"number"===s.type)&&(this.number(t),s.alias&&this.number(s.alias)),(s.string||"string"===s.type)&&(this.string(t),s.alias&&this.string(s.alias)),(s.count||"count"===s.type)&&this.count(t),"boolean"==typeof s.global&&this.global(t,s.global),s.defaultDescription&&(v(this,ae,"f").defaultDescription[t]=s.defaultDescription),s.skipValidation&&this.skipValidation(t);const B=s.describe||s.description||s.desc,M=v(this,ve,"f").getDescriptions();Object.prototype.hasOwnProperty.call(M,t)&&"string"!=typeof B||this.describe(t,B),s.hidden&&this.hide(t),s.requiresArg&&this.requiresArg(t)}return this}options(t,s){return this.option(t,s)}parse(t,s,b){h("[string|array] [function|boolean|object] [function]",[t,s,b],arguments.length),this[ke](),void 0===t&&(t=v(this,De,"f")),"object"==typeof s&&(O(this,fe,s,"f"),s=b),"function"==typeof s&&(O(this,le,s,"f"),s=!1),s||O(this,De,t,"f"),v(this,le,"f")&&O(this,X,!1,"f");const F=this[nt](t,!!s),B=this.parsed;return v(this,q,"f").setParsed(this.parsed),f(F)?F.then((t=>(v(this,le,"f")&&v(this,le,"f").call(this,v(this,K,"f"),t,v(this,oe,"f")),t))).catch((t=>{throw v(this,le,"f")&&v(this,le,"f")(t,this.parsed.argv,v(this,oe,"f")),t})).finally((()=>{this[Ue](),this.parsed=B})):(v(this,le,"f")&&v(this,le,"f").call(this,v(this,K,"f"),F,v(this,oe,"f")),this[Ue](),this.parsed=B,F)}parseAsync(t,s,b){const F=this.parse(t,s,b);return f(F)?F:Promise.resolve(F)}parseSync(t,s,b){const F=this.parse(t,s,b);if(f(F))throw new e(".parseSync() must not be used with asynchronous builders, handlers, or middleware");return F}parserConfiguration(t){return h("<object>",[t],arguments.length),O(this,ce,t,"f"),this}pkgConf(t,s){h("<string> [string]",[t,s],arguments.length);let b=null;const F=this[Ie](s||v(this,W,"f"));return F[t]&&"object"==typeof F[t]&&(b=n(F[t],s||v(this,W,"f"),this[Se]()["deep-merge-config"]||!1,v(this,ge,"f")),v(this,ae,"f").configObjects=(v(this,ae,"f").configObjects||[]).concat(b)),this}positional(t,s){h("<string> <object>",[t,s],arguments.length);const b=["default","defaultDescription","implies","normalize","choices","conflicts","coerce","type","describe","desc","description","alias"];s=g(s,((t,s)=>!("type"===t&&!["string","number","boolean"].includes(s))&&b.includes(t)));const F=v(this,z,"f").fullCommands[v(this,z,"f").fullCommands.length-1],B=F?v(this,U,"f").cmdToParseOptions(F):{array:[],alias:{},default:{},demand:{}};return p(B).forEach((b=>{const F=B[b];Array.isArray(F)?-1!==F.indexOf(t)&&(s[b]=!0):F[t]&&!(b in s)&&(s[b]=F[t])})),this.group(t,v(this,ve,"f").getPositionalGroupName()),this.option(t,s)}recommendCommands(t=!0){return h("[boolean]",[t],arguments.length),O(this,pe,t,"f"),this}required(t,s,b){return this.demand(t,s,b)}require(t,s,b){return this.demand(t,s,b)}requiresArg(t){return h("<array|string|object> [number]",[t],arguments.length),"string"==typeof t&&v(this,ae,"f").narg[t]||this[Ne](this.requiresArg.bind(this),"narg",t,NaN),this}showCompletionScript(t,s){return h("[string] [string]",[t,s],arguments.length),t=t||this.$0,v(this,ie,"f").log(v(this,q,"f").generateCompletionScript(t,s||v(this,H,"f")||"completion")),this}showHelp(t){if(h("[string|function]",[t],arguments.length),O(this,ne,!0,"f"),!v(this,ve,"f").hasCachedHelpMessage()){if(!this.parsed){const s=this[nt](v(this,De,"f"),void 0,void 0,0,!0);if(f(s))return s.then((()=>{v(this,ve,"f").showHelp(t)})),this}const s=v(this,U,"f").runDefaultBuilderOn(this);if(f(s))return s.then((()=>{v(this,ve,"f").showHelp(t)})),this}return v(this,ve,"f").showHelp(t),this}scriptName(t){return this.customScriptName=!0,this.$0=t,this}showHelpOnFail(t,s){return h("[boolean|string] [string]",[t,s],arguments.length),v(this,ve,"f").showHelpOnFail(t,s),this}showVersion(t){return h("[string|function]",[t],arguments.length),v(this,ve,"f").showVersion(t),this}skipValidation(t){return h("<array|string>",[t],arguments.length),this[$e]("skipValidation",t),this}strict(t){return h("[boolean]",[t],arguments.length),O(this,me,!1!==t,"f"),this}strictCommands(t){return h("[boolean]",[t],arguments.length),O(this,ye,!1!==t,"f"),this}strictOptions(t){return h("[boolean]",[t],arguments.length),O(this,be,!1!==t,"f"),this}string(t){return h("<array|string>",[t],arguments.length),this[$e]("string",t),this[it](t),this}terminalWidth(){return h([],0),v(this,ge,"f").process.stdColumns}updateLocale(t){return this.updateStrings(t)}updateStrings(t){return h("<object>",[t],arguments.length),O(this,Y,!1,"f"),v(this,ge,"f").y18n.updateLocale(t),this}usage(t,s,b,F){if(h("<string|null|undefined> [string|boolean] [function|object] [function]",[t,s,b,F],arguments.length),void 0!==s){if(d(t,null,v(this,ge,"f")),(t||"").match(/^\$0( |$)/))return this.command(t,s,b,F);throw new e(".usage() description must start with $0 if being used as alias for .command()")}return v(this,ve,"f").usage(t),this}usageConfiguration(t){return h("<object>",[t],arguments.length),O(this,Ce,t,"f"),this}version(t,s,b){const F="version";if(h("[boolean|string] [string] [string]",[t,s,b],arguments.length),v(this,Ee,"f")&&(this[Oe](v(this,Ee,"f")),v(this,ve,"f").version(void 0),O(this,Ee,null,"f")),0===arguments.length)b=this[Me](),t=F;else if(1===arguments.length){if(!1===t)return this;b=t,t=F}else 2===arguments.length&&(b=s,s=void 0);return O(this,Ee,"string"==typeof t?t:F,"f"),s=s||v(this,ve,"f").deferY18nLookup("Show version number"),v(this,ve,"f").version(b||void 0),this.boolean(v(this,Ee,"f")),this.describe(v(this,Ee,"f"),s),this}wrap(t){return h("<number|null|undefined>",[t],arguments.length),v(this,ve,"f").wrap(t),this}[(U=new WeakMap,W=new WeakMap,z=new WeakMap,q=new WeakMap,H=new WeakMap,V=new WeakMap,K=new WeakMap,Y=new WeakMap,Q=new WeakMap,X=new WeakMap,Z=new WeakMap,J=new WeakMap,ee=new WeakMap,ne=new WeakMap,se=new WeakMap,re=new WeakMap,ie=new WeakMap,oe=new WeakMap,ae=new WeakMap,ue=new WeakMap,ce=new WeakMap,le=new WeakMap,fe=new WeakMap,he=new WeakMap,de=new WeakMap,De=new WeakMap,pe=new WeakMap,ge=new WeakMap,me=new WeakMap,ye=new WeakMap,be=new WeakMap,ve=new WeakMap,Ce=new WeakMap,Ee=new WeakMap,Fe=new WeakMap,we)](t){if(!t._||!t["--"])return t;t._.push.apply(t._,t["--"]);try{delete t["--"]}catch(t){}return t}[Ae](){return{log:(...t)=>{this[Xe]()||console.log(...t),O(this,ne,!0,"f"),v(this,oe,"f").length&&O(this,oe,v(this,oe,"f")+"\n","f"),O(this,oe,v(this,oe,"f")+t.join(" "),"f")},error:(...t)=>{this[Xe]()||console.error(...t),O(this,ne,!0,"f"),v(this,oe,"f").length&&O(this,oe,v(this,oe,"f")+"\n","f"),O(this,oe,v(this,oe,"f")+t.join(" "),"f")}}}[Oe](t){p(v(this,ae,"f")).forEach((s=>{if("configObjects"===s)return;const b=v(this,ae,"f")[s];Array.isArray(b)?b.includes(t)&&b.splice(b.indexOf(t),1):"object"==typeof b&&delete b[t]})),delete v(this,ve,"f").getDescriptions()[t]}[xe](t,s,b){v(this,Q,"f")[b]||(v(this,ge,"f").process.emitWarning(t,s),v(this,Q,"f")[b]=!0)}[ke](){v(this,Z,"f").push({options:v(this,ae,"f"),configObjects:v(this,ae,"f").configObjects.slice(0),exitProcess:v(this,X,"f"),groups:v(this,ee,"f"),strict:v(this,me,"f"),strictCommands:v(this,ye,"f"),strictOptions:v(this,be,"f"),completionCommand:v(this,H,"f"),output:v(this,oe,"f"),exitError:v(this,K,"f"),hasOutput:v(this,ne,"f"),parsed:this.parsed,parseFn:v(this,le,"f"),parseContext:v(this,fe,"f")}),v(this,ve,"f").freeze(),v(this,Fe,"f").freeze(),v(this,U,"f").freeze(),v(this,J,"f").freeze()}[_e](){let t,s="";return t=/\b(node|iojs|electron)(\.exe)?$/.test(v(this,ge,"f").process.argv()[0])?v(this,ge,"f").process.argv().slice(1,2):v(this,ge,"f").process.argv().slice(0,1),s=t.map((t=>{const s=this[et](v(this,W,"f"),t);return t.match(/^(\/|([a-zA-Z]:)?\\)/)&&s.length<t.length?s:t})).join(" ").trim(),v(this,ge,"f").getEnv("_")&&v(this,ge,"f").getProcessArgvBin()===v(this,ge,"f").getEnv("_")&&(s=v(this,ge,"f").getEnv("_").replace(`${v(this,ge,"f").path.dirname(v(this,ge,"f").process.execPath())}/`,"")),s}[Se](){return v(this,ce,"f")}[je](){return v(this,Ce,"f")}[Be](){if(!v(this,Y,"f"))return;const t=v(this,ge,"f").getEnv("LC_ALL")||v(this,ge,"f").getEnv("LC_MESSAGES")||v(this,ge,"f").getEnv("LANG")||v(this,ge,"f").getEnv("LANGUAGE")||"en_US";this.locale(t.replace(/[.:].*/,""))}[Me](){return this[Ie]().version||"unknown"}[Pe](t){const s=t["--"]?t["--"]:t._;for(let t,b=0;void 0!==(t=s[b]);b++)v(this,ge,"f").Parser.looksLikeNumber(t)&&Number.isSafeInteger(Math.floor(parseFloat(`${t}`)))&&(s[b]=Number(t));return t}[Ie](t){const s=t||"*";if(v(this,he,"f")[s])return v(this,he,"f")[s];let b={};try{let s=t||v(this,ge,"f").mainFilename;!t&&v(this,ge,"f").path.extname(s)&&(s=v(this,ge,"f").path.dirname(s));const F=v(this,ge,"f").findUp(s,((t,s)=>s.includes("package.json")?"package.json":void 0));d(F,void 0,v(this,ge,"f")),b=JSON.parse(v(this,ge,"f").readFileSync(F,"utf8"))}catch(t){}return v(this,he,"f")[s]=b||{},v(this,he,"f")[s]}[$e](t,s){(s=[].concat(s)).forEach((s=>{s=this[Ge](s),v(this,ae,"f")[t].push(s)}))}[Ne](t,s,b,F){this[Le](t,s,b,F,((t,s,b)=>{v(this,ae,"f")[t][s]=b}))}[Te](t,s,b,F){this[Le](t,s,b,F,((t,s,b)=>{v(this,ae,"f")[t][s]=(v(this,ae,"f")[t][s]||[]).concat(b)}))}[Le](t,s,b,F,B){if(Array.isArray(b))b.forEach((s=>{t(s,F)}));else if((t=>"object"==typeof t)(b))for(const s of p(b))t(s,b[s]);else B(s,this[Ge](b),F)}[Ge](t){return"__proto__"===t?"___proto___":t}[Re](t,s){return this[Ne](this[Re].bind(this),"key",t,s),this}[Ue](){var t,s,b,F,B,M,T,L,G,R,W,z;const q=v(this,Z,"f").pop();let V;d(q,void 0,v(this,ge,"f")),t=this,s=this,b=this,F=this,B=this,M=this,T=this,L=this,G=this,R=this,W=this,z=this,({options:{set value(s){O(t,ae,s,"f")}}.value,configObjects:V,exitProcess:{set value(t){O(s,X,t,"f")}}.value,groups:{set value(t){O(b,ee,t,"f")}}.value,output:{set value(t){O(F,oe,t,"f")}}.value,exitError:{set value(t){O(B,K,t,"f")}}.value,hasOutput:{set value(t){O(M,ne,t,"f")}}.value,parsed:this.parsed,strict:{set value(t){O(T,me,t,"f")}}.value,strictCommands:{set value(t){O(L,ye,t,"f")}}.value,strictOptions:{set value(t){O(G,be,t,"f")}}.value,completionCommand:{set value(t){O(R,H,t,"f")}}.value,parseFn:{set value(t){O(W,le,t,"f")}}.value,parseContext:{set value(t){O(z,fe,t,"f")}}.value}=q),v(this,ae,"f").configObjects=V,v(this,ve,"f").unfreeze(),v(this,Fe,"f").unfreeze(),v(this,U,"f").unfreeze(),v(this,J,"f").unfreeze()}[We](t,s){return j(s,(s=>(t(s),s)))}getInternalMethods(){return{getCommandInstance:this[ze].bind(this),getContext:this[qe].bind(this),getHasOutput:this[He].bind(this),getLoggerInstance:this[Ve].bind(this),getParseContext:this[Ke].bind(this),getParserConfiguration:this[Se].bind(this),getUsageConfiguration:this[je].bind(this),getUsageInstance:this[Ye].bind(this),getValidationInstance:this[Qe].bind(this),hasParseCallback:this[Xe].bind(this),isGlobalContext:this[Ze].bind(this),postProcess:this[Je].bind(this),reset:this[tt].bind(this),runValidation:this[st].bind(this),runYargsParserAndExecuteCommands:this[nt].bind(this),setHasOutput:this[rt].bind(this)}}[ze](){return v(this,U,"f")}[qe](){return v(this,z,"f")}[He](){return v(this,ne,"f")}[Ve](){return v(this,ie,"f")}[Ke](){return v(this,fe,"f")||{}}[Ye](){return v(this,ve,"f")}[Qe](){return v(this,Fe,"f")}[Xe](){return!!v(this,le,"f")}[Ze](){return v(this,re,"f")}[Je](t,s,b,F){if(b)return t;if(f(t))return t;s||(t=this[we](t));return(this[Se]()["parse-positional-numbers"]||void 0===this[Se]()["parse-positional-numbers"])&&(t=this[Pe](t)),F&&(t=C(t,this,v(this,J,"f").getMiddleware(),!1)),t}[tt](t={}){O(this,ae,v(this,ae,"f")||{},"f");const s={};s.local=v(this,ae,"f").local||[],s.configObjects=v(this,ae,"f").configObjects||[];const b={};s.local.forEach((s=>{b[s]=!0,(t[s]||[]).forEach((t=>{b[t]=!0}))})),Object.assign(v(this,de,"f"),Object.keys(v(this,ee,"f")).reduce(((t,s)=>{const F=v(this,ee,"f")[s].filter((t=>!(t in b)));return F.length>0&&(t[s]=F),t}),{})),O(this,ee,{},"f");return["array","boolean","string","skipValidation","count","normalize","number","hiddenOptions"].forEach((t=>{s[t]=(v(this,ae,"f")[t]||[]).filter((t=>!b[t]))})),["narg","key","alias","default","defaultDescription","config","choices","demandedOptions","demandedCommands","deprecatedOptions"].forEach((t=>{s[t]=g(v(this,ae,"f")[t],(t=>!b[t]))})),s.envPrefix=v(this,ae,"f").envPrefix,O(this,ae,s,"f"),O(this,ve,v(this,ve,"f")?v(this,ve,"f").reset(b):P(this,v(this,ge,"f")),"f"),O(this,Fe,v(this,Fe,"f")?v(this,Fe,"f").reset(b):function(t,s,b){const F=b.y18n.__,B=b.y18n.__n,M={nonOptionCount:function(b){const F=t.getDemandedCommands(),M=b._.length+(b["--"]?b["--"].length:0)-t.getInternalMethods().getContext().commands.length;F._&&(M<F._.min||M>F._.max)&&(M<F._.min?void 0!==F._.minMsg?s.fail(F._.minMsg?F._.minMsg.replace(/\$0/g,M.toString()).replace(/\$1/,F._.min.toString()):null):s.fail(B("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",M,M.toString(),F._.min.toString())):M>F._.max&&(void 0!==F._.maxMsg?s.fail(F._.maxMsg?F._.maxMsg.replace(/\$0/g,M.toString()).replace(/\$1/,F._.max.toString()):null):s.fail(B("Too many non-option arguments: got %s, maximum of %s","Too many non-option arguments: got %s, maximum of %s",M,M.toString(),F._.max.toString()))))},positionalCount:function(t,b){b<t&&s.fail(B("Not enough non-option arguments: got %s, need at least %s","Not enough non-option arguments: got %s, need at least %s",b,b+"",t+""))},requiredArguments:function(t,b){let F=null;for(const s of Object.keys(b))Object.prototype.hasOwnProperty.call(t,s)&&void 0!==t[s]||(F=F||{},F[s]=b[s]);if(F){const t=[];for(const s of Object.keys(F)){const b=F[s];b&&t.indexOf(b)<0&&t.push(b)}const b=t.length?`\n${t.join("\n")}`:"";s.fail(B("Missing required argument: %s","Missing required arguments: %s",Object.keys(F).length,Object.keys(F).join(", ")+b))}},unknownArguments:function(b,F,T,L,G=!0){var U;const W=t.getInternalMethods().getCommandInstance().getCommands(),z=[],q=t.getInternalMethods().getContext();if(Object.keys(b).forEach((s=>{R.includes(s)||Object.prototype.hasOwnProperty.call(T,s)||Object.prototype.hasOwnProperty.call(t.getInternalMethods().getParseContext(),s)||M.isValidAndSomeAliasIsNotNew(s,F)||z.push(s)})),G&&(q.commands.length>0||W.length>0||L)&&b._.slice(q.commands.length).forEach((t=>{W.includes(""+t)||z.push(""+t)})),G){const s=(null===(U=t.getDemandedCommands()._)||void 0===U?void 0:U.max)||0,F=q.commands.length+s;F<b._.length&&b._.slice(F).forEach((t=>{t=String(t),q.commands.includes(t)||z.includes(t)||z.push(t)}))}z.length&&s.fail(B("Unknown argument: %s","Unknown arguments: %s",z.length,z.map((t=>t.trim()?t:`"${t}"`)).join(", ")))},unknownCommands:function(b){const F=t.getInternalMethods().getCommandInstance().getCommands(),M=[],T=t.getInternalMethods().getContext();return(T.commands.length>0||F.length>0)&&b._.slice(T.commands.length).forEach((t=>{F.includes(""+t)||M.push(""+t)})),M.length>0&&(s.fail(B("Unknown command: %s","Unknown commands: %s",M.length,M.join(", "))),!0)},isValidAndSomeAliasIsNotNew:function(s,b){if(!Object.prototype.hasOwnProperty.call(b,s))return!1;const F=t.parsed.newAliases;return[s,...b[s]].some((t=>!Object.prototype.hasOwnProperty.call(F,t)||!F[s]))},limitedChoices:function(b){const B=t.getOptions(),M={};if(!Object.keys(B.choices).length)return;Object.keys(b).forEach((t=>{-1===R.indexOf(t)&&Object.prototype.hasOwnProperty.call(B.choices,t)&&[].concat(b[t]).forEach((s=>{-1===B.choices[t].indexOf(s)&&void 0!==s&&(M[t]=(M[t]||[]).concat(s))}))}));const T=Object.keys(M);if(!T.length)return;let L=F("Invalid values:");T.forEach((t=>{L+=`\n ${F("Argument: %s, Given: %s, Choices: %s",t,s.stringifiedValues(M[t]),s.stringifiedValues(B.choices[t]))}`})),s.fail(L)}};let T={};function a(t,s){const b=Number(s);return"number"==typeof(s=isNaN(b)?s:b)?s=t._.length>=s:s.match(/^--no-.+/)?(s=s.match(/^--no-(.+)/)[1],s=!Object.prototype.hasOwnProperty.call(t,s)):s=Object.prototype.hasOwnProperty.call(t,s),s}M.implies=function(s,F){h("<string|object> [array|number|string]",[s,F],arguments.length),"object"==typeof s?Object.keys(s).forEach((t=>{M.implies(t,s[t])})):(t.global(s),T[s]||(T[s]=[]),Array.isArray(F)?F.forEach((t=>M.implies(s,t))):(d(F,void 0,b),T[s].push(F)))},M.getImplied=function(){return T},M.implications=function(t){const b=[];if(Object.keys(T).forEach((s=>{const F=s;(T[s]||[]).forEach((s=>{let B=F;const M=s;B=a(t,B),s=a(t,s),B&&!s&&b.push(` ${F} -> ${M}`)}))})),b.length){let t=`${F("Implications failed:")}\n`;b.forEach((s=>{t+=s})),s.fail(t)}};let L={};M.conflicts=function(s,b){h("<string|object> [array|string]",[s,b],arguments.length),"object"==typeof s?Object.keys(s).forEach((t=>{M.conflicts(t,s[t])})):(t.global(s),L[s]||(L[s]=[]),Array.isArray(b)?b.forEach((t=>M.conflicts(s,t))):L[s].push(b))},M.getConflicting=()=>L,M.conflicting=function(B){Object.keys(B).forEach((t=>{L[t]&&L[t].forEach((b=>{b&&void 0!==B[t]&&void 0!==B[b]&&s.fail(F("Arguments %s and %s are mutually exclusive",t,b))}))})),t.getInternalMethods().getParserConfiguration()["strip-dashed"]&&Object.keys(L).forEach((t=>{L[t].forEach((M=>{M&&void 0!==B[b.Parser.camelCase(t)]&&void 0!==B[b.Parser.camelCase(M)]&&s.fail(F("Arguments %s and %s are mutually exclusive",t,M))}))}))},M.recommendCommands=function(t,b){b=b.sort(((t,s)=>s.length-t.length));let B=null,M=1/0;for(let s,F=0;void 0!==(s=b[F]);F++){const b=N(t,s);b<=3&&b<M&&(M=b,B=s)}B&&s.fail(F("Did you mean %s?",B))},M.reset=function(t){return T=g(T,(s=>!t[s])),L=g(L,(s=>!t[s])),M};const G=[];return M.freeze=function(){G.push({implied:T,conflicting:L})},M.unfreeze=function(){const t=G.pop();d(t,void 0,b),({implied:T,conflicting:L}=t)},M}(this,v(this,ve,"f"),v(this,ge,"f")),"f"),O(this,U,v(this,U,"f")?v(this,U,"f").reset():function(t,s,b,F){return new _(t,s,b,F)}(v(this,ve,"f"),v(this,Fe,"f"),v(this,J,"f"),v(this,ge,"f")),"f"),v(this,q,"f")||O(this,q,function(t,s,b,F){return new D(t,s,b,F)}(this,v(this,ve,"f"),v(this,U,"f"),v(this,ge,"f")),"f"),v(this,J,"f").reset(),O(this,H,null,"f"),O(this,oe,"","f"),O(this,K,null,"f"),O(this,ne,!1,"f"),this.parsed=!1,this}[et](t,s){return v(this,ge,"f").path.relative(t,s)}[nt](t,s,b,F=0,B=!1){let M=!!b||B;t=t||v(this,De,"f"),v(this,ae,"f").__=v(this,ge,"f").y18n.__,v(this,ae,"f").configuration=this[Se]();const T=!!v(this,ae,"f").configuration["populate--"],L=Object.assign({},v(this,ae,"f").configuration,{"populate--":!0}),G=v(this,ge,"f").Parser.detailed(t,Object.assign({},v(this,ae,"f"),{configuration:{"parse-positional-numbers":!1,...L}})),R=Object.assign(G.argv,v(this,fe,"f"));let W;const z=G.aliases;let V=!1,K=!1;Object.keys(R).forEach((t=>{t===v(this,se,"f")&&R[t]?V=!0:t===v(this,Ee,"f")&&R[t]&&(K=!0)})),R.$0=this.$0,this.parsed=G,0===F&&v(this,ve,"f").clearCachedHelpMessage();try{if(this[Be](),s)return this[Je](R,T,!!b,!1);if(v(this,se,"f")){[v(this,se,"f")].concat(z[v(this,se,"f")]||[]).filter((t=>t.length>1)).includes(""+R._[R._.length-1])&&(R._.pop(),V=!0)}O(this,re,!1,"f");const L=v(this,U,"f").getCommands(),Y=v(this,q,"f").completionKey in R,Q=V||Y||B;if(R._.length){if(L.length){let t;for(let s,M=F||0;void 0!==R._[M];M++){if(s=String(R._[M]),L.includes(s)&&s!==v(this,H,"f")){const t=v(this,U,"f").runCommand(s,this,G,M+1,B,V||K||B);return this[Je](t,T,!!b,!1)}if(!t&&s!==v(this,H,"f")){t=s;break}}!v(this,U,"f").hasDefaultCommand()&&v(this,pe,"f")&&t&&!Q&&v(this,Fe,"f").recommendCommands(t,L)}v(this,H,"f")&&R._.includes(v(this,H,"f"))&&!Y&&(v(this,X,"f")&&E(!0),this.showCompletionScript(),this.exit(0))}if(v(this,U,"f").hasDefaultCommand()&&!Q){const t=v(this,U,"f").runCommand(null,this,G,0,B,V||K||B);return this[Je](t,T,!!b,!1)}if(Y){v(this,X,"f")&&E(!0);const s=(t=[].concat(t)).slice(t.indexOf(`--${v(this,q,"f").completionKey}`)+1);return v(this,q,"f").getCompletion(s,((t,s)=>{if(t)throw new e(t.message);(s||[]).forEach((t=>{v(this,ie,"f").log(t)})),this.exit(0)})),this[Je](R,!T,!!b,!1)}if(v(this,ne,"f")||(V?(v(this,X,"f")&&E(!0),M=!0,this.showHelp("log"),this.exit(0)):K&&(v(this,X,"f")&&E(!0),M=!0,v(this,ve,"f").showVersion("log"),this.exit(0))),!M&&v(this,ae,"f").skipValidation.length>0&&(M=Object.keys(R).some((t=>v(this,ae,"f").skipValidation.indexOf(t)>=0&&!0===R[t]))),!M){if(G.error)throw new e(G.error.message);if(!Y){const t=this[st](z,{},G.error);b||(W=C(R,this,v(this,J,"f").getMiddleware(),!0)),W=this[We](t,null!=W?W:R),f(W)&&!b&&(W=W.then((()=>C(R,this,v(this,J,"f").getMiddleware(),!1))))}}}catch(t){if(!(t instanceof e))throw t;v(this,ve,"f").fail(t.message,t)}return this[Je](null!=W?W:R,T,!!b,!0)}[st](t,s,b,F){const B={...this.getDemandedOptions()};return M=>{if(b)throw new e(b.message);v(this,Fe,"f").nonOptionCount(M),v(this,Fe,"f").requiredArguments(M,B);let T=!1;v(this,ye,"f")&&(T=v(this,Fe,"f").unknownCommands(M)),v(this,me,"f")&&!T?v(this,Fe,"f").unknownArguments(M,t,s,!!F):v(this,be,"f")&&v(this,Fe,"f").unknownArguments(M,t,{},!1,!1),v(this,Fe,"f").limitedChoices(M),v(this,Fe,"f").implications(M),v(this,Fe,"f").conflicting(M)}}[rt](){O(this,ne,!0,"f")}[it](t){if("string"==typeof t)v(this,ae,"f").key[t]=!0;else for(const s of t)v(this,ae,"f").key[s]=!0}}var ot,at;const{readFileSync:ut}=b(9896),{inspect:ct}=b(9023),{resolve:lt}=b(6928),ft=b(9162),ht=b(6420);var dt,Dt={assert:{notStrictEqual:F.notStrictEqual,strictEqual:F.strictEqual},cliui:b(702),findUp:b(7020),getEnv:t=>process.env[t],getCallerFile:b(9103),getProcessArgvBin:y,inspect:ct,mainFilename:null!==(at=null===(ot=false||void 0===b(8501)?void 0:b.c[b.s])||void 0===ot?void 0:ot.filename)&&void 0!==at?at:process.cwd(),Parser:ht,path:b(6928),process:{argv:()=>process.argv,cwd:process.cwd,emitWarning:(t,s)=>process.emitWarning(t,s),execPath:()=>process.execPath,exit:t=>{process.exit(t)},nextTick:process.nextTick,stdColumns:void 0!==process.stdout.columns?process.stdout.columns:null},readFileSync:ut,require:b(8501),requireDirectory:b(763),stringWidth:b(1838),y18n:ft({directory:lt(__dirname,"../locales"),updateFiles:!1})};const pt=(null===(dt=null===process||void 0===process?void 0:process.env)||void 0===dt?void 0:dt.YARGS_MIN_NODE_VERSION)?Number(process.env.YARGS_MIN_NODE_VERSION):12;if(process&&process.version){if(Number(process.version.match(/v([^.]+)/)[1])<pt)throw Error(`yargs supports a minimum Node.js version of ${pt}. Read our version support policy: https://github.com/yargs/yargs#supported-nodejs-versions`)}const gt=b(6420);var mt,yt={applyExtends:n,cjsPlatformShim:Dt,Yargs:(mt=Dt,(t=[],s=mt.process.cwd(),b)=>{const F=new te(t,s,b,mt);return Object.defineProperty(F,"argv",{get:()=>F.parse(),enumerable:!0}),F.help(),F.version(),F}),argsert:h,isPromise:f,objFilter:g,parseCommand:o,Parser:gt,processArgv:L,YError:e};t.exports=yt},9309:(t,s,b)=>{"use strict";b.d(s,{o0:()=>detect});var F=b(9896);var B=b(6928);var M=b(5426);async function pathExists(t){try{await F.promises.access(t);return true}catch{return false}}var T=new Map;function hasGlobalInstallation(t){const s=`has_global_${t}`;if(T.has(s)){return Promise.resolve(T.get(s))}return M(t,["--version"]).then((t=>/^\d+.\d+.\d+$/.test(t.stdout))).then((t=>{T.set(s,t);return t})).catch((()=>false))}function getTypeofLockFile(t="."){const s=`lockfile_${t}`;if(T.has(s)){return Promise.resolve(T.get(s))}return Promise.all([pathExists((0,B.resolve)(t,"yarn.lock")),pathExists((0,B.resolve)(t,"package-lock.json")),pathExists((0,B.resolve)(t,"pnpm-lock.yaml")),pathExists((0,B.resolve)(t,"bun.lockb"))]).then((([t,b,F,B])=>{let M=null;if(t){M="yarn"}else if(F){M="pnpm"}else if(B){M="bun"}else if(b){M="npm"}T.set(s,M);return M}))}var detect=async({cwd:t,includeGlobalBun:s}={})=>{const b=await getTypeofLockFile(t);if(b){return b}const[F,B,M]=await Promise.all([hasGlobalInstallation("yarn"),hasGlobalInstallation("pnpm"),s&&hasGlobalInstallation("bun")]);if(F){return"yarn"}if(B){return"pnpm"}if(M){return"bun"}return"npm"};function getNpmVersion(t){return execa(t||"npm",["--version"]).then((t=>t.stdout))}function clearCache(){return T.clear()}},222:(t,s,b)=>{"use strict";b.d(s,{A:()=>R});var F=b(2612);const{applyExtends:B,cjsPlatformShim:M,Parser:T,processArgv:L,Yargs:G}=F;G.applyExtends=(t,s,b)=>B(t,s,b,M);G.hideBin=L.hideBin;G.Parser=T;const R=G}};var __webpack_module_cache__={};function __nccwpck_require__(t){var s=__webpack_module_cache__[t];if(s!==undefined){return s.exports}var b=__webpack_module_cache__[t]={id:t,loaded:false,exports:{}};var F=true;try{__webpack_modules__[t](b,b.exports,__nccwpck_require__);F=false}finally{if(F)delete __webpack_module_cache__[t]}b.loaded=true;return b.exports}__nccwpck_require__.c=__webpack_module_cache__;(()=>{var t=typeof Symbol==="function"?Symbol("webpack queues"):"__webpack_queues__";var s=typeof Symbol==="function"?Symbol("webpack exports"):"__webpack_exports__";var b=typeof Symbol==="function"?Symbol("webpack error"):"__webpack_error__";var resolveQueue=t=>{if(t&&t.d<1){t.d=1;t.forEach((t=>t.r--));t.forEach((t=>t.r--?t.r++:t()))}};var wrapDeps=F=>F.map((F=>{if(F!==null&&typeof F==="object"){if(F[t])return F;if(F.then){var B=[];B.d=0;F.then((t=>{M[s]=t;resolveQueue(B)}),(t=>{M[b]=t;resolveQueue(B)}));var M={};M[t]=t=>t(B);return M}}var T={};T[t]=t=>{};T[s]=F;return T}));__nccwpck_require__.a=(F,B,M)=>{var T;M&&((T=[]).d=-1);var L=new Set;var G=F.exports;var R;var U;var W;var z=new Promise(((t,s)=>{W=s;U=t}));z[s]=G;z[t]=t=>(T&&t(T),L.forEach(t),z["catch"]((t=>{})));F.exports=z;B((F=>{R=wrapDeps(F);var B;var getResult=()=>R.map((t=>{if(t[b])throw t[b];return t[s]}));var M=new Promise((s=>{B=()=>s(getResult);B.r=0;var fnQueue=t=>t!==T&&!L.has(t)&&(L.add(t),t&&!t.d&&(B.r++,t.push(B)));R.map((s=>s[t](fnQueue)))}));return B.r?M:getResult()}),(t=>(t?W(z[b]=t):U(G),resolveQueue(T))));T&&T.d<0&&(T.d=0)}})();(()=>{__nccwpck_require__.n=t=>{var s=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(s,{a:s});return s}})();(()=>{__nccwpck_require__.d=(t,s)=>{for(var b in s){if(__nccwpck_require__.o(s,b)&&!__nccwpck_require__.o(t,b)){Object.defineProperty(t,b,{enumerable:true,get:s[b]})}}}})();(()=>{__nccwpck_require__.o=(t,s)=>Object.prototype.hasOwnProperty.call(t,s)})();(()=>{__nccwpck_require__.r=t=>{if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(t,"__esModule",{value:true})}})();(()=>{__nccwpck_require__.nmd=t=>{t.paths=[];if(!t.children)t.children=[];return t}})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var __webpack_exports__=__nccwpck_require__(__nccwpck_require__.s=1719);module.exports=__webpack_exports__})();
|
package/dist/next.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const compiledUserWorkerEntrypointScript=`var uo=Object.create;var Te=Object.defineProperty;var mo=Object.getOwnPropertyDescriptor;var lo=Object.getOwnPropertyNames;var ho=Object.getPrototypeOf,yo=Object.prototype.hasOwnProperty;var oe=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),go=(e,r)=>{for(var t in r)Te(e,t,{get:r[t],enumerable:!0})},bo=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of lo(r))!yo.call(e,n)&&n!==t&&Te(e,n,{get:()=>r[n],enumerable:!(o=mo(r,n))||o.enumerable});return e};var Eo=(e,r,t)=>(t=e!=null?uo(ho(e)):{},bo(r||!e||!e.__esModule?Te(t,"default",{value:e,enumerable:!0}):t,e));var xr=oe((Gn,Er)=>{"use strict";var ve=Object.defineProperty,xo=Object.getOwnPropertyDescriptor,_o=Object.getOwnPropertyNames,So=Object.prototype.hasOwnProperty,Oo=(e,r)=>{for(var t in r)ve(e,t,{get:r[t],enumerable:!0})},wo=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of _o(r))!So.call(e,n)&&n!==t&&ve(e,n,{get:()=>r[n],enumerable:!(o=xo(r,n))||o.enumerable});return e},Ro=e=>wo(ve({},"__esModule",{value:!0}),e),ur={};Oo(ur,{CITY_HEADER_NAME:()=>mr,COUNTRY_HEADER_NAME:()=>Ae,EMOJI_FLAG_UNICODE_STARTING_POSITION:()=>br,IP_HEADER_NAME:()=>lr,LATITUDE_HEADER_NAME:()=>dr,LONGITUDE_HEADER_NAME:()=>hr,REGION_HEADER_NAME:()=>yr,REQUEST_ID_HEADER_NAME:()=>gr,geolocation:()=>Po,ipAddress:()=>vo});Er.exports=Ro(ur);var mr="x-vercel-ip-city",Ae="x-vercel-ip-country",lr="x-real-ip",dr="x-vercel-ip-latitude",hr="x-vercel-ip-longitude",yr="x-vercel-ip-country-region",gr="x-vercel-id",br=127397;function U(e,r){return e.get(r)??void 0}function To(e,r){let t=U(e.headers,r);return t?decodeURIComponent(t):void 0}function Ao(e){let r=new RegExp("^[A-Z]{2}\$").test(e);if(!(!e||!r))return String.fromCodePoint(...e.split("").map(t=>br+t.charCodeAt(0)))}function vo(e){let r="headers"in e?e.headers:e;return U(r,lr)}function Io(e){return e?e.split(":")[0]:"dev1"}function Po(e){return{city:To(e,mr),country:U(e.headers,Ae),flag:Ao(U(e.headers,Ae)),countryRegion:U(e.headers,yr),region:Io(U(e.headers,gr)),latitude:U(e.headers,dr),longitude:U(e.headers,hr)}}});var Or=oe((Fn,Sr)=>{"use strict";var Ie=Object.defineProperty,No=Object.getOwnPropertyDescriptor,Co=Object.getOwnPropertyNames,jo=Object.prototype.hasOwnProperty,Uo=(e,r)=>{for(var t in r)Ie(e,t,{get:r[t],enumerable:!0})},Ko=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Co(r))!jo.call(e,n)&&n!==t&&Ie(e,n,{get:()=>r[n],enumerable:!(o=No(r,n))||o.enumerable});return e},Mo=e=>Ko(Ie({},"__esModule",{value:!0}),e),_r={};Uo(_r,{getEnv:()=>zo});Sr.exports=Mo(_r);var zo=(e=process.env)=>({VERCEL:b(e,"VERCEL"),CI:b(e,"CI"),VERCEL_ENV:b(e,"VERCEL_ENV"),VERCEL_URL:b(e,"VERCEL_URL"),VERCEL_BRANCH_URL:b(e,"VERCEL_BRANCH_URL"),VERCEL_PROJECT_PRODUCTION_URL:b(e,"VERCEL_PROJECT_PRODUCTION_URL"),VERCEL_REGION:b(e,"VERCEL_REGION"),VERCEL_DEPLOYMENT_ID:b(e,"VERCEL_DEPLOYMENT_ID"),VERCEL_SKEW_PROTECTION_ENABLED:b(e,"VERCEL_SKEW_PROTECTION_ENABLED"),VERCEL_AUTOMATION_BYPASS_SECRET:b(e,"VERCEL_AUTOMATION_BYPASS_SECRET"),VERCEL_GIT_PROVIDER:b(e,"VERCEL_GIT_PROVIDER"),VERCEL_GIT_REPO_SLUG:b(e,"VERCEL_GIT_REPO_SLUG"),VERCEL_GIT_REPO_OWNER:b(e,"VERCEL_GIT_REPO_OWNER"),VERCEL_GIT_REPO_ID:b(e,"VERCEL_GIT_REPO_ID"),VERCEL_GIT_COMMIT_REF:b(e,"VERCEL_GIT_COMMIT_REF"),VERCEL_GIT_COMMIT_SHA:b(e,"VERCEL_GIT_COMMIT_SHA"),VERCEL_GIT_COMMIT_MESSAGE:b(e,"VERCEL_GIT_COMMIT_MESSAGE"),VERCEL_GIT_COMMIT_AUTHOR_LOGIN:b(e,"VERCEL_GIT_COMMIT_AUTHOR_LOGIN"),VERCEL_GIT_COMMIT_AUTHOR_NAME:b(e,"VERCEL_GIT_COMMIT_AUTHOR_NAME"),VERCEL_GIT_PREVIOUS_SHA:b(e,"VERCEL_GIT_PREVIOUS_SHA"),VERCEL_GIT_PULL_REQUEST_ID:b(e,"VERCEL_GIT_PULL_REQUEST_ID")}),b=(e,r)=>{let t=e[r];return t===""?void 0:t}});var Ar=oe((\$n,Tr)=>{"use strict";var Pe=Object.defineProperty,Do=Object.getOwnPropertyDescriptor,ko=Object.getOwnPropertyNames,Lo=Object.prototype.hasOwnProperty,Wo=(e,r)=>{for(var t in r)Pe(e,t,{get:r[t],enumerable:!0})},Vo=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of ko(r))!Lo.call(e,n)&&n!==t&&Pe(e,n,{get:()=>r[n],enumerable:!(o=Do(r,n))||o.enumerable});return e},Jo=e=>Vo(Pe({},"__esModule",{value:!0}),e),wr={};Wo(wr,{SYMBOL_FOR_REQ_CONTEXT:()=>Rr,getContext:()=>Bo});Tr.exports=Jo(wr);var Rr=Symbol.for("@vercel/request-context");function Bo(){return globalThis[Rr]?.get?.()??{}}});var Pr=oe((qn,Ir)=>{"use strict";var Ne=Object.defineProperty,Ho=Object.getOwnPropertyDescriptor,Go=Object.getOwnPropertyNames,Fo=Object.prototype.hasOwnProperty,\$o=(e,r)=>{for(var t in r)Ne(e,t,{get:r[t],enumerable:!0})},qo=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of Go(r))!Fo.call(e,n)&&n!==t&&Ne(e,n,{get:()=>r[n],enumerable:!(o=Ho(r,n))||o.enumerable});return e},Yo=e=>qo(Ne({},"__esModule",{value:!0}),e),vr={};\$o(vr,{waitUntil:()=>Qo});Ir.exports=Yo(vr);var Xo=Ar(),Qo=e=>{if(e===null||typeof e!="object"||typeof e.then!="function")throw new TypeError(\`waitUntil can only be called with a Promise, got \${typeof e}\`);return(0,Xo.getContext)().waitUntil?.(e)}});var Ur=oe((Yn,jr)=>{"use strict";var Ce=Object.defineProperty,Zo=Object.getOwnPropertyDescriptor,en=Object.getOwnPropertyNames,rn=Object.prototype.hasOwnProperty,tn=(e,r)=>{for(var t in r)Ce(e,t,{get:r[t],enumerable:!0})},on=(e,r,t,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of en(r))!rn.call(e,n)&&n!==t&&Ce(e,n,{get:()=>r[n],enumerable:!(o=Zo(r,n))||o.enumerable});return e},nn=e=>on(Ce({},"__esModule",{value:!0}),e),Cr={};tn(Cr,{geolocation:()=>Nr.geolocation,getEnv:()=>sn.getEnv,ipAddress:()=>Nr.ipAddress,waitUntil:()=>an.waitUntil});jr.exports=nn(Cr);var Nr=xr(),sn=Or(),an=Pr()});var ee=Eo(Ur());var V=crypto,ue=e=>e instanceof CryptoKey;var J=new TextEncoder,K=new TextDecoder,Qn=2**32;function Kr(...e){let r=e.reduce((n,{length:s})=>n+s,0),t=new Uint8Array(r),o=0;for(let n of e)t.set(n,o),o+=n.length;return t}var cn=e=>{let r=atob(e),t=new Uint8Array(r.length);for(let o=0;o<r.length;o++)t[o]=r.charCodeAt(o);return t},N=e=>{let r=e;r instanceof Uint8Array&&(r=K.decode(r)),r=r.replace(/-/g,"+").replace(/_/g,"/").replace(/\\s/g,"");try{return cn(r)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};var E=class extends Error{constructor(r,t){super(r,t),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};E.code="ERR_JOSE_GENERIC";var v=class extends E{constructor(r,t,o="unspecified",n="unspecified"){super(r,{cause:{claim:o,reason:n,payload:t}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=o,this.reason=n,this.payload=t}};v.code="ERR_JWT_CLAIM_VALIDATION_FAILED";var B=class extends E{constructor(r,t,o="unspecified",n="unspecified"){super(r,{cause:{claim:o,reason:n,payload:t}}),this.code="ERR_JWT_EXPIRED",this.claim=o,this.reason=n,this.payload=t}};B.code="ERR_JWT_EXPIRED";var ne=class extends E{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}};ne.code="ERR_JOSE_ALG_NOT_ALLOWED";var _=class extends E{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}};_.code="ERR_JOSE_NOT_SUPPORTED";var je=class extends E{constructor(r="decryption operation failed",t){super(r,t),this.code="ERR_JWE_DECRYPTION_FAILED"}};je.code="ERR_JWE_DECRYPTION_FAILED";var Ue=class extends E{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}};Ue.code="ERR_JWE_INVALID";var g=class extends E{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}};g.code="ERR_JWS_INVALID";var k=class extends E{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}};k.code="ERR_JWT_INVALID";var Ke=class extends E{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}};Ke.code="ERR_JWK_INVALID";var H=class extends E{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}};H.code="ERR_JWKS_INVALID";var L=class extends E{constructor(r="no applicable key found in the JSON Web Key Set",t){super(r,t),this.code="ERR_JWKS_NO_MATCHING_KEY"}};L.code="ERR_JWKS_NO_MATCHING_KEY";var ie=class extends E{constructor(r="multiple matching keys found in the JSON Web Key Set",t){super(r,t),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}};ie.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";var se=class extends E{constructor(r="request timed out",t){super(r,t),this.code="ERR_JWKS_TIMEOUT"}};se.code="ERR_JWKS_TIMEOUT";var ae=class extends E{constructor(r="signature verification failed",t){super(r,t),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}};ae.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function C(e,r="algorithm.name"){return new TypeError(\`CryptoKey does not support this operation, its \${r} must be \${e}\`)}function me(e,r){return e.name===r}function Me(e){return parseInt(e.name.slice(4),10)}function fn(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function un(e,r){if(r.length&&!r.some(t=>e.usages.includes(t))){let t="CryptoKey does not support this operation, its usages must include ";if(r.length>2){let o=r.pop();t+=\`one of \${r.join(", ")}, or \${o}.\`}else r.length===2?t+=\`one of \${r[0]} or \${r[1]}.\`:t+=\`\${r[0]}.\`;throw new TypeError(t)}}function Mr(e,r,...t){switch(r){case"HS256":case"HS384":case"HS512":{if(!me(e.algorithm,"HMAC"))throw C("HMAC");let o=parseInt(r.slice(2),10);if(Me(e.algorithm.hash)!==o)throw C(\`SHA-\${o}\`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!me(e.algorithm,"RSASSA-PKCS1-v1_5"))throw C("RSASSA-PKCS1-v1_5");let o=parseInt(r.slice(2),10);if(Me(e.algorithm.hash)!==o)throw C(\`SHA-\${o}\`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!me(e.algorithm,"RSA-PSS"))throw C("RSA-PSS");let o=parseInt(r.slice(2),10);if(Me(e.algorithm.hash)!==o)throw C(\`SHA-\${o}\`,"algorithm.hash");break}case"EdDSA":{if(e.algorithm.name!=="Ed25519"&&e.algorithm.name!=="Ed448")throw C("Ed25519 or Ed448");break}case"ES256":case"ES384":case"ES512":{if(!me(e.algorithm,"ECDSA"))throw C("ECDSA");let o=fn(r);if(e.algorithm.namedCurve!==o)throw C(o,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}un(e,t)}function zr(e,r,...t){if(t=t.filter(Boolean),t.length>2){let o=t.pop();e+=\`one of type \${t.join(", ")}, or \${o}.\`}else t.length===2?e+=\`one of type \${t[0]} or \${t[1]}.\`:e+=\`of type \${t[0]}.\`;return r==null?e+=\` Received \${r}\`:typeof r=="function"&&r.name?e+=\` Received function \${r.name}\`:typeof r=="object"&&r!=null&&r.constructor?.name&&(e+=\` Received an instance of \${r.constructor.name}\`),e}var ze=(e,...r)=>zr("Key must be ",e,...r);function De(e,r,...t){return zr(\`Key for the \${e} algorithm must be \`,r,...t)}var ke=e=>ue(e)?!0:e?.[Symbol.toStringTag]==="KeyObject",G=["CryptoKey"];var mn=(...e)=>{let r=e.filter(Boolean);if(r.length===0||r.length===1)return!0;let t;for(let o of r){let n=Object.keys(o);if(!t||t.size===0){t=new Set(n);continue}for(let s of n){if(t.has(s))return!1;t.add(s)}}return!0},Dr=mn;function ln(e){return typeof e=="object"&&e!==null}function R(e){if(!ln(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let r=e;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}var kr=(e,r)=>{if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:t}=r.algorithm;if(typeof t!="number"||t<2048)throw new TypeError(\`\${e} requires key modulusLength to be 2048 bits or larger\`)}};function j(e){return R(e)&&typeof e.kty=="string"}function Lr(e){return e.kty!=="oct"&&typeof e.d=="string"}function Wr(e){return e.kty!=="oct"&&typeof e.d>"u"}function Vr(e){return j(e)&&e.kty==="oct"&&typeof e.k=="string"}function hn(e){let r,t;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:\`SHA-\${e.alg.slice(-3)}\`},t=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:\`SHA-\${e.alg.slice(-3)}\`},t=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":r={name:"RSA-OAEP",hash:\`SHA-\${parseInt(e.alg.slice(-3),10)||1}\`},t=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":r={name:"ECDSA",namedCurve:"P-256"},t=e.d?["sign"]:["verify"];break;case"ES384":r={name:"ECDSA",namedCurve:"P-384"},t=e.d?["sign"]:["verify"];break;case"ES512":r={name:"ECDSA",namedCurve:"P-521"},t=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:"ECDH",namedCurve:e.crv},t=e.d?["deriveBits"]:[];break;default:throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"EdDSA":r={name:e.crv},t=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:e.crv},t=e.d?["deriveBits"]:[];break;default:throw new _('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new _('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:r,keyUsages:t}}var yn=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:r,keyUsages:t}=hn(e),o=[r,e.ext??!1,e.key_ops??t],n={...e};return delete n.alg,delete n.use,V.subtle.importKey("jwk",n,...o)},le=yn;var Jr=e=>N(e),F,\$,Br=e=>e?.[Symbol.toStringTag]==="KeyObject",de=async(e,r,t,o,n=!1)=>{let s=e.get(r);if(s?.[o])return s[o];let c=await le({...t,alg:o});return n&&Object.freeze(r),s?s[o]=c:e.set(r,{[o]:c}),c},gn=(e,r)=>{if(Br(e)){let t=e.export({format:"jwk"});return delete t.d,delete t.dp,delete t.dq,delete t.p,delete t.q,delete t.qi,t.k?Jr(t.k):(\$||(\$=new WeakMap),de(\$,e,t,r))}return j(e)?e.k?N(e.k):(\$||(\$=new WeakMap),de(\$,e,e,r,!0)):e},bn=(e,r)=>{if(Br(e)){let t=e.export({format:"jwk"});return t.k?Jr(t.k):(F||(F=new WeakMap),de(F,e,t,r))}return j(e)?e.k?N(e.k):(F||(F=new WeakMap),de(F,e,e,r,!0)):e},Le={normalizePublicKey:gn,normalizePrivateKey:bn};async function he(e,r){if(!R(e))throw new TypeError("JWK must be an object");switch(r||(r=e.alg),e.kty){case"oct":if(typeof e.k!="string"||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return N(e.k);case"RSA":if(e.oth!==void 0)throw new _('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return le({...e,alg:r});default:throw new _('Unsupported "kty" (Key Type) Parameter value')}}var q=e=>e?.[Symbol.toStringTag],We=(e,r,t)=>{if(r.use!==void 0&&r.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(r.key_ops!==void 0&&r.key_ops.includes?.(t)!==!0)throw new TypeError(\`Invalid key for this operation, when present its key_ops must include \${t}\`);if(r.alg!==void 0&&r.alg!==e)throw new TypeError(\`Invalid key for this operation, when present its alg must be \${e}\`);return!0},En=(e,r,t,o)=>{if(!(r instanceof Uint8Array)){if(o&&j(r)){if(Vr(r)&&We(e,r,t))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!ke(r))throw new TypeError(De(e,r,...G,"Uint8Array",o?"JSON Web Key":null));if(r.type!=="secret")throw new TypeError(\`\${q(r)} instances for symmetric algorithms must be of type "secret"\`)}},xn=(e,r,t,o)=>{if(o&&j(r))switch(t){case"sign":if(Lr(r)&&We(e,r,t))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(Wr(r)&&We(e,r,t))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!ke(r))throw new TypeError(De(e,r,...G,o?"JSON Web Key":null));if(r.type==="secret")throw new TypeError(\`\${q(r)} instances for asymmetric algorithms must not be of type "secret"\`);if(t==="sign"&&r.type==="public")throw new TypeError(\`\${q(r)} instances for asymmetric algorithm signing must be of type "private"\`);if(t==="decrypt"&&r.type==="public")throw new TypeError(\`\${q(r)} instances for asymmetric algorithm decryption must be of type "private"\`);if(r.algorithm&&t==="verify"&&r.type==="private")throw new TypeError(\`\${q(r)} instances for asymmetric algorithm verifying must be of type "public"\`);if(r.algorithm&&t==="encrypt"&&r.type==="private")throw new TypeError(\`\${q(r)} instances for asymmetric algorithm encryption must be of type "public"\`)};function Hr(e,r,t,o){r.startsWith("HS")||r==="dir"||r.startsWith("PBES2")||/^A\\d{3}(?:GCM)?KW\$/.test(r)?En(r,t,o,e):xn(r,t,o,e)}var wi=Hr.bind(void 0,!1),Ve=Hr.bind(void 0,!0);function _n(e,r,t,o,n){if(n.crit!==void 0&&o?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!o||o.crit===void 0)return new Set;if(!Array.isArray(o.crit)||o.crit.length===0||o.crit.some(c=>typeof c!="string"||c.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let s;t!==void 0?s=new Map([...Object.entries(t),...r.entries()]):s=r;for(let c of o.crit){if(!s.has(c))throw new _(\`Extension Header Parameter "\${c}" is not recognized\`);if(n[c]===void 0)throw new e(\`Extension Header Parameter "\${c}" is missing\`);if(s.get(c)&&o[c]===void 0)throw new e(\`Extension Header Parameter "\${c}" MUST be integrity protected\`)}return new Set(o.crit)}var Gr=_n;var Sn=(e,r)=>{if(r!==void 0&&(!Array.isArray(r)||r.some(t=>typeof t!="string")))throw new TypeError(\`"\${e}" option must be an array of strings\`);if(r)return new Set(r)},Fr=Sn;function Je(e,r){let t=\`SHA-\${e.slice(-3)}\`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:t,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:t,name:"RSA-PSS",saltLength:e.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:t,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:t,name:"ECDSA",namedCurve:r.namedCurve};case"EdDSA":return{name:r.name};default:throw new _(\`alg \${e} is not supported either by JOSE or your javascript runtime\`)}}async function Be(e,r,t){if(t==="sign"&&(r=await Le.normalizePrivateKey(r,e)),t==="verify"&&(r=await Le.normalizePublicKey(r,e)),ue(r))return Mr(r,e,t),r;if(r instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(ze(r,...G));return V.subtle.importKey("raw",r,{hash:\`SHA-\${e.slice(-3)}\`,name:"HMAC"},!1,[t])}throw new TypeError(ze(r,...G,"Uint8Array","JSON Web Key"))}var On=async(e,r,t,o)=>{let n=await Be(e,r,"verify");kr(e,n);let s=Je(e,n.algorithm);try{return await V.subtle.verify(s,n,t,o)}catch{return!1}},\$r=On;async function qr(e,r,t){if(!R(e))throw new g("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new g('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new g("JWS Protected Header incorrect type");if(e.payload===void 0)throw new g("JWS Payload missing");if(typeof e.signature!="string")throw new g("JWS Signature missing or incorrect type");if(e.header!==void 0&&!R(e.header))throw new g("JWS Unprotected Header incorrect type");let o={};if(e.protected)try{let Re=N(e.protected);o=JSON.parse(K.decode(Re))}catch{throw new g("JWS Protected Header is invalid")}if(!Dr(o,e.header))throw new g("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let n={...o,...e.header},s=Gr(g,new Map([["b64",!0]]),t?.crit,o,n),c=!0;if(s.has("b64")&&(c=o.b64,typeof c!="boolean"))throw new g('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:a}=n;if(typeof a!="string"||!a)throw new g('JWS "alg" (Algorithm) Header Parameter missing or invalid');let f=t&&Fr("algorithms",t.algorithms);if(f&&!f.has(a))throw new ne('"alg" (Algorithm) Header Parameter value not allowed');if(c){if(typeof e.payload!="string")throw new g("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new g("JWS Payload must be a string or an Uint8Array instance");let p=!1;typeof r=="function"?(r=await r(o,e),p=!0,Ve(a,r,"verify"),j(r)&&(r=await he(r,a))):Ve(a,r,"verify");let m=Kr(J.encode(e.protected??""),J.encode("."),typeof e.payload=="string"?J.encode(e.payload):e.payload),y;try{y=N(e.signature)}catch{throw new g("Failed to base64url decode the signature")}if(!await \$r(a,r,y,m))throw new ae;let A;if(c)try{A=N(e.payload)}catch{throw new g("Failed to base64url decode the payload")}else typeof e.payload=="string"?A=J.encode(e.payload):A=e.payload;let w={payload:A};return e.protected!==void 0&&(w.protectedHeader=o),e.header!==void 0&&(w.unprotectedHeader=e.header),p?{...w,key:r}:w}async function Yr(e,r,t){if(e instanceof Uint8Array&&(e=K.decode(e)),typeof e!="string")throw new g("Compact JWS must be a string or Uint8Array");let{0:o,1:n,2:s,length:c}=e.split(".");if(c!==3)throw new g("Invalid Compact JWS");let a=await qr({payload:n,protected:o,signature:s},r,t),f={payload:a.payload,protectedHeader:a.protectedHeader};return typeof r=="function"?{...f,key:a.key}:f}var Xr=e=>Math.floor(e.getTime()/1e3);var wn=/^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?\$/i,He=e=>{let r=wn.exec(e);if(!r||r[4]&&r[1])throw new TypeError("Invalid time period format");let t=parseFloat(r[2]),o=r[3].toLowerCase(),n;switch(o){case"sec":case"secs":case"second":case"seconds":case"s":n=Math.round(t);break;case"minute":case"minutes":case"min":case"mins":case"m":n=Math.round(t*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":n=Math.round(t*3600);break;case"day":case"days":case"d":n=Math.round(t*86400);break;case"week":case"weeks":case"w":n=Math.round(t*604800);break;default:n=Math.round(t*31557600);break}return r[1]==="-"||r[4]==="ago"?-n:n};var Qr=e=>e.toLowerCase().replace(/^application\\//,""),Rn=(e,r)=>typeof e=="string"?r.includes(e):Array.isArray(e)?r.some(Set.prototype.has.bind(new Set(e))):!1,Zr=(e,r,t={})=>{let o;try{o=JSON.parse(K.decode(r))}catch{}if(!R(o))throw new k("JWT Claims Set must be a top-level JSON object");let{typ:n}=t;if(n&&(typeof e.typ!="string"||Qr(e.typ)!==Qr(n)))throw new v('unexpected "typ" JWT header value',o,"typ","check_failed");let{requiredClaims:s=[],issuer:c,subject:a,audience:f,maxTokenAge:p}=t,m=[...s];p!==void 0&&m.push("iat"),f!==void 0&&m.push("aud"),a!==void 0&&m.push("sub"),c!==void 0&&m.push("iss");for(let w of new Set(m.reverse()))if(!(w in o))throw new v(\`missing required "\${w}" claim\`,o,w,"missing");if(c&&!(Array.isArray(c)?c:[c]).includes(o.iss))throw new v('unexpected "iss" claim value',o,"iss","check_failed");if(a&&o.sub!==a)throw new v('unexpected "sub" claim value',o,"sub","check_failed");if(f&&!Rn(o.aud,typeof f=="string"?[f]:f))throw new v('unexpected "aud" claim value',o,"aud","check_failed");let y;switch(typeof t.clockTolerance){case"string":y=He(t.clockTolerance);break;case"number":y=t.clockTolerance;break;case"undefined":y=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:S}=t,A=Xr(S||new Date);if((o.iat!==void 0||p)&&typeof o.iat!="number")throw new v('"iat" claim must be a number',o,"iat","invalid");if(o.nbf!==void 0){if(typeof o.nbf!="number")throw new v('"nbf" claim must be a number',o,"nbf","invalid");if(o.nbf>A+y)throw new v('"nbf" claim timestamp check failed',o,"nbf","check_failed")}if(o.exp!==void 0){if(typeof o.exp!="number")throw new v('"exp" claim must be a number',o,"exp","invalid");if(o.exp<=A-y)throw new B('"exp" claim timestamp check failed',o,"exp","check_failed")}if(p){let w=A-o.iat,Re=typeof p=="number"?p:He(p);if(w-y>Re)throw new B('"iat" claim timestamp check failed (too far in the past)',o,"iat","check_failed");if(w<0-y)throw new v('"iat" claim timestamp check failed (it should be in the past)',o,"iat","check_failed")}return o};async function Ge(e,r,t){let o=await Yr(e,r,t);if(o.protectedHeader.crit?.includes("b64")&&o.protectedHeader.b64===!1)throw new k("JWTs MUST NOT use unencoded payload");let s={payload:Zr(o.protectedHeader,o.payload,t),protectedHeader:o.protectedHeader};return typeof r=="function"?{...s,key:o.key}:s}function Tn(e){switch(typeof e=="string"&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new _('Unsupported "alg" value for a JSON Web Key Set')}}function An(e){return e&&typeof e=="object"&&Array.isArray(e.keys)&&e.keys.every(vn)}function vn(e){return R(e)}function rt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}var Fe=class{constructor(r){if(this._cached=new WeakMap,!An(r))throw new H("JSON Web Key Set malformed");this._jwks=rt(r)}async getKey(r,t){let{alg:o,kid:n}={...r,...t?.header},s=Tn(o),c=this._jwks.keys.filter(p=>{let m=s===p.kty;if(m&&typeof n=="string"&&(m=n===p.kid),m&&typeof p.alg=="string"&&(m=o===p.alg),m&&typeof p.use=="string"&&(m=p.use==="sig"),m&&Array.isArray(p.key_ops)&&(m=p.key_ops.includes("verify")),m&&o==="EdDSA"&&(m=p.crv==="Ed25519"||p.crv==="Ed448"),m)switch(o){case"ES256":m=p.crv==="P-256";break;case"ES256K":m=p.crv==="secp256k1";break;case"ES384":m=p.crv==="P-384";break;case"ES512":m=p.crv==="P-521";break}return m}),{0:a,length:f}=c;if(f===0)throw new L;if(f!==1){let p=new ie,{_cached:m}=this;throw p[Symbol.asyncIterator]=async function*(){for(let y of c)try{yield await et(m,y,o)}catch{}},p}return et(this._cached,a,o)}};async function et(e,r,t){let o=e.get(r)||e.set(r,{}).get(r);if(o[t]===void 0){let n=await he({...r,ext:!0},t);if(n instanceof Uint8Array||n.type!=="public")throw new H("JSON Web Key Set members must be public keys");o[t]=n}return o[t]}function \$e(e){let r=new Fe(e),t=async(o,n)=>r.getKey(o,n);return Object.defineProperties(t,{jwks:{value:()=>rt(r._jwks),enumerable:!0,configurable:!1,writable:!1}}),t}var In=async(e,r,t)=>{let o,n,s=!1;typeof AbortController=="function"&&(o=new AbortController,n=setTimeout(()=>{s=!0,o.abort()},r));let c=await fetch(e.href,{signal:o?o.signal:void 0,redirect:"manual",headers:t.headers}).catch(a=>{throw s?new se:a});if(n!==void 0&&clearTimeout(n),c.status!==200)throw new E("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await c.json()}catch{throw new E("Failed to parse the JSON Web Key Set HTTP response as JSON")}},tt=In;function Pn(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}var qe;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(qe="jose/v5.9.6");var ye=Symbol();function Nn(e,r){return!(typeof e!="object"||e===null||!("uat"in e)||typeof e.uat!="number"||Date.now()-e.uat>=r||!("jwks"in e)||!R(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,R))}var Ye=class{constructor(r,t){if(!(r instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(r.href),this._options={agent:t?.agent,headers:t?.headers},this._timeoutDuration=typeof t?.timeoutDuration=="number"?t?.timeoutDuration:5e3,this._cooldownDuration=typeof t?.cooldownDuration=="number"?t?.cooldownDuration:3e4,this._cacheMaxAge=typeof t?.cacheMaxAge=="number"?t?.cacheMaxAge:6e5,t?.[ye]!==void 0&&(this._cache=t?.[ye],Nn(t?.[ye],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=\$e(this._cache.jwks)))}coolingDown(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cooldownDuration:!1}fresh(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cacheMaxAge:!1}async getKey(r,t){(!this._local||!this.fresh())&&await this.reload();try{return await this._local(r,t)}catch(o){if(o instanceof L&&this.coolingDown()===!1)return await this.reload(),this._local(r,t);throw o}}async reload(){this._pendingFetch&&Pn()&&(this._pendingFetch=void 0);let r=new Headers(this._options.headers);qe&&!r.has("User-Agent")&&(r.set("User-Agent",qe),this._options.headers=Object.fromEntries(r.entries())),this._pendingFetch||(this._pendingFetch=tt(this._url,this._timeoutDuration,this._options).then(t=>{this._local=\$e(t),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=t),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(t=>{throw this._pendingFetch=void 0,t})),await this._pendingFetch}};function Xe(e,r){let t=new Ye(e,r),o=async(n,s)=>t.getKey(n,s);return Object.defineProperties(o,{coolingDown:{get:()=>t.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>t.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>t.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!t._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>t._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),o}var Qe,Ze,er,rr,tr,Cn=typeof window<"u"&&typeof window.document<"u",jn=typeof self=="object"&&typeof self?.importScripts=="function"&&(((Qe=self.constructor)===null||Qe===void 0?void 0:Qe.name)==="DedicatedWorkerGlobalScope"||((Ze=self.constructor)===null||Ze===void 0?void 0:Ze.name)==="ServiceWorkerGlobalScope"||((er=self.constructor)===null||er===void 0?void 0:er.name)==="SharedWorkerGlobalScope"),ot=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",nt=typeof Bun<"u"&&typeof Bun.version<"u",Un=typeof process<"u"&&!!process.version&&!!(!((rr=process.versions)===null||rr===void 0)&&rr.node)&&!ot&&!nt,Kn=typeof navigator<"u"&&navigator?.product==="ReactNative",Mn=typeof globalThis<"u"&&((tr=globalThis?.navigator)===null||tr===void 0?void 0:tr.userAgent)==="Cloudflare-Workers",or=zn();function zn(){return Cn?{type:"browser",version:window.navigator.userAgent}:Mn?{type:"workerd"}:jn?{type:"web-worker"}:ot?{type:"deno",version:Deno.version.deno}:nt?{type:"bun",version:Bun.version}:Un?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:Kn?{type:"react-native"}:{type:"unknown"}}var i={};go(i,{JsonError:()=>Y,ParseError:()=>X,any:()=>Et,bigint:()=>st,boolean:()=>xt,booleanLiteral:()=>bt,date:()=>at,discriminant:()=>It,enum_:()=>be,getObjectLikeUtils:()=>P,getObjectUtils:()=>W,getSchemaUtils:()=>h,isProperty:()=>z,lazy:()=>ct,lazyObject:()=>ht,list:()=>xe,number:()=>_t,object:()=>Ee,objectWithoutOptionalProperties:()=>dt,optional:()=>nr,property:()=>ft,record:()=>Rt,set:()=>Tt,string:()=>St,stringLiteral:()=>gt,transform:()=>ir,undiscriminatedUnion:()=>vt,union:()=>Nt,unknown:()=>Ot,withParsedProperties:()=>ar});var l={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function d(e,r){return\`Expected \${r}. Received \${Dn(e)}.\`}function Dn(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return\`"\${e}"\`;case"bigint":case"number":case"boolean":case"undefined":return\`\${e}\`}return typeof e}function x(e){return Object.assign(Object.assign({},e),{json:it(e.json),parse:it(e.parse)})}function it(e){return(r,t)=>{let o=e(r,t),{skipValidation:n=!1}=t??{};return!o.ok&&n?(console.warn(["Failed to validate.",...o.errors.map(s=>" - "+(s.path.length>0?\`\${s.path.join(".")}: \${s.message}\`:s.message))].join(\`\n\`)),{ok:!0,value:r}):o}}function ge(e){return e.path.length===0?e.message:\`\${e.path.join(" -> ")}: \${e.message}\`}var Y=class e extends Error{constructor(r){super(r.map(ge).join("; ")),this.errors=r,Object.setPrototypeOf(this,e.prototype)}};var X=class e extends Error{constructor(r){super(r.map(ge).join("; ")),this.errors=r,Object.setPrototypeOf(this,e.prototype)}};function h(e){return{optional:()=>nr(e),transform:r=>ir(e,r),parseOrThrow:(r,t)=>{let o=e.parse(r,t);if(o.ok)return o.value;throw new X(o.errors)},jsonOrThrow:(r,t)=>{let o=e.json(r,t);if(o.ok)return o.value;throw new Y(o.errors)}}}function nr(e){let r={parse:(t,o)=>t==null?{ok:!0,value:void 0}:e.parse(t,o),json:(t,o)=>o?.omitUndefined&&t===void 0?{ok:!0,value:void 0}:t==null?{ok:!0,value:null}:e.json(t,o),getType:()=>l.OPTIONAL};return Object.assign(Object.assign({},r),h(r))}function ir(e,r){let t={parse:(o,n)=>{let s=e.parse(o,n);return s.ok?{ok:!0,value:r.transform(s.value)}:s},json:(o,n)=>{let s=r.untransform(o);return e.json(s,n)},getType:()=>e.getType()};return Object.assign(Object.assign({},t),h(t))}function st(){let e={parse:(r,{breadcrumbsPrefix:t=[]}={})=>typeof r!="string"?{ok:!1,errors:[{path:t,message:d(r,"string")}]}:{ok:!0,value:BigInt(r)},json:(r,{breadcrumbsPrefix:t=[]}={})=>typeof r=="bigint"?{ok:!0,value:r.toString()}:{ok:!1,errors:[{path:t,message:d(r,"bigint")}]},getType:()=>l.BIGINT};return Object.assign(Object.assign({},x(e)),h(e))}var kn=/^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24:?00)([.,]\\d+(?!:))?)?(\\17[0-5]\\d([.,]\\d+)?)?([zZ]|([+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?\$/;function at(){let e={parse:(r,{breadcrumbsPrefix:t=[]}={})=>typeof r!="string"?{ok:!1,errors:[{path:t,message:d(r,"string")}]}:kn.test(r)?{ok:!0,value:new Date(r)}:{ok:!1,errors:[{path:t,message:d(r,"ISO 8601 date string")}]},json:(r,{breadcrumbsPrefix:t=[]}={})=>r instanceof Date?{ok:!0,value:r.toISOString()}:{ok:!1,errors:[{path:t,message:d(r,"Date object")}]},getType:()=>l.DATE};return Object.assign(Object.assign({},x(e)),h(e))}function O(e,r){return()=>{let t={parse:r,json:r,getType:()=>e};return Object.assign(Object.assign({},x(t)),h(t))}}function be(e){let r=new Set(e);return O(l.ENUM,(o,{allowUnrecognizedEnumValues:n,breadcrumbsPrefix:s=[]}={})=>typeof o!="string"?{ok:!1,errors:[{path:s,message:d(o,"string")}]}:!r.has(o)&&!n?{ok:!1,errors:[{path:s,message:d(o,"enum")}]}:{ok:!0,value:o})()}function ct(e){let r=sr(e);return Object.assign(Object.assign({},r),h(r))}function sr(e){return{parse:(r,t)=>Q(e).parse(r,t),json:(r,t)=>Q(e).json(r,t),getType:()=>Q(e).getType()}}function Q(e){let r=e;return r.__zurg_memoized==null&&(r.__zurg_memoized=e()),r.__zurg_memoized}function ce(e){return Object.entries(e)}function pe(e,r){let t=new Set(r);return Object.entries(e).reduce((o,[n,s])=>(t.has(n)&&(o[n]=s),o),{})}function M(e){if(typeof e!="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;let r=e;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function fe(e){return Object.keys(e)}function pt(e,r){let t=[],o=[];for(let n of e)r(n)?t.push(n):o.push(n);return[t,o]}function P(e){return{withParsedProperties:r=>ar(e,r)}}function ar(e,r){let t={parse:(o,n)=>{let s=e.parse(o,n);if(!s.ok)return s;let c=Object.entries(r).reduce((a,[f,p])=>Object.assign(Object.assign({},a),{[f]:typeof p=="function"?p(s.value):p}),{});return{ok:!0,value:Object.assign(Object.assign({},s.value),c)}},json:(o,n)=>{var s;if(!M(o))return{ok:!1,errors:[{path:(s=n?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],message:d(o,"object")}]};let c=new Set(Object.keys(r)),a=pe(o,Object.keys(o).filter(f=>!c.has(f)));return e.json(a,n)},getType:()=>e.getType()};return Object.assign(Object.assign(Object.assign({},t),h(t)),P(t))}function ft(e,r){return{rawKey:e,valueSchema:r,isProperty:!0}}function z(e){return e.isProperty}function Ee(e){let r={_getRawProperties:()=>Object.entries(e).map(([t,o])=>z(o)?o.rawKey:t),_getParsedProperties:()=>fe(e),parse:(t,o)=>{let n={},s=[];for(let[c,a]of ce(e)){let f=z(a)?a.rawKey:c,p=z(a)?a.valueSchema:a,m={rawKey:f,parsedKey:c,valueSchema:p};n[f]=m,lt(p)&&s.push(f)}return ut({value:t,requiredKeys:s,getProperty:c=>{let a=n[c];if(a!=null)return{transformedKey:a.parsedKey,transform:f=>{var p;return a.valueSchema.parse(f,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(p=o?.breadcrumbsPrefix)!==null&&p!==void 0?p:[],c]}))}}},unrecognizedObjectKeys:o?.unrecognizedObjectKeys,skipValidation:o?.skipValidation,breadcrumbsPrefix:o?.breadcrumbsPrefix,omitUndefined:o?.omitUndefined})},json:(t,o)=>{let n=[];for(let[s,c]of ce(e)){let a=z(c)?c.valueSchema:c;lt(a)&&n.push(s)}return ut({value:t,requiredKeys:n,getProperty:s=>{let c=e[s];if(c!=null)return z(c)?{transformedKey:c.rawKey,transform:a=>{var f;return c.valueSchema.json(a,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(f=o?.breadcrumbsPrefix)!==null&&f!==void 0?f:[],s]}))}}:{transformedKey:s,transform:a=>{var f;return c.json(a,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(f=o?.breadcrumbsPrefix)!==null&&f!==void 0?f:[],s]}))}}},unrecognizedObjectKeys:o?.unrecognizedObjectKeys,skipValidation:o?.skipValidation,breadcrumbsPrefix:o?.breadcrumbsPrefix,omitUndefined:o?.omitUndefined})},getType:()=>l.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},x(r)),h(r)),P(r)),W(r))}function ut({value:e,requiredKeys:r,getProperty:t,unrecognizedObjectKeys:o="fail",skipValidation:n=!1,breadcrumbsPrefix:s=[]}){if(!M(e))return{ok:!1,errors:[{path:s,message:d(e,"object")}]};let c=new Set(r),a=[],f={};for(let[p,m]of Object.entries(e)){let y=t(p);if(y!=null){c.delete(p);let S=y.transform(m);S.ok?f[y.transformedKey]=S.value:(f[p]=m,a.push(...S.errors))}else switch(o){case"fail":a.push({path:[...s,p],message:\`Unexpected key "\${p}"\`});break;case"strip":break;case"passthrough":f[p]=m;break}}return a.push(...r.filter(p=>c.has(p)).map(p=>({path:s,message:\`Missing required key "\${p}"\`}))),a.length===0||n?{ok:!0,value:f}:{ok:!1,errors:a}}function W(e){return{extend:r=>{let t={_getParsedProperties:()=>[...e._getParsedProperties(),...r._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...r._getRawProperties()],parse:(o,n)=>mt({extensionKeys:r._getRawProperties(),value:o,transformBase:s=>e.parse(s,n),transformExtension:s=>r.parse(s,n)}),json:(o,n)=>mt({extensionKeys:r._getParsedProperties(),value:o,transformBase:s=>e.json(s,n),transformExtension:s=>r.json(s,n)}),getType:()=>l.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},t),h(t)),P(t)),W(t))},passthrough:()=>{let r={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(t,o)=>{let n=e.parse(t,Object.assign(Object.assign({},o),{unrecognizedObjectKeys:"passthrough"}));return n.ok?{ok:!0,value:Object.assign(Object.assign({},t),n.value)}:n},json:(t,o)=>{let n=e.json(t,Object.assign(Object.assign({},o),{unrecognizedObjectKeys:"passthrough"}));return n.ok?{ok:!0,value:Object.assign(Object.assign({},t),n.value)}:n},getType:()=>l.OBJECT};return Object.assign(Object.assign(Object.assign(Object.assign({},r),h(r)),P(r)),W(r))}}}function mt({extensionKeys:e,value:r,transformBase:t,transformExtension:o}){let n=new Set(e),[s,c]=pt(fe(r),p=>n.has(p)),a=t(pe(r,c)),f=o(pe(r,s));return a.ok&&f.ok?{ok:!0,value:Object.assign(Object.assign({},a.value),f.value)}:{ok:!1,errors:[...a.ok?[]:a.errors,...f.ok?[]:f.errors]}}function lt(e){return!Ln(e)}function Ln(e){switch(e.getType()){case l.ANY:case l.UNKNOWN:case l.OPTIONAL:return!0;default:return!1}}function dt(e){return Ee(e)}function ht(e){let r=Object.assign(Object.assign({},sr(e)),{_getRawProperties:()=>Q(e)._getRawProperties(),_getParsedProperties:()=>Q(e)._getParsedProperties()});return Object.assign(Object.assign(Object.assign(Object.assign({},r),h(r)),P(r)),W(r))}function xe(e){let r={parse:(t,o)=>yt(t,(n,s)=>{var c;return e.parse(n,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(c=o?.breadcrumbsPrefix)!==null&&c!==void 0?c:[],\`[\${s}]\`]}))}),json:(t,o)=>yt(t,(n,s)=>{var c;return e.json(n,Object.assign(Object.assign({},o),{breadcrumbsPrefix:[...(c=o?.breadcrumbsPrefix)!==null&&c!==void 0?c:[],\`[\${s}]\`]}))}),getType:()=>l.LIST};return Object.assign(Object.assign({},x(r)),h(r))}function yt(e,r){return Array.isArray(e)?e.map((o,n)=>r(o,n)).reduce((o,n)=>{if(o.ok&&n.ok)return{ok:!0,value:[...o.value,n.value]};let s=[];return o.ok||s.push(...o.errors),n.ok||s.push(...n.errors),{ok:!1,errors:s}},{ok:!0,value:[]}):{ok:!1,errors:[{message:d(e,"list"),path:[]}]}}function gt(e){return O(l.STRING_LITERAL,(t,{breadcrumbsPrefix:o=[]}={})=>t===e?{ok:!0,value:e}:{ok:!1,errors:[{path:o,message:d(t,\`"\${e}"\`)}]})()}function bt(e){return O(l.BOOLEAN_LITERAL,(t,{breadcrumbsPrefix:o=[]}={})=>t===e?{ok:!0,value:e}:{ok:!1,errors:[{path:o,message:d(t,\`\${e.toString()}\`)}]})()}var Et=O(l.ANY,e=>({ok:!0,value:e}));var xt=O(l.BOOLEAN,(e,{breadcrumbsPrefix:r=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:r,message:d(e,"boolean")}]});var _t=O(l.NUMBER,(e,{breadcrumbsPrefix:r=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:r,message:d(e,"number")}]});var St=O(l.STRING,(e,{breadcrumbsPrefix:r=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:r,message:d(e,"string")}]});var Ot=O(l.UNKNOWN,e=>({ok:!0,value:e}));function Rt(e,r){let t={parse:(o,n)=>wt({value:o,isKeyNumeric:e.getType()===l.NUMBER,transformKey:s=>{var c;return e.parse(s,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(c=n?.breadcrumbsPrefix)!==null&&c!==void 0?c:[],\`\${s} (key)\`]}))},transformValue:(s,c)=>{var a;return r.parse(s,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],\`\${c}\`]}))},breadcrumbsPrefix:n?.breadcrumbsPrefix}),json:(o,n)=>wt({value:o,isKeyNumeric:e.getType()===l.NUMBER,transformKey:s=>{var c;return e.json(s,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(c=n?.breadcrumbsPrefix)!==null&&c!==void 0?c:[],\`\${s} (key)\`]}))},transformValue:(s,c)=>{var a;return r.json(s,Object.assign(Object.assign({},n),{breadcrumbsPrefix:[...(a=n?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],\`\${c}\`]}))},breadcrumbsPrefix:n?.breadcrumbsPrefix}),getType:()=>l.RECORD};return Object.assign(Object.assign({},x(t)),h(t))}function wt({value:e,isKeyNumeric:r,transformKey:t,transformValue:o,breadcrumbsPrefix:n=[]}){return M(e)?ce(e).reduce((s,[c,a])=>{if(a==null)return s;let f=s,p=c;if(r){let A=c.length>0?Number(c):NaN;isNaN(A)||(p=A)}let m=t(p),y=o(a,p);if(f.ok&&m.ok&&y.ok)return{ok:!0,value:Object.assign(Object.assign({},f.value),{[m.value]:y.value})};let S=[];return f.ok||S.push(...f.errors),m.ok||S.push(...m.errors),y.ok||S.push(...y.errors),{ok:!1,errors:S}},{ok:!0,value:{}}):{ok:!1,errors:[{path:n,message:d(e,"object")}]}}function Tt(e){let r=xe(e),t={parse:(o,n)=>{let s=r.parse(o,n);return s.ok?{ok:!0,value:new Set(s.value)}:s},json:(o,n)=>{var s;return o instanceof Set?r.json([...o],n):{ok:!1,errors:[{path:(s=n?.breadcrumbsPrefix)!==null&&s!==void 0?s:[],message:d(o,"Set")}]}},getType:()=>l.SET};return Object.assign(Object.assign({},x(t)),h(t))}function vt(e){let r={parse:(t,o)=>At((n,s)=>n.parse(t,s),e,o),json:(t,o)=>At((n,s)=>n.json(t,s),e,o),getType:()=>l.UNDISCRIMINATED_UNION};return Object.assign(Object.assign({},x(r)),h(r))}function At(e,r,t){let o=[];for(let[n,s]of r.entries()){let c=e(s,Object.assign(Object.assign({},t),{skipValidation:!1}));if(c.ok)return c;for(let a of c.errors)o.push({path:a.path,message:\`[Variant \${n}] \${a.message}\`})}return{ok:!1,errors:o}}function It(e,r){return{parsedDiscriminant:e,rawDiscriminant:r}}var Wn=function(e,r){var t={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&r.indexOf(o)<0&&(t[o]=e[o]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,o=Object.getOwnPropertySymbols(e);n<o.length;n++)r.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(t[o[n]]=e[o[n]]);return t};function Nt(e,r){let t=typeof e=="string"?e:e.rawDiscriminant,o=typeof e=="string"?e:e.parsedDiscriminant,n=be(fe(r)),s={parse:(c,a)=>Pt({value:c,discriminant:t,transformedDiscriminant:o,transformDiscriminantValue:f=>{var p;return n.parse(f,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(p=a?.breadcrumbsPrefix)!==null&&p!==void 0?p:[],t]})},getAdditionalPropertiesSchema:f=>r[f],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,p)=>p.parse(f,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),json:(c,a)=>Pt({value:c,discriminant:o,transformedDiscriminant:t,transformDiscriminantValue:f=>{var p;return n.json(f,{allowUnrecognizedEnumValues:a?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...(p=a?.breadcrumbsPrefix)!==null&&p!==void 0?p:[],o]})},getAdditionalPropertiesSchema:f=>r[f],allowUnrecognizedUnionMembers:a?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(f,p)=>p.json(f,a),breadcrumbsPrefix:a?.breadcrumbsPrefix}),getType:()=>l.UNION};return Object.assign(Object.assign(Object.assign({},x(s)),h(s)),P(s))}function Pt({value:e,discriminant:r,transformedDiscriminant:t,transformDiscriminantValue:o,getAdditionalPropertiesSchema:n,allowUnrecognizedUnionMembers:s=!1,transformAdditionalProperties:c,breadcrumbsPrefix:a=[]}){if(!M(e))return{ok:!1,errors:[{path:a,message:d(e,"object")}]};let f=e,p=r,m=f[p],y=Wn(f,[typeof p=="symbol"?p:p+""]);if(m==null)return{ok:!1,errors:[{path:a,message:\`Missing discriminant ("\${r}")\`}]};let S=o(m);if(!S.ok)return{ok:!1,errors:S.errors};let A=n(S.value);if(A==null)return s?{ok:!0,value:Object.assign({[t]:S.value},y)}:{ok:!1,errors:[{path:[...a,r],message:"Unexpected discriminant value"}]};let w=c(y,A);return w.ok?{ok:!0,value:Object.assign({[t]:m},w.value)}:w}var I=i.object({organizationId:i.string(),agentId:i.string(),settings:i.record(i.string(),i.unknown())});var Ct=i.object({}).extend(I);var jt=i.object({}).extend(I);var Ut=i.enum_(["CONVERSATION","CONVERSATION_MESSAGE","KNOWLEDGE_BASE","KNOWLEDGE_DOCUMENT","ACTION","USER","EVENT","EVENT_TRIGGER","USER_PROFILE","FEEDBACK"]);var D=i.object({referenceId:i.string()});var T=i.object({type:Ut,appId:i.string(),organizationId:i.string(),agentId:i.string()}).extend(D);var Kt=i.enum_(["THUMBS_UP","THUMBS_DOWN","INSERT","HANDOFF"]);var Mt=i.object({type:Kt,text:i.string().optional()});var zt=i.object({feedbackId:T,conversationId:T,conversationMessageId:T,userId:T.optional(),createdAt:i.date().optional()}).extend(Mt);var Dt=i.object({feedbacks:i.list(zt)}).extend(I);var kt=i.object({conversations:i.list(T)}).extend(I);var Lt=i.enum_(["EMAIL","PHONE_NUMBER"]);var _e=i.object({value:i.string(),type:Lt});var Wt=i.object({userId:D.optional(),userIdentifiers:i.list(_e),allUserData:i.record(i.string(),i.record(i.string(),i.string())),defaultUserData:i.record(i.string(),i.string())});var Vt=i.object({actionId:i.string(),conversationId:T.optional(),conversationMetadata:i.record(i.string(),i.string()),parameters:i.record(i.string(),i.unknown()),user:Wt}).extend(I);var uu=i.object({response:i.string()});var Jt=i.object({knowledgeBaseId:D}).extend(I);var Ru=i.object({message:i.string().optional()});function Bt(e){return e}var Ht=i.string().transform({transform:Bt,untransform:e=>e});var Gt=i.enum_(["text","array","color","image"]);var Ft=i.object({displayName:i.string(),description:i.string().optional(),type:Gt});var pl=i.record(Ht,Ft);var \$t=i.enum_(["VISIBLE","PARTIALLY_VISIBLE","HIDDEN"]);var qt=i.object({value:i.string(),visibility:\$t});var Se=i.object({identifiers:i.list(_e),data:i.record(i.string(),qt)});var El=i.object({userId:D}).extend(Se);var Ol=i.object({userId:T,allUserData:i.record(i.string(),i.record(i.string(),i.string())),defaultUserData:i.record(i.string(),i.string())}).extend(Se);var Yt=i.enum_(["CONVERSATION_CREATED","FEEDBACK_CREATED"]);var Xt=i.object({description:i.string(),type:Yt});var Pl=i.object({triggerId:T}).extend(Xt);var Cl=i.object({number:i.number(),size:i.number(),totalElements:i.number(),totalPages:i.number()});var Ul=i.object({page:i.number().optional(),size:i.number().optional(),sortId:i.string().optional(),sortDesc:i.boolean().optional()});var Qt=i.enum_(["STRING","BOOLEAN","NUMBER"]);var Zt=i.object({label:i.string(),value:i.unknown()});var eo=i.enum_(["POSITIVE","NEGATIVE","NEUTRAL","MIXED","UNKNOWN"]);var Ll=i.object({userRequest:i.string().optional(),agentResponse:i.string().optional(),resolutionStatus:i.string().optional(),category:i.string().optional(),sentiment:eo.optional()});var ro=i.enum_(["SHORT","MEDIUM","LONG"]);var to=i.enum_(["MARKDOWN","FORMS","IMAGES","CHARTS_HIGHCHARTS_TS"]);var Gl=i.object({capabilities:i.list(to),isCopilot:i.boolean(),responseLength:ro});var oo=i.object({id:i.string(),label:i.string(),description:i.string(),required:i.boolean(),type:Qt.optional(),enumOptions:i.list(Zt).optional()});var no=i.object({name:i.string(),description:i.string(),userInteractionRequired:i.boolean(),buttonName:i.string().optional(),precondition:i.lazy(()=>Oe).optional(),userFormParameters:i.list(oo)});var rd=i.object({actionId:T}).extend(no);var io=i.enum_(["NOT"]);var Z=i.object({operator:io.optional()});var we=i.object({key:i.string(),value:i.string().optional()}).extend(Z);var so=i.object({tags:i.set(i.string())}).extend(Z);var ao=i.object({actionId:i.string(),appId:i.string().optional()}).extend(Z);var co=i.union("conversationPreconditionType",{tags:so,metadata:we,actionExecuted:ao}).transform({transform:e=>e,untransform:e=>e});var Oe=i.union("preconditionType",{user:we,conversation:i.object({value:co}),group:i.lazyObject(()=>po)}).transform({transform:e=>e,untransform:e=>e});var fo=i.enum_(["AND","OR"]);var po=i.object({operator:fo,preconditions:i.list(i.lazy(()=>Oe))});import re from"../..";async function te(e){let t=\`https://developers\${process.env.ENVIRONMENT===void 0?"":\`.\${process.env.ENVIRONMENT==="sandbox"?"cassie.sb":process.env.ENVIRONMENT}\`}.mavenagi-apis.com/.well-known/jwks\`,o=Xe(new URL(t)),n=e.headers.get("authorization").replace("Bearer ","");await Ge(n,o,{issuer:"https://developers.mavenagi.com",audience:process.env.MAVENAGI_APP_ID})}async function xh(e){await te(e);let{organizationId:r,agentId:t,settings:o,actionId:n,conversationId:s,conversationMetadata:c,parameters:a,user:f}=Vt.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{let p=await re.executeAction?.({organizationId:r,agentId:t,settings:o,actionId:n,conversationId:s,conversationMetadata:c,parameters:a,user:f});return new Response(JSON.stringify({response:p}),{status:200,headers:{"Content-Type":"application/json"}})}catch(p){return console.error(p),p instanceof Error?new Response(p.message,{status:500}):new Response("No result returned",{status:204})}}async function _h(e){await te(e);let{organizationId:r,agentId:t,settings:o,feedbacks:n}=Dt.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await re.feedbackCreatedOrUpdated?.({organizationId:r,agentId:t,settings:o,feedbacks:n,ctx:{waitUntil:ee.waitUntil}}),new Response(null)}catch(s){return console.error(s),s instanceof Error?new Response(s.message,{status:500}):new Response("Unknown error",{status:500})}}async function Sh(e){await te(e);let{organizationId:r,agentId:t,settings:o,conversations:n}=kt.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await re.conversationCreatedOrUpdated?.({organizationId:r,agentId:t,settings:o,conversations:n,ctx:{waitUntil:ee.waitUntil}}),new Response(null)}catch(s){return console.error(s),s instanceof Error?new Response(s.message,{status:500}):new Response("Unknown error",{status:500})}}async function Oh(e){await te(e);let{organizationId:r,agentId:t,settings:o,knowledgeBaseId:n}=Jt.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await re.knowledgeBaseRefreshed?.({organizationId:r,agentId:t,knowledgeBaseId:n,settings:o,ctx:{waitUntil:ee.waitUntil}}),new Response(null)}catch(s){return console.error(s),s instanceof Error?new Response(s.message,{status:500}):new Response("Unknown error",{status:500})}}async function wh(e){await te(e);let{organizationId:r,agentId:t,settings:o}=jt.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await re.postInstall?.({organizationId:r,agentId:t,settings:o,ctx:{waitUntil:ee.waitUntil}}),new Response(null)}catch(n){return console.error(n),n instanceof Error?new Response(n.message,{status:400}):new Response("Unknown error",{status:500})}}async function Rh(e){await te(e);let{organizationId:r,agentId:t,settings:o}=Ct.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await re.preInstall?.({organizationId:r,agentId:t,settings:o,ctx:{waitUntil:ee.waitUntil}}),new Response(null)}catch(n){return console.error(n),n instanceof Error?new Response(n.message,{status:400}):new Response("Unknown error",{status:500})}}export{Sh as conversationCreatedOrUpdated,xh as executeAction,_h as feedbackCreatedOrUpdated,Oh as knowledgeBaseRefreshed,wh as postInstall,Rh as preInstall};\n`;
|
|
1
|
+
export const compiledUserWorkerEntrypointScript=`var Br=Object.defineProperty;var eo=(e,r,t)=>r in e?Br(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t;var ro=(e,r)=>{for(var t in r)Br(e,t,{get:r[t],enumerable:!0})};var j=(e,r,t)=>(eo(e,typeof r!="symbol"?r+"":r,t),t);var X=new TextEncoder,B=new TextDecoder,Oa=2**32;function Wr(...e){let r=e.reduce((o,{length:a})=>o+a,0),t=new Uint8Array(r),n=0;for(let o of e)t.set(o,n),n+=o.length;return t}function Jr(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(e);let r=atob(e),t=new Uint8Array(r.length);for(let n=0;n<r.length;n++)t[n]=r.charCodeAt(n);return t}function L(e){if(Uint8Array.fromBase64)return Uint8Array.fromBase64(typeof e=="string"?e:B.decode(e),{alphabet:"base64url"});let r=e;r instanceof Uint8Array&&(r=B.decode(r)),r=r.replace(/-/g,"+").replace(/_/g,"/").replace(/\\s/g,"");try{return Jr(r)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}}var P=class extends Error{code="ERR_JOSE_GENERIC";constructor(r,t){super(r,t),this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}};j(P,"code","ERR_JOSE_GENERIC");var T=class extends P{code="ERR_JWT_CLAIM_VALIDATION_FAILED";claim;reason;payload;constructor(r,t,n="unspecified",o="unspecified"){super(r,{cause:{claim:n,reason:o,payload:t}}),this.claim=n,this.reason=o,this.payload=t}};j(T,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");var Z=class extends P{code="ERR_JWT_EXPIRED";claim;reason;payload;constructor(r,t,n="unspecified",o="unspecified"){super(r,{cause:{claim:n,reason:o,payload:t}}),this.claim=n,this.reason=o,this.payload=t}};j(Z,"code","ERR_JWT_EXPIRED");var se=class extends P{code="ERR_JOSE_ALG_NOT_ALLOWED"};j(se,"code","ERR_JOSE_ALG_NOT_ALLOWED");var A=class extends P{code="ERR_JOSE_NOT_SUPPORTED"};j(A,"code","ERR_JOSE_NOT_SUPPORTED");var S=class extends P{code="ERR_JWS_INVALID"};j(S,"code","ERR_JWS_INVALID");var G=class extends P{code="ERR_JWT_INVALID"};j(G,"code","ERR_JWT_INVALID");var Q=class extends P{code="ERR_JWKS_INVALID"};j(Q,"code","ERR_JWKS_INVALID");var \$=class extends P{code="ERR_JWKS_NO_MATCHING_KEY";constructor(r="no applicable key found in the JSON Web Key Set",t){super(r,t)}};j(\$,"code","ERR_JWKS_NO_MATCHING_KEY");var ce=class extends P{[Symbol.asyncIterator];code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";constructor(r="multiple matching keys found in the JSON Web Key Set",t){super(r,t)}};j(ce,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");var ue=class extends P{code="ERR_JWKS_TIMEOUT";constructor(r="request timed out",t){super(r,t)}};j(ue,"code","ERR_JWKS_TIMEOUT");var fe=class extends P{code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";constructor(r="signature verification failed",t){super(r,t)}};j(fe,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");function W(e,r="algorithm.name"){return new TypeError(\`CryptoKey does not support this operation, its \${r} must be \${e}\`)}function le(e,r){return e.name===r}function Ye(e){return parseInt(e.name.slice(4),10)}function oo(e){switch(e){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function io(e,r){if(r&&!e.usages.includes(r))throw new TypeError(\`CryptoKey does not support this operation, its usages must include \${r}.\`)}function Lr(e,r,t){switch(r){case"HS256":case"HS384":case"HS512":{if(!le(e.algorithm,"HMAC"))throw W("HMAC");let n=parseInt(r.slice(2),10);if(Ye(e.algorithm.hash)!==n)throw W(\`SHA-\${n}\`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!le(e.algorithm,"RSASSA-PKCS1-v1_5"))throw W("RSASSA-PKCS1-v1_5");let n=parseInt(r.slice(2),10);if(Ye(e.algorithm.hash)!==n)throw W(\`SHA-\${n}\`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!le(e.algorithm,"RSA-PSS"))throw W("RSA-PSS");let n=parseInt(r.slice(2),10);if(Ye(e.algorithm.hash)!==n)throw W(\`SHA-\${n}\`,"algorithm.hash");break}case"Ed25519":case"EdDSA":{if(!le(e.algorithm,"Ed25519"))throw W("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!le(e.algorithm,"ECDSA"))throw W("ECDSA");let n=oo(r);if(e.algorithm.namedCurve!==n)throw W(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}io(e,t)}function Vr(e,r,...t){if(t=t.filter(Boolean),t.length>2){let n=t.pop();e+=\`one of type \${t.join(", ")}, or \${n}.\`}else t.length===2?e+=\`one of type \${t[0]} or \${t[1]}.\`:e+=\`of type \${t[0]}.\`;return r==null?e+=\` Received \${r}\`:typeof r=="function"&&r.name?e+=\` Received function \${r.name}\`:typeof r=="object"&&r!=null&&r.constructor?.name&&(e+=\` Received an instance of \${r.constructor.name}\`),e}var Hr=(e,...r)=>Vr("Key must be ",e,...r);function Xe(e,r,...t){return Vr(\`Key for the \${e} algorithm must be \`,r,...t)}function Ze(e){return e?.[Symbol.toStringTag]==="CryptoKey"}function Qe(e){return e?.[Symbol.toStringTag]==="KeyObject"}var er=e=>Ze(e)||Qe(e);var Fr=(...e)=>{let r=e.filter(Boolean);if(r.length===0||r.length===1)return!0;let t;for(let n of r){let o=Object.keys(n);if(!t||t.size===0){t=new Set(o);continue}for(let a of o){if(t.has(a))return!1;t.add(a)}}return!0};function ao(e){return typeof e=="object"&&e!==null}var z=e=>{if(!ao(e)||Object.prototype.toString.call(e)!=="[object Object]")return!1;if(Object.getPrototypeOf(e)===null)return!0;let r=e;for(;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r};var Gr=(e,r)=>{if(e.startsWith("RS")||e.startsWith("PS")){let{modulusLength:t}=r.algorithm;if(typeof t!="number"||t<2048)throw new TypeError(\`\${e} requires key modulusLength to be 2048 bits or larger\`)}};function so(e){let r,t;switch(e.kty){case"RSA":{switch(e.alg){case"PS256":case"PS384":case"PS512":r={name:"RSA-PSS",hash:\`SHA-\${e.alg.slice(-3)}\`},t=e.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":r={name:"RSASSA-PKCS1-v1_5",hash:\`SHA-\${e.alg.slice(-3)}\`},t=e.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":r={name:"RSA-OAEP",hash:\`SHA-\${parseInt(e.alg.slice(-3),10)||1}\`},t=e.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(e.alg){case"ES256":r={name:"ECDSA",namedCurve:"P-256"},t=e.d?["sign"]:["verify"];break;case"ES384":r={name:"ECDSA",namedCurve:"P-384"},t=e.d?["sign"]:["verify"];break;case"ES512":r={name:"ECDSA",namedCurve:"P-521"},t=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:"ECDH",namedCurve:e.crv},t=e.d?["deriveBits"]:[];break;default:throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(e.alg){case"Ed25519":case"EdDSA":r={name:"Ed25519"},t=e.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":r={name:e.crv},t=e.d?["deriveBits"]:[];break;default:throw new A('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new A('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:r,keyUsages:t}}var Pe=async e=>{if(!e.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');let{algorithm:r,keyUsages:t}=so(e),n={...e};return delete n.alg,delete n.use,crypto.subtle.importKey("jwk",n,r,e.ext??!e.d,e.key_ops??t)};async function \$r(e,r,t){if(!z(e))throw new TypeError("JWK must be an object");let n;switch(r??=e.alg,n??=t?.extractable??e.ext,e.kty){case"oct":if(typeof e.k!="string"||!e.k)throw new TypeError('missing "k" (Key Value) Parameter value');return L(e.k);case"RSA":if("oth"in e&&e.oth!==void 0)throw new A('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');case"EC":case"OKP":return Pe({...e,alg:r,ext:n});default:throw new A('Unsupported "kty" (Key Type) Parameter value')}}var qr=(e,r,t,n,o)=>{if(o.crit!==void 0&&n?.crit===void 0)throw new e('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(c=>typeof c!="string"||c.length===0))throw new e('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let a;t!==void 0?a=new Map([...Object.entries(t),...r.entries()]):a=r;for(let c of n.crit){if(!a.has(c))throw new A(\`Extension Header Parameter "\${c}" is not recognized\`);if(o[c]===void 0)throw new e(\`Extension Header Parameter "\${c}" is missing\`);if(a.get(c)&&n[c]===void 0)throw new e(\`Extension Header Parameter "\${c}" MUST be integrity protected\`)}return new Set(n.crit)};var Yr=(e,r)=>{if(r!==void 0&&(!Array.isArray(r)||r.some(t=>typeof t!="string")))throw new TypeError(\`"\${e}" option must be an array of strings\`);if(r)return new Set(r)};function pe(e){return z(e)&&typeof e.kty=="string"}function Xr(e){return e.kty!=="oct"&&typeof e.d=="string"}function Zr(e){return e.kty!=="oct"&&typeof e.d>"u"}function Qr(e){return e.kty==="oct"&&typeof e.k=="string"}var ee,et=async(e,r,t,n=!1)=>{ee||=new WeakMap;let o=ee.get(e);if(o?.[t])return o[t];let a=await Pe({...r,alg:t});return n&&Object.freeze(e),o?o[t]=a:ee.set(e,{[t]:a}),a},uo=(e,r)=>{ee||=new WeakMap;let t=ee.get(e);if(t?.[r])return t[r];let n=e.type==="public",o=!!n,a;if(e.asymmetricKeyType==="x25519"){switch(r){case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}a=e.toCryptoKey(e.asymmetricKeyType,o,n?[]:["deriveBits"])}if(e.asymmetricKeyType==="ed25519"){if(r!=="EdDSA"&&r!=="Ed25519")throw new TypeError("given KeyObject instance cannot be used for this algorithm");a=e.toCryptoKey(e.asymmetricKeyType,o,[n?"verify":"sign"])}if(e.asymmetricKeyType==="rsa"){let c;switch(r){case"RSA-OAEP":c="SHA-1";break;case"RS256":case"PS256":case"RSA-OAEP-256":c="SHA-256";break;case"RS384":case"PS384":case"RSA-OAEP-384":c="SHA-384";break;case"RS512":case"PS512":case"RSA-OAEP-512":c="SHA-512";break;default:throw new TypeError("given KeyObject instance cannot be used for this algorithm")}if(r.startsWith("RSA-OAEP"))return e.toCryptoKey({name:"RSA-OAEP",hash:c},o,n?["encrypt"]:["decrypt"]);a=e.toCryptoKey({name:r.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:c},o,[n?"verify":"sign"])}if(e.asymmetricKeyType==="ec"){let s=new Map([["prime256v1","P-256"],["secp384r1","P-384"],["secp521r1","P-521"]]).get(e.asymmetricKeyDetails?.namedCurve);if(!s)throw new TypeError("given KeyObject instance cannot be used for this algorithm");r==="ES256"&&s==="P-256"&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:s},o,[n?"verify":"sign"])),r==="ES384"&&s==="P-384"&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:s},o,[n?"verify":"sign"])),r==="ES512"&&s==="P-521"&&(a=e.toCryptoKey({name:"ECDSA",namedCurve:s},o,[n?"verify":"sign"])),r.startsWith("ECDH-ES")&&(a=e.toCryptoKey({name:"ECDH",namedCurve:s},o,n?[]:["deriveBits"]))}if(!a)throw new TypeError("given KeyObject instance cannot be used for this algorithm");return t?t[r]=a:ee.set(e,{[r]:a}),a},rt=async(e,r)=>{if(e instanceof Uint8Array||Ze(e))return e;if(Qe(e)){if(e.type==="secret")return e.export();if("toCryptoKey"in e&&typeof e.toCryptoKey=="function")try{return uo(e,r)}catch(n){if(n instanceof TypeError)throw n}let t=e.export({format:"jwk"});return et(e,t,r)}if(pe(e))return e.k?L(e.k):et(e,e,r,!0);throw new Error("unreachable")};var re=e=>e?.[Symbol.toStringTag],rr=(e,r,t)=>{if(r.use!==void 0){let n;switch(t){case"sign":case"verify":n="sig";break;case"encrypt":case"decrypt":n="enc";break}if(r.use!==n)throw new TypeError(\`Invalid key for this operation, its "use" must be "\${n}" when present\`)}if(r.alg!==void 0&&r.alg!==e)throw new TypeError(\`Invalid key for this operation, its "alg" must be "\${e}" when present\`);if(Array.isArray(r.key_ops)){let n;switch(!0){case(t==="sign"||t==="verify"):case e==="dir":case e.includes("CBC-HS"):n=t;break;case e.startsWith("PBES2"):n="deriveBits";break;case/^A\\d{3}(?:GCM)?(?:KW)?\$/.test(e):!e.includes("GCM")&&e.endsWith("KW")?n=t==="encrypt"?"wrapKey":"unwrapKey":n=t;break;case(t==="encrypt"&&e.startsWith("RSA")):n="wrapKey";break;case t==="decrypt":n=e.startsWith("RSA")?"unwrapKey":"deriveBits";break}if(n&&r.key_ops?.includes?.(n)===!1)throw new TypeError(\`Invalid key for this operation, its "key_ops" must include "\${n}" when present\`)}return!0},fo=(e,r,t)=>{if(!(r instanceof Uint8Array)){if(pe(r)){if(Qr(r)&&rr(e,r,t))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!er(r))throw new TypeError(Xe(e,r,"CryptoKey","KeyObject","JSON Web Key","Uint8Array"));if(r.type!=="secret")throw new TypeError(\`\${re(r)} instances for symmetric algorithms must be of type "secret"\`)}},lo=(e,r,t)=>{if(pe(r))switch(t){case"decrypt":case"sign":if(Xr(r)&&rr(e,r,t))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"encrypt":case"verify":if(Zr(r)&&rr(e,r,t))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!er(r))throw new TypeError(Xe(e,r,"CryptoKey","KeyObject","JSON Web Key"));if(r.type==="secret")throw new TypeError(\`\${re(r)} instances for asymmetric algorithms must not be of type "secret"\`);if(r.type==="public")switch(t){case"sign":throw new TypeError(\`\${re(r)} instances for asymmetric algorithm signing must be of type "private"\`);case"decrypt":throw new TypeError(\`\${re(r)} instances for asymmetric algorithm decryption must be of type "private"\`);default:break}if(r.type==="private")switch(t){case"verify":throw new TypeError(\`\${re(r)} instances for asymmetric algorithm verifying must be of type "public"\`);case"encrypt":throw new TypeError(\`\${re(r)} instances for asymmetric algorithm encryption must be of type "public"\`);default:break}},tt=(e,r,t)=>{e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A(?:128|192|256)(?:GCM)?(?:KW)?\$/.test(e)||/^A(?:128|192|256)CBC-HS(?:256|384|512)\$/.test(e)?fo(e,r,t):lo(e,r,t)};var nt=(e,r)=>{let t=\`SHA-\${e.slice(-3)}\`;switch(e){case"HS256":case"HS384":case"HS512":return{hash:t,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:t,name:"RSA-PSS",saltLength:parseInt(e.slice(-3),10)>>3};case"RS256":case"RS384":case"RS512":return{hash:t,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:t,name:"ECDSA",namedCurve:r.namedCurve};case"Ed25519":case"EdDSA":return{name:"Ed25519"};default:throw new A(\`alg \${e} is not supported either by JOSE or your javascript runtime\`)}};var ot=async(e,r,t)=>{if(r instanceof Uint8Array){if(!e.startsWith("HS"))throw new TypeError(Hr(r,"CryptoKey","KeyObject","JSON Web Key"));return crypto.subtle.importKey("raw",r,{hash:\`SHA-\${e.slice(-3)}\`,name:"HMAC"},!1,[t])}return Lr(r,e,t),r};var it=async(e,r,t,n)=>{let o=await ot(e,r,"verify");Gr(e,o);let a=nt(e,o.algorithm);try{return await crypto.subtle.verify(a,o,t,n)}catch{return!1}};async function at(e,r,t){if(!z(e))throw new S("Flattened JWS must be an object");if(e.protected===void 0&&e.header===void 0)throw new S('Flattened JWS must have either of the "protected" or "header" members');if(e.protected!==void 0&&typeof e.protected!="string")throw new S("JWS Protected Header incorrect type");if(e.payload===void 0)throw new S("JWS Payload missing");if(typeof e.signature!="string")throw new S("JWS Signature missing or incorrect type");if(e.header!==void 0&&!z(e.header))throw new S("JWS Unprotected Header incorrect type");let n={};if(e.protected)try{let O=L(e.protected);n=JSON.parse(B.decode(O))}catch{throw new S("JWS Protected Header is invalid")}if(!Fr(n,e.header))throw new S("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");let o={...n,...e.header},a=qr(S,new Map([["b64",!0]]),t?.crit,n,o),c=!0;if(a.has("b64")&&(c=n.b64,typeof c!="boolean"))throw new S('The "b64" (base64url-encode payload) Header Parameter must be a boolean');let{alg:s}=o;if(typeof s!="string"||!s)throw new S('JWS "alg" (Algorithm) Header Parameter missing or invalid');let l=t&&Yr("algorithms",t.algorithms);if(l&&!l.has(s))throw new se('"alg" (Algorithm) Header Parameter value not allowed');if(c){if(typeof e.payload!="string")throw new S("JWS Payload must be a string")}else if(typeof e.payload!="string"&&!(e.payload instanceof Uint8Array))throw new S("JWS Payload must be a string or an Uint8Array instance");let f=!1;typeof r=="function"&&(r=await r(n,e),f=!0),tt(s,r,"verify");let p=Wr(X.encode(e.protected??""),X.encode("."),typeof e.payload=="string"?X.encode(e.payload):e.payload),d;try{d=L(e.signature)}catch{throw new S("Failed to base64url decode the signature")}let _=await rt(r,s);if(!await it(s,_,d,p))throw new fe;let y;if(c)try{y=L(e.payload)}catch{throw new S("Failed to base64url decode the payload")}else typeof e.payload=="string"?y=X.encode(e.payload):y=e.payload;let g={payload:y};return e.protected!==void 0&&(g.protectedHeader=n),e.header!==void 0&&(g.unprotectedHeader=e.header),f?{...g,key:_}:g}async function st(e,r,t){if(e instanceof Uint8Array&&(e=B.decode(e)),typeof e!="string")throw new S("Compact JWS must be a string or Uint8Array");let{0:n,1:o,2:a,length:c}=e.split(".");if(c!==3)throw new S("Invalid Compact JWS");let s=await at({payload:o,protected:n,signature:a},r,t),l={payload:s.payload,protectedHeader:s.protectedHeader};return typeof r=="function"?{...l,key:s.key}:l}var ct=e=>Math.floor(e.getTime()/1e3);var po=/^(\\+|\\-)? ?(\\d+|\\d+\\.\\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?\$/i,tr=e=>{let r=po.exec(e);if(!r||r[4]&&r[1])throw new TypeError("Invalid time period format");let t=parseFloat(r[2]),n=r[3].toLowerCase(),o;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":o=Math.round(t);break;case"minute":case"minutes":case"min":case"mins":case"m":o=Math.round(t*60);break;case"hour":case"hours":case"hr":case"hrs":case"h":o=Math.round(t*3600);break;case"day":case"days":case"d":o=Math.round(t*86400);break;case"week":case"weeks":case"w":o=Math.round(t*604800);break;default:o=Math.round(t*31557600);break}return r[1]==="-"||r[4]==="ago"?-o:o};var ut=e=>e.toLowerCase().replace(/^application\\//,""),mo=(e,r)=>typeof e=="string"?r.includes(e):Array.isArray(e)?r.some(Set.prototype.has.bind(new Set(e))):!1,ft=(e,r,t={})=>{let n;try{n=JSON.parse(B.decode(r))}catch{}if(!z(n))throw new G("JWT Claims Set must be a top-level JSON object");let{typ:o}=t;if(o&&(typeof e.typ!="string"||ut(e.typ)!==ut(o)))throw new T('unexpected "typ" JWT header value',n,"typ","check_failed");let{requiredClaims:a=[],issuer:c,subject:s,audience:l,maxTokenAge:f}=t,p=[...a];f!==void 0&&p.push("iat"),l!==void 0&&p.push("aud"),s!==void 0&&p.push("sub"),c!==void 0&&p.push("iss");for(let y of new Set(p.reverse()))if(!(y in n))throw new T(\`missing required "\${y}" claim\`,n,y,"missing");if(c&&!(Array.isArray(c)?c:[c]).includes(n.iss))throw new T('unexpected "iss" claim value',n,"iss","check_failed");if(s&&n.sub!==s)throw new T('unexpected "sub" claim value',n,"sub","check_failed");if(l&&!mo(n.aud,typeof l=="string"?[l]:l))throw new T('unexpected "aud" claim value',n,"aud","check_failed");let d;switch(typeof t.clockTolerance){case"string":d=tr(t.clockTolerance);break;case"number":d=t.clockTolerance;break;case"undefined":d=0;break;default:throw new TypeError("Invalid clockTolerance option type")}let{currentDate:_}=t,h=ct(_||new Date);if((n.iat!==void 0||f)&&typeof n.iat!="number")throw new T('"iat" claim must be a number',n,"iat","invalid");if(n.nbf!==void 0){if(typeof n.nbf!="number")throw new T('"nbf" claim must be a number',n,"nbf","invalid");if(n.nbf>h+d)throw new T('"nbf" claim timestamp check failed',n,"nbf","check_failed")}if(n.exp!==void 0){if(typeof n.exp!="number")throw new T('"exp" claim must be a number',n,"exp","invalid");if(n.exp<=h-d)throw new Z('"exp" claim timestamp check failed',n,"exp","check_failed")}if(f){let y=h-n.iat,g=typeof f=="number"?f:tr(f);if(y-d>g)throw new Z('"iat" claim timestamp check failed (too far in the past)',n,"iat","check_failed");if(y<0-d)throw new T('"iat" claim timestamp check failed (it should be in the past)',n,"iat","check_failed")}return n};async function nr(e,r,t){let n=await st(e,r,t);if(n.protectedHeader.crit?.includes("b64")&&n.protectedHeader.b64===!1)throw new G("JWTs MUST NOT use unencoded payload");let a={payload:ft(n.protectedHeader,n.payload,t),protectedHeader:n.protectedHeader};return typeof r=="function"?{...a,key:n.key}:a}function yo(e){switch(typeof e=="string"&&e.slice(0,2)){case"RS":case"PS":return"RSA";case"ES":return"EC";case"Ed":return"OKP";default:throw new A('Unsupported "alg" value for a JSON Web Key Set')}}function bo(e){return e&&typeof e=="object"&&Array.isArray(e.keys)&&e.keys.every(ho)}function ho(e){return z(e)}function pt(e){return typeof structuredClone=="function"?structuredClone(e):JSON.parse(JSON.stringify(e))}var or=class{_jwks;_cached=new WeakMap;constructor(r){if(!bo(r))throw new Q("JSON Web Key Set malformed");this._jwks=pt(r)}async getKey(r,t){let{alg:n,kid:o}={...r,...t?.header},a=yo(n),c=this._jwks.keys.filter(f=>{let p=a===f.kty;if(p&&typeof o=="string"&&(p=o===f.kid),p&&typeof f.alg=="string"&&(p=n===f.alg),p&&typeof f.use=="string"&&(p=f.use==="sig"),p&&Array.isArray(f.key_ops)&&(p=f.key_ops.includes("verify")),p)switch(n){case"ES256":p=f.crv==="P-256";break;case"ES384":p=f.crv==="P-384";break;case"ES512":p=f.crv==="P-521";break;case"Ed25519":case"EdDSA":p=f.crv==="Ed25519";break}return p}),{0:s,length:l}=c;if(l===0)throw new \$;if(l!==1){let f=new ce,{_cached:p}=this;throw f[Symbol.asyncIterator]=async function*(){for(let d of c)try{yield await lt(p,d,n)}catch{}},f}return lt(this._cached,s,n)}};async function lt(e,r,t){let n=e.get(r)||e.set(r,{}).get(r);if(n[t]===void 0){let o=await \$r({...r,ext:!0},t);if(o instanceof Uint8Array||o.type!=="public")throw new Q("JSON Web Key Set members must be public keys");n[t]=o}return n[t]}function ir(e){let r=new or(e),t=async(n,o)=>r.getKey(n,o);return Object.defineProperties(t,{jwks:{value:()=>pt(r._jwks),enumerable:!0,configurable:!1,writable:!1}}),t}function go(){return typeof WebSocketPair<"u"||typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"||typeof EdgeRuntime<"u"&&EdgeRuntime==="vercel"}var ar;(typeof navigator>"u"||!navigator.userAgent?.startsWith?.("Mozilla/5.0 "))&&(ar="jose/v6.0.8");var me=Symbol();async function vo(e,r,t,n=fetch){let o=await n(e,{method:"GET",signal:t,redirect:"manual",headers:r}).catch(a=>{throw a.name==="TimeoutError"?new ue:a});if(o.status!==200)throw new P("Expected 200 OK from the JSON Web Key Set HTTP response");try{return await o.json()}catch{throw new P("Failed to parse the JSON Web Key Set HTTP response as JSON")}}var Ae=Symbol();function _o(e,r){return!(typeof e!="object"||e===null||!("uat"in e)||typeof e.uat!="number"||Date.now()-e.uat>=r||!("jwks"in e)||!z(e.jwks)||!Array.isArray(e.jwks.keys)||!Array.prototype.every.call(e.jwks.keys,z))}var sr=class{_url;_timeoutDuration;_cooldownDuration;_cacheMaxAge;_jwksTimestamp;_pendingFetch;_headers;[me];_local;_cache;constructor(r,t){if(!(r instanceof URL))throw new TypeError("url must be an instance of URL");this._url=new URL(r.href),this._timeoutDuration=typeof t?.timeoutDuration=="number"?t?.timeoutDuration:5e3,this._cooldownDuration=typeof t?.cooldownDuration=="number"?t?.cooldownDuration:3e4,this._cacheMaxAge=typeof t?.cacheMaxAge=="number"?t?.cacheMaxAge:6e5,this._headers=new Headers(t?.headers),ar&&!this._headers.has("User-Agent")&&this._headers.set("User-Agent",ar),this._headers.has("accept")||(this._headers.set("accept","application/json"),this._headers.append("accept","application/jwk-set+json")),this[me]=t?.[me],t?.[Ae]!==void 0&&(this._cache=t?.[Ae],_o(t?.[Ae],this._cacheMaxAge)&&(this._jwksTimestamp=this._cache.uat,this._local=ir(this._cache.jwks)))}coolingDown(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cooldownDuration:!1}fresh(){return typeof this._jwksTimestamp=="number"?Date.now()<this._jwksTimestamp+this._cacheMaxAge:!1}async getKey(r,t){(!this._local||!this.fresh())&&await this.reload();try{return await this._local(r,t)}catch(n){if(n instanceof \$&&this.coolingDown()===!1)return await this.reload(),this._local(r,t);throw n}}async reload(){this._pendingFetch&&go()&&(this._pendingFetch=void 0),this._pendingFetch||=vo(this._url.href,this._headers,AbortSignal.timeout(this._timeoutDuration),this[me]).then(r=>{this._local=ir(r),this._cache&&(this._cache.uat=Date.now(),this._cache.jwks=r),this._jwksTimestamp=Date.now(),this._pendingFetch=void 0}).catch(r=>{throw this._pendingFetch=void 0,r}),await this._pendingFetch}};function cr(e,r){let t=new sr(e,r),n=async(o,a)=>t.getKey(o,a);return Object.defineProperties(n,{coolingDown:{get:()=>t.coolingDown(),enumerable:!0,configurable:!1},fresh:{get:()=>t.fresh(),enumerable:!0,configurable:!1},reload:{value:()=>t.reload(),enumerable:!0,configurable:!1,writable:!1},reloading:{get:()=>!!t._pendingFetch,enumerable:!0,configurable:!1},jwks:{value:()=>t._local?.jwks(),enumerable:!0,configurable:!1,writable:!1}}),n}function wo(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}var ur,fr,lr,pr,mr,dr,yr,br,So=typeof window<"u"&&typeof window.document<"u",xo=(typeof self>"u"?"undefined":wo(self))==="object"&&typeof((ur=self)===null||ur===void 0?void 0:ur.importScripts)=="function"&&(((fr=self.constructor)===null||fr===void 0?void 0:fr.name)==="DedicatedWorkerGlobalScope"||((lr=self.constructor)===null||lr===void 0?void 0:lr.name)==="ServiceWorkerGlobalScope"||((pr=self.constructor)===null||pr===void 0?void 0:pr.name)==="SharedWorkerGlobalScope"),mt=typeof Deno<"u"&&typeof Deno.version<"u"&&typeof Deno.version.deno<"u",dt=typeof Bun<"u"&&typeof Bun.version<"u",Oo=typeof process<"u"&&!!process.version&&!!(!((mr=process.versions)===null||mr===void 0)&&mr.node)&&!mt&&!dt,Eo=typeof navigator<"u"&&((dr=navigator)===null||dr===void 0?void 0:dr.product)==="ReactNative",Po=typeof globalThis<"u"&&((br=globalThis)===null||br===void 0||(yr=br.navigator)===null||yr===void 0?void 0:yr.userAgent)==="Cloudflare-Workers",hr=Ao();function Ao(){return So?{type:"browser",version:window.navigator.userAgent}:Po?{type:"workerd"}:xo?{type:"web-worker"}:mt?{type:"deno",version:Deno.version.deno}:dt?{type:"bun",version:Bun.version}:Oo?{type:"node",version:process.versions.node,parsedVersion:Number(process.versions.node.split(".")[0])}:Eo?{type:"react-native"}:{type:"unknown"}}var i={};ro(i,{JsonError:()=>ze,ParseError:()=>je,any:()=>Dt,bigint:()=>gt,boolean:()=>Nt,booleanLiteral:()=>Kt,date:()=>vt,discriminant:()=>Xt,enum_:()=>ke,getObjectLikeUtils:()=>D,getObjectUtils:()=>q,getSchemaUtils:()=>v,isProperty:()=>H,lazy:()=>_t,lazyObject:()=>jt,list:()=>Ce,number:()=>Mt,object:()=>Ue,objectWithoutOptionalProperties:()=>zt,optional:()=>xr,property:()=>Et,record:()=>Ht,set:()=>Ft,string:()=>Bt,stringLiteral:()=>Ct,transform:()=>Or,undiscriminatedUnion:()=>Yt,union:()=>Qt,unknown:()=>Wt,withParsedProperties:()=>Ar});var m={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",OPTIONAL:"optional"};function Io(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function yt(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function b(e,r){return"Expected ".concat(r,". Received ").concat(To(e),".")}function To(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(Io(e,BigInt))return"BigInt";switch(typeof e>"u"?"undefined":yt(e)){case"string":return'"'.concat(e,'"');case"bigint":case"number":case"boolean":case"undefined":return"".concat(e)}return typeof e>"u"?"undefined":yt(e)}function gr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function zo(e){if(Array.isArray(e))return gr(e)}function Ro(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function jo(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ko(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Uo(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ro(e,o,t[o])})}return e}function Co(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Ko(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Co(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function Do(e){return zo(e)||jo(e)||No(e)||ko()}function No(e,r){if(e){if(typeof e=="string")return gr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return gr(e,r)}}function E(e){return Ko(Uo({},e),{json:bt(e.json),parse:bt(e.parse)})}function bt(e){return function(r,t){var n=e(r,t),o=t??{},a=o.skipValidation,c=a===void 0?!1:a;return!n.ok&&c?(console.warn(["Failed to validate."].concat(Do(n.errors.map(function(s){return" - "+(s.path.length>0?"".concat(s.path.join("."),": ").concat(s.message):s.message)}))).join(\`\n\`)),{ok:!0,value:r}):n}}function Ie(e){return e.path.length===0?e.message:"".concat(e.path.join(" -> "),": ").concat(e.message)}function Mo(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function Bo(e,r,t){return r=de(r),Ho(e,_r()?Reflect.construct(r,t||[],de(e).constructor):r.apply(e,t))}function Wo(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function Te(e,r,t){return _r()?Te=Reflect.construct:Te=function(o,a,c){var s=[null];s.push.apply(s,a);var l=Function.bind.apply(o,s),f=new l;return c&&ye(f,c.prototype),f},Te.apply(null,arguments)}function Jo(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function de(e){return de=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},de(e)}function Lo(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&ye(e,r)}function Vo(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Ho(e,r){return r&&(Fo(r)==="object"||typeof r=="function")?r:Mo(e)}function ye(e,r){return ye=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},ye(e,r)}function Fo(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function vr(e){var r=typeof Map=="function"?new Map:void 0;return vr=function(n){if(n===null||!Vo(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r<"u"){if(r.has(n))return r.get(n);r.set(n,o)}function o(){return Te(n,arguments,de(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),ye(o,n)},vr(e)}function _r(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(_r=function(){return!!e})()}var ze=function(e){"use strict";Lo(r,e);function r(t){Wo(this,r);var n;return n=Bo(this,r,[t.map(Ie).join("; ")]),Jo(n,"errors",void 0),n.errors=t,Object.setPrototypeOf(n,r.prototype),n}return r}(vr(Error));function Go(e){if(e===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function \$o(e,r,t){return r=be(r),Qo(e,Sr()?Reflect.construct(r,t||[],be(e).constructor):r.apply(e,t))}function qo(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function Re(e,r,t){return Sr()?Re=Reflect.construct:Re=function(o,a,c){var s=[null];s.push.apply(s,a);var l=Function.bind.apply(o,s),f=new l;return c&&he(f,c.prototype),f},Re.apply(null,arguments)}function Yo(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function be(e){return be=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},be(e)}function Xo(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&he(e,r)}function Zo(e){return Function.toString.call(e).indexOf("[native code]")!==-1}function Qo(e,r){return r&&(ei(r)==="object"||typeof r=="function")?r:Go(e)}function he(e,r){return he=Object.setPrototypeOf||function(n,o){return n.__proto__=o,n},he(e,r)}function ei(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function wr(e){var r=typeof Map=="function"?new Map:void 0;return wr=function(n){if(n===null||!Zo(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof r<"u"){if(r.has(n))return r.get(n);r.set(n,o)}function o(){return Re(n,arguments,be(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),he(o,n)},wr(e)}function Sr(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Sr=function(){return!!e})()}var je=function(e){"use strict";Xo(r,e);function r(t){qo(this,r);var n;return n=\$o(this,r,[t.map(Ie).join("; ")]),Yo(n,"errors",void 0),n.errors=t,Object.setPrototypeOf(n,r.prototype),n}return r}(wr(Error));function ri(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ht(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){ri(e,o,t[o])})}return e}function v(e){return{optional:function(){return xr(e)},transform:function(r){return Or(e,r)},parseOrThrow:function(r,t){var n=e.parse(r,t);if(n.ok)return n.value;throw new je(n.errors)},jsonOrThrow:function(r,t){var n=e.json(r,t);if(n.ok)return n.value;throw new ze(n.errors)}}}function xr(e){var r={parse:function(t,n){return t==null?{ok:!0,value:void 0}:e.parse(t,n)},json:function(t,n){return n?.omitUndefined&&t===void 0?{ok:!0,value:void 0}:t==null?{ok:!0,value:null}:e.json(t,n)},getType:function(){return m.OPTIONAL}};return ht({},r,v(r))}function Or(e,r){var t={parse:function(n,o){var a=e.parse(n,o);return a.ok?{ok:!0,value:r.transform(a.value)}:a},json:function(n,o){var a=r.untransform(n);return e.json(a,o)},getType:function(){return e.getType()}};return ht({},t,v(t))}function ti(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ni(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){ti(e,o,t[o])})}return e}function oi(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function gt(){var e={parse:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.breadcrumbsPrefix,o=n===void 0?[]:n;return typeof r!="string"?{ok:!1,errors:[{path:o,message:b(r,"string")}]}:{ok:!0,value:BigInt(r)}},json:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.breadcrumbsPrefix,o=n===void 0?[]:n;return(typeof r>"u"?"undefined":oi(r))==="bigint"?{ok:!0,value:r.toString()}:{ok:!1,errors:[{path:o,message:b(r,"bigint")}]}},getType:function(){return m.BIGINT}};return ni({},E(e),v(e))}function ii(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ai(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function si(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){ii(e,o,t[o])})}return e}var ci=/^([+-]?\\d{4}(?!\\d{2}\\b))((-?)((0[1-9]|1[0-2])(\\3([12]\\d|0[1-9]|3[01]))?|W([0-4]\\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\\d|[12]\\d{2}|3([0-5]\\d|6[1-6])))([T\\s]((([01]\\d|2[0-3])((:?)[0-5]\\d)?|24:?00)([.,]\\d+(?!:))?)?(\\17[0-5]\\d([.,]\\d+)?)?([zZ]|([+-])([01]\\d|2[0-3]):?([0-5]\\d)?)?)?)?\$/;function vt(){var e={parse:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.breadcrumbsPrefix,o=n===void 0?[]:n;return typeof r!="string"?{ok:!1,errors:[{path:o,message:b(r,"string")}]}:ci.test(r)?{ok:!0,value:new Date(r)}:{ok:!1,errors:[{path:o,message:b(r,"ISO 8601 date string")}]}},json:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.breadcrumbsPrefix,o=n===void 0?[]:n;return ai(r,Date)?{ok:!0,value:r.toISOString()}:{ok:!1,errors:[{path:o,message:b(r,"Date object")}]}},getType:function(){return m.DATE}};return si({},E(e),v(e))}function ui(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function fi(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){ui(e,o,t[o])})}return e}function I(e,r){return function(){var t={parse:r,json:r,getType:function(){return e}};return fi({},E(t),v(t))}}function ke(e){var r=new Set(e),t=I(m.ENUM,function(n){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=o.allowUnrecognizedEnumValues,c=o.breadcrumbsPrefix,s=c===void 0?[]:c;return typeof n!="string"?{ok:!1,errors:[{path:s,message:b(n,"string")}]}:!r.has(n)&&!a?{ok:!1,errors:[{path:s,message:b(n,"enum")}]}:{ok:!0,value:n}});return t()}function li(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function pi(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){li(e,o,t[o])})}return e}function _t(e){var r=Er(e);return pi({},r,v(r))}function Er(e){return{parse:function(r,t){return te(e).parse(r,t)},json:function(r,t){return te(e).json(r,t)},getType:function(){return te(e).getType()}}}function te(e){var r=e;return r.__zurg_memoized==null&&(r.__zurg_memoized=e()),r.__zurg_memoized}function ge(e){return Object.entries(e)}function wt(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function mi(e){if(Array.isArray(e))return e}function di(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function yi(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function bi(e,r){return mi(e)||di(e,r)||hi(e,r)||yi()}function hi(e,r){if(e){if(typeof e=="string")return wt(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return wt(e,r)}}function ve(e,r){var t=new Set(r);return Object.entries(e).reduce(function(n,o){var a=bi(o,2),c=a[0],s=a[1];return t.has(c)&&(n[c]=s),n},{})}function gi(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function V(e){if((typeof e>"u"?"undefined":gi(e))!=="object"||e===null)return!1;if(Object.getPrototypeOf(e)===null)return!0;for(var r=e;Object.getPrototypeOf(r)!==null;)r=Object.getPrototypeOf(r);return Object.getPrototypeOf(e)===r}function _e(e){return Object.keys(e)}function St(e,r){var t=[],n=[],o=!0,a=!1,c=void 0;try{for(var s=e[Symbol.iterator](),l;!(o=(l=s.next()).done);o=!0){var f=l.value;r(f)?t.push(f):n.push(f)}}catch(p){a=!0,c=p}finally{try{!o&&s.return!=null&&s.return()}finally{if(a)throw c}}return[t,n]}function xt(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function vi(e){if(Array.isArray(e))return e}function Ot(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _i(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function wi(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Pr(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ot(e,o,t[o])})}return e}function Si(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function xi(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Si(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function Oi(e,r){return vi(e)||_i(e,r)||Ei(e,r)||wi()}function Ei(e,r){if(e){if(typeof e=="string")return xt(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return xt(e,r)}}function D(e){return{withParsedProperties:function(r){return Ar(e,r)}}}function Ar(e,r){var t={parse:function(n,o){var a=e.parse(n,o);if(!a.ok)return a;var c=Object.entries(r).reduce(function(s,l){var f=Oi(l,2),p=f[0],d=f[1];return xi(Pr({},s),Ot({},p,typeof d=="function"?d(a.value):d))},{});return{ok:!0,value:Pr({},a.value,c)}},json:function(n,o){if(!V(n)){var a;return{ok:!1,errors:[{path:(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],message:b(n,"object")}]}}var c=new Set(Object.keys(r)),s=ve(n,Object.keys(n).filter(function(l){return!c.has(l)}));return e.json(s,o)},getType:function(){return e.getType()}};return Pr({},t,v(t),D(t))}function Et(e,r){return{rawKey:e,valueSchema:r,isProperty:!0}}function H(e){return e.isProperty}function Ir(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Pi(e){if(Array.isArray(e))return e}function Ai(e){if(Array.isArray(e))return Ir(e)}function Ii(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Ti(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zi(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function Ri(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ji(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function N(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ii(e,o,t[o])})}return e}function ki(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function we(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ki(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function Se(e,r){return Pi(e)||zi(e,r)||Tt(e,r)||Ri()}function U(e){return Ai(e)||Ti(e)||Tt(e)||ji()}function Tt(e,r){if(e){if(typeof e=="string")return Ir(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return Ir(e,r)}}function Ue(e){var r={_getRawProperties:function(){return Object.entries(e).map(function(t){var n=Se(t,2),o=n[0],a=n[1];return H(a)?a.rawKey:o})},_getParsedProperties:function(){return _e(e)},parse:function(t,n){var o={},a=[],c=!0,s=!1,l=void 0;try{for(var f=ge(e)[Symbol.iterator](),p;!(c=(p=f.next()).done);c=!0){var d=Se(p.value,2),_=d[0],h=d[1],y=H(h)?h.rawKey:_,g=H(h)?h.valueSchema:h,O={rawKey:y,parsedKey:_,valueSchema:g};o[y]=O,It(g)&&a.push(y)}}catch(w){s=!0,l=w}finally{try{!c&&f.return!=null&&f.return()}finally{if(s)throw l}}return Pt({value:t,requiredKeys:a,getProperty:function(w){var k=o[w];if(k!=null)return{transformedKey:k.parsedKey,transform:function(K){var R;return k.valueSchema.parse(K,we(N({},n),{breadcrumbsPrefix:U((R=n?.breadcrumbsPrefix)!==null&&R!==void 0?R:[]).concat([w])}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},json:function(t,n){var o=[],a=!0,c=!1,s=void 0;try{for(var l=ge(e)[Symbol.iterator](),f;!(a=(f=l.next()).done);a=!0){var p=Se(f.value,2),d=p[0],_=p[1],h=H(_)?_.valueSchema:_;It(h)&&o.push(d)}}catch(y){c=!0,s=y}finally{try{!a&&l.return!=null&&l.return()}finally{if(c)throw s}}return Pt({value:t,requiredKeys:o,getProperty:function(y){var g=e[y];if(g!=null)return H(g)?{transformedKey:g.rawKey,transform:function(O){var w;return g.valueSchema.json(O,we(N({},n),{breadcrumbsPrefix:U((w=n?.breadcrumbsPrefix)!==null&&w!==void 0?w:[]).concat([y])}))}}:{transformedKey:y,transform:function(O){var w;return g.json(O,we(N({},n),{breadcrumbsPrefix:U((w=n?.breadcrumbsPrefix)!==null&&w!==void 0?w:[]).concat([y])}))}}},unrecognizedObjectKeys:n?.unrecognizedObjectKeys,skipValidation:n?.skipValidation,breadcrumbsPrefix:n?.breadcrumbsPrefix,omitUndefined:n?.omitUndefined})},getType:function(){return m.OBJECT}};return N({},E(r),v(r),D(r),q(r))}function Pt(e){var r=e.value,t=e.requiredKeys,n=e.getProperty,o=e.unrecognizedObjectKeys,a=o===void 0?"fail":o,c=e.skipValidation,s=c===void 0?!1:c,l=e.breadcrumbsPrefix,f=l===void 0?[]:l,p;if(!V(r))return{ok:!1,errors:[{path:f,message:b(r,"object")}]};var d=new Set(t),_=[],h={},y=!0,g=!1,O=void 0;try{for(var w=Object.entries(r)[Symbol.iterator](),k;!(y=(k=w.next()).done);y=!0){var K=Se(k.value,2),R=K[0],Ge=K[1],\$e=n(R);if(\$e!=null){d.delete(R);var qe=\$e.transform(Ge);if(qe.ok)h[\$e.transformedKey]=qe.value;else{var Mr;h[R]=Ge,(Mr=_).push.apply(Mr,U(qe.errors))}}else switch(a){case"fail":_.push({path:U(f).concat([R]),message:'Unexpected key "'.concat(R,'"')});break;case"strip":break;case"passthrough":h[R]=Ge;break}}}catch(ae){g=!0,O=ae}finally{try{!y&&w.return!=null&&w.return()}finally{if(g)throw O}}return(p=_).push.apply(p,U(t.filter(function(ae){return d.has(ae)}).map(function(ae){return{path:f,message:'Missing required key "'.concat(ae,'"')}}))),_.length===0||s?{ok:!0,value:h}:{ok:!1,errors:_}}function q(e){return{extend:function(r){var t={_getParsedProperties:function(){return U(e._getParsedProperties()).concat(U(r._getParsedProperties()))},_getRawProperties:function(){return U(e._getRawProperties()).concat(U(r._getRawProperties()))},parse:function(n,o){return At({extensionKeys:r._getRawProperties(),value:n,transformBase:function(a){return e.parse(a,o)},transformExtension:function(a){return r.parse(a,o)}})},json:function(n,o){return At({extensionKeys:r._getParsedProperties(),value:n,transformBase:function(a){return e.json(a,o)},transformExtension:function(a){return r.json(a,o)}})},getType:function(){return m.OBJECT}};return N({},t,v(t),D(t),q(t))},passthrough:function(){var r={_getParsedProperties:function(){return e._getParsedProperties()},_getRawProperties:function(){return e._getRawProperties()},parse:function(t,n){var o=e.parse(t,we(N({},n),{unrecognizedObjectKeys:"passthrough"}));return o.ok?{ok:!0,value:N({},t,o.value)}:o},json:function(t,n){var o=e.json(t,we(N({},n),{unrecognizedObjectKeys:"passthrough"}));return o.ok?{ok:!0,value:N({},t,o.value)}:o},getType:function(){return m.OBJECT}};return N({},r,v(r),D(r),q(r))}}}function At(e){var r=e.extensionKeys,t=e.value,n=e.transformBase,o=e.transformExtension,a=new Set(r),c=Se(St(_e(t),function(d){return a.has(d)}),2),s=c[0],l=c[1],f=n(ve(t,l)),p=o(ve(t,s));return f.ok&&p.ok?{ok:!0,value:N({},f.value,p.value)}:{ok:!1,errors:U(f.ok?[]:f.errors).concat(U(p.ok?[]:p.errors))}}function It(e){return!Ui(e)}function Ui(e){switch(e.getType()){case m.ANY:case m.UNKNOWN:case m.OPTIONAL:return!0;default:return!1}}function zt(e){return Ue(e)}function Ci(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Rt(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ci(e,o,t[o])})}return e}function Ki(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Di(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ki(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function jt(e){var r=Di(Rt({},Er(e)),{_getRawProperties:function(){return te(e)._getRawProperties()},_getParsedProperties:function(){return te(e)._getParsedProperties()}});return Rt({},r,v(r),D(r),q(r))}function zr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Ni(e){if(Array.isArray(e))return zr(e)}function Mi(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Bi(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Wi(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Tr(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Mi(e,o,t[o])})}return e}function Ji(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function kt(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ji(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function xe(e){return Ni(e)||Bi(e)||Li(e)||Wi()}function Li(e,r){if(e){if(typeof e=="string")return zr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return zr(e,r)}}function Ce(e){var r={parse:function(t,n){return Ut(t,function(o,a){var c;return e.parse(o,kt(Tr({},n),{breadcrumbsPrefix:xe((c=n?.breadcrumbsPrefix)!==null&&c!==void 0?c:[]).concat(["[".concat(a,"]")])}))})},json:function(t,n){return Ut(t,function(o,a){var c;return e.json(o,kt(Tr({},n),{breadcrumbsPrefix:xe((c=n?.breadcrumbsPrefix)!==null&&c!==void 0?c:[]).concat(["[".concat(a,"]")])}))})},getType:function(){return m.LIST}};return Tr({},E(r),v(r))}function Ut(e,r){if(!Array.isArray(e))return{ok:!1,errors:[{message:b(e,"list"),path:[]}]};var t=e.map(function(n,o){return r(n,o)});return t.reduce(function(n,o){if(n.ok&&o.ok)return{ok:!0,value:xe(n.value).concat([o.value])};var a=[];if(!n.ok){var c;(c=a).push.apply(c,xe(n.errors))}if(!o.ok){var s;(s=a).push.apply(s,xe(o.errors))}return{ok:!1,errors:a}},{ok:!0,value:[]})}function Ct(e){var r=I(m.STRING_LITERAL,function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.breadcrumbsPrefix,a=o===void 0?[]:o;return t===e?{ok:!0,value:e}:{ok:!1,errors:[{path:a,message:b(t,'"'.concat(e,'"'))}]}});return r()}function Kt(e){var r=I(m.BOOLEAN_LITERAL,function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=n.breadcrumbsPrefix,a=o===void 0?[]:o;return t===e?{ok:!0,value:e}:{ok:!1,errors:[{path:a,message:b(t,"".concat(e.toString()))}]}});return r()}var Dt=I(m.ANY,function(e){return{ok:!0,value:e}});var Nt=I(m.BOOLEAN,function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.breadcrumbsPrefix,n=t===void 0?[]:t;return typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:b(e,"boolean")}]}});var Mt=I(m.NUMBER,function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.breadcrumbsPrefix,n=t===void 0?[]:t;return typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:b(e,"number")}]}});var Bt=I(m.STRING,function(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},t=r.breadcrumbsPrefix,n=t===void 0?[]:t;return typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:n,message:b(e,"string")}]}});var Wt=I(m.UNKNOWN,function(e){return{ok:!0,value:e}});function Rr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Vi(e){if(Array.isArray(e))return e}function Hi(e){if(Array.isArray(e))return Rr(e)}function Lt(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function Fi(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Gi(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function \$i(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function qi(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function ne(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Lt(e,o,t[o])})}return e}function Yi(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function Oe(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yi(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function Xi(e,r){return Vi(e)||Gi(e,r)||Vt(e,r)||\$i()}function Y(e){return Hi(e)||Fi(e)||Vt(e)||qi()}function Vt(e,r){if(e){if(typeof e=="string")return Rr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return Rr(e,r)}}function Ht(e,r){var t={parse:function(n,o){return Jt({value:n,isKeyNumeric:e.getType()===m.NUMBER,transformKey:function(a){var c;return e.parse(a,Oe(ne({},o),{breadcrumbsPrefix:Y((c=o?.breadcrumbsPrefix)!==null&&c!==void 0?c:[]).concat(["".concat(a," (key)")])}))},transformValue:function(a,c){var s;return r.parse(a,Oe(ne({},o),{breadcrumbsPrefix:Y((s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[]).concat(["".concat(c)])}))},breadcrumbsPrefix:o?.breadcrumbsPrefix})},json:function(n,o){return Jt({value:n,isKeyNumeric:e.getType()===m.NUMBER,transformKey:function(a){var c;return e.json(a,Oe(ne({},o),{breadcrumbsPrefix:Y((c=o?.breadcrumbsPrefix)!==null&&c!==void 0?c:[]).concat(["".concat(a," (key)")])}))},transformValue:function(a,c){var s;return r.json(a,Oe(ne({},o),{breadcrumbsPrefix:Y((s=o?.breadcrumbsPrefix)!==null&&s!==void 0?s:[]).concat(["".concat(c)])}))},breadcrumbsPrefix:o?.breadcrumbsPrefix})},getType:function(){return m.RECORD}};return ne({},E(t),v(t))}function Jt(e){var r=e.value,t=e.isKeyNumeric,n=e.transformKey,o=e.transformValue,a=e.breadcrumbsPrefix,c=a===void 0?[]:a;return V(r)?ge(r).reduce(function(s,l){var f=Xi(l,2),p=f[0],d=f[1];if(d==null)return s;var _=s,h=p;if(t){var y=p.length>0?Number(p):NaN;isNaN(y)||(h=y)}var g=n(h),O=o(d,h);if(_.ok&&g.ok&&O.ok)return{ok:!0,value:Oe(ne({},_.value),Lt({},g.value,O.value))};var w=[];if(!_.ok){var k;(k=w).push.apply(k,Y(_.errors))}if(!g.ok){var K;(K=w).push.apply(K,Y(g.errors))}if(!O.ok){var R;(R=w).push.apply(R,Y(O.errors))}return{ok:!1,errors:w}},{ok:!0,value:{}}):{ok:!1,errors:[{path:c,message:b(r,"object")}]}}function jr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function Zi(e){if(Array.isArray(e))return jr(e)}function Qi(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ea(e,r){return r!=null&&typeof Symbol<"u"&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function ra(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ta(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function na(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Qi(e,o,t[o])})}return e}function oa(e){return Zi(e)||ra(e)||ia(e)||ta()}function ia(e,r){if(e){if(typeof e=="string")return jr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return jr(e,r)}}function Ft(e){var r=Ce(e),t={parse:function(n,o){var a=r.parse(n,o);return a.ok?{ok:!0,value:new Set(a.value)}:a},json:function(n,o){if(!ea(n,Set)){var a;return{ok:!1,errors:[{path:(a=o?.breadcrumbsPrefix)!==null&&a!==void 0?a:[],message:b(n,"Set")}]}}var c=r.json(oa(n),o);return c},getType:function(){return m.SET}};return na({},E(t),v(t))}function Gt(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function aa(e){if(Array.isArray(e))return e}function sa(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ca(e,r){var t=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(t!=null){var n=[],o=!0,a=!1,c,s;try{for(t=t.call(e);!(o=(c=t.next()).done)&&(n.push(c.value),!(r&&n.length===r));o=!0);}catch(l){a=!0,s=l}finally{try{!o&&t.return!=null&&t.return()}finally{if(a)throw s}}return n}}function ua(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function qt(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){sa(e,o,t[o])})}return e}function fa(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),t.push.apply(t,n)}return t}function la(e,r){return r=r??{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fa(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function pa(e,r){return aa(e)||ca(e,r)||ma(e,r)||ua()}function ma(e,r){if(e){if(typeof e=="string")return Gt(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return Gt(e,r)}}function Yt(e){var r={parse:function(t,n){return \$t(function(o,a){return o.parse(t,a)},e,n)},json:function(t,n){return \$t(function(o,a){return o.json(t,a)},e,n)},getType:function(){return m.UNDISCRIMINATED_UNION}};return qt({},E(r),v(r))}function \$t(e,r,t){var n=[],o=!0,a=!1,c=void 0;try{for(var s=r.entries()[Symbol.iterator](),l;!(o=(l=s.next()).done);o=!0){var f=pa(l.value,2),p=f[0],d=f[1],_=e(d,la(qt({},t),{skipValidation:!1}));if(_.ok)return _;var h=!0,y=!1,g=void 0;try{for(var O=_.errors[Symbol.iterator](),w;!(h=(w=O.next()).done);h=!0){var k=w.value;n.push({path:k.path,message:"[Variant ".concat(p,"] ").concat(k.message)})}}catch(K){y=!0,g=K}finally{try{!h&&O.return!=null&&O.return()}finally{if(y)throw g}}}}catch(K){a=!0,c=K}finally{try{!o&&s.return!=null&&s.return()}finally{if(a)throw c}}return{ok:!1,errors:n}}function Xt(e,r){return{parsedDiscriminant:e,rawDiscriminant:r}}function kr(e,r){(r==null||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function da(e){if(Array.isArray(e))return kr(e)}function Ur(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ya(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function ba(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function Cr(e){for(var r=1;r<arguments.length;r++){var t=arguments[r]!=null?arguments[r]:{},n=Object.keys(t);typeof Object.getOwnPropertySymbols=="function"&&(n=n.concat(Object.getOwnPropertySymbols(t).filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable}))),n.forEach(function(o){Ur(e,o,t[o])})}return e}function ha(e,r){if(e==null)return{};var t=ga(e,r),n,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o<a.length;o++)n=a[o],!(r.indexOf(n)>=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(t[n]=e[n])}return t}function ga(e,r){if(e==null)return{};var t={},n=Object.keys(e),o,a;for(a=0;a<n.length;a++)o=n[a],!(r.indexOf(o)>=0)&&(t[o]=e[o]);return t}function Kr(e){return da(e)||ya(e)||wa(e)||ba()}function va(e,r){if(Dr(e)!=="object"||e===null)return e;var t=e[Symbol.toPrimitive];if(t!==void 0){var n=t.call(e,r||"default");if(Dr(n)!=="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(r==="string"?String:Number)(e)}function _a(e){var r=va(e,"string");return Dr(r)==="symbol"?r:String(r)}function Dr(e){"@swc/helpers - typeof";return e&&typeof Symbol<"u"&&e.constructor===Symbol?"symbol":typeof e}function wa(e,r){if(e){if(typeof e=="string")return kr(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if(t==="Object"&&e.constructor&&(t=e.constructor.name),t==="Map"||t==="Set")return Array.from(t);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array\$/.test(t))return kr(e,r)}}function Qt(e,r){var t=typeof e=="string"?e:e.rawDiscriminant,n=typeof e=="string"?e:e.parsedDiscriminant,o=ke(_e(r)),a={parse:function(c,s){return Zt({value:c,discriminant:t,transformedDiscriminant:n,transformDiscriminantValue:function(l){var f;return o.parse(l,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:Kr((f=s?.breadcrumbsPrefix)!==null&&f!==void 0?f:[]).concat([t])})},getAdditionalPropertiesSchema:function(l){return r[l]},allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:function(l,f){return f.parse(l,s)},breadcrumbsPrefix:s?.breadcrumbsPrefix})},json:function(c,s){return Zt({value:c,discriminant:n,transformedDiscriminant:t,transformDiscriminantValue:function(l){var f;return o.json(l,{allowUnrecognizedEnumValues:s?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:Kr((f=s?.breadcrumbsPrefix)!==null&&f!==void 0?f:[]).concat([n])})},getAdditionalPropertiesSchema:function(l){return r[l]},allowUnrecognizedUnionMembers:s?.allowUnrecognizedUnionMembers,transformAdditionalProperties:function(l,f){return f.json(l,s)},breadcrumbsPrefix:s?.breadcrumbsPrefix})},getType:function(){return m.UNION}};return Cr({},E(a),v(a),D(a))}function Zt(e){var r=e.value,t=e.discriminant,n=e.transformedDiscriminant,o=e.transformDiscriminantValue,a=e.getAdditionalPropertiesSchema,c=e.allowUnrecognizedUnionMembers,s=c===void 0?!1:c,l=e.transformAdditionalProperties,f=e.breadcrumbsPrefix,p=f===void 0?[]:f;if(!V(r))return{ok:!1,errors:[{path:p,message:b(r,"object")}]};var d=r[t],_=ha(r,[t].map(_a));if(d==null)return{ok:!1,errors:[{path:p,message:'Missing discriminant ("'.concat(t,'")')}]};var h=o(d);if(!h.ok)return{ok:!1,errors:h.errors};var y=a(h.value);if(y==null)return s?{ok:!0,value:Cr(Ur({},n,h.value),_)}:{ok:!1,errors:[{path:Kr(p).concat([t]),message:"Unexpected discriminant value"}]};var g=l(_,y);return g.ok?{ok:!0,value:Cr(Ur({},n,d),g.value)}:g}var C=i.object({organizationId:i.string(),agentId:i.string(),settings:i.record(i.string(),i.unknown())});var en=i.object({}).extend(C);var rn=i.object({}).extend(C);var tn=i.enum_(["CONVERSATION","CONVERSATION_MESSAGE","KNOWLEDGE_BASE","KNOWLEDGE_DOCUMENT","ACTION","USER","EVENT","EVENT_TRIGGER","USER_PROFILE","FEEDBACK"]);var M=i.object({referenceId:i.string()});var J=i.object({type:tn,appId:i.string()}).extend(M);var x=i.object({organizationId:i.string(),agentId:i.string()}).extend(J);var nn=i.enum_(["THUMBS_UP","THUMBS_DOWN","INSERT","HANDOFF"]);var on=i.object({type:nn,text:i.string().optional()});var an=i.object({feedbackId:x,conversationId:x,conversationMessageId:x,userId:x.optional(),createdAt:i.date().optional()}).extend(on);var sn=i.object({feedbacks:i.list(an)}).extend(C);var cn=i.object({conversations:i.list(x)}).extend(C);var un=i.enum_(["EMAIL","PHONE_NUMBER"]);var Ke=i.object({value:i.string(),type:un});var fn=i.object({userId:M.optional(),userIdentifiers:i.list(Ke),allUserData:i.record(i.string(),i.record(i.string(),i.string())),defaultUserData:i.record(i.string(),i.string())});var ln=i.object({actionId:i.string(),conversationId:x.optional(),conversationMetadata:i.record(i.string(),i.string()),parameters:i.record(i.string(),i.unknown()),user:fn,transientData:i.record(i.string(),i.string()).optional()}).extend(C);var jp=i.object({response:i.string()});var pn=i.object({knowledgeBaseId:M}).extend(C);var Fp=i.object({message:i.string().optional()});var \$p=i.object({referenceId:i.string(),appId:i.string()});var mn=i.enum_(["text","array","color","image","multiline","section"]);var De=i.enum_(["VISIBLE","PARTIALLY_VISIBLE","HIDDEN"]);var dn=i.object({key:i.string(),displayName:i.string(),description:i.string().optional(),type:mn,visibility:De.optional(),fields:i.lazy(function(){return yn}).optional()});var yn=i.list(i.lazyObject(function(){return dn}));var bn=i.object({value:i.string(),visibility:De});var Ne=i.object({identifiers:i.list(Ke),data:i.record(i.string(),bn)});var um=i.object({userId:M}).extend(Ne);var mm=i.object({userId:x,allUserData:i.record(i.string(),i.record(i.string(),i.string())),defaultUserData:i.record(i.string(),i.string())}).extend(Ne);var hn=i.enum_(["CONVERSATION_CREATED","FEEDBACK_CREATED"]);var gn=i.object({description:i.string(),type:hn});var _m=i.object({triggerId:x}).extend(gn);var Sm=i.object({number:i.number(),size:i.number(),totalElements:i.number(),totalPages:i.number()});var Om=i.object({page:i.number().optional(),size:i.number().optional(),sortId:i.string().optional(),sortDesc:i.boolean().optional()});var Me=i.enum_(["STRING","BOOLEAN","NUMBER"]);var Be=i.object({label:i.string(),value:i.unknown()});var vn=i.enum_(["POSITIVE","NEGATIVE","NEUTRAL","MIXED","UNKNOWN"]);var _n=i.object({actionIds:i.list(J),incompleteActionIds:i.list(J)});var wn=i.object({userRequest:i.string().optional(),agentResponse:i.string().optional(),resolutionStatus:i.string().optional(),category:i.string().optional(),sentiment:vn.optional()});var We=i.enum_(["SHORT","MEDIUM","LONG"]);var Sn=i.enum_(["MARKDOWN","FORMS","IMAGES","CHARTS_HIGHCHARTS_TS"]);var xn=i.object({capabilities:i.list(Sn),isCopilot:i.boolean(),responseLength:We});var On=i.object({responseConfig:xn.optional(),subject:i.string().optional(),url:i.string().optional(),createdAt:i.date().optional(),updatedAt:i.date().optional(),tags:i.set(i.string()).optional(),metadata:i.record(i.string(),i.string()).optional()});var En=i.object({url:i.string()});var Pn=i.enum_(["USER","HUMAN_AGENT","EXTERNAL_SYSTEM"]);var Je=i.object({createdAt:i.date().optional(),updatedAt:i.date().optional()});var An=i.object({userId:M,text:i.string(),userMessageType:Pn}).extend(Je);var In=i.object({conversationMessageId:x,language:i.string().optional(),attachments:i.list(En)}).extend(An);var Tn=i.enum_(["BOT_RESPONSE","BOT_SUGGESTION"]);var zn=i.object({text:i.string()});var Rn=i.object({id:i.string(),label:i.string(),description:i.string(),required:i.boolean(),suggestion:i.unknown().optional(),type:Me,enumOptions:i.list(Be).optional()});var jn=i.object({id:i.string(),formLabel:i.string(),fields:i.list(Rn),submitLabel:i.string()});var kn=i.enum_(["HIGHCHARTS_TS"]);var Un=i.object({label:i.string(),specSchema:kn,spec:i.string()});var Cn=i.union("type",{text:zn,actionForm:jn,chart:Un}).transform({transform:function(e){return e},untransform:function(e){return e}});var Kn=i.object({title:i.string(),url:i.string()});var Dn=i.object({followupQuestions:i.list(i.string()),sources:i.list(Kn),language:i.string().optional()});var Nn=i.object({conversationMessageId:x,botMessageType:Tn,responses:i.list(Cn),metadata:Dn}).extend(Je);var Mn=i.union("type",{user:In,bot:Nn}).transform({transform:function(e){return e},untransform:function(e){return e}});var Id=i.object({conversationId:x,messages:i.list(Mn),analysis:wn,summary:_n,deleted:i.boolean()}).extend(On);var Nr=i.object({documentId:J,documentName:i.string(),documentExcerpt:i.string(),legacyCorpusMavenId:i.string(),legacyDocumentMavenId:i.string()});var Bn=i.object({knowledgeReviewed:i.list(Nr),knowledgeUtilized:i.list(Nr)});var Le=i.object({actionId:J,actionName:i.string()});var Ve=i.object({actionParameters:i.record(i.string(),i.unknown()),executionResult:i.string().optional(),executionError:i.string().optional()}).extend(Le);var Wn=i.object({actionsReviewed:i.list(Le),actionsExecuted:i.list(Ve)});var Jn=i.object({}).extend(Ve);var Ln=i.object({safetyCheckPassed:i.boolean()});var Vn=i.union("type",{knowledge:Bn,actions:Wn,form:Jn,safety:Ln}).transform({transform:function(e){return e},untransform:function(e){return e}});var Yd=i.object({items:i.list(Vn)});var Hn=i.object({id:i.string(),label:i.string(),description:i.string(),required:i.boolean(),type:Me.optional(),enumOptions:i.list(Be).optional()});var Fn=i.object({name:i.string(),description:i.string(),userInteractionRequired:i.boolean(),buttonName:i.string().optional(),precondition:i.lazy(function(){return He}).optional(),userFormParameters:i.list(Hn)});var iy=i.object({actionId:x}).extend(Fn);var Gn=i.enum_(["NOT"]);var F=i.object({operator:Gn.optional()});var Fe=i.object({key:i.string(),value:i.string().optional()}).extend(F);var \$n=i.object({tags:i.set(i.string())}).extend(F);var qn=i.object({actionId:i.string(),appId:i.string().optional()}).extend(F);var Yn=i.object({useMarkdown:i.boolean().optional(),useForms:i.boolean().optional(),useImages:i.boolean().optional(),isCopilot:i.boolean().optional(),responseLength:We.optional()}).extend(F);var Xn=i.union("conversationPreconditionType",{tags:\$n,metadata:Fe,actionExecuted:qn,responseConfig:Yn}).transform({transform:function(e){return e},untransform:function(e){return e}});var He=i.union("preconditionType",{user:Fe,conversation:i.object({value:Xn}),group:i.lazyObject(function(){return Zn})}).transform({transform:function(e){return e},untransform:function(e){return e}});var Qn=i.enum_(["AND","OR"]);var Zn=i.object({operator:Qn,preconditions:i.list(i.lazy(function(){return He}))});import oe from"../..";async function ie(e){let t=\`https://developers\${process.env.ENVIRONMENT===void 0?"":\`.\${process.env.ENVIRONMENT==="sandbox"?\`\${process.env.SANDBOX_USER}.sb\`:process.env.ENVIRONMENT}\`}.mavenagi-apis.com/.well-known/jwks\`,n=cr(new URL(t)),o=e.headers.get("authorization").replace("Bearer ","");await nr(o,n,{issuer:"https://developers.mavenagi.com",audience:process.env.MAVENAGI_APP_ID})}async function oh(e){await ie(e);let{organizationId:r,agentId:t,settings:n,actionId:o,conversationId:a,conversationMetadata:c,parameters:s,user:l,transientData:f}=ln.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{let p=await oe.executeAction?.({organizationId:r,agentId:t,settings:n,actionId:o,conversationId:a,conversationMetadata:c,parameters:s,user:l,transientData:f});return new Response(JSON.stringify({response:p}),{status:200,headers:{"Content-Type":"application/json"}})}catch(p){return console.error(p),p instanceof Error?new Response(p.message,{status:500}):new Response("No result returned",{status:204})}}async function ih(e){await ie(e);let{organizationId:r,agentId:t,settings:n,feedbacks:o}=sn.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.feedbackCreatedOrUpdated?.({organizationId:r,agentId:t,settings:n,feedbacks:o}),new Response(null)}catch(a){return console.error(a),a instanceof Error?new Response(a.message,{status:500}):new Response("Unknown error",{status:500})}}async function ah(e){await ie(e);let{organizationId:r,agentId:t,settings:n,conversations:o}=cn.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.conversationCreatedOrUpdated?.({organizationId:r,agentId:t,settings:n,conversations:o}),new Response(null)}catch(a){return console.error(a),a instanceof Error?new Response(a.message,{status:500}):new Response("Unknown error",{status:500})}}async function sh(e){await ie(e);let{organizationId:r,agentId:t,settings:n,knowledgeBaseId:o}=pn.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.knowledgeBaseRefreshed?.({organizationId:r,agentId:t,knowledgeBaseId:o,settings:n}),new Response(null)}catch(a){return console.error(a),a instanceof Error?new Response(a.message,{status:500}):new Response("Unknown error",{status:500})}}async function ch(e){await ie(e);let{organizationId:r,agentId:t,settings:n}=rn.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.postInstall?.({organizationId:r,agentId:t,settings:n}),new Response(null)}catch(o){return console.error(o),o instanceof Error?new Response(o.message,{status:400}):new Response("Unknown error",{status:500})}}async function uh(e){await ie(e);let{organizationId:r,agentId:t,settings:n}=en.parseOrThrow(await e.json(),{unrecognizedObjectKeys:"strip",allowUnrecognizedEnumValues:!0,allowUnrecognizedUnionMembers:!0});try{return await oe.preInstall?.({organizationId:r,agentId:t,settings:n}),new Response(null)}catch(o){return console.error(o),o instanceof Error?new Response(o.message,{status:400}):new Response("Unknown error",{status:500})}}export{ah as conversationCreatedOrUpdated,oh as executeAction,ih as feedbackCreatedOrUpdated,sh as knowledgeBaseRefreshed,ch as postInstall,uh as preInstall};\n`;
|
package/package.json
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mavenagi/apps",
|
|
3
|
-
"
|
|
4
|
-
"version": "1.0.0",
|
|
3
|
+
"version": "1.0.2",
|
|
5
4
|
"description": "CLI for developing apps for Maven AGI",
|
|
6
5
|
"main": "dist/index.js",
|
|
7
|
-
"types": "dist/index.d.ts",
|
|
8
6
|
"author": "Maven AGI",
|
|
9
7
|
"bin": {
|
|
10
8
|
"mavenagi": "dist/index.js"
|
|
11
9
|
},
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
|
|
15
|
-
"publish": "npm publish"
|
|
16
|
-
},
|
|
17
|
-
"devDependencies": {
|
|
18
|
-
"@types/node": "^22.10.1",
|
|
19
|
-
"typescript": "^5"
|
|
20
|
-
},
|
|
21
|
-
"nx": {
|
|
22
|
-
"targets": {
|
|
23
|
-
"build": {
|
|
24
|
-
"outputs": [
|
|
25
|
-
"{projectRoot}/dist/index.js"
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
]
|
|
30
13
|
}
|
package/index.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {execFileSync} from 'child_process'
|
|
3
|
-
import fs from 'fs'
|
|
4
|
-
|
|
5
|
-
// @ts-ignore
|
|
6
|
-
import {compiledUserWorkerEntrypointScript} from './next.js'
|
|
7
|
-
|
|
8
|
-
const p = (f: string) => `${fs.existsSync('./src') ? 'src/' : ''}${f}`
|
|
9
|
-
|
|
10
|
-
fs.rmSync(p('app/mavenagi-cgi'), {recursive: true, force: true})
|
|
11
|
-
fs.mkdirSync(p('app/mavenagi-cgi'), {recursive: true})
|
|
12
|
-
fs.writeFileSync(p('app/mavenagi-cgi/next.ts'), `// @ts-nocheck\n${compiledUserWorkerEntrypointScript}`)
|
|
13
|
-
Object.entries({
|
|
14
|
-
'pre-install': 'preInstall',
|
|
15
|
-
'post-install': 'postInstall',
|
|
16
|
-
feedbacks: 'feedbackCreatedOrUpdated',
|
|
17
|
-
conversations: 'conversationCreatedOrUpdated',
|
|
18
|
-
'execute-action': 'executeAction',
|
|
19
|
-
'knowledge-base-refreshed': 'knowledgeBaseRefreshed',
|
|
20
|
-
}).forEach(([f, name]) => {
|
|
21
|
-
fs.mkdirSync(p(`app/mavenagi-cgi/v1/${f}`), {recursive: true})
|
|
22
|
-
const indexFileContents = fs.readFileSync(p(`index.ts`), 'utf8')
|
|
23
|
-
const isEdge =
|
|
24
|
-
indexFileContents.includes("export const runtime = 'edge'") ||
|
|
25
|
-
indexFileContents.includes('export const runtime = "edge"')
|
|
26
|
-
fs.writeFileSync(
|
|
27
|
-
p(`app/mavenagi-cgi/v1/${f}/route.ts`),
|
|
28
|
-
`// @ts-nocheck\nimport {${name}} from '../../next'
|
|
29
|
-
import userWorker from '../../../..'
|
|
30
|
-
|
|
31
|
-
export const POST = ${name}
|
|
32
|
-
export const runtime = ${isEdge ? "'edge'" : "'nodejs'"}
|
|
33
|
-
export const maxDuration = 900
|
|
34
|
-
`
|
|
35
|
-
)
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
let packageManager = 'npm'
|
|
39
|
-
if (fs.existsSync('yarn.lock')) {
|
|
40
|
-
packageManager = 'yarn'
|
|
41
|
-
} else if (fs.existsSync('pnpm-lock.yaml')) {
|
|
42
|
-
packageManager = 'pnpm'
|
|
43
|
-
} else if (fs.existsSync('bun.lockb')) {
|
|
44
|
-
packageManager = 'bun'
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
execFileSync(packageManager, ['run', ...process.argv.slice(2)], {stdio: 'inherit'})
|
|
49
|
-
process.exit(0)
|
|
50
|
-
} catch (err: any) {
|
|
51
|
-
process.exit(err.status || 1)
|
|
52
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
-
|
|
27
|
-
/* Modules */
|
|
28
|
-
"module": "ES2022" /* Specify what module code is generated. */,
|
|
29
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
43
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
44
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
45
|
-
|
|
46
|
-
/* JavaScript Support */
|
|
47
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
48
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
49
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
-
|
|
51
|
-
/* Emit */
|
|
52
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
53
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
55
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
57
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
-
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
|
59
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
62
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
63
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
64
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
65
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
66
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
67
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
68
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
69
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
70
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
71
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
72
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
73
|
-
|
|
74
|
-
/* Interop Constraints */
|
|
75
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
76
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
77
|
-
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
78
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
79
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
80
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
81
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
82
|
-
|
|
83
|
-
/* Type Checking */
|
|
84
|
-
"strict": true /* Enable all strict type-checking options. */,
|
|
85
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
86
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
87
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
88
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
89
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
90
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
91
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
92
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
93
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
94
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
95
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
96
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
97
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
98
|
-
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
99
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
100
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
101
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
102
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
103
|
-
|
|
104
|
-
/* Completeness */
|
|
105
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
106
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
107
|
-
}
|
|
108
|
-
}
|