@telia-ace/alliance-internal-node-utilities 1.1.1-next.0 → 2.0.0-dev.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-26VIM55J.js → chunk-A5O3J5K5.js} +19 -19
- package/dist/chunk-RVFY4UX4.js +32 -0
- package/dist/compile-distribution.js +22 -13
- package/dist/index.d.ts +18 -25
- package/dist/index.js +3 -3
- package/dist/prompt-LQKYOZP6.js +45 -0
- package/package.json +4 -4
- package/dist/chunk-EBHULZEM.js +0 -32
- package/dist/chunk-JG7V63GM.js +0 -1
- package/dist/main-FN5JZTIU.js +0 -9
- package/dist/prompt-YMONYGAG.js +0 -45
package/dist/index.d.ts
CHANGED
|
@@ -6,14 +6,15 @@ import { AppManifest } from '@telia-ace/alliance-framework/manifest';
|
|
|
6
6
|
|
|
7
7
|
type BearerTokenSettings = {
|
|
8
8
|
privateKey: string;
|
|
9
|
-
aud: string;
|
|
10
|
-
sub: string;
|
|
11
|
-
name: string;
|
|
12
9
|
user: {
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
id: string;
|
|
11
|
+
firstName: string;
|
|
12
|
+
lastName: string;
|
|
15
13
|
email: string;
|
|
14
|
+
permissions: string[];
|
|
15
|
+
accessToken: string;
|
|
16
16
|
};
|
|
17
|
+
audience: string;
|
|
17
18
|
workspace: {
|
|
18
19
|
name: string;
|
|
19
20
|
slug: string;
|
|
@@ -34,7 +35,6 @@ declare const zKeyConfig: z.ZodObject<Pick<{
|
|
|
34
35
|
SERVICE_PORT: z.ZodDefault<z.ZodEffects<z.ZodString, number, string>>;
|
|
35
36
|
REDIS_HOST: z.ZodString;
|
|
36
37
|
REDIS_PASSWORD: z.ZodOptional<z.ZodString>;
|
|
37
|
-
COMMON_DOMAIN: z.ZodDefault<z.ZodEffects<z.ZodEnum<["true", "false"]>, boolean, "true" | "false">>;
|
|
38
38
|
}, "JWT_PRIVATE_KEY" | "JWT_PUBLIC_CSP_KEY">, "strip", z.ZodTypeAny, {
|
|
39
39
|
JWT_PRIVATE_KEY: string;
|
|
40
40
|
JWT_PUBLIC_CSP_KEY: string;
|
|
@@ -42,21 +42,21 @@ declare const zKeyConfig: z.ZodObject<Pick<{
|
|
|
42
42
|
JWT_PRIVATE_KEY?: string | undefined;
|
|
43
43
|
JWT_PUBLIC_CSP_KEY?: string | undefined;
|
|
44
44
|
}>;
|
|
45
|
-
declare function createBearerToken({ privateKey,
|
|
45
|
+
declare function createBearerToken({ privateKey, audience, user, workspace, organization, expiration, }: BearerTokenSettings): string;
|
|
46
46
|
type BearerTokenContent = {
|
|
47
47
|
iss: 'Alliance';
|
|
48
48
|
aud: string;
|
|
49
49
|
sub: string;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
firstName: string;
|
|
51
|
+
lastName: string;
|
|
52
|
+
email: string;
|
|
53
|
+
accessToken: string;
|
|
54
|
+
workspace: string;
|
|
55
|
+
organization: string;
|
|
56
|
+
permissions: string[];
|
|
57
|
+
workspaceName: string;
|
|
57
58
|
};
|
|
58
59
|
declare function getPrivateKey(config: Pick<z.infer<typeof zKeyConfig>, 'JWT_PRIVATE_KEY'>): string;
|
|
59
|
-
declare function createSystemUserToken(config: Pick<z.infer<typeof zKeyConfig>, 'JWT_PRIVATE_KEY'>): string;
|
|
60
60
|
type PublicKeys = {
|
|
61
61
|
pkcs: string;
|
|
62
62
|
spki: string;
|
|
@@ -120,12 +120,6 @@ declare const zSharedConfig: z.ZodObject<{
|
|
|
120
120
|
* Optional
|
|
121
121
|
*/
|
|
122
122
|
REDIS_PASSWORD: z.ZodOptional<z.ZodString>;
|
|
123
|
-
/**
|
|
124
|
-
* Whether the service should use common domain as workspace and user handling instead of legacy
|
|
125
|
-
*
|
|
126
|
-
* Optional, defaults to "false"
|
|
127
|
-
*/
|
|
128
|
-
COMMON_DOMAIN: z.ZodDefault<z.ZodEffects<z.ZodEnum<["true", "false"]>, boolean, "true" | "false">>;
|
|
129
123
|
}, "strip", z.ZodTypeAny, {
|
|
130
124
|
AUTH_COOKIE_NAME: string;
|
|
131
125
|
AUTH_COOKIE_SECRET: string;
|
|
@@ -135,7 +129,6 @@ declare const zSharedConfig: z.ZodObject<{
|
|
|
135
129
|
SERVICE_LOG_LEVEL: "silent" | "fatal" | "error" | "warn" | "info" | "debug" | "trace";
|
|
136
130
|
SERVICE_PORT: number;
|
|
137
131
|
REDIS_HOST: string;
|
|
138
|
-
COMMON_DOMAIN: boolean;
|
|
139
132
|
REDIS_PASSWORD?: string | undefined;
|
|
140
133
|
}, {
|
|
141
134
|
DB_ENDPOINT: string;
|
|
@@ -147,7 +140,6 @@ declare const zSharedConfig: z.ZodObject<{
|
|
|
147
140
|
SERVICE_LOG_LEVEL?: "silent" | "fatal" | "error" | "warn" | "info" | "debug" | "trace" | undefined;
|
|
148
141
|
SERVICE_PORT?: string | undefined;
|
|
149
142
|
REDIS_PASSWORD?: string | undefined;
|
|
150
|
-
COMMON_DOMAIN?: "true" | "false" | undefined;
|
|
151
143
|
}>;
|
|
152
144
|
|
|
153
145
|
declare enum AllianceHeaders {
|
|
@@ -177,7 +169,8 @@ declare enum GatewayErrorCode {
|
|
|
177
169
|
WorkspacePermissionDenied = 10013,
|
|
178
170
|
NoTargetUrlHeader = 10014,
|
|
179
171
|
NoSessionInRedisCache = 10015,
|
|
180
|
-
ProhibitedTargetDomain = 10016
|
|
172
|
+
ProhibitedTargetDomain = 10016,
|
|
173
|
+
NoOrganizationInRequestContext = 10017
|
|
181
174
|
}
|
|
182
175
|
declare enum DataErrorCode {
|
|
183
176
|
NoPublicKey = 11000,
|
|
@@ -242,4 +235,4 @@ declare function getAppManifests(apps: string[]): Promise<AppManifest[]>;
|
|
|
242
235
|
|
|
243
236
|
declare function slugify(value: string, replacement?: string): string;
|
|
244
237
|
|
|
245
|
-
export { AllianceError, AllianceHeaders, type AppImportInfo, type BearerTokenContent, DataErrorCode, GatewayErrorCode, type Logger, type PublicKeys, createBearerToken, createFileStorage, createIndexHtml, createLogger, createPrettyLogger, createPublicKeys,
|
|
238
|
+
export { AllianceError, AllianceHeaders, type AppImportInfo, type BearerTokenContent, DataErrorCode, GatewayErrorCode, type Logger, type PublicKeys, createBearerToken, createFileStorage, createIndexHtml, createLogger, createPrettyLogger, createPublicKeys, getAppManifests, getCleanPublicKey, getPrivateKey, requestErrorHandler, requestLoggerHandler, slugify, zBooleanEnum, zNonEmptyString, zSharedConfig };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as E,b as
|
|
1
|
+
import{a as E,b as ae,c as ue,d as ce}from"./chunk-RVFY4UX4.js";import"./chunk-A5O3J5K5.js";import{createPublicKey as ge}from"node:crypto";import fe from"jsonwebtoken";var me=E.enum(["true","false"]).transform(e=>e==="true"),y=E.string().min(1),S=E.object({AUTH_COOKIE_NAME:y.default("alliance-auth"),AUTH_COOKIE_SECRET:y.default("zlLZBlk7wt8lypP5lA4D"),DB_ENDPOINT:y,JWT_PRIVATE_KEY:y.default("MIIEogIBAAKCAQEAsGqOzjnfQtCYlDqhgGAnKuJOCiPt2WpCmL1Cs+SLBQlyoNn6LT8BJ6ZRj8t/vK8Sw0p51Uq/3k0tazh7bLGkWNMBLY3BqFiNRMMnCqHJfvGIUi/itNXNe2kbP7H3rbyQTu4O7yH/ZAMitdpF2KLucVRlFxrQ/ggZjxwEGso4JUnCwmAnoKct/uupKz9Y2PMTr00WWN79aPfD4LcKi570VJqBT3ISSucdwFLYNqnOkQnEa8O8xbthQhiI0k1GGJT+GCQcATUPeEbaCFXonOrJm+CyuMmQWYLFF3NbE5NllU1jz9PYHzp2hAgAx8WGeretTvpEA1dE2gvXNESGbQ8FxQIDAQABAoIBAAjTJmud1348eGAfLV8CRaij2MAxxenJ9/ozVXfcPIa2+fCelsuBSv8pwbYODvNoVT7xpcs2nwccGI6JgnBl09EhqlMWCT7w7GLT2aBy3A/T6JF76xJICQGzDfWPYygMtlyhv0YqZDUjjFlJHun+/ysqIUMY81AR0FLUAEc6yw41ChcdSvTgIqBM9f5PsBRK7zOgdW1vcVQiZbf2Vqr+7wTJ+6b9A4rWnnAqesGDXqYupx3UJEu3x0wRNQB8FeiG9iJrw4cyD9SmM95doTyKosQ2PWWnUO1NMgmWCR/mWcKZAUcfZUpnQ8rz75WAWept8ZIOOdha8UZ1B/kw3EsVdEECgYEA3iN0BRUqMN0J69bazvlNOWtI+Chc1lYMt/tZ4p78pIJpAZvc3rQ9lAp6JvOEno2IglULA4I+ZLUmpz+lfu7XxKMNOI3cnG7WdiGbiIlwOSwuxzeO1FJqhtnc0U6mNkIjptV8b2etj8U2/SXAC3CC8XgsawAj9A/I7awlCL3NXdECgYEAy07gun3rcd3Y0ISmd3+SbAn/MbGf8uRLcfSc2ls9B6m3pXj25prXJWIrB6DyGuL/HQmHzffQkOeXmwFGHFXyiIFOIITX4z8b9lMnavgUZoPDY+ZFsxp6I7vMn75AetB8wYXpOFFeCG/Ck/VSIYP7oAN8kLw8EHdOuNbZYbu34bUCgYBYd14ZOBiZZS4yUlrJ2tc6atOgoNJ4OcTO8LcXXaHYEmenUF9iAf4UGygSoyDJ1CvtW9kLCK+4g7xlFx/dsVkU4qq9PyIA2tNmMHQ0qCedXU8z35huTnRGSDV81gmzyhtQsezgoTWp8Cy6HHKjG6fKasWlx2SKKk8m+Eu3c396QQKBgBMY2asq4M7VU+RiUXCwHwTe+4Wjda7PGvcdTw6Du3vYyVNVxXtr2AG+8uPIjnVQFT6ZApSqToEOAAOjXv6SZDHGU5xiXhUOfIXq0a0OmHv4rIXZv3pPZmGs5k+rA0uGAfH7riiIHBkWxmQ3ivty9lPVgAHobIvvaQmbxNeVVnRxAoGAUzUmcBiUAiODfjulrpYvWG0tCn5B//yk7g1Tm3Chrh9huA1qGEN3jDoqSsTd5k4Yi5foyAZt5ORgoiUVm4IsfS56aoxIco1CtFG3zeMQRy4uKzTsvUTOdsJ4RlQdjNwpngXR44VL0WelgCDqTqJwn5ubzPvuIHuTj3cBpmJCjOo="),JWT_PUBLIC_CSP_KEY:E.string().min(1).default("BgIAAACkAABSU0ExAAgAAAEAAQDFBQ9thkQ01wvaRFcDRPpOrbd6hsXHAAiEdjof2NPPY02VZZMTW3MXxYJZkMm4suCbyeqc6FUI2kZ4DzUBHCQY/pQYRk3SiBhCYbvFvMNrxAmRzqk22FLAHedKEnJPgZpU9J6LCrfgw/do/d5YFk2vE/PYWD8rqev+LaegJ2DCwkklOMoaBByPGQj+0BoXZVRx7qLYRdq1IgNk/yHvDu5OkLyt97E/G2l7zdW04i9SiPF+yaEKJ8NEjViowY0tAdNYpLFsezhrLU3ev0rVeUrDEq+8f8uPUaYnAT8t+tmgcgkFi+SzQr2YQmrZ7SMKTuIqJ2CAoTqUmNBC3znOjmqw"),SERVICE_LOG_LEVEL:E.enum(["silent","fatal","error","warn","info","debug","trace"]).default("trace"),SERVICE_PORT:y.transform(Number).default("3000"),REDIS_HOST:y,REDIS_PASSWORD:y.optional()});var K=(c=>(c.TargetUrl="alliance-target-url",c.TargetApp="alliance-target-app",c.TargetWorkspace="alliance-target-workspace",c.TargetOrganization="alliance-target-organization",c))(K||{});var Xe=S.pick({JWT_PRIVATE_KEY:!0,JWT_PUBLIC_CSP_KEY:!0});function le({privateKey:e,audience:t,user:n,workspace:u,organization:c,expiration:f="1h"}){return`Bearer ${fe.sign({iss:"Alliance",aud:t,sub:n.id,firstName:n.firstName,lastName:n.lastName,accessToken:n.accessToken,email:n.email,permissions:n.permissions,workspace:u.slug,organization:c.slug,workspaceName:u.name},e,{expiresIn:f,algorithm:"RS256"})}`}function M(e){return`-----BEGIN RSA PRIVATE KEY-----
|
|
2
2
|
`+e.JWT_PRIVATE_KEY+`
|
|
3
|
-
-----END RSA PRIVATE KEY-----`}function
|
|
4
|
-
`,"")}var Y=(i=>(i[i.NoObjectId=10001]="NoObjectId",i[i.NoTargetAppHeader=10002]="NoTargetAppHeader",i[i.NoTargetWorkspaceHeader=10003]="NoTargetWorkspaceHeader",i[i.NoManifest=10006]="NoManifest",i[i.NoRequestContext=10007]="NoRequestContext",i[i.NoUserInRequestContext=10008]="NoUserInRequestContext",i[i.NoAppInRequestContext=10009]="NoAppInRequestContext",i[i.NoWorkspaceInRequestContext=10010]="NoWorkspaceInRequestContext",i[i.NoUserPermissionsInRequestContext=10012]="NoUserPermissionsInRequestContext",i[i.WorkspacePermissionDenied=10013]="WorkspacePermissionDenied",i[i.NoTargetUrlHeader=10014]="NoTargetUrlHeader",i[i.NoSessionInRedisCache=10015]="NoSessionInRedisCache",i[i.ProhibitedTargetDomain=10016]="ProhibitedTargetDomain",i))(Y||{}),D=(n=>(n[n.NoPublicKey=11e3]="NoPublicKey",n[n.NoAuthHeader=11001]="NoAuthHeader",n))(D||{});var J={10001:{statusCode:401,msg:"No object id available on authenticated user."},10002:{statusCode:400,msg:"Request missing header 'alliance-target-app'."},10003:{statusCode:400,msg:"Request missing header 'alliance-target-workspace'."},10014:{statusCode:400,msg:"Request missing header 'alliance-target-url'."},10015:{statusCode:401,msg:"Could not find user session in Redis server."},10006:{statusCode:500,msg:"Could not find manifest for app '{{appSlug}}'."},10007:{statusCode:500,msg:"No request context."},10008:{statusCode:500,msg:"No user in request context."},10009:{statusCode:500,msg:"No app in request context."},10010:{statusCode:500,msg:"No workspace in request context."},10012:{statusCode:500,msg:"No user permissions in request context."},10013:{statusCode:403,msg:"User does not have access to the current workspace."},10016:{statusCode:403,msg:"Request prohibited - REQUEST_DOMAIN_WHITE_LIST does not contain '{{domain}}'."},11e3:{statusCode:401,msg:"No public key available to decode JWT."},11001:{statusCode:401,msg:"No authorization header found."},12e3:{statusCode:401,msg:"No object id found in user claims."}};var O=class extends Error{constructor(n,u={}){let{msg:m,statusCode:l}=J[n],f=he(m,u);super(f);this.errorCode=n;this.message=f,this.statusCode=l,this.info=`https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${this.errorCode}`}info;statusCode};function he(e,t){return Object.entries(t).reduce((n,[u,m])=>n.replaceAll(`{{${u}}}`,m),e)}function Ie(e){return(t,n,u,m)=>{let l={cause:t.cause,message:t.message,status:t.status||t.statusCode||t.code,info:t.info};return e.error("error when processing request",{url:n.url,body:n.body,error:l}),u.status(l.status).json(l)}}import{homedir as _e,tmpdir as qe}from"node:os";import{resolve as ke}from"node:path";var ve=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,we=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Ee=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Ce(e,t){if(e==="__proto__"||e==="constructor"&&t&&typeof t=="object"&&"prototype"in t){xe(e);return}return t}function xe(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function A(e,t={}){if(typeof e!="string")return e;let n=e.trim();if(e[0]==='"'&&e.at(-1)==='"'&&!e.includes("\\"))return n.slice(1,-1);if(n.length<=9){let u=n.toLowerCase();if(u==="true")return!0;if(u==="false")return!1;if(u==="undefined")return;if(u==="null")return null;if(u==="nan")return Number.NaN;if(u==="infinity")return Number.POSITIVE_INFINITY;if(u==="-infinity")return Number.NEGATIVE_INFINITY}if(!Ee.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(ve.test(e)||we.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,Ce)}return JSON.parse(e)}catch(u){if(t.strict)throw u;return e}}function Ae(e){return!e||typeof e.then!="function"?Promise.resolve(e):e}function p(e,...t){try{return Ae(e(...t))}catch(n){return Promise.reject(n)}}function Pe(e){let t=typeof e;return e===null||t!=="object"&&t!=="function"}function Ne(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function P(e){if(Pe(e))return String(e);if(Ne(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return P(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function H(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}var z="base64:";function Q(e){if(typeof e=="string")return e;H();let t=Buffer.from(e).toString("base64");return z+t}function G(e){return typeof e!="string"||!e.startsWith(z)?e:(H(),Buffer.from(e.slice(z.length),"base64"))}var Re=["hasItem","getItem","getItemRaw","setItem","setItemRaw","removeItem","getMeta","setMeta","removeMeta","getKeys","clear","mount","unmount"];function b(e,t){if(t=C(t),!t)return e;let n={...e};for(let u of Re)n[u]=(m="",...l)=>e[u](t+m,...l);return n.getKeys=(u="",...m)=>e.getKeys(t+u,...m).then(l=>l.map(f=>f.slice(t.length))),n}function g(e){return e?e.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function Z(...e){return g(e.join(":"))}function C(e){return e=g(e),e?e+":":""}var Te="memory",Se=()=>{let e=new Map;return{name:Te,options:{},hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys(){return Array.from(e.keys())},clear(){e.clear()},dispose(){e.clear()}}};function ee(e={}){let t={mounts:{"":e.driver||Se()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=r=>{for(let o of t.mountpoints)if(r.startsWith(o))return{base:o,relativeKey:r.slice(o.length),driver:t.mounts[o]};return{base:"",relativeKey:r,driver:t.mounts[""]}},u=(r,o)=>t.mountpoints.filter(s=>s.startsWith(r)||o&&r.startsWith(s)).map(s=>({relativeBase:r.length>s.length?r.slice(s.length):void 0,mountpoint:s,driver:t.mounts[s]})),m=(r,o)=>{if(t.watching){o=g(o);for(let s of t.watchListeners)s(r,o)}},l=async()=>{if(!t.watching){t.watching=!0;for(let r in t.mounts)t.unwatch[r]=await X(t.mounts[r],m,r)}},f=async()=>{if(t.watching){for(let r in t.unwatch)await t.unwatch[r]();t.unwatch={},t.watching=!1}},y=(r,o,s)=>{let a=new Map,i=c=>{let d=a.get(c.base);return d||(d={driver:c.driver,base:c.base,items:[]},a.set(c.base,d)),d};for(let c of r){let d=typeof c=="string",N=g(d?c:c.key),I=d?void 0:c.value,T=d||!c.options?o:{...o,...c.options},W=n(N);i(W).items.push({key:N,value:I,relativeKey:W.relativeKey,options:T})}return Promise.all([...a.values()].map(c=>s(c))).then(c=>c.flat())},x={hasItem(r,o={}){r=g(r);let{relativeKey:s,driver:a}=n(r);return p(a.hasItem,s,o)},getItem(r,o={}){r=g(r);let{relativeKey:s,driver:a}=n(r);return p(a.getItem,s,o).then(i=>A(i))},getItems(r,o){return y(r,o,s=>s.driver.getItems?p(s.driver.getItems,s.items.map(a=>({key:a.relativeKey,options:a.options})),o).then(a=>a.map(i=>({key:Z(s.base,i.key),value:A(i.value)}))):Promise.all(s.items.map(a=>p(s.driver.getItem,a.relativeKey,a.options).then(i=>({key:a.key,value:A(i)})))))},getItemRaw(r,o={}){r=g(r);let{relativeKey:s,driver:a}=n(r);return a.getItemRaw?p(a.getItemRaw,s,o):p(a.getItem,s,o).then(i=>G(i))},async setItem(r,o,s={}){if(o===void 0)return x.removeItem(r);r=g(r);let{relativeKey:a,driver:i}=n(r);i.setItem&&(await p(i.setItem,a,P(o),s),i.watch||m("update",r))},async setItems(r,o){await y(r,o,async s=>{s.driver.setItems&&await p(s.driver.setItems,s.items.map(a=>({key:a.relativeKey,value:P(a.value),options:a.options})),o),s.driver.setItem&&await Promise.all(s.items.map(a=>p(s.driver.setItem,a.relativeKey,P(a.value),a.options)))})},async setItemRaw(r,o,s={}){if(o===void 0)return x.removeItem(r,s);r=g(r);let{relativeKey:a,driver:i}=n(r);if(i.setItemRaw)await p(i.setItemRaw,a,o,s);else if(i.setItem)await p(i.setItem,a,Q(o),s);else return;i.watch||m("update",r)},async removeItem(r,o={}){typeof o=="boolean"&&(o={removeMeta:o}),r=g(r);let{relativeKey:s,driver:a}=n(r);a.removeItem&&(await p(a.removeItem,s,o),(o.removeMeta||o.removeMata)&&await p(a.removeItem,s+"$",o),a.watch||m("remove",r))},async getMeta(r,o={}){typeof o=="boolean"&&(o={nativeOnly:o}),r=g(r);let{relativeKey:s,driver:a}=n(r),i=Object.create(null);if(a.getMeta&&Object.assign(i,await p(a.getMeta,s,o)),!o.nativeOnly){let c=await p(a.getItem,s+"$",o).then(d=>A(d));c&&typeof c=="object"&&(typeof c.atime=="string"&&(c.atime=new Date(c.atime)),typeof c.mtime=="string"&&(c.mtime=new Date(c.mtime)),Object.assign(i,c))}return i},setMeta(r,o,s={}){return this.setItem(r+"$",o,s)},removeMeta(r,o={}){return this.removeItem(r+"$",o)},async getKeys(r,o={}){r=C(r);let s=u(r,!0),a=[],i=[];for(let c of s){let N=(await p(c.driver.getKeys,c.relativeBase,o)).map(I=>c.mountpoint+g(I)).filter(I=>!a.some(T=>I.startsWith(T)));i.push(...N),a=[c.mountpoint,...a.filter(I=>!I.startsWith(c.mountpoint))]}return r?i.filter(c=>c.startsWith(r)&&!c.endsWith("$")):i.filter(c=>!c.endsWith("$"))},async clear(r,o={}){r=C(r),await Promise.all(u(r,!1).map(async s=>{if(s.driver.clear)return p(s.driver.clear,s.relativeBase,o);if(s.driver.removeItem){let a=await s.driver.getKeys(s.relativeBase||"",o);return Promise.all(a.map(i=>s.driver.removeItem(i,o)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(r=>$(r)))},async watch(r){return await l(),t.watchListeners.push(r),async()=>{t.watchListeners=t.watchListeners.filter(o=>o!==r),t.watchListeners.length===0&&await f()}},async unwatch(){t.watchListeners=[],await f()},mount(r,o){if(r=C(r),r&&t.mounts[r])throw new Error(`already mounted at ${r}`);return r&&(t.mountpoints.push(r),t.mountpoints.sort((s,a)=>a.length-s.length)),t.mounts[r]=o,t.watching&&Promise.resolve(X(o,m,r)).then(s=>{t.unwatch[r]=s}).catch(console.error),x},async unmount(r,o=!0){r=C(r),!(!r||!t.mounts[r])&&(t.watching&&r in t.unwatch&&(t.unwatch[r](),delete t.unwatch[r]),o&&await $(t.mounts[r]),t.mountpoints=t.mountpoints.filter(s=>s!==r),delete t.mounts[r])},getMount(r=""){r=g(r)+":";let o=n(r);return{driver:o.driver,base:o.base}},getMounts(r="",o={}){return r=g(r),u(r,o.parents).map(a=>({driver:a.driver,base:a.mountpoint}))}};return x}function X(e,t,n){return e.watch?e.watch((u,m)=>t(u,n+m)):()=>{}}async function $(e){typeof e.dispose=="function"&&await p(e.dispose)}import{existsSync as Le,promises as Oe}from"fs";import{resolve as ze,join as be}from"path";function R(e,t,n){return new Error(`[unstorage] [${e}] ${t}`,n)}function te(e,t){return Array.isArray(t)?R(e,`Missing some of the required options ${t.map(n=>"`"+n+"`").join(", ")}`):R(e,`Missing required option \`${t}\`.`)}import{existsSync as Ke,promises as v}from"fs";import{resolve as ne,dirname as oe}from"path";function B(e){return e.code==="ENOENT"||e.code==="EISDIR"?null:e}function re(e){return e.code==="EEXIST"?null:e}async function _(e,t,n){return await ae(oe(e)),v.writeFile(e,t,n)}function q(e,t){return v.readFile(e,t).catch(B)}function se(e){return v.unlink(e).catch(B)}function ie(e){return v.readdir(e,{withFileTypes:!0}).catch(B).then(t=>t||[])}async function ae(e){Ke(e)||(await ae(oe(e)).catch(re),await v.mkdir(e).catch(re))}async function k(e,t){if(t&&t(e))return[];let n=await ie(e),u=[];return await Promise.all(n.map(async m=>{let l=ne(e,m.name);if(m.isDirectory()){let f=await k(l,t);u.push(...f.map(y=>m.name+"/"+y))}else t&&t(m.name)||u.push(m.name)})),u}async function U(e){let t=await ie(e);await Promise.all(t.map(n=>{let u=ne(e,n.name);return n.isDirectory()?U(u).then(()=>v.rmdir(u)):v.unlink(u)}))}var Be=/\.\.\:|\.\.$/,F="fs-lite",ue=(e={})=>{if(!e.base)throw te(F,"base");e.base=ze(e.base);let t=n=>{if(Be.test(n))throw R(F,`Invalid key: ${JSON.stringify(n)}. It should not contain .. segments`);return be(e.base,n.replace(/:/g,"/"))};return{name:F,options:e,hasItem(n){return Le(t(n))},getItem(n){return q(t(n),"utf8")},getItemRaw(n){return q(t(n))},async getMeta(n){let{atime:u,mtime:m,size:l,birthtime:f,ctime:y}=await Oe.stat(t(n)).catch(()=>({}));return{atime:u,mtime:m,size:l,birthtime:f,ctime:y}},setItem(n,u){if(!e.readOnly)return _(t(n),u,"utf8")},setItemRaw(n,u){if(!e.readOnly)return _(t(n),u)},removeItem(n){if(!e.readOnly)return se(t(n))},getKeys(){return k(t("."),e.ignore)},async clear(){e.readOnly||e.noClear||await U(t("."))}}};function Ue({prefix:e,logger:t}){return b(ee({driver:ue({base:Fe({logger:t})})}),e)}function Fe({logger:e}){let t="";try{t=_e()}catch(n){e.error("could not use homedir, trying tmpdir",{error:n?.message})}if(!t)try{t=qe()}catch(n){e.error("could not use tmpdir, trying process.cwd",{error:n?.message})}if(!t)try{t=process.cwd()}catch(n){e.error("could not use process.cwd, exiting",{error:n?.message}),process.exit(1)}return ke(t,".alliance")}import Me from"pino";function w(e){return t=>(n,u)=>e[t]({...u,msg:n})}function We(e){return M(e,{target:"pino-pretty",options:{colorize:!0,ignore:"time,pid,hostname",messageFormat:"{msg}"}})}function M(e,t){let n=Me({level:e.SERVICE_LOG_LEVEL,redact:["authorization","headers.authorization","req.headers.authorization","res.headers.authorization","req.headers.cookie",'res.headers["set-cookie"]'],transport:t});return{fatal:w(n)("fatal"),error:w(n)("error"),warn:w(n)("warn"),info:w(n)("info"),debug:w(n)("debug"),trace:w(n)("trace"),silent:w(n)("silent"),child:()=>M(e),level:e.SERVICE_LOG_LEVEL}}function je(e){return(t,n,u)=>(e.trace("received request",{url:t.url,params:t.params,query:t.query,body:t.body}),u())}export{O as AllianceError,K as AllianceHeaders,D as DataErrorCode,Y as GatewayErrorCode,V as createBearerToken,Ue as createFileStorage,me as createIndexHtml,M as createLogger,We as createPrettyLogger,de as createPublicKeys,fe as createSystemUserToken,le as getAppManifests,ye as getCleanPublicKey,L as getPrivateKey,Ie as requestErrorHandler,je as requestLoggerHandler,ce as slugify,j as zBooleanEnum,h as zNonEmptyString,S as zSharedConfig};
|
|
3
|
+
-----END RSA PRIVATE KEY-----`}function pe(e){let t=M(e),n=ge(t);return{pkcs:n.export({type:"pkcs1",format:"pem"}).toString().trim(),spki:n.export({type:"spki",format:"pem"}).toString().trim(),csp:e.JWT_PUBLIC_CSP_KEY}}function de(e,t){return t[e].replace("-----BEGIN RSA PUBLIC KEY-----","").replace("-----END RSA PUBLIC KEY-----","").replace("-----BEGIN PUBLIC KEY-----","").replace("-----END PUBLIC KEY-----","").trim().replaceAll(`
|
|
4
|
+
`,"")}var _=(s=>(s[s.NoObjectId=10001]="NoObjectId",s[s.NoTargetAppHeader=10002]="NoTargetAppHeader",s[s.NoTargetWorkspaceHeader=10003]="NoTargetWorkspaceHeader",s[s.NoManifest=10006]="NoManifest",s[s.NoRequestContext=10007]="NoRequestContext",s[s.NoUserInRequestContext=10008]="NoUserInRequestContext",s[s.NoAppInRequestContext=10009]="NoAppInRequestContext",s[s.NoWorkspaceInRequestContext=10010]="NoWorkspaceInRequestContext",s[s.NoUserPermissionsInRequestContext=10012]="NoUserPermissionsInRequestContext",s[s.WorkspacePermissionDenied=10013]="WorkspacePermissionDenied",s[s.NoTargetUrlHeader=10014]="NoTargetUrlHeader",s[s.NoSessionInRedisCache=10015]="NoSessionInRedisCache",s[s.ProhibitedTargetDomain=10016]="ProhibitedTargetDomain",s[s.NoOrganizationInRequestContext=10017]="NoOrganizationInRequestContext",s))(_||{}),V=(n=>(n[n.NoPublicKey=11e3]="NoPublicKey",n[n.NoAuthHeader=11001]="NoAuthHeader",n))(V||{});var Y={10001:{statusCode:401,msg:"No object id available on authenticated user."},10002:{statusCode:400,msg:"Request missing header 'alliance-target-app'."},10003:{statusCode:400,msg:"Request missing header 'alliance-target-workspace'."},10014:{statusCode:400,msg:"Request missing header 'alliance-target-url'."},10015:{statusCode:401,msg:"Could not find user session in Redis server."},10006:{statusCode:500,msg:"Could not find manifest for app '{{appSlug}}'."},10007:{statusCode:500,msg:"No request context."},10008:{statusCode:500,msg:"No user in request context."},10009:{statusCode:500,msg:"No app in request context."},10010:{statusCode:500,msg:"No workspace in request context."},10017:{statusCode:500,msg:"No organization in request context."},10012:{statusCode:500,msg:"No user permissions in request context."},10013:{statusCode:403,msg:"User does not have access to the current workspace."},10016:{statusCode:403,msg:"Request prohibited - REQUEST_DOMAIN_WHITE_LIST does not contain '{{domain}}'."},11e3:{statusCode:401,msg:"No public key available to decode JWT."},11001:{statusCode:401,msg:"No authorization header found."},12e3:{statusCode:401,msg:"No object id found in user claims."}};var L=class extends Error{constructor(n,u={}){let{msg:c,statusCode:f}=Y[n],p=ye(c,u);super(p);this.errorCode=n;this.message=p,this.statusCode=f,this.info=`https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes#${this.errorCode}`}info;statusCode};function ye(e,t){return Object.entries(t).reduce((n,[u,c])=>n.replaceAll(`{{${u}}}`,c),e)}function he(e){return(t,n,u,c)=>{let f={cause:t.cause,message:t.message,status:t.status||t.statusCode||t.code,info:t.info};return e.error("error when processing request",{url:n.url,body:n.body,error:f}),u.status(f.status).json(f)}}import{homedir as Be,tmpdir as qe}from"node:os";import{resolve as ke}from"node:path";var Ie=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,ve=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,we=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Ee(e,t){if(e==="__proto__"||e==="constructor"&&t&&typeof t=="object"&&"prototype"in t){xe(e);return}return t}function xe(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function C(e,t={}){if(typeof e!="string")return e;let n=e.trim();if(e[0]==='"'&&e.endsWith('"')&&!e.includes("\\"))return n.slice(1,-1);if(n.length<=9){let u=n.toLowerCase();if(u==="true")return!0;if(u==="false")return!1;if(u==="undefined")return;if(u==="null")return null;if(u==="nan")return Number.NaN;if(u==="infinity")return Number.POSITIVE_INFINITY;if(u==="-infinity")return Number.NEGATIVE_INFINITY}if(!we.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(Ie.test(e)||ve.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,Ee)}return JSON.parse(e)}catch(u){if(t.strict)throw u;return e}}function Ce(e){return!e||typeof e.then!="function"?Promise.resolve(e):e}function g(e,...t){try{return Ce(e(...t))}catch(n){return Promise.reject(n)}}function Ne(e){let t=typeof e;return e===null||t!=="object"&&t!=="function"}function Ae(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function N(e){if(Ne(e))return String(e);if(Ae(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return N(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function D(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}var O="base64:";function J(e){if(typeof e=="string")return e;D();let t=Buffer.from(e).toString("base64");return O+t}function H(e){return typeof e!="string"||!e.startsWith(O)?e:(D(),Buffer.from(e.slice(O.length),"base64"))}var Pe=["hasItem","getItem","getItemRaw","setItem","setItemRaw","removeItem","getMeta","setMeta","removeMeta","getKeys","clear","mount","unmount"];function z(e,t){if(t=x(t),!t)return e;let n={...e};for(let u of Pe)n[u]=(c="",...f)=>e[u](t+c,...f);return n.getKeys=(u="",...c)=>e.getKeys(t+u,...c).then(f=>f.map(p=>p.slice(t.length))),n}function l(e){return e?e.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function Q(...e){return l(e.join(":"))}function x(e){return e=l(e),e?e+":":""}var Re="memory",Te=()=>{let e=new Map;return{name:Re,options:{},hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys(){return Array.from(e.keys())},clear(){e.clear()},dispose(){e.clear()}}};function X(e={}){let t={mounts:{"":e.driver||Te()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=r=>{for(let o of t.mountpoints)if(r.startsWith(o))return{base:o,relativeKey:r.slice(o.length),driver:t.mounts[o]};return{base:"",relativeKey:r,driver:t.mounts[""]}},u=(r,o)=>t.mountpoints.filter(i=>i.startsWith(r)||o&&r.startsWith(i)).map(i=>({relativeBase:r.length>i.length?r.slice(i.length):void 0,mountpoint:i,driver:t.mounts[i]})),c=(r,o)=>{if(t.watching){o=l(o);for(let i of t.watchListeners)i(r,o)}},f=async()=>{if(!t.watching){t.watching=!0;for(let r in t.mounts)t.unwatch[r]=await G(t.mounts[r],c,r)}},p=async()=>{if(t.watching){for(let r in t.unwatch)await t.unwatch[r]();t.unwatch={},t.watching=!1}},w=(r,o,i)=>{let a=new Map,m=s=>{let d=a.get(s.base);return d||(d={driver:s.driver,base:s.base,items:[]},a.set(s.base,d)),d};for(let s of r){let d=typeof s=="string",P=l(d?s:s.key),h=d?void 0:s.value,T=d||!s.options?o:{...o,...s.options},j=n(P);m(j).items.push({key:P,value:h,relativeKey:j.relativeKey,options:T})}return Promise.all([...a.values()].map(s=>i(s))).then(s=>s.flat())},A={hasItem(r,o={}){r=l(r);let{relativeKey:i,driver:a}=n(r);return g(a.hasItem,i,o)},getItem(r,o={}){r=l(r);let{relativeKey:i,driver:a}=n(r);return g(a.getItem,i,o).then(m=>C(m))},getItems(r,o){return w(r,o,i=>i.driver.getItems?g(i.driver.getItems,i.items.map(a=>({key:a.relativeKey,options:a.options})),o).then(a=>a.map(m=>({key:Q(i.base,m.key),value:C(m.value)}))):Promise.all(i.items.map(a=>g(i.driver.getItem,a.relativeKey,a.options).then(m=>({key:a.key,value:C(m)})))))},getItemRaw(r,o={}){r=l(r);let{relativeKey:i,driver:a}=n(r);return a.getItemRaw?g(a.getItemRaw,i,o):g(a.getItem,i,o).then(m=>H(m))},async setItem(r,o,i={}){if(o===void 0)return A.removeItem(r);r=l(r);let{relativeKey:a,driver:m}=n(r);m.setItem&&(await g(m.setItem,a,N(o),i),m.watch||c("update",r))},async setItems(r,o){await w(r,o,async i=>{if(i.driver.setItems)return g(i.driver.setItems,i.items.map(a=>({key:a.relativeKey,value:N(a.value),options:a.options})),o);i.driver.setItem&&await Promise.all(i.items.map(a=>g(i.driver.setItem,a.relativeKey,N(a.value),a.options)))})},async setItemRaw(r,o,i={}){if(o===void 0)return A.removeItem(r,i);r=l(r);let{relativeKey:a,driver:m}=n(r);if(m.setItemRaw)await g(m.setItemRaw,a,o,i);else if(m.setItem)await g(m.setItem,a,J(o),i);else return;m.watch||c("update",r)},async removeItem(r,o={}){typeof o=="boolean"&&(o={removeMeta:o}),r=l(r);let{relativeKey:i,driver:a}=n(r);a.removeItem&&(await g(a.removeItem,i,o),(o.removeMeta||o.removeMata)&&await g(a.removeItem,i+"$",o),a.watch||c("remove",r))},async getMeta(r,o={}){typeof o=="boolean"&&(o={nativeOnly:o}),r=l(r);let{relativeKey:i,driver:a}=n(r),m=Object.create(null);if(a.getMeta&&Object.assign(m,await g(a.getMeta,i,o)),!o.nativeOnly){let s=await g(a.getItem,i+"$",o).then(d=>C(d));s&&typeof s=="object"&&(typeof s.atime=="string"&&(s.atime=new Date(s.atime)),typeof s.mtime=="string"&&(s.mtime=new Date(s.mtime)),Object.assign(m,s))}return m},setMeta(r,o,i={}){return this.setItem(r+"$",o,i)},removeMeta(r,o={}){return this.removeItem(r+"$",o)},async getKeys(r,o={}){r=x(r);let i=u(r,!0),a=[],m=[];for(let s of i){let P=(await g(s.driver.getKeys,s.relativeBase,o)).map(h=>s.mountpoint+l(h)).filter(h=>!a.some(T=>h.startsWith(T)));m.push(...P),a=[s.mountpoint,...a.filter(h=>!h.startsWith(s.mountpoint))]}return r?m.filter(s=>s.startsWith(r)&&!s.endsWith("$")):m.filter(s=>!s.endsWith("$"))},async clear(r,o={}){r=x(r),await Promise.all(u(r,!1).map(async i=>{if(i.driver.clear)return g(i.driver.clear,i.relativeBase,o);if(i.driver.removeItem){let a=await i.driver.getKeys(i.relativeBase||"",o);return Promise.all(a.map(m=>i.driver.removeItem(m,o)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(r=>Z(r)))},async watch(r){return await f(),t.watchListeners.push(r),async()=>{t.watchListeners=t.watchListeners.filter(o=>o!==r),t.watchListeners.length===0&&await p()}},async unwatch(){t.watchListeners=[],await p()},mount(r,o){if(r=x(r),r&&t.mounts[r])throw new Error(`already mounted at ${r}`);return r&&(t.mountpoints.push(r),t.mountpoints.sort((i,a)=>a.length-i.length)),t.mounts[r]=o,t.watching&&Promise.resolve(G(o,c,r)).then(i=>{t.unwatch[r]=i}).catch(console.error),A},async unmount(r,o=!0){r=x(r),!(!r||!t.mounts[r])&&(t.watching&&r in t.unwatch&&(t.unwatch[r](),delete t.unwatch[r]),o&&await Z(t.mounts[r]),t.mountpoints=t.mountpoints.filter(i=>i!==r),delete t.mounts[r])},getMount(r=""){r=l(r)+":";let o=n(r);return{driver:o.driver,base:o.base}},getMounts(r="",o={}){return r=l(r),u(r,o.parents).map(a=>({driver:a.driver,base:a.mountpoint}))}};return A}function G(e,t,n){return e.watch?e.watch((u,c)=>t(u,n+c)):()=>{}}async function Z(e){typeof e.dispose=="function"&&await g(e.dispose)}import{existsSync as Ke,promises as Le}from"fs";import{resolve as Oe,join as ze}from"path";function R(e,t,n){return new Error(`[unstorage] [${e}] ${t}`,n)}function $(e,t){return Array.isArray(t)?R(e,`Missing some of the required options ${t.map(n=>"`"+n+"`").join(", ")}`):R(e,`Missing required option \`${t}\`.`)}import{existsSync as Se,promises as I}from"fs";import{resolve as te,dirname as re}from"path";function b(e){return e.code==="ENOENT"||e.code==="EISDIR"?null:e}function ee(e){return e.code==="EEXIST"?null:e}async function B(e,t,n){return await se(re(e)),I.writeFile(e,t,n)}function q(e,t){return I.readFile(e,t).catch(b)}function ne(e){return I.unlink(e).catch(b)}function oe(e){return I.readdir(e,{withFileTypes:!0}).catch(b).then(t=>t||[])}async function se(e){Se(e)||(await se(re(e)).catch(ee),await I.mkdir(e).catch(ee))}async function k(e,t){if(t&&t(e))return[];let n=await oe(e),u=[];return await Promise.all(n.map(async c=>{let f=te(e,c.name);if(c.isDirectory()){let p=await k(f,t);u.push(...p.map(w=>c.name+"/"+w))}else t&&t(c.name)||u.push(c.name)})),u}async function F(e){let t=await oe(e);await Promise.all(t.map(n=>{let u=te(e,n.name);return n.isDirectory()?F(u).then(()=>I.rmdir(u)):I.unlink(u)}))}var be=/\.\.\:|\.\.$/,U="fs-lite",ie=(e={})=>{if(!e.base)throw $(U,"base");e.base=Oe(e.base);let t=n=>{if(be.test(n))throw R(U,`Invalid key: ${JSON.stringify(n)}. It should not contain .. segments`);return ze(e.base,n.replace(/:/g,"/"))};return{name:U,options:e,hasItem(n){return Ke(t(n))},getItem(n){return q(t(n),"utf8")},getItemRaw(n){return q(t(n))},async getMeta(n){let{atime:u,mtime:c,size:f,birthtime:p,ctime:w}=await Le.stat(t(n)).catch(()=>({}));return{atime:u,mtime:c,size:f,birthtime:p,ctime:w}},setItem(n,u){if(!e.readOnly)return B(t(n),u,"utf8")},setItemRaw(n,u){if(!e.readOnly)return B(t(n),u)},removeItem(n){if(!e.readOnly)return ne(t(n))},getKeys(){return k(t("."),e.ignore)},async clear(){e.readOnly||e.noClear||await F(t("."))}}};function Fe({prefix:e,logger:t}){return z(X({driver:ie({base:Ue({logger:t})})}),e)}function Ue({logger:e}){let t="";try{t=Be()}catch(n){e.error("could not use homedir, trying tmpdir",{error:n?.message})}if(!t)try{t=qe()}catch(n){e.error("could not use tmpdir, trying process.cwd",{error:n?.message})}if(!t)try{t=process.cwd()}catch(n){e.error("could not use process.cwd, exiting",{error:n?.message}),process.exit(1)}return ke(t,".alliance")}import We from"pino";function v(e){return t=>(n,u)=>e[t]({...u,msg:n})}function je(e){return W(e,{target:"pino-pretty",options:{colorize:!0,ignore:"time,pid,hostname",messageFormat:"{msg}"}})}function W(e,t){let n=We({level:e.SERVICE_LOG_LEVEL,redact:["authorization","headers.authorization","req.headers.authorization","res.headers.authorization","req.headers.cookie",'res.headers["set-cookie"]'],transport:t});return{fatal:v(n)("fatal"),error:v(n)("error"),warn:v(n)("warn"),info:v(n)("info"),debug:v(n)("debug"),trace:v(n)("trace"),silent:v(n)("silent"),child:()=>W(e),level:e.SERVICE_LOG_LEVEL}}function Me(e){return(t,n,u)=>(e.trace("received request",{url:t.url,params:t.params,query:t.query,body:t.body}),u())}export{L as AllianceError,K as AllianceHeaders,V as DataErrorCode,_ as GatewayErrorCode,le as createBearerToken,Fe as createFileStorage,ue as createIndexHtml,W as createLogger,je as createPrettyLogger,pe as createPublicKeys,ce as getAppManifests,de as getCleanPublicKey,M as getPrivateKey,he as requestErrorHandler,Me as requestLoggerHandler,ae as slugify,me as zBooleanEnum,y as zNonEmptyString,S as zSharedConfig};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import{c as i,e as K,f as P}from"./chunk-A5O3J5K5.js";import{stdin as FD,stdout as rD}from"node:process";import z from"node:readline";import{WriteStream as iD}from"node:tty";import sD from"tty";var _="\x1B",a=`${_}[`,CD="\x07",k={to(t,u){return u?`${a}${u+1};${t+1}H`:`${a}${t+1}G`},move(t,u){let e="";return t<0?e+=`${a}${-t}D`:t>0&&(e+=`${a}${t}C`),u<0?e+=`${a}${-u}A`:u>0&&(e+=`${a}${u}B`),e},up:(t=1)=>`${a}${t}A`,down:(t=1)=>`${a}${t}B`,forward:(t=1)=>`${a}${t}C`,backward:(t=1)=>`${a}${t}D`,nextLine:(t=1)=>`${a}E`.repeat(t),prevLine:(t=1)=>`${a}F`.repeat(t),left:`${a}G`,hide:`${a}?25l`,show:`${a}?25h`,save:`${_}7`,restore:`${_}8`},nD={up:(t=1)=>`${a}S`.repeat(t),down:(t=1)=>`${a}T`.repeat(t)},ED={screen:`${a}2J`,up:(t=1)=>`${a}1J`.repeat(t),down:(t=1)=>`${a}J`.repeat(t),line:`${a}2K`,lineEnd:`${a}K`,lineStart:`${a}1K`,lines(t){let u="";for(let e=0;e<t;e++)u+=this.line+(e<t-1?k.up():"");return t&&(u+=k.left),u}},A={cursor:k,scroll:nD,erase:ED,beep:CD},I={exports:{}},oD=sD,aD=!("NO_COLOR"in process.env||process.argv.includes("--no-color"))&&("FORCE_COLOR"in process.env||process.argv.includes("--color")||process.platform==="win32"||oD.isatty(1)&&process.env.TERM!=="dumb"||"CI"in process.env),E=(t,u,e=t)=>F=>{let r=""+F,s=r.indexOf(u,t.length);return~s?t+Q(r,u,e,s)+u:t+r+u},Q=(t,u,e,F)=>{let r=t.substring(0,F)+e,s=t.substring(F+u.length),D=s.indexOf(u);return~D?r+Q(s,u,e,D):r+s},DD=(t=aD)=>({isColorSupported:t,reset:t?u=>`\x1B[0m${u}\x1B[0m`:String,bold:t?E("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"):String,dim:t?E("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"):String,italic:t?E("\x1B[3m","\x1B[23m"):String,underline:t?E("\x1B[4m","\x1B[24m"):String,inverse:t?E("\x1B[7m","\x1B[27m"):String,hidden:t?E("\x1B[8m","\x1B[28m"):String,strikethrough:t?E("\x1B[9m","\x1B[29m"):String,black:t?E("\x1B[30m","\x1B[39m"):String,red:t?E("\x1B[31m","\x1B[39m"):String,green:t?E("\x1B[32m","\x1B[39m"):String,yellow:t?E("\x1B[33m","\x1B[39m"):String,blue:t?E("\x1B[34m","\x1B[39m"):String,magenta:t?E("\x1B[35m","\x1B[39m"):String,cyan:t?E("\x1B[36m","\x1B[39m"):String,white:t?E("\x1B[37m","\x1B[39m"):String,gray:t?E("\x1B[90m","\x1B[39m"):String,bgBlack:t?E("\x1B[40m","\x1B[49m"):String,bgRed:t?E("\x1B[41m","\x1B[49m"):String,bgGreen:t?E("\x1B[42m","\x1B[49m"):String,bgYellow:t?E("\x1B[43m","\x1B[49m"):String,bgBlue:t?E("\x1B[44m","\x1B[49m"):String,bgMagenta:t?E("\x1B[45m","\x1B[49m"):String,bgCyan:t?E("\x1B[46m","\x1B[49m"):String,bgWhite:t?E("\x1B[47m","\x1B[49m"):String});I.exports=DD();I.exports.createColors=DD;var cD=I.exports,w=K(cD);function lD({onlyFirst:t=!1}={}){let u=["[\\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(u,t?void 0:"g")}function uD(t){if(typeof t!="string")throw new TypeError(`Expected a \`string\`, got \`${typeof t}\``);return t.replace(lD(),"")}var T={},hD={get exports(){return T},set exports(t){T=t}};(function(t){var u={};t.exports=u,u.eastAsianWidth=function(F){var r=F.charCodeAt(0),s=F.length==2?F.charCodeAt(1):0,D=r;return 55296<=r&&r<=56319&&56320<=s&&s<=57343&&(r&=1023,s&=1023,D=r<<10|s,D+=65536),D==12288||65281<=D&&D<=65376||65504<=D&&D<=65510?"F":D==8361||65377<=D&&D<=65470||65474<=D&&D<=65479||65482<=D&&D<=65487||65490<=D&&D<=65495||65498<=D&&D<=65500||65512<=D&&D<=65518?"H":4352<=D&&D<=4447||4515<=D&&D<=4519||4602<=D&&D<=4607||9001<=D&&D<=9002||11904<=D&&D<=11929||11931<=D&&D<=12019||12032<=D&&D<=12245||12272<=D&&D<=12283||12289<=D&&D<=12350||12353<=D&&D<=12438||12441<=D&&D<=12543||12549<=D&&D<=12589||12593<=D&&D<=12686||12688<=D&&D<=12730||12736<=D&&D<=12771||12784<=D&&D<=12830||12832<=D&&D<=12871||12880<=D&&D<=13054||13056<=D&&D<=19903||19968<=D&&D<=42124||42128<=D&&D<=42182||43360<=D&&D<=43388||44032<=D&&D<=55203||55216<=D&&D<=55238||55243<=D&&D<=55291||63744<=D&&D<=64255||65040<=D&&D<=65049||65072<=D&&D<=65106||65108<=D&&D<=65126||65128<=D&&D<=65131||110592<=D&&D<=110593||127488<=D&&D<=127490||127504<=D&&D<=127546||127552<=D&&D<=127560||127568<=D&&D<=127569||131072<=D&&D<=194367||177984<=D&&D<=196605||196608<=D&&D<=262141?"W":32<=D&&D<=126||162<=D&&D<=163||165<=D&&D<=166||D==172||D==175||10214<=D&&D<=10221||10629<=D&&D<=10630?"Na":D==161||D==164||167<=D&&D<=168||D==170||173<=D&&D<=174||176<=D&&D<=180||182<=D&&D<=186||188<=D&&D<=191||D==198||D==208||215<=D&&D<=216||222<=D&&D<=225||D==230||232<=D&&D<=234||236<=D&&D<=237||D==240||242<=D&&D<=243||247<=D&&D<=250||D==252||D==254||D==257||D==273||D==275||D==283||294<=D&&D<=295||D==299||305<=D&&D<=307||D==312||319<=D&&D<=322||D==324||328<=D&&D<=331||D==333||338<=D&&D<=339||358<=D&&D<=359||D==363||D==462||D==464||D==466||D==468||D==470||D==472||D==474||D==476||D==593||D==609||D==708||D==711||713<=D&&D<=715||D==717||D==720||728<=D&&D<=731||D==733||D==735||768<=D&&D<=879||913<=D&&D<=929||931<=D&&D<=937||945<=D&&D<=961||963<=D&&D<=969||D==1025||1040<=D&&D<=1103||D==1105||D==8208||8211<=D&&D<=8214||8216<=D&&D<=8217||8220<=D&&D<=8221||8224<=D&&D<=8226||8228<=D&&D<=8231||D==8240||8242<=D&&D<=8243||D==8245||D==8251||D==8254||D==8308||D==8319||8321<=D&&D<=8324||D==8364||D==8451||D==8453||D==8457||D==8467||D==8470||8481<=D&&D<=8482||D==8486||D==8491||8531<=D&&D<=8532||8539<=D&&D<=8542||8544<=D&&D<=8555||8560<=D&&D<=8569||D==8585||8592<=D&&D<=8601||8632<=D&&D<=8633||D==8658||D==8660||D==8679||D==8704||8706<=D&&D<=8707||8711<=D&&D<=8712||D==8715||D==8719||D==8721||D==8725||D==8730||8733<=D&&D<=8736||D==8739||D==8741||8743<=D&&D<=8748||D==8750||8756<=D&&D<=8759||8764<=D&&D<=8765||D==8776||D==8780||D==8786||8800<=D&&D<=8801||8804<=D&&D<=8807||8810<=D&&D<=8811||8814<=D&&D<=8815||8834<=D&&D<=8835||8838<=D&&D<=8839||D==8853||D==8857||D==8869||D==8895||D==8978||9312<=D&&D<=9449||9451<=D&&D<=9547||9552<=D&&D<=9587||9600<=D&&D<=9615||9618<=D&&D<=9621||9632<=D&&D<=9633||9635<=D&&D<=9641||9650<=D&&D<=9651||9654<=D&&D<=9655||9660<=D&&D<=9661||9664<=D&&D<=9665||9670<=D&&D<=9672||D==9675||9678<=D&&D<=9681||9698<=D&&D<=9701||D==9711||9733<=D&&D<=9734||D==9737||9742<=D&&D<=9743||9748<=D&&D<=9749||D==9756||D==9758||D==9792||D==9794||9824<=D&&D<=9825||9827<=D&&D<=9829||9831<=D&&D<=9834||9836<=D&&D<=9837||D==9839||9886<=D&&D<=9887||9918<=D&&D<=9919||9924<=D&&D<=9933||9935<=D&&D<=9953||D==9955||9960<=D&&D<=9983||D==10045||D==10071||10102<=D&&D<=10111||11093<=D&&D<=11097||12872<=D&&D<=12879||57344<=D&&D<=63743||65024<=D&&D<=65039||D==65533||127232<=D&&D<=127242||127248<=D&&D<=127277||127280<=D&&D<=127337||127344<=D&&D<=127386||917760<=D&&D<=917999||983040<=D&&D<=1048573||1048576<=D&&D<=1114109?"A":"N"},u.characterLength=function(F){var r=this.eastAsianWidth(F);return r=="F"||r=="W"||r=="A"?2:1};function e(F){return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}u.length=function(F){for(var r=e(F),s=0,D=0;D<r.length;D++)s=s+this.characterLength(r[D]);return s},u.slice=function(F,r,s){textLen=u.length(F),r=r||0,s=s||1,r<0&&(r=textLen+r),s<0&&(s=textLen+s);for(var D="",C=0,h=e(F),c=0;c<h.length;c++){var B=h[c],l=u.length(B);if(C>=r-(l==2?1:0))if(C+l<=s)D+=B;else break;C+=l}return D}})(hD);var BD=T,AD=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g};function $(t,u={}){if(typeof t!="string"||t.length===0||(u={ambiguousIsNarrow:!0,...u},t=uD(t),t.length===0))return 0;t=t.replace(AD()," ");let e=u.ambiguousIsNarrow?1:2,F=0;for(let r of t){let s=r.codePointAt(0);if(!(s<=31||s>=127&&s<=159||s>=768&&s<=879))switch(BD.eastAsianWidth(r)){case"F":case"W":F+=2;break;case"A":F+=e;break;default:F+=1}}return F}var y=10,q=(t=0)=>u=>`\x1B[${u+t}m`,G=(t=0)=>u=>`\x1B[${38+t};5;${u}m`,H=(t=0)=>(u,e,F)=>`\x1B[${38+t};2;${u};${e};${F}m`,o={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(o.modifier);var mD=Object.keys(o.color),gD=Object.keys(o.bgColor);[...mD,...gD];function pD(){let t=new Map;for(let[u,e]of Object.entries(o)){for(let[F,r]of Object.entries(e))o[F]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},e[F]=o[F],t.set(r[0],r[1]);Object.defineProperty(o,u,{value:e,enumerable:!1})}return Object.defineProperty(o,"codes",{value:t,enumerable:!1}),o.color.close="\x1B[39m",o.bgColor.close="\x1B[49m",o.color.ansi=q(),o.color.ansi256=G(),o.color.ansi16m=H(),o.bgColor.ansi=q(y),o.bgColor.ansi256=G(y),o.bgColor.ansi16m=H(y),Object.defineProperties(o,{rgbToAnsi256:{value:(u,e,F)=>u===e&&e===F?u<8?16:u>248?231:Math.round((u-8)/247*24)+232:16+36*Math.round(u/255*5)+6*Math.round(e/255*5)+Math.round(F/255*5),enumerable:!1},hexToRgb:{value:u=>{let e=/[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));if(!e)return[0,0,0];let[F]=e;F.length===3&&(F=[...F].map(s=>s+s).join(""));let r=Number.parseInt(F,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:u=>o.rgbToAnsi256(...o.hexToRgb(u)),enumerable:!1},ansi256ToAnsi:{value:u=>{if(u<8)return 30+u;if(u<16)return 90+(u-8);let e,F,r;if(u>=232)e=((u-232)*10+8)/255,F=e,r=e;else{u-=16;let C=u%36;e=Math.floor(u/36)/5,F=Math.floor(C/6)/5,r=C%6/5}let s=Math.max(e,F,r)*2;if(s===0)return 30;let D=30+(Math.round(r)<<2|Math.round(F)<<1|Math.round(e));return s===2&&(D+=60),D},enumerable:!1},rgbToAnsi:{value:(u,e,F)=>o.ansi256ToAnsi(o.rgbToAnsi256(u,e,F)),enumerable:!1},hexToAnsi:{value:u=>o.ansi256ToAnsi(o.hexToAnsi256(u)),enumerable:!1}}),o}var dD=pD(),f=new Set(["\x1B","\x9B"]),$D=39,L="\x07",tD="[",bD="]",eD="m",N=`${bD}8;;`,Y=t=>`${f.values().next().value}${tD}${t}${eD}`,Z=t=>`${f.values().next().value}${N}${t}${L}`,vD=t=>t.split(" ").map(u=>$(u)),S=(t,u,e)=>{let F=[...u],r=!1,s=!1,D=$(uD(t[t.length-1]));for(let[C,h]of F.entries()){let c=$(h);if(D+c<=e?t[t.length-1]+=h:(t.push(h),D=0),f.has(h)&&(r=!0,s=F.slice(C+1).join("").startsWith(N)),r){s?h===L&&(r=!1,s=!1):h===eD&&(r=!1);continue}D+=c,D===e&&C<F.length-1&&(t.push(""),D=0)}!D&&t[t.length-1].length>0&&t.length>1&&(t[t.length-2]+=t.pop())},fD=t=>{let u=t.split(" "),e=u.length;for(;e>0&&!($(u[e-1])>0);)e--;return e===u.length?t:u.slice(0,e).join(" ")+u.slice(e).join("")},xD=(t,u,e={})=>{if(e.trim!==!1&&t.trim()==="")return"";let F="",r,s,D=vD(t),C=[""];for(let[c,B]of t.split(" ").entries()){e.trim!==!1&&(C[C.length-1]=C[C.length-1].trimStart());let l=$(C[C.length-1]);if(c!==0&&(l>=u&&(e.wordWrap===!1||e.trim===!1)&&(C.push(""),l=0),(l>0||e.trim===!1)&&(C[C.length-1]+=" ",l++)),e.hard&&D[c]>u){let g=u-l,b=1+Math.floor((D[c]-g-1)/u);Math.floor((D[c]-1)/u)<b&&C.push(""),S(C,B,u);continue}if(l+D[c]>u&&l>0&&D[c]>0){if(e.wordWrap===!1&&l<u){S(C,B,u);continue}C.push("")}if(l+D[c]>u&&e.wordWrap===!1){S(C,B,u);continue}C[C.length-1]+=B}e.trim!==!1&&(C=C.map(c=>fD(c)));let h=[...C.join(`
|
|
2
|
+
`)];for(let[c,B]of h.entries()){if(F+=B,f.has(B)){let{groups:g}=new RegExp(`(?:\\${tD}(?<code>\\d+)m|\\${N}(?<uri>.*)${L})`).exec(h.slice(c).join(""))||{groups:{}};if(g.code!==void 0){let b=Number.parseFloat(g.code);r=b===$D?void 0:b}else g.uri!==void 0&&(s=g.uri.length===0?void 0:g.uri)}let l=dD.codes.get(Number(r));h[c+1]===`
|
|
3
|
+
`?(s&&(F+=Z("")),r&&l&&(F+=Y(l))):B===`
|
|
4
|
+
`&&(r&&l&&(F+=Y(r)),s&&(F+=Z(s)))}return F};function J(t,u,e){return String(t).normalize().replace(/\r\n/g,`
|
|
5
|
+
`).split(`
|
|
6
|
+
`).map(F=>xD(F,u,e)).join(`
|
|
7
|
+
`)}function wD(t,u){if(t===u)return;let e=t.split(`
|
|
8
|
+
`),F=u.split(`
|
|
9
|
+
`),r=[];for(let s=0;s<Math.max(e.length,F.length);s++)e[s]!==F[s]&&r.push(s);return r}var yD=Symbol("clack:cancel");function v(t,u){t.isTTY&&t.setRawMode(u)}var U=new Map([["k","up"],["j","down"],["h","left"],["l","right"]]),SD=new Set(["up","down","left","right","space","enter"]),p=class{constructor({render:u,input:e=FD,output:F=rD,...r},s=!0){this._track=!1,this._cursor=0,this.state="initial",this.error="",this.subscribers=new Map,this._prevFrame="",this.opts=r,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=u.bind(this),this._track=s,this.input=e,this.output=F}prompt(){let u=new iD(0);return u._write=(e,F,r)=>{this._track&&(this.value=this.rl.line.replace(/\t/g,""),this._cursor=this.rl.cursor,this.emit("value",this.value)),r()},this.input.pipe(u),this.rl=z.createInterface({input:this.input,output:u,tabSize:2,prompt:"",escapeCodeTimeout:50}),z.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on("keypress",this.onKeypress),v(this.input,!0),this.output.on("resize",this.render),this.render(),new Promise((e,F)=>{this.once("submit",()=>{this.output.write(A.cursor.show),this.output.off("resize",this.render),v(this.input,!1),e(this.value)}),this.once("cancel",()=>{this.output.write(A.cursor.show),this.output.off("resize",this.render),v(this.input,!1),e(yD)})})}on(u,e){let F=this.subscribers.get(u)??[];F.push({cb:e}),this.subscribers.set(u,F)}once(u,e){let F=this.subscribers.get(u)??[];F.push({cb:e,once:!0}),this.subscribers.set(u,F)}emit(u,...e){let F=this.subscribers.get(u)??[],r=[];for(let s of F)s.cb(...e),s.once&&r.push(()=>F.splice(F.indexOf(s),1));for(let s of r)s()}unsubscribe(){this.subscribers.clear()}onKeypress(u,e){if(this.state==="error"&&(this.state="active"),e?.name&&!this._track&&U.has(e.name)&&this.emit("cursor",U.get(e.name)),e?.name&&SD.has(e.name)&&this.emit("cursor",e.name),u&&(u.toLowerCase()==="y"||u.toLowerCase()==="n")&&this.emit("confirm",u.toLowerCase()==="y"),u&&this.emit("key",u.toLowerCase()),e?.name==="return"){if(this.opts.validate){let F=this.opts.validate(this.value);F&&(this.error=F,this.state="error",this.rl.write(this.value))}this.state!=="error"&&(this.state="submit")}u===""&&(this.state="cancel"),(this.state==="submit"||this.state==="cancel")&&this.emit("finalize"),this.render(),(this.state==="submit"||this.state==="cancel")&&this.close()}close(){this.input.unpipe(),this.input.removeListener("keypress",this.onKeypress),this.output.write(`
|
|
10
|
+
`),v(this.input,!1),this.rl.close(),this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let u=J(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
|
|
11
|
+
`).length-1;this.output.write(A.cursor.move(-999,u*-1))}render(){let u=J(this._render(this)??"",process.stdout.columns,{hard:!0});if(u!==this._prevFrame){if(this.state==="initial")this.output.write(A.cursor.hide);else{let e=wD(this._prevFrame,u);if(this.restoreCursor(),e&&e?.length===1){let F=e[0];this.output.write(A.cursor.move(0,F)),this.output.write(A.erase.lines(1));let r=u.split(`
|
|
12
|
+
`);this.output.write(r[F]),this._prevFrame=u,this.output.write(A.cursor.move(0,r.length-F-1));return}else if(e&&e?.length>1){let F=e[0];this.output.write(A.cursor.move(0,F)),this.output.write(A.erase.down());let r=u.split(`
|
|
13
|
+
`).slice(F);this.output.write(r.join(`
|
|
14
|
+
`)),this._prevFrame=u;return}this.output.write(A.erase.down())}this.output.write(u),this.state==="initial"&&(this.state="active"),this._prevFrame=u}}},V=class extends p{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(u){super(u,!1),this.value=!!u.initialValue,this.on("value",()=>{this.value=this._value}),this.on("confirm",e=>{this.output.write(A.cursor.move(0,-1)),this.value=e,this.state="submit",this.close()}),this.on("cursor",()=>{this.value=!this.value})}},j=class extends p{constructor(u){super(u,!1),this.cursor=0,this.options=u.options,this.value=[...u.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:e})=>e===u.cursorAt),0),this.on("key",e=>{e==="a"&&this.toggleAll()}),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case"space":this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){let u=this.value.length===this.options.length;this.value=u?[]:this.options.map(e=>e.value)}toggleValue(){let u=this.value.includes(this._value);this.value=u?this.value.filter(e=>e!==this._value):[...this.value,this._value]}},M=class extends p{constructor(u){super(u,!1),this.cursor=0,this.options=u.options,this.cursor=this.options.findIndex(({value:e})=>e===u.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on("cursor",e=>{switch(e){case"left":case"up":this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case"down":case"right":this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}},O=class extends p{constructor(u){super(u),this.valueWithCursor="",this.on("finalize",()=>{this.value||(this.value=u.defaultValue),this.valueWithCursor=this.value}),this.on("value",()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.value}${w.inverse(w.hidden("_"))}`;else{let e=this.value.slice(0,this.cursor),F=this.value.slice(this.cursor);this.valueWithCursor=`${e}${w.inverse(F[0])}${F.slice(1)}`}})}get cursor(){return this._cursor}},_D=P(),m=(t,u)=>_D?t:u,kD=m("\u276F",">"),TD=m("\u25A0","x"),VD=m("\u25B2","x"),jD=m("\u2714","\u221A"),n="",d="",W=m("\u25CF",">"),R=m("\u25CB"," "),MD=m("\u25FB","[\u2022]"),X=m("\u25FC","[+]"),OD=m("\u25FB","[ ]"),x=t=>{switch(t){case"initial":case"active":return i.cyan(kD);case"cancel":return i.red(TD);case"error":return i.yellow(VD);case"submit":return i.green(jD)}},WD=t=>new O({validate:t.validate,placeholder:t.placeholder,defaultValue:t.defaultValue,initialValue:t.initialValue,render(){let u=`${i.gray(n)}
|
|
15
|
+
${x(this.state)} ${t.message}
|
|
16
|
+
`,e=t.placeholder?i.inverse(t.placeholder[0])+i.dim(t.placeholder.slice(1)):i.inverse(i.hidden("_")),F=this.value?this.valueWithCursor:e;switch(this.state){case"error":return`${u.trim()}
|
|
17
|
+
${i.yellow(n)} ${F}
|
|
18
|
+
${i.yellow(d)} ${i.yellow(this.error)}
|
|
19
|
+
`;case"submit":return`${u}${i.gray(n)} ${i.dim(this.value||t.placeholder)}`;case"cancel":return`${u}${i.gray(n)} ${i.strikethrough(i.dim(this.value??""))}${this.value?.trim()?`
|
|
20
|
+
`+i.gray(n):""}`;default:return`${u}${i.cyan(n)} ${F}
|
|
21
|
+
${i.cyan(d)}
|
|
22
|
+
`}}}).prompt(),RD=t=>{let u=t.active??"Yes",e=t.inactive??"No";return new V({active:u,inactive:e,initialValue:t.initialValue??!0,render(){let F=`${i.gray(n)}
|
|
23
|
+
${x(this.state)} ${t.message}
|
|
24
|
+
`,r=this.value?u:e;switch(this.state){case"submit":return`${F}${i.gray(n)} ${i.dim(r)}`;case"cancel":return`${F}${i.gray(n)} ${i.strikethrough(i.dim(r))}
|
|
25
|
+
${i.gray(n)}`;default:return`${F}${i.cyan(n)} ${this.value?`${i.green(W)} ${u}`:`${i.dim(R)} ${i.dim(u)}`} ${i.dim("/")} ${this.value?`${i.dim(R)} ${i.dim(e)}`:`${i.green(W)} ${e}`}
|
|
26
|
+
${i.cyan(d)}
|
|
27
|
+
`}}}).prompt()},ID=t=>{let u=(e,F)=>{let r=e.label??String(e.value);switch(F){case"active":return`${i.green(W)} ${r} ${e.hint?i.dim(`(${e.hint})`):""}`;case"selected":return`${i.dim(r)}`;case"cancelled":return`${i.strikethrough(i.dim(r))}`}return`${i.dim(R)} ${i.dim(r)}`};return new M({options:t.options,initialValue:t.initialValue,render(){let e=`${i.gray(n)}
|
|
28
|
+
${x(this.state)} ${t.message}
|
|
29
|
+
`;switch(this.state){case"submit":return`${e}${i.gray(n)} ${u(this.options[this.cursor],"selected")}`;case"cancel":return`${e}${i.gray(n)} ${u(this.options[this.cursor],"cancelled")}
|
|
30
|
+
${i.gray(n)}`;default:return`${e}${i.cyan(n)} ${this.options.map((F,r)=>u(F,r===this.cursor?"active":"inactive")).join(`
|
|
31
|
+
${i.cyan(n)} `)}
|
|
32
|
+
${i.cyan(d)}
|
|
33
|
+
`}}}).prompt()},LD=t=>{let u=(e,F)=>{let r=e.label??String(e.value);switch(F){case"active":return`${i.cyan(MD)} ${r} ${e.hint?i.dim(`(${e.hint})`):""}`;case"selected":return`${i.green(X)} ${i.dim(r)}`;case"cancelled":return`${i.strikethrough(i.dim(r))}`;case"active-selected":return`${i.green(X)} ${r} ${e.hint?i.dim(`(${e.hint})`):""}`;case"submitted":return`${i.dim(r)}`}return`${i.dim(OD)} ${i.dim(r)}`};return new j({options:t.options,initialValues:t.initialValues,required:t.required??!0,cursorAt:t.cursorAt,validate(e){if(this.required&&e.length===0)return`Please select at least one option.
|
|
34
|
+
${i.reset(i.dim(`Press ${i.gray(i.bgWhite(i.inverse(" space ")))} to select, ${i.gray(i.bgWhite(i.inverse(" enter ")))} to submit`))}`},render(){let e=`${i.gray(n)}
|
|
35
|
+
${x(this.state)} ${t.message}
|
|
36
|
+
`;switch(this.state){case"submit":return`${e}${i.gray(n)} ${this.options.filter(({value:F})=>this.value.includes(F)).map(F=>u(F,"submitted")).join(i.dim(", "))||i.dim("none")}`;case"cancel":{let F=this.options.filter(({value:r})=>this.value.includes(r)).map(r=>u(r,"cancelled")).join(i.dim(", "));return`${e}${i.gray(n)} ${F.trim()?`${F}
|
|
37
|
+
${i.gray(n)}`:""}`}case"error":{let F=this.error.split(`
|
|
38
|
+
`).map((r,s)=>s===0?`${i.yellow(d)} ${i.yellow(r)}`:` ${r}`).join(`
|
|
39
|
+
`);return e+i.yellow(n)+" "+this.options.map((r,s)=>{let D=this.value.includes(r.value),C=s===this.cursor;return C&&D?u(r,"active-selected"):D?u(r,"selected"):u(r,C?"active":"inactive")}).join(`
|
|
40
|
+
${i.yellow(n)} `)+`
|
|
41
|
+
`+F+`
|
|
42
|
+
`}default:return`${e}${i.cyan(n)} ${this.options.map((F,r)=>{let s=this.value.includes(F.value),D=r===this.cursor;return D&&s?u(F,"active-selected"):s?u(F,"selected"):u(F,D?"active":"inactive")}).join(`
|
|
43
|
+
${i.cyan(n)} `)}
|
|
44
|
+
${i.cyan(d)}
|
|
45
|
+
`}}}).prompt()};async function ZD(t,u={}){if(!u.type||u.type==="text")return await WD({message:t,defaultValue:u.default,placeholder:u.placeholder,initialValue:u.initial});if(u.type==="confirm")return await RD({message:t,initialValue:u.initial});if(u.type==="select")return await ID({message:t,options:u.options.map(e=>typeof e=="string"?{value:e,label:e}:e)});if(u.type==="multiselect")return await LD({message:t,options:u.options.map(e=>typeof e=="string"?{value:e,label:e}:e),required:u.required});throw new Error(`Unknown prompt type: ${u.type}`)}export{ZD as prompt};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@telia-ace/alliance-internal-node-utilities",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-dev.0",
|
|
4
4
|
"description": "Utilities used internally by packages developed by team Alliance.",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"author": "Telia Company AB",
|
|
@@ -21,11 +21,11 @@
|
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"jsonwebtoken": "^9.0.2",
|
|
24
|
-
"pino": "^
|
|
24
|
+
"pino": "^9.3.2"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"pino-pretty": "^
|
|
28
|
-
"@telia-ace/alliance-framework": "^
|
|
27
|
+
"pino-pretty": "^11.2.2",
|
|
28
|
+
"@telia-ace/alliance-framework": "^2.0.0-dev.0"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|
package/dist/chunk-EBHULZEM.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import{e as ne}from"./chunk-26VIM55J.js";import{a as ze,b as De}from"./chunk-JG7V63GM.js";var Te=ze((ve,ge)=>{"use strict";(function(r,e,t){typeof ve=="object"?(ge.exports=t(),ge.exports.default=t()):typeof define=="function"&&define.amd?define(t):e[r]=t()})("slugify",ve,function(){var r=JSON.parse(`{"$":"dollar","%":"percent","&":"and","<":"less",">":"greater","|":"or","\xA2":"cent","\xA3":"pound","\xA4":"currency","\xA5":"yen","\xA9":"(c)","\xAA":"a","\xAE":"(r)","\xBA":"o","\xC0":"A","\xC1":"A","\xC2":"A","\xC3":"A","\xC4":"A","\xC5":"A","\xC6":"AE","\xC7":"C","\xC8":"E","\xC9":"E","\xCA":"E","\xCB":"E","\xCC":"I","\xCD":"I","\xCE":"I","\xCF":"I","\xD0":"D","\xD1":"N","\xD2":"O","\xD3":"O","\xD4":"O","\xD5":"O","\xD6":"O","\xD8":"O","\xD9":"U","\xDA":"U","\xDB":"U","\xDC":"U","\xDD":"Y","\xDE":"TH","\xDF":"ss","\xE0":"a","\xE1":"a","\xE2":"a","\xE3":"a","\xE4":"a","\xE5":"a","\xE6":"ae","\xE7":"c","\xE8":"e","\xE9":"e","\xEA":"e","\xEB":"e","\xEC":"i","\xED":"i","\xEE":"i","\xEF":"i","\xF0":"d","\xF1":"n","\xF2":"o","\xF3":"o","\xF4":"o","\xF5":"o","\xF6":"o","\xF8":"o","\xF9":"u","\xFA":"u","\xFB":"u","\xFC":"u","\xFD":"y","\xFE":"th","\xFF":"y","\u0100":"A","\u0101":"a","\u0102":"A","\u0103":"a","\u0104":"A","\u0105":"a","\u0106":"C","\u0107":"c","\u010C":"C","\u010D":"c","\u010E":"D","\u010F":"d","\u0110":"DJ","\u0111":"dj","\u0112":"E","\u0113":"e","\u0116":"E","\u0117":"e","\u0118":"e","\u0119":"e","\u011A":"E","\u011B":"e","\u011E":"G","\u011F":"g","\u0122":"G","\u0123":"g","\u0128":"I","\u0129":"i","\u012A":"i","\u012B":"i","\u012E":"I","\u012F":"i","\u0130":"I","\u0131":"i","\u0136":"k","\u0137":"k","\u013B":"L","\u013C":"l","\u013D":"L","\u013E":"l","\u0141":"L","\u0142":"l","\u0143":"N","\u0144":"n","\u0145":"N","\u0146":"n","\u0147":"N","\u0148":"n","\u014C":"O","\u014D":"o","\u0150":"O","\u0151":"o","\u0152":"OE","\u0153":"oe","\u0154":"R","\u0155":"r","\u0158":"R","\u0159":"r","\u015A":"S","\u015B":"s","\u015E":"S","\u015F":"s","\u0160":"S","\u0161":"s","\u0162":"T","\u0163":"t","\u0164":"T","\u0165":"t","\u0168":"U","\u0169":"u","\u016A":"u","\u016B":"u","\u016E":"U","\u016F":"u","\u0170":"U","\u0171":"u","\u0172":"U","\u0173":"u","\u0174":"W","\u0175":"w","\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017A":"z","\u017B":"Z","\u017C":"z","\u017D":"Z","\u017E":"z","\u018F":"E","\u0192":"f","\u01A0":"O","\u01A1":"o","\u01AF":"U","\u01B0":"u","\u01C8":"LJ","\u01C9":"lj","\u01CB":"NJ","\u01CC":"nj","\u0218":"S","\u0219":"s","\u021A":"T","\u021B":"t","\u0259":"e","\u02DA":"o","\u0386":"A","\u0388":"E","\u0389":"H","\u038A":"I","\u038C":"O","\u038E":"Y","\u038F":"W","\u0390":"i","\u0391":"A","\u0392":"B","\u0393":"G","\u0394":"D","\u0395":"E","\u0396":"Z","\u0397":"H","\u0398":"8","\u0399":"I","\u039A":"K","\u039B":"L","\u039C":"M","\u039D":"N","\u039E":"3","\u039F":"O","\u03A0":"P","\u03A1":"R","\u03A3":"S","\u03A4":"T","\u03A5":"Y","\u03A6":"F","\u03A7":"X","\u03A8":"PS","\u03A9":"W","\u03AA":"I","\u03AB":"Y","\u03AC":"a","\u03AD":"e","\u03AE":"h","\u03AF":"i","\u03B0":"y","\u03B1":"a","\u03B2":"b","\u03B3":"g","\u03B4":"d","\u03B5":"e","\u03B6":"z","\u03B7":"h","\u03B8":"8","\u03B9":"i","\u03BA":"k","\u03BB":"l","\u03BC":"m","\u03BD":"n","\u03BE":"3","\u03BF":"o","\u03C0":"p","\u03C1":"r","\u03C2":"s","\u03C3":"s","\u03C4":"t","\u03C5":"y","\u03C6":"f","\u03C7":"x","\u03C8":"ps","\u03C9":"w","\u03CA":"i","\u03CB":"y","\u03CC":"o","\u03CD":"y","\u03CE":"w","\u0401":"Yo","\u0402":"DJ","\u0404":"Ye","\u0406":"I","\u0407":"Yi","\u0408":"J","\u0409":"LJ","\u040A":"NJ","\u040B":"C","\u040F":"DZ","\u0410":"A","\u0411":"B","\u0412":"V","\u0413":"G","\u0414":"D","\u0415":"E","\u0416":"Zh","\u0417":"Z","\u0418":"I","\u0419":"J","\u041A":"K","\u041B":"L","\u041C":"M","\u041D":"N","\u041E":"O","\u041F":"P","\u0420":"R","\u0421":"S","\u0422":"T","\u0423":"U","\u0424":"F","\u0425":"H","\u0426":"C","\u0427":"Ch","\u0428":"Sh","\u0429":"Sh","\u042A":"U","\u042B":"Y","\u042C":"","\u042D":"E","\u042E":"Yu","\u042F":"Ya","\u0430":"a","\u0431":"b","\u0432":"v","\u0433":"g","\u0434":"d","\u0435":"e","\u0436":"zh","\u0437":"z","\u0438":"i","\u0439":"j","\u043A":"k","\u043B":"l","\u043C":"m","\u043D":"n","\u043E":"o","\u043F":"p","\u0440":"r","\u0441":"s","\u0442":"t","\u0443":"u","\u0444":"f","\u0445":"h","\u0446":"c","\u0447":"ch","\u0448":"sh","\u0449":"sh","\u044A":"u","\u044B":"y","\u044C":"","\u044D":"e","\u044E":"yu","\u044F":"ya","\u0451":"yo","\u0452":"dj","\u0454":"ye","\u0456":"i","\u0457":"yi","\u0458":"j","\u0459":"lj","\u045A":"nj","\u045B":"c","\u045D":"u","\u045F":"dz","\u0490":"G","\u0491":"g","\u0492":"GH","\u0493":"gh","\u049A":"KH","\u049B":"kh","\u04A2":"NG","\u04A3":"ng","\u04AE":"UE","\u04AF":"ue","\u04B0":"U","\u04B1":"u","\u04BA":"H","\u04BB":"h","\u04D8":"AE","\u04D9":"ae","\u04E8":"OE","\u04E9":"oe","\u0531":"A","\u0532":"B","\u0533":"G","\u0534":"D","\u0535":"E","\u0536":"Z","\u0537":"E'","\u0538":"Y'","\u0539":"T'","\u053A":"JH","\u053B":"I","\u053C":"L","\u053D":"X","\u053E":"C'","\u053F":"K","\u0540":"H","\u0541":"D'","\u0542":"GH","\u0543":"TW","\u0544":"M","\u0545":"Y","\u0546":"N","\u0547":"SH","\u0549":"CH","\u054A":"P","\u054B":"J","\u054C":"R'","\u054D":"S","\u054E":"V","\u054F":"T","\u0550":"R","\u0551":"C","\u0553":"P'","\u0554":"Q'","\u0555":"O''","\u0556":"F","\u0587":"EV","\u0621":"a","\u0622":"aa","\u0623":"a","\u0624":"u","\u0625":"i","\u0626":"e","\u0627":"a","\u0628":"b","\u0629":"h","\u062A":"t","\u062B":"th","\u062C":"j","\u062D":"h","\u062E":"kh","\u062F":"d","\u0630":"th","\u0631":"r","\u0632":"z","\u0633":"s","\u0634":"sh","\u0635":"s","\u0636":"dh","\u0637":"t","\u0638":"z","\u0639":"a","\u063A":"gh","\u0641":"f","\u0642":"q","\u0643":"k","\u0644":"l","\u0645":"m","\u0646":"n","\u0647":"h","\u0648":"w","\u0649":"a","\u064A":"y","\u064B":"an","\u064C":"on","\u064D":"en","\u064E":"a","\u064F":"u","\u0650":"e","\u0652":"","\u0660":"0","\u0661":"1","\u0662":"2","\u0663":"3","\u0664":"4","\u0665":"5","\u0666":"6","\u0667":"7","\u0668":"8","\u0669":"9","\u067E":"p","\u0686":"ch","\u0698":"zh","\u06A9":"k","\u06AF":"g","\u06CC":"y","\u06F0":"0","\u06F1":"1","\u06F2":"2","\u06F3":"3","\u06F4":"4","\u06F5":"5","\u06F6":"6","\u06F7":"7","\u06F8":"8","\u06F9":"9","\u0E3F":"baht","\u10D0":"a","\u10D1":"b","\u10D2":"g","\u10D3":"d","\u10D4":"e","\u10D5":"v","\u10D6":"z","\u10D7":"t","\u10D8":"i","\u10D9":"k","\u10DA":"l","\u10DB":"m","\u10DC":"n","\u10DD":"o","\u10DE":"p","\u10DF":"zh","\u10E0":"r","\u10E1":"s","\u10E2":"t","\u10E3":"u","\u10E4":"f","\u10E5":"k","\u10E6":"gh","\u10E7":"q","\u10E8":"sh","\u10E9":"ch","\u10EA":"ts","\u10EB":"dz","\u10EC":"ts","\u10ED":"ch","\u10EE":"kh","\u10EF":"j","\u10F0":"h","\u1E62":"S","\u1E63":"s","\u1E80":"W","\u1E81":"w","\u1E82":"W","\u1E83":"w","\u1E84":"W","\u1E85":"w","\u1E9E":"SS","\u1EA0":"A","\u1EA1":"a","\u1EA2":"A","\u1EA3":"a","\u1EA4":"A","\u1EA5":"a","\u1EA6":"A","\u1EA7":"a","\u1EA8":"A","\u1EA9":"a","\u1EAA":"A","\u1EAB":"a","\u1EAC":"A","\u1EAD":"a","\u1EAE":"A","\u1EAF":"a","\u1EB0":"A","\u1EB1":"a","\u1EB2":"A","\u1EB3":"a","\u1EB4":"A","\u1EB5":"a","\u1EB6":"A","\u1EB7":"a","\u1EB8":"E","\u1EB9":"e","\u1EBA":"E","\u1EBB":"e","\u1EBC":"E","\u1EBD":"e","\u1EBE":"E","\u1EBF":"e","\u1EC0":"E","\u1EC1":"e","\u1EC2":"E","\u1EC3":"e","\u1EC4":"E","\u1EC5":"e","\u1EC6":"E","\u1EC7":"e","\u1EC8":"I","\u1EC9":"i","\u1ECA":"I","\u1ECB":"i","\u1ECC":"O","\u1ECD":"o","\u1ECE":"O","\u1ECF":"o","\u1ED0":"O","\u1ED1":"o","\u1ED2":"O","\u1ED3":"o","\u1ED4":"O","\u1ED5":"o","\u1ED6":"O","\u1ED7":"o","\u1ED8":"O","\u1ED9":"o","\u1EDA":"O","\u1EDB":"o","\u1EDC":"O","\u1EDD":"o","\u1EDE":"O","\u1EDF":"o","\u1EE0":"O","\u1EE1":"o","\u1EE2":"O","\u1EE3":"o","\u1EE4":"U","\u1EE5":"u","\u1EE6":"U","\u1EE7":"u","\u1EE8":"U","\u1EE9":"u","\u1EEA":"U","\u1EEB":"u","\u1EEC":"U","\u1EED":"u","\u1EEE":"U","\u1EEF":"u","\u1EF0":"U","\u1EF1":"u","\u1EF2":"Y","\u1EF3":"y","\u1EF4":"Y","\u1EF5":"y","\u1EF6":"Y","\u1EF7":"y","\u1EF8":"Y","\u1EF9":"y","\u2013":"-","\u2018":"'","\u2019":"'","\u201C":"\\"","\u201D":"\\"","\u201E":"\\"","\u2020":"+","\u2022":"*","\u2026":"...","\u20A0":"ecu","\u20A2":"cruzeiro","\u20A3":"french franc","\u20A4":"lira","\u20A5":"mill","\u20A6":"naira","\u20A7":"peseta","\u20A8":"rupee","\u20A9":"won","\u20AA":"new shequel","\u20AB":"dong","\u20AC":"euro","\u20AD":"kip","\u20AE":"tugrik","\u20AF":"drachma","\u20B0":"penny","\u20B1":"peso","\u20B2":"guarani","\u20B3":"austral","\u20B4":"hryvnia","\u20B5":"cedi","\u20B8":"kazakhstani tenge","\u20B9":"indian rupee","\u20BA":"turkish lira","\u20BD":"russian ruble","\u20BF":"bitcoin","\u2120":"sm","\u2122":"tm","\u2202":"d","\u2206":"delta","\u2211":"sum","\u221E":"infinity","\u2665":"love","\u5143":"yuan","\u5186":"yen","\uFDFC":"rial","\uFEF5":"laa","\uFEF7":"laa","\uFEF9":"lai","\uFEFB":"la"}`),e=JSON.parse('{"bg":{"\u0419":"Y","\u0426":"Ts","\u0429":"Sht","\u042A":"A","\u042C":"Y","\u0439":"y","\u0446":"ts","\u0449":"sht","\u044A":"a","\u044C":"y"},"de":{"\xC4":"AE","\xE4":"ae","\xD6":"OE","\xF6":"oe","\xDC":"UE","\xFC":"ue","\xDF":"ss","%":"prozent","&":"und","|":"oder","\u2211":"summe","\u221E":"unendlich","\u2665":"liebe"},"es":{"%":"por ciento","&":"y","<":"menor que",">":"mayor que","|":"o","\xA2":"centavos","\xA3":"libras","\xA4":"moneda","\u20A3":"francos","\u2211":"suma","\u221E":"infinito","\u2665":"amor"},"fr":{"%":"pourcent","&":"et","<":"plus petit",">":"plus grand","|":"ou","\xA2":"centime","\xA3":"livre","\xA4":"devise","\u20A3":"franc","\u2211":"somme","\u221E":"infini","\u2665":"amour"},"pt":{"%":"porcento","&":"e","<":"menor",">":"maior","|":"ou","\xA2":"centavo","\u2211":"soma","\xA3":"libra","\u221E":"infinito","\u2665":"amor"},"uk":{"\u0418":"Y","\u0438":"y","\u0419":"Y","\u0439":"y","\u0426":"Ts","\u0446":"ts","\u0425":"Kh","\u0445":"kh","\u0429":"Shch","\u0449":"shch","\u0413":"H","\u0433":"h"},"vi":{"\u0110":"D","\u0111":"d"},"da":{"\xD8":"OE","\xF8":"oe","\xC5":"AA","\xE5":"aa","%":"procent","&":"og","|":"eller","$":"dollar","<":"mindre end",">":"st\xF8rre end"},"nb":{"&":"og","\xC5":"AA","\xC6":"AE","\xD8":"OE","\xE5":"aa","\xE6":"ae","\xF8":"oe"},"it":{"&":"e"},"nl":{"&":"en"},"sv":{"&":"och","\xC5":"AA","\xC4":"AE","\xD6":"OE","\xE5":"aa","\xE4":"ae","\xF6":"oe"}}');function t(s,n){if(typeof s!="string")throw new Error("slugify: string argument expected");n=typeof n=="string"?{replacement:n}:n||{};var a=e[n.locale]||{},i=n.replacement===void 0?"-":n.replacement,o=n.trim===void 0?!0:n.trim,u=s.normalize().split("").reduce(function(d,g){var x=a[g];return x===void 0&&(x=r[g]),x===void 0&&(x=g),x===i&&(x=" "),d+x.replace(n.remove||/[^\w\s$*_+~.()'"!\-:@]+/g,"")},"");return n.strict&&(u=u.replace(/[^A-Za-z0-9\s]/g,"")),o&&(u=u.trim()),u=u.replace(/\s+/g,i),n.lower&&(u=u.toLowerCase()),u}return t.extend=function(s){Object.assign(r,s)},t})});var Ae=De(Te(),1);function Ee(r,e="-"){return(0,Ae.default)(r,{strict:!0,replacement:e,lower:!0})}import{existsSync as Ue,rmSync as $e,writeFileSync as Le}from"node:fs";import{resolve as Be}from"node:path";function er(r){let e=Be(process.cwd(),"index.html");Ue(e)&&$e(e,{force:!0});let t=He(r);return Le(e,t),e}function qe(r){return r.reduce((e,{appImport:t,manifestImport:s},n)=>{let a=t+`
|
|
2
|
-
`+s;return n===0?a:e+`
|
|
3
|
-
`+a},"")}function Ye(r){return"const apps = ["+r.reduce((t,{appVariableName:s,manifestVariableName:n})=>{let a=`{ app: ${s}, manifest: ${n} },`;return t+`
|
|
4
|
-
`+a},"")+`
|
|
5
|
-
];`}function He(r){let e=r.map(({packageName:n,appImportPath:a,manifestImportPath:i})=>{let o=Ee(n,""),u=`${o}App`,d=`${o}Manifest`;return{packageName:n,appVariableName:u,manifestVariableName:d,appImport:`import ${u} from '${Se(a)}';`,manifestImport:`import ${d} from '${Se(i)}';`}}),t=qe(e),s=Ye(e);return Je.replaceAll("$imports;",t).replaceAll("$apps;",s)}var Je=`
|
|
6
|
-
<!doctype html>
|
|
7
|
-
<html lang="en">
|
|
8
|
-
<head>
|
|
9
|
-
<meta charset="UTF-8" />
|
|
10
|
-
<link rel="icon" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGcElEQVRYha2Xe4xUVx3HP7/fPTOzDLO7sw8RlzWlZEtp2dCy0qIVWltKU/UPDZH6ijXWEK2odPcPa2qbhpi2kSa7blSStsFUjNq0lWCMaVMx8rAm22IJMJRHCqFC6BJ22eEx+5p7z88/7sywC7uwgCe5mXsz5/y+j/M753eOcJ2tK5sDyBrME2gBmkBq43/tnMERgXdAjrbn518yXq4RNA3cB/J54HNiMhfEicm4oAYghmHexN4Dew5k01giUybQlc1h0CbI9zC+Imi9mCAIYhoHsnI4KcNjYoDhxWPxsxFY1Z5vHQVwVwSu3Qdid4E8rSb3i6mqKYwBjpWX1V/QZBiYYWIIiifCw8Mm/vS7L/W237FqJno58M5srgmxP4npjsAHDwTeaeAdagGBdwQWoBYgFqCmqGlMqvTE3+U+ipbeE+ngB42Lde6kDnRmcwisAHlBfdBYCYxStp3y7xjTJ51RA0XxgGCkasQFSfkW8NQlBDqzORVYK6ZPqAU6ThUyqd0TN7mQDRZ/CULzvVVeRO68xIGubE6BbjH9oVqA+thaQccpvjLwRDTit2RG/fxVGR3sLc4ELuRAV90+gJ/G4K4EHpRs1wr7qwW/uH36uaxPzwz0xNZhHUfAzJZgsjZWrqXEiTP9WlRP1Bb+pCacs2KaCwvmD/5+cLhCoCubU0G61QJXyWYkVv9/Av/UEzVh2+PVDmDPr875ob4oD6UcMLhfTdqU8dket+sDD6rwS7vrfMs30i4qRhzfMhwe3FhwQG+FgMDKytIyKe1o1zffZlB3swvve7mehgVJZ95zatdouG31gHpvoHYUwHVmc4AsqoCXYK9HtzhYsDoTLnqyRl1a1QxOvjMavrmyT4sFr6hhsA/AZUbqKKTy9ZfCXhuFpntS4WfWZWloTcTTa8bh14fCrY/2a3E4UlOLt2jYCeCGE+cBBuPhdk2gZjDjjmS46KkampelnEhMPhwy3/PkGb/vhXPO4zGJ60KyTo5nPpk8wg5wPz57M13Z3PuGzRtTxEovV3BBoXlZKrytvZqmpSknKhVCJ3tGwu2rBxjYHzrEymUZw9Py0LQtD6yb7aG8CoR/mNgKs1LHEomJ4M2M9McDf9PX0n7eI9OpbXEVxQCFE5F/d+0Zf+iPgy7e/GPDjVj9rGXJcO7D6b+yLu7vABavrd10/O8jz5/cFqXNFBGr1HYzQ0SoviEIm5dXceOXpvGJpSkNEjJuGy+ciPzu7nN+/4aCRkM2vsaUrM/coH7ed9Ond3WffbPyF8CxQ/1Y5F8b/C9fHthlFPvFB05JNzqtvSnBxxYmmN4UVCwe60b/7mK4d/15Dr82qH50fHkva/fiSc00v/SlGr97fX79ytdb1owjAHDwX71tVbWuJ9OQdMl0gmTKESQUVWGsxQDD/ZE/snnIH/xdgVP/KU5yqCnBi2f6bPF3b6jxe17Mhx9sKizsyLceKPeqDP7bF/rfa2xLvHrLN6sfmr08o0GDqAaCIYRD3g/sD/1Hb49w7K1hev89otEoTi6To+V5n3l3Mryru1r3vpjn8KbCZjU5MLbfuBCd2VyzIHsTgauZ3pAkkXIanScc6Tf1RfRiJyYHN4Iq/O2PZ/zc71Rpz89P+30bz4QmdltHvvXQpARKJB5R0w0XSvL4cjwV+FnLU+HiZ2tUpxtbf9Tnj20vOJPo2fZ8688u7n3pmdB42Yt/xUuESVQ+yVJexZNtVmbQ2JYIH9zcGC5/pd71Hxjxm5f1cnzboDPx7xs8M9G4CSV1ZnOZICE7GNXbKweTMU7EA6USoemeVLhgTYame1Nu4MBI2PN0ng+3DDovIZFG5w37bEe+dc+UCQC8/ZtjzX07i/88saU4J8yLXiAhaCC+fn7Sz/7iNFq+mqZ6TuD6do+Gu7vPcuQvBRf62LlIQ2/Y1zvyra9OhnPZSf1g58k5I6ftDSnqnNFTaOACqmclfP0tSa3KBjrc5/2Hbwz7Q38ocHLniDM8XjxeIrxG3rA16vXXj529dVKMK2bVL2fkmhrmJ/9cPy91Z2ZGwhMqQx95TudC8gdCZx4obbMVAhqNGvaoCr99bKD1svGntK4647vg84J8X021PBXlK5gJGJWr11GDb3fkW7dPJfaUi3539iARxSUCz4AsERMVpHwDxMTyhq0HftGRbz071bhXfeooXVJvBR4EbgSGgR6Bt9qvArjc/gfZzPoCTDB+AgAAAABJRU5ErkJggg=="/>
|
|
11
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
12
|
-
<title>Alliance Portal</title>
|
|
13
|
-
</head>
|
|
14
|
-
|
|
15
|
-
<body>
|
|
16
|
-
<script type="module">
|
|
17
|
-
import createFramework from '@telia-ace/alliance-framework/create-framework';
|
|
18
|
-
import '@telia-ace/alliance-ui/components';
|
|
19
|
-
import { addCssVariables } from '@telia-ace/alliance-ui/voca/foundations';
|
|
20
|
-
|
|
21
|
-
$imports;
|
|
22
|
-
|
|
23
|
-
addCssVariables();
|
|
24
|
-
|
|
25
|
-
$apps;
|
|
26
|
-
|
|
27
|
-
createFramework(apps);
|
|
28
|
-
</script>
|
|
29
|
-
</body>
|
|
30
|
-
</html>
|
|
31
|
-
`.trim();function Se(r){return r.replaceAll("\\","\\\\")}import{rmSync as Ce,writeFileSync as Ge}from"node:fs";import{resolve as We}from"node:path";async function Ke(r,e){let t=We(process.cwd(),`${e}.mjs`);try{Ge(t,r);let s=await import(`file:///${t}`);return Ce(t,{force:!0}),s}catch(s){try{Ce(t,{force:!0})}catch{}ne.error("something went wrong when creating temp module for app manifest import"),ne.error(s),process.exit(1)}}async function pr(r){let e=[],t=[];for(let s of r){let n=`manifest${r.indexOf(s)}`,a=`pkgjson${r.indexOf(s)}`,i=`export${r.indexOf(s)}`;e.push(`import ${n} from '${s}/manifest';`),e.push(`delete ${n}['$schema'];`),e.push(`import ${a} from './node_modules/${s}/package.json' assert { type: "json" };`),e.push(`const ${i} = { ...${n}, version: ${a}.version };`),t.push(i)}return e.push(`export default [${t.join(", ")}];`),Ke(e.join(`
|
|
32
|
-
`),"app-manifests").then(s=>s.default)}var _;(function(r){r.assertEqual=n=>n;function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return r.objectValues(i)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},r.find=(n,a)=>{for(let i of n)if(a(i))return i},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(_||(_={}));var xe;(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(xe||(xe={}));var l=_.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),N=r=>{switch(typeof r){case"undefined":return l.undefined;case"string":return l.string;case"number":return isNaN(r)?l.nan:l.number;case"boolean":return l.boolean;case"function":return l.function;case"bigint":return l.bigint;case"symbol":return l.symbol;case"object":return Array.isArray(r)?l.array:r===null?l.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?l.promise:typeof Map<"u"&&r instanceof Map?l.map:typeof Set<"u"&&r instanceof Set?l.set:typeof Date<"u"&&r instanceof Date?l.date:l.object;default:return l.unknown}},c=_.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Xe=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),T=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,u=0;for(;u<i.path.length;){let d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return n(this),s}toString(){return this.message}get message(){return JSON.stringify(this.issues,_.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};T.create=r=>new T(r);var ae=(r,e)=>{let t;switch(r.code){case c.invalid_type:r.received===l.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case c.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,_.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:t=`Unrecognized key(s) in object: ${_.joinValues(r.keys,", ")}`;break;case c.invalid_union:t="Invalid input";break;case c.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${_.joinValues(r.options)}`;break;case c.invalid_enum_value:t=`Invalid enum value. Expected ${_.joinValues(r.options)}, received '${r.received}'`;break;case c.invalid_arguments:t="Invalid function arguments";break;case c.invalid_return_type:t="Invalid function return type";break;case c.invalid_date:t="Invalid date";break;case c.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:_.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case c.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case c.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case c.custom:t="Invalid input";break;case c.invalid_intersection_types:t="Intersection results could not be merged";break;case c.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case c.not_finite:t="Number must be finite";break;default:t=e.defaultError,_.assertNever(r)}return{message:t}},je=ae;function Qe(r){je=r}function de(){return je}var ue=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],i={...n,path:a},o="",u=s.filter(d=>!!d).slice().reverse();for(let d of u)o=d(i,{data:e,defaultError:o}).message;return{...n,path:a,message:n.message||o}},Fe=[];function f(r,e){let t=ue({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,de(),ae].filter(s=>!!s)});r.common.issues.push(t)}var b=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t)s.push({key:await n.key,value:await n.value});return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),Ze=r=>({status:"dirty",value:r}),k=r=>({status:"valid",value:r}),be=r=>r.status==="aborted",ke=r=>r.status==="dirty",ie=r=>r.status==="valid",le=r=>typeof Promise<"u"&&r instanceof Promise,h;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var E=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Oe=(r,e)=>{if(ie(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new T(r.common.issues);return this._error=t,this._error}}};function y(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>i.code!=="invalid_type"?{message:o.defaultError}:typeof o.data>"u"?{message:s??o.defaultError}:{message:t??o.defaultError},description:n}}var v=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return N(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new b,ctx:{common:e.parent.common,data:e.data,parsedType:N(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(le(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;let n={common:{issues:[],async:(s=t?.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)},a=this._parseSync({data:e,path:n.path,parent:n});return Oe(n,a)}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:N(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(le(n)?n:Promise.resolve(n));return Oe(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new A({schema:this,typeName:p.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return S.create(this,this._def)}nullable(){return Z.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return j.create(this,this._def)}promise(){return V.create(this,this._def)}or(e){return B.create([this,e],this._def)}and(e){return q.create(this,e,this._def)}transform(e){return new A({...y(this._def),schema:this,typeName:p.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new W({...y(this._def),innerType:this,defaultValue:t,typeName:p.ZodDefault})}brand(){return new me({typeName:p.ZodBranded,type:this,...y(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new te({...y(this._def),innerType:this,catchValue:t,typeName:p.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return oe.create(this,e)}readonly(){return se.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},et=/^c[^\s-]{8,}$/i,tt=/^[a-z][a-z0-9]*$/,rt=/^[0-9A-HJKMNP-TV-Z]{26}$/,st=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nt=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,at="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",_e,it=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ot=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,ct=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function dt(r,e){return!!((e==="v4"||!e)&&it.test(r)||(e==="v6"||!e)&&ot.test(r))}var R=class r extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==l.string){let a=this._getOrReturnCtx(e);return f(a,{code:c.invalid_type,expected:l.string,received:a.parsedType}),m}let s=new b,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?f(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")nt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")_e||(_e=new RegExp(at,"u")),_e.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")st.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")et.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")tt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")rt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),f(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),f(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?ct(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="ip"?dt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):_.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),{validation:t,code:c.invalid_string,...h.errToObj(s)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...h.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...h.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...h.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...h.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...h.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...h.errToObj(t)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};R.create=r=>{var e;return new R({checks:[],typeName:p.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...y(r)})};function ut(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=parseInt(r.toFixed(n).replace(".","")),i=parseInt(e.toFixed(n).replace(".",""));return a%i/Math.pow(10,n)}var P=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==l.number){let a=this._getOrReturnCtx(e);return f(a,{code:c.invalid_type,expected:l.number,received:a.parsedType}),m}let s,n=new b;for(let a of this._def.checks)a.kind==="int"?_.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?ut(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:c.not_finite,message:a.message}),n.dirty()):_.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&_.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};P.create=r=>new P({checks:[],typeName:p.ZodNumber,coerce:r?.coerce||!1,...y(r)});var z=class r extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==l.bigint){let a=this._getOrReturnCtx(e);return f(a,{code:c.invalid_type,expected:l.bigint,received:a.parsedType}),m}let s,n=new b;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),f(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):_.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,h.toString(t))}gt(e,t){return this.setLimit("min",e,!1,h.toString(t))}lte(e,t){return this.setLimit("max",e,!0,h.toString(t))}lt(e,t){return this.setLimit("max",e,!1,h.toString(t))}setLimit(e,t,s,n){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:h.toString(n)}]})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};z.create=r=>{var e;return new z({checks:[],typeName:p.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...y(r)})};var D=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==l.boolean){let s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:l.boolean,received:s.parsedType}),m}return k(e.data)}};D.create=r=>new D({typeName:p.ZodBoolean,coerce:r?.coerce||!1,...y(r)});var U=class r extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==l.date){let a=this._getOrReturnCtx(e);return f(a,{code:c.invalid_type,expected:l.date,received:a.parsedType}),m}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return f(a,{code:c.invalid_date}),m}let s=new b,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):_.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};U.create=r=>new U({checks:[],coerce:r?.coerce||!1,typeName:p.ZodDate,...y(r)});var X=class extends v{_parse(e){if(this._getType(e)!==l.symbol){let s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:l.symbol,received:s.parsedType}),m}return k(e.data)}};X.create=r=>new X({typeName:p.ZodSymbol,...y(r)});var $=class extends v{_parse(e){if(this._getType(e)!==l.undefined){let s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:l.undefined,received:s.parsedType}),m}return k(e.data)}};$.create=r=>new $({typeName:p.ZodUndefined,...y(r)});var L=class extends v{_parse(e){if(this._getType(e)!==l.null){let s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:l.null,received:s.parsedType}),m}return k(e.data)}};L.create=r=>new L({typeName:p.ZodNull,...y(r)});var M=class extends v{constructor(){super(...arguments),this._any=!0}_parse(e){return k(e.data)}};M.create=r=>new M({typeName:p.ZodAny,...y(r)});var I=class extends v{constructor(){super(...arguments),this._unknown=!0}_parse(e){return k(e.data)}};I.create=r=>new I({typeName:p.ZodUnknown,...y(r)});var C=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return f(t,{code:c.invalid_type,expected:l.never,received:t.parsedType}),m}};C.create=r=>new C({typeName:p.ZodNever,...y(r)});var Q=class extends v{_parse(e){if(this._getType(e)!==l.undefined){let s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:l.void,received:s.parsedType}),m}return k(e.data)}};Q.create=r=>new Q({typeName:p.ZodVoid,...y(r)});var j=class r extends v{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==l.array)return f(t,{code:c.invalid_type,expected:l.array,received:t.parsedType}),m;if(n.exactLength!==null){let i=t.data.length>n.exactLength.value,o=t.data.length<n.exactLength.value;(i||o)&&(f(t,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(f(t,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(f(t,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>n.type._parseAsync(new E(t,i,t.path,o)))).then(i=>b.mergeArray(s,i));let a=[...t.data].map((i,o)=>n.type._parseSync(new E(t,i,t.path,o)));return b.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:h.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:h.toString(t)}})}nonempty(e){return this.min(1,e)}};j.create=(r,e)=>new j({type:r,minLength:null,maxLength:null,exactLength:null,typeName:p.ZodArray,...y(e)});function K(r){if(r instanceof w){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=S.create(K(s))}return new w({...r._def,shape:()=>e})}else return r instanceof j?new j({...r._def,type:K(r.element)}):r instanceof S?S.create(K(r.unwrap())):r instanceof Z?Z.create(K(r.unwrap())):r instanceof O?O.create(r.items.map(e=>K(e))):r}var w=class r extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=_.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==l.object){let d=this._getOrReturnCtx(e);return f(d,{code:c.invalid_type,expected:l.object,received:d.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof C&&this._def.unknownKeys==="strip"))for(let d in n.data)i.includes(d)||o.push(d);let u=[];for(let d of i){let g=a[d],x=n.data[d];u.push({key:{status:"valid",value:d},value:g._parse(new E(n,x,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof C){let d=this._def.unknownKeys;if(d==="passthrough")for(let g of o)u.push({key:{status:"valid",value:g},value:{status:"valid",value:n.data[g]}});else if(d==="strict")o.length>0&&(f(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let g of o){let x=n.data[g];u.push({key:{status:"valid",value:g},value:d._parse(new E(n,x,n.path,g)),alwaysSet:g in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let d=[];for(let g of u){let x=await g.key;d.push({key:x,value:await g.value,alwaysSet:g.alwaysSet})}return d}).then(d=>b.mergeObjectSync(s,d)):b.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,s)=>{var n,a,i,o;let u=(i=(a=(n=this._def).errorMap)===null||a===void 0?void 0:a.call(n,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=h.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:p.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return _.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return _.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new r({...this._def,shape:()=>t})}deepPartial(){return K(this)}partial(e){let t={};return _.objectKeys(this.shape).forEach(s=>{let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return _.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof S;)a=a._def.innerType;t[s]=a}}),new r({...this._def,shape:()=>t})}keyof(){return Ne(_.objectKeys(this.shape))}};w.create=(r,e)=>new w({shape:()=>r,unknownKeys:"strip",catchall:C.create(),typeName:p.ZodObject,...y(e)});w.strictCreate=(r,e)=>new w({shape:()=>r,unknownKeys:"strict",catchall:C.create(),typeName:p.ZodObject,...y(e)});w.lazycreate=(r,e)=>new w({shape:r,unknownKeys:"strip",catchall:C.create(),typeName:p.ZodObject,...y(e)});var B=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new T(o.ctx.common.issues));return f(t,{code:c.invalid_union,unionErrors:i}),m}if(t.common.async)return Promise.all(s.map(async a=>{let i={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let u of s){let d={...t,common:{...t.common,issues:[]},parent:null},g=u._parseSync({data:t.data,path:t.path,parent:d});if(g.status==="valid")return g;g.status==="dirty"&&!a&&(a={result:g,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(u=>new T(u));return f(t,{code:c.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}};B.create=(r,e)=>new B({options:r,typeName:p.ZodUnion,...y(e)});var ce=r=>r instanceof Y?ce(r.schema):r instanceof A?ce(r.innerType()):r instanceof H?[r.value]:r instanceof J?r.options:r instanceof G?Object.keys(r.enum):r instanceof W?ce(r._def.innerType):r instanceof $?[void 0]:r instanceof L?[null]:null,fe=class r extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.object)return f(t,{code:c.invalid_type,expected:l.object,received:t.parsedType}),m;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let i=ce(a.shape[e]);if(!i)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new r({typeName:p.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...y(s)})}};function we(r,e){let t=N(r),s=N(e);if(r===e)return{valid:!0,data:r};if(t===l.object&&s===l.object){let n=_.objectKeys(e),a=_.objectKeys(r).filter(o=>n.indexOf(o)!==-1),i={...r,...e};for(let o of a){let u=we(r[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(t===l.array&&s===l.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let i=r[a],o=e[a],u=we(i,o);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===l.date&&s===l.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var q=class extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(be(a)||be(i))return m;let o=we(a.value,i.value);return o.valid?((ke(a)||ke(i))&&t.dirty(),{status:t.value,value:o.data}):(f(s,{code:c.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};q.create=(r,e,t)=>new q({left:r,right:e,typeName:p.ZodIntersection,...y(t)});var O=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.array)return f(s,{code:c.invalid_type,expected:l.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return f(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(f(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((i,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new E(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>b.mergeArray(t,i)):b.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};O.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new O({items:r,typeName:p.ZodTuple,rest:null,...y(e)})};var he=class r extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.object)return f(s,{code:c.invalid_type,expected:l.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in s.data)n.push({key:a._parse(new E(s,o,s.path,o)),value:i._parse(new E(s,s.data[o],s.path,o))});return s.common.async?b.mergeObjectAsync(t,n):b.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof v?new r({keyType:e,valueType:t,typeName:p.ZodRecord,...y(s)}):new r({keyType:R.create(),valueType:e,typeName:p.ZodRecord,...y(t)})}},F=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.map)return f(s,{code:c.invalid_type,expected:l.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,u],d)=>({key:n._parse(new E(s,o,s.path,[d,"key"])),value:a._parse(new E(s,u,s.path,[d,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of i){let d=await u.key,g=await u.value;if(d.status==="aborted"||g.status==="aborted")return m;(d.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(d.value,g.value)}return{status:t.value,value:o}})}else{let o=new Map;for(let u of i){let d=u.key,g=u.value;if(d.status==="aborted"||g.status==="aborted")return m;(d.status==="dirty"||g.status==="dirty")&&t.dirty(),o.set(d.value,g.value)}return{status:t.value,value:o}}}};F.create=(r,e,t)=>new F({valueType:e,keyType:r,typeName:p.ZodMap,...y(t)});var ee=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==l.set)return f(s,{code:c.invalid_type,expected:l.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(f(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(f(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function i(u){let d=new Set;for(let g of u){if(g.status==="aborted")return m;g.status==="dirty"&&t.dirty(),d.add(g.value)}return{status:t.value,value:d}}let o=[...s.data.values()].map((u,d)=>a._parse(new E(s,u,s.path,d)));return s.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,t){return new r({...this._def,minSize:{value:e,message:h.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:h.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ee.create=(r,e)=>new ee({valueType:r,minSize:null,maxSize:null,typeName:p.ZodSet,...y(e)});var pe=class r extends v{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.function)return f(t,{code:c.invalid_type,expected:l.function,received:t.parsedType}),m;function s(o,u){return ue({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,de(),ae].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:u}})}function n(o,u){return ue({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,de(),ae].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof V){let o=this;return k(async function(...u){let d=new T([]),g=await o._def.args.parseAsync(u,a).catch(ye=>{throw d.addIssue(s(u,ye)),d}),x=await Reflect.apply(i,this,g);return await o._def.returns._def.type.parseAsync(x,a).catch(ye=>{throw d.addIssue(n(x,ye)),d})})}else{let o=this;return k(function(...u){let d=o._def.args.safeParse(u,a);if(!d.success)throw new T([s(u,d.error)]);let g=Reflect.apply(i,this,d.data),x=o._def.returns.safeParse(g,a);if(!x.success)throw new T([n(g,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:O.create(e).rest(I.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r({args:e||O.create([]).rest(I.create()),returns:t||I.create(),typeName:p.ZodFunction,...y(s)})}},Y=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};Y.create=(r,e)=>new Y({getter:r,typeName:p.ZodLazy,...y(e)});var H=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};H.create=(r,e)=>new H({value:r,typeName:p.ZodLiteral,...y(e)});function Ne(r,e){return new J({values:r,typeName:p.ZodEnum,...y(e)})}var J=class r extends v{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{expected:_.joinValues(s),received:t.parsedType,code:c.invalid_type}),m}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{received:t.data,code:c.invalid_enum_value,options:s}),m}return k(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return r.create(e)}exclude(e){return r.create(this.options.filter(t=>!e.includes(t)))}};J.create=Ne;var G=class extends v{_parse(e){let t=_.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==l.string&&s.parsedType!==l.number){let n=_.objectValues(t);return f(s,{expected:_.joinValues(n),received:s.parsedType,code:c.invalid_type}),m}if(t.indexOf(e.data)===-1){let n=_.objectValues(t);return f(s,{received:s.data,code:c.invalid_enum_value,options:n}),m}return k(e.data)}get enum(){return this._def.values}};G.create=(r,e)=>new G({values:r,typeName:p.ZodNativeEnum,...y(e)});var V=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==l.promise&&t.common.async===!1)return f(t,{code:c.invalid_type,expected:l.promise,received:t.parsedType}),m;let s=t.parsedType===l.promise?t.data:Promise.resolve(t.data);return k(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};V.create=(r,e)=>new V({type:r,typeName:p.ZodPromise,...y(e)});var A=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===p.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{f(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);return s.common.issues.length?{status:"dirty",value:s.data}:s.common.async?Promise.resolve(i).then(o=>this._def.schema._parseAsync({data:o,path:s.path,parent:s})):this._def.schema._parseSync({data:i,path:s.path,parent:s})}if(n.type==="refinement"){let i=o=>{let u=n.refinement(o,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!ie(i))return i;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>ie(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);_.assertNever(n)}};A.create=(r,e,t)=>new A({schema:r,typeName:p.ZodEffects,effect:e,...y(t)});A.createWithPreprocess=(r,e,t)=>new A({schema:e,effect:{type:"preprocess",transform:r},typeName:p.ZodEffects,...y(t)});var S=class extends v{_parse(e){return this._getType(e)===l.undefined?k(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};S.create=(r,e)=>new S({innerType:r,typeName:p.ZodOptional,...y(e)});var Z=class extends v{_parse(e){return this._getType(e)===l.null?k(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};Z.create=(r,e)=>new Z({innerType:r,typeName:p.ZodNullable,...y(e)});var W=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===l.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};W.create=(r,e)=>new W({innerType:r,typeName:p.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...y(e)});var te=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return le(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new T(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new T(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};te.create=(r,e)=>new te({innerType:r,typeName:p.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...y(e)});var re=class extends v{_parse(e){if(this._getType(e)!==l.nan){let s=this._getOrReturnCtx(e);return f(s,{code:c.invalid_type,expected:l.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};re.create=r=>new re({typeName:p.ZodNaN,...y(r)});var lt=Symbol("zod_brand"),me=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},oe=class r extends v{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),Ze(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:p.ZodPipeline})}},se=class extends v{_parse(e){let t=this._def.innerType._parse(e);return ie(t)&&(t.value=Object.freeze(t.value)),t}};se.create=(r,e)=>new se({innerType:r,typeName:p.ZodReadonly,...y(e)});var Re=(r,e={},t)=>r?M.create().superRefine((s,n)=>{var a,i;if(!r(s)){let o=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;n.addIssue({code:"custom",...d,fatal:u})}}):M.create(),ft={object:w.lazycreate},p;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(p||(p={}));var ht=(r,e={message:`Input not instance of ${r.name}`})=>Re(t=>t instanceof r,e),Me=R.create,Ve=P.create,pt=re.create,mt=z.create,Pe=D.create,yt=U.create,vt=X.create,gt=$.create,_t=L.create,xt=M.create,bt=I.create,kt=C.create,wt=Q.create,Tt=j.create,At=w.create,Et=w.strictCreate,St=B.create,Ct=fe.create,Ot=q.create,It=O.create,jt=he.create,Zt=F.create,Nt=ee.create,Rt=pe.create,Mt=Y.create,Vt=H.create,Pt=J.create,zt=G.create,Dt=V.create,Ie=A.create,Ut=S.create,$t=Z.create,Lt=A.createWithPreprocess,Bt=oe.create,qt=()=>Me().optional(),Yt=()=>Ve().optional(),Ht=()=>Pe().optional(),Jt={string:r=>R.create({...r,coerce:!0}),number:r=>P.create({...r,coerce:!0}),boolean:r=>D.create({...r,coerce:!0}),bigint:r=>z.create({...r,coerce:!0}),date:r=>U.create({...r,coerce:!0})},Gt=m,yr=Object.freeze({__proto__:null,defaultErrorMap:ae,setErrorMap:Qe,getErrorMap:de,makeIssue:ue,EMPTY_PATH:Fe,addIssueToContext:f,ParseStatus:b,INVALID:m,DIRTY:Ze,OK:k,isAborted:be,isDirty:ke,isValid:ie,isAsync:le,get util(){return _},get objectUtil(){return xe},ZodParsedType:l,getParsedType:N,ZodType:v,ZodString:R,ZodNumber:P,ZodBigInt:z,ZodBoolean:D,ZodDate:U,ZodSymbol:X,ZodUndefined:$,ZodNull:L,ZodAny:M,ZodUnknown:I,ZodNever:C,ZodVoid:Q,ZodArray:j,ZodObject:w,ZodUnion:B,ZodDiscriminatedUnion:fe,ZodIntersection:q,ZodTuple:O,ZodRecord:he,ZodMap:F,ZodSet:ee,ZodFunction:pe,ZodLazy:Y,ZodLiteral:H,ZodEnum:J,ZodNativeEnum:G,ZodPromise:V,ZodEffects:A,ZodTransformer:A,ZodOptional:S,ZodNullable:Z,ZodDefault:W,ZodCatch:te,ZodNaN:re,BRAND:lt,ZodBranded:me,ZodPipeline:oe,ZodReadonly:se,custom:Re,Schema:v,ZodSchema:v,late:ft,get ZodFirstPartyTypeKind(){return p},coerce:Jt,any:xt,array:Tt,bigint:mt,boolean:Pe,date:yt,discriminatedUnion:Ct,effect:Ie,enum:Pt,function:Rt,instanceof:ht,intersection:Ot,lazy:Mt,literal:Vt,map:Zt,nan:pt,nativeEnum:zt,never:kt,null:_t,nullable:$t,number:Ve,object:At,oboolean:Ht,onumber:Yt,optional:Ut,ostring:qt,pipeline:Bt,preprocess:Lt,promise:Dt,record:jt,set:Nt,strictObject:Et,string:Me,symbol:vt,transformer:Ie,tuple:It,undefined:gt,union:St,unknown:bt,void:wt,NEVER:Gt,ZodIssueCode:c,quotelessJson:Xe,ZodError:T});export{yr as a,Ee as b,er as c,pr as d};
|
package/dist/chunk-JG7V63GM.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var g=Object.create;var f=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty;var m=(b,a)=>()=>(a||b((a={exports:{}}).exports,a),a.exports);var l=(b,a,c,e)=>{if(a&&typeof a=="object"||typeof a=="function")for(let d of i(a))!k.call(b,d)&&d!==c&&f(b,d,{get:()=>a[d],enumerable:!(e=h(a,d))||e.enumerable});return b};var n=(b,a,c)=>(c=b!=null?g(j(b)):{},l(a||!b||!b.__esModule?f(c,"default",{value:b,enumerable:!0}):c,b));export{m as a,n as b};
|