@shipstatic/ship 3.6.0 → 3.7.0-beta.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/README.md +13 -3
- package/THIRD-PARTY-LICENSES.md +1 -1
- package/dist/browser.d.ts +95 -34
- package/dist/browser.js +2 -1
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +57 -56
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +95 -34
- package/dist/index.d.ts +95 -34
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -107,7 +107,7 @@ ship.domains.set('www.münchen.de'); // → Unicode supported
|
|
|
107
107
|
### Tokens
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
|
-
ship tokens create --ttl 30d --label
|
|
110
|
+
ship tokens create --ttl 30d --label project:web # Or 3600, 90s, 1h — one grammar
|
|
111
111
|
ship tokens list
|
|
112
112
|
ship tokens get <token>
|
|
113
113
|
ship tokens delete <token>
|
|
@@ -267,8 +267,10 @@ const ship = new Ship({ token: 'ship-your-api-key', maxRetries: 5 });
|
|
|
267
267
|
Deliberately never retried: a maintenance 503 (its message says when to come
|
|
268
268
|
back), 429 (the rate limiter has answered), `PUT`/`DELETE` (a repeat can
|
|
269
269
|
misreport a lost success as a failure), anything stopped by a `signal` you
|
|
270
|
-
supplied, and any other
|
|
271
|
-
|
|
270
|
+
supplied, and any other request that is not safe to send twice. A deploy is
|
|
271
|
+
safe to send twice when it carries an `idempotencyKey`: the API answers with
|
|
272
|
+
the deployment that key already made, within your account, instead of making
|
|
273
|
+
a second one.
|
|
272
274
|
|
|
273
275
|
`timeout` is the ceiling on one ATTEMPT. For a hard overall deadline pass your
|
|
274
276
|
own `signal` (`AbortSignal.timeout(ms)`), which is never retried past.
|
|
@@ -287,6 +289,14 @@ ship.deploy(input, {
|
|
|
287
289
|
});
|
|
288
290
|
```
|
|
289
291
|
|
|
292
|
+
#### Large deployments
|
|
293
|
+
|
|
294
|
+
There's nothing to set up. One request carries up to 64 MB, so a bigger site
|
|
295
|
+
goes in several: the SDK sends a list of every file first, then the files
|
|
296
|
+
themselves in batches, and the site goes live when the last one arrives. You
|
|
297
|
+
get the same answer as for a small site. Every batch is safe to retry, so a
|
|
298
|
+
dropped connection costs you only that batch.
|
|
299
|
+
|
|
290
300
|
#### Expiring deployments
|
|
291
301
|
|
|
292
302
|
Pass `ttl` in **seconds** and the platform reclaims the deployment when the time is up — 1 second to one year. The wire carries the duration and the API stamps `expires` against its own clock, so the answer says when:
|
package/THIRD-PARTY-LICENSES.md
CHANGED
package/dist/browser.d.ts
CHANGED
|
@@ -222,6 +222,9 @@ interface DeploymentListResponse extends ListResponse {
|
|
|
222
222
|
*
|
|
223
223
|
* No prose either (`message`): an acknowledgement is data, and each surface
|
|
224
224
|
* composes its own copy.
|
|
225
|
+
*
|
|
226
|
+
* It states where the deployment IS, not what the call did: a repeat finds
|
|
227
|
+
* the row already `deleting` and answers this same object again, at 202.
|
|
225
228
|
*/
|
|
226
229
|
interface DeploymentDeleteResponse {
|
|
227
230
|
/** The deployment hostname that was marked for removal */
|
|
@@ -546,6 +549,40 @@ declare const IDEMPOTENCY_KEY_CONSTRAINTS: {
|
|
|
546
549
|
/** How long a stored 201 stays replayable. */
|
|
547
550
|
readonly WINDOW_SECONDS: number;
|
|
548
551
|
};
|
|
552
|
+
/**
|
|
553
|
+
* The most one deploy request may carry, and the framing a client counts
|
|
554
|
+
* toward it. A deployment larger than one request arrives in several: a
|
|
555
|
+
* declaration with its {@link DEPLOY_FIELDS.MANIFEST}, then
|
|
556
|
+
* {@link API_PATHS.DEPLOYMENT_FILES} for the rest.
|
|
557
|
+
*
|
|
558
|
+
* Framing, not plan policy, which is why it is static rather than delivered
|
|
559
|
+
* by `/limits`: a client splitting at a smaller number is always correct.
|
|
560
|
+
*
|
|
561
|
+
* **`MAX_BYTES` is a one-way door.** This package is bundled into every
|
|
562
|
+
* published client, so an installed client keeps its cap forever. Raising it
|
|
563
|
+
* is free (an older client splits smaller, which is always valid); lowering
|
|
564
|
+
* it turns every installed client's largest request into a refusal.
|
|
565
|
+
*
|
|
566
|
+
* 64 MiB because it holds the largest file any plan allows (50 MiB) with its
|
|
567
|
+
* framing, keeps a request inside the API's memory, finishes within the
|
|
568
|
+
* SDK's request timeout at 2.5 Mbit/s, and sits under the edge's 100 MiB
|
|
569
|
+
* request limit. Measured on the development environment at the boundary
|
|
570
|
+
* (2026-10-18), a request of exactly 64 MiB, one 50 MiB file and 14 MiB of
|
|
571
|
+
* others, stored in under half a second of CPU, sent with or without a
|
|
572
|
+
* `Content-Length`, alone or two at once. What a request costs when its
|
|
573
|
+
* files are rewritten is the API's to bound, and it does so per file.
|
|
574
|
+
*/
|
|
575
|
+
declare const DEPLOY_REQUEST_CONSTRAINTS: {
|
|
576
|
+
/** The most one deploy request may carry, as `Content-Length` counts it. */
|
|
577
|
+
readonly MAX_BYTES: number;
|
|
578
|
+
/**
|
|
579
|
+
* The most multipart framing one part adds beyond its bytes and its name,
|
|
580
|
+
* and the body's closing delimiter at most the same. A ceiling by the
|
|
581
|
+
* multipart standard (a boundary is at most 70 characters), not a
|
|
582
|
+
* measurement.
|
|
583
|
+
*/
|
|
584
|
+
readonly PART_OVERHEAD: 256;
|
|
585
|
+
};
|
|
549
586
|
/**
|
|
550
587
|
* Normalize a `via` value from any transport — trimmed, lowercased, and a
|
|
551
588
|
* member of {@link DeploymentVia}, or `undefined`.
|
|
@@ -648,7 +685,10 @@ interface DomainValidateResponse {
|
|
|
648
685
|
interface Token {
|
|
649
686
|
/** 7-char management identifier (e.g., "a1b2c3d") */
|
|
650
687
|
readonly token: string;
|
|
651
|
-
/**
|
|
688
|
+
/**
|
|
689
|
+
* The token's labels, which every deployment it uploads is also born with,
|
|
690
|
+
* ahead of the upload's own. Always present, empty array when none.
|
|
691
|
+
*/
|
|
652
692
|
labels: string[];
|
|
653
693
|
/** Unix timestamp (seconds) when token was created */
|
|
654
694
|
readonly created: number;
|
|
@@ -1127,6 +1167,8 @@ declare const API_PATHS: {
|
|
|
1127
1167
|
readonly DEPLOYMENTS: "/deployments";
|
|
1128
1168
|
readonly DEPLOYMENT: (deployment: string) => string;
|
|
1129
1169
|
readonly DEPLOYMENT_CONFIG: (deployment: string) => string;
|
|
1170
|
+
/** Fills a declared deployment with more of its files. */
|
|
1171
|
+
readonly DEPLOYMENT_FILES: (deployment: string) => string;
|
|
1130
1172
|
readonly DOMAINS: "/domains";
|
|
1131
1173
|
readonly DOMAIN: (domain: string) => string;
|
|
1132
1174
|
readonly DOMAIN_VERIFY: (domain: string) => string;
|
|
@@ -1167,8 +1209,11 @@ declare const API_PATHS: {
|
|
|
1167
1209
|
declare const DEPLOY_FIELDS: {
|
|
1168
1210
|
/** One entry per file — read with `getAll`. */
|
|
1169
1211
|
readonly FILES: "files[]";
|
|
1170
|
-
/**
|
|
1171
|
-
|
|
1212
|
+
/**
|
|
1213
|
+
* JSON array of {@link ManifestEntry}, one per file of the deployment: its
|
|
1214
|
+
* declaration. Optional; a request without one is the whole deployment.
|
|
1215
|
+
*/
|
|
1216
|
+
readonly MANIFEST: "manifest";
|
|
1172
1217
|
/** JSON array of label strings. */
|
|
1173
1218
|
readonly LABELS: "labels";
|
|
1174
1219
|
/** The deploying surface's {@link DeploymentVia} member. */
|
|
@@ -1198,6 +1243,19 @@ declare const DEPLOY_FIELDS: {
|
|
|
1198
1243
|
/** @internal reCAPTCHA proof — `web/www`'s public uploader only. */
|
|
1199
1244
|
readonly CAPTCHA: "captcha";
|
|
1200
1245
|
};
|
|
1246
|
+
/**
|
|
1247
|
+
* One file of a deployment's declaration ({@link DEPLOY_FIELDS.MANIFEST}).
|
|
1248
|
+
* The wire shape both ends share and nothing more: the API owns what makes a
|
|
1249
|
+
* manifest valid, and a client builds one from files it has already checked.
|
|
1250
|
+
*/
|
|
1251
|
+
interface ManifestEntry {
|
|
1252
|
+
/** The deploy path, relative to the deployment root, no leading slash. */
|
|
1253
|
+
path: string;
|
|
1254
|
+
/** The file's size in bytes. */
|
|
1255
|
+
size: number;
|
|
1256
|
+
/** The MD5 of the file's bytes, 32 lowercase hex characters. */
|
|
1257
|
+
md5: string;
|
|
1258
|
+
}
|
|
1201
1259
|
/**
|
|
1202
1260
|
* The JSON deploy body's file grammar: the OTHER body both deploy doors
|
|
1203
1261
|
* accept, beside the multipart one {@link DEPLOY_FIELDS} names. A JSON caller
|
|
@@ -2186,14 +2244,16 @@ interface Journey {
|
|
|
2186
2244
|
* them.
|
|
2187
2245
|
*
|
|
2188
2246
|
* ```ts
|
|
2189
|
-
* doors.login({ token, next: '/claim/abc' })
|
|
2190
|
-
* // '/login/<token>?next=%2Fclaim%2Fabc'
|
|
2247
|
+
* doors.login.link({ token, next: '/claim/abc' })
|
|
2248
|
+
* // '/login/link/<token>?next=%2Fclaim%2Fabc'
|
|
2191
2249
|
* ```
|
|
2192
2250
|
*/
|
|
2193
2251
|
declare const doors: {
|
|
2194
|
-
readonly login: ({
|
|
2195
|
-
|
|
2196
|
-
|
|
2252
|
+
readonly login: (({ next }?: Journey) => string) & {
|
|
2253
|
+
link: ({ token, next }: Journey & {
|
|
2254
|
+
readonly token: string;
|
|
2255
|
+
}) => string;
|
|
2256
|
+
};
|
|
2197
2257
|
readonly register: ({ next }?: Journey) => string;
|
|
2198
2258
|
readonly logout: ({ next }?: Journey) => string;
|
|
2199
2259
|
readonly invitation: (invitation: string) => string;
|
|
@@ -2215,7 +2275,7 @@ declare function accountOfPath(path: string): string | null;
|
|
|
2215
2275
|
* The door a path names, or null for an account place or the operator
|
|
2216
2276
|
* partition. Every question about doors reads this one answer: which page is
|
|
2217
2277
|
* an auth page, which errand a destination carries, what a vendor must not
|
|
2218
|
-
* see. `/login/<token>` is the login door, as `/invitation/<id>` is the
|
|
2278
|
+
* see. `/login/link/<token>` is the login door, as `/invitation/<id>` is the
|
|
2219
2279
|
* invitation door: a door's object is the rest of its path.
|
|
2220
2280
|
*/
|
|
2221
2281
|
declare function doorOf(path: string): DoorSegment | null;
|
|
@@ -2436,8 +2496,9 @@ interface DeploymentUploadOptions {
|
|
|
2436
2496
|
* commit sha, a uuid minted before the first try — never one minted fresh
|
|
2437
2497
|
* on each retry, which would defeat the point.
|
|
2438
2498
|
*
|
|
2439
|
-
*
|
|
2440
|
-
*
|
|
2499
|
+
* A key replays within the account that sent it; an anonymous key is
|
|
2500
|
+
* ignored, and each anonymous deploy is a new deployment. Only successes
|
|
2501
|
+
* replay: a failed deploy retries fresh under the same key.
|
|
2441
2502
|
*/
|
|
2442
2503
|
idempotencyKey?: string;
|
|
2443
2504
|
}
|
|
@@ -3097,9 +3158,9 @@ interface DeployBodyContext {
|
|
|
3097
3158
|
*/
|
|
3098
3159
|
via?: DeploymentViaType;
|
|
3099
3160
|
/**
|
|
3100
|
-
* Optional plaintext password to protect the deployment
|
|
3101
|
-
*
|
|
3102
|
-
*
|
|
3161
|
+
* Optional plaintext password to protect the deployment, already through
|
|
3162
|
+
* `validatePassword`, which trims it: the body sends the value the rule
|
|
3163
|
+
* judged, and the API trims and judges it the same way.
|
|
3103
3164
|
*/
|
|
3104
3165
|
password?: string;
|
|
3105
3166
|
/**
|
|
@@ -3318,6 +3379,11 @@ declare class SimpleEvents {
|
|
|
3318
3379
|
emit<K extends keyof ShipEvents>(event: K, ...args: ShipEvents[K]): void;
|
|
3319
3380
|
}
|
|
3320
3381
|
|
|
3382
|
+
/**
|
|
3383
|
+
* The slowest upload a deploy request is sized for, in bits a second. Stated
|
|
3384
|
+
* here, beside the one ceiling this client derives from it.
|
|
3385
|
+
*/
|
|
3386
|
+
declare const UPLOAD_FLOOR_BITS_PER_SECOND = 2500000;
|
|
3321
3387
|
interface ApiHttpOptions extends ShipClientOptions {
|
|
3322
3388
|
/** Resolves the credential slot per request — async so token providers can mint/refresh. */
|
|
3323
3389
|
getAuthHeaders: () => Record<string, string> | Promise<Record<string, string>>;
|
|
@@ -3355,23 +3421,26 @@ interface DeployTransport {
|
|
|
3355
3421
|
*/
|
|
3356
3422
|
interface Transport {
|
|
3357
3423
|
request<T>(path: string, options: ShipRequestInit, operationName: string, timeoutMs?: number): Promise<T>;
|
|
3358
|
-
requestWithStatus<T>(path: string, options: ShipRequestInit, operationName: string): Promise<RequestResult<T>>;
|
|
3424
|
+
requestWithStatus<T>(path: string, options: ShipRequestInit, operationName: string, timeoutMs?: number): Promise<RequestResult<T>>;
|
|
3359
3425
|
readonly deploy: DeployTransport;
|
|
3360
3426
|
}
|
|
3361
3427
|
/**
|
|
3362
3428
|
* A request as THIS client composes one.
|
|
3363
3429
|
*
|
|
3364
|
-
*
|
|
3365
|
-
*
|
|
3366
|
-
*
|
|
3367
|
-
*
|
|
3368
|
-
*
|
|
3369
|
-
* them. Narrowing at RUNTIME instead would have turned an unreachable case
|
|
3370
|
-
* into a SILENT no-retry — a deploy that quietly stopped replaying because
|
|
3371
|
-
* someone handed the transport a `Headers`. Here that is a compile error.
|
|
3430
|
+
* `RequestInit`, with the headers narrowed from the DOM's three-shaped
|
|
3431
|
+
* `HeadersInit` to the one shape every call site here builds (so
|
|
3432
|
+
* `mergeHeaders` composes a record without a cast), and one field of its
|
|
3433
|
+
* own: `idempotent`, which the resource that knows the request is safe to
|
|
3434
|
+
* repeat sets, and the retry rule reads. The transport never infers it.
|
|
3372
3435
|
*/
|
|
3373
3436
|
type ShipRequestInit = Omit<RequestInit, 'headers'> & {
|
|
3374
3437
|
headers?: Record<string, string>;
|
|
3438
|
+
/**
|
|
3439
|
+
* The request may be sent twice with the same effect: a fill (every fill
|
|
3440
|
+
* is safe to repeat), or a declaration carrying an `Idempotency-Key`, which
|
|
3441
|
+
* the API answers with the deployment the key names.
|
|
3442
|
+
*/
|
|
3443
|
+
idempotent?: boolean;
|
|
3375
3444
|
};
|
|
3376
3445
|
declare class ApiHttp extends SimpleEvents implements Transport {
|
|
3377
3446
|
private readonly apiUrl;
|
|
@@ -3422,14 +3491,6 @@ declare class ApiHttp extends SimpleEvents implements Transport {
|
|
|
3422
3491
|
* is one that may be sent twice.
|
|
3423
3492
|
*/
|
|
3424
3493
|
private isRetryable;
|
|
3425
|
-
/**
|
|
3426
|
-
* Did this request carry the header that makes a repeat safe?
|
|
3427
|
-
*
|
|
3428
|
-
* Case-insensitively, because HTTP field names are — the CLI's env tier and
|
|
3429
|
-
* the SDK option both spell it canonically, but a caller composing headers
|
|
3430
|
-
* by hand is entitled not to.
|
|
3431
|
-
*/
|
|
3432
|
-
private hasIdempotencyKey;
|
|
3433
3494
|
/**
|
|
3434
3495
|
* One attempt: headers, timeout signal, the `request`/`response` events, and
|
|
3435
3496
|
* error normalization.
|
|
@@ -3453,7 +3514,7 @@ declare class ApiHttp extends SimpleEvents implements Transport {
|
|
|
3453
3514
|
* the answer: a domain upsert says create-or-update in its 201/200 and
|
|
3454
3515
|
* nowhere else in the response.
|
|
3455
3516
|
*/
|
|
3456
|
-
requestWithStatus<T>(path: string, options: ShipRequestInit, operationName: string): Promise<RequestResult<T>>;
|
|
3517
|
+
requestWithStatus<T>(path: string, options: ShipRequestInit, operationName: string, timeoutMs?: number): Promise<RequestResult<T>>;
|
|
3457
3518
|
private mergeHeaders;
|
|
3458
3519
|
private createTimeoutSignal;
|
|
3459
3520
|
private safeClone;
|
|
@@ -3913,7 +3974,7 @@ declare function pluralize(count: number, singular: string, plural: string, incl
|
|
|
3913
3974
|
* @file The browser half of the deploy pipeline: reading paths off `File`s.
|
|
3914
3975
|
*
|
|
3915
3976
|
* Everything after is shared (`shared/core/deploy-files.ts`) — path
|
|
3916
|
-
* optimization, junk filtering, the platform's rules, the
|
|
3977
|
+
* optimization, junk filtering, the platform's rules, the digests. What is
|
|
3917
3978
|
* genuinely browser here is one line: a directory drop carries
|
|
3918
3979
|
* `webkitRelativePath`, a file picker does not.
|
|
3919
3980
|
*
|
|
@@ -3979,4 +4040,4 @@ declare class Ship extends Ship$1 {
|
|
|
3979
4040
|
protected processInput(input: DeployInput, options: DeploymentOptions, limits: PlatformLimits): Promise<StaticFile[]>;
|
|
3980
4041
|
}
|
|
3981
4042
|
|
|
3982
|
-
export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountAccess, type AccountDeleteResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, AccountRefusal, type AccountRefusalType, type AccountResource, type AccountRole, type AccountUsage, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BUILD_SETTINGS, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, type BuildFailureDetails, CALLER, type Caps, type ConsoleErrand, type ConsolePaths, type ConsoleSection, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_TOKEN, type DeployBodyContext, type DeployFile, type DeployFileEncoding, type DeployFileSpec, type DeployInput, type DeployTransport, type Deployment, type DeploymentCreateResponse, type DeploymentDeleteResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, type DeploymentSetOptions, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, DeploymentVia, type DeploymentViaType, type DnsLookup, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDeleteResponse, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetOptions, type DomainSetResult, type DomainShareResponse, DomainStatus, type DomainStatusType, type DomainValidateResponse, DomainVerification, type DomainVerificationType, type DomainVerifyResponse, type DoorSegment, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type LabelsResponse, type ListOptions, type ListResponse, type MD5Result, MY_API_KEY_URL, OAUTH_TOKEN, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, type PingResponse, type Plan, type PlanChangeRefusalDetails, type PlanChangeRequest, type PlanChangeResponse, type PlanDestination, type PlansResponse, type PlatformLimitKey, type PlatformLimits, type RequestResult, type ResourceContext, SECTIONS, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_ENV, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type ScheduledChange, type SettingsFragment, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type ShipRequestInit, type StaticFile, TTL_CONSTRAINTS, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, type Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, USAGE_KIND, USER_VISIBLE_EVENTS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, accountOfPath, allValidFilesReady, assertShipJsonSyntax, billingReturnOf, calculateMD5, classifyToken, consolePaths, countPhrase, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, doorOf, doors, errandOf, excessOver, extractSubdomain, filterJunk, fitPhrase, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isClaimPath, isCustomDomain, isDeployment, isPlatformDomain, isShipError, isUpgradePath, normalizeVia, optimizeDeployPaths, personName, personShortName, placesTaken, pluralize, processFilesForBrowser, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployCount, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateLabel, validateLabels, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
|
|
4043
|
+
export { ACCOUNT_HEADER, API_KEY, API_PATHS, AUTH_BASE_PATH, type Account, type AccountAccess, type AccountDeleteResponse, type AccountKeyResponse, AccountPlan, type AccountPlanType, AccountRefusal, type AccountRefusalType, type AccountResource, type AccountRole, type AccountUsage, type Activity, type ActivityEvent, type ActivityListResponse, type ActivityMeta, type ApiDeployOptions, ApiHttp, type ApiHttpOptions, AuthMethod, type AuthMethodType, BUILD_SETTINGS, type BillingInterval, type BillingPortalSession, type BillingSyncResponse, type BuildFailureDetails, CALLER, type Caps, type ConsoleErrand, type ConsolePaths, type ConsoleSection, DEFAULT_API, DEPLOYMENT_CONFIG_FILENAME, DEPLOY_FIELDS, DEPLOY_FILE_GRAMMAR, DEPLOY_REQUEST_CONSTRAINTS, DEPLOY_TOKEN, type DeployBodyContext, type DeployFile, type DeployFileEncoding, type DeployFileSpec, type DeployInput, type DeployTransport, type Deployment, type DeploymentCreateResponse, type DeploymentDeleteResponse, type DeploymentListResponse, type DeploymentOptions, type DeploymentResource, type DeploymentResourceContext, type DeploymentSetOptions, DeploymentStatus, type DeploymentStatusType, type DeploymentUploadOptions, DeploymentVia, type DeploymentViaType, type DnsLookup, type DnsProvider, type DnsRecord, type DnsRecordType, type Domain, type DomainDeleteResponse, type DomainDnsResponse, type DomainListResponse, type DomainRecordsResponse, type DomainResource, type DomainSetOptions, type DomainSetResult, type DomainShareResponse, DomainStatus, type DomainStatusType, type DomainValidateResponse, DomainVerification, type DomainVerificationType, type DomainVerifyResponse, type DoorSegment, type ErrorResponse, ErrorType, type ExecutionEnvironment, FileValidationStatus as FILE_VALIDATION_STATUS, type Fetch, type FileValidationResult, FileValidationStatus, type FileValidationStatusType, IDEMPOTENCY_KEY_CONSTRAINTS, JUNK_DIRECTORIES, LABEL_CONSTRAINTS, LABEL_PATTERN, type LabelsResponse, type ListOptions, type ListResponse, type MD5Result, MY_API_KEY_URL, type ManifestEntry, OAUTH_TOKEN, OAuthScope, type OAuthScopeType, PASSWORD_CONSTRAINTS, PUBLIC_DEPLOYMENT_TTL_SECONDS, type PingResponse, type Plan, type PlanChangeRefusalDetails, type PlanChangeRequest, type PlanChangeResponse, type PlanDestination, type PlansResponse, type PlatformLimitKey, type PlatformLimits, type RequestResult, type ResourceContext, SECTIONS, SETUP_TROUBLESHOOTING_ANCHOR, SHIP_ENV, SHIP_VIA_ENV, type SPACheckRequest, type SPACheckResponse, SPA_CHECK_CONSTRAINTS, SPA_DEFAULT_CONFIG, type ScheduledChange, type SettingsFragment, type SetupInstructionsResponse, Ship, type ShipClientOptions, ShipError, type ShipEvents, type ShipRequestInit, type StaticFile, TTL_CONSTRAINTS, type Token, type TokenCreateOptions, type TokenCreateResponse, type TokenDeleteResponse, TokenKind, type TokenKindType, type TokenListResponse, type TokenProvider, type TokenResource, type Transport, UNBUILT_PROJECT_MARKERS, UNSAFE_FILENAME_CHARS, UPLOAD_FLOOR_BITS_PER_SECOND, USAGE_KIND, USER_VISIBLE_EVENTS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, accountOfPath, allValidFilesReady, assertShipJsonSyntax, billingReturnOf, calculateMD5, classifyToken, consolePaths, countPhrase, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, doorOf, doors, errandOf, excessOver, extractSubdomain, filterJunk, fitPhrase, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isClaimPath, isCustomDomain, isDeployment, isPlatformDomain, isShipError, isUpgradePath, normalizeVia, optimizeDeployPaths, personName, personShortName, placesTaken, pluralize, processFilesForBrowser, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployCount, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateLabel, validateLabels, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
|
package/dist/browser.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
var At=Object.create;var G=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,Rt=Object.prototype.hasOwnProperty;var It=(e,t,n)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var xe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_t=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},Lt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of St(t))!Rt.call(e,l)&&l!==n&&G(e,l,{get:()=>t[l],enumerable:!(i=Dt(t,l))||i.enumerable});return e};var k=(e,t,n)=>(n=e!=null?At(bt(e)):{},Lt(t||!e||!e.__esModule?G(n,"default",{value:e,enumerable:!0}):n,e));var z=(e,t,n)=>It(e,typeof t!="symbol"?t+"":t,n);function Nn(e){if(!e||typeof e!="string")return;let t=e.trim().toLowerCase();return Object.values(Nt).includes(t)?t:void 0}function ve(e){if(e==null)return;if(typeof e!="string")throw m.validation("Idempotency key must be a string.");let t=e.trim();if(!t)throw m.validation("Idempotency key must not be empty.");if(t.length>C.MAX_LENGTH)throw m.validation(`Idempotency key must be at most ${C.MAX_LENGTH} characters.`);return t}function xt(e){return e.members+e.invitations}function wn(e,t){let n=Math.max(0,xt(e)-t.members),i=Math.max(0,e.members-t.members),l={members:i,invitations:n-i,customDomains:e.customDomains-t.customDomains,platformDomains:e.platformDomains-t.platformDomains};return Object.fromEntries(Object.entries(l).filter(([,p])=>p>0))}function wt(e){return Fe(["members","customDomains","platformDomains"].filter(t=>(e[t]??0)>0).map(t=>Ce(t,e[t]??0)))}function On(e){let t=wt(e),n=e.invitations??0;return Fe([...t?[`remove ${t}`]:[],...n>0?[`cancel ${Ce("invitations",n)}`]:[]])}function vn(e){return e.name?.trim()||e.email}function Cn(e){return e.name?.trim().split(" ")[0]||e.email}function Ct(e){let t=e.code;return t==="ERR_INVALID_URL"?!1:typeof t=="string"?!0:e instanceof TypeError?!/\burl\b/i.test(e.message):!1}function Me(e){return e!==null&&typeof e=="object"&&"name"in e&&e.name==="ShipError"&&"status"in e}function Ft(e){let t=e.replace(/\\/g,"/").split("/").pop()??"",n=t.lastIndexOf(".");return n<=0||n===t.length-1?null:t.slice(n+1).toLowerCase()}function Ue(e,t){let n=Ft(e);return n===null?!1:Array.isArray(t)?t.includes(n):t.has(n)}function $e(e){return Ut.test(e)}function j(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>$t.has(n))}function Bt(e){return e.startsWith(Be.PREFIX)?P.API_KEY:e.startsWith(He.PREFIX)?P.DEPLOY_TOKEN:e.startsWith(Ge.PREFIX)?P.OAUTH:P.OPAQUE}function Bn(e){return e.slice(0,ae.length).toLowerCase()!==ae?null:e.slice(ae.length)||null}function ze(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,n;try{n=JSON.parse(t)}catch(i){throw m.config(`invalid JSON format in config: ${i.message}`,{filePath:x})}if(n===null||typeof n!="object"||Array.isArray(n))throw m.config(`${x} must contain a JSON object`,{filePath:x})}function ce(e,t,n){if(!e.startsWith(t.PREFIX))throw m.validation(`${n} must start with "${t.PREFIX}"`);if(e.length!==t.TOTAL_LENGTH)throw m.validation(`${n} must be ${t.TOTAL_LENGTH} characters total (${t.PREFIX} + ${t.HEX_LENGTH} hex chars)`);let i=e.slice(t.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${t.HEX_LENGTH}}$`,"i").test(i))throw m.validation(`${n} must contain ${t.HEX_LENGTH} hexadecimal characters after "${t.PREFIX}" prefix`)}function Ht(e){ce(e,Be,"API key")}function Gt(e){ce(e,He,"Deploy token")}function kt(e){ce(e,Ge,"OAuth access token")}function pe(e){switch(Bt(e)){case P.API_KEY:Ht(e);return;case P.DEPLOY_TOKEN:Gt(e);return;case P.OAUTH:kt(e);return;case P.OPAQUE:if(!e)throw m.validation("Token must be a non-empty string")}}function Ke(e){if(!e||e.length>$.MAX_LENGTH||!$.PATTERN.test(e))throw m.validation(`Caller must be 1-${$.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function Gn(e){try{let t=new URL(e);if(!["http:","https:"].includes(t.protocol))throw m.validation("API URL must use http:// or https:// protocol");if(t.pathname!=="/"&&t.pathname!=="")throw m.validation("API URL must not contain a path");if(t.search||t.hash)throw m.validation("API URL must not contain query parameters or fragments")}catch(t){throw Me(t)?t:m.validation("API URL must be a valid URL")}}function kn(e){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(e)}function fe(e){if(e!=null){if(typeof e!="number"||!Number.isFinite(e))throw m.validation("TTL must be a number of seconds");if(!Number.isInteger(e))throw m.validation("TTL must be a whole number of seconds");if(e<K.MIN_SECONDS||e>K.MAX_SECONDS)throw m.validation(`TTL must be between ${K.MIN_SECONDS} and ${K.MAX_SECONDS} seconds`);return e}}function jt(e){let t=e?`/${e}`:"",n=i=>`${t}${i}`;return{dashboard:()=>t||"/",newSite:()=>n("/new"),deployments:Object.assign(()=>n("/deployments"),{upload:()=>n("/deployments/upload")}),domains:Object.assign(()=>n("/domains"),{connect:i=>n(`/domains/${i}/connect`),deployment:i=>n(`/domains/${i}/deployment`)}),settings:i=>n(i?`/settings#${i}`:"/settings"),claim:i=>n(`/claim/${i}`),settingsAfterBilling:()=>n(`/settings?${Oe("portal")}`),upgrade:i=>n(i?`/upgrade/${i}`:"/upgrade"),success:()=>n("/success"),successAfterCheckout:()=>n(`/success?${Oe("checkout")}`),apiKey:()=>n("/api-key")}}function Kn(e){let t=new URLSearchParams(e);for(let[n,[i,l]]of Object.entries(Ve))if(t.get(i)===l)return n;return null}function q(e){let t=e.split(/[?#]/)[0].toLowerCase(),[n="",i=""]=t.split("/").filter(Boolean);return Xt(n)?{kind:"door",door:n}:n===Vt?{kind:"admin"}:n===""||Pe(n)?{kind:"account",account:null,section:n===""?null:n}:{kind:"account",account:n,section:Pe(i)?i:null}}function Vn(e){let t=q(e);return t.kind==="account"?t.account:null}function qt(e){let t=q(e);return t.kind==="door"?t.door:null}function jn(e){return Yt(e)?"claim":qt(e)==="invitation"?"invite":Wt(e)?"upgrade":null}function Jt(e){let t=Math.round(e/60);if(!(t>=1))return"less than a minute";if(t<120)return ue(t,"minute");let n=Math.round(e/3600);return n<48?ue(n,"hour"):ue(Math.round(e/86400),"day")}function Jn(e,t=Date.now()/1e3){let n=e-t;return n>0?Jt(n):null}function ue(e,t){return`${e} ${t}${e===1?"":"s"}`}function H(e,t=1){if(e===0)return"0 Bytes";let n=1024,i=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**l).toFixed(t))} ${i[l]}`}function je(e,t){return e.endsWith(`.${t}`)}function Zn(e,t){return!je(e,t)}function er(e,t){return je(e,t)?e.slice(0,-(t.length+1)):null}function tr(e){return`https://${e}`}function nr(e){return`https://${e}`}function Zt(e){if(typeof e!="string")throw m.validation("Labels must be strings");let t=e.trim().toLowerCase();if(t.length<v.MIN_LENGTH)throw m.validation(`Labels must be at least ${v.MIN_LENGTH} characters long`);if(t.length>v.MAX_LENGTH)throw m.validation(`Labels must be no more than ${v.MAX_LENGTH} characters long`);if(!Qt.test(t))throw m.validation("Labels use letters and numbers, with . _ or - between them, and can have one : between a key and a value, like env:production");return t}function F(e){if(e==null)return;if(!Array.isArray(e))throw m.validation("Labels must be an array");if(e.length>v.MAX_COUNT)throw m.validation(`Maximum ${v.MAX_COUNT} labels allowed`);let t=e.map(Zt);if(new Set(t).size!==t.length)throw m.validation("Duplicate labels are not allowed");return t}function rr(e){return!e||e.length===0?null:JSON.stringify(e)}function or(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Xe(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Build command must be a string");let t=e.trim();if(t.length===0||t.length>B.COMMAND_MAX_LENGTH)throw m.validation(`Build command must be between 1 and ${B.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(t))throw m.validation("Build command must be a single line");return t}function qe(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Output folder must be a string");let t=e.trim().replace(/\/+$/,"");if(t.length===0||t.length>B.OUTPUT_DIR_MAX_LENGTH)throw m.validation(`Output folder must be between 1 and ${B.OUTPUT_DIR_MAX_LENGTH} characters`);if(!B.OUTPUT_DIR_PATTERN.test(t)||t.split("/").some(n=>n===".."||n==="."))throw m.validation("Output folder must be a relative path inside the project, like dist or dist/site");return t}function me(e){if(e==null)return;if(typeof e!="string")throw m.validation("Password must be a string");let t=e.trim();if(t.length<V.MIN_LENGTH||t.length>V.MAX_LENGTH)throw m.validation(`Password must be between ${V.MIN_LENGTH} and ${V.MAX_LENGTH} characters`);return t}var Rn,Nt,In,_n,Ln,C,xn,we,Ce,Fe,Pn,A,I,Fn,g,Ot,ie,Pt,vt,m,Mt,Mn,Ut,$t,Un,se,Be,He,Ge,$,$n,P,ae,Hn,x,ke,X,K,zt,Kt,Vt,Ve,Oe,le,zn,Xt,Pe,Yt,Wt,de,Xn,qn,Yn,Wn,Qn,b,v,Qt,B,V,S=_(()=>{"use strict";Rn={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},Nt={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc",CLD:"cld",CRS:"crs",GMN:"gmn",API:"api"},In={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},_n={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},Ln="troubleshooting",C={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};xn={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"};we={deployments:{one:"deployment",many:"deployments"},platformDomains:{one:"ShipStatic domain",many:"ShipStatic domains"},customDomains:{one:"custom domain",many:"custom domains"},members:{one:"member",many:"members"},invitations:{one:"invitation",many:"invitations"}};Ce=(e,t)=>`${t} ${t===1?we[e].one:we[e].many}`,Fe=e=>e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e[0]??"",Pn={PAUSED:"paused",UNKNOWN:"unknown"};A={DEPLOYMENTS:"/deployments",DEPLOYMENT:e=>`/deployments/${e}`,DEPLOYMENT_CONFIG:e=>`/deployments/${e}/config`,DOMAINS:"/domains",DOMAIN:e=>`/domains/${e}`,DOMAIN_VERIFY:e=>`/domains/${e}/verify`,DOMAIN_DNS:e=>`/domains/${e}/dns`,DOMAIN_RECORDS:e=>`/domains/${e}/records`,DOMAIN_SHARE:e=>`/domains/${e}/share`,DOMAIN_PROPAGATION:e=>`/domains/${e}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:e=>`/tokens/${e}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PLANS:"/plans",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},I={FILES:"files[]",CHECKSUMS:"checksums",LABELS:"labels",VIA:"via",PASSWORD:"password",TTL:"ttl",BUILD:"build",PRERENDER:"prerender",SPA:"spa",BUILD_COMMAND:"buildCommand",OUTPUT_DIR:"outputDir",CAPTCHA:"captcha"},Fn={PATH:"path",CONTENT:"content",ENCODING:"encoding",DEFAULT_ENCODING:"utf-8",ENCODINGS:["utf-8","base64"]},g={Validation:"validation_failed",NotFound:"not_found",Forbidden:"forbidden",RateLimit:"rate_limit_exceeded",Authentication:"authentication_failed",Business:"business_logic_error",Api:"internal_server_error",Maintenance:"maintenance",Build:"build_failed",Network:"network_error",Timeout:"timeout_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},Ot=new Set([g.Network,g.Timeout,g.Cancelled,g.File,g.Config]),ie={client:new Set([g.Build,g.Business,g.Cancelled,g.Config,g.File,g.Forbidden,g.NotFound,g.RateLimit,g.Validation]),network:new Set([g.Network,g.Timeout]),auth:new Set([g.Authentication])},Pt=new Set(Object.values(g).filter(e=>!Ot.has(e))),vt=200;m=class e extends Error{constructor(n,i,l,p){super(i);z(this,"type");z(this,"status");z(this,"details");this.type=n,this.status=l,this.details=p,this.name="ShipError"}toResponse(){let n=this.details,i=this.type===g.Authentication&&n?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:i}}static async fromHttpResponse(n,i){let l,p,h;try{if(n.headers.get("content-type")?.includes("application/json")){let d=await n.json();if(d&&typeof d=="object"){let T=d;typeof T.message=="string"?l=T.message:typeof T.error=="string"&&(l=T.error),p=T.details,typeof T.error=="string"&&Pt.has(T.error)&&(h=T.error)}}else{let d=(await n.text()).trim();d&&!d.startsWith("<")&&d.length<=vt&&(l=d)}}catch{}let y=n.headers.get("retry-after");if(y!==null){let E=y.trim(),d=/^\d+$/.test(E)?Number(E):Math.ceil((Date.parse(E)-Date.now())/1e3);if(Number.isFinite(d)&&d>=0){let T=p&&typeof p=="object"?p:{};T.retryAfter===void 0&&(p={...T,retryAfter:d})}}l=l||`${i||"Request"} failed with status ${n.status}`;let f=h??(n.status===401?g.Authentication:n.status===403?g.Forbidden:n.status===429?g.RateLimit:g.Api);return new e(f,l,n.status,p)}static fromFetchError(n,i){if(Me(n))return n;let l=i||"Request",p=n?.name;return p==="AbortError"?e.cancelled(`${l} was cancelled`):p==="TimeoutError"?e.timeout(`${l} timed out`,{cause:n}):n instanceof Error?Ct(n)?e.network(`${l} failed: ${n.message}`,{cause:n}):new e(g.Api,`${l} failed: ${n.message}`):new e(g.Api,`${l} failed: Unknown error`)}static validation(n,i){return new e(g.Validation,n,400,i)}static notFound(n,i){let l=i?`${n} ${i} not found`:`${n} not found`;return new e(g.NotFound,l,404)}static forbidden(n,i){return new e(g.Forbidden,n,403,i)}static rateLimit(n="Too many requests",i){return new e(g.RateLimit,n,429,i)}static authentication(n="Authentication required",i){return new e(g.Authentication,n,401,i)}static business(n,i=400,l){return new e(g.Business,n,i,l)}static network(n,i){return new e(g.Network,n,void 0,i)}static timeout(n,i){return new e(g.Timeout,n,void 0,i)}static cancelled(n,i){return new e(g.Cancelled,n,void 0,i)}static file(n,i){return new e(g.File,n,void 0,i)}static config(n,i){return new e(g.Config,n,void 0,i)}static api(n,i=500,l){return new e(g.Api,n,i,l)}static maintenance(n,i){return new e(g.Maintenance,n,503,i)}static build(n,i){return new e(g.Build,n,422,i)}isClientError(){return ie.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return ie.network.has(this.type)}isAuthError(){return ie.auth.has(this.type)}isType(n){return this.type===n}};Mt=["html","htm","xhtml","xml","txt","md","markdown","pdf","csv","json","jsonc","webmanifest","map","toml","yaml","yml","rss","atom","css","scss","sass","less","js","mjs","cjs","jsx","ts","tsx","wasm","vue","svelte","png","jpg","jpeg","gif","webp","avif","svg","ico","bmp","tif","tiff","heic","heif","woff","woff2","ttf","otf","eot","mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","mp4","webm","ogv","mov","m4v","avi","glb","gltf","usdz","vtt","srt","zip"],Mn=Mt.map(e=>`.${e}`).join(","),Ut=/[\x00-\x1f\x7f#?%\\<>"]/;$t=new Set(["node_modules","package.json"]);Un="/auth",se={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",SYSTEM:"system"},Be={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},He={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},Ge={PREFIX:"oauth-",HEX_LENGTH:32,TOTAL_LENGTH:38},$={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},$n="X-Account",P={API_KEY:se.API_KEY,DEPLOY_TOKEN:se.TOKEN,OAUTH:se.OAUTH,OPAQUE:"opaque"};ae="bearer ";Hn={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},x="ship.json",ke={rewrites:[{source:"/(.*)",destination:"/index.html"}]},X={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};K={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};zt={new:{owner:!1},deployments:{owner:!1},domains:{owner:!1},settings:{owner:!1},claim:{owner:!1},upgrade:{owner:!0},success:{owner:!0},"api-key":{owner:!0}},Kt=["login","register","logout","invitation","consent"],Vt="admin",Ve={checkout:["upgrading","true"],portal:["billing","returned"]},Oe=e=>Ve[e].join("="),le=(e,t)=>t?`${e}?next=${encodeURIComponent(t)}`:e;zn={login:({token:e,next:t}={})=>le(e?`/login/${e}`:"/login",t),register:({next:e}={})=>le("/register",e),logout:({next:e}={})=>le("/logout",e),invitation:e=>`/invitation/${e}`,consent:()=>"/consent"};Xt=e=>Kt.includes(e),Pe=e=>Object.hasOwn(zt,e);Yt=e=>{let t=q(e);return t.kind==="account"&&t.section==="claim"},Wt=e=>{let t=q(e);return t.kind==="account"&&t.section==="upgrade"};de="https://api.shipstatic.com",Xn={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},qn="SHIP_VIA",Yn=`https://my.shipstatic.com${jt().apiKey()}`,Wn=4320*60;Qn=["account.create","account.update","account.delete","account.key.generate","account.plan.transition","deployment.create","deployment.update","deployment.delete","deployment.claim","domain.create","domain.update","domain.delete","domain.verify","token.create","token.consume","token.delete","member.join","member.leave","consent.grant"],b={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};v={MIN_LENGTH:3,MAX_LENGTH:63,MAX_COUNT:10},Qt=/^[a-z0-9]+(?:[._-][a-z0-9]+)*(?::[a-z0-9]+(?:[._-][a-z0-9]+)*)?$/;B={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};V={MIN_LENGTH:6,MAX_LENGTH:128}});var Ze=xe((Je,Qe)=>{"use strict";(function(e){if(typeof Je=="object")Qe.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t;try{t=window}catch{t=self}t.SparkMD5=e()}})(function(e){"use strict";var t=function(c,u){return c+u&4294967295},n=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function i(c,u,o,r,a,s){return u=t(t(u,c),t(r,s)),t(u<<a|u>>>32-a,o)}function l(c,u){var o=c[0],r=c[1],a=c[2],s=c[3];o+=(r&a|~r&s)+u[0]-680876936|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[1]-389564586|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[2]+606105819|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[3]-1044525330|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&s)+u[4]-176418897|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[5]+1200080426|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[6]-1473231341|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[7]-45705983|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&s)+u[8]+1770035416|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[9]-1958414417|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[10]-42063|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[11]-1990404162|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&s)+u[12]+1804603682|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[13]-40341101|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[14]-1502002290|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[15]+1236535329|0,r=(r<<22|r>>>10)+a|0,o+=(r&s|a&~s)+u[1]-165796510|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[6]-1069501632|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[11]+643717713|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[0]-373897302|0,r=(r<<20|r>>>12)+a|0,o+=(r&s|a&~s)+u[5]-701558691|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[10]+38016083|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[15]-660478335|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[4]-405537848|0,r=(r<<20|r>>>12)+a|0,o+=(r&s|a&~s)+u[9]+568446438|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[14]-1019803690|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[3]-187363961|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[8]+1163531501|0,r=(r<<20|r>>>12)+a|0,o+=(r&s|a&~s)+u[13]-1444681467|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[2]-51403784|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[7]+1735328473|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[12]-1926607734|0,r=(r<<20|r>>>12)+a|0,o+=(r^a^s)+u[5]-378558|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[8]-2022574463|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[11]+1839030562|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[14]-35309556|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^s)+u[1]-1530992060|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[4]+1272893353|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[7]-155497632|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[10]-1094730640|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^s)+u[13]+681279174|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[0]-358537222|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[3]-722521979|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[6]+76029189|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^s)+u[9]-640364487|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[12]-421815835|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[15]+530742520|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[2]-995338651|0,r=(r<<23|r>>>9)+a|0,o+=(a^(r|~s))+u[0]-198630844|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[7]+1126891415|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[14]-1416354905|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[5]-57434055|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~s))+u[12]+1700485571|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[3]-1894986606|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[10]-1051523|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[1]-2054922799|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~s))+u[8]+1873313359|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[15]-30611744|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[6]-1560198380|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[13]+1309151649|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~s))+u[4]-145523070|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[11]-1120210379|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[2]+718787259|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[9]-343485551|0,r=(r<<21|r>>>11)+a|0,c[0]=o+c[0]|0,c[1]=r+c[1]|0,c[2]=a+c[2]|0,c[3]=s+c[3]|0}function p(c){var u=[],o;for(o=0;o<64;o+=4)u[o>>2]=c.charCodeAt(o)+(c.charCodeAt(o+1)<<8)+(c.charCodeAt(o+2)<<16)+(c.charCodeAt(o+3)<<24);return u}function h(c){var u=[],o;for(o=0;o<64;o+=4)u[o>>2]=c[o]+(c[o+1]<<8)+(c[o+2]<<16)+(c[o+3]<<24);return u}function y(c){var u=c.length,o=[1732584193,-271733879,-1732584194,271733878],r,a,s,R,N,O;for(r=64;r<=u;r+=64)l(o,p(c.substring(r-64,r)));for(c=c.substring(r-64),a=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)s[r>>2]|=c.charCodeAt(r)<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(l(o,s),r=0;r<16;r+=1)s[r]=0;return R=u*8,R=R.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(R[2],16),O=parseInt(R[1],16)||0,s[14]=N,s[15]=O,l(o,s),o}function f(c){var u=c.length,o=[1732584193,-271733879,-1732584194,271733878],r,a,s,R,N,O;for(r=64;r<=u;r+=64)l(o,h(c.subarray(r-64,r)));for(c=r-64<u?c.subarray(r-64):new Uint8Array(0),a=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)s[r>>2]|=c[r]<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(l(o,s),r=0;r<16;r+=1)s[r]=0;return R=u*8,R=R.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(R[2],16),O=parseInt(R[1],16)||0,s[14]=N,s[15]=O,l(o,s),o}function E(c){var u="",o;for(o=0;o<4;o+=1)u+=n[c>>o*8+4&15]+n[c>>o*8&15];return u}function d(c){var u;for(u=0;u<c.length;u+=1)c[u]=E(c[u]);return c.join("")}d(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(t=function(c,u){var o=(c&65535)+(u&65535),r=(c>>16)+(u>>16)+(o>>16);return r<<16|o&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function c(u,o){return u=u|0||0,u<0?Math.max(u+o,0):Math.min(u,o)}ArrayBuffer.prototype.slice=function(u,o){var r=this.byteLength,a=c(u,r),s=r,R,N,O,Ne;return o!==e&&(s=c(o,r)),a>s?new ArrayBuffer(0):(R=s-a,N=new ArrayBuffer(R),O=new Uint8Array(N),Ne=new Uint8Array(this,a,R),O.set(Ne),N)}})();function T(c){return/[\u0080-\uFFFF]/.test(c)&&(c=unescape(encodeURIComponent(c))),c}function L(c,u){var o=c.length,r=new ArrayBuffer(o),a=new Uint8Array(r),s;for(s=0;s<o;s+=1)a[s]=c.charCodeAt(s);return u?a:r}function U(c){return String.fromCharCode.apply(null,new Uint8Array(c))}function oe(c,u,o){var r=new Uint8Array(c.byteLength+u.byteLength);return r.set(new Uint8Array(c)),r.set(new Uint8Array(u),c.byteLength),o?r:r.buffer}function w(c){var u=[],o=c.length,r;for(r=0;r<o-1;r+=2)u.push(parseInt(c.substr(r,2),16));return String.fromCharCode.apply(String,u)}function D(){this.reset()}return D.prototype.append=function(c){return this.appendBinary(T(c)),this},D.prototype.appendBinary=function(c){this._buff+=c,this._length+=c.length;var u=this._buff.length,o;for(o=64;o<=u;o+=64)l(this._hash,p(this._buff.substring(o-64,o)));return this._buff=this._buff.substring(o-64),this},D.prototype.end=function(c){var u=this._buff,o=u.length,r,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s;for(r=0;r<o;r+=1)a[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(a,o),s=d(this._hash),c&&(s=w(s)),this.reset(),s},D.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},D.prototype.setState=function(c){return this._buff=c.buff,this._length=c.length,this._hash=c.hash,this},D.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},D.prototype._finish=function(c,u){var o=u,r,a,s;if(c[o>>2]|=128<<(o%4<<3),o>55)for(l(this._hash,c),o=0;o<16;o+=1)c[o]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(r[2],16),s=parseInt(r[1],16)||0,c[14]=a,c[15]=s,l(this._hash,c)},D.hash=function(c,u){return D.hashBinary(T(c),u)},D.hashBinary=function(c,u){var o=y(c),r=d(o);return u?w(r):r},D.ArrayBuffer=function(){this.reset()},D.ArrayBuffer.prototype.append=function(c){var u=oe(this._buff.buffer,c,!0),o=u.length,r;for(this._length+=c.byteLength,r=64;r<=o;r+=64)l(this._hash,h(u.subarray(r-64,r)));return this._buff=r-64<o?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},D.ArrayBuffer.prototype.end=function(c){var u=this._buff,o=u.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a,s;for(a=0;a<o;a+=1)r[a>>2]|=u[a]<<(a%4<<3);return this._finish(r,o),s=d(this._hash),c&&(s=w(s)),this.reset(),s},D.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.ArrayBuffer.prototype.getState=function(){var c=D.prototype.getState.call(this);return c.buff=U(c.buff),c},D.ArrayBuffer.prototype.setState=function(c){return c.buff=L(c.buff,!0),D.prototype.setState.call(this,c)},D.ArrayBuffer.prototype.destroy=D.prototype.destroy,D.ArrayBuffer.prototype._finish=D.prototype._finish,D.ArrayBuffer.hash=function(c,u){var o=f(new Uint8Array(c)),r=d(o);return u?w(r):r},D})});var J=xe((dr,et)=>{"use strict";et.exports={}});async function un(e){let t=(await Promise.resolve().then(()=>k(Ze(),1))).default,n=new t.ArrayBuffer,i=2097152;for(let l=0;l<e.size;l+=i){let p=Math.min(l+i,e.size);n.append(await e.slice(l,p).arrayBuffer())}return{md5:n.end()}}async function cn(e){let{createHash:t}=await Promise.resolve().then(()=>k(J(),1)),n=t("md5");return n.update(e),{md5:n.digest("hex")}}async function pn(e){let{createHash:t}=await Promise.resolve().then(()=>k(J(),1)),{createReadStream:n}=await Promise.resolve().then(()=>k(J(),1));return new Promise((i,l)=>{let p=t("md5"),h=n(e);h.on("error",y=>l(m.file(`Failed to read file for MD5: ${y.message}`,{filePath:e}))),h.on("data",y=>p.update(y)),h.on("end",()=>i({md5:p.digest("hex")}))})}async function Q(e){if(e instanceof Blob)return un(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return cn(e);if(typeof e=="string")return pn(e);throw m.business("Invalid input for MD5 calculation")}var Z=_(()=>{"use strict";S()});function ne(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var at=_(()=>{"use strict"});function lt(e,t={}){if(t.flatten===!1)return e.map(i=>({path:ne(i),name:ye(i)}));let n=hn(e);return e.map(i=>{let l=ne(i);if(n){let p=n.endsWith("/")?n:`${n}/`;l.startsWith(p)&&(l=l.substring(p.length))}return l||(l=ye(i)),{path:l,name:ye(i)}})}function hn(e){if(!e.length)return"";let n=e.map(p=>ne(p)).map(p=>p.split("/")),i=[],l=Math.min(...n.map(p=>p.length));for(let p=0;p<l-1;p++){let h=n[0][p];if(n.every(y=>y[p]===h))i.push(h);else break}return i.join("/")}function ye(e){return e.split(/[/\\]/).pop()||e}var ge=_(()=>{"use strict";at()});function Mr(e){Ee=e}function yn(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function ut(){return Ee||yn()}var Ee,Te=_(()=>{"use strict";Ee=null});function Ae(e,t,n){let i=t.suggestions?.[n];return i?`${e} ${i}`:e}function re(e,t){return gn.find(n=>n.broken(e,t))}var gn,M,Se=_(()=>{"use strict";S();be();gn=[{name:"name",broken:({path:e})=>!De(e).valid,sentence:({path:e})=>De(e).reason??`File name "${e}" is invalid.`},{name:"extension",broken:({path:e},t)=>Ue(e,t.blockedExtensions??[]),sentence:({path:e})=>`File "${e}" has an extension that is not allowed.`},{name:"fileSize",broken:({size:e},t)=>e>t.maxFileSize,sentence:({path:e},t)=>Ae(`File "${e}" is too large. Maximum ${H(t.maxFileSize)} allowed.`,t,"maxFileSize")},{name:"totalSize",broken:({totalSize:e},t)=>e>t.maxTotalSize,sentence:({totalSize:e},t)=>Ae(`Files add up to ${H(e)}. Maximum ${H(t.maxTotalSize)} allowed.`,t,"maxTotalSize")}],M={name:"filesCount",broken:(e,t)=>e>t.maxFilesCount,sentence:(e,t)=>Ae(`Too many files (${e}). Maximum ${t.maxFilesCount} files allowed.`,t,"maxFilesCount")}});function De(e){let t=l=>({valid:!1,reason:`File name "${e}" ${l}.`});if($e(e))return t("contains unsafe characters");if(e.startsWith(" ")||e.endsWith(" "))return t("cannot start or end with spaces");if(e.endsWith("."))return t("cannot end with dots");let n=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,i=e.split("/").pop()||e;return n.test(i)?t("uses a reserved system name"):e.includes("..")?t("contains a path traversal pattern"):{valid:!0}}function zr(e,t){let n=[],i=[],l=[];if(e.length===0){let f={file:"(no files)",message:"At least one file must be provided."};return n.push(f),{files:[],validFiles:[],errors:n,warnings:[],canDeploy:!1}}for(let f of e)if(j(f.name))return n.push({file:f.name,message:"Unbuilt project detected. Deploy your build output (dist/, build/, out/), not the project folder."}),{files:e.map(E=>({...E,status:b.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:n,warnings:[],canDeploy:!1};if(M.broken(e.length,t)){let f={file:`(${e.length} files)`,message:M.sentence(e.length,t)};return n.push(f),{files:e.map(E=>({...E,status:b.VALIDATION_FAILED,statusMessage:f.message})),validFiles:[],errors:n,warnings:[],canDeploy:!1}}let p=0;for(let f of e){let E=b.READY,d="Ready for upload";if(f.status===b.PROCESSING_ERROR)E=b.VALIDATION_FAILED,d=f.statusMessage||`File "${f.name}" could not be read.`,n.push({file:f.name,message:d});else if(f.size===0){E=b.EXCLUDED,d=`File "${f.name}" is empty, so it is excluded.`,i.push({file:f.name,message:d}),l.push({...f,status:E,statusMessage:d});continue}else if(f.size<0)E=b.VALIDATION_FAILED,d=`File "${f.name}" reports a negative size.`,n.push({file:f.name,message:d});else if(!f.name||f.name.trim().length===0)E=b.VALIDATION_FAILED,d="File name cannot be empty.",n.push({file:f.name||"(empty)",message:d});else if(f.name.includes("\0"))E=b.VALIDATION_FAILED,d=`File name "${f.name}" contains invalid characters (null byte).`,n.push({file:f.name,message:d});else{let T={path:f.name,size:f.size,totalSize:p+f.size},L=re(T,t);L?(E=b.VALIDATION_FAILED,d=L.sentence(T,t),n.push({file:L.name==="totalSize"?`(${e.length} files)`:f.name,message:d})):p=T.totalSize}l.push({...f,status:E,statusMessage:d})}n.length>0&&(l=l.map(f=>f.status===b.EXCLUDED?f:{...f,status:b.VALIDATION_FAILED,statusMessage:f.status===b.VALIDATION_FAILED?f.statusMessage:"Deployment failed due to validation errors in bundle"}));let h=n.length===0?l.filter(f=>f.status===b.READY):[],y=n.length===0;return{files:l,validFiles:h,errors:n,warnings:i,canDeploy:y}}function En(e){return e.filter(t=>t.status===b.READY)}function Kr(e){return En(e).length>0}var be=_(()=>{"use strict";S();Se();S()});function ct(e){return An.test(e)}var Tn,An,pt=_(()=>{"use strict";Tn=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],An=new RegExp(Tn.join("|"))});function ft(e,t){if(!e||e.length===0)return[];if(!t?.allowUnbuilt&&e.find(i=>i&&j(i)))throw m.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return e.filter(n=>{if(!n)return!1;let i=n.replace(/\\/g,"/").split("/").filter(Boolean);if(i.length===0)return!0;let l=i[i.length-1];if(ct(l))return!1;for(let h of i)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let p=i.slice(0,-1);for(let h of p)if(Dn.some(y=>h.toLowerCase()===y.toLowerCase()))return!1;return!0})}var Dn,Re=_(()=>{"use strict";S();pt();Dn=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function dt(e,t){if(e.includes("\0")||e.includes("/../")||e.startsWith("../")||e.endsWith("/.."))throw m.business(`Security error: Unsafe file path "${e}" for file: ${t}`)}function mt(e,t){let n=re(e,t);if(n)throw m.business(n.sentence(e,t))}function ht(e,t){if(M.broken(e,t))throw m.business(M.sentence(e,t))}var Ie=_(()=>{"use strict";S();Se()});async function yt(e,t={},n){let i=!!(t.build||t.prerender),l=lt(e.map(d=>d.path),{flatten:t.pathDetect!==!1}).map(d=>d.path),p=new Set(ft(l,{allowUnbuilt:i})),h=e.map((d,T)=>({source:d,deployPath:l[T]})).filter(({deployPath:d})=>p.has(d));if(h.length===0)return[];let y=i?null:Sn(n),f=[],E=0;for(let{source:d,deployPath:T}of h){if(y&&dt(T,d.origin),d.size===0)continue;y&&(E+=d.size,mt({path:T,size:d.size,totalSize:E},y));let L=await d.read(),{md5:U}=await Q(L);f.push({path:T,content:L,size:d.size,md5:U})}return y&&ht(f.length,y),f}function Sn(e){if(!e)throw m.config("Platform limits not provided. Deploy-mode validation requires the limits argument \u2014 pass `ship.getLimits()` result.");return e}var gt=_(()=>{"use strict";S();ge();Re();Z();Ie()});var Tt={};_t(Tt,{processFilesForBrowser:()=>Et});async function Et(e,t={},n){if(ut()!=="browser")throw m.business("processFilesForBrowser can only be called in a browser environment.");return yt(e.map(i=>({path:i.webkitRelativePath||i.name,origin:i.name,size:i.size,read:async()=>i})),t,n)}var _e=_(()=>{"use strict";S();gt();Te()});S();S();S();var Y=class{constructor(){this.handlers=new Map}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t)?.add(n)}off(t,n){let i=this.handlers.get(t);i&&(i.delete(n),i.size===0&&this.handlers.delete(t))}emit(t,...n){let i=this.handlers.get(t);if(!i)return;let l=Array.from(i);for(let p of l)try{p(...n)}catch(h){i.delete(p),t!=="error"&&setTimeout(()=>{let y=h instanceof Error?h:new Error(String(h));this.emit("error",y,String(t))},0)}}};var en=3e4,tn=2,nn=300,rn=2e3,on=new Set([500,502,503,504]);function sn(e,t){return new Promise((n,i)=>{if(t?.aborted){i(t.reason);return}let l=()=>{clearTimeout(h),t?.removeEventListener("abort",p)},p=()=>{l(),i(t?.reason)},h=setTimeout(()=>{l(),n()},e);t?.addEventListener("abort",p)})}var Ye=3e5,an=3e5,ln=Ye+an,W=class extends Y{constructor(n){super();this.globalHeaders={};this.apiUrl=n.apiUrl||de,this.getAuthHeadersCallback=n.getAuthHeaders,this.session=n.session??!1,this.caller=n.caller,this.timeout=n.timeout??en,this.maxRetries=Math.max(0,n.maxRetries??tn),this.fetch=n.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:n.deployEndpoint||A.DEPLOYMENTS,timeout:n.timeout??Ye,buildTimeout:n.timeout??ln}}setGlobalHeaders(n){this.globalHeaders=n}async executeRequest(n,i,l,p=this.timeout){for(let h=0;;h++)try{return await this.attemptOnce(n,i,l,p)}catch(y){let f=m.fromFetchError(y,l);if(h>=this.maxRetries||!this.isRetryable(f,i))throw this.emit("error",f,n),f;this.emit("retry",f,n,h+1);let E=Math.min(rn,nn*2**h);try{await sn(Math.random()*E,i.signal)}catch(d){let T=m.fromFetchError(d,l);throw this.emit("error",T,n),T}}}isRetryable(n,i){if(i.signal?.aborted||n.isType(g.Maintenance)||n.isType(g.Cancelled)||!(n.isNetworkError()||n.status!==void 0&&on.has(n.status)))return!1;let p=(i.method??"GET").toUpperCase();return p==="GET"||p==="HEAD"?!0:p==="PUT"||p==="DELETE"?!1:this.hasIdempotencyKey(i.headers)}hasIdempotencyKey(n){if(!n)return!1;let i=C.HEADER.toLowerCase();return Object.keys(n).some(l=>l.toLowerCase()===i)}async attemptOnce(n,i,l,p=this.timeout){let h=()=>{};try{let y=await this.mergeHeaders(i.headers),f=this.createTimeoutSignal(i.signal,p);h=f.cleanup;let E={...i,headers:y,credentials:this.session&&!y.Authorization?"include":void 0,signal:f.signal};this.emit("request",n,E);let d=await this.fetch(n,E);if(h(),!d.ok)throw await m.fromHttpResponse(d,l);return this.emit("response",this.safeClone(d),n),{data:await this.parseResponse(this.safeClone(d)),status:d.status}}catch(y){throw h(),m.fromFetchError(y,l)}}async request(n,i,l,p){let{data:h}=await this.executeRequest(`${this.apiUrl}${n}`,i,l,p);return h}async requestWithStatus(n,i,l){return this.executeRequest(`${this.apiUrl}${n}`,i,l)}async mergeHeaders(n={}){return{...this.globalHeaders,...this.caller?{[$.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...n}}createTimeoutSignal(n,i=this.timeout){let l=new AbortController,p=setTimeout(()=>l.abort(new DOMException(`Timed out after ${i}ms`,"TimeoutError")),i),h=n?()=>l.abort(n.reason):void 0;return n&&h&&(n.addEventListener("abort",h),n.aborted&&l.abort(n.reason)),{signal:l.signal,cleanup:()=>{clearTimeout(p),n&&h&&n.removeEventListener("abort",h)}}}safeClone(n){try{return n.clone()}catch{return n}}async parseResponse(n){if(!(n.headers.get("Content-Length")==="0"||n.status===204))return n.json()}};S();S();async function We(e,t={}){let{labels:n,via:i,password:l,ttl:p,flags:h,captcha:y}=t,f=new FormData,E=[];for(let d of e){if(typeof d.content=="string"||d.content===null||d.content===void 0)throw m.file(`Unsupported file.content type: ${d.path}`,{filePath:d.path});if(!d.md5)throw m.file(`File missing md5 checksum: ${d.path}`,{filePath:d.path});f.append(I.FILES,new File([d.content],d.path,{type:"application/octet-stream"})),E.push(d.md5)}return f.append(I.CHECKSUMS,JSON.stringify(E)),n&&n.length>0&&f.append(I.LABELS,JSON.stringify(n)),i&&f.append(I.VIA,i),l&&f.append(I.PASSWORD,l),p!==void 0&&f.append(I.TTL,String(p)),h?.build&&f.append(I.BUILD,"true"),h?.prerender&&f.append(I.PRERENDER,"true"),h?.spa&&f.append(I.SPA,"true"),h?.buildCommand&&f.append(I.BUILD_COMMAND,h.buildCommand),h?.outputDir&&f.append(I.OUTPUT_DIR,h.outputDir),y&&f.append(I.CAPTCHA,y),f}S();Z();async function fn(){let e=JSON.stringify(ke,null,2),t;typeof Buffer<"u"?t=Buffer.from(e,"utf-8"):t=new Blob([e],{type:"application/json"});let{md5:n}=await Q(t);return{path:x,content:t,size:e.length,md5:n}}async function dn(e,t,n){let i=e.find(y=>y.path===X.INDEX_FILE||y.path===`/${X.INDEX_FILE}`);if(!i||i.size>X.MAX_INDEX_BYTES)return!1;let l;if(typeof Buffer<"u"&&Buffer.isBuffer(i.content))l=i.content.toString("utf-8");else if(typeof Blob<"u"&&i.content instanceof Blob)l=await i.content.text();else if(typeof File<"u"&&i.content instanceof File)l=await i.content.text();else return!1;let p={files:e.map(y=>y.path),index:l};return(await t.request(A.SPA_CHECK,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p),signal:n??null},"SPA check")).isSPA}async function tt(e,t,n){return n.spaDetect===!1||n.spa||n.build||n.prerender||e.some(i=>i.path===x)?e:await dn(e,t,n.signal)?[...e,await fn()]:e}S();S();async function nt(e){let t=e.find(l=>l.path===x||l.path===`/${x}`);if(!t)return;let n=t.content,i=typeof n.text=="function"?await n.text():t.content.toString("utf8");ze(i)}var ee={"Content-Type":"application/json"},mn="sdk";function he(e){let t=new URLSearchParams;e?.limit!==void 0&&t.set("limit",String(e.limit)),e?.cursor!==void 0&&t.set("cursor",e.cursor);let n=t.toString();return n?`?${n}`:""}function rt(e){let{getApi:t,processInput:n}=e;return{upload:async(i,l={})=>{if(!n)throw m.config("processInput function is not provided.");let p=t(),h=await n(i,l),y=await tt(h,p,l);if(!y.length)throw m.business("No files to deploy");for(let w of y)if(!w.md5)throw m.file(`MD5 checksum missing for file: ${w.path}`,{filePath:w.path});me(l.password);let f=fe(l.ttl),E=ve(l.idempotencyKey),d=F(l.labels);await nt(y);let T=Xe(l.buildCommand),L=qe(l.outputDir),U=l.build||l.prerender||l.spa?{build:l.build,prerender:l.prerender,spa:l.spa,buildCommand:T,outputDir:L}:void 0,oe=await We(y,{labels:d,via:l.via??mn,password:l.password,ttl:f,flags:U,captcha:l.captcha});return p.request(p.deploy.endpoint,{method:"POST",body:oe,...E?{headers:{[C.HEADER]:E}}:{},signal:l.signal||null},"Deploy",l.build||l.prerender?p.deploy.buildTimeout:p.deploy.timeout)},list:async i=>t().request(`${A.DEPLOYMENTS}${he(i)}`,{method:"GET"},"List deployments"),get:async i=>t().request(A.DEPLOYMENT(encodeURIComponent(i)),{method:"GET"},"Get deployment"),set:async(i,l)=>t().request(A.DEPLOYMENT(encodeURIComponent(i)),{method:"PATCH",headers:ee,body:JSON.stringify({labels:F(l.labels)})},"Update deployment labels"),delete:async i=>t().request(A.DEPLOYMENT(encodeURIComponent(i)),{method:"DELETE"},"Delete deployment")}}function ot(e){let{getApi:t}=e;return{set:async(n,i={})=>{let l=F(i.labels),p={};i.deployment&&(p.deployment=i.deployment),l!==void 0&&(p.labels=l);let{data:h,status:y}=await t().requestWithStatus(A.DOMAIN(encodeURIComponent(n)),{method:"PUT",headers:ee,body:JSON.stringify(p)},"Set domain");return{...h,isCreate:y===201}},list:async n=>t().request(`${A.DOMAINS}${he(n)}`,{method:"GET"},"List domains"),get:async n=>t().request(A.DOMAIN(encodeURIComponent(n)),{method:"GET"},"Get domain"),delete:async n=>t().request(A.DOMAIN(encodeURIComponent(n)),{method:"DELETE"},"Delete domain"),verify:async n=>t().request(A.DOMAIN_VERIFY(encodeURIComponent(n)),{method:"POST"},"Verify domain"),validate:async n=>t().request(A.DOMAINS_VALIDATE,{method:"POST",headers:ee,body:JSON.stringify({domain:n})},"Validate domain"),dns:async n=>t().request(A.DOMAIN_DNS(encodeURIComponent(n)),{method:"GET"},"Get domain DNS"),records:async n=>t().request(A.DOMAIN_RECORDS(encodeURIComponent(n)),{method:"GET"},"Get domain records"),share:async n=>t().request(A.DOMAIN_SHARE(encodeURIComponent(n)),{method:"GET"},"Get domain share")}}function it(e){let{getApi:t}=e;return{get:async()=>t().request(A.ACCOUNT,{method:"GET"},"Get account")}}function st(e){let{getApi:t}=e;return{create:async(n={})=>{let i=fe(n.ttl),l=F(n.labels),p={};return i!==void 0&&(p.ttl=i),l!==void 0&&(p.labels=l),t().request(A.TOKENS,{method:"POST",headers:ee,body:JSON.stringify(p)},"Create token")},list:async n=>t().request(`${A.TOKENS}${he(n)}`,{method:"GET"},"List tokens"),get:async n=>t().request(A.TOKEN(encodeURIComponent(n)),{method:"GET"},"Get token"),delete:async n=>t().request(A.TOKEN(encodeURIComponent(n)),{method:"DELETE"},"Delete token")}}var te=class{constructor(t={}){this.credential=null;if(t={...t,apiUrl:t.apiUrl||void 0,token:t.token||void 0,caller:t.caller||void 0},this.clientOptions=t,t.caller!==void 0&&Ke(t.caller),t.token&&t.session)throw m.config("Provide either `token` or `session`, not both.");typeof t.token=="string"?(pe(t.token),this.credential=t.token):t.token&&(this.credential=t.token),this.http=new W({...t,getAuthHeaders:()=>this.getAuthHeaders()});let n={getApi:()=>this.http};this.deployments=rt({...n,processInput:async(i,l)=>this.processInput(i,l,await this.getLimits({signal:l.signal}))}),this.domains=ot(n),this.account=it(n),this.tokens=st(n)}async ping(){return this.http.request(A.PING,{method:"GET"},"Ping")}async deploy(t,n){return this.deployments.upload(t,n)}async whoami(){return this.account.get()}async getLimits(t={}){return this.http.request(A.LIMITS,{method:"GET",signal:t.signal??null},"Get limits")}on(t,n){this.http.on(t,n)}off(t,n){this.http.off(t,n)}setHeaders(t){this.http.setGlobalHeaders(t)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(t){if(this.clientOptions.session)throw m.config("Provide either `token` or `session`, not both.");if(typeof t=="string"){if(!t)throw m.business("Invalid token provided. Token must be a non-empty string.");pe(t),this.credential=t;return}if(typeof t!="function")throw m.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=t}async getAuthHeaders(){if(this.credential===null)return{};let t=typeof this.credential=="function"?await this.credential():this.credential;if(!t)throw m.authentication("Token provider returned no token.");if(typeof t!="string")throw m.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${t}`}}};S();S();ge();Te();be();Re();Z();Ie();function eo(e,t,n,i=!0){let l=e===1?t:n;return i?`${e} ${l}`:l}_e();var Le=class extends te{async deploy(t,n){return super.deploy(t,n)}async processInput(t,n,i){if(!Array.isArray(t)||!t.every(p=>p instanceof File))throw m.business("Invalid input type for browser environment. Expected File[].");if(t.length===0)throw m.business("No files to deploy.");let{processFilesForBrowser:l}=await Promise.resolve().then(()=>(_e(),Tt));return l(t,n,i)}},Lo=Le;export{$n as ACCOUNT_HEADER,Be as API_KEY,A as API_PATHS,Un as AUTH_BASE_PATH,xn as AccountPlan,Pn as AccountRefusal,W as ApiHttp,se as AuthMethod,B as BUILD_SETTINGS,$ as CALLER,de as DEFAULT_API,x as DEPLOYMENT_CONFIG_FILENAME,I as DEPLOY_FIELDS,Fn as DEPLOY_FILE_GRAMMAR,He as DEPLOY_TOKEN,Rn as DeploymentStatus,Nt as DeploymentVia,In as DomainStatus,_n as DomainVerification,g as ErrorType,b as FILE_VALIDATION_STATUS,b as FileValidationStatus,C as IDEMPOTENCY_KEY_CONSTRAINTS,Dn as JUNK_DIRECTORIES,v as LABEL_CONSTRAINTS,Qt as LABEL_PATTERN,Yn as MY_API_KEY_URL,Ge as OAUTH_TOKEN,Hn as OAuthScope,V as PASSWORD_CONSTRAINTS,Wn as PUBLIC_DEPLOYMENT_TTL_SECONDS,zt as SECTIONS,Ln as SETUP_TROUBLESHOOTING_ANCHOR,Xn as SHIP_ENV,qn as SHIP_VIA_ENV,X as SPA_CHECK_CONSTRAINTS,ke as SPA_DEFAULT_CONFIG,Le as Ship,m as ShipError,K as TTL_CONSTRAINTS,P as TokenKind,$t as UNBUILT_PROJECT_MARKERS,Ut as UNSAFE_FILENAME_CHARS,we as USAGE_KIND,Qn as USER_VISIBLE_EVENTS,Mn as WEB_FILE_ACCEPT,Mr as __setTestEnvironment,Vn as accountOfPath,Kr as allValidFilesReady,ze as assertShipJsonSyntax,Kn as billingReturnOf,Q as calculateMD5,Bt as classifyToken,jt as consolePaths,wt as countPhrase,it as createAccountResource,rt as createDeploymentResource,ot as createDomainResource,st as createTokenResource,Lo as default,or as deserializeLabels,qt as doorOf,zn as doors,jn as errandOf,wn as excessOver,er as extractSubdomain,ft as filterJunk,On as fitPhrase,Jt as formatDuration,H as formatFileSize,Jn as formatTimeRemaining,tr as generateDeploymentUrl,nr as generateDomainUrl,ut as getENV,En as getValidFiles,j as hasUnbuiltMarker,$e as hasUnsafeChars,Ue as isBlockedExtension,Yt as isClaimPath,Zn as isCustomDomain,kn as isDeployment,je as isPlatformDomain,Me as isShipError,Wt as isUpgradePath,Nn as normalizeVia,lt as optimizeDeployPaths,vn as personName,Cn as personShortName,xt as placesTaken,eo as pluralize,Et as processFilesForBrowser,Bn as readBearerValue,rr as serializeLabels,Ht as validateApiKey,Gn as validateApiUrl,Xe as validateBuildCommand,Ke as validateCaller,ht as validateDeployCount,mt as validateDeployFile,dt as validateDeployPath,Gt as validateDeployToken,De as validateFileName,zr as validateFiles,ve as validateIdempotencyKey,Zt as validateLabel,F as validateLabels,kt as validateOAuthToken,qe as validateOutputDir,me as validatePassword,pe as validateToken,fe as validateTtl};
|
|
1
|
+
var wt=Object.create;var k=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var vt=Object.getPrototypeOf,Ct=Object.prototype.hasOwnProperty;var Mt=(e,t,n)=>t in e?k(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var L=(e,t)=>()=>(e&&(t=e(e=0)),t);var Fe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ut=(e,t)=>{for(var n in t)k(e,n,{get:t[n],enumerable:!0})},$t=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of Ft(t))!Ct.call(e,l)&&l!==n&&k(e,l,{get:()=>t[l],enumerable:!(s=Pt(t,l))||s.enumerable});return e};var z=(e,t,n)=>(n=e!=null?wt(vt(e)):{},$t(t||!e||!e.__esModule?k(n,"default",{value:e,enumerable:!0}):n,e));var V=(e,t,n)=>Mt(e,typeof t!="symbol"?t+"":t,n);function Vn(e){if(!e||typeof e!="string")return;let t=e.trim().toLowerCase();return Object.values(Bt).includes(t)?t:void 0}function $e(e){if(e==null)return;if(typeof e!="string")throw d.validation("Idempotency key must be a string.");let t=e.trim();if(!t)throw d.validation("Idempotency key must not be empty.");if(t.length>X.MAX_LENGTH)throw d.validation(`Idempotency key must be at most ${X.MAX_LENGTH} characters.`);return t}function Ht(e){return e.members+e.invitations}function Kn(e,t){let n=Math.max(0,Ht(e)-t.members),s=Math.max(0,e.members-t.members),l={members:s,invitations:n-s,customDomains:e.customDomains-t.customDomains,platformDomains:e.platformDomains-t.platformDomains};return Object.fromEntries(Object.entries(l).filter(([,p])=>p>0))}function Gt(e){return He(["members","customDomains","platformDomains"].filter(t=>(e[t]??0)>0).map(t=>Be(t,e[t]??0)))}function Xn(e){let t=Gt(e),n=e.invitations??0;return He([...t?[`remove ${t}`]:[],...n>0?[`cancel ${Be("invitations",n)}`]:[]])}function qn(e){return e.name?.trim()||e.email}function Wn(e){return e.name?.trim().split(" ")[0]||e.email}function jt(e){let t=e.code;return t==="ERR_INVALID_URL"?!1:typeof t=="string"?!0:e instanceof TypeError?!/\burl\b/i.test(e.message):!1}function Ge(e){return e!==null&&typeof e=="object"&&"name"in e&&e.name==="ShipError"&&"status"in e}function Kt(e){let t=e.replace(/\\/g,"/").split("/").pop()??"",n=t.lastIndexOf(".");return n<=0||n===t.length-1?null:t.slice(n+1).toLowerCase()}function ke(e,t){let n=Kt(e);return n===null?!1:Array.isArray(t)?t.includes(n):t.has(n)}function ze(e){return Yt.test(e)}function q(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>qt.has(n))}function Wt(e){return e.startsWith(Ve.PREFIX)?w.API_KEY:e.startsWith(je.PREFIX)?w.DEPLOY_TOKEN:e.startsWith(Ke.PREFIX)?w.OAUTH:w.OPAQUE}function tr(e){return e.slice(0,ue.length).toLowerCase()!==ue?null:e.slice(ue.length)||null}function Ye(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,n;try{n=JSON.parse(t)}catch(s){throw d.config(`invalid JSON format in config: ${s.message}`,{filePath:N})}if(n===null||typeof n!="object"||Array.isArray(n))throw d.config(`${N} must contain a JSON object`,{filePath:N})}function pe(e,t,n){if(!e.startsWith(t.PREFIX))throw d.validation(`${n} must start with "${t.PREFIX}"`);if(e.length!==t.TOTAL_LENGTH)throw d.validation(`${n} must be ${t.TOTAL_LENGTH} characters total (${t.PREFIX} + ${t.HEX_LENGTH} hex chars)`);let s=e.slice(t.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${t.HEX_LENGTH}}$`,"i").test(s))throw d.validation(`${n} must contain ${t.HEX_LENGTH} hexadecimal characters after "${t.PREFIX}" prefix`)}function Jt(e){pe(e,Ve,"API key")}function Qt(e){pe(e,je,"Deploy token")}function Zt(e){pe(e,Ke,"OAuth access token")}function fe(e){switch(Wt(e)){case w.API_KEY:Jt(e);return;case w.DEPLOY_TOKEN:Qt(e);return;case w.OAUTH:Zt(e);return;case w.OPAQUE:if(!e)throw d.validation("Token must be a non-empty string")}}function qe(e){if(!e||e.length>B.MAX_LENGTH||!B.PATTERN.test(e))throw d.validation(`Caller must be 1-${B.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function rr(e){try{let t=new URL(e);if(!["http:","https:"].includes(t.protocol))throw d.validation("API URL must use http:// or https:// protocol");if(t.pathname!=="/"&&t.pathname!=="")throw d.validation("API URL must not contain a path");if(t.search||t.hash)throw d.validation("API URL must not contain query parameters or fragments")}catch(t){throw Ge(t)?t:d.validation("API URL must be a valid URL")}}function or(e){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(e)}function de(e){if(e!=null){if(typeof e!="number"||!Number.isFinite(e))throw d.validation("TTL must be a number of seconds");if(!Number.isInteger(e))throw d.validation("TTL must be a whole number of seconds");if(e<j.MIN_SECONDS||e>j.MAX_SECONDS)throw d.validation(`TTL must be between ${j.MIN_SECONDS} and ${j.MAX_SECONDS} seconds`);return e}}function rn(e){let t=e?`/${e}`:"",n=s=>`${t}${s}`;return{dashboard:()=>t||"/",newSite:()=>n("/new"),deployments:Object.assign(()=>n("/deployments"),{upload:()=>n("/deployments/upload")}),domains:Object.assign(()=>n("/domains"),{connect:s=>n(`/domains/${s}/connect`),deployment:s=>n(`/domains/${s}/deployment`)}),settings:s=>n(s?`/settings#${s}`:"/settings"),claim:s=>n(`/claim/${s}`),settingsAfterBilling:()=>n(`/settings?${Ce("portal")}`),upgrade:s=>n(s?`/upgrade/${s}`:"/upgrade"),success:()=>n("/success"),successAfterCheckout:()=>n(`/success?${Ce("checkout")}`),apiKey:()=>n("/api-key")}}function sr(e){let t=new URLSearchParams(e);for(let[n,[s,l]]of Object.entries(We))if(t.get(s)===l)return n;return null}function J(e){let t=e.split(/[?#]/)[0].toLowerCase(),[n="",s=""]=t.split("/").filter(Boolean);return sn(n)?{kind:"door",door:n}:n===nn?{kind:"admin"}:n===""||Me(n)?{kind:"account",account:null,section:n===""?null:n}:{kind:"account",account:n,section:Me(s)?s:null}}function ar(e){let t=J(e);return t.kind==="account"?t.account:null}function an(e){let t=J(e);return t.kind==="door"?t.door:null}function lr(e){return ln(e)?"claim":an(e)==="invitation"?"invite":un(e)?"upgrade":null}function cn(e){let t=Math.round(e/60);if(!(t>=1))return"less than a minute";if(t<120)return ce(t,"minute");let n=Math.round(e/3600);return n<48?ce(n,"hour"):ce(Math.round(e/86400),"day")}function dr(e,t=Date.now()/1e3){let n=e-t;return n>0?cn(n):null}function ce(e,t){return`${e} ${t}${e===1?"":"s"}`}function F(e,t=1){if(e===0)return"0 Bytes";let n=1024,s=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**l).toFixed(t))} ${s[l]}`}function Je(e,t){return e.endsWith(`.${t}`)}function hr(e,t){return!Je(e,t)}function yr(e,t){return Je(e,t)?e.slice(0,-(t.length+1)):null}function gr(e){return`https://${e}`}function Er(e){return`https://${e}`}function fn(e){if(typeof e!="string")throw d.validation("Labels must be strings");let t=e.trim().toLowerCase();if(t.length<M.MIN_LENGTH)throw d.validation(`Labels must be at least ${M.MIN_LENGTH} characters long`);if(t.length>M.MAX_LENGTH)throw d.validation(`Labels must be no more than ${M.MAX_LENGTH} characters long`);if(!pn.test(t))throw d.validation("Labels use letters and numbers, with . _ or - between them, and can have one : between a key and a value, like env:production");return t}function U(e){if(e==null)return;if(!Array.isArray(e))throw d.validation("Labels must be an array");if(e.length>M.MAX_COUNT)throw d.validation(`Maximum ${M.MAX_COUNT} labels allowed`);let t=e.map(fn);if(new Set(t).size!==t.length)throw d.validation("Duplicate labels are not allowed");return t}function Tr(e){return!e||e.length===0?null:JSON.stringify(e)}function Ar(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Qe(e){if(e==null||e==="")return;if(typeof e!="string")throw d.validation("Build command must be a string");let t=e.trim();if(t.length===0||t.length>H.COMMAND_MAX_LENGTH)throw d.validation(`Build command must be between 1 and ${H.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(t))throw d.validation("Build command must be a single line");return t}function Ze(e){if(e==null||e==="")return;if(typeof e!="string")throw d.validation("Output folder must be a string");let t=e.trim().replace(/\/+$/,"");if(t.length===0||t.length>H.OUTPUT_DIR_MAX_LENGTH)throw d.validation(`Output folder must be between 1 and ${H.OUTPUT_DIR_MAX_LENGTH} characters`);if(!H.OUTPUT_DIR_PATTERN.test(t)||t.split("/").some(n=>n===".."||n==="."))throw d.validation("Output folder must be a relative path inside the project, like dist or dist/site");return t}function he(e){if(e==null)return;if(typeof e!="string")throw d.validation("Password must be a string");let t=e.trim();if(t.length<K.MIN_LENGTH||t.length>K.MAX_LENGTH)throw d.validation(`Password must be between ${K.MIN_LENGTH} and ${K.MAX_LENGTH} characters`);return t}var Hn,Bt,Gn,kn,zn,X,Ue,jn,ve,Be,He,Yn,S,_,Jn,g,kt,ae,zt,Vt,d,Xt,Qn,Yt,qt,Zn,le,Ve,je,Ke,B,er,w,ue,nr,N,Xe,W,j,en,tn,nn,We,Ce,Y,on,ir,sn,Me,ln,un,me,ur,cr,pr,fr,mr,R,M,pn,H,K,D=L(()=>{"use strict";Hn={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},Bt={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc",CLD:"cld",CRS:"crs",GMN:"gmn",API:"api"},Gn={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},kn={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},zn="troubleshooting",X={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60},Ue={MAX_BYTES:64*1024*1024,PART_OVERHEAD:256};jn={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"};ve={deployments:{one:"deployment",many:"deployments"},platformDomains:{one:"ShipStatic domain",many:"ShipStatic domains"},customDomains:{one:"custom domain",many:"custom domains"},members:{one:"member",many:"members"},invitations:{one:"invitation",many:"invitations"}};Be=(e,t)=>`${t} ${t===1?ve[e].one:ve[e].many}`,He=e=>e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e[0]??"",Yn={PAUSED:"paused",UNKNOWN:"unknown"};S={DEPLOYMENTS:"/deployments",DEPLOYMENT:e=>`/deployments/${e}`,DEPLOYMENT_CONFIG:e=>`/deployments/${e}/config`,DEPLOYMENT_FILES:e=>`/deployments/${e}/files`,DOMAINS:"/domains",DOMAIN:e=>`/domains/${e}`,DOMAIN_VERIFY:e=>`/domains/${e}/verify`,DOMAIN_DNS:e=>`/domains/${e}/dns`,DOMAIN_RECORDS:e=>`/domains/${e}/records`,DOMAIN_SHARE:e=>`/domains/${e}/share`,DOMAIN_PROPAGATION:e=>`/domains/${e}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:e=>`/tokens/${e}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PLANS:"/plans",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},_={FILES:"files[]",MANIFEST:"manifest",LABELS:"labels",VIA:"via",PASSWORD:"password",TTL:"ttl",BUILD:"build",PRERENDER:"prerender",SPA:"spa",BUILD_COMMAND:"buildCommand",OUTPUT_DIR:"outputDir",CAPTCHA:"captcha"},Jn={PATH:"path",CONTENT:"content",ENCODING:"encoding",DEFAULT_ENCODING:"utf-8",ENCODINGS:["utf-8","base64"]},g={Validation:"validation_failed",NotFound:"not_found",Forbidden:"forbidden",RateLimit:"rate_limit_exceeded",Authentication:"authentication_failed",Business:"business_logic_error",Api:"internal_server_error",Maintenance:"maintenance",Build:"build_failed",Network:"network_error",Timeout:"timeout_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},kt=new Set([g.Network,g.Timeout,g.Cancelled,g.File,g.Config]),ae={client:new Set([g.Build,g.Business,g.Cancelled,g.Config,g.File,g.Forbidden,g.NotFound,g.RateLimit,g.Validation]),network:new Set([g.Network,g.Timeout]),auth:new Set([g.Authentication])},zt=new Set(Object.values(g).filter(e=>!kt.has(e))),Vt=200;d=class e extends Error{constructor(n,s,l,p){super(s);V(this,"type");V(this,"status");V(this,"details");this.type=n,this.status=l,this.details=p,this.name="ShipError"}toResponse(){let n=this.details,s=this.type===g.Authentication&&n?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:s}}static async fromHttpResponse(n,s){let l,p,m;try{if(n.headers.get("content-type")?.includes("application/json")){let h=await n.json();if(h&&typeof h=="object"){let E=h;typeof E.message=="string"?l=E.message:typeof E.error=="string"&&(l=E.error),p=E.details,typeof E.error=="string"&&zt.has(E.error)&&(m=E.error)}}else{let h=(await n.text()).trim();h&&!h.startsWith("<")&&h.length<=Vt&&(l=h)}}catch{}let y=n.headers.get("retry-after");if(y!==null){let A=y.trim(),h=/^\d+$/.test(A)?Number(A):Math.ceil((Date.parse(A)-Date.now())/1e3);if(Number.isFinite(h)&&h>=0){let E=p&&typeof p=="object"?p:{};E.retryAfter===void 0&&(p={...E,retryAfter:h})}}l=l||`${s||"Request"} failed with status ${n.status}`;let f=m??(n.status===401?g.Authentication:n.status===403?g.Forbidden:n.status===429?g.RateLimit:g.Api);return new e(f,l,n.status,p)}static fromFetchError(n,s){if(Ge(n))return n;let l=s||"Request",p=n?.name;return p==="AbortError"?e.cancelled(`${l} was cancelled`):p==="TimeoutError"?e.timeout(`${l} timed out`,{cause:n}):n instanceof Error?jt(n)?e.network(`${l} failed: ${n.message}`,{cause:n}):new e(g.Api,`${l} failed: ${n.message}`):new e(g.Api,`${l} failed: Unknown error`)}static validation(n,s){return new e(g.Validation,n,400,s)}static notFound(n,s){let l=s?`${n} ${s} not found`:`${n} not found`;return new e(g.NotFound,l,404)}static forbidden(n,s){return new e(g.Forbidden,n,403,s)}static rateLimit(n="Too many requests",s){return new e(g.RateLimit,n,429,s)}static authentication(n="Authentication required",s){return new e(g.Authentication,n,401,s)}static business(n,s=400,l){return new e(g.Business,n,s,l)}static network(n,s){return new e(g.Network,n,void 0,s)}static timeout(n,s){return new e(g.Timeout,n,void 0,s)}static cancelled(n,s){return new e(g.Cancelled,n,void 0,s)}static file(n,s){return new e(g.File,n,void 0,s)}static config(n,s){return new e(g.Config,n,void 0,s)}static api(n,s=500,l){return new e(g.Api,n,s,l)}static maintenance(n,s){return new e(g.Maintenance,n,503,s)}static build(n,s){return new e(g.Build,n,422,s)}isClientError(){return ae.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return ae.network.has(this.type)}isAuthError(){return ae.auth.has(this.type)}isType(n){return this.type===n}};Xt=["html","htm","xhtml","xml","txt","md","markdown","pdf","csv","json","jsonc","webmanifest","map","toml","yaml","yml","rss","atom","css","scss","sass","less","js","mjs","cjs","jsx","ts","tsx","wasm","vue","svelte","png","jpg","jpeg","gif","webp","avif","svg","ico","bmp","tif","tiff","heic","heif","woff","woff2","ttf","otf","eot","mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","mp4","webm","ogv","mov","m4v","avi","glb","gltf","usdz","vtt","srt","zip"],Qn=Xt.map(e=>`.${e}`).join(","),Yt=/[\x00-\x1f\x7f#?%\\<>"]/;qt=new Set(["node_modules","package.json"]);Zn="/auth",le={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",SYSTEM:"system"},Ve={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},je={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},Ke={PREFIX:"oauth-",HEX_LENGTH:32,TOTAL_LENGTH:38},B={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},er="X-Account",w={API_KEY:le.API_KEY,DEPLOY_TOKEN:le.TOKEN,OAUTH:le.OAUTH,OPAQUE:"opaque"};ue="bearer ";nr={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},N="ship.json",Xe={rewrites:[{source:"/(.*)",destination:"/index.html"}]},W={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};j={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};en={new:{owner:!1},deployments:{owner:!1},domains:{owner:!1},settings:{owner:!1},claim:{owner:!1},upgrade:{owner:!0},success:{owner:!0},"api-key":{owner:!0}},tn=["login","register","logout","invitation","consent"],nn="admin",We={checkout:["upgrading","true"],portal:["billing","returned"]},Ce=e=>We[e].join("="),Y=(e,t)=>t?`${e}?next=${encodeURIComponent(t)}`:e;on=Object.assign(({next:e}={})=>Y("/login",e),{link:({token:e,next:t})=>Y(`/login/link/${e}`,t)}),ir={login:on,register:({next:e}={})=>Y("/register",e),logout:({next:e}={})=>Y("/logout",e),invitation:e=>`/invitation/${e}`,consent:()=>"/consent"};sn=e=>tn.includes(e),Me=e=>Object.hasOwn(en,e);ln=e=>{let t=J(e);return t.kind==="account"&&t.section==="claim"},un=e=>{let t=J(e);return t.kind==="account"&&t.section==="upgrade"};me="https://api.shipstatic.com",ur={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},cr="SHIP_VIA",pr=`https://my.shipstatic.com${rn().apiKey()}`,fr=4320*60;mr=["account.create","account.update","account.delete","account.key.generate","account.plan.transition","deployment.create","deployment.update","deployment.delete","deployment.claim","domain.create","domain.update","domain.delete","domain.verify","token.create","token.consume","token.delete","member.join","member.leave","consent.grant"],R={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};M={MIN_LENGTH:3,MAX_LENGTH:63,MAX_COUNT:10},pn=/^[a-z0-9]+(?:[._-][a-z0-9]+)*(?::[a-z0-9]+(?:[._-][a-z0-9]+)*)?$/;H={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};K={MIN_LENGTH:6,MAX_LENGTH:128}});var ct=Fe((lt,ut)=>{"use strict";(function(e){if(typeof lt=="object")ut.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t;try{t=window}catch{t=self}t.SparkMD5=e()}})(function(e){"use strict";var t=function(c,u){return c+u&4294967295},n=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(c,u,o,r,a,i){return u=t(t(u,c),t(r,i)),t(u<<a|u>>>32-a,o)}function l(c,u){var o=c[0],r=c[1],a=c[2],i=c[3];o+=(r&a|~r&i)+u[0]-680876936|0,o=(o<<7|o>>>25)+r|0,i+=(o&r|~o&a)+u[1]-389564586|0,i=(i<<12|i>>>20)+o|0,a+=(i&o|~i&r)+u[2]+606105819|0,a=(a<<17|a>>>15)+i|0,r+=(a&i|~a&o)+u[3]-1044525330|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&i)+u[4]-176418897|0,o=(o<<7|o>>>25)+r|0,i+=(o&r|~o&a)+u[5]+1200080426|0,i=(i<<12|i>>>20)+o|0,a+=(i&o|~i&r)+u[6]-1473231341|0,a=(a<<17|a>>>15)+i|0,r+=(a&i|~a&o)+u[7]-45705983|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&i)+u[8]+1770035416|0,o=(o<<7|o>>>25)+r|0,i+=(o&r|~o&a)+u[9]-1958414417|0,i=(i<<12|i>>>20)+o|0,a+=(i&o|~i&r)+u[10]-42063|0,a=(a<<17|a>>>15)+i|0,r+=(a&i|~a&o)+u[11]-1990404162|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&i)+u[12]+1804603682|0,o=(o<<7|o>>>25)+r|0,i+=(o&r|~o&a)+u[13]-40341101|0,i=(i<<12|i>>>20)+o|0,a+=(i&o|~i&r)+u[14]-1502002290|0,a=(a<<17|a>>>15)+i|0,r+=(a&i|~a&o)+u[15]+1236535329|0,r=(r<<22|r>>>10)+a|0,o+=(r&i|a&~i)+u[1]-165796510|0,o=(o<<5|o>>>27)+r|0,i+=(o&a|r&~a)+u[6]-1069501632|0,i=(i<<9|i>>>23)+o|0,a+=(i&r|o&~r)+u[11]+643717713|0,a=(a<<14|a>>>18)+i|0,r+=(a&o|i&~o)+u[0]-373897302|0,r=(r<<20|r>>>12)+a|0,o+=(r&i|a&~i)+u[5]-701558691|0,o=(o<<5|o>>>27)+r|0,i+=(o&a|r&~a)+u[10]+38016083|0,i=(i<<9|i>>>23)+o|0,a+=(i&r|o&~r)+u[15]-660478335|0,a=(a<<14|a>>>18)+i|0,r+=(a&o|i&~o)+u[4]-405537848|0,r=(r<<20|r>>>12)+a|0,o+=(r&i|a&~i)+u[9]+568446438|0,o=(o<<5|o>>>27)+r|0,i+=(o&a|r&~a)+u[14]-1019803690|0,i=(i<<9|i>>>23)+o|0,a+=(i&r|o&~r)+u[3]-187363961|0,a=(a<<14|a>>>18)+i|0,r+=(a&o|i&~o)+u[8]+1163531501|0,r=(r<<20|r>>>12)+a|0,o+=(r&i|a&~i)+u[13]-1444681467|0,o=(o<<5|o>>>27)+r|0,i+=(o&a|r&~a)+u[2]-51403784|0,i=(i<<9|i>>>23)+o|0,a+=(i&r|o&~r)+u[7]+1735328473|0,a=(a<<14|a>>>18)+i|0,r+=(a&o|i&~o)+u[12]-1926607734|0,r=(r<<20|r>>>12)+a|0,o+=(r^a^i)+u[5]-378558|0,o=(o<<4|o>>>28)+r|0,i+=(o^r^a)+u[8]-2022574463|0,i=(i<<11|i>>>21)+o|0,a+=(i^o^r)+u[11]+1839030562|0,a=(a<<16|a>>>16)+i|0,r+=(a^i^o)+u[14]-35309556|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^i)+u[1]-1530992060|0,o=(o<<4|o>>>28)+r|0,i+=(o^r^a)+u[4]+1272893353|0,i=(i<<11|i>>>21)+o|0,a+=(i^o^r)+u[7]-155497632|0,a=(a<<16|a>>>16)+i|0,r+=(a^i^o)+u[10]-1094730640|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^i)+u[13]+681279174|0,o=(o<<4|o>>>28)+r|0,i+=(o^r^a)+u[0]-358537222|0,i=(i<<11|i>>>21)+o|0,a+=(i^o^r)+u[3]-722521979|0,a=(a<<16|a>>>16)+i|0,r+=(a^i^o)+u[6]+76029189|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^i)+u[9]-640364487|0,o=(o<<4|o>>>28)+r|0,i+=(o^r^a)+u[12]-421815835|0,i=(i<<11|i>>>21)+o|0,a+=(i^o^r)+u[15]+530742520|0,a=(a<<16|a>>>16)+i|0,r+=(a^i^o)+u[2]-995338651|0,r=(r<<23|r>>>9)+a|0,o+=(a^(r|~i))+u[0]-198630844|0,o=(o<<6|o>>>26)+r|0,i+=(r^(o|~a))+u[7]+1126891415|0,i=(i<<10|i>>>22)+o|0,a+=(o^(i|~r))+u[14]-1416354905|0,a=(a<<15|a>>>17)+i|0,r+=(i^(a|~o))+u[5]-57434055|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~i))+u[12]+1700485571|0,o=(o<<6|o>>>26)+r|0,i+=(r^(o|~a))+u[3]-1894986606|0,i=(i<<10|i>>>22)+o|0,a+=(o^(i|~r))+u[10]-1051523|0,a=(a<<15|a>>>17)+i|0,r+=(i^(a|~o))+u[1]-2054922799|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~i))+u[8]+1873313359|0,o=(o<<6|o>>>26)+r|0,i+=(r^(o|~a))+u[15]-30611744|0,i=(i<<10|i>>>22)+o|0,a+=(o^(i|~r))+u[6]-1560198380|0,a=(a<<15|a>>>17)+i|0,r+=(i^(a|~o))+u[13]+1309151649|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~i))+u[4]-145523070|0,o=(o<<6|o>>>26)+r|0,i+=(r^(o|~a))+u[11]-1120210379|0,i=(i<<10|i>>>22)+o|0,a+=(o^(i|~r))+u[2]+718787259|0,a=(a<<15|a>>>17)+i|0,r+=(i^(a|~o))+u[9]-343485551|0,r=(r<<21|r>>>11)+a|0,c[0]=o+c[0]|0,c[1]=r+c[1]|0,c[2]=a+c[2]|0,c[3]=i+c[3]|0}function p(c){var u=[],o;for(o=0;o<64;o+=4)u[o>>2]=c.charCodeAt(o)+(c.charCodeAt(o+1)<<8)+(c.charCodeAt(o+2)<<16)+(c.charCodeAt(o+3)<<24);return u}function m(c){var u=[],o;for(o=0;o<64;o+=4)u[o>>2]=c[o]+(c[o+1]<<8)+(c[o+2]<<16)+(c[o+3]<<24);return u}function y(c){var u=c.length,o=[1732584193,-271733879,-1732584194,271733878],r,a,i,I,x,O;for(r=64;r<=u;r+=64)l(o,p(c.substring(r-64,r)));for(c=c.substring(r-64),a=c.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)i[r>>2]|=c.charCodeAt(r)<<(r%4<<3);if(i[r>>2]|=128<<(r%4<<3),r>55)for(l(o,i),r=0;r<16;r+=1)i[r]=0;return I=u*8,I=I.toString(16).match(/(.*?)(.{0,8})$/),x=parseInt(I[2],16),O=parseInt(I[1],16)||0,i[14]=x,i[15]=O,l(o,i),o}function f(c){var u=c.length,o=[1732584193,-271733879,-1732584194,271733878],r,a,i,I,x,O;for(r=64;r<=u;r+=64)l(o,m(c.subarray(r-64,r)));for(c=r-64<u?c.subarray(r-64):new Uint8Array(0),a=c.length,i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)i[r>>2]|=c[r]<<(r%4<<3);if(i[r>>2]|=128<<(r%4<<3),r>55)for(l(o,i),r=0;r<16;r+=1)i[r]=0;return I=u*8,I=I.toString(16).match(/(.*?)(.{0,8})$/),x=parseInt(I[2],16),O=parseInt(I[1],16)||0,i[14]=x,i[15]=O,l(o,i),o}function A(c){var u="",o;for(o=0;o<4;o+=1)u+=n[c>>o*8+4&15]+n[c>>o*8&15];return u}function h(c){var u;for(u=0;u<c.length;u+=1)c[u]=A(c[u]);return c.join("")}h(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(t=function(c,u){var o=(c&65535)+(u&65535),r=(c>>16)+(u>>16)+(o>>16);return r<<16|o&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function c(u,o){return u=u|0||0,u<0?Math.max(u+o,0):Math.min(u,o)}ArrayBuffer.prototype.slice=function(u,o){var r=this.byteLength,a=c(u,r),i=r,I,x,O,Pe;return o!==e&&(i=c(o,r)),a>i?new ArrayBuffer(0):(I=i-a,x=new ArrayBuffer(I),O=new Uint8Array(x),Pe=new Uint8Array(this,a,I),O.set(Pe),x)}})();function E(c){return/[\u0080-\uFFFF]/.test(c)&&(c=unescape(encodeURIComponent(c))),c}function b(c,u){var o=c.length,r=new ArrayBuffer(o),a=new Uint8Array(r),i;for(i=0;i<o;i+=1)a[i]=c.charCodeAt(i);return u?a:r}function v(c){return String.fromCharCode.apply(null,new Uint8Array(c))}function C(c,u,o){var r=new Uint8Array(c.byteLength+u.byteLength);return r.set(new Uint8Array(c)),r.set(new Uint8Array(u),c.byteLength),o?r:r.buffer}function P(c){var u=[],o=c.length,r;for(r=0;r<o-1;r+=2)u.push(parseInt(c.substr(r,2),16));return String.fromCharCode.apply(String,u)}function T(){this.reset()}return T.prototype.append=function(c){return this.appendBinary(E(c)),this},T.prototype.appendBinary=function(c){this._buff+=c,this._length+=c.length;var u=this._buff.length,o;for(o=64;o<=u;o+=64)l(this._hash,p(this._buff.substring(o-64,o)));return this._buff=this._buff.substring(o-64),this},T.prototype.end=function(c){var u=this._buff,o=u.length,r,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i;for(r=0;r<o;r+=1)a[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(a,o),i=h(this._hash),c&&(i=P(i)),this.reset(),i},T.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},T.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},T.prototype.setState=function(c){return this._buff=c.buff,this._length=c.length,this._hash=c.hash,this},T.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},T.prototype._finish=function(c,u){var o=u,r,a,i;if(c[o>>2]|=128<<(o%4<<3),o>55)for(l(this._hash,c),o=0;o<16;o+=1)c[o]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(r[2],16),i=parseInt(r[1],16)||0,c[14]=a,c[15]=i,l(this._hash,c)},T.hash=function(c,u){return T.hashBinary(E(c),u)},T.hashBinary=function(c,u){var o=y(c),r=h(o);return u?P(r):r},T.ArrayBuffer=function(){this.reset()},T.ArrayBuffer.prototype.append=function(c){var u=C(this._buff.buffer,c,!0),o=u.length,r;for(this._length+=c.byteLength,r=64;r<=o;r+=64)l(this._hash,m(u.subarray(r-64,r)));return this._buff=r-64<o?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},T.ArrayBuffer.prototype.end=function(c){var u=this._buff,o=u.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a,i;for(a=0;a<o;a+=1)r[a>>2]|=u[a]<<(a%4<<3);return this._finish(r,o),i=h(this._hash),c&&(i=P(i)),this.reset(),i},T.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},T.ArrayBuffer.prototype.getState=function(){var c=T.prototype.getState.call(this);return c.buff=v(c.buff),c},T.ArrayBuffer.prototype.setState=function(c){return c.buff=b(c.buff,!0),T.prototype.setState.call(this,c)},T.ArrayBuffer.prototype.destroy=T.prototype.destroy,T.ArrayBuffer.prototype._finish=T.prototype._finish,T.ArrayBuffer.hash=function(c,u){var o=f(new Uint8Array(c)),r=h(o);return u?P(r):r},T})});var ee=Fe((Pr,pt)=>{"use strict";pt.exports={}});async function In(e){let t=(await Promise.resolve().then(()=>z(ct(),1))).default,n=new t.ArrayBuffer,s=2097152;for(let l=0;l<e.size;l+=s){let p=Math.min(l+s,e.size);n.append(await e.slice(l,p).arrayBuffer())}return{md5:n.end()}}async function _n(e){let{createHash:t}=await Promise.resolve().then(()=>z(ee(),1)),n=t("md5");return n.update(e),{md5:n.digest("hex")}}async function Ln(e){let{createHash:t}=await Promise.resolve().then(()=>z(ee(),1)),{createReadStream:n}=await Promise.resolve().then(()=>z(ee(),1));return new Promise((s,l)=>{let p=t("md5"),m=n(e);m.on("error",y=>l(d.file(`Failed to read file for MD5: ${y.message}`,{filePath:e}))),m.on("data",y=>p.update(y)),m.on("end",()=>s({md5:p.digest("hex")}))})}async function te(e){if(e instanceof Blob)return In(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return _n(e);if(typeof e=="string")return Ln(e);throw d.business("Invalid input for MD5 calculation")}var ne=L(()=>{"use strict";D()});function ie(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var Et=L(()=>{"use strict"});function Tt(e,t={}){if(t.flatten===!1)return e.map(s=>({path:ie(s),name:Ae(s)}));let n=wn(e);return e.map(s=>{let l=ie(s);if(n){let p=n.endsWith("/")?n:`${n}/`;l.startsWith(p)&&(l=l.substring(p.length))}return l||(l=Ae(s)),{path:l,name:Ae(s)}})}function wn(e){if(!e.length)return"";let n=e.map(p=>ie(p)).map(p=>p.split("/")),s=[],l=Math.min(...n.map(p=>p.length));for(let p=0;p<l-1;p++){let m=n[0][p];if(n.every(y=>y[p]===m))s.push(m);else break}return s.join("/")}function Ae(e){return e.split(/[/\\]/).pop()||e}var Se=L(()=>{"use strict";Et()});function no(e){De=e}function Pn(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function At(){return De||Pn()}var De,be=L(()=>{"use strict";De=null});function Re(e,t,n){let s=t.suggestions?.[n];return s?`${e} ${s}`:e}function se(e,t){return Fn.find(n=>n.broken(e,t))}var Fn,$,_e=L(()=>{"use strict";D();Le();Fn=[{name:"name",broken:({path:e})=>!Ie(e).valid,sentence:({path:e})=>Ie(e).reason??`File name "${e}" is invalid.`},{name:"extension",broken:({path:e},t)=>ke(e,t.blockedExtensions??[]),sentence:({path:e})=>`File "${e}" has an extension that is not allowed.`},{name:"fileSize",broken:({size:e},t)=>e>t.maxFileSize,sentence:({path:e},t)=>Re(`File "${e}" is too large. Maximum ${F(t.maxFileSize)} allowed.`,t,"maxFileSize")},{name:"totalSize",broken:({totalSize:e},t)=>e>t.maxTotalSize,sentence:({totalSize:e},t)=>Re(`Files add up to ${F(e)}. Maximum ${F(t.maxTotalSize)} allowed.`,t,"maxTotalSize")}],$={name:"filesCount",broken:(e,t)=>e>t.maxFilesCount,sentence:(e,t)=>Re(`Too many files (${e}). Maximum ${t.maxFilesCount} files allowed.`,t,"maxFilesCount")}});function Ie(e){let t=l=>({valid:!1,reason:`File name "${e}" ${l}.`});if(ze(e))return t("contains unsafe characters");if(e.startsWith(" ")||e.endsWith(" "))return t("cannot start or end with spaces");if(e.endsWith("."))return t("cannot end with dots");let n=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,s=e.split("/").pop()||e;return n.test(s)?t("uses a reserved system name"):e.includes("..")?t("contains a path traversal pattern"):{valid:!0}}function uo(e,t){let n=[],s=[],l=[];if(e.length===0){let f={file:"(no files)",message:"At least one file must be provided."};return n.push(f),{files:[],validFiles:[],errors:n,warnings:[],canDeploy:!1}}for(let f of e)if(q(f.name))return n.push({file:f.name,message:"Unbuilt project detected. Deploy your build output (dist/, build/, out/), not the project folder."}),{files:e.map(A=>({...A,status:R.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:n,warnings:[],canDeploy:!1};if($.broken(e.length,t)){let f={file:`(${e.length} files)`,message:$.sentence(e.length,t)};return n.push(f),{files:e.map(A=>({...A,status:R.VALIDATION_FAILED,statusMessage:f.message})),validFiles:[],errors:n,warnings:[],canDeploy:!1}}let p=0;for(let f of e){let A=R.READY,h="Ready for upload";if(f.status===R.PROCESSING_ERROR)A=R.VALIDATION_FAILED,h=f.statusMessage||`File "${f.name}" could not be read.`,n.push({file:f.name,message:h});else if(f.size===0){A=R.EXCLUDED,h=`File "${f.name}" is empty, so it is excluded.`,s.push({file:f.name,message:h}),l.push({...f,status:A,statusMessage:h});continue}else if(f.size<0)A=R.VALIDATION_FAILED,h=`File "${f.name}" reports a negative size.`,n.push({file:f.name,message:h});else if(!f.name||f.name.trim().length===0)A=R.VALIDATION_FAILED,h="File name cannot be empty.",n.push({file:f.name||"(empty)",message:h});else if(f.name.includes("\0"))A=R.VALIDATION_FAILED,h=`File name "${f.name}" contains invalid characters (null byte).`,n.push({file:f.name,message:h});else{let E={path:f.name,size:f.size,totalSize:p+f.size},b=se(E,t);b?(A=R.VALIDATION_FAILED,h=b.sentence(E,t),n.push({file:b.name==="totalSize"?`(${e.length} files)`:f.name,message:h})):p=E.totalSize}l.push({...f,status:A,statusMessage:h})}n.length>0&&(l=l.map(f=>f.status===R.EXCLUDED?f:{...f,status:R.VALIDATION_FAILED,statusMessage:f.status===R.VALIDATION_FAILED?f.statusMessage:"Deployment failed due to validation errors in bundle"}));let m=n.length===0?l.filter(f=>f.status===R.READY):[],y=n.length===0;return{files:l,validFiles:m,errors:n,warnings:s,canDeploy:y}}function vn(e){return e.filter(t=>t.status===R.READY)}function co(e){return vn(e).length>0}var Le=L(()=>{"use strict";D();_e();D()});function St(e){return Mn.test(e)}var Cn,Mn,Dt=L(()=>{"use strict";Cn=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],Mn=new RegExp(Cn.join("|"))});function bt(e,t){if(!e||e.length===0)return[];if(!t?.allowUnbuilt&&e.find(s=>s&&q(s)))throw d.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return e.filter(n=>{if(!n)return!1;let s=n.replace(/\\/g,"/").split("/").filter(Boolean);if(s.length===0)return!0;let l=s[s.length-1];if(St(l))return!1;for(let m of s)if(m!==".well-known"&&(m.startsWith(".")||m.length>255))return!1;let p=s.slice(0,-1);for(let m of p)if(Un.some(y=>m.toLowerCase()===y.toLowerCase()))return!1;return!0})}var Un,Ne=L(()=>{"use strict";D();Dt();Un=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function Rt(e,t){if(e.includes("\0")||e.includes("/../")||e.startsWith("../")||e.endsWith("/.."))throw d.business(`Security error: Unsafe file path "${e}" for file: ${t}`)}function It(e,t){let n=se(e,t);if(n)throw d.business(n.sentence(e,t))}function _t(e,t){if($.broken(e,t))throw d.business($.sentence(e,t))}var xe=L(()=>{"use strict";D();_e()});async function Lt(e,t={},n){let s=!!(t.build||t.prerender),l=Tt(e.map(h=>h.path),{flatten:t.pathDetect!==!1}).map(h=>h.path),p=new Set(bt(l,{allowUnbuilt:s})),m=e.map((h,E)=>({source:h,deployPath:l[E]})).filter(({deployPath:h})=>p.has(h));if(m.length===0)return[];let y=s?null:$n(n),f=[],A=0;for(let{source:h,deployPath:E}of m){if(y&&Rt(E,h.origin),h.size===0)continue;y&&(A+=h.size,It({path:E,size:h.size,totalSize:A},y));let b=await h.read(),{md5:v}=await te(b);f.push({path:E,content:b,size:h.size,md5:v})}return y&&_t(f.length,y),f}function $n(e){if(!e)throw d.config("Platform limits not provided. Deploy-mode validation requires the limits argument \u2014 pass `ship.getLimits()` result.");return e}var Nt=L(()=>{"use strict";D();Se();Ne();ne();xe()});var Ot={};Ut(Ot,{processFilesForBrowser:()=>xt});async function xt(e,t={},n){if(At()!=="browser")throw d.business("processFilesForBrowser can only be called in a browser environment.");return Lt(e.map(s=>({path:s.webkitRelativePath||s.name,origin:s.name,size:s.size,read:async()=>s})),t,n)}var Oe=L(()=>{"use strict";D();Nt();be()});D();D();D();var Q=class{constructor(){this.handlers=new Map}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t)?.add(n)}off(t,n){let s=this.handlers.get(t);s&&(s.delete(n),s.size===0&&this.handlers.delete(t))}emit(t,...n){let s=this.handlers.get(t);if(!s)return;let l=Array.from(s);for(let p of l)try{p(...n)}catch(m){s.delete(p),t!=="error"&&setTimeout(()=>{let y=m instanceof Error?m:new Error(String(m));this.emit("error",y,String(t))},0)}}};var dn=3e4,mn=2,hn=300,yn=2e3,gn=new Set([500,502,503,504]);function En(e,t){return new Promise((n,s)=>{if(t?.aborted){s(t.reason);return}let l=()=>{clearTimeout(m),t?.removeEventListener("abort",p)},p=()=>{l(),s(t?.reason)},m=setTimeout(()=>{l(),n()},e);t?.addEventListener("abort",p)})}var _r=25e5,et=3e5,Tn=3e5,An=et+Tn,Z=class extends Q{constructor(n){super();this.globalHeaders={};this.apiUrl=n.apiUrl||me,this.getAuthHeadersCallback=n.getAuthHeaders,this.session=n.session??!1,this.caller=n.caller,this.timeout=n.timeout??dn,this.maxRetries=Math.max(0,n.maxRetries??mn),this.fetch=n.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:n.deployEndpoint||S.DEPLOYMENTS,timeout:n.timeout??et,buildTimeout:n.timeout??An}}setGlobalHeaders(n){this.globalHeaders=n}async executeRequest(n,s,l,p=this.timeout){for(let m=0;;m++)try{return await this.attemptOnce(n,s,l,p)}catch(y){let f=d.fromFetchError(y,l);if(m>=this.maxRetries||!this.isRetryable(f,s))throw this.emit("error",f,n),f;this.emit("retry",f,n,m+1);let A=Math.min(yn,hn*2**m);try{await En(Math.random()*A,s.signal)}catch(h){let E=d.fromFetchError(h,l);throw this.emit("error",E,n),E}}}isRetryable(n,s){if(s.signal?.aborted||n.isType(g.Maintenance)||n.isType(g.Cancelled)||!(n.isNetworkError()||n.status!==void 0&&gn.has(n.status)))return!1;let p=(s.method??"GET").toUpperCase();return p==="GET"||p==="HEAD"||s.idempotent===!0}async attemptOnce(n,s,l,p=this.timeout){let m=()=>{};try{let{idempotent:y,...f}=s,A=await this.mergeHeaders(f.headers),h=this.createTimeoutSignal(f.signal,p);m=h.cleanup;let E={...f,headers:A,credentials:this.session&&!A.Authorization?"include":void 0,signal:h.signal};this.emit("request",n,E);let b=await this.fetch(n,E);if(m(),!b.ok)throw await d.fromHttpResponse(b,l);return this.emit("response",this.safeClone(b),n),{data:await this.parseResponse(this.safeClone(b)),status:b.status}}catch(y){throw m(),d.fromFetchError(y,l)}}async request(n,s,l,p){let{data:m}=await this.executeRequest(`${this.apiUrl}${n}`,s,l,p);return m}async requestWithStatus(n,s,l,p){return this.executeRequest(`${this.apiUrl}${n}`,s,l,p)}async mergeHeaders(n={}){return{...this.globalHeaders,...this.caller?{[B.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...n}}createTimeoutSignal(n,s=this.timeout){let l=new AbortController,p=setTimeout(()=>l.abort(new DOMException(`Timed out after ${s}ms`,"TimeoutError")),s),m=n?()=>l.abort(n.reason):void 0;return n&&m&&(n.addEventListener("abort",m),n.aborted&&l.abort(n.reason)),{signal:l.signal,cleanup:()=>{clearTimeout(p),n&&m&&n.removeEventListener("abort",m)}}}safeClone(n){try{return n.clone()}catch{return n}}async parseResponse(n){if(!(n.headers.get("Content-Length")==="0"||n.status===204))return n.json()}};D();D();function tt(e){return e.map(t=>{if(!t.md5)throw d.file(`MD5 missing for file: ${t.path}`,{filePath:t.path});return{path:t.path,size:t.size,md5:t.md5}})}function nt(e,t={}){let{labels:n,via:s,password:l,ttl:p,flags:m,captcha:y}=t,f=[[_.MANIFEST,JSON.stringify(e)]];return n&&n.length>0&&f.push([_.LABELS,JSON.stringify(n)]),s&&f.push([_.VIA,s]),l&&f.push([_.PASSWORD,l]),p!==void 0&&f.push([_.TTL,String(p)]),m?.build&&f.push([_.BUILD,"true"]),m?.prerender&&f.push([_.PRERENDER,"true"]),m?.spa&&f.push([_.SPA,"true"]),m?.buildCommand&&f.push([_.BUILD_COMMAND,m.buildCommand]),m?.outputDir&&f.push([_.OUTPUT_DIR,m.outputDir]),y&&f.push([_.CAPTCHA,y]),f}function rt(e,t){for(let n of t){if(typeof n.content=="string"||n.content===null||n.content===void 0)throw d.file(`Unsupported file.content type: ${n.path}`,{filePath:n.path});e.append(_.FILES,new File([n.content],n.path,{type:"application/octet-stream"}))}}function ot(e,t){let n=new FormData;rt(n,e);for(let[s,l]of t)n.append(s,l);return n}function it(e){let t=new FormData;return rt(t,e),t}D();var{MAX_BYTES:ye,PART_OVERHEAD:G}=Ue,st=new TextEncoder;function Sn(e){return st.encode(e.replace(/\r\n|\r|\n/g,`\r
|
|
2
|
+
`)).length}function Dn(e){return st.encode(e.replace(/"/g,"%22").replace(/\r/g,"%0D").replace(/\n/g,"%0A")).length}function at(e){return e.size+Dn(e.path)+G}function bn(e,t){return t.reduce((s,[,l])=>s+Sn(l)+G,e.reduce((s,l)=>s+at(l),0))+G}var Rn=`A project sent for building can be at most ${F(ye)}.`;function ge(e,t,n){if(bn(e,t)<=ye)return{declaration:e,fills:[]};if(n)throw d.validation(Rn);let s=e.filter(y=>y.path===N),l=[],p=[],m=G;for(let y of e){if(y.path===N)continue;let f=at(y);p.length>0&&m+f>ye&&(l.push(p),p=[],m=G),p.push(y),m+=f}return p.length>0&&l.push(p),{declaration:s,fills:l}}D();ne();async function Nn(){let e=JSON.stringify(Xe,null,2),t;typeof Buffer<"u"?t=Buffer.from(e,"utf-8"):t=new Blob([e],{type:"application/json"});let{md5:n}=await te(t);return{path:N,content:t,size:e.length,md5:n}}async function xn(e,t,n){let s=e.find(y=>y.path===W.INDEX_FILE||y.path===`/${W.INDEX_FILE}`);if(!s||s.size>W.MAX_INDEX_BYTES)return!1;let l;if(typeof Buffer<"u"&&Buffer.isBuffer(s.content))l=s.content.toString("utf-8");else if(typeof Blob<"u"&&s.content instanceof Blob)l=await s.content.text();else if(typeof File<"u"&&s.content instanceof File)l=await s.content.text();else return!1;let p={files:e.map(y=>y.path),index:l};return(await t.request(S.SPA_CHECK,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p),signal:n??null},"SPA check")).isSPA}async function Ee(e,t,n){return e.some(s=>s.path===N)?e:await xn(e,t,n)?[...e,await Nn()]:e}async function ft(e,t,n){return n.spaDetect===!1||n.spa||n.build||n.prerender?e:Ee(e,t,n.signal)}D();D();async function dt(e){let t=e.find(l=>l.path===N||l.path===`/${N}`);if(!t)return;let n=t.content,s=typeof n.text=="function"?await n.text():t.content.toString("utf8");Ye(s)}var re={"Content-Type":"application/json"},On="sdk";function Te(e){let t=new URLSearchParams;e?.limit!==void 0&&t.set("limit",String(e.limit)),e?.cursor!==void 0&&t.set("cursor",e.cursor);let n=t.toString();return n?`?${n}`:""}function mt(e){let{getApi:t,processInput:n}=e;return{upload:async(s,l={})=>{if(!n)throw d.config("processInput function is not provided.");let p=t(),m=await n(s,l),y=await ft(m,p,l);if(!y.length)throw d.business("No files to deploy");let f=he(l.password),A=de(l.ttl),h=$e(l.idempotencyKey),E=U(l.labels);await dt(y);let b=Qe(l.buildCommand),v=Ze(l.outputDir),C=!!(l.build||l.prerender),P=(a,i)=>nt(tt(a),{labels:E,via:l.via??On,password:f,ttl:A,flags:C||i?{build:l.build,prerender:l.prerender,spa:i,buildCommand:b,outputDir:v}:void 0,captcha:l.captcha}),T=P(y,l.spa),c=ge(y,T,C);l.spa&&!C&&c.fills.length>0&&(y=await Ee(y,p,l.signal),T=P(y,!1),c=ge(y,T,!1));let u=l.signal||null,o=await p.requestWithStatus(p.deploy.endpoint,{method:"POST",body:ot(c.declaration,T),...h?{headers:{[X.HEADER]:h}}:{},signal:u,idempotent:h!==void 0},"Deploy",C?p.deploy.buildTimeout:p.deploy.timeout);if(o.status!==202)return o.data;let r=S.DEPLOYMENT_FILES(encodeURIComponent(o.data.deployment));for(let a of c.fills){let i=await p.requestWithStatus(r,{method:"POST",body:it(a),signal:u,idempotent:!0},"Deploy",p.deploy.timeout);if(i.status!==202)return i.data}throw d.api("Every file was sent, but the deployment did not go live. Deploy again.")},list:async s=>t().request(`${S.DEPLOYMENTS}${Te(s)}`,{method:"GET"},"List deployments"),get:async s=>t().request(S.DEPLOYMENT(encodeURIComponent(s)),{method:"GET"},"Get deployment"),set:async(s,l)=>t().request(S.DEPLOYMENT(encodeURIComponent(s)),{method:"PATCH",headers:re,body:JSON.stringify({labels:U(l.labels)})},"Update deployment labels"),delete:async s=>t().request(S.DEPLOYMENT(encodeURIComponent(s)),{method:"DELETE"},"Delete deployment")}}function ht(e){let{getApi:t}=e;return{set:async(n,s={})=>{let l=U(s.labels),p={};s.deployment&&(p.deployment=s.deployment),l!==void 0&&(p.labels=l);let{data:m,status:y}=await t().requestWithStatus(S.DOMAIN(encodeURIComponent(n)),{method:"PUT",headers:re,body:JSON.stringify(p)},"Set domain");return{...m,isCreate:y===201}},list:async n=>t().request(`${S.DOMAINS}${Te(n)}`,{method:"GET"},"List domains"),get:async n=>t().request(S.DOMAIN(encodeURIComponent(n)),{method:"GET"},"Get domain"),delete:async n=>t().request(S.DOMAIN(encodeURIComponent(n)),{method:"DELETE"},"Delete domain"),verify:async n=>t().request(S.DOMAIN_VERIFY(encodeURIComponent(n)),{method:"POST"},"Verify domain"),validate:async n=>t().request(S.DOMAINS_VALIDATE,{method:"POST",headers:re,body:JSON.stringify({domain:n})},"Validate domain"),dns:async n=>t().request(S.DOMAIN_DNS(encodeURIComponent(n)),{method:"GET"},"Get domain DNS"),records:async n=>t().request(S.DOMAIN_RECORDS(encodeURIComponent(n)),{method:"GET"},"Get domain records"),share:async n=>t().request(S.DOMAIN_SHARE(encodeURIComponent(n)),{method:"GET"},"Get domain share")}}function yt(e){let{getApi:t}=e;return{get:async()=>t().request(S.ACCOUNT,{method:"GET"},"Get account")}}function gt(e){let{getApi:t}=e;return{create:async(n={})=>{let s=de(n.ttl),l=U(n.labels),p={};return s!==void 0&&(p.ttl=s),l!==void 0&&(p.labels=l),t().request(S.TOKENS,{method:"POST",headers:re,body:JSON.stringify(p)},"Create token")},list:async n=>t().request(`${S.TOKENS}${Te(n)}`,{method:"GET"},"List tokens"),get:async n=>t().request(S.TOKEN(encodeURIComponent(n)),{method:"GET"},"Get token"),delete:async n=>t().request(S.TOKEN(encodeURIComponent(n)),{method:"DELETE"},"Delete token")}}var oe=class{constructor(t={}){this.credential=null;if(t={...t,apiUrl:t.apiUrl||void 0,token:t.token||void 0,caller:t.caller||void 0},this.clientOptions=t,t.caller!==void 0&&qe(t.caller),t.token&&t.session)throw d.config("Provide either `token` or `session`, not both.");typeof t.token=="string"?(fe(t.token),this.credential=t.token):t.token&&(this.credential=t.token),this.http=new Z({...t,getAuthHeaders:()=>this.getAuthHeaders()});let n={getApi:()=>this.http};this.deployments=mt({...n,processInput:async(s,l)=>this.processInput(s,l,await this.getLimits({signal:l.signal}))}),this.domains=ht(n),this.account=yt(n),this.tokens=gt(n)}async ping(){return this.http.request(S.PING,{method:"GET"},"Ping")}async deploy(t,n){return this.deployments.upload(t,n)}async whoami(){return this.account.get()}async getLimits(t={}){return this.http.request(S.LIMITS,{method:"GET",signal:t.signal??null},"Get limits")}on(t,n){this.http.on(t,n)}off(t,n){this.http.off(t,n)}setHeaders(t){this.http.setGlobalHeaders(t)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(t){if(this.clientOptions.session)throw d.config("Provide either `token` or `session`, not both.");if(typeof t=="string"){if(!t)throw d.business("Invalid token provided. Token must be a non-empty string.");fe(t),this.credential=t;return}if(typeof t!="function")throw d.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=t}async getAuthHeaders(){if(this.credential===null)return{};let t=typeof this.credential=="function"?await this.credential():this.credential;if(!t)throw d.authentication("Token provider returned no token.");if(typeof t!="string")throw d.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${t}`}}};D();D();Se();be();Le();Ne();ne();xe();function So(e,t,n,s=!0){let l=e===1?t:n;return s?`${e} ${l}`:l}Oe();var we=class extends oe{async deploy(t,n){return super.deploy(t,n)}async processInput(t,n,s){if(!Array.isArray(t)||!t.every(p=>p instanceof File))throw d.business("Invalid input type for browser environment. Expected File[].");if(t.length===0)throw d.business("No files to deploy.");let{processFilesForBrowser:l}=await Promise.resolve().then(()=>(Oe(),Ot));return l(t,n,s)}},Xo=we;export{er as ACCOUNT_HEADER,Ve as API_KEY,S as API_PATHS,Zn as AUTH_BASE_PATH,jn as AccountPlan,Yn as AccountRefusal,Z as ApiHttp,le as AuthMethod,H as BUILD_SETTINGS,B as CALLER,me as DEFAULT_API,N as DEPLOYMENT_CONFIG_FILENAME,_ as DEPLOY_FIELDS,Jn as DEPLOY_FILE_GRAMMAR,Ue as DEPLOY_REQUEST_CONSTRAINTS,je as DEPLOY_TOKEN,Hn as DeploymentStatus,Bt as DeploymentVia,Gn as DomainStatus,kn as DomainVerification,g as ErrorType,R as FILE_VALIDATION_STATUS,R as FileValidationStatus,X as IDEMPOTENCY_KEY_CONSTRAINTS,Un as JUNK_DIRECTORIES,M as LABEL_CONSTRAINTS,pn as LABEL_PATTERN,pr as MY_API_KEY_URL,Ke as OAUTH_TOKEN,nr as OAuthScope,K as PASSWORD_CONSTRAINTS,fr as PUBLIC_DEPLOYMENT_TTL_SECONDS,en as SECTIONS,zn as SETUP_TROUBLESHOOTING_ANCHOR,ur as SHIP_ENV,cr as SHIP_VIA_ENV,W as SPA_CHECK_CONSTRAINTS,Xe as SPA_DEFAULT_CONFIG,we as Ship,d as ShipError,j as TTL_CONSTRAINTS,w as TokenKind,qt as UNBUILT_PROJECT_MARKERS,Yt as UNSAFE_FILENAME_CHARS,_r as UPLOAD_FLOOR_BITS_PER_SECOND,ve as USAGE_KIND,mr as USER_VISIBLE_EVENTS,Qn as WEB_FILE_ACCEPT,no as __setTestEnvironment,ar as accountOfPath,co as allValidFilesReady,Ye as assertShipJsonSyntax,sr as billingReturnOf,te as calculateMD5,Wt as classifyToken,rn as consolePaths,Gt as countPhrase,yt as createAccountResource,mt as createDeploymentResource,ht as createDomainResource,gt as createTokenResource,Xo as default,Ar as deserializeLabels,an as doorOf,ir as doors,lr as errandOf,Kn as excessOver,yr as extractSubdomain,bt as filterJunk,Xn as fitPhrase,cn as formatDuration,F as formatFileSize,dr as formatTimeRemaining,gr as generateDeploymentUrl,Er as generateDomainUrl,At as getENV,vn as getValidFiles,q as hasUnbuiltMarker,ze as hasUnsafeChars,ke as isBlockedExtension,ln as isClaimPath,hr as isCustomDomain,or as isDeployment,Je as isPlatformDomain,Ge as isShipError,un as isUpgradePath,Vn as normalizeVia,Tt as optimizeDeployPaths,qn as personName,Wn as personShortName,Ht as placesTaken,So as pluralize,xt as processFilesForBrowser,tr as readBearerValue,Tr as serializeLabels,Jt as validateApiKey,rr as validateApiUrl,Qe as validateBuildCommand,qe as validateCaller,_t as validateDeployCount,It as validateDeployFile,Rt as validateDeployPath,Qt as validateDeployToken,Ie as validateFileName,uo as validateFiles,$e as validateIdempotencyKey,fn as validateLabel,U as validateLabels,Zt as validateOAuthToken,Ze as validateOutputDir,he as validatePassword,fe as validateToken,de as validateTtl};
|
|
2
3
|
//# sourceMappingURL=browser.js.map
|