@shipstatic/ship 3.4.0 → 3.5.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 CHANGED
@@ -433,7 +433,7 @@ This package includes a [SKILL.md](./SKILL.md) file, a portable skill definition
433
433
  | **[VS Code](https://marketplace.visualstudio.com/items?itemName=shipstatic.shipstatic)** | Search "ShipStatic" in the Marketplace |
434
434
  | **[Gemini CLI](https://github.com/shipstatic/plugin)** | `gemini extensions install https://github.com/shipstatic/plugin` |
435
435
  | **[n8n](https://www.npmjs.com/package/n8n-nodes-shipstatic)** | Search "ShipStatic" in n8n's node panel |
436
- | **[GitHub Action](https://github.com/shipstatic/action)** | `shipstatic/action@v2` |
436
+ | **[GitHub Action](https://github.com/shipstatic/action)** | `shipstatic/action@v3` |
437
437
  | **[Agent Skill](https://www.shipstatic.com/SKILL.md)** | One file, for any skills-aware tool |
438
438
 
439
439
  ## License
@@ -5,7 +5,7 @@ Their copyright notices travel with that copy, and are reproduced here in
5
5
  full. This file is GENERATED from the build's own metafile — edit the
6
6
  bundle, not this list.
7
7
 
8
- ## @shipstatic/types 3.8.0
8
+ ## @shipstatic/types 3.9.0
9
9
 
10
10
  License: MIT
11
11
 
package/dist/browser.d.ts CHANGED
@@ -511,8 +511,7 @@ interface DomainShareResponse {
511
511
  * the console sends a stuck reader to it rather than to the general docs. If
512
512
  * the spellings ever diverged, nothing would fail: the link would open the page
513
513
  * at its top and nobody would be told, the silent-drift class this
514
- * constitution exists to delete ({@link SIGN_IN_RETURN_PARAM} is the same shape
515
- * one domain over).
514
+ * constitution exists to delete.
516
515
  */
517
516
  declare const SETUP_TROUBLESHOOTING_ANCHOR = "troubleshooting";
518
517
  /**
@@ -717,13 +716,13 @@ declare const AccountPlan: {
717
716
  };
718
717
  type AccountPlanType = (typeof AccountPlan)[keyof typeof AccountPlan];
719
718
  /**
720
- * The three things an account ACCUMULATES, and therefore the three things a
719
+ * The four things an account ACCUMULATES, and therefore the four things a
721
720
  * plan caps. One word for the count and for the ceiling: `Account.usage` and
722
721
  * `Account.caps` are the same shape, so a surface renders "2 of 3" by
723
722
  * dividing one by the other and can never divide by a different denominator
724
723
  * than the 403 uses.
725
724
  *
726
- * All three are counts plans SELL, and every plan publishes a number for each.
725
+ * All four are counts plans SELL, and every plan publishes a number for each.
727
726
  * A platform domain (`my-app.shipstatic.com`) is among them: the namespace
728
727
  * is the platform's, so every plan bounds how many names one account may take
729
728
  * from it — which is not the address every deployment gets by construction
@@ -763,12 +762,81 @@ interface Caps {
763
762
  */
764
763
  readonly customDomains: number;
765
764
  /**
766
- * Members of the account, the owner included: one membership row each, so
767
- * a pending invitation is not yet a member. As `usage` it is how many the
768
- * account has, as `caps` how many its plan allows.
765
+ * Member places. As `caps` it is how many people the plan allows in the
766
+ * account, the owner included. As `usage` it is the members the account
767
+ * has: one membership row each. A pending invitation holds a place too,
768
+ * counted beside it as {@link AccountUsage.invitations}, so what stands
769
+ * against this cap is {@link placesTaken}, members and invitations
770
+ * together.
769
771
  */
770
772
  readonly members: number;
771
773
  }
774
+ /**
775
+ * What the account holds: every cap's count, and the pending invitations.
776
+ *
777
+ * A member place is taken by a member or by a pending invitation, and an
778
+ * account never holds more of the two together than its plan's `members`
779
+ * cap: the invite door refuses a new invitation when the places are taken,
780
+ * and a move down a tier is booked only when the places fit the destination.
781
+ * The count has no cap of its own, which is why it is a field of the usage
782
+ * and not of {@link Caps}: the place it takes is a member's.
783
+ *
784
+ * Only a member pauses, though. An account over its members cap pauses every
785
+ * member while it does not fit; a pending invitation pauses nobody and
786
+ * counts toward no pause.
787
+ */
788
+ interface AccountUsage extends Caps {
789
+ /**
790
+ * Invitations still open: pending, and not yet expired. An expired one
791
+ * holds nothing, whether or not a sweep has removed its row.
792
+ */
793
+ readonly invitations: number;
794
+ }
795
+ /** The member places an account has taken: its members, and its pending invitations. */
796
+ declare function placesTaken(usage: Pick<AccountUsage, 'members' | 'invitations'>): number;
797
+ /**
798
+ * The kind each count of {@link AccountUsage} names, as a person reads it:
799
+ * one and many. The one vocabulary every surface that says a count uses, the
800
+ * api's cap refusals and the console's room notes alike, so "custom domain"
801
+ * is one word wherever it is met. A person reads "ShipStatic domain" where
802
+ * the code says platform domain; the code's word never reaches them.
803
+ */
804
+ declare const USAGE_KIND: Record<keyof AccountUsage, {
805
+ readonly one: string;
806
+ readonly many: string;
807
+ }>;
808
+ /**
809
+ * What an account holds beyond a set of caps, per kind, only the kinds that
810
+ * are over: what a move down a tier must shed before it is booked, and what
811
+ * the console notes on a cheaper card.
812
+ *
813
+ * Member places are read against `caps.members`: the places over the cap are
814
+ * counted once ({@link placesTaken} less the cap), members are named first,
815
+ * because a member over the cap has to go whatever else the account holds,
816
+ * and what is over after them is the invitations to cancel. So two members
817
+ * and one invitation against a cap of one is one member and one invitation,
818
+ * and five members against the same cap is four members and no invitation.
819
+ * The two domain kinds are read against their own caps. Deployments are not
820
+ * read at all: nothing pauses them, and above their cap they only block
821
+ * creation (see {@link Caps}).
822
+ */
823
+ declare function excessOver(usage: AccountUsage, caps: Caps): Partial<AccountUsage>;
824
+ /**
825
+ * Counts of kinds in words, people first: "4 members and 2 custom domains",
826
+ * or nothing. The order is {@link USAGE_KIND}'s minus the two kinds a count never
827
+ * names here, deployments and invitations, which have their own sentence
828
+ * ({@link fitPhrase}).
829
+ */
830
+ declare function countPhrase(excess: Partial<AccountUsage>): string;
831
+ /**
832
+ * What to do before an account fits a set of caps, in words: "remove 1
833
+ * member and cancel 1 invitation", "remove 2 custom domains", "cancel 2
834
+ * invitations", or nothing when it fits. Two verbs, because a member place is
835
+ * freed two ways: a member is removed, a pending invitation is cancelled. The
836
+ * api's change door and the console's room notes say this one phrase, so a
837
+ * refusal and the note that preceded it cannot differ.
838
+ */
839
+ declare function fitPhrase(excess: Partial<AccountUsage>): string;
772
840
  /**
773
841
  * A person's standing in an account. `owner` founded it and alone manages
774
842
  * billing, credentials, members and deletion; `member` uses its resources
@@ -836,13 +904,17 @@ interface Account {
836
904
  * still work, every write is refused. The plan is unchanged underneath.
837
905
  */
838
906
  readonly suspended: boolean;
839
- /** What the account currently holds — see {@link Caps}. */
840
- readonly usage: Caps;
841
907
  /**
842
- * What the account is allowed to hold, under the same keys as
843
- * {@link usage}, so the pair divides. These are the account's EFFECTIVE
844
- * caps: its plan's numbers, plus whatever the operator granted it
845
- * individually.
908
+ * What the account currently holds: every cap's count, and the pending
909
+ * invitations beside them — see {@link AccountUsage}.
910
+ */
911
+ readonly usage: AccountUsage;
912
+ /**
913
+ * What the account is allowed to hold, under {@link usage}'s cap keys, so
914
+ * the pair divides. These are the account's EFFECTIVE caps: its plan's
915
+ * numbers, plus whatever the operator granted it individually. The one key
916
+ * of `usage` absent here is `invitations`, which has no cap of its own: a
917
+ * pending invitation takes a member place, so it counts against `members`.
846
918
  */
847
919
  readonly caps: Caps;
848
920
  /**
@@ -862,15 +934,16 @@ interface Account {
862
934
  */
863
935
  readonly access?: AccountAccess;
864
936
  /**
865
- * Whether the account's MEMBERS are admitted today: `paused` while it holds
866
- * more members than its plan allows, until the owner upgrades or removes
867
- * members. It is {@link access} for everyone who is not the owner, published
868
- * for the account so the one person it never pauses can be told; the API
869
- * derives both from one rule, so a console reads the pause here rather than
870
- * re-deriving it from the member counts. Optional by the additive-evolution
871
- * law: a response that predates it is `active`.
937
+ * The account's own standing, beside the credential's ({@link access}):
938
+ * whether its MEMBERS are admitted today, `paused` while it holds more
939
+ * members than its plan allows, until the owner upgrades or removes
940
+ * members. It is {@link access} for everyone who is not the owner,
941
+ * published for the account so the one person it never pauses can be told;
942
+ * the API derives both from one rule, so a console reads the pause here
943
+ * rather than re-deriving it from the member counts. Optional by the
944
+ * additive-evolution law: a response that predates it is `active`.
872
945
  */
873
- readonly members?: AccountAccess;
946
+ readonly membership?: AccountAccess;
874
947
  /** Unix timestamp (seconds) when account was created */
875
948
  readonly created: number;
876
949
  /** Unix timestamp (seconds) when account was activated (first deployment), null if not yet activated */
@@ -1613,20 +1686,6 @@ interface PingResponse {
1613
1686
  * already share the credential prefixes below.
1614
1687
  */
1615
1688
  declare const AUTH_BASE_PATH = "/auth";
1616
- /**
1617
- * The query marker a completed sign-in LANDS with.
1618
- *
1619
- * The API's magic-link verify leg stamps `?signing-in=1` onto its success
1620
- * redirect, and the console boots into its wait screen on seeing it — two
1621
- * repos, one spelling, which is why it lives here. Success is marked and the
1622
- * error leg deliberately is NOT: the console gives the marker precedence, so
1623
- * a marked error would render a wait that resolves to bare doors with the
1624
- * error's sentence lost. If the spellings ever diverged the failure would be
1625
- * invisible to every suite — email landings would flash the doors for one
1626
- * round trip instead of waiting — which is exactly the silent-drift class
1627
- * this constitution exists to delete.
1628
- */
1629
- declare const SIGN_IN_RETURN_PARAM = "signing-in";
1630
1689
  /**
1631
1690
  * How a request (or recorded activity) was authorized.
1632
1691
  *
@@ -2049,6 +2108,9 @@ declare const SECTIONS: {
2049
2108
  readonly settings: {
2050
2109
  readonly owner: false;
2051
2110
  };
2111
+ readonly claim: {
2112
+ readonly owner: false;
2113
+ };
2052
2114
  readonly upgrade: {
2053
2115
  readonly owner: true;
2054
2116
  };
@@ -2061,6 +2123,10 @@ declare const SECTIONS: {
2061
2123
  };
2062
2124
  /** A section's first segment. */
2063
2125
  type ConsoleSection = keyof typeof SECTIONS;
2126
+ /** The pages that exist before an account is known, by first segment. */
2127
+ declare const DOOR_SEGMENTS: readonly ["login", "register", "logout", "invitation", "consent"];
2128
+ /** A door's first segment. */
2129
+ type DoorSegment = (typeof DOOR_SEGMENTS)[number];
2064
2130
  /** The two fragments of the settings page a link may name. */
2065
2131
  type SettingsFragment = 'members' | 'api-key';
2066
2132
  /**
@@ -2094,6 +2160,8 @@ declare function consolePaths(account?: string): {
2094
2160
  deployment: (domain: string) => string;
2095
2161
  };
2096
2162
  settings: (fragment?: SettingsFragment) => string;
2163
+ /** The claim of an anonymous deployment into this account; the API mails the bare form. */
2164
+ claim: (code: string) => string;
2097
2165
  /** Settings, marked as the landing of a Stripe Customer Portal return. */
2098
2166
  settingsAfterBilling: () => string;
2099
2167
  upgrade: (plan?: AccountPlanType) => string;
@@ -2104,13 +2172,31 @@ declare function consolePaths(account?: string): {
2104
2172
  };
2105
2173
  /** The builders `consolePaths` returns. */
2106
2174
  type ConsolePaths = ReturnType<typeof consolePaths>;
2107
- /** The doors: the pages that exist before an account is known. */
2175
+ /** Where a sign-in door's journey goes on: the console path a `?next` carries. */
2176
+ interface Journey {
2177
+ readonly next?: string;
2178
+ }
2179
+ /**
2180
+ * The doors: the pages a PERSON stands on before an account is known, one
2181
+ * builder per door segment and named for it: signing in and out, joining an
2182
+ * account, granting an app access. A door's object rides its path (the
2183
+ * sign-in link's token, the invitation's id), and the journey rides the
2184
+ * query, so the three doors a sign-in moves through take it by name. What a
2185
+ * person does IN an account is a section (`consolePaths`), the claim among
2186
+ * them.
2187
+ *
2188
+ * ```ts
2189
+ * doors.login({ token, next: '/claim/abc' })
2190
+ * // '/login/<token>?next=%2Fclaim%2Fabc'
2191
+ * ```
2192
+ */
2108
2193
  declare const doors: {
2109
- readonly login: (next?: string) => string;
2110
- readonly register: (next?: string) => string;
2111
- readonly logout: () => string;
2194
+ readonly login: ({ token, next }?: Journey & {
2195
+ readonly token?: string;
2196
+ }) => string;
2197
+ readonly register: ({ next }?: Journey) => string;
2198
+ readonly logout: ({ next }?: Journey) => string;
2112
2199
  readonly invitation: (invitation: string) => string;
2113
- readonly claim: (code: string) => string;
2114
2200
  readonly consent: () => string;
2115
2201
  };
2116
2202
  /**
@@ -2125,10 +2211,21 @@ declare function billingReturnOf(search: string): BillingReturn | null;
2125
2211
  * the account exists is the server's answer, never the path's.
2126
2212
  */
2127
2213
  declare function accountOfPath(path: string): string | null;
2128
- /** Whether a path names a claim link (`/claim/:code`, a bearer credential). */
2214
+ /**
2215
+ * The door a path names, or null for an account place or the operator
2216
+ * partition. Every question about doors reads this one answer: which page is
2217
+ * 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
2219
+ * invitation door: a door's object is the rest of its path.
2220
+ */
2221
+ declare function doorOf(path: string): DoorSegment | null;
2222
+ /**
2223
+ * Whether a path names the claim section, in either form: `/claim/:code`, and
2224
+ * the same under `/<account>/`. The code is a bearer credential, which is why
2225
+ * a reader asks about this section by name: the doors title their visitor by
2226
+ * it, and analytics elides it.
2227
+ */
2129
2228
  declare const isClaimPath: (path: string) => boolean;
2130
- /** Whether a path names an invitation (`/invitations/:invitation`). */
2131
- declare const isInvitationPath: (path: string) => boolean;
2132
2229
  /**
2133
2230
  * Whether a path names the upgrade section, in either form: `/upgrade`,
2134
2231
  * `/upgrade/:plan`, and the same under `/<account>/`.
@@ -2461,20 +2558,6 @@ interface Plan {
2461
2558
  * nothing (a plan sold by conversation publishes no numbers).
2462
2559
  */
2463
2560
  readonly caps: Caps | null;
2464
- /**
2465
- * Why this row cannot be ordered right now — the closed door's own sentence,
2466
- * verbatim — or absent when the way is open. A menu lists what can be
2467
- * ordered, and a row that is sold but not yet orderable (its door is closed:
2468
- * checkout unbuilt, a feature unfinished) SAYS SO on the menu instead of
2469
- * only at the order.
2470
- *
2471
- * Clients branch on PRESENCE and render the sentence unchanged — they know
2472
- * *that* the row is closed, never *which* door or *when it lifts*; the
2473
- * vocabulary of doors stays server-side. The same rule the refusal follows:
2474
- * `POST /billing/change` onto a closed row answers 400 with
2475
- * `details.closed`, and its `message` is this sentence.
2476
- */
2477
- readonly closed?: string;
2478
2561
  }
2479
2562
  /**
2480
2563
  * Response for `GET /plans` — the whole public menu, in display order.
@@ -2512,17 +2595,18 @@ interface PlanChangeRequest {
2512
2595
  }
2513
2596
  /**
2514
2597
  * `details` of the change door's refusal of a move down a tier the account
2515
- * does not fit: the account holds more members, custom domains or platform
2516
- * domains than the destination allows.
2598
+ * does not fit: the account holds more members, pending invitations, custom
2599
+ * domains or platform domains than the destination allows.
2517
2600
  *
2518
2601
  * `excess` counts what to REMOVE before asking again, per kind, keyed like
2519
- * {@link Caps}; only the kinds over the destination's caps appear. The
2520
- * door's `message` names the same counts in a sentence, and that sentence is
2521
- * what a surface shows; the counts are for a client that acts on the
2522
- * refusal.
2602
+ * {@link AccountUsage}; only the kinds over the destination's caps appear
2603
+ * ({@link excessOver}). Members and invitations are counted apart, since one
2604
+ * is removed and the other cancelled. The door's `message` names the same
2605
+ * counts in a sentence, and that sentence is what a surface shows; the
2606
+ * counts are for a client that acts on the refusal.
2523
2607
  */
2524
2608
  interface PlanChangeRefusalDetails {
2525
- readonly excess: Partial<Caps>;
2609
+ readonly excess: Partial<AccountUsage>;
2526
2610
  }
2527
2611
  /**
2528
2612
  * The pending plan change — a Stripe Subscription Schedule, mirrored onto the
@@ -3850,4 +3934,4 @@ declare class Ship extends Ship$1 {
3850
3934
  protected processInput(input: DeployInput, options: DeploymentOptions, limits: PlatformLimits): Promise<StaticFile[]>;
3851
3935
  }
3852
3936
 
3853
- 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 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 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, SIGN_IN_RETURN_PARAM, 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, USER_VISIBLE_EVENTS, type UploadedFile, type UserVisibleActivityEvent, type ValidatableFile, type ValidationIssue, WEB_FILE_ACCEPT, __setTestEnvironment, accountOfPath, allValidFilesReady, assertShipJsonSyntax, billingReturnOf, calculateMD5, classifyToken, consolePaths, createAccountResource, createDeploymentResource, createDomainResource, createTokenResource, Ship as default, deserializeLabels, doors, errandOf, extractSubdomain, filterJunk, formatDuration, formatFileSize, formatTimeRemaining, generateDeploymentUrl, generateDomainUrl, getENV, getValidFiles, hasUnbuiltMarker, hasUnsafeChars, isBlockedExtension, isClaimPath, isCustomDomain, isDeployment, isInvitationPath, isPlatformDomain, isShipError, isUpgradePath, normalizeVia, optimizeDeployPaths, personName, personShortName, pluralize, processFilesForBrowser, readBearerValue, serializeLabels, validateApiKey, validateApiUrl, validateBuildCommand, validateCaller, validateDeployCount, validateDeployFile, validateDeployPath, validateDeployToken, validateFileName, validateFiles, validateIdempotencyKey, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
3937
+ 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, validateOAuthToken, validateOutputDir, validatePassword, validateToken, validateTtl };
package/dist/browser.js CHANGED
@@ -1,2 +1,2 @@
1
- var Et=Object.create;var G=Object.defineProperty;var Tt=Object.getOwnPropertyDescriptor;var At=Object.getOwnPropertyNames;var St=Object.getPrototypeOf,Dt=Object.prototype.hasOwnProperty;var Rt=(e,n,t)=>n in e?G(e,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[n]=t;var _=(e,n)=>()=>(e&&(n=e(e=0)),n);var Le=(e,n)=>()=>(n||e((n={exports:{}}).exports,n),n.exports),bt=(e,n)=>{for(var t in n)G(e,t,{get:n[t],enumerable:!0})},It=(e,n,t,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of At(n))!Dt.call(e,l)&&l!==t&&G(e,l,{get:()=>n[l],enumerable:!(s=Tt(n,l))||s.enumerable});return e};var k=(e,n,t)=>(t=e!=null?Et(St(e)):{},It(n||!e||!e.__esModule?G(t,"default",{value:e,enumerable:!0}):t,e));var K=(e,n,t)=>Rt(e,typeof n!="symbol"?n+"":n,t);function Dn(e){if(!e||typeof e!="string")return;let n=e.trim().toLowerCase();return Object.values(_t).includes(n)?n:void 0}function Pe(e){if(e==null)return;if(typeof e!="string")throw m.validation("Idempotency key must be a string.");let n=e.trim();if(!n)throw m.validation("Idempotency key must not be empty.");if(n.length>v.MAX_LENGTH)throw m.validation(`Idempotency key must be at most ${v.MAX_LENGTH} characters.`);return n}function In(e){return e.name?.trim()||e.email}function _n(e){return e.name?.trim().split(" ")[0]||e.email}function xt(e){let n=e.code;return n==="ERR_INVALID_URL"?!1:typeof n=="string"?!0:e instanceof TypeError?!/\burl\b/i.test(e.message):!1}function Ce(e){return e!==null&&typeof e=="object"&&"name"in e&&e.name==="ShipError"&&"status"in e}function Ot(e){let n=e.replace(/\\/g,"/").split("/").pop()??"",t=n.lastIndexOf(".");return t<=0||t===n.length-1?null:n.slice(t+1).toLowerCase()}function ve(e,n){let t=Ot(e);return t===null?!1:Array.isArray(n)?n.includes(t):n.has(t)}function Fe(e){return Ct.test(e)}function X(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(t=>vt.has(t))}function Ft(e){return e.startsWith(Me.PREFIX)?P.API_KEY:e.startsWith(Ue.PREFIX)?P.DEPLOY_TOKEN:e.startsWith($e.PREFIX)?P.OAUTH:P.OPAQUE}function Pn(e){return e.slice(0,ae.length).toLowerCase()!==ae?null:e.slice(ae.length)||null}function He(e){let n=e.charCodeAt(0)===65279?e.slice(1):e,t;try{t=JSON.parse(n)}catch(s){throw m.config(`invalid JSON format in config: ${s.message}`,{filePath:w})}if(t===null||typeof t!="object"||Array.isArray(t))throw m.config(`${w} must contain a JSON object`,{filePath:w})}function ue(e,n,t){if(!e.startsWith(n.PREFIX))throw m.validation(`${t} must start with "${n.PREFIX}"`);if(e.length!==n.TOTAL_LENGTH)throw m.validation(`${t} must be ${n.TOTAL_LENGTH} characters total (${n.PREFIX} + ${n.HEX_LENGTH} hex chars)`);let s=e.slice(n.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${n.HEX_LENGTH}}$`,"i").test(s))throw m.validation(`${t} must contain ${n.HEX_LENGTH} hexadecimal characters after "${n.PREFIX}" prefix`)}function Mt(e){ue(e,Me,"API key")}function Ut(e){ue(e,Ue,"Deploy token")}function $t(e){ue(e,$e,"OAuth access token")}function ce(e){switch(Ft(e)){case P.API_KEY:Mt(e);return;case P.DEPLOY_TOKEN:Ut(e);return;case P.OAUTH:$t(e);return;case P.OPAQUE:if(!e)throw m.validation("Token must be a non-empty string")}}function Ge(e){if(!e||e.length>U.MAX_LENGTH||!U.PATTERN.test(e))throw m.validation(`Caller must be 1-${U.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function vn(e){try{let n=new URL(e);if(!["http:","https:"].includes(n.protocol))throw m.validation("API URL must use http:// or https:// protocol");if(n.pathname!=="/"&&n.pathname!=="")throw m.validation("API URL must not contain a path");if(n.search||n.hash)throw m.validation("API URL must not contain query parameters or fragments")}catch(n){throw Ce(n)?n:m.validation("API URL must be a valid URL")}}function Fn(e){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(e)}function pe(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<V.MIN_SECONDS||e>V.MAX_SECONDS)throw m.validation(`TTL must be between ${V.MIN_SECONDS} and ${V.MAX_SECONDS} seconds`);return e}}function kt(e){let n=e?`/${e}`:"",t=s=>`${n}${s}`;return{dashboard:()=>n||"/",newSite:()=>t("/new"),deployments:Object.assign(()=>t("/deployments"),{upload:()=>t("/deployments/upload")}),domains:Object.assign(()=>t("/domains"),{connect:s=>t(`/domains/${s}/connect`),deployment:s=>t(`/domains/${s}/deployment`)}),settings:s=>t(s?`/settings#${s}`:"/settings"),settingsAfterBilling:()=>t(`/settings?${we("portal")}`),upgrade:s=>t(s?`/upgrade/${s}`:"/upgrade"),success:()=>t("/success"),successAfterCheckout:()=>t(`/success?${we("checkout")}`),apiKey:()=>t("/api-key")}}function Un(e){let n=new URLSearchParams(e);for(let[t,[s,l]]of Object.entries(ke))if(n.get(s)===l)return t;return null}function j(e){let n=e.split(/[?#]/)[0].toLowerCase(),[t="",s=""]=n.split("/").filter(Boolean);return Kt(t)?{kind:"door",door:t}:t===Gt?{kind:"admin"}:t===""||Oe(t)?{kind:"account",account:null,section:t===""?null:t}:{kind:"account",account:t,section:Oe(s)?s:null}}function $n(e){let n=j(e);return n.kind==="account"?n.account:null}function Bn(e){return Vt(e)?"claim":zt(e)?"invite":Xt(e)?"upgrade":null}function qt(e){let n=Math.round(e/60);if(!(n>=1))return"less than a minute";if(n<120)return le(n,"minute");let t=Math.round(e/3600);return t<48?le(t,"hour"):le(Math.round(e/86400),"day")}function Vn(e,n=Date.now()/1e3){let t=e-n;return t>0?qt(t):null}function le(e,n){return`${e} ${n}${e===1?"":"s"}`}function B(e,n=1){if(e===0)return"0 Bytes";let t=1024,s=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(t));return`${Number.parseFloat((e/t**l).toFixed(n))} ${s[l]}`}function Ke(e,n){return e.endsWith(`.${n}`)}function Xn(e,n){return!Ke(e,n)}function qn(e,n){return Ke(e,n)?e.slice(0,-(n.length+1)):null}function jn(e){return`https://${e}`}function Yn(e){return`https://${e}`}function Wn(e){return!e||e.length===0?null:JSON.stringify(e)}function Jn(e){if(!e)return[];try{let n=JSON.parse(e);return Array.isArray(n)?n:[]}catch{return[]}}function ze(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Build command must be a string");let n=e.trim();if(n.length===0||n.length>$.COMMAND_MAX_LENGTH)throw m.validation(`Build command must be between 1 and ${$.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(n))throw m.validation("Build command must be a single line");return n}function Xe(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Output folder must be a string");let n=e.trim().replace(/\/+$/,"");if(n.length===0||n.length>$.OUTPUT_DIR_MAX_LENGTH)throw m.validation(`Output folder must be between 1 and ${$.OUTPUT_DIR_MAX_LENGTH} characters`);if(!$.OUTPUT_DIR_PATTERN.test(n)||n.split("/").some(t=>t===".."||t==="."))throw m.validation("Output folder must be a relative path inside the project, like dist or dist/site");return n}function fe(e){if(e==null)return;if(typeof e!="string")throw m.validation("Password must be a string");let n=e.trim();if(n.length<z.MIN_LENGTH||n.length>z.MAX_LENGTH)throw m.validation(`Password must be between ${z.MIN_LENGTH} and ${z.MAX_LENGTH} characters`);return n}var En,_t,Tn,An,Sn,v,Rn,bn,A,I,Nn,g,Nt,oe,Lt,wt,m,Pt,Ln,Ct,vt,wn,xn,se,Me,Ue,$e,U,On,P,ae,Cn,w,Be,q,V,Bt,Ht,Gt,ke,we,xe,Mn,Kt,Oe,Vt,zt,Xt,de,Hn,Gn,kn,Kn,zn,R,C,Ve,$,z,D=_(()=>{"use strict";En={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},_t={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc",CLD:"cld",CRS:"crs",GMN:"gmn",API:"api"},Tn={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},An={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},Sn="troubleshooting",v={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};Rn={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"},bn={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"},Nn={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"},Nt=new Set([g.Network,g.Timeout,g.Cancelled,g.File,g.Config]),oe={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])},Lt=new Set(Object.values(g).filter(e=>!Nt.has(e))),wt=200;m=class e extends Error{constructor(t,s,l,p){super(s);K(this,"type");K(this,"status");K(this,"details");this.type=t,this.status=l,this.details=p,this.name="ShipError"}toResponse(){let t=this.details,s=this.type===g.Authentication&&t?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:s}}static async fromHttpResponse(t,s){let l,p,h;try{if(t.headers.get("content-type")?.includes("application/json")){let f=await t.json();if(f&&typeof f=="object"){let T=f;typeof T.message=="string"?l=T.message:typeof T.error=="string"&&(l=T.error),p=T.details,typeof T.error=="string"&&Lt.has(T.error)&&(h=T.error)}}else{let f=(await t.text()).trim();f&&!f.startsWith("<")&&f.length<=wt&&(l=f)}}catch{}let y=t.headers.get("retry-after");if(y!==null){let E=y.trim(),f=/^\d+$/.test(E)?Number(E):Math.ceil((Date.parse(E)-Date.now())/1e3);if(Number.isFinite(f)&&f>=0){let T=p&&typeof p=="object"?p:{};T.retryAfter===void 0&&(p={...T,retryAfter:f})}}l=l||`${s||"Request"} failed with status ${t.status}`;let d=h??(t.status===401?g.Authentication:t.status===403?g.Forbidden:t.status===429?g.RateLimit:g.Api);return new e(d,l,t.status,p)}static fromFetchError(t,s){if(Ce(t))return t;let l=s||"Request",p=t?.name;return p==="AbortError"?e.cancelled(`${l} was cancelled`):p==="TimeoutError"?e.timeout(`${l} timed out`,{cause:t}):t instanceof Error?xt(t)?e.network(`${l} failed: ${t.message}`,{cause:t}):new e(g.Api,`${l} failed: ${t.message}`):new e(g.Api,`${l} failed: Unknown error`)}static validation(t,s){return new e(g.Validation,t,400,s)}static notFound(t,s){let l=s?`${t} ${s} not found`:`${t} not found`;return new e(g.NotFound,l,404)}static forbidden(t,s){return new e(g.Forbidden,t,403,s)}static rateLimit(t="Too many requests",s){return new e(g.RateLimit,t,429,s)}static authentication(t="Authentication required",s){return new e(g.Authentication,t,401,s)}static business(t,s=400,l){return new e(g.Business,t,s,l)}static network(t,s){return new e(g.Network,t,void 0,s)}static timeout(t,s){return new e(g.Timeout,t,void 0,s)}static cancelled(t,s){return new e(g.Cancelled,t,void 0,s)}static file(t,s){return new e(g.File,t,void 0,s)}static config(t,s){return new e(g.Config,t,void 0,s)}static api(t,s=500,l){return new e(g.Api,t,s,l)}static maintenance(t,s){return new e(g.Maintenance,t,503,s)}static build(t,s){return new e(g.Build,t,422,s)}isClientError(){return oe.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return oe.network.has(this.type)}isAuthError(){return oe.auth.has(this.type)}isType(t){return this.type===t}};Pt=["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"],Ln=Pt.map(e=>`.${e}`).join(","),Ct=/[\x00-\x1f\x7f#?%\\<>"]/;vt=new Set(["node_modules","package.json"]);wn="/auth",xn="signing-in",se={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",SYSTEM:"system"},Me={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},Ue={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},$e={PREFIX:"oauth-",HEX_LENGTH:32,TOTAL_LENGTH:38},U={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},On="X-Account",P={API_KEY:se.API_KEY,DEPLOY_TOKEN:se.TOKEN,OAUTH:se.OAUTH,OPAQUE:"opaque"};ae="bearer ";Cn={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},w="ship.json",Be={rewrites:[{source:"/(.*)",destination:"/index.html"}]},q={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};V={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};Bt={new:{owner:!1},deployments:{owner:!1},domains:{owner:!1},settings:{owner:!1},upgrade:{owner:!0},success:{owner:!0},"api-key":{owner:!0}},Ht=["login","register","logout","invitations","claim","consent"],Gt="admin",ke={checkout:["upgrading","true"],portal:["billing","returned"]},we=e=>ke[e].join("="),xe=(e,n)=>n?`${e}?next=${encodeURIComponent(n)}`:e;Mn={login:e=>xe("/login",e),register:e=>xe("/register",e),logout:()=>"/logout",invitation:e=>`/invitations/${e}`,claim:e=>`/claim/${e}`,consent:()=>"/consent"};Kt=e=>Ht.includes(e),Oe=e=>Object.hasOwn(Bt,e);Vt=e=>{let n=j(e);return n.kind==="door"&&n.door==="claim"},zt=e=>{let n=j(e);return n.kind==="door"&&n.door==="invitations"},Xt=e=>{let n=j(e);return n.kind==="account"&&n.section==="upgrade"};de="https://api.shipstatic.com",Hn={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},Gn="SHIP_VIA",kn=`https://my.shipstatic.com${kt().apiKey()}`,Kn=4320*60;zn=["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"};C={MIN_LENGTH:3,MAX_LENGTH:25,MAX_COUNT:10,SEPARATORS:"._-"},Ve=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;$={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};z={MIN_LENGTH:6,MAX_LENGTH:128}});var Je=Le((Ye,We)=>{"use strict";(function(e){if(typeof Ye=="object")We.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var n;try{n=window}catch{n=self}n.SparkMD5=e()}})(function(e){"use strict";var n=function(c,u){return c+u&4294967295},t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function s(c,u,i,r,a,o){return u=n(n(u,c),n(r,o)),n(u<<a|u>>>32-a,i)}function l(c,u){var i=c[0],r=c[1],a=c[2],o=c[3];i+=(r&a|~r&o)+u[0]-680876936|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&a)+u[1]-389564586|0,o=(o<<12|o>>>20)+i|0,a+=(o&i|~o&r)+u[2]+606105819|0,a=(a<<17|a>>>15)+o|0,r+=(a&o|~a&i)+u[3]-1044525330|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&o)+u[4]-176418897|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&a)+u[5]+1200080426|0,o=(o<<12|o>>>20)+i|0,a+=(o&i|~o&r)+u[6]-1473231341|0,a=(a<<17|a>>>15)+o|0,r+=(a&o|~a&i)+u[7]-45705983|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&o)+u[8]+1770035416|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&a)+u[9]-1958414417|0,o=(o<<12|o>>>20)+i|0,a+=(o&i|~o&r)+u[10]-42063|0,a=(a<<17|a>>>15)+o|0,r+=(a&o|~a&i)+u[11]-1990404162|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&o)+u[12]+1804603682|0,i=(i<<7|i>>>25)+r|0,o+=(i&r|~i&a)+u[13]-40341101|0,o=(o<<12|o>>>20)+i|0,a+=(o&i|~o&r)+u[14]-1502002290|0,a=(a<<17|a>>>15)+o|0,r+=(a&o|~a&i)+u[15]+1236535329|0,r=(r<<22|r>>>10)+a|0,i+=(r&o|a&~o)+u[1]-165796510|0,i=(i<<5|i>>>27)+r|0,o+=(i&a|r&~a)+u[6]-1069501632|0,o=(o<<9|o>>>23)+i|0,a+=(o&r|i&~r)+u[11]+643717713|0,a=(a<<14|a>>>18)+o|0,r+=(a&i|o&~i)+u[0]-373897302|0,r=(r<<20|r>>>12)+a|0,i+=(r&o|a&~o)+u[5]-701558691|0,i=(i<<5|i>>>27)+r|0,o+=(i&a|r&~a)+u[10]+38016083|0,o=(o<<9|o>>>23)+i|0,a+=(o&r|i&~r)+u[15]-660478335|0,a=(a<<14|a>>>18)+o|0,r+=(a&i|o&~i)+u[4]-405537848|0,r=(r<<20|r>>>12)+a|0,i+=(r&o|a&~o)+u[9]+568446438|0,i=(i<<5|i>>>27)+r|0,o+=(i&a|r&~a)+u[14]-1019803690|0,o=(o<<9|o>>>23)+i|0,a+=(o&r|i&~r)+u[3]-187363961|0,a=(a<<14|a>>>18)+o|0,r+=(a&i|o&~i)+u[8]+1163531501|0,r=(r<<20|r>>>12)+a|0,i+=(r&o|a&~o)+u[13]-1444681467|0,i=(i<<5|i>>>27)+r|0,o+=(i&a|r&~a)+u[2]-51403784|0,o=(o<<9|o>>>23)+i|0,a+=(o&r|i&~r)+u[7]+1735328473|0,a=(a<<14|a>>>18)+o|0,r+=(a&i|o&~i)+u[12]-1926607734|0,r=(r<<20|r>>>12)+a|0,i+=(r^a^o)+u[5]-378558|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^a)+u[8]-2022574463|0,o=(o<<11|o>>>21)+i|0,a+=(o^i^r)+u[11]+1839030562|0,a=(a<<16|a>>>16)+o|0,r+=(a^o^i)+u[14]-35309556|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^o)+u[1]-1530992060|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^a)+u[4]+1272893353|0,o=(o<<11|o>>>21)+i|0,a+=(o^i^r)+u[7]-155497632|0,a=(a<<16|a>>>16)+o|0,r+=(a^o^i)+u[10]-1094730640|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^o)+u[13]+681279174|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^a)+u[0]-358537222|0,o=(o<<11|o>>>21)+i|0,a+=(o^i^r)+u[3]-722521979|0,a=(a<<16|a>>>16)+o|0,r+=(a^o^i)+u[6]+76029189|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^o)+u[9]-640364487|0,i=(i<<4|i>>>28)+r|0,o+=(i^r^a)+u[12]-421815835|0,o=(o<<11|o>>>21)+i|0,a+=(o^i^r)+u[15]+530742520|0,a=(a<<16|a>>>16)+o|0,r+=(a^o^i)+u[2]-995338651|0,r=(r<<23|r>>>9)+a|0,i+=(a^(r|~o))+u[0]-198630844|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~a))+u[7]+1126891415|0,o=(o<<10|o>>>22)+i|0,a+=(i^(o|~r))+u[14]-1416354905|0,a=(a<<15|a>>>17)+o|0,r+=(o^(a|~i))+u[5]-57434055|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~o))+u[12]+1700485571|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~a))+u[3]-1894986606|0,o=(o<<10|o>>>22)+i|0,a+=(i^(o|~r))+u[10]-1051523|0,a=(a<<15|a>>>17)+o|0,r+=(o^(a|~i))+u[1]-2054922799|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~o))+u[8]+1873313359|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~a))+u[15]-30611744|0,o=(o<<10|o>>>22)+i|0,a+=(i^(o|~r))+u[6]-1560198380|0,a=(a<<15|a>>>17)+o|0,r+=(o^(a|~i))+u[13]+1309151649|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~o))+u[4]-145523070|0,i=(i<<6|i>>>26)+r|0,o+=(r^(i|~a))+u[11]-1120210379|0,o=(o<<10|o>>>22)+i|0,a+=(i^(o|~r))+u[2]+718787259|0,a=(a<<15|a>>>17)+o|0,r+=(o^(a|~i))+u[9]-343485551|0,r=(r<<21|r>>>11)+a|0,c[0]=i+c[0]|0,c[1]=r+c[1]|0,c[2]=a+c[2]|0,c[3]=o+c[3]|0}function p(c){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=c.charCodeAt(i)+(c.charCodeAt(i+1)<<8)+(c.charCodeAt(i+2)<<16)+(c.charCodeAt(i+3)<<24);return u}function h(c){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=c[i]+(c[i+1]<<8)+(c[i+2]<<16)+(c[i+3]<<24);return u}function y(c){var u=c.length,i=[1732584193,-271733879,-1732584194,271733878],r,a,o,b,L,O;for(r=64;r<=u;r+=64)l(i,p(c.substring(r-64,r)));for(c=c.substring(r-64),a=c.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)o[r>>2]|=c.charCodeAt(r)<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(i,o),r=0;r<16;r+=1)o[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),L=parseInt(b[2],16),O=parseInt(b[1],16)||0,o[14]=L,o[15]=O,l(i,o),i}function d(c){var u=c.length,i=[1732584193,-271733879,-1732584194,271733878],r,a,o,b,L,O;for(r=64;r<=u;r+=64)l(i,h(c.subarray(r-64,r)));for(c=r-64<u?c.subarray(r-64):new Uint8Array(0),a=c.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)o[r>>2]|=c[r]<<(r%4<<3);if(o[r>>2]|=128<<(r%4<<3),r>55)for(l(i,o),r=0;r<16;r+=1)o[r]=0;return b=u*8,b=b.toString(16).match(/(.*?)(.{0,8})$/),L=parseInt(b[2],16),O=parseInt(b[1],16)||0,o[14]=L,o[15]=O,l(i,o),i}function E(c){var u="",i;for(i=0;i<4;i+=1)u+=t[c>>i*8+4&15]+t[c>>i*8&15];return u}function f(c){var u;for(u=0;u<c.length;u+=1)c[u]=E(c[u]);return c.join("")}f(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(n=function(c,u){var i=(c&65535)+(u&65535),r=(c>>16)+(u>>16)+(i>>16);return r<<16|i&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function c(u,i){return u=u|0||0,u<0?Math.max(u+i,0):Math.min(u,i)}ArrayBuffer.prototype.slice=function(u,i){var r=this.byteLength,a=c(u,r),o=r,b,L,O,Ne;return i!==e&&(o=c(i,r)),a>o?new ArrayBuffer(0):(b=o-a,L=new ArrayBuffer(b),O=new Uint8Array(L),Ne=new Uint8Array(this,a,b),O.set(Ne),L)}})();function T(c){return/[\u0080-\uFFFF]/.test(c)&&(c=unescape(encodeURIComponent(c))),c}function N(c,u){var i=c.length,r=new ArrayBuffer(i),a=new Uint8Array(r),o;for(o=0;o<i;o+=1)a[o]=c.charCodeAt(o);return u?a:r}function M(c){return String.fromCharCode.apply(null,new Uint8Array(c))}function ie(c,u,i){var r=new Uint8Array(c.byteLength+u.byteLength);return r.set(new Uint8Array(c)),r.set(new Uint8Array(u),c.byteLength),i?r:r.buffer}function x(c){var u=[],i=c.length,r;for(r=0;r<i-1;r+=2)u.push(parseInt(c.substr(r,2),16));return String.fromCharCode.apply(String,u)}function S(){this.reset()}return S.prototype.append=function(c){return this.appendBinary(T(c)),this},S.prototype.appendBinary=function(c){this._buff+=c,this._length+=c.length;var u=this._buff.length,i;for(i=64;i<=u;i+=64)l(this._hash,p(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},S.prototype.end=function(c){var u=this._buff,i=u.length,r,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],o;for(r=0;r<i;r+=1)a[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(a,i),o=f(this._hash),c&&(o=x(o)),this.reset(),o},S.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},S.prototype.setState=function(c){return this._buff=c.buff,this._length=c.length,this._hash=c.hash,this},S.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},S.prototype._finish=function(c,u){var i=u,r,a,o;if(c[i>>2]|=128<<(i%4<<3),i>55)for(l(this._hash,c),i=0;i<16;i+=1)c[i]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(r[2],16),o=parseInt(r[1],16)||0,c[14]=a,c[15]=o,l(this._hash,c)},S.hash=function(c,u){return S.hashBinary(T(c),u)},S.hashBinary=function(c,u){var i=y(c),r=f(i);return u?x(r):r},S.ArrayBuffer=function(){this.reset()},S.ArrayBuffer.prototype.append=function(c){var u=ie(this._buff.buffer,c,!0),i=u.length,r;for(this._length+=c.byteLength,r=64;r<=i;r+=64)l(this._hash,h(u.subarray(r-64,r)));return this._buff=r-64<i?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},S.ArrayBuffer.prototype.end=function(c){var u=this._buff,i=u.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a,o;for(a=0;a<i;a+=1)r[a>>2]|=u[a]<<(a%4<<3);return this._finish(r,i),o=f(this._hash),c&&(o=x(o)),this.reset(),o},S.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.ArrayBuffer.prototype.getState=function(){var c=S.prototype.getState.call(this);return c.buff=M(c.buff),c},S.ArrayBuffer.prototype.setState=function(c){return c.buff=N(c.buff,!0),S.prototype.setState.call(this,c)},S.ArrayBuffer.prototype.destroy=S.prototype.destroy,S.ArrayBuffer.prototype._finish=S.prototype._finish,S.ArrayBuffer.hash=function(c,u){var i=d(new Uint8Array(c)),r=f(i);return u?x(r):r},S})});var J=Le((sr,Qe)=>{"use strict";Qe.exports={}});async function nn(e){let n=(await Promise.resolve().then(()=>k(Je(),1))).default,t=new n.ArrayBuffer,s=2097152;for(let l=0;l<e.size;l+=s){let p=Math.min(l+s,e.size);t.append(await e.slice(l,p).arrayBuffer())}return{md5:t.end()}}async function rn(e){let{createHash:n}=await Promise.resolve().then(()=>k(J(),1)),t=n("md5");return t.update(e),{md5:t.digest("hex")}}async function on(e){let{createHash:n}=await Promise.resolve().then(()=>k(J(),1)),{createReadStream:t}=await Promise.resolve().then(()=>k(J(),1));return new Promise((s,l)=>{let p=n("md5"),h=t(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",()=>s({md5:p.digest("hex")}))})}async function Q(e){if(e instanceof Blob)return nn(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return rn(e);if(typeof e=="string")return on(e);throw m.business("Invalid input for MD5 calculation")}var Z=_(()=>{"use strict";D()});function ne(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var ot=_(()=>{"use strict"});function st(e,n={}){if(n.flatten===!1)return e.map(s=>({path:ne(s),name:he(s)}));let t=un(e);return e.map(s=>{let l=ne(s);if(t){let p=t.endsWith("/")?t:`${t}/`;l.startsWith(p)&&(l=l.substring(p.length))}return l||(l=he(s)),{path:l,name:he(s)}})}function un(e){if(!e.length)return"";let t=e.map(p=>ne(p)).map(p=>p.split("/")),s=[],l=Math.min(...t.map(p=>p.length));for(let p=0;p<l-1;p++){let h=t[0][p];if(t.every(y=>y[p]===h))s.push(h);else break}return s.join("/")}function he(e){return e.split(/[/\\]/).pop()||e}var ye=_(()=>{"use strict";ot()});function wr(e){ge=e}function cn(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function at(){return ge||cn()}var ge,Ee=_(()=>{"use strict";ge=null});function Te(e,n,t){let s=n.suggestions?.[t];return s?`${e} ${s}`:e}function re(e,n){return pn.find(t=>t.broken(e,n))}var pn,F,Se=_(()=>{"use strict";D();De();pn=[{name:"name",broken:({path:e})=>!Ae(e).valid,sentence:({path:e})=>Ae(e).reason??`File name "${e}" is invalid.`},{name:"extension",broken:({path:e},n)=>ve(e,n.blockedExtensions??[]),sentence:({path:e})=>`File "${e}" has an extension that is not allowed.`},{name:"fileSize",broken:({size:e},n)=>e>n.maxFileSize,sentence:({path:e},n)=>Te(`File "${e}" is too large. Maximum ${B(n.maxFileSize)} allowed.`,n,"maxFileSize")},{name:"totalSize",broken:({totalSize:e},n)=>e>n.maxTotalSize,sentence:({totalSize:e},n)=>Te(`Files add up to ${B(e)}. Maximum ${B(n.maxTotalSize)} allowed.`,n,"maxTotalSize")}],F={name:"filesCount",broken:(e,n)=>e>n.maxFilesCount,sentence:(e,n)=>Te(`Too many files (${e}). Maximum ${n.maxFilesCount} files allowed.`,n,"maxFilesCount")}});function Ae(e){let n=l=>({valid:!1,reason:`File name "${e}" ${l}.`});if(Fe(e))return n("contains unsafe characters");if(e.startsWith(" ")||e.endsWith(" "))return n("cannot start or end with spaces");if(e.endsWith("."))return n("cannot end with dots");let t=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,s=e.split("/").pop()||e;return t.test(s)?n("uses a reserved system name"):e.includes("..")?n("contains a path traversal pattern"):{valid:!0}}function Mr(e,n){let t=[],s=[],l=[];if(e.length===0){let d={file:"(no files)",message:"At least one file must be provided."};return t.push(d),{files:[],validFiles:[],errors:t,warnings:[],canDeploy:!1}}for(let d of e)if(X(d.name))return t.push({file:d.name,message:"Unbuilt project detected. Deploy your build output (dist/, build/, out/), not the project folder."}),{files:e.map(E=>({...E,status:R.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:t,warnings:[],canDeploy:!1};if(F.broken(e.length,n)){let d={file:`(${e.length} files)`,message:F.sentence(e.length,n)};return t.push(d),{files:e.map(E=>({...E,status:R.VALIDATION_FAILED,statusMessage:d.message})),validFiles:[],errors:t,warnings:[],canDeploy:!1}}let p=0;for(let d of e){let E=R.READY,f="Ready for upload";if(d.status===R.PROCESSING_ERROR)E=R.VALIDATION_FAILED,f=d.statusMessage||`File "${d.name}" could not be read.`,t.push({file:d.name,message:f});else if(d.size===0){E=R.EXCLUDED,f=`File "${d.name}" is empty, so it is excluded.`,s.push({file:d.name,message:f}),l.push({...d,status:E,statusMessage:f});continue}else if(d.size<0)E=R.VALIDATION_FAILED,f=`File "${d.name}" reports a negative size.`,t.push({file:d.name,message:f});else if(!d.name||d.name.trim().length===0)E=R.VALIDATION_FAILED,f="File name cannot be empty.",t.push({file:d.name||"(empty)",message:f});else if(d.name.includes("\0"))E=R.VALIDATION_FAILED,f=`File name "${d.name}" contains invalid characters (null byte).`,t.push({file:d.name,message:f});else{let T={path:d.name,size:d.size,totalSize:p+d.size},N=re(T,n);N?(E=R.VALIDATION_FAILED,f=N.sentence(T,n),t.push({file:N.name==="totalSize"?`(${e.length} files)`:d.name,message:f})):p=T.totalSize}l.push({...d,status:E,statusMessage:f})}t.length>0&&(l=l.map(d=>d.status===R.EXCLUDED?d:{...d,status:R.VALIDATION_FAILED,statusMessage:d.status===R.VALIDATION_FAILED?d.statusMessage:"Deployment failed due to validation errors in bundle"}));let h=t.length===0?l.filter(d=>d.status===R.READY):[],y=t.length===0;return{files:l,validFiles:h,errors:t,warnings:s,canDeploy:y}}function dn(e){return e.filter(n=>n.status===R.READY)}function Ur(e){return dn(e).length>0}var De=_(()=>{"use strict";D();Se();D()});function lt(e){return mn.test(e)}var fn,mn,ut=_(()=>{"use strict";fn=["^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(fn.join("|"))});function ct(e,n){if(!e||e.length===0)return[];if(!n?.allowUnbuilt&&e.find(s=>s&&X(s)))throw m.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return e.filter(t=>{if(!t)return!1;let s=t.replace(/\\/g,"/").split("/").filter(Boolean);if(s.length===0)return!0;let l=s[s.length-1];if(lt(l))return!1;for(let h of s)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let p=s.slice(0,-1);for(let h of p)if(hn.some(y=>h.toLowerCase()===y.toLowerCase()))return!1;return!0})}var hn,Re=_(()=>{"use strict";D();ut();hn=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function pt(e,n){if(e.includes("\0")||e.includes("/../")||e.startsWith("../")||e.endsWith("/.."))throw m.business(`Security error: Unsafe file path "${e}" for file: ${n}`)}function dt(e,n){let t=re(e,n);if(t)throw m.business(t.sentence(e,n))}function ft(e,n){if(F.broken(e,n))throw m.business(F.sentence(e,n))}var be=_(()=>{"use strict";D();Se()});async function mt(e,n={},t){let s=!!(n.build||n.prerender),l=st(e.map(f=>f.path),{flatten:n.pathDetect!==!1}).map(f=>f.path),p=new Set(ct(l,{allowUnbuilt:s})),h=e.map((f,T)=>({source:f,deployPath:l[T]})).filter(({deployPath:f})=>p.has(f));if(h.length===0)return[];let y=s?null:yn(t),d=[],E=0;for(let{source:f,deployPath:T}of h){if(y&&pt(T,f.origin),f.size===0)continue;y&&(E+=f.size,dt({path:T,size:f.size,totalSize:E},y));let N=await f.read(),{md5:M}=await Q(N);d.push({path:T,content:N,size:f.size,md5:M})}return y&&ft(d.length,y),d}function yn(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 ht=_(()=>{"use strict";D();ye();Re();Z();be()});var gt={};bt(gt,{processFilesForBrowser:()=>yt});async function yt(e,n={},t){if(at()!=="browser")throw m.business("processFilesForBrowser can only be called in a browser environment.");return mt(e.map(s=>({path:s.webkitRelativePath||s.name,origin:s.name,size:s.size,read:async()=>s})),n,t)}var Ie=_(()=>{"use strict";D();ht();Ee()});D();D();D();var Y=class{constructor(){this.handlers=new Map}on(n,t){this.handlers.has(n)||this.handlers.set(n,new Set),this.handlers.get(n)?.add(t)}off(n,t){let s=this.handlers.get(n);s&&(s.delete(t),s.size===0&&this.handlers.delete(n))}emit(n,...t){let s=this.handlers.get(n);if(!s)return;let l=Array.from(s);for(let p of l)try{p(...t)}catch(h){s.delete(p),n!=="error"&&setTimeout(()=>{let y=h instanceof Error?h:new Error(String(h));this.emit("error",y,String(n))},0)}}};var jt=3e4,Yt=2,Wt=300,Jt=2e3,Qt=new Set([500,502,503,504]);function Zt(e,n){return new Promise((t,s)=>{if(n?.aborted){s(n.reason);return}let l=()=>{clearTimeout(h),n?.removeEventListener("abort",p)},p=()=>{l(),s(n?.reason)},h=setTimeout(()=>{l(),t()},e);n?.addEventListener("abort",p)})}var qe=3e5,en=3e5,tn=qe+en,W=class extends Y{constructor(t){super();this.globalHeaders={};this.apiUrl=t.apiUrl||de,this.getAuthHeadersCallback=t.getAuthHeaders,this.session=t.session??!1,this.caller=t.caller,this.timeout=t.timeout??jt,this.maxRetries=Math.max(0,t.maxRetries??Yt),this.fetch=t.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:t.deployEndpoint||A.DEPLOYMENTS,timeout:t.timeout??qe,buildTimeout:t.timeout??tn}}setGlobalHeaders(t){this.globalHeaders=t}async executeRequest(t,s,l,p=this.timeout){for(let h=0;;h++)try{return await this.attemptOnce(t,s,l,p)}catch(y){let d=m.fromFetchError(y,l);if(h>=this.maxRetries||!this.isRetryable(d,s))throw this.emit("error",d,t),d;this.emit("retry",d,t,h+1);let E=Math.min(Jt,Wt*2**h);try{await Zt(Math.random()*E,s.signal)}catch(f){let T=m.fromFetchError(f,l);throw this.emit("error",T,t),T}}}isRetryable(t,s){if(s.signal?.aborted||t.isType(g.Maintenance)||t.isType(g.Cancelled)||!(t.isNetworkError()||t.status!==void 0&&Qt.has(t.status)))return!1;let p=(s.method??"GET").toUpperCase();return p==="GET"||p==="HEAD"?!0:p==="PUT"||p==="DELETE"?!1:this.hasIdempotencyKey(s.headers)}hasIdempotencyKey(t){if(!t)return!1;let s=v.HEADER.toLowerCase();return Object.keys(t).some(l=>l.toLowerCase()===s)}async attemptOnce(t,s,l,p=this.timeout){let h=()=>{};try{let y=await this.mergeHeaders(s.headers),d=this.createTimeoutSignal(s.signal,p);h=d.cleanup;let E={...s,headers:y,credentials:this.session&&!y.Authorization?"include":void 0,signal:d.signal};this.emit("request",t,E);let f=await this.fetch(t,E);if(h(),!f.ok)throw await m.fromHttpResponse(f,l);return this.emit("response",this.safeClone(f),t),{data:await this.parseResponse(this.safeClone(f)),status:f.status}}catch(y){throw h(),m.fromFetchError(y,l)}}async request(t,s,l,p){let{data:h}=await this.executeRequest(`${this.apiUrl}${t}`,s,l,p);return h}async requestWithStatus(t,s,l){return this.executeRequest(`${this.apiUrl}${t}`,s,l)}async mergeHeaders(t={}){return{...this.globalHeaders,...this.caller?{[U.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...t}}createTimeoutSignal(t,s=this.timeout){let l=new AbortController,p=setTimeout(()=>l.abort(new DOMException(`Timed out after ${s}ms`,"TimeoutError")),s),h=t?()=>l.abort(t.reason):void 0;return t&&h&&(t.addEventListener("abort",h),t.aborted&&l.abort(t.reason)),{signal:l.signal,cleanup:()=>{clearTimeout(p),t&&h&&t.removeEventListener("abort",h)}}}safeClone(t){try{return t.clone()}catch{return t}}async parseResponse(t){if(!(t.headers.get("Content-Length")==="0"||t.status===204))return t.json()}};D();D();async function je(e,n={}){let{labels:t,via:s,password:l,ttl:p,flags:h,captcha:y}=n,d=new FormData,E=[];for(let f of e){if(typeof f.content=="string"||f.content===null||f.content===void 0)throw m.file(`Unsupported file.content type: ${f.path}`,{filePath:f.path});if(!f.md5)throw m.file(`File missing md5 checksum: ${f.path}`,{filePath:f.path});d.append(I.FILES,new File([f.content],f.path,{type:"application/octet-stream"})),E.push(f.md5)}return d.append(I.CHECKSUMS,JSON.stringify(E)),t&&t.length>0&&d.append(I.LABELS,JSON.stringify(t)),s&&d.append(I.VIA,s),l&&d.append(I.PASSWORD,l),p!==void 0&&d.append(I.TTL,String(p)),h?.build&&d.append(I.BUILD,"true"),h?.prerender&&d.append(I.PRERENDER,"true"),h?.spa&&d.append(I.SPA,"true"),h?.buildCommand&&d.append(I.BUILD_COMMAND,h.buildCommand),h?.outputDir&&d.append(I.OUTPUT_DIR,h.outputDir),y&&d.append(I.CAPTCHA,y),d}D();Z();async function sn(){let e=JSON.stringify(Be,null,2),n;typeof Buffer<"u"?n=Buffer.from(e,"utf-8"):n=new Blob([e],{type:"application/json"});let{md5:t}=await Q(n);return{path:w,content:n,size:e.length,md5:t}}async function an(e,n,t){let s=e.find(y=>y.path===q.INDEX_FILE||y.path===`/${q.INDEX_FILE}`);if(!s||s.size>q.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 n.request(A.SPA_CHECK,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p),signal:t??null},"SPA check")).isSPA}async function Ze(e,n,t){return t.spaDetect===!1||t.spa||t.build||t.prerender||e.some(s=>s.path===w)?e:await an(e,n,t.signal)?[...e,await sn()]:e}D();D();function H(e){if(e==null)return;if(e.length===0)return e;if(e.length>C.MAX_COUNT)throw m.validation(`Maximum ${C.MAX_COUNT} labels allowed`);let n=e.map((s,l)=>{if(typeof s!="string")throw m.validation(`Label at index ${l} must be a string`);let p=s.trim().toLowerCase();if(p.length<C.MIN_LENGTH)throw m.validation(`Labels must be at least ${C.MIN_LENGTH} characters long`);if(p.length>C.MAX_LENGTH)throw m.validation(`Labels must be no more than ${C.MAX_LENGTH} characters long`);if(!Ve.test(p))throw m.validation(`Labels must start and end with alphanumeric characters, with optional separators (${C.SEPARATORS}) between segments`);return p}),t=[...new Set(n)];if(t.length!==n.length)throw m.validation("Duplicate labels are not allowed");return t}async function et(e){let n=e.find(l=>l.path===w||l.path===`/${w}`);if(!n)return;let t=n.content,s=typeof t.text=="function"?await t.text():n.content.toString("utf8");He(s)}var ee={"Content-Type":"application/json"},ln="sdk";function me(e){let n=new URLSearchParams;e?.limit!==void 0&&n.set("limit",String(e.limit)),e?.cursor!==void 0&&n.set("cursor",e.cursor);let t=n.toString();return t?`?${t}`:""}function tt(e){let{getApi:n,processInput:t}=e;return{upload:async(s,l={})=>{if(!t)throw m.config("processInput function is not provided.");let p=n(),h=await t(s,l),y=await Ze(h,p,l);if(!y.length)throw m.business("No files to deploy");for(let x of y)if(!x.md5)throw m.file(`MD5 checksum missing for file: ${x.path}`,{filePath:x.path});fe(l.password);let d=pe(l.ttl),E=Pe(l.idempotencyKey),f=H(l.labels);await et(y);let T=ze(l.buildCommand),N=Xe(l.outputDir),M=l.build||l.prerender||l.spa?{build:l.build,prerender:l.prerender,spa:l.spa,buildCommand:T,outputDir:N}:void 0,ie=await je(y,{labels:f,via:l.via??ln,password:l.password,ttl:d,flags:M,captcha:l.captcha});return p.request(p.deploy.endpoint,{method:"POST",body:ie,...E?{headers:{[v.HEADER]:E}}:{},signal:l.signal||null},"Deploy",l.build||l.prerender?p.deploy.buildTimeout:p.deploy.timeout)},list:async s=>n().request(`${A.DEPLOYMENTS}${me(s)}`,{method:"GET"},"List deployments"),get:async s=>n().request(A.DEPLOYMENT(encodeURIComponent(s)),{method:"GET"},"Get deployment"),set:async(s,l)=>n().request(A.DEPLOYMENT(encodeURIComponent(s)),{method:"PATCH",headers:ee,body:JSON.stringify({labels:H(l.labels)})},"Update deployment labels"),delete:async s=>n().request(A.DEPLOYMENT(encodeURIComponent(s)),{method:"DELETE"},"Delete deployment")}}function nt(e){let{getApi:n}=e;return{set:async(t,s={})=>{let l=H(s.labels),p={};s.deployment&&(p.deployment=s.deployment),l!==void 0&&(p.labels=l);let{data:h,status:y}=await n().requestWithStatus(A.DOMAIN(encodeURIComponent(t)),{method:"PUT",headers:ee,body:JSON.stringify(p)},"Set domain");return{...h,isCreate:y===201}},list:async t=>n().request(`${A.DOMAINS}${me(t)}`,{method:"GET"},"List domains"),get:async t=>n().request(A.DOMAIN(encodeURIComponent(t)),{method:"GET"},"Get domain"),delete:async t=>n().request(A.DOMAIN(encodeURIComponent(t)),{method:"DELETE"},"Delete domain"),verify:async t=>n().request(A.DOMAIN_VERIFY(encodeURIComponent(t)),{method:"POST"},"Verify domain"),validate:async t=>n().request(A.DOMAINS_VALIDATE,{method:"POST",headers:ee,body:JSON.stringify({domain:t})},"Validate domain"),dns:async t=>n().request(A.DOMAIN_DNS(encodeURIComponent(t)),{method:"GET"},"Get domain DNS"),records:async t=>n().request(A.DOMAIN_RECORDS(encodeURIComponent(t)),{method:"GET"},"Get domain records"),share:async t=>n().request(A.DOMAIN_SHARE(encodeURIComponent(t)),{method:"GET"},"Get domain share")}}function rt(e){let{getApi:n}=e;return{get:async()=>n().request(A.ACCOUNT,{method:"GET"},"Get account")}}function it(e){let{getApi:n}=e;return{create:async(t={})=>{let s=pe(t.ttl),l=H(t.labels),p={};return s!==void 0&&(p.ttl=s),l!==void 0&&(p.labels=l),n().request(A.TOKENS,{method:"POST",headers:ee,body:JSON.stringify(p)},"Create token")},list:async t=>n().request(`${A.TOKENS}${me(t)}`,{method:"GET"},"List tokens"),get:async t=>n().request(A.TOKEN(encodeURIComponent(t)),{method:"GET"},"Get token"),delete:async t=>n().request(A.TOKEN(encodeURIComponent(t)),{method:"DELETE"},"Delete token")}}var te=class{constructor(n={}){this.credential=null;if(n={...n,apiUrl:n.apiUrl||void 0,token:n.token||void 0,caller:n.caller||void 0},this.clientOptions=n,n.caller!==void 0&&Ge(n.caller),n.token&&n.session)throw m.config("Provide either `token` or `session`, not both.");typeof n.token=="string"?(ce(n.token),this.credential=n.token):n.token&&(this.credential=n.token),this.http=new W({...n,getAuthHeaders:()=>this.getAuthHeaders()});let t={getApi:()=>this.http};this.deployments=tt({...t,processInput:async(s,l)=>this.processInput(s,l,await this.getLimits({signal:l.signal}))}),this.domains=nt(t),this.account=rt(t),this.tokens=it(t)}async ping(){return this.http.request(A.PING,{method:"GET"},"Ping")}async deploy(n,t){return this.deployments.upload(n,t)}async whoami(){return this.account.get()}async getLimits(n={}){return this.http.request(A.LIMITS,{method:"GET",signal:n.signal??null},"Get limits")}on(n,t){this.http.on(n,t)}off(n,t){this.http.off(n,t)}setHeaders(n){this.http.setGlobalHeaders(n)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(n){if(this.clientOptions.session)throw m.config("Provide either `token` or `session`, not both.");if(typeof n=="string"){if(!n)throw m.business("Invalid token provided. Token must be a non-empty string.");ce(n),this.credential=n;return}if(typeof n!="function")throw m.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=n}async getAuthHeaders(){if(this.credential===null)return{};let n=typeof this.credential=="function"?await this.credential():this.credential;if(!n)throw m.authentication("Token provider returned no token.");if(typeof n!="string")throw m.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${n}`}}};D();D();ye();Ee();De();Re();Z();be();function qr(e,n,t,s=!0){let l=e===1?n:t;return s?`${e} ${l}`:l}Ie();var _e=class extends te{async deploy(n,t){return super.deploy(n,t)}async processInput(n,t,s){if(!Array.isArray(n)||!n.every(p=>p instanceof File))throw m.business("Invalid input type for browser environment. Expected File[].");if(n.length===0)throw m.business("No files to deploy.");let{processFilesForBrowser:l}=await Promise.resolve().then(()=>(Ie(),gt));return l(n,t,s)}},Ti=_e;export{On as ACCOUNT_HEADER,Me as API_KEY,A as API_PATHS,wn as AUTH_BASE_PATH,Rn as AccountPlan,bn as AccountRefusal,W as ApiHttp,se as AuthMethod,$ as BUILD_SETTINGS,U as CALLER,de as DEFAULT_API,w as DEPLOYMENT_CONFIG_FILENAME,I as DEPLOY_FIELDS,Nn as DEPLOY_FILE_GRAMMAR,Ue as DEPLOY_TOKEN,En as DeploymentStatus,_t as DeploymentVia,Tn as DomainStatus,An as DomainVerification,g as ErrorType,R as FILE_VALIDATION_STATUS,R as FileValidationStatus,v as IDEMPOTENCY_KEY_CONSTRAINTS,hn as JUNK_DIRECTORIES,C as LABEL_CONSTRAINTS,Ve as LABEL_PATTERN,kn as MY_API_KEY_URL,$e as OAUTH_TOKEN,Cn as OAuthScope,z as PASSWORD_CONSTRAINTS,Kn as PUBLIC_DEPLOYMENT_TTL_SECONDS,Bt as SECTIONS,Sn as SETUP_TROUBLESHOOTING_ANCHOR,Hn as SHIP_ENV,Gn as SHIP_VIA_ENV,xn as SIGN_IN_RETURN_PARAM,q as SPA_CHECK_CONSTRAINTS,Be as SPA_DEFAULT_CONFIG,_e as Ship,m as ShipError,V as TTL_CONSTRAINTS,P as TokenKind,vt as UNBUILT_PROJECT_MARKERS,Ct as UNSAFE_FILENAME_CHARS,zn as USER_VISIBLE_EVENTS,Ln as WEB_FILE_ACCEPT,wr as __setTestEnvironment,$n as accountOfPath,Ur as allValidFilesReady,He as assertShipJsonSyntax,Un as billingReturnOf,Q as calculateMD5,Ft as classifyToken,kt as consolePaths,rt as createAccountResource,tt as createDeploymentResource,nt as createDomainResource,it as createTokenResource,Ti as default,Jn as deserializeLabels,Mn as doors,Bn as errandOf,qn as extractSubdomain,ct as filterJunk,qt as formatDuration,B as formatFileSize,Vn as formatTimeRemaining,jn as generateDeploymentUrl,Yn as generateDomainUrl,at as getENV,dn as getValidFiles,X as hasUnbuiltMarker,Fe as hasUnsafeChars,ve as isBlockedExtension,Vt as isClaimPath,Xn as isCustomDomain,Fn as isDeployment,zt as isInvitationPath,Ke as isPlatformDomain,Ce as isShipError,Xt as isUpgradePath,Dn as normalizeVia,st as optimizeDeployPaths,In as personName,_n as personShortName,qr as pluralize,yt as processFilesForBrowser,Pn as readBearerValue,Wn as serializeLabels,Mt as validateApiKey,vn as validateApiUrl,ze as validateBuildCommand,Ge as validateCaller,ft as validateDeployCount,dt as validateDeployFile,pt as validateDeployPath,Ut as validateDeployToken,Ae as validateFileName,Mr as validateFiles,Pe as validateIdempotencyKey,$t as validateOAuthToken,Xe as validateOutputDir,fe as validatePassword,ce as validateToken,pe as validateTtl};
1
+ var St=Object.create;var G=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var bt=Object.getOwnPropertyNames;var Rt=Object.getPrototypeOf,It=Object.prototype.hasOwnProperty;var _t=(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),Lt=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},Nt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of bt(t))!It.call(e,l)&&l!==n&&G(e,l,{get:()=>t[l],enumerable:!(o=Dt(t,l))||o.enumerable});return e};var k=(e,t,n)=>(n=e!=null?St(Rt(e)):{},Nt(t||!e||!e.__esModule?G(n,"default",{value:e,enumerable:!0}):n,e));var K=(e,t,n)=>_t(e,typeof t!="symbol"?t+"":t,n);function Ln(e){if(!e||typeof e!="string")return;let t=e.trim().toLowerCase();return Object.values(xt).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 Ot(e){return e.members+e.invitations}function xn(e,t){let n=Math.max(0,Ot(e)-t.members),o=Math.max(0,e.members-t.members),l={members:o,invitations:n-o,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 Pn(e){return e.name?.trim()||e.email}function vn(e){return e.name?.trim().split(" ")[0]||e.email}function Ft(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 Mt(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=Mt(e);return n===null?!1:Array.isArray(t)?t.includes(n):t.has(n)}function $e(e){return $t.test(e)}function j(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>Bt.has(n))}function Ht(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 $n(e){return e.slice(0,ae.length).toLowerCase()!==ae?null:e.slice(ae.length)||null}function Ke(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,n;try{n=JSON.parse(t)}catch(o){throw m.config(`invalid JSON format in config: ${o.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 o=e.slice(t.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${t.HEX_LENGTH}}$`,"i").test(o))throw m.validation(`${n} must contain ${t.HEX_LENGTH} hexadecimal characters after "${t.PREFIX}" prefix`)}function Gt(e){ce(e,Be,"API key")}function kt(e){ce(e,He,"Deploy token")}function Kt(e){ce(e,Ge,"OAuth access token")}function pe(e){switch(Ht(e)){case P.API_KEY:Gt(e);return;case P.DEPLOY_TOKEN:kt(e);return;case P.OAUTH:Kt(e);return;case P.OPAQUE:if(!e)throw m.validation("Token must be a non-empty string")}}function Ve(e){if(!e||e.length>U.MAX_LENGTH||!U.PATTERN.test(e))throw m.validation(`Caller must be 1-${U.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function Hn(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 Gn(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<V.MIN_SECONDS||e>V.MAX_SECONDS)throw m.validation(`TTL must be between ${V.MIN_SECONDS} and ${V.MAX_SECONDS} seconds`);return e}}function Xt(e){let t=e?`/${e}`:"",n=o=>`${t}${o}`;return{dashboard:()=>t||"/",newSite:()=>n("/new"),deployments:Object.assign(()=>n("/deployments"),{upload:()=>n("/deployments/upload")}),domains:Object.assign(()=>n("/domains"),{connect:o=>n(`/domains/${o}/connect`),deployment:o=>n(`/domains/${o}/deployment`)}),settings:o=>n(o?`/settings#${o}`:"/settings"),claim:o=>n(`/claim/${o}`),settingsAfterBilling:()=>n(`/settings?${we("portal")}`),upgrade:o=>n(o?`/upgrade/${o}`:"/upgrade"),success:()=>n("/success"),successAfterCheckout:()=>n(`/success?${we("checkout")}`),apiKey:()=>n("/api-key")}}function Kn(e){let t=new URLSearchParams(e);for(let[n,[o,l]]of Object.entries(ze))if(t.get(o)===l)return n;return null}function q(e){let t=e.split(/[?#]/)[0].toLowerCase(),[n="",o=""]=t.split("/").filter(Boolean);return qt(n)?{kind:"door",door:n}:n===jt?{kind:"admin"}:n===""||Pe(n)?{kind:"account",account:null,section:n===""?null:n}:{kind:"account",account:n,section:Pe(o)?o:null}}function Vn(e){let t=q(e);return t.kind==="account"?t.account:null}function Yt(e){let t=q(e);return t.kind==="door"?t.door:null}function zn(e){return Wt(e)?"claim":Yt(e)==="invitation"?"invite":Jt(e)?"upgrade":null}function Qt(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 Wn(e,t=Date.now()/1e3){let n=e-t;return n>0?Qt(n):null}function ue(e,t){return`${e} ${t}${e===1?"":"s"}`}function B(e,t=1){if(e===0)return"0 Bytes";let n=1024,o=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**l).toFixed(t))} ${o[l]}`}function je(e,t){return e.endsWith(`.${t}`)}function Qn(e,t){return!je(e,t)}function Zn(e,t){return je(e,t)?e.slice(0,-(t.length+1)):null}function er(e){return`https://${e}`}function tr(e){return`https://${e}`}function nr(e){return!e||e.length===0?null:JSON.stringify(e)}function rr(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 m.validation("Build command must be a string");let t=e.trim();if(t.length===0||t.length>$.COMMAND_MAX_LENGTH)throw m.validation(`Build command must be between 1 and ${$.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(t))throw m.validation("Build command must be a single line");return t}function Ye(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>$.OUTPUT_DIR_MAX_LENGTH)throw m.validation(`Output folder must be between 1 and ${$.OUTPUT_DIR_MAX_LENGTH} characters`);if(!$.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<z.MIN_LENGTH||t.length>z.MAX_LENGTH)throw m.validation(`Password must be between ${z.MIN_LENGTH} and ${z.MAX_LENGTH} characters`);return t}var bn,xt,Rn,In,_n,C,Nn,Oe,Ce,Fe,wn,A,I,Cn,g,Pt,oe,vt,Ct,m,Ut,Fn,$t,Bt,Mn,se,Be,He,Ge,U,Un,P,ae,Bn,x,ke,X,V,Vt,zt,jt,ze,we,le,kn,qt,Pe,Wt,Jt,de,jn,Xn,qn,Yn,Jn,b,v,Xe,$,z,D=_(()=>{"use strict";bn={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},xt={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc",CLD:"cld",CRS:"crs",GMN:"gmn",API:"api"},Rn={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},In={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},_n="troubleshooting",C={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};Nn={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"};Oe={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?Oe[e].one:Oe[e].many}`,Fe=e=>e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e[0]??"",wn={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"},Cn={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"},Pt=new Set([g.Network,g.Timeout,g.Cancelled,g.File,g.Config]),oe={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])},vt=new Set(Object.values(g).filter(e=>!Pt.has(e))),Ct=200;m=class e extends Error{constructor(n,o,l,p){super(o);K(this,"type");K(this,"status");K(this,"details");this.type=n,this.status=l,this.details=p,this.name="ShipError"}toResponse(){let n=this.details,o=this.type===g.Authentication&&n?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:o}}static async fromHttpResponse(n,o){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"&&vt.has(T.error)&&(h=T.error)}}else{let d=(await n.text()).trim();d&&!d.startsWith("<")&&d.length<=Ct&&(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||`${o||"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,o){if(Me(n))return n;let l=o||"Request",p=n?.name;return p==="AbortError"?e.cancelled(`${l} was cancelled`):p==="TimeoutError"?e.timeout(`${l} timed out`,{cause:n}):n instanceof Error?Ft(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,o){return new e(g.Validation,n,400,o)}static notFound(n,o){let l=o?`${n} ${o} not found`:`${n} not found`;return new e(g.NotFound,l,404)}static forbidden(n,o){return new e(g.Forbidden,n,403,o)}static rateLimit(n="Too many requests",o){return new e(g.RateLimit,n,429,o)}static authentication(n="Authentication required",o){return new e(g.Authentication,n,401,o)}static business(n,o=400,l){return new e(g.Business,n,o,l)}static network(n,o){return new e(g.Network,n,void 0,o)}static timeout(n,o){return new e(g.Timeout,n,void 0,o)}static cancelled(n,o){return new e(g.Cancelled,n,void 0,o)}static file(n,o){return new e(g.File,n,void 0,o)}static config(n,o){return new e(g.Config,n,void 0,o)}static api(n,o=500,l){return new e(g.Api,n,o,l)}static maintenance(n,o){return new e(g.Maintenance,n,503,o)}static build(n,o){return new e(g.Build,n,422,o)}isClientError(){return oe.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return oe.network.has(this.type)}isAuthError(){return oe.auth.has(this.type)}isType(n){return this.type===n}};Ut=["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"],Fn=Ut.map(e=>`.${e}`).join(","),$t=/[\x00-\x1f\x7f#?%\\<>"]/;Bt=new Set(["node_modules","package.json"]);Mn="/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},U={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},Un="X-Account",P={API_KEY:se.API_KEY,DEPLOY_TOKEN:se.TOKEN,OAUTH:se.OAUTH,OPAQUE:"opaque"};ae="bearer ";Bn={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};V={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};Vt={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}},zt=["login","register","logout","invitation","consent"],jt="admin",ze={checkout:["upgrading","true"],portal:["billing","returned"]},we=e=>ze[e].join("="),le=(e,t)=>t?`${e}?next=${encodeURIComponent(t)}`:e;kn={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"};qt=e=>zt.includes(e),Pe=e=>Object.hasOwn(Vt,e);Wt=e=>{let t=q(e);return t.kind==="account"&&t.section==="claim"},Jt=e=>{let t=q(e);return t.kind==="account"&&t.section==="upgrade"};de="https://api.shipstatic.com",jn={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},Xn="SHIP_VIA",qn=`https://my.shipstatic.com${Xt().apiKey()}`,Yn=4320*60;Jn=["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:25,MAX_COUNT:10,SEPARATORS:"._-"},Xe=/^[a-z0-9]+(?:[._-][a-z0-9]+)*$/;$={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};z={MIN_LENGTH:6,MAX_LENGTH:128}});var et=xe((Qe,Ze)=>{"use strict";(function(e){if(typeof Qe=="object")Ze.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 o(c,u,i,r,a,s){return u=t(t(u,c),t(r,s)),t(u<<a|u>>>32-a,i)}function l(c,u){var i=c[0],r=c[1],a=c[2],s=c[3];i+=(r&a|~r&s)+u[0]-680876936|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&a)+u[1]-389564586|0,s=(s<<12|s>>>20)+i|0,a+=(s&i|~s&r)+u[2]+606105819|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&i)+u[3]-1044525330|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&s)+u[4]-176418897|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&a)+u[5]+1200080426|0,s=(s<<12|s>>>20)+i|0,a+=(s&i|~s&r)+u[6]-1473231341|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&i)+u[7]-45705983|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&s)+u[8]+1770035416|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&a)+u[9]-1958414417|0,s=(s<<12|s>>>20)+i|0,a+=(s&i|~s&r)+u[10]-42063|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&i)+u[11]-1990404162|0,r=(r<<22|r>>>10)+a|0,i+=(r&a|~r&s)+u[12]+1804603682|0,i=(i<<7|i>>>25)+r|0,s+=(i&r|~i&a)+u[13]-40341101|0,s=(s<<12|s>>>20)+i|0,a+=(s&i|~s&r)+u[14]-1502002290|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&i)+u[15]+1236535329|0,r=(r<<22|r>>>10)+a|0,i+=(r&s|a&~s)+u[1]-165796510|0,i=(i<<5|i>>>27)+r|0,s+=(i&a|r&~a)+u[6]-1069501632|0,s=(s<<9|s>>>23)+i|0,a+=(s&r|i&~r)+u[11]+643717713|0,a=(a<<14|a>>>18)+s|0,r+=(a&i|s&~i)+u[0]-373897302|0,r=(r<<20|r>>>12)+a|0,i+=(r&s|a&~s)+u[5]-701558691|0,i=(i<<5|i>>>27)+r|0,s+=(i&a|r&~a)+u[10]+38016083|0,s=(s<<9|s>>>23)+i|0,a+=(s&r|i&~r)+u[15]-660478335|0,a=(a<<14|a>>>18)+s|0,r+=(a&i|s&~i)+u[4]-405537848|0,r=(r<<20|r>>>12)+a|0,i+=(r&s|a&~s)+u[9]+568446438|0,i=(i<<5|i>>>27)+r|0,s+=(i&a|r&~a)+u[14]-1019803690|0,s=(s<<9|s>>>23)+i|0,a+=(s&r|i&~r)+u[3]-187363961|0,a=(a<<14|a>>>18)+s|0,r+=(a&i|s&~i)+u[8]+1163531501|0,r=(r<<20|r>>>12)+a|0,i+=(r&s|a&~s)+u[13]-1444681467|0,i=(i<<5|i>>>27)+r|0,s+=(i&a|r&~a)+u[2]-51403784|0,s=(s<<9|s>>>23)+i|0,a+=(s&r|i&~r)+u[7]+1735328473|0,a=(a<<14|a>>>18)+s|0,r+=(a&i|s&~i)+u[12]-1926607734|0,r=(r<<20|r>>>12)+a|0,i+=(r^a^s)+u[5]-378558|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^a)+u[8]-2022574463|0,s=(s<<11|s>>>21)+i|0,a+=(s^i^r)+u[11]+1839030562|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^i)+u[14]-35309556|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^s)+u[1]-1530992060|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^a)+u[4]+1272893353|0,s=(s<<11|s>>>21)+i|0,a+=(s^i^r)+u[7]-155497632|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^i)+u[10]-1094730640|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^s)+u[13]+681279174|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^a)+u[0]-358537222|0,s=(s<<11|s>>>21)+i|0,a+=(s^i^r)+u[3]-722521979|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^i)+u[6]+76029189|0,r=(r<<23|r>>>9)+a|0,i+=(r^a^s)+u[9]-640364487|0,i=(i<<4|i>>>28)+r|0,s+=(i^r^a)+u[12]-421815835|0,s=(s<<11|s>>>21)+i|0,a+=(s^i^r)+u[15]+530742520|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^i)+u[2]-995338651|0,r=(r<<23|r>>>9)+a|0,i+=(a^(r|~s))+u[0]-198630844|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~a))+u[7]+1126891415|0,s=(s<<10|s>>>22)+i|0,a+=(i^(s|~r))+u[14]-1416354905|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~i))+u[5]-57434055|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~s))+u[12]+1700485571|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~a))+u[3]-1894986606|0,s=(s<<10|s>>>22)+i|0,a+=(i^(s|~r))+u[10]-1051523|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~i))+u[1]-2054922799|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~s))+u[8]+1873313359|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~a))+u[15]-30611744|0,s=(s<<10|s>>>22)+i|0,a+=(i^(s|~r))+u[6]-1560198380|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~i))+u[13]+1309151649|0,r=(r<<21|r>>>11)+a|0,i+=(a^(r|~s))+u[4]-145523070|0,i=(i<<6|i>>>26)+r|0,s+=(r^(i|~a))+u[11]-1120210379|0,s=(s<<10|s>>>22)+i|0,a+=(i^(s|~r))+u[2]+718787259|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~i))+u[9]-343485551|0,r=(r<<21|r>>>11)+a|0,c[0]=i+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=[],i;for(i=0;i<64;i+=4)u[i>>2]=c.charCodeAt(i)+(c.charCodeAt(i+1)<<8)+(c.charCodeAt(i+2)<<16)+(c.charCodeAt(i+3)<<24);return u}function h(c){var u=[],i;for(i=0;i<64;i+=4)u[i>>2]=c[i]+(c[i+1]<<8)+(c[i+2]<<16)+(c[i+3]<<24);return u}function y(c){var u=c.length,i=[1732584193,-271733879,-1732584194,271733878],r,a,s,R,N,w;for(r=64;r<=u;r+=64)l(i,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(i,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),w=parseInt(R[1],16)||0,s[14]=N,s[15]=w,l(i,s),i}function f(c){var u=c.length,i=[1732584193,-271733879,-1732584194,271733878],r,a,s,R,N,w;for(r=64;r<=u;r+=64)l(i,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(i,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),w=parseInt(R[1],16)||0,s[14]=N,s[15]=w,l(i,s),i}function E(c){var u="",i;for(i=0;i<4;i+=1)u+=n[c>>i*8+4&15]+n[c>>i*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 i=(c&65535)+(u&65535),r=(c>>16)+(u>>16)+(i>>16);return r<<16|i&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function c(u,i){return u=u|0||0,u<0?Math.max(u+i,0):Math.min(u,i)}ArrayBuffer.prototype.slice=function(u,i){var r=this.byteLength,a=c(u,r),s=r,R,N,w,Ne;return i!==e&&(s=c(i,r)),a>s?new ArrayBuffer(0):(R=s-a,N=new ArrayBuffer(R),w=new Uint8Array(N),Ne=new Uint8Array(this,a,R),w.set(Ne),N)}})();function T(c){return/[\u0080-\uFFFF]/.test(c)&&(c=unescape(encodeURIComponent(c))),c}function L(c,u){var i=c.length,r=new ArrayBuffer(i),a=new Uint8Array(r),s;for(s=0;s<i;s+=1)a[s]=c.charCodeAt(s);return u?a:r}function M(c){return String.fromCharCode.apply(null,new Uint8Array(c))}function ie(c,u,i){var r=new Uint8Array(c.byteLength+u.byteLength);return r.set(new Uint8Array(c)),r.set(new Uint8Array(u),c.byteLength),i?r:r.buffer}function O(c){var u=[],i=c.length,r;for(r=0;r<i-1;r+=2)u.push(parseInt(c.substr(r,2),16));return String.fromCharCode.apply(String,u)}function S(){this.reset()}return S.prototype.append=function(c){return this.appendBinary(T(c)),this},S.prototype.appendBinary=function(c){this._buff+=c,this._length+=c.length;var u=this._buff.length,i;for(i=64;i<=u;i+=64)l(this._hash,p(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},S.prototype.end=function(c){var u=this._buff,i=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<i;r+=1)a[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(a,i),s=d(this._hash),c&&(s=O(s)),this.reset(),s},S.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},S.prototype.setState=function(c){return this._buff=c.buff,this._length=c.length,this._hash=c.hash,this},S.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},S.prototype._finish=function(c,u){var i=u,r,a,s;if(c[i>>2]|=128<<(i%4<<3),i>55)for(l(this._hash,c),i=0;i<16;i+=1)c[i]=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)},S.hash=function(c,u){return S.hashBinary(T(c),u)},S.hashBinary=function(c,u){var i=y(c),r=d(i);return u?O(r):r},S.ArrayBuffer=function(){this.reset()},S.ArrayBuffer.prototype.append=function(c){var u=ie(this._buff.buffer,c,!0),i=u.length,r;for(this._length+=c.byteLength,r=64;r<=i;r+=64)l(this._hash,h(u.subarray(r-64,r)));return this._buff=r-64<i?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},S.ArrayBuffer.prototype.end=function(c){var u=this._buff,i=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<i;a+=1)r[a>>2]|=u[a]<<(a%4<<3);return this._finish(r,i),s=d(this._hash),c&&(s=O(s)),this.reset(),s},S.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.ArrayBuffer.prototype.getState=function(){var c=S.prototype.getState.call(this);return c.buff=M(c.buff),c},S.ArrayBuffer.prototype.setState=function(c){return c.buff=L(c.buff,!0),S.prototype.setState.call(this,c)},S.ArrayBuffer.prototype.destroy=S.prototype.destroy,S.ArrayBuffer.prototype._finish=S.prototype._finish,S.ArrayBuffer.hash=function(c,u){var i=f(new Uint8Array(c)),r=d(i);return u?O(r):r},S})});var J=xe((fr,tt)=>{"use strict";tt.exports={}});async function ln(e){let t=(await Promise.resolve().then(()=>k(et(),1))).default,n=new t.ArrayBuffer,o=2097152;for(let l=0;l<e.size;l+=o){let p=Math.min(l+o,e.size);n.append(await e.slice(l,p).arrayBuffer())}return{md5:n.end()}}async function un(e){let{createHash:t}=await Promise.resolve().then(()=>k(J(),1)),n=t("md5");return n.update(e),{md5:n.digest("hex")}}async function cn(e){let{createHash:t}=await Promise.resolve().then(()=>k(J(),1)),{createReadStream:n}=await Promise.resolve().then(()=>k(J(),1));return new Promise((o,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",()=>o({md5:p.digest("hex")}))})}async function Q(e){if(e instanceof Blob)return ln(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return un(e);if(typeof e=="string")return cn(e);throw m.business("Invalid input for MD5 calculation")}var Z=_(()=>{"use strict";D()});function ne(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var lt=_(()=>{"use strict"});function ut(e,t={}){if(t.flatten===!1)return e.map(o=>({path:ne(o),name:ye(o)}));let n=mn(e);return e.map(o=>{let l=ne(o);if(n){let p=n.endsWith("/")?n:`${n}/`;l.startsWith(p)&&(l=l.substring(p.length))}return l||(l=ye(o)),{path:l,name:ye(o)}})}function mn(e){if(!e.length)return"";let n=e.map(p=>ne(p)).map(p=>p.split("/")),o=[],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))o.push(h);else break}return o.join("/")}function ye(e){return e.split(/[/\\]/).pop()||e}var ge=_(()=>{"use strict";lt()});function Fr(e){Ee=e}function hn(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function ct(){return Ee||hn()}var Ee,Te=_(()=>{"use strict";Ee=null});function Ae(e,t,n){let o=t.suggestions?.[n];return o?`${e} ${o}`:e}function re(e,t){return yn.find(n=>n.broken(e,t))}var yn,F,De=_(()=>{"use strict";D();be();yn=[{name:"name",broken:({path:e})=>!Se(e).valid,sentence:({path:e})=>Se(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 ${B(t.maxFileSize)} allowed.`,t,"maxFileSize")},{name:"totalSize",broken:({totalSize:e},t)=>e>t.maxTotalSize,sentence:({totalSize:e},t)=>Ae(`Files add up to ${B(e)}. Maximum ${B(t.maxTotalSize)} allowed.`,t,"maxTotalSize")}],F={name:"filesCount",broken:(e,t)=>e>t.maxFilesCount,sentence:(e,t)=>Ae(`Too many files (${e}). Maximum ${t.maxFilesCount} files allowed.`,t,"maxFilesCount")}});function Se(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,o=e.split("/").pop()||e;return n.test(o)?t("uses a reserved system name"):e.includes("..")?t("contains a path traversal pattern"):{valid:!0}}function kr(e,t){let n=[],o=[],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(F.broken(e.length,t)){let f={file:`(${e.length} files)`,message:F.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.`,o.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:o,canDeploy:y}}function gn(e){return e.filter(t=>t.status===b.READY)}function Kr(e){return gn(e).length>0}var be=_(()=>{"use strict";D();De();D()});function pt(e){return Tn.test(e)}var En,Tn,ft=_(()=>{"use strict";En=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],Tn=new RegExp(En.join("|"))});function dt(e,t){if(!e||e.length===0)return[];if(!t?.allowUnbuilt&&e.find(o=>o&&j(o)))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 o=n.replace(/\\/g,"/").split("/").filter(Boolean);if(o.length===0)return!0;let l=o[o.length-1];if(pt(l))return!1;for(let h of o)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let p=o.slice(0,-1);for(let h of p)if(An.some(y=>h.toLowerCase()===y.toLowerCase()))return!1;return!0})}var An,Re=_(()=>{"use strict";D();ft();An=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function mt(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 ht(e,t){let n=re(e,t);if(n)throw m.business(n.sentence(e,t))}function yt(e,t){if(F.broken(e,t))throw m.business(F.sentence(e,t))}var Ie=_(()=>{"use strict";D();De()});async function gt(e,t={},n){let o=!!(t.build||t.prerender),l=ut(e.map(d=>d.path),{flatten:t.pathDetect!==!1}).map(d=>d.path),p=new Set(dt(l,{allowUnbuilt:o})),h=e.map((d,T)=>({source:d,deployPath:l[T]})).filter(({deployPath:d})=>p.has(d));if(h.length===0)return[];let y=o?null:Sn(n),f=[],E=0;for(let{source:d,deployPath:T}of h){if(y&&mt(T,d.origin),d.size===0)continue;y&&(E+=d.size,ht({path:T,size:d.size,totalSize:E},y));let L=await d.read(),{md5:M}=await Q(L);f.push({path:T,content:L,size:d.size,md5:M})}return y&&yt(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 Et=_(()=>{"use strict";D();ge();Re();Z();Ie()});var At={};Lt(At,{processFilesForBrowser:()=>Tt});async function Tt(e,t={},n){if(ct()!=="browser")throw m.business("processFilesForBrowser can only be called in a browser environment.");return gt(e.map(o=>({path:o.webkitRelativePath||o.name,origin:o.name,size:o.size,read:async()=>o})),t,n)}var _e=_(()=>{"use strict";D();Et();Te()});D();D();D();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 o=this.handlers.get(t);o&&(o.delete(n),o.size===0&&this.handlers.delete(t))}emit(t,...n){let o=this.handlers.get(t);if(!o)return;let l=Array.from(o);for(let p of l)try{p(...n)}catch(h){o.delete(p),t!=="error"&&setTimeout(()=>{let y=h instanceof Error?h:new Error(String(h));this.emit("error",y,String(t))},0)}}};var Zt=3e4,en=2,tn=300,nn=2e3,rn=new Set([500,502,503,504]);function on(e,t){return new Promise((n,o)=>{if(t?.aborted){o(t.reason);return}let l=()=>{clearTimeout(h),t?.removeEventListener("abort",p)},p=()=>{l(),o(t?.reason)},h=setTimeout(()=>{l(),n()},e);t?.addEventListener("abort",p)})}var We=3e5,sn=3e5,an=We+sn,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??Zt,this.maxRetries=Math.max(0,n.maxRetries??en),this.fetch=n.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:n.deployEndpoint||A.DEPLOYMENTS,timeout:n.timeout??We,buildTimeout:n.timeout??an}}setGlobalHeaders(n){this.globalHeaders=n}async executeRequest(n,o,l,p=this.timeout){for(let h=0;;h++)try{return await this.attemptOnce(n,o,l,p)}catch(y){let f=m.fromFetchError(y,l);if(h>=this.maxRetries||!this.isRetryable(f,o))throw this.emit("error",f,n),f;this.emit("retry",f,n,h+1);let E=Math.min(nn,tn*2**h);try{await on(Math.random()*E,o.signal)}catch(d){let T=m.fromFetchError(d,l);throw this.emit("error",T,n),T}}}isRetryable(n,o){if(o.signal?.aborted||n.isType(g.Maintenance)||n.isType(g.Cancelled)||!(n.isNetworkError()||n.status!==void 0&&rn.has(n.status)))return!1;let p=(o.method??"GET").toUpperCase();return p==="GET"||p==="HEAD"?!0:p==="PUT"||p==="DELETE"?!1:this.hasIdempotencyKey(o.headers)}hasIdempotencyKey(n){if(!n)return!1;let o=C.HEADER.toLowerCase();return Object.keys(n).some(l=>l.toLowerCase()===o)}async attemptOnce(n,o,l,p=this.timeout){let h=()=>{};try{let y=await this.mergeHeaders(o.headers),f=this.createTimeoutSignal(o.signal,p);h=f.cleanup;let E={...o,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,o,l,p){let{data:h}=await this.executeRequest(`${this.apiUrl}${n}`,o,l,p);return h}async requestWithStatus(n,o,l){return this.executeRequest(`${this.apiUrl}${n}`,o,l)}async mergeHeaders(n={}){return{...this.globalHeaders,...this.caller?{[U.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...n}}createTimeoutSignal(n,o=this.timeout){let l=new AbortController,p=setTimeout(()=>l.abort(new DOMException(`Timed out after ${o}ms`,"TimeoutError")),o),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()}};D();D();async function Je(e,t={}){let{labels:n,via:o,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)),o&&f.append(I.VIA,o),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}D();Z();async function pn(){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 fn(e,t,n){let o=e.find(y=>y.path===X.INDEX_FILE||y.path===`/${X.INDEX_FILE}`);if(!o||o.size>X.MAX_INDEX_BYTES)return!1;let l;if(typeof Buffer<"u"&&Buffer.isBuffer(o.content))l=o.content.toString("utf-8");else if(typeof Blob<"u"&&o.content instanceof Blob)l=await o.content.text();else if(typeof File<"u"&&o.content instanceof File)l=await o.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 nt(e,t,n){return n.spaDetect===!1||n.spa||n.build||n.prerender||e.some(o=>o.path===x)?e:await fn(e,t,n.signal)?[...e,await pn()]:e}D();D();function H(e){if(e==null)return;if(e.length===0)return e;if(e.length>v.MAX_COUNT)throw m.validation(`Maximum ${v.MAX_COUNT} labels allowed`);let t=e.map((o,l)=>{if(typeof o!="string")throw m.validation(`Label at index ${l} must be a string`);let p=o.trim().toLowerCase();if(p.length<v.MIN_LENGTH)throw m.validation(`Labels must be at least ${v.MIN_LENGTH} characters long`);if(p.length>v.MAX_LENGTH)throw m.validation(`Labels must be no more than ${v.MAX_LENGTH} characters long`);if(!Xe.test(p))throw m.validation(`Labels must start and end with alphanumeric characters, with optional separators (${v.SEPARATORS}) between segments`);return p}),n=[...new Set(t)];if(n.length!==t.length)throw m.validation("Duplicate labels are not allowed");return n}async function rt(e){let t=e.find(l=>l.path===x||l.path===`/${x}`);if(!t)return;let n=t.content,o=typeof n.text=="function"?await n.text():t.content.toString("utf8");Ke(o)}var ee={"Content-Type":"application/json"},dn="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 it(e){let{getApi:t,processInput:n}=e;return{upload:async(o,l={})=>{if(!n)throw m.config("processInput function is not provided.");let p=t(),h=await n(o,l),y=await nt(h,p,l);if(!y.length)throw m.business("No files to deploy");for(let O of y)if(!O.md5)throw m.file(`MD5 checksum missing for file: ${O.path}`,{filePath:O.path});me(l.password);let f=fe(l.ttl),E=ve(l.idempotencyKey),d=H(l.labels);await rt(y);let T=qe(l.buildCommand),L=Ye(l.outputDir),M=l.build||l.prerender||l.spa?{build:l.build,prerender:l.prerender,spa:l.spa,buildCommand:T,outputDir:L}:void 0,ie=await Je(y,{labels:d,via:l.via??dn,password:l.password,ttl:f,flags:M,captcha:l.captcha});return p.request(p.deploy.endpoint,{method:"POST",body:ie,...E?{headers:{[C.HEADER]:E}}:{},signal:l.signal||null},"Deploy",l.build||l.prerender?p.deploy.buildTimeout:p.deploy.timeout)},list:async o=>t().request(`${A.DEPLOYMENTS}${he(o)}`,{method:"GET"},"List deployments"),get:async o=>t().request(A.DEPLOYMENT(encodeURIComponent(o)),{method:"GET"},"Get deployment"),set:async(o,l)=>t().request(A.DEPLOYMENT(encodeURIComponent(o)),{method:"PATCH",headers:ee,body:JSON.stringify({labels:H(l.labels)})},"Update deployment labels"),delete:async o=>t().request(A.DEPLOYMENT(encodeURIComponent(o)),{method:"DELETE"},"Delete deployment")}}function ot(e){let{getApi:t}=e;return{set:async(n,o={})=>{let l=H(o.labels),p={};o.deployment&&(p.deployment=o.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 st(e){let{getApi:t}=e;return{get:async()=>t().request(A.ACCOUNT,{method:"GET"},"Get account")}}function at(e){let{getApi:t}=e;return{create:async(n={})=>{let o=fe(n.ttl),l=H(n.labels),p={};return o!==void 0&&(p.ttl=o),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&&Ve(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=it({...n,processInput:async(o,l)=>this.processInput(o,l,await this.getLimits({signal:l.signal}))}),this.domains=ot(n),this.account=st(n),this.tokens=at(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}`}}};D();D();ge();Te();be();Re();Z();Ie();function Zr(e,t,n,o=!0){let l=e===1?t:n;return o?`${e} ${l}`:l}_e();var Le=class extends te{async deploy(t,n){return super.deploy(t,n)}async processInput(t,n,o){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(),At));return l(t,n,o)}},Ii=Le;export{Un as ACCOUNT_HEADER,Be as API_KEY,A as API_PATHS,Mn as AUTH_BASE_PATH,Nn as AccountPlan,wn as AccountRefusal,W as ApiHttp,se as AuthMethod,$ as BUILD_SETTINGS,U as CALLER,de as DEFAULT_API,x as DEPLOYMENT_CONFIG_FILENAME,I as DEPLOY_FIELDS,Cn as DEPLOY_FILE_GRAMMAR,He as DEPLOY_TOKEN,bn as DeploymentStatus,xt as DeploymentVia,Rn as DomainStatus,In as DomainVerification,g as ErrorType,b as FILE_VALIDATION_STATUS,b as FileValidationStatus,C as IDEMPOTENCY_KEY_CONSTRAINTS,An as JUNK_DIRECTORIES,v as LABEL_CONSTRAINTS,Xe as LABEL_PATTERN,qn as MY_API_KEY_URL,Ge as OAUTH_TOKEN,Bn as OAuthScope,z as PASSWORD_CONSTRAINTS,Yn as PUBLIC_DEPLOYMENT_TTL_SECONDS,Vt as SECTIONS,_n as SETUP_TROUBLESHOOTING_ANCHOR,jn as SHIP_ENV,Xn as SHIP_VIA_ENV,X as SPA_CHECK_CONSTRAINTS,ke as SPA_DEFAULT_CONFIG,Le as Ship,m as ShipError,V as TTL_CONSTRAINTS,P as TokenKind,Bt as UNBUILT_PROJECT_MARKERS,$t as UNSAFE_FILENAME_CHARS,Oe as USAGE_KIND,Jn as USER_VISIBLE_EVENTS,Fn as WEB_FILE_ACCEPT,Fr as __setTestEnvironment,Vn as accountOfPath,Kr as allValidFilesReady,Ke as assertShipJsonSyntax,Kn as billingReturnOf,Q as calculateMD5,Ht as classifyToken,Xt as consolePaths,wt as countPhrase,st as createAccountResource,it as createDeploymentResource,ot as createDomainResource,at as createTokenResource,Ii as default,rr as deserializeLabels,Yt as doorOf,kn as doors,zn as errandOf,xn as excessOver,Zn as extractSubdomain,dt as filterJunk,On as fitPhrase,Qt as formatDuration,B as formatFileSize,Wn as formatTimeRemaining,er as generateDeploymentUrl,tr as generateDomainUrl,ct as getENV,gn as getValidFiles,j as hasUnbuiltMarker,$e as hasUnsafeChars,Ue as isBlockedExtension,Wt as isClaimPath,Qn as isCustomDomain,Gn as isDeployment,je as isPlatformDomain,Me as isShipError,Jt as isUpgradePath,Ln as normalizeVia,ut as optimizeDeployPaths,Pn as personName,vn as personShortName,Ot as placesTaken,Zr as pluralize,Tt as processFilesForBrowser,$n as readBearerValue,nr as serializeLabels,Gt as validateApiKey,Hn as validateApiUrl,qe as validateBuildCommand,Ve as validateCaller,yt as validateDeployCount,ht as validateDeployFile,mt as validateDeployPath,kt as validateDeployToken,Se as validateFileName,kr as validateFiles,ve as validateIdempotencyKey,Kt as validateOAuthToken,Ye as validateOutputDir,me as validatePassword,pe as validateToken,fe as validateTtl};
2
2
  //# sourceMappingURL=browser.js.map