@shipstatic/ship 3.6.0-beta.0 → 3.6.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/THIRD-PARTY-LICENSES.md +1 -1
- package/dist/browser.d.ts +16 -7
- package/dist/browser.js +1 -1
- package/dist/browser.js.map +1 -1
- package/dist/cli.cjs +36 -36
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -7
- package/dist/index.d.ts +16 -7
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/THIRD-PARTY-LICENSES.md
CHANGED
package/dist/browser.d.ts
CHANGED
|
@@ -2908,9 +2908,9 @@ declare function generateDomainUrl(domain: string): string;
|
|
|
2908
2908
|
* between them. The whole label, the key and the `:` and the value together,
|
|
2909
2909
|
* counts toward {@link LABEL_CONSTRAINTS.MAX_LENGTH}.
|
|
2910
2910
|
*
|
|
2911
|
-
* The platform stores a label and shows it as
|
|
2912
|
-
* a key or a value and changes no behaviour because of one: a
|
|
2913
|
-
* a resource and lets its owner find it. So a resource may carry several
|
|
2911
|
+
* The platform stores a label in lowercase and shows it as stored. It reads
|
|
2912
|
+
* nothing from a key or a value and changes no behaviour because of one: a
|
|
2913
|
+
* label describes a resource and lets its owner find it. So a resource may carry several
|
|
2914
2914
|
* values for one key (`team:web` and `team:api`), and only the same label
|
|
2915
2915
|
* twice is refused.
|
|
2916
2916
|
*
|
|
@@ -2920,14 +2920,19 @@ declare function generateDomainUrl(domain: string): string;
|
|
|
2920
2920
|
declare const LABEL_CONSTRAINTS: {
|
|
2921
2921
|
/** Minimum label length in characters. */
|
|
2922
2922
|
readonly MIN_LENGTH: 3;
|
|
2923
|
-
/**
|
|
2923
|
+
/**
|
|
2924
|
+
* Maximum label length in characters. A key, its `:` and its value share it,
|
|
2925
|
+
* and it fits a key with a UUID (36 characters) or a full git SHA (40).
|
|
2926
|
+
*/
|
|
2924
2927
|
readonly MAX_LENGTH: 63;
|
|
2925
2928
|
/** Maximum number of labels on one resource. */
|
|
2926
2929
|
readonly MAX_COUNT: 10;
|
|
2927
2930
|
};
|
|
2928
2931
|
/**
|
|
2929
|
-
* The shape of a label: one
|
|
2930
|
-
*
|
|
2932
|
+
* The shape of a label: one side, or two with a `:` between them. A side is
|
|
2933
|
+
* lowercase letters and digits with single `.`, `_` or `-` between them, and
|
|
2934
|
+
* the pattern spells it twice. Length is {@link LABEL_CONSTRAINTS}' rule, and
|
|
2935
|
+
* {@link validateLabel} applies both.
|
|
2931
2936
|
*
|
|
2932
2937
|
* Matches: `production`, `v1.2.3`, `env:production`, `commit:3f9c2ab`
|
|
2933
2938
|
* Refuses: `-prod`, `foo--bar`, `:production`, `env:`, `a:b:c`, `Env:Prod`
|
|
@@ -2953,9 +2958,13 @@ declare function validateLabel(value: unknown): string;
|
|
|
2953
2958
|
* an empty array returns as is, which is how an update clears every label.
|
|
2954
2959
|
* At most {@link LABEL_CONSTRAINTS.MAX_COUNT}, and no label twice after
|
|
2955
2960
|
* normalization.
|
|
2961
|
+
*
|
|
2962
|
+
* It takes any value, like the other checks here, because two callers hand it
|
|
2963
|
+
* one the compiler has not seen: the API's multipart door (a parsed JSON
|
|
2964
|
+
* field) and an SDK caller without TypeScript.
|
|
2956
2965
|
*/
|
|
2957
2966
|
declare function validateLabels(labels: string[]): string[];
|
|
2958
|
-
declare function validateLabels(labels:
|
|
2967
|
+
declare function validateLabels(labels: unknown): string[] | undefined;
|
|
2959
2968
|
/**
|
|
2960
2969
|
* Serialize labels array to JSON string for database storage.
|
|
2961
2970
|
* Returns null for empty or undefined arrays.
|
package/dist/browser.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var Dt=Object.create;var G=Object.defineProperty;var St=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,i)=>{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:!(i=St(t,l))||i.enumerable});return e};var k=(e,t,n)=>(n=e!=null?Dt(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 xn(e){if(!e||typeof e!="string")return;let t=e.trim().toLowerCase();return Object.values(xt).includes(t)?t:void 0}function Ce(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 wt(e){return e.members+e.invitations}function On(e,t){let n=Math.max(0,wt(e)-t.members),i=Math.max(0,e.members-t.members),l={members:i,invitations:n-i,customDomains:e.customDomains-t.customDomains,platformDomains:e.platformDomains-t.platformDomains};return Object.fromEntries(Object.entries(l).filter(([,p])=>p>0))}function Ot(e){return Me(["members","customDomains","platformDomains"].filter(t=>(e[t]??0)>0).map(t=>Fe(t,e[t]??0)))}function Pn(e){let t=Ot(e),n=e.invitations??0;return Me([...t?[`remove ${t}`]:[],...n>0?[`cancel ${Fe("invitations",n)}`]:[]])}function Cn(e){return e.name?.trim()||e.email}function Fn(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 Ue(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 $e(e,t){let n=Mt(e);return n===null?!1:Array.isArray(t)?t.includes(n):t.has(n)}function Be(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(He.PREFIX)?P.API_KEY:e.startsWith(Ge.PREFIX)?P.DEPLOY_TOKEN:e.startsWith(ke.PREFIX)?P.OAUTH:P.OPAQUE}function Hn(e){return e.slice(0,ae.length).toLowerCase()!==ae?null:e.slice(ae.length)||null}function ze(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,n;try{n=JSON.parse(t)}catch(i){throw m.config(`invalid JSON format in config: ${i.message}`,{filePath:x})}if(n===null||typeof n!="object"||Array.isArray(n))throw m.config(`${x} must contain a JSON object`,{filePath:x})}function ce(e,t,n){if(!e.startsWith(t.PREFIX))throw m.validation(`${n} must start with "${t.PREFIX}"`);if(e.length!==t.TOTAL_LENGTH)throw m.validation(`${n} must be ${t.TOTAL_LENGTH} characters total (${t.PREFIX} + ${t.HEX_LENGTH} hex chars)`);let i=e.slice(t.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${t.HEX_LENGTH}}$`,"i").test(i))throw m.validation(`${n} must contain ${t.HEX_LENGTH} hexadecimal characters after "${t.PREFIX}" prefix`)}function Gt(e){ce(e,He,"API key")}function kt(e){ce(e,Ge,"Deploy token")}function Kt(e){ce(e,ke,"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>$.MAX_LENGTH||!$.PATTERN.test(e))throw m.validation(`Caller must be 1-${$.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function kn(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 Ue(t)?t:m.validation("API URL must be a valid URL")}}function Kn(e){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(e)}function fe(e){if(e!=null){if(typeof e!="number"||!Number.isFinite(e))throw m.validation("TTL must be a number of seconds");if(!Number.isInteger(e))throw m.validation("TTL must be a whole number of seconds");if(e<z.MIN_SECONDS||e>z.MAX_SECONDS)throw m.validation(`TTL must be between ${z.MIN_SECONDS} and ${z.MAX_SECONDS} seconds`);return e}}function Xt(e){let t=e?`/${e}`:"",n=i=>`${t}${i}`;return{dashboard:()=>t||"/",newSite:()=>n("/new"),deployments:Object.assign(()=>n("/deployments"),{upload:()=>n("/deployments/upload")}),domains:Object.assign(()=>n("/domains"),{connect:i=>n(`/domains/${i}/connect`),deployment:i=>n(`/domains/${i}/deployment`)}),settings:i=>n(i?`/settings#${i}`:"/settings"),claim:i=>n(`/claim/${i}`),settingsAfterBilling:()=>n(`/settings?${Oe("portal")}`),upgrade:i=>n(i?`/upgrade/${i}`:"/upgrade"),success:()=>n("/success"),successAfterCheckout:()=>n(`/success?${Oe("checkout")}`),apiKey:()=>n("/api-key")}}function Vn(e){let t=new URLSearchParams(e);for(let[n,[i,l]]of Object.entries(je))if(t.get(i)===l)return n;return null}function q(e){let t=e.split(/[?#]/)[0].toLowerCase(),[n="",i=""]=t.split("/").filter(Boolean);return 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(i)?i:null}}function jn(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 Xn(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 Qn(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 H(e,t=1){if(e===0)return"0 Bytes";let n=1024,i=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**l).toFixed(t))} ${i[l]}`}function Xe(e,t){return e.endsWith(`.${t}`)}function er(e,t){return!Xe(e,t)}function tr(e,t){return Xe(e,t)?e.slice(0,-(t.length+1)):null}function nr(e){return`https://${e}`}function rr(e){return`https://${e}`}function en(e){if(typeof e!="string")throw m.validation("Labels must be strings");let t=e.trim().toLowerCase();if(t.length<v.MIN_LENGTH)throw m.validation(`Labels must be at least ${v.MIN_LENGTH} characters long`);if(t.length>v.MAX_LENGTH)throw m.validation(`Labels must be no more than ${v.MAX_LENGTH} characters long`);if(!Zt.test(t))throw m.validation("Labels use letters and numbers, with . _ or - between them, and can have one : between a key and a value, like env:production");return t}function F(e){if(e==null)return;if(!Array.isArray(e))throw m.validation("Labels must be an array");if(e.length>v.MAX_COUNT)throw m.validation(`Maximum ${v.MAX_COUNT} labels allowed`);let t=e.map(en);if(new Set(t).size!==t.length)throw m.validation("Duplicate labels are not allowed");return t}function or(e){return!e||e.length===0?null:JSON.stringify(e)}function ir(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>B.COMMAND_MAX_LENGTH)throw m.validation(`Build command must be between 1 and ${B.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(t))throw m.validation("Build command must be a single line");return t}function 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>B.OUTPUT_DIR_MAX_LENGTH)throw m.validation(`Output folder must be between 1 and ${B.OUTPUT_DIR_MAX_LENGTH} characters`);if(!B.OUTPUT_DIR_PATTERN.test(t)||t.split("/").some(n=>n===".."||n==="."))throw m.validation("Output folder must be a relative path inside the project, like dist or dist/site");return t}function me(e){if(e==null)return;if(typeof e!="string")throw m.validation("Password must be a string");let t=e.trim();if(t.length<V.MIN_LENGTH||t.length>V.MAX_LENGTH)throw m.validation(`Password must be between ${V.MIN_LENGTH} and ${V.MAX_LENGTH} characters`);return t}var In,xt,_n,Ln,Nn,C,wn,we,Fe,Me,vn,A,I,Mn,g,Pt,ie,vt,Ct,m,Ut,Un,$t,Bt,$n,se,He,Ge,ke,$,Bn,P,ae,Gn,x,Ke,X,z,zt,Vt,jt,je,Oe,le,zn,qt,Pe,Wt,Jt,de,qn,Yn,Wn,Jn,Zn,b,v,ve,Zt,B,V,S=_(()=>{"use strict";In={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"},_n={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},Ln={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},Nn="troubleshooting",C={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};wn={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"};we={deployments:{one:"deployment",many:"deployments"},platformDomains:{one:"ShipStatic domain",many:"ShipStatic domains"},customDomains:{one:"custom domain",many:"custom domains"},members:{one:"member",many:"members"},invitations:{one:"invitation",many:"invitations"}};Fe=(e,t)=>`${t} ${t===1?we[e].one:we[e].many}`,Me=e=>e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e[0]??"",vn={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"},Mn={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]),ie={client:new Set([g.Build,g.Business,g.Cancelled,g.Config,g.File,g.Forbidden,g.NotFound,g.RateLimit,g.Validation]),network:new Set([g.Network,g.Timeout]),auth:new Set([g.Authentication])},vt=new Set(Object.values(g).filter(e=>!Pt.has(e))),Ct=200;m=class e extends Error{constructor(n,i,l,p){super(i);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,i=this.type===g.Authentication&&n?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:i}}static async fromHttpResponse(n,i){let l,p,h;try{if(n.headers.get("content-type")?.includes("application/json")){let d=await n.json();if(d&&typeof d=="object"){let T=d;typeof T.message=="string"?l=T.message:typeof T.error=="string"&&(l=T.error),p=T.details,typeof T.error=="string"&&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||`${i||"Request"} failed with status ${n.status}`;let f=h??(n.status===401?g.Authentication:n.status===403?g.Forbidden:n.status===429?g.RateLimit:g.Api);return new e(f,l,n.status,p)}static fromFetchError(n,i){if(Ue(n))return n;let l=i||"Request",p=n?.name;return p==="AbortError"?e.cancelled(`${l} was cancelled`):p==="TimeoutError"?e.timeout(`${l} timed out`,{cause:n}):n instanceof Error?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,i){return new e(g.Validation,n,400,i)}static notFound(n,i){let l=i?`${n} ${i} not found`:`${n} not found`;return new e(g.NotFound,l,404)}static forbidden(n,i){return new e(g.Forbidden,n,403,i)}static rateLimit(n="Too many requests",i){return new e(g.RateLimit,n,429,i)}static authentication(n="Authentication required",i){return new e(g.Authentication,n,401,i)}static business(n,i=400,l){return new e(g.Business,n,i,l)}static network(n,i){return new e(g.Network,n,void 0,i)}static timeout(n,i){return new e(g.Timeout,n,void 0,i)}static cancelled(n,i){return new e(g.Cancelled,n,void 0,i)}static file(n,i){return new e(g.File,n,void 0,i)}static config(n,i){return new e(g.Config,n,void 0,i)}static api(n,i=500,l){return new e(g.Api,n,i,l)}static maintenance(n,i){return new e(g.Maintenance,n,503,i)}static build(n,i){return new e(g.Build,n,422,i)}isClientError(){return ie.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return ie.network.has(this.type)}isAuthError(){return ie.auth.has(this.type)}isType(n){return this.type===n}};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"],Un=Ut.map(e=>`.${e}`).join(","),$t=/[\x00-\x1f\x7f#?%\\<>"]/;Bt=new Set(["node_modules","package.json"]);$n="/auth",se={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",SYSTEM:"system"},He={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},Ge={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},ke={PREFIX:"oauth-",HEX_LENGTH:32,TOTAL_LENGTH:38},$={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},Bn="X-Account",P={API_KEY:se.API_KEY,DEPLOY_TOKEN:se.TOKEN,OAUTH:se.OAUTH,OPAQUE:"opaque"};ae="bearer ";Gn={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};z={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};zt={new:{owner:!1},deployments:{owner:!1},domains:{owner:!1},settings:{owner:!1},claim:{owner:!1},upgrade:{owner:!0},success:{owner:!0},"api-key":{owner:!0}},Vt=["login","register","logout","invitation","consent"],jt="admin",je={checkout:["upgrading","true"],portal:["billing","returned"]},Oe=e=>je[e].join("="),le=(e,t)=>t?`${e}?next=${encodeURIComponent(t)}`:e;zn={login:({token:e,next:t}={})=>le(e?`/login/${e}`:"/login",t),register:({next:e}={})=>le("/register",e),logout:({next:e}={})=>le("/logout",e),invitation:e=>`/invitation/${e}`,consent:()=>"/consent"};qt=e=>Vt.includes(e),Pe=e=>Object.hasOwn(zt,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",qn={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},Yn="SHIP_VIA",Wn=`https://my.shipstatic.com${Xt().apiKey()}`,Jn=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"],b={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};v={MIN_LENGTH:3,MAX_LENGTH:63,MAX_COUNT:10},ve="[a-z0-9]+(?:[._-][a-z0-9]+)*",Zt=new RegExp(`^${ve}(?::${ve})?$`);B={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};V={MIN_LENGTH:6,MAX_LENGTH:128}});var 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 i(c,u,o,r,a,s){return u=t(t(u,c),t(r,s)),t(u<<a|u>>>32-a,o)}function l(c,u){var o=c[0],r=c[1],a=c[2],s=c[3];o+=(r&a|~r&s)+u[0]-680876936|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[1]-389564586|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[2]+606105819|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[3]-1044525330|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&s)+u[4]-176418897|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[5]+1200080426|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[6]-1473231341|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[7]-45705983|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&s)+u[8]+1770035416|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[9]-1958414417|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[10]-42063|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[11]-1990404162|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&s)+u[12]+1804603682|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[13]-40341101|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[14]-1502002290|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[15]+1236535329|0,r=(r<<22|r>>>10)+a|0,o+=(r&s|a&~s)+u[1]-165796510|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[6]-1069501632|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[11]+643717713|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[0]-373897302|0,r=(r<<20|r>>>12)+a|0,o+=(r&s|a&~s)+u[5]-701558691|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[10]+38016083|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[15]-660478335|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[4]-405537848|0,r=(r<<20|r>>>12)+a|0,o+=(r&s|a&~s)+u[9]+568446438|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[14]-1019803690|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[3]-187363961|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[8]+1163531501|0,r=(r<<20|r>>>12)+a|0,o+=(r&s|a&~s)+u[13]-1444681467|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[2]-51403784|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[7]+1735328473|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[12]-1926607734|0,r=(r<<20|r>>>12)+a|0,o+=(r^a^s)+u[5]-378558|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[8]-2022574463|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[11]+1839030562|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[14]-35309556|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^s)+u[1]-1530992060|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[4]+1272893353|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[7]-155497632|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[10]-1094730640|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^s)+u[13]+681279174|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[0]-358537222|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[3]-722521979|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[6]+76029189|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^s)+u[9]-640364487|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[12]-421815835|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[15]+530742520|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[2]-995338651|0,r=(r<<23|r>>>9)+a|0,o+=(a^(r|~s))+u[0]-198630844|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[7]+1126891415|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[14]-1416354905|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[5]-57434055|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~s))+u[12]+1700485571|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[3]-1894986606|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[10]-1051523|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[1]-2054922799|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~s))+u[8]+1873313359|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[15]-30611744|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[6]-1560198380|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[13]+1309151649|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~s))+u[4]-145523070|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[11]-1120210379|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[2]+718787259|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[9]-343485551|0,r=(r<<21|r>>>11)+a|0,c[0]=o+c[0]|0,c[1]=r+c[1]|0,c[2]=a+c[2]|0,c[3]=s+c[3]|0}function p(c){var u=[],o;for(o=0;o<64;o+=4)u[o>>2]=c.charCodeAt(o)+(c.charCodeAt(o+1)<<8)+(c.charCodeAt(o+2)<<16)+(c.charCodeAt(o+3)<<24);return u}function h(c){var u=[],o;for(o=0;o<64;o+=4)u[o>>2]=c[o]+(c[o+1]<<8)+(c[o+2]<<16)+(c[o+3]<<24);return u}function y(c){var u=c.length,o=[1732584193,-271733879,-1732584194,271733878],r,a,s,R,N,O;for(r=64;r<=u;r+=64)l(o,p(c.substring(r-64,r)));for(c=c.substring(r-64),a=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)s[r>>2]|=c.charCodeAt(r)<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(l(o,s),r=0;r<16;r+=1)s[r]=0;return R=u*8,R=R.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(R[2],16),O=parseInt(R[1],16)||0,s[14]=N,s[15]=O,l(o,s),o}function f(c){var u=c.length,o=[1732584193,-271733879,-1732584194,271733878],r,a,s,R,N,O;for(r=64;r<=u;r+=64)l(o,h(c.subarray(r-64,r)));for(c=r-64<u?c.subarray(r-64):new Uint8Array(0),a=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)s[r>>2]|=c[r]<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(l(o,s),r=0;r<16;r+=1)s[r]=0;return R=u*8,R=R.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(R[2],16),O=parseInt(R[1],16)||0,s[14]=N,s[15]=O,l(o,s),o}function E(c){var u="",o;for(o=0;o<4;o+=1)u+=n[c>>o*8+4&15]+n[c>>o*8&15];return u}function d(c){var u;for(u=0;u<c.length;u+=1)c[u]=E(c[u]);return c.join("")}d(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(t=function(c,u){var o=(c&65535)+(u&65535),r=(c>>16)+(u>>16)+(o>>16);return r<<16|o&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function c(u,o){return u=u|0||0,u<0?Math.max(u+o,0):Math.min(u,o)}ArrayBuffer.prototype.slice=function(u,o){var r=this.byteLength,a=c(u,r),s=r,R,N,O,Ne;return o!==e&&(s=c(o,r)),a>s?new ArrayBuffer(0):(R=s-a,N=new ArrayBuffer(R),O=new Uint8Array(N),Ne=new Uint8Array(this,a,R),O.set(Ne),N)}})();function T(c){return/[\u0080-\uFFFF]/.test(c)&&(c=unescape(encodeURIComponent(c))),c}function L(c,u){var o=c.length,r=new ArrayBuffer(o),a=new Uint8Array(r),s;for(s=0;s<o;s+=1)a[s]=c.charCodeAt(s);return u?a:r}function U(c){return String.fromCharCode.apply(null,new Uint8Array(c))}function oe(c,u,o){var r=new Uint8Array(c.byteLength+u.byteLength);return r.set(new Uint8Array(c)),r.set(new Uint8Array(u),c.byteLength),o?r:r.buffer}function w(c){var u=[],o=c.length,r;for(r=0;r<o-1;r+=2)u.push(parseInt(c.substr(r,2),16));return String.fromCharCode.apply(String,u)}function D(){this.reset()}return D.prototype.append=function(c){return this.appendBinary(T(c)),this},D.prototype.appendBinary=function(c){this._buff+=c,this._length+=c.length;var u=this._buff.length,o;for(o=64;o<=u;o+=64)l(this._hash,p(this._buff.substring(o-64,o)));return this._buff=this._buff.substring(o-64),this},D.prototype.end=function(c){var u=this._buff,o=u.length,r,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s;for(r=0;r<o;r+=1)a[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(a,o),s=d(this._hash),c&&(s=w(s)),this.reset(),s},D.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},D.prototype.setState=function(c){return this._buff=c.buff,this._length=c.length,this._hash=c.hash,this},D.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},D.prototype._finish=function(c,u){var o=u,r,a,s;if(c[o>>2]|=128<<(o%4<<3),o>55)for(l(this._hash,c),o=0;o<16;o+=1)c[o]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(r[2],16),s=parseInt(r[1],16)||0,c[14]=a,c[15]=s,l(this._hash,c)},D.hash=function(c,u){return D.hashBinary(T(c),u)},D.hashBinary=function(c,u){var o=y(c),r=d(o);return u?w(r):r},D.ArrayBuffer=function(){this.reset()},D.ArrayBuffer.prototype.append=function(c){var u=oe(this._buff.buffer,c,!0),o=u.length,r;for(this._length+=c.byteLength,r=64;r<=o;r+=64)l(this._hash,h(u.subarray(r-64,r)));return this._buff=r-64<o?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},D.ArrayBuffer.prototype.end=function(c){var u=this._buff,o=u.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a,s;for(a=0;a<o;a+=1)r[a>>2]|=u[a]<<(a%4<<3);return this._finish(r,o),s=d(this._hash),c&&(s=w(s)),this.reset(),s},D.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.ArrayBuffer.prototype.getState=function(){var c=D.prototype.getState.call(this);return c.buff=U(c.buff),c},D.ArrayBuffer.prototype.setState=function(c){return c.buff=L(c.buff,!0),D.prototype.setState.call(this,c)},D.ArrayBuffer.prototype.destroy=D.prototype.destroy,D.ArrayBuffer.prototype._finish=D.prototype._finish,D.ArrayBuffer.hash=function(c,u){var o=f(new Uint8Array(c)),r=d(o);return u?w(r):r},D})});var J=xe((mr,tt)=>{"use strict";tt.exports={}});async function cn(e){let t=(await Promise.resolve().then(()=>k(et(),1))).default,n=new t.ArrayBuffer,i=2097152;for(let l=0;l<e.size;l+=i){let p=Math.min(l+i,e.size);n.append(await e.slice(l,p).arrayBuffer())}return{md5:n.end()}}async function pn(e){let{createHash:t}=await Promise.resolve().then(()=>k(J(),1)),n=t("md5");return n.update(e),{md5:n.digest("hex")}}async function fn(e){let{createHash:t}=await Promise.resolve().then(()=>k(J(),1)),{createReadStream:n}=await Promise.resolve().then(()=>k(J(),1));return new Promise((i,l)=>{let p=t("md5"),h=n(e);h.on("error",y=>l(m.file(`Failed to read file for MD5: ${y.message}`,{filePath:e}))),h.on("data",y=>p.update(y)),h.on("end",()=>i({md5:p.digest("hex")}))})}async function Q(e){if(e instanceof Blob)return cn(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return pn(e);if(typeof e=="string")return fn(e);throw m.business("Invalid input for MD5 calculation")}var Z=_(()=>{"use strict";S()});function ne(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var lt=_(()=>{"use strict"});function ut(e,t={}){if(t.flatten===!1)return e.map(i=>({path:ne(i),name:ye(i)}));let n=yn(e);return e.map(i=>{let l=ne(i);if(n){let p=n.endsWith("/")?n:`${n}/`;l.startsWith(p)&&(l=l.substring(p.length))}return l||(l=ye(i)),{path:l,name:ye(i)}})}function yn(e){if(!e.length)return"";let n=e.map(p=>ne(p)).map(p=>p.split("/")),i=[],l=Math.min(...n.map(p=>p.length));for(let p=0;p<l-1;p++){let h=n[0][p];if(n.every(y=>y[p]===h))i.push(h);else break}return i.join("/")}function ye(e){return e.split(/[/\\]/).pop()||e}var ge=_(()=>{"use strict";lt()});function Ur(e){Ee=e}function gn(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function ct(){return Ee||gn()}var Ee,Te=_(()=>{"use strict";Ee=null});function Ae(e,t,n){let i=t.suggestions?.[n];return i?`${e} ${i}`:e}function re(e,t){return En.find(n=>n.broken(e,t))}var En,M,Se=_(()=>{"use strict";S();be();En=[{name:"name",broken:({path:e})=>!De(e).valid,sentence:({path:e})=>De(e).reason??`File name "${e}" is invalid.`},{name:"extension",broken:({path:e},t)=>$e(e,t.blockedExtensions??[]),sentence:({path:e})=>`File "${e}" has an extension that is not allowed.`},{name:"fileSize",broken:({size:e},t)=>e>t.maxFileSize,sentence:({path:e},t)=>Ae(`File "${e}" is too large. Maximum ${H(t.maxFileSize)} allowed.`,t,"maxFileSize")},{name:"totalSize",broken:({totalSize:e},t)=>e>t.maxTotalSize,sentence:({totalSize:e},t)=>Ae(`Files add up to ${H(e)}. Maximum ${H(t.maxTotalSize)} allowed.`,t,"maxTotalSize")}],M={name:"filesCount",broken:(e,t)=>e>t.maxFilesCount,sentence:(e,t)=>Ae(`Too many files (${e}). Maximum ${t.maxFilesCount} files allowed.`,t,"maxFilesCount")}});function De(e){let t=l=>({valid:!1,reason:`File name "${e}" ${l}.`});if(Be(e))return t("contains unsafe characters");if(e.startsWith(" ")||e.endsWith(" "))return t("cannot start or end with spaces");if(e.endsWith("."))return t("cannot end with dots");let n=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,i=e.split("/").pop()||e;return n.test(i)?t("uses a reserved system name"):e.includes("..")?t("contains a path traversal pattern"):{valid:!0}}function zr(e,t){let n=[],i=[],l=[];if(e.length===0){let f={file:"(no files)",message:"At least one file must be provided."};return n.push(f),{files:[],validFiles:[],errors:n,warnings:[],canDeploy:!1}}for(let f of e)if(j(f.name))return n.push({file:f.name,message:"Unbuilt project detected. Deploy your build output (dist/, build/, out/), not the project folder."}),{files:e.map(E=>({...E,status:b.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:n,warnings:[],canDeploy:!1};if(M.broken(e.length,t)){let f={file:`(${e.length} files)`,message:M.sentence(e.length,t)};return n.push(f),{files:e.map(E=>({...E,status:b.VALIDATION_FAILED,statusMessage:f.message})),validFiles:[],errors:n,warnings:[],canDeploy:!1}}let p=0;for(let f of e){let E=b.READY,d="Ready for upload";if(f.status===b.PROCESSING_ERROR)E=b.VALIDATION_FAILED,d=f.statusMessage||`File "${f.name}" could not be read.`,n.push({file:f.name,message:d});else if(f.size===0){E=b.EXCLUDED,d=`File "${f.name}" is empty, so it is excluded.`,i.push({file:f.name,message:d}),l.push({...f,status:E,statusMessage:d});continue}else if(f.size<0)E=b.VALIDATION_FAILED,d=`File "${f.name}" reports a negative size.`,n.push({file:f.name,message:d});else if(!f.name||f.name.trim().length===0)E=b.VALIDATION_FAILED,d="File name cannot be empty.",n.push({file:f.name||"(empty)",message:d});else if(f.name.includes("\0"))E=b.VALIDATION_FAILED,d=`File name "${f.name}" contains invalid characters (null byte).`,n.push({file:f.name,message:d});else{let T={path:f.name,size:f.size,totalSize:p+f.size},L=re(T,t);L?(E=b.VALIDATION_FAILED,d=L.sentence(T,t),n.push({file:L.name==="totalSize"?`(${e.length} files)`:f.name,message:d})):p=T.totalSize}l.push({...f,status:E,statusMessage:d})}n.length>0&&(l=l.map(f=>f.status===b.EXCLUDED?f:{...f,status:b.VALIDATION_FAILED,statusMessage:f.status===b.VALIDATION_FAILED?f.statusMessage:"Deployment failed due to validation errors in bundle"}));let h=n.length===0?l.filter(f=>f.status===b.READY):[],y=n.length===0;return{files:l,validFiles:h,errors:n,warnings:i,canDeploy:y}}function Tn(e){return e.filter(t=>t.status===b.READY)}function Vr(e){return Tn(e).length>0}var be=_(()=>{"use strict";S();Se();S()});function pt(e){return Dn.test(e)}var An,Dn,ft=_(()=>{"use strict";An=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],Dn=new RegExp(An.join("|"))});function dt(e,t){if(!e||e.length===0)return[];if(!t?.allowUnbuilt&&e.find(i=>i&&j(i)))throw m.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return e.filter(n=>{if(!n)return!1;let i=n.replace(/\\/g,"/").split("/").filter(Boolean);if(i.length===0)return!0;let l=i[i.length-1];if(pt(l))return!1;for(let h of i)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let p=i.slice(0,-1);for(let h of p)if(Sn.some(y=>h.toLowerCase()===y.toLowerCase()))return!1;return!0})}var Sn,Re=_(()=>{"use strict";S();ft();Sn=["__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(M.broken(e,t))throw m.business(M.sentence(e,t))}var Ie=_(()=>{"use strict";S();Se()});async function gt(e,t={},n){let i=!!(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:i})),h=e.map((d,T)=>({source:d,deployPath:l[T]})).filter(({deployPath:d})=>p.has(d));if(h.length===0)return[];let y=i?null:bn(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:U}=await Q(L);f.push({path:T,content:L,size:d.size,md5:U})}return y&&yt(f.length,y),f}function bn(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";S();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(i=>({path:i.webkitRelativePath||i.name,origin:i.name,size:i.size,read:async()=>i})),t,n)}var _e=_(()=>{"use strict";S();Et();Te()});S();S();S();var Y=class{constructor(){this.handlers=new Map}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t)?.add(n)}off(t,n){let i=this.handlers.get(t);i&&(i.delete(n),i.size===0&&this.handlers.delete(t))}emit(t,...n){let i=this.handlers.get(t);if(!i)return;let l=Array.from(i);for(let p of l)try{p(...n)}catch(h){i.delete(p),t!=="error"&&setTimeout(()=>{let y=h instanceof Error?h:new Error(String(h));this.emit("error",y,String(t))},0)}}};var tn=3e4,nn=2,rn=300,on=2e3,sn=new Set([500,502,503,504]);function an(e,t){return new Promise((n,i)=>{if(t?.aborted){i(t.reason);return}let l=()=>{clearTimeout(h),t?.removeEventListener("abort",p)},p=()=>{l(),i(t?.reason)},h=setTimeout(()=>{l(),n()},e);t?.addEventListener("abort",p)})}var We=3e5,ln=3e5,un=We+ln,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??tn,this.maxRetries=Math.max(0,n.maxRetries??nn),this.fetch=n.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:n.deployEndpoint||A.DEPLOYMENTS,timeout:n.timeout??We,buildTimeout:n.timeout??un}}setGlobalHeaders(n){this.globalHeaders=n}async executeRequest(n,i,l,p=this.timeout){for(let h=0;;h++)try{return await this.attemptOnce(n,i,l,p)}catch(y){let f=m.fromFetchError(y,l);if(h>=this.maxRetries||!this.isRetryable(f,i))throw this.emit("error",f,n),f;this.emit("retry",f,n,h+1);let E=Math.min(on,rn*2**h);try{await an(Math.random()*E,i.signal)}catch(d){let T=m.fromFetchError(d,l);throw this.emit("error",T,n),T}}}isRetryable(n,i){if(i.signal?.aborted||n.isType(g.Maintenance)||n.isType(g.Cancelled)||!(n.isNetworkError()||n.status!==void 0&&sn.has(n.status)))return!1;let p=(i.method??"GET").toUpperCase();return p==="GET"||p==="HEAD"?!0:p==="PUT"||p==="DELETE"?!1:this.hasIdempotencyKey(i.headers)}hasIdempotencyKey(n){if(!n)return!1;let i=C.HEADER.toLowerCase();return Object.keys(n).some(l=>l.toLowerCase()===i)}async attemptOnce(n,i,l,p=this.timeout){let h=()=>{};try{let y=await this.mergeHeaders(i.headers),f=this.createTimeoutSignal(i.signal,p);h=f.cleanup;let E={...i,headers:y,credentials:this.session&&!y.Authorization?"include":void 0,signal:f.signal};this.emit("request",n,E);let d=await this.fetch(n,E);if(h(),!d.ok)throw await m.fromHttpResponse(d,l);return this.emit("response",this.safeClone(d),n),{data:await this.parseResponse(this.safeClone(d)),status:d.status}}catch(y){throw h(),m.fromFetchError(y,l)}}async request(n,i,l,p){let{data:h}=await this.executeRequest(`${this.apiUrl}${n}`,i,l,p);return h}async requestWithStatus(n,i,l){return this.executeRequest(`${this.apiUrl}${n}`,i,l)}async mergeHeaders(n={}){return{...this.globalHeaders,...this.caller?{[$.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...n}}createTimeoutSignal(n,i=this.timeout){let l=new AbortController,p=setTimeout(()=>l.abort(new DOMException(`Timed out after ${i}ms`,"TimeoutError")),i),h=n?()=>l.abort(n.reason):void 0;return n&&h&&(n.addEventListener("abort",h),n.aborted&&l.abort(n.reason)),{signal:l.signal,cleanup:()=>{clearTimeout(p),n&&h&&n.removeEventListener("abort",h)}}}safeClone(n){try{return n.clone()}catch{return n}}async parseResponse(n){if(!(n.headers.get("Content-Length")==="0"||n.status===204))return n.json()}};S();S();async function Je(e,t={}){let{labels:n,via:i,password:l,ttl:p,flags:h,captcha:y}=t,f=new FormData,E=[];for(let d of e){if(typeof d.content=="string"||d.content===null||d.content===void 0)throw m.file(`Unsupported file.content type: ${d.path}`,{filePath:d.path});if(!d.md5)throw m.file(`File missing md5 checksum: ${d.path}`,{filePath:d.path});f.append(I.FILES,new File([d.content],d.path,{type:"application/octet-stream"})),E.push(d.md5)}return f.append(I.CHECKSUMS,JSON.stringify(E)),n&&n.length>0&&f.append(I.LABELS,JSON.stringify(n)),i&&f.append(I.VIA,i),l&&f.append(I.PASSWORD,l),p!==void 0&&f.append(I.TTL,String(p)),h?.build&&f.append(I.BUILD,"true"),h?.prerender&&f.append(I.PRERENDER,"true"),h?.spa&&f.append(I.SPA,"true"),h?.buildCommand&&f.append(I.BUILD_COMMAND,h.buildCommand),h?.outputDir&&f.append(I.OUTPUT_DIR,h.outputDir),y&&f.append(I.CAPTCHA,y),f}S();Z();async function dn(){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 mn(e,t,n){let i=e.find(y=>y.path===X.INDEX_FILE||y.path===`/${X.INDEX_FILE}`);if(!i||i.size>X.MAX_INDEX_BYTES)return!1;let l;if(typeof Buffer<"u"&&Buffer.isBuffer(i.content))l=i.content.toString("utf-8");else if(typeof Blob<"u"&&i.content instanceof Blob)l=await i.content.text();else if(typeof File<"u"&&i.content instanceof File)l=await i.content.text();else return!1;let p={files:e.map(y=>y.path),index:l};return(await t.request(A.SPA_CHECK,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p),signal:n??null},"SPA check")).isSPA}async function nt(e,t,n){return n.spaDetect===!1||n.spa||n.build||n.prerender||e.some(i=>i.path===x)?e:await mn(e,t,n.signal)?[...e,await dn()]:e}S();S();async function rt(e){let t=e.find(l=>l.path===x||l.path===`/${x}`);if(!t)return;let n=t.content,i=typeof n.text=="function"?await n.text():t.content.toString("utf8");ze(i)}var ee={"Content-Type":"application/json"},hn="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 ot(e){let{getApi:t,processInput:n}=e;return{upload:async(i,l={})=>{if(!n)throw m.config("processInput function is not provided.");let p=t(),h=await n(i,l),y=await nt(h,p,l);if(!y.length)throw m.business("No files to deploy");for(let w of y)if(!w.md5)throw m.file(`MD5 checksum missing for file: ${w.path}`,{filePath:w.path});me(l.password);let f=fe(l.ttl),E=Ce(l.idempotencyKey),d=F(l.labels);await rt(y);let T=qe(l.buildCommand),L=Ye(l.outputDir),U=l.build||l.prerender||l.spa?{build:l.build,prerender:l.prerender,spa:l.spa,buildCommand:T,outputDir:L}:void 0,oe=await Je(y,{labels:d,via:l.via??hn,password:l.password,ttl:f,flags:U,captcha:l.captcha});return p.request(p.deploy.endpoint,{method:"POST",body:oe,...E?{headers:{[C.HEADER]:E}}:{},signal:l.signal||null},"Deploy",l.build||l.prerender?p.deploy.buildTimeout:p.deploy.timeout)},list:async i=>t().request(`${A.DEPLOYMENTS}${he(i)}`,{method:"GET"},"List deployments"),get:async i=>t().request(A.DEPLOYMENT(encodeURIComponent(i)),{method:"GET"},"Get deployment"),set:async(i,l)=>t().request(A.DEPLOYMENT(encodeURIComponent(i)),{method:"PATCH",headers:ee,body:JSON.stringify({labels:F(l.labels)})},"Update deployment labels"),delete:async i=>t().request(A.DEPLOYMENT(encodeURIComponent(i)),{method:"DELETE"},"Delete deployment")}}function it(e){let{getApi:t}=e;return{set:async(n,i={})=>{let l=F(i.labels),p={};i.deployment&&(p.deployment=i.deployment),l!==void 0&&(p.labels=l);let{data:h,status:y}=await t().requestWithStatus(A.DOMAIN(encodeURIComponent(n)),{method:"PUT",headers:ee,body:JSON.stringify(p)},"Set domain");return{...h,isCreate:y===201}},list:async n=>t().request(`${A.DOMAINS}${he(n)}`,{method:"GET"},"List domains"),get:async n=>t().request(A.DOMAIN(encodeURIComponent(n)),{method:"GET"},"Get domain"),delete:async n=>t().request(A.DOMAIN(encodeURIComponent(n)),{method:"DELETE"},"Delete domain"),verify:async n=>t().request(A.DOMAIN_VERIFY(encodeURIComponent(n)),{method:"POST"},"Verify domain"),validate:async n=>t().request(A.DOMAINS_VALIDATE,{method:"POST",headers:ee,body:JSON.stringify({domain:n})},"Validate domain"),dns:async n=>t().request(A.DOMAIN_DNS(encodeURIComponent(n)),{method:"GET"},"Get domain DNS"),records:async n=>t().request(A.DOMAIN_RECORDS(encodeURIComponent(n)),{method:"GET"},"Get domain records"),share:async n=>t().request(A.DOMAIN_SHARE(encodeURIComponent(n)),{method:"GET"},"Get domain share")}}function 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 i=fe(n.ttl),l=F(n.labels),p={};return i!==void 0&&(p.ttl=i),l!==void 0&&(p.labels=l),t().request(A.TOKENS,{method:"POST",headers:ee,body:JSON.stringify(p)},"Create token")},list:async n=>t().request(`${A.TOKENS}${he(n)}`,{method:"GET"},"List tokens"),get:async n=>t().request(A.TOKEN(encodeURIComponent(n)),{method:"GET"},"Get token"),delete:async n=>t().request(A.TOKEN(encodeURIComponent(n)),{method:"DELETE"},"Delete token")}}var te=class{constructor(t={}){this.credential=null;if(t={...t,apiUrl:t.apiUrl||void 0,token:t.token||void 0,caller:t.caller||void 0},this.clientOptions=t,t.caller!==void 0&&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=ot({...n,processInput:async(i,l)=>this.processInput(i,l,await this.getLimits({signal:l.signal}))}),this.domains=it(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}`}}};S();S();ge();Te();be();Re();Z();Ie();function to(e,t,n,i=!0){let l=e===1?t:n;return i?`${e} ${l}`:l}_e();var Le=class extends te{async deploy(t,n){return super.deploy(t,n)}async processInput(t,n,i){if(!Array.isArray(t)||!t.every(p=>p instanceof File))throw m.business("Invalid input type for browser environment. Expected File[].");if(t.length===0)throw m.business("No files to deploy.");let{processFilesForBrowser:l}=await Promise.resolve().then(()=>(_e(),At));return l(t,n,i)}},No=Le;export{Bn as ACCOUNT_HEADER,He as API_KEY,A as API_PATHS,$n as AUTH_BASE_PATH,wn as AccountPlan,vn as AccountRefusal,W as ApiHttp,se as AuthMethod,B as BUILD_SETTINGS,$ as CALLER,de as DEFAULT_API,x as DEPLOYMENT_CONFIG_FILENAME,I as DEPLOY_FIELDS,Mn as DEPLOY_FILE_GRAMMAR,Ge as DEPLOY_TOKEN,In as DeploymentStatus,xt as DeploymentVia,_n as DomainStatus,Ln as DomainVerification,g as ErrorType,b as FILE_VALIDATION_STATUS,b as FileValidationStatus,C as IDEMPOTENCY_KEY_CONSTRAINTS,Sn as JUNK_DIRECTORIES,v as LABEL_CONSTRAINTS,Zt as LABEL_PATTERN,Wn as MY_API_KEY_URL,ke as OAUTH_TOKEN,Gn as OAuthScope,V as PASSWORD_CONSTRAINTS,Jn as PUBLIC_DEPLOYMENT_TTL_SECONDS,zt as SECTIONS,Nn as SETUP_TROUBLESHOOTING_ANCHOR,qn as SHIP_ENV,Yn as SHIP_VIA_ENV,X as SPA_CHECK_CONSTRAINTS,Ke as SPA_DEFAULT_CONFIG,Le as Ship,m as ShipError,z as TTL_CONSTRAINTS,P as TokenKind,Bt as UNBUILT_PROJECT_MARKERS,$t as UNSAFE_FILENAME_CHARS,we as USAGE_KIND,Zn as USER_VISIBLE_EVENTS,Un as WEB_FILE_ACCEPT,Ur as __setTestEnvironment,jn as accountOfPath,Vr as allValidFilesReady,ze as assertShipJsonSyntax,Vn as billingReturnOf,Q as calculateMD5,Ht as classifyToken,Xt as consolePaths,Ot as countPhrase,st as createAccountResource,ot as createDeploymentResource,it as createDomainResource,at as createTokenResource,No as default,ir as deserializeLabels,Yt as doorOf,zn as doors,Xn as errandOf,On as excessOver,tr as extractSubdomain,dt as filterJunk,Pn as fitPhrase,Qt as formatDuration,H as formatFileSize,Qn as formatTimeRemaining,nr as generateDeploymentUrl,rr as generateDomainUrl,ct as getENV,Tn as getValidFiles,j as hasUnbuiltMarker,Be as hasUnsafeChars,$e as isBlockedExtension,Wt as isClaimPath,er as isCustomDomain,Kn as isDeployment,Xe as isPlatformDomain,Ue as isShipError,Jt as isUpgradePath,xn as normalizeVia,ut as optimizeDeployPaths,Cn as personName,Fn as personShortName,wt as placesTaken,to as pluralize,Tt as processFilesForBrowser,Hn as readBearerValue,or as serializeLabels,Gt as validateApiKey,kn as validateApiUrl,qe as validateBuildCommand,Ve as validateCaller,yt as validateDeployCount,ht as validateDeployFile,mt as validateDeployPath,kt as validateDeployToken,De as validateFileName,zr as validateFiles,Ce as validateIdempotencyKey,en as validateLabel,F as validateLabels,Kt as validateOAuthToken,Ye as validateOutputDir,me as validatePassword,pe as validateToken,fe as validateTtl};
|
|
1
|
+
var At=Object.create;var G=Object.defineProperty;var Dt=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var bt=Object.getPrototypeOf,Rt=Object.prototype.hasOwnProperty;var It=(e,t,n)=>t in e?G(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var _=(e,t)=>()=>(e&&(t=e(e=0)),t);var xe=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),_t=(e,t)=>{for(var n in t)G(e,n,{get:t[n],enumerable:!0})},Lt=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of St(t))!Rt.call(e,l)&&l!==n&&G(e,l,{get:()=>t[l],enumerable:!(i=Dt(t,l))||i.enumerable});return e};var k=(e,t,n)=>(n=e!=null?At(bt(e)):{},Lt(t||!e||!e.__esModule?G(n,"default",{value:e,enumerable:!0}):n,e));var z=(e,t,n)=>It(e,typeof t!="symbol"?t+"":t,n);function Nn(e){if(!e||typeof e!="string")return;let t=e.trim().toLowerCase();return Object.values(Nt).includes(t)?t:void 0}function ve(e){if(e==null)return;if(typeof e!="string")throw m.validation("Idempotency key must be a string.");let t=e.trim();if(!t)throw m.validation("Idempotency key must not be empty.");if(t.length>C.MAX_LENGTH)throw m.validation(`Idempotency key must be at most ${C.MAX_LENGTH} characters.`);return t}function xt(e){return e.members+e.invitations}function wn(e,t){let n=Math.max(0,xt(e)-t.members),i=Math.max(0,e.members-t.members),l={members:i,invitations:n-i,customDomains:e.customDomains-t.customDomains,platformDomains:e.platformDomains-t.platformDomains};return Object.fromEntries(Object.entries(l).filter(([,p])=>p>0))}function wt(e){return Fe(["members","customDomains","platformDomains"].filter(t=>(e[t]??0)>0).map(t=>Ce(t,e[t]??0)))}function On(e){let t=wt(e),n=e.invitations??0;return Fe([...t?[`remove ${t}`]:[],...n>0?[`cancel ${Ce("invitations",n)}`]:[]])}function vn(e){return e.name?.trim()||e.email}function Cn(e){return e.name?.trim().split(" ")[0]||e.email}function Ct(e){let t=e.code;return t==="ERR_INVALID_URL"?!1:typeof t=="string"?!0:e instanceof TypeError?!/\burl\b/i.test(e.message):!1}function Me(e){return e!==null&&typeof e=="object"&&"name"in e&&e.name==="ShipError"&&"status"in e}function Ft(e){let t=e.replace(/\\/g,"/").split("/").pop()??"",n=t.lastIndexOf(".");return n<=0||n===t.length-1?null:t.slice(n+1).toLowerCase()}function Ue(e,t){let n=Ft(e);return n===null?!1:Array.isArray(t)?t.includes(n):t.has(n)}function $e(e){return Ut.test(e)}function j(e){return e.replace(/\\/g,"/").split("/").filter(Boolean).some(n=>$t.has(n))}function Bt(e){return e.startsWith(Be.PREFIX)?P.API_KEY:e.startsWith(He.PREFIX)?P.DEPLOY_TOKEN:e.startsWith(Ge.PREFIX)?P.OAUTH:P.OPAQUE}function Bn(e){return e.slice(0,ae.length).toLowerCase()!==ae?null:e.slice(ae.length)||null}function ze(e){let t=e.charCodeAt(0)===65279?e.slice(1):e,n;try{n=JSON.parse(t)}catch(i){throw m.config(`invalid JSON format in config: ${i.message}`,{filePath:x})}if(n===null||typeof n!="object"||Array.isArray(n))throw m.config(`${x} must contain a JSON object`,{filePath:x})}function ce(e,t,n){if(!e.startsWith(t.PREFIX))throw m.validation(`${n} must start with "${t.PREFIX}"`);if(e.length!==t.TOTAL_LENGTH)throw m.validation(`${n} must be ${t.TOTAL_LENGTH} characters total (${t.PREFIX} + ${t.HEX_LENGTH} hex chars)`);let i=e.slice(t.PREFIX.length);if(!new RegExp(`^[a-f0-9]{${t.HEX_LENGTH}}$`,"i").test(i))throw m.validation(`${n} must contain ${t.HEX_LENGTH} hexadecimal characters after "${t.PREFIX}" prefix`)}function Ht(e){ce(e,Be,"API key")}function Gt(e){ce(e,He,"Deploy token")}function kt(e){ce(e,Ge,"OAuth access token")}function pe(e){switch(Bt(e)){case P.API_KEY:Ht(e);return;case P.DEPLOY_TOKEN:Gt(e);return;case P.OAUTH:kt(e);return;case P.OPAQUE:if(!e)throw m.validation("Token must be a non-empty string")}}function Ke(e){if(!e||e.length>$.MAX_LENGTH||!$.PATTERN.test(e))throw m.validation(`Caller must be 1-${$.MAX_LENGTH} characters: letters, digits, dots, underscores, or hyphens`)}function Gn(e){try{let t=new URL(e);if(!["http:","https:"].includes(t.protocol))throw m.validation("API URL must use http:// or https:// protocol");if(t.pathname!=="/"&&t.pathname!=="")throw m.validation("API URL must not contain a path");if(t.search||t.hash)throw m.validation("API URL must not contain query parameters or fragments")}catch(t){throw Me(t)?t:m.validation("API URL must be a valid URL")}}function kn(e){return/^[a-z]+-[a-z]+-[a-z0-9]{7}(\.[a-z0-9.-]+)?$/i.test(e)}function fe(e){if(e!=null){if(typeof e!="number"||!Number.isFinite(e))throw m.validation("TTL must be a number of seconds");if(!Number.isInteger(e))throw m.validation("TTL must be a whole number of seconds");if(e<K.MIN_SECONDS||e>K.MAX_SECONDS)throw m.validation(`TTL must be between ${K.MIN_SECONDS} and ${K.MAX_SECONDS} seconds`);return e}}function jt(e){let t=e?`/${e}`:"",n=i=>`${t}${i}`;return{dashboard:()=>t||"/",newSite:()=>n("/new"),deployments:Object.assign(()=>n("/deployments"),{upload:()=>n("/deployments/upload")}),domains:Object.assign(()=>n("/domains"),{connect:i=>n(`/domains/${i}/connect`),deployment:i=>n(`/domains/${i}/deployment`)}),settings:i=>n(i?`/settings#${i}`:"/settings"),claim:i=>n(`/claim/${i}`),settingsAfterBilling:()=>n(`/settings?${Oe("portal")}`),upgrade:i=>n(i?`/upgrade/${i}`:"/upgrade"),success:()=>n("/success"),successAfterCheckout:()=>n(`/success?${Oe("checkout")}`),apiKey:()=>n("/api-key")}}function Kn(e){let t=new URLSearchParams(e);for(let[n,[i,l]]of Object.entries(Ve))if(t.get(i)===l)return n;return null}function q(e){let t=e.split(/[?#]/)[0].toLowerCase(),[n="",i=""]=t.split("/").filter(Boolean);return Xt(n)?{kind:"door",door:n}:n===Vt?{kind:"admin"}:n===""||Pe(n)?{kind:"account",account:null,section:n===""?null:n}:{kind:"account",account:n,section:Pe(i)?i:null}}function Vn(e){let t=q(e);return t.kind==="account"?t.account:null}function qt(e){let t=q(e);return t.kind==="door"?t.door:null}function jn(e){return Yt(e)?"claim":qt(e)==="invitation"?"invite":Wt(e)?"upgrade":null}function Jt(e){let t=Math.round(e/60);if(!(t>=1))return"less than a minute";if(t<120)return ue(t,"minute");let n=Math.round(e/3600);return n<48?ue(n,"hour"):ue(Math.round(e/86400),"day")}function Jn(e,t=Date.now()/1e3){let n=e-t;return n>0?Jt(n):null}function ue(e,t){return`${e} ${t}${e===1?"":"s"}`}function H(e,t=1){if(e===0)return"0 Bytes";let n=1024,i=["Bytes","KB","MB","GB"],l=Math.floor(Math.log(e)/Math.log(n));return`${Number.parseFloat((e/n**l).toFixed(t))} ${i[l]}`}function je(e,t){return e.endsWith(`.${t}`)}function Zn(e,t){return!je(e,t)}function er(e,t){return je(e,t)?e.slice(0,-(t.length+1)):null}function tr(e){return`https://${e}`}function nr(e){return`https://${e}`}function Zt(e){if(typeof e!="string")throw m.validation("Labels must be strings");let t=e.trim().toLowerCase();if(t.length<v.MIN_LENGTH)throw m.validation(`Labels must be at least ${v.MIN_LENGTH} characters long`);if(t.length>v.MAX_LENGTH)throw m.validation(`Labels must be no more than ${v.MAX_LENGTH} characters long`);if(!Qt.test(t))throw m.validation("Labels use letters and numbers, with . _ or - between them, and can have one : between a key and a value, like env:production");return t}function F(e){if(e==null)return;if(!Array.isArray(e))throw m.validation("Labels must be an array");if(e.length>v.MAX_COUNT)throw m.validation(`Maximum ${v.MAX_COUNT} labels allowed`);let t=e.map(Zt);if(new Set(t).size!==t.length)throw m.validation("Duplicate labels are not allowed");return t}function rr(e){return!e||e.length===0?null:JSON.stringify(e)}function or(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function Xe(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Build command must be a string");let t=e.trim();if(t.length===0||t.length>B.COMMAND_MAX_LENGTH)throw m.validation(`Build command must be between 1 and ${B.COMMAND_MAX_LENGTH} characters`);if(/[\x00-\x1f\x7f]/.test(t))throw m.validation("Build command must be a single line");return t}function qe(e){if(e==null||e==="")return;if(typeof e!="string")throw m.validation("Output folder must be a string");let t=e.trim().replace(/\/+$/,"");if(t.length===0||t.length>B.OUTPUT_DIR_MAX_LENGTH)throw m.validation(`Output folder must be between 1 and ${B.OUTPUT_DIR_MAX_LENGTH} characters`);if(!B.OUTPUT_DIR_PATTERN.test(t)||t.split("/").some(n=>n===".."||n==="."))throw m.validation("Output folder must be a relative path inside the project, like dist or dist/site");return t}function me(e){if(e==null)return;if(typeof e!="string")throw m.validation("Password must be a string");let t=e.trim();if(t.length<V.MIN_LENGTH||t.length>V.MAX_LENGTH)throw m.validation(`Password must be between ${V.MIN_LENGTH} and ${V.MAX_LENGTH} characters`);return t}var Rn,Nt,In,_n,Ln,C,xn,we,Ce,Fe,Pn,A,I,Fn,g,Ot,ie,Pt,vt,m,Mt,Mn,Ut,$t,Un,se,Be,He,Ge,$,$n,P,ae,Hn,x,ke,X,K,zt,Kt,Vt,Ve,Oe,le,zn,Xt,Pe,Yt,Wt,de,Xn,qn,Yn,Wn,Qn,b,v,Qt,B,V,S=_(()=>{"use strict";Rn={PENDING:"pending",SUCCESS:"success",FAILED:"failed",DELETING:"deleting"},Nt={WEB:"web",SDK:"sdk",CLI:"cli",MCP:"mcp",GIT:"git",N8N:"n8n",GPT:"gpt",VSC:"vsc",CLD:"cld",CRS:"crs",GMN:"gmn",API:"api"},In={LIVE:"live",UNLINKED:"unlinked",UNVERIFIED:"unverified",PAUSED:"paused"},_n={PENDING:"pending",PARTIAL:"partial",VERIFIED:"verified"},Ln="troubleshooting",C={HEADER:"Idempotency-Key",MAX_LENGTH:256,WINDOW_SECONDS:1440*60};xn={FREE:"free",PRO:"pro",TEAM:"team",SCALE:"scale",SPONSORED:"sponsored"};we={deployments:{one:"deployment",many:"deployments"},platformDomains:{one:"ShipStatic domain",many:"ShipStatic domains"},customDomains:{one:"custom domain",many:"custom domains"},members:{one:"member",many:"members"},invitations:{one:"invitation",many:"invitations"}};Ce=(e,t)=>`${t} ${t===1?we[e].one:we[e].many}`,Fe=e=>e.length>1?`${e.slice(0,-1).join(", ")} and ${e[e.length-1]}`:e[0]??"",Pn={PAUSED:"paused",UNKNOWN:"unknown"};A={DEPLOYMENTS:"/deployments",DEPLOYMENT:e=>`/deployments/${e}`,DEPLOYMENT_CONFIG:e=>`/deployments/${e}/config`,DOMAINS:"/domains",DOMAIN:e=>`/domains/${e}`,DOMAIN_VERIFY:e=>`/domains/${e}/verify`,DOMAIN_DNS:e=>`/domains/${e}/dns`,DOMAIN_RECORDS:e=>`/domains/${e}/records`,DOMAIN_SHARE:e=>`/domains/${e}/share`,DOMAIN_PROPAGATION:e=>`/domains/${e}/propagation`,DOMAINS_VALIDATE:"/domains/validate",TOKENS:"/tokens",TOKEN:e=>`/tokens/${e}`,ACCOUNT:"/account",ACCOUNT_KEY:"/account/key",ACCOUNT_CLAIM:"/account/claim",ACTIVITIES:"/activities",LABELS:"/labels",LIMITS:"/limits",PLANS:"/plans",PING:"/ping",SETUP:"/setup",SPA_CHECK:"/spa-check",UPLOAD:"/upload"},I={FILES:"files[]",CHECKSUMS:"checksums",LABELS:"labels",VIA:"via",PASSWORD:"password",TTL:"ttl",BUILD:"build",PRERENDER:"prerender",SPA:"spa",BUILD_COMMAND:"buildCommand",OUTPUT_DIR:"outputDir",CAPTCHA:"captcha"},Fn={PATH:"path",CONTENT:"content",ENCODING:"encoding",DEFAULT_ENCODING:"utf-8",ENCODINGS:["utf-8","base64"]},g={Validation:"validation_failed",NotFound:"not_found",Forbidden:"forbidden",RateLimit:"rate_limit_exceeded",Authentication:"authentication_failed",Business:"business_logic_error",Api:"internal_server_error",Maintenance:"maintenance",Build:"build_failed",Network:"network_error",Timeout:"timeout_error",Cancelled:"operation_cancelled",File:"file_error",Config:"config_error"},Ot=new Set([g.Network,g.Timeout,g.Cancelled,g.File,g.Config]),ie={client:new Set([g.Build,g.Business,g.Cancelled,g.Config,g.File,g.Forbidden,g.NotFound,g.RateLimit,g.Validation]),network:new Set([g.Network,g.Timeout]),auth:new Set([g.Authentication])},Pt=new Set(Object.values(g).filter(e=>!Ot.has(e))),vt=200;m=class e extends Error{constructor(n,i,l,p){super(i);z(this,"type");z(this,"status");z(this,"details");this.type=n,this.status=l,this.details=p,this.name="ShipError"}toResponse(){let n=this.details,i=this.type===g.Authentication&&n?.internal?void 0:this.details;return{error:this.type,message:this.message,status:this.status,details:i}}static async fromHttpResponse(n,i){let l,p,h;try{if(n.headers.get("content-type")?.includes("application/json")){let d=await n.json();if(d&&typeof d=="object"){let T=d;typeof T.message=="string"?l=T.message:typeof T.error=="string"&&(l=T.error),p=T.details,typeof T.error=="string"&&Pt.has(T.error)&&(h=T.error)}}else{let d=(await n.text()).trim();d&&!d.startsWith("<")&&d.length<=vt&&(l=d)}}catch{}let y=n.headers.get("retry-after");if(y!==null){let E=y.trim(),d=/^\d+$/.test(E)?Number(E):Math.ceil((Date.parse(E)-Date.now())/1e3);if(Number.isFinite(d)&&d>=0){let T=p&&typeof p=="object"?p:{};T.retryAfter===void 0&&(p={...T,retryAfter:d})}}l=l||`${i||"Request"} failed with status ${n.status}`;let f=h??(n.status===401?g.Authentication:n.status===403?g.Forbidden:n.status===429?g.RateLimit:g.Api);return new e(f,l,n.status,p)}static fromFetchError(n,i){if(Me(n))return n;let l=i||"Request",p=n?.name;return p==="AbortError"?e.cancelled(`${l} was cancelled`):p==="TimeoutError"?e.timeout(`${l} timed out`,{cause:n}):n instanceof Error?Ct(n)?e.network(`${l} failed: ${n.message}`,{cause:n}):new e(g.Api,`${l} failed: ${n.message}`):new e(g.Api,`${l} failed: Unknown error`)}static validation(n,i){return new e(g.Validation,n,400,i)}static notFound(n,i){let l=i?`${n} ${i} not found`:`${n} not found`;return new e(g.NotFound,l,404)}static forbidden(n,i){return new e(g.Forbidden,n,403,i)}static rateLimit(n="Too many requests",i){return new e(g.RateLimit,n,429,i)}static authentication(n="Authentication required",i){return new e(g.Authentication,n,401,i)}static business(n,i=400,l){return new e(g.Business,n,i,l)}static network(n,i){return new e(g.Network,n,void 0,i)}static timeout(n,i){return new e(g.Timeout,n,void 0,i)}static cancelled(n,i){return new e(g.Cancelled,n,void 0,i)}static file(n,i){return new e(g.File,n,void 0,i)}static config(n,i){return new e(g.Config,n,void 0,i)}static api(n,i=500,l){return new e(g.Api,n,i,l)}static maintenance(n,i){return new e(g.Maintenance,n,503,i)}static build(n,i){return new e(g.Build,n,422,i)}isClientError(){return ie.client.has(this.type)?!0:this.status!==void 0&&this.status>=400&&this.status<500}isNetworkError(){return ie.network.has(this.type)}isAuthError(){return ie.auth.has(this.type)}isType(n){return this.type===n}};Mt=["html","htm","xhtml","xml","txt","md","markdown","pdf","csv","json","jsonc","webmanifest","map","toml","yaml","yml","rss","atom","css","scss","sass","less","js","mjs","cjs","jsx","ts","tsx","wasm","vue","svelte","png","jpg","jpeg","gif","webp","avif","svg","ico","bmp","tif","tiff","heic","heif","woff","woff2","ttf","otf","eot","mp3","wav","ogg","oga","opus","m4a","aac","flac","weba","mp4","webm","ogv","mov","m4v","avi","glb","gltf","usdz","vtt","srt","zip"],Mn=Mt.map(e=>`.${e}`).join(","),Ut=/[\x00-\x1f\x7f#?%\\<>"]/;$t=new Set(["node_modules","package.json"]);Un="/auth",se={SESSION:"session",API_KEY:"apiKey",TOKEN:"token",AGENT:"agent",OAUTH:"oauth",SYSTEM:"system"},Be={PREFIX:"ship-",HEX_LENGTH:32,TOTAL_LENGTH:37,HINT_LENGTH:4},He={PREFIX:"deploy-",HEX_LENGTH:32,TOTAL_LENGTH:39},Ge={PREFIX:"oauth-",HEX_LENGTH:32,TOTAL_LENGTH:38},$={HEADER:"X-Caller",MAX_LENGTH:128,PATTERN:/^[a-zA-Z0-9._-]+$/},$n="X-Account",P={API_KEY:se.API_KEY,DEPLOY_TOKEN:se.TOKEN,OAUTH:se.OAUTH,OPAQUE:"opaque"};ae="bearer ";Hn={ACCOUNT_READ:"account:read",DEPLOYMENTS_READ:"deployments:read",DEPLOYMENTS_WRITE:"deployments:write",DOMAINS_READ:"domains:read",DOMAINS_WRITE:"domains:write"},x="ship.json",ke={rewrites:[{source:"/(.*)",destination:"/index.html"}]},X={INDEX_FILE:"index.html",MAX_INDEX_BYTES:100*1024};K={MIN_SECONDS:1,MAX_SECONDS:365*24*60*60};zt={new:{owner:!1},deployments:{owner:!1},domains:{owner:!1},settings:{owner:!1},claim:{owner:!1},upgrade:{owner:!0},success:{owner:!0},"api-key":{owner:!0}},Kt=["login","register","logout","invitation","consent"],Vt="admin",Ve={checkout:["upgrading","true"],portal:["billing","returned"]},Oe=e=>Ve[e].join("="),le=(e,t)=>t?`${e}?next=${encodeURIComponent(t)}`:e;zn={login:({token:e,next:t}={})=>le(e?`/login/${e}`:"/login",t),register:({next:e}={})=>le("/register",e),logout:({next:e}={})=>le("/logout",e),invitation:e=>`/invitation/${e}`,consent:()=>"/consent"};Xt=e=>Kt.includes(e),Pe=e=>Object.hasOwn(zt,e);Yt=e=>{let t=q(e);return t.kind==="account"&&t.section==="claim"},Wt=e=>{let t=q(e);return t.kind==="account"&&t.section==="upgrade"};de="https://api.shipstatic.com",Xn={TOKEN:"SHIP_TOKEN",API_URL:"SHIP_API_URL"},qn="SHIP_VIA",Yn=`https://my.shipstatic.com${jt().apiKey()}`,Wn=4320*60;Qn=["account.create","account.update","account.delete","account.key.generate","account.plan.transition","deployment.create","deployment.update","deployment.delete","deployment.claim","domain.create","domain.update","domain.delete","domain.verify","token.create","token.consume","token.delete","member.join","member.leave","consent.grant"],b={PENDING:"pending",PROCESSING_ERROR:"processing_error",EXCLUDED:"excluded",VALIDATION_FAILED:"validation_failed",READY:"ready"};v={MIN_LENGTH:3,MAX_LENGTH:63,MAX_COUNT:10},Qt=/^[a-z0-9]+(?:[._-][a-z0-9]+)*(?::[a-z0-9]+(?:[._-][a-z0-9]+)*)?$/;B={COMMAND_MAX_LENGTH:200,OUTPUT_DIR_MAX_LENGTH:100,OUTPUT_DIR_PATTERN:/^[A-Za-z0-9._-]+(\/[A-Za-z0-9._-]+)*$/};V={MIN_LENGTH:6,MAX_LENGTH:128}});var Ze=xe((Je,Qe)=>{"use strict";(function(e){if(typeof Je=="object")Qe.exports=e();else if(typeof define=="function"&&define.amd)define(e);else{var t;try{t=window}catch{t=self}t.SparkMD5=e()}})(function(e){"use strict";var t=function(c,u){return c+u&4294967295},n=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function i(c,u,o,r,a,s){return u=t(t(u,c),t(r,s)),t(u<<a|u>>>32-a,o)}function l(c,u){var o=c[0],r=c[1],a=c[2],s=c[3];o+=(r&a|~r&s)+u[0]-680876936|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[1]-389564586|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[2]+606105819|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[3]-1044525330|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&s)+u[4]-176418897|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[5]+1200080426|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[6]-1473231341|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[7]-45705983|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&s)+u[8]+1770035416|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[9]-1958414417|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[10]-42063|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[11]-1990404162|0,r=(r<<22|r>>>10)+a|0,o+=(r&a|~r&s)+u[12]+1804603682|0,o=(o<<7|o>>>25)+r|0,s+=(o&r|~o&a)+u[13]-40341101|0,s=(s<<12|s>>>20)+o|0,a+=(s&o|~s&r)+u[14]-1502002290|0,a=(a<<17|a>>>15)+s|0,r+=(a&s|~a&o)+u[15]+1236535329|0,r=(r<<22|r>>>10)+a|0,o+=(r&s|a&~s)+u[1]-165796510|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[6]-1069501632|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[11]+643717713|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[0]-373897302|0,r=(r<<20|r>>>12)+a|0,o+=(r&s|a&~s)+u[5]-701558691|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[10]+38016083|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[15]-660478335|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[4]-405537848|0,r=(r<<20|r>>>12)+a|0,o+=(r&s|a&~s)+u[9]+568446438|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[14]-1019803690|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[3]-187363961|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[8]+1163531501|0,r=(r<<20|r>>>12)+a|0,o+=(r&s|a&~s)+u[13]-1444681467|0,o=(o<<5|o>>>27)+r|0,s+=(o&a|r&~a)+u[2]-51403784|0,s=(s<<9|s>>>23)+o|0,a+=(s&r|o&~r)+u[7]+1735328473|0,a=(a<<14|a>>>18)+s|0,r+=(a&o|s&~o)+u[12]-1926607734|0,r=(r<<20|r>>>12)+a|0,o+=(r^a^s)+u[5]-378558|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[8]-2022574463|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[11]+1839030562|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[14]-35309556|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^s)+u[1]-1530992060|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[4]+1272893353|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[7]-155497632|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[10]-1094730640|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^s)+u[13]+681279174|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[0]-358537222|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[3]-722521979|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[6]+76029189|0,r=(r<<23|r>>>9)+a|0,o+=(r^a^s)+u[9]-640364487|0,o=(o<<4|o>>>28)+r|0,s+=(o^r^a)+u[12]-421815835|0,s=(s<<11|s>>>21)+o|0,a+=(s^o^r)+u[15]+530742520|0,a=(a<<16|a>>>16)+s|0,r+=(a^s^o)+u[2]-995338651|0,r=(r<<23|r>>>9)+a|0,o+=(a^(r|~s))+u[0]-198630844|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[7]+1126891415|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[14]-1416354905|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[5]-57434055|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~s))+u[12]+1700485571|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[3]-1894986606|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[10]-1051523|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[1]-2054922799|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~s))+u[8]+1873313359|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[15]-30611744|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[6]-1560198380|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[13]+1309151649|0,r=(r<<21|r>>>11)+a|0,o+=(a^(r|~s))+u[4]-145523070|0,o=(o<<6|o>>>26)+r|0,s+=(r^(o|~a))+u[11]-1120210379|0,s=(s<<10|s>>>22)+o|0,a+=(o^(s|~r))+u[2]+718787259|0,a=(a<<15|a>>>17)+s|0,r+=(s^(a|~o))+u[9]-343485551|0,r=(r<<21|r>>>11)+a|0,c[0]=o+c[0]|0,c[1]=r+c[1]|0,c[2]=a+c[2]|0,c[3]=s+c[3]|0}function p(c){var u=[],o;for(o=0;o<64;o+=4)u[o>>2]=c.charCodeAt(o)+(c.charCodeAt(o+1)<<8)+(c.charCodeAt(o+2)<<16)+(c.charCodeAt(o+3)<<24);return u}function h(c){var u=[],o;for(o=0;o<64;o+=4)u[o>>2]=c[o]+(c[o+1]<<8)+(c[o+2]<<16)+(c[o+3]<<24);return u}function y(c){var u=c.length,o=[1732584193,-271733879,-1732584194,271733878],r,a,s,R,N,O;for(r=64;r<=u;r+=64)l(o,p(c.substring(r-64,r)));for(c=c.substring(r-64),a=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)s[r>>2]|=c.charCodeAt(r)<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(l(o,s),r=0;r<16;r+=1)s[r]=0;return R=u*8,R=R.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(R[2],16),O=parseInt(R[1],16)||0,s[14]=N,s[15]=O,l(o,s),o}function f(c){var u=c.length,o=[1732584193,-271733879,-1732584194,271733878],r,a,s,R,N,O;for(r=64;r<=u;r+=64)l(o,h(c.subarray(r-64,r)));for(c=r-64<u?c.subarray(r-64):new Uint8Array(0),a=c.length,s=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=0;r<a;r+=1)s[r>>2]|=c[r]<<(r%4<<3);if(s[r>>2]|=128<<(r%4<<3),r>55)for(l(o,s),r=0;r<16;r+=1)s[r]=0;return R=u*8,R=R.toString(16).match(/(.*?)(.{0,8})$/),N=parseInt(R[2],16),O=parseInt(R[1],16)||0,s[14]=N,s[15]=O,l(o,s),o}function E(c){var u="",o;for(o=0;o<4;o+=1)u+=n[c>>o*8+4&15]+n[c>>o*8&15];return u}function d(c){var u;for(u=0;u<c.length;u+=1)c[u]=E(c[u]);return c.join("")}d(y("hello"))!=="5d41402abc4b2a76b9719d911017c592"&&(t=function(c,u){var o=(c&65535)+(u&65535),r=(c>>16)+(u>>16)+(o>>16);return r<<16|o&65535}),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&(function(){function c(u,o){return u=u|0||0,u<0?Math.max(u+o,0):Math.min(u,o)}ArrayBuffer.prototype.slice=function(u,o){var r=this.byteLength,a=c(u,r),s=r,R,N,O,Ne;return o!==e&&(s=c(o,r)),a>s?new ArrayBuffer(0):(R=s-a,N=new ArrayBuffer(R),O=new Uint8Array(N),Ne=new Uint8Array(this,a,R),O.set(Ne),N)}})();function T(c){return/[\u0080-\uFFFF]/.test(c)&&(c=unescape(encodeURIComponent(c))),c}function L(c,u){var o=c.length,r=new ArrayBuffer(o),a=new Uint8Array(r),s;for(s=0;s<o;s+=1)a[s]=c.charCodeAt(s);return u?a:r}function U(c){return String.fromCharCode.apply(null,new Uint8Array(c))}function oe(c,u,o){var r=new Uint8Array(c.byteLength+u.byteLength);return r.set(new Uint8Array(c)),r.set(new Uint8Array(u),c.byteLength),o?r:r.buffer}function w(c){var u=[],o=c.length,r;for(r=0;r<o-1;r+=2)u.push(parseInt(c.substr(r,2),16));return String.fromCharCode.apply(String,u)}function D(){this.reset()}return D.prototype.append=function(c){return this.appendBinary(T(c)),this},D.prototype.appendBinary=function(c){this._buff+=c,this._length+=c.length;var u=this._buff.length,o;for(o=64;o<=u;o+=64)l(this._hash,p(this._buff.substring(o-64,o)));return this._buff=this._buff.substring(o-64),this},D.prototype.end=function(c){var u=this._buff,o=u.length,r,a=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],s;for(r=0;r<o;r+=1)a[r>>2]|=u.charCodeAt(r)<<(r%4<<3);return this._finish(a,o),s=d(this._hash),c&&(s=w(s)),this.reset(),s},D.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},D.prototype.setState=function(c){return this._buff=c.buff,this._length=c.length,this._hash=c.hash,this},D.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},D.prototype._finish=function(c,u){var o=u,r,a,s;if(c[o>>2]|=128<<(o%4<<3),o>55)for(l(this._hash,c),o=0;o<16;o+=1)c[o]=0;r=this._length*8,r=r.toString(16).match(/(.*?)(.{0,8})$/),a=parseInt(r[2],16),s=parseInt(r[1],16)||0,c[14]=a,c[15]=s,l(this._hash,c)},D.hash=function(c,u){return D.hashBinary(T(c),u)},D.hashBinary=function(c,u){var o=y(c),r=d(o);return u?w(r):r},D.ArrayBuffer=function(){this.reset()},D.ArrayBuffer.prototype.append=function(c){var u=oe(this._buff.buffer,c,!0),o=u.length,r;for(this._length+=c.byteLength,r=64;r<=o;r+=64)l(this._hash,h(u.subarray(r-64,r)));return this._buff=r-64<o?new Uint8Array(u.buffer.slice(r-64)):new Uint8Array(0),this},D.ArrayBuffer.prototype.end=function(c){var u=this._buff,o=u.length,r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],a,s;for(a=0;a<o;a+=1)r[a>>2]|=u[a]<<(a%4<<3);return this._finish(r,o),s=d(this._hash),c&&(s=w(s)),this.reset(),s},D.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},D.ArrayBuffer.prototype.getState=function(){var c=D.prototype.getState.call(this);return c.buff=U(c.buff),c},D.ArrayBuffer.prototype.setState=function(c){return c.buff=L(c.buff,!0),D.prototype.setState.call(this,c)},D.ArrayBuffer.prototype.destroy=D.prototype.destroy,D.ArrayBuffer.prototype._finish=D.prototype._finish,D.ArrayBuffer.hash=function(c,u){var o=f(new Uint8Array(c)),r=d(o);return u?w(r):r},D})});var J=xe((dr,et)=>{"use strict";et.exports={}});async function un(e){let t=(await Promise.resolve().then(()=>k(Ze(),1))).default,n=new t.ArrayBuffer,i=2097152;for(let l=0;l<e.size;l+=i){let p=Math.min(l+i,e.size);n.append(await e.slice(l,p).arrayBuffer())}return{md5:n.end()}}async function cn(e){let{createHash:t}=await Promise.resolve().then(()=>k(J(),1)),n=t("md5");return n.update(e),{md5:n.digest("hex")}}async function pn(e){let{createHash:t}=await Promise.resolve().then(()=>k(J(),1)),{createReadStream:n}=await Promise.resolve().then(()=>k(J(),1));return new Promise((i,l)=>{let p=t("md5"),h=n(e);h.on("error",y=>l(m.file(`Failed to read file for MD5: ${y.message}`,{filePath:e}))),h.on("data",y=>p.update(y)),h.on("end",()=>i({md5:p.digest("hex")}))})}async function Q(e){if(e instanceof Blob)return un(e);if(typeof Buffer<"u"&&Buffer.isBuffer(e))return cn(e);if(typeof e=="string")return pn(e);throw m.business("Invalid input for MD5 calculation")}var Z=_(()=>{"use strict";S()});function ne(e){return e.replace(/\\/g,"/").replace(/\/+/g,"/").replace(/^\/+/,"")}var at=_(()=>{"use strict"});function lt(e,t={}){if(t.flatten===!1)return e.map(i=>({path:ne(i),name:ye(i)}));let n=hn(e);return e.map(i=>{let l=ne(i);if(n){let p=n.endsWith("/")?n:`${n}/`;l.startsWith(p)&&(l=l.substring(p.length))}return l||(l=ye(i)),{path:l,name:ye(i)}})}function hn(e){if(!e.length)return"";let n=e.map(p=>ne(p)).map(p=>p.split("/")),i=[],l=Math.min(...n.map(p=>p.length));for(let p=0;p<l-1;p++){let h=n[0][p];if(n.every(y=>y[p]===h))i.push(h);else break}return i.join("/")}function ye(e){return e.split(/[/\\]/).pop()||e}var ge=_(()=>{"use strict";at()});function Mr(e){Ee=e}function yn(){return typeof process<"u"&&process.versions&&process.versions.node?"node":typeof window<"u"||typeof self<"u"?"browser":"unknown"}function ut(){return Ee||yn()}var Ee,Te=_(()=>{"use strict";Ee=null});function Ae(e,t,n){let i=t.suggestions?.[n];return i?`${e} ${i}`:e}function re(e,t){return gn.find(n=>n.broken(e,t))}var gn,M,Se=_(()=>{"use strict";S();be();gn=[{name:"name",broken:({path:e})=>!De(e).valid,sentence:({path:e})=>De(e).reason??`File name "${e}" is invalid.`},{name:"extension",broken:({path:e},t)=>Ue(e,t.blockedExtensions??[]),sentence:({path:e})=>`File "${e}" has an extension that is not allowed.`},{name:"fileSize",broken:({size:e},t)=>e>t.maxFileSize,sentence:({path:e},t)=>Ae(`File "${e}" is too large. Maximum ${H(t.maxFileSize)} allowed.`,t,"maxFileSize")},{name:"totalSize",broken:({totalSize:e},t)=>e>t.maxTotalSize,sentence:({totalSize:e},t)=>Ae(`Files add up to ${H(e)}. Maximum ${H(t.maxTotalSize)} allowed.`,t,"maxTotalSize")}],M={name:"filesCount",broken:(e,t)=>e>t.maxFilesCount,sentence:(e,t)=>Ae(`Too many files (${e}). Maximum ${t.maxFilesCount} files allowed.`,t,"maxFilesCount")}});function De(e){let t=l=>({valid:!1,reason:`File name "${e}" ${l}.`});if($e(e))return t("contains unsafe characters");if(e.startsWith(" ")||e.endsWith(" "))return t("cannot start or end with spaces");if(e.endsWith("."))return t("cannot end with dots");let n=/^(CON|PRN|AUX|NUL|COM[1-9]|LPT[1-9])(\.|$)/i,i=e.split("/").pop()||e;return n.test(i)?t("uses a reserved system name"):e.includes("..")?t("contains a path traversal pattern"):{valid:!0}}function zr(e,t){let n=[],i=[],l=[];if(e.length===0){let f={file:"(no files)",message:"At least one file must be provided."};return n.push(f),{files:[],validFiles:[],errors:n,warnings:[],canDeploy:!1}}for(let f of e)if(j(f.name))return n.push({file:f.name,message:"Unbuilt project detected. Deploy your build output (dist/, build/, out/), not the project folder."}),{files:e.map(E=>({...E,status:b.VALIDATION_FAILED,statusMessage:"Unbuilt project detected"})),validFiles:[],errors:n,warnings:[],canDeploy:!1};if(M.broken(e.length,t)){let f={file:`(${e.length} files)`,message:M.sentence(e.length,t)};return n.push(f),{files:e.map(E=>({...E,status:b.VALIDATION_FAILED,statusMessage:f.message})),validFiles:[],errors:n,warnings:[],canDeploy:!1}}let p=0;for(let f of e){let E=b.READY,d="Ready for upload";if(f.status===b.PROCESSING_ERROR)E=b.VALIDATION_FAILED,d=f.statusMessage||`File "${f.name}" could not be read.`,n.push({file:f.name,message:d});else if(f.size===0){E=b.EXCLUDED,d=`File "${f.name}" is empty, so it is excluded.`,i.push({file:f.name,message:d}),l.push({...f,status:E,statusMessage:d});continue}else if(f.size<0)E=b.VALIDATION_FAILED,d=`File "${f.name}" reports a negative size.`,n.push({file:f.name,message:d});else if(!f.name||f.name.trim().length===0)E=b.VALIDATION_FAILED,d="File name cannot be empty.",n.push({file:f.name||"(empty)",message:d});else if(f.name.includes("\0"))E=b.VALIDATION_FAILED,d=`File name "${f.name}" contains invalid characters (null byte).`,n.push({file:f.name,message:d});else{let T={path:f.name,size:f.size,totalSize:p+f.size},L=re(T,t);L?(E=b.VALIDATION_FAILED,d=L.sentence(T,t),n.push({file:L.name==="totalSize"?`(${e.length} files)`:f.name,message:d})):p=T.totalSize}l.push({...f,status:E,statusMessage:d})}n.length>0&&(l=l.map(f=>f.status===b.EXCLUDED?f:{...f,status:b.VALIDATION_FAILED,statusMessage:f.status===b.VALIDATION_FAILED?f.statusMessage:"Deployment failed due to validation errors in bundle"}));let h=n.length===0?l.filter(f=>f.status===b.READY):[],y=n.length===0;return{files:l,validFiles:h,errors:n,warnings:i,canDeploy:y}}function En(e){return e.filter(t=>t.status===b.READY)}function Kr(e){return En(e).length>0}var be=_(()=>{"use strict";S();Se();S()});function ct(e){return An.test(e)}var Tn,An,pt=_(()=>{"use strict";Tn=["^npm-debug\\.log$","^\\..*\\.swp$","^\\.DS_Store$","^\\.AppleDouble$","^\\.LSOverride$","^Icon\\r$","^\\._.*","^\\.Spotlight-V100(?:$|\\/)","\\.Trashes","^__MACOSX$","~$","^Thumbs\\.db$","^ehthumbs\\.db$","^[Dd]esktop\\.ini$","@eaDir$"],An=new RegExp(Tn.join("|"))});function ft(e,t){if(!e||e.length===0)return[];if(!t?.allowUnbuilt&&e.find(i=>i&&j(i)))throw m.business("Unbuilt project detected \u2014 deploy your build output (dist/, build/, out/), not the project folder");return e.filter(n=>{if(!n)return!1;let i=n.replace(/\\/g,"/").split("/").filter(Boolean);if(i.length===0)return!0;let l=i[i.length-1];if(ct(l))return!1;for(let h of i)if(h!==".well-known"&&(h.startsWith(".")||h.length>255))return!1;let p=i.slice(0,-1);for(let h of p)if(Dn.some(y=>h.toLowerCase()===y.toLowerCase()))return!1;return!0})}var Dn,Re=_(()=>{"use strict";S();pt();Dn=["__MACOSX",".Trashes",".fseventsd",".Spotlight-V100"]});function dt(e,t){if(e.includes("\0")||e.includes("/../")||e.startsWith("../")||e.endsWith("/.."))throw m.business(`Security error: Unsafe file path "${e}" for file: ${t}`)}function mt(e,t){let n=re(e,t);if(n)throw m.business(n.sentence(e,t))}function ht(e,t){if(M.broken(e,t))throw m.business(M.sentence(e,t))}var Ie=_(()=>{"use strict";S();Se()});async function yt(e,t={},n){let i=!!(t.build||t.prerender),l=lt(e.map(d=>d.path),{flatten:t.pathDetect!==!1}).map(d=>d.path),p=new Set(ft(l,{allowUnbuilt:i})),h=e.map((d,T)=>({source:d,deployPath:l[T]})).filter(({deployPath:d})=>p.has(d));if(h.length===0)return[];let y=i?null:Sn(n),f=[],E=0;for(let{source:d,deployPath:T}of h){if(y&&dt(T,d.origin),d.size===0)continue;y&&(E+=d.size,mt({path:T,size:d.size,totalSize:E},y));let L=await d.read(),{md5:U}=await Q(L);f.push({path:T,content:L,size:d.size,md5:U})}return y&&ht(f.length,y),f}function Sn(e){if(!e)throw m.config("Platform limits not provided. Deploy-mode validation requires the limits argument \u2014 pass `ship.getLimits()` result.");return e}var gt=_(()=>{"use strict";S();ge();Re();Z();Ie()});var Tt={};_t(Tt,{processFilesForBrowser:()=>Et});async function Et(e,t={},n){if(ut()!=="browser")throw m.business("processFilesForBrowser can only be called in a browser environment.");return yt(e.map(i=>({path:i.webkitRelativePath||i.name,origin:i.name,size:i.size,read:async()=>i})),t,n)}var _e=_(()=>{"use strict";S();gt();Te()});S();S();S();var Y=class{constructor(){this.handlers=new Map}on(t,n){this.handlers.has(t)||this.handlers.set(t,new Set),this.handlers.get(t)?.add(n)}off(t,n){let i=this.handlers.get(t);i&&(i.delete(n),i.size===0&&this.handlers.delete(t))}emit(t,...n){let i=this.handlers.get(t);if(!i)return;let l=Array.from(i);for(let p of l)try{p(...n)}catch(h){i.delete(p),t!=="error"&&setTimeout(()=>{let y=h instanceof Error?h:new Error(String(h));this.emit("error",y,String(t))},0)}}};var en=3e4,tn=2,nn=300,rn=2e3,on=new Set([500,502,503,504]);function sn(e,t){return new Promise((n,i)=>{if(t?.aborted){i(t.reason);return}let l=()=>{clearTimeout(h),t?.removeEventListener("abort",p)},p=()=>{l(),i(t?.reason)},h=setTimeout(()=>{l(),n()},e);t?.addEventListener("abort",p)})}var Ye=3e5,an=3e5,ln=Ye+an,W=class extends Y{constructor(n){super();this.globalHeaders={};this.apiUrl=n.apiUrl||de,this.getAuthHeadersCallback=n.getAuthHeaders,this.session=n.session??!1,this.caller=n.caller,this.timeout=n.timeout??en,this.maxRetries=Math.max(0,n.maxRetries??tn),this.fetch=n.fetch??globalThis.fetch.bind(globalThis),this.deploy={endpoint:n.deployEndpoint||A.DEPLOYMENTS,timeout:n.timeout??Ye,buildTimeout:n.timeout??ln}}setGlobalHeaders(n){this.globalHeaders=n}async executeRequest(n,i,l,p=this.timeout){for(let h=0;;h++)try{return await this.attemptOnce(n,i,l,p)}catch(y){let f=m.fromFetchError(y,l);if(h>=this.maxRetries||!this.isRetryable(f,i))throw this.emit("error",f,n),f;this.emit("retry",f,n,h+1);let E=Math.min(rn,nn*2**h);try{await sn(Math.random()*E,i.signal)}catch(d){let T=m.fromFetchError(d,l);throw this.emit("error",T,n),T}}}isRetryable(n,i){if(i.signal?.aborted||n.isType(g.Maintenance)||n.isType(g.Cancelled)||!(n.isNetworkError()||n.status!==void 0&&on.has(n.status)))return!1;let p=(i.method??"GET").toUpperCase();return p==="GET"||p==="HEAD"?!0:p==="PUT"||p==="DELETE"?!1:this.hasIdempotencyKey(i.headers)}hasIdempotencyKey(n){if(!n)return!1;let i=C.HEADER.toLowerCase();return Object.keys(n).some(l=>l.toLowerCase()===i)}async attemptOnce(n,i,l,p=this.timeout){let h=()=>{};try{let y=await this.mergeHeaders(i.headers),f=this.createTimeoutSignal(i.signal,p);h=f.cleanup;let E={...i,headers:y,credentials:this.session&&!y.Authorization?"include":void 0,signal:f.signal};this.emit("request",n,E);let d=await this.fetch(n,E);if(h(),!d.ok)throw await m.fromHttpResponse(d,l);return this.emit("response",this.safeClone(d),n),{data:await this.parseResponse(this.safeClone(d)),status:d.status}}catch(y){throw h(),m.fromFetchError(y,l)}}async request(n,i,l,p){let{data:h}=await this.executeRequest(`${this.apiUrl}${n}`,i,l,p);return h}async requestWithStatus(n,i,l){return this.executeRequest(`${this.apiUrl}${n}`,i,l)}async mergeHeaders(n={}){return{...this.globalHeaders,...this.caller?{[$.HEADER]:this.caller}:{},...await this.getAuthHeadersCallback(),...n}}createTimeoutSignal(n,i=this.timeout){let l=new AbortController,p=setTimeout(()=>l.abort(new DOMException(`Timed out after ${i}ms`,"TimeoutError")),i),h=n?()=>l.abort(n.reason):void 0;return n&&h&&(n.addEventListener("abort",h),n.aborted&&l.abort(n.reason)),{signal:l.signal,cleanup:()=>{clearTimeout(p),n&&h&&n.removeEventListener("abort",h)}}}safeClone(n){try{return n.clone()}catch{return n}}async parseResponse(n){if(!(n.headers.get("Content-Length")==="0"||n.status===204))return n.json()}};S();S();async function We(e,t={}){let{labels:n,via:i,password:l,ttl:p,flags:h,captcha:y}=t,f=new FormData,E=[];for(let d of e){if(typeof d.content=="string"||d.content===null||d.content===void 0)throw m.file(`Unsupported file.content type: ${d.path}`,{filePath:d.path});if(!d.md5)throw m.file(`File missing md5 checksum: ${d.path}`,{filePath:d.path});f.append(I.FILES,new File([d.content],d.path,{type:"application/octet-stream"})),E.push(d.md5)}return f.append(I.CHECKSUMS,JSON.stringify(E)),n&&n.length>0&&f.append(I.LABELS,JSON.stringify(n)),i&&f.append(I.VIA,i),l&&f.append(I.PASSWORD,l),p!==void 0&&f.append(I.TTL,String(p)),h?.build&&f.append(I.BUILD,"true"),h?.prerender&&f.append(I.PRERENDER,"true"),h?.spa&&f.append(I.SPA,"true"),h?.buildCommand&&f.append(I.BUILD_COMMAND,h.buildCommand),h?.outputDir&&f.append(I.OUTPUT_DIR,h.outputDir),y&&f.append(I.CAPTCHA,y),f}S();Z();async function fn(){let e=JSON.stringify(ke,null,2),t;typeof Buffer<"u"?t=Buffer.from(e,"utf-8"):t=new Blob([e],{type:"application/json"});let{md5:n}=await Q(t);return{path:x,content:t,size:e.length,md5:n}}async function dn(e,t,n){let i=e.find(y=>y.path===X.INDEX_FILE||y.path===`/${X.INDEX_FILE}`);if(!i||i.size>X.MAX_INDEX_BYTES)return!1;let l;if(typeof Buffer<"u"&&Buffer.isBuffer(i.content))l=i.content.toString("utf-8");else if(typeof Blob<"u"&&i.content instanceof Blob)l=await i.content.text();else if(typeof File<"u"&&i.content instanceof File)l=await i.content.text();else return!1;let p={files:e.map(y=>y.path),index:l};return(await t.request(A.SPA_CHECK,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(p),signal:n??null},"SPA check")).isSPA}async function tt(e,t,n){return n.spaDetect===!1||n.spa||n.build||n.prerender||e.some(i=>i.path===x)?e:await dn(e,t,n.signal)?[...e,await fn()]:e}S();S();async function nt(e){let t=e.find(l=>l.path===x||l.path===`/${x}`);if(!t)return;let n=t.content,i=typeof n.text=="function"?await n.text():t.content.toString("utf8");ze(i)}var ee={"Content-Type":"application/json"},mn="sdk";function he(e){let t=new URLSearchParams;e?.limit!==void 0&&t.set("limit",String(e.limit)),e?.cursor!==void 0&&t.set("cursor",e.cursor);let n=t.toString();return n?`?${n}`:""}function rt(e){let{getApi:t,processInput:n}=e;return{upload:async(i,l={})=>{if(!n)throw m.config("processInput function is not provided.");let p=t(),h=await n(i,l),y=await tt(h,p,l);if(!y.length)throw m.business("No files to deploy");for(let w of y)if(!w.md5)throw m.file(`MD5 checksum missing for file: ${w.path}`,{filePath:w.path});me(l.password);let f=fe(l.ttl),E=ve(l.idempotencyKey),d=F(l.labels);await nt(y);let T=Xe(l.buildCommand),L=qe(l.outputDir),U=l.build||l.prerender||l.spa?{build:l.build,prerender:l.prerender,spa:l.spa,buildCommand:T,outputDir:L}:void 0,oe=await We(y,{labels:d,via:l.via??mn,password:l.password,ttl:f,flags:U,captcha:l.captcha});return p.request(p.deploy.endpoint,{method:"POST",body:oe,...E?{headers:{[C.HEADER]:E}}:{},signal:l.signal||null},"Deploy",l.build||l.prerender?p.deploy.buildTimeout:p.deploy.timeout)},list:async i=>t().request(`${A.DEPLOYMENTS}${he(i)}`,{method:"GET"},"List deployments"),get:async i=>t().request(A.DEPLOYMENT(encodeURIComponent(i)),{method:"GET"},"Get deployment"),set:async(i,l)=>t().request(A.DEPLOYMENT(encodeURIComponent(i)),{method:"PATCH",headers:ee,body:JSON.stringify({labels:F(l.labels)})},"Update deployment labels"),delete:async i=>t().request(A.DEPLOYMENT(encodeURIComponent(i)),{method:"DELETE"},"Delete deployment")}}function ot(e){let{getApi:t}=e;return{set:async(n,i={})=>{let l=F(i.labels),p={};i.deployment&&(p.deployment=i.deployment),l!==void 0&&(p.labels=l);let{data:h,status:y}=await t().requestWithStatus(A.DOMAIN(encodeURIComponent(n)),{method:"PUT",headers:ee,body:JSON.stringify(p)},"Set domain");return{...h,isCreate:y===201}},list:async n=>t().request(`${A.DOMAINS}${he(n)}`,{method:"GET"},"List domains"),get:async n=>t().request(A.DOMAIN(encodeURIComponent(n)),{method:"GET"},"Get domain"),delete:async n=>t().request(A.DOMAIN(encodeURIComponent(n)),{method:"DELETE"},"Delete domain"),verify:async n=>t().request(A.DOMAIN_VERIFY(encodeURIComponent(n)),{method:"POST"},"Verify domain"),validate:async n=>t().request(A.DOMAINS_VALIDATE,{method:"POST",headers:ee,body:JSON.stringify({domain:n})},"Validate domain"),dns:async n=>t().request(A.DOMAIN_DNS(encodeURIComponent(n)),{method:"GET"},"Get domain DNS"),records:async n=>t().request(A.DOMAIN_RECORDS(encodeURIComponent(n)),{method:"GET"},"Get domain records"),share:async n=>t().request(A.DOMAIN_SHARE(encodeURIComponent(n)),{method:"GET"},"Get domain share")}}function it(e){let{getApi:t}=e;return{get:async()=>t().request(A.ACCOUNT,{method:"GET"},"Get account")}}function st(e){let{getApi:t}=e;return{create:async(n={})=>{let i=fe(n.ttl),l=F(n.labels),p={};return i!==void 0&&(p.ttl=i),l!==void 0&&(p.labels=l),t().request(A.TOKENS,{method:"POST",headers:ee,body:JSON.stringify(p)},"Create token")},list:async n=>t().request(`${A.TOKENS}${he(n)}`,{method:"GET"},"List tokens"),get:async n=>t().request(A.TOKEN(encodeURIComponent(n)),{method:"GET"},"Get token"),delete:async n=>t().request(A.TOKEN(encodeURIComponent(n)),{method:"DELETE"},"Delete token")}}var te=class{constructor(t={}){this.credential=null;if(t={...t,apiUrl:t.apiUrl||void 0,token:t.token||void 0,caller:t.caller||void 0},this.clientOptions=t,t.caller!==void 0&&Ke(t.caller),t.token&&t.session)throw m.config("Provide either `token` or `session`, not both.");typeof t.token=="string"?(pe(t.token),this.credential=t.token):t.token&&(this.credential=t.token),this.http=new W({...t,getAuthHeaders:()=>this.getAuthHeaders()});let n={getApi:()=>this.http};this.deployments=rt({...n,processInput:async(i,l)=>this.processInput(i,l,await this.getLimits({signal:l.signal}))}),this.domains=ot(n),this.account=it(n),this.tokens=st(n)}async ping(){return this.http.request(A.PING,{method:"GET"},"Ping")}async deploy(t,n){return this.deployments.upload(t,n)}async whoami(){return this.account.get()}async getLimits(t={}){return this.http.request(A.LIMITS,{method:"GET",signal:t.signal??null},"Get limits")}on(t,n){this.http.on(t,n)}off(t,n){this.http.off(t,n)}setHeaders(t){this.http.setGlobalHeaders(t)}clearHeaders(){this.http.setGlobalHeaders({})}setToken(t){if(this.clientOptions.session)throw m.config("Provide either `token` or `session`, not both.");if(typeof t=="string"){if(!t)throw m.business("Invalid token provided. Token must be a non-empty string.");pe(t),this.credential=t;return}if(typeof t!="function")throw m.business("Invalid token provided. Token must be a non-empty string or a provider function.");this.credential=t}async getAuthHeaders(){if(this.credential===null)return{};let t=typeof this.credential=="function"?await this.credential():this.credential;if(!t)throw m.authentication("Token provider returned no token.");if(typeof t!="string")throw m.authentication("Token provider returned a non-string value.");return{Authorization:`Bearer ${t}`}}};S();S();ge();Te();be();Re();Z();Ie();function eo(e,t,n,i=!0){let l=e===1?t:n;return i?`${e} ${l}`:l}_e();var Le=class extends te{async deploy(t,n){return super.deploy(t,n)}async processInput(t,n,i){if(!Array.isArray(t)||!t.every(p=>p instanceof File))throw m.business("Invalid input type for browser environment. Expected File[].");if(t.length===0)throw m.business("No files to deploy.");let{processFilesForBrowser:l}=await Promise.resolve().then(()=>(_e(),Tt));return l(t,n,i)}},Lo=Le;export{$n as ACCOUNT_HEADER,Be as API_KEY,A as API_PATHS,Un as AUTH_BASE_PATH,xn as AccountPlan,Pn as AccountRefusal,W as ApiHttp,se as AuthMethod,B as BUILD_SETTINGS,$ as CALLER,de as DEFAULT_API,x as DEPLOYMENT_CONFIG_FILENAME,I as DEPLOY_FIELDS,Fn as DEPLOY_FILE_GRAMMAR,He as DEPLOY_TOKEN,Rn as DeploymentStatus,Nt as DeploymentVia,In as DomainStatus,_n as DomainVerification,g as ErrorType,b as FILE_VALIDATION_STATUS,b as FileValidationStatus,C as IDEMPOTENCY_KEY_CONSTRAINTS,Dn as JUNK_DIRECTORIES,v as LABEL_CONSTRAINTS,Qt as LABEL_PATTERN,Yn as MY_API_KEY_URL,Ge as OAUTH_TOKEN,Hn as OAuthScope,V as PASSWORD_CONSTRAINTS,Wn as PUBLIC_DEPLOYMENT_TTL_SECONDS,zt as SECTIONS,Ln as SETUP_TROUBLESHOOTING_ANCHOR,Xn as SHIP_ENV,qn as SHIP_VIA_ENV,X as SPA_CHECK_CONSTRAINTS,ke as SPA_DEFAULT_CONFIG,Le as Ship,m as ShipError,K as TTL_CONSTRAINTS,P as TokenKind,$t as UNBUILT_PROJECT_MARKERS,Ut as UNSAFE_FILENAME_CHARS,we as USAGE_KIND,Qn as USER_VISIBLE_EVENTS,Mn as WEB_FILE_ACCEPT,Mr as __setTestEnvironment,Vn as accountOfPath,Kr as allValidFilesReady,ze as assertShipJsonSyntax,Kn as billingReturnOf,Q as calculateMD5,Bt as classifyToken,jt as consolePaths,wt as countPhrase,it as createAccountResource,rt as createDeploymentResource,ot as createDomainResource,st as createTokenResource,Lo as default,or as deserializeLabels,qt as doorOf,zn as doors,jn as errandOf,wn as excessOver,er as extractSubdomain,ft as filterJunk,On as fitPhrase,Jt as formatDuration,H as formatFileSize,Jn as formatTimeRemaining,tr as generateDeploymentUrl,nr as generateDomainUrl,ut as getENV,En as getValidFiles,j as hasUnbuiltMarker,$e as hasUnsafeChars,Ue as isBlockedExtension,Yt as isClaimPath,Zn as isCustomDomain,kn as isDeployment,je as isPlatformDomain,Me as isShipError,Wt as isUpgradePath,Nn as normalizeVia,lt as optimizeDeployPaths,vn as personName,Cn as personShortName,xt as placesTaken,eo as pluralize,Et as processFilesForBrowser,Bn as readBearerValue,rr as serializeLabels,Ht as validateApiKey,Gn as validateApiUrl,Xe as validateBuildCommand,Ke as validateCaller,ht as validateDeployCount,mt as validateDeployFile,dt as validateDeployPath,Gt as validateDeployToken,De as validateFileName,zr as validateFiles,ve as validateIdempotencyKey,Zt as validateLabel,F as validateLabels,kt as validateOAuthToken,qe as validateOutputDir,me as validatePassword,pe as validateToken,fe as validateTtl};
|
|
2
2
|
//# sourceMappingURL=browser.js.map
|